@ni/nimble-components 32.9.2 → 32.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/all-components-bundle.js +412 -333
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +3561 -3521
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/combobox/index.d.ts +7 -0
  6. package/dist/esm/combobox/index.js +2 -1
  7. package/dist/esm/combobox/index.js.map +1 -1
  8. package/dist/esm/combobox/styles.js +2 -0
  9. package/dist/esm/combobox/styles.js.map +1 -1
  10. package/dist/esm/combobox/template.js +8 -3
  11. package/dist/esm/combobox/template.js.map +1 -1
  12. package/dist/esm/icon-base/styles.js +2 -2
  13. package/dist/esm/icon-base/styles.js.map +1 -1
  14. package/dist/esm/number-field/index.js +2 -1
  15. package/dist/esm/number-field/index.js.map +1 -1
  16. package/dist/esm/number-field/template.d.ts +8 -0
  17. package/dist/esm/number-field/template.js +89 -0
  18. package/dist/esm/number-field/template.js.map +1 -0
  19. package/dist/esm/patterns/required-visible/styles.d.ts +1 -0
  20. package/dist/esm/patterns/required-visible/styles.js +17 -0
  21. package/dist/esm/patterns/required-visible/styles.js.map +1 -0
  22. package/dist/esm/patterns/required-visible/template.d.ts +9 -0
  23. package/dist/esm/patterns/required-visible/template.js +20 -0
  24. package/dist/esm/patterns/required-visible/template.js.map +1 -0
  25. package/dist/esm/patterns/required-visible/testing/required-visible-pattern.pageobject.d.ts +10 -0
  26. package/dist/esm/patterns/required-visible/testing/required-visible-pattern.pageobject.js +19 -0
  27. package/dist/esm/patterns/required-visible/testing/required-visible-pattern.pageobject.js.map +1 -0
  28. package/dist/esm/patterns/required-visible/types.d.ts +17 -0
  29. package/dist/esm/patterns/required-visible/types.js +21 -0
  30. package/dist/esm/patterns/required-visible/types.js.map +1 -0
  31. package/dist/esm/radio-group/index.d.ts +7 -0
  32. package/dist/esm/radio-group/index.js +2 -1
  33. package/dist/esm/radio-group/index.js.map +1 -1
  34. package/dist/esm/radio-group/styles.js +3 -1
  35. package/dist/esm/radio-group/styles.js.map +1 -1
  36. package/dist/esm/radio-group/template.js +4 -1
  37. package/dist/esm/radio-group/template.js.map +1 -1
  38. package/dist/esm/select/index.d.ts +7 -0
  39. package/dist/esm/select/index.js +2 -1
  40. package/dist/esm/select/index.js.map +1 -1
  41. package/dist/esm/select/styles.js +2 -0
  42. package/dist/esm/select/styles.js.map +1 -1
  43. package/dist/esm/select/template.js +8 -3
  44. package/dist/esm/select/template.js.map +1 -1
  45. package/dist/esm/text-area/index.d.ts +11 -0
  46. package/dist/esm/text-area/index.js +2 -1
  47. package/dist/esm/text-area/index.js.map +1 -1
  48. package/dist/esm/text-area/styles.js +2 -0
  49. package/dist/esm/text-area/styles.js.map +1 -1
  50. package/dist/esm/text-area/template.js +6 -1
  51. package/dist/esm/text-area/template.js.map +1 -1
  52. package/dist/esm/text-field/index.js +2 -1
  53. package/dist/esm/text-field/index.js.map +1 -1
  54. package/dist/esm/text-field/template.d.ts +8 -0
  55. package/dist/esm/text-field/template.js +73 -0
  56. package/dist/esm/text-field/template.js.map +1 -0
  57. package/package.json +1 -1
