@frontify/fondue-components 26.0.2 → 26.0.3

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.
@@ -1,154 +1,8 @@
1
- import { jsxs as d, jsx as n } from "react/jsx-runtime";
2
- import { IconCaretDown as V } from "@frontify/fondue-icons";
3
- import * as I from "@radix-ui/react-popover";
4
- import { useSelect as s } from "downshift";
5
- import { forwardRef as ee, useRef as te, useCallback as N, useState as ne, useMemo as oe } from "react";
6
- import { useBadgeItems as re } from "./fondue-components100.js";
7
- import { useFocusRing as ae } from "./fondue-components101.js";
8
- import { useSelectData as se } from "./fondue-components102.js";
9
- import { useSelectionDescription as ie } from "./fondue-components103.js";
10
- import r from "./fondue-components99.js";
11
- import { ClearButton as le } from "./fondue-components104.js";
12
- import { CollapsibleBadges as ce } from "./fondue-components105.js";
13
- import { SelectMenu as ue } from "./fondue-components106.js";
14
- import { StatusIcons as ge } from "./fondue-components107.js";
15
- const O = ({
16
- children: M,
17
- selectedItemValues: o,
18
- onItemSelect: p,
19
- onClear: P,
20
- placeholder: c = "",
21
- status: u = "neutral",
22
- disabled: f,
23
- alignMenu: R = "start",
24
- side: j = "bottom",
25
- id: k,
26
- showStringValue: y = !0,
27
- "data-test-id": b = "fondue-select",
28
- viewportCollisionPadding: E = "compact",
29
- onEscapeKeyDown: F,
30
- multiple: g,
31
- ...i
32
- }, a) => {
33
- const C = te(null), B = N(
34
- (e) => {
35
- C.current = e, typeof a == "function" ? a(e) : a && (a.current = e);
36
- },
37
- [a]
38
- ), { inputSlots: H, menuSlots: K, items: w, clearButton: S, getItemByValue: l } = se(M), { onMouseDown: z, onFocus: A, onBlur: q } = ae(), { selectionDescriptionId: D, selectionDescription: m } = ie(
39
- g,
40
- o,
41
- l
42
- ), G = re(o, l), [J, v] = ne(!1), x = N(
43
- (e) => {
44
- const t = l(e);
45
- if (t)
46
- return !y && (t != null && t.children) ? t.children : t == null ? void 0 : t.label;
47
- },
48
- [l, y]
49
- ), { getToggleButtonProps: L, getMenuProps: Q, getItemProps: U, reset: W, isOpen: X, highlightedIndex: Y } = s({
50
- items: w,
51
- selectedItem: null,
52
- toggleButtonId: k,
53
- labelId: "aria-labelledby" in i ? i["aria-labelledby"] : void 0,
54
- onIsOpenChange: () => {
55
- v(!1);
56
- },
57
- onHighlightedIndexChange: () => {
58
- v(!0);
59
- },
60
- onSelectedItemChange: ({ selectedItem: e }) => {
61
- p(e == null ? void 0 : e.value);
62
- },
63
- itemToString: (e) => e ? e.label : "",
64
- ...g ? {
65
- stateReducer: (e, t) => {
66
- const { changes: h, type: $ } = t;
67
- switch ($) {
68
- case s.stateChangeTypes.ToggleButtonKeyDownEnter:
69
- case s.stateChangeTypes.ToggleButtonKeyDownSpaceButton:
70
- case s.stateChangeTypes.ItemClick:
71
- return {
72
- ...h,
73
- isOpen: !0,
74
- highlightedIndex: e.highlightedIndex
75
- };
76
- case s.stateChangeTypes.ToggleButtonBlur:
77
- return {
78
- ...h,
79
- selectedItem: e.selectedItem
80
- };
81
- }
82
- return h;
83
- }
84
- } : {}
85
- }), T = u === "error", Z = () => {
86
- P(), W();
87
- }, _ = oe(
88
- () => x(o[0]) || c,
89
- [x, o, c]
90
- );
91
- return /* @__PURE__ */ d(I.Root, { open: X, children: [
92
- /* @__PURE__ */ n(I.Anchor, { asChild: !0, onMouseDown: z, onFocus: A, onBlur: q, children: /* @__PURE__ */ d(
93
- "div",
94
- {
95
- ref: B,
96
- className: r.root,
97
- "data-status": T ? "error" : u,
98
- "data-disabled": f,
99
- "data-empty": o.length === 0,
100
- "data-test-id": b,
101
- ...f ? {} : (
102
- // eslint-disable-next-line react-hooks/refs
103
- L({
104
- "aria-label": "aria-label" in i ? i["aria-label"] : void 0,
105
- "aria-describedby": m ? D : void 0,
106
- ref: B
107
- })
108
- ),
109
- children: [
110
- m ? /* @__PURE__ */ n("span", { id: D, className: r.srOnly, children: m }) : null,
111
- g ? /* @__PURE__ */ n("div", { className: r.selectedValue, children: /* @__PURE__ */ n(
112
- ce,
113
- {
114
- items: G,
115
- placeholder: c,
116
- onDismiss: (e) => {
117
- var t;
118
- p(e), (t = C.current) == null || t.focus();
119
- },
120
- selectedCount: o.length
121
- }
122
- ) }) : /* @__PURE__ */ n("span", { className: r.selectedValue, children: _ }),
123
- H,
124
- S ? /* @__PURE__ */ n(le, { onClear: Z, children: S }) : null,
125
- /* @__PURE__ */ d("div", { className: r.icons, children: [
126
- /* @__PURE__ */ n(V, { size: 16, className: r.caret }),
127
- /* @__PURE__ */ n(ge, { status: u, hasError: T, dataTestId: b })
128
- ] })
129
- ]
130
- }
131
- ) }),
132
- /* @__PURE__ */ n(
133
- ue,
134
- {
135
- align: R,
136
- side: j,
137
- highlightedIndex: Y,
138
- getMenuProps: Q,
139
- getItemProps: U,
140
- selectedItemValues: o,
141
- hasInteractedSinceOpening: J,
142
- viewportCollisionPadding: E,
143
- onEscapeKeyDown: F,
144
- children: K
145
- }
146
- )
147
- ] });
1
+ const o = "_root_1y4f3_2", t = {
2
+ root: o
148
3
  };
149
- O.displayName = "Select";
150
- const Te = ee(O);
151
4
  export {
152
- Te as SelectBase
5
+ t as default,
6
+ o as root
153
7
  };
154
8
  //# sourceMappingURL=fondue-components98.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components98.js","sources":["../src/components/Select/components/SelectBase.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown } from '@frontify/fondue-icons';\nimport * as RadixPopover from '@radix-ui/react-popover';\nimport { useSelect } from 'downshift';\nimport { forwardRef, useCallback, useMemo, useRef, useState, type ForwardedRef, type ReactNode } from 'react';\n\nimport { type CommonAriaProps } from '#/helpers/aria';\n\nimport { useBadgeItems } from '../hooks/useBadgeItems';\nimport { useFocusRing } from '../hooks/useFocusRing';\nimport { useSelectData } from '../hooks/useSelectData';\nimport { useSelectionDescription } from '../hooks/useSelectionDescription';\nimport styles from '../styles/select.module.scss';\n\nimport { ClearButton } from './ClearButton';\nimport { CollapsibleBadges } from './CollapsibleBadges';\nimport { SelectMenu, type SelectMenuViewportCollisionPadding } from './SelectMenu';\nimport { StatusIcons } from './StatusIcons';\n\nexport type SelectSharedProps = {\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 * 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\ntype SelectBaseProps = SelectSharedProps & {\n /**\n * The currently selected item values\n */\n selectedItemValues: string[];\n /**\n * Callback fired when an item is selected or deselected\n */\n onItemSelect: (value?: string) => void;\n /**\n * Callback fired when the selection is cleared\n */\n onClear: () => void;\n /**\n * Whether the select allows multiple selections\n */\n multiple: boolean;\n};\n\nconst SelectBaseInput = (\n {\n children,\n selectedItemValues,\n onItemSelect,\n onClear,\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 multiple,\n ...props\n }: SelectBaseProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n): ReactNode => {\n const internalRef = useRef<HTMLDivElement | null>(null);\n const triggerRef = useCallback(\n (node: HTMLDivElement | null): void => {\n internalRef.current = node;\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n },\n [forwardedRef],\n );\n const { inputSlots, menuSlots, items, clearButton, getItemByValue } = useSelectData(children);\n const { onMouseDown, onFocus, onBlur } = useFocusRing();\n const { selectionDescriptionId, selectionDescription } = useSelectionDescription(\n multiple,\n selectedItemValues,\n getItemByValue,\n );\n const badgeItems = useBadgeItems(selectedItemValues, getItemByValue);\n\n const [hasInteractedSinceOpening, setHasInteractedSinceOpening] = useState(false);\n\n const getDisplayedValue = useCallback(\n (itemValue?: string): ReactNode => {\n const selectedItem = getItemByValue(itemValue);\n if (selectedItem) {\n return !showStringValue && selectedItem?.children ? selectedItem.children : selectedItem?.label;\n }\n return undefined;\n },\n [getItemByValue, showStringValue],\n );\n\n const { getToggleButtonProps, getMenuProps, getItemProps, reset, isOpen, highlightedIndex } = useSelect<{\n value: string;\n label: string;\n children?: ReactNode;\n }>({\n items,\n selectedItem: null,\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 onItemSelect(selectedItem?.value);\n },\n itemToString: (item) => (item ? item.label : ''),\n ...(multiple\n ? {\n stateReducer: (state, actionAndChanges) => {\n const { changes, type } = actionAndChanges;\n switch (type) {\n case useSelect.stateChangeTypes.ToggleButtonKeyDownEnter:\n case useSelect.stateChangeTypes.ToggleButtonKeyDownSpaceButton:\n case useSelect.stateChangeTypes.ItemClick:\n return {\n ...changes,\n isOpen: true,\n highlightedIndex: state.highlightedIndex,\n };\n case useSelect.stateChangeTypes.ToggleButtonBlur:\n return {\n ...changes,\n selectedItem: state.selectedItem,\n };\n }\n return changes;\n },\n }\n : {}),\n });\n\n const hasError = status === 'error';\n\n const handleClear = (): void => {\n onClear();\n reset();\n };\n\n const singleSelectValue = useMemo(\n (): ReactNode => getDisplayedValue(selectedItemValues[0]) || placeholder,\n [getDisplayedValue, selectedItemValues, placeholder],\n );\n\n return (\n <RadixPopover.Root open={isOpen}>\n <RadixPopover.Anchor asChild onMouseDown={onMouseDown} onFocus={onFocus} onBlur={onBlur}>\n <div\n ref={triggerRef}\n className={styles.root}\n data-status={hasError ? 'error' : status}\n data-disabled={disabled}\n data-empty={selectedItemValues.length === 0}\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 'aria-describedby': selectionDescription ? selectionDescriptionId : undefined,\n ref: triggerRef,\n }))}\n >\n {selectionDescription ? (\n <span id={selectionDescriptionId} className={styles.srOnly}>\n {selectionDescription}\n </span>\n ) : null}\n {multiple ? (\n <div className={styles.selectedValue}>\n <CollapsibleBadges\n items={badgeItems}\n placeholder={placeholder}\n onDismiss={(value) => {\n onItemSelect(value);\n internalRef.current?.focus();\n }}\n selectedCount={selectedItemValues.length}\n />\n </div>\n ) : (\n <span className={styles.selectedValue}>{singleSelectValue}</span>\n )}\n {inputSlots}\n {clearButton ? <ClearButton onClear={handleClear}>{clearButton}</ClearButton> : null}\n <div className={styles.icons}>\n <IconCaretDown size={16} className={styles.caret} />\n <StatusIcons status={status} hasError={hasError} dataTestId={dataTestId} />\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 selectedItemValues={selectedItemValues}\n hasInteractedSinceOpening={hasInteractedSinceOpening}\n viewportCollisionPadding={viewportCollisionPadding}\n onEscapeKeyDown={onEscapeKeyDown}\n >\n {menuSlots}\n </SelectMenu>\n </RadixPopover.Root>\n );\n};\nSelectBaseInput.displayName = 'Select';\n\nexport const SelectBase = forwardRef<HTMLDivElement, SelectBaseProps>(SelectBaseInput);\n"],"names":["SelectBaseInput","children","selectedItemValues","onItemSelect","onClear","placeholder","status","disabled","alignMenu","side","id","showStringValue","dataTestId","viewportCollisionPadding","onEscapeKeyDown","multiple","props","forwardedRef","internalRef","useRef","triggerRef","useCallback","node","inputSlots","menuSlots","items","clearButton","getItemByValue","useSelectData","onMouseDown","onFocus","onBlur","useFocusRing","selectionDescriptionId","selectionDescription","useSelectionDescription","badgeItems","useBadgeItems","hasInteractedSinceOpening","setHasInteractedSinceOpening","useState","getDisplayedValue","itemValue","selectedItem","getToggleButtonProps","getMenuProps","getItemProps","reset","isOpen","highlightedIndex","useSelect","item","state","actionAndChanges","changes","type","hasError","handleClear","singleSelectValue","useMemo","jsxs","RadixPopover","jsx","styles","CollapsibleBadges","value","_a","ClearButton","IconCaretDown","StatusIcons","SelectMenu","SelectBase","forwardRef"],"mappings":";;;;;;;;;;;;;;AA4FA,MAAMA,IAAkB,CACpB;AAAA,EACI,UAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,SAAAC;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,UAAAC;AAAA,EACA,GAAGC;AACP,GACAC,MACY;AACZ,QAAMC,IAAcC,GAA8B,IAAI,GAChDC,IAAaC;AAAA,IACf,CAACC,MAAsC;AACnC,MAAAJ,EAAY,UAAUI,GAClB,OAAOL,KAAiB,aACxBA,EAAaK,CAAI,IACVL,MACPA,EAAa,UAAUK;AAAA,IAE/B;AAAA,IACA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1,48 +1,8 @@
1
- const c = "_root_13ciu_7", e = "_selectedValue_13ciu_63", _ = "_input_13ciu_80", o = "_slot_13ciu_106", t = "_clear_13ciu_156", n = "_clearIcon_13ciu_163", u = "_icons_13ciu_167", i = "_caret_13ciu_173", r = "_iconSuccess_13ciu_201", s = "_iconError_13ciu_207", a = "_menu_13ciu_213", l = "_portal_13ciu_236", p = "_item_13ciu_252", g = "_checkmarkIcon_13ciu_281", m = "_itemValue_13ciu_287", d = "_group_13ciu_301", I = "_groupHeading_13ciu_312", b = "_badgesContainer_13ciu_324", k = "_badgeWrapper_13ciu_336", S = "_srOnly_13ciu_345", V = "_multiSelectInput_13ciu_357", y = {
2
- root: c,
3
- selectedValue: e,
4
- input: _,
5
- slot: o,
6
- clear: t,
7
- clearIcon: n,
8
- icons: u,
9
- caret: i,
10
- iconSuccess: r,
11
- iconError: s,
12
- menu: a,
13
- portal: l,
14
- item: p,
15
- checkmarkIcon: g,
16
- itemValue: m,
17
- group: d,
18
- groupHeading: I,
19
- badgesContainer: b,
20
- badgeWrapper: k,
21
- srOnly: S,
22
- multiSelectInput: V
1
+ const r = (e) => {
2
+ if (e)
3
+ return `rgba(${e.red}, ${e.green}, ${e.blue}, ${e.alpha ?? 1})`;
23
4
  };
24
5
  export {
25
- k as badgeWrapper,
26
- b as badgesContainer,
27
- i as caret,
28
- g as checkmarkIcon,
29
- t as clear,
30
- n as clearIcon,
31
- y as default,
32
- d as group,
33
- I as groupHeading,
34
- s as iconError,
35
- r as iconSuccess,
36
- u as icons,
37
- _ as input,
38
- p as item,
39
- m as itemValue,
40
- a as menu,
41
- V as multiSelectInput,
42
- l as portal,
43
- c as root,
44
- e as selectedValue,
45
- o as slot,
46
- S as srOnly
6
+ r as colorToCss
47
7
  };
48
8
  //# sourceMappingURL=fondue-components99.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components99.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"fondue-components99.js","sources":["../src/components/Badge/utils.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type RgbaColor } from './types';\n\nexport const DEFAULT_COLOR = { red: 255, green: 255, blue: 255, alpha: 1, name: '' };\n\n/**\n * Converts a color object to a CSS color string.\n * @param {RgbaColor} color - The color object to be converted.\n * @returns {string}\n * @example\n * colorToCss({ red: 255, green: 255, blue: 255, alpha: 1 }); // 'rgba(255, 255, 255, 1)'\n * @example\n * colorToCss({ red: 255, green: 87, blue: 51, alpha: 1 }); // 'rgba(255, 87, 51, 1)'\n * @example\n * colorToCss({ red: 0, green: 0, blue: 0, alpha: 0 }); // 'rgba(0, 0, 0, 0)'\n */\nexport const colorToCss = (color?: RgbaColor) => {\n if (!color) {\n return undefined;\n }\n return `rgba(${color.red}, ${color.green}, ${color.blue}, ${color.alpha ?? 1})`;\n};\n"],"names":["colorToCss","color"],"mappings":"AAiBO,MAAMA,IAAa,CAACC,MAAsB;AAC7C,MAAKA;AAGL,WAAO,QAAQA,EAAM,GAAG,KAAKA,EAAM,KAAK,KAAKA,EAAM,IAAI,KAAKA,EAAM,SAAS,CAAC;AAChF;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@frontify/fondue-components",
3
3
  "type": "module",
4
- "version": "26.0.2",
4
+ "version": "26.0.3",
5
5
  "homepage": "https://github.com/Frontify/fondue",
6
6
  "repository": {
7
7
  "type": "git",
@@ -34,8 +34,8 @@
34
34
  "peerDependencies": {
35
35
  "react": "^18",
36
36
  "react-dom": "^18",
37
- "@frontify/fondue-tokens": "^5.0.0",
38
- "@frontify/fondue-icons": "^0.24.1"
37
+ "@frontify/fondue-icons": "^0.24.1",
38
+ "@frontify/fondue-tokens": "^5.0.0"
39
39
  },
40
40
  "dependencies": {
41
41
  "@radix-ui/react-accordion": "^1.2.12",
@@ -103,8 +103,8 @@
103
103
  "vite-plugin-dts": "^4.5.4",
104
104
  "vite-tsconfig-paths": "^5.1.4",
105
105
  "vitest": "^3.2.4",
106
- "@frontify/fondue-tokens": "^5.0.0",
107
- "@frontify/fondue-icons": "^0.24.1"
106
+ "@frontify/fondue-icons": "^0.24.1",
107
+ "@frontify/fondue-tokens": "^5.0.0"
108
108
  },
109
109
  "scripts": {
110
110
  "build": "vite build",