Compare commits

..

3 Commits

5 changed files with 288 additions and 157 deletions

View File

@@ -15,13 +15,13 @@ import {
import { import {
ChangeFeedPolicyState, ChangeFeedPolicyState,
GeospatialConfigType, GeospatialConfigType,
getSanitizedInputValue,
IsComponentDirtyResult, IsComponentDirtyResult,
isDirty,
TtlOff, TtlOff,
TtlOn, TtlOn,
TtlOnNoDefault, TtlOnNoDefault,
TtlType, TtlType,
getSanitizedInputValue,
isDirty,
} from "../SettingsUtils"; } from "../SettingsUtils";
import { ToolTipLabelComponent } from "./ToolTipLabelComponent"; import { ToolTipLabelComponent } from "./ToolTipLabelComponent";
@@ -55,6 +55,18 @@ export interface SubSettingsComponentProps {
onSubSettingsSaveableChange: (isSubSettingsSaveable: boolean) => void; onSubSettingsSaveableChange: (isSubSettingsSaveable: boolean) => void;
onSubSettingsDiscardableChange: (isSubSettingsDiscardable: boolean) => void; onSubSettingsDiscardableChange: (isSubSettingsDiscardable: boolean) => void;
} }
const stylingforvisuallyhiddenspan = {
position: "absolute",
width: "1px",
height: "1px",
margin: "-1px",
border: 0,
padding: 0,
clip: "rect(0 0 0 0)",
overflow: "hidden",
};
export class SubSettingsComponent extends React.Component<SubSettingsComponentProps> { export class SubSettingsComponent extends React.Component<SubSettingsComponentProps> {
private shouldCheckComponentIsDirty = true; private shouldCheckComponentIsDirty = true;
@@ -197,17 +209,26 @@ export class SubSettingsComponent extends React.Component<SubSettingsComponentPr
</MessageBar> </MessageBar>
)} )}
{this.props.timeToLive === TtlType.On && ( {this.props.timeToLive === TtlType.On && (
<TextField <div>
id="timeToLiveSeconds" <span id="timetoliveon" style={stylingforvisuallyhiddenspan}>
styles={getTextFieldStyles(this.props.timeToLiveSeconds, this.props.timeToLiveSecondsBaseline)} Time to live on
type="number" </span>
required <TextField
min={1} id="timeToLiveSeconds"
max={Int32.Max} styles={getTextFieldStyles(this.props.timeToLiveSeconds, this.props.timeToLiveSecondsBaseline)}
value={this.props.timeToLiveSeconds?.toString()} type="number"
onChange={this.onTimeToLiveSecondsChange} required
suffix="second(s)" min={1}
/> max={Int32.Max}
value={this.props.timeToLiveSeconds?.toString()}
onChange={this.onTimeToLiveSecondsChange}
suffix="second(s)"
aria-labelledby="timetoliveon secondssuffixforscreenreader"
/>
<span id="secondssuffixforscreenreader" style={stylingforvisuallyhiddenspan}>
Second(s)
</span>
</div>
)} )}
</Stack> </Stack>
); );

View File

