@ni/nimble-components 32.2.10 → 32.3.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.
@@ -1,5 +1,6 @@
1
1
  import { RadioGroup as FoundationRadioGroup } from '@microsoft/fast-foundation';
2
2
  import { Orientation } from '@microsoft/fast-web-utilities';
3
+ import type { ErrorPattern } from '../patterns/error/types';
3
4
  declare global {
4
5
  interface HTMLElementTagNameMap {
5
6
  'nimble-radio-group': RadioGroup;
@@ -9,6 +10,8 @@ export { Orientation };
9
10
  /**
10
11
  * A nimble-styled grouping element for radio buttons
11
12
  */
12
- export declare class RadioGroup extends FoundationRadioGroup {
13
+ export declare class RadioGroup extends FoundationRadioGroup implements ErrorPattern {
14
+ errorText?: string;
15
+ errorVisible: boolean;
13
16
  }
14
17
  export declare const radioGroupTag = "nimble-radio-group";
@@ -1,12 +1,25 @@
1
- import { RadioGroup as FoundationRadioGroup, radioGroupTemplate as template, DesignSystem } from '@microsoft/fast-foundation';
1
+ import { __decorate } from "tslib";
2
+ import { RadioGroup as FoundationRadioGroup, DesignSystem } from '@microsoft/fast-foundation';
2
3
  import { Orientation } from '@microsoft/fast-web-utilities';
4
+ import { attr } from '@microsoft/fast-element';
3
5
  import { styles } from './styles';
6
+ import { template } from './template';
4
7
  export { Orientation };
5
8
  /**
6
9
  * A nimble-styled grouping element for radio buttons
7
10
  */
8
11
  export class RadioGroup extends FoundationRadioGroup {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.errorVisible = false;
15
+ }
9
16
  }
17
+ __decorate([
18
+ attr({ attribute: 'error-text' })
19
+ ], RadioGroup.prototype, "errorText", void 0);
20
+ __decorate([
21
+ attr({ attribute: 'error-visible', mode: 'boolean' })
22
+ ], RadioGroup.prototype, "errorVisible", void 0);
10
23
  const nimbleRadioGroup = RadioGroup.compose({
11
24
  baseName: 'radio-group',
12
25
  baseClass: FoundationRadioGroup,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/radio-group/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,IAAI,oBAAoB,EAClC,kBAAkB,IAAI,QAAQ,EAC9B,YAAY,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAQlC,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,oBAAoB;CAAG;AAEvD,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 radioGroupTemplate as template,\n DesignSystem\n} from '@microsoft/fast-foundation';\nimport { Orientation } from '@microsoft/fast-web-utilities';\nimport { styles } from './styles';\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 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,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAStC,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,oBAAoB;IAApD;;QAKW,iBAAY,GAAG,KAAK,CAAC;IAChC,CAAC;CAAA;AAJU;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;6CACR;AAGnB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;gDAC1B;AAGhC,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 { attr } from '@microsoft/fast-element';\nimport { styles } from './styles';\nimport { template } from './template';\nimport type { ErrorPattern } 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 FoundationRadioGroup implements ErrorPattern {\n @attr({ attribute: 'error-text' })\n public errorText?: string;\n\n @attr({ attribute: 'error-visible', mode: 'boolean' })\n public errorVisible = false;\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"]}
@@ -1,12 +1,15 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { display } from '../utilities/style/display';
3
- import { controlLabelDisabledFontColor, controlLabelFont, controlLabelFontColor, standardPadding } from '../theme-provider/design-tokens';
3
+ import { controlLabelDisabledFontColor, controlLabelFont, controlLabelFontColor, controlLabelFontLineHeight, smallPadding, standardPadding } from '../theme-provider/design-tokens';
4
+ import { styles as errorStyles } from '../patterns/error/styles';
4
5
  export const styles = css `
5
6
  ${display('inline-block')}
7
+ ${errorStyles}
6
8
 
7
9
  .positioning-region {
8
10
  display: flex;
9
11
  gap: ${standardPadding};
12
+ position: relative;
10
13
  }
11
14
 
12
15
  :host([orientation='vertical']) .positioning-region {
@@ -17,6 +20,13 @@ export const styles = css `
17
20
  flex-direction: row;
18
21
  }
19
22
 
23
+ .label-container {
24
+ display: flex;
25
+ height: ${controlLabelFontLineHeight};
26
+ gap: ${smallPadding};
27
+ margin-bottom: ${smallPadding};
28
+ }
29
+
20
30
  slot[name='label'] {
21
31
  font: ${controlLabelFont};
22
32
  color: ${controlLabelFontColor};
@@ -25,5 +35,10 @@ export const styles = css `
25
35
  :host([disabled]) slot[name='label'] {
26
36
  color: ${controlLabelDisabledFontColor};
27
37
  }
38
+
39
+ .error-icon {
40
+ margin-left: auto;
41
+ margin-right: ${smallPadding};
42
+ }
28
43
  `;
29
44
  //# sourceMappingURL=styles.js.map
@@ -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,eAAe,EAClB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,cAAc,CAAC;;;;eAId,eAAe;;;;;;;;;;;;gBAYd,gBAAgB;iBACf,qBAAqB;;;;iBAIrB,6BAA6B;;CAE7C,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { display } from '../utilities/style/display';\nimport {\n controlLabelDisabledFontColor,\n controlLabelFont,\n controlLabelFontColor,\n standardPadding\n} from '../theme-provider/design-tokens';\n\nexport const styles = css`\n ${display('inline-block')}\n\n .positioning-region {\n display: flex;\n gap: ${standardPadding};\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 slot[name='label'] {\n font: ${controlLabelFont};\n color: ${controlLabelFontColor};\n }\n\n :host([disabled]) slot[name='label'] {\n color: ${controlLabelDisabledFontColor};\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;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"]}
@@ -0,0 +1,2 @@
1
+ import type { RadioGroup } from '.';
2
+ export declare const template: import("@microsoft/fast-element").ViewTemplate<RadioGroup, any>;
@@ -0,0 +1,36 @@
1
+ import { elements, html, slotted } from '@microsoft/fast-element';
2
+ import { Orientation } from '@microsoft/fast-web-utilities';
3
+ import { errorTextTemplate } from '../patterns/error/template';
4
+ import { iconExclamationMarkTag } from '../icons/exclamation-mark';
5
+ /* eslint-disable @typescript-eslint/indent */
6
+ export const template = html `
7
+ <template
8
+ role="radiogroup"
9
+ aria-disabled="${x => x.disabled}"
10
+ aria-readonly="${x => x.readOnly}"
11
+ @click="${(x, c) => x.clickHandler(c.event)}"
12
+ @keydown="${(x, c) => x.keydownHandler(c.event)}"
13
+ @focusout="${(x, c) => x.focusOutHandler(c.event)}"
14
+ >
15
+ <div class="label-container">
16
+ <slot name="label"></slot>
17
+ <${iconExclamationMarkTag}
18
+ severity="error"
19
+ class="error-icon"
20
+ ></${iconExclamationMarkTag}>
21
+ </div>
22
+ <div
23
+ class="positioning-region ${x => (x.orientation === Orientation.horizontal ? 'horizontal' : 'vertical')}"
24
+ part="positioning-region"
25
+ >
26
+ <slot
27
+ ${slotted({
28
+ property: 'slottedRadioButtons',
29
+ filter: elements('[role=radio]')
30
+ })}
31
+ ></slot>
32
+ ${errorTextTemplate}
33
+ </div>
34
+ </template>
35
+ `;
36
+ //# sourceMappingURL=template.js.map
@@ -0,0 +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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ni/nimble-components",
3
- "version": "32.2.10",
3
+ "version": "32.3.0",
4
4
  "description": "Styled web components for the NI Nimble Design System",
5
5
  "scripts": {
6
6
  "build": "npm run generate-icons && npm run generate-workers && npm run build-components && npm run bundle-components && npm run generate-scss",