@ni/nimble-components 7.0.1 → 7.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.
@@ -28,6 +28,4 @@ declare class Button extends FoundationButton {
28
28
  * HTML Attribute: content-hidden
29
29
  */
30
30
  contentHidden: boolean;
31
- private readonly contentId;
32
- connectedCallback(): void;
33
31
  }
@@ -27,13 +27,6 @@ class Button extends FoundationButton {
27
27
  * HTML Attribute: content-hidden
28
28
  */
29
29
  this.contentHidden = false;
30
- this.contentId = 'nimble-button-content';
31
- }
32
- connectedCallback() {
33
- super.connectedCallback();
34
- const content = this.control.querySelector('.content');
35
- content.id = this.contentId;
36
- this.control.setAttribute('aria-labelledby', this.contentId);
37
30
  }
38
31
  }
39
32
  __decorate([
@@ -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,MAAO,SAAQ,gBAAgB;IAArC;;QACI;;;;;;WAMG;QAEI,eAAU,GAAqB,gBAAgB,CAAC,OAAO,CAAC;QAE/D;;;;;;;;WAQG;QAEI,kBAAa,GAAG,KAAK,CAAC;QAEZ,cAAS,GAAG,uBAAuB,CAAC;IAQzD,CAAC;IANmB,iBAAiB;QAC7B,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAE,CAAC;QACxD,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;QAC5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AM,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"}
@@ -28,6 +28,4 @@ declare class Button extends FoundationButton {
28
28
  * HTML Attribute: content-hidden
29
29
  */
30
30
  contentHidden: boolean;
31
- private readonly contentId;
32
- connectedCallback(): void;
33
31
  }
@@ -0,0 +1,12 @@
1
+ import { Switch as FoundationSwitch } from '@microsoft/fast-foundation';
2
+ export type { Switch };
3
+ declare global {
4
+ interface HTMLElementTagNameMap {
5
+ 'nimble-switch': Switch;
6
+ }
7
+ }
8
+ /**
9
+ * A nimble-styled switch control.
10
+ */
11
+ declare class Switch extends FoundationSwitch {
12
+ }
@@ -0,0 +1 @@
1
+ export declare const styles: import("@microsoft/fast-element").ElementStyles;
@@ -0,0 +1,2 @@
1
+ import type { Switch } from '.';
2
+ export declare const template: import("@microsoft/fast-element").ViewTemplate<Switch, any>;
@@ -1,2 +1,4 @@
1
+ import { ViewTemplate } from '@microsoft/fast-element';
2
+ import { FoundationElementTemplate, ButtonOptions } from '@microsoft/fast-foundation';
1
3
  import type { ToggleButton } from '.';
2
- export declare const template: import("@microsoft/fast-element").ViewTemplate<ToggleButton, any>;
4
+ export declare const template: FoundationElementTemplate<ViewTemplate<ToggleButton>, ButtonOptions>;
@@ -88,14 +88,26 @@ export const styles = css `
88
88
  }
89
89
 
90
90
  :host([content-hidden]) .content {
91
- display: none;
91
+ ${
92
+ /**
93
+ * Hide content visually while keeping it screen reader-accessible.
94
+ * Source: https://webaim.org/techniques/css/invisiblecontent/#techniques
95
+ * See discussion here: https://github.com/microsoft/fast/issues/5740#issuecomment-1068195035
96
+ */
97
+ ''}
98
+ display: inline-block;
99
+ height: 1px;
100
+ width: 1px;
101
+ position: absolute;
102
+ margin: -1px;
103
+ clip: rect(1px, 1px, 1px, 1px);
104
+ clip-path: inset(50%);
105
+ overflow: hidden;
106
+ padding: 0;
92
107
  }
93
108
 
94
109
  [part='start'] {
95
110
  display: contents;
96
- }
97
-
98
- slot[name='start']::slotted(*) {
99
111
  ${iconColor.cssCustomProperty}: ${buttonLabelFontColor};
100
112
  }
101
113
 
@@ -104,6 +116,11 @@ export const styles = css `
104
116
  }
105
117
 
106
118
  [part='end'] {
119
+ display: contents;
120
+ ${iconColor.cssCustomProperty}: ${buttonLabelFontColor};
121
+ }
122
+
123
+ :host([content-hidden]) [part='end'] {
107
124
  display: none;
108
125
  }
109
126
  `
@@ -1 +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,eAAe,EACf,oBAAoB,EACpB,4BAA4B,EAC5B,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,eAAe,EAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,aAAa,CAAC;;;;kBAIV,aAAa;iBACd,oBAAoB;gBACrB,eAAe;;;;;UAKrB;AACE;;;;EAIE,CAAC,EACP;;;;;iBAKS,4BAA4B;;;;;;;;kBAQ3B,WAAW;;;;;;;;;;;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AAqB;oCAC9B,gBAAgB;;;0BAG1B,YAAY;6CACO,qBAAqB;oCAC9B,gBAAgB;;;;wCAIZ,iBAAiB;oCACrB,iBAAiB;;;;6CAIR,qBAAqB;;;aAGrD,CACJ,CACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Switch as FoundationSwitch } from '@microsoft/fast-foundation';
2
+ export type { Switch };
3
+ declare global {
4
+ interface HTMLElementTagNameMap {
5
+ 'nimble-switch': Switch;
6
+ }
7
+ }
8
+ /**
9
+ * A nimble-styled switch control.
10
+ */
11
+ declare class Switch extends FoundationSwitch {
12
+ }
@@ -0,0 +1,16 @@
1
+ import { DesignSystem, Switch as FoundationSwitch } from '@microsoft/fast-foundation';
2
+ import { styles } from './styles';
3
+ import { template } from './template';
4
+ /**
5
+ * A nimble-styled switch control.
6
+ */
7
+ class Switch extends FoundationSwitch {
8
+ }
9
+ const nimbleSwitch = Switch.compose({
10
+ baseClass: FoundationSwitch,
11
+ baseName: 'switch',
12
+ template,
13
+ styles
14
+ });
15
+ DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleSwitch());
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/switch/index.ts"],"names":[],"mappings":"AAAA,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;AAUtC;;GAEG;AACH,MAAM,MAAO,SAAQ,gBAAgB;CAAG;AAExC,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAgB;IAC/C,SAAS,EAAE,gBAAgB;IAC3B,QAAQ,EAAE,QAAQ;IAClB,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const styles: import("@microsoft/fast-element").ElementStyles;
@@ -0,0 +1,174 @@
1
+ import { css } from '@microsoft/fast-element';
2
+ import { display } from '@microsoft/fast-foundation';
3
+ import { Black15, Black7, Black91, White } from '@ni/nimble-tokens/dist/styledictionary/js/tokens';
4
+ import { borderHoverColor, borderWidth, buttonLabelDisabledFontColor, buttonLabelFont, buttonLabelFontColor, controlHeight, controlLabelDisabledFontColor, controlLabelFont, controlLabelFontColor, fillHoverColor, smallDelay } from '../theme-provider/design-tokens';
5
+ import { hexToRgbaCssColor } from '../utilities/style/colors';
6
+ import { focusVisible } from '../utilities/style/focus';
7
+ import { themeBehavior } from '../utilities/style/theme';
8
+ export const styles = css `
9
+ ${display('inline-flex')}
10
+
11
+ :host {
12
+ outline: none;
13
+ font: ${buttonLabelFont};
14
+ color: ${buttonLabelFontColor};
15
+ flex-direction: column;
16
+ cursor: pointer;
17
+ --ni-private-switch-height: 24px;
18
+ --ni-private-switch-indicator-size: 16px;
19
+ padding-bottom: calc(
20
+ ${controlHeight} - var(--ni-private-switch-height)
21
+ );
22
+ }
23
+
24
+ :host([disabled]) {
25
+ cursor: default;
26
+ color: ${buttonLabelDisabledFontColor};
27
+ }
28
+
29
+ .label {
30
+ color: ${controlLabelFontColor};
31
+ font: ${controlLabelFont};
32
+ }
33
+
34
+ :host([disabled]) .label {
35
+ color: ${controlLabelDisabledFontColor};
36
+ }
37
+
38
+ .label__hidden {
39
+ display: none;
40
+ visibility: hidden;
41
+ }
42
+
43
+ .switch-container {
44
+ display: flex;
45
+ align-items: center;
46
+ }
47
+
48
+ slot[name='unchecked-message']::slotted(*) {
49
+ margin-inline-end: 8px;
50
+ }
51
+
52
+ .switch {
53
+ display: flex;
54
+ height: var(--ni-private-switch-height);
55
+ width: calc(var(--ni-private-switch-height) * 2);
56
+ box-sizing: border-box;
57
+ background-color: ${fillHoverColor};
58
+ border-radius: calc(var(--ni-private-switch-height) / 2);
59
+ align-items: center;
60
+ border: calc(${borderWidth} * 2) solid transparent;
61
+ }
62
+
63
+ :host([disabled]) .switch {
64
+ background-color: var(--ni-private-switch-background-disabled-color);
65
+ }
66
+
67
+ :host(${focusVisible}) .switch {
68
+ border-color: ${borderHoverColor};
69
+ }
70
+
71
+ .checked-indicator-spacer {
72
+ flex-grow: 0;
73
+ transition: flex-grow ${smallDelay} ease-in-out;
74
+ }
75
+
76
+ :host([aria-checked='true']) .checked-indicator-spacer {
77
+ flex-grow: 1;
78
+ transition: flex-grow ${smallDelay} ease-in-out;
79
+ }
80
+
81
+ .checked-indicator {
82
+ display: flex;
83
+ justify-content: center;
84
+ align-items: center;
85
+ background-color: var(--ni-private-switch-indicator-background-color);
86
+ box-sizing: border-box;
87
+ width: var(--ni-private-switch-indicator-size);
88
+ height: var(--ni-private-switch-indicator-size);
89
+ border-radius: calc(var(--ni-private-switch-indicator-size) / 2);
90
+ margin: calc(
91
+ calc(
92
+ var(--ni-private-switch-height) -
93
+ var(--ni-private-switch-indicator-size)
94
+ ) / 2
95
+ );
96
+ border: ${borderWidth} solid
97
+ var(--ni-private-switch-indicator-border-color);
98
+ }
99
+
100
+ :host(:hover) .checked-indicator {
101
+ border: calc(${borderWidth} * 2) solid ${borderHoverColor};
102
+ }
103
+
104
+ :host([disabled]) .checked-indicator {
105
+ background-color: var(
106
+ --ni-private-switch-indicator-background-disabled-color
107
+ );
108
+ border: ${borderWidth} solid
109
+ var(--ni-private-switch-indicator-border-disabled-color);
110
+ }
111
+
112
+ :host(${focusVisible}) .checked-indicator {
113
+ border: ${borderWidth} solid ${borderHoverColor};
114
+ }
115
+
116
+ .checked-indicator-inner {
117
+ width: calc(var(--ni-private-switch-indicator-size) / 2);
118
+ height: calc(var(--ni-private-switch-indicator-size) / 2);
119
+ border-radius: calc(var(--ni-private-switch-indicator-size) / 4);
120
+ background-color: var(--ni-private-switch-indicator-border-color);
121
+ opacity: 0;
122
+ transition: opacity ${smallDelay} ease-in-out;
123
+ }
124
+
125
+ :host([disabled]) .checked-indicator-inner {
126
+ background-color: var(
127
+ --ni-private-switch-indicator-border-disabled-color
128
+ );
129
+ }
130
+
131
+ :host([aria-checked='true']) .checked-indicator-inner {
132
+ opacity: 1;
133
+ transition: opacity ${smallDelay} ease-in-out;
134
+ }
135
+
136
+ slot[name='checked-message']::slotted(*) {
137
+ margin-inline-start: 8px;
138
+ }
139
+
140
+ @media (prefers-reduced-motion) {
141
+ .checked-indicator-inner,
142
+ .checked-indicator-spacer {
143
+ transition-duration: 0s;
144
+ }
145
+ }
146
+ `.withBehaviors(themeBehavior(css `
147
+ ${'' /* Light theme */}
148
+ :host {
149
+ --ni-private-switch-background-disabled-color: ${hexToRgbaCssColor(Black91, 0.07)};
150
+ --ni-private-switch-indicator-background-color: ${White};
151
+ --ni-private-switch-indicator-background-disabled-color: ${hexToRgbaCssColor(White, 0.1)};
152
+ --ni-private-switch-indicator-border-color: ${Black91};
153
+ --ni-private-switch-indicator-border-disabled-color: ${hexToRgbaCssColor(Black91, 0.3)};
154
+ }
155
+ `, css `
156
+ ${'' /* Dark theme */}
157
+ :host {
158
+ --ni-private-switch-background-disabled-color: ${hexToRgbaCssColor(Black15, 0.07)};
159
+ --ni-private-switch-indicator-background-color: ${hexToRgbaCssColor(Black91, 0.3)};
160
+ --ni-private-switch-indicator-background-disabled-color: ${hexToRgbaCssColor(Black91, 0.1)};
161
+ --ni-private-switch-indicator-border-color: ${Black7};
162
+ --ni-private-switch-indicator-border-disabled-color: ${hexToRgbaCssColor(Black7, 0.3)};
163
+ }
164
+ `, css `
165
+ ${'' /* Color theme */}
166
+ :host {
167
+ --ni-private-switch-background-disabled-color: ${hexToRgbaCssColor(White, 0.07)};
168
+ --ni-private-switch-indicator-background-color: ${hexToRgbaCssColor(White, 0.1)};
169
+ --ni-private-switch-indicator-background-disabled-color: ${hexToRgbaCssColor(White, 0.1)};
170
+ --ni-private-switch-indicator-border-color: ${White};
171
+ --ni-private-switch-indicator-border-disabled-color: ${hexToRgbaCssColor(White, 0.3)};
172
+ }
173
+ `));
174
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/switch/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACH,OAAO,EACP,MAAM,EACN,OAAO,EACP,KAAK,EACR,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACH,gBAAgB,EAChB,WAAW,EACX,4BAA4B,EAC5B,eAAe,EACf,oBAAoB,EACpB,aAAa,EACb,6BAA6B,EAC7B,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EACd,UAAU,EACb,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,aAAa,CAAC;;;;gBAIZ,eAAe;iBACd,oBAAoB;;;;;;cAMvB,aAAa;;;;;;iBAMV,4BAA4B;;;;iBAI5B,qBAAqB;gBACtB,gBAAgB;;;;iBAIf,6BAA6B;;;;;;;;;;;;;;;;;;;;;;4BAsBlB,cAAc;;;uBAGnB,WAAW;;;;;;;YAOtB,YAAY;wBACA,gBAAgB;;;;;gCAKR,UAAU;;;;;gCAKV,UAAU;;;;;;;;;;;;;;;;;;kBAkBxB,WAAW;;;;;uBAKN,WAAW,eAAe,gBAAgB;;;;;;;kBAO/C,WAAW;;;;YAIjB,YAAY;kBACN,WAAW,UAAU,gBAAgB;;;;;;;;;8BASzB,UAAU;;;;;;;;;;;8BAWV,UAAU;;;;;;;;;;;;;CAavC,CAAC,aAAa,CACP,aAAa,CACT,GAAG,CAAA;cACD,EAAE,CAAC,iBAAiB;;iEAE+B,iBAAiB,CAClE,OAAO,EACP,IAAI,CACP;kEACqD,KAAK;2EACI,iBAAiB,CAC5E,KAAK,EACL,GAAG,CACN;8DACiD,OAAO;uEACE,iBAAiB,CACxE,OAAO,EACP,GAAG,CACN;;SAEJ,EACG,GAAG,CAAA;cACD,EAAE,CAAC,gBAAgB;;iEAEgC,iBAAiB,CAClE,OAAO,EACP,IAAI,CACP;kEACqD,iBAAiB,CACnE,OAAO,EACP,GAAG,CACN;2EAC8D,iBAAiB,CAC5E,OAAO,EACP,GAAG,CACN;8DACiD,MAAM;uEACG,iBAAiB,CACxE,MAAM,EACN,GAAG,CACN;;SAEJ,EACG,GAAG,CAAA;cACD,EAAE,CAAC,iBAAiB;;iEAE+B,iBAAiB,CAClE,KAAK,EACL,IAAI,CACP;kEACqD,iBAAiB,CACnE,KAAK,EACL,GAAG,CACN;2EAC8D,iBAAiB,CAC5E,KAAK,EACL,GAAG,CACN;8DACiD,KAAK;uEACI,iBAAiB,CACxE,KAAK,EACL,GAAG,CACN;;SAEJ,CACA,CACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { Switch } from '.';
2
+ export declare const template: import("@microsoft/fast-element").ViewTemplate<Switch, any>;
@@ -0,0 +1,38 @@
1
+ import { html, slotted } from '@microsoft/fast-element';
2
+ // prettier-ignore
3
+ export const template = html `
4
+ <template
5
+ role="switch"
6
+ aria-checked="${x => x.checked}"
7
+ aria-disabled="${x => x.disabled}"
8
+ aria-readonly="${x => x.readOnly}"
9
+ tabindex="${x => (x.disabled ? null : 0)}"
10
+ @keypress="${(x, c) => x.keypressHandler(c.event)}"
11
+ @click="${(x, c) => x.clickHandler(c.event)}"
12
+ class="${x => (x.checked ? 'checked' : '')}"
13
+ >
14
+ <label
15
+ part="label"
16
+ class="${x => (x.defaultSlottedNodes?.length ? 'label' : 'label label__hidden')}"
17
+ >
18
+ <slot ${slotted('defaultSlottedNodes')}></slot>
19
+ </label>
20
+ <div class="switch-container">
21
+ <span class="status-message unchecked-message" part="unchecked-message">
22
+ <slot name="unchecked-message"></slot>
23
+ </span>
24
+ <div part="switch" class="switch">
25
+ <slot name="switch">
26
+ <span class="checked-indicator-spacer"></span>
27
+ <span class="checked-indicator" part="checked-indicator">
28
+ <span class="checked-indicator-inner">
29
+ </span>
30
+ </slot>
31
+ </div>
32
+ <span class="status-message checked-message" part="checked-message">
33
+ <slot name="checked-message"></slot>
34
+ </span>
35
+ </div>
36
+ </template>
37
+ `;
38
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/switch/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAGxD,kBAAkB;AAClB,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAQ;;;wBAGZ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO;yBACb,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;yBACf,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;oBACpB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;qBAC3B,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;iBAChD,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;;;;qBAI7B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC;;oBAEvE,OAAO,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;CAmBjD,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { attr } from '@microsoft/fast-element';
3
- import { DesignSystem, Switch as FoundationSwitch } from '@microsoft/fast-foundation';
3
+ import { applyMixins, DesignSystem, StartEnd, Switch as FoundationSwitch } from '@microsoft/fast-foundation';
4
4
  import { styles } from './styles';
5
5
  import { template } from './template';
6
6
  import { ButtonAppearance } from '../patterns/button/types';
@@ -36,6 +36,7 @@ __decorate([
36
36
  __decorate([
37
37
  attr({ attribute: 'content-hidden', mode: 'boolean' })
38
38
  ], ToggleButton.prototype, "contentHidden", void 0);
39
+ applyMixins(ToggleButton, StartEnd);
39
40
  const nimbleToggleButton = ToggleButton.compose({
40
41
  baseName: 'toggle-button',
41
42
  template,
@@ -1 +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;;QACI;;;;;;WAMG;QAEI,eAAU,GAAqB,gBAAgB,CAAC,OAAO,CAAC;QAE/D;;;;;;;;WAQG;QAEI,kBAAa,GAAG,KAAK,CAAC;IAIjC,CAAC;CAAA;AAhBG;IADC,IAAI;gDAC0D;AAY/D;IADC,IAAI,CAAC,EAAE,SAAS,EAAE,gBAAgB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YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC,CAAC"}
@@ -1,2 +1,4 @@
1
+ import { ViewTemplate } from '@microsoft/fast-element';
2
+ import { FoundationElementTemplate, ButtonOptions } from '@microsoft/fast-foundation';
1
3
  import type { ToggleButton } from '.';
2
- export declare const template: import("@microsoft/fast-element").ViewTemplate<ToggleButton, any>;
4
+ export declare const template: FoundationElementTemplate<ViewTemplate<ToggleButton>, ButtonOptions>;
@@ -1,12 +1,12 @@
1
1
  import { html, ref } from '@microsoft/fast-element';
2
- export const template = html `
2
+ import { endSlotTemplate, startSlotTemplate } from '@microsoft/fast-foundation';
3
+ export const template = (context, definition) => html `
3
4
  <div
4
5
  role="button"
5
6
  part="control"
6
7
  aria-pressed="${(x) => x.checked}"
7
8
  aria-disabled="${(x) => x.disabled}"
8
9
  aria-readonly="${(x) => x.readOnly}"
9
- aria-labelledby="nimble-toggle-button-content"
10
10
  tabindex="${(x) => (x.disabled ? null : 0)}"
11
11
  @keypress="${(x, c) => x.keypressHandler(c.event)}"
12
12
  @click="${(x, c) => x.clickHandler(c.event)}"
@@ -14,12 +14,11 @@ export const template = html `
14
14
  ?disabled="${x => x.disabled}"
15
15
  ${ref('control')}
16
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">
17
+ ${startSlotTemplate(context, definition)}
18
+ <span class="content" part="content">
21
19
  <slot></slot>
22
20
  </span>
21
+ ${endSlotTemplate(context, definition)}
23
22
  </div>
24
23
  `;
25
24
  //# sourceMappingURL=template.js.map
@@ -1 +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;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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;;UAEd,iBAAiB,CAAC,OAAO,EAAE,UAAU,CAAC;;;;UAItC,eAAe,CAAC,OAAO,EAAE,UAAU,CAAC;;CAE7C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ni/nimble-components",
3
- "version": "7.0.1",
3
+ "version": "7.2.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 build-components && npm run generate-scss && npm run build-storybook",