@@ -59,31 +59,68 @@ exports[`SubSettingsComponent analyticalTimeToLive hidden 1`] = `
} }
} }
/> />
<StyledTextFieldBase <div>
id="timeToLiveSeconds" <span
max={2147483647} id="timetoliveon"
min={1} style={
onChange={[Function]} Object {
required={true} "border": 0,
styles={ "clip": "rect(0 0 0 0)",
Object { "height": "1px",
"fieldGroup": Object { "margin": "-1px",
"borderColor": "", "overflow": "hidden",
"height": 25, "padding": 0,
"selectors": Object { "position": "absolute",
":disabled": Object { "width": "1px",
"backgroundColor": undefined, }
"borderColor": undefined,
},
},
"width": 300,
},
} }
} >
suffix="second(s)" Time to live on
type="number" </span>
value="1000" <StyledTextFieldBase
/> aria-labelledby="timetoliveon secondssuffixforscreenreader"
id="timeToLiveSeconds"
max={2147483647}
min={1}
onChange={[Function]}
required={true}
styles={
Object {
"fieldGroup": Object {
"borderColor": "",
"height": 25,
"selectors": Object {
":disabled": Object {
"backgroundColor": undefined,
"borderColor": undefined,
},
},
"width": 300,
},
}
}
suffix="second(s)"
type="number"
value="1000"
/>
<span
id="secondssuffixforscreenreader"
style={
Object {
"border": 0,
"clip": "rect(0 0 0 0)",
"height": "1px",
"margin": "-1px",
"overflow": "hidden",
"padding": 0,
"position": "absolute",
"width": "1px",
}
}
>
Second(s)
</span>
</div>
</Stack> </Stack>
<StyledChoiceGroup <StyledChoiceGroup
id="geoSpatialConfig" id="geoSpatialConfig"
@@ -283,31 +320,68 @@ exports[`SubSettingsComponent analyticalTimeToLiveSeconds hidden 1`] = `
} }
} }
/> />
<StyledTextFieldBase <div>
id="timeToLiveSeconds" <span
max={2147483647} id="timetoliveon"
min={1} style={
onChange={[Function]} Object {
required={true} "border": 0,
styles={ "clip": "rect(0 0 0 0)",
Object { "height": "1px",
"fieldGroup": Object { "margin": "-1px",
"borderColor": "", "overflow": "hidden",
"height": 25, "padding": 0,
"selectors": Object { "position": "absolute",
":disabled": Object { "width": "1px",
"backgroundColor": undefined, }
"borderColor": undefined,
},
},
"width": 300,
},
} }
} >
suffix="second(s)" Time to live on
type="number" </span>
value="1000" <StyledTextFieldBase
/> aria-labelledby="timetoliveon secondssuffixforscreenreader"
id="timeToLiveSeconds"
max={2147483647}
min={1}
onChange={[Function]}
required={true}
styles={
Object {
"fieldGroup": Object {
"borderColor": "",
"height": 25,
"selectors": Object {
":disabled": Object {
"backgroundColor": undefined,
"borderColor": undefined,
},
},
"width": 300,
},
}
}
suffix="second(s)"
type="number"
value="1000"
/>
<span
id="secondssuffixforscreenreader"
style={
Object {
"border": 0,
"clip": "rect(0 0 0 0)",
"height": "1px",
"margin": "-1px",
"overflow": "hidden",
"padding": 0,
"position": "absolute",
"width": "1px",
}
}
>
Second(s)
</span>
</div>
</Stack> </Stack>
<StyledChoiceGroup <StyledChoiceGroup
id="geoSpatialConfig" id="geoSpatialConfig"
@@ -560,31 +634,68 @@ exports[`SubSettingsComponent changeFeedPolicy hidden 1`] = `
} }
} }
/> />
<StyledTextFieldBase <div>
id="timeToLiveSeconds" <span
max={2147483647} id="timetoliveon"
min={1} style={
onChange={[Function]} Object {
required={true} "border": 0,
styles={ "clip": "rect(0 0 0 0)",
Object { "height": "1px",
"fieldGroup": Object { "margin": "-1px",
"borderColor": "", "overflow": "hidden",
"height": 25, "padding": 0,
"selectors": Object { "position": "absolute",
":disabled": Object { "width": "1px",
"backgroundColor": undefined, }
"borderColor": undefined,
},
},
"width": 300,
},
} }
} >
suffix="second(s)" Time to live on
type="number" </span>
value="1000" <StyledTextFieldBase
/> aria-labelledby="timetoliveon secondssuffixforscreenreader"
id="timeToLiveSeconds"
max={2147483647}
min={1}
onChange={[Function]}
required={true}
styles={
Object {
"fieldGroup": Object {
"borderColor": "",
"height": 25,
"selectors": Object {
":disabled": Object {
"backgroundColor": undefined,
"borderColor": undefined,
},
},
"width": 300,
},
}
}
suffix="second(s)"
type="number"
value="1000"
/>
<span
id="secondssuffixforscreenreader"
style={
Object {
"border": 0,
"clip": "rect(0 0 0 0)",
"height": "1px",
"margin": "-1px",
"overflow": "hidden",
"padding": 0,
"position": "absolute",
"width": "1px",
}
}
>
Second(s)
</span>
</div>
</Stack> </Stack>
<StyledChoiceGroup <StyledChoiceGroup
id="geoSpatialConfig" id="geoSpatialConfig"
@@ -799,31 +910,68 @@ exports[`SubSettingsComponent renders 1`] = `
} }
} }
/> />
<StyledTextFieldBase <div>
id="timeToLiveSeconds" <span
max={2147483647} id="timetoliveon"
min={1} style={
onChange={[Function]} Object {
required={true} "border": 0,
styles={ "clip": "rect(0 0 0 0)",
Object { "height": "1px",
"fieldGroup": Object { "margin": "-1px",
"borderColor": "", "overflow": "hidden",
"height": 25, "padding": 0,
"selectors": Object { "position": "absolute",
":disabled": Object { "width": "1px",
"backgroundColor": undefined, }
"borderColor": undefined,
},
},
"width": 300,
},
} }
} >
suffix="second(s)" Time to live on
type="number" </span>
value="1000" <StyledTextFieldBase
/> aria-labelledby="timetoliveon secondssuffixforscreenreader"
id="timeToLiveSeconds"
max={2147483647}
min={1}
onChange={[Function]}
required={true}
styles={
Object {
"fieldGroup": Object {
"borderColor": "",
"height": 25,
"selectors": Object {
":disabled": Object {
"backgroundColor": undefined,
"borderColor": undefined,
},
},
"width": 300,
},
}
}
suffix="second(s)"
type="number"
value="1000"
/>
<span
id="secondssuffixforscreenreader"
style={
Object {
"border": 0,
"clip": "rect(0 0 0 0)",
"height": "1px",
"margin": "-1px",
"overflow": "hidden",
"padding": 0,
"position": "absolute",
"width": "1px",
}
}
>
Second(s)
</span>
</div>
</Stack> </Stack>
<StyledChoiceGroup <StyledChoiceGroup
id="geoSpatialConfig" id="geoSpatialConfig"

