@frontify/fondue-components 25.0.0 → 26.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.
Files changed (59) hide show
  1. package/dist/fondue-components100.js +9 -0
  2. package/dist/fondue-components100.js.map +1 -0
  3. package/dist/fondue-components101.js +15 -0
  4. package/dist/fondue-components101.js.map +1 -0
  5. package/dist/fondue-components102.js +74 -0
  6. package/dist/fondue-components102.js.map +1 -0
  7. package/dist/fondue-components103.js +18 -0
  8. package/dist/fondue-components103.js.map +1 -0
  9. package/dist/fondue-components104.js +10 -0
  10. package/dist/fondue-components104.js.map +1 -0
  11. package/dist/fondue-components105.js +92 -0
  12. package/dist/fondue-components105.js.map +1 -0
  13. package/dist/fondue-components106.js +84 -0
  14. package/dist/fondue-components106.js.map +1 -0
  15. package/dist/fondue-components107.js +34 -0
  16. package/dist/fondue-components107.js.map +1 -0
  17. package/dist/fondue-components108.js +24 -0
  18. package/dist/fondue-components108.js.map +1 -0
  19. package/dist/fondue-components109.js +43 -0
  20. package/dist/fondue-components109.js.map +1 -0
  21. package/dist/fondue-components26.js +23 -143
  22. package/dist/fondue-components26.js.map +1 -1
  23. package/dist/fondue-components4.js.map +1 -1
  24. package/dist/fondue-components40.js +2 -2
  25. package/dist/fondue-components47.js +1 -1
  26. package/dist/fondue-components48.js.map +1 -1
  27. package/dist/fondue-components71.js +20 -154
  28. package/dist/fondue-components71.js.map +1 -1
  29. package/dist/fondue-components72.js +20 -19
  30. package/dist/fondue-components72.js.map +1 -1
  31. package/dist/fondue-components73.js +18 -79
  32. package/dist/fondue-components73.js.map +1 -1
  33. package/dist/fondue-components74.js +20 -8
  34. package/dist/fondue-components74.js.map +1 -1
  35. package/dist/fondue-components75.js +19 -37
  36. package/dist/fondue-components75.js.map +1 -1
  37. package/dist/fondue-components76.js +8 -71
  38. package/dist/fondue-components76.js.map +1 -1
  39. package/dist/fondue-components90.js +5 -0
  40. package/dist/fondue-components90.js.map +1 -1
  41. package/dist/fondue-components92.js +3 -15
  42. package/dist/fondue-components92.js.map +1 -1
  43. package/dist/fondue-components93.js +4 -4
  44. package/dist/fondue-components93.js.map +1 -1
  45. package/dist/fondue-components94.js +16 -4
  46. package/dist/fondue-components94.js.map +1 -1
  47. package/dist/fondue-components95.js +209 -38
  48. package/dist/fondue-components95.js.map +1 -1
  49. package/dist/fondue-components96.js +17 -19
  50. package/dist/fondue-components96.js.map +1 -1
  51. package/dist/fondue-components97.js +23 -0
  52. package/dist/fondue-components97.js.map +1 -0
  53. package/dist/fondue-components98.js +154 -0
  54. package/dist/fondue-components98.js.map +1 -0
  55. package/dist/fondue-components99.js +48 -0
  56. package/dist/fondue-components99.js.map +1 -0
  57. package/dist/index.d.ts +122 -136
  58. package/dist/style.css +1 -1
  59. package/package.json +5 -5
@@ -1,146 +1,26 @@
1
- import { jsxs as d, jsx as a } from "react/jsx-runtime";
2
- import { IconCaretDown as $, IconCheckMark as A, IconExclamationMarkTriangle as q } from "@frontify/fondue-icons";
3
- import * as g from "@radix-ui/react-popover";
4
- import { Slot as J } from "@radix-ui/react-slot";
5
- import { useSelect as K } from "downshift";
6
- import { forwardRef as L, useRef as Q, useState as U } from "react";
7
- import { ForwardedRefCombobox as W } from "./fondue-components71.js";
8
- import { ForwardedRefSelectItem as X, ForwardedRefSelectItemGroup as Y } from "./fondue-components72.js";
9
- import { SelectMenu as Z } from "./fondue-components73.js";
10
- import { ForwardedRefSelectSlot as _ } from "./fondue-components74.js";
11
- import o from "./fondue-components75.js";
12
- import { useSelectData as ee } from "./fondue-components76.js";
13
- const S = ({
14
- children: h,
15
- onSelect: s,
16
- value: b,
17
- defaultValue: I,
18
- placeholder: N = "",
19
- status: n = "neutral",
20
- disabled: m,
21
- alignMenu: w = "start",
22
- side: y = "bottom",
23
- id: C,
24
- showStringValue: R = !0,
25
- "data-test-id": c = "fondue-select",
26
- viewportCollisionPadding: x = "compact",
27
- onEscapeKeyDown: F,
28
- ...l
29
- }, v) => {
30
- const { inputSlots: k, menuSlots: B, items: M, clearButton: u, getItemByValue: p } = ee(h), P = p(I), G = p(b), i = Q(!1), [O, f] = U(!1), { getToggleButtonProps: z, getMenuProps: D, getItemProps: V, reset: j, selectedItem: r, isOpen: E, highlightedIndex: H } = K({
31
- items: M,
32
- defaultSelectedItem: P,
33
- selectedItem: G,
34
- toggleButtonId: C,
35
- labelId: "aria-labelledby" in l ? l["aria-labelledby"] : void 0,
36
- onIsOpenChange: () => {
37
- f(!1);
38
- },
39
- onHighlightedIndexChange: () => {
40
- f(!0);
41
- },
42
- onSelectedItemChange: ({ selectedItem: e }) => {
43
- s == null || s((e == null ? void 0 : e.value) ?? null);
44
- },
45
- itemToString: (e) => e ? e.label : ""
46
- }), T = r ? !R && r.children || r.label : N;
47
- return /* @__PURE__ */ d(g.Root, { open: E, children: [
48
- /* @__PURE__ */ a(
49
- g.Anchor,
50
- {
51
- asChild: !0,
52
- onMouseDown: (e) => {
53
- i.current = !0, e.currentTarget.dataset.showFocusRing = "false";
54
- },
55
- onFocus: (e) => {
56
- i.current || (e.target.dataset.showFocusRing = "true");
57
- },
58
- onBlur: (e) => {
59
- e.target.dataset.showFocusRing = "false", i.current = !1;
60
- },
61
- children: /* @__PURE__ */ d(
62
- "div",
63
- {
64
- className: o.root,
65
- "data-status": n,
66
- "data-disabled": m,
67
- "data-empty": !r,
68
- "data-test-id": c,
69
- ...m ? {} : (
70
- // eslint-disable-next-line react-hooks/refs
71
- z({
72
- "aria-label": "aria-label" in l ? l["aria-label"] : void 0,
73
- ref: v
74
- })
75
- ),
76
- children: [
77
- /* @__PURE__ */ a("span", { className: o.selectedValue, children: T }),
78
- k,
79
- u ? /* @__PURE__ */ a(
80
- J,
81
- {
82
- onClick: (e) => {
83
- e.stopPropagation(), j();
84
- },
85
- className: o.clear,
86
- children: u
87
- }
88
- ) : null,
89
- /* @__PURE__ */ d("div", { className: o.icons, children: [
90
- /* @__PURE__ */ a($, { size: 16, className: o.caret }),
91
- n === "success" ? /* @__PURE__ */ a(
92
- A,
93
- {
94
- size: 16,
95
- className: o.iconSuccess,
96
- "data-test-id": `${c}-success-icon`
97
- }
98
- ) : null,
99
- n === "error" ? /* @__PURE__ */ a(
100
- q,
101
- {
102
- size: 16,
103
- className: o.iconError,
104
- "data-test-id": `${c}-error-icon`
105
- }
106
- ) : null
107
- ] })
108
- ]
109
- }
110
- )
111
- }
112
- ),
113
- /* @__PURE__ */ a(
114
- Z,
115
- {
116
- align: w,
117
- side: y,
118
- highlightedIndex: H,
119
- getMenuProps: D,
120
- getItemProps: V,
121
- selectedItem: r,
122
- hasInteractedSinceOpening: O,
123
- viewportCollisionPadding: x,
124
- onEscapeKeyDown: F,
125
- children: B
126
- }
127
- )
128
- ] });
129
- };
130
- S.displayName = "Select";
131
- const te = L(S), t = te;
132
- t.displayName = "Select";
133
- t.Combobox = W;
134
- t.Combobox.displayName = "Select.Combobox";
135
- t.Item = X;
136
- t.Item.displayName = "Select.Item";
137
- t.Group = Y;
138
- t.Group.displayName = "Select.Group";
139
- t.Slot = _;
140
- t.Slot.displayName = "Select.Slot";
1
+ import { ComboboxMultiple as o } from "./fondue-components71.js";
2
+ import { ComboboxSingle as t } from "./fondue-components72.js";
3
+ import { SelectMultiple as m } from "./fondue-components73.js";
4
+ import { SelectSingle as p } from "./fondue-components74.js";
5
+ import { ForwardedRefSelectItem as i, ForwardedRefSelectItemGroup as r } from "./fondue-components75.js";
6
+ import { ForwardedRefSelectSlot as S } from "./fondue-components76.js";
7
+ const l = t;
8
+ l.Multiple = o;
9
+ const e = p;
10
+ e.displayName = "Select";
11
+ e.Multiple = m;
12
+ e.Multiple.displayName = "Select.Multiple";
13
+ e.Combobox = l;
14
+ e.Combobox.displayName = "Select.Combobox";
15
+ e.Combobox.Multiple = o;
16
+ e.Combobox.Multiple.displayName = "Select.Combobox.Multiple";
17
+ e.Item = i;
18
+ e.Item.displayName = "Select.Item";
19
+ e.Group = r;
20
+ e.Group.displayName = "Select.Group";
21
+ e.Slot = S;
22
+ e.Slot.displayName = "Select.Slot";
141
23
  export {
142
- te as ForwardedRefSelect,
143
- t as Select,
144
- S as SelectInput
24
+ e as Select
145
25
  };
