@frontify/fondue-components 22.1.0 → 22.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fondue-components11.js +40 -40
- package/dist/fondue-components11.js.map +1 -1
- package/dist/fondue-components34.js +2 -2
- package/dist/fondue-components39.js +1 -1
- package/dist/fondue-components42.js +1 -1
- package/dist/fondue-components44.js +1 -1
- package/dist/fondue-components56.js +12 -12
- package/dist/fondue-components75.js +20 -20
- package/dist/fondue-components85.js +2 -5
- package/dist/fondue-components85.js.map +1 -1
- package/dist/fondue-components86.js +16 -4
- package/dist/fondue-components86.js.map +1 -1
- package/dist/fondue-components87.js +5 -2
- package/dist/fondue-components87.js.map +1 -1
- package/dist/fondue-components88.js +4 -16
- package/dist/fondue-components88.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +27 -33
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as n, jsxs as g } from "react/jsx-runtime";
|
|
2
2
|
import { IconCaretRight as M } from "@frontify/fondue-icons";
|
|
3
3
|
import * as a from "@radix-ui/react-dropdown-menu";
|
|
4
|
-
import { forwardRef as
|
|
4
|
+
import { forwardRef as p, useMemo as A, Children as G, useRef as O } from "react";
|
|
5
5
|
import { useFondueTheme as D, ThemeProvider as b } from "./fondue-components31.js";
|
|
6
6
|
import { useProcessedChildren as h } from "./fondue-components53.js";
|
|
7
|
-
import
|
|
7
|
+
import i from "./fondue-components54.js";
|
|
8
8
|
const N = ({
|
|
9
9
|
children: o,
|
|
10
10
|
open: t,
|
|
@@ -20,7 +20,7 @@ const S = ({
|
|
|
20
20
|
...r
|
|
21
21
|
}, d) => /* @__PURE__ */ n(a.Trigger, { asChild: o, "data-test-id": e, ref: d, ...r, children: t });
|
|
22
22
|
S.displayName = "Dropdown.Trigger";
|
|
23
|
-
const
|
|
23
|
+
const v = {
|
|
24
24
|
compact: 8,
|
|
25
25
|
comfortable: 12,
|
|
26
26
|
spacious: 16
|
|
@@ -33,27 +33,27 @@ const O = {
|
|
|
33
33
|
triggerOffset: e = "compact",
|
|
34
34
|
children: r,
|
|
35
35
|
preventTriggerFocusOnClose: d,
|
|
36
|
-
viewportCollisionPadding:
|
|
36
|
+
viewportCollisionPadding: c = "compact",
|
|
37
37
|
forceMount: l = !1,
|
|
38
38
|
"data-test-id": m = "fondue-dropdown-content"
|
|
39
39
|
}, w) => {
|
|
40
|
-
const { theme: f, dir:
|
|
41
|
-
return /* @__PURE__ */ n(a.Portal, { forceMount: l || void 0, children: /* @__PURE__ */ n(b, { theme: f, dir:
|
|
40
|
+
const { theme: f, dir: u } = D();
|
|
41
|
+
return /* @__PURE__ */ n(a.Portal, { forceMount: l || void 0, children: /* @__PURE__ */ n(b, { theme: f, dir: u, children: /* @__PURE__ */ n(
|
|
42
42
|
a.Content,
|
|
43
43
|
{
|
|
44
|
-
dir:
|
|
44
|
+
dir: u,
|
|
45
45
|
align: t,
|
|
46
|
-
collisionPadding: x[
|
|
47
|
-
sideOffset:
|
|
46
|
+
collisionPadding: x[c],
|
|
47
|
+
sideOffset: v[e],
|
|
48
48
|
side: o,
|
|
49
|
-
className:
|
|
49
|
+
className: i.content,
|
|
50
50
|
"data-test-id": m,
|
|
51
51
|
ref: w,
|
|
52
|
-
onPointerDownOutside: (
|
|
53
|
-
|
|
52
|
+
onPointerDownOutside: (s) => {
|
|
53
|
+
l && s.currentTarget instanceof HTMLElement && s.currentTarget.getAttribute("data-state") === "open" && s.preventDefault();
|
|
54
54
|
},
|
|
55
|
-
onCloseAutoFocus: (
|
|
56
|
-
d &&
|
|
55
|
+
onCloseAutoFocus: (s) => {
|
|
56
|
+
d && s.preventDefault();
|
|
57
57
|
},
|
|
58
58
|
forceMount: l || void 0,
|
|
59
59
|
children: r
|
|
@@ -61,11 +61,11 @@ const O = {
|
|
|
61
61
|
) }) });
|
|
62
62
|
};
|
|
63
63
|
C.displayName = "Dropdown.Content";
|
|
64
|
-
const R = ({ children: o, heading: t, "data-test-id": e = "fondue-dropdown-group" }, r) =>
|
|
65
|
-
() => G.toArray(o).filter((
|
|
64
|
+
const R = ({ children: o, heading: t, "data-test-id": e = "fondue-dropdown-group" }, r) => A(
|
|
65
|
+
() => G.toArray(o).filter((c) => c !== null).length > 0,
|
|
66
66
|
[o]
|
|
67
|
-
) ? /* @__PURE__ */ g(a.Group, { className:
|
|
68
|
-
t ? /* @__PURE__ */ n("div", { className:
|
|
67
|
+
) ? /* @__PURE__ */ g(a.Group, { className: i.group, "data-test-id": e, ref: r, children: [
|
|
68
|
+
t ? /* @__PURE__ */ n("div", { className: i.groupHeading, children: /* @__PURE__ */ n("span", { "aria-label": t, children: t }) }) : null,
|
|
69
69
|
o
|
|
70
70
|
] }) : null;
|
|
71
71
|
R.displayName = "Dropdown.Group";
|
|
@@ -76,9 +76,9 @@ const T = ({
|
|
|
76
76
|
T.displayName = "Dropdown.SubMenu";
|
|
77
77
|
const I = ({ children: o, "data-test-id": t = "fondue-dropdown-subtrigger" }, e) => {
|
|
78
78
|
const { content: r } = h(o);
|
|
79
|
-
return /* @__PURE__ */ g(a.SubTrigger, { className:
|
|
79
|
+
return /* @__PURE__ */ g(a.SubTrigger, { className: i.subTrigger, "data-test-id": t, ref: e, children: [
|
|
80
80
|
r,
|
|
81
|
-
/* @__PURE__ */ n(M, { className:
|
|
81
|
+
/* @__PURE__ */ n(M, { className: i.subMenuIndicator, size: 16 })
|
|
82
82
|
] });
|
|
83
83
|
};
|
|
84
84
|
I.displayName = "Dropdown.SubTrigger";
|
|
@@ -88,7 +88,7 @@ const F = ({ children: o, "data-test-id": t = "fondue-dropdown-subcontent" }, e)
|
|
|
88
88
|
a.SubContent,
|
|
89
89
|
{
|
|
90
90
|
dir: d,
|
|
91
|
-
className:
|
|
91
|
+
className: i.subContent,
|
|
92
92
|
"data-test-id": t,
|
|
93
93
|
ref: e,
|
|
94
94
|
children: o
|
|
@@ -102,31 +102,31 @@ const y = ({
|
|
|
102
102
|
textValue: e,
|
|
103
103
|
onSelect: r,
|
|
104
104
|
emphasis: d = "default",
|
|
105
|
-
asChild:
|
|
105
|
+
asChild: c = !1,
|
|
106
106
|
"data-test-id": l = "fondue-dropdown-subtrigger",
|
|
107
107
|
...m
|
|
108
108
|
}, w) => {
|
|
109
|
-
const { content: f } = h(o),
|
|
109
|
+
const { content: f } = h(o), u = O(!1);
|
|
110
110
|
return /* @__PURE__ */ n(
|
|
111
111
|
a.Item,
|
|
112
112
|
{
|
|
113
113
|
onSelect: r,
|
|
114
|
-
className:
|
|
114
|
+
className: i.item,
|
|
115
115
|
textValue: e,
|
|
116
116
|
"data-test-id": l,
|
|
117
117
|
"data-emphasis": d,
|
|
118
118
|
ref: w,
|
|
119
119
|
disabled: t,
|
|
120
|
-
asChild:
|
|
121
|
-
"data-show-focus-ring":
|
|
120
|
+
asChild: c,
|
|
121
|
+
"data-show-focus-ring": u.current,
|
|
122
122
|
onMouseEnter: () => {
|
|
123
|
-
|
|
123
|
+
u.current = !0;
|
|
124
124
|
},
|
|
125
|
-
onFocus: (
|
|
126
|
-
|
|
125
|
+
onFocus: (s) => {
|
|
126
|
+
u.current || (s.target.dataset.showFocusRing = "true");
|
|
127
127
|
},
|
|
128
|
-
onBlur: (
|
|
129
|
-
|
|
128
|
+
onBlur: (s) => {
|
|
129
|
+
s.target.dataset.showFocusRing = "false", u.current = !1;
|
|
130
130
|
},
|
|
131
131
|
...m,
|
|
132
132
|
children: f
|
|
@@ -134,21 +134,21 @@ const y = ({
|
|
|
134
134
|
);
|
|
135
135
|
};
|
|
136
136
|
y.displayName = "Dropdown.Item";
|
|
137
|
-
const P = ({ children: o, name: t, "data-test-id": e = "fondue-dropdown-slot" }, r) => /* @__PURE__ */ n("div", { "data-name": t, className:
|
|
137
|
+
const P = ({ children: o, name: t, "data-test-id": e = "fondue-dropdown-slot" }, r) => /* @__PURE__ */ n("div", { "data-name": t, className: i.slot, "data-test-id": e, ref: r, children: o });
|
|
138
138
|
P.displayName = "Dropdown.Slot";
|
|
139
|
-
const _ =
|
|
139
|
+
const _ = p(S), E = p(C), L = p(R), j = p(I), H = p(F), z = p(y), B = p(P), U = {
|
|
140
140
|
Root: N,
|
|
141
141
|
Trigger: _,
|
|
142
|
-
Content:
|
|
143
|
-
Group:
|
|
142
|
+
Content: E,
|
|
143
|
+
Group: L,
|
|
144
144
|
SubMenu: T,
|
|
145
|
-
SubTrigger:
|
|
146
|
-
SubContent:
|
|
147
|
-
Item:
|
|
148
|
-
Slot:
|
|
145
|
+
SubTrigger: j,
|
|
146
|
+
SubContent: H,
|
|
147
|
+
Item: z,
|
|
148
|
+
Slot: B
|
|
149
149
|
};
|
|
150
150
|
export {
|
|
151
|
-
|
|
151
|
+
U as Dropdown,
|
|
152
152
|
C as DropdownContent,
|
|
153
153
|
R as DropdownGroup,
|
|
154
154
|
y as DropdownItem,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components11.js","sources":["../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretRight } from '@frontify/fondue-icons';\nimport * as RadixDropdown from '@radix-ui/react-dropdown-menu';\nimport { Children, forwardRef, useMemo, useRef, type ForwardedRef, type ReactNode } from 'react';\n\nimport { ThemeProvider, useFondueTheme } from '../ThemeProvider/ThemeProvider';\n\nimport { useProcessedChildren } from './hooks/useProcessedChildren';\nimport styles from './styles/dropdown.module.scss';\n\nexport type DropdownRootProps = {\n children?: ReactNode;\n /**\n * When set to true, interaction with outside elements will be disabled and only menu content will be visible to screen readers.\n * @default false\n */\n modal?: boolean;\n /**\n * Controls the open state of the dropdown.\n */\n open?: boolean;\n /**\n * Callback that is called when the open state of the dropdown changes.\n */\n onOpenChange?: (open: boolean) => void;\n\n 'data-test-id'?: string;\n};\n\nexport const DropdownRoot = ({\n children,\n open,\n modal = false,\n onOpenChange,\n 'data-test-id': dataTestId = 'fondue-dropdown',\n}: DropdownRootProps) => {\n return (\n <RadixDropdown.Root open={open} modal={modal} onOpenChange={onOpenChange} data-test-id={dataTestId}>\n {children}\n </RadixDropdown.Root>\n );\n};\nDropdownRoot.displayName = 'Dropdown.Root';\n\nexport type DropdownTriggerProps = {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n * @default true\n */\n asChild?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport const DropdownTrigger = (\n {\n asChild = true,\n children,\n 'data-test-id': dataTestId = 'fondue-dropdown-trigger',\n ...props\n }: DropdownTriggerProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n return (\n <RadixDropdown.Trigger asChild={asChild} data-test-id={dataTestId} ref={ref} {...props}>\n {children}\n </RadixDropdown.Trigger>\n );\n};\nDropdownTrigger.displayName = 'Dropdown.Trigger';\n\ntype DropdownSpacing = 'compact' | 'comfortable' | 'spacious';\ntype DropdownViewportCollisionPadding = 'compact' | 'spacious';\nexport type DropdownContentProps = {\n children?: ReactNode;\n 'data-test-id'?: string;\n /**\n * Defines the alignment of the dropdown.\n * @default \"start\"\n */\n align?: 'start' | 'center' | 'end';\n /**\n * Defines the preferred side of the dropdown. It will not be respected if there are collisions with the viewport.\n * @default \"bottom\"\n */\n side?: 'top' | 'right' | 'bottom' | 'left';\n /**\n * Defines the spacing between the dropdown and its trigger.\n * @default 'compact'\n */\n triggerOffset?: DropdownSpacing;\n /**\n * Prevents the focus from being set on the trigger when the dropdown is closed.\n */\n preventTriggerFocusOnClose?: boolean;\n /**\n * Define the minimum distance between the dropdown and the viewport edge\n * @default 'compact'\n */\n viewportCollisionPadding?: DropdownViewportCollisionPadding;\n /**\n * When true, the content will always be mounted in the DOM. Before enabling, make sure you really need it.\n * @default false\n */\n forceMount?: boolean;\n};\n\nconst SPACING_MAP: Record<DropdownSpacing, number> = {\n compact: 8,\n comfortable: 12,\n spacious: 16,\n};\n\nconst VIEWPORT_COLLISION_PADDING_MAP: Record<DropdownViewportCollisionPadding, number> = {\n compact: 8,\n spacious: 24,\n};\n\nexport const DropdownContent = (\n {\n side = 'bottom',\n align = 'start',\n triggerOffset = 'compact',\n children,\n preventTriggerFocusOnClose,\n viewportCollisionPadding = 'compact',\n forceMount = false,\n 'data-test-id': dataTestId = 'fondue-dropdown-content',\n }: DropdownContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { theme, dir } = useFondueTheme();\n\n return (\n <RadixDropdown.Portal forceMount={forceMount || undefined}>\n <ThemeProvider theme={theme} dir={dir}>\n <RadixDropdown.Content\n // @ts-expect-error - dir prop works at runtime but is not in the Radix UI type definition\n dir={dir}\n align={align}\n collisionPadding={VIEWPORT_COLLISION_PADDING_MAP[viewportCollisionPadding]}\n sideOffset={SPACING_MAP[triggerOffset]}\n side={side}\n className={styles.content}\n data-test-id={dataTestId}\n ref={ref}\n onPointerDownOutside={(event) => {\n event.preventDefault();\n }}\n onCloseAutoFocus={(event) => {\n if (preventTriggerFocusOnClose) {\n event.preventDefault();\n }\n }}\n forceMount={forceMount || undefined}\n >\n {children}\n </RadixDropdown.Content>\n </ThemeProvider>\n </RadixDropdown.Portal>\n );\n};\nDropdownContent.displayName = 'Dropdown.Content';\n\nexport type DropdownGroupProps = { children: ReactNode; heading?: string; 'data-test-id'?: string };\n\nexport const DropdownGroup = (\n { children, heading, 'data-test-id': dataTestId = 'fondue-dropdown-group' }: DropdownGroupProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const hasChildren = useMemo(\n () => Children.toArray(children).filter((child) => child !== null).length > 0,\n [children],\n );\n\n if (!hasChildren) {\n return null;\n }\n\n return (\n <RadixDropdown.Group className={styles.group} data-test-id={dataTestId} ref={ref}>\n {heading ? (\n <div className={styles.groupHeading}>\n <span aria-label={heading}>{heading}</span>\n </div>\n ) : null}\n {children}\n </RadixDropdown.Group>\n );\n};\nDropdownGroup.displayName = 'Dropdown.Group';\n\nexport type DropdownSubMenuProps = { children: ReactNode; 'data-test-id'?: string };\n\nexport const DropdownSubMenu = ({\n children,\n 'data-test-id': dataTestId = 'fondue-dropdown-submenu',\n}: DropdownSubMenuProps) => {\n return <RadixDropdown.Sub data-test-id={dataTestId}>{children}</RadixDropdown.Sub>;\n};\nDropdownSubMenu.displayName = 'Dropdown.SubMenu';\n\nexport type DropdownSubTriggerProps = { children: ReactNode; 'data-test-id'?: string };\n\nexport const DropdownSubTrigger = (\n { children, 'data-test-id': dataTestId = 'fondue-dropdown-subtrigger' }: DropdownSubTriggerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { content } = useProcessedChildren(children);\n return (\n <RadixDropdown.SubTrigger className={styles.subTrigger} data-test-id={dataTestId} ref={ref}>\n {content}\n <IconCaretRight className={styles.subMenuIndicator} size={16} />\n </RadixDropdown.SubTrigger>\n );\n};\nDropdownSubTrigger.displayName = 'Dropdown.SubTrigger';\n\nexport type DropdownSubContentProps = {\n children: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport const DropdownSubContent = (\n { children, 'data-test-id': dataTestId = 'fondue-dropdown-subcontent' }: DropdownSubContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { theme, dir } = useFondueTheme();\n\n return (\n <RadixDropdown.Portal>\n <ThemeProvider theme={theme} dir={dir}>\n <RadixDropdown.SubContent\n // @ts-expect-error - dir prop works at runtime but is not in the Radix UI type definition\n dir={dir}\n className={styles.subContent}\n data-test-id={dataTestId}\n ref={ref}\n >\n {children}\n </RadixDropdown.SubContent>\n </ThemeProvider>\n </RadixDropdown.Portal>\n );\n};\nDropdownSubContent.displayName = 'Dropdown.SubContent';\n\nexport type DropdownItemProps = {\n children: ReactNode;\n /**\n * Disables the item.\n */\n disabled?: boolean;\n /**\n * The text value of the item that is passed to the onSelect callback.\n */\n textValue?: string;\n /**\n * The style of the item.\n * @default \"default\"\n */\n emphasis?: 'default' | 'danger';\n /**\n * Callback that is called when the item is selected.\n */\n onSelect?: (event: Event) => void;\n /**\n * If true, the item props will be passed to the child element.\n * @default false\n */\n asChild?: boolean;\n 'data-test-id'?: string;\n};\n\nexport const DropdownItem = (\n {\n children,\n disabled,\n textValue,\n onSelect,\n emphasis = 'default',\n asChild = false,\n 'data-test-id': dataTestId = 'fondue-dropdown-subtrigger',\n ...props\n }: DropdownItemProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { content } = useProcessedChildren(children);\n const wasMouseInteracted = useRef(false);\n\n return (\n <RadixDropdown.Item\n onSelect={onSelect}\n className={styles.item}\n textValue={textValue}\n data-test-id={dataTestId}\n data-emphasis={emphasis}\n ref={ref}\n disabled={disabled}\n asChild={asChild}\n data-show-focus-ring={wasMouseInteracted.current}\n onMouseEnter={() => {\n wasMouseInteracted.current = true;\n }}\n onFocus={(focusEvent) => {\n if (!wasMouseInteracted.current) {\n focusEvent.target.dataset.showFocusRing = 'true';\n }\n }}\n onBlur={(blurEvent) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasMouseInteracted.current = false;\n }}\n {...props}\n >\n {content}\n </RadixDropdown.Item>\n );\n};\nDropdownItem.displayName = 'Dropdown.Item';\n\nexport type DropdownSlotProps = { children: ReactNode; name?: 'left' | 'right'; 'data-test-id'?: string };\n\nexport const DropdownSlot = (\n { children, name, 'data-test-id': dataTestId = 'fondue-dropdown-slot' }: DropdownSlotProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-name={name} className={styles.slot} data-test-id={dataTestId} ref={ref}>\n {children}\n </div>\n );\n};\nDropdownSlot.displayName = 'Dropdown.Slot';\n\nconst ForwardedRefDropdownTrigger = forwardRef<HTMLButtonElement, DropdownTriggerProps>(DropdownTrigger);\nconst ForwardedRefDropdownContent = forwardRef<HTMLDivElement, DropdownContentProps>(DropdownContent);\nconst ForwardedRefDropdownGroup = forwardRef<HTMLDivElement, DropdownGroupProps>(DropdownGroup);\nconst ForwardedRefDropdownSubTrigger = forwardRef<HTMLDivElement, DropdownSubTriggerProps>(DropdownSubTrigger);\nconst ForwardedRefDropdownSubContent = forwardRef<HTMLDivElement, DropdownSubContentProps>(DropdownSubContent);\nconst ForwardedRefDropdownItem = forwardRef<HTMLDivElement, DropdownItemProps>(DropdownItem);\nconst ForwardedRefDropdownSlot = forwardRef<HTMLDivElement, DropdownSlotProps>(DropdownSlot);\n\nexport const Dropdown = {\n Root: DropdownRoot,\n Trigger: ForwardedRefDropdownTrigger,\n Content: ForwardedRefDropdownContent,\n Group: ForwardedRefDropdownGroup,\n SubMenu: DropdownSubMenu,\n SubTrigger: ForwardedRefDropdownSubTrigger,\n SubContent: ForwardedRefDropdownSubContent,\n Item: ForwardedRefDropdownItem,\n Slot: ForwardedRefDropdownSlot,\n};\n"],"names":["DropdownRoot","children","open","modal","onOpenChange","dataTestId","jsx","RadixDropdown","DropdownTrigger","asChild","props","ref","SPACING_MAP","VIEWPORT_COLLISION_PADDING_MAP","DropdownContent","side","align","triggerOffset","preventTriggerFocusOnClose","viewportCollisionPadding","forceMount","theme","dir","useFondueTheme","ThemeProvider","styles","event","DropdownGroup","heading","useMemo","Children","child","jsxs","DropdownSubMenu","DropdownSubTrigger","content","useProcessedChildren","IconCaretRight","DropdownSubContent","DropdownItem","disabled","textValue","onSelect","emphasis","wasMouseInteracted","useRef","focusEvent","blurEvent","DropdownSlot","name","ForwardedRefDropdownTrigger","forwardRef","ForwardedRefDropdownContent","ForwardedRefDropdownGroup","ForwardedRefDropdownSubTrigger","ForwardedRefDropdownSubContent","ForwardedRefDropdownItem","ForwardedRefDropdownSlot","Dropdown"],"mappings":";;;;;;;AA8BO,MAAMA,IAAe,CAAC;AAAA,EACzB,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,cAAAC;AAAA,EACA,gBAAgBC,IAAa;AACjC,MAEQ,gBAAAC,EAACC,EAAc,MAAd,EAAmB,MAAAL,GAAY,OAAAC,GAAc,cAAAC,GAA4B,gBAAcC,GACnF,UAAAJ,GACL;AAGRD,EAAa,cAAc;AAYpB,MAAMQ,IAAkB,CAC3B;AAAA,EACI,SAAAC,IAAU;AAAA,EACV,UA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M,gBAAgB5C,IAAa,uBAAA,GAC/CM,MAGI,gBAAAL,EAAC,OAAA,EAAI,aAAW2C,GAAM,WAAWxB,EAAO,MAAM,gBAAcpB,GAAY,KAAAM,GACnE,UAAAV,EAAA,CACL;AAGR+C,EAAa,cAAc;AAE3B,MAAME,IAA8BC,EAAoD3C,CAAe,GACjG4C,IAA8BD,EAAiDrC,CAAe,GAC9FuC,IAA4BF,EAA+CxB,CAAa,GACxF2B,IAAiCH,EAAoDjB,CAAkB,GACvGqB,IAAiCJ,EAAoDb,CAAkB,GACvGkB,IAA2BL,EAA8CZ,CAAY,GACrFkB,IAA2BN,EAA8CH,CAAY,GAE9EU,IAAW;AAAA,EACpB,MAAM1D;AAAA,EACN,SAASkD;AAAA,EACT,SAASE;AAAA,EACT,OAAOC;AAAA,EACP,SAASpB;AAAA,EACT,YAAYqB;AAAA,EACZ,YAAYC;AAAA,EACZ,MAAMC;AAAA,EACN,MAAMC;AACV;"}
|
|
1
|
+
{"version":3,"file":"fondue-components11.js","sources":["../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretRight } from '@frontify/fondue-icons';\nimport * as RadixDropdown from '@radix-ui/react-dropdown-menu';\nimport { Children, forwardRef, useMemo, useRef, type ForwardedRef, type ReactNode } from 'react';\n\nimport { ThemeProvider, useFondueTheme } from '../ThemeProvider/ThemeProvider';\n\nimport { useProcessedChildren } from './hooks/useProcessedChildren';\nimport styles from './styles/dropdown.module.scss';\n\nexport type DropdownRootProps = {\n children?: ReactNode;\n /**\n * When set to true, interaction with outside elements will be disabled and only menu content will be visible to screen readers.\n * @default false\n */\n modal?: boolean;\n /**\n * Controls the open state of the dropdown.\n */\n open?: boolean;\n /**\n * Callback that is called when the open state of the dropdown changes.\n */\n onOpenChange?: (open: boolean) => void;\n\n 'data-test-id'?: string;\n};\n\nexport const DropdownRoot = ({\n children,\n open,\n modal = false,\n onOpenChange,\n 'data-test-id': dataTestId = 'fondue-dropdown',\n}: DropdownRootProps) => {\n return (\n <RadixDropdown.Root open={open} modal={modal} onOpenChange={onOpenChange} data-test-id={dataTestId}>\n {children}\n </RadixDropdown.Root>\n );\n};\nDropdownRoot.displayName = 'Dropdown.Root';\n\nexport type DropdownTriggerProps = {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n * @default true\n */\n asChild?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport const DropdownTrigger = (\n {\n asChild = true,\n children,\n 'data-test-id': dataTestId = 'fondue-dropdown-trigger',\n ...props\n }: DropdownTriggerProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n return (\n <RadixDropdown.Trigger asChild={asChild} data-test-id={dataTestId} ref={ref} {...props}>\n {children}\n </RadixDropdown.Trigger>\n );\n};\nDropdownTrigger.displayName = 'Dropdown.Trigger';\n\ntype DropdownSpacing = 'compact' | 'comfortable' | 'spacious';\ntype DropdownViewportCollisionPadding = 'compact' | 'spacious';\nexport type DropdownContentProps = {\n children?: ReactNode;\n 'data-test-id'?: string;\n /**\n * Defines the alignment of the dropdown.\n * @default \"start\"\n */\n align?: 'start' | 'center' | 'end';\n /**\n * Defines the preferred side of the dropdown. It will not be respected if there are collisions with the viewport.\n * @default \"bottom\"\n */\n side?: 'top' | 'right' | 'bottom' | 'left';\n /**\n * Defines the spacing between the dropdown and its trigger.\n * @default 'compact'\n */\n triggerOffset?: DropdownSpacing;\n /**\n * Prevents the focus from being set on the trigger when the dropdown is closed.\n */\n preventTriggerFocusOnClose?: boolean;\n /**\n * Define the minimum distance between the dropdown and the viewport edge\n * @default 'compact'\n */\n viewportCollisionPadding?: DropdownViewportCollisionPadding;\n /**\n * When true, the content will always be mounted in the DOM. Before enabling, make sure you really need it.\n * @default false\n */\n forceMount?: boolean;\n};\n\nconst SPACING_MAP: Record<DropdownSpacing, number> = {\n compact: 8,\n comfortable: 12,\n spacious: 16,\n};\n\nconst VIEWPORT_COLLISION_PADDING_MAP: Record<DropdownViewportCollisionPadding, number> = {\n compact: 8,\n spacious: 24,\n};\n\nexport const DropdownContent = (\n {\n side = 'bottom',\n align = 'start',\n triggerOffset = 'compact',\n children,\n preventTriggerFocusOnClose,\n viewportCollisionPadding = 'compact',\n forceMount = false,\n 'data-test-id': dataTestId = 'fondue-dropdown-content',\n }: DropdownContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { theme, dir } = useFondueTheme();\n\n return (\n <RadixDropdown.Portal forceMount={forceMount || undefined}>\n <ThemeProvider theme={theme} dir={dir}>\n <RadixDropdown.Content\n // @ts-expect-error - dir prop works at runtime but is not in the Radix UI type definition\n dir={dir}\n align={align}\n collisionPadding={VIEWPORT_COLLISION_PADDING_MAP[viewportCollisionPadding]}\n sideOffset={SPACING_MAP[triggerOffset]}\n side={side}\n className={styles.content}\n data-test-id={dataTestId}\n ref={ref}\n onPointerDownOutside={(event) => {\n if (forceMount && event.currentTarget instanceof HTMLElement) {\n // Trigger is technically outside the dropdown content and when forceMount is true\n // the content is always in the DOM so the onPointerDownOutside event is triggered\n const dropdownIsOpen = event.currentTarget.getAttribute('data-state') === 'open';\n if (dropdownIsOpen) {\n event.preventDefault();\n }\n }\n }}\n onCloseAutoFocus={(event) => {\n if (preventTriggerFocusOnClose) {\n event.preventDefault();\n }\n }}\n forceMount={forceMount || undefined}\n >\n {children}\n </RadixDropdown.Content>\n </ThemeProvider>\n </RadixDropdown.Portal>\n );\n};\nDropdownContent.displayName = 'Dropdown.Content';\n\nexport type DropdownGroupProps = { children: ReactNode; heading?: string; 'data-test-id'?: string };\n\nexport const DropdownGroup = (\n { children, heading, 'data-test-id': dataTestId = 'fondue-dropdown-group' }: DropdownGroupProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const hasChildren = useMemo(\n () => Children.toArray(children).filter((child) => child !== null).length > 0,\n [children],\n );\n\n if (!hasChildren) {\n return null;\n }\n\n return (\n <RadixDropdown.Group className={styles.group} data-test-id={dataTestId} ref={ref}>\n {heading ? (\n <div className={styles.groupHeading}>\n <span aria-label={heading}>{heading}</span>\n </div>\n ) : null}\n {children}\n </RadixDropdown.Group>\n );\n};\nDropdownGroup.displayName = 'Dropdown.Group';\n\nexport type DropdownSubMenuProps = { children: ReactNode; 'data-test-id'?: string };\n\nexport const DropdownSubMenu = ({\n children,\n 'data-test-id': dataTestId = 'fondue-dropdown-submenu',\n}: DropdownSubMenuProps) => {\n return <RadixDropdown.Sub data-test-id={dataTestId}>{children}</RadixDropdown.Sub>;\n};\nDropdownSubMenu.displayName = 'Dropdown.SubMenu';\n\nexport type DropdownSubTriggerProps = { children: ReactNode; 'data-test-id'?: string };\n\nexport const DropdownSubTrigger = (\n { children, 'data-test-id': dataTestId = 'fondue-dropdown-subtrigger' }: DropdownSubTriggerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { content } = useProcessedChildren(children);\n return (\n <RadixDropdown.SubTrigger className={styles.subTrigger} data-test-id={dataTestId} ref={ref}>\n {content}\n <IconCaretRight className={styles.subMenuIndicator} size={16} />\n </RadixDropdown.SubTrigger>\n );\n};\nDropdownSubTrigger.displayName = 'Dropdown.SubTrigger';\n\nexport type DropdownSubContentProps = {\n children: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport const DropdownSubContent = (\n { children, 'data-test-id': dataTestId = 'fondue-dropdown-subcontent' }: DropdownSubContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { theme, dir } = useFondueTheme();\n\n return (\n <RadixDropdown.Portal>\n <ThemeProvider theme={theme} dir={dir}>\n <RadixDropdown.SubContent\n // @ts-expect-error - dir prop works at runtime but is not in the Radix UI type definition\n dir={dir}\n className={styles.subContent}\n data-test-id={dataTestId}\n ref={ref}\n >\n {children}\n </RadixDropdown.SubContent>\n </ThemeProvider>\n </RadixDropdown.Portal>\n );\n};\nDropdownSubContent.displayName = 'Dropdown.SubContent';\n\nexport type DropdownItemProps = {\n children: ReactNode;\n /**\n * Disables the item.\n */\n disabled?: boolean;\n /**\n * The text value of the item that is passed to the onSelect callback.\n */\n textValue?: string;\n /**\n * The style of the item.\n * @default \"default\"\n */\n emphasis?: 'default' | 'danger';\n /**\n * Callback that is called when the item is selected.\n */\n onSelect?: (event: Event) => void;\n /**\n * If true, the item props will be passed to the child element.\n * @default false\n */\n asChild?: boolean;\n 'data-test-id'?: string;\n};\n\nexport const DropdownItem = (\n {\n children,\n disabled,\n textValue,\n onSelect,\n emphasis = 'default',\n asChild = false,\n 'data-test-id': dataTestId = 'fondue-dropdown-subtrigger',\n ...props\n }: DropdownItemProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { content } = useProcessedChildren(children);\n const wasMouseInteracted = useRef(false);\n\n return (\n <RadixDropdown.Item\n onSelect={onSelect}\n className={styles.item}\n textValue={textValue}\n data-test-id={dataTestId}\n data-emphasis={emphasis}\n ref={ref}\n disabled={disabled}\n asChild={asChild}\n data-show-focus-ring={wasMouseInteracted.current}\n onMouseEnter={() => {\n wasMouseInteracted.current = true;\n }}\n onFocus={(focusEvent) => {\n if (!wasMouseInteracted.current) {\n focusEvent.target.dataset.showFocusRing = 'true';\n }\n }}\n onBlur={(blurEvent) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasMouseInteracted.current = false;\n }}\n {...props}\n >\n {content}\n </RadixDropdown.Item>\n );\n};\nDropdownItem.displayName = 'Dropdown.Item';\n\nexport type DropdownSlotProps = { children: ReactNode; name?: 'left' | 'right'; 'data-test-id'?: string };\n\nexport const DropdownSlot = (\n { children, name, 'data-test-id': dataTestId = 'fondue-dropdown-slot' }: DropdownSlotProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-name={name} className={styles.slot} data-test-id={dataTestId} ref={ref}>\n {children}\n </div>\n );\n};\nDropdownSlot.displayName = 'Dropdown.Slot';\n\nconst ForwardedRefDropdownTrigger = forwardRef<HTMLButtonElement, DropdownTriggerProps>(DropdownTrigger);\nconst ForwardedRefDropdownContent = forwardRef<HTMLDivElement, DropdownContentProps>(DropdownContent);\nconst ForwardedRefDropdownGroup = forwardRef<HTMLDivElement, DropdownGroupProps>(DropdownGroup);\nconst ForwardedRefDropdownSubTrigger = forwardRef<HTMLDivElement, DropdownSubTriggerProps>(DropdownSubTrigger);\nconst ForwardedRefDropdownSubContent = forwardRef<HTMLDivElement, DropdownSubContentProps>(DropdownSubContent);\nconst ForwardedRefDropdownItem = forwardRef<HTMLDivElement, DropdownItemProps>(DropdownItem);\nconst ForwardedRefDropdownSlot = forwardRef<HTMLDivElement, DropdownSlotProps>(DropdownSlot);\n\nexport const Dropdown = {\n Root: DropdownRoot,\n Trigger: ForwardedRefDropdownTrigger,\n Content: ForwardedRefDropdownContent,\n Group: ForwardedRefDropdownGroup,\n SubMenu: DropdownSubMenu,\n SubTrigger: ForwardedRefDropdownSubTrigger,\n SubContent: ForwardedRefDropdownSubContent,\n Item: ForwardedRefDropdownItem,\n Slot: ForwardedRefDropdownSlot,\n};\n"],"names":["DropdownRoot","children","open","modal","onOpenChange","dataTestId","jsx","RadixDropdown","DropdownTrigger","asChild","props","ref","SPACING_MAP","VIEWPORT_COLLISION_PADDING_MAP","DropdownContent","side","align","triggerOffset","preventTriggerFocusOnClose","viewportCollisionPadding","forceMount","theme","dir","useFondueTheme","ThemeProvider","styles","event","DropdownGroup","heading","useMemo","Children","child","jsxs","DropdownSubMenu","DropdownSubTrigger","content","useProcessedChildren","IconCaretRight","DropdownSubContent","DropdownItem","disabled","textValue","onSelect","emphasis","wasMouseInteracted","useRef","focusEvent","blurEvent","DropdownSlot","name","ForwardedRefDropdownTrigger","forwardRef","ForwardedRefDropdownContent","ForwardedRefDropdownGroup","ForwardedRefDropdownSubTrigger","ForwardedRefDropdownSubContent","ForwardedRefDropdownItem","ForwardedRefDropdownSlot","Dropdown"],"mappings":";;;;;;;AA8BO,MAAMA,IAAe,CAAC;AAAA,EACzB,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,cAAAC;AA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YACpBE,EAAW,OAAO,QAAQ,gBAAgB;AAAA,MAElD;AAAA,MACA,QAAQ,CAACC,MAAc;AACnB,QAAAA,EAAU,OAAO,QAAQ,gBAAgB,SACzCH,EAAmB,UAAU;AAAA,MACjC;AAAA,MACC,GAAGlC;AAAA,MAEH,UAAAyB;AAAA,IAAA;AAAA,EAAA;AAGb;AACAI,EAAa,cAAc;AAIpB,MAAMS,IAAe,CACxB,EAAE,UAAA/C,GAAU,MAAAgD,GAAM,gBAAgB5C,IAAa,uBAAA,GAC/CM,MAGI,gBAAAL,EAAC,OAAA,EAAI,aAAW2C,GAAM,WAAWxB,EAAO,MAAM,gBAAcpB,GAAY,KAAAM,GACnE,UAAAV,EAAA,CACL;AAGR+C,EAAa,cAAc;AAE3B,MAAME,IAA8BC,EAAoD3C,CAAe,GACjG4C,IAA8BD,EAAiDrC,CAAe,GAC9FuC,IAA4BF,EAA+CxB,CAAa,GACxF2B,IAAiCH,EAAoDjB,CAAkB,GACvGqB,IAAiCJ,EAAoDb,CAAkB,GACvGkB,IAA2BL,EAA8CZ,CAAY,GACrFkB,IAA2BN,EAA8CH,CAAY,GAE9EU,IAAW;AAAA,EACpB,MAAM1D;AAAA,EACN,SAASkD;AAAA,EACT,SAASE;AAAA,EACT,OAAOC;AAAA,EACP,SAASpB;AAAA,EACT,YAAYqB;AAAA,EACZ,YAAYC;AAAA,EACZ,MAAMC;AAAA,EACN,MAAMC;AACV;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import s from "./fondue-
|
|
3
|
-
import { colorToCss as e } from "./fondue-
|
|
2
|
+
import s from "./fondue-components87.js";
|
|
3
|
+
import { colorToCss as e } from "./fondue-components88.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 });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FOCUS_OUTLINE as t } from "./fondue-
|
|
1
|
+
import { FOCUS_OUTLINE as t } from "./fondue-components85.js";
|
|
2
2
|
import { sv as e } from "./fondue-components38.js";
|
|
3
3
|
const o = e({
|
|
4
4
|
base: `tw-group tw-relative tw-flex tw-flex-row tw-gap-2 tw-items-center tw-justify-center tw-cursor-pointer tw-font-body tw-font-medium tw-box-border tw-whitespace-nowrap tw-transition-colors ${t}`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FOCUS_OUTLINE as t } from "./fondue-
|
|
1
|
+
import { FOCUS_OUTLINE as t } from "./fondue-components85.js";
|
|
2
2
|
import { sv as e } from "./fondue-components38.js";
|
|
3
3
|
const s = e({
|
|
4
4
|
base: `tw-peer tw-relative tw-inline-flex tw-bg-base tw-text-white tw-shrink-0 tw-rounded tw-border tw-border-line-x-strong group-hover:tw-border-line-xx-strong hover:tw-border-line-xx-strong tw-transition-colors data-[state="checked"]:tw-border-transparent data-[state="indeterminate"]:tw-border-transparent disabled:tw-border-line-strong disabled:tw-bg-base disabled:tw-cursor-not-allowed data-[state="checked"]:disabled:tw-bg-box-disabled-strong data-[readonly="true"]:tw-pointer-events-none ${t}`,
|
|
@@ -2,7 +2,7 @@ import { jsxs as t, jsx as a, Fragment as f } from "react/jsx-runtime";
|
|
|
2
2
|
import { IconDroplet as h, IconCross as I, IconCaretDown as v } from "@frontify/fondue-icons";
|
|
3
3
|
import { forwardRef as k } from "react";
|
|
4
4
|
import { Button as w } from "./fondue-components6.js";
|
|
5
|
-
import s from "./fondue-
|
|
5
|
+
import s from "./fondue-components86.js";
|
|
6
6
|
import { getColorWithName as y, colorToCss as z } from "./fondue-components47.js";
|
|
7
7
|
const c = ({
|
|
8
8
|
id: m,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
const o = "
|
|
1
|
+
const o = "_root_rlb6a_6", r = "_overlay_rlb6a_51", e = "_header_rlb6a_68", _ = "_body_rlb6a_93", t = "_footer_rlb6a_122", a = "_close_rlb6a_147", l = {
|
|
2
2
|
root: o,
|
|
3
|
-
overlay:
|
|
4
|
-
header:
|
|
5
|
-
body:
|
|
6
|
-
footer:
|
|
7
|
-
close:
|
|
3
|
+
overlay: r,
|
|
4
|
+
header: e,
|
|
5
|
+
body: _,
|
|
6
|
+
footer: t,
|
|
7
|
+
close: a
|
|
8
8
|
};
|
|
9
9
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
_ as body,
|
|
11
|
+
a as close,
|
|
12
|
+
l as default,
|
|
13
|
+
t as footer,
|
|
14
|
+
e as header,
|
|
15
|
+
r as overlay,
|
|
16
16
|
o as root
|
|
17
17
|
};
|
|
18
18
|
//# sourceMappingURL=fondue-components56.js.map
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
const
|
|
2
|
-
table:
|
|
3
|
-
headerCell:
|
|
4
|
-
rowCell:
|
|
5
|
-
caption:
|
|
1
|
+
const o = "_table_sabol_4", t = "_headerCell_sabol_18", e = "_rowCell_sabol_19", l = "_caption_sabol_61", _ = "_header_sabol_18", a = "_cellContent_sabol_93", s = "_sortIndicator_sabol_118", n = "_body_sabol_122", c = "_row_sabol_19", b = "_buttonText_sabol_186", r = {
|
|
2
|
+
table: o,
|
|
3
|
+
headerCell: t,
|
|
4
|
+
rowCell: e,
|
|
5
|
+
caption: l,
|
|
6
6
|
header: _,
|
|
7
|
-
cellContent:
|
|
8
|
-
sortIndicator:
|
|
9
|
-
body:
|
|
10
|
-
row:
|
|
11
|
-
buttonText:
|
|
7
|
+
cellContent: a,
|
|
8
|
+
sortIndicator: s,
|
|
9
|
+
body: n,
|
|
10
|
+
row: c,
|
|
11
|
+
buttonText: b
|
|
12
12
|
};
|
|
13
13
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
n as body,
|
|
15
|
+
b as buttonText,
|
|
16
|
+
l as caption,
|
|
17
|
+
a as cellContent,
|
|
18
|
+
r as default,
|
|
19
19
|
_ as header,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
t as headerCell,
|
|
21
|
+
c as row,
|
|
22
|
+
e as rowCell,
|
|
23
|
+
s as sortIndicator,
|
|
24
|
+
o as table
|
|
25
25
|
};
|
|
26
26
|
//# sourceMappingURL=fondue-components75.js.map
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
root: o
|
|
3
|
-
};
|
|
1
|
+
const t = "focus-visible:tw-outline has-[[data-show-focus-ring=true]]:tw-outline tw-outline-4 tw-outline-offset-2 tw-outline-blue focus-visible:tw-outline-blue";
|
|
4
2
|
export {
|
|
5
|
-
t as
|
|
6
|
-
o as root
|
|
3
|
+
t as FOCUS_OUTLINE
|
|
7
4
|
};
|
|
8
5
|
//# sourceMappingURL=fondue-components85.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components85.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components85.js","sources":["../src/utilities/focusStyle.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const FOCUS_OUTLINE =\n 'focus-visible:tw-outline has-[[data-show-focus-ring=true]]:tw-outline tw-outline-4 tw-outline-offset-2 tw-outline-blue focus-visible:tw-outline-blue'; // second declaration of tw-outline-blue is to assure that in firefox the outline isn't overriden by a global definition of :-moz-focusring which is coming from tailwinds normalization styling\n"],"names":["FOCUS_OUTLINE"],"mappings":"AAEO,MAAMA,IACT;"}
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const o = "_root_3jye8_5", c = "_clearIcon_3jye8_35", t = "_caret_3jye8_52", _ = "_colorName_3jye8_72", n = "_button_3jye8_93", e = "_colorIndicator_3jye8_105", r = "_actions_3jye8_124", a = {
|
|
2
|
+
root: o,
|
|
3
|
+
clearIcon: c,
|
|
4
|
+
caret: t,
|
|
5
|
+
colorName: _,
|
|
6
|
+
button: n,
|
|
7
|
+
colorIndicator: e,
|
|
8
|
+
actions: r
|
|
4
9
|
};
|
|
5
10
|
export {
|
|
6
|
-
r as
|
|
11
|
+
r as actions,
|
|
12
|
+
n as button,
|
|
13
|
+
t as caret,
|
|
14
|
+
c as clearIcon,
|
|
15
|
+
e as colorIndicator,
|
|
16
|
+
_ as colorName,
|
|
17
|
+
a as default,
|
|
18
|
+
o as root
|
|
7
19
|
};
|
|
8
20
|
//# sourceMappingURL=fondue-components86.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components86.js","sources":[
|
|
1
|
+
{"version":3,"file":"fondue-components86.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
const
|
|
1
|
+
const o = "_root_b0bc4_2", t = {
|
|
2
|
+
root: o
|
|
3
|
+
};
|
|
2
4
|
export {
|
|
3
|
-
t as
|
|
5
|
+
t as default,
|
|
6
|
+
o as root
|
|
4
7
|
};
|
|
5
8
|
//# sourceMappingURL=fondue-components87.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components87.js","sources":[
|
|
1
|
+
{"version":3,"file":"fondue-components87.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
caret: t,
|
|
5
|
-
colorName: n,
|
|
6
|
-
button: r,
|
|
7
|
-
colorIndicator: s,
|
|
8
|
-
actions: _
|
|
1
|
+
const r = (e) => {
|
|
2
|
+
if (e)
|
|
3
|
+
return `rgba(${e.red}, ${e.green}, ${e.blue}, ${e.alpha ?? 1})`;
|
|
9
4
|
};
|
|
10
5
|
export {
|
|
11
|
-
|
|
12
|
-
r as button,
|
|
13
|
-
t as caret,
|
|
14
|
-
c as clearIcon,
|
|
15
|
-
s as colorIndicator,
|
|
16
|
-
n as colorName,
|
|
17
|
-
a as default,
|
|
18
|
-
o as root
|
|
6
|
+
r as colorToCss
|
|
19
7
|
};
|
|
20
8
|
//# sourceMappingURL=fondue-components88.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components88.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components88.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;"}
|