@usefui/components 1.7.1 → 1.7.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/dist/index.mjs CHANGED
@@ -85,25 +85,6 @@ var ButtonIconStyles = css`
85
85
  svg {
86
86
  width: var(--fontsize-medium-20);
87
87
  height: var(--fontsize-medium-20);
88
- fill: currentColor;
89
- }
90
-
91
- svg {
92
- opacity: 0.6;
93
- }
94
-
95
- &:hover,
96
- &:focus,
97
- &:active {
98
- svg {
99
- opacity: 1;
100
- }
101
- }
102
-
103
- &[data-variant="primary"] {
104
- svg {
105
- fill: var(--body-color);
106
- }
107
88
  }
108
89
  `;
109
90
  var ButtonSizeStyles = css`
@@ -159,7 +140,6 @@ var ButtonBeforeDefaultStyles = css`
159
140
  `;
160
141
  var ButtonVariantsStyles = css`
161
142
  &[data-variant="primary"] {
162
- color: var(--body-color-alpha-80);
163
143
  background-color: var(--font-color);
164
144
  background: linear-gradient(
165
145
  180deg,
@@ -169,6 +149,11 @@ var ButtonVariantsStyles = css`
169
149
  background-size: 100% 200%;
170
150
  background-position: 0% 50%;
171
151
 
152
+ color: var(--body-color-alpha-80) !important;
153
+ svg * {
154
+ stroke: var(--body-color-alpha-80) !important;
155
+ }
156
+
172
157
  ::before {
173
158
  ${ButtonBeforeDefaultStyles}
174
159
  border-color: var(--body-color-alpha-20);
@@ -187,7 +172,6 @@ var ButtonVariantsStyles = css`
187
172
  }
188
173
  }
189
174
  &[data-variant="secondary"] {
190
- color: var(--font-color-alpha-60);
191
175
  border-color: var(--font-color-alpha-10);
192
176
 
193
177
  background-color: var(--body-color);
@@ -199,6 +183,8 @@ var ButtonVariantsStyles = css`
199
183
  background-size: 100% 200%;
200
184
  background-position: 0% 50%;
201
185
 
186
+ color: var(--font-color-alpha-60) !important;
187
+
202
188
  ::before {
203
189
  ${ButtonBeforeDefaultStyles}
204
190
  border-color: var(--font-color-alpha-10);
@@ -215,8 +201,6 @@ var ButtonVariantsStyles = css`
215
201
  }
216
202
  }
217
203
  &[data-variant="tertiary"] {
218
- color: var(--font-color-alpha-60);
219
-
220
204
  background-color: transparent;
221
205
  background: linear-gradient(
222
206
  -180deg,
@@ -226,6 +210,8 @@ var ButtonVariantsStyles = css`
226
210
  background-size: 100% 200%;
227
211
  background-position: 0% 10%;
228
212
 
213
+ color: var(--font-color-alpha-60) !important;
214
+
229
215
  &:hover,
230
216
  &:focus,
231
217
  &:active {
@@ -241,8 +227,8 @@ var ButtonVariantsStyles = css`
241
227
  }
242
228
  }
