@usefui/components 1.7.0 → 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
@@ -2013,8 +2033,6 @@ var DialogDefaultStyles = css6`
2013
2033
  position: fixed;
2014
2034
  top: 15dvh;
2015
2035
  bottom: auto;
2016
- left: auto;
2017
- right: auto;
2018
2036
 
2019
2037
  padding: var(--measurement-medium-30);
2020
2038
  width: 100%;
@@ -2104,7 +2122,8 @@ var Dialog = (props) => {
2104
2122
  if (open && toggleDialog) toggleDialog();
2105
2123
  }, []);
2106
2124
  if (lock) useDisabledScroll(Boolean(states.open));
2107
- return /* @__PURE__ */ React15.createElement(React15.Fragment, null, states.open && /* @__PURE__ */ React15.createElement(
2125
+ if (!states.open) return null;
2126
+ return /* @__PURE__ */ React15.createElement(
2108
2127
  ScrollArea,
2109
2128
  {
2110
2129
  as: DialogWrapper,
@@ -2119,7 +2138,7 @@ var Dialog = (props) => {
2119
2138
  ...restProps
2120
2139
  },
2121
2140
  children
2122
- ));
2141
+ );
2123
2142
  };
2124
2143
  Dialog.displayName = "Dialog";
2125
2144
  var DialogRoot = ({ children }) => {
@@ -2293,6 +2312,15 @@ var ContentWrapperSizes = css7`
2293
2312
  max-width: var(--large);
2294
2313
  }
2295
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
+ `;
2296
2324
  var RootWrapper = styled9.div`
2297
2325
  position: relative;
2298
2326
  `;
@@ -2319,13 +2347,14 @@ var ContentWrapper = styled9.ul`
2319
2347
  padding: var(--measurement-medium-30);
2320
2348
  margin: var(--measurement-medium-10) 0;
2321
2349
 
2322
- background-color: var(--body-color);
2323
2350
  border: var(--measurement-small-10) solid var(--font-color-alpha-10);
2324
2351
  border-radius: var(--measurement-medium-30);
2325
2352
 
2326
2353
  z-index: var(--depth-default-100);
2327
2354
 
2328
2355
  ${ContentWrapperSizes}
2356
+ ${ContentWrapperVariants}
2357
+
2329
2358
  animation-duration: 0.2s;
2330
2359
  animation-name: slide-in;
2331
2360
  animation-fill-mode: backwards;
@@ -2340,14 +2369,13 @@ var ItemWrapper2 = styled9.li`
2340
2369
  &[data-raw="false"] {
2341
2370
  padding: var(--measurement-medium-10) var(--measurement-medium-30);
2342
2371
  border-radius: var(--measurement-medium-20);
2372
+ color: var(--font-color);
2343
2373
 
2344
- text-align: left;
2345
- font-weight: 600;
2346
2374
  letter-spacing: calc(
2347
2375
  var(--fontsize-small-10) - ((var(--fontsize-small-10) * 1.066))
2348
2376
  );
2349
- font-size: var(--fontsize-medium-10);
2350
- color: var(--font-color);
2377
+ font-size: inherit;
2378
+ text-align: left;
2351
2379
 
2352
2380
  outline: none;
2353
2381
  cursor: pointer;
@@ -2359,7 +2387,7 @@ var ItemWrapper2 = styled9.li`
2359
2387
  &:active,
2360
2388
  &:focus-within,
2361
2389
  &:has(:active) {
2362
- background-color: var(--contrast-color);
2390
+ background-color: var(--font-color-alpha-10);
2363
2391
  }
2364
2392
  }
2365
2393
 
@@ -2424,7 +2452,14 @@ var DropdownMenuTrigger = (props) => {
2424
2452
  };
2425
2453
  DropdownMenuTrigger.displayName = "DropdownMenu.Trigger";
