@frontify/fondue-components 17.0.0 → 17.1.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/dist/fondue-components25.js +27 -25
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components34.js +1 -1
- package/dist/fondue-components34.js.map +1 -1
- package/dist/fondue-components39.js +43 -31
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components40.js +11 -11
- package/dist/fondue-components40.js.map +1 -1
- package/dist/fondue-components61.js +1 -1
- package/dist/fondue-components64.js +1 -1
- package/dist/fondue-components71.js +13 -13
- package/dist/fondue-components77.js +39 -16
- package/dist/fondue-components77.js.map +1 -1
- package/dist/fondue-components78.js +16 -39
- package/dist/fondue-components78.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as a, jsxs as u } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as x, forwardRef as i, useContext as b, useRef as
|
|
3
|
-
import { IconDotsHorizontal as
|
|
2
|
+
import { createContext as x, forwardRef as i, useContext as b, useRef as D, useEffect as E, useCallback as O, createElement as N } from "react";
|
|
3
|
+
import { IconDotsHorizontal as V } from "@frontify/fondue-icons";
|
|
4
4
|
import * as d from "@radix-ui/react-tabs";
|
|
5
|
-
import { useControllableState as
|
|
6
|
-
import { Button as
|
|
5
|
+
import { useControllableState as q } from "./fondue-components57.js";
|
|
6
|
+
import { Button as B } from "./fondue-components5.js";
|
|
7
7
|
import { Dropdown as l } from "./fondue-components10.js";
|
|
8
|
-
import { useTabTriggers as
|
|
8
|
+
import { useTabTriggers as H } from "./fondue-components70.js";
|
|
9
9
|
import r from "./fondue-components71.js";
|
|
10
|
-
const
|
|
10
|
+
const f = x({
|
|
11
11
|
value: "",
|
|
12
12
|
disabled: !1
|
|
13
13
|
}), w = x({
|
|
@@ -20,33 +20,35 @@ const T = x({
|
|
|
20
20
|
size: n = "medium",
|
|
21
21
|
onActiveTabChange: c,
|
|
22
22
|
children: m,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
variant: p = "default",
|
|
24
|
+
...k
|
|
25
|
+
}, P) => {
|
|
25
26
|
var R;
|
|
26
|
-
const [
|
|
27
|
+
const [T, v] = q({
|
|
27
28
|
prop: o,
|
|
28
29
|
defaultProp: s,
|
|
29
30
|
onChange: c
|
|
30
|
-
}), g =
|
|
31
|
+
}), g = O(
|
|
31
32
|
(e) => {
|
|
32
33
|
v(e);
|
|
33
34
|
},
|
|
34
35
|
[v]
|
|
35
|
-
), { triggerListRef:
|
|
36
|
-
activeTab:
|
|
36
|
+
), { triggerListRef: S, activeIndicatorRef: j, triggers: C, triggersOutOfView: h, addTrigger: A } = H({
|
|
37
|
+
activeTab: T
|
|
37
38
|
});
|
|
38
|
-
return /* @__PURE__ */ a(w.Provider, { value: { addTrigger:
|
|
39
|
+
return /* @__PURE__ */ a(w.Provider, { value: { addTrigger: A }, children: /* @__PURE__ */ u(
|
|
39
40
|
d.Root,
|
|
40
41
|
{
|
|
41
|
-
ref:
|
|
42
|
+
ref: P,
|
|
42
43
|
className: r.root,
|
|
43
44
|
onValueChange: g,
|
|
44
|
-
value:
|
|
45
|
+
value: T ?? ((R = C[0]) == null ? void 0 : R.value),
|
|
45
46
|
"data-tabs-content-padding": t,
|
|
46
|
-
|
|
47
|
+
"data-tabs-variant": p,
|
|
48
|
+
...k,
|
|
47
49
|
children: [
|
|
48
50
|
/* @__PURE__ */ u("div", { className: r.triggerListWrapper, children: [
|
|
49
|
-
/* @__PURE__ */ a(d.List, { ref:
|
|
51
|
+
/* @__PURE__ */ a(d.List, { ref: S, "data-size": n, className: r.triggerList, children: C.map((e) => /* @__PURE__ */ N(
|
|
50
52
|
d.Trigger,
|
|
51
53
|
{
|
|
52
54
|
...e.props,
|
|
@@ -59,7 +61,7 @@ const T = x({
|
|
|
59
61
|
e.element
|
|
60
62
|
)) }),
|
|
61
63
|
/* @__PURE__ */ u(l.Root, { children: [
|
|
62
|
-
h.length > 0 && /* @__PURE__ */ a(l.Trigger, { "data-test-id": "overflow-items-dropdown-trigger", children: /* @__PURE__ */ a(
|
|
64
|
+
h.length > 0 && /* @__PURE__ */ a(l.Trigger, { "data-test-id": "overflow-items-dropdown-trigger", children: /* @__PURE__ */ a(B, { emphasis: "default", aspect: "square", size: "small", children: /* @__PURE__ */ a(V, { size: 16 }) }) }),
|
|
63
65
|
/* @__PURE__ */ a(l.Content, { align: "end", "data-test-id": "overflow-items-dropdown-content", children: h.map((e) => /* @__PURE__ */ N(
|
|
64
66
|
l.Item,
|
|
65
67
|
{
|
|
@@ -75,7 +77,7 @@ const T = x({
|
|
|
75
77
|
"span",
|
|
76
78
|
{
|
|
77
79
|
"data-test-id": "active-tab-indicator",
|
|
78
|
-
ref:
|
|
80
|
+
ref: j,
|
|
79
81
|
className: r.activeIndicator
|
|
80
82
|
}
|
|
81
83
|
)
|
|
@@ -86,11 +88,11 @@ const T = x({
|
|
|
86
88
|
) });
|
|
87
89
|
};
|
|
88
90
|
y.displayName = "Tabs.Root";
|
|
89
|
-
const z = ({ children: t, value: o, disabled: s }) => /* @__PURE__ */ a(
|
|
91
|
+
const z = ({ children: t, value: o, disabled: s }) => /* @__PURE__ */ a(f.Provider, { value: { value: o, disabled: s }, children: t });
|
|
90
92
|
z.displayName = "Tabs.Tab";
|
|
91
93
|
const I = ({ children: t, ...o }, s) => {
|
|
92
|
-
const { value: n, disabled: c } = b(
|
|
93
|
-
return
|
|
94
|
+
const { value: n, disabled: c } = b(f), { addTrigger: m } = b(w), p = D(null);
|
|
95
|
+
return E(() => {
|
|
94
96
|
m({
|
|
95
97
|
ref: p || s,
|
|
96
98
|
value: n ?? "",
|
|
@@ -102,18 +104,18 @@ const I = ({ children: t, ...o }, s) => {
|
|
|
102
104
|
};
|
|
103
105
|
I.displayName = "Tabs.Trigger";
|
|
104
106
|
const L = ({ children: t, ...o }, s) => {
|
|
105
|
-
const { value: n } = b(
|
|
107
|
+
const { value: n } = b(f);
|
|
106
108
|
return /* @__PURE__ */ a(d.Content, { ref: s, ...o, className: r.content, value: n ?? "", children: t });
|
|
107
109
|
};
|
|
108
110
|
L.displayName = "Tabs.Content";
|
|
109
|
-
const
|
|
111
|
+
const X = {
|
|
110
112
|
Root: i(y),
|
|
111
113
|
Tab: i(z),
|
|
112
114
|
Trigger: i(I),
|
|
113
115
|
Content: i(L)
|
|
114
116
|
};
|
|
115
117
|
export {
|
|
116
|
-
|
|
118
|
+
X as Tabs,
|
|
117
119
|
L as TabsContent,
|
|
118
120
|
y as TabsRoot,
|
|
119
121
|
z as TabsTab,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components25.js","sources":["../src/components/Tabs/Tabs.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconDotsHorizontal } from '@frontify/fondue-icons';\nimport * as RadixTabs from '@radix-ui/react-tabs';\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useRef,\n type ForwardedRef,\n type ReactNode,\n} from 'react';\n\nimport { useControllableState } from '#/hooks/useControllableState';\n\nimport { Button } from '../Button/Button';\nimport { Dropdown } from '../Dropdown/Dropdown';\n\nimport { useTabTriggers } from './hooks/useTabTriggers';\nimport styles from './styles/tabs.module.scss';\nimport { type TabTrigger } from './types';\n\nexport type TabsRootProps = {\n id?: string;\n children: ReactNode;\n /**\n * Define the padding of the dialog\n * @default \"compact\"\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * The default active tab\n * Used for uncontrolled components\n */\n defaultActiveTab?: string;\n /**\n * The controlled value of the active tab\n */\n activeTab?: string;\n /**\n * The height of the tabs\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /**\n * Event handler called when the active tab changes\n */\n onActiveTabChange?: (value: string) => void;\n};\n\nconst TabConfigContext = createContext<{\n value: string;\n disabled?: boolean;\n}>({\n value: '',\n disabled: false,\n});\n\nconst TabTriggerContext = createContext<{\n addTrigger: (trigger: TabTrigger) => void;\n}>({\n addTrigger: () => {},\n});\n\nexport const TabsRoot = (\n {\n padding = 'compact',\n activeTab: propsActiveTab,\n defaultActiveTab,\n size = 'medium',\n onActiveTabChange,\n children,\n ...props\n }: TabsRootProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const [activeTab, setActiveTab] = useControllableState({\n prop: propsActiveTab,\n defaultProp: defaultActiveTab,\n onChange: onActiveTabChange,\n });\n\n const handleSetActiveTab = useCallback(\n (value: string) => {\n setActiveTab(value);\n },\n [setActiveTab],\n );\n\n const { triggerListRef, activeIndicatorRef, triggers, triggersOutOfView, addTrigger } = useTabTriggers({\n activeTab,\n });\n\n return (\n <TabTriggerContext.Provider value={{ addTrigger }}>\n <RadixTabs.Root\n ref={ref}\n className={styles.root}\n onValueChange={handleSetActiveTab}\n value={activeTab ?? triggers[0]?.value}\n data-tabs-content-padding={padding}\n {...props}\n >\n <div className={styles.triggerListWrapper}>\n <RadixTabs.List ref={triggerListRef} data-size={size} className={styles.triggerList}>\n {triggers.map((trigger) => (\n <RadixTabs.Trigger\n {...trigger.props}\n key={trigger.value}\n value={trigger.value}\n disabled={trigger.disabled}\n className={styles.trigger}\n ref={trigger.ref}\n >\n {trigger.element}\n </RadixTabs.Trigger>\n ))}\n </RadixTabs.List>\n <Dropdown.Root>\n {triggersOutOfView.length > 0 && (\n <Dropdown.Trigger data-test-id=\"overflow-items-dropdown-trigger\">\n <Button emphasis=\"default\" aspect=\"square\" size=\"small\">\n <IconDotsHorizontal size={16} />\n </Button>\n </Dropdown.Trigger>\n )}\n <Dropdown.Content align=\"end\" data-test-id=\"overflow-items-dropdown-content\">\n {triggersOutOfView.map((trigger) => (\n <Dropdown.Item\n {...trigger.props}\n disabled={trigger.disabled}\n onSelect={() => handleSetActiveTab(trigger.value)}\n key={trigger.value}\n >\n {trigger.element}\n </Dropdown.Item>\n ))}\n </Dropdown.Content>\n </Dropdown.Root>\n <span\n data-test-id=\"active-tab-indicator\"\n ref={activeIndicatorRef}\n className={styles.activeIndicator}\n />\n </div>\n {children}\n </RadixTabs.Root>\n </TabTriggerContext.Provider>\n );\n};\nTabsRoot.displayName = 'Tabs.Root';\n\ntype TabsTabProps = {\n children: ReactNode;\n value: string;\n disabled?: boolean;\n};\n\nexport const TabsTab = ({ children, value, disabled }: TabsTabProps) => (\n <TabConfigContext.Provider value={{ value, disabled }}>{children}</TabConfigContext.Provider>\n);\nTabsTab.displayName = 'Tabs.Tab';\n\ntype TabsTriggerProps = {\n children: ReactNode;\n};\n\nexport const TabsTrigger = ({ children, ...props }: TabsTriggerProps, ref: ForwardedRef<HTMLButtonElement>) => {\n const { value, disabled } = useContext(TabConfigContext);\n\n const { addTrigger } = useContext(TabTriggerContext);\n\n const localRef = useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n addTrigger({\n ref: localRef || ref,\n value: value ?? '',\n disabled,\n props,\n element: children,\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return null;\n};\nTabsTrigger.displayName = 'Tabs.Trigger';\n\ntype TabsContentProps = {\n children: ReactNode;\n};\n\nexport const TabsContent = ({ children, ...itemProps }: TabsContentProps, ref: ForwardedRef<HTMLDivElement>) => {\n const { value } = useContext(TabConfigContext);\n\n return (\n <RadixTabs.Content ref={ref} {...itemProps} className={styles.content} value={value ?? ''}>\n {children}\n </RadixTabs.Content>\n );\n};\nTabsContent.displayName = 'Tabs.Content';\n\nexport const Tabs = {\n Root: forwardRef<HTMLDivElement, TabsRootProps>(TabsRoot),\n Tab: forwardRef<HTMLDivElement, TabsTabProps>(TabsTab),\n Trigger: forwardRef<HTMLButtonElement, TabsTriggerProps>(TabsTrigger),\n Content: forwardRef<HTMLDivElement, TabsContentProps>(TabsContent),\n};\n"],"names":["TabConfigContext","createContext","TabTriggerContext","TabsRoot","padding","propsActiveTab","defaultActiveTab","size","onActiveTabChange","children","props","ref","activeTab","setActiveTab","useControllableState","handleSetActiveTab","useCallback","value","triggerListRef","activeIndicatorRef","triggers","triggersOutOfView","addTrigger","useTabTriggers","jsxs","RadixTabs","styles","_a","jsx","trigger","createElement","Dropdown","Button","IconDotsHorizontal","TabsTab","disabled","TabsTrigger","useContext","localRef","useRef","useEffect","TabsContent","itemProps","Tabs","forwardRef"],"mappings":";;;;;;;;;AAoDA,MAAMA,IAAmBC,EAGtB;AAAA,EACC,OAAO;AAAA,EACP,UAAU;AACd,CAAC,GAEKC,IAAoBD,EAEvB;AAAA,EACC,YAAY,MAAM;AAAA,EAAA;AACtB,CAAC,GAEYE,IAAW,CACpB;AAAA,EACI,SAAAC,IAAU;AAAA,EACV,WAAWC;AAAA,EACX,kBAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,mBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACP,GACAC,MACC;;AACD,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAAqB;AAAA,IACnD,MAAMT;AAAA,IACN,aAAaC;AAAA,IACb,UAAUE;AAAA,EAAA,CACb,GAEKO,IAAqBC;AAAA,IACvB,CAACC,MAAkB;AACf,MAAAJ,EAAaI,CAAK;AAAA,IACtB;AAAA,IACA,CAACJ,CAAY;AAAA,EACjB,GAEM,EAAE,gBAAAK,GAAgB,oBAAAC,GAAoB,UAAAC,GAAU,mBAAAC,GAAmB,YAAAC,MAAeC,EAAe;AAAA,IACnG,WAAAX;AAAA,EAAA,CACH;AAED,2BACKV,EAAkB,UAAlB,EAA2B,OAAO,EAAE,YAAAoB,KACjC,UAAA,gBAAAE;AAAA,IAACC,EAAU;AAAA,IAAV;AAAA,MACG,KAAAd;AAAA,MACA,WAAWe,EAAO;AAAA,MAClB,eAAeX;AAAA,MACf,OAAOH,OAAae,IAAAP,EAAS,CAAC,MAAV,gBAAAO,EAAa;AAAA,MACjC,6BAA2BvB;AAAA,MAC1B,GAAGM;AAAA,MAEJ,UAAA;AAAA,QAAC,gBAAAc,EAAA,OA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EAAS,cAAc;AAQhB,MAAM+B,IAAU,CAAC,EAAE,UAAAzB,GAAU,OAAAQ,GAAO,UAAAkB,EACvC,MAAA,gBAAAP,EAAC5B,EAAiB,UAAjB,EAA0B,OAAO,EAAE,OAAAiB,GAAO,UAAAkB,EAAA,GAAa,UAAA1B,EAAS,CAAA;AAErEyB,EAAQ,cAAc;AAMf,MAAME,IAAc,CAAC,EAAE,UAAA3B,GAAU,GAAGC,EAAA,GAA2BC,MAAyC;AAC3G,QAAM,EAAE,OAAAM,GAAO,UAAAkB,MAAaE,EAAWrC,CAAgB,GAEjD,EAAE,YAAAsB,EAAA,IAAee,EAAWnC,CAAiB,GAE7CoC,IAAWC,EAA0B,IAAI;AAE/C,SAAAC,EAAU,MAAM;AACD,IAAAlB,EAAA;AAAA,MACP,KAAKgB,KAAY3B;AAAA,MACjB,OAAOM,KAAS;AAAA,MAChB,UAAAkB;AAAA,MACA,OAAAzB;AAAA,MACA,SAASD;AAAA,IAAA,CACZ;AAAA,EAEL,GAAG,EAAE,GAEE;AACX;AACA2B,EAAY,cAAc;AAMnB,MAAMK,IAAc,CAAC,EAAE,UAAAhC,GAAU,GAAGiC,EAAA,GAA+B/B,MAAsC;AAC5G,QAAM,EAAE,OAAAM,EAAA,IAAUoB,EAAWrC,CAAgB;AAE7C,SACK,gBAAA4B,EAAAH,EAAU,SAAV,EAAkB,KAAAd,GAAW,GAAG+B,GAAW,WAAWhB,EAAO,SAAS,OAAOT,KAAS,IAClF,UAAAR,EACL,CAAA;AAER;AACAgC,EAAY,cAAc;AAEnB,MAAME,IAAO;AAAA,EAChB,MAAMC,EAA0CzC,CAAQ;AAAA,EACxD,KAAKyC,EAAyCV,CAAO;AAAA,EACrD,SAASU,EAAgDR,CAAW;AAAA,EACpE,SAASQ,EAA6CH,CAAW;AACrE;"}
|
|
1
|
+
{"version":3,"file":"fondue-components25.js","sources":["../src/components/Tabs/Tabs.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconDotsHorizontal } from '@frontify/fondue-icons';\nimport * as RadixTabs from '@radix-ui/react-tabs';\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useRef,\n type ForwardedRef,\n type ReactNode,\n} from 'react';\n\nimport { useControllableState } from '#/hooks/useControllableState';\n\nimport { Button } from '../Button/Button';\nimport { Dropdown } from '../Dropdown/Dropdown';\n\nimport { useTabTriggers } from './hooks/useTabTriggers';\nimport styles from './styles/tabs.module.scss';\nimport { type TabTrigger } from './types';\n\nexport type TabsRootProps = {\n id?: string;\n children: ReactNode;\n /**\n * Define the padding of the dialog\n * @default \"compact\"\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * The default active tab\n * Used for uncontrolled components\n */\n defaultActiveTab?: string;\n /**\n * The controlled value of the active tab\n */\n activeTab?: string;\n /**\n * The height of the tabs\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /**\n * Event handler called when the active tab changes\n */\n onActiveTabChange?: (value: string) => void;\n /**\n * Select the used variant\n * “default 'default'\n */\n variant?: 'default' | 'pill';\n};\n\nconst TabConfigContext = createContext<{\n value: string;\n disabled?: boolean;\n}>({\n value: '',\n disabled: false,\n});\n\nconst TabTriggerContext = createContext<{\n addTrigger: (trigger: TabTrigger) => void;\n}>({\n addTrigger: () => {},\n});\n\nexport const TabsRoot = (\n {\n padding = 'compact',\n activeTab: propsActiveTab,\n defaultActiveTab,\n size = 'medium',\n onActiveTabChange,\n children,\n variant = 'default',\n ...props\n }: TabsRootProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const [activeTab, setActiveTab] = useControllableState({\n prop: propsActiveTab,\n defaultProp: defaultActiveTab,\n onChange: onActiveTabChange,\n });\n\n const handleSetActiveTab = useCallback(\n (value: string) => {\n setActiveTab(value);\n },\n [setActiveTab],\n );\n\n const { triggerListRef, activeIndicatorRef, triggers, triggersOutOfView, addTrigger } = useTabTriggers({\n activeTab,\n });\n\n return (\n <TabTriggerContext.Provider value={{ addTrigger }}>\n <RadixTabs.Root\n ref={ref}\n className={styles.root}\n onValueChange={handleSetActiveTab}\n value={activeTab ?? triggers[0]?.value}\n data-tabs-content-padding={padding}\n data-tabs-variant={variant}\n {...props}\n >\n <div className={styles.triggerListWrapper}>\n <RadixTabs.List ref={triggerListRef} data-size={size} className={styles.triggerList}>\n {triggers.map((trigger) => (\n <RadixTabs.Trigger\n {...trigger.props}\n key={trigger.value}\n value={trigger.value}\n disabled={trigger.disabled}\n className={styles.trigger}\n ref={trigger.ref}\n >\n {trigger.element}\n </RadixTabs.Trigger>\n ))}\n </RadixTabs.List>\n <Dropdown.Root>\n {triggersOutOfView.length > 0 && (\n <Dropdown.Trigger data-test-id=\"overflow-items-dropdown-trigger\">\n <Button emphasis=\"default\" aspect=\"square\" size=\"small\">\n <IconDotsHorizontal size={16} />\n </Button>\n </Dropdown.Trigger>\n )}\n <Dropdown.Content align=\"end\" data-test-id=\"overflow-items-dropdown-content\">\n {triggersOutOfView.map((trigger) => (\n <Dropdown.Item\n {...trigger.props}\n disabled={trigger.disabled}\n onSelect={() => handleSetActiveTab(trigger.value)}\n key={trigger.value}\n >\n {trigger.element}\n </Dropdown.Item>\n ))}\n </Dropdown.Content>\n </Dropdown.Root>\n <span\n data-test-id=\"active-tab-indicator\"\n ref={activeIndicatorRef}\n className={styles.activeIndicator}\n />\n </div>\n {children}\n </RadixTabs.Root>\n </TabTriggerContext.Provider>\n );\n};\nTabsRoot.displayName = 'Tabs.Root';\n\ntype TabsTabProps = {\n children: ReactNode;\n value: string;\n disabled?: boolean;\n};\n\nexport const TabsTab = ({ children, value, disabled }: TabsTabProps) => (\n <TabConfigContext.Provider value={{ value, disabled }}>{children}</TabConfigContext.Provider>\n);\nTabsTab.displayName = 'Tabs.Tab';\n\ntype TabsTriggerProps = {\n children: ReactNode;\n};\n\nexport const TabsTrigger = ({ children, ...props }: TabsTriggerProps, ref: ForwardedRef<HTMLButtonElement>) => {\n const { value, disabled } = useContext(TabConfigContext);\n\n const { addTrigger } = useContext(TabTriggerContext);\n\n const localRef = useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n addTrigger({\n ref: localRef || ref,\n value: value ?? '',\n disabled,\n props,\n element: children,\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return null;\n};\nTabsTrigger.displayName = 'Tabs.Trigger';\n\ntype TabsContentProps = {\n children: ReactNode;\n};\n\nexport const TabsContent = ({ children, ...itemProps }: TabsContentProps, ref: ForwardedRef<HTMLDivElement>) => {\n const { value } = useContext(TabConfigContext);\n\n return (\n <RadixTabs.Content ref={ref} {...itemProps} className={styles.content} value={value ?? ''}>\n {children}\n </RadixTabs.Content>\n );\n};\nTabsContent.displayName = 'Tabs.Content';\n\nexport const Tabs = {\n Root: forwardRef<HTMLDivElement, TabsRootProps>(TabsRoot),\n Tab: forwardRef<HTMLDivElement, TabsTabProps>(TabsTab),\n Trigger: forwardRef<HTMLButtonElement, TabsTriggerProps>(TabsTrigger),\n Content: forwardRef<HTMLDivElement, TabsContentProps>(TabsContent),\n};\n"],"names":["TabConfigContext","createContext","TabTriggerContext","TabsRoot","padding","propsActiveTab","defaultActiveTab","size","onActiveTabChange","children","variant","props","ref","activeTab","setActiveTab","useControllableState","handleSetActiveTab","useCallback","value","triggerListRef","activeIndicatorRef","triggers","triggersOutOfView","addTrigger","useTabTriggers","jsxs","RadixTabs","styles","_a","jsx","trigger","createElement","Dropdown","Button","IconDotsHorizontal","TabsTab","disabled","TabsTrigger","useContext","localRef","useRef","useEffect","TabsContent","itemProps","Tabs","forwardRef"],"mappings":";;;;;;;;;AAyDA,MAAMA,IAAmBC,EAGtB;AAAA,EACC,OAAO;AAAA,EACP,UAAU;AACd,CAAC,GAEKC,IAAoBD,EAEvB;AAAA,EACC,YAAY,MAAM;AAAA,EAAA;AACtB,CAAC,GAEYE,IAAW,CACpB;AAAA,EACI,SAAAC,IAAU;AAAA,EACV,WAAWC;AAAA,EACX,kBAAAC;AAAA,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CqC,IAAWC,EAA0B,IAAI;AAE/C,SAAAC,EAAU,MAAM;AACD,IAAAlB,EAAA;AAAA,MACP,KAAKgB,KAAY3B;AAAA,MACjB,OAAOM,KAAS;AAAA,MAChB,UAAAkB;AAAA,MACA,OAAAzB;AAAA,MACA,SAASF;AAAA,IAAA,CACZ;AAAA,EAEL,GAAG,EAAE,GAEE;AACX;AACA4B,EAAY,cAAc;AAMnB,MAAMK,IAAc,CAAC,EAAE,UAAAjC,GAAU,GAAGkC,EAAA,GAA+B/B,MAAsC;AAC5G,QAAM,EAAE,OAAAM,EAAA,IAAUoB,EAAWtC,CAAgB;AAE7C,SACK,gBAAA6B,EAAAH,EAAU,SAAV,EAAkB,KAAAd,GAAW,GAAG+B,GAAW,WAAWhB,EAAO,SAAS,OAAOT,KAAS,IAClF,UAAAT,EACL,CAAA;AAER;AACAiC,EAAY,cAAc;AAEnB,MAAME,IAAO;AAAA,EAChB,MAAMC,EAA0C1C,CAAQ;AAAA,EACxD,KAAK0C,EAAyCV,CAAO;AAAA,EACrD,SAASU,EAAgDR,CAAW;AAAA,EACpE,SAASQ,EAA6CH,CAAW;AACrE;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FOCUS_OUTLINE as t } from "./fondue-components76.js";
|
|
2
2
|
import { sv as e } from "./fondue-components33.js";
|
|
3
3
|
const o = e({
|
|
4
|
-
base: `tw-group tw-relative tw-flex tw-flex-row tw-gap-2 tw-items-center tw-justify-center tw-cursor-pointer tw-font-body tw-font-medium tw-box-border tw-whitespace-nowrap ${t}`,
|
|
4
|
+
base: `tw-group tw-relative tw-flex tw-flex-row tw-gap-2 tw-items-center tw-justify-center tw-cursor-pointer tw-font-body tw-font-medium tw-box-border tw-whitespace-nowrap tw-transition-colors ${t}`,
|
|
5
5
|
variants: {
|
|
6
6
|
disabled: {
|
|
7
7
|
true: "tw-not-allowed tw-pointer-events-none tw-text-box-disabled-inverse tw-bg-box-disabled"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components34.js","sources":["../src/components/Button/styles/buttonStyles.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { FOCUS_OUTLINE } from '#/utilities/focusStyle';\nimport { sv } from '#/utilities/styleUtilities';\n\nexport const buttonStyles = sv({\n base:\n 'tw-group tw-relative tw-flex tw-flex-row tw-gap-2 tw-items-center tw-justify-center tw-cursor-pointer tw-font-body tw-font-medium tw-box-border tw-whitespace-nowrap ' +\n `${FOCUS_OUTLINE}`,\n variants: {\n disabled: {\n true: 'tw-not-allowed tw-pointer-events-none tw-text-box-disabled-inverse tw-bg-box-disabled',\n },\n rounding: {\n medium: 'tw-rounded',\n full: 'tw-rounded-full',\n },\n size: {\n small: 'tw-h-6 tw-text-body-small',\n medium: 'tw-h-9 tw-text-body-medium',\n large: 'tw-h-12 tw-text-body-large',\n },\n aspect: {\n square: 'tw-aspect-square tw-px-0',\n default: '',\n },\n hugWidth: {\n false: 'tw-w-full',\n },\n emphasis: {\n default: '',\n weak: '',\n strong: '',\n },\n variant: {\n default: '',\n positive: '',\n negative: '',\n danger: '',\n loud: '',\n },\n },\n compoundVariants: [\n {\n disabled: false,\n variant: 'default',\n emphasis: 'default',\n class:\n 'tw-bg-button-background ' +\n 'hover:tw-bg-button-background-hover ' +\n 'active:tw-bg-button-background-pressed',\n },\n {\n disabled: false,\n variant: 'default',\n emphasis: 'weak',\n class: 'hover:tw-bg-button-background-hover active:tw-bg-button-background-pressed',\n },\n {\n disabled: false,\n variant: 'default',\n emphasis: 'strong',\n class:\n 'tw-bg-button-strong-background ' +\n 'hover:tw-bg-button-strong-background-hover ' +\n 'active:tw-bg-button-strong-background-pressed',\n },\n {\n disabled: false,\n variant: 'positive',\n emphasis: 'default',\n class:\n 'tw-bg-button-positive-background ' +\n 'hover:tw-bg-button-positive-background-hover ' +\n 'active:tw-bg-button-positive-background-pressed',\n },\n {\n disabled: false,\n variant: 'positive',\n emphasis: 'weak',\n class: 'hover:tw-bg-button-positive-background-hover active:tw-bg-button-positive-background-pressed',\n },\n {\n disabled: false,\n variant: 'positive',\n emphasis: 'strong',\n class:\n 'tw-bg-button-strong-positive-background ' +\n 'hover:tw-bg-button-strong-positive-background-hover ' +\n 'active:tw-bg-button-strong-positive-background-pressed',\n },\n {\n disabled: false,\n variant: 'negative',\n emphasis: 'default',\n class:\n 'tw-bg-button-negative-background ' +\n 'hover:tw-bg-button-negative-background-hover ' +\n 'active:tw-bg-button-negative-background-pressed',\n },\n {\n disabled: false,\n variant: 'negative',\n emphasis: 'weak',\n class: 'hover:tw-bg-button-negative-background-hover active:tw-bg-button-negative-background-pressed',\n },\n {\n disabled: false,\n variant: 'negative',\n emphasis: 'strong',\n class:\n 'tw-bg-button-strong-negative-background ' +\n 'hover:tw-bg-button-strong-negative-background-hover ' +\n 'active:tw-bg-button-strong-negative-background-pressed',\n },\n {\n disabled: false,\n variant: 'danger',\n emphasis: 'default',\n class:\n 'tw-bg-button-background ' +\n 'hover:tw-bg-button-background-hover ' +\n 'active:tw-bg-button-background-pressed',\n },\n {\n disabled: false,\n variant: 'danger',\n emphasis: 'weak',\n class: 'hover:tw-bg-button-background-hover active:tw-bg-button-background-pressed',\n },\n {\n disabled: false,\n variant: 'danger',\n emphasis: 'strong',\n class:\n 'tw-bg-button-danger-background ' +\n 'hover:tw-bg-button-danger-background-hover ' +\n 'active:tw-bg-button-danger-background-pressed',\n },\n {\n disabled: false,\n variant: 'loud',\n emphasis: 'default',\n class: 'tw-bg-box-selected hover:tw-bg-box-selected-hover active:tw-bg-box-selected-pressed',\n },\n {\n disabled: false,\n variant: 'loud',\n emphasis: 'weak',\n class: 'tw-border-transparent hover:tw-bg-box-selected-hover active:tw-bg-box-selected-pressed',\n },\n {\n disabled: false,\n variant: 'loud',\n emphasis: 'strong',\n class:\n 'tw-bg-box-selected-strong ' +\n 'hover:tw-bg-box-selected-strong-hover ' +\n 'active:tw-bg-box-selected-strong-pressed ',\n },\n {\n aspect: 'default',\n size: 'small',\n class: 'tw-px-2',\n },\n {\n aspect: 'default',\n size: 'medium',\n class: 'tw-px-4',\n },\n {\n aspect: 'default',\n size: 'large',\n class: 'tw-px-6',\n },\n ],\n defaultVariants: {\n variant: 'default',\n emphasis: 'strong',\n size: 'medium',\n rounding: 'medium',\n hugWidth: true,\n aspect: 'default',\n disabled: false,\n },\n});\n"],"names":["buttonStyles","sv","FOCUS_OUTLINE"],"mappings":";;AAKO,MAAMA,IAAeC,EAAG;AAAA,EAC3B,MACI,
|
|
1
|
+
{"version":3,"file":"fondue-components34.js","sources":["../src/components/Button/styles/buttonStyles.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { FOCUS_OUTLINE } from '#/utilities/focusStyle';\nimport { sv } from '#/utilities/styleUtilities';\n\nexport const buttonStyles = sv({\n base:\n 'tw-group tw-relative tw-flex tw-flex-row tw-gap-2 tw-items-center tw-justify-center tw-cursor-pointer tw-font-body tw-font-medium tw-box-border tw-whitespace-nowrap tw-transition-colors ' +\n `${FOCUS_OUTLINE}`,\n variants: {\n disabled: {\n true: 'tw-not-allowed tw-pointer-events-none tw-text-box-disabled-inverse tw-bg-box-disabled',\n },\n rounding: {\n medium: 'tw-rounded',\n full: 'tw-rounded-full',\n },\n size: {\n small: 'tw-h-6 tw-text-body-small',\n medium: 'tw-h-9 tw-text-body-medium',\n large: 'tw-h-12 tw-text-body-large',\n },\n aspect: {\n square: 'tw-aspect-square tw-px-0',\n default: '',\n },\n hugWidth: {\n false: 'tw-w-full',\n },\n emphasis: {\n default: '',\n weak: '',\n strong: '',\n },\n variant: {\n default: '',\n positive: '',\n negative: '',\n danger: '',\n loud: '',\n },\n },\n compoundVariants: [\n {\n disabled: false,\n variant: 'default',\n emphasis: 'default',\n class:\n 'tw-bg-button-background ' +\n 'hover:tw-bg-button-background-hover ' +\n 'active:tw-bg-button-background-pressed',\n },\n {\n disabled: false,\n variant: 'default',\n emphasis: 'weak',\n class: 'hover:tw-bg-button-background-hover active:tw-bg-button-background-pressed',\n },\n {\n disabled: false,\n variant: 'default',\n emphasis: 'strong',\n class:\n 'tw-bg-button-strong-background ' +\n 'hover:tw-bg-button-strong-background-hover ' +\n 'active:tw-bg-button-strong-background-pressed',\n },\n {\n disabled: false,\n variant: 'positive',\n emphasis: 'default',\n class:\n 'tw-bg-button-positive-background ' +\n 'hover:tw-bg-button-positive-background-hover ' +\n 'active:tw-bg-button-positive-background-pressed',\n },\n {\n disabled: false,\n variant: 'positive',\n emphasis: 'weak',\n class: 'hover:tw-bg-button-positive-background-hover active:tw-bg-button-positive-background-pressed',\n },\n {\n disabled: false,\n variant: 'positive',\n emphasis: 'strong',\n class:\n 'tw-bg-button-strong-positive-background ' +\n 'hover:tw-bg-button-strong-positive-background-hover ' +\n 'active:tw-bg-button-strong-positive-background-pressed',\n },\n {\n disabled: false,\n variant: 'negative',\n emphasis: 'default',\n class:\n 'tw-bg-button-negative-background ' +\n 'hover:tw-bg-button-negative-background-hover ' +\n 'active:tw-bg-button-negative-background-pressed',\n },\n {\n disabled: false,\n variant: 'negative',\n emphasis: 'weak',\n class: 'hover:tw-bg-button-negative-background-hover active:tw-bg-button-negative-background-pressed',\n },\n {\n disabled: false,\n variant: 'negative',\n emphasis: 'strong',\n class:\n 'tw-bg-button-strong-negative-background ' +\n 'hover:tw-bg-button-strong-negative-background-hover ' +\n 'active:tw-bg-button-strong-negative-background-pressed',\n },\n {\n disabled: false,\n variant: 'danger',\n emphasis: 'default',\n class:\n 'tw-bg-button-background ' +\n 'hover:tw-bg-button-background-hover ' +\n 'active:tw-bg-button-background-pressed',\n },\n {\n disabled: false,\n variant: 'danger',\n emphasis: 'weak',\n class: 'hover:tw-bg-button-background-hover active:tw-bg-button-background-pressed',\n },\n {\n disabled: false,\n variant: 'danger',\n emphasis: 'strong',\n class:\n 'tw-bg-button-danger-background ' +\n 'hover:tw-bg-button-danger-background-hover ' +\n 'active:tw-bg-button-danger-background-pressed',\n },\n {\n disabled: false,\n variant: 'loud',\n emphasis: 'default',\n class: 'tw-bg-box-selected hover:tw-bg-box-selected-hover active:tw-bg-box-selected-pressed',\n },\n {\n disabled: false,\n variant: 'loud',\n emphasis: 'weak',\n class: 'tw-border-transparent hover:tw-bg-box-selected-hover active:tw-bg-box-selected-pressed',\n },\n {\n disabled: false,\n variant: 'loud',\n emphasis: 'strong',\n class:\n 'tw-bg-box-selected-strong ' +\n 'hover:tw-bg-box-selected-strong-hover ' +\n 'active:tw-bg-box-selected-strong-pressed ',\n },\n {\n aspect: 'default',\n size: 'small',\n class: 'tw-px-2',\n },\n {\n aspect: 'default',\n size: 'medium',\n class: 'tw-px-4',\n },\n {\n aspect: 'default',\n size: 'large',\n class: 'tw-px-6',\n },\n ],\n defaultVariants: {\n variant: 'default',\n emphasis: 'strong',\n size: 'medium',\n rounding: 'medium',\n hugWidth: true,\n aspect: 'default',\n disabled: false,\n },\n});\n"],"names":["buttonStyles","sv","FOCUS_OUTLINE"],"mappings":";;AAKO,MAAMA,IAAeC,EAAG;AAAA,EAC3B,MACI,6LACGC,CAAa;AAAA,EACpB,UAAU;AAAA,IACN,UAAU;AAAA,MACN,MAAM;AAAA,IACV;AAAA,IACA,UAAU;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,IACV;AAAA,IACA,MAAM;AAAA,MACF,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,IACX;AAAA,IACA,QAAQ;AAAA,MACJ,QAAQ;AAAA,MACR,SAAS;AAAA,IACb;AAAA,IACA,UAAU;AAAA,MACN,OAAO;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACN,SAAS;AAAA,MACT,MAAM;AAAA,MACN,QAAQ;AAAA,IACZ;AAAA,IACA,SAAS;AAAA,MACL,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,MAAM;AAAA,IAAA;AAAA,EAEd;AAAA,EACA,kBAAkB;AAAA,IACd;AAAA,MACI,UAAU;AA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,MACI,UAAU;AAAA,MACV,SAAS;AAAA,MACT,UAAU;AAAA,MACV,OACI;AAAA,IAGR;AAAA,IACA;AAAA,MACI,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,IAAA;AAAA,EAEf;AAAA,EACA,iBAAiB;AAAA,IACb,SAAS;AAAA,IACT,UAAU;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,IACV,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,UAAU;AAAA,EAAA;AAElB,CAAC;"}
|
|
@@ -1,43 +1,55 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { IconDroplet as h, IconCross as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import
|
|
5
|
-
import { getColorWithName as
|
|
1
|
+
import { jsxs as t, jsx as e, Fragment as f } from "react/jsx-runtime";
|
|
2
|
+
import { IconDroplet as h, IconCross as I, IconCaretDown as b } from "@frontify/fondue-icons";
|
|
3
|
+
import { forwardRef as v } from "react";
|
|
4
|
+
import s from "./fondue-components78.js";
|
|
5
|
+
import { getColorWithName as k, colorToCss as y } from "./fondue-components42.js";
|
|
6
6
|
const o = ({
|
|
7
7
|
id: c,
|
|
8
8
|
currentColor: a,
|
|
9
|
-
isOpen:
|
|
9
|
+
isOpen: l,
|
|
10
|
+
disabled: d = !1,
|
|
10
11
|
onClear: i,
|
|
11
|
-
onClick:
|
|
12
|
-
"data-test-id":
|
|
13
|
-
...
|
|
14
|
-
},
|
|
15
|
-
const
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
12
|
+
onClick: m,
|
|
13
|
+
"data-test-id": n = "color-picker-input",
|
|
14
|
+
...r
|
|
15
|
+
}, p) => {
|
|
16
|
+
const N = (a == null ? void 0 : a.name) ?? (a ? k(a, "RGBA").name : "");
|
|
17
|
+
return /* @__PURE__ */ t("div", { id: c, className: s.root, ref: p, "data-test-id": n, children: [
|
|
18
|
+
/* @__PURE__ */ t(
|
|
19
|
+
"button",
|
|
20
|
+
{
|
|
21
|
+
className: s.button,
|
|
22
|
+
...r,
|
|
23
|
+
disabled: d,
|
|
24
|
+
onClick: m,
|
|
25
|
+
type: "button",
|
|
26
|
+
"data-color-input-select": !0,
|
|
27
|
+
children: [
|
|
28
|
+
(a == null ? void 0 : a.red) !== void 0 ? /* @__PURE__ */ e(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
"aria-hidden": !0,
|
|
32
|
+
className: s.colorIndicator,
|
|
33
|
+
style: { "--active-color": y(a) }
|
|
34
|
+
}
|
|
35
|
+
) : /* @__PURE__ */ t(f, { children: [
|
|
36
|
+
/* @__PURE__ */ e(h, { size: 16 }),
|
|
37
|
+
/* @__PURE__ */ e("span", { children: "Select Color" })
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ e("span", { className: s.colorName, children: N })
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ t("div", { className: s.actions, children: [
|
|
44
|
+
i && /* @__PURE__ */ e("button", { type: "button", "aria-label": "Clear color", onClick: i, className: s.clear, children: /* @__PURE__ */ e(I, { size: 16 }) }),
|
|
45
|
+
/* @__PURE__ */ e("div", { className: s.caret, "data-state": l ? "open" : "closed", children: /* @__PURE__ */ e(b, { size: 16, className: s.caret }) })
|
|
34
46
|
] })
|
|
35
47
|
] });
|
|
36
48
|
};
|
|
37
49
|
o.displayName = "ColorPicker.Input";
|
|
38
|
-
const
|
|
50
|
+
const g = v(o);
|
|
39
51
|
export {
|
|
40
52
|
o as ColorPickerInput,
|
|
41
|
-
|
|
53
|
+
g as ForwardedRefColorPickerInput
|
|
42
54
|
};
|
|
43
55
|
//# sourceMappingURL=fondue-components39.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components39.js","sources":["../src/components/ColorPicker/ColorPickerInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown, IconCross, IconDroplet } from '@frontify/fondue-icons';\nimport { type CSSProperties, type ForwardedRef, forwardRef } from 'react';\n\nimport { type CommonAriaAttrs } from '#/utilities/types';\n\nimport styles from './styles/colorInput.module.scss';\nimport { type RgbaColor } from './types';\nimport { colorToCss, getColorWithName } from './utils';\n\ntype ColorPickerInputProps = {\n id?: string;\n /**\n * The active color in the color picker\n */\n currentColor?: RgbaColor;\n /**\n * The open state of the color picker used to
|
|
1
|
+
{"version":3,"file":"fondue-components39.js","sources":["../src/components/ColorPicker/ColorPickerInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown, IconCross, IconDroplet } from '@frontify/fondue-icons';\nimport { type CSSProperties, type ForwardedRef, forwardRef } from 'react';\n\nimport { type CommonAriaAttrs } from '#/utilities/types';\n\nimport styles from './styles/colorInput.module.scss';\nimport { type RgbaColor } from './types';\nimport { colorToCss, getColorWithName } from './utils';\n\ntype ColorPickerInputProps = {\n id?: string;\n /**\n * The active color in the color picker\n */\n currentColor?: RgbaColor;\n /**\n * The open state of the color picker used to determine arrow state\n */\n isOpen?: boolean;\n /**\n * Whether the color picker input is disabled\n */\n disabled?: boolean;\n /**\n * callback for clearing the color\n */\n onClear?: () => void;\n /**\n * Event handler called when the color picker input is clicked\n */\n onClick?: () => void;\n /**\n * The test id of the color picker input\n */\n 'data-test-id'?: string;\n} & CommonAriaAttrs;\n\nexport const ColorPickerInput = (\n {\n id,\n currentColor,\n isOpen,\n disabled = false,\n onClear,\n onClick,\n 'data-test-id': dataTestId = 'color-picker-input',\n ...props\n }: ColorPickerInputProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const colorName = currentColor?.name ?? (currentColor ? getColorWithName(currentColor, 'RGBA').name : '');\n return (\n <div id={id} className={styles.root} ref={forwardedRef} data-test-id={dataTestId}>\n <button\n className={styles.button}\n {...props}\n disabled={disabled}\n onClick={onClick}\n type=\"button\"\n data-color-input-select\n >\n {currentColor?.red !== undefined ? (\n <div\n aria-hidden\n className={styles.colorIndicator}\n style={{ '--active-color': colorToCss(currentColor) } as CSSProperties}\n />\n ) : (\n <>\n <IconDroplet size={16} />\n <span>Select Color</span>\n </>\n )}\n\n <span className={styles.colorName}>{colorName}</span>\n </button>\n <div className={styles.actions}>\n {onClear && (\n <button type=\"button\" aria-label=\"Clear color\" onClick={onClear} className={styles.clear}>\n <IconCross size={16} />\n </button>\n )}\n <div className={styles.caret} data-state={isOpen ? 'open' : 'closed'}>\n <IconCaretDown size={16} className={styles.caret} />\n </div>\n </div>\n </div>\n );\n};\nColorPickerInput.displayName = 'ColorPicker.Input';\n\nexport const ForwardedRefColorPickerInput = forwardRef<HTMLDivElement, ColorPickerInputProps>(ColorPickerInput);\n"],"names":["ColorPickerInput","id","currentColor","isOpen","disabled","onClear","onClick","dataTestId","props","forwardedRef","colorName","getColorWithName","jsxs","styles","jsx","colorToCss","Fragment","IconDroplet","IconCross","IconCaretDown","ForwardedRefColorPickerInput","forwardRef"],"mappings":";;;;;AAuCO,MAAMA,IAAmB,CAC5B;AAAA,EACI,IAAAC;AAAA,EACA,cAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,gBAAgBC,IAAa;AAAA,EAC7B,GAAGC;AACP,GACAC,MACC;AACK,QAAAC,KAAYR,KAAA,gBAAAA,EAAc,UAASA,IAAeS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AoB,IAA+BC,EAAkDrB,CAAgB;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as N, useState as b, useEffect as R } from "react";
|
|
3
3
|
import { Select as c } from "./fondue-components21.js";
|
|
4
4
|
import { TextInput as r } from "./fondue-components27.js";
|
|
5
5
|
import a from "./fondue-components41.js";
|
|
6
|
-
import { rgbColorToHex as d, DEFAULT_COLOR as I, DEFAULT_FORMAT as x, isValidHexColor as m, hexColorToRgba as S, getLimitedColorChannelValue as
|
|
6
|
+
import { rgbColorToHex as d, DEFAULT_COLOR as I, DEFAULT_FORMAT as x, isValidHexColor as m, hexColorToRgba as S, getLimitedColorChannelValue as o } from "./fondue-components42.js";
|
|
7
7
|
const h = ({
|
|
8
8
|
currentColor: t = I,
|
|
9
9
|
onColorChange: i = () => {
|
|
@@ -16,8 +16,8 @@ const h = ({
|
|
|
16
16
|
const [u, p] = b(d(t));
|
|
17
17
|
return R(() => {
|
|
18
18
|
p(d(t));
|
|
19
|
-
}, [t]), /* @__PURE__ */
|
|
20
|
-
/* @__PURE__ */ e("div", { className: a.colorFormatInput, children: /* @__PURE__ */
|
|
19
|
+
}, [t]), /* @__PURE__ */ n("div", { className: a.inputs, "data-test-id": f, ref: g, children: [
|
|
20
|
+
/* @__PURE__ */ e("div", { className: a.colorFormatInput, children: /* @__PURE__ */ n(
|
|
21
21
|
c,
|
|
22
22
|
{
|
|
23
23
|
"data-test-id": "color-picker-select-format",
|
|
@@ -41,7 +41,7 @@ const h = ({
|
|
|
41
41
|
value: u,
|
|
42
42
|
status: m(u) ? "neutral" : "error",
|
|
43
43
|
onBlur: (l) => {
|
|
44
|
-
m(l.target.value) && i(S(l.target.value));
|
|
44
|
+
m(l.target.value) && i({ ...S(l.target.value), alpha: t.alpha });
|
|
45
45
|
},
|
|
46
46
|
onChange: (l) => {
|
|
47
47
|
p(l.target.value);
|
|
@@ -49,7 +49,7 @@ const h = ({
|
|
|
49
49
|
"aria-label": "Hex color value",
|
|
50
50
|
children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "#" }) })
|
|
51
51
|
}
|
|
52
|
-
) : /* @__PURE__ */
|
|
52
|
+
) : /* @__PURE__ */ n("div", { className: a.colorChannelInputGroup, children: [
|
|
53
53
|
/* @__PURE__ */ e(
|
|
54
54
|
r.Root,
|
|
55
55
|
{
|
|
@@ -60,7 +60,7 @@ const h = ({
|
|
|
60
60
|
onChange: (l) => {
|
|
61
61
|
i({
|
|
62
62
|
...t,
|
|
63
|
-
red:
|
|
63
|
+
red: o(l.target.value)
|
|
64
64
|
});
|
|
65
65
|
},
|
|
66
66
|
"aria-label": "Red Color Channel",
|
|
@@ -77,7 +77,7 @@ const h = ({
|
|
|
77
77
|
onChange: (l) => {
|
|
78
78
|
i({
|
|
79
79
|
...t,
|
|
80
|
-
green:
|
|
80
|
+
green: o(l.target.value)
|
|
81
81
|
});
|
|
82
82
|
},
|
|
83
83
|
"aria-label": "Green Color Channel",
|
|
@@ -94,7 +94,7 @@ const h = ({
|
|
|
94
94
|
onChange: (l) => {
|
|
95
95
|
i({
|
|
96
96
|
...t,
|
|
97
|
-
blue:
|
|
97
|
+
blue: o(l.target.value)
|
|
98
98
|
});
|
|
99
99
|
},
|
|
100
100
|
"aria-label": "Blue Color Channel",
|
|
@@ -102,7 +102,7 @@ const h = ({
|
|
|
102
102
|
}
|
|
103
103
|
)
|
|
104
104
|
] }),
|
|
105
|
-
/* @__PURE__ */ e("div", { className: a.colorAlphaInput, children: /* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ e("div", { className: a.colorAlphaInput, children: /* @__PURE__ */ n(
|
|
106
106
|
r.Root,
|
|
107
107
|
{
|
|
108
108
|
"data-test-id": "color-picker-value-input-alpha",
|
|
@@ -112,7 +112,7 @@ const h = ({
|
|
|
112
112
|
onChange: (l) => {
|
|
113
113
|
i({
|
|
114
114
|
...t,
|
|
115
|
-
alpha:
|
|
115
|
+
alpha: o(l.target.value, 0, 100) / 100
|
|
116
116
|
});
|
|
117
117
|
},
|
|
118
118
|
"aria-label": "Color Opacity",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components40.js","sources":["../src/components/ColorPicker/ColorValueInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ForwardedRef, forwardRef, useEffect, useState } from 'react';\n\nimport { Select } from '../Select/Select';\nimport { TextInput } from '../TextInput/TextInput';\n\nimport styles from './styles/customColorPicker.module.scss';\nimport { type RgbaColor } from './types';\nimport {\n DEFAULT_COLOR,\n DEFAULT_FORMAT,\n getLimitedColorChannelValue,\n hexColorToRgba,\n isValidHexColor,\n rgbColorToHex,\n} from './utils';\n\ntype ColorFormat = 'HEX' | 'RGBA';\n\ntype ColorValueInputProps = {\n /**\n * @ignore\n * The active color in the color picker, passed down from the root component\n */\n currentColor?: RgbaColor;\n /**\n * @ignore\n * Event handler called when the color changes, passed down from the root component\n */\n onColorChange?: (color: RgbaColor) => void;\n /**\n * @ignore\n * The format to use for the color input, passed down from the root component\n */\n currentFormat?: ColorFormat;\n /**\n * @ignore\n * The format to use for the color input, passed down from the root component\n */\n setCurrentFormat?: (format: ColorFormat) => void;\n /**\n * The test id of the color picker value input\n */\n 'data-test-id'?: string;\n};\n\nexport const ColorValueInput = (\n {\n currentColor = DEFAULT_COLOR,\n onColorChange = () => {},\n currentFormat = DEFAULT_FORMAT,\n setCurrentFormat = () => {},\n 'data-test-id': dataTestId = 'color-picker-value-input',\n }: ColorValueInputProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const [hexColorValue, setHexColorValue] = useState<string>(rgbColorToHex(currentColor));\n\n useEffect(() => {\n setHexColorValue(rgbColorToHex(currentColor));\n }, [currentColor]);\n\n return (\n <div className={styles.inputs} data-test-id={dataTestId} ref={forwardedRef}>\n <div className={styles.colorFormatInput}>\n <Select\n data-test-id=\"color-picker-select-format\"\n aria-label=\"Select a color format\"\n onSelect={(selectedValue) => {\n setCurrentFormat(selectedValue as ColorFormat);\n }}\n value={currentFormat}\n >\n <Select.Item value=\"HEX\">HEX</Select.Item>\n <Select.Item value=\"RGBA\">RGBA</Select.Item>\n </Select>\n </div>\n {currentFormat === 'HEX' ? (\n <TextInput.Root\n data-test-id=\"color-picker-value-input-hex\"\n className={styles.valueInput}\n type=\"text\"\n value={hexColorValue}\n status={isValidHexColor(hexColorValue) ? 'neutral' : 'error'}\n onBlur={(event) => {\n if (isValidHexColor(event.target.value)) {\n onColorChange(hexColorToRgba(event.target.value));\n }\n }}\n onChange={(event) => {\n setHexColorValue(event.target.value);\n }}\n aria-label=\"Hex color value\"\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>#</span>\n </TextInput.Slot>\n </TextInput.Root>\n ) : (\n <div className={styles.colorChannelInputGroup}>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-red\"\n className={styles.valueInput}\n value={currentColor.red}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n red: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label=\"Red Color Channel\"\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>R</span>\n </TextInput.Slot>\n </TextInput.Root>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-green\"\n className={styles.valueInput}\n value={currentColor.green}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n green: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label=\"Green Color Channel\"\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>G</span>\n </TextInput.Slot>\n </TextInput.Root>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-blue\"\n className={styles.valueInput}\n value={currentColor.blue}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n blue: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label=\"Blue Color Channel\"\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>B</span>\n </TextInput.Slot>\n </TextInput.Root>\n </div>\n )}\n <div className={styles.colorAlphaInput}>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-alpha\"\n className={styles.valueInput}\n /* .toString() is a workaround for https://github.com/facebook/react/issues/9402 */\n value={currentColor.alpha === undefined ? 100 : Math.trunc(currentColor.alpha * 100).toString()}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n alpha: getLimitedColorChannelValue(event.target.value, 0, 100) / 100,\n });\n }}\n aria-label=\"Color Opacity\"\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>A</span>\n </TextInput.Slot>\n <TextInput.Slot name=\"right\">\n <span className={styles.inputDecorator}>%</span>\n </TextInput.Slot>\n </TextInput.Root>\n </div>\n </div>\n );\n};\nColorValueInput.displayName = 'ColorPicker.Values';\n\nexport const ForwardedRefColorValueInput = forwardRef<HTMLDivElement, ColorValueInputProps>(ColorValueInput);\n"],"names":["ColorValueInput","currentColor","DEFAULT_COLOR","onColorChange","currentFormat","DEFAULT_FORMAT","setCurrentFormat","dataTestId","forwardedRef","hexColorValue","setHexColorValue","useState","rgbColorToHex","useEffect","jsxs","styles","jsx","Select","selectedValue","TextInput","isValidHexColor","event","hexColorToRgba","getLimitedColorChannelValue","ForwardedRefColorValueInput","forwardRef"],"mappings":";;;;;;AA+CO,MAAMA,IAAkB,CAC3B;AAAA,EACI,cAAAC,IAAeC;AAAA,EACf,eAAAC,IAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,eAAAC,IAAgBC;AAAA,EAChB,kBAAAC,IAAmB,MAAM;AAAA,EAAC;AAAA,EAC1B,gBAAgBC,IAAa;AACjC,GACAC,MACC;AACD,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAiBC,EAAcX,CAAY,CAAC;AAEtF,SAAAY,EAAU,MAAM;AACK,IAAAH,EAAAE,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AAU,MAAV,EAAe,MAAK,QACjB,UAAC,gBAAAH,EAAA,QAAA,EAAK,WAAWD,EAAO,gBAAgB,UAAA,IAAA,CAAC,EAC7C,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACJ,GACJ;AAAA,IAEH,gBAAAC,EAAA,OAAA,EAAI,WAAWD,EAAO,iBACnB,UAAA,gBAAAD;AAAA,MAACK,EAAU;AAAA,MAAV;AAAA,QACG,gBAAa;AAAA,QACb,WAAWJ,EAAO;AAAA,QAElB,OAAOd,EAAa,UAAU,SAAY,MAAM,KAAK,MAAMA,EAAa,QAAQ,GAAG,EAAE,SAAS;AAAA,QAC9F,MAAK;AAAA,QACL,UAAU,CAACoB,MAAU;AACH,UAAAlB,EAAA;AAAA,YACV,GAAGF;AAAA,YACH,OAAOsB,EAA4BF,EAAM,OAAO,OAAO,GAAG,GAAG,IAAI;AAAA,UAAA,CACpE;AAAA,QACL;AAAA,QACA,cAAW;AAAA,QAEX,UAAA;AAAA,UAAC,gBAAAL,EAAAG,EAAU,MAAV,EAAe,MAAK,QACjB,UAAC,gBAAAH,EAAA,QAAA,EAAK,WAAWD,EAAO,gBAAgB,UAAA,IAAC,CAAA,GAC7C;AAAA,UACC,gBAAAC,EAAAG,EAAU,MAAV,EAAe,MAAK,SACjB,UAAC,gBAAAH,EAAA,QAAA,EAAK,WAAWD,EAAO,gBAAgB,UAAA,IAAA,CAAC,EAC7C,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,EAER,CAAA;AAAA,EAAA,GACJ;AAER;AACAf,EAAgB,cAAc;AAEjB,MAAAwB,IAA8BC,EAAiDzB,CAAe;"}
|
|
1
|
+
{"version":3,"file":"fondue-components40.js","sources":["../src/components/ColorPicker/ColorValueInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ForwardedRef, forwardRef, useEffect, useState } from 'react';\n\nimport { Select } from '../Select/Select';\nimport { TextInput } from '../TextInput/TextInput';\n\nimport styles from './styles/customColorPicker.module.scss';\nimport { type RgbaColor } from './types';\nimport {\n DEFAULT_COLOR,\n DEFAULT_FORMAT,\n getLimitedColorChannelValue,\n hexColorToRgba,\n isValidHexColor,\n rgbColorToHex,\n} from './utils';\n\ntype ColorFormat = 'HEX' | 'RGBA';\n\ntype ColorValueInputProps = {\n /**\n * @ignore\n * The active color in the color picker, passed down from the root component\n */\n currentColor?: RgbaColor;\n /**\n * @ignore\n * Event handler called when the color changes, passed down from the root component\n */\n onColorChange?: (color: RgbaColor) => void;\n /**\n * @ignore\n * The format to use for the color input, passed down from the root component\n */\n currentFormat?: ColorFormat;\n /**\n * @ignore\n * The format to use for the color input, passed down from the root component\n */\n setCurrentFormat?: (format: ColorFormat) => void;\n /**\n * The test id of the color picker value input\n */\n 'data-test-id'?: string;\n};\n\nexport const ColorValueInput = (\n {\n currentColor = DEFAULT_COLOR,\n onColorChange = () => {},\n currentFormat = DEFAULT_FORMAT,\n setCurrentFormat = () => {},\n 'data-test-id': dataTestId = 'color-picker-value-input',\n }: ColorValueInputProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const [hexColorValue, setHexColorValue] = useState<string>(rgbColorToHex(currentColor));\n\n useEffect(() => {\n setHexColorValue(rgbColorToHex(currentColor));\n }, [currentColor]);\n\n return (\n <div className={styles.inputs} data-test-id={dataTestId} ref={forwardedRef}>\n <div className={styles.colorFormatInput}>\n <Select\n data-test-id=\"color-picker-select-format\"\n aria-label=\"Select a color format\"\n onSelect={(selectedValue) => {\n setCurrentFormat(selectedValue as ColorFormat);\n }}\n value={currentFormat}\n >\n <Select.Item value=\"HEX\">HEX</Select.Item>\n <Select.Item value=\"RGBA\">RGBA</Select.Item>\n </Select>\n </div>\n {currentFormat === 'HEX' ? (\n <TextInput.Root\n data-test-id=\"color-picker-value-input-hex\"\n className={styles.valueInput}\n type=\"text\"\n value={hexColorValue}\n status={isValidHexColor(hexColorValue) ? 'neutral' : 'error'}\n onBlur={(event) => {\n if (isValidHexColor(event.target.value)) {\n onColorChange({ ...hexColorToRgba(event.target.value), alpha: currentColor.alpha });\n }\n }}\n onChange={(event) => {\n setHexColorValue(event.target.value);\n }}\n aria-label=\"Hex color value\"\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>#</span>\n </TextInput.Slot>\n </TextInput.Root>\n ) : (\n <div className={styles.colorChannelInputGroup}>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-red\"\n className={styles.valueInput}\n value={currentColor.red}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n red: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label=\"Red Color Channel\"\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>R</span>\n </TextInput.Slot>\n </TextInput.Root>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-green\"\n className={styles.valueInput}\n value={currentColor.green}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n green: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label=\"Green Color Channel\"\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>G</span>\n </TextInput.Slot>\n </TextInput.Root>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-blue\"\n className={styles.valueInput}\n value={currentColor.blue}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n blue: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label=\"Blue Color Channel\"\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>B</span>\n </TextInput.Slot>\n </TextInput.Root>\n </div>\n )}\n <div className={styles.colorAlphaInput}>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-alpha\"\n className={styles.valueInput}\n /* .toString() is a workaround for https://github.com/facebook/react/issues/9402 */\n value={currentColor.alpha === undefined ? 100 : Math.trunc(currentColor.alpha * 100).toString()}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n alpha: getLimitedColorChannelValue(event.target.value, 0, 100) / 100,\n });\n }}\n aria-label=\"Color Opacity\"\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>A</span>\n </TextInput.Slot>\n <TextInput.Slot name=\"right\">\n <span className={styles.inputDecorator}>%</span>\n </TextInput.Slot>\n </TextInput.Root>\n </div>\n </div>\n );\n};\nColorValueInput.displayName = 'ColorPicker.Values';\n\nexport const ForwardedRefColorValueInput = forwardRef<HTMLDivElement, ColorValueInputProps>(ColorValueInput);\n"],"names":["ColorValueInput","currentColor","DEFAULT_COLOR","onColorChange","currentFormat","DEFAULT_FORMAT","setCurrentFormat","dataTestId","forwardedRef","hexColorValue","setHexColorValue","useState","rgbColorToHex","useEffect","jsxs","styles","jsx","Select","selectedValue","TextInput","isValidHexColor","event","hexColorToRgba","getLimitedColorChannelValue","ForwardedRefColorValueInput","forwardRef"],"mappings":";;;;;;AA+CO,MAAMA,IAAkB,CAC3B;AAAA,EACI,cAAAC,IAAeC;AAAA,EACf,eAAAC,IAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,eAAAC,IAAgBC;AAAA,EAChB,kBAAAC,IAAmB,MAAM;AAAA,EAAC;AAAA,EAC1B,gBAAgBC,IAAa;AACjC,GACAC,MACC;AACD,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAiBC,EAAcX,CAAY,CAAC;AAEtF,SAAAY,EAAU,MAAM;AACK,IAAAH,EAAAE,EAAcX,CAAY,CAAC;AAAA,EAAA,GAC7C,CAACA,CAAY,CAAC,GAGb,gBAAAa,EAAC,SAAI,WAAWC,EAAO,QAAQ,gBAAcR,GAAY,KAAKC,GAC1D,UAAA;AAAA,IAAC,gBAAAQ,EAAA,OAAA,EAAI,WAAWD,EAAO,kBACnB,UAAA,gBAAAD;AAAA,MAACG;AAAA,MAAA;AAAA,QACG,gBAAa;AAAA,QACb,cAAW;AAAA,QACX,UAAU,CAACC,MAAkB;AACzB,UAAAZ,EAAiBY,CAA4B;AAAA,QACjD;AAAA,QACA,OAAO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AAa,UAAU,SAAY,MAAM,KAAK,MAAMA,EAAa,QAAQ,GAAG,EAAE,SAAS;AAAA,QAC9F,MAAK;AAAA,QACL,UAAU,CAACoB,MAAU;AACH,UAAAlB,EAAA;AAAA,YACV,GAAGF;AAAA,YACH,OAAOsB,EAA4BF,EAAM,OAAO,OAAO,GAAG,GAAG,IAAI;AAAA,UAAA,CACpE;AAAA,QACL;AAAA,QACA,cAAW;AAAA,QAEX,UAAA;AAAA,UAAC,gBAAAL,EAAAG,EAAU,MAAV,EAAe,MAAK,QACjB,UAAC,gBAAAH,EAAA,QAAA,EAAK,WAAWD,EAAO,gBAAgB,UAAA,IAAC,CAAA,GAC7C;AAAA,UACC,gBAAAC,EAAAG,EAAU,MAAV,EAAe,MAAK,SACjB,UAAC,gBAAAH,EAAA,QAAA,EAAK,WAAWD,EAAO,gBAAgB,UAAA,IAAA,CAAC,EAC7C,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,EAER,CAAA;AAAA,EAAA,GACJ;AAER;AACAf,EAAgB,cAAc;AAEjB,MAAAwB,IAA8BC,EAAiDzB,CAAe;"}
|
|
@@ -4,7 +4,7 @@ import { Slot as C } from "@radix-ui/react-slot";
|
|
|
4
4
|
import { isValidElement as V } from "react";
|
|
5
5
|
import { useFondueTheme as g, ThemeProvider as A } from "./fondue-components28.js";
|
|
6
6
|
import n from "./fondue-components63.js";
|
|
7
|
-
import { recursiveMap as D, getSelectOptionValue as M } from "./fondue-
|
|
7
|
+
import { recursiveMap as D, getSelectOptionValue as M } from "./fondue-components77.js";
|
|
8
8
|
const T = ({
|
|
9
9
|
highlightedIndex: p,
|
|
10
10
|
getMenuProps: l,
|
|
@@ -3,7 +3,7 @@ import { IconCross as x } from "@frontify/fondue-icons";
|
|
|
3
3
|
import { useState as B, useMemo as i, Children as f, isValidElement as a, cloneElement as E, useCallback as v } from "react";
|
|
4
4
|
import { ForwardedRefSelectItem as F } from "./fondue-components60.js";
|
|
5
5
|
import { ForwardedRefSelectSlot as c } from "./fondue-components62.js";
|
|
6
|
-
import { getSelectOptionValue as I } from "./fondue-
|
|
6
|
+
import { getSelectOptionValue as I } from "./fondue-components77.js";
|
|
7
7
|
const S = (r) => {
|
|
8
8
|
const t = [];
|
|
9
9
|
return f.forEach(r, (o) => {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
const t = "
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
const t = "_triggerListWrapper_d8wxe_5", r = "_trigger_d8wxe_5", e = "_activeIndicator_d8wxe_53", i = "_triggerList_d8wxe_5", o = "_root_d8wxe_135", g = "_content_d8wxe_158", _ = {
|
|
2
|
+
triggerListWrapper: t,
|
|
3
|
+
trigger: r,
|
|
4
|
+
activeIndicator: e,
|
|
5
|
+
triggerList: i,
|
|
6
|
+
root: o,
|
|
7
|
+
content: g
|
|
8
8
|
};
|
|
9
9
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
e as activeIndicator,
|
|
11
|
+
g as content,
|
|
12
12
|
_ as default,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
o as root,
|
|
14
|
+
r as trigger,
|
|
15
|
+
i as triggerList,
|
|
16
|
+
t as triggerListWrapper
|
|
17
17
|
};
|
|
18
18
|
//# sourceMappingURL=fondue-components71.js.map
|
|
@@ -1,20 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { Children as a, isValidElement as u, cloneElement as f } from "react";
|
|
2
|
+
import { ForwardedRefSelectItem as E } from "./fondue-components60.js";
|
|
3
|
+
const g = ({
|
|
4
|
+
children: o,
|
|
5
|
+
value: r,
|
|
6
|
+
label: s
|
|
7
|
+
}) => o && typeof o == "string" ? {
|
|
8
|
+
value: r || o,
|
|
9
|
+
label: s || o
|
|
10
|
+
} : {
|
|
11
|
+
value: r || "",
|
|
12
|
+
label: s || r || "",
|
|
13
|
+
...o ? { children: o } : null
|
|
14
|
+
}, w = (o, r) => u(o) && o.type === r, y = (o, r, s, p = 0) => {
|
|
15
|
+
const n = [];
|
|
16
|
+
let t = 0;
|
|
17
|
+
return a.forEach(o, (e) => {
|
|
18
|
+
if (w(e, E) && u(e))
|
|
19
|
+
g(e.props).label.toLowerCase().includes((s == null ? void 0 : s.toLowerCase()) || "") && (n.push(r(e, p + t)), t++);
|
|
20
|
+
else if (u(e) && (e != null && e.props.children)) {
|
|
21
|
+
const { parsedChildren: m, subElementCount: C } = y(
|
|
22
|
+
e.props.children,
|
|
23
|
+
r,
|
|
24
|
+
"",
|
|
25
|
+
p + t
|
|
26
|
+
);
|
|
27
|
+
e = f(e, {
|
|
28
|
+
children: m,
|
|
29
|
+
key: `group-${p + t}`
|
|
30
|
+
}), n.push(e), t += C;
|
|
31
|
+
} else
|
|
32
|
+
n.push(e);
|
|
33
|
+
}), {
|
|
34
|
+
parsedChildren: n,
|
|
35
|
+
subElementCount: t
|
|
36
|
+
};
|
|
9
37
|
};
|
|
10
38
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
r as clear,
|
|
15
|
-
a as colorIndicator,
|
|
16
|
-
t as colorName,
|
|
17
|
-
s as default,
|
|
18
|
-
o as root
|
|
39
|
+
g as getSelectOptionValue,
|
|
40
|
+
w as isReactLeaf,
|
|
41
|
+
y as recursiveMap
|
|
19
42
|
};
|
|
20
43
|
//# sourceMappingURL=fondue-components77.js.map
|