@ni/nimble-components 1.0.0 → 1.2.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 (49) hide show
  1. package/dist/esm/button/index.js +1 -1
  2. package/dist/esm/button/index.js.map +1 -1
  3. package/dist/esm/button/types.d.ts +2 -6
  4. package/dist/esm/button/types.js +1 -6
  5. package/dist/esm/button/types.js.map +1 -1
  6. package/dist/esm/nimble-components/src/button/types.d.ts +2 -6
  7. package/dist/esm/{button → nimble-components/src/patterns/button}/styles.d.ts +0 -0
  8. package/dist/esm/nimble-components/src/patterns/button/types.d.ts +10 -0
  9. package/dist/esm/nimble-components/src/text-field/index.d.ts +10 -0
  10. package/dist/esm/nimble-components/src/text-field/types.d.ts +19 -1
  11. package/dist/esm/nimble-components/src/toggle-button/index.d.ts +33 -0
  12. package/dist/esm/nimble-components/src/{button → toggle-button}/styles.d.ts +0 -0
  13. package/dist/esm/nimble-components/src/toggle-button/template.d.ts +2 -0
  14. package/dist/esm/nimble-components/src/toggle-button/types.d.ts +6 -0
  15. package/dist/esm/{button/behaviors.d.ts → nimble-components/src/utilities/style/appearance.d.ts} +1 -2
  16. package/dist/esm/patterns/button/styles.d.ts +1 -0
  17. package/dist/esm/{button → patterns/button}/styles.js +8 -8
  18. package/dist/esm/patterns/button/styles.js.map +1 -0
  19. package/dist/esm/patterns/button/types.d.ts +10 -0
  20. package/dist/esm/patterns/button/types.js +11 -0
  21. package/dist/esm/patterns/button/types.js.map +1 -0
  22. package/dist/esm/select/styles.js +6 -0
  23. package/dist/esm/select/styles.js.map +1 -1
  24. package/dist/esm/text-field/index.d.ts +10 -0
  25. package/dist/esm/text-field/index.js +12 -0
  26. package/dist/esm/text-field/index.js.map +1 -1
  27. package/dist/esm/text-field/styles.js +75 -22
  28. package/dist/esm/text-field/styles.js.map +1 -1
  29. package/dist/esm/text-field/types.d.ts +19 -1
  30. package/dist/esm/text-field/types.js +12 -0
  31. package/dist/esm/text-field/types.js.map +1 -1
  32. package/dist/esm/toggle-button/index.d.ts +33 -0
  33. package/dist/esm/toggle-button/index.js +43 -0
  34. package/dist/esm/toggle-button/index.js.map +1 -0
  35. package/dist/esm/toggle-button/styles.d.ts +1 -0
  36. package/dist/esm/toggle-button/styles.js +31 -0
  37. package/dist/esm/toggle-button/styles.js.map +1 -0
  38. package/dist/esm/toggle-button/template.d.ts +2 -0
  39. package/dist/esm/toggle-button/template.js +25 -0
  40. package/dist/esm/toggle-button/template.js.map +1 -0
  41. package/dist/esm/toggle-button/types.d.ts +6 -0
  42. package/dist/esm/toggle-button/types.js +2 -0
  43. package/dist/esm/toggle-button/types.js.map +1 -0
  44. package/dist/esm/{nimble-components/src/button/behaviors.d.ts → utilities/style/appearance.d.ts} +1 -2
  45. package/dist/esm/{button/behaviors.js → utilities/style/appearance.js} +1 -1
  46. package/dist/esm/utilities/style/appearance.js.map +1 -0
  47. package/package.json +5 -5
  48. package/dist/esm/button/behaviors.js.map +0 -1
  49. package/dist/esm/button/styles.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { attr } from '@microsoft/fast-element';
3
3
  import { Button as FoundationButton, buttonTemplate as template, DesignSystem } from '@microsoft/fast-foundation';
4
- import { styles } from './styles';
4
+ import { styles } from '../patterns/button/styles';
5
5
  import { ButtonAppearance } from './types';
6
6
  /**
7
7
  * A nimble-styled HTML button
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/button/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EACH,MAAM,IAAI,gBAAgB,EAE1B,cAAc,IAAI,QAAQ,EAC1B,YAAY,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAU3C;;GAEG;AACH,MAAM,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MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAU3C;;GAEG;AACH,MAAM,MAAO,SAAQ,gBAAgB;IAArC;;QAWI;;;;;;;;WAQG;QAEI,kBAAa,GAAG,KAAK,CAAC;QAEZ,cAAS,GAAG,uBAAuB,CAAC;IAYzD,CAAC;IAVU,iBAAiB;QACpB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAClB,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC;SAC9C;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAE,CAAC;QACxD,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;QAC5B,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACjE,CAAC;CACJ;AA1BG;IADC,IAAI;0CACgC;AAYrC;IADC,IAAI,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;6CAC1B;AAgBjC;;;;;;;;GAQG;AACH,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAgB;IAC/C,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE,gBAAgB;IAC3B,0GAA0G;IAC1G,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,YAAY,EAAE,CAAC,CAAC"}
@@ -3,10 +3,6 @@
3
3
  * @public
4
4
  */
5
5
  import type { Button } from '@microsoft/fast-foundation';