146
26
  //# sourceMappingURL=fondue-components26.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components26.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 /**\n * Event handler called when the escape key is pressed.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void;\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 onEscapeKeyDown,\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 : // eslint-disable-next-line react-hooks/refs\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 onEscapeKeyDown={onEscapeKeyDown}\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","onEscapeKeyDown","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":";;;;;;;;;;;;AAkFO,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;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,gBAAgBC,IAAa;AAAA,EAC7B,0BAAAC,IAA2B;AAAA,EAC3B,iBAAAC;AAAA,EACA,GAAGC;AACP,GACAC,MACC;AACD,QAAM,EAAE,YAAAC,GAAY,WAAAC,GAAW,OAAAC,GAAO,aAAAC,GAAa,gBAAAC,EAAA,IAAmBC,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,MAACU;AAAA,MAAA;AAAA,QACG,OAAO5C;AAAA,QACP,MAAAC;AAAA,QACA,kBAAA2B;AAAA,QACA,cAAAL;AAAA,QACA,cAAAC;AAAA,QACA,cAAAE;AAAA,QACA,2BAAAP;AAAA,QACA,0BAAAd;AAAA,QACA,iBAAAC;AAAA,QAEC,UAAAI;AAAA,MAAA;AAAA,IAAA;AAAA,EACL,GACJ;AAER;AACAlB,EAAY,cAAc;AAEnB,MAAMqD,KAAqBC,EAAiDtD,CAAW,GAGjFuD,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-components26.js","sources":["../src/components/Select/index.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { ComboboxMultiple } from './ComboboxMultiple';\nimport { ComboboxSingle } from './ComboboxSingle';\nimport { SelectMultiple } from './SelectMultiple';\nimport { SelectSingle } from './SelectSingle';\nimport { ForwardedRefSelectItem, ForwardedRefSelectItemGroup } from './components/SelectItem';\nimport { ForwardedRefSelectSlot } from './components/SelectSlot';\n\ntype ComboboxComponent = typeof ComboboxSingle & {\n Multiple: typeof ComboboxMultiple;\n};\n\n// @ts-expect-error We support both Select and Select.Combobox as the Root\nconst Combobox: ComboboxComponent = ComboboxSingle;\nCombobox.Multiple = ComboboxMultiple;\n\n// @ts-expect-error We support both Select and Select.Combobox as the Root\nexport const Select: typeof SelectSingle & {\n Multiple: typeof SelectMultiple;\n Combobox: ComboboxComponent;\n Item: typeof ForwardedRefSelectItem;\n Group: typeof ForwardedRefSelectItemGroup;\n Slot: typeof ForwardedRefSelectSlot;\n} = SelectSingle;\n\nSelect.displayName = 'Select';\nSelect.Multiple = SelectMultiple;\nSelect.Multiple.displayName = 'Select.Multiple';\nSelect.Combobox = Combobox;\nSelect.Combobox.displayName = 'Select.Combobox';\nSelect.Combobox.Multiple = ComboboxMultiple;\nSelect.Combobox.Multiple.displayName = 'Select.Combobox.Multiple';\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":["Combobox","ComboboxSingle","ComboboxMultiple","Select","SelectSingle","SelectMultiple","ForwardedRefSelectItem","ForwardedRefSelectItemGroup","ForwardedRefSelectSlot"],"mappings":";;;;;;AAcA,MAAMA,IAA8BC;AACpCD,EAAS,WAAWE;AAGb,MAAMC,IAMTC;AAEJD,EAAO,cAAc;AACrBA,EAAO,WAAWE;AAClBF,EAAO,SAAS,cAAc;AAC9BA,EAAO,WAAWH;AAClBG,EAAO,SAAS,cAAc;AAC9BA,EAAO,SAAS,WAAWD;AAC3BC,EAAO,SAAS,SAAS,cAAc;AACvCA,EAAO,OAAOG;AACdH,EAAO,KAAK,cAAc;AAC1BA,EAAO,QAAQI;AACfJ,EAAO,MAAM,cAAc;AAC3BA,EAAO,OAAOK;AACdL,EAAO,KAAK,cAAc;"}
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components4.js","sources":["../src/components/Badge/Badge.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCross } from '@frontify/fondue-icons';\nimport { type MouseEvent, type ReactNode } from 'react';\n\nimport { useTranslation } from '#/hooks/useTranslation';\n\nimport { BadgeStatus, type BadgeStatusProps } from './BadgeStatus';\nimport styles from './styles/badge.module.scss';\n\ntype BadgeStyle = 'default' | 'positive' | 'highlight' | 'warning' | 'negative';\n\ntype BadgeEmphasis = 'strong' | 'weak';\n\ntype BadgeSize = 'default' | 'small';\n\ntype BadgeProps = {\n /**\n * @default 'strong'\n */\n emphasis?: BadgeEmphasis;\n /**\n * @default 'default'\n */\n variant?: BadgeStyle;\n /**\n * @default 'default'\n */\n size?: BadgeSize;\n /**\n * @default false\n */\n disabled?: boolean;\n /**\n * Click handler\n */\n onClick?: (event?: MouseEvent<HTMLButtonElement>) => void;\n /**\n * Click handler on dismiss - providing this will show the dismiss button\n */\n onDismiss?: (event?: MouseEvent<HTMLButtonElement>) => void;\n /**\n * The color of the status dot\n */\n status?: BadgeStatusProps['status'];\n title?: string;\n 'aria-label'?: string;\n 'data-test-id'?: string;\n children: ReactNode;\n};\n\nexport const Badge = ({\n 'aria-label': ariaLabel,\n 'data-test-id': dataTestId = 'badge',\n children,\n disabled = false,\n emphasis = 'strong',\n onClick,\n onDismiss,\n size = 'default',\n status,\n title,\n variant = 'default',\n}: BadgeProps) => {\n const commonProps = {\n 'aria-label': ariaLabel || title,\n 'data-component': 'badge',\n 'data-disabled': disabled,\n 'data-dismissable': !!onDismiss,\n 'data-emphasis': emphasis,\n 'data-size': size,\n 'data-test-id': dataTestId,\n 'data-variant': variant,\n className: styles.root,\n title,\n };\n\n const contentProps = {\n 'aria-label': ariaLabel || title,\n disabled,\n onDismiss,\n status,\n };\n\n if (onClick) {\n return (\n <button type=\"button\" disabled={disabled} {...commonProps} onClick={onClick}>\n <BadgeContent {...contentProps}>{children}</BadgeContent>\n </button>\n );\n }\n\n return (\n <div {...commonProps}>\n <BadgeContent {...contentProps}>{children}</BadgeContent>\n </div>\n );\n};\n\nconst BadgeContent = ({ 'aria-label': ariaLabel, children, disabled = false, onDismiss, status }: BadgeProps) => {\n const { t } = useTranslation();\n\n return (\n <>\n {status && <BadgeStatus status={status} />}\n {children}\n {onDismiss && (\n <button\n type=\"button\"\n aria-label={t('Badge_dismiss', { label: ariaLabel || '' })}\n className={styles.dismiss}\n disabled={disabled}\n onClick={onDismiss}\n >\n <IconCross size=\"12\" />\n </button>\n )}\n </>\n );\n};\n"],"names":["Badge","ariaLabel","dataTestId","children","disabled","emphasis","onClick","onDismiss","size","status","title","variant","commonProps","styles","contentProps","jsx","BadgeContent","t","useTranslation","jsxs","Fragment","BadgeStatus","IconCross"],"mappings":";;;;;AAmDO,MAAMA,IAAQ,CAAC;AAAA,EAClB,cAAcC;AAAA,EACd,gBAAgBC,IAAa;AAAA,EAC7B,UAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,UAAAC,IAAW;AAAA,EACX,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC,IAAU;AACd,MAAkB;AACd,QAAMC,IAAc;AAAA,IAChB,cAAcX,KAAaS;AAAA,IAC3B,kBAAkB;AAAA,IAClB,iBAAiBN;AAAA,IACjB,oBAAoB,CAAC,CAACG;AAAA,IACtB,iBAAiBF;AAAA,IACjB,aAAaG;AAAA,IACb,gBAAgBN;AAAA,IAChB,gBAAgBS;AAAA,IAChB,WAAWE,EAAO;AAAA,IAClB,OAAAH;AAAA,EAAA,GAGEI,IAAe;AAAA,IACjB,cAAcb,KAAaS;AAAA,IAC3B,UAAAN;AAAA,IACA,WAAAG;AAAA,IACA,QAAAE;AAAA,EAAA;AAGJ,SAAIH,IAEI,gBAAAS,EAAC,UAAA,EAAO,MAAK,UAAS,UAAAX,GAAqB,GAAGQ,GAAa,SAAAN,GACvD,UAAA,gBAAAS,EAACC,GAAA,EAAc,GAAGF,GAAe,UAAAX,GAAS,GAC9C,IAKJ,gBAAAY,EAAC,SAAK,GAAGH,GACL,4BAACI,GAAA,EAAc,GAAGF,GAAe,UAAAX,EAAA,CAAS,EAAA,CAC9C;AAER,GAEMa,IAAe,CAAC,EAAE,cAAcf,GAAW,UAAAE,GAAU,UAAAC,IAAW,IAAO,WAAAG,GAAW,QAAAE,QAAyB;AAC7G,QAAM,EAAE,GAAAQ,EAAA,IAAMC,EAAA;AAEd,SACI,gBAAAC,EAAAC,GAAA,EACK,UAAA;AAAA,IAAAX,KAAU,gBAAAM,EAACM,KAAY,QAAAZ,EAAA,CAAgB;AAAA,IACvCN;AAAA,IACAI,KACG,gBAAAQ;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,MAAK;AAAA,QACL,cAAYE,EAAE,iBAAiB,EAAE,OAAOhB,KAAa,IAAI;AAAA,QACzD,WAAWY,EAAO;AAAA,QAClB,UAAAT;AAAA,QACA,SAASG;AAAA,QAET,UAAA,gBAAAQ,EAACO,GAAA,EAAU,MAAK,KAAA,CAAK;AAAA,MAAA;AAAA,IAAA;AAAA,EACzB,GAER;AAER;"}
1
+ {"version":3,"file":"fondue-components4.js","sources":["../src/components/Badge/Badge.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCross } from '@frontify/fondue-icons';\nimport { type MouseEvent, type ReactNode } from 'react';\n\nimport { useTranslation } from '#/hooks/useTranslation';\n\nimport { BadgeStatus, type BadgeStatusProps } from './BadgeStatus';\nimport styles from './styles/badge.module.scss';\n\ntype BadgeStyle = 'default' | 'positive' | 'highlight' | 'warning' | 'negative';\n\ntype BadgeEmphasis = 'strong' | 'weak';\n\ntype BadgeSize = 'default' | 'small';\n\ntype BadgeProps = {\n /**\n * @default 'strong'\n */\n emphasis?: BadgeEmphasis;\n /**\n * @default 'default'\n */\n variant?: BadgeStyle;\n /**\n * @default 'default'\n */\n size?: BadgeSize;\n /**\n * @default false\n */\n disabled?: boolean;\n /**\n * Click handler\n */\n onClick?: (event: MouseEvent<HTMLButtonElement>) => void;\n /**\n * Click handler on dismiss - providing this will show the dismiss button\n */\n onDismiss?: (event: MouseEvent<HTMLButtonElement>) => void;\n /**\n * The color of the status dot\n */\n status?: BadgeStatusProps['status'];\n title?: string;\n 'aria-label'?: string;\n 'data-test-id'?: string;\n children: ReactNode;\n};\n\nexport const Badge = ({\n 'aria-label': ariaLabel,\n 'data-test-id': dataTestId = 'badge',\n children,\n disabled = false,\n emphasis = 'strong',\n onClick,\n onDismiss,\n size = 'default',\n status,\n title,\n variant = 'default',\n}: BadgeProps) => {\n const commonProps = {\n 'aria-label': ariaLabel || title,\n 'data-component': 'badge',\n 'data-disabled': disabled,\n 'data-dismissable': !!onDismiss,\n 'data-emphasis': emphasis,\n 'data-size': size,\n 'data-test-id': dataTestId,\n 'data-variant': variant,\n className: styles.root,\n title,\n };\n\n const contentProps = {\n 'aria-label': ariaLabel || title,\n disabled,\n onDismiss,\n status,\n };\n\n if (onClick) {\n return (\n <button type=\"button\" disabled={disabled} {...commonProps} onClick={onClick}>\n <BadgeContent {...contentProps}>{children}</BadgeContent>\n </button>\n );\n }\n\n return (\n <div {...commonProps}>\n <BadgeContent {...contentProps}>{children}</BadgeContent>\n </div>\n );\n};\n\nconst BadgeContent = ({ 'aria-label': ariaLabel, children, disabled = false, onDismiss, status }: BadgeProps) => {\n const { t } = useTranslation();\n\n return (\n <>\n {status && <BadgeStatus status={status} />}\n {children}\n {onDismiss && (\n <button\n type=\"button\"\n aria-label={t('Badge_dismiss', { label: ariaLabel || '' })}\n className={styles.dismiss}\n disabled={disabled}\n onClick={onDismiss}\n >\n <IconCross size=\"12\" />\n </button>\n )}\n </>\n );\n};\n"],"names":["Badge","ariaLabel","dataTestId","children","disabled","emphasis","onClick","onDismiss","size","status","title","variant","commonProps","styles","contentProps","jsx","BadgeContent","t","useTranslation","jsxs","Fragment","BadgeStatus","IconCross"],"mappings":";;;;;AAmDO,MAAMA,IAAQ,CAAC;AAAA,EAClB,cAAcC;AAAA,EACd,gBAAgBC,IAAa;AAAA,EAC7B,UAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,UAAAC,IAAW;AAAA,EACX,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC,IAAU;AACd,MAAkB;AACd,QAAMC,IAAc;AAAA,IAChB,cAAcX,KAAaS;AAAA,IAC3B,kBAAkB;AAAA,IAClB,iBAAiBN;AAAA,IACjB,oBAAoB,CAAC,CAACG;AAAA,IACtB,iBAAiBF;AAAA,IACjB,aAAaG;AAAA,IACb,gBAAgBN;AAAA,IAChB,gBAAgBS;AAAA,IAChB,WAAWE,EAAO;AAAA,IAClB,OAAAH;AAAA,EAAA,GAGEI,IAAe;AAAA,IACjB,cAAcb,KAAaS;AAAA,IAC3B,UAAAN;AAAA,IACA,WAAAG;AAAA,IACA,QAAAE;AAAA,EAAA;AAGJ,SAAIH,IAEI,gBAAAS,EAAC,UAAA,EAAO,MAAK,UAAS,UAAAX,GAAqB,GAAGQ,GAAa,SAAAN,GACvD,UAAA,gBAAAS,EAACC,GAAA,EAAc,GAAGF,GAAe,UAAAX,GAAS,GAC9C,IAKJ,gBAAAY,EAAC,SAAK,GAAGH,GACL,4BAACI,GAAA,EAAc,GAAGF,GAAe,UAAAX,EAAA,CAAS,EAAA,CAC9C;AAER,GAEMa,IAAe,CAAC,EAAE,cAAcf,GAAW,UAAAE,GAAU,UAAAC,IAAW,IAAO,WAAAG,GAAW,QAAAE,QAAyB;AAC7G,QAAM,EAAE,GAAAQ,EAAA,IAAMC,EAAA;AAEd,SACI,gBAAAC,EAAAC,GAAA,EACK,UAAA;AAAA,IAAAX,KAAU,gBAAAM,EAACM,KAAY,QAAAZ,EAAA,CAAgB;AAAA,IACvCN;AAAA,IACAI,KACG,gBAAAQ;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,MAAK;AAAA,QACL,cAAYE,EAAE,iBAAiB,EAAE,OAAOhB,KAAa,IAAI;AAAA,QACzD,WAAWY,EAAO;AAAA,QAClB,UAAAT;AAAA,QACA,SAASG;AAAA,QAET,UAAA,gBAAAQ,EAACO,GAAA,EAAU,MAAK,KAAA,CAAK;AAAA,MAAA;AAAA,IAAA;AAAA,EACzB,GAER;AAER;"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import s from "./fondue-components93.js";
3
- import { colorToCss as e } from "./fondue-components94.js";
2
+ import s from "./fondue-components92.js";
3
+ import { colorToCss as e } from "./fondue-components93.js";
4
4
  const a = ["default", "positive", "highlight", "warning", "negative"], i = (t) => typeof t == "string" && a.includes(t), p = ({ status: t }) => {
5
5
  const o = i(t) ? { "data-status": t } : { style: { backgroundColor: typeof t == "string" ? t : e(t) || "transparent" } };
6
6
  return /* @__PURE__ */ r("div", { "data-test-id": "badge-status", className: s.root, ...o });
@@ -3,7 +3,7 @@ import { IconDroplet as I, IconCross as k, IconCaretDown as v } from "@frontify/
3
3
  import { forwardRef as P } from "react";
4
4
  import { useTranslation as w } from "./fondue-components39.js";
5
5
  import { Button as y } from "./fondue-components6.js";
6
- import a from "./fondue-components92.js";
6
+ import a from "./fondue-components94.js";
7
7
  import { getColorWithName as z, colorToCss as x } from "./fondue-components50.js";
8
8
  const c = ({
9
9
  id: m,
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components48.js","sources":["../src/components/ColorPicker/ColorValueInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ForwardedRef, forwardRef, useEffect, useState } from 'react';\n\nimport { useTranslation } from '#/hooks/useTranslation';\n\nimport { Select } from '../Select/Select';\nimport { TextInput } from '../TextInput/TextInput';\n\nimport styles from './styles/customColorPicker.module.scss';\nimport { type RgbaColor } from './types';\nimport {\n DEFAULT_COLOR,\n DEFAULT_FORMAT,\n getLimitedColorChannelValue,\n hexColorToRgba,\n isValidHexColor,\n rgbColorToHex,\n} from './utils';\n\ntype ColorFormat = 'HEX' | 'RGBA';\n\ntype ColorValueInputProps = {\n /**\n * @ignore\n * The active color in the color picker, passed down from the root component\n */\n currentColor?: RgbaColor;\n /**\n * @ignore\n * Event handler called when the color changes, passed down from the root component\n */\n onColorChange?: (color: RgbaColor) => void;\n /**\n * @ignore\n * The format to use for the color input, passed down from the root component\n */\n currentFormat?: ColorFormat;\n /**\n * @ignore\n * The format to use for the color input, passed down from the root component\n */\n setCurrentFormat?: (format: ColorFormat) => void;\n /**\n * The test id of the color picker value input\n */\n 'data-test-id'?: string;\n};\n\nconst nooperation = () => {};\n\nexport const ColorValueInput = (\n {\n currentColor = DEFAULT_COLOR,\n onColorChange = nooperation,\n currentFormat = DEFAULT_FORMAT,\n setCurrentFormat = nooperation,\n 'data-test-id': dataTestId = 'color-picker-value-input',\n }: ColorValueInputProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const { t } = useTranslation();\n const [hexColorValue, setHexColorValue] = useState<string>(() => rgbColorToHex(currentColor));\n\n useEffect(() => {\n setHexColorValue(rgbColorToHex(currentColor));\n }, [currentColor]);\n\n return (\n <div className={styles.inputs} data-test-id={dataTestId} ref={forwardedRef}>\n <div className={styles.colorFormatInput}>\n <Select\n data-test-id=\"color-picker-select-format\"\n aria-label={t('ColorPicker_selectFormat')}\n onSelect={(selectedValue) => {\n setCurrentFormat(selectedValue as ColorFormat);\n }}\n value={currentFormat}\n >\n <Select.Item value=\"HEX\">HEX</Select.Item>\n <Select.Item value=\"RGBA\">RGBA</Select.Item>\n </Select>\n </div>\n {currentFormat === 'HEX' ? (\n <TextInput.Root\n data-test-id=\"color-picker-value-input-hex\"\n className={styles.valueInput}\n type=\"text\"\n value={hexColorValue}\n status={isValidHexColor(hexColorValue) ? 'neutral' : 'error'}\n onBlur={(event) => {\n if (isValidHexColor(event.target.value)) {\n onColorChange({ ...hexColorToRgba(event.target.value), alpha: currentColor.alpha });\n }\n }}\n onChange={(event) => {\n const inputValue = event.target.value.startsWith('#')\n ? event.target.value.slice(1)\n : event.target.value;\n\n setHexColorValue(inputValue);\n }}\n aria-label={t('ColorPicker_hexValue')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>#</span>\n </TextInput.Slot>\n </TextInput.Root>\n ) : (\n <div className={styles.colorChannelInputGroup}>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-red\"\n className={styles.valueInput}\n value={currentColor.red}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n red: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label={t('ColorPicker_redChannel')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>R</span>\n </TextInput.Slot>\n </TextInput.Root>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-green\"\n className={styles.valueInput}\n value={currentColor.green}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n green: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label={t('ColorPicker_greenChannel')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>G</span>\n </TextInput.Slot>\n </TextInput.Root>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-blue\"\n className={styles.valueInput}\n value={currentColor.blue}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n blue: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label={t('ColorPicker_blueChannel')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>B</span>\n </TextInput.Slot>\n </TextInput.Root>\n </div>\n )}\n <div className={styles.colorAlphaInput}>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-alpha\"\n className={styles.valueInput}\n /* .toString() is a workaround for https://github.com/facebook/react/issues/9402 */\n value={currentColor.alpha === undefined ? 100 : Math.trunc(currentColor.alpha * 100).toString()}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n alpha: getLimitedColorChannelValue(event.target.value, 0, 100) / 100,\n });\n }}\n aria-label={t('ColorPicker_opacity')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>A</span>\n </TextInput.Slot>\n <TextInput.Slot name=\"right\">\n <span className={styles.inputDecorator}>%</span>\n </TextInput.Slot>\n </TextInput.Root>\n </div>\n </div>\n );\n};\nColorValueInput.displayName = 'ColorPicker.Values';\n\nexport const ForwardedRefColorValueInput = forwardRef<HTMLDivElement, ColorValueInputProps>(ColorValueInput);\n"],"names":["nooperation","ColorValueInput","currentColor","DEFAULT_COLOR","onColorChange","currentFormat","DEFAULT_FORMAT","setCurrentFormat","dataTestId","forwardedRef","t","useTranslation","hexColorValue","setHexColorValue","useState","rgbColorToHex","useEffect","jsxs","styles","jsx","Select","selectedValue","TextInput","isValidHexColor","event","hexColorToRgba","inputValue","getLimitedColorChannelValue","ForwardedRefColorValueInput","forwardRef"],"mappings":";;;;;;;AAiDA,MAAMA,IAAc,MAAM;AAAC,GAEdC,IAAkB,CAC3B;AAAA,EACI,cAAAC,IAAeC;AAAA,EACf,eAAAC,IAAgBJ;AAAA,EAChB,eAAAK,IAAgBC;AAAA,EAChB,kBAAAC,IAAmBP;AAAA,EACnB,gBAAgBQ,IAAa;AACjC,GACAC,MACC;AACD,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA,GACR,CAACC,GAAeC,CAAgB,IAAIC,EAAiB,MAAMC,EAAcb,CAAY,CAAC;AAE5F,SAAAc,EAAU,MAAM;AACZ,IAAAH,EAAiBE,EAAcb,CAAY,CAAC;AAAA,EAChD,GAAG,CAACA,CAAY,CAAC,GAGb,gBAAAe,EAAC,SAAI,WAAWC,EAAO,QAAQ,gBAAcV,GAAY,KAAKC,GAC1D,UAAA;AAAA,IAAA,gBAAAU,EAAC,OAAA,EAAI,WAAWD,EAAO,kBACnB,UAAA,gBAAAD;AAAA,MAACG;AAAA,MAAA;AAAA,QACG,gBAAa;AAAA,QACb,cAAYV,EAAE,0BAA0B;AAAA,QACxC,UAAU,CAACW,MAAkB;AACzB,UAAAd,EAAiBc,CAA4B;AAAA,QACjD;AAAA,QACA,OAAOhB;AAAA,QAEP,UAAA;AAAA,UAAA,gBAAAc,EAACC,EAAO,MAAP,EAAY,OAAM,OAAM,UAAA,OAAG;AAAA,4BAC3BA,EAAO,MAAP,EAAY,OAAM,QAAO,UAAA,OAAA,CAAI;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAEtC;AAAA,IACCf,MAAkB,QACf,gBAAAc;AAAA,MAACG,EAAU;AAAA,MAAV;AAAA,QACG,gB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UAAU,CAACsB,MAAU;AACjB,UAAApB,EAAc;AAAA,YACV,GAAGF;AAAA,YACH,OAAOyB,EAA4BH,EAAM,OAAO,OAAO,GAAG,GAAG,IAAI;AAAA,UAAA,CACpE;AAAA,QACL;AAAA,QACA,cAAYd,EAAE,qBAAqB;AAAA,QAEnC,UAAA;AAAA,UAAA,gBAAAS,EAACG,EAAU,MAAV,EAAe,MAAK,QACjB,UAAA,gBAAAH,EAAC,QAAA,EAAK,WAAWD,EAAO,gBAAgB,UAAA,IAAA,CAAC,GAC7C;AAAA,UACA,gBAAAC,EAACG,EAAU,MAAV,EAAe,MAAK,SACjB,UAAA,gBAAAH,EAAC,QAAA,EAAK,WAAWD,EAAO,gBAAgB,UAAA,IAAA,CAAC,EAAA,CAC7C;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,EACJ,CACJ;AAAA,EAAA,GACJ;AAER;AACAjB,EAAgB,cAAc;AAEvB,MAAM2B,IAA8BC,EAAiD5B,CAAe;"}
1
+ {"version":3,"file":"fondue-components48.js","sources":["../src/components/ColorPicker/ColorValueInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ForwardedRef, forwardRef, useEffect, useState } from 'react';\n\nimport { useTranslation } from '#/hooks/useTranslation';\n\nimport { Select } from '../Select';\nimport { TextInput } from '../TextInput/TextInput';\n\nimport styles from './styles/customColorPicker.module.scss';\nimport { type RgbaColor } from './types';\nimport {\n DEFAULT_COLOR,\n DEFAULT_FORMAT,\n getLimitedColorChannelValue,\n hexColorToRgba,\n isValidHexColor,\n rgbColorToHex,\n} from './utils';\n\ntype ColorFormat = 'HEX' | 'RGBA';\n\ntype ColorValueInputProps = {\n /**\n * @ignore\n * The active color in the color picker, passed down from the root component\n */\n currentColor?: RgbaColor;\n /**\n * @ignore\n * Event handler called when the color changes, passed down from the root component\n */\n onColorChange?: (color: RgbaColor) => void;\n /**\n * @ignore\n * The format to use for the color input, passed down from the root component\n */\n currentFormat?: ColorFormat;\n /**\n * @ignore\n * The format to use for the color input, passed down from the root component\n */\n setCurrentFormat?: (format: ColorFormat) => void;\n /**\n * The test id of the color picker value input\n */\n 'data-test-id'?: string;\n};\n\nconst nooperation = () => {};\n\nexport const ColorValueInput = (\n {\n currentColor = DEFAULT_COLOR,\n onColorChange = nooperation,\n currentFormat = DEFAULT_FORMAT,\n setCurrentFormat = nooperation,\n 'data-test-id': dataTestId = 'color-picker-value-input',\n }: ColorValueInputProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const { t } = useTranslation();\n const [hexColorValue, setHexColorValue] = useState<string>(() => rgbColorToHex(currentColor));\n\n useEffect(() => {\n setHexColorValue(rgbColorToHex(currentColor));\n }, [currentColor]);\n\n return (\n <div className={styles.inputs} data-test-id={dataTestId} ref={forwardedRef}>\n <div className={styles.colorFormatInput}>\n <Select\n data-test-id=\"color-picker-select-format\"\n aria-label={t('ColorPicker_selectFormat')}\n onSelect={(selectedValue) => {\n setCurrentFormat(selectedValue as ColorFormat);\n }}\n value={currentFormat}\n >\n <Select.Item value=\"HEX\">HEX</Select.Item>\n <Select.Item value=\"RGBA\">RGBA</Select.Item>\n </Select>\n </div>\n {currentFormat === 'HEX' ? (\n <TextInput.Root\n data-test-id=\"color-picker-value-input-hex\"\n className={styles.valueInput}\n type=\"text\"\n value={hexColorValue}\n status={isValidHexColor(hexColorValue) ? 'neutral' : 'error'}\n onBlur={(event) => {\n if (isValidHexColor(event.target.value)) {\n onColorChange({ ...hexColorToRgba(event.target.value), alpha: currentColor.alpha });\n }\n }}\n onChange={(event) => {\n const inputValue = event.target.value.startsWith('#')\n ? event.target.value.slice(1)\n : event.target.value;\n\n setHexColorValue(inputValue);\n }}\n aria-label={t('ColorPicker_hexValue')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>#</span>\n </TextInput.Slot>\n </TextInput.Root>\n ) : (\n <div className={styles.colorChannelInputGroup}>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-red\"\n className={styles.valueInput}\n value={currentColor.red}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n red: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label={t('ColorPicker_redChannel')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>R</span>\n </TextInput.Slot>\n </TextInput.Root>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-green\"\n className={styles.valueInput}\n value={currentColor.green}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n green: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label={t('ColorPicker_greenChannel')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>G</span>\n </TextInput.Slot>\n </TextInput.Root>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-blue\"\n className={styles.valueInput}\n value={currentColor.blue}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n blue: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label={t('ColorPicker_blueChannel')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>B</span>\n </TextInput.Slot>\n </TextInput.Root>\n </div>\n )}\n <div className={styles.colorAlphaInput}>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-alpha\"\n className={styles.valueInput}\n /* .toString() is a workaround for https://github.com/facebook/react/issues/9402 */\n value={currentColor.alpha === undefined ? 100 : Math.trunc(currentColor.alpha * 100).toString()}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n alpha: getLimitedColorChannelValue(event.target.value, 0, 100) / 100,\n });\n }}\n aria-label={t('ColorPicker_opacity')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>A</span>\n </TextInput.Slot>\n <TextInput.Slot name=\"right\">\n <span className={styles.inputDecorator}>%</span>\n </TextInput.Slot>\n </TextInput.Root>\n </div>\n </div>\n );\n};\nColorValueInput.displayName = 'ColorPicker.Values';\n\nexport const ForwardedRefColorValueInput = forwardRef<HTMLDivElement, ColorValueInputProps>(ColorValueInput);\n"],"names":["nooperation","ColorValueInput","currentColor","DEFAULT_COLOR","onColorChange","currentFormat","DEFAULT_FORMAT","setCurrentFormat","dataTestId","forwardedRef","t","useTranslation","hexColorValue","setHexColorValue","useState","rgbColorToHex","useEffect","jsxs","styles","jsx","Select","selectedValue","TextInput","isValidHexColor","event","hexColorToRgba","inputValue","getLimitedColorChannelValue","ForwardedRefColorValueInput","forwardRef"],"mappings":";;;;;;;AAiDA,MAAMA,IAAc,MAAM;AAAC,GAEdC,IAAkB,CAC3B;AAAA,EACI,cAAAC,IAAeC;AAAA,EACf,eAAAC,IAAgBJ;AAAA,EAChB,eAAAK,IAAgBC;AAAA,EAChB,kBAAAC,IAAmBP;AAAA,EACnB,gBAAgBQ,IAAa;AACjC,GACAC,MACC;AACD,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA,GACR,CAACC,GAAeC,CAAgB,IAAIC,EAAiB,MAAMC,EAAcb,CAAY,CAAC;AAE5F,SAAAc,EAAU,MAAM;AACZ,IAAAH,EAAiBE,EAAcb,CAAY,CAAC;AAAA,EAChD,GAAG,CAACA,CAAY,CAAC,GAGb,gBAAAe,EAAC,SAAI,WAAWC,EAAO,QAAQ,gBAAcV,GAAY,KAAKC,GAC1D,UAAA;AAAA,IAAA,gBAAAU,EAAC,OAAA,EAAI,WAAWD,EAAO,kBACnB,UAAA,gBAAAD;AAAA,MAACG;AAAA,MAAA;AAAA,QACG,gBAAa;AAAA,QACb,cAAYV,EAAE,0BAA0B;AAAA,QACxC,UAAU,CAACW,MAAkB;AACzB,UAAAd,EAAiBc,CAA4B;AAAA,QACjD;AAAA,QACA,OAAOhB;AAAA,QAEP,UAAA;AAAA,UAAA,gBAAAc,EAACC,EAAO,MAAP,EAAY,OAAM,OAAM,UAAA,OAAG;AAAA,4BAC3BA,EAAO,MAAP,EAAY,OAAM,QAAO,UAAA,OAAA,CAAI;AAAA,QAAA;AAAA,MAAA;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Aa,UAAU,SAAY,MAAM,KAAK,MAAMA,EAAa,QAAQ,GAAG,EAAE,SAAA;AAAA,QACrF,MAAK;AAAA,QACL,UAAU,CAACsB,MAAU;AACjB,UAAApB,EAAc;AAAA,YACV,GAAGF;AAAA,YACH,OAAOyB,EAA4BH,EAAM,OAAO,OAAO,GAAG,GAAG,IAAI;AAAA,UAAA,CACpE;AAAA,QACL;AAAA,QACA,cAAYd,EAAE,qBAAqB;AAAA,QAEnC,UAAA;AAAA,UAAA,gBAAAS,EAACG,EAAU,MAAV,EAAe,MAAK,QACjB,UAAA,gBAAAH,EAAC,QAAA,EAAK,WAAWD,EAAO,gBAAgB,UAAA,IAAA,CAAC,GAC7C;AAAA,UACA,gBAAAC,EAACG,EAAU,MAAV,EAAe,MAAK,SACjB,UAAA,gBAAAH,EAAC,QAAA,EAAK,WAAWD,EAAO,gBAAgB,UAAA,IAAA,CAAC,EAAA,CAC7C;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,EACJ,CACJ;AAAA,EAAA,GACJ;AAER;AACAjB,EAAgB,cAAc;AAEvB,MAAM2B,IAA8BC,EAAiD5B,CAAe;"}
@@ -1,157 +1,23 @@
1
- import { jsxs as g, jsx as t } from "react/jsx-runtime";
2
- import { IconCaretDown as U, IconCheckMark as W, IconExclamationMarkTriangle as X } from "@frontify/fondue-icons";
3
- import * as B from "@radix-ui/react-popover";
4
- import { Slot as Y } from "@radix-ui/react-slot";
5
- import { useCombobox as Z } from "downshift";
6
- import { forwardRef as A, useState as ee, useRef as te, useMemo as oe } from "react";
7
- import { LoadingCircle as re } from "./fondue-components19.js";
8
- import { ForwardedRefSelectSlot as ae } from "./fondue-components74.js";
9
- import { useTranslation as le } from "./fondue-components39.js";
10
- import { SelectMenu as ne } from "./fondue-components73.js";
11
- import o from "./fondue-components75.js";
12
- import { useSelectData as ie } from "./fondue-components76.js";
13
- const L = ({
14
- children: M,
15
- onSelect: i,
16
- value: O,
17
- defaultValue: v,
18
- placeholder: F = "",
19
- status: s = "neutral",
20
- disabled: f,
21
- "data-test-id": r = "fondue-select-combobox",
22
- alignMenu: P = "start",
23
- side: k = "bottom",
24
- id: y,
25
- viewportCollisionPadding: z = "compact",
26
- getAsyncItems: c,
27
- onEscapeKeyDown: D,
28
- ...a
29
- }, H) => {
30
- const { t: V } = le(), { inputSlots: $, menuSlots: T, items: u, filterText: j, clearButton: h, getItemByValue: p, setFilterText: b, asyncItemStatus: C } = ie(M, c), [E, x] = ee(!1), {
31
- getInputProps: d,
32
- getToggleButtonProps: _,
33
- getMenuProps: q,
34
- getItemProps: G,
35
- reset: w,
36
- selectedItem: l,
37
- isOpen: S,
38
- highlightedIndex: J,
39
- inputValue: m
40
- } = Z({
41
- items: u,
42
- selectedItem: p(O),
43
- defaultSelectedItem: p(v),
44
- defaultHighlightedIndex: 0,
45
- toggleButtonId: y,
46
- labelId: "aria-labelledby" in a ? a["aria-labelledby"] : void 0,
47
- onSelectedItemChange: ({ selectedItem: e }) => {
48
- i == null || i((e == null ? void 0 : e.value) ?? null);
49
- },
50
- onInputValueChange: ({ inputValue: e }) => {
51
- b(e);
52
- },
53
- onIsOpenChange: () => {
54
- x(!1), b("");
55
- },
56
- onHighlightedIndexChange: () => {
57
- x(!0);
58
- },
59
- itemToString: (e) => e ? e.label : ""
60
- }), n = te(!1), K = oe(
61
- () => !c && !u.find((e) => e.label.toLowerCase().includes(m.toLowerCase())),
62
- [m, u, c]
63
- ), Q = (e) => {
64
- var N, R;
65
- e.target.dataset.showFocusRing = "false", n.current = !1, (l == null ? void 0 : l.label.toLocaleLowerCase()) !== m.toLocaleLowerCase() && w(), d().onBlur && ((R = (N = d()).onBlur) == null || R.call(N, e));
66
- }, I = K || !!C.error || s === "error";
67
- return /* @__PURE__ */ g(B.Root, { open: S, children: [
68
- /* @__PURE__ */ t(B.Anchor, { asChild: !0, children: /* @__PURE__ */ g("div", { ref: H, className: o.root, "data-status": I ? "error" : s, children: [
69
- /* @__PURE__ */ t(
70
- "input",
71
- {
72
- ...d({
73
- "aria-label": "aria-label" in a ? a["aria-label"] : void 0
74
- }),
75
- "data-test-id": r,
76
- placeholder: F,
77
- className: o.input,
78
- disabled: f,
79
- onMouseDown: (e) => {
80
- n.current = !0, e.currentTarget.dataset.showFocusRing = "false";
81
- },
82
- onFocus: (e) => {
83
- n.current || (e.target.dataset.showFocusRing = "true");
84
- },
85
- onBlur: Q
86
- }
87
- ),
88
- $,
89
- h ? /* @__PURE__ */ t(
90
- Y,
91
- {
92
- onClick: (e) => {
93
- e.stopPropagation(), w();
94
- },
95
- className: o.clear,
96
- role: "button",
97
- children: h
98
- }
99
- ) : null,
100
- C.isLoading && S ? /* @__PURE__ */ t(ae, { name: "right", "data-test-id": `${r}-right-slot`, children: /* @__PURE__ */ t(re, { size: "x-small", "data-test-id": `${r}-loading-circle` }) }) : null,
101
- /* @__PURE__ */ g("div", { className: o.icons, children: [
102
- /* @__PURE__ */ t(
103
- "button",
104
- {
105
- "aria-label": V("Select_toggleMenu"),
106
- ..._(),
107
- type: "button",
108
- disabled: f,
109
- onMouseDown: () => {
110
- n.current = !0;
111
- },
112
- children: /* @__PURE__ */ t(U, { size: 16, className: o.caret })
113
- }
114
- ),
115
- s === "success" ? /* @__PURE__ */ t(
116
- W,
117
- {
118
- size: 16,
119
- className: o.iconSuccess,
120
- "data-test-id": `${r}-success-icon`
121
- }
122
- ) : null,
123
- I ? /* @__PURE__ */ t(
124
- X,
125
- {
126
- size: 16,
127
- className: o.iconError,
128
- "data-test-id": `${r}-error-icon`
129
- }
130
- ) : null
131
- ] })
132
- ] }) }),
133
- /* @__PURE__ */ t(
134
- ne,
135
- {
136
- align: P,
137
- side: k,
138
- highlightedIndex: J,
139
- filterText: j,
140
- getMenuProps: q,
141
- getItemProps: G,
142
- selectedItem: l,
143
- hasInteractedSinceOpening: E,
144
- viewportCollisionPadding: z,
145
- onEscapeKeyDown: D,
146
- children: T
147
- }
148
- )
149
- ] });
150
- };
151
- L.displayName = "Select.Combobox";
152
- const we = A(L);
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { forwardRef as u } from "react";
3
+ import { ComboboxBase as c } from "./fondue-components95.js";
4
+ import { useMultiselect as b } from "./fondue-components96.js";
5
+ const a = ({ value: e, onSelect: o, defaultValue: t, ...l }, m) => {
6
+ const { selectedItemValues: r, toggleSelectedItem: p, clear: i } = b(o, e, t);
7
+ return /* @__PURE__ */ s(
8
+ c,
9
+ {
10
+ ref: m,
11
+ multiple: !0,
12
+ selectedItemValues: r,
13
+ onItemSelect: p,
14
+ onClear: i,
15
+ ...l
16
+ }
17
+ );
18
+ }, n = u(a);
19
+ n.displayName = "Select.Combobox.Multiple";
153
20
  export {
154
- we as ForwardedRefCombobox,
155
- L as SelectCombobox
21
+ n as ComboboxMultiple
156
22
  };
157
23
  //# sourceMappingURL=fondue-components71.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components71.js","sources":["../src/components/Select/Combobox.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 { useCombobox } from 'downshift';\nimport { forwardRef, useMemo, useRef, useState, type FocusEvent, type ForwardedRef, type ReactNode } from 'react';\n\nimport { LoadingCircle } from '#/components/LoadingCircle/LoadingCircle.tsx';\nimport { ForwardedRefSelectSlot } from '#/components/Select/SelectSlot.tsx';\nimport { type CommonAriaProps } from '#/helpers/aria';\nimport { useTranslation } from '#/hooks/useTranslation';\n\nimport { SelectMenu, type SelectMenuViewportCollisionPadding } from './SelectMenu';\nimport styles from './styles/select.module.scss';\nimport { useSelectData, type AsyncItemsFetcher } from './useSelectData';\n\nexport type ComboboxProps = {\n /**\n * Children of the Combobox 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 combobox component. This is used to control the combobox externally.\n */\n value?: string | null;\n /**\n * The default value of the combobox component. Used for uncontrolled usages.\n */\n defaultValue?: string;\n /**\n * The placeholder in the combobox 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 combobox component.\n */\n disabled?: boolean;\n /**\n * The alignment of the menu.\n * @default \"start\"\n */\n alignMenu?: 'start' | 'center' | 'end' /**\n * Defines the preferred side of the combobox. It will not be respected if there are collisions with the viewport.\n * @default \"bottom\"\n */;\n side?: 'left' | 'right' | 'bottom' | 'top';\n /**\n * Id of the combobox component\n */\n id?: string;\n /**\n * The data test id of the combobox component.\n */\n 'data-test-id'?: string;\n /**\n * Define the minimum distance between the select menu and the viewport edge\n * @default 'compact'\n */\n viewportCollisionPadding?: SelectMenuViewportCollisionPadding;\n /**\n * Function to fetch items asynchronously.\n */\n getAsyncItems?: AsyncItemsFetcher;\n /**\n * Event handler called when the escape key is pressed.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void;\n} & CommonAriaProps;\n\nexport const SelectCombobox = (\n {\n children,\n onSelect,\n value,\n defaultValue,\n placeholder = '',\n status = 'neutral',\n disabled,\n 'data-test-id': dataTestId = 'fondue-select-combobox',\n alignMenu = 'start',\n side = 'bottom',\n id,\n viewportCollisionPadding = 'compact',\n getAsyncItems,\n onEscapeKeyDown,\n ...props\n }: ComboboxProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const { t } = useTranslation();\n const { inputSlots, menuSlots, items, filterText, clearButton, getItemByValue, setFilterText, asyncItemStatus } =\n useSelectData(children, getAsyncItems);\n\n const [hasInteractedSinceOpening, setHasInteractedSinceOpening] = useState(false);\n\n const {\n getInputProps,\n getToggleButtonProps,\n getMenuProps,\n getItemProps,\n reset,\n selectedItem,\n isOpen,\n highlightedIndex,\n inputValue,\n } = useCombobox({\n items,\n selectedItem: getItemByValue(value),\n defaultSelectedItem: getItemByValue(defaultValue),\n defaultHighlightedIndex: 0,\n toggleButtonId: id,\n labelId: 'aria-labelledby' in props ? props['aria-labelledby'] : undefined,\n onSelectedItemChange: ({ selectedItem }) => {\n onSelect?.(selectedItem?.value ?? null);\n },\n onInputValueChange: ({ inputValue }) => {\n setFilterText(inputValue);\n },\n onIsOpenChange: () => {\n setHasInteractedSinceOpening(false);\n setFilterText('');\n },\n onHighlightedIndexChange: () => {\n setHasInteractedSinceOpening(true);\n },\n itemToString: (item) => (item ? item.label : ''),\n });\n\n const wasClicked = useRef(false);\n\n const valueInvalid = useMemo(\n () => !getAsyncItems && !items.find((item) => item.label.toLowerCase().includes(inputValue.toLowerCase())),\n [inputValue, items, getAsyncItems],\n );\n\n const onBlurHandler = (blurEvent: FocusEvent<HTMLInputElement, Element>) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasClicked.current = false;\n\n const selectedItemNullOrOutdated = selectedItem?.label.toLocaleLowerCase() !== inputValue.toLocaleLowerCase();\n\n if (selectedItemNullOrOutdated) {\n // if there is no selection or\n // the existing selected value is not the same as the input value (old),\n // reset the input\n reset();\n }\n\n if (getInputProps().onBlur) {\n getInputProps().onBlur?.(blurEvent);\n }\n };\n const hasError = valueInvalid || !!asyncItemStatus.error || status === 'error';\n\n return (\n <RadixPopover.Root open={isOpen}>\n <RadixPopover.Anchor asChild>\n <div ref={forwardedRef} className={styles.root} data-status={hasError ? 'error' : status}>\n <input\n {...getInputProps({\n 'aria-label': 'aria-label' in props ? props['aria-label'] : undefined,\n })}\n data-test-id={dataTestId}\n placeholder={placeholder}\n className={styles.input}\n disabled={disabled}\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={onBlurHandler}\n />\n {inputSlots}\n {clearButton ? (\n <RadixSlot\n onClick={(event) => {\n event.stopPropagation();\n reset();\n }}\n className={styles.clear}\n role=\"button\"\n >\n {clearButton}\n </RadixSlot>\n ) : null}\n {asyncItemStatus.isLoading && isOpen ? (\n <ForwardedRefSelectSlot name=\"right\" data-test-id={`${dataTestId}-right-slot`}>\n <LoadingCircle size=\"x-small\" data-test-id={`${dataTestId}-loading-circle`} />\n </ForwardedRefSelectSlot>\n ) : null}\n <div className={styles.icons}>\n <button\n aria-label={t('Select_toggleMenu')}\n {...getToggleButtonProps()}\n type=\"button\"\n disabled={disabled}\n onMouseDown={() => {\n wasClicked.current = true;\n }}\n >\n <IconCaretDown size={16} className={styles.caret} />\n </button>\n {status === 'success' ? (\n <IconCheckMark\n size={16}\n className={styles.iconSuccess}\n data-test-id={`${dataTestId}-success-icon`}\n />\n ) : null}\n {hasError ? (\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 filterText={filterText}\n getMenuProps={getMenuProps}\n getItemProps={getItemProps}\n selectedItem={selectedItem}\n hasInteractedSinceOpening={hasInteractedSinceOpening}\n viewportCollisionPadding={viewportCollisionPadding}\n onEscapeKeyDown={onEscapeKeyDown}\n >\n {menuSlots}\n </SelectMenu>\n </RadixPopover.Root>\n );\n};\nSelectCombobox.displayName = 'Select.Combobox';\n\nexport const ForwardedRefCombobox = forwardRef<HTMLDivElement, ComboboxProps>(SelectCombobox);\n"],"names":["SelectCombobox","children","onSelect","value","defaultValue","placeholder","status","disabled","dataTestId","alignMenu","side","id","viewportCollisionPadding","getAsyncItems","onEscapeKeyDown","props","forwardedRef","t","useTranslation","inputSlots","menuSlots","items","filterText","clearButton","getItemByValue","setFilterText","asyncItemStatus","useSelectData","hasInteractedSinceOpening","setHasInteractedSinceOpening","useState","getInputProps","getToggleButtonProps","getMenuProps","getItemProps","reset","selectedItem","isOpen","highlightedIndex","inputValue","useCombobox","item","wasClicked","useRef","valueInvalid","useMemo","onBlurHandler","blurEvent","_b","_a","hasError","jsxs","RadixPopover","jsx","styles","mouseEvent","focusEvent","RadixSlot","event","ForwardedRefSelectSlot","LoadingCircle","IconCaretDown","IconCheckMark","IconExclamationMarkTriangle","SelectMenu","ForwardedRefCombobox","forwardRef"],"mappings":";;;;;;;;;;;;AA+EO,MAAMA,IAAiB,CAC1B;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,gBAAgBC,IAAa;AAAA,EAC7B,WAAAC,IAAY;AAAA,EACZ,MAAAC,IAAO;AAAA,EACP,IAAAC;AAAA,EACA,0BAAAC,IAA2B;AAAA,EAC3B,eAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,GAAGC;AACP,GACAC,MACC;AACD,QAAM,EAAE,GAAAC,EAAA,IAAMC,GAAA,GACR,EAAE,YAAAC,GAAY,WAAAC,GAAW,OAAAC,GAAO,YAAAC,GAAY,aAAAC,GAAa,gBAAAC,GAAgB,eAAAC,GAAe,iBAAAC,EAAA,IAC1FC,GAAc1B,GAAUY,CAAa,GAEnC,CAACe,GAA2BC,CAA4B,IAAIC,GAAS,EAAK,GAE1E;AAAA,IACF,eAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,cAAAC;AAAA,IACA,OAAAC;AAAA,IACA,cAAAC;AAAA,IACA,QAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,YAAAC;AAAA,EAAA,IACAC,EAAY;AAAA,IACZ,OAAAnB;AAAA,IACA,cAAcG,EAAerB,CAAK;AAAA,IAClC,qBAAqBqB,EAAepB,CAAY;AAAA,IAChD,yBAAyB;AAAA,IACzB,gBAAgBO;AAAA,IAChB,SAAS,qBAAqBI,IAAQA,EAAM,iB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hD,MAAW,YACR,gBAAA+C;AAAA,UAACS;AAAA,UAAA;AAAA,YACG,MAAM;AAAA,YACN,WAAWR,EAAO;AAAA,YAClB,gBAAc,GAAG9C,CAAU;AAAA,UAAA;AAAA,QAAA,IAE/B;AAAA,QACH0C,IACG,gBAAAG;AAAA,UAACU;AAAA,UAAA;AAAA,YACG,MAAM;AAAA,YACN,WAAWT,EAAO;AAAA,YAClB,gBAAc,GAAG9C,CAAU;AAAA,UAAA;AAAA,QAAA,IAE/B;AAAA,MAAA,EAAA,CACR;AAAA,IAAA,EAAA,CACJ,EAAA,CACJ;AAAA,IAEA,gBAAA6C;AAAA,MAACW;AAAA,MAAA;AAAA,QACG,OAAOvD;AAAA,QACP,MAAAC;AAAA,QACA,kBAAA4B;AAAA,QACA,YAAAhB;AAAA,QACA,cAAAW;AAAA,QACA,cAAAC;AAAA,QACA,cAAAE;AAAA,QACA,2BAAAR;AAAA,QACA,0BAAAhB;AAAA,QACA,iBAAAE;AAAA,QAEC,UAAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EACL,GACJ;AAER;AACApB,EAAe,cAAc;AAEtB,MAAMiE,KAAuBC,EAA0ClE,CAAc;"}
1
+ {"version":3,"file":"fondue-components71.js","sources":["../src/components/Select/ComboboxMultiple.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { forwardRef, type ForwardedRef } from 'react';\n\nimport { ComboboxBase, type ComboboxSharedProps } from './components/ComboboxBase';\nimport { useMultiselect } from './hooks/useMultiselect';\n\nexport type ComboboxMultipleProps = ComboboxSharedProps & {\n /**\n * The active value in the combobox component. This is used to control the combobox externally\n */\n value?: string[] | null;\n /**\n * Callback function that is called when items are selected\n */\n onSelect?: (selectedValues: string[] | null) => void;\n /**\n * The default value of the combobox component. Used for uncontrolled usages\n */\n defaultValue?: string[];\n};\n\nconst ComboboxMultipleInput = (\n { value, onSelect, defaultValue, ...rest }: ComboboxMultipleProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { selectedItemValues, toggleSelectedItem, clear } = useMultiselect(onSelect, value, defaultValue);\n\n return (\n <ComboboxBase\n ref={ref}\n multiple\n selectedItemValues={selectedItemValues}\n onItemSelect={toggleSelectedItem}\n onClear={clear}\n {...rest}\n />\n );\n};\n\nexport const ComboboxMultiple = forwardRef<HTMLDivElement, ComboboxMultipleProps>(ComboboxMultipleInput);\nComboboxMultiple.displayName = 'Select.Combobox.Multiple';\n"],"names":["ComboboxMultipleInput","value","onSelect","defaultValue","rest","ref","selectedItemValues","toggleSelectedItem","clear","useMultiselect","jsx","ComboboxBase","ComboboxMultiple","forwardRef"],"mappings":";;;;AAsBA,MAAMA,IAAwB,CAC1B,EAAE,OAAAC,GAAO,UAAAC,GAAU,cAAAC,GAAc,GAAGC,EAAA,GACpCC,MACC;AACD,QAAM,EAAE,oBAAAC,GAAoB,oBAAAC,GAAoB,OAAAC,EAAA,IAAUC,EAAeP,GAAUD,GAAOE,CAAY;AAEtG,SACI,gBAAAO;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,KAAAN;AAAA,MACA,UAAQ;AAAA,MACR,oBAAAC;AAAA,MACA,cAAcC;AAAA,MACd,SAASC;AAAA,MACR,GAAGJ;AAAA,IAAA;AAAA,EAAA;AAGhB,GAEaQ,IAAmBC,EAAkDb,CAAqB;AACvGY,EAAiB,cAAc;"}
@@ -1,22 +1,23 @@
1
- import { jsxs as d, jsx as r } from "react/jsx-runtime";
2
- import { IconCheckMark as n } from "@frontify/fondue-icons";
3
- import { forwardRef as l } from "react";
4
- import a from "./fondue-components75.js";
5
- const o = ({ "data-test-id": c = "fondue-select-item", ...e }, t) => /* @__PURE__ */ d("li", { "data-test-id": c, ref: t, ...e, children: [
6
- /* @__PURE__ */ r("div", { className: a.itemValue, children: e.children }),
7
- /* @__PURE__ */ r(n, { className: a.checkmarkIcon })
8
- ] });
9
- o.displayName = "Select.Item";
10
- const I = l(o), s = ({ children: c, groupId: e, heading: t, "data-test-id": i = "fondue-select-item-group" }, m) => /* @__PURE__ */ d("div", { "data-test-id": i, className: a.group, ref: m, children: [
11
- t ? /* @__PURE__ */ r("div", { className: a.groupHeading, children: /* @__PURE__ */ r("span", { children: t }) }) : null,
12
- c
13
- ] }, e);
14
- s.displayName = "Select.Group";
15
- const N = l(s);
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { forwardRef as i } from "react";
3
+ import { ComboboxBase as a } from "./fondue-components95.js";
4
+ import { useSingleSelect as b } from "./fondue-components97.js";
5
+ const p = ({ value: e, onSelect: o, defaultValue: t, ...m }, l) => {
6
+ const { selectedItemValues: r, selectItem: s, clear: n } = b(o, e, t);
7
+ return /* @__PURE__ */ c(
8
+ a,
9
+ {
10
+ ref: l,
11
+ multiple: !1,
12
+ selectedItemValues: r,
13
+ onItemSelect: s,
14
+ onClear: n,
15
+ ...m
16
+ }
17
+ );
18
+ }, f = i(p);
19
+ f.displayName = "Select.Combobox";
16
20
  export {
17
- I as ForwardedRefSelectItem,
18
- N as ForwardedRefSelectItemGroup,
19
- o as SelectItem,
20
- s as SelectItemGroup
21
+ f as ComboboxSingle
21
22
  };
22
23
  //# sourceMappingURL=fondue-components72.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components72.js","sources":["../src/components/Select/SelectItem.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCheckMark } from '@frontify/fondue-icons';\nimport { forwardRef, type ForwardedRef, type ReactNode } from 'react';\n\nimport styles from './styles/select.module.scss';\n\nexport type SelectItemProps = {\n /**\n * The value of the select item.\n */\n value: string;\n /**\n * The data test id of the select item.\n */\n 'data-test-id'?: string;\n} & (\n | {\n /**\n * The label of the select item. Required when the child is not a string.\n */\n label: string;\n /**\n * The children of the select item. This can be a custom component or a string.\n */\n children?: ReactNode;\n }\n | {\n label?: string;\n children: string;\n }\n);\n\nexport const SelectItem = (\n { 'data-test-id': dataTestId = 'fondue-select-item', ...props }: SelectItemProps,\n forwardedRef?: ForwardedRef<HTMLLIElement>,\n) => {\n return (\n <li data-test-id={dataTestId} ref={forwardedRef} {...props}>\n <div className={styles.itemValue}>{props.children}</div>\n <IconCheckMark className={styles.checkmarkIcon} />\n </li>\n );\n};\nSelectItem.displayName = 'Select.Item';\n\nexport const ForwardedRefSelectItem = forwardRef<HTMLLIElement, SelectItemProps>(SelectItem);\n\nexport type SelectItemGroupProps = {\n /**\n * The children of the select item group. This can contain multiple `Select.Item` components.\n */\n children: ReactNode;\n /**\n * The internal group ID of the select item group.\n */\n groupId: string;\n /**\n * The groups heading\n */\n heading?: string;\n /**\n * The data test id of the select item group.\n */\n 'data-test-id'?: string;\n};\n\nexport const SelectItemGroup = (\n { children, groupId, heading, 'data-test-id': dataTestId = 'fondue-select-item-group' }: SelectItemGroupProps,\n forwardedRef?: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-test-id={dataTestId} className={styles.group} ref={forwardedRef} key={groupId}>\n {heading ? (\n <div className={styles.groupHeading}>\n <span>{heading}</span>\n </div>\n ) : null}\n {children}\n </div>\n );\n};\nSelectItemGroup.displayName = 'Select.Group';\n\nexport const ForwardedRefSelectItemGroup = forwardRef<HTMLDivElement, SelectItemGroupProps>(SelectItemGroup);\n"],"names":["SelectItem","dataTestId","props","forwardedRef","jsx","styles","IconCheckMark","ForwardedRefSelectItem","forwardRef","SelectItemGroup","children","groupId","heading","jsxs","ForwardedRefSelectItemGroup"],"mappings":";;;;AAiCO,MAAMA,IAAa,CACtB,EAAE,gBAAgBC,IAAa,sBAAsB,GAAGC,EAAA,GACxDC,wBAGK,MAAA,EAAG,gBAAcF,GAAY,KAAKE,GAAe,GAAGD,GACjD,UAAA;AAAA,EAAA,gBAAAE,EAAC,OAAA,EAAI,WAAWC,EAAO,WAAY,YAAM,UAAS;AAAA,EAClD,gBAAAD,EAACE,GAAA,EAAc,WAAWD,EAAO,cAAA,CAAe;AAAA,GACpD;AAGRL,EAAW,cAAc;AAElB,MAAMO,IAAyBC,EAA2CR,CAAU,GAqB9ES,IAAkB,CAC3B,EAAE,UAAAC,GAAU,SAAAC,GAAS,SAAAC,GAAS,gBAAgBX,IAAa,2BAAA,GAC3DE,MAGI,gBAAAU,EAAC,SAAI,gBAAcZ,GAAY,WAAWI,EAAO,OAAO,KAAKF,GACxD,UAAA;AAAA,EAAAS,IACG,gBAAAR,EAAC,SAAI,WAAWC,EAAO,cACnB,UAAA,gBAAAD,EAAC,QAAA,EAAM,UAAAQ,EAAA,CAAQ,EAAA,CACnB,IACA;AAAA,EACHF;AAAA,EAAA,GAN2EC,CAOhF;AAGRF,EAAgB,cAAc;AAEvB,MAAMK,IAA8BN,EAAiDC,CAAe;"}
1
+ {"version":3,"file":"fondue-components72.js","sources":["../src/components/Select/ComboboxSingle.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { forwardRef, type ForwardedRef } from 'react';\n\nimport { ComboboxBase, type ComboboxSharedProps } from './components/ComboboxBase';\nimport { useSingleSelect } from './hooks/useSingleSelect';\n\nexport type ComboboxSingleProps = ComboboxSharedProps & {\n /**\n * The active value in the combobox component. This is used to control the combobox externally\n */\n value?: string | null;\n /**\n * Callback function that is called when an item is selected\n */\n onSelect?: (selectedValue: string | null) => void;\n /**\n * The default value of the combobox component. Used for uncontrolled usages\n */\n defaultValue?: string;\n};\n\nconst ComboboxSingleInput = (\n { value, onSelect, defaultValue, ...rest }: ComboboxSingleProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { selectedItemValues, selectItem, clear } = useSingleSelect(onSelect, value, defaultValue);\n\n return (\n <ComboboxBase\n ref={ref}\n multiple={false}\n selectedItemValues={selectedItemValues}\n onItemSelect={selectItem}\n onClear={clear}\n {...rest}\n />\n );\n};\n\nexport const ComboboxSingle = forwardRef<HTMLDivElement, ComboboxSingleProps>(ComboboxSingleInput);\nComboboxSingle.displayName = 'Select.Combobox';\n"],"names":["ComboboxSingleInput","value","onSelect","defaultValue","rest","ref","selectedItemValues","selectItem","clear","useSingleSelect","jsx","ComboboxBase","ComboboxSingle","forwardRef"],"mappings":";;;;AAsBA,MAAMA,IAAsB,CACxB,EAAE,OAAAC,GAAO,UAAAC,GAAU,cAAAC,GAAc,GAAGC,EAAA,GACpCC,MACC;AACD,QAAM,EAAE,oBAAAC,GAAoB,YAAAC,GAAY,OAAAC,EAAA,IAAUC,EAAgBP,GAAUD,GAAOE,CAAY;AAE/F,SACI,gBAAAO;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,KAAAN;AAAA,MACA,UAAU;AAAA,MACV,oBAAAC;AAAA,MACA,cAAcC;AAAA,MACd,SAASC;AAAA,MACR,GAAGJ;AAAA,IAAA;AAAA,EAAA;AAGhB,GAEaQ,IAAiBC,EAAgDb,CAAmB;AACjGY,EAAe,cAAc;"}