@frontify/fondue-components 1.3.5 → 1.5.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-components.js +15 -11
- package/dist/fondue-components.js.map +1 -1
- package/dist/fondue-components10.js +36 -44
- package/dist/fondue-components10.js.map +1 -1
- package/dist/fondue-components11.js +46 -72
- package/dist/fondue-components11.js.map +1 -1
- package/dist/fondue-components12.js +76 -45
- package/dist/fondue-components12.js.map +1 -1
- package/dist/fondue-components13.js +65 -11
- package/dist/fondue-components13.js.map +1 -1
- package/dist/fondue-components14.js +45 -154
- package/dist/fondue-components14.js.map +1 -1
- package/dist/fondue-components15.js +10 -116
- package/dist/fondue-components15.js.map +1 -1
- package/dist/fondue-components16.js +59 -22
- package/dist/fondue-components16.js.map +1 -1
- package/dist/fondue-components17.js +111 -14
- package/dist/fondue-components17.js.map +1 -1
- package/dist/fondue-components18.js +112 -24
- package/dist/fondue-components18.js.map +1 -1
- package/dist/fondue-components19.js +15 -54
- package/dist/fondue-components19.js.map +1 -1
- package/dist/fondue-components20.js +15 -17
- package/dist/fondue-components20.js.map +1 -1
- package/dist/fondue-components21.js +51 -26
- package/dist/fondue-components21.js.map +1 -1
- package/dist/fondue-components22.js +16 -24
- package/dist/fondue-components22.js.map +1 -1
- package/dist/fondue-components23.js +17 -9
- package/dist/fondue-components23.js.map +1 -1
- package/dist/fondue-components24.js +35 -6
- package/dist/fondue-components24.js.map +1 -1
- package/dist/fondue-components25.js +24 -14
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components26.js +9 -2360
- package/dist/fondue-components26.js.map +1 -1
- package/dist/fondue-components27.js +105 -138
- package/dist/fondue-components27.js.map +1 -1
- package/dist/fondue-components28.js +12 -2
- package/dist/fondue-components28.js.map +1 -1
- package/dist/fondue-components29.js +38 -29
- package/dist/fondue-components29.js.map +1 -1
- package/dist/fondue-components3.js +4 -4
- package/dist/fondue-components30.js +11 -0
- package/dist/fondue-components30.js.map +1 -0
- package/dist/fondue-components31.js +24 -0
- package/dist/fondue-components31.js.map +1 -0
- package/dist/fondue-components32.js +59 -0
- package/dist/fondue-components32.js.map +1 -0
- package/dist/fondue-components33.js +21 -0
- package/dist/fondue-components33.js.map +1 -0
- package/dist/fondue-components34.js +18 -0
- package/dist/fondue-components34.js.map +1 -0
- package/dist/fondue-components35.js +5 -0
- package/dist/fondue-components35.js.map +1 -0
- package/dist/fondue-components36.js +2363 -0
- package/dist/fondue-components36.js.map +1 -0
- package/dist/fondue-components37.js +123 -0
- package/dist/fondue-components37.js.map +1 -0
- package/dist/fondue-components38.js +42 -0
- package/dist/fondue-components38.js.map +1 -0
- package/dist/fondue-components39.js +29 -0
- package/dist/fondue-components39.js.map +1 -0
- package/dist/fondue-components4.js +2 -2
- package/dist/fondue-components5.js +54 -50
- package/dist/fondue-components5.js.map +1 -1
- package/dist/fondue-components6.js +2 -2
- package/dist/fondue-components7.js +77 -50
- package/dist/fondue-components7.js.map +1 -1
- package/dist/fondue-components8.js +56 -22
- package/dist/fondue-components8.js.map +1 -1
- package/dist/fondue-components9.js +24 -39
- package/dist/fondue-components9.js.map +1 -1
- package/dist/index.d.ts +245 -3
- package/dist/style.css +1 -1
- package/package.json +45 -36
|
@@ -1,38 +1,63 @@
|
|
|
1
|
-
import { sv as t } from "./fondue-
|
|
2
|
-
const
|
|
3
|
-
base: "tw-
|
|
1
|
+
import { sv as t } from "./fondue-components15.js";
|
|
2
|
+
const e = t({
|
|
3
|
+
base: "tw-flex tw-self-stretch tw-justify-center ",
|
|
4
4
|
variants: {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
direction: {
|
|
6
|
+
horizontal: "tw-flex-col tw-h-0 tw-border-t tw-w-full",
|
|
7
|
+
vertical: "tw-flex-row tw-w-0 tw-border-r tw-h-full "
|
|
7
8
|
},
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"x-
|
|
9
|
+
color: {
|
|
10
|
+
weak: "tw-border-line-weak",
|
|
11
|
+
default: "tw-border-line",
|
|
12
|
+
strong: "tw-border-line-strong",
|
|
13
|
+
"x-strong": "tw-border-x-line-strong"
|
|
13
14
|
},
|
|
14
15
|
style: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
solid: "tw-border-solid",
|
|
17
|
+
dashed: "tw-border-dashed",
|
|
18
|
+
noline: "tw-border-none"
|
|
18
19
|
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
},
|
|
21
|
+
compoundVariants: [
|
|
22
|
+
{
|
|
23
|
+
direction: "horizontal",
|
|
24
|
+
padding: "small",
|
|
25
|
+
class: "tw-my-4"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
direction: "horizontal",
|
|
29
|
+
padding: "medium",
|
|
30
|
+
class: "tw-my-7"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
direction: "horizontal",
|
|
34
|
+
padding: "large",
|
|
35
|
+
class: "tw-my-12"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
direction: "vertical",
|
|
39
|
+
padding: "small",
|
|
40
|
+
class: "tw-mx-4"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
direction: "vertical",
|
|
44
|
+
padding: "medium",
|
|
45
|
+
class: "tw-mx-7"
|
|
27
46
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
47
|
+
{
|
|
48
|
+
direction: "vertical",
|
|
49
|
+
padding: "large",
|
|
50
|
+
class: "tw-mx-12"
|
|
31
51
|
}
|
|
52
|
+
],
|
|
53
|
+
defaultVariants: {
|
|
54
|
+
padding: "medium",
|
|
55
|
+
direction: "horizontal",
|
|
56
|
+
color: "default",
|
|
57
|
+
style: "solid"
|
|
32
58
|
}
|
|
33
59
|
});
|
|
34
60
|
export {
|
|
35
|
-
|
|
36
|
-
a as loadingBarStyles
|
|
61
|
+
e as dividerStyles
|
|
37
62
|
};
|
|
38
63
|
//# sourceMappingURL=fondue-components21.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components21.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"fondue-components21.js","sources":["../src/components/Divider/styles/dividerStyles.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { sv } from '#/utilities/styleUtilities';\n\nexport const dividerStyles = sv({\n base: 'tw-flex tw-self-stretch tw-justify-center ',\n variants: {\n direction: {\n horizontal: 'tw-flex-col tw-h-0 tw-border-t tw-w-full',\n vertical: 'tw-flex-row tw-w-0 tw-border-r tw-h-full ',\n },\n color: {\n weak: 'tw-border-line-weak',\n default: 'tw-border-line',\n strong: 'tw-border-line-strong',\n 'x-strong': 'tw-border-x-line-strong',\n },\n style: {\n solid: 'tw-border-solid',\n dashed: 'tw-border-dashed',\n noline: 'tw-border-none',\n },\n },\n compoundVariants: [\n {\n direction: 'horizontal',\n padding: 'small',\n class: 'tw-my-4',\n },\n {\n direction: 'horizontal',\n padding: 'medium',\n class: 'tw-my-7',\n },\n {\n direction: 'horizontal',\n padding: 'large',\n class: 'tw-my-12',\n },\n {\n direction: 'vertical',\n padding: 'small',\n class: 'tw-mx-4',\n },\n {\n direction: 'vertical',\n padding: 'medium',\n class: 'tw-mx-7',\n },\n {\n direction: 'vertical',\n padding: 'large',\n class: 'tw-mx-12',\n },\n ],\n defaultVariants: {\n padding: 'medium',\n direction: 'horizontal',\n color: 'default',\n style: 'solid',\n },\n});\n"],"names":["dividerStyles","sv"],"mappings":";AAIO,MAAMA,IAAgBC,EAAG;AAAA,EAC5B,MAAM;AAAA,EACN,UAAU;AAAA,IACN,WAAW;AAAA,MACP,YAAY;AAAA,MACZ,UAAU;AAAA,IACd;AAAA,IACA,OAAO;AAAA,MACH,MAAM;AAAA,MACN,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,YAAY;AAAA,IAChB;AAAA,IACA,OAAO;AAAA,MACH,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,QAAQ;AAAA,IACZ;AAAA,EACJ;AAAA,EACA,kBAAkB;AAAA,IACd;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,EACJ;AAAA,EACA,iBAAiB;AAAA,IACb,SAAS;AAAA,IACT,WAAW;AAAA,IACX,OAAO;AAAA,IACP,OAAO;AAAA,EACX;AACJ,CAAC;"}
|
|
@@ -1,28 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
(l) => {
|
|
10
|
-
if (t) {
|
|
11
|
-
const u = typeof l == "function" ? l(e) : l;
|
|
12
|
-
u !== e && r(u);
|
|
13
|
-
} else
|
|
14
|
-
c(l);
|
|
15
|
-
},
|
|
16
|
-
[t, e, c, r]
|
|
17
|
-
);
|
|
18
|
-
return [i, a];
|
|
19
|
-
}, b = ({ defaultProp: e, onChange: n }) => {
|
|
20
|
-
const s = v(e), [o] = s, c = S(o), t = f(() => n, [n]);
|
|
21
|
-
return m(() => {
|
|
22
|
-
c.current !== o && (t == null || t(o), c.current = o);
|
|
23
|
-
}, [o, c, t]), s;
|
|
1
|
+
const t = "_content_11ubj_5", n = "_subContent_11ubj_6", o = "_item_11ubj_16", s = "_subTrigger_11ubj_17", u = "_subMenuIndicator_11ubj_54", _ = "_group_11ubj_60", e = "_slot_11ubj_67", b = {
|
|
2
|
+
content: t,
|
|
3
|
+
subContent: n,
|
|
4
|
+
item: o,
|
|
5
|
+
subTrigger: s,
|
|
6
|
+
subMenuIndicator: u,
|
|
7
|
+
group: _,
|
|
8
|
+
slot: e
|
|
24
9
|
};
|
|
25
10
|
export {
|
|
26
|
-
|
|
11
|
+
t as content,
|
|
12
|
+
b as default,
|
|
13
|
+
_ as group,
|
|
14
|
+
o as item,
|
|
15
|
+
e as slot,
|
|
16
|
+
n as subContent,
|
|
17
|
+
u as subMenuIndicator,
|
|
18
|
+
s as subTrigger
|
|
27
19
|
};
|
|
28
20
|
//# sourceMappingURL=fondue-components22.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components22.js","sources":[
|
|
1
|
+
{"version":3,"file":"fondue-components22.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const a =
|
|
1
|
+
import { sv as t } from "./fondue-components15.js";
|
|
2
|
+
const a = t({
|
|
3
|
+
base: 'tw-block tw-bg-base tw-shadow-mid tw-border tw-border-line tw-w-full sm:tw-w-fit sm:tw-max-w-[--flyout-max-width] tw-group tw-mt-4 sm:tw-mt-0 [body>[data-radix-popper-content-wrapper]:has(&)]:max-sm:tw-p-2 [body>[data-radix-popper-content-wrapper]:has(&)]:max-sm:tw-w-screen [body>[data-radix-popper-content-wrapper]:has(&)]:max-sm:!tw-translate-x-0 [body>[data-radix-popper-content-wrapper]:has(&)]:max-sm:!tw-translate-y-0 before:tw-fixed tw-content-[""] before:tw-top-0 before:tw-left-0 before:tw-h-screen before:tw-w-screen before:tw-bg-black before:tw-opacity-30 before:tw-z-[-1] before:tw-pointer-events-none sm:before:tw-hidden',
|
|
4
|
+
variants: {
|
|
5
|
+
rounded: {
|
|
6
|
+
true: "tw-rounded",
|
|
7
|
+
false: ""
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
defaultVariants: {
|
|
11
|
+
rounded: !0
|
|
12
|
+
}
|
|
13
|
+
}), e = "tw-flex tw-justify-between tw-items-center tw-border-b tw-border-line tw-font-medium group-data-[flyout-spacing=compact]:tw-p-4 group-data-[flyout-spacing=comfortable]:tw-p-6 group-data-[flyout-spacing=spacious]:tw-p-10 ", r = "tw-flex tw-justify-end tw-gap-2 tw-border-t tw-border-line tw-font-medium group-data-[flyout-spacing=compact]:tw-p-4 group-data-[flyout-spacing=comfortable]:tw-p-6 group-data-[flyout-spacing=spacious]:tw-p-10 ", p = "tw-flex tw-flex-col tw-gap-4 group-data-[flyout-spacing=compact]:tw-px-4 group-data-[flyout-spacing=compact]:tw-py-2 group-data-[flyout-spacing=comfortable]:tw-px-6 group-data-[flyout-spacing=comfortable]:tw-py-4 group-data-[flyout-spacing=spacious]:tw-px-10 group-data-[flyout-spacing=spacious]:tw-py-6 ";
|
|
3
14
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
w as segmentedControlItemSeparatorStyles,
|
|
9
|
-
n as segmentedControlItemStyles,
|
|
10
|
-
a as segmentedControlRootStyles
|
|
15
|
+
p as flyoutBodyStyles,
|
|
16
|
+
a as flyoutContentStyles,
|
|
17
|
+
r as flyoutFooterStyles,
|
|
18
|
+
e as flyoutHeaderStyles
|
|
11
19
|
};
|
|
12
20
|
//# sourceMappingURL=fondue-components23.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components23.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"fondue-components23.js","sources":["../src/components/Flyout/styles/flyoutStyles.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { sv } from '#/utilities/styleUtilities';\n\nexport const flyoutContentStyles = sv({\n base:\n 'tw-block tw-bg-base tw-shadow-mid tw-border tw-border-line tw-w-full sm:tw-w-fit sm:tw-max-w-[--flyout-max-width] tw-group tw-mt-4 sm:tw-mt-0 ' +\n // Mobile view flyout -> dialog responsiveness\n '[body>[data-radix-popper-content-wrapper]:has(&)]:max-sm:tw-p-2 [body>[data-radix-popper-content-wrapper]:has(&)]:max-sm:tw-w-screen [body>[data-radix-popper-content-wrapper]:has(&)]:max-sm:!tw-translate-x-0 [body>[data-radix-popper-content-wrapper]:has(&)]:max-sm:!tw-translate-y-0 ' +\n // Responsive dialog background element\n 'before:tw-fixed tw-content-[\"\"] before:tw-top-0 before:tw-left-0 before:tw-h-screen before:tw-w-screen before:tw-bg-black before:tw-opacity-30 before:tw-z-[-1] before:tw-pointer-events-none sm:before:tw-hidden',\n variants: {\n rounded: {\n true: 'tw-rounded',\n false: '',\n },\n },\n defaultVariants: {\n rounded: true,\n },\n});\n\nexport const flyoutHeaderStyles =\n 'tw-flex tw-justify-between tw-items-center tw-border-b tw-border-line tw-font-medium ' +\n 'group-data-[flyout-spacing=compact]:tw-p-4 ' +\n 'group-data-[flyout-spacing=comfortable]:tw-p-6 ' +\n 'group-data-[flyout-spacing=spacious]:tw-p-10 ';\n\nexport const flyoutFooterStyles =\n 'tw-flex tw-justify-end tw-gap-2 tw-border-t tw-border-line tw-font-medium ' +\n 'group-data-[flyout-spacing=compact]:tw-p-4 ' +\n 'group-data-[flyout-spacing=comfortable]:tw-p-6 ' +\n 'group-data-[flyout-spacing=spacious]:tw-p-10 ';\n\nexport const flyoutBodyStyles =\n 'tw-flex tw-flex-col tw-gap-4 ' +\n 'group-data-[flyout-spacing=compact]:tw-px-4 group-data-[flyout-spacing=compact]:tw-py-2 ' +\n 'group-data-[flyout-spacing=comfortable]:tw-px-6 group-data-[flyout-spacing=comfortable]:tw-py-4 ' +\n 'group-data-[flyout-spacing=spacious]:tw-px-10 group-data-[flyout-spacing=spacious]:tw-py-6 ';\n"],"names":["flyoutContentStyles","sv","flyoutHeaderStyles","flyoutFooterStyles","flyoutBodyStyles"],"mappings":";AAIO,MAAMA,IAAsBC,EAAG;AAAA,EAClC,MACI;AAAA,EAKJ,UAAU;AAAA,IACN,SAAS;AAAA,MACL,MAAM;AAAA,MACN,OAAO;AAAA,IACX;AAAA,EACJ;AAAA,EACA,iBAAiB;AAAA,IACb,SAAS;AAAA,EACb;AACJ,CAAC,GAEYC,IACT,gOAKSC,IACT,qNAKSC,IACT;"}
|
|
@@ -1,9 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
1
|
+
import { sv as t } from "./fondue-components15.js";
|
|
2
|
+
const i = t({
|
|
3
|
+
base: "tw-relative tw-w-full tw-overflow-hidden",
|
|
4
|
+
variants: {
|
|
5
|
+
rounded: {
|
|
6
|
+
true: "tw-rounded"
|
|
7
|
+
},
|
|
8
|
+
size: {
|
|
9
|
+
small: "tw-h-1",
|
|
10
|
+
medium: "tw-h-2",
|
|
11
|
+
large: "tw-h-3",
|
|
12
|
+
"x-large": "tw-h-4"
|
|
13
|
+
},
|
|
14
|
+
style: {
|
|
15
|
+
default: "tw-bg-box-selected",
|
|
16
|
+
positive: "tw-bg-box-positive",
|
|
17
|
+
negative: "tw-bg-box-negative"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}), a = t({
|
|
21
|
+
base: "tw-h-full tw-w-full",
|
|
22
|
+
variants: {
|
|
23
|
+
style: {
|
|
24
|
+
default: "tw-bg-text-interactive",
|
|
25
|
+
positive: "tw-bg-text-positive",
|
|
26
|
+
negative: "tw-bg-text-negative"
|
|
27
|
+
},
|
|
28
|
+
indeterminateState: {
|
|
29
|
+
true: "tw-animate-loading-bar-infinite tw-origin-left-right",
|
|
30
|
+
false: "tw-transition-all tw-origin-left tw-scale-x-[--loading-bar-proportion]"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
3
34
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
r as rootStyles,
|
|
7
|
-
n as slotStyles
|
|
35
|
+
i as loadingBarContainerStyles,
|
|
36
|
+
a as loadingBarStyles
|
|
8
37
|
};
|
|
9
38
|
//# sourceMappingURL=fondue-components24.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components24.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"fondue-components24.js","sources":["../src/components/LoadingBar/styles/loadingBarStyles.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { sv } from '#/utilities/styleUtilities';\n\nexport const loadingBarContainerStyles = sv({\n base: 'tw-relative tw-w-full tw-overflow-hidden',\n variants: {\n rounded: {\n true: 'tw-rounded',\n },\n size: {\n small: 'tw-h-1',\n medium: 'tw-h-2',\n large: 'tw-h-3',\n 'x-large': 'tw-h-4',\n },\n style: {\n default: 'tw-bg-box-selected',\n positive: 'tw-bg-box-positive',\n negative: 'tw-bg-box-negative',\n },\n },\n});\n\nexport const loadingBarStyles = sv({\n base: 'tw-h-full tw-w-full',\n variants: {\n style: {\n default: 'tw-bg-text-interactive',\n positive: 'tw-bg-text-positive',\n negative: 'tw-bg-text-negative',\n },\n indeterminateState: {\n true: 'tw-animate-loading-bar-infinite tw-origin-left-right',\n false: 'tw-transition-all tw-origin-left tw-scale-x-[--loading-bar-proportion]',\n },\n },\n});\n"],"names":["loadingBarContainerStyles","sv","loadingBarStyles"],"mappings":";AAIO,MAAMA,IAA4BC,EAAG;AAAA,EACxC,MAAM;AAAA,EACN,UAAU;AAAA,IACN,SAAS;AAAA,MACL,MAAM;AAAA,IACV;AAAA,IACA,MAAM;AAAA,MACF,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,WAAW;AAAA,IACf;AAAA,IACA,OAAO;AAAA,MACH,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,IACd;AAAA,EACJ;AACJ,CAAC,GAEYC,IAAmBD,EAAG;AAAA,EAC/B,MAAM;AAAA,EACN,UAAU;AAAA,IACN,OAAO;AAAA,MACH,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,IACd;AAAA,IACA,oBAAoB;AAAA,MAChB,MAAM;AAAA,MACN,OAAO;AAAA,IACX;AAAA,EACJ;AACJ,CAAC;"}
|
|
@@ -1,18 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
spacious: "tw-px-3 tw-py-2",
|
|
7
|
-
compact: "tw-px-2 tw-py-1"
|
|
8
|
-
}
|
|
9
|
-
},
|
|
10
|
-
defaultVariants: {
|
|
11
|
-
padding: "spacious"
|
|
1
|
+
import { useMemo as f, useCallback as d, useState as v, useRef as S, useEffect as m } from "react";
|
|
2
|
+
const U = ({
|
|
3
|
+
prop: e,
|
|
4
|
+
defaultProp: n,
|
|
5
|
+
onChange: s = () => {
|
|
12
6
|
}
|
|
13
|
-
})
|
|
7
|
+
}) => {
|
|
8
|
+
const [o, c] = b({ defaultProp: n, onChange: s }), t = e !== void 0, i = t ? e : o, r = f(() => s, [s]), a = d(
|
|
9
|
+
(l) => {
|
|
10
|
+
if (t) {
|
|
11
|
+
const u = typeof l == "function" ? l(e) : l;
|
|
12
|
+
u !== e && r(u);
|
|
13
|
+
} else
|
|
14
|
+
c(l);
|
|
15
|
+
},
|
|
16
|
+
[t, e, c, r]
|
|
17
|
+
);
|
|
18
|
+
return [i, a];
|
|
19
|
+
}, b = ({ defaultProp: e, onChange: n }) => {
|
|
20
|
+
const s = v(e), [o] = s, c = S(o), t = f(() => n, [n]);
|
|
21
|
+
return m(() => {
|
|
22
|
+
c.current !== o && (t == null || t(o), c.current = o);
|
|
23
|
+
}, [o, c, t]), s;
|
|
24
|
+
};
|
|
14
25
|
export {
|
|
15
|
-
|
|
16
|
-
o as tooltipContentStyles
|
|
26
|
+
U as useControllableState
|
|
17
27
|
};
|
|
18
28
|
//# sourceMappingURL=fondue-components25.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components25.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"fondue-components25.js","sources":["../src/hooks/useControllableState.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Dispatch, type SetStateAction, useCallback, useMemo, useState, useRef, useEffect } from 'react';\n\n// Radix UI handy hook for handling controlled and uncontrolled state\n// Source: https://github.com/radix-ui/primitives/blob/main/packages/react/use-controllable-state/src/useControllableState.tsx\n\ntype UseControllableStateParams<TValue> = {\n prop?: TValue;\n defaultProp?: TValue;\n onChange?: (state: TValue) => void;\n};\n\ntype SetStateFn<T> = (prevState?: T) => T;\n\nexport const useControllableState = <TValue>({\n prop,\n defaultProp,\n onChange = () => {},\n}: UseControllableStateParams<TValue>) => {\n const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });\n const isControlled = prop !== undefined;\n const value = isControlled ? prop : uncontrolledProp;\n const handleChange = useMemo(() => onChange, [onChange]);\n\n const setValue: Dispatch<SetStateAction<TValue | undefined>> = useCallback(\n (nextValue) => {\n if (isControlled) {\n const setter = nextValue as SetStateFn<TValue>;\n const value = typeof nextValue === 'function' ? setter(prop) : nextValue;\n if (value !== prop) {\n handleChange(value as TValue);\n }\n } else {\n setUncontrolledProp(nextValue);\n }\n },\n [isControlled, prop, setUncontrolledProp, handleChange],\n );\n\n return [value, setValue] as const;\n};\n\nconst useUncontrolledState = <TValue>({ defaultProp, onChange }: Omit<UseControllableStateParams<TValue>, 'prop'>) => {\n const uncontrolledState = useState<TValue | undefined>(defaultProp);\n const [value] = uncontrolledState;\n const prevValueRef = useRef(value);\n const handleChange = useMemo(() => onChange, [onChange]);\n\n useEffect(() => {\n if (prevValueRef.current !== value) {\n handleChange?.(value as TValue);\n prevValueRef.current = value;\n }\n }, [value, prevValueRef, handleChange]);\n\n return uncontrolledState;\n};\n"],"names":["useControllableState","prop","defaultProp","onChange","uncontrolledProp","setUncontrolledProp","useUncontrolledState","isControlled","value","handleChange","useMemo","setValue","useCallback","nextValue","uncontrolledState","useState","prevValueRef","useRef","useEffect"],"mappings":";AAeO,MAAMA,IAAuB,CAAS;AAAA,EACzC,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC,IAAW,MAAM;AAAA,EAAC;AACtB,MAA0C;AAChC,QAAA,CAACC,GAAkBC,CAAmB,IAAIC,EAAqB,EAAE,aAAAJ,GAAa,UAAAC,GAAU,GACxFI,IAAeN,MAAS,QACxBO,IAAQD,IAAeN,IAAOG,GAC9BK,IAAeC,EAAQ,MAAMP,GAAU,CAACA,CAAQ,CAAC,GAEjDQ,IAAyDC;AAAA,IAC3D,CAACC,MAAc;AACX,UAAIN,GAAc;AAEd,cAAMC,IAAQ,OAAOK,KAAc,aADpBA,EACwCZ,CAAI,IAAIY;AAC/D,QAAIL,MAAUP,KACVQ,EAAaD,CAAe;AAAA,MAChC;AAEA,QAAAH,EAAoBQ,CAAS;AAAA,IAErC;AAAA,IACA,CAACN,GAAcN,GAAMI,GAAqBI,CAAY;AAAA,EAAA;AAGnD,SAAA,CAACD,GAAOG,CAAQ;AAC3B,GAEML,IAAuB,CAAS,EAAE,aAAAJ,GAAa,UAAAC,QAAiE;AAC5G,QAAAW,IAAoBC,EAA6Bb,CAAW,GAC5D,CAACM,CAAK,IAAIM,GACVE,IAAeC,EAAOT,CAAK,GAC3BC,IAAeC,EAAQ,MAAMP,GAAU,CAACA,CAAQ,CAAC;AAEvD,SAAAe,EAAU,MAAM;AACR,IAAAF,EAAa,YAAYR,MACzBC,KAAA,QAAAA,EAAeD,IACfQ,EAAa,UAAUR;AAAA,EAE5B,GAAA,CAACA,GAAOQ,GAAcP,CAAY,CAAC,GAE/BK;AACX;"}
|