2426
2454
  var DropdownMenuContent = React17.forwardRef((props, _) => {
2427
- 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;
2428
2463
  const { id, states, methods } = useDropdownMenu();
2429
2464
  const { toggleOpen, setContentProps } = methods;
2430
2465
  const mounted = React17.useRef(false);
@@ -2490,6 +2525,7 @@ var DropdownMenuContent = React17.forwardRef((props, _) => {
2490
2525
  "aria-labelledby": id.split("|").at(0),
2491
2526
  "data-state": applyDataState(Boolean(states.open)),
2492
2527
  "data-sizing": sizing,
2528
+ "data-variant": variant,
2493
2529
  "data-side": hasEnoughHorizontalSpace ? "left" /* Left */ : "right" /* Right */,
2494
2530
  "data-align": hasEnoughHorizontalSpace ? "left" /* Left */ : "right" /* Right */,
2495
2531
  "data-raw": Boolean(raw),
@@ -2871,12 +2907,8 @@ var InnerWrapper = styled10.div`
2871
2907
  display: flex;
2872
2908
  flex-direction: column;
2873
2909
 
2874
- right: 0;
2875
- &[data-multiple="true"] {
2876
- right: var(--measurement-small-10) !important;
2877
- }
2878
-
2879
2910
  top: var(--measurement-small-10);
2911
+ right: var(--measurement-small-10);
2880
2912
  bottom: var(--measurement-small-10);
2881
2913
 
2882
2914
  border-left: var(--measurement-small-10) solid var(--font-color-alpha-10);
@@ -2887,7 +2919,6 @@ var InnerWrapper = styled10.div`
2887
2919
  &[data-error="true"] {
2888
2920
  border-color: var(--alpha-red-10) !important;
2889
2921
  }
2890
-
2891
2922
  &[data-shape="round"] {
2892
2923
  border-radius: 0 var(--measurement-large-90) var(--measurement-large-90) 0;
2893
2924
  }
@@ -2913,16 +2944,7 @@ var InnerTrigger = styled10.button`
2913
2944
  padding: 0 var(--measurement-medium-40);
2914
2945
 
2915
2946
  color: var(--font-color-alpha-60);
2916
-
2917
- background-color: var(--body-color);
2918
- background: linear-gradient(
2919
- 180deg,
2920
- transparent 50%,
2921
- var(--font-color-alpha-10) 100%
2922
- );
2923
- background-size: 100% 200%;
2924
- background-position: 0% 0%;
2925
- backdrop-filter: blur(var(--measurement-medium-10));
2947
+ backdrop-filter: blur(var(--measurement-small-60));
2926
2948
 
2927
2949
  cursor: pointer;
2928
2950
  transition: all ease-in-out 0.2s;
@@ -2932,7 +2954,7 @@ var InnerTrigger = styled10.button`
2932
2954
  transition: all ease-in-out 0.2s;
2933
2955
  }
2934
2956
 
2935
- ::before {
2957
+ /* ::before {
2936
2958
  content: "";
2937
2959
  inset: 0;
2938
2960
 
@@ -2946,12 +2968,12 @@ var InnerTrigger = styled10.button`
2946
2968
 
2947
2969
  transition: all ease-in-out 0.2s;
2948
2970
  mask-image: linear-gradient(var(--font-color), transparent);
2949
- }
2971
+ } */
2950
2972
 
2951
2973
  &:hover,
2952
2974
  &:active {
2953
2975
  color: var(--font-color);
2954
- background-position: 0% 50%;
2976
+ /* background-position: 0% 50%; */
2955
2977
 
2956
2978
  svg {
2957
2979
  opacity: 0.8;
@@ -2970,7 +2992,7 @@ var InnerSegment = styled10.span`
2970
2992
  text-align: center;
2971
2993
  outline: none;
2972
2994
  color: inherit;
2973
- transition: background-color ease-in-out 0.2s;
2995
+ /* transition: background-color ease-in-out 0.2s; */
2974
2996
 
2975
2997
  &[data-placeholder="true"] {
2976
2998
  color: var(--font-color-alpha-30);
@@ -2981,7 +3003,7 @@ var InnerSegment = styled10.span`
2981
3003
  &:active,
2982
3004
  &:focus-within,
2983
3005
  &:has(:active) {
2984
- background-color: var(--font-color-alpha-10);
3006
+ /* background-color: var(--font-color-alpha-10); */
2985
3007
  color: var(--font-color);
2986
3008
  }
2987
3009
  }
@@ -3878,7 +3900,7 @@ var MessageBubble = (props) => {
3878
3900
  };
3879
3901
  MessageBubble.displayName = "MessageBubble";
3880
3902
  var MessageBubbleContent = (props) => {
3881
- const { sizing, shape, variant, children, raw, ...restProps } = props;
3903
+ const { emphasis, sizing, shape, variant, children, raw, ...restProps } = props;
3882
3904
  const { id, states } = useMessageBubble();
3883
3905
  return /* @__PURE__ */ React21.createElement(
3884
3906
  MessageBubbleBadge,
@@ -3886,8 +3908,9 @@ var MessageBubbleContent = (props) => {
3886
3908
  "data-raw": Boolean(raw),
3887
3909
  "data-side": states?.side,
3888
3910
  variant: variant ?? "border" /* Border */,
3889
- shape: shape ?? "smooth" /* Smooth */,
3911
+ shape: shape ?? "round" /* Round */,
3890
3912
  sizing: sizing ?? "medium" /* Medium */,
3913
+ emphasis,
3891
3914
  "aria-label": `message-bubble-content-${id}`,
3892
3915
  ...restProps
3893
3916
  },
@@ -4541,7 +4564,8 @@ var SplitContainer = styled16.div`
4541
4564
  `;
4542
4565
  var Panel = styled16.div`
4543
4566
  overflow: hidden;
4544
- width: ${(props) => props.width}%;
4567
+ width: ${(props) => props.width}dvw;
4568
+ min-width: var(--measurement-large-60);
4545
4569
  `;
4546
4570
  var Divider2 = styled16.div`
4547
4571
  width: var(--measurement-medium-10);
@@ -4597,6 +4621,8 @@ var DragOverlay = styled16.div`
4597
4621
  // src/resizable/index.tsx
4598
4622
  var Resizable = ({
4599
4623
  defaultWidth,
4624
+ minWidth,
4625
+ maxWidth,
4600
4626
  left,
4601
4627
  right
4602
4628
  }) => {
@@ -4610,7 +4636,7 @@ var Resizable = ({
4610
4636
  if (!isDragging || !containerRef.current) return;
4611
4637
  const containerRect = containerRef.current.getBoundingClientRect();
4612
4638
  const newLeftWidth = (e.clientX - containerRect.left) / containerRect.width * 100;
4613
- const threshold = { min: 30, max: 70 };
4639
+ const threshold = { min: minWidth ?? 30, max: maxWidth ?? 70 };
4614
4640
  const constrainedWidth = Math.min(
4615
4641
  Math.max(newLeftWidth, threshold.min),
4616
4642
  threshold.max
@@ -6099,235 +6125,23 @@ var Tooltip = ({
6099
6125
  };
6100
6126
  Tooltip.displayName = "Tooltip";
6101
6127
 
6102
- // src/tree/index.tsx
6103
- import React46 from "react";
6104
-
6105
- // src/tree/hooks/tree-provider.tsx
6106
- import React44, { useState as useState10, createContext as createContext10, useContext as useContext10 } from "react";
6107
- var defaultTreeAPI = {
6108
- id: "",
6109
- states: {},
6110
- methods: {}
6111
- };
6112
- var TreeContext = createContext10(defaultTreeAPI);
6113
- var useTree = () => useContext10(TreeContext);
6114
- var TreeProvider = ({
6115
- children,
6116
- defaultExpandedIds = [],
6117
- onSelectionChange
6118
- }) => {
6119
- const context = useTreeProviderContext({
6120
- defaultExpandedIds,
6121
- onSelectionChange
6122
- });
6123
- return /* @__PURE__ */ React44.createElement(TreeContext.Provider, { value: context }, children);
6124
- };
6125
- function useTreeProviderContext({
6126
- defaultExpandedIds,
6127
- onSelectionChange
6128
- }) {
6129
- const treeId = React44.useId();
6130
- const [expandedIds, setExpandedIds] = useState10(
6131
- () => new Set(defaultExpandedIds)
6132
- );
6133
- const [selectedIds, setSelectedIds] = useState10(() => /* @__PURE__ */ new Set());
6134
- return {
6135
- id: treeId,
6136
- states: {
6137
- expandedIds,
6138
- selectedIds
6139
- },
6140
- methods: {
6141
- isExpanded: (id) => expandedIds.has(id),
6142
- isSelected: (id) => selectedIds.has(id),
6143
- toggleExpanded: (id) => {
6144
- setExpandedIds((prev) => {
6145
- const next = new Set(prev);
6146
- next.has(id) ? next.delete(id) : next.add(id);
6147
- return next;
6148
- });
6149
- },
6150
- toggleSelected: (id) => {
6151
- setSelectedIds((prev) => {
6152
- const next = new Set(prev);
6153
- next.has(id) ? next.delete(id) : next.add(id);
6154
- onSelectionChange?.(Array.from(next));
6155
- return next;
6156
- });
6157
- },
6158
- getTreeId: ({ nodeId, type }) => `${treeId}-${type}-${nodeId}`
6159
- }
6160
- };
6161
- }
6162
-
6163
- // src/tree/hooks/tree-node-provider.tsx
6164
- import React45, { createContext as createContext11, useContext as useContext11 } from "react";
6165
- var defaultTreeNodeAPI = {
6166
- id: "",
6167
- states: {},
6168
- methods: {}
6169
- };
6170
- var TreeNodeContext = createContext11(defaultTreeNodeAPI);
6171
- var useTreeNode = () => useContext11(TreeNodeContext);
6172
- var TreeNodeProvider = ({
6173
- children,
6174
- nodeId,
6175
- level,
6176
- isLast
6177
- }) => {
6178
- const context = useTreeNodeProviderContext({ nodeId, level, isLast });
6179
- return /* @__PURE__ */ React45.createElement(TreeNodeContext.Provider, { value: context }, children);
6180
- };
6181
- function useTreeNodeProviderContext({
6182
- nodeId,
6183
- level,
6184
- isLast
6185
- }) {
6186
- return {
6187
- id: nodeId,
6188
- states: {
6189
- nodeId,
6190
- level,
6191
- isLast
6192
- },
6193
- methods: {}
6194
- };
6195
- }
6196
-
6197
- // src/tree/styles/index.ts
6198
- import styled27 from "styled-components";
6199
- var TreeView = styled27.ul`
6200
- display: flex;
6201
- flex-direction: column;
6202
- list-style: none;
6203
- margin: 0;
6204
- padding: 0;
6205
- `;
6206
- var TreeItem = styled27.li`
6207
- display: flex;
6208
- flex-direction: column;
6209
- list-style: none;
6210
- `;
6211
- var TreeNodeContent = styled27.ul`
6212
- display: flex;
6213
- flex-direction: column;
6214
- list-style: none;
6215
- margin: 0;
6216
- padding: 0;
6217
- `;
6218
-
6219
- // src/tree/index.tsx
6220
- var Tree = (props) => {
6221
- const { children, ...restProps } = props;
6222
- const { id } = useTree();
6223
- return /* @__PURE__ */ React46.createElement(TreeView, { id, role: "tree", ...restProps }, children);
6224
- };
6225
- Tree.displayName = "Tree";
6226
- var TreeRoot = ({
6227
- children,
6228
- defaultExpandedIds,
6229
- onSelectionChange
6230
- }) => {
6231
- return /* @__PURE__ */ React46.createElement(
6232
- TreeProvider,
6233
- {
6234
- defaultExpandedIds,
6235
- onSelectionChange
6236
- },
6237
- children
6238
- );
6239
- };
6240
- TreeRoot.displayName = "Tree.Root";
6241
- var TreeNode = (props) => {
6242
- const { nodeId, level = 0, isLast = false, children, ...restProps } = props;
6243
- return /* @__PURE__ */ React46.createElement(TreeNodeProvider, { nodeId, level, isLast }, /* @__PURE__ */ React46.createElement(TreeItem, { role: "treeitem", "aria-level": level + 1, ...restProps }, children));
6244
- };
6245
- TreeNode.displayName = "Tree.Node";
6246
- var TreeTrigger = (props) => {
6247
- const { nodeId, disabled, onClick, children, ...restProps } = props;
6248
- const { methods } = useTree();
6249
- const { getTreeId, toggleExpanded, toggleSelected } = methods;
6250
- const isExpanded = methods.isExpanded && methods.isExpanded(nodeId);
6251
- const isSelected = methods.isSelected && methods.isSelected(nodeId);
6252
- const IdHandler = {
6253
- trigger: getTreeId && getTreeId({ nodeId, type: "trigger" }),
6254
- content: getTreeId && getTreeId({ nodeId, type: "content" })
6255
- };
6256
- const { states: nodeStates } = useTreeNode();
6257
- const level = nodeStates.level ?? 0;
6258
- const handleClick = (event) => {
6259
- if (!disabled) {
6260
- onClick && onClick(event);
6261
- toggleExpanded && toggleExpanded(nodeId);
6262
- toggleSelected && toggleSelected(nodeId);
6263
- }
6264
- };
6265
- return /* @__PURE__ */ React46.createElement(
6266
- Button,
6267
- {
6268
- id: String(IdHandler.trigger),
6269
- disabled: disabled ?? false,
6270
- onClick: handleClick,
6271
- "data-state": isExpanded ? "expanded" : "collapsed",
6272
- "data-selected": isSelected || void 0,
6273
- variant: props.variant ?? "ghost" /* Ghost */,
6274
- style: { paddingLeft: `calc(${level} * 1rem + 0.5rem)` },
6275
- rawicon: true,
6276
- ...restProps
6277
- },
6278
- children
6279
- );
6280
- };
6281
- TreeTrigger.displayName = "Tree.Trigger";
6282
- var TreeContent = (props) => {
6283
- const { nodeId, defaultOpen = false, children, ...restProps } = props;
6284
- const { methods } = useTree();
6285
- const { getTreeId, toggleExpanded } = methods;
6286
- const isExpanded = methods.isExpanded && methods.isExpanded(nodeId);
6287
- const IdHandler = {
6288
- trigger: getTreeId && getTreeId({ nodeId, type: "trigger" }),
6289
- content: getTreeId && getTreeId({ nodeId, type: "content" })
6290
- };
6291
- React46.useEffect(() => {
6292
- if (defaultOpen && !isExpanded && toggleExpanded) toggleExpanded(nodeId);
6293
- }, []);
6294
- if (isExpanded)
6295
- return /* @__PURE__ */ React46.createElement(
6296
- TreeNodeContent,
6297
- {
6298
- role: "group",
6299
- id: String(IdHandler.content),
6300
- "aria-labelledby": String(IdHandler.trigger),
6301
- "data-nodeId": nodeId,
6302
- ...restProps
6303
- },
6304
- children
6305
- );
6306
- return /* @__PURE__ */ React46.createElement(React46.Fragment, null);
6307
- };
6308
- TreeContent.displayName = "Tree.Content";
6309
- Tree.Root = TreeRoot;
6310
- Tree.Node = TreeNode;
6311
- Tree.Trigger = TreeTrigger;
6312
- Tree.Content = TreeContent;
6313
-
6314
6128
  // src/select/index.tsx
6315
- import React48 from "react";
6129
+ import React45 from "react";
6316
6130
 
6317
6131
  // src/select/hooks/index.tsx
6318
- import React47 from "react";
6132
+ import React44 from "react";
6319
6133
  var defaultComponentAPI10 = {
6320
6134
  id: "",
6321
6135
  states: {},
6322
6136
  methods: {}
6323
6137
  };
6324
- var SelectContext = React47.createContext(defaultComponentAPI10);
6325
- var useSelect = () => React47.useContext(SelectContext);
6138
+ var SelectContext = React44.createContext(defaultComponentAPI10);
6139
+ var useSelect = () => React44.useContext(SelectContext);
6326
6140
  var SelectProvider = ({
6327
6141
  children
6328
6142
  }) => {
6329
6143
  const context = useSelectProvider();
6330
- return /* @__PURE__ */ React47.createElement(SelectContext.Provider, { value: context }, children);
6144
+ return /* @__PURE__ */ React44.createElement(SelectContext.Provider, { value: context }, children);
6331
6145
  };
6332
6146
  function useSelectProvider() {
6333
6147
  const DEFAULT_POSITIONS2 = {
@@ -6340,19 +6154,19 @@ function useSelectProvider() {
6340
6154
  width: 0,
6341
6155
  height: 0
6342
6156
  };
6343
- const [open, setOpen] = React47.useState(false);
6344
- const [value, setValue] = React47.useState(null);
6345
- const [label, setLabel] = React47.useState("");
6346
- 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({
6347
6161
  ...DEFAULT_POSITIONS2,
6348
6162
  ...DEFAULT_DIMENSIONS2
6349
6163
  });
6350
- const [triggerProps, setTriggerProps] = React47.useState({
6164
+ const [triggerProps, setTriggerProps] = React44.useState({
6351
6165
  ...DEFAULT_POSITIONS2,
6352
6166
  ...DEFAULT_DIMENSIONS2
6353
6167
  });
6354
- const triggerId = React47.useId();
6355
- const listboxId = React47.useId();
6168
+ const triggerId = React44.useId();
6169
+ const listboxId = React44.useId();
6356
6170
  const composedId = `${triggerId}|${listboxId}`;
6357
6171
  return {
6358
6172
  id: composedId,
@@ -6375,12 +6189,12 @@ function useSelectProvider() {
6375
6189
  }
6376
6190
 
6377
6191
  // src/select/styles/index.tsx
6378
- import styled28 from "styled-components";
6379
- var Wrapper = styled28.div`
6192
+ import styled27 from "styled-components";
6193
+ var Wrapper = styled27.div`
6380
6194
  position: relative;
6381
6195
  width: 100%;
6382
6196
  `;
6383
- var Trigger = styled28.button`
6197
+ var Trigger = styled27.button`
6384
6198
  all: unset;
6385
6199
  box-sizing: border-box;
6386
6200
 
@@ -6398,7 +6212,7 @@ var Trigger = styled28.button`
6398
6212
 
6399
6213
  cursor: pointer !important;
6400
6214
  `;
6401
- var Label2 = styled28.span`
6215
+ var Label2 = styled27.span`
6402
6216
  flex: 1;
6403
6217
  text-align: left;
6404
6218
  font-weight: 400;
@@ -6406,7 +6220,7 @@ var Label2 = styled28.span`
6406
6220
  overflow: hidden;
6407
6221
  text-overflow: ellipsis;
6408
6222
  `;
6409
- var Content = styled28.ul`
6223
+ var Content = styled27.ul`
6410
6224
  @keyframes select-slide-in-down {
6411
6225
  0% {
6412
6226
  opacity: 0;
@@ -6460,7 +6274,7 @@ var Content = styled28.ul`
6460
6274
  }
6461
6275
  }
6462
6276
  `;
6463
- var List = styled28.li`
6277
+ var List = styled27.li`
6464
6278
  list-style: none;
6465
6279
  padding: 0;
6466
6280
  margin: 0;
@@ -6509,7 +6323,7 @@ var List = styled28.li`
6509
6323
  opacity: 0.6;
6510
6324
  }
6511
6325
  `;
6512
- var Item = styled28.span`
6326
+ var Item = styled27.span`
6513
6327
  display: flex;
6514
6328
  align-items: center;
6515
6329
  gap: var(--measurement-small-60);
@@ -6521,11 +6335,11 @@ var Item = styled28.span`
6521
6335
 
6522
6336
  // src/select/index.tsx
6523
6337
  var SelectRoot = ({ children }) => {
6524
- return /* @__PURE__ */ React48.createElement(SelectProvider, null, children);
6338
+ return /* @__PURE__ */ React45.createElement(SelectProvider, null, children);
6525
6339
  };
6526
6340
  SelectRoot.displayName = "Select.Root";
6527
6341
  var Select = ({ children }) => {
6528
- const selectRef = React48.useRef(null);
6342
+ const selectRef = React45.useRef(null);
6529
6343
  const { states, methods } = useSelect();
6530
6344
  const handleClickOutside = () => {
6531
6345
  if (states.open && methods.setOpen) {
@@ -6536,7 +6350,7 @@ var Select = ({ children }) => {
6536
6350
  selectRef,
6537
6351
  handleClickOutside
6538
6352
  );
6539
- return /* @__PURE__ */ React48.createElement(Wrapper, { ref: selectRef }, children);
6353
+ return /* @__PURE__ */ React45.createElement(Wrapper, { ref: selectRef }, children);
6540
6354
  };
6541
6355
  Select.displayName = "Select";
6542
6356
  var SelectTrigger = (props) => {
@@ -6550,7 +6364,7 @@ var SelectTrigger = (props) => {
6550
6364
  children,
6551
6365
  ...restProps
6552
6366
  } = props;
6553
- const triggerRef = React48.useRef(null);
6367
+ const triggerRef = React45.useRef(null);
6554
6368
  const triggerRect = () => triggerRef.current?.getBoundingClientRect();
6555
6369
  const { id, states, methods } = useSelect();
6556
6370
  const { toggleOpen, setTriggerProps } = methods;
@@ -6568,7 +6382,7 @@ var SelectTrigger = (props) => {
6568
6382
  });
6569
6383
  }
6570
6384
  };
6571
- return /* @__PURE__ */ React48.createElement(
6385
+ return /* @__PURE__ */ React45.createElement(
6572
6386
  Trigger,
6573
6387
  {
6574
6388
  ref: triggerRef,
@@ -6588,7 +6402,7 @@ var SelectTrigger = (props) => {
6588
6402
  disabled,
6589
6403
  ...restProps
6590
6404
  },
6591
- /* @__PURE__ */ React48.createElement(Label2, null, children)
6405
+ /* @__PURE__ */ React45.createElement(Label2, null, children)
6592
6406
  );
6593
6407
  };
6594
6408
  SelectTrigger.displayName = "Select.Trigger";
@@ -6596,8 +6410,8 @@ var SelectContent = (props) => {
6596
6410
  const { raw, defaultOpen, children, ...restProps } = props;
6597
6411
  const { id, states, methods } = useSelect();
6598
6412
  const { toggleOpen, setContentProps } = methods;
6599
- const mounted = React48.useRef(false);
6600
- const contentRef = React48.useRef(null);
6413
+ const mounted = React45.useRef(false);
6414
+ const contentRef = React45.useRef(null);
6601
6415
  const contentRect = () => contentRef?.current?.getBoundingClientRect();
6602
6416
  const bodyRect = () => {
6603
6417
  if (typeof document !== "undefined") {
@@ -6615,10 +6429,10 @@ var SelectContent = (props) => {
6615
6429
  content_bottom: states.contentProps.bottom
6616
6430
  };
6617
6431
  const hasEnoughVerticalSpace = dimensions.body_height - dimensions.content_bottom > dimensions.content_height - dimensions.content_height * 0.9;
6618
- React48.useEffect(() => {
6432
+ React45.useEffect(() => {
6619
6433
  if (defaultOpen && toggleOpen) toggleOpen();
6620
6434
  }, []);
6621
- React48.useEffect(() => {
6435
+ React45.useEffect(() => {
6622
6436
  mounted.current = true;
6623
6437
  if (setContentProps) {
6624
6438
  setContentProps({
@@ -6634,7 +6448,7 @@ var SelectContent = (props) => {
6634
6448
  mounted.current = false;
6635
6449
  };
6636
6450
  }, [states.open]);
6637
- React48.useEffect(() => {
6451
+ React45.useEffect(() => {
6638
6452
  if (!states.open) return;
6639
6453
  const handleKeyDown = (event) => {
6640
6454
  if (event.key === "Escape" && methods.setOpen) {
@@ -6645,7 +6459,7 @@ var SelectContent = (props) => {
6645
6459
  return () => document.removeEventListener("keydown", handleKeyDown);
6646
6460
  }, [states.open]);
6647
6461
  if (!states.open) return null;
6648
- return /* @__PURE__ */ React48.createElement(
6462
+ return /* @__PURE__ */ React45.createElement(
6649
6463
  ScrollArea,
6650
6464
  {
6651
6465
  scrollbar: true,
@@ -6685,7 +6499,7 @@ var SelectItem = (props) => {
6685
6499
  handleSelect(event);
6686
6500
  }
6687
6501
  };
6688
- return /* @__PURE__ */ React48.createElement(
6502
+ return /* @__PURE__ */ React45.createElement(
6689
6503
  List,
6690
6504
  {
6691
6505
  role: "option",
@@ -6699,7 +6513,7 @@ var SelectItem = (props) => {
6699
6513
  onKeyDown: handleKeyDown,
6700
6514
  ...restProps
6701
6515
  },
6702
- /* @__PURE__ */ React48.createElement(Item, null, children)
6516
+ /* @__PURE__ */ React45.createElement(Item, null, children)
6703
6517
  );
6704
6518
  };
6705
6519
  SelectItem.displayName = "Select.Item";
@@ -6805,11 +6619,6 @@ export {
6805
6619
  ToolbarSection,
6806
6620
  ToolbarTrigger,
6807
6621
  Tooltip,
6808
- Tree,
6809
- TreeContent,
6810
- TreeNode,
6811
- TreeRoot,
6812
- TreeTrigger,
6813
6622
  useAccordion,
6814
6623
  useCheckbox,
6815
6624
  useCollapsible,
@@ -6821,7 +6630,5 @@ export {
6821
6630
  useSheet,
6822
6631
  useSwitch,
6823
6632
  useTabs,
6824
- useToolbar,
6825
- useTree,
6826
- useTreeNode
6633
+ useToolbar
6827
6634
  };