@frontify/fondue-components 4.0.0 → 4.0.2
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 +32 -30
- package/dist/fondue-components.js.map +1 -1
- package/dist/fondue-components10.js +2 -2
- package/dist/fondue-components10.js.map +1 -1
- package/dist/fondue-components11.js +41 -37
- package/dist/fondue-components11.js.map +1 -1
- package/dist/fondue-components12.js +2 -2
- package/dist/fondue-components12.js.map +1 -1
- package/dist/fondue-components13.js +1 -1
- package/dist/fondue-components13.js.map +1 -1
- package/dist/fondue-components14.js +1 -1
- package/dist/fondue-components14.js.map +1 -1
- package/dist/fondue-components15.js +1 -1
- package/dist/fondue-components15.js.map +1 -1
- package/dist/fondue-components16.js +2 -2
- package/dist/fondue-components17.js +2 -2
- package/dist/fondue-components17.js.map +1 -1
- package/dist/fondue-components18.js +6 -6
- package/dist/fondue-components18.js.map +1 -1
- package/dist/fondue-components19.js +1 -1
- package/dist/fondue-components19.js.map +1 -1
- package/dist/fondue-components20.js +2 -2
- package/dist/fondue-components20.js.map +1 -1
- package/dist/fondue-components21.js +116 -65
- package/dist/fondue-components21.js.map +1 -1
- package/dist/fondue-components22.js +64 -41
- package/dist/fondue-components22.js.map +1 -1
- package/dist/fondue-components23.js +43 -32
- package/dist/fondue-components23.js.map +1 -1
- package/dist/fondue-components24.js +32 -5
- package/dist/fondue-components24.js.map +1 -1
- package/dist/fondue-components25.js +5 -12
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components26.js +10 -153
- package/dist/fondue-components26.js.map +1 -1
- package/dist/fondue-components27.js +59 -22
- package/dist/fondue-components27.js.map +1 -1
- package/dist/fondue-components28.js +17 -17
- package/dist/fondue-components28.js.map +1 -1
- package/dist/fondue-components29.js +112 -15
- package/dist/fondue-components29.js.map +1 -1
- package/dist/fondue-components3.js +2 -2
- package/dist/fondue-components30.js +19 -30
- package/dist/fondue-components30.js.map +1 -1
- package/dist/fondue-components31.js +32 -28
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components32.js +23 -125
- package/dist/fondue-components32.js.map +1 -1
- package/dist/fondue-components33.js +129 -20
- package/dist/fondue-components33.js.map +1 -1
- package/dist/fondue-components34.js +21 -45
- package/dist/fondue-components34.js.map +1 -1
- package/dist/fondue-components35.js +45 -28
- package/dist/fondue-components35.js.map +1 -1
- package/dist/fondue-components36.js +28 -15
- package/dist/fondue-components36.js.map +1 -1
- package/dist/fondue-components37.js +15 -60
- package/dist/fondue-components37.js.map +1 -1
- package/dist/fondue-components38.js +60 -15
- package/dist/fondue-components38.js.map +1 -1
- package/dist/fondue-components39.js +15 -19
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components4.js +4 -4
- package/dist/fondue-components4.js.map +1 -1
- package/dist/fondue-components40.js +18 -4
- package/dist/fondue-components40.js.map +1 -1
- package/dist/fondue-components41.js +3 -11
- package/dist/fondue-components41.js.map +1 -1
- package/dist/fondue-components42.js +11 -3
- package/dist/fondue-components42.js.map +1 -1
- package/dist/fondue-components43.js +5 -35
- package/dist/fondue-components43.js.map +1 -1
- package/dist/fondue-components44.js +35 -13
- package/dist/fondue-components44.js.map +1 -1
- package/dist/fondue-components45.js +12 -4
- package/dist/fondue-components45.js.map +1 -1
- package/dist/fondue-components46.js +4 -24
- package/dist/fondue-components46.js.map +1 -1
- package/dist/fondue-components47.js +24 -16
- package/dist/fondue-components47.js.map +1 -1
- package/dist/fondue-components48.js +16 -139
- package/dist/fondue-components48.js.map +1 -1
- package/dist/fondue-components49.js +140 -16
- package/dist/fondue-components49.js.map +1 -1
- package/dist/fondue-components5.js +2 -2
- package/dist/fondue-components5.js.map +1 -1
- package/dist/fondue-components50.js +16 -72
- package/dist/fondue-components50.js.map +1 -1
- package/dist/fondue-components51.js +72 -8
- package/dist/fondue-components51.js.map +1 -1
- package/dist/fondue-components52.js +8 -33
- package/dist/fondue-components52.js.map +1 -1
- package/dist/fondue-components53.js +32 -48
- package/dist/fondue-components53.js.map +1 -1
- package/dist/fondue-components54.js +48 -10
- package/dist/fondue-components54.js.map +1 -1
- package/dist/fondue-components55.js +8 -10
- package/dist/fondue-components55.js.map +1 -1
- package/dist/fondue-components56.js +12 -17
- package/dist/fondue-components56.js.map +1 -1
- package/dist/fondue-components57.js +52 -6
- package/dist/fondue-components57.js.map +1 -1
- package/dist/fondue-components58.js +15 -2
- package/dist/fondue-components58.js.map +1 -1
- package/dist/fondue-components59.js +17 -10
- package/dist/fondue-components59.js.map +1 -1
- package/dist/fondue-components6.js +5 -5
- package/dist/fondue-components6.js.map +1 -1
- package/dist/fondue-components60.js +6 -38
- package/dist/fondue-components60.js.map +1 -1
- package/dist/fondue-components61.js +5 -0
- package/dist/fondue-components61.js.map +1 -0
- package/dist/fondue-components62.js +14 -0
- package/dist/fondue-components62.js.map +1 -0
- package/dist/fondue-components63.js +42 -0
- package/dist/fondue-components63.js.map +1 -0
- package/dist/fondue-components7.js +2 -2
- package/dist/fondue-components7.js.map +1 -1
- package/dist/fondue-components8.js +2 -2
- package/dist/fondue-components8.js.map +1 -1
- package/dist/fondue-components9.js +85 -69
- package/dist/fondue-components9.js.map +1 -1
- package/dist/index.d.ts +71 -2
- package/dist/style.css +1 -1
- package/package.json +49 -48
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components51.js","sources":["../src/components/Select/
|
|
1
|
+
{"version":3,"file":"fondue-components51.js","sources":["../src/components/Select/SelectMenu.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as RadixPopover from '@radix-ui/react-popover';\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { type UseComboboxPropGetters, type UseSelectPropGetters } from 'downshift';\nimport { isValidElement, useRef, type ForwardedRef, type MouseEvent, type ReactElement, type ReactNode } from 'react';\n\nimport { usePreventDropdownOverflow } from '#/hooks/usePreventDropdownOverflow';\n\nimport { type SelectItemProps } from './SelectItem';\nimport styles from './styles/select.module.scss';\nimport { getSelectOptionValue, recursiveMap } from './utils';\n\nexport type SelectMenuProps = {\n /**\n * @internal\n * The index of the highlighted item in the menu.\n */\n highlightedIndex: number;\n /**\n * @internal\n * Callback function to retrieve the props for a menu element.\n */\n getMenuProps: UseSelectPropGetters<unknown>['getMenuProps'] | UseComboboxPropGetters<unknown>['getMenuProps'];\n /**\n * @internal\n * Callback function to retrieve the props for a item element.\n */\n getItemProps: UseSelectPropGetters<unknown>['getItemProps'] | UseComboboxPropGetters<unknown>['getItemProps'];\n /**\n * @internal\n * The children of the menu component. This can contain multiple `Select.Item` or `Select.Group` components.\n */\n children: ReactNode;\n /**\n * @internal\n * The filter text shown in the combobox input element.\n */\n filterText?: string;\n /**\n * @internal\n * The alignment of the menu.\n */\n align: 'start' | 'center' | 'end';\n /**\n * @internal\n * The type of the menu.\n */\n selectedItem?: {\n value: string;\n } | null;\n /**\n * @internal\n * A boolean to indicate if highlighted item was changed since opening the menu.\n * This is used to determine the style of the selected/highlighted item.\n */\n hasInteractedSinceOpening?: boolean;\n};\n\nexport const SelectMenu = ({\n highlightedIndex,\n getMenuProps,\n getItemProps,\n children,\n filterText,\n align,\n selectedItem,\n hasInteractedSinceOpening,\n}: SelectMenuProps) => {\n const ref = useRef<HTMLUListElement | null>(null);\n\n const { setMaxHeight } = usePreventDropdownOverflow(ref);\n\n const handleOnOpenAutoFocus = (event: Event) => {\n event.preventDefault();\n setMaxHeight();\n };\n\n return (\n <RadixPopover.Portal>\n <RadixPopover.Content\n align={align}\n collisionPadding={16}\n onOpenAutoFocus={handleOnOpenAutoFocus}\n className={styles.portal}\n >\n <ul\n className={styles.menu}\n {...getMenuProps()}\n ref={ref}\n data-has-interacted={hasInteractedSinceOpening ? 'true' : 'false'}\n data-test-id=\"fondue-select-menu\"\n >\n {\n recursiveMap(\n children,\n (child, index) => {\n const isValid = <TProps,>(\n child: ReactNode,\n ): child is ReactElement<TProps> & { ref: ForwardedRef<HTMLElement> } =>\n // @ts-expect-error - We are explicitly checking for ref\n isValidElement<TProps>(child) && child.ref !== undefined;\n\n if (isValid<SelectItemProps>(child)) {\n const optionData = getSelectOptionValue(child.props);\n const itemProps = getItemProps({\n item: optionData,\n index,\n ...(child.ref ? { ref: child.ref } : {}),\n });\n\n return (\n <RadixSlot\n className={styles.item}\n data-highlighted={highlightedIndex === index}\n data-selected={selectedItem?.value === optionData.value}\n key={child.props.value}\n // Workaround for the issue where the onClick event is not fired on touch devices because of portal usage\n onTouchStart={(event) => {\n if (itemProps.onClick) {\n itemProps.onClick(event as unknown as MouseEvent<HTMLElement>);\n }\n }}\n {...itemProps}\n >\n {child}\n </RadixSlot>\n );\n }\n },\n filterText,\n ).parsedChildren\n }\n </ul>\n </RadixPopover.Content>\n </RadixPopover.Portal>\n );\n};\nSelectMenu.displayName = 'Select.Menu';\n"],"names":["SelectMenu","highlightedIndex","getMenuProps","getItemProps","children","filterText","align","selectedItem","hasInteractedSinceOpening","ref","useRef","setMaxHeight","usePreventDropdownOverflow","handleOnOpenAutoFocus","event","jsx","RadixPopover","styles","recursiveMap","child","index","isValidElement","optionData","getSelectOptionValue","itemProps","RadixSlot"],"mappings":";;;;;;;AA2DO,MAAMA,IAAa,CAAC;AAAA,EACvB,kBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,2BAAAC;AACJ,MAAuB;AACb,QAAAC,IAAMC,EAAgC,IAAI,GAE1C,EAAE,cAAAC,EAAA,IAAiBC,EAA2BH,CAAG,GAEjDI,IAAwB,CAACC,MAAiB;AAC5C,IAAAA,EAAM,eAAe,GACRH,EAAA;AAAA,EACjB;AAGI,SAAA,gBAAAI,EAACC,EAAa,QAAb,EACG,UAAA,gBAAAD;AAAA,IAACC,EAAa;AAAA,IAAb;AAAA,MACG,OAAAV;AAAA,MACA,kBAAkB;AAAA,MAClB,iBAAiBO;AAAA,MACjB,WAAWI,EA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-
portal: l,
|
|
13
|
-
item: u,
|
|
14
|
-
checkmarkIcon: h,
|
|
15
|
-
itemValue: i,
|
|
16
|
-
group: p
|
|
17
|
-
};
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as d } from "react";
|
|
3
|
+
import m from "./fondue-components53.js";
|
|
4
|
+
const t = ({ children: e, name: o, "data-test-id": r = "fondue-select-slot", ...a }, s) => /* @__PURE__ */ l("div", { "data-test-id": r, ref: s, className: m.slot, "data-name": o, ...a, children: e });
|
|
5
|
+
t.displayName = "Select.Slot";
|
|
6
|
+
const S = d(t);
|
|
18
7
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
r as clear,
|
|
22
|
-
k as default,
|
|
23
|
-
p as group,
|
|
24
|
-
m as iconError,
|
|
25
|
-
s as iconSuccess,
|
|
26
|
-
t as icons,
|
|
27
|
-
o as input,
|
|
28
|
-
u as item,
|
|
29
|
-
i as itemValue,
|
|
30
|
-
a as menu,
|
|
31
|
-
l as portal,
|
|
32
|
-
c as root,
|
|
33
|
-
n as selectedValue,
|
|
34
|
-
_ as slot
|
|
8
|
+
S as ForwardedRefSelectSlot,
|
|
9
|
+
t as SelectSlot
|
|
35
10
|
};
|
|
36
11
|
//# sourceMappingURL=fondue-components52.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components52.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components52.js","sources":["../src/components/Select/SelectSlot.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { forwardRef, type ForwardedRef, type ReactNode } from 'react';\n\nimport styles from './styles/select.module.scss';\n\nexport type SelectSlotProps = {\n /**\n * The children of the select slot. This can be a custom component.\n */\n children?: ReactNode;\n /**\n * The slot name that is used to determine the placement.\n */\n name: 'menu' | 'left' | 'right' | 'clear';\n /**\n * The data test id of the select slot.\n */\n 'data-test-id'?: string;\n};\n\nexport const SelectSlot = (\n { children, name, 'data-test-id': dataTestId = 'fondue-select-slot', ...props }: SelectSlotProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-test-id={dataTestId} ref={forwardedRef} className={styles.slot} data-name={name} {...props}>\n {children}\n </div>\n );\n};\nSelectSlot.displayName = 'Select.Slot';\n\nexport const ForwardedRefSelectSlot = forwardRef<HTMLDivElement, SelectSlotProps>(SelectSlot);\n"],"names":["SelectSlot","children","name","dataTestId","props","forwardedRef","jsx","styles","ForwardedRefSelectSlot","forwardRef"],"mappings":";;;AAqBa,MAAAA,IAAa,CACtB,EAAE,UAAAC,GAAU,MAAAC,GAAM,gBAAgBC,IAAa,sBAAsB,GAAGC,EAAM,GAC9EC,MAGK,gBAAAC,EAAA,OAAA,EAAI,gBAAcH,GAAY,KAAKE,GAAc,WAAWE,EAAO,MAAM,aAAWL,GAAO,GAAGE,GAC1F,UAAAH,GACL;AAGRD,EAAW,cAAc;AAEZ,MAAAQ,IAAyBC,EAA4CT,CAAU;"}
|
|
@@ -1,52 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}), t;
|
|
18
|
-
}, z = (r) => {
|
|
19
|
-
const [t, o] = B(""), { inputSlots: u, menuSlots: l, itemValues: p, clearButton: V } = i(() => {
|
|
20
|
-
const s = [], n = [];
|
|
21
|
-
let m;
|
|
22
|
-
f.toArray(r).some(
|
|
23
|
-
(e) => a(e) && e.type === c
|
|
24
|
-
) ? f.forEach(r, (e) => {
|
|
25
|
-
a(e) && e.type === c && (e.props.name === "menu" ? n.push(e.props.children) : e.props.name === "left" || e.props.name === "right" ? s.push(e) : e.props.name === "clear" && (e.props.children ? m = e : m = E(e, { children: /* @__PURE__ */ w(x, { size: 16 }) })));
|
|
26
|
-
}) : n.push(r);
|
|
27
|
-
const g = S(n);
|
|
28
|
-
return { inputSlots: s, menuSlots: n, itemValues: g, clearButton: m };
|
|
29
|
-
}, [r]), y = i(
|
|
30
|
-
() => p.filter(
|
|
31
|
-
(s) => t === "" || s.label.toLowerCase().includes(t.toLowerCase())
|
|
32
|
-
),
|
|
33
|
-
[p, t]
|
|
34
|
-
), C = v(
|
|
35
|
-
(s) => s ? p.find((n) => n.value === s) : void 0,
|
|
36
|
-
[p]
|
|
37
|
-
);
|
|
38
|
-
return {
|
|
39
|
-
items: y,
|
|
40
|
-
menuSlots: l,
|
|
41
|
-
filterText: t,
|
|
42
|
-
inputSlots: u,
|
|
43
|
-
clearButton: V,
|
|
44
|
-
setFilterText: o,
|
|
45
|
-
getItemByValue: C
|
|
46
|
-
};
|
|
1
|
+
const c = "_root_1pv0q_6", o = "_selectedValue_1pv0q_68", _ = "_input_1pv0q_80", t = "_slot_1pv0q_106", e = "_clear_1pv0q_158", n = "_icons_1pv0q_171", s = "_caret_1pv0q_177", r = "_iconSuccess_1pv0q_205", p = "_iconError_1pv0q_211", a = "_menu_1pv0q_217", l = "_portal_1pv0q_237", u = "_item_1pv0q_241", i = "_checkmarkIcon_1pv0q_266", q = "_itemValue_1pv0q_273", v = "_group_1pv0q_287", m = {
|
|
2
|
+
root: c,
|
|
3
|
+
selectedValue: o,
|
|
4
|
+
input: _,
|
|
5
|
+
slot: t,
|
|
6
|
+
clear: e,
|
|
7
|
+
icons: n,
|
|
8
|
+
caret: s,
|
|
9
|
+
iconSuccess: r,
|
|
10
|
+
iconError: p,
|
|
11
|
+
menu: a,
|
|
12
|
+
portal: l,
|
|
13
|
+
item: u,
|
|
14
|
+
checkmarkIcon: i,
|
|
15
|
+
itemValue: q,
|
|
16
|
+
group: v
|
|
47
17
|
};
|
|
48
18
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
19
|
+
s as caret,
|
|
20
|
+
i as checkmarkIcon,
|
|
21
|
+
e as clear,
|
|
22
|
+
m as default,
|
|
23
|
+
v as group,
|
|
24
|
+
p as iconError,
|
|
25
|
+
r as iconSuccess,
|
|
26
|
+
n as icons,
|
|
27
|
+
_ as input,
|
|
28
|
+
u as item,
|
|
29
|
+
q as itemValue,
|
|
30
|
+
a as menu,
|
|
31
|
+
l as portal,
|
|
32
|
+
c as root,
|
|
33
|
+
o as selectedValue,
|
|
34
|
+
t as slot
|
|
51
35
|
};
|
|
52
36
|
//# sourceMappingURL=fondue-components53.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components53.js","sources":[
|
|
1
|
+
{"version":3,"file":"fondue-components53.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
|
|
@@ -1,14 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { jsx as w } from "react/jsx-runtime";
|
|
2
|
+
import { IconCross as x } from "@frontify/fondue-icons";
|
|
3
|
+
import { useState as B, useMemo as i, Children as f, isValidElement as a, cloneElement as E, useCallback as v } from "react";
|
|
4
|
+
import { ForwardedRefSelectItem as F } from "./fondue-components50.js";
|
|
5
|
+
import { ForwardedRefSelectSlot as c } from "./fondue-components52.js";
|
|
6
|
+
import { getSelectOptionValue as I } from "./fondue-components63.js";
|
|
7
|
+
const S = (r) => {
|
|
8
|
+
const t = [];
|
|
9
|
+
return f.forEach(r, (o) => {
|
|
10
|
+
if (a(o) && o.type === F)
|
|
11
|
+
t.push(I(o.props));
|
|
12
|
+
else if (a(o) && o.props.children) {
|
|
13
|
+
const u = S(o.props.children);
|
|
14
|
+
for (const l of u)
|
|
15
|
+
t.push(l);
|
|
16
|
+
}
|
|
17
|
+
}), t;
|
|
18
|
+
}, z = (r) => {
|
|
19
|
+
const [t, o] = B(""), { inputSlots: u, menuSlots: l, itemValues: p, clearButton: V } = i(() => {
|
|
20
|
+
const s = [], n = [];
|
|
21
|
+
let m;
|
|
22
|
+
f.toArray(r).some(
|
|
23
|
+
(e) => a(e) && e.type === c
|
|
24
|
+
) ? f.forEach(r, (e) => {
|
|
25
|
+
a(e) && e.type === c && (e.props.name === "menu" ? n.push(e.props.children) : e.props.name === "left" || e.props.name === "right" ? s.push(e) : e.props.name === "clear" && (e.props.children ? m = e : m = E(e, { children: /* @__PURE__ */ w(x, { size: 16 }) })));
|
|
26
|
+
}) : n.push(r);
|
|
27
|
+
const g = S(n);
|
|
28
|
+
return { inputSlots: s, menuSlots: n, itemValues: g, clearButton: m };
|
|
29
|
+
}, [r]), y = i(
|
|
30
|
+
() => p.filter(
|
|
31
|
+
(s) => t === "" || s.label.toLowerCase().includes(t.toLowerCase())
|
|
32
|
+
),
|
|
33
|
+
[p, t]
|
|
34
|
+
), C = v(
|
|
35
|
+
(s) => s ? p.find((n) => n.value === s) : void 0,
|
|
36
|
+
[p]
|
|
37
|
+
);
|
|
38
|
+
return {
|
|
39
|
+
items: y,
|
|
40
|
+
menuSlots: l,
|
|
41
|
+
filterText: t,
|
|
42
|
+
inputSlots: u,
|
|
43
|
+
clearButton: V,
|
|
44
|
+
setFilterText: o,
|
|
45
|
+
getItemByValue: C
|
|
46
|
+
};
|
|
6
47
|
};
|
|
7
48
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
t as root,
|
|
11
|
-
o as thumb,
|
|
12
|
-
_ as track
|
|
49
|
+
S as getRecursiveOptionValues,
|
|
50
|
+
z as useSelectData
|
|
13
51
|
};
|
|
14
52
|
//# sourceMappingURL=fondue-components54.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components54.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
1
|
+
{"version":3,"file":"fondue-components54.js","sources":["../src/components/Select/useSelectData.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCross } from '@frontify/fondue-icons';\nimport { Children, cloneElement, isValidElement, useCallback, useMemo, useState, type ReactNode } from 'react';\n\nimport { ForwardedRefSelectItem, type SelectItemProps } from './SelectItem';\nimport { ForwardedRefSelectSlot, type SelectSlotProps } from './SelectSlot';\nimport { getSelectOptionValue } from './utils';\n\nexport type SelectItemType = {\n value: string;\n label: string;\n};\n\n/**\n * Recursively extracts option values from children.\n * This function traverses through the React component tree and collects all SelectItem values.\n *\n * @param {ReactNode} children - The React children to extract values from.\n * @returns {SelectItemType[]} An array of SelectItemType objects.\n *\n * @example\n * const options = (\n * <SelectItem value=\"1\">Option 1</SelectItem>\n * <SelectItem value=\"2\">Option 2</SelectItem>\n * );\n * const values = getRecursiveOptionValues(options);\n * // Returns: [{ value: '1', label: 'Option 1' }, { value: '2', label: 'Option 2' }]\n */\nexport const getRecursiveOptionValues = (children: ReactNode): { value: string; label: string }[] => {\n const values: { value: string; label: string }[] = [];\n Children.forEach(children, (child) => {\n if (isValidElement<SelectItemProps>(child) && child.type === ForwardedRefSelectItem) {\n values.push(getSelectOptionValue(child.props));\n } else if (isValidElement<{ children: ReactNode }>(child) && child.props.children) {\n const optionValues = getRecursiveOptionValues(child.props.children);\n for (const optionValue of optionValues) {\n values.push(optionValue);\n }\n }\n });\n return values;\n};\n\n/**\n * Custom hook for managing select data and filtering.\n *\n * @param {ReactNode} children - The React children to process, typically SelectItem components.\n * @returns {Object} An object containing the processed data.\n */\nexport const useSelectData = (children: ReactNode) => {\n const [filterText, setFilterText] = useState('');\n const { inputSlots, menuSlots, itemValues, clearButton } = useMemo(() => {\n const inputSlots: ReactNode[] = [];\n const menuSlots: ReactNode[] = [];\n let clearButton: ReactNode;\n\n const hasSlots = Children.toArray(children).some(\n (child) => isValidElement<SelectSlotProps>(child) && child.type === ForwardedRefSelectSlot,\n );\n\n if (hasSlots) {\n Children.forEach(children, (child) => {\n if (isValidElement<SelectSlotProps>(child) && child.type === ForwardedRefSelectSlot) {\n if (child.props.name === 'menu') {\n menuSlots.push(child.props.children);\n } else if (child.props.name === 'left' || child.props.name === 'right') {\n inputSlots.push(child);\n } else if (child.props.name === 'clear') {\n if (child.props.children) {\n clearButton = child;\n } else {\n clearButton = cloneElement(child, { children: <IconCross size={16} /> });\n }\n }\n }\n });\n } else {\n menuSlots.push(children);\n }\n\n const itemValues = getRecursiveOptionValues(menuSlots);\n\n return { inputSlots, menuSlots, itemValues, clearButton };\n }, [children]);\n\n const items = useMemo(\n () =>\n itemValues.filter(\n (item) => filterText === '' || item.label.toLowerCase().includes(filterText.toLowerCase()),\n ),\n [itemValues, filterText],\n );\n\n const getItemByValue = useCallback(\n (value?: string) => (value ? itemValues.find((item) => item.value === value) : undefined),\n [itemValues],\n );\n\n return {\n items,\n menuSlots,\n filterText,\n inputSlots,\n clearButton,\n setFilterText,\n getItemByValue,\n };\n};\n"],"names":["getRecursiveOptionValues","children","values","Children","child","isValidElement","ForwardedRefSelectItem","getSelectOptionValue","optionValues","optionValue","useSelectData","filterText","setFilterText","useState","inputSlots","menuSlots","itemValues","clearButton","useMemo","ForwardedRefSelectSlot","cloneElement","IconCross","items","item","getItemByValue","useCallback","value"],"mappings":";;;;;;AA6Ba,MAAAA,IAA2B,CAACC,MAA4D;AACjG,QAAMC,IAA6C,CAAC;AAC3C,SAAAC,EAAA,QAAQF,GAAU,CAACG,MAAU;AAClC,QAAIC,EAAgCD,CAAK,KAAKA,EAAM,SAASE;AACzD,MAAAJ,EAAO,KAAKK,EAAqBH,EAAM,KAAK,CAAC;AAAA,aACtCC,EAAwCD,CAAK,KAAKA,EAAM,MAAM,UAAU;AAC/E,YAAMI,IAAeR,EAAyBI,EAAM,MAAM,QAAQ;AAClE,iBAAWK,KAAeD;AACtB,QAAAN,EAAO,KAAKO,CAAW;AAAA,IAC3B;AAAA,EACJ,CACH,GACMP;AACX,GAQaQ,IAAgB,CAACT,MAAwB;AAClD,QAAM,CAACU,GAAYC,CAAa,IAAIC,EAAS,EAAE,GACzC,EAAE,YAAAC,GAAY,WAAAC,GAA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BAAAY;AAAA,EACJ;AACJ;"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
const t = "
|
|
1
|
+
const t = "_root_oitg9_5", o = "_thumb_oitg9_17", _ = "_track_oitg9_21", r = "_range_oitg9_28", a = {
|
|
2
2
|
root: t,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
thumb: s
|
|
3
|
+
thumb: o,
|
|
4
|
+
track: _,
|
|
5
|
+
range: r
|
|
7
6
|
};
|
|
8
7
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
o as medium,
|
|
8
|
+
a as default,
|
|
9
|
+
r as range,
|
|
12
10
|
t as root,
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
o as thumb,
|
|
12
|
+
_ as track
|
|
15
13
|
};
|
|
16
14
|
//# sourceMappingURL=fondue-components55.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components55.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components55.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
const
|
|
2
|
-
root:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
loadingStatus: c,
|
|
8
|
-
spin: l,
|
|
9
|
-
"tw-dark": "_tw-dark_l0xje_170"
|
|
1
|
+
const t = "_root_1a16w_5", _ = "_small_1a16w_33", a = "_medium_1a16w_37", o = "_large_1a16w_41", m = "_thumb_1a16w_55", s = {
|
|
2
|
+
root: t,
|
|
3
|
+
small: _,
|
|
4
|
+
medium: a,
|
|
5
|
+
large: o,
|
|
6
|
+
thumb: m
|
|
10
7
|
};
|
|
11
8
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
t as
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
s as slot,
|
|
19
|
-
l as spin
|
|
9
|
+
s as default,
|
|
10
|
+
o as large,
|
|
11
|
+
a as medium,
|
|
12
|
+
t as root,
|
|
13
|
+
_ as small,
|
|
14
|
+
m as thumb
|
|
20
15
|
};
|
|
21
16
|
//# sourceMappingURL=fondue-components56.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components56.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components56.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -1,10 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { useRef as v, useState as w, useEffect as W, useLayoutEffect as p } from "react";
|
|
2
|
+
const b = (e, s) => e.filter((f) => {
|
|
3
|
+
var c;
|
|
4
|
+
const o = (c = f.ref) == null ? void 0 : c.current;
|
|
5
|
+
return o ? o.offsetLeft + o.offsetWidth > (s == null ? void 0 : s.scrollLeft) + s.offsetWidth || o.offsetLeft - s.scrollLeft < 0 : !1;
|
|
6
|
+
}), a = (e, s) => {
|
|
7
|
+
const f = s.current, o = e == null ? void 0 : e.querySelector('[data-state="active"]');
|
|
8
|
+
if (!e || !(o instanceof HTMLButtonElement) || !(f instanceof HTMLSpanElement))
|
|
9
|
+
return;
|
|
10
|
+
const c = (e == null ? void 0 : e.scrollLeft) > (o == null ? void 0 : o.offsetLeft), d = (o == null ? void 0 : o.offsetLeft) + (o == null ? void 0 : o.offsetWidth) > (e == null ? void 0 : e.offsetWidth);
|
|
11
|
+
c ? (e.offsetWidth > o.offsetWidth + o.offsetLeft ? f.style.left = `${o.offsetLeft}px` : f.style.left = `${e.offsetWidth - o.offsetWidth}px`, f.style.width = `${o == null ? void 0 : o.offsetWidth}px`) : d ? (f.style.left = `${e.clientWidth - o.offsetWidth}px`, f.style.width = `${o.offsetWidth}px`) : (f.style.left = `${o.offsetLeft}px`, f.style.width = `${o.offsetWidth}px`);
|
|
12
|
+
}, O = ({
|
|
13
|
+
activeTab: e
|
|
14
|
+
}) => {
|
|
15
|
+
const s = v(null), f = v(null), [o, c] = w([]), [d, u] = w([]);
|
|
16
|
+
return W(() => {
|
|
17
|
+
const t = s.current, n = t == null ? void 0 : t.querySelector('[data-state="active"]');
|
|
18
|
+
n instanceof HTMLButtonElement && t instanceof HTMLDivElement && (a(t, f), n.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "end" }));
|
|
19
|
+
}, [e, f]), p(() => {
|
|
20
|
+
var l;
|
|
21
|
+
const t = s.current, n = t == null ? void 0 : t.querySelector('[data-state="active"]');
|
|
22
|
+
if (t instanceof HTMLDivElement && n instanceof HTMLButtonElement) {
|
|
23
|
+
a(t, f);
|
|
24
|
+
const r = new MutationObserver(() => {
|
|
25
|
+
n.scrollIntoView({ behavior: "instant", block: "nearest", inline: "end" }), a(t, f);
|
|
26
|
+
});
|
|
27
|
+
t.parentNode && r.observe(t.parentNode, { childList: !0 });
|
|
28
|
+
const h = new IntersectionObserver(
|
|
29
|
+
() => {
|
|
30
|
+
u(b(o, t)), a(t, f);
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
root: t,
|
|
34
|
+
threshold: 1
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
for (const i of o)
|
|
38
|
+
(l = i.ref) != null && l.current && h.observe(i.ref.current);
|
|
39
|
+
return () => {
|
|
40
|
+
h.disconnect(), r.disconnect();
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}, [o, s, f]), {
|
|
44
|
+
triggerListRef: s,
|
|
45
|
+
activeIndicatorRef: f,
|
|
46
|
+
triggersOutOfView: d,
|
|
47
|
+
triggers: o,
|
|
48
|
+
addTrigger: (t) => {
|
|
49
|
+
c((n) => [...n, t]);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
4
52
|
};
|
|
5
53
|
export {
|
|
6
|
-
|
|
7
|
-
t as default,
|
|
8
|
-
o as root
|
|
54
|
+
O as useTabTriggers
|
|
9
55
|
};
|
|
10
56
|
//# sourceMappingURL=fondue-components57.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components57.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components57.js","sources":["../src/components/Tabs/hooks/useTabTriggers.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type RefObject, useEffect, useLayoutEffect, useRef, useState } from 'react';\n\nimport { type TabTrigger } from '../types';\n\nconst getOverflowingTriggers = (triggers: TabTrigger[], triggerListElement: HTMLDivElement) => {\n return triggers.filter((trigger) => {\n const triggerElement = trigger.ref?.current;\n if (!triggerElement) {\n return false;\n }\n return (\n triggerElement.offsetLeft + triggerElement.offsetWidth >\n triggerListElement?.scrollLeft + triggerListElement.offsetWidth ||\n triggerElement.offsetLeft - triggerListElement.scrollLeft < 0\n );\n });\n};\n\nconst moveActiveIndicator = (triggerListElement: HTMLDivElement, activeIndicatorRef: RefObject<HTMLSpanElement>) => {\n const activeIndicatorElement = activeIndicatorRef.current;\n const activeTriggerElement = triggerListElement?.querySelector('[data-state=\"active\"]');\n\n if (\n !triggerListElement ||\n !(activeTriggerElement instanceof HTMLButtonElement) ||\n !(activeIndicatorElement instanceof HTMLSpanElement)\n ) {\n return;\n }\n\n const isOverflowingLeft = triggerListElement?.scrollLeft > activeTriggerElement?.offsetLeft;\n const isOverflowingRight =\n activeTriggerElement?.offsetLeft + activeTriggerElement?.offsetWidth > triggerListElement?.offsetWidth;\n\n if (isOverflowingLeft) {\n const willFitAllItemsToTheLeft =\n triggerListElement.offsetWidth > activeTriggerElement.offsetWidth + activeTriggerElement.offsetLeft;\n if (willFitAllItemsToTheLeft) {\n activeIndicatorElement.style.left = `${activeTriggerElement.offsetLeft}px`;\n } else {\n activeIndicatorElement.style.left = `${triggerListElement.offsetWidth - activeTriggerElement.offsetWidth}px`;\n }\n activeIndicatorElement.style.width = `${activeTriggerElement?.offsetWidth}px`;\n } else if (isOverflowingRight) {\n activeIndicatorElement.style.left = `${triggerListElement.clientWidth - activeTriggerElement.offsetWidth}px`;\n activeIndicatorElement.style.width = `${activeTriggerElement.offsetWidth}px`;\n } else {\n activeIndicatorElement.style.left = `${activeTriggerElement.offsetLeft}px`;\n activeIndicatorElement.style.width = `${activeTriggerElement.offsetWidth}px`;\n }\n};\n\nexport const useTabTriggers = ({\n activeTab,\n}: {\n activeTab?: string;\n}): {\n triggerListRef: RefObject<HTMLDivElement>;\n activeIndicatorRef: RefObject<HTMLSpanElement>;\n triggers: TabTrigger[];\n triggersOutOfView: TabTrigger[];\n addTrigger: (trigger: TabTrigger) => void;\n} => {\n const triggerListRef = useRef<HTMLDivElement | null>(null);\n const activeIndicatorRef = useRef<HTMLSpanElement | null>(null);\n const [triggers, setTriggers] = useState<TabTrigger[]>([]);\n const [triggersOutOfView, setTriggersOutOfView] = useState<TabTrigger[]>([]);\n\n // move the active indicator and scroll to the correct position when the tab changes\n useEffect(() => {\n const triggerListElement = triggerListRef.current;\n const activeTriggerElement = triggerListElement?.querySelector('[data-state=\"active\"]');\n\n if (activeTriggerElement instanceof HTMLButtonElement && triggerListElement instanceof HTMLDivElement) {\n moveActiveIndicator(triggerListElement, activeIndicatorRef);\n activeTriggerElement.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'end' });\n }\n }, [activeTab, activeIndicatorRef]);\n\n useLayoutEffect(() => {\n const triggerListElement = triggerListRef.current;\n const activeTriggerElement = triggerListElement?.querySelector('[data-state=\"active\"]');\n\n if (triggerListElement instanceof HTMLDivElement && activeTriggerElement instanceof HTMLButtonElement) {\n // move the active indicator to the initial active tab\n moveActiveIndicator(triggerListElement, activeIndicatorRef);\n\n // observe addition of the dropdown trigger which reduces the available width\n const mutationObserver = new MutationObserver(() => {\n activeTriggerElement.scrollIntoView({ behavior: 'instant', block: 'nearest', inline: 'end' });\n moveActiveIndicator(triggerListElement, activeIndicatorRef);\n });\n if (triggerListElement.parentNode) {\n mutationObserver.observe(triggerListElement.parentNode, { childList: true });\n }\n\n // calculate the overflowing elements when item starts overflowing the parent\n const intersectionObserver = new IntersectionObserver(\n () => {\n setTriggersOutOfView(getOverflowingTriggers(triggers, triggerListElement));\n moveActiveIndicator(triggerListElement, activeIndicatorRef);\n },\n {\n root: triggerListElement,\n threshold: 1,\n },\n );\n for (const trigger of triggers) {\n if (trigger.ref?.current) {\n intersectionObserver.observe(trigger.ref.current);\n }\n }\n\n return () => {\n intersectionObserver.disconnect();\n mutationObserver.disconnect();\n };\n }\n }, [triggers, triggerListRef, activeIndicatorRef]);\n\n return {\n triggerListRef,\n activeIndicatorRef,\n triggersOutOfView,\n triggers,\n addTrigger: (trigger) => {\n setTriggers((prev) => [...prev, trigger]);\n },\n };\n};\n"],"names":["getOverflowingTriggers","triggers","triggerListElement","trigger","triggerElement","_a","moveActiveIndicator","activeIndicatorRef","activeIndicatorElement","activeTriggerElement","isOverflowingLeft","isOverflowingRight","useTabTriggers","activeTab","triggerListRef","useRef","setTriggers","useState","triggersOutOfView","setTriggersOutOfView","useEffect","useLayoutEffect","mutationObserver","intersectionObserver","prev"],"mappings":";AAMA,MAAMA,IAAyB,CAACC,GAAwBC,MAC7CD,EAAS,OAAO,CAACE,MAAY;;AAC1B,QAAAC,KAAiBC,IAAAF,EAAQ,QAAR,gBAAAE,EAAa;AACpC,SAAKD,IAIDA,EAAe,aAAaA,EAAe,eACvCF,KAAA,gBAAAA,EAAoB,cAAaA,EAAmB,eACxDE,EAAe,aAAaF,EAAmB,aAAa,IALrD;AAKqD,CAEnE,GAGCI,IAAsB,CAACJ,GAAoCK,MAAmD;AAChH,QAAMC,IAAyBD,EAAmB,SAC5CE,IAAuBP,KAAA,gBAAAA,EAAoB,cAAc;AAE/D,MACI,CAACA,KACD,EAAEO,aAAgC,sBAClC,EAAED,aAAkC;AAEpC;AAGE,QAAAE,KAAoBR,KAAA,gBAAAA,EAAoB,eAAaO,KAAA,gBAAAA,EAAsB,aAC3EE,KACFF,KAAA,gBAAAA,EA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M;AAC3B,QAAAb,EAAA,eAAe,EAAE,UAAU,WAAW,OAAO,WAAW,QAAQ,OAAO,GAC5FH,EAAoBJ,GAAoBK,CAAkB;AAAA,MAAA,CAC7D;AACD,MAAIL,EAAmB,cACnBoB,EAAiB,QAAQpB,EAAmB,YAAY,EAAE,WAAW,IAAM;AAI/E,YAAMqB,IAAuB,IAAI;AAAA,QAC7B,MAAM;AACmB,UAAAJ,EAAAnB,EAAuBC,GAAUC,CAAkB,CAAC,GACzEI,EAAoBJ,GAAoBK,CAAkB;AAAA,QAC9D;AAAA,QACA;AAAA,UACI,MAAML;AAAA,UACN,WAAW;AAAA,QAAA;AAAA,MAEnB;AACA,iBAAWC,KAAWF;AACd,SAAAI,IAAAF,EAAQ,QAAR,QAAAE,EAAa,WACQkB,EAAA,QAAQpB,EAAQ,IAAI,OAAO;AAIxD,aAAO,MAAM;AACT,QAAAoB,EAAqB,WAAW,GAChCD,EAAiB,WAAW;AAAA,MAChC;AAAA,IAAA;AAAA,EAEL,GAAA,CAACrB,GAAUa,GAAgBP,CAAkB,CAAC,GAE1C;AAAA,IACH,gBAAAO;AAAA,IACA,oBAAAP;AAAA,IACA,mBAAAW;AAAA,IACA,UAAAjB;AAAA,IACA,YAAY,CAACE,MAAY;AACrB,MAAAa,EAAY,CAACQ,MAAS,CAAC,GAAGA,GAAMrB,CAAO,CAAC;AAAA,IAAA;AAAA,EAEhD;AACJ;"}
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
const t = "
|
|
1
|
+
const t = "_root_17u01_5", r = "_triggerList_17u01_13", e = "_triggerListWrapper_17u01_27", i = "_trigger_17u01_13", o = "_content_17u01_76", g = "_activeIndicator_17u01_80", _ = {
|
|
2
|
+
root: t,
|
|
3
|
+
triggerList: r,
|
|
4
|
+
triggerListWrapper: e,
|
|
5
|
+
trigger: i,
|
|
6
|
+
content: o,
|
|
7
|
+
activeIndicator: g
|
|
8
|
+
};
|
|
2
9
|
export {
|
|
3
|
-
|
|
10
|
+
g as activeIndicator,
|
|
11
|
+
o as content,
|
|
12
|
+
_ as default,
|
|
13
|
+
t as root,
|
|
14
|
+
i as trigger,
|
|
15
|
+
r as triggerList,
|
|
16
|
+
e as triggerListWrapper
|
|
4
17
|
};
|
|
5
18
|
//# sourceMappingURL=fondue-components58.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components58.js","sources":[
|
|
1
|
+
{"version":3,"file":"fondue-components58.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
const o = "
|
|
2
|
-
root:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
const t = "_root_y2kt3_5", o = "_input_y2kt3_59", s = "_slot_y2kt3_78", _ = "_iconSuccess_y2kt3_128", n = "_iconError_y2kt3_136", c = "_loadingStatus_y2kt3_144", i = "_spin_y2kt3_1", r = {
|
|
2
|
+
root: t,
|
|
3
|
+
input: o,
|
|
4
|
+
slot: s,
|
|
5
|
+
iconSuccess: _,
|
|
6
|
+
iconError: n,
|
|
7
|
+
loadingStatus: c,
|
|
8
|
+
spin: i,
|
|
9
|
+
"tw-dark": "_tw-dark_y2kt3_176"
|
|
6
10
|
};
|
|
7
11
|
export {
|
|
8
|
-
r as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
r as default,
|
|
13
|
+
n as iconError,
|
|
14
|
+
_ as iconSuccess,
|
|
15
|
+
o as input,
|
|
16
|
+
c as loadingStatus,
|
|
17
|
+
t as root,
|
|
18
|
+
s as slot,
|
|
19
|
+
i as spin
|
|
13
20
|
};
|
|
14
21
|
//# sourceMappingURL=fondue-components59.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components59.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components59.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { Slot as u } from "@radix-ui/react-slot";
|
|
3
3
|
import { forwardRef as k, useState as R, Children as P } from "react";
|
|
4
|
-
import { ForwardedRefColorGradientInput as F } from "./fondue-
|
|
5
|
-
import { ForwardedRefColorPickerInput as y } from "./fondue-
|
|
6
|
-
import { ForwardedRefColorValueInput as N } from "./fondue-
|
|
7
|
-
import I from "./fondue-
|
|
8
|
-
import { getColorWithName as d, DEFAULT_COLOR as w, DEFAULT_FORMAT as h } from "./fondue-
|
|
4
|
+
import { ForwardedRefColorGradientInput as F } from "./fondue-components31.js";
|
|
5
|
+
import { ForwardedRefColorPickerInput as y } from "./fondue-components32.js";
|
|
6
|
+
import { ForwardedRefColorValueInput as N } from "./fondue-components33.js";
|
|
7
|
+
import I from "./fondue-components34.js";
|
|
8
|
+
import { getColorWithName as d, DEFAULT_COLOR as w, DEFAULT_FORMAT as h } from "./fondue-components35.js";
|
|
9
9
|
const m = ({
|
|
10
10
|
children: t,
|
|
11
11
|
currentColor: o = w,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components6.js","sources":["../src/components/ColorPicker/ColorPicker.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { Children, forwardRef, useState, type ForwardedRef, type ReactNode } from 'react';\n\nimport { ForwardedRefColorGradientInput } from './ColorGradientInput';\nimport { ForwardedRefColorPickerInput } from './ColorPickerInput';\nimport { ForwardedRefColorValueInput } from './ColorValueInput';\nimport styles from './styles/customColorPicker.module.scss';\nimport { type ColorFormat, type RgbaColor } from './types';\nimport { DEFAULT_COLOR, DEFAULT_FORMAT, getColorWithName } from './utils';\n\ntype ColorPickerProps = {\n /**\n * The children of the color picker component. This can contain multiple `ColorPicker.Values` or `ColorPicker.Gradient` components.\n */\n children?: ReactNode;\n /**\n * The active color in the color picker\n */\n currentColor?: RgbaColor;\n /**\n * Event handler called when the color changes\n */\n onColorChange?: (color: RgbaColor) => void;\n /**\n * The default format to use for the color input\n * @default \"HEX\"\n */\n defaultFormat?: ColorFormat;\n /**\n * The test id of the color picker\n */\n 'data-test-id'?: string;\n};\n\nexport const ColorPickerRoot = (\n {\n children,\n currentColor = DEFAULT_COLOR,\n onColorChange = () => {},\n defaultFormat = DEFAULT_FORMAT,\n 'data-test-id': dataTestId = 'color-picker-input',\n ...props\n }: ColorPickerProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const [currentFormat, setCurrentFormat] = useState<ColorFormat>(defaultFormat);\n\n return (\n <div className={styles.root} data-picker-type=\"custom-color\" data-test-id={dataTestId} ref={forwardedRef}>\n {Children.map(children, (child) => (\n <ColorPickerSlot\n {...props}\n onColorChange={(color: RgbaColor) => {\n onColorChange(getColorWithName(color, currentFormat));\n }}\n currentColor={currentColor}\n currentFormat={currentFormat}\n setCurrentFormat={(currentFormat: ColorFormat) => {\n setCurrentFormat(currentFormat);\n onColorChange(getColorWithName(currentColor, currentFormat));\n }}\n >\n {child}\n </ColorPickerSlot>\n ))}\n </div>\n );\n};\nColorPickerRoot.displayName = 'ColorPicker';\n\ntype ColorPickerSlotProps = ColorPickerProps & {\n currentFormat?: ColorFormat;\n setCurrentFormat?: (format: ColorFormat) => void;\n};\nconst ColorPickerSlot = ({ children, ...props }: ColorPickerSlotProps) => <RadixSlot {...props}>{children}</RadixSlot>;\n\nexport const ForwardedRefColorPicker = forwardRef<HTMLDivElement, ColorPickerProps>(ColorPickerRoot);\n\nexport const ColorPicker = {\n Root: ForwardedRefColorPicker,\n Values: ForwardedRefColorValueInput,\n Gradient: ForwardedRefColorGradientInput,\n Input: ForwardedRefColorPickerInput,\n};\n\nColorPicker.Root.displayName = 'ColorPicker.Root';\nColorPicker.Values.displayName = 'ColorPicker.Values';\nColorPicker.Gradient.displayName = 'ColorPicker.Gradient';\nColorPicker.Input.displayName = 'ColorPicker.Input';\n"],"names":["ColorPickerRoot","children","currentColor","DEFAULT_COLOR","onColorChange","defaultFormat","DEFAULT_FORMAT","dataTestId","props","forwardedRef","currentFormat","setCurrentFormat","useState","jsx","styles","Children","child","ColorPickerSlot","color","getColorWithName","RadixSlot","ForwardedRefColorPicker","forwardRef","ColorPicker","ForwardedRefColorValueInput","ForwardedRefColorGradientInput","ForwardedRefColorPickerInput"],"mappings":";;;;;;;;AAoCO,MAAMA,IAAkB,CAC3B;AAAA,EACI,UAAAC;AAAA,EACA,cAAAC,IAAeC;AAAA,EACf,eAAAC,IAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,eAAAC,IAAgBC;AAAA,EAChB,gBAAgBC,IAAa;AAAA,EAC7B,GAAGC;AACP,GACAC,MACC;AACD,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAsBP,CAAa;AAE7E,SACK,gBAAAQ,EAAA,OAAA,EAAI,WAAWC,EAAO,MAAM,oBAAiB,gBAAe,gBAAcP,GAAY,KAAKE,GACvF,UAAAM,EAAS,IAAId,GAAU,CAACe,MACrB,gBAAAH;AAAA,IAACI;AAAA,IAAA;AAAA,MACI,GAAGT;AAAA,MACJ,eAAe,CAACU,MAAqB;AACnB,QAAAd,EAAAe,EAAiBD,GAAOR,CAAa,CAAC;AAAA,MACxD;AAAA,MACA,cAAAR;AAAA,MACA,eAAAQ;AAAA,MACA,kBAAkB,CAACA,MAA+B;AAC9C,QAAAC,EAAiBD,CAAa,GAChBN,EAAAe,EAAiBjB,GAAcQ,CAAa,CAAC;AAAA,MAC/D;AAAA,MAEC,UAAAM;AAAA,IAAA;AAAA,EAER,CAAA,
|
|
1
|
+
{"version":3,"file":"fondue-components6.js","sources":["../src/components/ColorPicker/ColorPicker.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { Children, forwardRef, useState, type ForwardedRef, type ReactNode } from 'react';\n\nimport { ForwardedRefColorGradientInput } from './ColorGradientInput';\nimport { ForwardedRefColorPickerInput } from './ColorPickerInput';\nimport { ForwardedRefColorValueInput } from './ColorValueInput';\nimport styles from './styles/customColorPicker.module.scss';\nimport { type ColorFormat, type RgbaColor } from './types';\nimport { DEFAULT_COLOR, DEFAULT_FORMAT, getColorWithName } from './utils';\n\ntype ColorPickerProps = {\n /**\n * The children of the color picker component. This can contain multiple `ColorPicker.Values` or `ColorPicker.Gradient` components.\n */\n children?: ReactNode;\n /**\n * The active color in the color picker\n */\n currentColor?: RgbaColor;\n /**\n * Event handler called when the color changes\n */\n onColorChange?: (color: RgbaColor) => void;\n /**\n * The default format to use for the color input\n * @default \"HEX\"\n */\n defaultFormat?: ColorFormat;\n /**\n * The test id of the color picker\n */\n 'data-test-id'?: string;\n};\n\nexport const ColorPickerRoot = (\n {\n children,\n currentColor = DEFAULT_COLOR,\n onColorChange = () => {},\n defaultFormat = DEFAULT_FORMAT,\n 'data-test-id': dataTestId = 'color-picker-input',\n ...props\n }: ColorPickerProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const [currentFormat, setCurrentFormat] = useState<ColorFormat>(defaultFormat);\n\n return (\n <div className={styles.root} data-picker-type=\"custom-color\" data-test-id={dataTestId} ref={forwardedRef}>\n {Children.map(children, (child) => (\n <ColorPickerSlot\n {...props}\n onColorChange={(color: RgbaColor) => {\n onColorChange(getColorWithName(color, currentFormat));\n }}\n currentColor={currentColor}\n currentFormat={currentFormat}\n setCurrentFormat={(currentFormat: ColorFormat) => {\n setCurrentFormat(currentFormat);\n onColorChange(getColorWithName(currentColor, currentFormat));\n }}\n >\n {child}\n </ColorPickerSlot>\n ))}\n </div>\n );\n};\nColorPickerRoot.displayName = 'ColorPicker';\n\ntype ColorPickerSlotProps = ColorPickerProps & {\n currentFormat?: ColorFormat;\n setCurrentFormat?: (format: ColorFormat) => void;\n};\nconst ColorPickerSlot = ({ children, ...props }: ColorPickerSlotProps) => <RadixSlot {...props}>{children}</RadixSlot>;\n\nexport const ForwardedRefColorPicker = forwardRef<HTMLDivElement, ColorPickerProps>(ColorPickerRoot);\n\nexport const ColorPicker = {\n Root: ForwardedRefColorPicker,\n Values: ForwardedRefColorValueInput,\n Gradient: ForwardedRefColorGradientInput,\n Input: ForwardedRefColorPickerInput,\n};\n\nColorPicker.Root.displayName = 'ColorPicker.Root';\nColorPicker.Values.displayName = 'ColorPicker.Values';\nColorPicker.Gradient.displayName = 'ColorPicker.Gradient';\nColorPicker.Input.displayName = 'ColorPicker.Input';\n"],"names":["ColorPickerRoot","children","currentColor","DEFAULT_COLOR","onColorChange","defaultFormat","DEFAULT_FORMAT","dataTestId","props","forwardedRef","currentFormat","setCurrentFormat","useState","jsx","styles","Children","child","ColorPickerSlot","color","getColorWithName","RadixSlot","ForwardedRefColorPicker","forwardRef","ColorPicker","ForwardedRefColorValueInput","ForwardedRefColorGradientInput","ForwardedRefColorPickerInput"],"mappings":";;;;;;;;AAoCO,MAAMA,IAAkB,CAC3B;AAAA,EACI,UAAAC;AAAA,EACA,cAAAC,IAAeC;AAAA,EACf,eAAAC,IAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,eAAAC,IAAgBC;AAAA,EAChB,gBAAgBC,IAAa;AAAA,EAC7B,GAAGC;AACP,GACAC,MACC;AACD,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAsBP,CAAa;AAE7E,SACK,gBAAAQ,EAAA,OAAA,EAAI,WAAWC,EAAO,MAAM,oBAAiB,gBAAe,gBAAcP,GAAY,KAAKE,GACvF,UAAAM,EAAS,IAAId,GAAU,CAACe,MACrB,gBAAAH;AAAA,IAACI;AAAA,IAAA;AAAA,MACI,GAAGT;AAAA,MACJ,eAAe,CAACU,MAAqB;AACnB,QAAAd,EAAAe,EAAiBD,GAAOR,CAAa,CAAC;AAAA,MACxD;AAAA,MACA,cAAAR;AAAA,MACA,eAAAQ;AAAA,MACA,kBAAkB,CAACA,MAA+B;AAC9C,QAAAC,EAAiBD,CAAa,GAChBN,EAAAe,EAAiBjB,GAAcQ,CAAa,CAAC;AAAA,MAC/D;AAAA,MAEC,UAAAM;AAAA,IAAA;AAAA,EAER,CAAA,GACL;AAER;AACAhB,EAAgB,cAAc;AAM9B,MAAMiB,IAAkB,CAAC,EAAE,UAAAhB,GAAU,GAAGO,EAAM,MAA6B,gBAAAK,EAAAO,GAAA,EAAW,GAAGZ,GAAQ,UAAAP,GAAS,GAE7FoB,IAA0BC,EAA6CtB,CAAe,GAEtFuB,IAAc;AAAA,EACvB,MAAMF;AAAA,EACN,QAAQG;AAAA,EACR,UAAUC;AAAA,EACV,OAAOC;AACX;AAEAH,EAAY,KAAK,cAAc;AAC/BA,EAAY,OAAO,cAAc;AACjCA,EAAY,SAAS,cAAc;AACnCA,EAAY,MAAM,cAAc;"}
|
|
@@ -1,42 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
children: r,
|
|
5
|
-
value: o,
|
|
6
|
-
label: s
|
|
7
|
-
}) => r && typeof r == "string" ? {
|
|
8
|
-
value: o || r,
|
|
9
|
-
label: s || r
|
|
10
|
-
} : {
|
|
11
|
-
value: o || "",
|
|
12
|
-
label: s || o || ""
|
|
13
|
-
}, w = (r, o) => u(r) && r.type === o, y = (r, o, s, p = 0) => {
|
|
14
|
-
const n = [];
|
|
15
|
-
let t = 0;
|
|
16
|
-
return a.forEach(r, (e) => {
|
|
17
|
-
if (w(e, E) && u(e))
|
|
18
|
-
g(e.props).label.toLowerCase().includes((s == null ? void 0 : s.toLowerCase()) || "") && (n.push(o(e, p + t)), t++);
|
|
19
|
-
else if (u(e) && (e != null && e.props.children)) {
|
|
20
|
-
const { parsedChildren: m, subElementCount: C } = y(
|
|
21
|
-
e.props.children,
|
|
22
|
-
o,
|
|
23
|
-
"",
|
|
24
|
-
p + t
|
|
25
|
-
);
|
|
26
|
-
e = f(e, {
|
|
27
|
-
children: m,
|
|
28
|
-
key: `group-${p + t}`
|
|
29
|
-
}), n.push(e), t += C;
|
|
30
|
-
} else
|
|
31
|
-
n.push(e);
|
|
32
|
-
}), {
|
|
33
|
-
parsedChildren: n,
|
|
34
|
-
subElementCount: t
|
|
35
|
-
};
|
|
1
|
+
const o = "_root_18vgg_4", r = "_arrow_18vgg_22", t = {
|
|
2
|
+
root: o,
|
|
3
|
+
arrow: r
|
|
36
4
|
};
|
|
37
5
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
6
|
+
r as arrow,
|
|
7
|
+
t as default,
|
|
8
|
+
o as root
|
|
41
9
|
};
|
|
42
10
|
//# sourceMappingURL=fondue-components60.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components60.js","sources":[
|
|
1
|
+
{"version":3,"file":"fondue-components60.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fondue-components61.js","sources":["../src/utilities/focusStyle.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const FOCUS_OUTLINE =\n 'focus-visible:tw-outline has-[[data-show-focus-ring=true]]:tw-outline tw-outline-4 tw-outline-offset-2 tw-outline-blue focus-visible:tw-outline-blue'; // second declaration of tw-outline-blue is to assure that in firefox the outline isn't overriden by a global definition of :-moz-focusring which is coming from tailwinds normalization styling\n"],"names":["FOCUS_OUTLINE"],"mappings":"AAEO,MAAMA,IACT;"}
|