@usefui/components 1.5.2 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +246 -3
- package/dist/index.d.ts +246 -3
- package/dist/index.js +740 -307
- package/dist/index.mjs +708 -288
- package/package.json +12 -12
- package/src/__tests__/MessageBubble.test.tsx +179 -0
- package/src/__tests__/Shimmer.test.tsx +122 -0
- package/src/__tests__/Tree.test.tsx +275 -0
- package/src/accordion/hooks/index.tsx +3 -1
- package/src/badge/index.tsx +2 -3
- package/src/checkbox/hooks/index.tsx +5 -1
- package/src/collapsible/hooks/index.tsx +3 -1
- package/src/dialog/hooks/index.tsx +5 -1
- package/src/dropdown/hooks/index.tsx +3 -1
- package/src/dropdown/index.tsx +9 -9
- package/src/field/hooks/index.tsx +5 -1
- package/src/field/styles/index.ts +1 -0
- package/src/index.ts +6 -0
- package/src/message-bubble/MessageBubble.stories.tsx +91 -0
- package/src/message-bubble/hooks/index.tsx +41 -0
- package/src/message-bubble/index.tsx +153 -0
- package/src/message-bubble/styles/index.ts +61 -0
- package/src/otp-field/hooks/index.tsx +3 -1
- package/src/otp-field/index.tsx +5 -3
- package/src/sheet/hooks/index.tsx +5 -1
- package/src/shimmer/Shimmer.stories.tsx +95 -0
- package/src/shimmer/index.tsx +64 -0
- package/src/shimmer/styles/index.ts +33 -0
- package/src/switch/hooks/index.tsx +5 -1
- package/src/tabs/hooks/index.tsx +5 -1
- package/src/text-area/Textarea.stories.tsx +7 -2
- package/src/text-area/index.tsx +30 -14
- package/src/text-area/styles/index.ts +32 -72
- package/src/toolbar/hooks/index.tsx +5 -1
- package/src/tooltip/index.tsx +4 -3
- package/src/tree/Tree.stories.tsx +139 -0
- package/src/tree/hooks/tree-node-provider.tsx +50 -0
- package/src/tree/hooks/tree-provider.tsx +75 -0
- package/src/tree/index.tsx +231 -0
- package/src/tree/styles/index.ts +23 -0
- package/tsconfig.build.json +20 -0
- package/tsconfig.json +1 -3
package/dist/index.mjs
CHANGED
|
@@ -889,7 +889,9 @@ var defaultComponentAPI2 = {
|
|
|
889
889
|
};
|
|
890
890
|
var CheckboxContext = createContext2(defaultComponentAPI2);
|
|
891
891
|
var useCheckbox = () => useContext2(CheckboxContext);
|
|
892
|
-
var CheckboxProvider = ({
|
|
892
|
+
var CheckboxProvider = ({
|
|
893
|
+
children
|
|
894
|
+
}) => {
|
|
893
895
|
const context = useCheckboxProvider();
|
|
894
896
|
return /* @__PURE__ */ React8.createElement(CheckboxContext.Provider, { value: context }, children);
|
|
895
897
|
};
|
|
@@ -1333,7 +1335,9 @@ var defaultComponentAPI4 = {
|
|
|
1333
1335
|
};
|
|
1334
1336
|
var DialogContext = createContext4(defaultComponentAPI4);
|
|
1335
1337
|
var useDialog = () => useContext4(DialogContext);
|
|
1336
|
-
var DialogProvider = ({
|
|
1338
|
+
var DialogProvider = ({
|
|
1339
|
+
children
|
|
1340
|
+
}) => {
|
|
1337
1341
|
const context = useDialogProvider();
|
|
1338
1342
|
return /* @__PURE__ */ React13.createElement(DialogContext.Provider, { value: context }, children);
|
|
1339
1343
|
};
|
|
@@ -1775,7 +1779,10 @@ var DropdownMenu = ({ children }) => {
|
|
|
1775
1779
|
const handleClickOutside = () => {
|
|
1776
1780
|
if (states.open && toggleOpen) toggleOpen();
|
|
1777
1781
|
};
|
|
1778
|
-
useClickOutside(
|
|
1782
|
+
useClickOutside(
|
|
1783
|
+
DropdownContentRef,
|
|
1784
|
+
handleClickOutside
|
|
1785
|
+
);
|
|
1779
1786
|
useDisabledScroll(Boolean(states.open));
|
|
1780
1787
|
return /* @__PURE__ */ React17.createElement(RootWrapper, { ref: DropdownContentRef }, children);
|
|
1781
1788
|
};
|
|
@@ -1951,7 +1958,9 @@ var defaultComponentAPI5 = {
|
|
|
1951
1958
|
};
|
|
1952
1959
|
var FieldContext = createContext5(defaultComponentAPI5);
|
|
1953
1960
|
var useField = () => useContext5(FieldContext);
|
|
1954
|
-
var FieldProvider = ({
|
|
1961
|
+
var FieldProvider = ({
|
|
1962
|
+
children
|
|
1963
|
+
}) => {
|
|
1955
1964
|
const context = useFieldProvider();
|
|
1956
1965
|
return /* @__PURE__ */ React18.createElement(FieldContext.Provider, { value: context }, children);
|
|
1957
1966
|
};
|
|
@@ -1972,6 +1981,7 @@ var FieldDefaultStyles = css8`
|
|
|
1972
1981
|
display: flex;
|
|
1973
1982
|
align-items: center;
|
|
1974
1983
|
justify-content: center;
|
|
1984
|
+
box-sizing: border-box;
|
|
1975
1985
|
|
|
1976
1986
|
font-size: var(--fontsize-medium-20);
|
|
1977
1987
|
|
|
@@ -2243,23 +2253,175 @@ Field.Wrapper = FieldWrapper;
|
|
|
2243
2253
|
Field.Label = FieldLabel;
|
|
2244
2254
|
Field.Meta = FieldMeta;
|
|
2245
2255
|
|
|
2246
|
-
// src/
|
|
2256
|
+
// src/message-bubble/index.tsx
|
|
2247
2257
|
import React21 from "react";
|
|
2248
2258
|
|
|
2259
|
+
// src/message-bubble/hooks/index.tsx
|
|
2260
|
+
import React20, { useState as useState6, createContext as createContext6, useContext as useContext6 } from "react";
|
|
2261
|
+
var defaultComponentAPI6 = {
|
|
2262
|
+
id: "",
|
|
2263
|
+
states: {},
|
|
2264
|
+
methods: {}
|
|
2265
|
+
};
|
|
2266
|
+
var MessageBubbleContext = createContext6(defaultComponentAPI6);
|
|
2267
|
+
var useMessageBubble = () => useContext6(MessageBubbleContext);
|
|
2268
|
+
var MessageBubbleProvider = ({
|
|
2269
|
+
children
|
|
2270
|
+
}) => {
|
|
2271
|
+
const context = useMessageBubbleProvider();
|
|
2272
|
+
return /* @__PURE__ */ React20.createElement(MessageBubbleContext.Provider, { value: context }, children);
|
|
2273
|
+
};
|
|
2274
|
+
function useMessageBubbleProvider() {
|
|
2275
|
+
const [side, setSide] = useState6(null);
|
|
2276
|
+
const MessageBubbleId = React20.useId();
|
|
2277
|
+
return {
|
|
2278
|
+
id: MessageBubbleId,
|
|
2279
|
+
states: {
|
|
2280
|
+
side
|
|
2281
|
+
},
|
|
2282
|
+
methods: {
|
|
2283
|
+
applySide: (side2) => setSide(side2)
|
|
2284
|
+
}
|
|
2285
|
+
};
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
// src/message-bubble/styles/index.ts
|
|
2289
|
+
import styled11 from "styled-components";
|
|
2290
|
+
var MessageBubbleWrapper = styled11.div`
|
|
2291
|
+
display: flex;
|
|
2292
|
+
flex-direction: column;
|
|
2293
|
+
gap: var(--measurement-medium-10);
|
|
2294
|
+
|
|
2295
|
+
&[data-side="right"] {
|
|
2296
|
+
align-items: flex-end;
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
&[data-side="left"] {
|
|
2300
|
+
align-items: flex-start;
|
|
2301
|
+
}
|
|
2302
|
+
`;
|
|
2303
|
+
var MessageBubbleBadge = styled11(Badge)`
|
|
2304
|
+
position: relative;
|
|
2305
|
+
max-width: var(--measurement-large-90);
|
|
2306
|
+
width: 100%;
|
|
2307
|
+
justify-self: flex-end;
|
|
2308
|
+
padding: var(--measurement-medium-30) var(--measurement-medium-50) !important;
|
|
2309
|
+
border-radius: var(--measurement-medium-60) !important;
|
|
2310
|
+
|
|
2311
|
+
&[data-side="left"] {
|
|
2312
|
+
background-color: var(--contrast-color) !important;
|
|
2313
|
+
border-bottom-left-radius: 0 !important;
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2316
|
+
&[data-side="right"] {
|
|
2317
|
+
background-color: var(--font-color-alpha-10) !important;
|
|
2318
|
+
border-bottom-right-radius: 0 !important;
|
|
2319
|
+
}
|
|
2320
|
+
`;
|
|
2321
|
+
var MessageBubbleContentWrapper = styled11.div`
|
|
2322
|
+
line-height: 1.5;
|
|
2323
|
+
font-weight: 500;
|
|
2324
|
+
word-break: keep-all;
|
|
2325
|
+
width: 100%;
|
|
2326
|
+
|
|
2327
|
+
* {
|
|
2328
|
+
font-size: var(--fontsize-medium-10) !important;
|
|
2329
|
+
}
|
|
2330
|
+
`;
|
|
2331
|
+
var MessageBubbleMetaWrapper = styled11.div`
|
|
2332
|
+
display: flex;
|
|
2333
|
+
align-items: center;
|
|
2334
|
+
gap: var(--measurement-medium-10);
|
|
2335
|
+
width: 100%;
|
|
2336
|
+
|
|
2337
|
+
&[data-side="right"] {
|
|
2338
|
+
justify-content: flex-end;
|
|
2339
|
+
}
|
|
2340
|
+
|
|
2341
|
+
&[data-side="left"] {
|
|
2342
|
+
justify-content: flex-start;
|
|
2343
|
+
}
|
|
2344
|
+
`;
|
|
2345
|
+
|
|
2346
|
+
// src/message-bubble/index.tsx
|
|
2347
|
+
var MessageBubbleRoot = ({ children }) => {
|
|
2348
|
+
return /* @__PURE__ */ React21.createElement(MessageBubbleProvider, null, children);
|
|
2349
|
+
};
|
|
2350
|
+
MessageBubbleRoot.displayName = "MessageBubble.Root";
|
|
2351
|
+
var MessageBubble = (props) => {
|
|
2352
|
+
const { side, raw, children, ...restProps } = props;
|
|
2353
|
+
const { methods } = useMessageBubble();
|
|
2354
|
+
React21.useEffect(() => {
|
|
2355
|
+
if (side && methods?.applySide) methods.applySide(side);
|
|
2356
|
+
}, [side]);
|
|
2357
|
+
return /* @__PURE__ */ React21.createElement(
|
|
2358
|
+
MessageBubbleWrapper,
|
|
2359
|
+
{
|
|
2360
|
+
"data-raw": Boolean(raw),
|
|
2361
|
+
"data-side": side,
|
|
2362
|
+
"aria-label": restProps["aria-label"] ?? `message-bubble-${side}`,
|
|
2363
|
+
...restProps
|
|
2364
|
+
},
|
|
2365
|
+
children
|
|
2366
|
+
);
|
|
2367
|
+
};
|
|
2368
|
+
MessageBubble.displayName = "MessageBubble";
|
|
2369
|
+
var MessageBubbleContent = (props) => {
|
|
2370
|
+
const { children, raw, ...restProps } = props;
|
|
2371
|
+
const { id, states } = useMessageBubble();
|
|
2372
|
+
return /* @__PURE__ */ React21.createElement(
|
|
2373
|
+
MessageBubbleBadge,
|
|
2374
|
+
{
|
|
2375
|
+
variant: "secondary",
|
|
2376
|
+
"data-raw": Boolean(raw),
|
|
2377
|
+
"data-side": states?.side,
|
|
2378
|
+
"aria-label": `message-bubble-content-${id}`,
|
|
2379
|
+
...restProps
|
|
2380
|
+
},
|
|
2381
|
+
/* @__PURE__ */ React21.createElement(MessageBubbleContentWrapper, null, children)
|
|
2382
|
+
);
|
|
2383
|
+
};
|
|
2384
|
+
MessageBubbleContent.displayName = "MessageBubble.Content";
|
|
2385
|
+
var MessageBubbleMeta = (props) => {
|
|
2386
|
+
const { createdAt, raw, ...restProps } = props;
|
|
2387
|
+
const { states } = useMessageBubble();
|
|
2388
|
+
const formattedDate = new Intl.DateTimeFormat("en-US", {
|
|
2389
|
+
dateStyle: "medium",
|
|
2390
|
+
timeStyle: "short"
|
|
2391
|
+
}).format(createdAt);
|
|
2392
|
+
return /* @__PURE__ */ React21.createElement(
|
|
2393
|
+
MessageBubbleMetaWrapper,
|
|
2394
|
+
{
|
|
2395
|
+
"data-raw": Boolean(raw),
|
|
2396
|
+
"data-side": states?.side,
|
|
2397
|
+
"aria-label": `message-bubble-meta-${states?.side}`,
|
|
2398
|
+
...restProps
|
|
2399
|
+
},
|
|
2400
|
+
formattedDate
|
|
2401
|
+
);
|
|
2402
|
+
};
|
|
2403
|
+
MessageBubbleMeta.displayName = "MessageBubble.Meta";
|
|
2404
|
+
MessageBubble.Root = MessageBubbleRoot;
|
|
2405
|
+
MessageBubble.Content = MessageBubbleContent;
|
|
2406
|
+
MessageBubble.Meta = MessageBubbleMeta;
|
|
2407
|
+
|
|
2408
|
+
// src/otp-field/index.tsx
|
|
2409
|
+
import React23 from "react";
|
|
2410
|
+
|
|
2249
2411
|
// src/otp-field/hooks/index.tsx
|
|
2250
|
-
import
|
|
2251
|
-
var OTPFieldContext =
|
|
2412
|
+
import React22 from "react";
|
|
2413
|
+
var OTPFieldContext = React22.createContext(
|
|
2252
2414
|
null
|
|
2253
2415
|
);
|
|
2254
2416
|
var useOTPField = () => {
|
|
2255
|
-
const context =
|
|
2417
|
+
const context = React22.useContext(OTPFieldContext);
|
|
2256
2418
|
if (!context) return null;
|
|
2257
2419
|
return context;
|
|
2258
2420
|
};
|
|
2259
2421
|
|
|
2260
2422
|
// src/otp-field/styles/index.ts
|
|
2261
|
-
import
|
|
2262
|
-
var OTPCell =
|
|
2423
|
+
import styled12 from "styled-components";
|
|
2424
|
+
var OTPCell = styled12.input`
|
|
2263
2425
|
width: var(--measurement-medium-90);
|
|
2264
2426
|
height: var(--measurement-medium-90);
|
|
2265
2427
|
border: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
@@ -2294,11 +2456,11 @@ var OTPCell = styled11.input`
|
|
|
2294
2456
|
// src/otp-field/index.tsx
|
|
2295
2457
|
var OTPField = ({ children, length, onComplete }) => {
|
|
2296
2458
|
const defaultLength = length ?? 6;
|
|
2297
|
-
const inputRefs =
|
|
2298
|
-
const [otp, setOtp] =
|
|
2459
|
+
const inputRefs = React23.useRef([]);
|
|
2460
|
+
const [otp, setOtp] = React23.useState(
|
|
2299
2461
|
Array.from({ length: defaultLength }, () => "")
|
|
2300
2462
|
);
|
|
2301
|
-
const [activeIndex, setActiveIndex] =
|
|
2463
|
+
const [activeIndex, setActiveIndex] = React23.useState(0);
|
|
2302
2464
|
const handleChange = (index, value) => {
|
|
2303
2465
|
const newOtp = [...otp];
|
|
2304
2466
|
newOtp[index] = value.substring(value.length - 1);
|
|
@@ -2359,13 +2521,13 @@ var OTPField = ({ children, length, onComplete }) => {
|
|
|
2359
2521
|
);
|
|
2360
2522
|
return () => clearTimeout(timeout);
|
|
2361
2523
|
};
|
|
2362
|
-
|
|
2524
|
+
React23.useEffect(() => {
|
|
2363
2525
|
const otpString = otp.join("");
|
|
2364
2526
|
if (otpString.length === defaultLength && onComplete) {
|
|
2365
2527
|
onComplete(otpString);
|
|
2366
2528
|
}
|
|
2367
2529
|
}, [otp, defaultLength, onComplete]);
|
|
2368
|
-
const contextValue =
|
|
2530
|
+
const contextValue = React23.useMemo(() => {
|
|
2369
2531
|
return {
|
|
2370
2532
|
otp,
|
|
2371
2533
|
activeIndex,
|
|
@@ -2388,11 +2550,11 @@ var OTPField = ({ children, length, onComplete }) => {
|
|
|
2388
2550
|
handleClick,
|
|
2389
2551
|
handlePaste
|
|
2390
2552
|
]);
|
|
2391
|
-
return /* @__PURE__ */
|
|
2553
|
+
return /* @__PURE__ */ React23.createElement(OTPFieldContext.Provider, { value: contextValue }, children);
|
|
2392
2554
|
};
|
|
2393
2555
|
OTPField.displayName = "OTPField";
|
|
2394
|
-
var OTPFieldGroup =
|
|
2395
|
-
return /* @__PURE__ */
|
|
2556
|
+
var OTPFieldGroup = React23.forwardRef(({ ...props }, ref) => {
|
|
2557
|
+
return /* @__PURE__ */ React23.createElement("span", { ref, className: "flex g-medium-10 align-center", ...props });
|
|
2396
2558
|
});
|
|
2397
2559
|
OTPFieldGroup.displayName = "OTPField.Group";
|
|
2398
2560
|
var OTPFieldSlot = ({
|
|
@@ -2411,10 +2573,12 @@ var OTPFieldSlot = ({
|
|
|
2411
2573
|
handleClick,
|
|
2412
2574
|
handlePaste
|
|
2413
2575
|
} = context;
|
|
2414
|
-
return /* @__PURE__ */
|
|
2576
|
+
return /* @__PURE__ */ React23.createElement(
|
|
2415
2577
|
OTPCell,
|
|
2416
2578
|
{
|
|
2417
|
-
ref: (el) =>
|
|
2579
|
+
ref: (el) => {
|
|
2580
|
+
inputRefs.current[index] = el;
|
|
2581
|
+
},
|
|
2418
2582
|
type: "text",
|
|
2419
2583
|
"data-testid": "otp-field-slot",
|
|
2420
2584
|
"data-active": activeIndex === index,
|
|
@@ -2437,11 +2601,11 @@ OTPField.Group = OTPFieldGroup;
|
|
|
2437
2601
|
OTPField.Slot = OTPFieldSlot;
|
|
2438
2602
|
|
|
2439
2603
|
// src/overlay/index.tsx
|
|
2440
|
-
import
|
|
2604
|
+
import React24 from "react";
|
|
2441
2605
|
|
|
2442
2606
|
// src/overlay/styles/index.ts
|
|
2443
|
-
import
|
|
2444
|
-
var OverlayWrapper =
|
|
2607
|
+
import styled13 from "styled-components";
|
|
2608
|
+
var OverlayWrapper = styled13.div`
|
|
2445
2609
|
@keyframes animate-fade {
|
|
2446
2610
|
0% {
|
|
2447
2611
|
opacity: 0;
|
|
@@ -2469,15 +2633,15 @@ var OverlayWrapper = styled12.div`
|
|
|
2469
2633
|
// src/overlay/index.tsx
|
|
2470
2634
|
var Overlay = (props) => {
|
|
2471
2635
|
const { raw, visible, closeOnInteract, onClick, ...restProps } = props;
|
|
2472
|
-
const [mounted, setMounted] =
|
|
2636
|
+
const [mounted, setMounted] = React24.useState(Boolean(visible));
|
|
2473
2637
|
const handleClick = (event) => {
|
|
2474
2638
|
if (onClick) onClick(event);
|
|
2475
2639
|
if (closeOnInteract) setMounted(false);
|
|
2476
2640
|
};
|
|
2477
|
-
|
|
2641
|
+
React24.useEffect(() => {
|
|
2478
2642
|
if (visible !== mounted) setMounted(Boolean(visible));
|
|
2479
2643
|
}, [visible]);
|
|
2480
|
-
return /* @__PURE__ */
|
|
2644
|
+
return /* @__PURE__ */ React24.createElement(React24.Fragment, null, mounted && /* @__PURE__ */ React24.createElement(
|
|
2481
2645
|
OverlayWrapper,
|
|
2482
2646
|
{
|
|
2483
2647
|
tabIndex: -1,
|
|
@@ -2491,13 +2655,13 @@ var Overlay = (props) => {
|
|
|
2491
2655
|
Overlay.displayName = "Overlay";
|
|
2492
2656
|
|
|
2493
2657
|
// src/page/index.tsx
|
|
2494
|
-
import
|
|
2658
|
+
import React25 from "react";
|
|
2495
2659
|
|
|
2496
2660
|
// src/page/styles/index.ts
|
|
2497
|
-
import
|
|
2661
|
+
import styled15 from "styled-components";
|
|
2498
2662
|
|
|
2499
2663
|
// src/scrollarea/styles/index.ts
|
|
2500
|
-
import
|
|
2664
|
+
import styled14, { css as css9 } from "styled-components";
|
|
2501
2665
|
var HiddenScrollbar = css9`
|
|
2502
2666
|
scrollbar-width: none;
|
|
2503
2667
|
|
|
@@ -2542,7 +2706,7 @@ var CustomScrollbar = css9`
|
|
|
2542
2706
|
scrollbar-width: thin;
|
|
2543
2707
|
scrollbar-color: ${({ $thumbColor, $trackColor }) => `${$thumbColor || "var(--font-color-alpha-10)"} ${$trackColor || "transparent"}`};
|
|
2544
2708
|
`;
|
|
2545
|
-
var ScrollAreaWrapper =
|
|
2709
|
+
var ScrollAreaWrapper = styled14.div`
|
|
2546
2710
|
overflow: scroll;
|
|
2547
2711
|
|
|
2548
2712
|
&[data-scrollbar="true"] {
|
|
@@ -2554,11 +2718,11 @@ var ScrollAreaWrapper = styled13.div`
|
|
|
2554
2718
|
`;
|
|
2555
2719
|
|
|
2556
2720
|
// src/page/styles/index.ts
|
|
2557
|
-
var PageRootWrapper =
|
|
2721
|
+
var PageRootWrapper = styled15.div`
|
|
2558
2722
|
height: 100dvh;
|
|
2559
2723
|
width: 100%;
|
|
2560
2724
|
`;
|
|
2561
|
-
var PageNavWrapper =
|
|
2725
|
+
var PageNavWrapper = styled15.nav`
|
|
2562
2726
|
background-color: var(--body-color);
|
|
2563
2727
|
border: var(--measurement-small-10) solid transparent;
|
|
2564
2728
|
border-bottom-color: var(--font-color-alpha-10);
|
|
@@ -2567,7 +2731,7 @@ var PageNavWrapper = styled14.nav`
|
|
|
2567
2731
|
max-height: var(--measurement-large-20);
|
|
2568
2732
|
padding: var(--measurement-medium-30);
|
|
2569
2733
|
`;
|
|
2570
|
-
var PageMenuWrapper =
|
|
2734
|
+
var PageMenuWrapper = styled15.menu`
|
|
2571
2735
|
background-color: var(--body-color);
|
|
2572
2736
|
border: var(--measurement-small-10) solid transparent;
|
|
2573
2737
|
border-bottom-color: var(--font-color-alpha-10);
|
|
@@ -2577,19 +2741,19 @@ var PageMenuWrapper = styled14.menu`
|
|
|
2577
2741
|
margin: 0;
|
|
2578
2742
|
padding: var(--measurement-medium-60) var(--measurement-medium-30);
|
|
2579
2743
|
`;
|
|
2580
|
-
var PagePanelWrapper =
|
|
2744
|
+
var PagePanelWrapper = styled15.aside`
|
|
2581
2745
|
position: absolute;
|
|
2582
2746
|
bottom: 0;
|
|
2583
2747
|
width: 100%;
|
|
2584
2748
|
overflow: scroll;
|
|
2585
2749
|
${HiddenScrollbar}
|
|
2586
2750
|
`;
|
|
2587
|
-
var PageSectionWrapper =
|
|
2751
|
+
var PageSectionWrapper = styled15.div`
|
|
2588
2752
|
background: var(--body-color);
|
|
2589
2753
|
width: 100%;
|
|
2590
2754
|
height: 100%;
|
|
2591
2755
|
`;
|
|
2592
|
-
var PageBodyWrapper =
|
|
2756
|
+
var PageBodyWrapper = styled15.div`
|
|
2593
2757
|
--menus-height: calc(
|
|
2594
2758
|
var(--measurement-large-30) *
|
|
2595
2759
|
${({ $menus }) => $menus ? Number($menus) : 0}
|
|
@@ -2614,12 +2778,12 @@ var PageBodyWrapper = styled14.div`
|
|
|
2614
2778
|
// src/page/index.tsx
|
|
2615
2779
|
var Page = (props) => {
|
|
2616
2780
|
const { children } = props;
|
|
2617
|
-
return /* @__PURE__ */
|
|
2781
|
+
return /* @__PURE__ */ React25.createElement(PageRootWrapper, { className: "flex", ...props }, children);
|
|
2618
2782
|
};
|
|
2619
2783
|
Page.displayName = "Page";
|
|
2620
2784
|
var PageNavigation = (props) => {
|
|
2621
2785
|
const { children } = props;
|
|
2622
|
-
return /* @__PURE__ */
|
|
2786
|
+
return /* @__PURE__ */ React25.createElement(PageNavWrapper, { ...props }, children);
|
|
2623
2787
|
};
|
|
2624
2788
|
PageNavigation.displayName = "Page.Navigation";
|
|
2625
2789
|
var PageTools = (props) => {
|
|
@@ -2641,7 +2805,7 @@ var PageTools = (props) => {
|
|
|
2641
2805
|
const handleClick = (event) => {
|
|
2642
2806
|
if (onClick) onClick(event);
|
|
2643
2807
|
};
|
|
2644
|
-
return /* @__PURE__ */
|
|
2808
|
+
return /* @__PURE__ */ React25.createElement(Toolbar.Root, null, /* @__PURE__ */ React25.createElement(
|
|
2645
2809
|
Toolbar,
|
|
2646
2810
|
{
|
|
2647
2811
|
raw,
|
|
@@ -2653,27 +2817,27 @@ var PageTools = (props) => {
|
|
|
2653
2817
|
defaultOpen,
|
|
2654
2818
|
...props
|
|
2655
2819
|
},
|
|
2656
|
-
/* @__PURE__ */
|
|
2657
|
-
!fixed && /* @__PURE__ */
|
|
2820
|
+
/* @__PURE__ */ React25.createElement(Toolbar.Section, { showoncollapse }, children),
|
|
2821
|
+
!fixed && /* @__PURE__ */ React25.createElement(
|
|
2658
2822
|
Toolbar.Trigger,
|
|
2659
2823
|
{
|
|
2660
2824
|
title: shortcut ? `${bindkey ?? "ctrl"} + ${hotkey}` : "toolbar-trigger",
|
|
2661
2825
|
onClick: handleClick,
|
|
2662
2826
|
...triggerProps
|
|
2663
2827
|
},
|
|
2664
|
-
trigger ?? /* @__PURE__ */
|
|
2828
|
+
trigger ?? /* @__PURE__ */ React25.createElement("span", null, "\u2194")
|
|
2665
2829
|
)
|
|
2666
2830
|
));
|
|
2667
2831
|
};
|
|
2668
2832
|
PageTools.displayName = "Page.Tools";
|
|
2669
2833
|
var PageContent = (props) => {
|
|
2670
2834
|
const { children } = props;
|
|
2671
|
-
return /* @__PURE__ */
|
|
2835
|
+
return /* @__PURE__ */ React25.createElement(ScrollArea, { as: PageSectionWrapper, ...props }, children);
|
|
2672
2836
|
};
|
|
2673
2837
|
PageContent.displayName = "Page.Content";
|
|
2674
2838
|
var PageWrapper = (props) => {
|
|
2675
2839
|
const { children } = props;
|
|
2676
|
-
return /* @__PURE__ */
|
|
2840
|
+
return /* @__PURE__ */ React25.createElement(PageBodyWrapper, { ...props }, children);
|
|
2677
2841
|
};
|
|
2678
2842
|
PageWrapper.displayName = "Page.Wrapper";
|
|
2679
2843
|
var PagePanel = (props) => {
|
|
@@ -2696,7 +2860,7 @@ var PagePanel = (props) => {
|
|
|
2696
2860
|
const handleClick = (event) => {
|
|
2697
2861
|
if (onClick) onClick(event);
|
|
2698
2862
|
};
|
|
2699
|
-
return /* @__PURE__ */
|
|
2863
|
+
return /* @__PURE__ */ React25.createElement(Toolbar.Root, null, /* @__PURE__ */ React25.createElement(
|
|
2700
2864
|
PagePanelWrapper,
|
|
2701
2865
|
{
|
|
2702
2866
|
as: Toolbar,
|
|
@@ -2710,22 +2874,22 @@ var PagePanel = (props) => {
|
|
|
2710
2874
|
defaultOpen,
|
|
2711
2875
|
"aria-label": props["aria-label"]
|
|
2712
2876
|
},
|
|
2713
|
-
!fixed && /* @__PURE__ */
|
|
2877
|
+
!fixed && /* @__PURE__ */ React25.createElement(
|
|
2714
2878
|
Toolbar.Trigger,
|
|
2715
2879
|
{
|
|
2716
2880
|
title: shortcut ? `${bindkey ?? "ctrl"} + ${hotkey}` : "toolbar-trigger",
|
|
2717
2881
|
onClick: handleClick,
|
|
2718
2882
|
...triggerProps
|
|
2719
2883
|
},
|
|
2720
|
-
trigger ?? /* @__PURE__ */
|
|
2884
|
+
trigger ?? /* @__PURE__ */ React25.createElement("span", { style: { transform: "rotate(90deg)" } }, "\u2194")
|
|
2721
2885
|
),
|
|
2722
|
-
/* @__PURE__ */
|
|
2886
|
+
/* @__PURE__ */ React25.createElement(Toolbar.Section, { showoncollapse }, children)
|
|
2723
2887
|
));
|
|
2724
2888
|
};
|
|
2725
2889
|
PagePanel.displayName = "Page.Panel";
|
|
2726
2890
|
var PageMenu = (props) => {
|
|
2727
2891
|
const { children } = props;
|
|
2728
|
-
return /* @__PURE__ */
|
|
2892
|
+
return /* @__PURE__ */ React25.createElement(PageMenuWrapper, { ...props }, children);
|
|
2729
2893
|
};
|
|
2730
2894
|
PageMenu.displayName = "Page.Menu";
|
|
2731
2895
|
Page.Navigation = PageNavigation;
|
|
@@ -2736,14 +2900,14 @@ Page.Panel = PagePanel;
|
|
|
2736
2900
|
Page.Menu = PageMenu;
|
|
2737
2901
|
|
|
2738
2902
|
// src/portal/index.tsx
|
|
2739
|
-
import
|
|
2903
|
+
import React26 from "react";
|
|
2740
2904
|
import { createPortal } from "react-dom";
|
|
2741
2905
|
var Portal = (props) => {
|
|
2742
2906
|
if (typeof document === "undefined") return null;
|
|
2743
2907
|
const { container, children } = props;
|
|
2744
|
-
const [hasMounted, setHasMounted] =
|
|
2745
|
-
const [portalRoot, setPortalRoot] =
|
|
2746
|
-
|
|
2908
|
+
const [hasMounted, setHasMounted] = React26.useState(false);
|
|
2909
|
+
const [portalRoot, setPortalRoot] = React26.useState(null);
|
|
2910
|
+
React26.useEffect(() => {
|
|
2747
2911
|
setHasMounted(true);
|
|
2748
2912
|
setPortalRoot(document.querySelector(`#${container}`));
|
|
2749
2913
|
}, [container]);
|
|
@@ -2753,18 +2917,18 @@ var Portal = (props) => {
|
|
|
2753
2917
|
Portal.displayName = "Portal";
|
|
2754
2918
|
|
|
2755
2919
|
// src/privacy-field/index.tsx
|
|
2756
|
-
import
|
|
2920
|
+
import React27 from "react";
|
|
2757
2921
|
|
|
2758
2922
|
// src/privacy-field/styles/index.ts
|
|
2759
|
-
import
|
|
2760
|
-
var Wrapper =
|
|
2923
|
+
import styled16 from "styled-components";
|
|
2924
|
+
var Wrapper = styled16(Field.Wrapper)`
|
|
2761
2925
|
position: relative;
|
|
2762
2926
|
|
|
2763
2927
|
input {
|
|
2764
2928
|
width: 100% !important;
|
|
2765
2929
|
}
|
|
2766
2930
|
`;
|
|
2767
|
-
var Trigger =
|
|
2931
|
+
var Trigger = styled16(Button)`
|
|
2768
2932
|
position: absolute !important;
|
|
2769
2933
|
right: var(--measurement-medium-50);
|
|
2770
2934
|
top: calc(var(--measurement-medium-50));
|
|
@@ -2777,30 +2941,30 @@ var PrivacyField = ({
|
|
|
2777
2941
|
passwordIcon,
|
|
2778
2942
|
...restProps
|
|
2779
2943
|
}) => {
|
|
2780
|
-
const [type, setType] =
|
|
2944
|
+
const [type, setType] = React27.useState(
|
|
2781
2945
|
defaultType ?? "password"
|
|
2782
2946
|
);
|
|
2783
|
-
const handleChangeType =
|
|
2947
|
+
const handleChangeType = React27.useCallback(() => {
|
|
2784
2948
|
if (type === "text") setType("password");
|
|
2785
2949
|
if (type === "password") setType("text");
|
|
2786
2950
|
}, [type, setType]);
|
|
2787
|
-
return /* @__PURE__ */
|
|
2951
|
+
return /* @__PURE__ */ React27.createElement(Wrapper, { className: "flex" }, /* @__PURE__ */ React27.createElement(Field, { autoComplete: "off", type, ...restProps }), /* @__PURE__ */ React27.createElement(Trigger, { variant: "ghost", sizing: "small", onClick: handleChangeType }, type === "text" && textIcon, type === "password" && passwordIcon));
|
|
2788
2952
|
};
|
|
2789
2953
|
PrivacyField.displayName = "PrivacyField";
|
|
2790
2954
|
|
|
2791
2955
|
// src/resizable/index.tsx
|
|
2792
|
-
import
|
|
2956
|
+
import React28 from "react";
|
|
2793
2957
|
|
|
2794
2958
|
// src/resizable/styles/index.ts
|
|
2795
|
-
import
|
|
2796
|
-
var SplitContainer =
|
|
2959
|
+
import styled17 from "styled-components";
|
|
2960
|
+
var SplitContainer = styled17.div`
|
|
2797
2961
|
position: relative;
|
|
2798
2962
|
`;
|
|
2799
|
-
var Panel =
|
|
2963
|
+
var Panel = styled17.div`
|
|
2800
2964
|
overflow: hidden;
|
|
2801
2965
|
width: ${(props) => props.width}%;
|
|
2802
2966
|
`;
|
|
2803
|
-
var Divider2 =
|
|
2967
|
+
var Divider2 = styled17.div`
|
|
2804
2968
|
width: var(--measurement-medium-10);
|
|
2805
2969
|
height: 100%;
|
|
2806
2970
|
top: 0;
|
|
@@ -2824,14 +2988,14 @@ var Divider2 = styled16.div`
|
|
|
2824
2988
|
height: ${(props) => props.$dragging ? "var(--measurement-large-10)" : "var(--measurement-medium-60)"};
|
|
2825
2989
|
}
|
|
2826
2990
|
`;
|
|
2827
|
-
var DragHandle =
|
|
2991
|
+
var DragHandle = styled17.div`
|
|
2828
2992
|
position: absolute;
|
|
2829
2993
|
top: 0;
|
|
2830
2994
|
bottom: 0;
|
|
2831
2995
|
left: calc(var(--measurement-medium-10) * -1);
|
|
2832
2996
|
right: calc(var(--measurement-medium-10) * -1);
|
|
2833
2997
|
`;
|
|
2834
|
-
var DragIndicator =
|
|
2998
|
+
var DragIndicator = styled17.div`
|
|
2835
2999
|
position: fixed;
|
|
2836
3000
|
width: var(--measurement-medium-10);
|
|
2837
3001
|
/* height: var(--measurement-medium-60); */
|
|
@@ -2841,7 +3005,7 @@ var DragIndicator = styled16.div`
|
|
|
2841
3005
|
opacity: 0;
|
|
2842
3006
|
transition: all 0.2s;
|
|
2843
3007
|
`;
|
|
2844
|
-
var DragOverlay =
|
|
3008
|
+
var DragOverlay = styled17.div`
|
|
2845
3009
|
position: fixed;
|
|
2846
3010
|
top: 0;
|
|
2847
3011
|
left: 0;
|
|
@@ -2857,12 +3021,12 @@ var Resizable = ({
|
|
|
2857
3021
|
left,
|
|
2858
3022
|
right
|
|
2859
3023
|
}) => {
|
|
2860
|
-
const containerRef =
|
|
2861
|
-
const [leftWidth, setLeftWidth] =
|
|
2862
|
-
const [isDragging, setIsDragging] =
|
|
2863
|
-
const handleMouseDown =
|
|
2864
|
-
const handleMouseUp =
|
|
2865
|
-
const handleMouseMove =
|
|
3024
|
+
const containerRef = React28.useRef(null);
|
|
3025
|
+
const [leftWidth, setLeftWidth] = React28.useState(defaultWidth ?? 50);
|
|
3026
|
+
const [isDragging, setIsDragging] = React28.useState(false);
|
|
3027
|
+
const handleMouseDown = React28.useCallback(() => setIsDragging(true), []);
|
|
3028
|
+
const handleMouseUp = React28.useCallback(() => setIsDragging(false), []);
|
|
3029
|
+
const handleMouseMove = React28.useCallback(
|
|
2866
3030
|
(e) => {
|
|
2867
3031
|
if (!isDragging || !containerRef.current) return;
|
|
2868
3032
|
const containerRect = containerRef.current.getBoundingClientRect();
|
|
@@ -2876,7 +3040,7 @@ var Resizable = ({
|
|
|
2876
3040
|
},
|
|
2877
3041
|
[isDragging]
|
|
2878
3042
|
);
|
|
2879
|
-
|
|
3043
|
+
React28.useEffect(() => {
|
|
2880
3044
|
if (isDragging) {
|
|
2881
3045
|
document.addEventListener("mousemove", handleMouseMove);
|
|
2882
3046
|
document.addEventListener("mouseup", handleMouseUp);
|
|
@@ -2895,45 +3059,47 @@ var Resizable = ({
|
|
|
2895
3059
|
document.body.style.userSelect = "";
|
|
2896
3060
|
};
|
|
2897
3061
|
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
2898
|
-
return /* @__PURE__ */
|
|
3062
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(SplitContainer, { ref: containerRef, className: "h-100 flex" }, /* @__PURE__ */ React28.createElement(Panel, { width: leftWidth }, left), /* @__PURE__ */ React28.createElement(
|
|
2899
3063
|
Divider2,
|
|
2900
3064
|
{
|
|
2901
3065
|
$dragging: isDragging,
|
|
2902
3066
|
onMouseDown: handleMouseDown,
|
|
2903
3067
|
onTouchStart: handleMouseDown
|
|
2904
3068
|
},
|
|
2905
|
-
/* @__PURE__ */
|
|
3069
|
+
/* @__PURE__ */ React28.createElement(
|
|
2906
3070
|
DragHandle,
|
|
2907
3071
|
{
|
|
2908
3072
|
className: "flex align-center justify-center",
|
|
2909
3073
|
id: "drag-handle"
|
|
2910
3074
|
},
|
|
2911
|
-
/* @__PURE__ */
|
|
3075
|
+
/* @__PURE__ */ React28.createElement(DragIndicator, { className: "drag-indicator-handle" })
|
|
2912
3076
|
)
|
|
2913
|
-
), /* @__PURE__ */
|
|
3077
|
+
), /* @__PURE__ */ React28.createElement(Panel, { width: 100 - leftWidth }, right)), isDragging && /* @__PURE__ */ React28.createElement(DragOverlay, null));
|
|
2914
3078
|
};
|
|
2915
3079
|
Resizable.displayName = "Resizable";
|
|
2916
3080
|
|
|
2917
3081
|
// src/sheet/index.tsx
|
|
2918
|
-
import
|
|
3082
|
+
import React30 from "react";
|
|
2919
3083
|
|
|
2920
3084
|
// src/sheet/hooks/index.tsx
|
|
2921
|
-
import
|
|
2922
|
-
var SheetContext =
|
|
3085
|
+
import React29 from "react";
|
|
3086
|
+
var SheetContext = React29.createContext({
|
|
2923
3087
|
id: {},
|
|
2924
3088
|
states: {},
|
|
2925
3089
|
methods: {}
|
|
2926
3090
|
});
|
|
2927
|
-
var useSheet = () =>
|
|
2928
|
-
var SheetProvider = ({
|
|
3091
|
+
var useSheet = () => React29.useContext(SheetContext);
|
|
3092
|
+
var SheetProvider = ({
|
|
3093
|
+
children
|
|
3094
|
+
}) => {
|
|
2929
3095
|
const context = useSheetProvider();
|
|
2930
|
-
return /* @__PURE__ */
|
|
3096
|
+
return /* @__PURE__ */ React29.createElement(SheetContext.Provider, { value: context }, children);
|
|
2931
3097
|
};
|
|
2932
3098
|
function useSheetProvider() {
|
|
2933
|
-
const containerId =
|
|
2934
|
-
const triggerId =
|
|
2935
|
-
const controlId =
|
|
2936
|
-
const [open, setOpen] =
|
|
3099
|
+
const containerId = React29.useId();
|
|
3100
|
+
const triggerId = React29.useId();
|
|
3101
|
+
const controlId = React29.useId();
|
|
3102
|
+
const [open, setOpen] = React29.useState(false);
|
|
2937
3103
|
return {
|
|
2938
3104
|
id: {
|
|
2939
3105
|
containerId,
|
|
@@ -2951,7 +3117,7 @@ function useSheetProvider() {
|
|
|
2951
3117
|
}
|
|
2952
3118
|
|
|
2953
3119
|
// src/sheet/styles/index.ts
|
|
2954
|
-
import
|
|
3120
|
+
import styled18, { css as css10 } from "styled-components";
|
|
2955
3121
|
var SheetStyles = css10`
|
|
2956
3122
|
all: unset;
|
|
2957
3123
|
position: fixed;
|
|
@@ -3011,7 +3177,7 @@ var SheetSideStyles = css10`
|
|
|
3011
3177
|
animation-name: slide-left;
|
|
3012
3178
|
}
|
|
3013
3179
|
`;
|
|
3014
|
-
var SheetWrapper =
|
|
3180
|
+
var SheetWrapper = styled18.dialog`
|
|
3015
3181
|
&[data-raw="false"] {
|
|
3016
3182
|
${SheetStyles}
|
|
3017
3183
|
${SheetSideStyles}
|
|
@@ -3021,7 +3187,7 @@ var SheetWrapper = styled17.dialog`
|
|
|
3021
3187
|
|
|
3022
3188
|
// src/sheet/index.tsx
|
|
3023
3189
|
var SheetRoot = ({ children }) => {
|
|
3024
|
-
return /* @__PURE__ */
|
|
3190
|
+
return /* @__PURE__ */ React30.createElement(SheetProvider, null, children);
|
|
3025
3191
|
};
|
|
3026
3192
|
SheetRoot.displayName = "Sheet.Root";
|
|
3027
3193
|
var Sheet = (props) => {
|
|
@@ -3042,16 +3208,16 @@ var Sheet = (props) => {
|
|
|
3042
3208
|
const { id, states, methods } = useSheet();
|
|
3043
3209
|
const { toggle } = methods;
|
|
3044
3210
|
const shortcutControls = useKeyPress(String(hotkey), true, bindkey);
|
|
3045
|
-
|
|
3211
|
+
React30.useEffect(() => {
|
|
3046
3212
|
if (open && toggle) return toggle();
|
|
3047
3213
|
}, [open]);
|
|
3048
|
-
|
|
3214
|
+
React30.useEffect(() => {
|
|
3049
3215
|
if (shortcut && shortcutControls && toggle) {
|
|
3050
3216
|
return toggle();
|
|
3051
3217
|
}
|
|
3052
3218
|
}, [shortcutControls]);
|
|
3053
3219
|
useDisabledScroll(lock && Boolean(states.open));
|
|
3054
|
-
return /* @__PURE__ */
|
|
3220
|
+
return /* @__PURE__ */ React30.createElement(React30.Fragment, null, states.open && /* @__PURE__ */ React30.createElement(React30.Fragment, null, /* @__PURE__ */ React30.createElement(
|
|
3055
3221
|
SheetWrapper,
|
|
3056
3222
|
{
|
|
3057
3223
|
role: "dialog",
|
|
@@ -3068,7 +3234,7 @@ var Sheet = (props) => {
|
|
|
3068
3234
|
...restProps
|
|
3069
3235
|
},
|
|
3070
3236
|
children
|
|
3071
|
-
), overlay && /* @__PURE__ */
|
|
3237
|
+
), overlay && /* @__PURE__ */ React30.createElement(
|
|
3072
3238
|
Overlay,
|
|
3073
3239
|
{
|
|
3074
3240
|
onClick: () => toggle && toggle(!states.open),
|
|
@@ -3094,7 +3260,7 @@ var SheetTrigger = (props) => {
|
|
|
3094
3260
|
if (onClick) onClick(event);
|
|
3095
3261
|
if (toggle) toggle(!states.open);
|
|
3096
3262
|
};
|
|
3097
|
-
return /* @__PURE__ */
|
|
3263
|
+
return /* @__PURE__ */ React30.createElement(
|
|
3098
3264
|
Button,
|
|
3099
3265
|
{
|
|
3100
3266
|
id: id.triggerId,
|
|
@@ -3113,14 +3279,76 @@ SheetTrigger.displayName = "Sheet.Trigger";
|
|
|
3113
3279
|
Sheet.Root = SheetRoot;
|
|
3114
3280
|
Sheet.Trigger = SheetTrigger;
|
|
3115
3281
|
|
|
3282
|
+
// src/shimmer/index.tsx
|
|
3283
|
+
import React31 from "react";
|
|
3284
|
+
|
|
3285
|
+
// src/shimmer/styles/index.ts
|
|
3286
|
+
import styled19, { keyframes as keyframes2 } from "styled-components";
|
|
3287
|
+
var shimmer = keyframes2`
|
|
3288
|
+
0% {
|
|
3289
|
+
background-position: 200% center;
|
|
3290
|
+
}
|
|
3291
|
+
100% {
|
|
3292
|
+
background-position: -200% center;
|
|
3293
|
+
}
|
|
3294
|
+
`;
|
|
3295
|
+
var TextShimmerWrapper = styled19.span`
|
|
3296
|
+
background: linear-gradient(
|
|
3297
|
+
90deg,
|
|
3298
|
+
${({ "data-base-color": baseColor }) => baseColor} 0%,
|
|
3299
|
+
${({ "data-shimmer-color": shimmerColor }) => shimmerColor} 40%,
|
|
3300
|
+
${({ "data-base-color": baseColor }) => baseColor} 60%,
|
|
3301
|
+
${({ "data-base-color": baseColor }) => baseColor} 100%
|
|
3302
|
+
);
|
|
3303
|
+
background-size: ${({ "data-spread": spread }) => spread}% auto;
|
|
3304
|
+
background-clip: text;
|
|
3305
|
+
-webkit-background-clip: text;
|
|
3306
|
+
-webkit-text-fill-color: transparent;
|
|
3307
|
+
color: transparent;
|
|
3308
|
+
animation: ${shimmer} ${({ "data-duration": duration }) => duration}s linear
|
|
3309
|
+
infinite;
|
|
3310
|
+
display: inline-block;
|
|
3311
|
+
`;
|
|
3312
|
+
|
|
3313
|
+
// src/shimmer/index.tsx
|
|
3314
|
+
var DEFAULT_DURATION = 2;
|
|
3315
|
+
var DEFAULT_SPREAD = 200;
|
|
3316
|
+
var DEFAULT_SHIMMER_COLOR = "var(--font-color-alpha-60)";
|
|
3317
|
+
var DEFAULT_BASE_COLOR = "var(--font-color-alpha-30)";
|
|
3318
|
+
var Shimmer = (props) => {
|
|
3319
|
+
const {
|
|
3320
|
+
children,
|
|
3321
|
+
raw,
|
|
3322
|
+
duration = DEFAULT_DURATION,
|
|
3323
|
+
spread = DEFAULT_SPREAD,
|
|
3324
|
+
shimmerColor = DEFAULT_SHIMMER_COLOR,
|
|
3325
|
+
baseColor = DEFAULT_BASE_COLOR,
|
|
3326
|
+
...restProps
|
|
3327
|
+
} = props;
|
|
3328
|
+
return /* @__PURE__ */ React31.createElement(
|
|
3329
|
+
TextShimmerWrapper,
|
|
3330
|
+
{
|
|
3331
|
+
"data-raw": Boolean(raw),
|
|
3332
|
+
"data-duration": duration,
|
|
3333
|
+
"data-spread": spread,
|
|
3334
|
+
"data-shimmer-color": shimmerColor,
|
|
3335
|
+
"data-base-color": baseColor,
|
|
3336
|
+
"aria-label": restProps["aria-label"] ?? "shimmer-text",
|
|
3337
|
+
...restProps
|
|
3338
|
+
},
|
|
3339
|
+
children
|
|
3340
|
+
);
|
|
3341
|
+
};
|
|
3342
|
+
Shimmer.displayName = "Shimmer";
|
|
3343
|
+
|
|
3116
3344
|
// src/scrollarea/index.tsx
|
|
3117
|
-
import
|
|
3345
|
+
import React32 from "react";
|
|
3118
3346
|
var ScrollArea = ({
|
|
3119
3347
|
scrollbar = false,
|
|
3120
3348
|
children,
|
|
3121
3349
|
...restProps
|
|
3122
3350
|
}) => {
|
|
3123
|
-
return /* @__PURE__ */
|
|
3351
|
+
return /* @__PURE__ */ React32.createElement(
|
|
3124
3352
|
ScrollAreaWrapper,
|
|
3125
3353
|
{
|
|
3126
3354
|
"aria-hidden": "true",
|
|
@@ -3132,11 +3360,11 @@ var ScrollArea = ({
|
|
|
3132
3360
|
};
|
|
3133
3361
|
|
|
3134
3362
|
// src/spinner/index.tsx
|
|
3135
|
-
import
|
|
3363
|
+
import React33 from "react";
|
|
3136
3364
|
|
|
3137
3365
|
// src/spinner/styles/index.ts
|
|
3138
|
-
import
|
|
3139
|
-
var Rotate =
|
|
3366
|
+
import styled20, { css as css11, keyframes as keyframes3 } from "styled-components";
|
|
3367
|
+
var Rotate = keyframes3`
|
|
3140
3368
|
0% {
|
|
3141
3369
|
transform: rotate(0deg);
|
|
3142
3370
|
}
|
|
@@ -3158,7 +3386,7 @@ var FieldSizeStyles2 = css11`
|
|
|
3158
3386
|
height: var(--measurement-medium-60);
|
|
3159
3387
|
}
|
|
3160
3388
|
`;
|
|
3161
|
-
var RotatingSpinner =
|
|
3389
|
+
var RotatingSpinner = styled20.span`
|
|
3162
3390
|
padding: 0;
|
|
3163
3391
|
margin: 0;
|
|
3164
3392
|
|
|
@@ -3176,15 +3404,15 @@ var RotatingSpinner = styled18.span`
|
|
|
3176
3404
|
|
|
3177
3405
|
// src/spinner/index.tsx
|
|
3178
3406
|
var Spinner = (props) => {
|
|
3179
|
-
return /* @__PURE__ */
|
|
3407
|
+
return /* @__PURE__ */ React33.createElement(RotatingSpinner, { "data-size": props.sizing ?? "medium" });
|
|
3180
3408
|
};
|
|
3181
3409
|
|
|
3182
3410
|
// src/skeleton/index.tsx
|
|
3183
|
-
import
|
|
3411
|
+
import React34 from "react";
|
|
3184
3412
|
|
|
3185
3413
|
// src/skeleton/styles/index.ts
|
|
3186
|
-
import
|
|
3187
|
-
var SkeletonBlink =
|
|
3414
|
+
import styled21, { css as css12, keyframes as keyframes4 } from "styled-components";
|
|
3415
|
+
var SkeletonBlink = keyframes4`
|
|
3188
3416
|
0% {
|
|
3189
3417
|
opacity: 0.3;
|
|
3190
3418
|
}
|
|
@@ -3229,7 +3457,7 @@ var SkeletonShapeStyles = css12`
|
|
|
3229
3457
|
border-radius: var(--measurement-large-90);
|
|
3230
3458
|
}
|
|
3231
3459
|
`;
|
|
3232
|
-
var SkeletonLoader =
|
|
3460
|
+
var SkeletonLoader = styled21.span`
|
|
3233
3461
|
${SkeletonBaseStyles}
|
|
3234
3462
|
${SkeletonSizeStyles}
|
|
3235
3463
|
${SkeletonShapeStyles}
|
|
@@ -3242,7 +3470,7 @@ var Skeleton = (props) => {
|
|
|
3242
3470
|
shape = "smooth",
|
|
3243
3471
|
...restProps
|
|
3244
3472
|
} = props;
|
|
3245
|
-
return /* @__PURE__ */
|
|
3473
|
+
return /* @__PURE__ */ React34.createElement(
|
|
3246
3474
|
SkeletonLoader,
|
|
3247
3475
|
{
|
|
3248
3476
|
"data-size": sizing,
|
|
@@ -3255,24 +3483,26 @@ var Skeleton = (props) => {
|
|
|
3255
3483
|
Skeleton.displayName = "Skeleton";
|
|
3256
3484
|
|
|
3257
3485
|
// src/switch/index.tsx
|
|
3258
|
-
import
|
|
3486
|
+
import React36 from "react";
|
|
3259
3487
|
|
|
3260
3488
|
// src/switch/hooks/index.tsx
|
|
3261
|
-
import
|
|
3262
|
-
var
|
|
3489
|
+
import React35, { useState as useState7, createContext as createContext7, useContext as useContext7 } from "react";
|
|
3490
|
+
var defaultComponentAPI7 = {
|
|
3263
3491
|
id: "",
|
|
3264
3492
|
states: {},
|
|
3265
3493
|
methods: {}
|
|
3266
3494
|
};
|
|
3267
|
-
var SwitchContext =
|
|
3268
|
-
var useSwitch = () =>
|
|
3269
|
-
var SwitchProvider = ({
|
|
3495
|
+
var SwitchContext = createContext7(defaultComponentAPI7);
|
|
3496
|
+
var useSwitch = () => useContext7(SwitchContext);
|
|
3497
|
+
var SwitchProvider = ({
|
|
3498
|
+
children
|
|
3499
|
+
}) => {
|
|
3270
3500
|
const context = useSwitchProvider();
|
|
3271
|
-
return /* @__PURE__ */
|
|
3501
|
+
return /* @__PURE__ */ React35.createElement(SwitchContext.Provider, { value: context }, children);
|
|
3272
3502
|
};
|
|
3273
3503
|
function useSwitchProvider() {
|
|
3274
|
-
const [checked, setChecked] =
|
|
3275
|
-
const switchId =
|
|
3504
|
+
const [checked, setChecked] = useState7(false);
|
|
3505
|
+
const switchId = React35.useId();
|
|
3276
3506
|
return {
|
|
3277
3507
|
id: switchId,
|
|
3278
3508
|
states: {
|
|
@@ -3285,7 +3515,7 @@ function useSwitchProvider() {
|
|
|
3285
3515
|
}
|
|
3286
3516
|
|
|
3287
3517
|
// src/switch/styles/index.ts
|
|
3288
|
-
import
|
|
3518
|
+
import styled22, { css as css13 } from "styled-components";
|
|
3289
3519
|
var SwitchDefaultStyles = css13`
|
|
3290
3520
|
all: unset;
|
|
3291
3521
|
|
|
@@ -3380,14 +3610,14 @@ var SwitchSizeStyles = css13`
|
|
|
3380
3610
|
}
|
|
3381
3611
|
}
|
|
3382
3612
|
`;
|
|
3383
|
-
var TriggerWrapper =
|
|
3613
|
+
var TriggerWrapper = styled22.button`
|
|
3384
3614
|
&[data-raw="false"] {
|
|
3385
3615
|
${SwitchDefaultStyles}
|
|
3386
3616
|
${SwitchVariantsStyles}
|
|
3387
3617
|
${SwitchSizeStyles}
|
|
3388
3618
|
}
|
|
3389
3619
|
`;
|
|
3390
|
-
var Thumb =
|
|
3620
|
+
var Thumb = styled22.span`
|
|
3391
3621
|
&[data-raw="false"] {
|
|
3392
3622
|
all: unset;
|
|
3393
3623
|
display: block;
|
|
@@ -3421,10 +3651,10 @@ var Switch = (props) => {
|
|
|
3421
3651
|
if (onClick) onClick(event);
|
|
3422
3652
|
if (toggleSwitch) toggleSwitch();
|
|
3423
3653
|
};
|
|
3424
|
-
|
|
3654
|
+
React36.useEffect(() => {
|
|
3425
3655
|
if (defaultChecked && toggleSwitch) toggleSwitch();
|
|
3426
3656
|
}, [defaultChecked]);
|
|
3427
|
-
return /* @__PURE__ */
|
|
3657
|
+
return /* @__PURE__ */ React36.createElement(
|
|
3428
3658
|
TriggerWrapper,
|
|
3429
3659
|
{
|
|
3430
3660
|
type: "button",
|
|
@@ -3440,19 +3670,19 @@ var Switch = (props) => {
|
|
|
3440
3670
|
"data-raw": Boolean(raw),
|
|
3441
3671
|
...restProps
|
|
3442
3672
|
},
|
|
3443
|
-
/* @__PURE__ */
|
|
3673
|
+
/* @__PURE__ */ React36.createElement("title", null, "Switch"),
|
|
3444
3674
|
children
|
|
3445
3675
|
);
|
|
3446
3676
|
};
|
|
3447
3677
|
Switch.displayName = "Switch";
|
|
3448
3678
|
var SwitchRoot = ({ children }) => {
|
|
3449
|
-
return /* @__PURE__ */
|
|
3679
|
+
return /* @__PURE__ */ React36.createElement(SwitchProvider, null, children);
|
|
3450
3680
|
};
|
|
3451
3681
|
SwitchRoot.displayName = "Switch.Root";
|
|
3452
3682
|
var SwitchThumb = (props) => {
|
|
3453
3683
|
const { raw, sizing } = props;
|
|
3454
3684
|
const { id, states } = useSwitch();
|
|
3455
|
-
return /* @__PURE__ */
|
|
3685
|
+
return /* @__PURE__ */ React36.createElement(
|
|
3456
3686
|
Thumb,
|
|
3457
3687
|
{
|
|
3458
3688
|
role: "presentation",
|
|
@@ -3472,10 +3702,10 @@ Switch.Root = SwitchRoot;
|
|
|
3472
3702
|
Switch.Thumb = SwitchThumb;
|
|
3473
3703
|
|
|
3474
3704
|
// src/table/index.tsx
|
|
3475
|
-
import
|
|
3705
|
+
import React37 from "react";
|
|
3476
3706
|
|
|
3477
3707
|
// src/table/styles/index.ts
|
|
3478
|
-
import
|
|
3708
|
+
import styled23, { css as css14 } from "styled-components";
|
|
3479
3709
|
var CellStyles = css14`
|
|
3480
3710
|
box-sizing: border-box;
|
|
3481
3711
|
border: none;
|
|
@@ -3486,11 +3716,11 @@ var CellStyles = css14`
|
|
|
3486
3716
|
var(--fontsize-small-10) - ((var(--fontsize-small-10) * 1.066))
|
|
3487
3717
|
);
|
|
3488
3718
|
`;
|
|
3489
|
-
var TableLayer =
|
|
3719
|
+
var TableLayer = styled23.div`
|
|
3490
3720
|
border-radius: var(--measurement-medium-30);
|
|
3491
3721
|
border: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
3492
3722
|
`;
|
|
3493
|
-
var TableWrapper =
|
|
3723
|
+
var TableWrapper = styled23.table`
|
|
3494
3724
|
border-collapse: collapse;
|
|
3495
3725
|
|
|
3496
3726
|
tbody {
|
|
@@ -3501,7 +3731,7 @@ var TableWrapper = styled21.table`
|
|
|
3501
3731
|
}
|
|
3502
3732
|
}
|
|
3503
3733
|
`;
|
|
3504
|
-
var RowWrapper =
|
|
3734
|
+
var RowWrapper = styled23.tr`
|
|
3505
3735
|
border-bottom: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
3506
3736
|
|
|
3507
3737
|
transition: background-color linear 0.1s;
|
|
@@ -3510,7 +3740,7 @@ var RowWrapper = styled21.tr`
|
|
|
3510
3740
|
background-color: var(--font-color-alpha-10);
|
|
3511
3741
|
}
|
|
3512
3742
|
`;
|
|
3513
|
-
var HeadCellWrapper =
|
|
3743
|
+
var HeadCellWrapper = styled23.th`
|
|
3514
3744
|
font-size: var(--fontsize-medium-10);
|
|
3515
3745
|
${CellStyles}
|
|
3516
3746
|
|
|
@@ -3518,7 +3748,7 @@ var HeadCellWrapper = styled21.th`
|
|
|
3518
3748
|
color: var(--font-color-alpha-60);
|
|
3519
3749
|
}
|
|
3520
3750
|
`;
|
|
3521
|
-
var CellWrapper =
|
|
3751
|
+
var CellWrapper = styled23.td`
|
|
3522
3752
|
${CellStyles}
|
|
3523
3753
|
`;
|
|
3524
3754
|
|
|
@@ -3527,43 +3757,43 @@ var Table = ({
|
|
|
3527
3757
|
children,
|
|
3528
3758
|
...restProps
|
|
3529
3759
|
}) => {
|
|
3530
|
-
return /* @__PURE__ */
|
|
3760
|
+
return /* @__PURE__ */ React37.createElement(ScrollArea, { as: TableLayer, role: "presentation", tabIndex: -1 }, /* @__PURE__ */ React37.createElement(TableWrapper, { ...restProps, cellSpacing: "0", cellPadding: "0" }, children));
|
|
3531
3761
|
};
|
|
3532
3762
|
Table.displayName = "Table";
|
|
3533
3763
|
var TableHead = ({
|
|
3534
3764
|
children,
|
|
3535
3765
|
...restProps
|
|
3536
3766
|
}) => {
|
|
3537
|
-
return /* @__PURE__ */
|
|
3767
|
+
return /* @__PURE__ */ React37.createElement("thead", { ...restProps }, children);
|
|
3538
3768
|
};
|
|
3539
3769
|
TableHead.displayName = "Table.Head";
|
|
3540
3770
|
var TableBody = ({
|
|
3541
3771
|
children,
|
|
3542
3772
|
...restProps
|
|
3543
3773
|
}) => {
|
|
3544
|
-
return /* @__PURE__ */
|
|
3774
|
+
return /* @__PURE__ */ React37.createElement("tbody", { ...restProps }, children);
|
|
3545
3775
|
};
|
|
3546
3776
|
TableBody.displayName = "Table.Body";
|
|
3547
3777
|
var TableHeadCell = ({
|
|
3548
3778
|
children,
|
|
3549
3779
|
...restProps
|
|
3550
3780
|
}) => {
|
|
3551
|
-
return /* @__PURE__ */
|
|
3781
|
+
return /* @__PURE__ */ React37.createElement(HeadCellWrapper, { colSpan: 1, ...restProps }, /* @__PURE__ */ React37.createElement("div", { className: "flex align-center g-medium-30" }, children));
|
|
3552
3782
|
};
|
|
3553
3783
|
TableHeadCell.displayName = "Table.HeadCell";
|
|
3554
3784
|
var TableRow = ({ children, ...restProps }) => {
|
|
3555
|
-
return /* @__PURE__ */
|
|
3785
|
+
return /* @__PURE__ */ React37.createElement(RowWrapper, { className: "p-medium-30", ...restProps }, children);
|
|
3556
3786
|
};
|
|
3557
3787
|
TableRow.displayName = "Table.Row";
|
|
3558
3788
|
var TableCell = ({ children, ...restProps }) => {
|
|
3559
|
-
return /* @__PURE__ */
|
|
3789
|
+
return /* @__PURE__ */ React37.createElement(CellWrapper, { ...restProps }, /* @__PURE__ */ React37.createElement("div", { className: "flex align-center g-medium-30" }, children));
|
|
3560
3790
|
};
|
|
3561
3791
|
TableCell.displayName = "Table.Cell";
|
|
3562
3792
|
var TableFooter = ({
|
|
3563
3793
|
children,
|
|
3564
3794
|
...restProps
|
|
3565
3795
|
}) => {
|
|
3566
|
-
return /* @__PURE__ */
|
|
3796
|
+
return /* @__PURE__ */ React37.createElement("tfoot", { ...restProps }, children);
|
|
3567
3797
|
};
|
|
3568
3798
|
TableFooter.displayName = "Table.Footer";
|
|
3569
3799
|
Table.Head = TableHead;
|
|
@@ -3574,24 +3804,26 @@ Table.Cell = TableCell;
|
|
|
3574
3804
|
Table.Footer = TableFooter;
|
|
3575
3805
|
|
|
3576
3806
|
// src/tabs/index.tsx
|
|
3577
|
-
import
|
|
3807
|
+
import React39, { Children } from "react";
|
|
3578
3808
|
|
|
3579
3809
|
// src/tabs/hooks/index.tsx
|
|
3580
|
-
import
|
|
3581
|
-
var
|
|
3810
|
+
import React38, { createContext as createContext8, useContext as useContext8, useState as useState8 } from "react";
|
|
3811
|
+
var defaultComponentAPI8 = {
|
|
3582
3812
|
id: "",
|
|
3583
3813
|
states: {},
|
|
3584
3814
|
methods: {}
|
|
3585
3815
|
};
|
|
3586
|
-
var TabsContext =
|
|
3587
|
-
var useTabs = () =>
|
|
3588
|
-
var TabsProvider = ({
|
|
3816
|
+
var TabsContext = createContext8(defaultComponentAPI8);
|
|
3817
|
+
var useTabs = () => useContext8(TabsContext);
|
|
3818
|
+
var TabsProvider = ({
|
|
3819
|
+
children
|
|
3820
|
+
}) => {
|
|
3589
3821
|
const context = useTabsProvider();
|
|
3590
|
-
return /* @__PURE__ */
|
|
3822
|
+
return /* @__PURE__ */ React38.createElement(TabsContext.Provider, { value: context }, children);
|
|
3591
3823
|
};
|
|
3592
3824
|
function useTabsProvider() {
|
|
3593
|
-
const [value, setValue] =
|
|
3594
|
-
const tabsId =
|
|
3825
|
+
const [value, setValue] = useState8(null);
|
|
3826
|
+
const tabsId = React38.useId();
|
|
3595
3827
|
return {
|
|
3596
3828
|
id: tabsId,
|
|
3597
3829
|
states: {
|
|
@@ -3605,8 +3837,8 @@ function useTabsProvider() {
|
|
|
3605
3837
|
}
|
|
3606
3838
|
|
|
3607
3839
|
// src/tabs/styles/index.ts
|
|
3608
|
-
import
|
|
3609
|
-
var TabWrapper =
|
|
3840
|
+
import styled24 from "styled-components";
|
|
3841
|
+
var TabWrapper = styled24.div`
|
|
3610
3842
|
button {
|
|
3611
3843
|
&[aria-selected="true"] {
|
|
3612
3844
|
color: var(--font-color) !important;
|
|
@@ -3621,20 +3853,20 @@ var Tabs = (props) => {
|
|
|
3621
3853
|
const { applyValue } = methods;
|
|
3622
3854
|
const childArray = Children.toArray(children);
|
|
3623
3855
|
const firstChild = childArray[0];
|
|
3624
|
-
|
|
3625
|
-
if (
|
|
3856
|
+
React39.useEffect(() => {
|
|
3857
|
+
if (React39.isValidElement(firstChild)) {
|
|
3626
3858
|
if (childArray.length > 0 && applyValue)
|
|
3627
3859
|
applyValue(firstChild.props.value);
|
|
3628
3860
|
}
|
|
3629
3861
|
}, []);
|
|
3630
|
-
|
|
3862
|
+
React39.useEffect(() => {
|
|
3631
3863
|
if (defaultOpen && applyValue) applyValue(defaultOpen);
|
|
3632
3864
|
}, []);
|
|
3633
|
-
return /* @__PURE__ */
|
|
3865
|
+
return /* @__PURE__ */ React39.createElement(TabWrapper, { role: "tablist", ...restProps }, children);
|
|
3634
3866
|
};
|
|
3635
3867
|
Tabs.displayName = "Tabs";
|
|
3636
3868
|
var TabsRoot = ({ children }) => {
|
|
3637
|
-
return /* @__PURE__ */
|
|
3869
|
+
return /* @__PURE__ */ React39.createElement(TabsProvider, null, children);
|
|
3638
3870
|
};
|
|
3639
3871
|
TabsRoot.displayName = "Tabs.Root";
|
|
3640
3872
|
var TabsTrigger = (props) => {
|
|
@@ -3650,7 +3882,7 @@ var TabsTrigger = (props) => {
|
|
|
3650
3882
|
if (applyValue) applyValue(value);
|
|
3651
3883
|
if (onClick) onClick(event);
|
|
3652
3884
|
};
|
|
3653
|
-
return /* @__PURE__ */
|
|
3885
|
+
return /* @__PURE__ */ React39.createElement(
|
|
3654
3886
|
Button,
|
|
3655
3887
|
{
|
|
3656
3888
|
type: "button",
|
|
@@ -3678,7 +3910,7 @@ var TabsContent = (props) => {
|
|
|
3678
3910
|
trigger: getTabsId && getTabsId({ value, type: "trigger" }),
|
|
3679
3911
|
content: getTabsId && getTabsId({ value, type: "content" })
|
|
3680
3912
|
};
|
|
3681
|
-
return /* @__PURE__ */
|
|
3913
|
+
return /* @__PURE__ */ React39.createElement(
|
|
3682
3914
|
"div",
|
|
3683
3915
|
{
|
|
3684
3916
|
tabIndex: 0,
|
|
@@ -3699,10 +3931,10 @@ Tabs.Trigger = TabsTrigger;
|
|
|
3699
3931
|
Tabs.Content = TabsContent;
|
|
3700
3932
|
|
|
3701
3933
|
// src/text-area/index.tsx
|
|
3702
|
-
import
|
|
3934
|
+
import React40 from "react";
|
|
3703
3935
|
|
|
3704
3936
|
// src/text-area/styles/index.ts
|
|
3705
|
-
import
|
|
3937
|
+
import styled25, { css as css15 } from "styled-components";
|
|
3706
3938
|
var CustomScrollbar2 = css15`
|
|
3707
3939
|
height: ${({ $height }) => $height ?? "100%"};
|
|
3708
3940
|
width: ${({ $width }) => $width ?? "100%"};
|
|
@@ -3735,80 +3967,36 @@ var CustomScrollbar2 = css15`
|
|
|
3735
3967
|
scrollbar-width: thin;
|
|
3736
3968
|
scrollbar-color: ${({ $thumbColor, $trackColor }) => `${$thumbColor ?? "var(--font-color-alpha-10)"} ${$trackColor ?? "transparent"}`};
|
|
3737
3969
|
`;
|
|
3738
|
-
var
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
max-height: var(--measurement-large-60);
|
|
3742
|
-
min-height: auto;
|
|
3743
|
-
width: 100%;
|
|
3744
|
-
|
|
3745
|
-
overflow-y: auto;
|
|
3746
|
-
|
|
3747
|
-
outline: none;
|
|
3748
|
-
cursor: pointer;
|
|
3749
|
-
display: flex;
|
|
3750
|
-
align-items: center;
|
|
3751
|
-
justify-content: center;
|
|
3752
|
-
|
|
3753
|
-
font-size: var(--fontsize-small-80);
|
|
3754
|
-
padding: var(--measurement-medium-30) var(--measurement-medium-30)
|
|
3755
|
-
var(--measurement-large-10) var(--measurement-medium-30);
|
|
3756
|
-
|
|
3757
|
-
font-weight: 500;
|
|
3758
|
-
line-height: 1.1;
|
|
3759
|
-
letter-spacing: calc(
|
|
3760
|
-
var(--fontsize-small-10) - ((var(--fontsize-small-10) * 1.066))
|
|
3761
|
-
);
|
|
3762
|
-
|
|
3763
|
-
border: var(--measurement-small-10) solid transparent;
|
|
3764
|
-
border-radius: var(--measurement-medium-30);
|
|
3765
|
-
backdrop-filter: blur(var(--measurement-small-10));
|
|
3766
|
-
color: var(--font-color-alpha-60);
|
|
3767
|
-
|
|
3768
|
-
transition: all ease-in-out 0.2s;
|
|
3769
|
-
|
|
3770
|
-
svg,
|
|
3771
|
-
span,
|
|
3772
|
-
img {
|
|
3773
|
-
opacity: 0.6;
|
|
3774
|
-
}
|
|
3775
|
-
|
|
3776
|
-
&:hover,
|
|
3777
|
-
&:focus,
|
|
3778
|
-
&:active {
|
|
3779
|
-
color: var(--font-color);
|
|
3780
|
-
|
|
3781
|
-
svg,
|
|
3782
|
-
span,
|
|
3783
|
-
img {
|
|
3784
|
-
opacity: 1;
|
|
3785
|
-
}
|
|
3786
|
-
}
|
|
3787
|
-
&::placeholder {
|
|
3788
|
-
color: var(--font-color-alpha-30);
|
|
3789
|
-
}
|
|
3790
|
-
&:disabled {
|
|
3791
|
-
cursor: not-allowed;
|
|
3792
|
-
opacity: 0.6;
|
|
3793
|
-
}
|
|
3794
|
-
|
|
3795
|
-
&::placeholder {
|
|
3796
|
-
color: var(--font-color-alpha-30);
|
|
3797
|
-
}
|
|
3798
|
-
|
|
3799
|
-
&:focus-visible {
|
|
3800
|
-
outline: none;
|
|
3801
|
-
}
|
|
3970
|
+
var TextareaSizeStyles = css15`
|
|
3971
|
+
padding: var(--measurement-medium-30);
|
|
3972
|
+
max-height: var(--measurement-large-60);
|
|
3802
3973
|
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3974
|
+
&[data-size="small"] {
|
|
3975
|
+
min-height: var(--measurement-large-30);
|
|
3976
|
+
}
|
|
3977
|
+
&[data-size="medium"] {
|
|
3978
|
+
min-height: var(--measurement-large-50);
|
|
3979
|
+
}
|
|
3980
|
+
&[data-size="large"] {
|
|
3981
|
+
min-height: var(--measurement-large-60);
|
|
3982
|
+
max-height: var(--measurement-large-80);
|
|
3983
|
+
}
|
|
3984
|
+
`;
|
|
3985
|
+
var TextareaResizableStyles = css15`
|
|
3986
|
+
&[data-resizable="true"] {
|
|
3987
|
+
resize: vertical;
|
|
3988
|
+
}
|
|
3989
|
+
&[data-resizable="false"] {
|
|
3990
|
+
resize: none;
|
|
3991
|
+
}
|
|
3992
|
+
`;
|
|
3993
|
+
var TextAreaContainer = styled25.textarea`
|
|
3994
|
+
&[data-raw="false"] {
|
|
3995
|
+
${FieldDefaultStyles}
|
|
3996
|
+
${FieldShapeStyles}
|
|
3806
3997
|
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
color: var(--alpha-red-30);
|
|
3810
|
-
}
|
|
3811
|
-
}
|
|
3998
|
+
${TextareaSizeStyles}
|
|
3999
|
+
${TextareaResizableStyles}
|
|
3812
4000
|
|
|
3813
4001
|
${CustomScrollbar2}
|
|
3814
4002
|
${FieldVariantsStyles}
|
|
@@ -3816,8 +4004,9 @@ var TextAreaContainer = styled23.textarea`
|
|
|
3816
4004
|
`;
|
|
3817
4005
|
|
|
3818
4006
|
// src/text-area/index.tsx
|
|
3819
|
-
var Textarea = (
|
|
3820
|
-
const
|
|
4007
|
+
var Textarea = (props) => {
|
|
4008
|
+
const { raw, shape, sizing, variant, resizable, onChange } = props;
|
|
4009
|
+
const textareaRef = React40.useRef(null);
|
|
3821
4010
|
const adjustHeight = () => {
|
|
3822
4011
|
const textarea = textareaRef.current;
|
|
3823
4012
|
if (textarea) {
|
|
@@ -3832,37 +4021,40 @@ var Textarea = ({ onChange, ...props }) => {
|
|
|
3832
4021
|
adjustHeight();
|
|
3833
4022
|
onChange?.(e);
|
|
3834
4023
|
};
|
|
3835
|
-
|
|
3836
|
-
return /* @__PURE__ */
|
|
4024
|
+
React40.useEffect(() => adjustHeight(), [props.value]);
|
|
4025
|
+
return /* @__PURE__ */ React40.createElement(
|
|
3837
4026
|
TextAreaContainer,
|
|
3838
4027
|
{
|
|
3839
4028
|
ref: textareaRef,
|
|
3840
4029
|
onChange: handleChange,
|
|
3841
|
-
"data-variant":
|
|
3842
|
-
"data-
|
|
4030
|
+
"data-variant": variant ?? "secondary",
|
|
4031
|
+
"data-shape": shape ?? "smooth",
|
|
4032
|
+
"data-size": sizing ?? "medium" /* Medium */,
|
|
4033
|
+
"data-resizable": resizable,
|
|
4034
|
+
"data-raw": String(Boolean(raw)),
|
|
3843
4035
|
...props
|
|
3844
4036
|
}
|
|
3845
|
-
)
|
|
4037
|
+
);
|
|
3846
4038
|
};
|
|
3847
4039
|
Textarea.displayName = "Textarea";
|
|
3848
4040
|
|
|
3849
4041
|
// src/toggle/index.tsx
|
|
3850
|
-
import
|
|
4042
|
+
import React41 from "react";
|
|
3851
4043
|
var Toggle = (props) => {
|
|
3852
4044
|
const { defaultChecked, onClick, disabled, children, ...restProps } = props;
|
|
3853
|
-
const [checked, setChecked] =
|
|
4045
|
+
const [checked, setChecked] = React41.useState(
|
|
3854
4046
|
defaultChecked ?? false
|
|
3855
4047
|
);
|
|
3856
4048
|
const handleClick = (event) => {
|
|
3857
4049
|
if (onClick) onClick(event);
|
|
3858
4050
|
if (!disabled) setChecked((prevChecked) => !prevChecked);
|
|
3859
4051
|
};
|
|
3860
|
-
|
|
4052
|
+
React41.useEffect(() => {
|
|
3861
4053
|
if (defaultChecked !== void 0) {
|
|
3862
4054
|
setChecked(Boolean(defaultChecked));
|
|
3863
4055
|
}
|
|
3864
4056
|
}, [defaultChecked]);
|
|
3865
|
-
return /* @__PURE__ */
|
|
4057
|
+
return /* @__PURE__ */ React41.createElement(
|
|
3866
4058
|
Button,
|
|
3867
4059
|
{
|
|
3868
4060
|
role: "switch",
|
|
@@ -3880,24 +4072,26 @@ var Toggle = (props) => {
|
|
|
3880
4072
|
Toggle.displayName = "Toggle";
|
|
3881
4073
|
|
|
3882
4074
|
// src/toolbar/index.tsx
|
|
3883
|
-
import
|
|
4075
|
+
import React43 from "react";
|
|
3884
4076
|
|
|
3885
4077
|
// src/toolbar/hooks/index.tsx
|
|
3886
|
-
import
|
|
3887
|
-
var
|
|
4078
|
+
import React42, { useState as useState9, createContext as createContext9, useContext as useContext9 } from "react";
|
|
4079
|
+
var defaultComponentAPI9 = {
|
|
3888
4080
|
id: "",
|
|
3889
4081
|
states: {},
|
|
3890
4082
|
methods: {}
|
|
3891
4083
|
};
|
|
3892
|
-
var ToolbarContext =
|
|
3893
|
-
var useToolbar = () =>
|
|
3894
|
-
var ToolbarProvider = ({
|
|
4084
|
+
var ToolbarContext = createContext9(defaultComponentAPI9);
|
|
4085
|
+
var useToolbar = () => useContext9(ToolbarContext);
|
|
4086
|
+
var ToolbarProvider = ({
|
|
4087
|
+
children
|
|
4088
|
+
}) => {
|
|
3895
4089
|
const context = useToolbarProvider();
|
|
3896
|
-
return /* @__PURE__ */
|
|
4090
|
+
return /* @__PURE__ */ React42.createElement(ToolbarContext.Provider, { value: context }, children);
|
|
3897
4091
|
};
|
|
3898
4092
|
function useToolbarProvider() {
|
|
3899
|
-
const [expanded, setExpanded] =
|
|
3900
|
-
const toolbarId =
|
|
4093
|
+
const [expanded, setExpanded] = useState9(false);
|
|
4094
|
+
const toolbarId = React42.useId();
|
|
3901
4095
|
return {
|
|
3902
4096
|
id: toolbarId,
|
|
3903
4097
|
states: {
|
|
@@ -3910,7 +4104,7 @@ function useToolbarProvider() {
|
|
|
3910
4104
|
}
|
|
3911
4105
|
|
|
3912
4106
|
// src/toolbar/styles/index.ts
|
|
3913
|
-
import
|
|
4107
|
+
import styled26, { css as css16 } from "styled-components";
|
|
3914
4108
|
var ToolbarDefaultStyles = css16`
|
|
3915
4109
|
margin: 0;
|
|
3916
4110
|
display: grid;
|
|
@@ -4023,7 +4217,7 @@ var ToolbarSideStyles = css16`
|
|
|
4023
4217
|
}
|
|
4024
4218
|
}
|
|
4025
4219
|
`;
|
|
4026
|
-
var ToolbarWrapper =
|
|
4220
|
+
var ToolbarWrapper = styled26.menu`
|
|
4027
4221
|
&[data-raw="false"] {
|
|
4028
4222
|
${ToolbarDefaultStyles}
|
|
4029
4223
|
${ToolbarSizeStyles}
|
|
@@ -4031,7 +4225,7 @@ var ToolbarWrapper = styled24.menu`
|
|
|
4031
4225
|
${ToolbarSideStyles}
|
|
4032
4226
|
}
|
|
4033
4227
|
`;
|
|
4034
|
-
var ToolbarTriggerWrapper =
|
|
4228
|
+
var ToolbarTriggerWrapper = styled26.menu`
|
|
4035
4229
|
&[data-raw="false"] {
|
|
4036
4230
|
all: unset;
|
|
4037
4231
|
align-self: flex-end;
|
|
@@ -4056,13 +4250,13 @@ var Toolbar = (props) => {
|
|
|
4056
4250
|
const { toggleToolbar } = methods;
|
|
4057
4251
|
const shortcutControls = useKeyPress(String(hotkey), true, bindkey);
|
|
4058
4252
|
const orientation = side && ["left", "right"].includes(side) ? "vertical" : "horizontal";
|
|
4059
|
-
|
|
4253
|
+
React43.useEffect(() => {
|
|
4060
4254
|
if (defaultOpen && toggleToolbar) return toggleToolbar(true);
|
|
4061
4255
|
}, [defaultOpen]);
|
|
4062
|
-
|
|
4256
|
+
React43.useEffect(() => {
|
|
4063
4257
|
if (shortcut && shortcutControls && toggleToolbar) toggleToolbar();
|
|
4064
4258
|
}, [shortcutControls]);
|
|
4065
|
-
return /* @__PURE__ */
|
|
4259
|
+
return /* @__PURE__ */ React43.createElement(
|
|
4066
4260
|
ToolbarWrapper,
|
|
4067
4261
|
{
|
|
4068
4262
|
id,
|
|
@@ -4082,7 +4276,7 @@ var Toolbar = (props) => {
|
|
|
4082
4276
|
};
|
|
4083
4277
|
Toolbar.displayName = "Toolbar";
|
|
4084
4278
|
var ToolbarRoot = ({ children }) => {
|
|
4085
|
-
return /* @__PURE__ */
|
|
4279
|
+
return /* @__PURE__ */ React43.createElement(ToolbarProvider, null, children);
|
|
4086
4280
|
};
|
|
4087
4281
|
ToolbarRoot.displayName = "Toolbar.Root";
|
|
4088
4282
|
var ToolbarTrigger = (props) => {
|
|
@@ -4100,7 +4294,7 @@ var ToolbarTrigger = (props) => {
|
|
|
4100
4294
|
if (onClick) onClick(event);
|
|
4101
4295
|
if (toggleToolbar) toggleToolbar(!states.expanded);
|
|
4102
4296
|
};
|
|
4103
|
-
return /* @__PURE__ */
|
|
4297
|
+
return /* @__PURE__ */ React43.createElement(ToolbarTriggerWrapper, { "data-raw": Boolean(raw) }, /* @__PURE__ */ React43.createElement(
|
|
4104
4298
|
Button,
|
|
4105
4299
|
{
|
|
4106
4300
|
id: `${id}-trigger`,
|
|
@@ -4118,13 +4312,13 @@ var ToolbarSection = (props) => {
|
|
|
4118
4312
|
const { showoncollapse, children, ...restProps } = props;
|
|
4119
4313
|
const { states } = useToolbar();
|
|
4120
4314
|
const { expanded } = states;
|
|
4121
|
-
if (showoncollapse) return /* @__PURE__ */
|
|
4122
|
-
return /* @__PURE__ */
|
|
4315
|
+
if (showoncollapse) return /* @__PURE__ */ React43.createElement("section", { ...restProps }, children);
|
|
4316
|
+
return /* @__PURE__ */ React43.createElement("section", { ...restProps }, expanded && children);
|
|
4123
4317
|
};
|
|
4124
4318
|
ToolbarSection.displayName = "Toolbar.Section";
|
|
4125
4319
|
var ToolbarItem = (props) => {
|
|
4126
4320
|
const { showfirstchild, onClick, children, ...restProps } = props;
|
|
4127
|
-
const childArray =
|
|
4321
|
+
const childArray = React43.Children.toArray(children);
|
|
4128
4322
|
const { id, states, methods } = useToolbar();
|
|
4129
4323
|
const { expanded } = states;
|
|
4130
4324
|
const { toggleToolbar } = methods;
|
|
@@ -4133,7 +4327,7 @@ var ToolbarItem = (props) => {
|
|
|
4133
4327
|
if (onClick) onClick(event);
|
|
4134
4328
|
if (toggleToolbar && !expanded) toggleToolbar(true);
|
|
4135
4329
|
};
|
|
4136
|
-
return /* @__PURE__ */
|
|
4330
|
+
return /* @__PURE__ */ React43.createElement(
|
|
4137
4331
|
"div",
|
|
4138
4332
|
{
|
|
4139
4333
|
tabIndex: -1,
|
|
@@ -4154,11 +4348,11 @@ Toolbar.Item = ToolbarItem;
|
|
|
4154
4348
|
Toolbar.Section = ToolbarSection;
|
|
4155
4349
|
|
|
4156
4350
|
// src/tooltip/index.tsx
|
|
4157
|
-
import
|
|
4351
|
+
import React44 from "react";
|
|
4158
4352
|
|
|
4159
4353
|
// src/tooltip/styles/index.ts
|
|
4160
|
-
import
|
|
4161
|
-
var FadeIn2 =
|
|
4354
|
+
import styled27, { keyframes as keyframes5 } from "styled-components";
|
|
4355
|
+
var FadeIn2 = keyframes5`
|
|
4162
4356
|
0% {
|
|
4163
4357
|
opacity: 0;
|
|
4164
4358
|
}
|
|
@@ -4166,11 +4360,11 @@ var FadeIn2 = keyframes4`
|
|
|
4166
4360
|
opacity: 1;
|
|
4167
4361
|
}
|
|
4168
4362
|
`;
|
|
4169
|
-
var ContentBox =
|
|
4363
|
+
var ContentBox = styled27.div`
|
|
4170
4364
|
display: inline-block;
|
|
4171
4365
|
position: relative;
|
|
4172
4366
|
`;
|
|
4173
|
-
var ContentWrapper2 =
|
|
4367
|
+
var ContentWrapper2 = styled27.span`
|
|
4174
4368
|
&[data-raw="false"] {
|
|
4175
4369
|
width: fit-content;
|
|
4176
4370
|
max-width: var(--measurement-large-60);
|
|
@@ -4201,19 +4395,20 @@ var Tooltip = ({
|
|
|
4201
4395
|
children,
|
|
4202
4396
|
...restProps
|
|
4203
4397
|
}) => {
|
|
4204
|
-
const [visible, setVisible] =
|
|
4205
|
-
const [triggerProps, setTriggerProps] =
|
|
4206
|
-
const [contentProps, setContentProps] =
|
|
4207
|
-
const mounted =
|
|
4208
|
-
const containerRef =
|
|
4209
|
-
const contentRef =
|
|
4210
|
-
const timeoutRef =
|
|
4398
|
+
const [visible, setVisible] = React44.useState(false);
|
|
4399
|
+
const [triggerProps, setTriggerProps] = React44.useState(null);
|
|
4400
|
+
const [contentProps, setContentProps] = React44.useState(null);
|
|
4401
|
+
const mounted = React44.useRef(false);
|
|
4402
|
+
const containerRef = React44.useRef(null);
|
|
4403
|
+
const contentRef = React44.useRef(null);
|
|
4404
|
+
const timeoutRef = React44.useRef(null);
|
|
4211
4405
|
const contentRect = () => contentRef?.current?.getBoundingClientRect();
|
|
4212
|
-
const bodyRect =
|
|
4406
|
+
const bodyRect = () => {
|
|
4213
4407
|
if (typeof document !== "undefined") {
|
|
4214
|
-
return document
|
|
4408
|
+
return document?.body?.getBoundingClientRect();
|
|
4215
4409
|
}
|
|
4216
|
-
|
|
4410
|
+
return void 0;
|
|
4411
|
+
};
|
|
4217
4412
|
const positions = {
|
|
4218
4413
|
btt: `calc((${triggerProps?.top}px - ${contentProps?.height}px) - (var(--measurement-medium-10)))`,
|
|
4219
4414
|
ttb: `calc((${triggerProps?.top}px + ${triggerProps?.height}px) + var(--measurement-medium-10))`,
|
|
@@ -4230,14 +4425,14 @@ var Tooltip = ({
|
|
|
4230
4425
|
};
|
|
4231
4426
|
const hasEnoughHorizontalSpace = Number(dimensions.body_width) - Number(dimensions.content_left) > Number(dimensions.content_width) * 1.1;
|
|
4232
4427
|
const hasEnoughVerticalSpace = Number(dimensions.body_height) - Number(dimensions.content_bottom) > Number(dimensions.content_height) * 0.9;
|
|
4233
|
-
const showTooltip =
|
|
4428
|
+
const showTooltip = React44.useCallback(() => {
|
|
4234
4429
|
timeoutRef.current = setTimeout(() => setVisible(true), delay);
|
|
4235
4430
|
}, [delay]);
|
|
4236
|
-
const hideTooltip =
|
|
4431
|
+
const hideTooltip = React44.useCallback(() => {
|
|
4237
4432
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
4238
4433
|
setVisible(false);
|
|
4239
4434
|
}, []);
|
|
4240
|
-
const handleMouseEnter =
|
|
4435
|
+
const handleMouseEnter = React44.useCallback(() => {
|
|
4241
4436
|
const rect = containerRef.current?.getBoundingClientRect();
|
|
4242
4437
|
if (rect) {
|
|
4243
4438
|
setTriggerProps({
|
|
@@ -4251,11 +4446,11 @@ var Tooltip = ({
|
|
|
4251
4446
|
showTooltip();
|
|
4252
4447
|
}
|
|
4253
4448
|
}, [showTooltip]);
|
|
4254
|
-
const handleMouseLeave =
|
|
4449
|
+
const handleMouseLeave = React44.useCallback(
|
|
4255
4450
|
() => hideTooltip(),
|
|
4256
4451
|
[hideTooltip]
|
|
4257
4452
|
);
|
|
4258
|
-
|
|
4453
|
+
React44.useEffect(() => {
|
|
4259
4454
|
mounted.current = true;
|
|
4260
4455
|
setContentProps && setContentProps({
|
|
4261
4456
|
top: Number(contentRect()?.top),
|
|
@@ -4269,7 +4464,7 @@ var Tooltip = ({
|
|
|
4269
4464
|
mounted.current = false;
|
|
4270
4465
|
};
|
|
4271
4466
|
}, [visible]);
|
|
4272
|
-
return /* @__PURE__ */
|
|
4467
|
+
return /* @__PURE__ */ React44.createElement(
|
|
4273
4468
|
ContentBox,
|
|
4274
4469
|
{
|
|
4275
4470
|
ref: containerRef,
|
|
@@ -4279,7 +4474,7 @@ var Tooltip = ({
|
|
|
4279
4474
|
...restProps
|
|
4280
4475
|
},
|
|
4281
4476
|
children,
|
|
4282
|
-
visible && /* @__PURE__ */
|
|
4477
|
+
visible && /* @__PURE__ */ React44.createElement(
|
|
4283
4478
|
ContentWrapper2,
|
|
4284
4479
|
{
|
|
4285
4480
|
ref: contentRef,
|
|
@@ -4294,11 +4489,223 @@ var Tooltip = ({
|
|
|
4294
4489
|
"data-side": hasEnoughHorizontalSpace ? "left" /* Left */ : "right" /* Right */,
|
|
4295
4490
|
"data-align": hasEnoughHorizontalSpace ? "left" /* Left */ : "right" /* Right */
|
|
4296
4491
|
},
|
|
4297
|
-
/* @__PURE__ */
|
|
4492
|
+
/* @__PURE__ */ React44.createElement("div", null, content)
|
|
4298
4493
|
)
|
|
4299
4494
|
);
|
|
4300
4495
|
};
|
|
4301
4496
|
Tooltip.displayName = "Tooltip";
|
|
4497
|
+
|
|
4498
|
+
// src/tree/index.tsx
|
|
4499
|
+
import React47 from "react";
|
|
4500
|
+
|
|
4501
|
+
// src/tree/hooks/tree-provider.tsx
|
|
4502
|
+
import React45, { useState as useState10, createContext as createContext10, useContext as useContext10 } from "react";
|
|
4503
|
+
var defaultTreeAPI = {
|
|
4504
|
+
id: "",
|
|
4505
|
+
states: {},
|
|
4506
|
+
methods: {}
|
|
4507
|
+
};
|
|
4508
|
+
var TreeContext = createContext10(defaultTreeAPI);
|
|
4509
|
+
var useTree = () => useContext10(TreeContext);
|
|
4510
|
+
var TreeProvider = ({
|
|
4511
|
+
children,
|
|
4512
|
+
defaultExpandedIds = [],
|
|
4513
|
+
onSelectionChange
|
|
4514
|
+
}) => {
|
|
4515
|
+
const context = useTreeProviderContext({
|
|
4516
|
+
defaultExpandedIds,
|
|
4517
|
+
onSelectionChange
|
|
4518
|
+
});
|
|
4519
|
+
return /* @__PURE__ */ React45.createElement(TreeContext.Provider, { value: context }, children);
|
|
4520
|
+
};
|
|
4521
|
+
function useTreeProviderContext({
|
|
4522
|
+
defaultExpandedIds,
|
|
4523
|
+
onSelectionChange
|
|
4524
|
+
}) {
|
|
4525
|
+
const treeId = React45.useId();
|
|
4526
|
+
const [expandedIds, setExpandedIds] = useState10(
|
|
4527
|
+
() => new Set(defaultExpandedIds)
|
|
4528
|
+
);
|
|
4529
|
+
const [selectedIds, setSelectedIds] = useState10(() => /* @__PURE__ */ new Set());
|
|
4530
|
+
return {
|
|
4531
|
+
id: treeId,
|
|
4532
|
+
states: {
|
|
4533
|
+
expandedIds,
|
|
4534
|
+
selectedIds
|
|
4535
|
+
},
|
|
4536
|
+
methods: {
|
|
4537
|
+
isExpanded: (id) => expandedIds.has(id),
|
|
4538
|
+
isSelected: (id) => selectedIds.has(id),
|
|
4539
|
+
toggleExpanded: (id) => {
|
|
4540
|
+
setExpandedIds((prev) => {
|
|
4541
|
+
const next = new Set(prev);
|
|
4542
|
+
next.has(id) ? next.delete(id) : next.add(id);
|
|
4543
|
+
return next;
|
|
4544
|
+
});
|
|
4545
|
+
},
|
|
4546
|
+
toggleSelected: (id) => {
|
|
4547
|
+
setSelectedIds((prev) => {
|
|
4548
|
+
const next = new Set(prev);
|
|
4549
|
+
next.has(id) ? next.delete(id) : next.add(id);
|
|
4550
|
+
onSelectionChange?.(Array.from(next));
|
|
4551
|
+
return next;
|
|
4552
|
+
});
|
|
4553
|
+
},
|
|
4554
|
+
getTreeId: ({ nodeId, type }) => `${treeId}-${type}-${nodeId}`
|
|
4555
|
+
}
|
|
4556
|
+
};
|
|
4557
|
+
}
|
|
4558
|
+
|
|
4559
|
+
// src/tree/hooks/tree-node-provider.tsx
|
|
4560
|
+
import React46, { createContext as createContext11, useContext as useContext11 } from "react";
|
|
4561
|
+
var defaultTreeNodeAPI = {
|
|
4562
|
+
id: "",
|
|
4563
|
+
states: {},
|
|
4564
|
+
methods: {}
|
|
4565
|
+
};
|
|
4566
|
+
var TreeNodeContext = createContext11(defaultTreeNodeAPI);
|
|
4567
|
+
var useTreeNode = () => useContext11(TreeNodeContext);
|
|
4568
|
+
var TreeNodeProvider = ({
|
|
4569
|
+
children,
|
|
4570
|
+
nodeId,
|
|
4571
|
+
level,
|
|
4572
|
+
isLast
|
|
4573
|
+
}) => {
|
|
4574
|
+
const context = useTreeNodeProviderContext({ nodeId, level, isLast });
|
|
4575
|
+
return /* @__PURE__ */ React46.createElement(TreeNodeContext.Provider, { value: context }, children);
|
|
4576
|
+
};
|
|
4577
|
+
function useTreeNodeProviderContext({
|
|
4578
|
+
nodeId,
|
|
4579
|
+
level,
|
|
4580
|
+
isLast
|
|
4581
|
+
}) {
|
|
4582
|
+
return {
|
|
4583
|
+
id: nodeId,
|
|
4584
|
+
states: {
|
|
4585
|
+
nodeId,
|
|
4586
|
+
level,
|
|
4587
|
+
isLast
|
|
4588
|
+
},
|
|
4589
|
+
methods: {}
|
|
4590
|
+
};
|
|
4591
|
+
}
|
|
4592
|
+
|
|
4593
|
+
// src/tree/styles/index.ts
|
|
4594
|
+
import styled28 from "styled-components";
|
|
4595
|
+
var TreeView = styled28.ul`
|
|
4596
|
+
display: flex;
|
|
4597
|
+
flex-direction: column;
|
|
4598
|
+
list-style: none;
|
|
4599
|
+
margin: 0;
|
|
4600
|
+
padding: 0;
|
|
4601
|
+
`;
|
|
4602
|
+
var TreeItem = styled28.li`
|
|
4603
|
+
display: flex;
|
|
4604
|
+
flex-direction: column;
|
|
4605
|
+
list-style: none;
|
|
4606
|
+
`;
|
|
4607
|
+
var TreeNodeContent = styled28.ul`
|
|
4608
|
+
display: flex;
|
|
4609
|
+
flex-direction: column;
|
|
4610
|
+
list-style: none;
|
|
4611
|
+
margin: 0;
|
|
4612
|
+
padding: 0;
|
|
4613
|
+
`;
|
|
4614
|
+
|
|
4615
|
+
// src/tree/index.tsx
|
|
4616
|
+
var Tree = (props) => {
|
|
4617
|
+
const { children, ...restProps } = props;
|
|
4618
|
+
const { id } = useTree();
|
|
4619
|
+
return /* @__PURE__ */ React47.createElement(TreeView, { id, role: "tree", ...restProps }, children);
|
|
4620
|
+
};
|
|
4621
|
+
Tree.displayName = "Tree";
|
|
4622
|
+
var TreeRoot = ({
|
|
4623
|
+
children,
|
|
4624
|
+
defaultExpandedIds,
|
|
4625
|
+
onSelectionChange
|
|
4626
|
+
}) => {
|
|
4627
|
+
return /* @__PURE__ */ React47.createElement(
|
|
4628
|
+
TreeProvider,
|
|
4629
|
+
{
|
|
4630
|
+
defaultExpandedIds,
|
|
4631
|
+
onSelectionChange
|
|
4632
|
+
},
|
|
4633
|
+
children
|
|
4634
|
+
);
|
|
4635
|
+
};
|
|
4636
|
+
TreeRoot.displayName = "Tree.Root";
|
|
4637
|
+
var TreeNode = (props) => {
|
|
4638
|
+
const { nodeId, level = 0, isLast = false, children, ...restProps } = props;
|
|
4639
|
+
return /* @__PURE__ */ React47.createElement(TreeNodeProvider, { nodeId, level, isLast }, /* @__PURE__ */ React47.createElement(TreeItem, { role: "treeitem", "aria-level": level + 1, ...restProps }, children));
|
|
4640
|
+
};
|
|
4641
|
+
TreeNode.displayName = "Tree.Node";
|
|
4642
|
+
var TreeTrigger = (props) => {
|
|
4643
|
+
const { nodeId, disabled, onClick, children, ...restProps } = props;
|
|
4644
|
+
const { methods } = useTree();
|
|
4645
|
+
const { getTreeId, toggleExpanded, toggleSelected } = methods;
|
|
4646
|
+
const isExpanded = methods.isExpanded && methods.isExpanded(nodeId);
|
|
4647
|
+
const isSelected = methods.isSelected && methods.isSelected(nodeId);
|
|
4648
|
+
const IdHandler = {
|
|
4649
|
+
trigger: getTreeId && getTreeId({ nodeId, type: "trigger" }),
|
|
4650
|
+
content: getTreeId && getTreeId({ nodeId, type: "content" })
|
|
4651
|
+
};
|
|
4652
|
+
const { states: nodeStates } = useTreeNode();
|
|
4653
|
+
const level = nodeStates.level ?? 0;
|
|
4654
|
+
const handleClick = (event) => {
|
|
4655
|
+
if (!disabled) {
|
|
4656
|
+
onClick && onClick(event);
|
|
4657
|
+
toggleExpanded && toggleExpanded(nodeId);
|
|
4658
|
+
toggleSelected && toggleSelected(nodeId);
|
|
4659
|
+
}
|
|
4660
|
+
};
|
|
4661
|
+
return /* @__PURE__ */ React47.createElement(
|
|
4662
|
+
Button,
|
|
4663
|
+
{
|
|
4664
|
+
id: String(IdHandler.trigger),
|
|
4665
|
+
disabled: disabled ?? false,
|
|
4666
|
+
onClick: handleClick,
|
|
4667
|
+
"data-state": isExpanded ? "expanded" : "collapsed",
|
|
4668
|
+
"data-selected": isSelected || void 0,
|
|
4669
|
+
variant: props.variant ?? "ghost" /* Ghost */,
|
|
4670
|
+
style: { paddingLeft: `calc(${level} * 1rem + 0.5rem)` },
|
|
4671
|
+
rawicon: true,
|
|
4672
|
+
...restProps
|
|
4673
|
+
},
|
|
4674
|
+
children
|
|
4675
|
+
);
|
|
4676
|
+
};
|
|
4677
|
+
TreeTrigger.displayName = "Tree.Trigger";
|
|
4678
|
+
var TreeContent = (props) => {
|
|
4679
|
+
const { nodeId, defaultOpen = false, children, ...restProps } = props;
|
|
4680
|
+
const { methods } = useTree();
|
|
4681
|
+
const { getTreeId, toggleExpanded } = methods;
|
|
4682
|
+
const isExpanded = methods.isExpanded && methods.isExpanded(nodeId);
|
|
4683
|
+
const IdHandler = {
|
|
4684
|
+
trigger: getTreeId && getTreeId({ nodeId, type: "trigger" }),
|
|
4685
|
+
content: getTreeId && getTreeId({ nodeId, type: "content" })
|
|
4686
|
+
};
|
|
4687
|
+
React47.useEffect(() => {
|
|
4688
|
+
if (defaultOpen && !isExpanded && toggleExpanded) toggleExpanded(nodeId);
|
|
4689
|
+
}, []);
|
|
4690
|
+
if (isExpanded)
|
|
4691
|
+
return /* @__PURE__ */ React47.createElement(
|
|
4692
|
+
TreeNodeContent,
|
|
4693
|
+
{
|
|
4694
|
+
role: "group",
|
|
4695
|
+
id: String(IdHandler.content),
|
|
4696
|
+
"aria-labelledby": String(IdHandler.trigger),
|
|
4697
|
+
"data-nodeId": nodeId,
|
|
4698
|
+
...restProps
|
|
4699
|
+
},
|
|
4700
|
+
children
|
|
4701
|
+
);
|
|
4702
|
+
return /* @__PURE__ */ React47.createElement(React47.Fragment, null);
|
|
4703
|
+
};
|
|
4704
|
+
TreeContent.displayName = "Tree.Content";
|
|
4705
|
+
Tree.Root = TreeRoot;
|
|
4706
|
+
Tree.Node = TreeNode;
|
|
4707
|
+
Tree.Trigger = TreeTrigger;
|
|
4708
|
+
Tree.Content = TreeContent;
|
|
4302
4709
|
export {
|
|
4303
4710
|
Accordion,
|
|
4304
4711
|
AccordionContent,
|
|
@@ -4340,6 +4747,10 @@ export {
|
|
|
4340
4747
|
FieldMeta,
|
|
4341
4748
|
FieldRoot,
|
|
4342
4749
|
FieldWrapper,
|
|
4750
|
+
MessageBubble,
|
|
4751
|
+
MessageBubbleContent,
|
|
4752
|
+
MessageBubbleMeta,
|
|
4753
|
+
MessageBubbleRoot,
|
|
4343
4754
|
MetaVariantEnum,
|
|
4344
4755
|
OTPField,
|
|
4345
4756
|
OTPFieldSlot,
|
|
@@ -4358,6 +4769,7 @@ export {
|
|
|
4358
4769
|
Sheet,
|
|
4359
4770
|
SheetRoot,
|
|
4360
4771
|
SheetTrigger,
|
|
4772
|
+
Shimmer,
|
|
4361
4773
|
Skeleton,
|
|
4362
4774
|
Spinner,
|
|
4363
4775
|
Switch,
|
|
@@ -4382,14 +4794,22 @@ export {
|
|
|
4382
4794
|
ToolbarSection,
|
|
4383
4795
|
ToolbarTrigger,
|
|
4384
4796
|
Tooltip,
|
|
4797
|
+
Tree,
|
|
4798
|
+
TreeContent,
|
|
4799
|
+
TreeNode,
|
|
4800
|
+
TreeRoot,
|
|
4801
|
+
TreeTrigger,
|
|
4385
4802
|
useAccordion,
|
|
4386
4803
|
useCheckbox,
|
|
4387
4804
|
useCollapsible,
|
|
4388
4805
|
useDialog,
|
|
4389
4806
|
useDropdownMenu,
|
|
4390
4807
|
useField,
|
|
4808
|
+
useMessageBubble,
|
|
4391
4809
|
useSheet,
|
|
4392
4810
|
useSwitch,
|
|
4393
4811
|
useTabs,
|
|
4394
|
-
useToolbar
|
|
4812
|
+
useToolbar,
|
|
4813
|
+
useTree,
|
|
4814
|
+
useTreeNode
|
|
4395
4815
|
};
|