@frontify/fondue-components 24.0.0 → 25.0.0-rc.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 +52 -48
- package/dist/fondue-components.js.map +1 -1
- package/dist/fondue-components10.js +3 -3
- package/dist/fondue-components10.js.map +1 -1
- package/dist/fondue-components11.js +104 -86
- package/dist/fondue-components11.js.map +1 -1
- package/dist/fondue-components12.js +2 -2
- package/dist/fondue-components13.js +58 -57
- package/dist/fondue-components13.js.map +1 -1
- package/dist/fondue-components14.js +2 -2
- package/dist/fondue-components15.js +2 -2
- package/dist/fondue-components16.js +2 -2
- package/dist/fondue-components17.js +56 -36
- package/dist/fondue-components17.js.map +1 -1
- package/dist/fondue-components18.js +34 -16
- package/dist/fondue-components18.js.map +1 -1
- package/dist/fondue-components19.js +18 -73
- package/dist/fondue-components19.js.map +1 -1
- package/dist/fondue-components20.js +18 -36
- package/dist/fondue-components20.js.map +1 -1
- package/dist/fondue-components21.js +71 -50
- package/dist/fondue-components21.js.map +1 -1
- package/dist/fondue-components22.js +36 -138
- package/dist/fondue-components22.js.map +1 -1
- package/dist/fondue-components23.js +50 -50
- package/dist/fondue-components23.js.map +1 -1
- package/dist/fondue-components24.js +137 -99
- package/dist/fondue-components24.js.map +1 -1
- package/dist/fondue-components25.js +48 -26
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components26.js +92 -188
- package/dist/fondue-components26.js.map +1 -1
- package/dist/fondue-components27.js +30 -134
- package/dist/fondue-components27.js.map +1 -1
- package/dist/fondue-components28.js +191 -126
- package/dist/fondue-components28.js.map +1 -1
- package/dist/fondue-components29.js +134 -30
- package/dist/fondue-components29.js.map +1 -1
- package/dist/fondue-components3.js +1 -1
- package/dist/fondue-components30.js +130 -63
- package/dist/fondue-components30.js.map +1 -1
- package/dist/fondue-components31.js +31 -105
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components32.js +64 -36
- package/dist/fondue-components32.js.map +1 -1
- package/dist/fondue-components33.js +111 -53
- package/dist/fondue-components33.js.map +1 -1
- package/dist/fondue-components34.js +36 -20
- package/dist/fondue-components34.js.map +1 -1
- package/dist/fondue-components35.js +57 -23
- package/dist/fondue-components35.js.map +1 -1
- package/dist/fondue-components36.js +20 -7
- package/dist/fondue-components36.js.map +1 -1
- package/dist/fondue-components37.js +23 -6
- package/dist/fondue-components37.js.map +1 -1
- package/dist/fondue-components38.js +8 -32
- package/dist/fondue-components38.js.map +1 -1
- package/dist/fondue-components39.js +5 -3
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components4.js +3 -3
- package/dist/fondue-components40.js +32 -12
- package/dist/fondue-components40.js.map +1 -1
- package/dist/fondue-components41.js +5 -155
- package/dist/fondue-components41.js.map +1 -1
- package/dist/fondue-components42.js +18 -116
- package/dist/fondue-components42.js.map +1 -1
- package/dist/fondue-components43.js +59 -22
- package/dist/fondue-components43.js.map +1 -1
- package/dist/fondue-components44.js +111 -14
- package/dist/fondue-components44.js.map +1 -1
- package/dist/fondue-components45.js +116 -30
- package/dist/fondue-components45.js.map +1 -1
- package/dist/fondue-components46.js +21 -54
- package/dist/fondue-components46.js.map +1 -1
- package/dist/fondue-components47.js +32 -131
- package/dist/fondue-components47.js.map +1 -1
- package/dist/fondue-components48.js +53 -20
- package/dist/fondue-components48.js.map +1 -1
- package/dist/fondue-components49.js +131 -53
- package/dist/fondue-components49.js.map +1 -1
- package/dist/fondue-components5.js +2 -2
- package/dist/fondue-components50.js +20 -7
- package/dist/fondue-components50.js.map +1 -1
- package/dist/fondue-components51.js +53 -13
- package/dist/fondue-components51.js.map +1 -1
- package/dist/fondue-components52.js +7 -14
- package/dist/fondue-components52.js.map +1 -1
- package/dist/fondue-components53.js +13 -5
- package/dist/fondue-components53.js.map +1 -1
- package/dist/fondue-components54.js +15 -60
- package/dist/fondue-components54.js.map +1 -1
- package/dist/fondue-components55.js +5 -18
- package/dist/fondue-components55.js.map +1 -1
- package/dist/fondue-components56.js +60 -19
- package/dist/fondue-components56.js.map +1 -1
- package/dist/fondue-components57.js +18 -5
- package/dist/fondue-components57.js.map +1 -1
- package/dist/fondue-components58.js +18 -14
- package/dist/fondue-components58.js.map +1 -1
- package/dist/fondue-components59.js +1 -1
- package/dist/fondue-components6.js +4 -4
- package/dist/fondue-components60.js +10 -16
- package/dist/fondue-components60.js.map +1 -1
- package/dist/fondue-components61.js +4 -10
- package/dist/fondue-components61.js.map +1 -1
- package/dist/fondue-components62.js +18 -35
- package/dist/fondue-components62.js.map +1 -1
- package/dist/fondue-components63.js +10 -4
- package/dist/fondue-components63.js.map +1 -1
- package/dist/fondue-components64.js +34 -10
- package/dist/fondue-components64.js.map +1 -1
- package/dist/fondue-components65.js +35 -5
- package/dist/fondue-components65.js.map +1 -1
- package/dist/fondue-components66.js +4 -24
- package/dist/fondue-components66.js.map +1 -1
- package/dist/fondue-components67.js +12 -16
- package/dist/fondue-components67.js.map +1 -1
- package/dist/fondue-components68.js +4 -151
- package/dist/fondue-components68.js.map +1 -1
- package/dist/fondue-components69.js +25 -19
- package/dist/fondue-components69.js.map +1 -1
- package/dist/fondue-components7.js +2 -2
- package/dist/fondue-components70.js +16 -78
- package/dist/fondue-components70.js.map +1 -1
- package/dist/fondue-components71.js +152 -8
- package/dist/fondue-components71.js.map +1 -1
- package/dist/fondue-components72.js +19 -37
- package/dist/fondue-components72.js.map +1 -1
- package/dist/fondue-components73.js +77 -69
- package/dist/fondue-components73.js.map +1 -1
- package/dist/fondue-components74.js +8 -11
- package/dist/fondue-components74.js.map +1 -1
- package/dist/fondue-components75.js +36 -10
- package/dist/fondue-components75.js.map +1 -1
- package/dist/fondue-components76.js +70 -12
- package/dist/fondue-components76.js.map +1 -1
- package/dist/fondue-components77.js +10 -12
- package/dist/fondue-components77.js.map +1 -1
- package/dist/fondue-components78.js +10 -22
- package/dist/fondue-components78.js.map +1 -1
- package/dist/fondue-components79.js +13 -34
- package/dist/fondue-components79.js.map +1 -1
- package/dist/fondue-components8.js +5 -5
- package/dist/fondue-components80.js +12 -10
- package/dist/fondue-components80.js.map +1 -1
- package/dist/fondue-components81.js +22 -67
- package/dist/fondue-components81.js.map +1 -1
- package/dist/fondue-components82.js +34 -15
- package/dist/fondue-components82.js.map +1 -1
- package/dist/fondue-components83.js +9 -24
- package/dist/fondue-components83.js.map +1 -1
- package/dist/fondue-components84.js +67 -18
- package/dist/fondue-components84.js.map +1 -1
- package/dist/fondue-components85.js +14 -22
- package/dist/fondue-components85.js.map +1 -1
- package/dist/fondue-components86.js +24 -6
- package/dist/fondue-components86.js.map +1 -1
- package/dist/fondue-components87.js +18 -19
- package/dist/fondue-components87.js.map +1 -1
- package/dist/fondue-components88.js +24 -6
- package/dist/fondue-components88.js.map +1 -1
- package/dist/fondue-components89.js +8 -16
- package/dist/fondue-components89.js.map +1 -1
- package/dist/fondue-components9.js +5 -5
- package/dist/fondue-components90.js +20 -2
- package/dist/fondue-components90.js.map +1 -1
- package/dist/fondue-components91.js +5 -3
- package/dist/fondue-components91.js.map +1 -1
- package/dist/fondue-components92.js +4 -4
- package/dist/fondue-components92.js.map +1 -1
- package/dist/fondue-components93.js +4 -39
- package/dist/fondue-components93.js.map +1 -1
- package/dist/fondue-components94.js +2 -21
- package/dist/fondue-components94.js.map +1 -1
- package/dist/fondue-components95.js +43 -0
- package/dist/fondue-components95.js.map +1 -0
- package/dist/fondue-components96.js +24 -0
- package/dist/fondue-components96.js.map +1 -0
- package/dist/fondue-components97.js +20 -0
- package/dist/fondue-components97.js.map +1 -0
- package/dist/index.d.ts +143 -4
- package/dist/style.css +1 -1
- package/package.json +6 -6
|
@@ -1,39 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}, b) => /* @__PURE__ */ n(
|
|
18
|
-
"section",
|
|
19
|
-
{
|
|
20
|
-
className: f.root,
|
|
21
|
-
"data-test-id": a,
|
|
22
|
-
style: c(l),
|
|
23
|
-
role: r,
|
|
24
|
-
"aria-label": i,
|
|
25
|
-
"aria-hidden": o,
|
|
26
|
-
"aria-describedby": d,
|
|
27
|
-
"aria-labelledby": s,
|
|
28
|
-
"aria-expanded": t,
|
|
29
|
-
"aria-haspopup": p,
|
|
30
|
-
ref: b,
|
|
31
|
-
children: e
|
|
32
|
-
}
|
|
33
|
-
)
|
|
34
|
-
);
|
|
35
|
-
y.displayName = "Section";
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as i, useContext as s, useMemo as m } from "react";
|
|
3
|
+
const e = i({
|
|
4
|
+
navigate: () => {
|
|
5
|
+
throw new Error("RouterProvider: `navigate` function is not implemented");
|
|
6
|
+
},
|
|
7
|
+
// eslint-disable-next-line @eslint-react/no-unnecessary-use-prefix
|
|
8
|
+
useHref: () => {
|
|
9
|
+
throw new Error("RouterProvider: `useHref` function is not implemented");
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
e.displayName = "RouterContext";
|
|
13
|
+
const a = () => s(e), x = ({ children: r, navigate: t, useHref: o }) => {
|
|
14
|
+
const n = m(() => ({ navigate: t, useHref: o }), [t, o]);
|
|
15
|
+
return /* @__PURE__ */ u(e.Provider, { value: n, children: r });
|
|
16
|
+
};
|
|
36
17
|
export {
|
|
37
|
-
|
|
18
|
+
x as RouterProvider,
|
|
19
|
+
a as useFondueRouter
|
|
38
20
|
};
|
|
39
21
|
//# sourceMappingURL=fondue-components20.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components20.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"fondue-components20.js","sources":["../src/components/RouterProvider/RouterProvider.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { createContext, useContext, useMemo, type ReactNode } from 'react';\n\nexport type RouterProviderProps = {\n children: ReactNode;\n /**\n * Function to navigate to a specific path\n */\n navigate: (path: string) => void;\n /**\n * Function to resolves a URL against the current location.\n */\n useHref: (path: string) => string;\n};\n\nconst RouterContext = createContext<{\n navigate: (path: string) => void;\n useHref: (path: string) => string;\n}>({\n navigate: () => {\n throw new Error('RouterProvider: `navigate` function is not implemented');\n },\n // eslint-disable-next-line @eslint-react/no-unnecessary-use-prefix\n useHref: () => {\n throw new Error('RouterProvider: `useHref` function is not implemented');\n },\n});\nRouterContext.displayName = 'RouterContext';\n\nexport const useFondueRouter = () => {\n return useContext(RouterContext);\n};\n\nexport const RouterProvider = ({ children, navigate, useHref }: RouterProviderProps) => {\n const contextValue = useMemo(() => ({ navigate, useHref }), [navigate, useHref]);\n\n return <RouterContext.Provider value={contextValue}>{children}</RouterContext.Provider>;\n};\n"],"names":["RouterContext","createContext","useFondueRouter","useContext","RouterProvider","children","navigate","useHref","contextValue","useMemo"],"mappings":";;AAgBA,MAAMA,IAAgBC,EAGnB;AAAA,EACC,UAAU,MAAM;AACZ,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC5E;AAAA;AAAA,EAEA,SAAS,MAAM;AACX,UAAM,IAAI,MAAM,uDAAuD;AAAA,EAC3E;AACJ,CAAC;AACDD,EAAc,cAAc;AAErB,MAAME,IAAkB,MACpBC,EAAWH,CAAa,GAGtBI,IAAiB,CAAC,EAAE,UAAAC,GAAU,UAAAC,GAAU,SAAAC,QAAmC;AACpF,QAAMC,IAAeC,EAAQ,OAAO,EAAE,UAAAH,GAAU,SAAAC,MAAY,CAACD,GAAUC,CAAO,CAAC;AAE/E,2BAAQP,EAAc,UAAd,EAAuB,OAAOQ,GAAe,UAAAH,GAAS;AAClE;"}
|
|
@@ -1,58 +1,79 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return /* @__PURE__ */ l(
|
|
20
|
-
n.Root,
|
|
1
|
+
import { jsxs as h, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import * as a from "@radix-ui/react-scroll-area";
|
|
3
|
+
import { forwardRef as p } from "react";
|
|
4
|
+
import { useFondueTheme as u } from "./fondue-components34.js";
|
|
5
|
+
import o from "./fondue-components67.js";
|
|
6
|
+
const f = ({
|
|
7
|
+
type: t = "hover",
|
|
8
|
+
maxHeight: e = "100%",
|
|
9
|
+
maxWidth: s = "100%",
|
|
10
|
+
showShadow: c = !1,
|
|
11
|
+
scrollbarGutter: i = "auto",
|
|
12
|
+
padding: m,
|
|
13
|
+
children: n,
|
|
14
|
+
"data-test-id": r = "fondue-scroll-area"
|
|
15
|
+
}, d) => {
|
|
16
|
+
const { dir: b } = u();
|
|
17
|
+
return /* @__PURE__ */ h(
|
|
18
|
+
a.Root,
|
|
21
19
|
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
className:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
value: C,
|
|
29
|
-
type: "single",
|
|
30
|
-
asChild: !1,
|
|
31
|
-
"data-hug-width": f,
|
|
32
|
-
"aria-disabled": m.disabled,
|
|
20
|
+
type: t,
|
|
21
|
+
dir: b,
|
|
22
|
+
className: o.root,
|
|
23
|
+
style: { maxWidth: s },
|
|
24
|
+
"data-test-id": r,
|
|
25
|
+
ref: d,
|
|
33
26
|
children: [
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
/* @__PURE__ */ l(
|
|
28
|
+
a.Viewport,
|
|
29
|
+
{
|
|
30
|
+
className: o.viewport,
|
|
31
|
+
style: { maxHeight: e },
|
|
32
|
+
"data-scroll-padding": m,
|
|
33
|
+
"data-show-shadow": c,
|
|
34
|
+
"data-scrollbar-type": t,
|
|
35
|
+
"data-scrollbar-gutter": i,
|
|
36
|
+
"data-test-id": `${r}-viewport`,
|
|
37
|
+
children: n
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
/* @__PURE__ */ l(
|
|
41
|
+
a.Scrollbar,
|
|
42
|
+
{
|
|
43
|
+
className: o.scrollbar,
|
|
44
|
+
orientation: "vertical",
|
|
45
|
+
"data-test-id": `${r}-vertical-scrollbar`,
|
|
46
|
+
children: /* @__PURE__ */ l(
|
|
47
|
+
a.Thumb,
|
|
48
|
+
{
|
|
49
|
+
className: o.thumb,
|
|
50
|
+
"data-test-id": `${r}-vertical-scrollbar-thumb`
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ l(
|
|
56
|
+
a.Scrollbar,
|
|
57
|
+
{
|
|
58
|
+
className: o.scrollbar,
|
|
59
|
+
orientation: "horizontal",
|
|
60
|
+
"data-test-id": `${r}-horizontal-scrollbar`,
|
|
61
|
+
children: /* @__PURE__ */ l(
|
|
62
|
+
a.Thumb,
|
|
63
|
+
{
|
|
64
|
+
className: o.thumb,
|
|
65
|
+
"data-test-id": `${r}-horizontal-scrollbar-thumb`
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ l(a.Corner, { className: o.corner, "data-test-id": `${r}-corner` })
|
|
36
71
|
]
|
|
37
72
|
}
|
|
38
73
|
);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const c = ({ children: a, ...o }, s) => /* @__PURE__ */ l(n.Item, { ref: s, ...o, className: e.item, asChild: !1, children: [
|
|
42
|
-
/* @__PURE__ */ t("span", { className: e.separator }),
|
|
43
|
-
/* @__PURE__ */ l("span", { className: e.itemLabel, children: [
|
|
44
|
-
/* @__PURE__ */ t("span", { className: e.itemLabelActive, children: a }),
|
|
45
|
-
/* @__PURE__ */ t("span", { className: e.itemLabelInactive, children: a })
|
|
46
|
-
] })
|
|
47
|
-
] });
|
|
48
|
-
c.displayName = "SegmentedControl.Item";
|
|
49
|
-
const S = {
|
|
50
|
-
Root: i(d),
|
|
51
|
-
Item: i(c)
|
|
52
|
-
};
|
|
74
|
+
}, N = p(f);
|
|
75
|
+
N.displayName = "ScrollArea";
|
|
53
76
|
export {
|
|
54
|
-
|
|
55
|
-
c as SegmentedControlItem,
|
|
56
|
-
d as SegmentedControlRoot
|
|
77
|
+
N as ScrollArea
|
|
57
78
|
};
|
|
58
79
|
//# 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/ScrollArea/ScrollArea.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as RadixScrollArea from '@radix-ui/react-scroll-area';\nimport { type ForwardedRef, forwardRef, type ReactElement, type ReactNode } from 'react';\n\nimport { useFondueTheme } from '../ThemeProvider/ThemeProvider';\n\nimport styles from './styles/scrollArea.module.scss';\n\nexport type ScrollAreaProps = {\n /**\n * \"auto\" visible when content is overflowing on the corresponding orientation.\n * \"always\" always visible regardless of whether the content is overflowing. Sets the scrollbar gutter to stable.\n * \"scroll\" visible when the user is scrolling along its corresponding orientation.\n * \"hover\" when the user is hovering over the scroll area.\n * @default 'hover'\n */\n type?: 'auto' | 'always' | 'scroll' | 'hover';\n /**\n * Determines if the scrollbar should take up space in the content area\n * @default 'auto'\n */\n scrollbarGutter?: 'auto' | 'stable' | 'stable-horizontal' | 'stable-vertical';\n /**\n * Maximum height of the scroll area\n * @default '100%'\n */\n maxHeight?: string | number;\n /**\n * Minimum width of the scroll area\n * @default '100%'\n */\n maxWidth?: string | number;\n /**\n * Define the padding of the scroll area\n * @default \"compact\"\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * Determines if a inset shadow should be shown the edge of the component\n */\n showShadow?: boolean;\n 'data-test-id'?: string;\n children: ReactNode;\n};\n\nconst ScrollAreaComponent = (\n {\n type = 'hover',\n maxHeight = '100%',\n maxWidth = '100%',\n showShadow = false,\n scrollbarGutter = 'auto',\n padding,\n children,\n 'data-test-id': dataTestId = 'fondue-scroll-area',\n }: ScrollAreaProps,\n ref: ForwardedRef<HTMLDivElement>,\n): ReactElement => {\n const { dir } = useFondueTheme();\n\n return (\n <RadixScrollArea.Root\n type={type}\n dir={dir}\n className={styles.root}\n style={{ maxWidth }}\n data-test-id={dataTestId}\n ref={ref}\n >\n <RadixScrollArea.Viewport\n className={styles.viewport}\n style={{ maxHeight }}\n data-scroll-padding={padding}\n data-show-shadow={showShadow}\n data-scrollbar-type={type}\n data-scrollbar-gutter={scrollbarGutter}\n data-test-id={`${dataTestId}-viewport`}\n >\n {children}\n </RadixScrollArea.Viewport>\n <RadixScrollArea.Scrollbar\n className={styles.scrollbar}\n orientation=\"vertical\"\n data-test-id={`${dataTestId}-vertical-scrollbar`}\n >\n <RadixScrollArea.Thumb\n className={styles.thumb}\n data-test-id={`${dataTestId}-vertical-scrollbar-thumb`}\n />\n </RadixScrollArea.Scrollbar>\n <RadixScrollArea.Scrollbar\n className={styles.scrollbar}\n orientation=\"horizontal\"\n data-test-id={`${dataTestId}-horizontal-scrollbar`}\n >\n <RadixScrollArea.Thumb\n className={styles.thumb}\n data-test-id={`${dataTestId}-horizontal-scrollbar-thumb`}\n />\n </RadixScrollArea.Scrollbar>\n <RadixScrollArea.Corner className={styles.corner} data-test-id={`${dataTestId}-corner`} />\n </RadixScrollArea.Root>\n );\n};\n\nexport const ScrollArea = forwardRef<HTMLDivElement, ScrollAreaProps>(ScrollAreaComponent);\nScrollArea.displayName = 'ScrollArea';\n"],"names":["ScrollAreaComponent","type","maxHeight","maxWidth","showShadow","scrollbarGutter","padding","children","dataTestId","ref","dir","useF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c,GAAGN,CAAU;AAAA,YAE3B,UAAA,gBAAAO;AAAA,cAACF,EAAgB;AAAA,cAAhB;AAAA,gBACG,WAAWC,EAAO;AAAA,gBAClB,gBAAc,GAAGN,CAAU;AAAA,cAAA;AAAA,YAAA;AAAA,UAC/B;AAAA,QAAA;AAAA,QAEJ,gBAAAO,EAACF,EAAgB,QAAhB,EAAuB,WAAWC,EAAO,QAAQ,gBAAc,GAAGN,CAAU,UAAA,CAAW;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGpG,GAEaQ,IAAaC,EAA4CjB,CAAmB;AACzFgB,EAAW,cAAc;"}
|
|
@@ -1,141 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
f(!1);
|
|
37
|
-
},
|
|
38
|
-
onHighlightedIndexChange: () => {
|
|
39
|
-
f(!0);
|
|
40
|
-
},
|
|
41
|
-
onSelectedItemChange: ({ selectedItem: e }) => {
|
|
42
|
-
s == null || s((e == null ? void 0 : e.value) ?? null);
|
|
43
|
-
},
|
|
44
|
-
itemToString: (e) => e ? e.label : ""
|
|
45
|
-
}), H = r ? !R && r.children || r.label : N;
|
|
46
|
-
return /* @__PURE__ */ d(g.Root, { open: j, children: [
|
|
47
|
-
/* @__PURE__ */ a(
|
|
48
|
-
g.Anchor,
|
|
49
|
-
{
|
|
50
|
-
asChild: !0,
|
|
51
|
-
onMouseDown: (e) => {
|
|
52
|
-
i.current = !0, e.currentTarget.dataset.showFocusRing = "false";
|
|
53
|
-
},
|
|
54
|
-
onFocus: (e) => {
|
|
55
|
-
i.current || (e.target.dataset.showFocusRing = "true");
|
|
56
|
-
},
|
|
57
|
-
onBlur: (e) => {
|
|
58
|
-
e.target.dataset.showFocusRing = "false", i.current = !1;
|
|
59
|
-
},
|
|
60
|
-
children: /* @__PURE__ */ d(
|
|
61
|
-
"div",
|
|
62
|
-
{
|
|
63
|
-
className: o.root,
|
|
64
|
-
"data-status": n,
|
|
65
|
-
"data-disabled": m,
|
|
66
|
-
"data-empty": !r,
|
|
67
|
-
"data-test-id": c,
|
|
68
|
-
...m ? {} : O({
|
|
69
|
-
"aria-label": "aria-label" in l ? l["aria-label"] : void 0,
|
|
70
|
-
ref: F
|
|
71
|
-
}),
|
|
72
|
-
children: [
|
|
73
|
-
/* @__PURE__ */ a("span", { className: o.selectedValue, children: H }),
|
|
74
|
-
v,
|
|
75
|
-
u ? /* @__PURE__ */ a(
|
|
76
|
-
q,
|
|
77
|
-
{
|
|
78
|
-
onClick: (e) => {
|
|
79
|
-
e.stopPropagation(), V();
|
|
80
|
-
},
|
|
81
|
-
className: o.clear,
|
|
82
|
-
children: u
|
|
83
|
-
}
|
|
84
|
-
) : null,
|
|
85
|
-
/* @__PURE__ */ d("div", { className: o.icons, children: [
|
|
86
|
-
/* @__PURE__ */ a(T, { size: 16, className: o.caret }),
|
|
87
|
-
n === "success" ? /* @__PURE__ */ a(
|
|
88
|
-
$,
|
|
89
|
-
{
|
|
90
|
-
size: 16,
|
|
91
|
-
className: o.iconSuccess,
|
|
92
|
-
"data-test-id": `${c}-success-icon`
|
|
93
|
-
}
|
|
94
|
-
) : null,
|
|
95
|
-
n === "error" ? /* @__PURE__ */ a(
|
|
96
|
-
A,
|
|
97
|
-
{
|
|
98
|
-
size: 16,
|
|
99
|
-
className: o.iconError,
|
|
100
|
-
"data-test-id": `${c}-error-icon`
|
|
101
|
-
}
|
|
102
|
-
) : null
|
|
103
|
-
] })
|
|
104
|
-
]
|
|
105
|
-
}
|
|
106
|
-
)
|
|
107
|
-
}
|
|
108
|
-
),
|
|
109
|
-
/* @__PURE__ */ a(
|
|
110
|
-
Y,
|
|
111
|
-
{
|
|
112
|
-
align: w,
|
|
113
|
-
side: y,
|
|
114
|
-
highlightedIndex: E,
|
|
115
|
-
getMenuProps: z,
|
|
116
|
-
getItemProps: D,
|
|
117
|
-
selectedItem: r,
|
|
118
|
-
hasInteractedSinceOpening: G,
|
|
119
|
-
viewportCollisionPadding: x,
|
|
120
|
-
children: k
|
|
121
|
-
}
|
|
122
|
-
)
|
|
123
|
-
] });
|
|
124
|
-
};
|
|
125
|
-
S.displayName = "Select";
|
|
126
|
-
const ee = K(S), t = ee;
|
|
127
|
-
t.displayName = "Select";
|
|
128
|
-
t.Combobox = U;
|
|
129
|
-
t.Combobox.displayName = "Select.Combobox";
|
|
130
|
-
t.Item = W;
|
|
131
|
-
t.Item.displayName = "Select.Item";
|
|
132
|
-
t.Group = X;
|
|
133
|
-
t.Group.displayName = "Select.Group";
|
|
134
|
-
t.Slot = Z;
|
|
135
|
-
t.Slot.displayName = "Select.Slot";
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as m } from "react";
|
|
3
|
+
import { propsToCssVariables as c } from "./fondue-components40.js";
|
|
4
|
+
import f from "./fondue-components68.js";
|
|
5
|
+
const y = m(
|
|
6
|
+
({
|
|
7
|
+
"data-test-id": a = "fondue-section",
|
|
8
|
+
children: e,
|
|
9
|
+
role: r,
|
|
10
|
+
"aria-label": i,
|
|
11
|
+
"aria-hidden": o,
|
|
12
|
+
"aria-describedby": d,
|
|
13
|
+
"aria-labelledby": s,
|
|
14
|
+
"aria-expanded": t,
|
|
15
|
+
"aria-haspopup": p,
|
|
16
|
+
...l
|
|
17
|
+
}, b) => /* @__PURE__ */ n(
|
|
18
|
+
"section",
|
|
19
|
+
{
|
|
20
|
+
className: f.root,
|
|
21
|
+
"data-test-id": a,
|
|
22
|
+
style: c(l),
|
|
23
|
+
role: r,
|
|
24
|
+
"aria-label": i,
|
|
25
|
+
"aria-hidden": o,
|
|
26
|
+
"aria-describedby": d,
|
|
27
|
+
"aria-labelledby": s,
|
|
28
|
+
"aria-expanded": t,
|
|
29
|
+
"aria-haspopup": p,
|
|
30
|
+
ref: b,
|
|
31
|
+
children: e
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
);
|
|
35
|
+
y.displayName = "Section";
|
|
136
36
|
export {
|
|
137
|
-
|
|
138
|
-
t as Select,
|
|
139
|
-
S as SelectInput
|
|
37
|
+
y as Section
|
|
140
38
|
};
|
|
141
39
|
//# sourceMappingURL=fondue-components22.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components22.js","sources":["../src/components/Select/Select.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown, IconCheckMark, IconExclamationMarkTriangle } from '@frontify/fondue-icons';\nimport * as RadixPopover from '@radix-ui/react-popover';\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { useSelect } from 'downshift';\nimport { forwardRef, useRef, useState, type ForwardedRef, type ReactNode } from 'react';\n\nimport { type CommonAriaProps } from '#/helpers/aria';\n\nimport { ForwardedRefCombobox } from './Combobox';\nimport { ForwardedRefSelectItem, ForwardedRefSelectItemGroup } from './SelectItem';\nimport { SelectMenu, type SelectMenuViewportCollisionPadding } from './SelectMenu';\nimport { ForwardedRefSelectSlot } from './SelectSlot';\nimport styles from './styles/select.module.scss';\nimport { useSelectData } from './useSelectData';\n\nexport type SelectComponentProps = {\n /**\n * Children of the Select component. This can contain the `Select.Slot` components for the label, decorators, clear action and menu.\n */\n children?: ReactNode;\n /**\n * Callback function that is called when an item is selected.\n */\n onSelect?: (selectedValue: string | null) => void;\n /**\n * The active value in the select component. This is used to control the select externally.\n */\n value?: string | null;\n /**\n * The default value of the select component. Used for uncontrolled usages.\n */\n defaultValue?: string;\n /**\n * The placeholder in the select component.\n */\n placeholder?: string;\n /**\n * Status of the text input\n * @default \"neutral\"\n */\n status?: 'neutral' | 'success' | 'error';\n /**\n * Disables the select component.\n */\n disabled?: boolean;\n /**\n * The alignment of the menu.\n * @default \"start\"\n */\n alignMenu?: 'start' | 'center' | 'end';\n /**\n * Defines the preferred side of the select. It will not be respected if there are collisions with the viewport.\n * @default \"bottom\"\n */\n side?: 'left' | 'right' | 'bottom' | 'top';\n /**\n * The data test id of the select component.\n */\n 'data-test-id'?: string;\n /**\n * Id of the select component\n */\n id?: string;\n /**\n * The value of the select is shown as plain text (from the label prop) when set to true.\n * Items child components are used if set to false\n * @default true\n */\n showStringValue?: boolean;\n /**\n * Define the minimum distance between the select menu and the viewport edge\n * @default 'compact'\n */\n viewportCollisionPadding?: SelectMenuViewportCollisionPadding;\n} & CommonAriaProps;\n\nexport const SelectInput = (\n {\n children,\n onSelect,\n value,\n defaultValue,\n placeholder = '',\n status = 'neutral',\n disabled,\n alignMenu = 'start',\n side = 'bottom',\n id,\n showStringValue = true,\n 'data-test-id': dataTestId = 'fondue-select',\n viewportCollisionPadding = 'compact',\n ...props\n }: SelectComponentProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const { inputSlots, menuSlots, items, clearButton, getItemByValue } = useSelectData(children);\n\n const defaultItem = getItemByValue(defaultValue);\n const activeItem = getItemByValue(value);\n\n const wasClicked = useRef(false);\n\n const [hasInteractedSinceOpening, setHasInteractedSinceOpening] = useState(false);\n\n const { getToggleButtonProps, getMenuProps, getItemProps, reset, selectedItem, isOpen, highlightedIndex } =\n useSelect({\n items,\n defaultSelectedItem: defaultItem,\n selectedItem: activeItem,\n toggleButtonId: id,\n labelId: 'aria-labelledby' in props ? props['aria-labelledby'] : undefined,\n onIsOpenChange: () => {\n setHasInteractedSinceOpening(false);\n },\n onHighlightedIndexChange: () => {\n setHasInteractedSinceOpening(true);\n },\n onSelectedItemChange: ({ selectedItem }) => {\n onSelect?.(selectedItem?.value ?? null);\n },\n itemToString: (item) => (item ? item.label : ''),\n });\n\n const displayedValue = selectedItem\n ? (!showStringValue && selectedItem.children) || selectedItem.label\n : placeholder;\n\n return (\n <RadixPopover.Root open={isOpen}>\n <RadixPopover.Anchor\n asChild\n onMouseDown={(mouseEvent) => {\n wasClicked.current = true;\n mouseEvent.currentTarget.dataset.showFocusRing = 'false';\n }}\n onFocus={(focusEvent) => {\n if (!wasClicked.current) {\n focusEvent.target.dataset.showFocusRing = 'true';\n }\n }}\n onBlur={(blurEvent) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasClicked.current = false;\n }}\n >\n <div\n className={styles.root}\n data-status={status}\n data-disabled={disabled}\n data-empty={!selectedItem}\n data-test-id={dataTestId}\n {...(disabled\n ? {}\n : getToggleButtonProps({\n 'aria-label': 'aria-label' in props ? props['aria-label'] : undefined,\n ref: forwardedRef,\n }))}\n >\n <span className={styles.selectedValue}>{displayedValue}</span>\n {inputSlots}\n {clearButton ? (\n <RadixSlot\n onClick={(event) => {\n event.stopPropagation();\n reset();\n }}\n className={styles.clear}\n >\n {clearButton}\n </RadixSlot>\n ) : null}\n <div className={styles.icons}>\n <IconCaretDown size={16} className={styles.caret} />\n {status === 'success' ? (\n <IconCheckMark\n size={16}\n className={styles.iconSuccess}\n data-test-id={`${dataTestId}-success-icon`}\n />\n ) : null}\n {status === 'error' ? (\n <IconExclamationMarkTriangle\n size={16}\n className={styles.iconError}\n data-test-id={`${dataTestId}-error-icon`}\n />\n ) : null}\n </div>\n </div>\n </RadixPopover.Anchor>\n\n <SelectMenu\n align={alignMenu}\n side={side}\n highlightedIndex={highlightedIndex}\n getMenuProps={getMenuProps}\n getItemProps={getItemProps}\n selectedItem={selectedItem}\n hasInteractedSinceOpening={hasInteractedSinceOpening}\n viewportCollisionPadding={viewportCollisionPadding}\n >\n {menuSlots}\n </SelectMenu>\n </RadixPopover.Root>\n );\n};\nSelectInput.displayName = 'Select';\n\nexport const ForwardedRefSelect = forwardRef<HTMLDivElement, SelectComponentProps>(SelectInput);\n\n// @ts-expect-error We support both Select and Select.Combobox as the Root\nexport const Select: typeof SelectInput & {\n Combobox: typeof ForwardedRefCombobox;\n Item: typeof ForwardedRefSelectItem;\n Group: typeof ForwardedRefSelectItemGroup;\n Slot: typeof ForwardedRefSelectSlot;\n} = ForwardedRefSelect;\nSelect.displayName = 'Select';\nSelect.Combobox = ForwardedRefCombobox;\nSelect.Combobox.displayName = 'Select.Combobox';\nSelect.Item = ForwardedRefSelectItem;\nSelect.Item.displayName = 'Select.Item';\nSelect.Group = ForwardedRefSelectItemGroup;\nSelect.Group.displayName = 'Select.Group';\nSelect.Slot = ForwardedRefSelectSlot;\nSelect.Slot.displayName = 'Select.Slot';\n"],"names":["SelectInput","children","onSelect","value","defaultValue","placeholder","status","disabled","alignMenu","side","id","showStringValue","dataTestId","viewportCollisionPadding","props","forwardedRef","inputSlots","menuSlots","items","clearButton","getItemByValue","useSelectData","defaultItem","activeItem","wasClicked","useRef","hasInteractedSinceOpening","setHasInteractedSinceOpening","useState","getToggleButtonProps","getMenuProps","getItemProps","reset","selectedItem","isOpen","highlightedIndex","useSelect","item","displayedValue","jsxs","RadixPopover","jsx","mouseEvent","focusEvent","blurEvent","styles","RadixSlot","event","IconCaretDown","IconCheckMark","IconExclamationMarkTriangle","SelectMenu","ForwardedRefSelect","forwardRef","Select","ForwardedRefCombobox","ForwardedRefSelectItem","ForwardedRefSelectItemGroup","ForwardedRefSelectSlot"],"mappings":";;;;;;;;;;;;AA8EO,MAAMA,IAAc,CACvB;AAAA,EACI,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,QAAAC,IAAS;AAAA,EACT,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,MAAAC,IAAO;AAAA,EACP,IAAAC;AAA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L,EAAO;AAAA,oBAClB,gBAAc,GAAGjC,CAAU;AAAA,kBAAA;AAAA,gBAAA,IAE/B;AAAA,cAAA,EAAA,CACR;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACJ;AAAA,IAAA;AAAA,IAGJ,gBAAA6B;AAAA,MAACU;AAAA,MAAA;AAAA,QACG,OAAO3C;AAAA,QACP,MAAAC;AAAA,QACA,kBAAA0B;AAAA,QACA,cAAAL;AAAA,QACA,cAAAC;AAAA,QACA,cAAAE;AAAA,QACA,2BAAAP;AAAA,QACA,0BAAAb;AAAA,QAEC,UAAAI;AAAA,MAAA;AAAA,IAAA;AAAA,EACL,GACJ;AAER;AACAjB,EAAY,cAAc;AAEnB,MAAMoD,KAAqBC,EAAiDrD,CAAW,GAGjFsD,IAKTF;AACJE,EAAO,cAAc;AACrBA,EAAO,WAAWC;AAClBD,EAAO,SAAS,cAAc;AAC9BA,EAAO,OAAOE;AACdF,EAAO,KAAK,cAAc;AAC1BA,EAAO,QAAQG;AACfH,EAAO,MAAM,cAAc;AAC3BA,EAAO,OAAOI;AACdJ,EAAO,KAAK,cAAc;"}
|
|
1
|
+
{"version":3,"file":"fondue-components22.js","sources":["../src/components/Section/Section.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { forwardRef, type ReactNode } from 'react';\n\nimport { type CommonAriaProps } from '#/helpers/aria';\nimport { type Responsive, type LayoutComponentProps } from '#/helpers/layout';\nimport { propsToCssVariables } from '#/helpers/propsToCssVariables';\n\nimport styles from './styles/section.module.scss';\n\nexport type SectionProps = LayoutComponentProps & {\n /**\n * The display property.\n * @default 'block'\n */\n display?: Responsive<'none' | 'block' | 'inline-block' | 'inline'>;\n\n children?: ReactNode;\n 'data-test-id'?: string;\n} & CommonAriaProps;\n\nexport const Section = forwardRef<HTMLDivElement, SectionProps>(\n (\n {\n 'data-test-id': dataTestId = 'fondue-section',\n children,\n role,\n 'aria-label': ariaLabel,\n 'aria-hidden': ariaHidden,\n 'aria-describedby': ariaDescribedBy,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-expanded': ariaExpanded,\n 'aria-haspopup': ariaHasPopup,\n ...props\n },\n ref,\n ) => {\n return (\n <section\n className={styles.root}\n data-test-id={dataTestId}\n style={propsToCssVariables(props)}\n role={role}\n aria-label={ariaLabel}\n aria-hidden={ariaHidden}\n aria-describedby={ariaDescribedBy}\n aria-labelledby={ariaLabelledBy}\n aria-expanded={ariaExpanded}\n aria-haspopup={ariaHasPopup}\n ref={ref}\n >\n {children}\n </section>\n );\n },\n);\nSection.displayName = 'Section';\n"],"names":["Section","forwardRef","dataTestId","children","role","ariaLabel","ariaHidden","ariaDescribedBy","ariaLabelledBy","ariaExpanded","ariaHasPopup","props","ref","jsx","styles","propsToCssVariables"],"mappings":";;;;AAqBO,MAAMA,IAAUC;AAAA,EACnB,CACI;AAAA,IACI,gBAAgBC,IAAa;AAAA,IAC7B,UAAAC;AAAA,IACA,MAAAC;AAAA,IACA,cAAcC;AAAA,IACd,eAAeC;AAAA,IACf,oBAAoBC;AAAA,IACpB,mBAAmBC;AAAA,IACnB,iBAAiBC;AAAA,IACjB,iBAAiBC;AAAA,IACjB,GAAGC;AAAA,EAAA,GAEPC,MAGI,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAWC,EAAO;AAAA,MAClB,gBAAcZ;AAAA,MACd,OAAOa,EAAoBJ,CAAK;AAAA,MAChC,MAAAP;AAAA,MACA,cAAYC;AAAA,MACZ,eAAaC;AAAA,MACb,oBAAkBC;AAAA,MAClB,mBAAiBC;AAAA,MACjB,iBAAeC;AAAA,MACf,iBAAeC;AAAA,MACf,KAAAE;AAAA,MAEC,UAAAT;AAAA,IAAA;AAAA,EAAA;AAIjB;AACAH,EAAQ,cAAc;"}
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import * as n from "@radix-ui/react-toggle-group";
|
|
3
|
+
import { forwardRef as i } from "react";
|
|
4
|
+
import { useControllableState as N } from "./fondue-components69.js";
|
|
5
|
+
import e from "./fondue-components70.js";
|
|
6
|
+
const d = ({
|
|
7
|
+
children: a,
|
|
8
|
+
value: o,
|
|
9
|
+
defaultValue: s,
|
|
10
|
+
onValueChange: p,
|
|
11
|
+
hugWidth: f = !0,
|
|
12
|
+
...m
|
|
13
|
+
}, g) => {
|
|
14
|
+
const [C, u] = N({
|
|
15
|
+
prop: o,
|
|
16
|
+
defaultProp: s,
|
|
17
|
+
onChange: p
|
|
18
|
+
});
|
|
19
|
+
return /* @__PURE__ */ l(
|
|
20
|
+
n.Root,
|
|
16
21
|
{
|
|
17
|
-
ref:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
ref: g,
|
|
23
|
+
...m,
|
|
24
|
+
className: e.root,
|
|
25
|
+
onValueChange: (r) => {
|
|
26
|
+
r && u(r);
|
|
27
|
+
},
|
|
28
|
+
value: C,
|
|
29
|
+
type: "single",
|
|
30
|
+
asChild: !1,
|
|
31
|
+
"data-hug-width": f,
|
|
32
|
+
"aria-disabled": m.disabled,
|
|
25
33
|
children: [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
{
|
|
29
|
-
onPointerDown: () => {
|
|
30
|
-
o.current && (o.current.dataset.showFocusRing = "false");
|
|
31
|
-
},
|
|
32
|
-
className: r.track,
|
|
33
|
-
children: /* @__PURE__ */ s(e.Range, { className: r.range })
|
|
34
|
-
}
|
|
35
|
-
),
|
|
36
|
-
(a || n).map((w, u) => /* @__PURE__ */ s(
|
|
37
|
-
e.Thumb,
|
|
38
|
-
{
|
|
39
|
-
ref: o,
|
|
40
|
-
className: r.thumb,
|
|
41
|
-
onPointerDown: (t) => {
|
|
42
|
-
t.currentTarget.dataset.showFocusRing = "false";
|
|
43
|
-
},
|
|
44
|
-
onBlur: (t) => {
|
|
45
|
-
t.currentTarget.dataset.showFocusRing = "true";
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
u
|
|
49
|
-
))
|
|
34
|
+
a,
|
|
35
|
+
/* @__PURE__ */ t("div", { className: e.activeIndicator })
|
|
50
36
|
]
|
|
51
37
|
}
|
|
52
38
|
);
|
|
53
|
-
}
|
|
54
|
-
|
|
39
|
+
};
|
|
40
|
+
d.displayName = "SegmentedControl.Root";
|
|
41
|
+
const c = ({ children: a, ...o }, s) => /* @__PURE__ */ l(n.Item, { ref: s, ...o, className: e.item, asChild: !1, children: [
|
|
42
|
+
/* @__PURE__ */ t("span", { className: e.separator }),
|
|
43
|
+
/* @__PURE__ */ l("span", { className: e.itemLabel, children: [
|
|
44
|
+
/* @__PURE__ */ t("span", { className: e.itemLabelActive, children: a }),
|
|
45
|
+
/* @__PURE__ */ t("span", { className: e.itemLabelInactive, children: a })
|
|
46
|
+
] })
|
|
47
|
+
] });
|
|
48
|
+
c.displayName = "SegmentedControl.Item";
|
|
49
|
+
const S = {
|
|
50
|
+
Root: i(d),
|
|
51
|
+
Item: i(c)
|
|
52
|
+
};
|
|
55
53
|
export {
|
|
56
|
-
|
|
54
|
+
S as SegmentedControl,
|
|
55
|
+
c as SegmentedControlItem,
|
|
56
|
+
d as SegmentedControlRoot
|
|
57
57
|
};
|
|
58
58
|
//# 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/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';\nimport { forwardRef, type ForwardedRef, type ReactElement, type ReactNode } from 'react';\n\nimport { useControllableState } from '#/hooks/useControllableState';\n\nimport styles from './styles/segmentedControl.module.scss';\n\nexport type SegmentedControlRootProps<TValue extends string = string> = {\n id?: string;\n children: ReactNode;\n /**\n * The default value of the segmented control\n * Used for uncontrolled components\n */\n defaultValue: TValue;\n /**\n * The controlled value of the segmented control\n */\n value?: TValue;\n /**\n * Event handler called when the value changes\n */\n onValueChange?: (value: TValue) => void;\n /**\n * Disable the segmented control\n * @default false\n */\n disabled?: boolean;\n /**\n * Specify if the segmented control should only take the width of its content\n * @default true\n */\n hugWidth?: boolean;\n};\n\nexport const SegmentedControlRoot = <TValue extends string = string>(\n {\n children,\n value: propsValue,\n defaultValue,\n onValueChange,\n hugWidth = true,\n ...rootProps\n }: SegmentedControlRootProps<TValue>,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const [value, setValue] = useControllableState({\n prop: propsValue,\n defaultProp: defaultValue,\n onChange: onValueChange,\n });\n\n return (\n <ToggleGroupPrimitive.Root\n ref={ref}\n {...rootProps}\n className={styles.root}\n onValueChange={(value) => {\n if (value) {\n setValue(value as TValue);\n }\n }}\n value={value}\n type=\"single\"\n asChild={false}\n data-hug-width={hugWidth}\n aria-disabled={rootProps.disabled}\n >\n {children}\n {/* Active indicator */}\n <div className={styles.activeIndicator} />\n </ToggleGroupPrimitive.Root>\n );\n};\nSegmentedControlRoot.displayName = 'SegmentedControl.Root';\n\ntype SegmentedControlItemProps = {\n children: ReactNode;\n value: string;\n};\n\nexport const SegmentedControlItem = (\n { children, ...itemProps }: SegmentedControlItemProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => (\n <ToggleGroupPrimitive.Item ref={ref} {...itemProps} className={styles.item} asChild={false}>\n {/* Separator */}\n <span className={styles.separator} />\n <span className={styles.itemLabel}>\n {/* Active children */}\n <span className={styles.itemLabelActive}>{children}</span>\n\n {/* Inactive children */}\n <span className={styles.itemLabelInactive}>{children}</span>\n </span>\n </ToggleGroupPrimitive.Item>\n);\nSegmentedControlItem.displayName = 'SegmentedControl.Item';\n\nexport const SegmentedControl = {\n Root: forwardRef(SegmentedControlRoot) as <TValue extends string = string>(\n props: SegmentedControlRootProps<TValue> & { ref?: ForwardedRef<HTMLDivElement> },\n ) => ReactElement,\n Item: forwardRef(SegmentedControlItem),\n};\n"],"names":["SegmentedControlRoot","children","propsValue","defaultValue","onValueChange","hugWidth","rootProps","ref","value","setValue","useControllableState","jsxs","ToggleGroupPrimitive","styles","jsx","SegmentedControlItem","itemProps","SegmentedControl","forwardRef"],"mappings":";;;;;AAqCO,MAAMA,IAAuB,CAChC;AAAA,EACI,UAAAC;AAAA,EACA,OAAOC;AAAA,EACP,cAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,GAAGC;AACP,GACAC,MACC;AACD,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAqB;AAAA,IAC3C,MAAMR;AAAA,IACN,aAAaC;AAAA,IACb,UAAUC;AAAA,EAAA,CACb;AAED,SACI,gBAAAO;AAAA,IAACC,EAAqB;AAAA,IAArB;AAAA,MACG,KAAAL;AAAA,MACC,GAAGD;AAAA,MACJ,WAAWO,EAAO;AAAA,MAClB,eAAe,CAACL,MAAU;AACtB,QAAIA,KACAC,EAASD,CAAe;AAAA,MAEhC;AAAA,MACA,OAAAA;AAAA,MACA,MAAK;AAAA,MACL,SAAS;AAAA,MACT,kBAAgBH;AAAA,MAChB,iBAAeC,EAAU;AAAA,MAExB,UAAA;AAAA,QAAAL;AAAA,QAED,gBAAAa,EAAC,OAAA,EAAI,WAAWD,EAAO,gBAAA,CAAiB;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGpD;AACAb,EAAqB,cAAc;AAO5B,MAAMe,IAAuB,CAChC,EAAE,UAAAd,GAAU,GAAGe,EAAA,GACfT,MAEA,gBAAAI,EAACC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