6
- export declare enum ButtonAppearance {
7
- Outline = "outline",
8
- Ghost = "ghost",
9
- Block = "block"
10
- }
11
- export declare type ButtonAppearanceAttribute = `${ButtonAppearance}`;
6
+ export type { ButtonAppearanceAttribute } from '../patterns/button/types';
7
+ export { ButtonAppearance } from '../patterns/button/types';
12
8
  export declare type ButtonType = Button['type'];
@@ -1,7 +1,2 @@
1
- export var ButtonAppearance;
2
- (function (ButtonAppearance) {
3
- ButtonAppearance["Outline"] = "outline";
4
- ButtonAppearance["Ghost"] = "ghost";
5
- ButtonAppearance["Block"] = "block";
6
- })(ButtonAppearance || (ButtonAppearance = {}));
1
+ export { ButtonAppearance } from '../patterns/button/types';
7
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/button/types.ts"],"names":[],"mappings":"AAMA,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IACxB,uCAAmB,CAAA;IACnB,mCAAe,CAAA;IACf,mCAAe,CAAA;AACnB,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/button/types.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -3,10 +3,6 @@
3
3
  * @public
4
4
  */
5
5
  import type { Button } from '@microsoft/fast-foundation';
6
- export declare enum ButtonAppearance {
7
- Outline = "outline",
8
- Ghost = "ghost",
9
- Block = "block"
10
- }
11
- export declare type ButtonAppearanceAttribute = `${ButtonAppearance}`;
6
+ export type { ButtonAppearanceAttribute } from '../patterns/button/types';
7
+ export { ButtonAppearance } from '../patterns/button/types';
12
8
  export declare type ButtonType = Button['type'];
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Types of button appearance.
3
+ * @public
4
+ */
5
+ export declare enum ButtonAppearance {
6
+ Outline = "outline",
7
+ Ghost = "ghost",
8
+ Block = "block"
9
+ }
10
+ export declare type ButtonAppearanceAttribute = `${ButtonAppearance}`;
@@ -1,4 +1,5 @@
1
1
  import { TextField as FoundationTextField } from '@microsoft/fast-foundation';
2
+ import { TextFieldAppearance } from './types';
2
3
  export type { TextField };
