ixia-ui-react 1.8.0 → 2.0.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/README.md +24 -1
- package/dist/accordion/index.d.ts +41 -0
- package/dist/accordion/index.js +142 -0
- package/dist/accordion/index.js.map +1 -0
- package/dist/alert/index.d.ts +22 -0
- package/dist/alert/index.js +1 -0
- package/dist/alert-Dcu9R8CY.js +73 -0
- package/dist/alert-Dcu9R8CY.js.map +1 -0
- package/dist/alert-dialog/index.d.ts +39 -0
- package/dist/alert-dialog/index.js +134 -0
- package/dist/alert-dialog/index.js.map +1 -0
- package/dist/autocomplete/index.d.ts +2 -0
- package/dist/autocomplete/index.js +1 -0
- package/dist/autocomplete-BfpWVO1l.js +169 -0
- package/dist/autocomplete-BfpWVO1l.js.map +1 -0
- package/dist/avatar/index.d.ts +2 -0
- package/dist/avatar/index.js +1 -0
- package/dist/avatar-Bp4gZh21.js +93 -0
- package/dist/avatar-Bp4gZh21.js.map +1 -0
- package/dist/badge/index.d.ts +2 -0
- package/dist/badge/index.js +1 -0
- package/dist/badge-Cl-9WTW-.js +160 -0
- package/dist/badge-Cl-9WTW-.js.map +1 -0
- package/dist/bento-box/index.d.ts +30 -0
- package/dist/bento-box/index.js +103 -0
- package/dist/bento-box/index.js.map +1 -0
- package/dist/breadcrumb/index.d.ts +18 -0
- package/dist/breadcrumb/index.js +58 -0
- package/dist/breadcrumb/index.js.map +1 -0
- package/dist/button/index.d.ts +3 -0
- package/dist/button/index.js +1 -0
- package/dist/button-BpUC-R1J.js +307 -0
- package/dist/button-BpUC-R1J.js.map +1 -0
- package/dist/button-group/index.d.ts +2 -0
- package/dist/button-group/index.js +1 -0
- package/dist/button-group-7azbqlcO.js +269 -0
- package/dist/button-group-7azbqlcO.js.map +1 -0
- package/dist/button.types-BFKrBCGd.d.ts +10 -0
- package/dist/calendar/index.d.ts +63 -0
- package/dist/calendar/index.js +292 -0
- package/dist/calendar/index.js.map +1 -0
- package/dist/chart/index.d.ts +87 -0
- package/dist/chart/index.js +262 -0
- package/dist/chart/index.js.map +1 -0
- package/dist/checkbox/index.d.ts +2 -0
- package/dist/checkbox/index.js +1 -0
- package/dist/checkbox-BuUZ1Lly.js +54 -0
- package/dist/checkbox-BuUZ1Lly.js.map +1 -0
- package/dist/checkbox-group/index.d.ts +6 -0
- package/dist/checkbox-group/index.js +17 -0
- package/dist/checkbox-group/index.js.map +1 -0
- package/dist/cn-BDi0DfT5.js +29 -0
- package/dist/cn-BDi0DfT5.js.map +1 -0
- package/dist/code-block/index.d.ts +50 -0
- package/dist/code-block/index.js +208 -0
- package/dist/code-block/index.js.map +1 -0
- package/dist/collapsible/index.d.ts +2 -0
- package/dist/collapsible/index.js +1 -0
- package/dist/collapsible-BVqrh0Q0.js +44 -0
- package/dist/collapsible-BVqrh0Q0.js.map +1 -0
- package/dist/color-channel-slider/index.d.ts +2 -0
- package/dist/color-channel-slider/index.js +1 -0
- package/dist/color-channel-slider-h8mUPJ35.js +70 -0
- package/dist/color-channel-slider-h8mUPJ35.js.map +1 -0
- package/dist/color-picker/index.d.ts +137 -0
- package/dist/color-picker/index.js +621 -0
- package/dist/color-picker/index.js.map +1 -0
- package/dist/combobox/index.d.ts +64 -0
- package/dist/combobox/index.js +289 -0
- package/dist/combobox/index.js.map +1 -0
- package/dist/context-menu/index.d.ts +49 -0
- package/dist/context-menu/index.js +166 -0
- package/dist/context-menu/index.js.map +1 -0
- package/dist/dialog/index.d.ts +36 -0
- package/dist/dialog/index.js +119 -0
- package/dist/dialog/index.js.map +1 -0
- package/dist/drawer/index.d.ts +31 -0
- package/dist/drawer/index.js +95 -0
- package/dist/drawer/index.js.map +1 -0
- package/dist/dropzone/index.d.ts +70 -0
- package/dist/dropzone/index.js +479 -0
- package/dist/dropzone/index.js.map +1 -0
- package/dist/field/index.d.ts +2 -0
- package/dist/field/index.js +1 -0
- package/dist/field-DTL7eA5y.js +254 -0
- package/dist/field-DTL7eA5y.js.map +1 -0
- package/dist/form/index.d.ts +220 -0
- package/dist/form/index.js +3 -0
- package/dist/form-BxMg796f.js +192 -0
- package/dist/form-BxMg796f.js.map +1 -0
- package/dist/has-single-element-child-DLGI0Dh2.js +12 -0
- package/dist/has-single-element-child-DLGI0Dh2.js.map +1 -0
- package/dist/hooks/index.d.ts +26 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks-DUm-q_ig.js +68 -0
- package/dist/hooks-DUm-q_ig.js.map +1 -0
- package/dist/icon/index.d.ts +2 -0
- package/dist/icon/index.js +1 -0
- package/dist/icon-D3JWfCa2.js +85 -0
- package/dist/icon-D3JWfCa2.js.map +1 -0
- package/dist/icon-container/index.d.ts +10 -0
- package/dist/icon-container/index.js +64 -0
- package/dist/icon-container/index.js.map +1 -0
- package/dist/index-0ZQzIKoE.d.ts +11 -0
- package/dist/index-B3MK1QYh.d.ts +11 -0
- package/dist/index-BJVMIPq4.d.ts +54 -0
- package/dist/index-BsV-u_jc.d.ts +4 -0
- package/dist/index-BygR7cUT.d.ts +22 -0
- package/dist/index-BzTOLSgZ.d.ts +9 -0
- package/dist/index-C15xiG9O.d.ts +14 -0
- package/dist/index-C2zco6-C.d.ts +15 -0
- package/dist/index-CIDOd4Z8.d.ts +56 -0
- package/dist/index-CQti9gFb.d.ts +49 -0
- package/dist/index-CiE-Rqit.d.ts +70 -0
- package/dist/index-D1kkOg9k.d.ts +14 -0
- package/dist/index-DLfdAked.d.ts +34 -0
- package/dist/index-DMaW_XF1.d.ts +24 -0
- package/dist/index-Db_QGr6S.d.ts +5 -0
- package/dist/index-DdFxZ3Xr.d.ts +22 -0
- package/dist/index-DfNHJF0t.d.ts +33 -0
- package/dist/index-DyQYoAUf.d.ts +29 -0
- package/dist/index-N2CBSUDu.d.ts +14 -0
- package/dist/index-PuhTRMce.d.ts +11 -0
- package/dist/index-Wb_tILYa.d.ts +24 -0
- package/dist/index-bVyqfhJS.d.ts +4 -0
- package/dist/index-x4f8gnaI.d.ts +15 -0
- package/dist/input/index.d.ts +3 -0
- package/dist/input/index.js +1 -0
- package/dist/input-Laj6dwtK.js +179 -0
- package/dist/input-Laj6dwtK.js.map +1 -0
- package/dist/input-group/index.d.ts +2 -0
- package/dist/input-group/index.js +1 -0
- package/dist/input-group-CgdazGrY.js +111 -0
- package/dist/input-group-CgdazGrY.js.map +1 -0
- package/dist/input-otp/index.d.ts +13 -0
- package/dist/input-otp/index.js +44 -0
- package/dist/input-otp/index.js.map +1 -0
- package/dist/input.types-816rEVWU.d.ts +20 -0
- package/dist/input.types-D0gyoaQv.js +48 -0
- package/dist/input.types-D0gyoaQv.js.map +1 -0
- package/dist/kbd/index.d.ts +9 -0
- package/dist/kbd/index.js +25 -0
- package/dist/kbd/index.js.map +1 -0
- package/dist/label/index.d.ts +8 -0
- package/dist/label/index.js +1 -0
- package/dist/label-BgpayDvN.js +27 -0
- package/dist/label-BgpayDvN.js.map +1 -0
- package/dist/layer-tree/index.d.ts +728 -0
- package/dist/layer-tree/index.js +685 -0
- package/dist/layer-tree/index.js.map +1 -0
- package/dist/map/google/index.d.ts +143 -0
- package/dist/map/google/index.js +445 -0
- package/dist/map/google/index.js.map +1 -0
- package/dist/map/index.d.ts +94 -0
- package/dist/map/index.js +208 -0
- package/dist/map/index.js.map +1 -0
- package/dist/map.context-Dw1D7E8m.js +11 -0
- package/dist/map.context-Dw1D7E8m.js.map +1 -0
- package/dist/menu/index.d.ts +2 -0
- package/dist/menu/index.js +1 -0
- package/dist/menu-sf13cnGp.js +173 -0
- package/dist/menu-sf13cnGp.js.map +1 -0
- package/dist/menu-tone-DWBEHoX2.js +22 -0
- package/dist/menu-tone-DWBEHoX2.js.map +1 -0
- package/dist/meter/index.d.ts +2 -0
- package/dist/meter/index.js +1 -0
- package/dist/meter-HD5taq57.js +116 -0
- package/dist/meter-HD5taq57.js.map +1 -0
- package/dist/nav-bar/index.d.ts +25 -0
- package/dist/nav-bar/index.js +133 -0
- package/dist/nav-bar/index.js.map +1 -0
- package/dist/navigation-menu/index.d.ts +43 -0
- package/dist/navigation-menu/index.js +176 -0
- package/dist/navigation-menu/index.js.map +1 -0
- package/dist/number-field/index.d.ts +14 -0
- package/dist/number-field/index.js +116 -0
- package/dist/number-field/index.js.map +1 -0
- package/dist/popover/index.d.ts +2 -0
- package/dist/popover/index.js +1 -0
- package/dist/popover-B1s4xXrX.js +114 -0
- package/dist/popover-B1s4xXrX.js.map +1 -0
- package/dist/preview-card/index.d.ts +13 -0
- package/dist/preview-card/index.js +35 -0
- package/dist/preview-card/index.js.map +1 -0
- package/dist/profile/index.d.ts +21 -0
- package/dist/profile/index.js +52 -0
- package/dist/profile/index.js.map +1 -0
- package/dist/progress/index.d.ts +23 -0
- package/dist/progress/index.js +97 -0
- package/dist/progress/index.js.map +1 -0
- package/dist/radar-ping/index.d.ts +11 -0
- package/dist/radar-ping/index.js +49 -0
- package/dist/radar-ping/index.js.map +1 -0
- package/dist/radio-group/index.d.ts +2 -0
- package/dist/radio-group/index.js +1 -0
- package/dist/radio-group-Dj43u35Z.js +47 -0
- package/dist/radio-group-Dj43u35Z.js.map +1 -0
- package/dist/resizeable/index.d.ts +11 -0
- package/dist/resizeable/index.js +31 -0
- package/dist/resizeable/index.js.map +1 -0
- package/dist/scroll-area/index.d.ts +11 -0
- package/dist/scroll-area/index.js +51 -0
- package/dist/scroll-area/index.js.map +1 -0
- package/dist/select/index.d.ts +2 -0
- package/dist/select/index.js +1 -0
- package/dist/select-DncJXYim.js +159 -0
- package/dist/select-DncJXYim.js.map +1 -0
- package/dist/separator/index.d.ts +2 -0
- package/dist/separator/index.js +1 -0
- package/dist/separator-DgIQp1cB.js +97 -0
- package/dist/separator-DgIQp1cB.js.map +1 -0
- package/dist/sidebar/index.d.ts +80 -0
- package/dist/sidebar/index.js +334 -0
- package/dist/sidebar/index.js.map +1 -0
- package/dist/site-header/index.d.ts +22 -0
- package/dist/site-header/index.js +55 -0
- package/dist/site-header/index.js.map +1 -0
- package/dist/skeleton/index.d.ts +4 -0
- package/dist/skeleton/index.js +1 -0
- package/dist/skeleton-DSG3FWby.js +13 -0
- package/dist/skeleton-DSG3FWby.js.map +1 -0
- package/dist/slider/index.d.ts +2 -0
- package/dist/slider/index.js +1 -0
- package/dist/slider-D_XlV4OW.js +114 -0
- package/dist/slider-D_XlV4OW.js.map +1 -0
- package/dist/slider-group/index.d.ts +46 -0
- package/dist/slider-group/index.js +198 -0
- package/dist/slider-group/index.js.map +1 -0
- package/dist/styles.css +4 -1
- package/dist/switch/index.d.ts +2 -0
- package/dist/switch/index.js +1 -0
- package/dist/switch-DXHixGHe.js +23 -0
- package/dist/switch-DXHixGHe.js.map +1 -0
- package/dist/table/index.d.ts +920 -0
- package/dist/table/index.js +1544 -0
- package/dist/table/index.js.map +1 -0
- package/dist/tabs/index.d.ts +2 -0
- package/dist/tabs/index.js +1 -0
- package/dist/tabs-DTC7coap.js +270 -0
- package/dist/tabs-DTC7coap.js.map +1 -0
- package/dist/text-area/index.d.ts +2 -0
- package/dist/text-area/index.js +1 -0
- package/dist/text-area-H6HjKnv_.js +50 -0
- package/dist/text-area-H6HjKnv_.js.map +1 -0
- package/dist/toast/index.d.ts +65 -0
- package/dist/toast/index.js +216 -0
- package/dist/toast/index.js.map +1 -0
- package/dist/toggle/index.d.ts +2 -0
- package/dist/toggle/index.js +1 -0
- package/dist/toggle-ZT9thVmz.js +73 -0
- package/dist/toggle-ZT9thVmz.js.map +1 -0
- package/dist/toggle-group/index.d.ts +10 -0
- package/dist/toggle-group/index.js +63 -0
- package/dist/toggle-group/index.js.map +1 -0
- package/dist/toggle-group-context-CBNZEf1I.js +6 -0
- package/dist/toggle-group-context-CBNZEf1I.js.map +1 -0
- package/dist/tooltip/index.d.ts +18 -0
- package/dist/tooltip/index.js +1 -0
- package/dist/tooltip-B6z3tDbW.js +41 -0
- package/dist/tooltip-B6z3tDbW.js.map +1 -0
- package/dist/trim-text-children-CQRFg2fL.js +33 -0
- package/dist/trim-text-children-CQRFg2fL.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils-BI2x7nW5.js +5 -0
- package/dist/utils-BI2x7nW5.js.map +1 -0
- package/package.json +100 -31
- package/dist/index.d.ts +0 -8000
- package/dist/index.js +0 -17274
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { r as SelectTrigger } from "../index-CIDOd4Z8.js";
|
|
2
|
+
import { t as Tabs } from "../index-DyQYoAUf.js";
|
|
3
|
+
import React$1 from "react";
|
|
4
|
+
type CodeBlockProps = Omit<React.ComponentProps<'div'>, 'defaultValue'> & {
|
|
5
|
+
defaultValue: CodeBlockValue;
|
|
6
|
+
items: CodeBlockValue[];
|
|
7
|
+
};
|
|
8
|
+
interface CodeBlockProviderState {
|
|
9
|
+
currentValue: CodeBlockValue;
|
|
10
|
+
setCurrentValue: React.Dispatch<React.SetStateAction<CodeBlockValue>>;
|
|
11
|
+
items: CodeBlockValue[];
|
|
12
|
+
}
|
|
13
|
+
interface CodeBlockValue {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
code?: string;
|
|
18
|
+
content?: React.ReactNode;
|
|
19
|
+
icon?: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
type CodeBlockTabsProps = React.ComponentProps<typeof Tabs>;
|
|
22
|
+
type CodeBlockCopyProps = React.ComponentProps<'button'>;
|
|
23
|
+
type CodeBlockNameProps = React.ComponentProps<'div'>;
|
|
24
|
+
type CodeBlockSelectProps = React.ComponentProps<typeof SelectTrigger>;
|
|
25
|
+
type CodeBlockHeaderGroupProps = React.ComponentProps<'div'>;
|
|
26
|
+
type CodeBlockDownloadProps = React.ComponentProps<'button'>;
|
|
27
|
+
type CodeBlockActionsProps = React.ComponentProps<'div'>;
|
|
28
|
+
type CodeBlockWindowProps = React.ComponentProps<'div'>;
|
|
29
|
+
declare function CodeBlock$1({ items, defaultValue, className, ref, ...props }: CodeBlockProps): React$1.JSX.Element;
|
|
30
|
+
export declare function CodeBlockActions({ className, ref, ...props }: CodeBlockActionsProps): import("react").JSX.Element;
|
|
31
|
+
export declare function CodeBlockCopy({ className, children, disabled, ref, ...props }: CodeBlockCopyProps): React$1.JSX.Element;
|
|
32
|
+
export declare function CodeBlockDownload({ className, children, disabled, ref, ...props }: CodeBlockDownloadProps): React$1.JSX.Element;
|
|
33
|
+
type CodeBlockHeaderProps = React.ComponentProps<'div'>;
|
|
34
|
+
export declare function CodeBlockHeader({ className, ref, ...props }: CodeBlockHeaderProps): import("react").JSX.Element;
|
|
35
|
+
export declare function CodeBlockName({ className, children, ref, ...props }: CodeBlockNameProps): import("react").JSX.Element | undefined;
|
|
36
|
+
export declare function CodeBlockSelect({ className, children, ref, ...props }: CodeBlockSelectProps): import("react").JSX.Element;
|
|
37
|
+
export declare function CodeBlockTabs({ className, children, ref, ...props }: CodeBlockTabsProps): import("react").JSX.Element;
|
|
38
|
+
export declare function CodeBlockWindow({ className, children, ref, ...props }: CodeBlockWindowProps): import("react").JSX.Element;
|
|
39
|
+
declare const CodeBlock: typeof CodeBlock$1 & {
|
|
40
|
+
Actions: typeof CodeBlockActions;
|
|
41
|
+
Copy: typeof CodeBlockCopy;
|
|
42
|
+
Download: typeof CodeBlockDownload;
|
|
43
|
+
Header: typeof CodeBlockHeader;
|
|
44
|
+
Name: typeof CodeBlockName;
|
|
45
|
+
Select: typeof CodeBlockSelect;
|
|
46
|
+
Tabs: typeof CodeBlockTabs;
|
|
47
|
+
Window: typeof CodeBlockWindow;
|
|
48
|
+
};
|
|
49
|
+
export { CodeBlock, type CodeBlockActionsProps, type CodeBlockCopyProps, type CodeBlockDownloadProps, type CodeBlockHeaderGroupProps, type CodeBlockNameProps, type CodeBlockProps, type CodeBlockProviderState, type CodeBlockSelectProps, type CodeBlockTabsProps, type CodeBlockValue, type CodeBlockWindowProps };
|
|
50
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { t as cn } from "../cn-BDi0DfT5.js";
|
|
2
|
+
import { n as Icon } from "../icon-D3JWfCa2.js";
|
|
3
|
+
import { t as trimTextChildren } from "../trim-text-children-CQRFg2fL.js";
|
|
4
|
+
import { t as Button } from "../button-BpUC-R1J.js";
|
|
5
|
+
import { a as SelectPopup, c as SelectIcon, i as SelectTitle, n as SelectValue, o as SelectList, r as SelectTrigger, s as SelectItem, t as Select } from "../select-DncJXYim.js";
|
|
6
|
+
import { i as TabsList, n as TabsTab, t as Tabs } from "../tabs-DTC7coap.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import React from "react";
|
|
9
|
+
// src/components/code-block/code-block.tsx
|
|
10
|
+
const CodeBlockContext = React.createContext(void 0);
|
|
11
|
+
function CodeBlock$1({ items, defaultValue, className, ref, ...props }) {
|
|
12
|
+
const [currentValue, setCurrentValue] = React.useState(defaultValue);
|
|
13
|
+
return /* @__PURE__ */ jsx(CodeBlockContext.Provider, {
|
|
14
|
+
value: {
|
|
15
|
+
currentValue,
|
|
16
|
+
items,
|
|
17
|
+
setCurrentValue
|
|
18
|
+
},
|
|
19
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
20
|
+
className: cn("flex flex-col rounded-xl border border-border bg-surface", className),
|
|
21
|
+
ref,
|
|
22
|
+
...props
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function useCodeBlock() {
|
|
27
|
+
const context = React.useContext(CodeBlockContext);
|
|
28
|
+
if (!context) throw new Error("useCodeBlock must be used within a CodeBlock");
|
|
29
|
+
return context;
|
|
30
|
+
}
|
|
31
|
+
// src/components/code-block/code-block-actions.tsx
|
|
32
|
+
function CodeBlockActions({ className, ref, ...props }) {
|
|
33
|
+
return /* @__PURE__ */ jsx("div", {
|
|
34
|
+
className: cn("absolute top-2xs right-2xs flex items-center gap-3xs", className),
|
|
35
|
+
ref,
|
|
36
|
+
...props
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
// src/components/code-block/code-block-copy.tsx
|
|
40
|
+
const COPY_TIMEOUT = 2e3;
|
|
41
|
+
const COPY_STATUS_ICON = {
|
|
42
|
+
false: /* @__PURE__ */ jsx(Icon, {
|
|
43
|
+
name: "copy",
|
|
44
|
+
className: "animate-in zoom-in"
|
|
45
|
+
}),
|
|
46
|
+
true: /* @__PURE__ */ jsx(Icon, {
|
|
47
|
+
name: "selected",
|
|
48
|
+
className: "animate-in zoom-in"
|
|
49
|
+
})
|
|
50
|
+
};
|
|
51
|
+
function CodeBlockCopy({ className, children, disabled, ref, ...props }) {
|
|
52
|
+
const { currentValue } = useCodeBlock(), { code } = currentValue, [copied, setCopied] = React.useState(false), handleClick = async () => {
|
|
53
|
+
try {
|
|
54
|
+
if (code === void 0) throw new Error("No source code available to copy");
|
|
55
|
+
await navigator.clipboard.writeText(code);
|
|
56
|
+
setCopied(true);
|
|
57
|
+
setTimeout(() => setCopied(false), COPY_TIMEOUT);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
console.error("Failed to copy text:", error);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
63
|
+
"aria-label": "Copy code",
|
|
64
|
+
className: cn("", className),
|
|
65
|
+
onClick: handleClick,
|
|
66
|
+
ref,
|
|
67
|
+
size: "medium",
|
|
68
|
+
tone: "neutral",
|
|
69
|
+
variant: "ghost",
|
|
70
|
+
...props,
|
|
71
|
+
disabled: disabled || code === void 0,
|
|
72
|
+
children: [children, COPY_STATUS_ICON[`${copied}`]]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
// src/components/code-block/code-block-download.tsx
|
|
76
|
+
const DOWNLOAD_TIMEOUT = 2e3;
|
|
77
|
+
const DOWNLOAD_STATUS_ICON = {
|
|
78
|
+
false: /* @__PURE__ */ jsx(Icon, {
|
|
79
|
+
name: "download",
|
|
80
|
+
className: "animate-in zoom-in"
|
|
81
|
+
}),
|
|
82
|
+
true: /* @__PURE__ */ jsx(Icon, {
|
|
83
|
+
name: "selected",
|
|
84
|
+
className: "animate-in zoom-in"
|
|
85
|
+
})
|
|
86
|
+
};
|
|
87
|
+
function CodeBlockDownload({ className, children, disabled, ref, ...props }) {
|
|
88
|
+
const { currentValue } = useCodeBlock(), { code } = currentValue, [downloaded, setDownloaded] = React.useState(false), handleClick = async () => {
|
|
89
|
+
try {
|
|
90
|
+
if (code === void 0) throw new Error("No source code available to download");
|
|
91
|
+
const blob = new Blob([code], { type: "text/plain;charset=utf-8" }), url = URL.createObjectURL(blob), link = document.createElement("a");
|
|
92
|
+
link.href = url;
|
|
93
|
+
link.download = currentValue.name;
|
|
94
|
+
link.click();
|
|
95
|
+
URL.revokeObjectURL(url);
|
|
96
|
+
setDownloaded(true);
|
|
97
|
+
setTimeout(() => setDownloaded(false), DOWNLOAD_TIMEOUT);
|
|
98
|
+
} catch (error) {
|
|
99
|
+
console.error("Failed to download file:", error);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
103
|
+
"aria-label": "Download file",
|
|
104
|
+
onClick: handleClick,
|
|
105
|
+
size: "medium",
|
|
106
|
+
variant: "ghost",
|
|
107
|
+
tone: "neutral",
|
|
108
|
+
className: cn("", className),
|
|
109
|
+
ref,
|
|
110
|
+
...props,
|
|
111
|
+
disabled: disabled || code === void 0,
|
|
112
|
+
children: [children, DOWNLOAD_STATUS_ICON[`${downloaded}`]]
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
// src/components/code-block/code-block-header.tsx
|
|
116
|
+
function CodeBlockHeader({ className, ref, ...props }) {
|
|
117
|
+
return /* @__PURE__ */ jsx("div", {
|
|
118
|
+
className: cn("flex min-h-2xl items-center justify-between border-b border-border px-2xs pl-(--code-block-header-padding-left) [--code-block-header-padding-left:var(--spacing-2xs)] has-data-[slot=code-block-tabs]:[--code-block-header-padding-left:0px]", className),
|
|
119
|
+
ref,
|
|
120
|
+
...props
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
// src/components/code-block/code-block-name.tsx
|
|
124
|
+
function CodeBlockName({ className, children, ref, ...props }) {
|
|
125
|
+
const { currentValue } = useCodeBlock();
|
|
126
|
+
if (!currentValue?.name) return;
|
|
127
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
128
|
+
className: cn("flex items-center justify-center gap-2xs px-xs font-heading text-base leading-none font-bold text-on-surface-variant [&>svg]:size-md", className),
|
|
129
|
+
ref,
|
|
130
|
+
...props,
|
|
131
|
+
children: [
|
|
132
|
+
trimTextChildren(children),
|
|
133
|
+
currentValue?.icon,
|
|
134
|
+
trimTextChildren(currentValue.name)
|
|
135
|
+
]
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
// src/components/code-block/code-block-select.tsx
|
|
139
|
+
function CodeBlockSelect({ className, children, ref, ...props }) {
|
|
140
|
+
const { currentValue, setCurrentValue, items } = useCodeBlock(), handleChange = (value) => {
|
|
141
|
+
const selectedValue = items.find(({ id }) => id === value);
|
|
142
|
+
if (selectedValue) setCurrentValue(selectedValue);
|
|
143
|
+
};
|
|
144
|
+
return /* @__PURE__ */ jsxs(Select, {
|
|
145
|
+
value: currentValue.id,
|
|
146
|
+
onValueChange: handleChange,
|
|
147
|
+
children: [/* @__PURE__ */ jsxs(SelectTrigger, {
|
|
148
|
+
"aria-label": "Select snippet",
|
|
149
|
+
className: cn("", className),
|
|
150
|
+
ref,
|
|
151
|
+
...props,
|
|
152
|
+
variant: "ghost",
|
|
153
|
+
children: [/* @__PURE__ */ jsx(SelectValue, { children: (value) => items.find((item) => item.id === value)?.label }), /* @__PURE__ */ jsx(SelectIcon, { children: /* @__PURE__ */ jsx(Icon, { name: "chevronsUpDown" }) })]
|
|
154
|
+
}), /* @__PURE__ */ jsx(SelectPopup, { children: /* @__PURE__ */ jsxs(SelectList, { children: [children, items.map(({ label, id }) => /* @__PURE__ */ jsx(SelectItem, {
|
|
155
|
+
value: id,
|
|
156
|
+
children: /* @__PURE__ */ jsx(SelectTitle, { children: label })
|
|
157
|
+
}, id))] }) })]
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
// src/components/code-block/code-block-tabs.tsx
|
|
161
|
+
function CodeBlockTabs({ className, children, ref, ...props }) {
|
|
162
|
+
const { currentValue, items, setCurrentValue } = useCodeBlock(), handleOnValueChange = (value) => {
|
|
163
|
+
const selectedValue = items.find((item) => item.id === value);
|
|
164
|
+
if (selectedValue) setCurrentValue(selectedValue);
|
|
165
|
+
};
|
|
166
|
+
return /* @__PURE__ */ jsxs(Tabs, {
|
|
167
|
+
value: currentValue.id,
|
|
168
|
+
onValueChange: handleOnValueChange,
|
|
169
|
+
className: cn("", className),
|
|
170
|
+
variant: "underline",
|
|
171
|
+
showBorder: false,
|
|
172
|
+
ref,
|
|
173
|
+
...props,
|
|
174
|
+
children: [/* @__PURE__ */ jsx(TabsList, {
|
|
175
|
+
"data-slot": "code-block-tabs",
|
|
176
|
+
children: items.map(({ id, label }) => /* @__PURE__ */ jsx(TabsTab, {
|
|
177
|
+
value: id,
|
|
178
|
+
children: label
|
|
179
|
+
}, id))
|
|
180
|
+
}), children]
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
// src/components/code-block/code-block-window.tsx
|
|
184
|
+
function CodeBlockWindow({ className, children, ref, ...props }) {
|
|
185
|
+
const { currentValue } = useCodeBlock();
|
|
186
|
+
let { content } = currentValue;
|
|
187
|
+
if (content === void 0 && currentValue.code !== void 0) content = /* @__PURE__ */ jsx("pre", { children: /* @__PURE__ */ jsx("code", { children: currentValue.code }) });
|
|
188
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
189
|
+
className: cn("relative overflow-auto rounded-lg px-md py-sm", className),
|
|
190
|
+
ref,
|
|
191
|
+
...props,
|
|
192
|
+
children: [children, content]
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
// src/components/code-block/index.ts
|
|
196
|
+
const CodeBlock = Object.assign(CodeBlock$1, {
|
|
197
|
+
Actions: CodeBlockActions,
|
|
198
|
+
Copy: CodeBlockCopy,
|
|
199
|
+
Download: CodeBlockDownload,
|
|
200
|
+
Header: CodeBlockHeader,
|
|
201
|
+
Name: CodeBlockName,
|
|
202
|
+
Select: CodeBlockSelect,
|
|
203
|
+
Tabs: CodeBlockTabs,
|
|
204
|
+
Window: CodeBlockWindow
|
|
205
|
+
});
|
|
206
|
+
export { CodeBlock, CodeBlockActions, CodeBlockCopy, CodeBlockDownload, CodeBlockHeader, CodeBlockName, CodeBlockSelect, CodeBlockTabs, CodeBlockWindow };
|
|
207
|
+
|
|
208
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["CodeBlock","CodeBlockRoot"],"sources":["../../src/components/code-block/code-block.tsx","../../src/components/code-block/code-block-actions.tsx","../../src/components/code-block/code-block-copy.tsx","../../src/components/code-block/code-block-download.tsx","../../src/components/code-block/code-block-header.tsx","../../src/components/code-block/code-block-name.tsx","../../src/components/code-block/code-block-select.tsx","../../src/components/code-block/code-block-tabs.tsx","../../src/components/code-block/code-block-window.tsx","../../src/components/code-block/index.ts"],"sourcesContent":["import React from 'react'\n\nimport { cn } from '@/utils/cn'\n\nimport type { CodeBlockProps, CodeBlockProviderState, CodeBlockValue } from './code-block.types'\n\nconst CodeBlockContext = React.createContext<CodeBlockProviderState | undefined>(undefined)\n\nfunction CodeBlock({ items, defaultValue, className, ref, ...props }: CodeBlockProps) {\n const [currentValue, setCurrentValue] = React.useState<CodeBlockValue>(defaultValue)\n\n return (\n <CodeBlockContext.Provider value={{ currentValue, items, setCurrentValue }}>\n <div\n className={cn('flex flex-col rounded-xl border border-border bg-surface', className)}\n ref={ref}\n {...props}\n />\n </CodeBlockContext.Provider>\n )\n}\n\nfunction useCodeBlock() {\n const context = React.useContext(CodeBlockContext)\n\n if (!context) {\n throw new Error('useCodeBlock must be used within a CodeBlock')\n }\n\n return context\n}\n\nexport { CodeBlock, useCodeBlock }\n","import { cn } from '@/utils/cn'\n\nimport type { CodeBlockActionsProps } from './code-block.types'\n\nexport function CodeBlockActions({ className, ref, ...props }: CodeBlockActionsProps) {\n return (\n <div\n className={cn('absolute top-2xs right-2xs flex items-center gap-3xs', className)}\n ref={ref}\n {...props}\n />\n )\n}\n","import React from 'react'\n\nimport { cn } from '@/utils/cn'\n\nimport { Button } from '../button'\nimport { Icon } from '../icon'\nimport { useCodeBlock } from './code-block'\nimport type { CodeBlockCopyProps } from './code-block.types'\n\nconst COPY_TIMEOUT = 2000,\n COPY_STATUS_ICON = {\n false: <Icon name=\"copy\" className=\"animate-in zoom-in\" />,\n true: <Icon name=\"selected\" className=\"animate-in zoom-in\" />,\n }\n\nexport function CodeBlockCopy({\n className,\n children,\n disabled,\n ref,\n ...props\n}: CodeBlockCopyProps) {\n const { currentValue } = useCodeBlock(),\n { code } = currentValue,\n [copied, setCopied] = React.useState(false),\n handleClick = async () => {\n try {\n if (code === undefined) {\n throw new Error('No source code available to copy')\n }\n await navigator.clipboard.writeText(code)\n setCopied(true)\n setTimeout(() => setCopied(false), COPY_TIMEOUT)\n } catch (error) {\n console.error('Failed to copy text:', error)\n }\n }\n\n return (\n <Button\n aria-label=\"Copy code\"\n className={cn('', className)}\n onClick={handleClick}\n ref={ref}\n size=\"medium\"\n tone=\"neutral\"\n variant=\"ghost\"\n {...props}\n disabled={disabled || code === undefined}\n >\n {children}\n {COPY_STATUS_ICON[`${copied}`]}\n </Button>\n )\n}\n","import React from 'react'\n\nimport { cn } from '@/utils/cn'\n\nimport { Button } from '../button'\nimport { Icon } from '../icon'\nimport { useCodeBlock } from './code-block'\nimport type { CodeBlockDownloadProps } from './code-block.types'\n\nconst DOWNLOAD_TIMEOUT = 2000,\n DOWNLOAD_STATUS_ICON = {\n false: <Icon name=\"download\" className=\"animate-in zoom-in\" />,\n true: <Icon name=\"selected\" className=\"animate-in zoom-in\" />,\n }\n\nexport function CodeBlockDownload({\n className,\n children,\n disabled,\n ref,\n ...props\n}: CodeBlockDownloadProps) {\n const { currentValue } = useCodeBlock(),\n { code } = currentValue,\n [downloaded, setDownloaded] = React.useState(false),\n handleClick = async () => {\n try {\n if (code === undefined) {\n throw new Error('No source code available to download')\n }\n const blob = new Blob([code], { type: 'text/plain;charset=utf-8' }),\n url = URL.createObjectURL(blob),\n link = document.createElement('a')\n link.href = url\n link.download = currentValue.name\n link.click()\n URL.revokeObjectURL(url)\n\n setDownloaded(true)\n setTimeout(() => setDownloaded(false), DOWNLOAD_TIMEOUT)\n } catch (error) {\n console.error('Failed to download file:', error)\n }\n }\n\n return (\n <Button\n aria-label=\"Download file\"\n onClick={handleClick}\n size=\"medium\"\n variant=\"ghost\"\n tone=\"neutral\"\n className={cn('', className)}\n ref={ref}\n {...props}\n disabled={disabled || code === undefined}\n >\n {children}\n {DOWNLOAD_STATUS_ICON[`${downloaded}`]}\n </Button>\n )\n}\n","import { cn } from '@/utils/cn'\n\ntype CodeBlockHeaderProps = React.ComponentProps<'div'>\n\nexport function CodeBlockHeader({ className, ref, ...props }: CodeBlockHeaderProps) {\n return (\n <div\n className={cn(\n // Keep the tab-specific default overridable by ordinary padding classes.\n 'flex min-h-2xl items-center justify-between border-b border-border px-2xs pl-(--code-block-header-padding-left) [--code-block-header-padding-left:var(--spacing-2xs)] has-data-[slot=code-block-tabs]:[--code-block-header-padding-left:0px]',\n className,\n )}\n ref={ref}\n {...props}\n />\n )\n}\n","import { cn } from '@/utils/cn'\nimport { trimTextChildren } from '@/utils/trim-text-children'\n\nimport { useCodeBlock } from './code-block'\nimport type { CodeBlockNameProps } from './code-block.types'\n\nexport function CodeBlockName({ className, children, ref, ...props }: CodeBlockNameProps) {\n const { currentValue } = useCodeBlock()\n\n if (!currentValue?.name) {\n return undefined\n }\n\n return (\n <div\n className={cn(\n 'flex items-center justify-center gap-2xs px-xs font-heading text-base leading-none font-bold text-on-surface-variant [&>svg]:size-md',\n className,\n )}\n ref={ref}\n {...props}\n >\n {trimTextChildren(children)}\n {currentValue?.icon}\n {trimTextChildren(currentValue.name)}\n </div>\n )\n}\n","import { cn } from '@/utils/cn'\n\nimport { Icon } from '../icon'\nimport {\n Select,\n SelectIcon,\n SelectItem,\n SelectList,\n SelectPopup,\n SelectTitle,\n SelectTrigger,\n SelectValue,\n} from '../select'\nimport { useCodeBlock } from './code-block'\nimport type { CodeBlockSelectProps } from './code-block.types'\n\nexport function CodeBlockSelect({ className, children, ref, ...props }: CodeBlockSelectProps) {\n const { currentValue, setCurrentValue, items } = useCodeBlock(),\n handleChange = (value: unknown) => {\n const selectedValue = items.find(({ id }) => id === value)\n if (selectedValue) {\n setCurrentValue(selectedValue)\n }\n }\n\n return (\n <Select value={currentValue.id} onValueChange={handleChange}>\n <SelectTrigger\n aria-label=\"Select snippet\"\n className={cn('', className)}\n ref={ref}\n {...props}\n variant=\"ghost\"\n >\n <SelectValue>\n {(value: keyof typeof items) => items.find((item) => item.id === value)?.label}\n </SelectValue>\n <SelectIcon>\n <Icon name=\"chevronsUpDown\" />\n </SelectIcon>\n </SelectTrigger>\n <SelectPopup>\n <SelectList>\n {children}\n {items.map(({ label, id }) => (\n <SelectItem key={id} value={id}>\n <SelectTitle>{label}</SelectTitle>\n </SelectItem>\n ))}\n </SelectList>\n </SelectPopup>\n </Select>\n )\n}\n","import { cn } from '@/utils/cn'\n\nimport { Tabs, TabsList, TabsTab } from '../tabs'\nimport { useCodeBlock } from './code-block'\nimport type { CodeBlockTabsProps } from './code-block.types'\n\nexport function CodeBlockTabs({ className, children, ref, ...props }: CodeBlockTabsProps) {\n const { currentValue, items, setCurrentValue } = useCodeBlock(),\n handleOnValueChange = (value: string) => {\n const selectedValue = items.find((item) => item.id === value)\n if (selectedValue) {\n setCurrentValue(selectedValue)\n }\n }\n\n return (\n <Tabs\n value={currentValue.id}\n onValueChange={handleOnValueChange}\n className={cn('', className)}\n variant=\"underline\"\n showBorder={false}\n ref={ref}\n {...props}\n >\n <TabsList data-slot=\"code-block-tabs\">\n {items.map(({ id, label }) => (\n <TabsTab key={id} value={id}>\n {label}\n </TabsTab>\n ))}\n </TabsList>\n {children}\n </Tabs>\n )\n}\n","import { cn } from '@/utils/cn'\n\nimport { useCodeBlock } from './code-block'\nimport type { CodeBlockWindowProps } from './code-block.types'\n\nexport function CodeBlockWindow({ className, children, ref, ...props }: CodeBlockWindowProps) {\n const { currentValue } = useCodeBlock()\n let { content } = currentValue\n\n if (content === undefined && currentValue.code !== undefined) {\n content = (\n <pre>\n <code>{currentValue.code}</code>\n </pre>\n )\n }\n\n return (\n <div\n className={cn('relative overflow-auto rounded-lg px-md py-sm', className)}\n ref={ref}\n {...props}\n >\n {children}\n {content}\n </div>\n )\n}\n","import { CodeBlock as CodeBlockRoot } from './code-block'\nimport { CodeBlockActions } from './code-block-actions'\nimport { CodeBlockCopy } from './code-block-copy'\nimport { CodeBlockDownload } from './code-block-download'\nimport { CodeBlockHeader } from './code-block-header'\nimport { CodeBlockName } from './code-block-name'\nimport { CodeBlockSelect } from './code-block-select'\nimport { CodeBlockTabs } from './code-block-tabs'\nimport { CodeBlockWindow } from './code-block-window'\n\nconst CodeBlock = Object.assign(CodeBlockRoot, {\n Actions: CodeBlockActions,\n Copy: CodeBlockCopy,\n Download: CodeBlockDownload,\n Header: CodeBlockHeader,\n Name: CodeBlockName,\n Select: CodeBlockSelect,\n Tabs: CodeBlockTabs,\n Window: CodeBlockWindow,\n})\n\nexport type {\n CodeBlockProps,\n CodeBlockActionsProps,\n CodeBlockCopyProps,\n CodeBlockDownloadProps,\n CodeBlockHeaderGroupProps,\n CodeBlockNameProps,\n CodeBlockProviderState,\n CodeBlockSelectProps,\n CodeBlockTabsProps,\n CodeBlockWindowProps,\n CodeBlockValue,\n} from './code-block.types'\nexport { CodeBlockActions } from './code-block-actions'\nexport { CodeBlockCopy } from './code-block-copy'\nexport { CodeBlockDownload } from './code-block-download'\nexport { CodeBlockHeader } from './code-block-header'\nexport { CodeBlockName } from './code-block-name'\nexport { CodeBlockSelect } from './code-block-select'\nexport { CodeBlockTabs } from './code-block-tabs'\nexport { CodeBlockWindow } from './code-block-window'\n\nexport { CodeBlock }\n"],"mappings":"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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as CollapsibleProps, i as CollapsiblePanelProps, n as CollapsibleTrigger, o as CollapsibleTriggerProps, r as CollapsiblePanel, t as Collapsible } from "../index-N2CBSUDu.js";
|
|
2
|
+
export { Collapsible, CollapsiblePanel, type CollapsiblePanelProps, type CollapsibleProps, CollapsibleTrigger, type CollapsibleTriggerProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as Collapsible, r as CollapsiblePanel, n as CollapsibleTrigger } from "../collapsible-BVqrh0Q0.js";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { t as cn } from "./cn-BDi0DfT5.js";
|
|
2
|
+
import { n as Icon } from "./icon-D3JWfCa2.js";
|
|
3
|
+
import { t as Button } from "./button-BpUC-R1J.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Collapsible } from "@base-ui/react/collapsible";
|
|
6
|
+
// src/components/collapsible/collapsible.tsx
|
|
7
|
+
function Collapsible$2({ className, ref, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(Collapsible.Root, {
|
|
9
|
+
className: cn("flex min-h-xl w-full flex-col justify-center gap-xs", className),
|
|
10
|
+
ref,
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
// src/components/collapsible/collapsible-panel.tsx
|
|
15
|
+
function CollapsiblePanel({ className, ref, ...props }) {
|
|
16
|
+
return /* @__PURE__ */ jsx(Collapsible.Panel, {
|
|
17
|
+
className: cn("mb-3xs ml-md flex h-(--collapsible-panel-height) flex-col justify-end gap-3xs overflow-hidden border-l border-border-strong pl-sm transition-all duration-150 ease-out data-ending-style:h-0 data-starting-style:h-0 [&[hidden]:not([hidden=\"until-found\"])]:hidden", className),
|
|
18
|
+
ref,
|
|
19
|
+
...props
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
// src/components/collapsible/collapsible-trigger.tsx
|
|
23
|
+
function CollapsibleTrigger({ className, children, ref, ...props }) {
|
|
24
|
+
return /* @__PURE__ */ jsx(Collapsible.Trigger, { render: (renderProps) => /* @__PURE__ */ jsxs(Button, {
|
|
25
|
+
...renderProps,
|
|
26
|
+
tone: "neutral",
|
|
27
|
+
variant: "elevated",
|
|
28
|
+
className: cn("group/trigger", className),
|
|
29
|
+
ref,
|
|
30
|
+
...props,
|
|
31
|
+
children: [children, /* @__PURE__ */ jsx(Icon, {
|
|
32
|
+
name: "chevronRight",
|
|
33
|
+
className: "ml-auto transition-all ease-out group-data-panel-open/trigger:rotate-90"
|
|
34
|
+
})]
|
|
35
|
+
}) });
|
|
36
|
+
}
|
|
37
|
+
// src/components/collapsible/index.ts
|
|
38
|
+
const Collapsible$1 = Object.assign(Collapsible$2, {
|
|
39
|
+
Panel: CollapsiblePanel,
|
|
40
|
+
Trigger: CollapsibleTrigger
|
|
41
|
+
});
|
|
42
|
+
export { CollapsibleTrigger as n, CollapsiblePanel as r, Collapsible$1 as t };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=collapsible-BVqrh0Q0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapsible-BVqrh0Q0.js","names":["Collapsible","BaseCollapsible","BaseCollapsible","BaseCollapsible","Collapsible","CollapsibleRoot"],"sources":["../src/components/collapsible/collapsible.tsx","../src/components/collapsible/collapsible-panel.tsx","../src/components/collapsible/collapsible-trigger.tsx","../src/components/collapsible/index.ts"],"sourcesContent":["import { Collapsible as BaseCollapsible } from '@base-ui/react/collapsible'\n\nimport { cn } from '@/utils/cn'\n\nimport type { CollapsibleProps } from './collapsible.types'\n\nexport function Collapsible({ className, ref, ...props }: CollapsibleProps) {\n return (\n <BaseCollapsible.Root\n className={cn('flex min-h-xl w-full flex-col justify-center gap-xs', className)}\n ref={ref}\n {...props}\n />\n )\n}\n","import { Collapsible as BaseCollapsible } from '@base-ui/react/collapsible'\n\nimport { cn } from '@/utils/cn'\n\nimport type { CollapsiblePanelProps } from './collapsible.types'\n\nexport function CollapsiblePanel({ className, ref, ...props }: CollapsiblePanelProps) {\n return (\n <BaseCollapsible.Panel\n className={cn(\n 'mb-3xs ml-md flex h-(--collapsible-panel-height) flex-col justify-end gap-3xs overflow-hidden border-l border-border-strong pl-sm transition-all duration-150 ease-out data-ending-style:h-0 data-starting-style:h-0 [&[hidden]:not([hidden=\"until-found\"])]:hidden',\n className,\n )}\n ref={ref}\n {...props}\n />\n )\n}\n","import { Collapsible as BaseCollapsible } from '@base-ui/react/collapsible'\n\nimport { cn } from '@/utils/cn'\n\nimport { Button } from '../button'\nimport { Icon } from '../icon'\nimport type { CollapsibleTriggerProps } from './collapsible.types'\n\nexport function CollapsibleTrigger({\n className,\n children,\n ref,\n ...props\n}: CollapsibleTriggerProps) {\n return (\n <BaseCollapsible.Trigger\n render={(renderProps) => (\n <Button\n {...renderProps}\n tone=\"neutral\"\n variant=\"elevated\"\n className={cn('group/trigger', className)}\n ref={ref}\n {...props}\n >\n {children}\n <Icon\n name=\"chevronRight\"\n className=\"ml-auto transition-all ease-out group-data-panel-open/trigger:rotate-90\"\n />\n </Button>\n )}\n />\n )\n}\n","import { Collapsible as CollapsibleRoot } from './collapsible'\nimport { CollapsiblePanel } from './collapsible-panel'\nimport { CollapsibleTrigger } from './collapsible-trigger'\n\nconst Collapsible = Object.assign(CollapsibleRoot, {\n Panel: CollapsiblePanel,\n Trigger: CollapsibleTrigger,\n})\n\nexport type {\n CollapsibleProps,\n CollapsibleTriggerProps,\n CollapsiblePanelProps,\n} from './collapsible.types'\nexport { CollapsiblePanel } from './collapsible-panel'\nexport { CollapsibleTrigger } from './collapsible-trigger'\n\nexport { Collapsible }\n"],"mappings":";;;;;;AAMA,SAAgBA,cAAY,EAAE,WAAW,KAAK,GAAG,SAA2B;CAC1E,OACE,oBAACC,YAAgB,MAAjB;EACE,WAAW,GAAG,uDAAuD,SAAS;EACzE;EACL,GAAI;CACL,CAAA;AAEL;;ACRA,SAAgB,iBAAiB,EAAE,WAAW,KAAK,GAAG,SAAgC;CACpF,OACE,oBAACC,YAAgB,OAAjB;EACE,WAAW,GACT,yQACA,SACF;EACK;EACL,GAAI;CACL,CAAA;AAEL;;ACTA,SAAgB,mBAAmB,EACjC,WACA,UACA,KACA,GAAG,SACuB;CAC1B,OACE,oBAACC,YAAgB,SAAjB,EACE,SAAS,gBACP,qBAAC,QAAD;EACE,GAAI;EACJ,MAAK;EACL,SAAQ;EACR,WAAW,GAAG,iBAAiB,SAAS;EACnC;EACL,GAAI;EANN,UAAA,CAQG,UACD,oBAAC,MAAD;GACE,MAAK;GACL,WAAU;EACX,CAAA,CACK;CAEX,CAAA,EAAA,CAAA;AAEL;;AC9BA,MAAMC,gBAAc,OAAO,OAAOC,eAAiB;CACjD,OAAO;CACP,SAAS;AACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as ColorChannelSlider } from "../color-channel-slider-h8mUPJ35.js";
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { t as cn } from "./cn-BDi0DfT5.js";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Slider } from "@base-ui/react";
|
|
5
|
+
// src/components/color-channel-slider/color-channel-slider.types.ts
|
|
6
|
+
const colorChannelSliderVariants = cva("flex flex-col gap-xs", {
|
|
7
|
+
defaultVariants: { size: "medium" },
|
|
8
|
+
variants: { size: {
|
|
9
|
+
large: "[&_[data-slot='slider-thumb']]:size-lg [&_[data-slot='slider-thumb']]:border-4 [&_[data-slot='slider-thumb'][data-dragging]]:size-lg [&_[data-slot='slider-track'][data-orientation='horizontal']]:h-md [&_[data-slot='slider-track'][data-orientation='vertical']]:w-xs",
|
|
10
|
+
medium: "[&_[data-slot='slider-thumb']]:size-md [&_[data-slot='slider-thumb']]:border-4 [&_[data-slot='slider-thumb'][data-dragging]]:size-md [&_[data-slot='slider-track'][data-orientation='horizontal']]:h-sm [&_[data-slot='slider-track'][data-orientation='vertical']]:w-2xs",
|
|
11
|
+
small: "[&_[data-slot='slider-thumb']]:size-sm [&_[data-slot='slider-thumb']]:border-4 [&_[data-slot='slider-thumb'][data-dragging]]:size-sm [&_[data-slot='slider-track'][data-orientation='horizontal']]:h-xs [&_[data-slot='slider-track'][data-orientation='vertical']]:w-3xs"
|
|
12
|
+
} }
|
|
13
|
+
});
|
|
14
|
+
// src/components/color-channel-slider/color-channel-slider.tsx
|
|
15
|
+
const PRIMARY_THUMB_INDEX = 0;
|
|
16
|
+
function ColorChannelSlider({ size, trackStyle, className, children, "aria-label": ariaLabel = "Color value", ref, ...props }) {
|
|
17
|
+
const hasTransparency = trackStyle.some((color) => color.includes("rgba") || color.includes("hsla") || color.includes("/")), baseGradient = `linear-gradient(to right, ${trackStyle.join(", ")})`, checkerboard = "linear-gradient(45deg, #d4d4d8 25%, transparent 25%, transparent 75%, #d4d4d8 75%, #d4d4d8)";
|
|
18
|
+
let backgroundImage = baseGradient, backgroundPosition = "auto", backgroundSize = "auto";
|
|
19
|
+
if (hasTransparency) {
|
|
20
|
+
backgroundImage = [
|
|
21
|
+
baseGradient,
|
|
22
|
+
checkerboard,
|
|
23
|
+
checkerboard
|
|
24
|
+
].join(", ");
|
|
25
|
+
backgroundPosition = "0 0, 0 0, 5px 5px";
|
|
26
|
+
backgroundSize = "100% 100%, 10px 10px, 10px 10px";
|
|
27
|
+
}
|
|
28
|
+
return /* @__PURE__ */ jsx(Slider.Root, {
|
|
29
|
+
className: cn(colorChannelSliderVariants({ size }), className),
|
|
30
|
+
"data-slot": "slider-root",
|
|
31
|
+
thumbAlignment: "edge",
|
|
32
|
+
ref,
|
|
33
|
+
...props,
|
|
34
|
+
children: /* @__PURE__ */ jsx(Slider.Control, {
|
|
35
|
+
className: "shrink-0 hover:cursor-pointer data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full",
|
|
36
|
+
children: /* @__PURE__ */ jsxs(Slider.Track, {
|
|
37
|
+
"data-slot": "slider-track",
|
|
38
|
+
className: cn("relative size-full rounded-full"),
|
|
39
|
+
style: {
|
|
40
|
+
backgroundColor: "#ffffff",
|
|
41
|
+
backgroundImage,
|
|
42
|
+
backgroundPosition,
|
|
43
|
+
backgroundSize
|
|
44
|
+
},
|
|
45
|
+
children: [
|
|
46
|
+
children,
|
|
47
|
+
/* @__PURE__ */ jsx(Slider.Indicator, {
|
|
48
|
+
"data-slot": "slider-indicator",
|
|
49
|
+
className: "rounded-full"
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ jsx(Slider.Thumb, {
|
|
52
|
+
"data-slot": "slider-thumb",
|
|
53
|
+
"aria-label": ariaLabel,
|
|
54
|
+
className: cn("absolute aspect-square rounded-full border-white shadow-xs transition-[width,height,opacity] data-dragging:cursor-grabbing hover:[&:not([data-dragging])]:cursor-pointer"),
|
|
55
|
+
render: (thumbProps, state) => /* @__PURE__ */ jsx("div", {
|
|
56
|
+
...thumbProps,
|
|
57
|
+
style: {
|
|
58
|
+
...thumbProps.style,
|
|
59
|
+
backgroundColor: trackStyle[state.values[PRIMARY_THUMB_INDEX]]
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
]
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
export { ColorChannelSlider as t };
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=color-channel-slider-h8mUPJ35.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-channel-slider-h8mUPJ35.js","names":["BaseSlider"],"sources":["../src/components/color-channel-slider/color-channel-slider.types.ts","../src/components/color-channel-slider/color-channel-slider.tsx"],"sourcesContent":["import type { Slider as BaseSlider } from '@base-ui/react'\nimport { cva } from 'class-variance-authority'\nimport type { VariantProps } from 'class-variance-authority'\n\nexport type ColorChannelSliderProps = React.ComponentProps<typeof BaseSlider.Root> &\n VariantProps<typeof colorChannelSliderVariants> & {\n trackStyle: string[]\n }\n\nexport const colorChannelSliderVariants = cva('flex flex-col gap-xs', {\n defaultVariants: {\n size: 'medium',\n },\n variants: {\n size: {\n large:\n \"[&_[data-slot='slider-thumb']]:size-lg [&_[data-slot='slider-thumb']]:border-4 [&_[data-slot='slider-thumb'][data-dragging]]:size-lg [&_[data-slot='slider-track'][data-orientation='horizontal']]:h-md [&_[data-slot='slider-track'][data-orientation='vertical']]:w-xs\",\n medium:\n \"[&_[data-slot='slider-thumb']]:size-md [&_[data-slot='slider-thumb']]:border-4 [&_[data-slot='slider-thumb'][data-dragging]]:size-md [&_[data-slot='slider-track'][data-orientation='horizontal']]:h-sm [&_[data-slot='slider-track'][data-orientation='vertical']]:w-2xs\",\n small:\n \"[&_[data-slot='slider-thumb']]:size-sm [&_[data-slot='slider-thumb']]:border-4 [&_[data-slot='slider-thumb'][data-dragging]]:size-sm [&_[data-slot='slider-track'][data-orientation='horizontal']]:h-xs [&_[data-slot='slider-track'][data-orientation='vertical']]:w-3xs\",\n },\n },\n})\n","import { Slider as BaseSlider } from '@base-ui/react'\n\nimport { cn } from '@/utils/cn'\n\nimport { colorChannelSliderVariants } from './color-channel-slider.types'\nimport type { ColorChannelSliderProps } from './color-channel-slider.types'\n\nconst PRIMARY_THUMB_INDEX = 0\n\nexport function ColorChannelSlider({\n size,\n trackStyle,\n className,\n children,\n 'aria-label': ariaLabel = 'Color value',\n ref,\n ...props\n}: ColorChannelSliderProps) {\n const hasTransparency = trackStyle.some(\n (color: string) => color.includes('rgba') || color.includes('hsla') || color.includes('/'),\n ),\n baseGradient = `linear-gradient(to right, ${trackStyle.join(', ')})`,\n checkerboard =\n 'linear-gradient(45deg, #d4d4d8 25%, transparent 25%, transparent 75%, #d4d4d8 75%, #d4d4d8)'\n let backgroundImage = baseGradient,\n backgroundPosition = 'auto',\n backgroundSize = 'auto'\n if (hasTransparency) {\n backgroundImage = [baseGradient, checkerboard, checkerboard].join(', ')\n backgroundPosition = '0 0, 0 0, 5px 5px'\n backgroundSize = '100% 100%, 10px 10px, 10px 10px'\n }\n\n return (\n <BaseSlider.Root\n className={cn(colorChannelSliderVariants({ size }), className)}\n data-slot=\"slider-root\"\n thumbAlignment=\"edge\"\n ref={ref}\n {...props}\n >\n <BaseSlider.Control className=\"shrink-0 hover:cursor-pointer data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full\">\n <BaseSlider.Track\n data-slot=\"slider-track\"\n className={cn('relative size-full rounded-full')}\n style={{\n backgroundColor: '#ffffff',\n backgroundImage,\n backgroundPosition,\n backgroundSize,\n }}\n >\n {children}\n <BaseSlider.Indicator data-slot=\"slider-indicator\" className=\"rounded-full\" />\n <BaseSlider.Thumb\n data-slot=\"slider-thumb\"\n aria-label={ariaLabel}\n className={cn(\n 'absolute aspect-square rounded-full border-white shadow-xs transition-[width,height,opacity] data-dragging:cursor-grabbing hover:[&:not([data-dragging])]:cursor-pointer',\n )}\n render={(thumbProps, state) => (\n <div\n {...thumbProps}\n style={{\n ...thumbProps.style,\n backgroundColor: trackStyle[state.values[PRIMARY_THUMB_INDEX]],\n }}\n />\n )}\n />\n </BaseSlider.Track>\n </BaseSlider.Control>\n </BaseSlider.Root>\n )\n}\n"],"mappings":";;;;;AASA,MAAa,6BAA6B,IAAI,wBAAwB;CACpE,iBAAiB,EACf,MAAM,SACR;CACA,UAAU,EACR,MAAM;EACJ,OACE;EACF,QACE;EACF,OACE;CACJ,EACF;AACF,CAAC;;AChBD,MAAM,sBAAsB;AAE5B,SAAgB,mBAAmB,EACjC,MACA,YACA,WACA,UACA,cAAc,YAAY,eAC1B,KACA,GAAG,SACuB;CAC1B,MAAM,kBAAkB,WAAW,MAC9B,UAAkB,MAAM,SAAS,MAAM,KAAK,MAAM,SAAS,MAAM,KAAK,MAAM,SAAS,GAAG,CAC3F,GACA,eAAe,6BAA6B,WAAW,KAAK,IAAI,EAAE,IAClE,eACE;CACJ,IAAI,kBAAkB,cACpB,qBAAqB,QACrB,iBAAiB;CACnB,IAAI,iBAAiB;EACnB,kBAAkB;GAAC;GAAc;GAAc;EAAY,CAAC,CAAC,KAAK,IAAI;EACtE,qBAAqB;EACrB,iBAAiB;CACnB;CAEA,OACE,oBAACA,OAAW,MAAZ;EACE,WAAW,GAAG,2BAA2B,EAAE,KAAK,CAAC,GAAG,SAAS;EAC7D,aAAU;EACV,gBAAe;EACV;EACL,GAAI;EAEJ,UAAA,oBAACA,OAAW,SAAZ;GAAoB,WAAU;GAC5B,UAAA,qBAACA,OAAW,OAAZ;IACE,aAAU;IACV,WAAW,GAAG,iCAAiC;IAC/C,OAAO;KACL,iBAAiB;KACjB;KACA;KACA;IACF;IARF,UAAA;KAUG;KACD,oBAACA,OAAW,WAAZ;MAAsB,aAAU;MAAmB,WAAU;KAAgB,CAAA;KAC7E,oBAACA,OAAW,OAAZ;MACE,aAAU;MACV,cAAY;MACZ,WAAW,GACT,0KACF;MACA,SAAS,YAAY,UACnB,oBAAC,OAAD;OACE,GAAI;OACJ,OAAO;QACL,GAAG,WAAW;QACd,iBAAiB,WAAW,MAAM,OAAO;OAC3C;MACD,CAAA;KAEJ,CAAA;IACe;;EACA,CAAA;CACL,CAAA;AAErB"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { r as SelectTrigger } from "../index-CIDOd4Z8.js";
|
|
2
|
+
import { t as ColorChannelSlider } from "../index-PuhTRMce.js";
|
|
3
|
+
import { t as InputGroup } from "../index-DdFxZ3Xr.js";
|
|
4
|
+
import { VariantProps } from "class-variance-authority";
|
|
5
|
+
import React$1 from "react";
|
|
6
|
+
import chroma from "chroma-js";
|
|
7
|
+
interface ColorPickerContextType {
|
|
8
|
+
color: chroma.Color;
|
|
9
|
+
setColor: (color: chroma.Color) => void;
|
|
10
|
+
hue: number;
|
|
11
|
+
saturation: number;
|
|
12
|
+
value: number;
|
|
13
|
+
alpha: number;
|
|
14
|
+
setHue: (hue: number) => void;
|
|
15
|
+
setSaturation: (saturation: number) => void;
|
|
16
|
+
setValue: (value: number) => void;
|
|
17
|
+
setSaturationValue: (saturation: number, value: number) => void;
|
|
18
|
+
setAlpha: (alpha: number) => void;
|
|
19
|
+
setLightness: (lightness: number) => void;
|
|
20
|
+
valueType: ValueType;
|
|
21
|
+
setValueType: (valueType: ValueType) => void;
|
|
22
|
+
palette: chroma.Color[];
|
|
23
|
+
setPalette: (palette: chroma.Color[]) => void;
|
|
24
|
+
addPaletteColor: (color: chroma.Color) => void;
|
|
25
|
+
paletteLimit?: number;
|
|
26
|
+
}
|
|
27
|
+
interface ColorPickerState {
|
|
28
|
+
hue: number;
|
|
29
|
+
saturation: number;
|
|
30
|
+
value: number;
|
|
31
|
+
alpha: number;
|
|
32
|
+
valueType: ValueType;
|
|
33
|
+
palette: chroma.Color[];
|
|
34
|
+
}
|
|
35
|
+
type ColorPickerAction = {
|
|
36
|
+
type: 'set_color';
|
|
37
|
+
color: chroma.Color;
|
|
38
|
+
} | {
|
|
39
|
+
type: 'set_hue';
|
|
40
|
+
hue: number;
|
|
41
|
+
} | {
|
|
42
|
+
type: 'set_saturation';
|
|
43
|
+
saturation: number;
|
|
44
|
+
} | {
|
|
45
|
+
type: 'set_value';
|
|
46
|
+
value: number;
|
|
47
|
+
} | {
|
|
48
|
+
type: 'set_saturation_value';
|
|
49
|
+
saturation: number;
|
|
50
|
+
value: number;
|
|
51
|
+
} | {
|
|
52
|
+
type: 'set_alpha';
|
|
53
|
+
alpha: number;
|
|
54
|
+
} | {
|
|
55
|
+
type: 'set_lightness';
|
|
56
|
+
lightness: number;
|
|
57
|
+
} | {
|
|
58
|
+
type: 'set_value_type';
|
|
59
|
+
valueType: ValueType;
|
|
60
|
+
} | {
|
|
61
|
+
type: 'set_palette';
|
|
62
|
+
palette: chroma.Color[];
|
|
63
|
+
} | {
|
|
64
|
+
type: 'add_palette_color';
|
|
65
|
+
color: chroma.Color;
|
|
66
|
+
};
|
|
67
|
+
type ColorPickerProps = React.ComponentProps<'div'> & VariantProps<typeof colorPickerVariants> & {
|
|
68
|
+
value?: string;
|
|
69
|
+
onValueChange?: (color: string) => void;
|
|
70
|
+
defaultColor?: string;
|
|
71
|
+
palette?: string[];
|
|
72
|
+
defaultPalette?: string[];
|
|
73
|
+
onPaletteChange?: (palette: string[]) => void;
|
|
74
|
+
paletteLimit?: number;
|
|
75
|
+
defaultValueType?: ValueTypeValue;
|
|
76
|
+
};
|
|
77
|
+
declare const colorPickerVariants: (props?: ({
|
|
78
|
+
variant?: "elevated" | "ghost" | "outline" | null | undefined;
|
|
79
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string, colorPickerSwatchVariants: (props?: ({
|
|
80
|
+
size?: "large" | "medium" | "small" | null | undefined;
|
|
81
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string, VALUE_TYPES: ValueType[];
|
|
82
|
+
interface ValueType {
|
|
83
|
+
label: string;
|
|
84
|
+
value: string;
|
|
85
|
+
getValue: (color: chroma.Color) => string | number[];
|
|
86
|
+
parseValue: (value: string) => chroma.Color | undefined;
|
|
87
|
+
}
|
|
88
|
+
type ValueTypeValue = 'rgb' | 'css' | 'hex' | 'hsl' | 'hsv';
|
|
89
|
+
type ColorPickerInputProps = React.ComponentProps<typeof InputGroup> & {
|
|
90
|
+
showPopover?: boolean;
|
|
91
|
+
showTransparencyField?: boolean;
|
|
92
|
+
};
|
|
93
|
+
type ColorPickerAreaProps = React.ComponentProps<'div'>;
|
|
94
|
+
type ColorPickerHueSliderProps = Partial<React.ComponentProps<typeof ColorChannelSlider>>;
|
|
95
|
+
type ColorPickerLightnessSliderProps = Partial<React.ComponentProps<typeof ColorChannelSlider>>;
|
|
96
|
+
type ColorPickerTransparencySliderProps = Partial<React.ComponentProps<typeof ColorChannelSlider>>;
|
|
97
|
+
type ColorPickerValueTypeProps = React.ComponentProps<typeof SelectTrigger>;
|
|
98
|
+
type ColorPickerRowProps = React.ComponentProps<'div'>;
|
|
99
|
+
type ColorPickerGroupProps = React.ComponentProps<'div'>;
|
|
100
|
+
type ColorPickerLabelProps = React.ComponentProps<'span'>;
|
|
101
|
+
type ColorPickerPaletteListProps = React.ComponentProps<'div'>;
|
|
102
|
+
type ColorPickerPaletteSwatchProps = Omit<React.ComponentProps<'button'>, 'color'> & VariantProps<typeof colorPickerSwatchVariants> & {
|
|
103
|
+
color: string;
|
|
104
|
+
};
|
|
105
|
+
type ColorPickerPaletteAddProps = React.ComponentProps<'button'>;
|
|
106
|
+
type ColorPickerPaletteLimitProps = React.ComponentProps<'span'>;
|
|
107
|
+
declare function ColorPicker$1({ variant, value: controlledValue, defaultColor, palette: controlledPalette, defaultPalette, onPaletteChange, paletteLimit, defaultValueType, onValueChange, className, ref, ...props }: ColorPickerProps): React$1.JSX.Element;
|
|
108
|
+
export declare function ColorPickerArea({ className, ref, ...props }: ColorPickerAreaProps): import("react").JSX.Element;
|
|
109
|
+
export declare function ColorPickerGroup({ className, ref, ...props }: ColorPickerGroupProps): import("react").JSX.Element;
|
|
110
|
+
export declare function ColorPickerHueSlider({ className, ref, ...props }: ColorPickerHueSliderProps): import("react").JSX.Element;
|
|
111
|
+
export declare function ColorPickerInput({ showPopover, showTransparencyField, className, children, ref, ...props }: ColorPickerInputProps): React$1.JSX.Element;
|
|
112
|
+
export declare function ColorPickerLabel({ className, ref, ...props }: ColorPickerLabelProps): import("react").JSX.Element;
|
|
113
|
+
export declare function ColorPickerLightnessSlider({ className, ref, ...props }: ColorPickerLightnessSliderProps): import("react").JSX.Element;
|
|
114
|
+
declare function ColorPickerPaletteAdd({ className, children, ref, ...props }: ColorPickerPaletteAddProps): import("react").JSX.Element;
|
|
115
|
+
export declare function ColorPickerPaletteLimit({ className, children, ref, ...props }: ColorPickerPaletteLimitProps): false | import("react").JSX.Element;
|
|
116
|
+
export declare function ColorPickerPaletteList({ className, children, ref, ...props }: ColorPickerPaletteListProps): import("react").JSX.Element;
|
|
117
|
+
export declare function ColorPickerPaletteSwatch({ size, color, className, children, ref, ...props }: ColorPickerPaletteSwatchProps): import("react").JSX.Element;
|
|
118
|
+
export declare function ColorPickerRow({ className, ref, ...props }: ColorPickerRowProps): import("react").JSX.Element;
|
|
119
|
+
export declare function ColorPickerTransparencySlider({ className, ref, ...props }: ColorPickerTransparencySliderProps): import("react").JSX.Element;
|
|
120
|
+
export declare function ColorPickerValueType({ className, children, ref, ...props }: ColorPickerValueTypeProps): import("react").JSX.Element;
|
|
121
|
+
declare const ColorPicker: typeof ColorPicker$1 & {
|
|
122
|
+
Area: typeof ColorPickerArea;
|
|
123
|
+
Group: typeof ColorPickerGroup;
|
|
124
|
+
HueSlider: typeof ColorPickerHueSlider;
|
|
125
|
+
Input: typeof ColorPickerInput;
|
|
126
|
+
Label: typeof ColorPickerLabel;
|
|
127
|
+
LightnessSlider: typeof ColorPickerLightnessSlider;
|
|
128
|
+
PaletteAdd: typeof ColorPickerPaletteAdd;
|
|
129
|
+
PaletteLimit: typeof ColorPickerPaletteLimit;
|
|
130
|
+
PaletteList: typeof ColorPickerPaletteList;
|
|
131
|
+
PaletteSwatch: typeof ColorPickerPaletteSwatch;
|
|
132
|
+
Row: typeof ColorPickerRow;
|
|
133
|
+
TransparencySlider: typeof ColorPickerTransparencySlider;
|
|
134
|
+
ValueType: typeof ColorPickerValueType;
|
|
135
|
+
};
|
|
136
|
+
export { ColorPicker, type ColorPickerAction, type ColorPickerAreaProps, type ColorPickerContextType, type ColorPickerGroupProps, type ColorPickerHueSliderProps, type ColorPickerInputProps, type ColorPickerLabelProps, type ColorPickerLightnessSliderProps, type ColorPickerPaletteAddProps, type ColorPickerPaletteLimitProps, type ColorPickerPaletteListProps, type ColorPickerPaletteSwatchProps, type ColorPickerProps, type ColorPickerRowProps, type ColorPickerState, type ColorPickerTransparencySliderProps, type ColorPickerValueTypeProps };
|
|
137
|
+
//# sourceMappingURL=index.d.ts.map
|