@@ -0,0 +1,20 @@
1
+ import { html, when } from '@microsoft/fast-element';
2
+ import { iconAsteriskTag } from '../../icons/asterisk';
3
+ /**
4
+ * Given the template for a control label, creates a new template that includes
5
+ * an icon next to the label to indicate whether or not the control is required.
6
+ *
7
+ * This function is intended to be used with components leveraging `mixinRequiredVisiblePattern`.
8
+ */
9
+ /* eslint-disable @typescript-eslint/indent */
10
+ export function createRequiredVisibleLabelTemplate(labelTemplate) {
11
+ return html `
12
+ <div class="annotated-label">
13
+ ${labelTemplate}
14
+ ${when(x => x.requiredVisible, html `
15
+ <${iconAsteriskTag} class="required-icon" severity="error"></${iconAsteriskTag}>
16
+ `)}
17
+ </div>
18
+ `;
19
+ }
20
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/patterns/required-visible/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,IAAI,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD;;;;;GAKG;AACH,8CAA8C;AAC9C,MAAM,UAAU,kCAAkC,CAC9C,aAAmD;IAEnD,OAAO,IAAI,CAAA;;cAED,aAAa;cACb,IAAI,CACF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,EACtB,IAAI,CAAA;mBACD,eAAe,6CAA6C,eAAe;aACjF,CACA;;KAER,CAAC;AACN,CAAC","sourcesContent":["import { ViewTemplate, html, when } from '@microsoft/fast-element';\nimport { iconAsteriskTag } from '../../icons/asterisk';\nimport type { RequiredVisiblePattern } from './types';\n\n/**\n * Given the template for a control label, creates a new template that includes\n * an icon next to the label to indicate whether or not the control is required.\n *\n * This function is intended to be used with components leveraging `mixinRequiredVisiblePattern`.\n */\n/* eslint-disable @typescript-eslint/indent */\nexport function createRequiredVisibleLabelTemplate(\n labelTemplate: ViewTemplate<RequiredVisiblePattern>\n): ViewTemplate<RequiredVisiblePattern> {\n return html`\n <div class=\"annotated-label\">\n ${labelTemplate}\n ${when(\n x => x.requiredVisible,\n html`\n <${iconAsteriskTag} class=\"required-icon\" severity=\"error\"></${iconAsteriskTag}>\n `\n )}\n </div>\n `;\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import type { FoundationElement } from '@microsoft/fast-foundation';
2
+ /**
3
+ * A page object for the elements that use the required-visible mixin.
4
+ */
5
+ export declare class RequiredVisiblePatternPageObject {
6
+ private readonly element;
7
+ constructor(element: FoundationElement);
8
+ isRequiredVisibleIconVisible(): boolean;
9
+ private getRequiredVisibleIcon;
10
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * A page object for the elements that use the required-visible mixin.
3
+ */
4
+ export class RequiredVisiblePatternPageObject {
5
+ constructor(element) {
6
+ this.element = element;
7
+ }
8
+ isRequiredVisibleIconVisible() {
9
+ const icon = this.getRequiredVisibleIcon();
10
+ if (!icon) {
11
+ return false;
12
+ }
13
+ return getComputedStyle(icon).display !== 'none';
14
+ }
15
+ getRequiredVisibleIcon() {
16
+ return this.element.shadowRoot.querySelector('.required-icon');
17
+ }
18
+ }
19
+ //# sourceMappingURL=required-visible-pattern.pageobject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"required-visible-pattern.pageobject.js","sourceRoot":"","sources":["../../../../../src/patterns/required-visible/testing/required-visible-pattern.pageobject.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,gCAAgC;IACzC,YAAoC,OAA0B;QAA1B,YAAO,GAAP,OAAO,CAAmB;IAAG,CAAC;IAE3D,4BAA4B;QAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC3C,IAAI,CAAC,IAAI,EAAE,CAAC;YACR,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC;IACrD,CAAC;IAEO,sBAAsB;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,UAAW,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACpE,CAAC;CACJ","sourcesContent":["import type { FoundationElement } from '@microsoft/fast-foundation';\n\n/**\n * A page object for the elements that use the required-visible mixin.\n */\nexport class RequiredVisiblePatternPageObject {\n public constructor(private readonly element: FoundationElement) {}\n\n public isRequiredVisibleIconVisible(): boolean {\n const icon = this.getRequiredVisibleIcon();\n if (!icon) {\n return false;\n }\n return getComputedStyle(icon).display !== 'none';\n }\n\n private getRequiredVisibleIcon(): HTMLElement | null {\n return this.element.shadowRoot!.querySelector('.required-icon');\n }\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import { FASTElement } from '@microsoft/fast-element';
2
+ export interface RequiredVisiblePattern {
3
+ /**
4
+ * Whether or not to show the required appearance of the control
5
+ */
6
+ requiredVisible: boolean;
7
+ }
8
+ type FASTElementConstructor = abstract new (...args: any[]) => FASTElement;
9
+ export declare function mixinRequiredVisiblePattern<TBase extends FASTElementConstructor>(base: TBase): (abstract new (...args: any[]) => {
10
+ requiredVisible: boolean;
11
+ readonly $fastController: import("@microsoft/fast-element").Controller;
12
+ $emit(type: string, detail?: any, options?: Omit<CustomEventInit<any>, "detail"> | undefined): boolean | void;
13
+ connectedCallback(): void;
14
+ disconnectedCallback(): void;
15
+ attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
16
+ }) & TBase;
17
+ export {};
@@ -0,0 +1,21 @@
1
+ import { attr } from '@microsoft/fast-element';
2
+ // As the returned class is internal to the function, we can't write a signature that uses is directly, so rely on inference
3
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type
4
+ export function mixinRequiredVisiblePattern(base) {
5
+ /**
6
+ * The Mixin that provides the requiredVisible property and required-visible attribute
7
+ * to a component.
8
+ */
9
+ class RequiredVisibleElement extends base {
10
+ constructor() {
11
+ super(...arguments);
12
+ /*
13
+ * Show the required appearance of the control
14
+ */
15
+ this.requiredVisible = false;
16
+ }
17
+ }
18
+ attr({ attribute: 'required-visible', mode: 'boolean' })(RequiredVisibleElement.prototype, 'requiredVisible');
19
+ return RequiredVisibleElement;
20
+ }
21
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/patterns/required-visible/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAe,MAAM,yBAAyB,CAAC;AAY5D,4HAA4H;AAC5H,+HAA+H;AAC/H,MAAM,UAAU,2BAA2B,CAEzC,IAAW;IACT;;;OAGG;IACH,MAAe,sBACX,SAAQ,IAAI;QADhB;;YAGI;;eAEG;YACI,oBAAe,GAAG,KAAK,CAAC;QACnC,CAAC;KAAA;IAED,IAAI,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CACpD,sBAAsB,CAAC,SAAS,EAChC,iBAAiB,CACpB,CAAC;IACF,OAAO,sBAAsB,CAAC;AAClC,CAAC","sourcesContent":["import { attr, FASTElement } from '@microsoft/fast-element';\n\nexport interface RequiredVisiblePattern {\n /**\n * Whether or not to show the required appearance of the control\n */\n requiredVisible: boolean;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype FASTElementConstructor = abstract new (...args: any[]) => FASTElement;\n\n// As the returned class is internal to the function, we can't write a signature that uses is directly, so rely on inference\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type\nexport function mixinRequiredVisiblePattern<\n TBase extends FASTElementConstructor\n>(base: TBase) {\n /**\n * The Mixin that provides the requiredVisible property and required-visible attribute\n * to a component.\n */\n abstract class RequiredVisibleElement\n extends base\n implements RequiredVisiblePattern {\n /*\n * Show the required appearance of the control\n */\n public requiredVisible = false;\n }\n\n attr({ attribute: 'required-visible', mode: 'boolean' })(\n RequiredVisibleElement.prototype,\n 'requiredVisible'\n );\n return RequiredVisibleElement;\n}\n"]}
@@ -15,6 +15,13 @@ declare const RadioGroup_base: (abstract new (...args: any[]) => {
15
15
  connectedCallback(): void;
16
16
  disconnectedCallback(): void;
17
17
  attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
18
+ }) & (abstract new (...args: any[]) => {
19
+ requiredVisible: boolean;
20
+ readonly $fastController: import("@microsoft/fast-element").Controller;
21
+ $emit(type: string, detail?: any, options?: Omit<CustomEventInit<any>, "detail"> | undefined): boolean | void;
22
+ connectedCallback(): void;
23
+ disconnectedCallback(): void;
24
+ attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
18
25
  }) & typeof FoundationRadioGroup;
19
26
  /**
20
27
  * A nimble-styled grouping element for radio buttons
@@ -3,11 +3,12 @@ import { Orientation } from '@microsoft/fast-web-utilities';
3
3
  import { styles } from './styles';
4
4
  import { template } from './template';
5
5
  import { mixinErrorPattern } from '../patterns/error/types';
6
+ import { mixinRequiredVisiblePattern } from '../patterns/required-visible/types';
6
7
  export { Orientation };
7
8
  /**
8
9
  * A nimble-styled grouping element for radio buttons
9
10
  */
10
- export class RadioGroup extends mixinErrorPattern(FoundationRadioGroup) {
11
+ export class RadioGroup extends mixinErrorPattern(mixinRequiredVisiblePattern(FoundationRadioGroup)) {
11
12
  }
12
13
  const nimbleRadioGroup = RadioGroup.compose({
13
14
  baseName: 'radio-group',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/radio-group/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,IAAI,oBAAoB,EAClC,YAAY,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAQ5D,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,iBAAiB,CAAC,oBAAoB,CAAC;CAAG;AAE1E,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,CAAC;IACxC,QAAQ,EAAE,aAAa;IACvB,SAAS,EAAE,oBAAoB;IAC/B,QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,IAAI;KACvB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC","sourcesContent":["import {\n RadioGroup as FoundationRadioGroup,\n DesignSystem\n} from '@microsoft/fast-foundation';\nimport { Orientation } from '@microsoft/fast-web-utilities';\nimport { styles } from './styles';\nimport { template } from './template';\nimport { mixinErrorPattern } from '../patterns/error/types';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-radio-group': RadioGroup;\n }\n}\n\nexport { Orientation };\n\n/**\n * A nimble-styled grouping element for radio buttons\n */\nexport class RadioGroup extends mixinErrorPattern(FoundationRadioGroup) {}\n\nconst nimbleRadioGroup = RadioGroup.compose({\n baseName: 'radio-group',\n baseClass: FoundationRadioGroup,\n template,\n styles,\n shadowOptions: {\n delegatesFocus: true\n }\n});\n\nDesignSystem.getOrCreate().withPrefix('nimble').register(nimbleRadioGroup());\nexport const radioGroupTag = 'nimble-radio-group';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/radio-group/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,IAAI,oBAAoB,EAClC,YAAY,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAQjF,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,iBAAiB,CAC7C,2BAA2B,CAAC,oBAAoB,CAAC,CACpD;CAAG;AAEJ,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,CAAC;IACxC,QAAQ,EAAE,aAAa;IACvB,SAAS,EAAE,oBAAoB;IAC/B,QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,IAAI;KACvB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC","sourcesContent":["import {\n RadioGroup as FoundationRadioGroup,\n DesignSystem\n} from '@microsoft/fast-foundation';\nimport { Orientation } from '@microsoft/fast-web-utilities';\nimport { styles } from './styles';\nimport { template } from './template';\nimport { mixinErrorPattern } from '../patterns/error/types';\nimport { mixinRequiredVisiblePattern } from '../patterns/required-visible/types';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-radio-group': RadioGroup;\n }\n}\n\nexport { Orientation };\n\n/**\n * A nimble-styled grouping element for radio buttons\n */\nexport class RadioGroup extends mixinErrorPattern(\n mixinRequiredVisiblePattern(FoundationRadioGroup)\n) {}\n\nconst nimbleRadioGroup = RadioGroup.compose({\n baseName: 'radio-group',\n baseClass: FoundationRadioGroup,\n template,\n styles,\n shadowOptions: {\n delegatesFocus: true\n }\n});\n\nDesignSystem.getOrCreate().withPrefix('nimble').register(nimbleRadioGroup());\nexport const radioGroupTag = 'nimble-radio-group';\n"]}
@@ -2,9 +2,11 @@ import { css } from '@microsoft/fast-element';
2
2
  import { display } from '../utilities/style/display';
3
3
  import { controlLabelDisabledFontColor, controlLabelFont, controlLabelFontColor, controlLabelFontLineHeight, smallPadding, standardPadding } from '../theme-provider/design-tokens';
4
4
  import { styles as errorStyles } from '../patterns/error/styles';
5
+ import { styles as requiredVisibleStyles } from '../patterns/required-visible/styles';
5
6
  export const styles = css `
6
7
  ${display('inline-block')}
7
8
  ${errorStyles}
9
+ ${requiredVisibleStyles}
8
10
 
9
11
  .positioning-region {
10
12
  display: flex;
@@ -22,7 +24,7 @@ export const styles = css `
22
24
 
23
25
  .label-container {
24
26
  display: flex;
25
- height: ${controlLabelFontLineHeight};
27
+ min-height: ${controlLabelFontLineHeight};
26
28
  gap: ${smallPadding};
27
29
  margin-bottom: ${smallPadding};
28
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/radio-group/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACH,6BAA6B,EAC7B,gBAAgB,EAChB,qBAAqB,EACrB,0BAA0B,EAC1B,YAAY,EACZ,eAAe,EAClB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEjE,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,cAAc,CAAC;MACvB,WAAW;;;;eAIF,eAAe;;;;;;;;;;;;;;kBAcZ,0BAA0B;eAC7B,YAAY;yBACF,YAAY;;;;gBAIrB,gBAAgB;iBACf,qBAAqB;;;;iBAIrB,6BAA6B;;;;;wBAKtB,YAAY;;CAEnC,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { display } from '../utilities/style/display';\nimport {\n controlLabelDisabledFontColor,\n controlLabelFont,\n controlLabelFontColor,\n controlLabelFontLineHeight,\n smallPadding,\n standardPadding\n} from '../theme-provider/design-tokens';\nimport { styles as errorStyles } from '../patterns/error/styles';\n\nexport const styles = css`\n ${display('inline-block')}\n ${errorStyles}\n\n .positioning-region {\n display: flex;\n gap: ${standardPadding};\n position: relative;\n }\n\n :host([orientation='vertical']) .positioning-region {\n flex-direction: column;\n }\n\n :host([orientation='horizontal']) .positioning-region {\n flex-direction: row;\n }\n\n .label-container {\n display: flex;\n height: ${controlLabelFontLineHeight};\n gap: ${smallPadding};\n margin-bottom: ${smallPadding};\n }\n\n slot[name='label'] {\n font: ${controlLabelFont};\n color: ${controlLabelFontColor};\n }\n\n :host([disabled]) slot[name='label'] {\n color: ${controlLabelDisabledFontColor};\n }\n\n .error-icon {\n margin-left: auto;\n margin-right: ${smallPadding};\n }\n`;\n"]}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/radio-group/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACH,6BAA6B,EAC7B,gBAAgB,EAChB,qBAAqB,EACrB,0BAA0B,EAC1B,YAAY,EACZ,eAAe,EAClB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,MAAM,IAAI,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAEtF,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,cAAc,CAAC;MACvB,WAAW;MACX,qBAAqB;;;;eAIZ,eAAe;;;;;;;;;;;;;;sBAcR,0BAA0B;eACjC,YAAY;yBACF,YAAY;;;;gBAIrB,gBAAgB;iBACf,qBAAqB;;;;iBAIrB,6BAA6B;;;;;wBAKtB,YAAY;;CAEnC,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { display } from '../utilities/style/display';\nimport {\n controlLabelDisabledFontColor,\n controlLabelFont,\n controlLabelFontColor,\n controlLabelFontLineHeight,\n smallPadding,\n standardPadding\n} from '../theme-provider/design-tokens';\nimport { styles as errorStyles } from '../patterns/error/styles';\nimport { styles as requiredVisibleStyles } from '../patterns/required-visible/styles';\n\nexport const styles = css`\n ${display('inline-block')}\n ${errorStyles}\n ${requiredVisibleStyles}\n\n .positioning-region {\n display: flex;\n gap: ${standardPadding};\n position: relative;\n }\n\n :host([orientation='vertical']) .positioning-region {\n flex-direction: column;\n }\n\n :host([orientation='horizontal']) .positioning-region {\n flex-direction: row;\n }\n\n .label-container {\n display: flex;\n min-height: ${controlLabelFontLineHeight};\n gap: ${smallPadding};\n margin-bottom: ${smallPadding};\n }\n\n slot[name='label'] {\n font: ${controlLabelFont};\n color: ${controlLabelFontColor};\n }\n\n :host([disabled]) slot[name='label'] {\n color: ${controlLabelDisabledFontColor};\n }\n\n .error-icon {\n margin-left: auto;\n margin-right: ${smallPadding};\n }\n`;\n"]}
@@ -2,18 +2,21 @@ import { elements, html, slotted } from '@microsoft/fast-element';
2
2
  import { Orientation } from '@microsoft/fast-web-utilities';
3
3
  import { errorTextTemplate } from '../patterns/error/template';
4
4
  import { iconExclamationMarkTag } from '../icons/exclamation-mark';
5
+ import { createRequiredVisibleLabelTemplate } from '../patterns/required-visible/template';
6
+ const labelTemplate = createRequiredVisibleLabelTemplate(html `<slot name="label"></slot>`);
5
7
  /* eslint-disable @typescript-eslint/indent */
6
8
  export const template = html `
7
9
  <template
8
10
  role="radiogroup"
9
11
  aria-disabled="${x => x.disabled}"
10
12
  aria-readonly="${x => x.readOnly}"
13
+ aria-required="${x => x.requiredVisible}"
11
14
  @click="${(x, c) => x.clickHandler(c.event)}"
12
15
  @keydown="${(x, c) => x.keydownHandler(c.event)}"
13
16
  @focusout="${(x, c) => x.focusOutHandler(c.event)}"
14
17
  >
15
18
  <div class="label-container">
16
- <slot name="label"></slot>
19
+ ${labelTemplate}
17
20
  <${iconExclamationMarkTag}
18
21
  severity="error"
19
22
  class="error-icon"
@@ -1 +1 @@
1
- {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/radio-group/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,8CAA8C;AAC9C,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAY;;;yBAGf,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;yBACf,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;kBACtB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAmB,CAAC;oBAC7C,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,KAAsB,CAAC;qBACnD,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAmB,CAAC;;;;eAIxD,sBAAsB;;;iBAGpB,sBAAsB;;;wCAGC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,KAAK,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC;;;;kBAIjG,OAAO,CAAC;IACN,QAAQ,EAAE,qBAAqB;IAC/B,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC;CACnC,CAAC;;cAEJ,iBAAiB;;;CAG9B,CAAC","sourcesContent":["import { elements, html, slotted } from '@microsoft/fast-element';\nimport { Orientation } from '@microsoft/fast-web-utilities';\nimport type { RadioGroup } from '.';\nimport { errorTextTemplate } from '../patterns/error/template';\nimport { iconExclamationMarkTag } from '../icons/exclamation-mark';\n\n/* eslint-disable @typescript-eslint/indent */\nexport const template = html<RadioGroup>`\n <template\n role=\"radiogroup\"\n aria-disabled=\"${x => x.disabled}\"\n aria-readonly=\"${x => x.readOnly}\"\n @click=\"${(x, c) => x.clickHandler(c.event as MouseEvent)}\"\n @keydown=\"${(x, c) => x.keydownHandler(c.event as KeyboardEvent)}\"\n @focusout=\"${(x, c) => x.focusOutHandler(c.event as FocusEvent)}\"\n >\n <div class=\"label-container\">\n <slot name=\"label\"></slot> \n <${iconExclamationMarkTag}\n severity=\"error\"\n class=\"error-icon\"\n ></${iconExclamationMarkTag}>\n </div>\n <div\n class=\"positioning-region ${x => (x.orientation === Orientation.horizontal ? 'horizontal' : 'vertical')}\"\n part=\"positioning-region\"\n >\n <slot\n ${slotted({\n property: 'slottedRadioButtons',\n filter: elements('[role=radio]')\n })}\n ></slot>\n ${errorTextTemplate}\n </div>\n </template>\n`;\n"]}
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/radio-group/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,kCAAkC,EAAE,MAAM,uCAAuC,CAAC;AAE3F,MAAM,aAAa,GAAG,kCAAkC,CACpD,IAAI,CAAY,4BAA4B,CAC/C,CAAC;AAEF,8CAA8C;AAC9C,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAY;;;yBAGf,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;yBACf,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;yBACf,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe;kBAC7B,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAmB,CAAC;oBAC7C,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,KAAsB,CAAC;qBACnD,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAmB,CAAC;;;cAGzD,aAAa;eACZ,sBAAsB;;;iBAGpB,sBAAsB;;;wCAGC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,KAAK,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC;;;;kBAIjG,OAAO,CAAC;IACN,QAAQ,EAAE,qBAAqB;IAC/B,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC;CACnC,CAAC;;cAEJ,iBAAiB;;;CAG9B,CAAC","sourcesContent":["import { elements, html, slotted } from '@microsoft/fast-element';\nimport { Orientation } from '@microsoft/fast-web-utilities';\nimport type { RadioGroup } from '.';\nimport { errorTextTemplate } from '../patterns/error/template';\nimport { iconExclamationMarkTag } from '../icons/exclamation-mark';\nimport { createRequiredVisibleLabelTemplate } from '../patterns/required-visible/template';\n\nconst labelTemplate = createRequiredVisibleLabelTemplate(\n html<RadioGroup>`<slot name=\"label\"></slot>`\n);\n\n/* eslint-disable @typescript-eslint/indent */\nexport const template = html<RadioGroup>`\n <template\n role=\"radiogroup\"\n aria-disabled=\"${x => x.disabled}\"\n aria-readonly=\"${x => x.readOnly}\"\n aria-required=\"${x => x.requiredVisible}\"\n @click=\"${(x, c) => x.clickHandler(c.event as MouseEvent)}\"\n @keydown=\"${(x, c) => x.keydownHandler(c.event as KeyboardEvent)}\"\n @focusout=\"${(x, c) => x.focusOutHandler(c.event as FocusEvent)}\"\n >\n <div class=\"label-container\">\n ${labelTemplate}\n <${iconExclamationMarkTag}\n severity=\"error\"\n class=\"error-icon\"\n ></${iconExclamationMarkTag}>\n </div>\n <div\n class=\"positioning-region ${x => (x.orientation === Orientation.horizontal ? 'horizontal' : 'vertical')}\"\n part=\"positioning-region\"\n >\n <slot\n ${slotted({\n property: 'slottedRadioButtons',\n filter: elements('[role=radio]')\n })}\n ></slot>\n ${errorTextTemplate}\n </div>\n </template>\n`;\n"]}
@@ -18,6 +18,13 @@ declare const Select_base: (abstract new (...args: any[]) => {
18
18
  connectedCallback(): void;
19
19
  disconnectedCallback(): void;
20
20
  attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
21
+ }) & (abstract new (...args: any[]) => {
22
+ requiredVisible: boolean;
23
+ readonly $fastController: import("@microsoft/fast-element").Controller;
24
+ $emit(type: string, detail?: any, options?: Omit<CustomEventInit<any>, "detail"> | undefined): boolean | void;
25
+ connectedCallback(): void;
26
+ disconnectedCallback(): void;
27
+ attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
21
28
  }) & typeof FormAssociatedSelect;
22
29
  /**
23
30
  * A nimble-styled HTML select.
@@ -14,6 +14,7 @@ import { FilterMode } from './types';
14
14
  import { diacriticInsensitiveStringNormalizer } from '../utilities/models/string-normalizers';
15
15
  import { FormAssociatedSelect } from './models/select-form-associated';
16
16
  import { slotTextContent } from '../utilities/models/slot-text-content';
17
+ import { mixinRequiredVisiblePattern } from '../patterns/required-visible/types';
17
18
  const isOptionSelectable = (el) => {
18
19
  return !el.visuallyHidden && !el.disabled && !el.hidden;
19
20
  };
@@ -26,7 +27,7 @@ const isOptionOrGroupVisible = (el) => {
26
27
  /**
27
28
  * A nimble-styled HTML select.
28
29
  */
29
- export class Select extends mixinErrorPattern(FormAssociatedSelect) {
30
+ export class Select extends mixinErrorPattern(mixinRequiredVisiblePattern(FormAssociatedSelect)) {
30
31
  constructor() {
31
32
  super(...arguments);
32
33
  this.appearance = DropdownAppearance.underline;