3
4
  declare global {
4
5
  interface HTMLElementTagNameMap {
@@ -9,4 +10,13 @@ declare global {
9
10
  * A nimble-styed HTML text input
10
11
  */
11
12
  declare class TextField extends FoundationTextField {
13
+ /**
14
+ * The appearance the text field should have.
15
+ *
16
+ * @public
17
+ * @remarks
18
+ * HTML Attribute: appearance
19
+ */
20
+ appearance: TextFieldAppearance;
21
+ connectedCallback(): void;
12
22
  }
@@ -1,3 +1,21 @@
1
1
  import { TextFieldType } from '@microsoft/fast-foundation';
2
- export { TextFieldType };
2
+ /**
3
+ * Values for the 'type' attribute of the text field.
4
+ */
3
5
  export declare type TextFieldTypeAttribute = `${TextFieldType}`;
6
+ /**
7
+ * Values for the 'type' property of the text field.
8
+ */
9
+ export { TextFieldType };
10
+ /**
11
+ * Values for the 'appearance' attribute of the text field.
12
+ */
13
+ export declare type TextFieldAppearanceAttribute = `${TextFieldAppearance}`;
14
+ /**
15
+ * Values for the 'appearance' property of the text field
16
+ */
17
+ export declare enum TextFieldAppearance {
18
+ Underline = "underline",
19
+ Outline = "outline",
20
+ Block = "block"
21
+ }
@@ -0,0 +1,33 @@
1
+ import { Switch as FoundationSwitch } from '@microsoft/fast-foundation';
2
+ import { ButtonAppearance } from '../patterns/button/types';
3
+ export type { ToggleButton };
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ 'nimble-toggle-button': ToggleButton;
7
+ }
8
+ }
9
+ /**
10
+ * A nimble-styled toggle button control.
11
+ */
12
+ declare class ToggleButton extends FoundationSwitch {
13
+ /**
14
+ * The appearance the button should have.
15
+ *
16
+ * @public
17
+ * @remarks
18
+ * HTML Attribute: appearance
19
+ */
20
+ appearance: ButtonAppearance;
21
+ /**
22
+ * Specify as 'true' to hide the text content of the button. The button will
23
+ * become square, and the text content will be used as the label of the button
24
+ * for accessibility purposes.
25
+ *
26
+ * @public
27
+ * @remarks
28
+ * HTML Attribute: content-hidden
29
+ */
30
+ contentHidden: boolean;
31
+ readonly control: HTMLElement;
32
+ connectedCallback(): void;
33
+ }
@@ -0,0 +1,2 @@
1
+ import type { ToggleButton } from '.';
2
+ export declare const template: import("@microsoft/fast-element").ViewTemplate<ToggleButton, any>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Types of toggle button appearance.
3
+ * @public
4
+ */
5
+ export type { ButtonAppearanceAttribute } from '../patterns/button/types';
6
+ export { ButtonAppearance } from '../patterns/button/types';
@@ -1,5 +1,4 @@
1
1
  import type { Behavior, ElementStyles } from '@microsoft/fast-element';
2
- import type { ButtonAppearance } from './types';
3
2
  /**
4
3
  * Behavior that will conditionally apply a stylesheet based on the element's
5
4
  * appearance property
@@ -9,4 +8,4 @@ import type { ButtonAppearance } from './types';
9
8
  *
10
9
  * @public
11
10
  */
12
- export declare function appearanceBehavior(value: ButtonAppearance, styles: ElementStyles): Behavior;
11
+ export declare function appearanceBehavior<AppearanceType>(value: AppearanceType, styles: ElementStyles): Behavior;
@@ -0,0 +1 @@
1
+ export declare const styles: import("@microsoft/fast-element").ElementStyles;
@@ -1,8 +1,8 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { display } from '@microsoft/fast-foundation';
3
- import { focusVisible } from '../utilities/style/focus';
4
- import { actionColorRgbPartial, borderColorHover, borderColorRgbPartial, borderWidth, buttonContentFontColor, contentFontColorDisabled, contentFontSize, controlHeight, fillColorSelected, fontFamily, iconColor, smallDelay, standardPadding } from '../theme-provider/design-tokens';
5
- import { appearanceBehavior } from './behaviors';
3
+ import { focusVisible } from '../../utilities/style/focus';
4
+ import { actionColorRgbPartial, borderColorHover, borderColorRgbPartial, borderWidth, buttonContentFontColor, contentFontColorDisabled, contentFontSize, controlHeight, fillColorSelected, fontFamily, iconColor, smallDelay, standardPadding } from '../../theme-provider/design-tokens';
5
+ import { appearanceBehavior } from '../../utilities/style/appearance';
6
6
  import { ButtonAppearance } from './types';
7
7
  export const styles = css `
8
8
  ${display('inline-flex')}
@@ -113,7 +113,7 @@ export const styles = css `
113
113
  .withBehaviors(appearanceBehavior(ButtonAppearance.Outline, css `
114
114
  .control {
115
115
  background-color: transparent;
116
- border-color: rgba(${actionColorRgbPartial}, 0.5);
116
+ border-color: rgba(${actionColorRgbPartial}, 0.3);
117
117
  }
118
118
 
119
119
  .control:hover {
@@ -128,7 +128,7 @@ export const styles = css `
128
128
 
129
129
  .control:active {
130
130
  background-color: ${fillColorSelected};
131
- border-color: transparent;
131
+ border-color: ${fillColorSelected};
132
132
  }
133
133
 
134
134
  .control[disabled] {
@@ -153,7 +153,7 @@ export const styles = css `
153
153
 
154
154
  .control:active {
155
155
  background-color: ${fillColorSelected};
156
- border-color: transparent;
156
+ border-color: ${fillColorSelected};
157
157
  }
158
158
 
159
159
  .control[disabled] {
@@ -178,12 +178,12 @@ export const styles = css `
178
178
 
179
179
  .control:active {
180
180
  background-color: ${fillColorSelected};
181
- border-color: transparent;
181
+ border-color: ${fillColorSelected};
182
182
  }
183
183
 
184
184
  .control[disabled] {
185
185
  background-color: rgba(${borderColorRgbPartial}, 0.1);
186
- border-color: rgba(${borderColorRgbPartial}, 0.1);
186
+ border-color: transparent;
187
187
  }
188
188
  `));
189
189
  //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/patterns/button/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACH,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,sBAAsB,EACtB,wBAAwB,EACxB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,E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10 @@
1
+ /**
2
+ * Types of button appearance.
3
+ * @public
4
+ */
5
+ export declare enum ButtonAppearance {
6
+ Outline = "outline",
7
+ Ghost = "ghost",
8
+ Block = "block"
9
+ }
10
+ export declare type ButtonAppearanceAttribute = `${ButtonAppearance}`;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Types of button appearance.
3
+ * @public
4
+ */
5
+ export var ButtonAppearance;
6
+ (function (ButtonAppearance) {
7
+ ButtonAppearance["Outline"] = "outline";
8
+ ButtonAppearance["Ghost"] = "ghost";
9
+ ButtonAppearance["Block"] = "block";
10
+ })(ButtonAppearance || (ButtonAppearance = {}));
11
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/patterns/button/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IACxB,uCAAmB,CAAA;IACnB,mCAAe,CAAA;IACf,mCAAe,CAAA;AACnB,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B"}
@@ -24,6 +24,12 @@ export const styles = css `
24
24
  overflow-y: auto;
25
25
  position: absolute;
26
26
  width: 100%;
27
+ ${
28
+ /*
29
+ * The --max-height custom property is defined by fast-foundation.
30
+ * See: https://github.com/microsoft/fast/blob/af1f8736ae9ff54a7449324bad952865981d1ece/packages/web-components/fast-foundation/src/select/select.ts#L199
31
+ */ ''}
32
+ max-height: calc(var(--max-height) - ${controlHeight});
27
33
  z-index: 1;
28
34
  padding: 4px;
29
35
  box-shadow: 0px 3px 3px ${popupBoxShadowColor};
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/select/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACH,0BAA0B,EAC1B,gBA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aAAa;;;;;;;;;;;;;;;;UAgBrB;AACE;;;GAGG,CAAC,EACR;+CACuC,aAAa;;;kCAG1B,mBAAmB;4BACzB,gBAAgB;4BAChB,0BAA0B;;;;;;;;;;;;;qBAajC,eAAe;;;;yBAIX,WAAW,UAAU,wBAAwB;;;;;;;;;;;yBAW7C,WAAW,UAAU,gBAAgB;oCAC1B,UAAU,oBAAoB,UAAU;;;;mCAIzC,gBAAgB;;oCAEf,UAAU,oBAAoB,UAAU;;;;;yBAKnD,WAAW,UAAU,wBAAwB;;iBAErD,wBAAwB;;;;;;;;;;;;;;kBAcvB,aAAa;;;;oBAIX,aAAa;;;;;;;;;;;;;;;;;;;;;;iBAsBhB,QAAQ;kBACP,QAAQ;gBACV,gBAAgB;;;;gBAIhB,wBAAwB;;;;;;;;;;;;;;;;;;;;;CAqBvC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { TextField as FoundationTextField } from '@microsoft/fast-foundation';
2
+ import { TextFieldAppearance } from './types';
2
3
  export type { TextField };
3
4
  declare global {
4
5
  interface HTMLElementTagNameMap {
@@ -9,4 +10,13 @@ declare global {
9
10
  * A nimble-styed HTML text input
10
11
  */
11
12
  declare class TextField extends FoundationTextField {
13
+ /**
14
+ * The appearance the text field should have.
15
+ *
16
+ * @public
17
+ * @remarks
18
+ * HTML Attribute: appearance
19
+ */
20
+ appearance: TextFieldAppearance;
21
+ connectedCallback(): void;
12
22
  }
@@ -1,11 +1,23 @@
1
+ import { __decorate } from "tslib";
2
+ import { attr } from '@microsoft/fast-element';
1
3
  import { DesignSystem, TextField as FoundationTextField, textFieldTemplate as template } from '@microsoft/fast-foundation';
2
4
  import { statusAlarmActive16X16 } from '@ni/nimble-tokens/dist-icons-esm/nimble-icons-inline';
3
5
  import { styles } from './styles';
6
+ import { TextFieldAppearance } from './types';
4
7
  /**
5
8
  * A nimble-styed HTML text input
6
9
  */
7
10
  class TextField extends FoundationTextField {
11
+ connectedCallback() {
12
+ super.connectedCallback();
13
+ if (!this.appearance) {
14
+ this.appearance = TextFieldAppearance.Underline;
15
+ }
16
+ }
8
17
  }
18
+ __decorate([
19
+ attr
20
+ ], TextField.prototype, "appearance", void 0);
9
21
  const nimbleTextField = TextField.compose({
10
22
  baseName: 'text-field',
11
23
  baseClass: FoundationTextField,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/text-field/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EACZ,SAAS,IAAI,mBAAmB,EAEhC,iBAAiB,IAAI,QAAQ,EAChC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,sDAAsD,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAUlC;;GAEG;AACH,MAAM,SAAU,SAAQ,mBAAmB;CAAG;AAE9C,MAAM,eAAe,GAAG,SAAS,CAAC,OAAO,CAAmB;IACxD,QAAQ,EAAE,YAAY;IACtB,SAAS,EAAE,mBAAmB;IAC9B,0GAA0G;IAC1G,QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,IAAI;KACvB;IACD,GAAG,EAAE,sBAAsB,CAAC,IAAI;CACnC,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/text-field/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EACH,YAAY,EACZ,SAAS,IAAI,mBAAmB,EAEhC,iBAAiB,IAAI,QAAQ,EAChC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,sDAAsD,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAU9C;;GAEG;AACH,MAAM,SAAU,SAAQ,mBAAmB;IAWhC,iBAAiB;QACpB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAClB,IAAI,CAAC,UAAU,GAAG,mBAAmB,CAAC,SAAS,CAAC;SACnD;IACL,CAAC;CACJ;AARG;IADC,IAAI;6CACmC;AAU5C,MAAM,eAAe,GAAG,SAAS,CAAC,OAAO,CAAmB;IACxD,QAAQ,EAAE,YAAY;IACtB,SAAS,EAAE,mBAAmB;IAC9B,0GAA0G;IAC1G,QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,IAAI;KACvB;IACD,GAAG,EAAE,sBAAsB,CAAC,IAAI;CACnC,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC"}
@@ -1,6 +1,8 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { display } from '@microsoft/fast-foundation';
3
- import { borderColorRgbPartial, borderColorHover, borderWidth, contentFontColor, contentFontColorDisabled, contentFontSize, controlHeight, failColor, fillColorSelectedRgbPartial, fontFamily, iconSize, labelFontColor, labelFontFamily, labelFontSize, labelFontWeight, labelHeight, labelTextTransform, smallDelay } from '../theme-provider/design-tokens';
3
+ import { borderColorRgbPartial, borderColorHover, borderWidth, contentFontColor, contentFontColorDisabled, contentFontSize, controlHeight, failColor, fillColorSelectedRgbPartial, fontFamily, iconSize, labelFontColor, labelFontColorDisabled, labelFontFamily, labelFontSize, labelFontWeight, labelHeight, labelTextTransform, smallDelay, standardPadding } from '../theme-provider/design-tokens';
4
+ import { appearanceBehavior } from '../utilities/style/appearance';
5
+ import { TextFieldAppearance } from './types';
4
6
  import { Theme } from '../theme-provider/types';
5
7
  import { themeBehavior } from '../utilities/style/theme';
6
8
  export const styles = css `
@@ -26,41 +28,49 @@ export const styles = css `
26
28
  flex-direction: row;
27
29
  border-radius: 0px;
28
30
  font-family: ${fontFamily};
29
- border-bottom: ${borderWidth} solid rgba(${borderColorRgbPartial}, 0.3);
30
- padding-bottom: 1px;
31
31
  transition: border-bottom ${smallDelay}, padding-bottom ${smallDelay};
32
32
  align-items: flex-end;
33
+ --ni-private-hover-bottom-border-width: 2px;
34
+ border: 0px solid rgba(${borderColorRgbPartial}, 0.3);
35
+ border-bottom-width: var(--ni-private-bottom-border-width);
36
+ padding-bottom: calc(
37
+ var(--ni-private-hover-bottom-border-width) -
38
+ var(--ni-private-bottom-border-width)
39
+ );
33
40
  }
34
41
 
35
- @media (prefers-reduced-motion) {
36
- .root {
37
- transition-duration: 0s;
38
- }
42
+ :host .root:hover {
43
+ --ni-private-bottom-border-width: var(
44
+ --ni-private-hover-bottom-border-width
45
+ );
46
+ }
47
+
48
+ :host([disabled]) .root:hover {
49
+ --ni-private-bottom-border-width: 1px;
39
50
  }
40
51
 
52
+ .root:focus-within,
41
53
  .root:hover {
42
- border-bottom: 2px solid ${borderColorHover};
43
- padding-bottom: 0px;
54
+ border-bottom-color: ${borderColorHover};
44
55
  }
45
56
 
46
57
  :host(.invalid) .root {
47
- border-bottom: ${borderWidth} solid ${failColor};
58
+ border-bottom-color: ${failColor};
48
59
  }
49
60
 
50
- :host(.invalid) .root:hover {
51
- border-bottom: 2px solid ${failColor};
52
- padding-bottom: 0px;
61
+ :host([disabled]) .root {
62
+ border-color: rgba(${borderColorRgbPartial}, 0.1);
53
63
  }
54
64
 
55
- :host([disabled]) .root,
56
- :host([disabled]) .root:hover {
57
- border-bottom: ${borderWidth} solid ${contentFontColorDisabled};
58
- padding-bottom: 1px;
65
+ :host([readonly]) .root {
66
+ border: none;
67
+ padding: ${borderWidth};
59
68
  }
60
69
 
61
- :host([readonly]) .root,
62
- :host([readonly]) .root:hover {
63
- border: none;
70
+ @media (prefers-reduced-motion) {
71
+ .root {
72
+ transition-duration: 0s;
73
+ }
64
74
  }
65
75
 
66
76
  .control {
@@ -68,10 +78,17 @@ export const styles = css `
68
78
  font: inherit;
69
79
  background: transparent;
70
80
  color: inherit;
71
- height: 28px;
81
+ padding-top: 0px;
82
+ padding-bottom: 0px;
83
+ height: calc(
84
+ ${controlHeight} - ${borderWidth} -
85
+ var(--ni-private-hover-bottom-border-width)
86
+ );
72
87
  width: 100%;
73
88
  margin-top: auto;
74
89
  margin-bottom: auto;
90
+ padding-left: calc(${standardPadding} / 2);
91
+ padding-right: calc(${standardPadding} / 2);
75
92
  border: none;
76
93
  }
77
94
 
@@ -113,6 +130,10 @@ export const styles = css `
113
130
  text-transform: ${labelTextTransform};
114
131
  }
115
132
 
133
+ :host([disabled]) .label {
134
+ color: ${labelFontColorDisabled};
135
+ }
136
+
116
137
  :host [part='end'] {
117
138
  display: none;
118
139
  }
@@ -136,7 +157,39 @@ export const styles = css `
136
157
  :host([disabled]) [part='end'] path {
137
158
  fill: ${contentFontColorDisabled};
138
159
  }
139
- `.withBehaviors(themeBehavior(css `
160
+ `.withBehaviors(appearanceBehavior(TextFieldAppearance.Underline, css `
161
+ .root {
162
+ --ni-private-bottom-border-width: 1px;
163
+ padding-top: ${borderWidth};
164
+ padding-left: ${borderWidth};
165
+ padding-right: ${borderWidth};
166
+ }
167
+ `), appearanceBehavior(TextFieldAppearance.Block, css `
168
+ .root {
169
+ background-color: rgba(${borderColorRgbPartial}, 0.05);
170
+ --ni-private-bottom-border-width: 0px;
171
+ padding-top: ${borderWidth};
172
+ padding-left: ${borderWidth};
173
+ padding-right: ${borderWidth};
174
+ }
175
+
176
+ .root:focus-within,
177
+ :host(.invalid) .root,
178
+ :host([disabled]) .root {
179
+ --ni-private-bottom-border-width: 1px;
180
+ }
181
+
182
+ :host([disabled]) .root,
183
+ :host([readonly]) .root {
184
+ background-color: transparent;
185
+ }
186
+ `), appearanceBehavior(TextFieldAppearance.Outline, css `
187
+ .root {
188
+ --ni-private-bottom-border-width: 1px;
189
+ border-width: ${borderWidth};
190
+ border-bottom-width: var(--ni-private-bottom-border-width);
191
+ }
192
+ `), themeBehavior(css `
140
193
  ${'' /* Light theme */}
141
194
  .control::-ms-reveal {
142
195
  filter: invert(0%);
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/text-field/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,OAAO,EACH,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,wBAAwB,EACxB,eAAe,EACf,aAAa,EACb,SAAS,EACT,2BAA2B,EAC3B,UAAU,EACV,QAAQ,EACR,cAAc,EACd,eAAe,EACf,aAAa,EACb,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,UAAU,EACb,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,cAAc,CAAC;;;uBAGN,UAAU;qBACZ,eAAe;;;iBAGnB,gBAAgB;uBACV,WAAW,MAAM,aAAa;;;;iBAIpC,wBAAwB;;;;;;;;;uBASlB,UAAU;yBACR,WAAW,eAAe,qBAAqB;;oCAEpC,UAAU,oBAAoB,UAAU;;;;;;;;;;;mCAWzC,gBAAgB;;;;;yBAK1B,WAAW,UAAU,SAAS;;;;mCAIpB,SAAS;;;;;;yBAMnB,WAAW,UAAU,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6BrD,cAAc;2BACJ,2BAA2B;;;;iBAIrC,cAAc;;;;;;;;;;;;iBAYd,wBAAwB;;;;;iBAKxB,cAAc;uBACR,eAAe;qBACjB,aAAa;uBACX,eAAe;uBACf,WAAW;0BACR,kBAAkB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;;;+BAoBvB,gBAAgB;;;;+BAIhB,SAAS;;;;6BAIX,qBAAqB;;;;;mBAK/B,WAAW;;;;;;;;;;;;;;;;;cAiBhB,aAAa,MAAM,WAAW;;;;;;6BAMf,eAAe;8BACd,eAAe;;;;;;;;;;;;iBAY5B,cAAc;2BACJ,2BAA2B;;;;iBAIrC,cAAc;;;;;;;;;;;;iBAYd,wBAAwB;;;;;iBAKxB,cAAc;uBACR,eAAe;qBACjB,aAAa;uBACX,eAAe;uBACf,WAAW;0BACR,kBAAkB;;;;iBAI3B,sBAAsB;;;;;;;;;;;;;;;kBAerB,QAAQ;iBACT,QAAQ;;;;gBAIT,SAAS;;;;gBAIT,wBAAwB;;CAEvC,CAAC,aAAa,CACP,kBAAkB,CACd,mBAAmB,CAAC,SAAS,EAC7B,GAAG,CAAA;;;+BAGgB,WAAW;gCACV,WAAW;iCACV,WAAW;;SAEnC,CACA,EACD,kBAAkB,CACd,mBAAmB,CAAC,KAAK,EACzB,GAAG,CAAA;;yCAE0B,qBAAqB;;+BAE/B,WAAW;gCACV,WAAW;iCACV,WAAW;;;;;;;;;;;;;SAanC,CACA,EACD,kBAAkB,CACd,mBAAmB,CAAC,OAAO,EAC3B,GAAG,CAAA;;;gCAGiB,WAAW;;;SAGlC,CACA,EACD,aAAa,CACT,GAAG,CAAA;cACD,EAAE,CAAC,iBAAiB;;;;SAIzB,EACG,GAAG,CAAA;cACD,EAAE,CAAC,gBAAgB;;;;SAIxB;AACG,cAAc;AACd,KAAK,CAAC,IAAI;AACV,mBAAmB;AACnB,KAAK,CAAC,KAAK,CACd,CACJ,CAAC"}
@@ -1,3 +1,21 @@
1
1
  import { TextFieldType } from '@microsoft/fast-foundation';
2
- export { TextFieldType };
2
+ /**
3
+ * Values for the 'type' attribute of the text field.
4
+ */
3
5
  export declare type TextFieldTypeAttribute = `${TextFieldType}`;
6
+ /**
7
+ * Values for the 'type' property of the text field.
8
+ */
9
+ export { TextFieldType };
10
+ /**
11
+ * Values for the 'appearance' attribute of the text field.
12
+ */
13
+ export declare type TextFieldAppearanceAttribute = `${TextFieldAppearance}`;
14
+ /**
15
+ * Values for the 'appearance' property of the text field
16
+ */
17
+ export declare enum TextFieldAppearance {
18
+ Underline = "underline",
19
+ Outline = "outline",
20
+ Block = "block"
21
+ }
@@ -1,3 +1,15 @@
1
1
  import { TextFieldType } from '@microsoft/fast-foundation';
2
+ /**
3
+ * Values for the 'type' property of the text field.
4
+ */
2
5
  export { TextFieldType };
6
+ /**
7
+ * Values for the 'appearance' property of the text field
8
+ */
9
+ export var TextFieldAppearance;
10
+ (function (TextFieldAppearance) {
11
+ TextFieldAppearance["Underline"] = "underline";
12
+ TextFieldAppearance["Outline"] = "outline";
13
+ TextFieldAppearance["Block"] = "block";
14
+ })(TextFieldAppearance || (TextFieldAppearance = {}));
3
15
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/text-field/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/text-field/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAO3D;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,CAAC;AAOzB;;GAEG;AACH,MAAM,CAAN,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC3B,8CAAuB,CAAA;IACvB,0CAAmB,CAAA;IACnB,sCAAe,CAAA;AACnB,CAAC,EAJW,mBAAmB,KAAnB,mBAAmB,QAI9B"}
@@ -0,0 +1,33 @@
1
+ import { Switch as FoundationSwitch } from '@microsoft/fast-foundation';
2
+ import { ButtonAppearance } from '../patterns/button/types';
3
+ export type { ToggleButton };
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ 'nimble-toggle-button': ToggleButton;
7
+ }
8
+ }
9
+ /**
10
+ * A nimble-styled toggle button control.
11
+ */
12
+ declare class ToggleButton extends FoundationSwitch {
13
+ /**
14
+ * The appearance the button should have.
15
+ *
16
+ * @public
17
+ * @remarks
18
+ * HTML Attribute: appearance
19
+ */
20
+ appearance: ButtonAppearance;
21
+ /**
22
+ * Specify as 'true' to hide the text content of the button. The button will
23
+ * become square, and the text content will be used as the label of the button
24
+ * for accessibility purposes.
25
+ *
26
+ * @public
27
+ * @remarks
28
+ * HTML Attribute: content-hidden
29
+ */
30
+ contentHidden: boolean;
31
+ readonly control: HTMLElement;
32
+ connectedCallback(): void;
33
+ }
@@ -0,0 +1,43 @@
1
+ import { __decorate } from "tslib";
2
+ import { attr } from '@microsoft/fast-element';
3
+ import { DesignSystem, Switch as FoundationSwitch } from '@microsoft/fast-foundation';
4
+ import { styles } from './styles';
5
+ import { template } from './template';
6
+ import { ButtonAppearance } from '../patterns/button/types';
7
+ /**
8
+ * A nimble-styled toggle button control.
9
+ */
10
+ class ToggleButton extends FoundationSwitch {
11
+ constructor() {
12
+ super(...arguments);
13
+ /**
14
+ * Specify as 'true' to hide the text content of the button. The button will
15
+ * become square, and the text content will be used as the label of the button
16
+ * for accessibility purposes.
17
+ *
18
+ * @public
19
+ * @remarks
20
+ * HTML Attribute: content-hidden
21
+ */
22
+ this.contentHidden = false;
23
+ }
24
+ connectedCallback() {
25
+ super.connectedCallback();
26
+ if (!this.appearance) {
27
+ this.appearance = ButtonAppearance.Outline;
28
+ }
29
+ }
30
+ }
31
+ __decorate([
32
+ attr
33
+ ], ToggleButton.prototype, "appearance", void 0);
34
+ __decorate([
35
+ attr({ attribute: 'content-hidden', mode: 'boolean' })
36
+ ], ToggleButton.prototype, "contentHidden", void 0);
37
+ const nimbleToggleButton = ToggleButton.compose({
38
+ baseName: 'toggle-button',
39
+ template,
40
+ styles
41
+ });
42
+ DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleToggleButton());
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/toggle-button/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EACH,YAAY,EACZ,MAAM,IAAI,gBAAgB,EAE7B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAU5D;;GAEG;AACH,MAAM,YAAa,SAAQ,gBAAgB;IAA3C;;QAWI;;;;;;;;WAQG;QAEI,kBAAa,GAAG,KAAK,CAAC;IAUjC,CAAC;IANU,iBAAiB;QACpB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAClB,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC;SAC9C;IACL,CAAC;CACJ;AAtBG;IADC,IAAI;gDACgC;AAYrC;IADC,IAAI,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;mDAC1B;AAYjC,MAAM,kBAAkB,GAAG,YAAY,CAAC,OAAO,CAAgB;IAC3D,QAAQ,EAAE,eAAe;IACzB,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const styles: import("@microsoft/fast-element").ElementStyles;
@@ -0,0 +1,31 @@
1
+ import { css } from '@microsoft/fast-element';
2
+ import { focusVisible } from '../utilities/style/focus';
3
+ import { fillColorSelected } from '../theme-provider/design-tokens';
4
+ import { styles as buttonStyles } from '../patterns/button/styles';
5
+ export const styles = css `
6
+ ${buttonStyles}
7
+
8
+ .control[aria-pressed='true'] {
9
+ background-color: ${fillColorSelected};
10
+ border-color: ${fillColorSelected};
11
+ }
12
+
13
+ .control[aria-pressed='true']:hover {
14
+ background-color: ${fillColorSelected};
15
+ }
16
+
17
+ .control[aria-pressed='true']${focusVisible} {
18
+ background-color: ${fillColorSelected};
19
+ }
20
+
21
+ .control[aria-pressed='true'][disabled] {
22
+ background-color: ${fillColorSelected};
23
+ border-color: ${fillColorSelected};
24
+ }
25
+
26
+ .control[aria-pressed='true'][disabled]:hover {
27
+ background-color: ${fillColorSelected};
28
+ border-color: ${fillColorSelected};
29
+ }
30
+ `;
31
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/toggle-button/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEnE,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,YAAY;;;4BAGU,iBAAiB;wBACrB,iBAAiB;;;;4BAIb,iBAAiB;;;mCAGV,YAAY;4BACnB,iBAAiB;;;;4BAIjB,iBAAiB;wBACrB,iBAAiB;;;;4BAIb,iBAAiB;wBACrB,iBAAiB;;CAExC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { ToggleButton } from '.';
2
+ export declare const template: import("@microsoft/fast-element").ViewTemplate<ToggleButton, any>;
@@ -0,0 +1,25 @@
1
+ import { html, ref } from '@microsoft/fast-element';
2
+ export const template = html `
3
+ <div
4
+ role="button"
5
+ part="control"
6
+ aria-pressed="${(x) => x.checked}"
7
+ aria-disabled="${(x) => x.disabled}"
8
+ aria-readonly="${(x) => x.readOnly}"
9
+ aria-labelledby="nimble-toggle-button-content"
10
+ tabindex="${(x) => (x.disabled ? null : 0)}"
11
+ @keypress="${(x, c) => x.keypressHandler(c.event)}"
12
+ @click="${(x, c) => x.clickHandler(c.event)}"
13
+ class="control ${(x) => (x.checked ? 'checked' : '')}"
14
+ ?disabled="${x => x.disabled}"
15
+ ${ref('control')}
16
+ >
17
+ <span part="start" class="start">
18
+ <slot name="start"></slot>
19
+ </span>
20
+ <span class="content" part="content" id="nimble-toggle-button-content">
21
+ <slot></slot>
22
+ </span>
23
+ </div>
24
+ `;
25
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/toggle-button/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAGpD,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAc;;;;wBAIlB,CAAC,CAAe,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO;yBAC7B,CAAC,CAAe,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ;yBAC/B,CAAC,CAAe,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ;;oBAEpC,CAAC,CAAe,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;qBAC3C,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAsB,CAAC;kBACxD,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAmB,CAAC;yBACxC,CAAC,CAAe,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;qBACrD,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;UAC1B,GAAG,CAAC,SAAS,CAAC;;;;;;;;;CASvB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Types of toggle button appearance.
3
+ * @public
4
+ */
5
+ export type { ButtonAppearanceAttribute } from '../patterns/button/types';
6
+ export { ButtonAppearance } from '../patterns/button/types';
@@ -0,0 +1,2 @@
1
+ export { ButtonAppearance } from '../patterns/button/types';
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/toggle-button/types.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import type { Behavior, ElementStyles } from '@microsoft/fast-element';
2
- import type { ButtonAppearance } from './types';
3
2
  /**
4
3
  * Behavior that will conditionally apply a stylesheet based on the element's
5
4
  * appearance property
@@ -9,4 +8,4 @@ import type { ButtonAppearance } from './types';
9
8
  *
10
9
  * @public
11
10
  */
12
- export declare function appearanceBehavior(value: ButtonAppearance, styles: ElementStyles): Behavior;
11
+ export declare function appearanceBehavior<AppearanceType>(value: AppearanceType, styles: ElementStyles): Behavior;
@@ -11,4 +11,4 @@ import { PropertyStyleSheetBehavior } from '@microsoft/fast-foundation';
11
11
  export function appearanceBehavior(value, styles) {
12
12
  return new PropertyStyleSheetBehavior('appearance', value, styles);
13
13
  }
14
- //# sourceMappingURL=behaviors.js.map
14
+ //# sourceMappingURL=appearance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appearance.js","sourceRoot":"","sources":["../../../../src/utilities/style/appearance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAGxE;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAC9B,KAAqB,EACrB,MAAqB;IAErB,OAAO,IAAI,0BAA0B,CAAC,YAAY,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AACvE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ni/nimble-components",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Styled web components for the NI Nimble Design System",
5
5
  "scripts": {
6
6
  "build": "npm run build-components && npm run generate-scss && npm run build-storybook",
@@ -42,10 +42,10 @@
42
42
  },
43
43
  "homepage": "https://github.com/ni/nimble#readme",
44
44
  "dependencies": {
45
- "@microsoft/fast-animation": "^4.1.5",
46
- "@microsoft/fast-element": "^1.6.1",
47
- "@microsoft/fast-foundation": "^2.22.0",
48
- "@microsoft/fast-web-utilities": "^5.0.2",
45
+ "@microsoft/fast-animation": "^4.1.8",
46
+ "@microsoft/fast-element": "^1.7.0",
47
+ "@microsoft/fast-foundation": "^2.28.0 <2.29.0",
48
+ "@microsoft/fast-web-utilities": "^5.1.0",
49
49
  "@ni/nimble-tokens": "^1.0.0",
50
50
  "hex-rgb": "^5.0.0"
51
51
  },
@@ -1 +0,0 @@
1
- {"version":3,"file":"behaviors.js","sourceRoot":"","sources":["../../../src/button/behaviors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAIxE;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAC9B,KAAuB,EACvB,MAAqB;IAErB,OAAO,IAAI,0BAA0B,CAAC,YAAY,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AACvE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/button/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EACH,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,sBAAsB,EACtB,w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