@frontify/fondue-components 3.2.0 → 3.3.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 +18 -16
- package/dist/fondue-components.js.map +1 -1
- package/dist/fondue-components10.js +2 -2
- package/dist/fondue-components11.js +42 -30
- package/dist/fondue-components11.js.map +1 -1
- package/dist/fondue-components12.js +2 -2
- package/dist/fondue-components13.js +1 -1
- package/dist/fondue-components14.js +1 -1
- package/dist/fondue-components15.js +64 -6
- package/dist/fondue-components15.js.map +1 -1
- package/dist/fondue-components16.js +6 -47
- package/dist/fondue-components16.js.map +1 -1
- package/dist/fondue-components17.js +42 -50
- package/dist/fondue-components17.js.map +1 -1
- package/dist/fondue-components18.js +112 -29
- package/dist/fondue-components18.js.map +1 -1
- package/dist/fondue-components19.js +53 -110
- package/dist/fondue-components19.js.map +1 -1
- package/dist/fondue-components20.js +27 -64
- package/dist/fondue-components20.js.map +1 -1
- package/dist/fondue-components21.js +64 -41
- package/dist/fondue-components21.js.map +1 -1
- package/dist/fondue-components22.js +43 -32
- package/dist/fondue-components22.js.map +1 -1
- package/dist/fondue-components23.js +32 -5
- package/dist/fondue-components23.js.map +1 -1
- package/dist/fondue-components24.js +5 -12
- package/dist/fondue-components24.js.map +1 -1
- package/dist/fondue-components25.js +10 -153
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components26.js +59 -22
- package/dist/fondue-components26.js.map +1 -1
- package/dist/fondue-components27.js +17 -17
- package/dist/fondue-components27.js.map +1 -1
- package/dist/fondue-components28.js +112 -15
- package/dist/fondue-components28.js.map +1 -1
- package/dist/fondue-components29.js +19 -30
- package/dist/fondue-components29.js.map +1 -1
- package/dist/fondue-components3.js +2 -2
- package/dist/fondue-components30.js +32 -28
- package/dist/fondue-components30.js.map +1 -1
- package/dist/fondue-components31.js +23 -125
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components32.js +129 -20
- package/dist/fondue-components32.js.map +1 -1
- package/dist/fondue-components33.js +21 -45
- package/dist/fondue-components33.js.map +1 -1
- package/dist/fondue-components34.js +45 -15
- package/dist/fondue-components34.js.map +1 -1
- package/dist/fondue-components35.js +28 -60
- package/dist/fondue-components35.js.map +1 -1
- package/dist/fondue-components36.js +15 -15
- package/dist/fondue-components36.js.map +1 -1
- package/dist/fondue-components37.js +60 -19
- package/dist/fondue-components37.js.map +1 -1
- package/dist/fondue-components38.js +15 -17
- package/dist/fondue-components38.js.map +1 -1
- package/dist/fondue-components39.js +16 -4
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components4.js +4 -4
- package/dist/fondue-components40.js +3 -11
- package/dist/fondue-components40.js.map +1 -1
- package/dist/fondue-components41.js +11 -3
- package/dist/fondue-components41.js.map +1 -1
- package/dist/fondue-components42.js +5 -35
- package/dist/fondue-components42.js.map +1 -1
- package/dist/fondue-components43.js +35 -5
- package/dist/fondue-components43.js.map +1 -1
- package/dist/fondue-components44.js +12 -24
- package/dist/fondue-components44.js.map +1 -1
- package/dist/fondue-components45.js +4 -16
- package/dist/fondue-components45.js.map +1 -1
- package/dist/fondue-components46.js +24 -10
- package/dist/fondue-components46.js.map +1 -1
- package/dist/fondue-components47.js +16 -12
- package/dist/fondue-components47.js.map +1 -1
- package/dist/fondue-components5.js +2 -2
- package/dist/fondue-components50.js +2 -2
- package/dist/fondue-components53.js +1 -1
- package/dist/fondue-components54.js +9 -16
- package/dist/fondue-components54.js.map +1 -1
- package/dist/fondue-components55.js +12 -6
- package/dist/fondue-components55.js.map +1 -1
- package/dist/fondue-components56.js +18 -2
- package/dist/fondue-components56.js.map +1 -1
- package/dist/fondue-components57.js +4 -8
- package/dist/fondue-components57.js.map +1 -1
- package/dist/fondue-components58.js +2 -39
- package/dist/fondue-components58.js.map +1 -1
- package/dist/fondue-components59.js +14 -0
- package/dist/fondue-components59.js.map +1 -0
- package/dist/fondue-components6.js +5 -5
- package/dist/fondue-components60.js +42 -0
- package/dist/fondue-components60.js.map +1 -0
- package/dist/fondue-components7.js +78 -68
- package/dist/fondue-components7.js.map +1 -1
- package/dist/fondue-components8.js +2 -2
- package/dist/fondue-components9.js +3 -3
- package/dist/index.d.ts +27 -3
- package/dist/style.css +1 -1
- package/package.json +39 -38
|
@@ -1,32 +1,115 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
import { jsxs as i, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { IconCaretDown as G, IconCheckMark as z, IconExclamationMarkTriangle as D } from "@frontify/fondue-icons";
|
|
3
|
+
import * as f from "@radix-ui/react-popover";
|
|
4
|
+
import { Slot as j } from "@radix-ui/react-slot";
|
|
5
|
+
import { useSelect as E } from "downshift";
|
|
6
|
+
import { forwardRef as T, useRef as $ } from "react";
|
|
7
|
+
import { ForwardedRefCombobox as A } from "./fondue-components48.js";
|
|
8
|
+
import { ForwardedRefSelectItem as O, ForwardedRefSelectItemGroup as V } from "./fondue-components49.js";
|
|
9
|
+
import { SelectMenu as q } from "./fondue-components50.js";
|
|
10
|
+
import { ForwardedRefSelectSlot as H } from "./fondue-components51.js";
|
|
11
|
+
import r from "./fondue-components52.js";
|
|
12
|
+
import { useSelectData as J } from "./fondue-components53.js";
|
|
13
|
+
const S = ({
|
|
14
|
+
children: g,
|
|
15
|
+
onSelect: m,
|
|
16
|
+
value: h,
|
|
17
|
+
defaultValue: I,
|
|
18
|
+
placeholder: N = "",
|
|
19
|
+
status: a = "neutral",
|
|
20
|
+
disabled: n,
|
|
21
|
+
"aria-label": b,
|
|
22
|
+
"data-test-id": s = "fondue-select"
|
|
23
|
+
}, d) => {
|
|
24
|
+
const { inputSlots: w, menuSlots: R, items: x, clearButton: u, getItemByValue: p } = J(g), C = p(I), y = p(h), l = $(!1), { getToggleButtonProps: F, getMenuProps: k, getItemProps: v, reset: M, selectedItem: c, isOpen: P, highlightedIndex: B } = E({
|
|
25
|
+
items: x,
|
|
26
|
+
defaultSelectedItem: C,
|
|
27
|
+
selectedItem: y,
|
|
28
|
+
onSelectedItemChange: ({ selectedItem: e }) => {
|
|
29
|
+
m && m(e.value);
|
|
30
|
+
},
|
|
31
|
+
itemToString: (e) => e ? e.label : ""
|
|
32
|
+
});
|
|
33
|
+
return /* @__PURE__ */ i(f.Root, { open: P, children: [
|
|
34
|
+
/* @__PURE__ */ o(
|
|
35
|
+
f.Anchor,
|
|
36
|
+
{
|
|
37
|
+
asChild: !0,
|
|
38
|
+
onMouseDown: (e) => {
|
|
39
|
+
l.current = !0, e.currentTarget.dataset.showFocusRing = "false";
|
|
40
|
+
},
|
|
41
|
+
onFocus: (e) => {
|
|
42
|
+
l.current || (e.target.dataset.showFocusRing = "true");
|
|
43
|
+
},
|
|
44
|
+
onBlur: (e) => {
|
|
45
|
+
e.target.dataset.showFocusRing = "false", l.current = !1;
|
|
46
|
+
},
|
|
47
|
+
children: /* @__PURE__ */ i(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
className: r.root,
|
|
51
|
+
"data-status": a,
|
|
52
|
+
"data-disabled": n,
|
|
53
|
+
"data-empty": !c,
|
|
54
|
+
"data-test-id": s,
|
|
55
|
+
...n ? {} : F({
|
|
56
|
+
"aria-label": b,
|
|
57
|
+
...d ? { ref: d } : {}
|
|
58
|
+
}),
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ o("span", { className: r.input, children: c ? c.label : N }),
|
|
61
|
+
w,
|
|
62
|
+
u && /* @__PURE__ */ o(
|
|
63
|
+
j,
|
|
64
|
+
{
|
|
65
|
+
onClick: (e) => {
|
|
66
|
+
e.stopPropagation(), M();
|
|
67
|
+
},
|
|
68
|
+
className: r.clear,
|
|
69
|
+
children: u
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ i("div", { className: r.icons, children: [
|
|
73
|
+
/* @__PURE__ */ o(G, { size: 16, className: r.caret }),
|
|
74
|
+
a === "success" ? /* @__PURE__ */ o(
|
|
75
|
+
z,
|
|
76
|
+
{
|
|
77
|
+
size: 16,
|
|
78
|
+
className: r.iconSuccess,
|
|
79
|
+
"data-test-id": `${s}-success-icon`
|
|
80
|
+
}
|
|
81
|
+
) : null,
|
|
82
|
+
a === "error" ? /* @__PURE__ */ o(
|
|
83
|
+
D,
|
|
84
|
+
{
|
|
85
|
+
size: 16,
|
|
86
|
+
className: r.iconError,
|
|
87
|
+
"data-test-id": `${s}-error-icon`
|
|
88
|
+
}
|
|
89
|
+
) : null
|
|
90
|
+
] })
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
/* @__PURE__ */ o(q, { highlightedIndex: B, getMenuProps: k, getItemProps: v, children: R })
|
|
97
|
+
] });
|
|
98
|
+
};
|
|
99
|
+
S.displayName = "Select";
|
|
100
|
+
const K = T(S), t = K;
|
|
101
|
+
t.displayName = "Select";
|
|
102
|
+
t.Combobox = A;
|
|
103
|
+
t.Combobox.displayName = "Select.Combobox";
|
|
104
|
+
t.Item = O;
|
|
105
|
+
t.Item.displayName = "Select.Item";
|
|
106
|
+
t.Group = V;
|
|
107
|
+
t.Group.displayName = "Select.Group";
|
|
108
|
+
t.Slot = H;
|
|
109
|
+
t.Slot.displayName = "Select.Slot";
|
|
29
110
|
export {
|
|
30
|
-
|
|
111
|
+
K as ForwardedRefSelect,
|
|
112
|
+
t as Select,
|
|
113
|
+
S as SelectInput
|
|
31
114
|
};
|
|
32
115
|
//# sourceMappingURL=fondue-components18.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components18.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"fondue-components18.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, type ForwardedRef, type ReactNode } from 'react';\n\nimport { ForwardedRefCombobox } from './Combobox';\nimport { ForwardedRefSelectItem, ForwardedRefSelectItemGroup } from './SelectItem';\nimport { SelectMenu } 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) => void;\n /**\n * The active value in the select component. This is used to control the select externally.\n */\n value?: string;\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 aria label of the select component.\n */\n 'aria-label'?: string;\n /**\n * The data test id of the select component.\n */\n 'data-test-id'?: string;\n};\n\nexport const SelectInput = (\n {\n children,\n onSelect,\n value,\n defaultValue,\n placeholder = '',\n status = 'neutral',\n disabled,\n 'aria-label': ariaLabel,\n 'data-test-id': dataTestId = 'fondue-select',\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 { getToggleButtonProps, getMenuProps, getItemProps, reset, selectedItem, isOpen, highlightedIndex } =\n useSelect({\n items,\n defaultSelectedItem: defaultItem,\n selectedItem: activeItem,\n onSelectedItemChange: ({ selectedItem }) => {\n onSelect && onSelect(selectedItem.value);\n },\n itemToString: (item) => (item ? item.label : ''),\n });\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': ariaLabel,\n ...(forwardedRef ? { ref: forwardedRef } : {}),\n }))}\n >\n <span className={styles.input}>{selectedItem ? selectedItem.label : placeholder}</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 )}\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 highlightedIndex={highlightedIndex} getMenuProps={getMenuProps} getItemProps={getItemProps}>\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","ariaLabel","dataTestId","forwardedRef","inputSlots","menuSlots","items","clearButton","getItemByValue","useSelectData","defaultItem","activeItem","wasClicked","useRef","getToggleButtonProps","getMenuProps","getItemProps","reset","selectedItem","isOpen","highlightedIndex","useSelect","item","jsxs","RadixPopover","jsx","mouseEvent","focusEvent","blurEvent","styles","RadixSlot","event","IconCaretDown","IconCheckMark","IconExclamationMarkTriangle","SelectMenu","ForwardedRefSelect","forwardRef","Select","ForwardedRefCombobox","ForwardedRefSelectItem","ForwardedRefSelectItemGroup","ForwardedRefSelectSlot"],"mappings":";;;;;;;;;;;;AAuDO,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,cAAcC;AAAA,EACd,gBAAgBC,IAAa;AACjC,GACAC,MACC;AACK,QAAA,EAAE,YAAAC,GAAY,WAAAC,GAAW,OAAAC,GAAO,aAAAC,GAAa,gBAAA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AAK,cAAc;"}
|
|
@@ -1,115 +1,58 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
onSelectedItemChange: ({ selectedItem: e }) => {
|
|
29
|
-
m && m(e.value);
|
|
30
|
-
},
|
|
31
|
-
itemToString: (e) => e ? e.label : ""
|
|
32
|
-
});
|
|
33
|
-
return /* @__PURE__ */ i(f.Root, { open: P, children: [
|
|
34
|
-
/* @__PURE__ */ o(
|
|
35
|
-
f.Anchor,
|
|
36
|
-
{
|
|
37
|
-
asChild: !0,
|
|
38
|
-
onMouseDown: (e) => {
|
|
39
|
-
l.current = !0, e.currentTarget.dataset.showFocusRing = "false";
|
|
40
|
-
},
|
|
41
|
-
onFocus: (e) => {
|
|
42
|
-
l.current || (e.target.dataset.showFocusRing = "true");
|
|
43
|
-
},
|
|
44
|
-
onBlur: (e) => {
|
|
45
|
-
e.target.dataset.showFocusRing = "false", l.current = !1;
|
|
46
|
-
},
|
|
47
|
-
children: /* @__PURE__ */ i(
|
|
48
|
-
"div",
|
|
1
|
+
import { jsxs as f, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import * as e from "@radix-ui/react-slider";
|
|
3
|
+
import { forwardRef as h, useRef as R } from "react";
|
|
4
|
+
import r from "./fondue-components54.js";
|
|
5
|
+
const g = ({
|
|
6
|
+
value: a,
|
|
7
|
+
defaultValue: n = [0],
|
|
8
|
+
onChange: i,
|
|
9
|
+
onCommit: m,
|
|
10
|
+
"data-test-id": c = "fondue-slider",
|
|
11
|
+
...d
|
|
12
|
+
}, l) => {
|
|
13
|
+
const o = R(null);
|
|
14
|
+
return /* @__PURE__ */ f(
|
|
15
|
+
e.Root,
|
|
16
|
+
{
|
|
17
|
+
ref: l,
|
|
18
|
+
className: r.root,
|
|
19
|
+
value: a,
|
|
20
|
+
defaultValue: n,
|
|
21
|
+
onValueChange: i,
|
|
22
|
+
onValueCommit: m,
|
|
23
|
+
"data-test-id": c,
|
|
24
|
+
...d,
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ s(
|
|
27
|
+
e.Track,
|
|
49
28
|
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
...n ? {} : F({
|
|
56
|
-
"aria-label": b,
|
|
57
|
-
...d ? { ref: d } : {}
|
|
58
|
-
}),
|
|
59
|
-
children: [
|
|
60
|
-
/* @__PURE__ */ o("span", { className: r.input, children: c ? c.label : N }),
|
|
61
|
-
w,
|
|
62
|
-
u && /* @__PURE__ */ o(
|
|
63
|
-
j,
|
|
64
|
-
{
|
|
65
|
-
onClick: (e) => {
|
|
66
|
-
e.stopPropagation(), M();
|
|
67
|
-
},
|
|
68
|
-
className: r.clear,
|
|
69
|
-
children: u
|
|
70
|
-
}
|
|
71
|
-
),
|
|
72
|
-
/* @__PURE__ */ i("div", { className: r.icons, children: [
|
|
73
|
-
/* @__PURE__ */ o(G, { size: 16, className: r.caret }),
|
|
74
|
-
a === "success" ? /* @__PURE__ */ o(
|
|
75
|
-
z,
|
|
76
|
-
{
|
|
77
|
-
size: 16,
|
|
78
|
-
className: r.iconSuccess,
|
|
79
|
-
"data-test-id": `${s}-success-icon`
|
|
80
|
-
}
|
|
81
|
-
) : null,
|
|
82
|
-
a === "error" ? /* @__PURE__ */ o(
|
|
83
|
-
D,
|
|
84
|
-
{
|
|
85
|
-
size: 16,
|
|
86
|
-
className: r.iconError,
|
|
87
|
-
"data-test-id": `${s}-error-icon`
|
|
88
|
-
}
|
|
89
|
-
) : null
|
|
90
|
-
] })
|
|
91
|
-
]
|
|
29
|
+
onPointerDown: () => {
|
|
30
|
+
o.current && (o.current.dataset.showFocusRing = "false");
|
|
31
|
+
},
|
|
32
|
+
className: r.track,
|
|
33
|
+
children: /* @__PURE__ */ s(e.Range, { className: r.range })
|
|
92
34
|
}
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
t
|
|
103
|
-
t.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
+
))
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}, p = h(g);
|
|
54
|
+
p.displayName = "Slider";
|
|
110
55
|
export {
|
|
111
|
-
|
|
112
|
-
t as Select,
|
|
113
|
-
S as SelectInput
|
|
56
|
+
p as Slider
|
|
114
57
|
};
|
|
115
58
|
//# sourceMappingURL=fondue-components19.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components19.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"fondue-components19.js","sources":["../src/components/Slider/Slider.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as RadixSlider from '@radix-ui/react-slider';\nimport { type ForwardedRef, forwardRef, useRef } from 'react';\n\nimport { type CommonAriaAttrs } from '#/utilities/types';\n\nimport styles from './styles/slider.module.scss';\n\nexport type SliderProps = {\n id?: string;\n name?: string;\n /**\n * The default value of the slider\n * Used for uncontrolled components\n * @default [0]\n */\n defaultValue?: number[];\n /**\n * The controlled value of the slider\n * @default [0]\n */\n value?: number[];\n /**\n * Minimum value of the slider\n * @default 0\n */\n min?: number;\n /**\n * Maximum value of the slider\n * @default 100\n */\n max?: number;\n /**\n * The granularity with which the slider can step through values\n * @default 1\n */\n step?: number;\n /**\n * The minimum steps between thumbs in a range slider\n * @default 0\n */\n minStepsBetweenThumbs?: number;\n /**\n * Disable the slider\n * @default false\n */\n disabled?: boolean;\n onChange?: (value: number[]) => void;\n onCommit?: (value: number[]) => void;\n 'data-test-id'?: string;\n} & CommonAriaAttrs;\n\nconst SliderComponent = (\n {\n value,\n defaultValue = [0],\n onChange,\n onCommit,\n 'data-test-id': dataTestId = 'fondue-slider',\n ...props\n }: SliderProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n const sliderThumbRef = useRef<HTMLSpanElement | null>(null);\n return (\n <RadixSlider.Root\n ref={ref}\n className={styles.root}\n value={value}\n defaultValue={defaultValue}\n onValueChange={onChange}\n onValueCommit={onCommit}\n data-test-id={dataTestId}\n {...props}\n >\n <RadixSlider.Track\n onPointerDown={() => {\n if (sliderThumbRef.current) {\n sliderThumbRef.current.dataset.showFocusRing = 'false';\n }\n }}\n className={styles.track}\n >\n <RadixSlider.Range className={styles.range} />\n </RadixSlider.Track>\n {(value || defaultValue).map((_, index) => (\n <RadixSlider.Thumb\n ref={sliderThumbRef}\n className={styles.thumb}\n onPointerDown={(event) => {\n event.currentTarget.dataset.showFocusRing = 'false';\n }}\n onBlur={(event) => {\n event.currentTarget.dataset.showFocusRing = 'true';\n }}\n key={index}\n />\n ))}\n </RadixSlider.Root>\n );\n};\n\nexport const Slider = forwardRef<HTMLButtonElement, SliderProps>(SliderComponent);\nSlider.displayName = 'Slider';\n"],"names":["SliderComponent","value","defaultValue","onChange","onCommit","dataTestId","props","ref","sliderThumbRef","useRef","jsxs","RadixSlider","styles","jsx","_","index","event","Slider","forwardRef"],"mappings":";;;;AAqDA,MAAMA,IAAkB,CACpB;AAAA,EACI,OAAAC;AAAA,EACA,cAAAC,IAAe,CAAC,CAAC;AAAA,EACjB,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAgBC,IAAa;AAAA,EAC7B,GAAGC;AACP,GACAC,MACC;AACK,QAAAC,IAAiBC,EAA+B,IAAI;AAEtD,SAAA,gBAAAC;AAAA,IAACC,EAAY;AAAA,IAAZ;AAAA,MACG,KAAAJ;AAAA,MACA,WAAWK,EAAO;AAAA,MAClB,OAAAX;AAAA,MACA,cAAAC;AAAA,MACA,eAAeC;AAAA,MACf,eAAeC;AAAA,MACf,gBAAcC;AAAA,MACb,GAAGC;AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAAO;AAAA,UAACF,EAAY;AAAA,UAAZ;AAAA,YACG,eAAe,MAAM;AACjB,cAAIH,EAAe,YACAA,EAAA,QAAQ,QAAQ,gBAAgB;AAAA,YAEvD;AAAA,YACA,WAAWI,EAAO;AAAA,YAElB,4BAACD,EAAY,OAAZ,EAAkB,WAAWC,EAAO,OAAO;AAAA,UAAA;AAAA,QAChD;AAAA,SACEX,KAASC,GAAc,IAAI,CAACY,GAAGC,MAC7B,gBAAAF;AAAA,UAACF,EAAY;AAAA,UAAZ;AAAA,YACG,KAAKH;AAAA,YACL,WAAWI,EAAO;AAAA,YAClB,eAAe,CAACI,MAAU;AAChB,cAAAA,EAAA,cAAc,QAAQ,gBAAgB;AAAA,YAChD;AAAA,YACA,QAAQ,CAACA,MAAU;AACT,cAAAA,EAAA,cAAc,QAAQ,gBAAgB;AAAA,YAChD;AAAA,UAAA;AAAA,UACKD;AAAA,QAAA,CAEZ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGb,GAEaE,IAASC,EAA2ClB,CAAe;AAChFiB,EAAO,cAAc;"}
|
|
@@ -1,69 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { cn as
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/* @__PURE__ */ s(
|
|
17
|
-
"input",
|
|
18
|
-
{
|
|
19
|
-
onMouseDown: (o) => {
|
|
20
|
-
i.current = !0, o.currentTarget.dataset.showFocusRing = "false";
|
|
21
|
-
},
|
|
22
|
-
type: "text",
|
|
23
|
-
...t,
|
|
24
|
-
onFocus: (o) => {
|
|
25
|
-
var l;
|
|
26
|
-
i.current || (o.target.dataset.showFocusRing = "true"), (l = t.onFocus) == null || l.call(t, o);
|
|
27
|
-
},
|
|
28
|
-
onBlur: (o) => {
|
|
29
|
-
var l;
|
|
30
|
-
o.target.dataset.showFocusRing = "false", i.current = !1, (l = t.onBlur) == null || l.call(t, o);
|
|
31
|
-
},
|
|
32
|
-
ref: R,
|
|
33
|
-
className: r.input,
|
|
34
|
-
"aria-invalid": e === "error"
|
|
35
|
-
}
|
|
36
|
-
),
|
|
37
|
-
e === "success" ? /* @__PURE__ */ s(w, { size: 16, className: r.iconSuccess, "data-test-id": `${a}-success-icon` }) : null,
|
|
38
|
-
e === "error" ? /* @__PURE__ */ s(
|
|
39
|
-
N,
|
|
40
|
-
{
|
|
41
|
-
size: 16,
|
|
42
|
-
className: r.iconError,
|
|
43
|
-
"data-test-id": `${a}-error-icon`
|
|
44
|
-
}
|
|
45
|
-
) : null,
|
|
46
|
-
c
|
|
47
|
-
] });
|
|
48
|
-
};
|
|
49
|
-
f.displayName = "TextField.Root";
|
|
50
|
-
const u = ({ name: c, className: d, ...e }, a) => /* @__PURE__ */ s(
|
|
51
|
-
"div",
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as o from "@radix-ui/react-switch";
|
|
3
|
+
import { forwardRef as l } from "react";
|
|
4
|
+
import { cn as f } from "./fondue-components25.js";
|
|
5
|
+
import t from "./fondue-components55.js";
|
|
6
|
+
const n = ({
|
|
7
|
+
value: a,
|
|
8
|
+
defaultValue: i,
|
|
9
|
+
size: m = "medium",
|
|
10
|
+
onChange: r,
|
|
11
|
+
"data-test-id": c = "fondue-switch",
|
|
12
|
+
"aria-label": d = "Switch",
|
|
13
|
+
...s
|
|
14
|
+
}, h) => /* @__PURE__ */ e(
|
|
15
|
+
o.Root,
|
|
52
16
|
{
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
17
|
+
ref: h,
|
|
18
|
+
checked: a,
|
|
19
|
+
defaultChecked: i,
|
|
20
|
+
className: f([t.root, t[m]]),
|
|
21
|
+
onCheckedChange: r,
|
|
22
|
+
"aria-label": d,
|
|
23
|
+
"data-test-id": c,
|
|
24
|
+
...s,
|
|
25
|
+
children: /* @__PURE__ */ e(o.Thumb, { className: t.thumb })
|
|
58
26
|
}
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
const x = n(f), T = n(u), F = x;
|
|
62
|
-
F.Root = x;
|
|
63
|
-
F.Slot = T;
|
|
27
|
+
), p = l(n);
|
|
28
|
+
p.displayName = "Switch";
|
|
64
29
|
export {
|
|
65
|
-
|
|
66
|
-
u as TextFieldSlot,
|
|
67
|
-
F as TextInput
|
|
30
|
+
p as Switch
|
|
68
31
|
};
|
|
69
32
|
//# 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/Switch/Switch.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as RadixSwitch from '@radix-ui/react-switch';\nimport { type FormEvent, type ForwardedRef, forwardRef } from 'react';\n\nimport { cn } from '#/utilities/styleUtilities';\nimport { type CommonAriaAttrs } from '#/utilities/types';\n\nimport styles from './styles/switch.module.scss';\n\ntype SwitchProps = {\n id?: string;\n name?: string;\n /**\n * The size of the switch component.\n * @default medium\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * The active value in the select component. This is used to control the select externally.\n * @default false\n */\n value?: boolean;\n /**\n * The default value of the select component. Used for uncontrolled usages.\n * @default false\n */\n defaultValue?: boolean;\n /**\n * Disables the select component.\n * @default false\n */\n disabled?: boolean;\n /**\n * Whether the switch is required.\n * @default false\n */\n required?: boolean;\n /**\n * Callback function that is called when the switch is toggled.\n * @param checked - The new checked state of the switch\n */\n onChange?: (checked: boolean) => void;\n /**\n * Event handler called when the checkbox is blurred\n * @param event - The event object\n */\n onBlur?: (event: FormEvent<HTMLButtonElement>) => void;\n /**\n * Event handler called when the checkbox is focused\n * @param event - The event object\n */\n onFocus?: (event: FormEvent<HTMLButtonElement>) => void;\n 'data-test-id'?: string;\n} & CommonAriaAttrs;\n\nconst SwitchComponent = (\n {\n value,\n defaultValue,\n size = 'medium',\n onChange,\n 'data-test-id': dataTestId = 'fondue-switch',\n 'aria-label': ariaLabel = 'Switch',\n ...props\n }: SwitchProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => (\n <RadixSwitch.Root\n ref={ref}\n checked={value}\n defaultChecked={defaultValue}\n className={cn([styles.root, styles[size]])}\n onCheckedChange={onChange}\n aria-label={ariaLabel}\n data-test-id={dataTestId}\n {...props}\n >\n <RadixSwitch.Thumb className={styles.thumb} />\n </RadixSwitch.Root>\n);\n\nexport const Switch = forwardRef<HTMLButtonElement, SwitchProps>(SwitchComponent);\nSwitch.displayName = 'Switch';\n"],"names":["SwitchComponent","value","defaultValue","size","onChange","dataTestId","ariaLabel","props","ref","jsx","RadixSwitch","cn","styles","Switch","forwardRef"],"mappings":";;;;;AAwDA,MAAMA,IAAkB,CACpB;AAAA,EACI,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,UAAAC;AAAA,EACA,gBAAgBC,IAAa;AAAA,EAC7B,cAAcC,IAAY;AAAA,EAC1B,GAAGC;AACP,GACAC,MAEA,gBAAAC;AAAA,EAACC,EAAY;AAAA,EAAZ;AAAA,IACG,KAAAF;AAAA,IACA,SAASP;AAAA,IACT,gBAAgBC;AAAA,IAChB,WAAWS,EAAG,CAACC,EAAO,MAAMA,EAAOT,CAAI,CAAC,CAAC;AAAA,IACzC,iBAAiBC;AAAA,IACjB,cAAYE;AAAA,IACZ,gBAAcD;AAAA,IACb,GAAGE;AAAA,IAEJ,4BAACG,EAAY,OAAZ,EAAkB,WAAWE,EAAO,OAAO;AAAA,EAAA;AAChD,GAGSC,IAASC,EAA2Cd,CAAe;AAChFa,EAAO,cAAc;"}
|