@nimbus-ds/segmented-control 2.0.0 → 2.0.2
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.
- package/CHANGELOG.md +13 -1
- package/dist/CHANGELOG.md +13 -1
- package/dist/index.d.ts +60 -23
- package/dist/index.js +1 -1
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
The SegmentedControl component is a composite component that allows us to select one or more options from a list.
|
|
3
|
+
The SegmentedControl component is a composite component that allows us to select one or more options from a list.
|
|
4
|
+
|
|
5
|
+
## 2026-01-13 `2.0.2`
|
|
6
|
+
|
|
7
|
+
#### 🎉 New features
|
|
8
|
+
|
|
9
|
+
- Adds support for React 19. ([#404](https://github.com/TiendaNube/nimbus-design-system/pull/404) by [@joacotornello](https://github.com/joacotornello))
|
|
10
|
+
|
|
11
|
+
## 2025-09-11 `2.0.1`
|
|
12
|
+
|
|
13
|
+
#### 🐛 Bug fixes
|
|
14
|
+
|
|
15
|
+
- Fixed controlled mode requiring both selected segments and handler for activating to only requiring 1 of either.([#319](https://github.com/TiendaNube/nimbus-design-system/pull/347) by [@mrolando-tn](https://github.com/mrolando-tn))
|
|
4
16
|
|
|
5
17
|
## 2025-07-28 `2.0.0`
|
|
6
18
|
|
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
The SegmentedControl component is a composite component that allows us to select one or more options from a list.
|
|
3
|
+
The SegmentedControl component is a composite component that allows us to select one or more options from a list.
|
|
4
|
+
|
|
5
|
+
## 2026-01-13 `2.0.2`
|
|
6
|
+
|
|
7
|
+
#### 🎉 New features
|
|
8
|
+
|
|
9
|
+
- Adds support for React 19. ([#404](https://github.com/TiendaNube/nimbus-design-system/pull/404) by [@joacotornello](https://github.com/joacotornello))
|
|
10
|
+
|
|
11
|
+
## 2025-09-11 `2.0.1`
|
|
12
|
+
|
|
13
|
+
#### 🐛 Bug fixes
|
|
14
|
+
|
|
15
|
+
- Fixed controlled mode requiring both selected segments and handler for activating to only requiring 1 of either.([#319](https://github.com/TiendaNube/nimbus-design-system/pull/347) by [@mrolando-tn](https://github.com/mrolando-tn))
|
|
4
16
|
|
|
5
17
|
## 2025-07-28 `2.0.0`
|
|
6
18
|
|
package/dist/index.d.ts
CHANGED
|
@@ -22,10 +22,10 @@ export interface PolymorphicForwardRefComponent<IntrinsicElementString, OwnProps
|
|
|
22
22
|
* so that events are typed when using JSX.IntrinsicElements.
|
|
23
23
|
*/
|
|
24
24
|
<As = IntrinsicElementString>(props: As extends "" ? {
|
|
25
|
-
as: keyof JSX.IntrinsicElements;
|
|
25
|
+
as: keyof React.JSX.IntrinsicElements;
|
|
26
26
|
} : As extends React.ComponentType<infer P> ? Merge<P, OwnProps & {
|
|
27
27
|
as: As;
|
|
28
|
-
}> : As extends keyof JSX.IntrinsicElements ? Merge<JSX.IntrinsicElements[As], OwnProps & {
|
|
28
|
+
}> : As extends keyof React.JSX.IntrinsicElements ? Merge<React.JSX.IntrinsicElements[As], OwnProps & {
|
|
29
29
|
as: As;
|
|
30
30
|
}> : never): React.ReactElement | null;
|
|
31
31
|
}
|
|
@@ -34,6 +34,7 @@ export interface Conditions<T> {
|
|
|
34
34
|
md?: T;
|
|
35
35
|
lg?: T;
|
|
36
36
|
xl?: T;
|
|
37
|
+
xxl?: T;
|
|
37
38
|
}
|
|
38
39
|
export type BorderStyle = "solid" | "none" | "hidden" | "dashed" | "dotted";
|
|
39
40
|
export type BoxSizing = "border-box" | "content-box";
|
|
@@ -50,11 +51,15 @@ export type Position = "absolute" | "fixed" | "relative" | "static" | "sticky";
|
|
|
50
51
|
export type Overflow = "visible" | "hidden" | "scroll" | "auto";
|
|
51
52
|
export type PointerEvents = "auto" | "none" | "visiblePainted" | "visibleFill" | "visibleStroke" | "visible" | "painted" | "fill" | "stroke" | "all" | "inherit";
|
|
52
53
|
export type TransitionTiming = "ease" | "ease-in" | "ease-out" | "ease-in-out" | "linear" | "step-start" | "step-end";
|
|
54
|
+
export type ScrollbarWidth = "auto" | "none" | "thin";
|
|
53
55
|
declare const propertiesBox: {
|
|
54
56
|
gap: {
|
|
55
57
|
none: string;
|
|
56
58
|
"0-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
57
|
-
"1": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
59
|
+
"1": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`; /**
|
|
60
|
+
* The display property sets whether an box is treated as a block or inline element and the layout used for its children,
|
|
61
|
+
* such as grid or flex.
|
|
62
|
+
*/
|
|
58
63
|
"1-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
59
64
|
"2": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
60
65
|
"2-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
@@ -78,7 +83,10 @@ declare const propertiesBox: {
|
|
|
78
83
|
gridGap: {
|
|
79
84
|
none: string;
|
|
80
85
|
"0-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
81
|
-
"1": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
86
|
+
"1": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`; /**
|
|
87
|
+
* The display property sets whether an box is treated as a block or inline element and the layout used for its children,
|
|
88
|
+
* such as grid or flex.
|
|
89
|
+
*/
|
|
82
90
|
"1-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
83
91
|
"2": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
84
92
|
"2-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
@@ -129,6 +137,14 @@ declare const propertiesBox: {
|
|
|
129
137
|
"neutral-surfaceHighlight": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
130
138
|
"neutral-surfaceDisabled": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
131
139
|
"neutral-textLow": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
140
|
+
"neutral-textHigh": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
141
|
+
"ai-generative-surface": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
142
|
+
"ai-generative-surfaceHighlight": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
143
|
+
transparent: string;
|
|
144
|
+
};
|
|
145
|
+
background: {
|
|
146
|
+
"ai-generative-interactive-border": string;
|
|
147
|
+
"ai-generative-interactive": string;
|
|
132
148
|
transparent: string;
|
|
133
149
|
};
|
|
134
150
|
color: {
|
|
@@ -155,6 +171,9 @@ declare const propertiesBox: {
|
|
|
155
171
|
"neutral-surfaceHighlight": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
156
172
|
"neutral-surfaceDisabled": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
157
173
|
"neutral-textLow": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
174
|
+
"neutral-textHigh": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
175
|
+
"ai-generative-surface": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
176
|
+
"ai-generative-surfaceHighlight": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
158
177
|
transparent: string;
|
|
159
178
|
};
|
|
160
179
|
borderColor: {
|
|
@@ -177,10 +196,7 @@ declare const propertiesBox: {
|
|
|
177
196
|
transparent: string;
|
|
178
197
|
};
|
|
179
198
|
borderRadius: {
|
|
180
|
-
"0-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
181
|
-
* The alignItems property sets the align-self value on all direct children as a group. In Flexbox, it controls the alignment of items on the Cross Axis.
|
|
182
|
-
* In Grid Layout, it controls the alignment of items on the Block Axis within their grid area.
|
|
183
|
-
*/
|
|
199
|
+
"0-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
184
200
|
"1": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
185
201
|
"2": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
186
202
|
"3": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
@@ -188,10 +204,6 @@ declare const propertiesBox: {
|
|
|
188
204
|
"5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
189
205
|
"6": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
190
206
|
full: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
191
|
-
/**
|
|
192
|
-
* The alignSelf property overrides a grid or flex item's align-items value. In Grid, it aligns the item inside the grid area.
|
|
193
|
-
* In Flexbox, it aligns the item on the cross axis.
|
|
194
|
-
*/
|
|
195
207
|
base: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
196
208
|
half: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
197
209
|
none: string;
|
|
@@ -210,7 +222,10 @@ declare const propertiesBox: {
|
|
|
210
222
|
spacing: {
|
|
211
223
|
none: string;
|
|
212
224
|
"0-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
213
|
-
"1": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
225
|
+
"1": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`; /**
|
|
226
|
+
* The display property sets whether an box is treated as a block or inline element and the layout used for its children,
|
|
227
|
+
* such as grid or flex.
|
|
228
|
+
*/
|
|
214
229
|
"1-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
215
230
|
"2": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
216
231
|
"2-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
@@ -233,7 +248,10 @@ declare const propertiesBox: {
|
|
|
233
248
|
};
|
|
234
249
|
margin: {
|
|
235
250
|
"0-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
236
|
-
"1": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
251
|
+
"1": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`; /**
|
|
252
|
+
* The display property sets whether an box is treated as a block or inline element and the layout used for its children,
|
|
253
|
+
* such as grid or flex.
|
|
254
|
+
*/
|
|
237
255
|
"1-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
238
256
|
"2": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
239
257
|
"2-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
@@ -268,6 +286,7 @@ declare const propertiesBox: {
|
|
|
268
286
|
"4": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
269
287
|
"5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
270
288
|
focusRing: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
289
|
+
aiFocus: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
271
290
|
};
|
|
272
291
|
transitionDuration: {
|
|
273
292
|
base: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
@@ -296,7 +315,10 @@ declare const propertiesBox: {
|
|
|
296
315
|
};
|
|
297
316
|
fontSize: {
|
|
298
317
|
"0-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
299
|
-
"1": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
318
|
+
"1": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`; /**
|
|
319
|
+
* The display property sets whether an box is treated as a block or inline element and the layout used for its children,
|
|
320
|
+
* such as grid or flex.
|
|
321
|
+
*/
|
|
300
322
|
"1-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
301
323
|
"2": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
302
324
|
"2-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
@@ -320,12 +342,17 @@ declare const propertiesBox: {
|
|
|
320
342
|
h2: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
321
343
|
h3: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
322
344
|
h4: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
323
|
-
h5: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
345
|
+
h5: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`; /**
|
|
346
|
+
* This defines the ability for a flex item to grow if necessary.
|
|
347
|
+
*/
|
|
324
348
|
h6: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
325
349
|
};
|
|
326
350
|
lineHeight: {
|
|
327
351
|
"0-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
328
|
-
"1": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
352
|
+
"1": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`; /**
|
|
353
|
+
* The display property sets whether an box is treated as a block or inline element and the layout used for its children,
|
|
354
|
+
* such as grid or flex.
|
|
355
|
+
*/
|
|
329
356
|
"1-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
330
357
|
"2": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
331
358
|
"2-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
@@ -345,16 +372,16 @@ declare const propertiesBox: {
|
|
|
345
372
|
"16": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
346
373
|
"18": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
347
374
|
"20": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
348
|
-
h1: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
375
|
+
h1: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`; /**
|
|
376
|
+
* The flexWrap property sets whether flex items are forced onto one line or can wrap onto multiple lines.
|
|
377
|
+
*/
|
|
349
378
|
h2: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
350
379
|
h3: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
351
380
|
h4: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
352
381
|
h5: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
353
382
|
h6: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
* @default border-box
|
|
357
|
-
*/
|
|
383
|
+
};
|
|
384
|
+
scrollbarWidth: ScrollbarWidth[];
|
|
358
385
|
};
|
|
359
386
|
export type BoxBorderColorProperties = keyof typeof propertiesBox.borderColor;
|
|
360
387
|
export type BoxBorderRadiusProperties = keyof typeof propertiesBox.borderRadius;
|
|
@@ -371,8 +398,10 @@ export type BoxTransitionDurationProperties = keyof typeof propertiesBox.transit
|
|
|
371
398
|
export type BoxFontSizeProperties = keyof typeof propertiesBox.fontSize;
|
|
372
399
|
export type BoxFontWeightProperties = keyof typeof propertiesBox.fontWeight;
|
|
373
400
|
export type BoxLineHeightProperties = keyof typeof propertiesBox.lineHeight;
|
|
401
|
+
export type BoxBackgroundProperties = keyof typeof propertiesBox.background;
|
|
374
402
|
export interface BoxConditions<T> extends Conditions<T> {
|
|
375
403
|
focus?: T;
|
|
404
|
+
focusVisible?: T;
|
|
376
405
|
focusWithin?: T;
|
|
377
406
|
active?: T;
|
|
378
407
|
hover?: T;
|
|
@@ -631,6 +660,10 @@ export interface BoxSprinkle {
|
|
|
631
660
|
* The zIndex property specifies the stack order of the box.
|
|
632
661
|
*/
|
|
633
662
|
zIndex?: BoxZIndexProperties | BoxConditions<BoxZIndexProperties>;
|
|
663
|
+
/**
|
|
664
|
+
* The background property sets the background of the box.
|
|
665
|
+
*/
|
|
666
|
+
background?: BoxBackgroundProperties | BoxConditions<BoxBackgroundProperties>;
|
|
634
667
|
/**
|
|
635
668
|
* The backgroundImage property sets one or more background images on an element.
|
|
636
669
|
*/
|
|
@@ -749,6 +782,10 @@ export interface BoxSprinkle {
|
|
|
749
782
|
* @default left
|
|
750
783
|
*/
|
|
751
784
|
textAlign?: TextAlign | BoxConditions<TextAlign>;
|
|
785
|
+
/**
|
|
786
|
+
* The scrollbarWidth property specifies the width of the scrollbar.
|
|
787
|
+
*/
|
|
788
|
+
scrollbarWidth?: ScrollbarWidth | BoxConditions<ScrollbarWidth>;
|
|
752
789
|
}
|
|
753
790
|
export interface BoxProperties extends BoxSprinkle {
|
|
754
791
|
/**
|
|
@@ -817,7 +854,7 @@ export interface ControlledSegmentedControlProperties extends SegmentedControlBa
|
|
|
817
854
|
* Callback fired when the selected segments change.
|
|
818
855
|
* @param selectedIds Array of selected segment IDs
|
|
819
856
|
*/
|
|
820
|
-
onSegmentsSelect
|
|
857
|
+
onSegmentsSelect?: (selectedIds: string[]) => void;
|
|
821
858
|
}
|
|
822
859
|
/**
|
|
823
860
|
* Props for the SegmentedControl component, supporting both controlled and uncontrolled modes
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("@nimbus-ds/box"),require("@nimbus-ds/styles"),require("@nimbus-ds/skeleton")):"function"==typeof define&&define.amd?define(["react","@nimbus-ds/box","@nimbus-ds/styles","@nimbus-ds/skeleton"],t):"object"==typeof exports?exports["@nimbus-ds/segmented-control"]=t(require("react"),require("@nimbus-ds/box"),require("@nimbus-ds/styles"),require("@nimbus-ds/skeleton")):e["@nimbus-ds/segmented-control"]=t(e.react,e["@nimbus-ds/box"],e["@nimbus-ds/styles"],e["@nimbus-ds/skeleton"])}(global,((e,t,n,r)=>(()=>{"use strict";var o={480:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useRefObjectAsForwardedRef=void 0;const r=n(155);t.useRefObjectAsForwardedRef=function(e,t){(0,r.useImperativeHandle)(e,(()=>t.current))}},849:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentedControl=void 0;const r=n(769).__importStar(n(155)),o=n(558),a=n(337),i=n(595),l=n(43),u=n(142),s=({children:e,fullWidth:t=!1,...n})=>{const[a,l]=(0,r.useState)([]),s=(0,r.useRef)(new Set),c=(0,i.isControlled)(n),d=(0,r.useMemo)((()=>c?n.selectedSegments:a),[c,a,n]),f=(0,r.useCallback)((e=>{const t=t=>{const n=[...t],r=n.indexOf(e);return-1!==r?(n.splice(r,1),n):(n.push(e),n)};if(c){const e=n;e.onSegmentsSelect&&e.onSegmentsSelect(t(d))}else l(t)}),[c,d,n]),p=(0,r.useCallback)((e=>{s.current.add(e)}),[]),y=(0,r.useCallback)((e=>{s.current.delete(e)}),[]),m=(0,r.useCallback)((e=>d.includes(e)),[d]),b=(0,r.useMemo)((()=>({registerButton:p,unregisterButton:y,toggleSegment:f,isSelected:m,fullWidth:t})),[p,y,f,m,t]),{onSegmentsSelect:_,selectedSegments:g,...v}=n;return r.default.createElement(u.SegmentedControlContext.Provider,{value:b},r.default.createElement(o.Box,{"aria-label":"Segmented control",role:"group","data-testid":"segmented-control-container",maxWidth:t?"100%":"fit-content",alignItems:"center",justifyContent:"center",flexWrap:"nowrap",...v,display:"flex",gap:"1",backgroundColor:"neutral-surface",borderRadius:"2"},e))};t.SegmentedControl=s,s.displayName="SegmentedControl",(s.Button=a.SegmentedControlButton).displayName="SegmentedControl.Button",(s.ButtonSkeleton=l.SegmentedControlButtonSkeleton).displayName="SegmentedControl.ButtonSkeleton"},454:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentedControlButton=void 0;const r=n(769).__importStar(n(155)),o=n(480),a=n(367),i=n(43),l=n(142),u=(0,r.forwardRef)((({className:e,style:t,as:n="button",id:i,label:u,disabled:s=!1,fullWidth:c=!1,children:d,onClick:f,...p},y)=>{const m=(0,r.useRef)(null);(0,o.useRefObjectAsForwardedRef)(y,m);const b=(0,l.useSegmentedControlContext)();(0,r.useEffect)((()=>{if(i)return b.registerButton(i),()=>{b.unregisterButton(i)}}),[b,i]),(0,r.useImperativeHandle)(y,(()=>m?.current)),(0,r.useEffect)((()=>{!m.current||m.current instanceof HTMLAnchorElement||m.current instanceof HTMLButtonElement||console.error("Error: Found `SegmentedControlButton` component that renders an inaccessible element",m.current,"Please ensure `SegmentedControlButton` always renders as <a> or <button>")}),[m]);const _=b.isSelected(i),g=b?b.fullWidth:c,{classnames:v}=a.segmentedControl.subcomponents.button,S=[v.appearance[_?"selected":"default"]].concat(g?v.fullWidth:"").join(" ");return r.default.createElement(n,{id:i,role:"button",...p,className:S,"aria-pressed":_,"aria-label":u,disabled:s,onClick:e=>{b&&i&&b.toggleSegment(i),f?.(e)},ref:m},d)}));t.SegmentedControlButton=u,u.Skeleton=i.SegmentedControlButtonSkeleton,u.Skeleton.displayName="SegmentedControlButton.Skeleton"},43:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentedControlButtonSkeleton=void 0;const r=n(769).__importDefault(n(155)),o=n(334);t.SegmentedControlButtonSkeleton=({width:e="100%",height:t="2rem",...n})=>r.default.createElement(o.Skeleton,{width:e,height:t,borderRadius:"0.5rem",...n})},207:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentedControlButtonSkeleton=void 0;const r=n(43);var o=n(43);Object.defineProperty(t,"SegmentedControlButtonSkeleton",{enumerable:!0,get:function(){return o.SegmentedControlButtonSkeleton}}),t.default=r.SegmentedControlButtonSkeleton},76:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});n(769).__exportStar(n(207),t)},611:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentedControlButton=t.SegmentedControlButtonSkeleton=void 0;const r=n(454);var o=n(76);Object.defineProperty(t,"SegmentedControlButtonSkeleton",{enumerable:!0,get:function(){return o.SegmentedControlButtonSkeleton}});var a=n(454);Object.defineProperty(t,"SegmentedControlButton",{enumerable:!0,get:function(){return a.SegmentedControlButton}}),t.default=r.SegmentedControlButton},337:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});n(769).__exportStar(n(611),t)},898:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useSegmentedControlContext=t.SegmentedControlContext=void 0;const r=n(155);t.SegmentedControlContext=(0,r.createContext)(null);t.useSegmentedControlContext=()=>{const e=(0,r.useContext)(t.SegmentedControlContext);if(!e)throw new Error("useSegmentedControlContext must be used within a SegmentedControl");return e}},142:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useSegmentedControlContext=t.SegmentedControlContext=void 0;var r=n(898);Object.defineProperty(t,"SegmentedControlContext",{enumerable:!0,get:function(){return r.SegmentedControlContext}}),Object.defineProperty(t,"useSegmentedControlContext",{enumerable:!0,get:function(){return r.useSegmentedControlContext}})},595:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isControlled=void 0;t.isControlled=e=>"selectedSegments"in e&&"onSegmentsSelect"in e},558:e=>{e.exports=t},334:e=>{e.exports=r},367:e=>{e.exports=n},155:t=>{t.exports=e},769:(e,t,n)=>{n.r(t),n.d(t,{__addDisposableResource:()=>I,__assign:()=>a,__asyncDelegator:()=>j,__asyncGenerator:()=>O,__asyncValues:()=>x,__await:()=>C,__awaiter:()=>y,__classPrivateFieldGet:()=>T,__classPrivateFieldIn:()=>R,__classPrivateFieldSet:()=>M,__createBinding:()=>b,__decorate:()=>l,__disposeResources:()=>A,__esDecorate:()=>s,__exportStar:()=>_,__extends:()=>o,__generator:()=>m,__importDefault:()=>B,__importStar:()=>E,__makeTemplateObject:()=>P,__metadata:()=>p,__param:()=>u,__propKey:()=>d,__read:()=>v,__rest:()=>i,__runInitializers:()=>c,__setFunctionName:()=>f,__spread:()=>S,__spreadArray:()=>w,__spreadArrays:()=>h,__values:()=>g,default:()=>F});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)};function i(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function l(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i}function u(e,t){return function(n,r){t(n,r,e)}}function s(e,t,n,r,o,a){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var l,u=r.kind,s="getter"===u?"get":"setter"===u?"set":"value",c=!t&&e?r.static?e:e.prototype:null,d=t||(c?Object.getOwnPropertyDescriptor(c,r.name):{}),f=!1,p=n.length-1;p>=0;p--){var y={};for(var m in r)y[m]="access"===m?{}:r[m];for(var m in r.access)y.access[m]=r.access[m];y.addInitializer=function(e){if(f)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var b=(0,n[p])("accessor"===u?{get:d.get,set:d.set}:d[s],y);if("accessor"===u){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(l=i(b.get))&&(d.get=l),(l=i(b.set))&&(d.set=l),(l=i(b.init))&&o.unshift(l)}else(l=i(b))&&("field"===u?o.unshift(l):d[s]=l)}c&&Object.defineProperty(c,r.name,d),f=!0}function c(e,t,n){for(var r=arguments.length>2,o=0;o<t.length;o++)n=r?t[o].call(e,n):t[o].call(e);return r?n:void 0}function d(e){return"symbol"==typeof e?e:"".concat(e)}function f(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function p(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function y(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{u(r.next(e))}catch(e){a(e)}}function l(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,l)}u((r=r.apply(e,t||[])).next())}))}function m(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(u){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,u])}}}var b=Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]};function _(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||b(t,e,n)}function g(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}function S(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(v(arguments[t]));return e}function h(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var a=arguments[t],i=0,l=a.length;i<l;i++,o++)r[o]=a[i];return r}function w(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function C(e){return this instanceof C?(this.v=e,this):new C(e)}function O(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(e,t||[]),a=[];return r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r;function i(e){o[e]&&(r[e]=function(t){return new Promise((function(n,r){a.push([e,t,n,r])>1||l(e,t)}))})}function l(e,t){try{(n=o[e](t)).value instanceof C?Promise.resolve(n.value.v).then(u,s):c(a[0][2],n)}catch(e){c(a[0][3],e)}var n}function u(e){l("next",e)}function s(e){l("throw",e)}function c(e,t){e(t),a.shift(),a.length&&l(a[0][0],a[0][1])}}function j(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,o){t[r]=e[r]?function(t){return(n=!n)?{value:C(e[r](t)),done:!1}:o?o(t):t}:o}}function x(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=g(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,o,(t=e[n](t)).done,t.value)}))}}}function P(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var k=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function E(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&b(t,e,n);return k(t,e),t}function B(e){return e&&e.__esModule?e:{default:e}}function T(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function M(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}function R(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function I(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var r;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(void 0===r){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose]}if("function"!=typeof r)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t}var D="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var r=new Error(n);return r.name="SuppressedError",r.error=e,r.suppressed=t,r};function A(e){function t(t){e.error=e.hasError?new D(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function n(){for(;e.stack.length;){var r=e.stack.pop();try{var o=r.dispose&&r.dispose.call(r.value);if(r.async)return Promise.resolve(o).then(n,(function(e){return t(e),n()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}const F={__extends:o,__assign:a,__rest:i,__decorate:l,__param:u,__metadata:p,__awaiter:y,__generator:m,__createBinding:b,__exportStar:_,__values:g,__read:v,__spread:S,__spreadArrays:h,__spreadArray:w,__await:C,__asyncGenerator:O,__asyncDelegator:j,__asyncValues:x,__makeTemplateObject:P,__importStar:E,__importDefault:B,__classPrivateFieldGet:T,__classPrivateFieldSet:M,__classPrivateFieldIn:R,__addDisposableResource:I,__disposeResources:A}}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return o[e](n,n.exports,i),n.exports}i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return(()=>{var e=l;Object.defineProperty(e,"__esModule",{value:!0}),e.useSegmentedControlContext=e.SegmentedControl=void 0;const t=i(849);var n=i(849);Object.defineProperty(e,"SegmentedControl",{enumerable:!0,get:function(){return n.SegmentedControl}});var r=i(142);Object.defineProperty(e,"useSegmentedControlContext",{enumerable:!0,get:function(){return r.useSegmentedControlContext}}),e.default=t.SegmentedControl})(),l})()));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("@nimbus-ds/box"),require("@nimbus-ds/styles"),require("@nimbus-ds/skeleton")):"function"==typeof define&&define.amd?define(["react","@nimbus-ds/box","@nimbus-ds/styles","@nimbus-ds/skeleton"],t):"object"==typeof exports?exports["@nimbus-ds/segmented-control"]=t(require("react"),require("@nimbus-ds/box"),require("@nimbus-ds/styles"),require("@nimbus-ds/skeleton")):e["@nimbus-ds/segmented-control"]=t(e.react,e["@nimbus-ds/box"],e["@nimbus-ds/styles"],e["@nimbus-ds/skeleton"])}(global,((e,t,n,r)=>(()=>{"use strict";var o={480:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useRefObjectAsForwardedRef=void 0;const r=n(155);t.useRefObjectAsForwardedRef=function(e,t){(0,r.useImperativeHandle)(e,(()=>t.current))}},849:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentedControl=void 0;const r=n(769).__importStar(n(155)),o=n(558),a=n(337),i=n(595),l=n(43),u=n(142),s=({children:e,fullWidth:t=!1,...n})=>{const[a,l]=(0,r.useState)([]),s=(0,r.useRef)(new Set),c=(0,i.isControlled)(n),d=(0,r.useMemo)((()=>c?n.selectedSegments:a),[c,a,n]),f=(0,r.useCallback)((e=>{const t=t=>{const n=[...t],r=n.indexOf(e);return-1!==r?(n.splice(r,1),n):(n.push(e),n)};if(c){const e=n;e.onSegmentsSelect&&e.onSegmentsSelect(t(d))}else l(t)}),[c,d,n]),p=(0,r.useCallback)((e=>{s.current.add(e)}),[]),y=(0,r.useCallback)((e=>{s.current.delete(e)}),[]),m=(0,r.useCallback)((e=>d.includes(e)),[d]),b=(0,r.useMemo)((()=>({registerButton:p,unregisterButton:y,toggleSegment:f,isSelected:m,fullWidth:t})),[p,y,f,m,t]),{onSegmentsSelect:_,selectedSegments:g,...v}=n;return r.default.createElement(u.SegmentedControlContext.Provider,{value:b},r.default.createElement(o.Box,{"aria-label":"Segmented control",role:"group","data-testid":"segmented-control-container",maxWidth:t?"100%":"fit-content",alignItems:"center",justifyContent:"center",flexWrap:"nowrap",...v,display:"flex",gap:"1",backgroundColor:"neutral-surface",borderRadius:"2"},e))};t.SegmentedControl=s,s.displayName="SegmentedControl",(s.Button=a.SegmentedControlButton).displayName="SegmentedControl.Button",(s.ButtonSkeleton=l.SegmentedControlButtonSkeleton).displayName="SegmentedControl.ButtonSkeleton"},454:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentedControlButton=void 0;const r=n(769).__importStar(n(155)),o=n(480),a=n(367),i=n(43),l=n(142),u=(0,r.forwardRef)((({className:e,style:t,as:n="button",id:i,label:u,disabled:s=!1,fullWidth:c=!1,children:d,onClick:f,...p},y)=>{const m=(0,r.useRef)(null);(0,o.useRefObjectAsForwardedRef)(y,m);const b=(0,l.useSegmentedControlContext)();(0,r.useEffect)((()=>{if(i)return b.registerButton(i),()=>{b.unregisterButton(i)}}),[b,i]),(0,r.useImperativeHandle)(y,(()=>m?.current)),(0,r.useEffect)((()=>{!m.current||m.current instanceof HTMLAnchorElement||m.current instanceof HTMLButtonElement||console.error("Error: Found `SegmentedControlButton` component that renders an inaccessible element",m.current,"Please ensure `SegmentedControlButton` always renders as <a> or <button>")}),[m]);const _=b.isSelected(i),g=b?b.fullWidth:c,{classnames:v}=a.segmentedControl.subcomponents.button,S=[v.appearance[_?"selected":"default"]].concat(g?v.fullWidth:"").join(" ");return r.default.createElement(n,{id:i,role:"button",...p,className:S,"aria-pressed":_,"aria-label":u,disabled:s,onClick:e=>{b&&i&&b.toggleSegment(i),f?.(e)},ref:m},d)}));t.SegmentedControlButton=u,u.Skeleton=i.SegmentedControlButtonSkeleton,u.Skeleton.displayName="SegmentedControlButton.Skeleton"},43:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentedControlButtonSkeleton=void 0;const r=n(769).__importDefault(n(155)),o=n(334);t.SegmentedControlButtonSkeleton=({width:e="100%",height:t="2rem",...n})=>r.default.createElement(o.Skeleton,{width:e,height:t,borderRadius:"0.5rem",...n})},207:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentedControlButtonSkeleton=void 0;const r=n(43);var o=n(43);Object.defineProperty(t,"SegmentedControlButtonSkeleton",{enumerable:!0,get:function(){return o.SegmentedControlButtonSkeleton}}),t.default=r.SegmentedControlButtonSkeleton},76:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});n(769).__exportStar(n(207),t)},611:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentedControlButton=t.SegmentedControlButtonSkeleton=void 0;const r=n(454);var o=n(76);Object.defineProperty(t,"SegmentedControlButtonSkeleton",{enumerable:!0,get:function(){return o.SegmentedControlButtonSkeleton}});var a=n(454);Object.defineProperty(t,"SegmentedControlButton",{enumerable:!0,get:function(){return a.SegmentedControlButton}}),t.default=r.SegmentedControlButton},337:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});n(769).__exportStar(n(611),t)},898:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useSegmentedControlContext=t.SegmentedControlContext=void 0;const r=n(155);t.SegmentedControlContext=(0,r.createContext)(null);t.useSegmentedControlContext=()=>{const e=(0,r.useContext)(t.SegmentedControlContext);if(!e)throw new Error("useSegmentedControlContext must be used within a SegmentedControl");return e}},142:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useSegmentedControlContext=t.SegmentedControlContext=void 0;var r=n(898);Object.defineProperty(t,"SegmentedControlContext",{enumerable:!0,get:function(){return r.SegmentedControlContext}}),Object.defineProperty(t,"useSegmentedControlContext",{enumerable:!0,get:function(){return r.useSegmentedControlContext}})},595:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isControlled=void 0;t.isControlled=e=>"selectedSegments"in e},558:e=>{e.exports=t},334:e=>{e.exports=r},367:e=>{e.exports=n},155:t=>{t.exports=e},769:(e,t,n)=>{n.r(t),n.d(t,{__addDisposableResource:()=>I,__assign:()=>a,__asyncDelegator:()=>j,__asyncGenerator:()=>O,__asyncValues:()=>x,__await:()=>C,__awaiter:()=>y,__classPrivateFieldGet:()=>T,__classPrivateFieldIn:()=>R,__classPrivateFieldSet:()=>M,__createBinding:()=>b,__decorate:()=>l,__disposeResources:()=>A,__esDecorate:()=>s,__exportStar:()=>_,__extends:()=>o,__generator:()=>m,__importDefault:()=>B,__importStar:()=>E,__makeTemplateObject:()=>P,__metadata:()=>p,__param:()=>u,__propKey:()=>d,__read:()=>v,__rest:()=>i,__runInitializers:()=>c,__setFunctionName:()=>f,__spread:()=>S,__spreadArray:()=>w,__spreadArrays:()=>h,__values:()=>g,default:()=>F});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)};function i(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function l(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i}function u(e,t){return function(n,r){t(n,r,e)}}function s(e,t,n,r,o,a){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var l,u=r.kind,s="getter"===u?"get":"setter"===u?"set":"value",c=!t&&e?r.static?e:e.prototype:null,d=t||(c?Object.getOwnPropertyDescriptor(c,r.name):{}),f=!1,p=n.length-1;p>=0;p--){var y={};for(var m in r)y[m]="access"===m?{}:r[m];for(var m in r.access)y.access[m]=r.access[m];y.addInitializer=function(e){if(f)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var b=(0,n[p])("accessor"===u?{get:d.get,set:d.set}:d[s],y);if("accessor"===u){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(l=i(b.get))&&(d.get=l),(l=i(b.set))&&(d.set=l),(l=i(b.init))&&o.unshift(l)}else(l=i(b))&&("field"===u?o.unshift(l):d[s]=l)}c&&Object.defineProperty(c,r.name,d),f=!0}function c(e,t,n){for(var r=arguments.length>2,o=0;o<t.length;o++)n=r?t[o].call(e,n):t[o].call(e);return r?n:void 0}function d(e){return"symbol"==typeof e?e:"".concat(e)}function f(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function p(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function y(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{u(r.next(e))}catch(e){a(e)}}function l(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,l)}u((r=r.apply(e,t||[])).next())}))}function m(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(u){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,u])}}}var b=Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]};function _(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||b(t,e,n)}function g(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}function S(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(v(arguments[t]));return e}function h(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var a=arguments[t],i=0,l=a.length;i<l;i++,o++)r[o]=a[i];return r}function w(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function C(e){return this instanceof C?(this.v=e,this):new C(e)}function O(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(e,t||[]),a=[];return r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r;function i(e){o[e]&&(r[e]=function(t){return new Promise((function(n,r){a.push([e,t,n,r])>1||l(e,t)}))})}function l(e,t){try{(n=o[e](t)).value instanceof C?Promise.resolve(n.value.v).then(u,s):c(a[0][2],n)}catch(e){c(a[0][3],e)}var n}function u(e){l("next",e)}function s(e){l("throw",e)}function c(e,t){e(t),a.shift(),a.length&&l(a[0][0],a[0][1])}}function j(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,o){t[r]=e[r]?function(t){return(n=!n)?{value:C(e[r](t)),done:!1}:o?o(t):t}:o}}function x(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=g(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,o,(t=e[n](t)).done,t.value)}))}}}function P(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var k=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function E(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&b(t,e,n);return k(t,e),t}function B(e){return e&&e.__esModule?e:{default:e}}function T(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function M(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}function R(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function I(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var r;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(void 0===r){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose]}if("function"!=typeof r)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t}var D="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var r=new Error(n);return r.name="SuppressedError",r.error=e,r.suppressed=t,r};function A(e){function t(t){e.error=e.hasError?new D(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function n(){for(;e.stack.length;){var r=e.stack.pop();try{var o=r.dispose&&r.dispose.call(r.value);if(r.async)return Promise.resolve(o).then(n,(function(e){return t(e),n()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}const F={__extends:o,__assign:a,__rest:i,__decorate:l,__param:u,__metadata:p,__awaiter:y,__generator:m,__createBinding:b,__exportStar:_,__values:g,__read:v,__spread:S,__spreadArrays:h,__spreadArray:w,__await:C,__asyncGenerator:O,__asyncDelegator:j,__asyncValues:x,__makeTemplateObject:P,__importStar:E,__importDefault:B,__classPrivateFieldGet:T,__classPrivateFieldSet:M,__classPrivateFieldIn:R,__addDisposableResource:I,__disposeResources:A}}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return o[e](n,n.exports,i),n.exports}i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return(()=>{var e=l;Object.defineProperty(e,"__esModule",{value:!0}),e.useSegmentedControlContext=e.SegmentedControl=void 0;const t=i(849);var n=i(849);Object.defineProperty(e,"SegmentedControl",{enumerable:!0,get:function(){return n.SegmentedControl}});var r=i(142);Object.defineProperty(e,"useSegmentedControlContext",{enumerable:!0,get:function(){return r.useSegmentedControlContext}}),e.default=t.SegmentedControl})(),l})()));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nimbus-ds/segmented-control",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
"version": "yarn version"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@nimbus-ds/box": "^4.
|
|
18
|
-
"@nimbus-ds/button": "^2.
|
|
19
|
-
"@nimbus-ds/skeleton": "^3.0.
|
|
20
|
-
"@nimbus-ds/typings": "^1.
|
|
17
|
+
"@nimbus-ds/box": "^4.3.3",
|
|
18
|
+
"@nimbus-ds/button": "^2.10.1",
|
|
19
|
+
"@nimbus-ds/skeleton": "^3.0.2",
|
|
20
|
+
"@nimbus-ds/typings": "^1.3.1"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@nimbus-ds/styles": "^9.
|
|
24
|
-
"react": "^16.8 || ^17.0 || ^18.0",
|
|
25
|
-
"react-dom": "^16.8 || ^17.0 || ^18.0"
|
|
23
|
+
"@nimbus-ds/styles": "^9.50.0",
|
|
24
|
+
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0",
|
|
25
|
+
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0"
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://nimbus.nuvemshop.com.br/documentation",
|
|
28
28
|
"repository": {
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"url": "https://github.com/TiendaNube/nimbus-design-system/issues"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@nimbus-ds/badge": "^3.1.
|
|
37
|
-
"@nimbus-ds/icon": "^3.1
|
|
38
|
-
"@nimbus-ds/icons": "^1.
|
|
39
|
-
"@nimbus-ds/tooltip": "^2.6.
|
|
40
|
-
"@nimbus-ds/webpack": "^1.
|
|
36
|
+
"@nimbus-ds/badge": "^3.1.3",
|
|
37
|
+
"@nimbus-ds/icon": "^3.3.1",
|
|
38
|
+
"@nimbus-ds/icons": "^1.15.1",
|
|
39
|
+
"@nimbus-ds/tooltip": "^2.6.2",
|
|
40
|
+
"@nimbus-ds/webpack": "^1.7.1"
|
|
41
41
|
}
|
|
42
42
|
}
|