View File

@@ -1,4 +1,5 @@
import * as React from "react"; import * as React from "react";
import { AccessibleElement } from "../../Controls/AccessibleElement/AccessibleElement";
import "./TabComponent.less"; import "./TabComponent.less";
export interface TabContent { export interface TabContent {
@@ -18,15 +19,11 @@ interface TabComponentProps {
onTabIndexChange: (newIndex: number) => void; onTabIndexChange: (newIndex: number) => void;
hideHeader: boolean; hideHeader: boolean;
} }
interface TabRefs {
[key: string]: HTMLElement;
}
/** /**
* We assume there's at least one tab * We assume there's at least one tab
*/ */
export class TabComponent extends React.Component<TabComponentProps> { export class TabComponent extends React.Component<TabComponentProps> {
private tabRefs: TabRefs = {};
public constructor(props: TabComponentProps) { public constructor(props: TabComponentProps) {
super(props); super(props);
@@ -36,41 +33,11 @@ export class TabComponent extends React.Component<TabComponentProps> {
throw new Error(msg); throw new Error(msg);
} }
} }
state = {
activeTabIndex: this.props.currentTabIndex,
};
private setActiveTab(index: number): void { private setActiveTab(index: number): void {
this.setState({ activeTabIndex: index }); this.setState({ activeTabIndex: index });
this.props.onTabIndexChange(index); this.props.onTabIndexChange(index);
} }
private setIndex = (index: number) => {
const tab = this.tabRefs[index];
if (tab) {
tab.focus();
this.setState({ activeTabIndex: index });
}
};
private handlekeypress = (event: React.KeyboardEvent<HTMLSpanElement>): void => {
const { tabs, onTabIndexChange } = this.props;
const { activeTabIndex } = this.state;
const count = tabs.length;
const prevTab = () => {
this.setIndex((activeTabIndex - 1 + count) % count);
onTabIndexChange((activeTabIndex - 1 + count) % count);
};
const nextTab = () => {
this.setIndex((activeTabIndex + 1) % count);
onTabIndexChange((activeTabIndex + 1) % count);
};
if (event.key === "ArrowLeft") {
prevTab();
} else if (event.key === "ArrowRight") {
nextTab();
}
};
private renderTabTitles(): JSX.Element[] { private renderTabTitles(): JSX.Element[] {
return this.props.tabs.map((tab: Tab, index: number) => { return this.props.tabs.map((tab: Tab, index: number) => {
@@ -80,32 +47,26 @@ export class TabComponent extends React.Component<TabComponentProps> {
let className = "toggleSwitch"; let className = "toggleSwitch";
let ariaselected; let ariaselected;
let tabindex;
if (index === this.props.currentTabIndex) { if (index === this.props.currentTabIndex) {
className += " selectedToggle"; className += " selectedToggle";
ariaselected = true; ariaselected = true;
tabindex = 0;
} else { } else {
className += " unselectedToggle"; className += " unselectedToggle";
ariaselected = false; ariaselected = false;
tabindex = -1;
} }
return ( return (
<div className="tab" key={index}> <div className="tab" key={index}>
<span <AccessibleElement
as="span"
className={className} className={className}
role="tab" role="tab"
onClick={() => this.setActiveTab(index)} onActivated={() => this.setActiveTab(index)}
onKeyDown={(event: React.KeyboardEvent<HTMLSpanElement>) => this.handlekeypress(event)}
onFocus={() => this.setState({ activeTabIndex: index })}
aria-label={`Select tab: ${tab.title}`} aria-label={`Select tab: ${tab.title}`}
aria-selected={ariaselected} aria-selected={ariaselected}
tabIndex={tabindex}
ref={(element) => (this.tabRefs[index] = element)}
> >
{tab.title} {tab.title}
</span> </AccessibleElement>
</div> </div>
); );
}); });

View File

@@ -1,10 +1,10 @@
import { DefaultButton, IconButton, Image, Modal, PrimaryButton, Stack, Text } from "@fluentui/react"; import { DefaultButton, IconButton, Image, Modal, PrimaryButton, Stack, Text } from "@fluentui/react";
import { useCarousel } from "hooks/useCarousel";
import React, { useState } from "react";
import Youtube from "react-youtube";
import { Action } from "Shared/Telemetry/TelemetryConstants"; import { Action } from "Shared/Telemetry/TelemetryConstants";
import { traceSuccess } from "Shared/Telemetry/TelemetryProcessor"; import { traceSuccess } from "Shared/Telemetry/TelemetryProcessor";
import { userContext } from "UserContext"; import { userContext } from "UserContext";
import { useCarousel } from "hooks/useCarousel";
import React, { useState } from "react";
import Youtube from "react-youtube";
import Image1 from "../../../images/CarouselImage1.svg"; import Image1 from "../../../images/CarouselImage1.svg";
import Image2 from "../../../images/CarouselImage2.svg"; import Image2 from "../../../images/CarouselImage2.svg";
@@ -25,7 +25,7 @@ export const QuickstartCarousel: React.FC<QuickstartCarouselProps> = ({
<Stack> <Stack>
<Stack horizontal horizontalAlign="space-between" style={{ padding: 16 }}> <Stack horizontal horizontalAlign="space-between" style={{ padding: 16 }}>
<Text variant="xLarge">{getHeaderText(page)}</Text> <Text variant="xLarge">{getHeaderText(page)}</Text>
<IconButton iconProps={{ iconName: "Cancel" }} onClick={() => setPage(4)} /> <IconButton iconProps={{ iconName: "Cancel" }} onClick={() => setPage(4)} ariaLabel="Close"/>
</Stack> </Stack>
{getContent(page)} {getContent(page)}
<Text variant="medium" style={{ padding: "0 16px" }}> <Text variant="medium" style={{ padding: "0 16px" }}>

View File

@@ -134,6 +134,7 @@
data-bind="click: selectQueryOptions, event: { keydown: onselectQueryOptionsKeyDown }" data-bind="click: selectQueryOptions, event: { keydown: onselectQueryOptionsKeyDown }"
tabindex="0" tabindex="0"
role="button" role="button"
href=""
> >
<span>Choose Columns... </span> <span>Choose Columns... </span>
</a> </a>