243
229
  &[data-variant="mono"] {
244
- color: var(--font-color-alpha-80);
245
230
  background-color: var(--contrast-color);
231
+ color: var(--font-color-alpha-80) !important;
246
232
 
247
233
  ::before {
248
234
  ${ButtonBeforeDefaultStyles}
@@ -261,9 +247,9 @@ var ButtonVariantsStyles = css`
261
247
  }
262
248
  }
263
249
  &[data-variant="border"] {
264
- color: var(--font-color-alpha-60);
265
250
  background-color: transparent;
266
251
  border-color: var(--font-color-alpha-10);
252
+ color: var(--font-color-alpha-60) !important;
267
253
 
268
254
  &:hover,
269
255
  &:focus,
@@ -305,7 +291,6 @@ var ButtonVariantsStyles = css`
305
291
  }
306
292
 
307
293
  &[data-variant="meta"] {
308
- color: var(--alpha-mono-white-80);
309
294
  background-color: var(--color-blue);
310
295
  background: linear-gradient(
311
296
  180deg,
@@ -315,6 +300,8 @@ var ButtonVariantsStyles = css`
315
300
  background-size: 100% 200%;
316
301
  background-position: 0% 50%;
317
302
 
303
+ color: var(--alpha-mono-white-80) !important;
304
+
318
305
  ::before {
319
306
  ${ButtonBeforeDefaultStyles}
320
307
  border-color: var(--tint-blue-30);
@@ -335,7 +322,6 @@ var ButtonVariantsStyles = css`
335
322
  }
336
323
  }
337
324
  &[data-variant="hint"] {
338
- color: var(--alpha-mono-white-80);
339
325
  background-color: var(--color-purple);
340
326
  background: linear-gradient(
341
327
  180deg,
@@ -345,6 +331,8 @@ var ButtonVariantsStyles = css`
345
331
  background-size: 100% 200%;
346
332
  background-position: 0% 50%;
347
333
 
334
+ color: var(--alpha-mono-white-80) !important;
335
+
348
336
  ::before {
349
337
  ${ButtonBeforeDefaultStyles}
350
338
  border-color: var(--shade-purple-20);
@@ -361,7 +349,6 @@ var ButtonVariantsStyles = css`
361
349
  }
362
350
  }
363
351
  &[data-variant="success"] {
364
- color: var(--alpha-mono-white-90);
365
352
  background-color: var(--shade-green-30);
366
353
  background: linear-gradient(
367
354
  180deg,
@@ -371,6 +358,8 @@ var ButtonVariantsStyles = css`
371
358
  background-size: 100% 200%;
372
359
  background-position: 0% 50%;
373
360
 
361
+ color: var(--alpha-mono-white-80) !important;
362
+
374
363
  ::before {
375
364
  ${ButtonBeforeDefaultStyles}
376
365
  border-color: var(--shade-green-20);
@@ -387,7 +376,6 @@ var ButtonVariantsStyles = css`
387
376
  }
388
377
  }
389
378
  &[data-variant="danger"] {
390
- color: var(--alpha-mono-white-80);
391
379
  background-color: var(--color-red);
392
380
  background: linear-gradient(
393
381
  180deg,
@@ -397,6 +385,8 @@ var ButtonVariantsStyles = css`
397
385
  background-size: 100% 200%;
398
386
  background-position: 0% 50%;
399
387
 
388
+ color: var(--alpha-mono-white-80) !important;
389
+
400
390
  ::before {
401
391
  ${ButtonBeforeDefaultStyles}
402
392
  border-color: var(--tint-red-60);
@@ -416,7 +406,6 @@ var ButtonVariantsStyles = css`
416
406
  }
417
407
  }
418
408
  &[data-variant="warning"] {
419
- color: var(--alpha-mono-dark-80);
420
409
  background-color: var(--color-orange);
421
410
  background: linear-gradient(
422
411
  180deg,
@@ -426,6 +415,8 @@ var ButtonVariantsStyles = css`
426
415
  background-size: 100% 200%;
427
416
  background-position: 0% 50%;
428
417
 
418
+ color: var(--alpha-mono-dark-80) !important;
419
+
429
420
  ::before {
430
421
  ${ButtonBeforeDefaultStyles}
431
422
  border-color: var(--tint-orange-30);
@@ -502,7 +493,8 @@ var ButtonWrapper = styled.button`
502
493
  ${ButtonSizeStyles}
503
494
  ${ButtonShapeStyles}
504
495
  ${ButtonVariantsStyles}
505
- &[data-rawIcon="false"] {
496
+
497
+ &[data-rawIcon="false"] {
506
498
  ${ButtonIconStyles}
507
499
  }
508
500
  }
@@ -1012,6 +1004,28 @@ var BadgeVariantStyles = css3`
1012
1004
  }
1013
1005
  }
1014
1006
  `;
1007
+ var BadgeEmphasisVariantStyles = css3`
1008
+ &[data-variant="danger"] {
1009
+ background-color: var(--color-red) !important;
1010
+ color: var(--color-mono-white) !important;
1011
+ }
1012
+ &[data-variant="warning"] {
1013
+ background-color: var(--color-orange) !important;
1014
+ color: var(--color-mono-dark) !important;
1015
+ }
1016
+ &[data-variant="success"] {
1017
+ background-color: var(--color-green) !important;
1018
+ color: var(--color-mono-white) !important;
1019
+ }
1020
+ &[data-variant="meta"] {
1021
+ background-color: var(--color-blue) !important;
1022
+ color: var(--color-mono-white) !important;
1023
+ }
1024
+ &[data-variant="hint"] {
1025
+ background-color: var(--color-purple) !important;
1026
+ color: var(--color-mono-white) !important;
1027
+ }
1028
+ `;
1015
1029
  var BadgeShapeStyles = css3`
1016
1030
  &[data-shape="square"] {
1017
1031
  border-radius: 0;
@@ -1049,6 +1063,10 @@ var BadgeWrapper2 = styled3.div`
1049
1063
  ${BadgeVariantStyles}
1050
1064
  ${BadgeShapeStyles}
1051
1065
  ${BadgeSizeStyles}
1066
+
1067
+ &[data-emphasis="true"] {
1068
+ ${BadgeEmphasisVariantStyles}
1069
+ }
1052
1070
  }
1053
1071
  `;
1054
1072
 
@@ -1056,6 +1074,7 @@ var BadgeWrapper2 = styled3.div`
1056
1074
  var Badge = (props) => {
1057
1075
  const {
1058
1076
  raw = false,
1077
+ emphasis = false,
1059
1078
  sizing = "small" /* Small */,
1060
1079
  variant = "primary" /* Primary */,
1061
1080
  shape = "smooth" /* Smooth */,
@@ -1069,6 +1088,7 @@ var Badge = (props) => {
1069
1088
  "data-variant": variant,
1070
1089
  "data-shape": shape,
1071
1090
  "data-size": sizing,
1091
+ "data-emphasis": emphasis,
1072
1092
  ...restProps
1073
1093
  },
1074
1094
  children
@@ -2102,7 +2122,8 @@ var Dialog = (props) => {
2102
2122
  if (open && toggleDialog) toggleDialog();
2103
2123
  }, []);
2104
2124
  if (lock) useDisabledScroll(Boolean(states.open));
2105
- return /* @__PURE__ */ React15.createElement(React15.Fragment, null, states.open && /* @__PURE__ */ React15.createElement(
2125
+ if (!states.open) return null;
2126
+ return /* @__PURE__ */ React15.createElement(
2106
2127
  ScrollArea,
2107
2128
  {
2108
2129
  as: DialogWrapper,
@@ -2117,7 +2138,7 @@ var Dialog = (props) => {
2117
2138
  ...restProps
2118
2139
  },
2119
2140
  children
2120
- ));
2141
+ );
2121
2142
  };
2122
2143
  Dialog.displayName = "Dialog";
2123
2144
  var DialogRoot = ({ children }) => {
@@ -2291,6 +2312,15 @@ var ContentWrapperSizes = css7`
2291
2312
  max-width: var(--large);
2292
2313
  }
2293
2314
  `;
2315
+ var ContentWrapperVariants = css7`
2316
+ &[data-variant="body"] {
2317
+ background-color: var(--body-color);
2318
+ }
2319
+
2320
+ &[data-variant="contrast"] {
2321
+ background-color: var(--contrast-color);
2322
+ }
2323
+ `;
2294
2324
  var RootWrapper = styled9.div`
2295
2325
  position: relative;
2296
2326
  `;
@@ -2317,13 +2347,14 @@ var ContentWrapper = styled9.ul`
2317
2347
  padding: var(--measurement-medium-30);
2318
2348
  margin: var(--measurement-medium-10) 0;
2319
2349
 
2320
- background-color: var(--body-color);
2321
2350
  border: var(--measurement-small-10) solid var(--font-color-alpha-10);
2322
2351
  border-radius: var(--measurement-medium-30);
2323
2352
 
2324
2353
  z-index: var(--depth-default-100);
2325
2354
 
2326
2355
  ${ContentWrapperSizes}
2356
+ ${ContentWrapperVariants}
2357
+
2327
2358
  animation-duration: 0.2s;
2328
2359
  animation-name: slide-in;
2329
2360
  animation-fill-mode: backwards;
@@ -2338,14 +2369,13 @@ var ItemWrapper2 = styled9.li`
2338
2369
  &[data-raw="false"] {
2339
2370
  padding: var(--measurement-medium-10) var(--measurement-medium-30);
2340
2371
  border-radius: var(--measurement-medium-20);
2372
+ color: var(--font-color);
2341
2373
 
2342
- text-align: left;
2343
- font-weight: 600;
2344
2374
  letter-spacing: calc(
2345
2375
  var(--fontsize-small-10) - ((var(--fontsize-small-10) * 1.066))
2346
2376
  );
2347
- font-size: var(--fontsize-medium-10);
2348
- color: var(--font-color);
2377
+ font-size: inherit;
2378
+ text-align: left;
2349
2379
 
2350
2380
  outline: none;
2351
2381
  cursor: pointer;
@@ -2357,7 +2387,7 @@ var ItemWrapper2 = styled9.li`
2357
2387
  &:active,
2358
2388
  &:focus-within,
2359
2389
  &:has(:active) {
2360
- background-color: var(--contrast-color);
2390
+ background-color: var(--font-color-alpha-10);
2361
2391
  }
2362
2392
  }
2363
2393
 
@@ -2422,7 +2452,14 @@ var DropdownMenuTrigger = (props) => {
2422
2452
  };
2423
2453
  DropdownMenuTrigger.displayName = "DropdownMenu.Trigger";
2424
2454
  var DropdownMenuContent = React17.forwardRef((props, _) => {
2425
- const { raw, sizing = "medium", defaultOpen, children, ...restProps } = props;
2455
+ const {
2456
+ raw,
2457
+ sizing = "medium" /* Medium */,
2458
+ variant = "body",
2459
+ defaultOpen,
2460
+ children,
2461
+ ...restProps
2462
+ } = props;
2426
2463
  const { id, states, methods } = useDropdownMenu();
2427
2464
  const { toggleOpen, setContentProps } = methods;
2428
2465
  const mounted = React17.useRef(false);
@@ -2488,6 +2525,7 @@ var DropdownMenuContent = React17.forwardRef((props, _) => {
2488
2525
  "aria-labelledby": id.split("|").at(0),
2489
2526
  "data-state": applyDataState(Boolean(states.open)),
2490
2527
  "data-sizing": sizing,
2528
+ "data-variant": variant,
2491
2529
  "data-side": hasEnoughHorizontalSpace ? "left" /* Left */ : "right" /* Right */,
2492
2530
  "data-align": hasEnoughHorizontalSpace ? "left" /* Left */ : "right" /* Right */,
2493
2531
  "data-raw": Boolean(raw),
@@ -2869,12 +2907,8 @@ var InnerWrapper = styled10.div`
2869
2907
  display: flex;
2870
2908
  flex-direction: column;
2871
2909
 
2872
- right: 0;
2873
- &[data-multiple="true"] {
2874
- right: var(--measurement-small-10) !important;
2875
- }
2876
-
2877
2910
  top: var(--measurement-small-10);
2911
+ right: var(--measurement-small-10);
2878
2912
  bottom: var(--measurement-small-10);
2879
2913
 
2880
2914
  border-left: var(--measurement-small-10) solid var(--font-color-alpha-10);
@@ -2885,7 +2919,6 @@ var InnerWrapper = styled10.div`
2885
2919
  &[data-error="true"] {
2886
2920
  border-color: var(--alpha-red-10) !important;
2887
2921
  }
2888
-
2889
2922
  &[data-shape="round"] {
2890
2923
  border-radius: 0 var(--measurement-large-90) var(--measurement-large-90) 0;
2891
2924
  }
@@ -2911,16 +2944,7 @@ var InnerTrigger = styled10.button`
2911
2944
  padding: 0 var(--measurement-medium-40);
2912
2945
 
2913
2946
  color: var(--font-color-alpha-60);
2914
-
2915
- background-color: var(--body-color);
2916
- background: linear-gradient(
2917
- 180deg,
2918
- transparent 50%,
2919
- var(--font-color-alpha-10) 100%
2920
- );
2921
- background-size: 100% 200%;
2922
- background-position: 0% 0%;
2923
- backdrop-filter: blur(var(--measurement-medium-10));
2947
+ backdrop-filter: blur(var(--measurement-small-60));
2924
2948
 
2925
2949
  cursor: pointer;
2926
2950
  transition: all ease-in-out 0.2s;
@@ -2930,7 +2954,7 @@ var InnerTrigger = styled10.button`
2930
2954
  transition: all ease-in-out 0.2s;
2931
2955
  }
2932
2956
 
2933
- ::before {
2957
+ /* ::before {
2934
2958
  content: "";
2935
2959
  inset: 0;
2936
2960
 
@@ -2944,12 +2968,12 @@ var InnerTrigger = styled10.button`
2944
2968
 
2945
2969
  transition: all ease-in-out 0.2s;
2946
2970
  mask-image: linear-gradient(var(--font-color), transparent);
2947
- }
2971
+ } */
2948
2972
 
2949
2973
  &:hover,
2950
2974
  &:active {
2951
2975
  color: var(--font-color);
2952
- background-position: 0% 50%;
2976
+ /* background-position: 0% 50%; */
2953
2977
 
2954
2978
  svg {
2955
2979
  opacity: 0.8;
@@ -2968,7 +2992,7 @@ var InnerSegment = styled10.span`
2968
2992
  text-align: center;
2969
2993
  outline: none;
2970
2994
  color: inherit;
2971
- transition: background-color ease-in-out 0.2s;
2995
+ /* transition: background-color ease-in-out 0.2s; */
2972
2996
 
2973
2997
  &[data-placeholder="true"] {
2974
2998
  color: var(--font-color-alpha-30);
@@ -2979,7 +3003,7 @@ var InnerSegment = styled10.span`
2979
3003
  &:active,
2980
3004
  &:focus-within,
2981
3005
  &:has(:active) {
2982
- background-color: var(--font-color-alpha-10);
3006
+ /* background-color: var(--font-color-alpha-10); */
2983
3007
  color: var(--font-color);
2984
3008
  }
2985
3009
  }
@@ -3876,7 +3900,7 @@ var MessageBubble = (props) => {
3876
3900
  };
3877
3901
  MessageBubble.displayName = "MessageBubble";
3878
3902
  var MessageBubbleContent = (props) => {
3879
- const { sizing, shape, variant, children, raw, ...restProps } = props;
3903
+ const { emphasis, sizing, shape, variant, children, raw, ...restProps } = props;
3880
3904
  const { id, states } = useMessageBubble();
3881
3905
  return /* @__PURE__ */ React21.createElement(
3882
3906
  MessageBubbleBadge,
@@ -3884,8 +3908,9 @@ var MessageBubbleContent = (props) => {
3884
3908
  "data-raw": Boolean(raw),
3885
3909
  "data-side": states?.side,
3886
3910
  variant: variant ?? "border" /* Border */,
3887
- shape: shape ?? "smooth" /* Smooth */,
3911
+ shape: shape ?? "round" /* Round */,
3888
3912
  sizing: sizing ?? "medium" /* Medium */,
3913
+ emphasis,
3889
3914
  "aria-label": `message-bubble-content-${id}`,
3890
3915
  ...restProps
3891
3916
  },
@@ -4539,7 +4564,8 @@ var SplitContainer = styled16.div`
4539
4564
  `;
4540
4565
  var Panel = styled16.div`
4541
4566
  overflow: hidden;
4542
- width: ${(props) => props.width}%;
4567
+ width: ${(props) => props.width}dvw;
4568
+ min-width: var(--measurement-large-60);
4543
4569
  `;
4544
4570
  var Divider2 = styled16.div`
4545
4571
  width: var(--measurement-medium-10);
@@ -4595,6 +4621,8 @@ var DragOverlay = styled16.div`
4595
4621
  // src/resizable/index.tsx
4596
4622
  var Resizable = ({
4597
4623
  defaultWidth,
4624
+ minWidth,
4625
+ maxWidth,
4598
4626
  left,
4599
4627
  right
4600
4628
  }) => {
@@ -4608,7 +4636,7 @@ var Resizable = ({
4608
4636
  if (!isDragging || !containerRef.current) return;
4609
4637
  const containerRect = containerRef.current.getBoundingClientRect();
4610
4638
  const newLeftWidth = (e.clientX - containerRect.left) / containerRect.width * 100;
4611
- const threshold = { min: 30, max: 70 };
4639
+ const threshold = { min: minWidth ?? 30, max: maxWidth ?? 70 };
4612
4640
  const constrainedWidth = Math.min(
4613
4641
  Math.max(newLeftWidth, threshold.min),
4614
4642
  threshold.max
@@ -6097,235 +6125,23 @@ var Tooltip = ({
6097
6125
  };
6098
6126
  Tooltip.displayName = "Tooltip";
6099
6127
 
6100
- // src/tree/index.tsx
6101
- import React46 from "react";
6102
-
6103
- // src/tree/hooks/tree-provider.tsx
6104
- import React44, { useState as useState10, createContext as createContext10, useContext as useContext10 } from "react";
6105
- var defaultTreeAPI = {
6106
- id: "",
6107
- states: {},
6108
- methods: {}
6109
- };
6110
- var TreeContext = createContext10(defaultTreeAPI);
6111
- var useTree = () => useContext10(TreeContext);
6112
- var TreeProvider = ({
6113
- children,
6114
- defaultExpandedIds = [],
6115
- onSelectionChange
6116
- }) => {
6117
- const context = useTreeProviderContext({
6118
- defaultExpandedIds,
6119
- onSelectionChange
6120
- });
6121
- return /* @__PURE__ */ React44.createElement(TreeContext.Provider, { value: context }, children);
6122
- };
6123
- function useTreeProviderContext({
6124
- defaultExpandedIds,
6125
- onSelectionChange
6126
- }) {
6127
- const treeId = React44.useId();
6128
- const [expandedIds, setExpandedIds] = useState10(
6129
- () => new Set(defaultExpandedIds)
6130
- );
6131
- const [selectedIds, setSelectedIds] = useState10(() => /* @__PURE__ */ new Set());
6132
- return {
6133
- id: treeId,
6134
- states: {
6135
- expandedIds,
6136
- selectedIds
6137
- },
6138
- methods: {
6139
- isExpanded: (id) => expandedIds.has(id),
6140
- isSelected: (id) => selectedIds.has(id),
6141
- toggleExpanded: (id) => {
6142
- setExpandedIds((prev) => {
6143
- const next = new Set(prev);
6144
- next.has(id) ? next.delete(id) : next.add(id);
6145
- return next;
6146
- });
6147
- },
6148
- toggleSelected: (id) => {
6149
- setSelectedIds((prev) => {
6150
- const next = new Set(prev);
6151
- next.has(id) ? next.delete(id) : next.add(id);
6152
- onSelectionChange?.(Array.from(next));
6153
- return next;
6154
- });
6155
- },
6156
- getTreeId: ({ nodeId, type }) => `${treeId}-${type}-${nodeId}`
6157
- }
6158
- };
6159
- }
6160
-
6161
- // src/tree/hooks/tree-node-provider.tsx
6162
- import React45, { createContext as createContext11, useContext as useContext11 } from "react";
6163
- var defaultTreeNodeAPI = {
6164
- id: "",
6165
- states: {},
6166
- methods: {}
6167
- };
6168
- var TreeNodeContext = createContext11(defaultTreeNodeAPI);
6169
- var useTreeNode = () => useContext11(TreeNodeContext);
6170
- var TreeNodeProvider = ({
6171
- children,
6172
- nodeId,
6173
- level,
6174
- isLast
6175
- }) => {
6176
- const context = useTreeNodeProviderContext({ nodeId, level, isLast });
6177
- return /* @__PURE__ */ React45.createElement(TreeNodeContext.Provider, { value: context }, children);
6178
- };
6179
- function useTreeNodeProviderContext({
6180
- nodeId,
6181
- level,
6182
- isLast
6183
- }) {
6184
- return {
6185
- id: nodeId,
6186
- states: {
6187
- nodeId,
6188
- level,
6189
- isLast
6190
- },
6191
- methods: {}
6192
- };
6193
- }
6194
-
6195
- // src/tree/styles/index.ts
6196
- import styled27 from "styled-components";
6197
- var TreeView = styled27.ul`
6198
- display: flex;
6199
- flex-direction: column;
6200
- list-style: none;
6201
- margin: 0;
6202
- padding: 0;
6203
- `;
6204
- var TreeItem = styled27.li`
6205
- display: flex;
6206
- flex-direction: column;
6207
- list-style: none;
6208
- `;
6209
- var TreeNodeContent = styled27.ul`
6210
- display: flex;
6211
- flex-direction: column;
6212
- list-style: none;
6213
- margin: 0;
6214
- padding: 0;
6215
- `;
6216
-
6217
- // src/tree/index.tsx
6218
- var Tree = (props) => {
6219
- const { children, ...restProps } = props;
6220
- const { id } = useTree();
6221
- return /* @__PURE__ */ React46.createElement(TreeView, { id, role: "tree", ...restProps }, children);
6222
- };
6223
- Tree.displayName = "Tree";
6224
- var TreeRoot = ({
6225
- children,
6226
- defaultExpandedIds,
6227
- onSelectionChange
6228
- }) => {
6229
- return /* @__PURE__ */ React46.createElement(
6230
- TreeProvider,
6231
- {
6232
- defaultExpandedIds,
6233
- onSelectionChange
6234
- },
6235
- children
6236
- );
6237
- };
6238
- TreeRoot.displayName = "Tree.Root";
6239
- var TreeNode = (props) => {
6240
- const { nodeId, level = 0, isLast = false, children, ...restProps } = props;
6241
- return /* @__PURE__ */ React46.createElement(TreeNodeProvider, { nodeId, level, isLast }, /* @__PURE__ */ React46.createElement(TreeItem, { role: "treeitem", "aria-level": level + 1, ...restProps }, children));
6242
- };
6243
- TreeNode.displayName = "Tree.Node";
6244
- var TreeTrigger = (props) => {
6245
- const { nodeId, disabled, onClick, children, ...restProps } = props;
6246
- const { methods } = useTree();
6247
- const { getTreeId, toggleExpanded, toggleSelected } = methods;
6248
- const isExpanded = methods.isExpanded && methods.isExpanded(nodeId);
6249
- const isSelected = methods.isSelected && methods.isSelected(nodeId);
6250
- const IdHandler = {
6251
- trigger: getTreeId && getTreeId({ nodeId, type: "trigger" }),
6252
- content: getTreeId && getTreeId({ nodeId, type: "content" })
6253
- };
6254
- const { states: nodeStates } = useTreeNode();
6255
- const level = nodeStates.level ?? 0;
6256
- const handleClick = (event) => {
6257
- if (!disabled) {
6258
- onClick && onClick(event);
6259
- toggleExpanded && toggleExpanded(nodeId);
6260
- toggleSelected && toggleSelected(nodeId);
6261
- }
6262
- };
6263
- return /* @__PURE__ */ React46.createElement(
6264
- Button,
6265
- {
6266
- id: String(IdHandler.trigger),
6267
- disabled: disabled ?? false,
6268
- onClick: handleClick,
6269
- "data-state": isExpanded ? "expanded" : "collapsed",
6270
- "data-selected": isSelected || void 0,
6271
- variant: props.variant ?? "ghost" /* Ghost */,
6272
- style: { paddingLeft: `calc(${level} * 1rem + 0.5rem)` },
6273
- rawicon: true,
6274
- ...restProps
6275
- },
6276
- children
6277
- );
6278
- };
6279
- TreeTrigger.displayName = "Tree.Trigger";
6280
- var TreeContent = (props) => {
6281
- const { nodeId, defaultOpen = false, children, ...restProps } = props;
6282
- const { methods } = useTree();
6283
- const { getTreeId, toggleExpanded } = methods;
6284
- const isExpanded = methods.isExpanded && methods.isExpanded(nodeId);
6285
- const IdHandler = {
6286
- trigger: getTreeId && getTreeId({ nodeId, type: "trigger" }),
6287
- content: getTreeId && getTreeId({ nodeId, type: "content" })
6288
- };
6289
- React46.useEffect(() => {
6290
- if (defaultOpen && !isExpanded && toggleExpanded) toggleExpanded(nodeId);
6291
- }, []);
6292
- if (isExpanded)
6293
- return /* @__PURE__ */ React46.createElement(
6294
- TreeNodeContent,
6295
- {
6296
- role: "group",
6297
- id: String(IdHandler.content),
6298
- "aria-labelledby": String(IdHandler.trigger),
6299
- "data-nodeId": nodeId,
6300
- ...restProps
6301
- },
6302
- children
6303
- );
6304
- return /* @__PURE__ */ React46.createElement(React46.Fragment, null);
6305
- };
6306
- TreeContent.displayName = "Tree.Content";
6307
- Tree.Root = TreeRoot;
6308
- Tree.Node = TreeNode;
6309
- Tree.Trigger = TreeTrigger;
6310
- Tree.Content = TreeContent;
6311
-
6312
6128
  // src/select/index.tsx
6313
- import React48 from "react";
6129
+ import React45 from "react";
6314
6130
 
6315
6131
  // src/select/hooks/index.tsx
6316
- import React47 from "react";
6132
+ import React44 from "react";
6317
6133
  var defaultComponentAPI10 = {
6318
6134
  id: "",
6319
6135
  states: {},
6320
6136
  methods: {}
6321
6137
  };
6322
- var SelectContext = React47.createContext(defaultComponentAPI10);
6323
- var useSelect = () => React47.useContext(SelectContext);
6138
+ var SelectContext = React44.createContext(defaultComponentAPI10);
6139
+ var useSelect = () => React44.useContext(SelectContext);
6324
6140
  var SelectProvider = ({
6325
6141
  children
6326
6142
  }) => {
6327
6143
  const context = useSelectProvider();
6328
- return /* @__PURE__ */ React47.createElement(SelectContext.Provider, { value: context }, children);
6144
+ return /* @__PURE__ */ React44.createElement(SelectContext.Provider, { value: context }, children);
6329
6145
  };
6330
6146
  function useSelectProvider() {
6331
6147
  const DEFAULT_POSITIONS2 = {
@@ -6338,19 +6154,19 @@ function useSelectProvider() {
6338
6154
  width: 0,
6339
6155
  height: 0
6340
6156
  };
6341
- const [open, setOpen] = React47.useState(false);
6342
- const [value, setValue] = React47.useState(null);
6343
- const [label, setLabel] = React47.useState("");
6344
- const [contentProps, setContentProps] = React47.useState({
6157
+ const [open, setOpen] = React44.useState(false);
6158
+ const [value, setValue] = React44.useState(null);
6159
+ const [label, setLabel] = React44.useState("");
6160
+ const [contentProps, setContentProps] = React44.useState({
6345
6161
  ...DEFAULT_POSITIONS2,
6346
6162
  ...DEFAULT_DIMENSIONS2
6347
6163
  });
6348
- const [triggerProps, setTriggerProps] = React47.useState({
6164
+ const [triggerProps, setTriggerProps] = React44.useState({
6349
6165
  ...DEFAULT_POSITIONS2,
6350
6166
  ...DEFAULT_DIMENSIONS2
6351
6167
  });
6352
- const triggerId = React47.useId();
6353
- const listboxId = React47.useId();
6168
+ const triggerId = React44.useId();
6169
+ const listboxId = React44.useId();
6354
6170
  const composedId = `${triggerId}|${listboxId}`;
6355
6171
  return {
6356
6172
  id: composedId,
@@ -6373,12 +6189,12 @@ function useSelectProvider() {
6373
6189
  }
6374
6190
 
6375
6191
  // src/select/styles/index.tsx
6376
- import styled28 from "styled-components";
6377
- var Wrapper = styled28.div`
6192
+ import styled27 from "styled-components";
6193
+ var Wrapper = styled27.div`
6378
6194
  position: relative;
6379
6195
  width: 100%;
6380
6196
  `;
6381
- var Trigger = styled28.button`
6197
+ var Trigger = styled27.button`
6382
6198
  all: unset;
6383
6199
  box-sizing: border-box;
6384
6200
 
@@ -6396,7 +6212,7 @@ var Trigger = styled28.button`
6396
6212
 
6397
6213
  cursor: pointer !important;
6398
6214
  `;
6399
- var Label2 = styled28.span`
6215
+ var Label2 = styled27.span`
6400
6216
  flex: 1;
6401
6217
  text-align: left;
6402
6218
  font-weight: 400;
@@ -6404,7 +6220,7 @@ var Label2 = styled28.span`
6404
6220
  overflow: hidden;
6405
6221
  text-overflow: ellipsis;
6406
6222
  `;
6407
- var Content = styled28.ul`
6223
+ var Content = styled27.ul`
6408
6224
  @keyframes select-slide-in-down {
6409
6225
  0% {
6410
6226
  opacity: 0;
@@ -6458,7 +6274,7 @@ var Content = styled28.ul`
6458
6274
  }
6459
6275
  }
6460
6276
  `;
6461
- var List = styled28.li`
6277
+ var List = styled27.li`
6462
6278
  list-style: none;
6463
6279
  padding: 0;
6464
6280
  margin: 0;
@@ -6507,7 +6323,7 @@ var List = styled28.li`
6507
6323
  opacity: 0.6;
6508
6324
  }
6509
6325
  `;
6510
- var Item = styled28.span`
6326
+ var Item = styled27.span`
6511
6327
  display: flex;
6512
6328
  align-items: center;
6513
6329
  gap: var(--measurement-small-60);
@@ -6519,11 +6335,11 @@ var Item = styled28.span`
6519
6335
 
6520
6336
  // src/select/index.tsx
6521
6337
  var SelectRoot = ({ children }) => {
6522
- return /* @__PURE__ */ React48.createElement(SelectProvider, null, children);
6338
+ return /* @__PURE__ */ React45.createElement(SelectProvider, null, children);
6523
6339
  };
6524
6340
  SelectRoot.displayName = "Select.Root";
6525
6341
  var Select = ({ children }) => {
6526
- const selectRef = React48.useRef(null);
6342
+ const selectRef = React45.useRef(null);
6527
6343
  const { states, methods } = useSelect();
6528
6344
  const handleClickOutside = () => {
6529
6345
  if (states.open && methods.setOpen) {
@@ -6534,7 +6350,7 @@ var Select = ({ children }) => {
6534
6350
  selectRef,
6535
6351
  handleClickOutside
6536
6352
  );
6537
- return /* @__PURE__ */ React48.createElement(Wrapper, { ref: selectRef }, children);
6353
+ return /* @__PURE__ */ React45.createElement(Wrapper, { ref: selectRef }, children);
6538
6354
  };
6539
6355
  Select.displayName = "Select";
6540
6356
  var SelectTrigger = (props) => {
@@ -6548,7 +6364,7 @@ var SelectTrigger = (props) => {
6548
6364
  children,
6549
6365
  ...restProps
6550
6366
  } = props;
6551
- const triggerRef = React48.useRef(null);
6367
+ const triggerRef = React45.useRef(null);
6552
6368
  const triggerRect = () => triggerRef.current?.getBoundingClientRect();
6553
6369
  const { id, states, methods } = useSelect();
6554
6370
  const { toggleOpen, setTriggerProps } = methods;
@@ -6566,7 +6382,7 @@ var SelectTrigger = (props) => {
6566
6382
  });
6567
6383
  }
6568
6384
  };
6569
- return /* @__PURE__ */ React48.createElement(
6385
+ return /* @__PURE__ */ React45.createElement(
6570
6386
  Trigger,
6571
6387
  {
6572
6388
  ref: triggerRef,
@@ -6586,7 +6402,7 @@ var SelectTrigger = (props) => {
6586
6402
  disabled,
6587
6403
  ...restProps
6588
6404
  },
6589
- /* @__PURE__ */ React48.createElement(Label2, null, children)
6405
+ /* @__PURE__ */ React45.createElement(Label2, null, children)
6590
6406
  );
6591
6407
  };
6592
6408
  SelectTrigger.displayName = "Select.Trigger";
@@ -6594,8 +6410,8 @@ var SelectContent = (props) => {
6594
6410
  const { raw, defaultOpen, children, ...restProps } = props;
6595
6411
  const { id, states, methods } = useSelect();
6596
6412
  const { toggleOpen, setContentProps } = methods;
6597
- const mounted = React48.useRef(false);
6598
- const contentRef = React48.useRef(null);
6413
+ const mounted = React45.useRef(false);
6414
+ const contentRef = React45.useRef(null);
6599
6415
  const contentRect = () => contentRef?.current?.getBoundingClientRect();
6600
6416
  const bodyRect = () => {
6601
6417
  if (typeof document !== "undefined") {
@@ -6613,10 +6429,10 @@ var SelectContent = (props) => {
6613
6429
  content_bottom: states.contentProps.bottom
6614
6430
  };
6615
6431
  const hasEnoughVerticalSpace = dimensions.body_height - dimensions.content_bottom > dimensions.content_height - dimensions.content_height * 0.9;
6616
- React48.useEffect(() => {
6432
+ React45.useEffect(() => {
6617
6433
  if (defaultOpen && toggleOpen) toggleOpen();
6618
6434
  }, []);
6619
- React48.useEffect(() => {
6435
+ React45.useEffect(() => {
6620
6436
  mounted.current = true;
6621
6437
  if (setContentProps) {
6622
6438
  setContentProps({
@@ -6632,7 +6448,7 @@ var SelectContent = (props) => {
6632
6448
  mounted.current = false;
6633
6449
  };
6634
6450
  }, [states.open]);
6635
- React48.useEffect(() => {
6451
+ React45.useEffect(() => {
6636
6452
  if (!states.open) return;
6637
6453
  const handleKeyDown = (event) => {
6638
6454
  if (event.key === "Escape" && methods.setOpen) {
@@ -6643,7 +6459,7 @@ var SelectContent = (props) => {
6643
6459
  return () => document.removeEventListener("keydown", handleKeyDown);
6644
6460
  }, [states.open]);
6645
6461
  if (!states.open) return null;
6646
- return /* @__PURE__ */ React48.createElement(
6462
+ return /* @__PURE__ */ React45.createElement(
6647
6463
  ScrollArea,
6648
6464
  {
6649
6465
  scrollbar: true,
@@ -6683,7 +6499,7 @@ var SelectItem = (props) => {
6683
6499
  handleSelect(event);
6684
6500
  }
6685
6501
  };
6686
- return /* @__PURE__ */ React48.createElement(
6502
+ return /* @__PURE__ */ React45.createElement(
6687
6503
  List,
6688
6504
  {
6689
6505
  role: "option",
@@ -6697,7 +6513,7 @@ var SelectItem = (props) => {
6697
6513
  onKeyDown: handleKeyDown,
6698
6514
  ...restProps
6699
6515
  },
6700
- /* @__PURE__ */ React48.createElement(Item, null, children)
6516
+ /* @__PURE__ */ React45.createElement(Item, null, children)
6701
6517
  );
6702
6518
  };
6703
6519
  SelectItem.displayName = "Select.Item";
@@ -6803,11 +6619,6 @@ export {
6803
6619
  ToolbarSection,
6804
6620
  ToolbarTrigger,
6805
6621
  Tooltip,
6806
- Tree,
6807
- TreeContent,
6808
- TreeNode,
6809
- TreeRoot,
6810
- TreeTrigger,
6811
6622
  useAccordion,
6812
6623
  useCheckbox,
6813
6624
  useCollapsible,
@@ -6819,7 +6630,5 @@ export {
6819
6630
  useSheet,
6820
6631
  useSwitch,
6821
6632
  useTabs,
6822
- useToolbar,
6823
- useTree,
6824
- useTreeNode
6633
+ useToolbar
6825
6634
  };