@fanvue/ui 3.51.0 → 3.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Autocomplete/Autocomplete.cjs +34 -10
- package/dist/cjs/components/Autocomplete/Autocomplete.cjs.map +1 -1
- package/dist/cjs/components/Autocomplete/AutocompleteOptionItem.cjs +13 -1
- package/dist/cjs/components/Autocomplete/AutocompleteOptionItem.cjs.map +1 -1
- package/dist/cjs/components/BottomNavigation/BottomNavigation.cjs +2 -2
- package/dist/cjs/components/BottomNavigation/BottomNavigation.cjs.map +1 -1
- package/dist/cjs/components/Card/Card.cjs +5 -2
- package/dist/cjs/components/Card/Card.cjs.map +1 -1
- package/dist/cjs/components/Chart/ChartCard.cjs +2 -1
- package/dist/cjs/components/Chart/ChartCard.cjs.map +1 -1
- package/dist/cjs/components/Chart/ChartLoadingOverlay.cjs +1 -1
- package/dist/cjs/components/Chart/ChartLoadingOverlay.cjs.map +1 -1
- package/dist/cjs/components/ChatInput/ChatInput.cjs +2 -2
- package/dist/cjs/components/ChatInput/ChatInput.cjs.map +1 -1
- package/dist/cjs/components/ChatMessage/ChatMessage.cjs +1 -1
- package/dist/cjs/components/ChatMessage/ChatMessage.cjs.map +1 -1
- package/dist/cjs/components/CreatorCard/CreatorCard.cjs +3 -5
- package/dist/cjs/components/CreatorCard/CreatorCard.cjs.map +1 -1
- package/dist/cjs/components/CreatorCover/CreatorCover.cjs +11 -7
- package/dist/cjs/components/CreatorCover/CreatorCover.cjs.map +1 -1
- package/dist/cjs/components/DatePicker/DatePicker.cjs +37 -16
- package/dist/cjs/components/DatePicker/DatePicker.cjs.map +1 -1
- package/dist/cjs/components/Drawer/Drawer.cjs +11 -3
- package/dist/cjs/components/Drawer/Drawer.cjs.map +1 -1
- package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs +33 -10
- package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs.map +1 -1
- package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs +2 -1
- package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs.map +1 -1
- package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs +18 -13
- package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs.map +1 -1
- package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs +56 -40
- package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs.map +1 -1
- package/dist/cjs/components/IconButton/IconButton.cjs +5 -2
- package/dist/cjs/components/IconButton/IconButton.cjs.map +1 -1
- package/dist/cjs/components/Icons/MenuRowIcon.cjs +9 -2
- package/dist/cjs/components/Icons/MenuRowIcon.cjs.map +1 -1
- package/dist/cjs/components/Icons/VerifiedIcon.cjs +9 -15
- package/dist/cjs/components/Icons/VerifiedIcon.cjs.map +1 -1
- package/dist/cjs/components/InlineEmptyState/InlineEmptyState.cjs +42 -0
- package/dist/cjs/components/InlineEmptyState/InlineEmptyState.cjs.map +1 -0
- package/dist/cjs/components/Link/Link.cjs +30 -7
- package/dist/cjs/components/Link/Link.cjs.map +1 -1
- package/dist/cjs/components/PhoneField/PhoneField.cjs +21 -17
- package/dist/cjs/components/PhoneField/PhoneField.cjs.map +1 -1
- package/dist/cjs/components/Popover/Popover.cjs +69 -0
- package/dist/cjs/components/Popover/Popover.cjs.map +1 -0
- package/dist/cjs/components/SegmentedControl/SegmentedControl.cjs +6 -10
- package/dist/cjs/components/SegmentedControl/SegmentedControl.cjs.map +1 -1
- package/dist/cjs/components/SegmentedControl/segmentedControlClassNames.cjs +54 -0
- package/dist/cjs/components/SegmentedControl/segmentedControlClassNames.cjs.map +1 -0
- package/dist/cjs/components/Select/Select.cjs +40 -12
- package/dist/cjs/components/Select/Select.cjs.map +1 -1
- package/dist/cjs/components/Slider/SliderThumb.cjs +3 -2
- package/dist/cjs/components/Slider/SliderThumb.cjs.map +1 -1
- package/dist/cjs/components/Snackbar/Snackbar.cjs +1 -1
- package/dist/cjs/components/Snackbar/Snackbar.cjs.map +1 -1
- package/dist/cjs/components/Switch/Switch.cjs +1 -1
- package/dist/cjs/components/Switch/Switch.cjs.map +1 -1
- package/dist/cjs/components/Table/Table.cjs +77 -7
- package/dist/cjs/components/Table/Table.cjs.map +1 -1
- package/dist/cjs/components/Table/TableRowLink.cjs +55 -0
- package/dist/cjs/components/Table/TableRowLink.cjs.map +1 -0
- package/dist/cjs/components/Tag/Tag.cjs +99 -0
- package/dist/cjs/components/Tag/Tag.cjs.map +1 -0
- package/dist/cjs/components/TextArea/TextArea.cjs +5 -4
- package/dist/cjs/components/TextArea/TextArea.cjs.map +1 -1
- package/dist/cjs/components/TextField/TextField.cjs +30 -15
- package/dist/cjs/components/TextField/TextField.cjs.map +1 -1
- package/dist/cjs/index.cjs +12 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/utils/floatingContentSurface.cjs +8 -0
- package/dist/cjs/utils/floatingContentSurface.cjs.map +1 -0
- package/dist/cjs/utils/inputFieldClasses.cjs +8 -0
- package/dist/cjs/utils/inputFieldClasses.cjs.map +1 -0
- package/dist/cjs/utils/pointerCapture.cjs +20 -0
- package/dist/cjs/utils/pointerCapture.cjs.map +1 -0
- package/dist/cjs/utils/useDragToDismiss.cjs +3 -2
- package/dist/cjs/utils/useDragToDismiss.cjs.map +1 -1
- package/dist/cjs/utils/useSuppressClickAfterDrag.cjs +2 -1
- package/dist/cjs/utils/useSuppressClickAfterDrag.cjs.map +1 -1
- package/dist/components/Autocomplete/Autocomplete.mjs +34 -10
- package/dist/components/Autocomplete/Autocomplete.mjs.map +1 -1
- package/dist/components/Autocomplete/AutocompleteOptionItem.mjs +13 -1
- package/dist/components/Autocomplete/AutocompleteOptionItem.mjs.map +1 -1
- package/dist/components/BottomNavigation/BottomNavigation.mjs +2 -2
- package/dist/components/BottomNavigation/BottomNavigation.mjs.map +1 -1
- package/dist/components/Card/Card.mjs +5 -2
- package/dist/components/Card/Card.mjs.map +1 -1
- package/dist/components/Chart/ChartCard.mjs +2 -1
- package/dist/components/Chart/ChartCard.mjs.map +1 -1
- package/dist/components/Chart/ChartLoadingOverlay.mjs +1 -1
- package/dist/components/Chart/ChartLoadingOverlay.mjs.map +1 -1
- package/dist/components/ChatInput/ChatInput.mjs +2 -2
- package/dist/components/ChatInput/ChatInput.mjs.map +1 -1
- package/dist/components/ChatMessage/ChatMessage.mjs +1 -1
- package/dist/components/ChatMessage/ChatMessage.mjs.map +1 -1
- package/dist/components/CreatorCard/CreatorCard.mjs +3 -5
- package/dist/components/CreatorCard/CreatorCard.mjs.map +1 -1
- package/dist/components/CreatorCover/CreatorCover.mjs +11 -7
- package/dist/components/CreatorCover/CreatorCover.mjs.map +1 -1
- package/dist/components/DatePicker/DatePicker.mjs +39 -18
- package/dist/components/DatePicker/DatePicker.mjs.map +1 -1
- package/dist/components/Drawer/Drawer.mjs +11 -3
- package/dist/components/Drawer/Drawer.mjs.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenuItem.mjs +33 -10
- package/dist/components/DropdownMenu/DropdownMenuItem.mjs.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs +2 -1
- package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenuRoot.mjs +18 -13
- package/dist/components/DropdownMenu/DropdownMenuRoot.mjs.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs +56 -40
- package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs.map +1 -1
- package/dist/components/IconButton/IconButton.mjs +5 -2
- package/dist/components/IconButton/IconButton.mjs.map +1 -1
- package/dist/components/Icons/MenuRowIcon.mjs +9 -2
- package/dist/components/Icons/MenuRowIcon.mjs.map +1 -1
- package/dist/components/Icons/VerifiedIcon.mjs +9 -15
- package/dist/components/Icons/VerifiedIcon.mjs.map +1 -1
- package/dist/components/InlineEmptyState/InlineEmptyState.mjs +25 -0
- package/dist/components/InlineEmptyState/InlineEmptyState.mjs.map +1 -0
- package/dist/components/Link/Link.mjs +31 -8
- package/dist/components/Link/Link.mjs.map +1 -1
- package/dist/components/PhoneField/PhoneField.mjs +21 -17
- package/dist/components/PhoneField/PhoneField.mjs.map +1 -1
- package/dist/components/Popover/Popover.mjs +51 -0
- package/dist/components/Popover/Popover.mjs.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.mjs +6 -10
- package/dist/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
- package/dist/components/SegmentedControl/segmentedControlClassNames.mjs +54 -0
- package/dist/components/SegmentedControl/segmentedControlClassNames.mjs.map +1 -0
- package/dist/components/Select/Select.mjs +40 -12
- package/dist/components/Select/Select.mjs.map +1 -1
- package/dist/components/Slider/SliderThumb.mjs +3 -2
- package/dist/components/Slider/SliderThumb.mjs.map +1 -1
- package/dist/components/Snackbar/Snackbar.mjs +1 -1
- package/dist/components/Snackbar/Snackbar.mjs.map +1 -1
- package/dist/components/Switch/Switch.mjs +1 -1
- package/dist/components/Switch/Switch.mjs.map +1 -1
- package/dist/components/Table/Table.mjs +77 -7
- package/dist/components/Table/Table.mjs.map +1 -1
- package/dist/components/Table/TableRowLink.mjs +38 -0
- package/dist/components/Table/TableRowLink.mjs.map +1 -0
- package/dist/components/Tag/Tag.mjs +82 -0
- package/dist/components/Tag/Tag.mjs.map +1 -0
- package/dist/components/TextArea/TextArea.mjs +5 -4
- package/dist/components/TextArea/TextArea.mjs.map +1 -1
- package/dist/components/TextField/TextField.mjs +30 -15
- package/dist/components/TextField/TextField.mjs.map +1 -1
- package/dist/date-picker.d.ts +9 -0
- package/dist/index.d.ts +339 -30
- package/dist/index.mjs +12 -0
- package/dist/index.mjs.map +1 -1
- package/dist/styles/base.css +8 -4
- package/dist/styles/theme.css +1217 -1
- package/dist/utils/floatingContentSurface.mjs +8 -0
- package/dist/utils/floatingContentSurface.mjs.map +1 -0
- package/dist/utils/inputFieldClasses.mjs +8 -0
- package/dist/utils/inputFieldClasses.mjs.map +1 -0
- package/dist/utils/pointerCapture.mjs +20 -0
- package/dist/utils/pointerCapture.mjs.map +1 -0
- package/dist/utils/useDragToDismiss.mjs +3 -2
- package/dist/utils/useDragToDismiss.mjs.map +1 -1
- package/dist/utils/useSuppressClickAfterDrag.mjs +2 -1
- package/dist/utils/useSuppressClickAfterDrag.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -4,8 +4,22 @@ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { cn } from "../../utils/cn.mjs";
|
|
6
6
|
import { TickIcon } from "../Icons/TickIcon.mjs";
|
|
7
|
-
const DropdownMenuRadioGroup =
|
|
8
|
-
|
|
7
|
+
const DropdownMenuRadioGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
8
|
+
DropdownMenuPrimitive.RadioGroup,
|
|
9
|
+
{
|
|
10
|
+
ref,
|
|
11
|
+
className: cn("flex flex-col gap-[3px]", className),
|
|
12
|
+
...props
|
|
13
|
+
}
|
|
14
|
+
));
|
|
15
|
+
DropdownMenuRadioGroup.displayName = "DropdownMenuRadioGroup";
|
|
16
|
+
const checkedV2Row = (disabled) => disabled ? "theme-v2:data-[state=checked]:bg-transparent" : "theme-v2:data-[state=checked]:bg-menu-item-selected theme-v2:data-[state=checked]:text-content-primary-inverted theme-v2:data-[state=checked]:data-[highlighted]:bg-menu-item-selected-hover";
|
|
17
|
+
const helperClassName = (disabled) => cn(
|
|
18
|
+
"typography-description-12px-regular text-content-secondary",
|
|
19
|
+
"group-data-[disabled]:text-content-disabled",
|
|
20
|
+
!disabled && "theme-v2:group-data-[state=checked]:text-content-secondary-inverted theme-v2:group-data-[state=checked]:group-data-[highlighted]:text-menu-item-selected-hover-secondary"
|
|
21
|
+
);
|
|
22
|
+
const DropdownMenuRadioItem = React.forwardRef(({ className, children, helper, size: _size = "40", disabled, ...props }, ref) => {
|
|
9
23
|
return /* @__PURE__ */ jsxs(
|
|
10
24
|
DropdownMenuPrimitive.RadioItem,
|
|
11
25
|
{
|
|
@@ -15,19 +29,18 @@ const DropdownMenuRadioItem = React.forwardRef(({ className, children, helper, s
|
|
|
15
29
|
// (node `7393:62008`), and at 16px a radio row indented 4px further than a
|
|
16
30
|
// `DropdownMenuCheckboxItem` in the same menu. 12px radius and a 40px
|
|
17
31
|
// minimum height, like `DropdownMenuItem`.
|
|
18
|
-
"group flex min-h-10 w-full cursor-pointer gap-3 rounded-sm px-3 py-2 outline-none",
|
|
32
|
+
"group flex min-h-10 w-full shrink-0 cursor-pointer gap-3 rounded-sm px-3 py-2 outline-none",
|
|
19
33
|
// A helper line makes it a two-line row aligned to its title; a single
|
|
20
34
|
// line centres in the 40px row like the checkbox and DropdownMenuItem.
|
|
21
35
|
helper ? "items-start" : "items-center",
|
|
22
|
-
"data-[
|
|
36
|
+
"data-[state=checked]:bg-menu-item-selected",
|
|
37
|
+
"data-[highlighted]:bg-interaction-hover",
|
|
38
|
+
"data-[state=checked]:data-[highlighted]:bg-interaction-hover",
|
|
39
|
+
checkedV2Row(disabled),
|
|
23
40
|
"data-[disabled]:cursor-not-allowed data-[disabled]:text-content-disabled",
|
|
24
|
-
// See DropdownMenuItem above: bg-interaction-hover aliases to the same
|
|
25
|
-
// token as the plain hover background, so it can't distinguish the
|
|
26
|
-
// checked state from an unchecked-but-hovered row.
|
|
27
|
-
"data-[state=checked]:bg-neutral-alphas-100",
|
|
28
|
-
"data-[state=checked]:data-[highlighted]:bg-neutral-alphas-200",
|
|
29
41
|
className
|
|
30
42
|
),
|
|
43
|
+
disabled,
|
|
31
44
|
...props,
|
|
32
45
|
children: [
|
|
33
46
|
/* @__PURE__ */ jsx(
|
|
@@ -37,44 +50,47 @@ const DropdownMenuRadioItem = React.forwardRef(({ className, children, helper, s
|
|
|
37
50
|
// In a two-line row `mt-px` centres the 16px circle on the 18px title line.
|
|
38
51
|
helper && "mt-px",
|
|
39
52
|
"flex size-4 shrink-0 items-center justify-center rounded-full border border-icons-primary",
|
|
40
|
-
"group-data-[disabled]:border-content-disabled"
|
|
53
|
+
"group-data-[disabled]:border-content-disabled theme-v2:group-data-[disabled]:border-icons-disabled",
|
|
54
|
+
!disabled && "theme-v2:group-data-[state=checked]:border-icons-primary-inverted"
|
|
41
55
|
),
|
|
42
56
|
"aria-hidden": "true",
|
|
43
|
-
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
57
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
58
|
+
"span",
|
|
59
|
+
{
|
|
60
|
+
className: cn(
|
|
61
|
+
"size-2 rounded-full bg-content-primary",
|
|
62
|
+
disabled ? "theme-v2:bg-icons-disabled" : "theme-v2:bg-icons-primary-inverted"
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
) })
|
|
44
66
|
}
|
|
45
67
|
),
|
|
46
68
|
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
47
69
|
/* @__PURE__ */ jsx("span", { className: "typography-body-small-14px-semibold truncate", children }),
|
|
48
|
-
helper && /* @__PURE__ */ jsx(
|
|
49
|
-
"span",
|
|
50
|
-
{
|
|
51
|
-
className: cn(
|
|
52
|
-
"typography-description-12px-regular text-content-secondary",
|
|
53
|
-
"group-data-[disabled]:text-content-disabled"
|
|
54
|
-
),
|
|
55
|
-
children: helper
|
|
56
|
-
}
|
|
57
|
-
)
|
|
70
|
+
helper && /* @__PURE__ */ jsx("span", { className: helperClassName(disabled), children: helper })
|
|
58
71
|
] })
|
|
59
72
|
]
|
|
60
73
|
}
|
|
61
74
|
);
|
|
62
75
|
});
|
|
63
76
|
DropdownMenuRadioItem.displayName = "DropdownMenuRadioItem";
|
|
64
|
-
const DropdownMenuCheckboxItem = React.forwardRef(({ className, children, helper, avatar, ...props }, ref) => {
|
|
77
|
+
const DropdownMenuCheckboxItem = React.forwardRef(({ className, children, helper, avatar, disabled, ...props }, ref) => {
|
|
65
78
|
return /* @__PURE__ */ jsxs(
|
|
66
79
|
DropdownMenuPrimitive.CheckboxItem,
|
|
67
80
|
{
|
|
68
81
|
ref,
|
|
69
82
|
className: cn(
|
|
70
|
-
"group flex min-h-10 w-full cursor-pointer items-center gap-3 rounded-sm px-3 py-2 outline-none",
|
|
71
|
-
//
|
|
72
|
-
// leave every selected row shaded, which reads as
|
|
73
|
-
// a menu that starts fully selected.
|
|
74
|
-
|
|
83
|
+
"group flex min-h-10 w-full shrink-0 cursor-pointer items-center gap-3 rounded-sm px-3 py-2 outline-none",
|
|
84
|
+
// In the current palette the checked state is carried by the tick alone.
|
|
85
|
+
// A background here would leave every selected row shaded, which reads as
|
|
86
|
+
// "all highlighted" on a menu that starts fully selected. The v2 palette
|
|
87
|
+
// inverts checked rows like every other selected menu row.
|
|
88
|
+
"data-[highlighted]:bg-interaction-hover",
|
|
89
|
+
checkedV2Row(disabled),
|
|
75
90
|
"data-[disabled]:cursor-not-allowed data-[disabled]:text-content-disabled",
|
|
76
91
|
className
|
|
77
92
|
),
|
|
93
|
+
disabled,
|
|
78
94
|
...props,
|
|
79
95
|
children: [
|
|
80
96
|
/* @__PURE__ */ jsx(
|
|
@@ -83,25 +99,25 @@ const DropdownMenuCheckboxItem = React.forwardRef(({ className, children, helper
|
|
|
83
99
|
className: cn(
|
|
84
100
|
"flex size-4 shrink-0 items-center justify-center rounded-2xs border border-icons-primary",
|
|
85
101
|
"group-data-[state=checked]:bg-icons-primary",
|
|
86
|
-
"group-data-[disabled]:border-content-disabled"
|
|
102
|
+
"group-data-[disabled]:border-content-disabled theme-v2:group-data-[disabled]:border-icons-disabled",
|
|
103
|
+
disabled ? "theme-v2:group-data-[state=checked]:bg-icons-disabled" : "theme-v2:group-data-[state=checked]:border-icons-primary-inverted theme-v2:group-data-[state=checked]:bg-icons-primary-inverted"
|
|
87
104
|
),
|
|
88
105
|
"aria-hidden": "true",
|
|
89
|
-
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
106
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
107
|
+
TickIcon,
|
|
108
|
+
{
|
|
109
|
+
className: cn(
|
|
110
|
+
"size-4 text-content-primary-inverted",
|
|
111
|
+
!disabled && "theme-v2:text-content-primary"
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
) })
|
|
90
115
|
}
|
|
91
116
|
),
|
|
92
|
-
avatar && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: avatar }),
|
|
117
|
+
avatar && /* @__PURE__ */ jsx("span", { className: cn("shrink-0", disabled && "theme-v2:opacity-60"), children: avatar }),
|
|
93
118
|
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
94
119
|
/* @__PURE__ */ jsx("span", { className: "typography-body-small-14px-semibold truncate", children }),
|
|
95
|
-
helper && /* @__PURE__ */ jsx(
|
|
96
|
-
"span",
|
|
97
|
-
{
|
|
98
|
-
className: cn(
|
|
99
|
-
"typography-description-12px-regular text-content-secondary",
|
|
100
|
-
"group-data-[disabled]:text-content-disabled"
|
|
101
|
-
),
|
|
102
|
-
children: helper
|
|
103
|
-
}
|
|
104
|
-
)
|
|
120
|
+
helper && /* @__PURE__ */ jsx("span", { className: helperClassName(disabled), children: helper })
|
|
105
121
|
] })
|
|
106
122
|
]
|
|
107
123
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenuSelectionItems.mjs","sources":["../../../src/components/DropdownMenu/DropdownMenuSelectionItems.tsx"],"sourcesContent":["import * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { TickIcon } from \"../Icons/TickIcon\";\n\n/** Props for the {@link DropdownMenuRadioGroup} component. */\nexport interface DropdownMenuRadioGroupProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioGroup> {}\n\n/**\n * Groups {@link DropdownMenuRadioItem} children so they behave as a\n * single-select set. Controlled via `value`/`onValueChange`.\n *\n * @example\n * ```tsx\n * <DropdownMenuRadioGroup value={sort} onValueChange={setSort}>\n * <DropdownMenuRadioItem value=\"newest\">Newest first</DropdownMenuRadioItem>\n * <DropdownMenuRadioItem value=\"oldest\">Oldest first</DropdownMenuRadioItem>\n * </DropdownMenuRadioGroup>\n * ```\n *\n * Requires Radix menu context — not supported inside a `variant=\"sheet\"` menu.\n */\nexport const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\n/** Height preset for a {@link DropdownMenuRadioItem}. */\nexport type DropdownMenuRadioItemSize = \"40\";\n\nexport interface DropdownMenuRadioItemProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem> {\n /** Optional secondary text shown below the title. */\n helper?: string;\n /** Height of the item row. @default \"40\" */\n size?: DropdownMenuRadioItemSize;\n}\n\n/**\n * A single radio-style choice within a {@link DropdownMenuRadioGroup}. Shows\n * a circular indicator that fills when selected, plus an optional helper line\n * underneath the title.\n */\nexport const DropdownMenuRadioItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.RadioItem>,\n DropdownMenuRadioItemProps\n>(({ className, children, helper, size: _size = \"40\", ...props }, ref) => {\n return (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n // `px-3` (12px), not 16px: `V2 Menu Radio Item` is `px-[12px] py-[8px]`\n // (node `7393:62008`), and at 16px a radio row indented 4px further than a\n // `DropdownMenuCheckboxItem` in the same menu. 12px radius and a 40px\n // minimum height, like `DropdownMenuItem`.\n \"group flex min-h-10 w-full cursor-pointer gap-3 rounded-sm px-3 py-2 outline-none\",\n // A helper line makes it a two-line row aligned to its title; a single\n // line centres in the 40px row like the checkbox and DropdownMenuItem.\n helper ? \"items-start\" : \"items-center\",\n \"data-[highlighted]:bg-neutral-alphas-50\",\n \"data-[disabled]:cursor-not-allowed data-[disabled]:text-content-disabled\",\n // See DropdownMenuItem above: bg-interaction-hover aliases to the same\n // token as the plain hover background, so it can't distinguish the\n // checked state from an unchecked-but-hovered row.\n \"data-[state=checked]:bg-neutral-alphas-100\",\n \"data-[state=checked]:data-[highlighted]:bg-neutral-alphas-200\",\n className,\n )}\n {...props}\n >\n <span\n className={cn(\n // In a two-line row `mt-px` centres the 16px circle on the 18px title line.\n helper && \"mt-px\",\n \"flex size-4 shrink-0 items-center justify-center rounded-full border border-icons-primary\",\n \"group-data-[disabled]:border-content-disabled\",\n )}\n aria-hidden=\"true\"\n >\n <DropdownMenuPrimitive.ItemIndicator asChild>\n <span className=\"size-2 rounded-full bg-content-primary\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n <span className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <span className=\"typography-body-small-14px-semibold truncate\">{children}</span>\n {helper && (\n <span\n className={cn(\n \"typography-description-12px-regular text-content-secondary\",\n \"group-data-[disabled]:text-content-disabled\",\n )}\n >\n {helper}\n </span>\n )}\n </span>\n </DropdownMenuPrimitive.RadioItem>\n );\n});\nDropdownMenuRadioItem.displayName = \"DropdownMenuRadioItem\";\n\nexport interface DropdownMenuCheckboxItemProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem> {\n /** Optional secondary text shown below the title. */\n helper?: string;\n /** Leading avatar rendered between the checkbox and the title. Render at 32px to match the design. */\n avatar?: React.ReactNode;\n}\n\n/**\n * A single multi-select choice within a dropdown menu. Shows a square indicator\n * that fills when checked, an optional leading avatar, and an optional helper\n * line underneath the title.\n *\n * Pair with {@link DropdownMenuHeader} at `type=\"search\"` for filterable menus.\n * Use {@link DropdownMenuRadioItem} instead when only one option may be active.\n *\n * @example\n * ```tsx\n * <DropdownMenuCheckboxItem\n * checked={selected.has(creator.id)}\n * onCheckedChange={() => toggle(creator.id)}\n * avatar={<Avatar size={32} src={creator.avatarUrl} />}\n * >\n * @sofiabloom\n * </DropdownMenuCheckboxItem>\n * ```\n */\nexport const DropdownMenuCheckboxItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n DropdownMenuCheckboxItemProps\n>(({ className, children, helper, avatar, ...props }, ref) => {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n \"group flex min-h-10 w-full cursor-pointer items-center gap-3 rounded-sm px-3 py-2 outline-none\",\n // Checked state is carried by the tick alone. A background here would\n // leave every selected row shaded, which reads as \"all highlighted\" on\n // a menu that starts fully selected.\n \"data-[highlighted]:bg-neutral-alphas-50\",\n \"data-[disabled]:cursor-not-allowed data-[disabled]:text-content-disabled\",\n className,\n )}\n {...props}\n >\n <span\n className={cn(\n \"flex size-4 shrink-0 items-center justify-center rounded-2xs border border-icons-primary\",\n \"group-data-[state=checked]:bg-icons-primary\",\n \"group-data-[disabled]:border-content-disabled\",\n )}\n aria-hidden=\"true\"\n >\n <DropdownMenuPrimitive.ItemIndicator asChild>\n <TickIcon className=\"size-4 text-content-primary-inverted\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {avatar && <span className=\"shrink-0\">{avatar}</span>}\n <span className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <span className=\"typography-body-small-14px-semibold truncate\">{children}</span>\n {helper && (\n <span\n className={cn(\n \"typography-description-12px-regular text-content-secondary\",\n \"group-data-[disabled]:text-content-disabled\",\n )}\n >\n {helper}\n </span>\n )}\n </span>\n </DropdownMenuPrimitive.CheckboxItem>\n );\n});\nDropdownMenuCheckboxItem.displayName = \"DropdownMenuCheckboxItem\";\n"],"names":[],"mappings":";;;;;;AAuBO,MAAM,yBAAyB,sBAAsB;AAkBrD,MAAM,wBAAwB,MAAM,WAGzC,CAAC,EAAE,WAAW,UAAU,QAAQ,MAAM,QAAQ,MAAM,GAAG,MAAA,G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cACT;AAAA,cACA;AAAA,cACA;AAAA,YAAA;AAAA,YAEF,eAAY;AAAA,YAEZ,UAAA,oBAAC,sBAAsB,eAAtB,EAAoC,SAAO,MAC1C,UAAA,oBAAC,UAAA,EAAS,WAAU,uCAAA,CAAuC,EAAA,CAC7D;AAAA,UAAA;AAAA,QAAA;AAAA,QAED,UAAU,oBAAC,QAAA,EAAK,WAAU,YAAY,UAAA,QAAO;AAAA,QAC9C,qBAAC,QAAA,EAAK,WAAU,sCACd,UAAA;AAAA,UAAA,oBAAC,QAAA,EAAK,WAAU,gDAAgD,SAAA,CAAS;AAAA,UACxE,UACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW;AAAA,gBACT;AAAA,gBACA;AAAA,cAAA;AAAA,cAGD,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH,EAAA,CAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;AACD,yBAAyB,cAAc;"}
|
|
1
|
+
{"version":3,"file":"DropdownMenuSelectionItems.mjs","sources":["../../../src/components/DropdownMenu/DropdownMenuSelectionItems.tsx"],"sourcesContent":["import * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { TickIcon } from \"../Icons/TickIcon\";\n\n/** Props for the {@link DropdownMenuRadioGroup} component. */\nexport interface DropdownMenuRadioGroupProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioGroup> {}\n\n/**\n * Groups {@link DropdownMenuRadioItem} children so they behave as a\n * single-select set. Controlled via `value`/`onValueChange`.\n *\n * @example\n * ```tsx\n * <DropdownMenuRadioGroup value={sort} onValueChange={setSort}>\n * <DropdownMenuRadioItem value=\"newest\">Newest first</DropdownMenuRadioItem>\n * <DropdownMenuRadioItem value=\"oldest\">Oldest first</DropdownMenuRadioItem>\n * </DropdownMenuRadioGroup>\n * ```\n *\n * Requires Radix menu context — not supported inside a `variant=\"sheet\"` menu.\n */\nexport const DropdownMenuRadioGroup = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.RadioGroup>,\n DropdownMenuRadioGroupProps\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioGroup\n ref={ref}\n className={cn(\"flex flex-col gap-[3px]\", className)}\n {...props}\n />\n));\nDropdownMenuRadioGroup.displayName = \"DropdownMenuRadioGroup\";\n\n/**\n * Under the v2 palette a checked radio or checkbox row fills `Menu Item Selected`,\n * which is inverted there, with inverted content. A highlighted checked row moves to\n * `Menu Item Selected Hover` so keyboard focus stays visible. A disabled row takes the\n * library's Disabled state instead, which has no fill.\n */\nconst checkedV2Row = (disabled: boolean | undefined) =>\n disabled\n ? \"theme-v2:data-[state=checked]:bg-transparent\"\n : \"theme-v2:data-[state=checked]:bg-menu-item-selected theme-v2:data-[state=checked]:text-content-primary-inverted theme-v2:data-[state=checked]:data-[highlighted]:bg-menu-item-selected-hover\";\n\n/**\n * A helper line, inverted on a checked row under the v2 palette unless the row is disabled,\n * and `Menu Item Selected Hover Secondary` while that row is highlighted.\n */\nconst helperClassName = (disabled: boolean | undefined) =>\n cn(\n \"typography-description-12px-regular text-content-secondary\",\n \"group-data-[disabled]:text-content-disabled\",\n !disabled &&\n \"theme-v2:group-data-[state=checked]:text-content-secondary-inverted theme-v2:group-data-[state=checked]:group-data-[highlighted]:text-menu-item-selected-hover-secondary\",\n );\n\n/** Height preset for a {@link DropdownMenuRadioItem}. */\nexport type DropdownMenuRadioItemSize = \"40\";\n\nexport interface DropdownMenuRadioItemProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem> {\n /** Optional secondary text shown below the title. */\n helper?: string;\n /** Height of the item row. @default \"40\" */\n size?: DropdownMenuRadioItemSize;\n}\n\n/**\n * A single radio-style choice within a {@link DropdownMenuRadioGroup}. Shows\n * a circular indicator that fills when selected, plus an optional helper line\n * underneath the title. The checked row rests on `Buttons/Navigation/Hover`, and\n * hovering it shows `Interaction/Hover` like any other row. Under the v2 palette\n * the fill is inverted, with inverted content, and a highlighted checked row moves to\n * `Menu Item Selected Hover`. Rows do not shrink, so a two-line row stays whole when\n * the panel scrolls.\n */\nexport const DropdownMenuRadioItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.RadioItem>,\n DropdownMenuRadioItemProps\n>(({ className, children, helper, size: _size = \"40\", disabled, ...props }, ref) => {\n return (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n // `px-3` (12px), not 16px: `V2 Menu Radio Item` is `px-[12px] py-[8px]`\n // (node `7393:62008`), and at 16px a radio row indented 4px further than a\n // `DropdownMenuCheckboxItem` in the same menu. 12px radius and a 40px\n // minimum height, like `DropdownMenuItem`.\n \"group flex min-h-10 w-full shrink-0 cursor-pointer gap-3 rounded-sm px-3 py-2 outline-none\",\n // A helper line makes it a two-line row aligned to its title; a single\n // line centres in the 40px row like the checkbox and DropdownMenuItem.\n helper ? \"items-start\" : \"items-center\",\n \"data-[state=checked]:bg-menu-item-selected\",\n \"data-[highlighted]:bg-interaction-hover\",\n \"data-[state=checked]:data-[highlighted]:bg-interaction-hover\",\n checkedV2Row(disabled),\n \"data-[disabled]:cursor-not-allowed data-[disabled]:text-content-disabled\",\n className,\n )}\n disabled={disabled}\n {...props}\n >\n <span\n className={cn(\n // In a two-line row `mt-px` centres the 16px circle on the 18px title line.\n helper && \"mt-px\",\n \"flex size-4 shrink-0 items-center justify-center rounded-full border border-icons-primary\",\n \"group-data-[disabled]:border-content-disabled theme-v2:group-data-[disabled]:border-icons-disabled\",\n !disabled && \"theme-v2:group-data-[state=checked]:border-icons-primary-inverted\",\n )}\n aria-hidden=\"true\"\n >\n <DropdownMenuPrimitive.ItemIndicator asChild>\n <span\n className={cn(\n \"size-2 rounded-full bg-content-primary\",\n disabled ? \"theme-v2:bg-icons-disabled\" : \"theme-v2:bg-icons-primary-inverted\",\n )}\n />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n <span className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <span className=\"typography-body-small-14px-semibold truncate\">{children}</span>\n {helper && <span className={helperClassName(disabled)}>{helper}</span>}\n </span>\n </DropdownMenuPrimitive.RadioItem>\n );\n});\nDropdownMenuRadioItem.displayName = \"DropdownMenuRadioItem\";\n\nexport interface DropdownMenuCheckboxItemProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem> {\n /** Optional secondary text shown below the title. */\n helper?: string;\n /** Leading avatar rendered between the checkbox and the title. Render at 32px to match the design. */\n avatar?: React.ReactNode;\n}\n\n/**\n * A single multi-select choice within a dropdown menu. Shows a square indicator\n * that fills when checked, an optional leading avatar, and an optional helper\n * line underneath the title. Rows do not shrink, so a two-line row stays whole\n * when the panel scrolls.\n *\n * Pair with {@link DropdownMenuHeader} at `type=\"search\"` for filterable menus.\n * Use {@link DropdownMenuRadioItem} instead when only one option may be active.\n *\n * @example\n * ```tsx\n * <DropdownMenuCheckboxItem\n * checked={selected.has(creator.id)}\n * onCheckedChange={() => toggle(creator.id)}\n * avatar={<Avatar size={32} src={creator.avatarUrl} />}\n * >\n * @sofiabloom\n * </DropdownMenuCheckboxItem>\n * ```\n */\nexport const DropdownMenuCheckboxItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n DropdownMenuCheckboxItemProps\n>(({ className, children, helper, avatar, disabled, ...props }, ref) => {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n \"group flex min-h-10 w-full shrink-0 cursor-pointer items-center gap-3 rounded-sm px-3 py-2 outline-none\",\n // In the current palette the checked state is carried by the tick alone.\n // A background here would leave every selected row shaded, which reads as\n // \"all highlighted\" on a menu that starts fully selected. The v2 palette\n // inverts checked rows like every other selected menu row.\n \"data-[highlighted]:bg-interaction-hover\",\n checkedV2Row(disabled),\n \"data-[disabled]:cursor-not-allowed data-[disabled]:text-content-disabled\",\n className,\n )}\n disabled={disabled}\n {...props}\n >\n <span\n className={cn(\n \"flex size-4 shrink-0 items-center justify-center rounded-2xs border border-icons-primary\",\n \"group-data-[state=checked]:bg-icons-primary\",\n \"group-data-[disabled]:border-content-disabled theme-v2:group-data-[disabled]:border-icons-disabled\",\n disabled\n ? \"theme-v2:group-data-[state=checked]:bg-icons-disabled\"\n : \"theme-v2:group-data-[state=checked]:border-icons-primary-inverted theme-v2:group-data-[state=checked]:bg-icons-primary-inverted\",\n )}\n aria-hidden=\"true\"\n >\n <DropdownMenuPrimitive.ItemIndicator asChild>\n <TickIcon\n className={cn(\n \"size-4 text-content-primary-inverted\",\n !disabled && \"theme-v2:text-content-primary\",\n )}\n />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {avatar && (\n <span className={cn(\"shrink-0\", disabled && \"theme-v2:opacity-60\")}>{avatar}</span>\n )}\n <span className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <span className=\"typography-body-small-14px-semibold truncate\">{children}</span>\n {helper && <span className={helperClassName(disabled)}>{helper}</span>}\n </span>\n </DropdownMenuPrimitive.CheckboxItem>\n );\n});\nDropdownMenuCheckboxItem.displayName = \"DropdownMenuCheckboxItem\";\n"],"names":[],"mappings":";;;;;;AAuBO,MAAM,yBAAyB,MAAM,WAG1C,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1B;AAAA,EAAC,sBAAsB;AAAA,EAAtB;AAAA,IACC;AAAA,IACA,WAAW,GAAG,2BAA2B,SAAS;AAAA,IACjD,GAAG;AAAA,EAAA;AACN,CACD;AACD,uBAAuB,cAAc;AAQrC,MAAM,eAAe,CAAC,aACpB,WACI,iDACA;AAMN,MAAM,kBAAkB,CAAC,aACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA,CAAC,YACC;AACJ;AAsBK,MAAM,wBAAwB,MAAM,WAGzC,CAAC,EAAE,WAAW,UAAU,QAAQ,MAAM,QAAQ,MAAM,UAAU,GAAG,MAAA,GAAS,QAAQ;AAClF,SACE;AAAA,IAAC,sBA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,MAEJ,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAW;AAAA,cACT;AAAA,cACA;AAAA,cACA;AAAA,cACA,WACI,0DACA;AAAA,YAAA;AAAA,YAEN,eAAY;AAAA,YAEZ,UAAA,oBAAC,sBAAsB,eAAtB,EAAoC,SAAO,MAC1C,UAAA;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAW;AAAA,kBACT;AAAA,kBACA,CAAC,YAAY;AAAA,gBAAA;AAAA,cACf;AAAA,YAAA,EACF,CACF;AAAA,UAAA;AAAA,QAAA;AAAA,QAED,8BACE,QAAA,EAAK,WAAW,GAAG,YAAY,YAAY,qBAAqB,GAAI,UAAA,OAAA,CAAO;AAAA,QAE9E,qBAAC,QAAA,EAAK,WAAU,sCACd,UAAA;AAAA,UAAA,oBAAC,QAAA,EAAK,WAAU,gDAAgD,SAAA,CAAS;AAAA,UACxE,UAAU,oBAAC,QAAA,EAAK,WAAW,gBAAgB,QAAQ,GAAI,UAAA,OAAA,CAAO;AAAA,QAAA,EAAA,CACjE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;AACD,yBAAyB,cAAc;"}
|
|
@@ -131,8 +131,11 @@ const VARIANT_CLASSES = {
|
|
|
131
131
|
// with only an icon inside). Border and hover match the Select trigger it lines up
|
|
132
132
|
// with, so the row reads as one control group.
|
|
133
133
|
field: {
|
|
134
|
-
default: "border border-border-
|
|
135
|
-
disabled:
|
|
134
|
+
default: "border border-border-input bg-inputs-inputs-primary text-content-primary not-disabled:hover:border-border-input-hover theme-v2:focus-visible:not-disabled:border-border-selected theme-v2:focus-visible:shadow-none",
|
|
135
|
+
disabled: cn(
|
|
136
|
+
DISABLED_TRANSPARENT,
|
|
137
|
+
"theme-v2:disabled:border-transparent theme-v2:disabled:bg-inputs-inputs-disabled theme-v2:disabled:text-icons-disabled"
|
|
138
|
+
)
|
|
136
139
|
}
|
|
137
140
|
};
|
|
138
141
|
function getVariantClasses(variant, negative) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.mjs","sources":["../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Count, type CountSize } from \"../Count/Count\";\nimport { IconDefaultsContext, NO_ICON_DEFAULTS } from \"../Icons/IconDefaults\";\n\n/**\n * Visual style variant of the icon button.\n *\n * `primary`, `secondary`, `tertiary`, `outline`, `error`, `white` and `black`\n * use the shared button colour tokens and a size-driven shape (squared at the\n * `24` size, circular otherwise). Of these, `primary`, `secondary`, `tertiary`\n * and `outline` also honour the {@link IconButtonProps.negative} prop, as does\n * `upsell`, which takes the other theme's glow.\n *\n * `upsell` is the Figma \"Upsell\" icon button and matches `Button`'s `brand`\n * variant: a green radial fill, a green glow and a highlight that circles the\n * rim once, held still when the user prefers reduced motion. It takes the same\n * size-driven shape as the standard variants.\n *\n * `overlay` is a translucent dark fill with a backdrop blur, for buttons that sit\n * on photos or video. Its fill and icon look the same in light and dark themes, while\n * the keyboard focus ring still follows the theme. It takes the same size-driven\n * shape as the standard variants.\n *\n * `brand`, `contrast`, `messaging`, `navTray`, `tertiaryDestructive`, `stop` and\n * `microphone` are bespoke variants that stay circular at every size.\n */\nexport type IconButtonVariant =\n | \"primary\"\n | \"secondary\"\n | \"tertiary\"\n | \"outline\"\n | \"error\"\n | \"white\"\n | \"black\"\n | \"brand\"\n | \"upsell\"\n | \"contrast\"\n | \"messaging\"\n | \"navTray\"\n | \"tertiaryDestructive\"\n | \"stop\"\n | \"microphone\"\n | \"overlay\"\n | \"field\";\n\n/** Icon button size in pixels. */\nexport type IconButtonSize = \"24\" | \"32\" | \"40\" | \"48\" | \"52\" | \"72\";\n\nconst iconSizeVariants: Record<IconButtonSize, string> = {\n 24: \"[&>svg]:size-4\",\n 32: \"[&>svg]:size-4\",\n 40: \"[&>svg]:size-4\",\n 48: \"[&>svg]:size-6\",\n 52: \"[&>svg]:size-7\",\n 72: \"[&>svg]:size-8\",\n};\n\nconst sizeVariants: Record<IconButtonSize, string> = {\n 24: \"size-6 p-1\",\n 32: \"size-8 p-1.5\",\n 40: \"size-10 p-[10px]\",\n 48: \"size-12 p-3\",\n 52: \"size-[52px] p-2\",\n 72: \"size-[72px] p-4\",\n};\n\nconst countSizeMap: Record<IconButtonSize, CountSize> = {\n 24: \"16\",\n 32: \"24\",\n 40: \"32\",\n 48: \"32\",\n 52: \"32\",\n 72: \"32\",\n};\n\n/**\n * Variants whose corner radius is size-driven (see {@link IconButton}): the `24`\n * size is squared (`rounded-xs`), every larger size stays circular. All other\n * variants are circular at every size.\n */\nconst SIZE_DRIVEN_SHAPE_VARIANTS = new Set<IconButtonVariant>([\n \"primary\",\n \"secondary\",\n \"tertiary\",\n \"outline\",\n \"error\",\n \"white\",\n \"black\",\n \"upsell\",\n \"overlay\",\n]);\n\n/** Variants that honour the `negative` (dark-surface) treatment. */\nconst NEGATIVE_AWARE_VARIANTS = new Set<IconButtonVariant>([\n \"primary\",\n \"secondary\",\n \"tertiary\",\n \"outline\",\n \"upsell\",\n]);\n\nconst DISABLED_FILL = \"disabled:bg-buttons-disabled-default disabled:text-content-disabled\";\nconst DISABLED_FILL_NEGATIVE =\n \"disabled:bg-buttons-disabled-negative disabled:text-content-disabled\";\nconst UPSELL =\n \"fv-upsell fv-upsell-shine bg-buttons-brand-default text-content-always-black not-disabled:hover:[--fv-upsell-end:var(--color-buttons-brand-hover)] not-disabled:active:[--fv-upsell-end:var(--color-buttons-brand-hover)]\";\nconst DISABLED_TRANSPARENT = \"disabled:text-content-disabled\";\nconst DISABLED_OPACITY = \"disabled:opacity-50\";\n\ntype VariantClasses = {\n default: string;\n disabled: string;\n negative?: string;\n negativeDisabled?: string;\n};\n\n/**\n * Icon button styling for every variant. The disabled treatment is expressed\n * with the CSS `disabled:` variant (not the `disabled` prop) so an ancestor\n * `<fieldset disabled>` is styled too; hover is guarded with `not-disabled:` so\n * it never fights the disabled state.\n */\nconst VARIANT_CLASSES: Record<IconButtonVariant, VariantClasses> = {\n primary: {\n default:\n \"bg-buttons-primary-default text-content-primary-inverted not-disabled:hover:bg-buttons-primary-hover not-disabled:active:bg-buttons-primary-hover\",\n disabled: DISABLED_FILL,\n negative:\n \"bg-buttons-primary-negative-default text-content-primary not-disabled:hover:bg-buttons-primary-negative-hover not-disabled:active:bg-buttons-primary-negative-hover\",\n negativeDisabled: DISABLED_FILL_NEGATIVE,\n },\n secondary: {\n default:\n \"bg-buttons-secondary-default text-content-primary not-disabled:hover:bg-buttons-secondary-hover not-disabled:active:bg-buttons-secondary-hover\",\n disabled: DISABLED_FILL,\n negative:\n \"bg-buttons-secondary-negative-default text-content-primary-inverted not-disabled:hover:bg-buttons-secondary-negative-hover not-disabled:active:bg-buttons-secondary-negative-hover\",\n negativeDisabled: DISABLED_FILL_NEGATIVE,\n },\n tertiary: {\n default:\n \"bg-transparent text-content-primary not-disabled:hover:bg-buttons-tertiary-hover not-disabled:active:bg-buttons-tertiary-hover\",\n disabled: DISABLED_TRANSPARENT,\n negative:\n \"bg-transparent text-content-primary-inverted not-disabled:hover:bg-buttons-tertiary-negative-hover not-disabled:active:bg-buttons-tertiary-negative-hover\",\n negativeDisabled: DISABLED_TRANSPARENT,\n },\n outline: {\n default:\n \"border border-buttons-outline-default bg-transparent text-content-primary not-disabled:hover:bg-buttons-outline-hover not-disabled:active:bg-buttons-outline-hover\",\n disabled: \"disabled:border-buttons-disabled-default disabled:text-content-disabled\",\n negative:\n \"border border-buttons-outline-negative-default bg-transparent text-content-primary-inverted not-disabled:hover:bg-buttons-outline-negative-hover not-disabled:active:bg-buttons-outline-negative-hover\",\n negativeDisabled: \"disabled:border-buttons-disabled-negative disabled:text-content-disabled\",\n },\n error: {\n default:\n \"bg-buttons-error-default text-content-always-white not-disabled:hover:bg-buttons-error-hover not-disabled:active:bg-buttons-error-hover\",\n disabled: DISABLED_FILL,\n },\n white: {\n default:\n \"bg-buttons-always-white-default text-content-always-black not-disabled:hover:bg-buttons-always-white-hover not-disabled:active:bg-buttons-always-white-hover\",\n disabled: DISABLED_FILL,\n },\n black: {\n default:\n \"bg-buttons-always-black-default text-content-always-white not-disabled:hover:bg-buttons-always-black-hover not-disabled:active:bg-buttons-always-black-hover\",\n disabled: DISABLED_FILL,\n },\n brand: {\n default:\n \"bg-content-always-black text-brand-primary-default hover:bg-brand-primary-default hover:text-content-always-black not-disabled:active:bg-brand-primary-default not-disabled:active:text-content-always-black\",\n disabled: DISABLED_OPACITY,\n },\n upsell: {\n default: UPSELL,\n negative: `${UPSELL} fv-upsell-negative`,\n disabled: DISABLED_FILL,\n negativeDisabled: DISABLED_FILL_NEGATIVE,\n },\n contrast: {\n default:\n \"bg-transparent text-content-always-white hover:bg-brand-primary-muted not-disabled:active:bg-brand-primary-muted\",\n disabled: DISABLED_OPACITY,\n },\n messaging: {\n default:\n \"bg-content-always-black text-brand-primary-default hover:bg-brand-primary-default hover:text-content-always-black not-disabled:active:bg-brand-primary-default not-disabled:active:text-content-always-black\",\n disabled: DISABLED_OPACITY,\n },\n navTray: {\n default:\n \"bg-transparent text-content-primary hover:bg-brand-primary-muted not-disabled:active:bg-brand-primary-muted\",\n disabled: DISABLED_OPACITY,\n },\n tertiaryDestructive: {\n default:\n \"bg-transparent text-error-content hover:bg-brand-primary-muted not-disabled:active:bg-brand-primary-muted\",\n disabled: DISABLED_OPACITY,\n },\n stop: {\n default:\n \"bg-buttons-primary-default text-content-primary-inverted hover:bg-buttons-brand-default hover:text-content-always-black not-disabled:active:bg-buttons-brand-default not-disabled:active:text-content-always-black\",\n disabled: DISABLED_OPACITY,\n },\n microphone: {\n default:\n \"bg-buttons-primary-default text-content-primary-inverted hover:bg-buttons-brand-default hover:text-content-always-black not-disabled:active:bg-buttons-brand-default not-disabled:active:text-content-always-black\",\n disabled: DISABLED_OPACITY,\n },\n overlay: {\n default:\n \"bg-buttons-overlay-default text-content-always-white backdrop-blur-sm not-disabled:hover:bg-buttons-overlay-hover not-disabled:active:bg-buttons-overlay-hover\",\n disabled: DISABLED_OPACITY,\n },\n // Carries the input surface rather than a button one, so an icon-only action can\n // sit flush in a row of fields (Figma draws these as a `V2 Input Fields` instance\n // with only an icon inside). Border and hover match the Select trigger it lines up\n // with, so the row reads as one control group.\n field: {\n default:\n \"border border-border-primary bg-inputs-inputs-primary text-content-primary not-disabled:hover:border-neutral-alphas-400\",\n disabled: DISABLED_TRANSPARENT,\n },\n};\n\nfunction getVariantClasses(variant: IconButtonVariant, negative: boolean): string {\n const classes = VARIANT_CLASSES[variant];\n const isNegative = NEGATIVE_AWARE_VARIANTS.has(variant) && negative;\n const base = (isNegative && classes.negative) || classes.default;\n const disabledClasses = (isNegative && classes.negativeDisabled) || classes.disabled;\n return cn(base, disabledClasses);\n}\n\nexport interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Visual style variant of the icon button. @default \"primary\" */\n variant?: IconButtonVariant;\n /** Size of the button in pixels. @default \"40\" */\n size?: IconButtonSize;\n /** Icon element to render inside the button. */\n icon: React.ReactNode;\n /**\n * Forces the dark-surface treatment regardless of theme. Only honoured on the\n * `primary`, `secondary`, `tertiary`, and `outline` variants. @default false\n */\n negative?: boolean;\n /** When provided, displays a {@link Count} badge at the top-right corner. */\n counterValue?: number;\n}\n\n/**\n * A button containing only an icon. Use when an action can be represented by an\n * icon alone (e.g. close, send). Always pair with an `aria-label` for\n * accessibility.\n *\n * Shape is size-driven for the standard variants, `upsell` and `overlay`: the `24` size is\n * squared (`rounded-xs`), every larger size is circular. Bespoke variants (`brand`,\n * `contrast`, `messaging`, `navTray`, `tertiaryDestructive`, `stop`,\n * `microphone`) stay circular at all sizes. `field` is the exception that is\n * never circular — it takes the inputs' `rounded-sm` so it matches the fields it\n * sits beside. Use it at `32`, `40` or `48`: those are the sizes `Select` offers,\n * and the variant only earns its surface when it lines up with one.\n *\n * @example\n * ```tsx\n * <IconButton icon={<CloseIcon />} aria-label=\"Close\" variant=\"tertiary\" />\n * ```\n */\nexport const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(\n (\n {\n className,\n variant = \"primary\",\n size = \"40\",\n icon,\n counterValue,\n negative = false,\n disabled = false,\n ...props\n },\n ref,\n ) => {\n if (process.env.NODE_ENV !== \"production\") {\n if (!props[\"aria-label\"] && !props[\"aria-labelledby\"] && !props.title) {\n console.warn(\n \"IconButton: No accessible name provided. Add an `aria-label`, `aria-labelledby`, or `title` prop so screen readers can announce this button.\",\n );\n }\n }\n\n return (\n <button\n ref={ref}\n type=\"button\"\n data-testid=\"icon-button\"\n disabled={disabled}\n className={cn(\n \"relative inline-flex shrink-0 items-center justify-center focus-visible:outline-none\",\n \"cursor-pointer transition-all duration-150 ease-in-out disabled:cursor-default\",\n \"focus-visible:shadow-focus-ring\",\n // `field` takes the inputs' radius at every size so it lines up with the\n // fields around it; everything else keeps the existing size-driven shape.\n variant === \"field\"\n ? \"rounded-sm\"\n : SIZE_DRIVEN_SHAPE_VARIANTS.has(variant) && size === \"24\"\n ? \"rounded-xs\"\n : \"rounded-full\",\n sizeVariants[size],\n getVariantClasses(variant, negative),\n className,\n )}\n {...props}\n >\n <span\n className={cn(\"flex shrink-0 items-center justify-center\", iconSizeVariants[size])}\n aria-hidden=\"true\"\n >\n {/* A button sizes its own icon, so a menu row's icon defaults stop here. */}\n <IconDefaultsContext.Provider value={NO_ICON_DEFAULTS}>\n {icon}\n </IconDefaultsContext.Provider>\n </span>\n\n {counterValue !== undefined && (\n <Count\n value={counterValue}\n variant=\"alert\"\n size={countSizeMap[size]}\n className=\"absolute -top-0.5 -right-0.5 z-10\"\n />\n )}\n </button>\n );\n },\n);\n\nIconButton.displayName = \"IconButton\";\n"],"names":[],"mappings":";;;;;;AAiDA,MAAM,mBAAmD;AAAA,EACvD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,eAA+C;AAAA,EACnD,IAA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QAAA;AAAA,MAEJ;AAAA,IACF;AAEA,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,MAAK;AAAA,QACL,eAAY;AAAA,QACZ;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA;AAAA;AAAA,UAGA,YAAY,UACR,eACA,2BAA2B,IAAI,OAAO,KAAK,SAAS,OAClD,eACA;AAAA,UACN,aAAa,IAAI;AAAA,UACjB,kBAAkB,SAAS,QAAQ;AAAA,UACnC;AAAA,QAAA;AAAA,QAED,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW,GAAG,6CAA6C,iBAAiB,IAAI,CAAC;AAAA,cACjF,eAAY;AAAA,cAGZ,8BAAC,oBAAoB,UAApB,EAA6B,OAAO,kBAClC,UAAA,KAAA,CACH;AAAA,YAAA;AAAA,UAAA;AAAA,UAGD,iBAAiB,UAChB;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,OAAO;AAAA,cACP,SAAQ;AAAA,cACR,MAAM,aAAa,IAAI;AAAA,cACvB,WAAU;AAAA,YAAA;AAAA,UAAA;AAAA,QACZ;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,WAAW,cAAc;"}
|
|
1
|
+
{"version":3,"file":"IconButton.mjs","sources":["../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Count, type CountSize } from \"../Count/Count\";\nimport { IconDefaultsContext, NO_ICON_DEFAULTS } from \"../Icons/IconDefaults\";\n\n/**\n * Visual style variant of the icon button.\n *\n * `primary`, `secondary`, `tertiary`, `outline`, `error`, `white` and `black`\n * use the shared button colour tokens and a size-driven shape (squared at the\n * `24` size, circular otherwise). Of these, `primary`, `secondary`, `tertiary`\n * and `outline` also honour the {@link IconButtonProps.negative} prop, as does\n * `upsell`, which takes the other theme's glow.\n *\n * `upsell` is the Figma \"Upsell\" icon button and matches `Button`'s `brand`\n * variant: a green radial fill, a green glow and a highlight that circles the\n * rim once, held still when the user prefers reduced motion. It takes the same\n * size-driven shape as the standard variants.\n *\n * `overlay` is a translucent dark fill with a backdrop blur, for buttons that sit\n * on photos or video. Its fill and icon look the same in light and dark themes, while\n * the keyboard focus ring still follows the theme. It takes the same size-driven\n * shape as the standard variants.\n *\n * `brand`, `contrast`, `messaging`, `navTray`, `tertiaryDestructive`, `stop` and\n * `microphone` are bespoke variants that stay circular at every size.\n */\nexport type IconButtonVariant =\n | \"primary\"\n | \"secondary\"\n | \"tertiary\"\n | \"outline\"\n | \"error\"\n | \"white\"\n | \"black\"\n | \"brand\"\n | \"upsell\"\n | \"contrast\"\n | \"messaging\"\n | \"navTray\"\n | \"tertiaryDestructive\"\n | \"stop\"\n | \"microphone\"\n | \"overlay\"\n | \"field\";\n\n/** Icon button size in pixels. */\nexport type IconButtonSize = \"24\" | \"32\" | \"40\" | \"48\" | \"52\" | \"72\";\n\nconst iconSizeVariants: Record<IconButtonSize, string> = {\n 24: \"[&>svg]:size-4\",\n 32: \"[&>svg]:size-4\",\n 40: \"[&>svg]:size-4\",\n 48: \"[&>svg]:size-6\",\n 52: \"[&>svg]:size-7\",\n 72: \"[&>svg]:size-8\",\n};\n\nconst sizeVariants: Record<IconButtonSize, string> = {\n 24: \"size-6 p-1\",\n 32: \"size-8 p-1.5\",\n 40: \"size-10 p-[10px]\",\n 48: \"size-12 p-3\",\n 52: \"size-[52px] p-2\",\n 72: \"size-[72px] p-4\",\n};\n\nconst countSizeMap: Record<IconButtonSize, CountSize> = {\n 24: \"16\",\n 32: \"24\",\n 40: \"32\",\n 48: \"32\",\n 52: \"32\",\n 72: \"32\",\n};\n\n/**\n * Variants whose corner radius is size-driven (see {@link IconButton}): the `24`\n * size is squared (`rounded-xs`), every larger size stays circular. All other\n * variants are circular at every size.\n */\nconst SIZE_DRIVEN_SHAPE_VARIANTS = new Set<IconButtonVariant>([\n \"primary\",\n \"secondary\",\n \"tertiary\",\n \"outline\",\n \"error\",\n \"white\",\n \"black\",\n \"upsell\",\n \"overlay\",\n]);\n\n/** Variants that honour the `negative` (dark-surface) treatment. */\nconst NEGATIVE_AWARE_VARIANTS = new Set<IconButtonVariant>([\n \"primary\",\n \"secondary\",\n \"tertiary\",\n \"outline\",\n \"upsell\",\n]);\n\nconst DISABLED_FILL = \"disabled:bg-buttons-disabled-default disabled:text-content-disabled\";\nconst DISABLED_FILL_NEGATIVE =\n \"disabled:bg-buttons-disabled-negative disabled:text-content-disabled\";\nconst UPSELL =\n \"fv-upsell fv-upsell-shine bg-buttons-brand-default text-content-always-black not-disabled:hover:[--fv-upsell-end:var(--color-buttons-brand-hover)] not-disabled:active:[--fv-upsell-end:var(--color-buttons-brand-hover)]\";\nconst DISABLED_TRANSPARENT = \"disabled:text-content-disabled\";\nconst DISABLED_OPACITY = \"disabled:opacity-50\";\n\ntype VariantClasses = {\n default: string;\n disabled: string;\n negative?: string;\n negativeDisabled?: string;\n};\n\n/**\n * Icon button styling for every variant. The disabled treatment is expressed\n * with the CSS `disabled:` variant (not the `disabled` prop) so an ancestor\n * `<fieldset disabled>` is styled too; hover is guarded with `not-disabled:` so\n * it never fights the disabled state.\n */\nconst VARIANT_CLASSES: Record<IconButtonVariant, VariantClasses> = {\n primary: {\n default:\n \"bg-buttons-primary-default text-content-primary-inverted not-disabled:hover:bg-buttons-primary-hover not-disabled:active:bg-buttons-primary-hover\",\n disabled: DISABLED_FILL,\n negative:\n \"bg-buttons-primary-negative-default text-content-primary not-disabled:hover:bg-buttons-primary-negative-hover not-disabled:active:bg-buttons-primary-negative-hover\",\n negativeDisabled: DISABLED_FILL_NEGATIVE,\n },\n secondary: {\n default:\n \"bg-buttons-secondary-default text-content-primary not-disabled:hover:bg-buttons-secondary-hover not-disabled:active:bg-buttons-secondary-hover\",\n disabled: DISABLED_FILL,\n negative:\n \"bg-buttons-secondary-negative-default text-content-primary-inverted not-disabled:hover:bg-buttons-secondary-negative-hover not-disabled:active:bg-buttons-secondary-negative-hover\",\n negativeDisabled: DISABLED_FILL_NEGATIVE,\n },\n tertiary: {\n default:\n \"bg-transparent text-content-primary not-disabled:hover:bg-buttons-tertiary-hover not-disabled:active:bg-buttons-tertiary-hover\",\n disabled: DISABLED_TRANSPARENT,\n negative:\n \"bg-transparent text-content-primary-inverted not-disabled:hover:bg-buttons-tertiary-negative-hover not-disabled:active:bg-buttons-tertiary-negative-hover\",\n negativeDisabled: DISABLED_TRANSPARENT,\n },\n outline: {\n default:\n \"border border-buttons-outline-default bg-transparent text-content-primary not-disabled:hover:bg-buttons-outline-hover not-disabled:active:bg-buttons-outline-hover\",\n disabled: \"disabled:border-buttons-disabled-default disabled:text-content-disabled\",\n negative:\n \"border border-buttons-outline-negative-default bg-transparent text-content-primary-inverted not-disabled:hover:bg-buttons-outline-negative-hover not-disabled:active:bg-buttons-outline-negative-hover\",\n negativeDisabled: \"disabled:border-buttons-disabled-negative disabled:text-content-disabled\",\n },\n error: {\n default:\n \"bg-buttons-error-default text-content-always-white not-disabled:hover:bg-buttons-error-hover not-disabled:active:bg-buttons-error-hover\",\n disabled: DISABLED_FILL,\n },\n white: {\n default:\n \"bg-buttons-always-white-default text-content-always-black not-disabled:hover:bg-buttons-always-white-hover not-disabled:active:bg-buttons-always-white-hover\",\n disabled: DISABLED_FILL,\n },\n black: {\n default:\n \"bg-buttons-always-black-default text-content-always-white not-disabled:hover:bg-buttons-always-black-hover not-disabled:active:bg-buttons-always-black-hover\",\n disabled: DISABLED_FILL,\n },\n brand: {\n default:\n \"bg-content-always-black text-brand-primary-default hover:bg-brand-primary-default hover:text-content-always-black not-disabled:active:bg-brand-primary-default not-disabled:active:text-content-always-black\",\n disabled: DISABLED_OPACITY,\n },\n upsell: {\n default: UPSELL,\n negative: `${UPSELL} fv-upsell-negative`,\n disabled: DISABLED_FILL,\n negativeDisabled: DISABLED_FILL_NEGATIVE,\n },\n contrast: {\n default:\n \"bg-transparent text-content-always-white hover:bg-brand-primary-muted not-disabled:active:bg-brand-primary-muted\",\n disabled: DISABLED_OPACITY,\n },\n messaging: {\n default:\n \"bg-content-always-black text-brand-primary-default hover:bg-brand-primary-default hover:text-content-always-black not-disabled:active:bg-brand-primary-default not-disabled:active:text-content-always-black\",\n disabled: DISABLED_OPACITY,\n },\n navTray: {\n default:\n \"bg-transparent text-content-primary hover:bg-brand-primary-muted not-disabled:active:bg-brand-primary-muted\",\n disabled: DISABLED_OPACITY,\n },\n tertiaryDestructive: {\n default:\n \"bg-transparent text-error-content hover:bg-brand-primary-muted not-disabled:active:bg-brand-primary-muted\",\n disabled: DISABLED_OPACITY,\n },\n stop: {\n default:\n \"bg-buttons-primary-default text-content-primary-inverted hover:bg-buttons-brand-default hover:text-content-always-black not-disabled:active:bg-buttons-brand-default not-disabled:active:text-content-always-black\",\n disabled: DISABLED_OPACITY,\n },\n microphone: {\n default:\n \"bg-buttons-primary-default text-content-primary-inverted hover:bg-buttons-brand-default hover:text-content-always-black not-disabled:active:bg-buttons-brand-default not-disabled:active:text-content-always-black\",\n disabled: DISABLED_OPACITY,\n },\n overlay: {\n default:\n \"bg-buttons-overlay-default text-content-always-white backdrop-blur-sm not-disabled:hover:bg-buttons-overlay-hover not-disabled:active:bg-buttons-overlay-hover\",\n disabled: DISABLED_OPACITY,\n },\n // Carries the input surface rather than a button one, so an icon-only action can\n // sit flush in a row of fields (Figma draws these as a `V2 Input Fields` instance\n // with only an icon inside). Border and hover match the Select trigger it lines up\n // with, so the row reads as one control group.\n field: {\n default:\n \"border border-border-input bg-inputs-inputs-primary text-content-primary not-disabled:hover:border-border-input-hover theme-v2:focus-visible:not-disabled:border-border-selected theme-v2:focus-visible:shadow-none\",\n disabled: cn(\n DISABLED_TRANSPARENT,\n \"theme-v2:disabled:border-transparent theme-v2:disabled:bg-inputs-inputs-disabled theme-v2:disabled:text-icons-disabled\",\n ),\n },\n};\n\nfunction getVariantClasses(variant: IconButtonVariant, negative: boolean): string {\n const classes = VARIANT_CLASSES[variant];\n const isNegative = NEGATIVE_AWARE_VARIANTS.has(variant) && negative;\n const base = (isNegative && classes.negative) || classes.default;\n const disabledClasses = (isNegative && classes.negativeDisabled) || classes.disabled;\n return cn(base, disabledClasses);\n}\n\nexport interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Visual style variant of the icon button. @default \"primary\" */\n variant?: IconButtonVariant;\n /** Size of the button in pixels. @default \"40\" */\n size?: IconButtonSize;\n /** Icon element to render inside the button. */\n icon: React.ReactNode;\n /**\n * Forces the dark-surface treatment regardless of theme. Only honoured on the\n * `primary`, `secondary`, `tertiary`, and `outline` variants. @default false\n */\n negative?: boolean;\n /** When provided, displays a {@link Count} badge at the top-right corner. */\n counterValue?: number;\n}\n\n/**\n * A button containing only an icon. Use when an action can be represented by an\n * icon alone (e.g. close, send). Always pair with an `aria-label` for\n * accessibility.\n *\n * Shape is size-driven for the standard variants, `upsell` and `overlay`: the `24` size is\n * squared (`rounded-xs`), every larger size is circular. Bespoke variants (`brand`,\n * `contrast`, `messaging`, `navTray`, `tertiaryDestructive`, `stop`,\n * `microphone`) stay circular at all sizes. `field` is the exception that is\n * never circular — it takes the inputs' `rounded-sm` so it matches the fields it\n * sits beside. Use it at `32`, `40` or `48`: those are the sizes `Select` offers,\n * and the variant only earns its surface when it lines up with one.\n *\n * @example\n * ```tsx\n * <IconButton icon={<CloseIcon />} aria-label=\"Close\" variant=\"tertiary\" />\n * ```\n */\nexport const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(\n (\n {\n className,\n variant = \"primary\",\n size = \"40\",\n icon,\n counterValue,\n negative = false,\n disabled = false,\n ...props\n },\n ref,\n ) => {\n if (process.env.NODE_ENV !== \"production\") {\n if (!props[\"aria-label\"] && !props[\"aria-labelledby\"] && !props.title) {\n console.warn(\n \"IconButton: No accessible name provided. Add an `aria-label`, `aria-labelledby`, or `title` prop so screen readers can announce this button.\",\n );\n }\n }\n\n return (\n <button\n ref={ref}\n type=\"button\"\n data-testid=\"icon-button\"\n disabled={disabled}\n className={cn(\n \"relative inline-flex shrink-0 items-center justify-center focus-visible:outline-none\",\n \"cursor-pointer transition-all duration-150 ease-in-out disabled:cursor-default\",\n \"focus-visible:shadow-focus-ring\",\n // `field` takes the inputs' radius at every size so it lines up with the\n // fields around it; everything else keeps the existing size-driven shape.\n variant === \"field\"\n ? \"rounded-sm\"\n : SIZE_DRIVEN_SHAPE_VARIANTS.has(variant) && size === \"24\"\n ? \"rounded-xs\"\n : \"rounded-full\",\n sizeVariants[size],\n getVariantClasses(variant, negative),\n className,\n )}\n {...props}\n >\n <span\n className={cn(\"flex shrink-0 items-center justify-center\", iconSizeVariants[size])}\n aria-hidden=\"true\"\n >\n {/* A button sizes its own icon, so a menu row's icon defaults stop here. */}\n <IconDefaultsContext.Provider value={NO_ICON_DEFAULTS}>\n {icon}\n </IconDefaultsContext.Provider>\n </span>\n\n {counterValue !== undefined && (\n <Count\n value={counterValue}\n variant=\"alert\"\n size={countSizeMap[size]}\n className=\"absolute -top-0.5 -right-0.5 z-10\"\n />\n )}\n </button>\n );\n },\n);\n\nIconButton.displayName = \"IconButton\";\n"],"names":[],"mappings":";;;;;;AAiDA,MAAM,mBAAmD;AAAA,EACvD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,eAA+C;AAAA,EACnD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,eAAkD;AAAA,EACtD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAOA,MAAM,iDAAiC,IAAuB;AAAA,EAC5D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,E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AAS,QAAQ;AAAA,UACnC;AAAA,QAAA;AAAA,QAED,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW,GAAG,6CAA6C,iBAAiB,IAAI,CAAC;AAAA,cACjF,eAAY;AAAA,cAGZ,8BAAC,oBAAoB,UAApB,EAA6B,OAAO,kBAClC,UAAA,KAAA,CACH;AAAA,YAAA;AAAA,UAAA;AAAA,UAGD,iBAAiB,UAChB;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,OAAO;AAAA,cACP,SAAQ;AAAA,cACR,MAAM,aAAa,IAAI;AAAA,cACvB,WAAU;AAAA,YAAA;AAAA,UAAA;AAAA,QACZ;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,WAAW,cAAc;"}
|
|
@@ -3,7 +3,13 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { cn } from "../../utils/cn.mjs";
|
|
4
4
|
import { IconDefaultsContext } from "./IconDefaults.mjs";
|
|
5
5
|
const MENU_ROW_ICON_DEFAULTS = { filled: true, size: 16 };
|
|
6
|
-
function MenuRowIcon({
|
|
6
|
+
function MenuRowIcon({
|
|
7
|
+
children,
|
|
8
|
+
inheritColor,
|
|
9
|
+
alignToTitle,
|
|
10
|
+
invertWhenSelected,
|
|
11
|
+
className
|
|
12
|
+
}) {
|
|
7
13
|
return /* @__PURE__ */ jsx(
|
|
8
14
|
"span",
|
|
9
15
|
{
|
|
@@ -12,7 +18,8 @@ function MenuRowIcon({ children, inheritColor, alignToTitle, className }) {
|
|
|
12
18
|
alignToTitle && "h-4.5",
|
|
13
19
|
!inheritColor && [
|
|
14
20
|
"text-icons-secondary",
|
|
15
|
-
"group-data-[disabled]:text-icons-disabled group-disabled:text-icons-disabled group-aria-disabled:text-icons-disabled"
|
|
21
|
+
"group-data-[disabled]:text-icons-disabled group-disabled:text-icons-disabled group-aria-disabled:text-icons-disabled",
|
|
22
|
+
invertWhenSelected && "theme-v2:group-data-[selected]:text-icons-primary-inverted theme-v2:group-data-[state=checked]:text-icons-primary-inverted"
|
|
16
23
|
],
|
|
17
24
|
className
|
|
18
25
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuRowIcon.mjs","sources":["../../../src/components/Icons/MenuRowIcon.tsx"],"sourcesContent":["import type * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { type IconDefaults, IconDefaultsContext } from \"./IconDefaults\";\n\nconst MENU_ROW_ICON_DEFAULTS: IconDefaults = { filled: true, size: 16 };\n\ninterface MenuRowIconProps {\n children: React.ReactNode;\n /** Keep the row's own colour (e.g. a destructive row's error red) instead of `Icons/Secondary`. */\n inheritColor?: boolean;\n /** Centre the icon on an 18px title line, for two-line rows aligned to their title. */\n alignToTitle?: boolean;\n className?: string;\n}\n\n/**\n * The icon slot of a menu or select row: a 16px box in `Icons/Secondary`, with\n * prop-based icons drawn filled at 16px unless they set their own `filled` or\n * `size`. The disabled variants cover every way a row is disabled: Radix's\n * `data-disabled`, a native `disabled` button and `aria-disabled`.
|
|
1
|
+
{"version":3,"file":"MenuRowIcon.mjs","sources":["../../../src/components/Icons/MenuRowIcon.tsx"],"sourcesContent":["import type * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { type IconDefaults, IconDefaultsContext } from \"./IconDefaults\";\n\nconst MENU_ROW_ICON_DEFAULTS: IconDefaults = { filled: true, size: 16 };\n\ninterface MenuRowIconProps {\n children: React.ReactNode;\n /** Keep the row's own colour (e.g. a destructive row's error red) instead of `Icons/Secondary`. */\n inheritColor?: boolean;\n /** Centre the icon on an 18px title line, for two-line rows aligned to their title. */\n alignToTitle?: boolean;\n /** Turn `Icons/Primary Inverted` when the row is selected under the v2 palette. Pass `false` for a disabled row. */\n invertWhenSelected?: boolean;\n className?: string;\n}\n\n/**\n * The icon slot of a menu or select row: a 16px box in `Icons/Secondary`, with\n * prop-based icons drawn filled at 16px unless they set their own `filled` or\n * `size`. The disabled variants cover every way a row is disabled: Radix's\n * `data-disabled`, a native `disabled` button and `aria-disabled`. With\n * `invertWhenSelected`, a selected row (`data-selected` or `data-state=\"checked\"`)\n * turns the icon `Icons/Primary Inverted` under the v2 palette. Internal to the package.\n */\nexport function MenuRowIcon({\n children,\n inheritColor,\n alignToTitle,\n invertWhenSelected,\n className,\n}: MenuRowIconProps) {\n return (\n <span\n className={cn(\n \"flex shrink-0 items-center [&>svg]:size-4\",\n alignToTitle && \"h-4.5\",\n !inheritColor && [\n \"text-icons-secondary\",\n \"group-data-[disabled]:text-icons-disabled group-disabled:text-icons-disabled group-aria-disabled:text-icons-disabled\",\n invertWhenSelected &&\n \"theme-v2:group-data-[selected]:text-icons-primary-inverted theme-v2:group-data-[state=checked]:text-icons-primary-inverted\",\n ],\n className,\n )}\n >\n <IconDefaultsContext.Provider value={MENU_ROW_ICON_DEFAULTS}>\n {children}\n </IconDefaultsContext.Provider>\n </span>\n );\n}\n"],"names":[],"mappings":";;;;AAIA,MAAM,yBAAuC,EAAE,QAAQ,MAAM,MAAM,GAAA;AAqB5D,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAqB;AACnB,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,gBAAgB;AAAA,QAChB,CAAC,gBAAgB;AAAA,UACf;AAAA,UACA;AAAA,UACA,sBACE;AAAA,QAAA;AAAA,QAEJ;AAAA,MAAA;AAAA,MAGF,8BAAC,oBAAoB,UAApB,EAA6B,OAAO,wBAClC,SAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -6,51 +6,45 @@ const VARIANTS = {
|
|
|
6
6
|
16: {
|
|
7
7
|
outlined: [
|
|
8
8
|
{
|
|
9
|
-
d: "
|
|
10
|
-
sw: 1
|
|
9
|
+
d: "M7.193 10.113a.5.5 0 0 1-.353-.147L5.227 8.353a.503.503 0 0 1 0-.707.503.503 0 0 1 .706 0l1.26 1.26L10.06 6.04a.503.503 0 0 1 .707 0 .503.503 0 0 1 0 .706l-3.22 3.22a.5.5 0 0 1-.354.147"
|
|
11
10
|
},
|
|
12
11
|
{
|
|
13
|
-
d: "
|
|
12
|
+
d: "M8 15.167c-.42 0-.84-.14-1.167-.42L5.78 13.84a1 1 0 0 0-.513-.187H4.12c-.987 0-1.787-.8-1.787-1.786v-1.14a1 1 0 0 0-.186-.507l-.9-1.06C.7 8.513.7 7.493 1.247 6.847l.9-1.06a1 1 0 0 0 .186-.507V4.133c0-.986.8-1.786 1.787-1.786h1.153c.14 0 .407-.1.514-.187l1.053-.907a1.82 1.82 0 0 1 2.327 0l1.053.907c.107.093.373.187.513.187h1.134c.986 0 1.786.8 1.786 1.786v1.134c0 .14.1.406.194.513l.906 1.053c.56.654.56 1.674 0 2.327l-.906 1.053a1.03 1.03 0 0 0-.194.514v1.133c0 .987-.8 1.787-1.786 1.787h-1.134c-.14 0-.406.1-.513.186l-1.053.907A1.76 1.76 0 0 1 8 15.167M4.12 3.347a.79.79 0 0 0-.787.786v1.14c0 .38-.18.867-.426 1.154l-.9 1.06c-.234.273-.234.746 0 1.02l.9 1.06c.246.293.426.773.426 1.153v1.14a.79.79 0 0 0 .787.787h1.153c.387 0 .874.18 1.167.433l1.053.907c.274.233.754.233 1.027 0l1.053-.907c.294-.247.78-.433 1.167-.433h1.133a.79.79 0 0 0 .787-.787v-1.133c0-.387.18-.874.433-1.167L14 8.507c.233-.274.233-.754 0-1.027l-.907-1.053a1.96 1.96 0 0 1-.433-1.167V4.133a.79.79 0 0 0-.787-.786H10.74c-.387 0-.873-.18-1.167-.434L8.52 2.007c-.273-.234-.753-.234-1.027 0L6.44 2.92a2 2 0 0 1-1.167.427z"
|
|
14
13
|
}
|
|
15
14
|
],
|
|
16
15
|
filled: [
|
|
17
16
|
{
|
|
18
|
-
d: "
|
|
19
|
-
eo: true
|
|
17
|
+
d: "m14.373 7.16-.906-1.053a1.5 1.5 0 0 1-.314-.84V4.134c0-.707-.58-1.287-1.286-1.287h-1.134c-.26 0-.64-.14-.84-.313L8.84 1.627c-.46-.393-1.213-.393-1.68 0l-1.047.913c-.2.167-.58.307-.84.307H4.12c-.707 0-1.287.58-1.287 1.287v1.14c0 .26-.14.633-.306.833l-.9 1.06c-.387.46-.387 1.207 0 1.667l.9 1.06c.166.2.306.573.306.833v1.14c0 .707.58 1.287 1.287 1.287h1.153c.26 0 .64.14.84.313l1.054.907c.46.393 1.213.393 1.68 0l1.053-.907c.2-.173.573-.313.84-.313h1.133c.707 0 1.287-.58 1.287-1.287v-1.133c0-.26.14-.64.313-.84l.907-1.054c.387-.46.387-1.22-.007-1.68m-3.6-.42-3.22 3.22a.5.5 0 0 1-.706 0L5.233 8.347a.503.503 0 0 1 0-.707.503.503 0 0 1 .707 0L7.2 8.9l2.867-2.866a.503.503 0 0 1 .706 0 .503.503 0 0 1 0 .706"
|
|
20
18
|
}
|
|
21
19
|
]
|
|
22
20
|
},
|
|
23
21
|
24: {
|
|
24
22
|
outlined: [
|
|
25
23
|
{
|
|
26
|
-
d: "
|
|
27
|
-
sw: 1.5
|
|
24
|
+
d: "M10.79 15.17a.75.75 0 0 1-.53-.22l-2.42-2.42a.754.754 0 0 1 0-1.06c.29-.29.77-.29 1.06 0l1.89 1.89 4.3-4.3c.29-.29.77-.29 1.06 0s.29.77 0 1.06l-4.83 4.83a.75.75 0 0 1-.53.22"
|
|
28
25
|
},
|
|
29
26
|
{
|
|
30
|
-
d: "
|
|
27
|
+
d: "M12 22.75c-.63 0-1.26-.21-1.75-.63l-1.58-1.36c-.16-.14-.56-.28-.77-.28H6.18A2.68 2.68 0 0 1 3.5 17.8v-1.71c0-.21-.14-.6-.28-.76l-1.35-1.59c-.82-.97-.82-2.5 0-3.47l1.35-1.59c.14-.16.28-.55.28-.76V6.2c0-1.48 1.2-2.68 2.68-2.68h1.73c.21 0 .61-.15.77-.28l1.58-1.36c.98-.84 2.51-.84 3.49 0l1.58 1.36c.16.14.56.28.77.28h1.7c1.48 0 2.68 1.2 2.68 2.68v1.7c0 .21.15.61.29.77l1.36 1.58c.84.98.84 2.51 0 3.49l-1.36 1.58c-.14.16-.29.56-.29.77v1.7c0 1.48-1.2 2.68-2.68 2.68h-1.7c-.21 0-.61.15-.77.28l-1.58 1.36c-.49.43-1.12.64-1.75.64M6.18 5.02C5.53 5.02 5 5.55 5 6.2v1.71c0 .57-.27 1.3-.64 1.73l-1.35 1.59c-.35.41-.35 1.12 0 1.53l1.35 1.59c.37.44.64 1.16.64 1.73v1.71c0 .65.53 1.18 1.18 1.18h1.73c.58 0 1.31.27 1.75.65l1.58 1.36c.41.35 1.13.35 1.54 0l1.58-1.36c.44-.37 1.17-.65 1.75-.65h1.7c.65 0 1.18-.53 1.18-1.18v-1.7c0-.58.27-1.31.65-1.75L21 12.76c.35-.41.35-1.13 0-1.54l-1.36-1.58c-.38-.44-.65-1.17-.65-1.75V6.2c0-.65-.53-1.18-1.18-1.18h-1.7c-.58 0-1.31-.27-1.75-.65l-1.58-1.36c-.41-.35-1.13-.35-1.54 0L9.66 4.38c-.44.37-1.18.64-1.75.64z"
|
|
31
28
|
}
|
|
32
29
|
],
|
|
33
30
|
filled: [
|
|
34
31
|
{
|
|
35
|
-
d: "M21.
|
|
36
|
-
eo: true
|
|
32
|
+
d: "M21.56 10.74 20.2 9.16c-.26-.3-.47-.86-.47-1.26V6.2c0-1.06-.87-1.93-1.93-1.93h-1.7c-.39 0-.96-.21-1.26-.47l-1.58-1.36c-.69-.59-1.82-.59-2.52 0L9.17 3.81c-.3.25-.87.46-1.26.46H6.18c-1.06 0-1.93.87-1.93 1.93v1.71c0 .39-.21.95-.46 1.25l-1.35 1.59c-.58.69-.58 1.81 0 2.5l1.35 1.59c.25.3.46.86.46 1.25v1.71c0 1.06.87 1.93 1.93 1.93h1.73c.39 0 .96.21 1.26.47l1.58 1.36c.69.59 1.82.59 2.52 0l1.58-1.36c.3-.26.86-.47 1.26-.47h1.7c1.06 0 1.93-.87 1.93-1.93v-1.7c0-.39.21-.96.47-1.26l1.36-1.58c.58-.69.58-1.83-.01-2.52m-5.4-.63-4.83 4.83a.75.75 0 0 1-1.06 0l-2.42-2.42a.754.754 0 0 1 0-1.06c.29-.29.77-.29 1.06 0l1.89 1.89 4.3-4.3c.29-.29.77-.29 1.06 0s.29.77 0 1.06"
|
|
37
33
|
}
|
|
38
34
|
]
|
|
39
35
|
},
|
|
40
36
|
32: {
|
|
41
37
|
outlined: [
|
|
42
38
|
{
|
|
43
|
-
d: "
|
|
44
|
-
sw: 2
|
|
39
|
+
d: "M14.387 20.226a1 1 0 0 1-.707-.294l-3.227-3.226a1.006 1.006 0 0 1 0-1.414 1.006 1.006 0 0 1 1.413 0l2.52 2.52 5.734-5.733a1.006 1.006 0 0 1 1.413 0 1.006 1.006 0 0 1 0 1.413l-6.44 6.44a1 1 0 0 1-.707.294"
|
|
45
40
|
},
|
|
46
41
|
{
|
|
47
|
-
d: "
|
|
42
|
+
d: "M16 30.333c-.84 0-1.68-.28-2.334-.84L11.56 27.68c-.213-.187-.746-.373-1.026-.373H8.24a3.574 3.574 0 0 1-3.574-3.574v-2.28c0-.28-.186-.8-.373-1.013l-1.8-2.12c-1.093-1.294-1.093-3.334 0-4.627l1.8-2.12c.187-.213.373-.733.373-1.013V8.267c0-1.974 1.6-3.574 3.574-3.574h2.306c.28 0 .814-.2 1.027-.373l2.107-1.814c1.306-1.12 3.346-1.12 4.653 0L20.44 4.32c.213.186.746.373 1.026.373h2.267c1.973 0 3.573 1.6 3.573 3.574v2.266c0 .28.2.814.387 1.027l1.813 2.106c1.12 1.307 1.12 3.347 0 4.654l-1.813 2.107c-.187.213-.387.746-.387 1.026v2.267c0 1.973-1.6 3.573-3.573 3.573h-2.267c-.28 0-.813.2-1.027.373l-2.106 1.814c-.653.573-1.493.853-2.333.853M8.24 6.693c-.867 0-1.574.707-1.574 1.574v2.28c0 .76-.36 1.733-.853 2.306l-1.8 2.12c-.467.547-.467 1.493 0 2.04l1.8 2.12c.493.587.853 1.547.853 2.307v2.28c0 .867.707 1.573 1.574 1.573h2.306c.774 0 1.747.36 2.334.867l2.106 1.813c.547.467 1.507.467 2.053 0l2.107-1.813c.587-.494 1.56-.867 2.334-.867h2.266c.867 0 1.574-.706 1.574-1.573v-2.267c0-.773.36-1.747.866-2.333L28 17.013c.466-.547.466-1.507 0-2.053l-1.814-2.107c-.506-.586-.866-1.56-.866-2.333V8.267c0-.867-.707-1.574-1.574-1.574H21.48c-.774 0-1.747-.36-2.334-.866L17.04 4.013c-.546-.466-1.506-.466-2.053 0L12.88 5.84c-.586.493-1.573.853-2.333.853z"
|
|
48
43
|
}
|
|
49
44
|
],
|
|
50
45
|
filled: [
|
|
51
46
|
{
|
|
52
|
-
d: "
|
|
53
|
-
eo: true
|
|
47
|
+
d: "m28.747 14.32-1.814-2.106c-.346-.4-.626-1.147-.626-1.68V8.267a2.583 2.583 0 0 0-2.574-2.573h-2.266c-.52 0-1.28-.28-1.68-.627L17.68 3.254c-.92-.787-2.427-.787-3.36 0l-2.093 1.827c-.4.333-1.16.613-1.68.613H8.24a2.583 2.583 0 0 0-2.573 2.573v2.28c0 .52-.28 1.267-.614 1.667l-1.8 2.12c-.773.92-.773 2.413 0 3.333l1.8 2.12c.334.4.614 1.147.614 1.667v2.28a2.583 2.583 0 0 0 2.573 2.573h2.307c.52 0 1.28.28 1.68.627l2.106 1.813c.92.787 2.427.787 3.36 0l2.107-1.813c.4-.347 1.147-.627 1.68-.627h2.267a2.583 2.583 0 0 0 2.573-2.573v-2.267c0-.52.28-1.28.627-1.68l1.813-2.106c.773-.92.773-2.44-.013-3.36m-7.2-.84-6.44 6.44a1 1 0 0 1-1.414 0l-3.226-3.226a1.006 1.006 0 0 1 0-1.413 1.006 1.006 0 0 1 1.413 0l2.52 2.52 5.733-5.734a1.006 1.006 0 0 1 1.414 0 1.006 1.006 0 0 1 0 1.414"
|
|
54
48
|
}
|
|
55
49
|
]
|
|
56
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerifiedIcon.mjs","sources":["../../../src/components/Icons/VerifiedIcon.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { BaseIcon } from \"./BaseIcon\";\nimport type { BaseIconProps, IconVariants } from \"./types\";\n\nconst VARIANTS: IconVariants = {\n 16: {\n outlined: [\n {\n d: \"M14.1051 9.4044C14.8084 8.6002 14.8084 7.3998 14.1051 6.5956L13.9891 6.4629C13.8087 6.2567 13.7209 5.9856 13.746 5.7128L13.7618 5.5419C13.8599 4.4763 13.1535 3.5029 12.11 3.2658L11.947 3.2288C11.6787 3.1679 11.4474 2.9991 11.3075 2.7622L11.221 2.6158C10.6753 1.6919 9.5283 1.3171 8.5423 1.7404L8.3946 1.8039C8.1427 1.9121 7.8573 1.9121 7.6054 1.8039L7.4553 1.7394C6.4703 1.3165 5.3245 1.69 4.7781 2.6122L4.6934 2.7552C4.553 2.9923 4.3209 3.1609 4.052 3.2212L3.8955 3.2563C2.8495 3.491 2.1401 4.4656 2.2382 5.5331L2.2542 5.7074C2.2792 5.9794 2.1918 6.2499 2.0123 6.4558L1.8902 6.5959C1.1893 7.4003 1.1903 8.5988 1.8927 9.4019L2.011 9.5372C2.1913 9.7433 2.2792 10.0143 2.2541 10.287L2.2377 10.4652C2.1398 11.5306 2.8462 12.5037 3.8896 12.7407L4.0538 12.7781C4.3216 12.8389 4.5526 13.0072 4.6926 13.2435L4.7757 13.3837C5.3231 14.3077 6.472 14.6807 7.4577 14.2545L7.6045 14.191C7.8569 14.0819 8.1432 14.0815 8.3959 14.19L8.5447 14.2539C9.5297 14.6769 10.6755 14.3033 11.2219 13.3811L11.3074 13.2368C11.4473 13.0005 11.6784 12.8322 11.9462 12.7714L12.11 12.7342C13.1535 12.4971 13.8599 11.5237 13.7618 10.4581L13.746 10.2871C13.7209 10.0144 13.8087 9.7433 13.9891 9.5371L14.1051 9.4044Z\",\n sw: 1,\n },\n {\n d: \"M6.9627 10.91C6.8325 11.0406 6.6209 11.0406 6.4906 10.91L4.4284 8.8424C4.2985 8.7121 4.2987 8.5013 4.4287 8.3713L4.9438 7.8562C5.0742 7.7259 5.2856 7.7261 5.4157 7.8567L6.7267 9.1733L10.3909 5.4965C10.5211 5.366 10.7325 5.3658 10.8628 5.4961L11.3779 6.0113C11.508 6.1413 11.5081 6.3521 11.3783 6.4824L6.9627 10.91Z\",\n },\n ],\n filled: [\n {\n d: \"M14.1051 9.4044C14.8084 8.6002 14.8084 7.3998 14.1051 6.5956L13.9891 6.4629C13.8087 6.2567 13.7209 5.9856 13.746 5.7128L13.7618 5.5419C13.8599 4.4763 13.1535 3.5029 12.11 3.2658L11.947 3.2288C11.6787 3.1679 11.4474 2.9991 11.3075 2.7622L11.221 2.6158C10.6753 1.6919 9.5283 1.3171 8.5423 1.7404L8.3946 1.8039C8.1427 1.9121 7.8573 1.9121 7.6054 1.8039L7.4553 1.7394C6.4703 1.3165 5.3245 1.69 4.7781 2.6122L4.6934 2.7552C4.553 2.9923 4.3209 3.1609 4.052 3.2212L3.8955 3.2563C2.8495 3.491 2.1401 4.4656 2.2382 5.5331L2.2542 5.7074C2.2792 5.9794 2.1918 6.2499 2.0123 6.4558L1.8902 6.5959C1.1893 7.4003 1.1903 8.5988 1.8927 9.4019L2.011 9.5372C2.1913 9.7433 2.2792 10.0143 2.2541 10.287L2.2377 10.4652C2.1398 11.5306 2.8462 12.5037 3.8896 12.7407L4.0538 12.7781C4.3216 12.8389 4.5526 13.0072 4.6926 13.2435L4.7757 13.3837C5.3231 14.3077 6.472 14.6807 7.4577 14.2545L7.6045 14.191C7.8569 14.0819 8.1432 14.0815 8.3959 14.19L8.5447 14.2539C9.5297 14.6769 10.6755 14.3033 11.2219 13.3811L11.3074 13.2368C11.4473 13.0005 11.6784 12.8322 11.9462 12.7714L12.11 12.7342C13.1535 12.4971 13.8599 11.5237 13.7618 10.4581L13.746 10.2871C13.7209 10.0144 13.8087 9.7433 13.9891 9.5371L14.1051 9.4044ZM6.9627 10.91C6.8325 11.0406 6.6209 11.0406 6.4906 10.91L4.4284 8.8424C4.2985 8.7121 4.2987 8.5013 4.4287 8.3713L4.9438 7.8562C5.0742 7.7259 5.2856 7.7261 5.4157 7.8567L6.7267 9.1733L10.3909 5.4965C10.5211 5.366 10.7325 5.3658 10.8628 5.4961L11.3779 6.0113C11.508 6.1413 11.5081 6.3521 11.3783 6.4824L6.9627 10.91Z\",\n eo: true,\n },\n ],\n },\n 24: {\n outlined: [\n {\n d: \"M21.158 14.107a3.2 3.2 0 0 0 0-4.214l-.174-.199a1.5 1.5 0 0 1-.365-1.125l.024-.256a3.2 3.2 0 0 0-2.478-3.414l-.244-.056a1.5 1.5 0 0 1-.96-.7l-.13-.22a3.2 3.2 0 0 0-4.017-1.312l-.222.095a1.5 1.5 0 0 1-1.184 0l-.225-.097a3.2 3.2 0 0 0-4.016 1.31l-.127.214a1.5 1.5 0 0 1-.962.699l-.235.052A3.2 3.2 0 0 0 3.357 8.3l.024.261a1.5 1.5 0 0 1-.363 1.123l-.183.21a3.2 3.2 0 0 0 .004 4.209l.178.203c.27.309.402.716.364 1.125l-.024.267a3.2 3.2 0 0 0 2.477 3.413l.247.056a1.5 1.5 0 0 1 .958.698l.125.21a3.2 3.2 0 0 0 4.023 1.307l.22-.096a1.5 1.5 0 0 1 1.187-.001l.223.096a3.2 3.2 0 0 0 4.016-1.31l.128-.216a1.5 1.5 0 0 1 .958-.698l.246-.056a3.2 3.2 0 0 0 2.478-3.414l-.024-.256a1.5 1.5 0 0 1 .365-1.125z\",\n sw: 1.5,\n },\n {\n d: \"M10.444 16.365a.5.5 0 0 1-.708 0l-3.093-3.101a.5.5 0 0 1 0-.707l.773-.773a.5.5 0 0 1 .708.001l1.966 1.975 5.496-5.515a.5.5 0 0 1 .708 0l.773.772a.5.5 0 0 1 0 .707z\",\n },\n ],\n filled: [\n {\n d: \"M21.158 14.107a3.2 3.2 0 0 0 0-4.214l-.174-.199a1.5 1.5 0 0 1-.365-1.125l.024-.256a3.2 3.2 0 0 0-2.478-3.414l-.244-.056a1.5 1.5 0 0 1-.96-.7l-.13-.22a3.2 3.2 0 0 0-4.017-1.312l-.222.095a1.5 1.5 0 0 1-1.184 0l-.225-.097a3.2 3.2 0 0 0-4.016 1.31l-.127.214a1.5 1.5 0 0 1-.962.699l-.235.052A3.2 3.2 0 0 0 3.357 8.3l.024.261a1.5 1.5 0 0 1-.363 1.123l-.183.21a3.2 3.2 0 0 0 .004 4.209l.178.203c.27.309.402.716.364 1.125l-.024.267a3.2 3.2 0 0 0 2.477 3.413l.247.056a1.5 1.5 0 0 1 .958.698l.125.21a3.2 3.2 0 0 0 4.023 1.307l.22-.096a1.5 1.5 0 0 1 1.187-.001l.223.096a3.2 3.2 0 0 0 4.016-1.31l.128-.216a1.5 1.5 0 0 1 .958-.698l.246-.056a3.2 3.2 0 0 0 2.478-3.414l-.024-.256a1.5 1.5 0 0 1 .365-1.125zm-10.714 2.258a.5.5 0 0 1-.708 0l-3.093-3.101a.5.5 0 0 1 0-.707l.773-.773a.5.5 0 0 1 .708.001l1.966 1.975 5.496-5.515a.5.5 0 0 1 .708 0l.773.772a.5.5 0 0 1 0 .707z\",\n eo: true,\n },\n ],\n },\n 32: {\n outlined: [\n {\n d: \"M28.2103 18.8088C29.6168 17.2004 29.6168 14.7996 28.2103 13.1912L27.9781 12.9258C27.6175 12.5134 27.4417 11.9712 27.492 11.4257L27.5236 11.0838C27.7199 8.9526 26.3071 7.0057 24.22 6.5317L23.894 6.4576C23.3575 6.3357 22.8948 5.9982 22.6149 5.5244L22.442 5.2316C21.3507 3.3838 19.0567 2.6341 17.0847 3.4809L16.7892 3.6078C16.2853 3.8242 15.7147 3.8242 15.2108 3.6078L14.9105 3.4788C12.9407 2.6329 10.649 3.3801 9.5562 5.2245L9.3869 5.5104C9.1059 5.9845 8.6418 6.3217 8.1041 6.4424L7.791 6.5126C5.6989 6.9821 4.2802 8.9311 4.4764 11.0662L4.5084 11.4147C4.5584 11.9588 4.3836 12.4997 4.0246 12.9117L3.7804 13.1919C2.3785 14.8005 2.3807 17.1976 3.7854 18.8037L4.0221 19.0744C4.3826 19.4867 4.5583 20.0287 4.5082 20.574L4.4754 20.9304C4.2796 23.0612 5.6925 25.0075 7.7791 25.4815L8.1076 25.5561C8.6432 25.6777 9.1053 26.0144 9.3853 26.4869L9.5515 26.7675C10.6463 28.6153 12.944 29.3613 14.9155 28.5089L15.2091 28.382C15.7139 28.1637 16.2864 28.1629 16.7919 28.38L17.0895 28.5079C19.0593 29.3537 21.3511 28.6065 22.4437 26.7621L22.6148 26.4736C22.8947 26.0011 23.3568 25.6644 23.8924 25.5428L24.22 25.4684C26.3071 24.9943 27.7199 23.0473 27.5236 20.9161L27.492 20.5743C27.4417 20.0288 27.6175 19.4865 27.9781 19.0741L28.2103 18.8088Z\",\n sw: 2,\n },\n {\n d: \"M13.9253 21.82C13.6649 22.0812 13.2418 22.0812 12.9813 21.82L8.8568 17.6848C8.5971 17.4243 8.5973 17.0027 8.8575 16.7425L9.8876 15.7124C10.1483 15.4517 10.5712 15.4521 10.8314 15.7135L13.4533 18.3467L20.7819 10.993C21.0421 10.7319 21.4649 10.7315 21.7256 10.9922L22.7559 12.0226C23.016 12.2827 23.0163 12.7043 22.7565 12.9647L13.9253 21.82Z\",\n },\n ],\n filled: [\n {\n d: \"M28.2103 18.8088C29.6168 17.2004 29.6168 14.7996 28.2103 13.1912L27.9781 12.9258C27.6175 12.5134 27.4417 11.9712 27.492 11.4257L27.5236 11.0838C27.7199 8.9526 26.3071 7.0057 24.22 6.5317L23.894 6.4576C23.3575 6.3357 22.8948 5.9982 22.6149 5.5244L22.442 5.2316C21.3507 3.3838 19.0567 2.6341 17.0847 3.4809L16.7892 3.6078C16.2853 3.8242 15.7147 3.8242 15.2108 3.6078L14.9105 3.4788C12.9407 2.6329 10.649 3.3801 9.5562 5.2245L9.3869 5.5104C9.1059 5.9845 8.6418 6.3217 8.1041 6.4424L7.791 6.5126C5.6989 6.9821 4.2802 8.9311 4.4764 11.0662L4.5084 11.4147C4.5584 11.9588 4.3836 12.4997 4.0246 12.9117L3.7804 13.1919C2.3785 14.8005 2.3807 17.1976 3.7854 18.8037L4.0221 19.0744C4.3826 19.4867 4.5583 20.0287 4.5082 20.574L4.4754 20.9304C4.2796 23.0612 5.6925 25.0075 7.7791 25.4815L8.1076 25.5561C8.6432 25.6777 9.1053 26.0144 9.3853 26.4869L9.5515 26.7675C10.6463 28.6153 12.944 29.3613 14.9155 28.5089L15.2091 28.382C15.7139 28.1637 16.2864 28.1629 16.7919 28.38L17.0895 28.5079C19.0593 29.3537 21.3511 28.6065 22.4437 26.7621L22.6148 26.4736C22.8947 26.0011 23.3568 25.6644 23.8924 25.5428L24.22 25.4684C26.3071 24.9943 27.7199 23.0473 27.5236 20.9161L27.492 20.5743C27.4417 20.0288 27.6175 19.4865 27.9781 19.0741L28.2103 18.8088ZM13.9253 21.82C13.6649 22.0812 13.2418 22.0812 12.9813 21.82L8.8568 17.6848C8.5971 17.4243 8.5973 17.0027 8.8575 16.7425L9.8876 15.7124C10.1483 15.4517 10.5712 15.4521 10.8314 15.7135L13.4533 18.3467L20.7819 10.993C21.0421 10.7319 21.4649 10.7315 21.7256 10.9922L22.7559 12.0226C23.016 12.2827 23.0163 12.7043 22.7565 12.9647L13.9253 21.82Z\",\n eo: true,\n },\n ],\n },\n};\n\n/** Props for {@link VerifiedIcon}. See {@link BaseIconProps} for the shared shape. */\nexport type VerifiedIconProps = BaseIconProps;\n\n/**\n * Verified badge icon. Renders at sizes 16, 24, or 32 px with outlined and filled variants.\n * Defaults to the filled variant.\n *\n * @example\n * ```tsx\n * <VerifiedIcon size={24} />\n * ```\n */\nexport const VerifiedIcon = React.forwardRef<SVGSVGElement, VerifiedIconProps>(\n ({ filled = true, ...props }, ref) => (\n <BaseIcon ref={ref} variants={VARIANTS} filled={filled} {...props} />\n ),\n);\n\nVerifiedIcon.displayName = \"VerifiedIcon\";\n"],"names":[],"mappings":";;;;AAIA,MAAM,WAAyB;AAAA,EAC7B,IAAI;AAAA,IACF,UAAU;AAAA,MACR;AAAA,QACE,GAAG;AAAA,QACH,IAAI;AAAA,MAAA;AAAA,MAEN;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,IAEF,QAAQ;AAAA,MACN;AAAA,QACE,GAAG;AAAA,QACH,IAAI;AAAA,MAAA;AAAA,IACN;AAAA,EACF;AAAA,EAEF,IAAI;AAAA,IACF,UAAU;AAAA,MACR;AAAA,QACE,GAAG;AAAA,QACH,IAAI;AAAA,MAAA;AAAA,MAEN;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,IAEF,QAAQ;AAAA,MACN;AAAA,QACE,GAAG;AAAA,QACH,IAAI;AAAA,MAAA;AAAA,IACN;AAAA,EACF;AAAA,EAEF,IAAI;AAAA,IACF,UAAU;AAAA,MACR;AAAA,QACE,GAAG;AAAA,QACH,IAAI;AAAA,MAAA;AAAA,MAEN;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,IAEF,QAAQ;AAAA,MACN;AAAA,QACE,GAAG;AAAA,QACH,IAAI;AAAA,MAAA;AAAA,IACN;AAAA,EACF;AAEJ;AAcO,MAAM,eAAe,MAAM;AAAA,EAChC,CAAC,EAAE,SAAS,MAAM,GAAG,MAAA,GAAS,QAC5B,oBAAC,YAAS,KAAU,UAAU,UAAU,QAAiB,GAAG,MAAA,CAAO;AAEvE;AAEA,aAAa,cAAc;"}
|
|
1
|
+
{"version":3,"file":"VerifiedIcon.mjs","sources":["../../../src/components/Icons/VerifiedIcon.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { BaseIcon } from \"./BaseIcon\";\nimport type { BaseIconProps, IconVariants } from \"./types\";\n\nconst VARIANTS: IconVariants = {\n 16: {\n outlined: [\n {\n d: \"M7.193 10.113a.5.5 0 0 1-.353-.147L5.227 8.353a.503.503 0 0 1 0-.707.503.503 0 0 1 .706 0l1.26 1.26L10.06 6.04a.503.503 0 0 1 .707 0 .503.503 0 0 1 0 .706l-3.22 3.22a.5.5 0 0 1-.354.147\",\n },\n {\n d: \"M8 15.167c-.42 0-.84-.14-1.167-.42L5.78 13.84a1 1 0 0 0-.513-.187H4.12c-.987 0-1.787-.8-1.787-1.786v-1.14a1 1 0 0 0-.186-.507l-.9-1.06C.7 8.513.7 7.493 1.247 6.847l.9-1.06a1 1 0 0 0 .186-.507V4.133c0-.986.8-1.786 1.787-1.786h1.153c.14 0 .407-.1.514-.187l1.053-.907a1.82 1.82 0 0 1 2.327 0l1.053.907c.107.093.373.187.513.187h1.134c.986 0 1.786.8 1.786 1.786v1.134c0 .14.1.406.194.513l.906 1.053c.56.654.56 1.674 0 2.327l-.906 1.053a1.03 1.03 0 0 0-.194.514v1.133c0 .987-.8 1.787-1.786 1.787h-1.134c-.14 0-.406.1-.513.186l-1.053.907A1.76 1.76 0 0 1 8 15.167M4.12 3.347a.79.79 0 0 0-.787.786v1.14c0 .38-.18.867-.426 1.154l-.9 1.06c-.234.273-.234.746 0 1.02l.9 1.06c.246.293.426.773.426 1.153v1.14a.79.79 0 0 0 .787.787h1.153c.387 0 .874.18 1.167.433l1.053.907c.274.233.754.233 1.027 0l1.053-.907c.294-.247.78-.433 1.167-.433h1.133a.79.79 0 0 0 .787-.787v-1.133c0-.387.18-.874.433-1.167L14 8.507c.233-.274.233-.754 0-1.027l-.907-1.053a1.96 1.96 0 0 1-.433-1.167V4.133a.79.79 0 0 0-.787-.786H10.74c-.387 0-.873-.18-1.167-.434L8.52 2.007c-.273-.234-.753-.234-1.027 0L6.44 2.92a2 2 0 0 1-1.167.427z\",\n },\n ],\n filled: [\n {\n d: \"m14.373 7.16-.906-1.053a1.5 1.5 0 0 1-.314-.84V4.134c0-.707-.58-1.287-1.286-1.287h-1.134c-.26 0-.64-.14-.84-.313L8.84 1.627c-.46-.393-1.213-.393-1.68 0l-1.047.913c-.2.167-.58.307-.84.307H4.12c-.707 0-1.287.58-1.287 1.287v1.14c0 .26-.14.633-.306.833l-.9 1.06c-.387.46-.387 1.207 0 1.667l.9 1.06c.166.2.306.573.306.833v1.14c0 .707.58 1.287 1.287 1.287h1.153c.26 0 .64.14.84.313l1.054.907c.46.393 1.213.393 1.68 0l1.053-.907c.2-.173.573-.313.84-.313h1.133c.707 0 1.287-.58 1.287-1.287v-1.133c0-.26.14-.64.313-.84l.907-1.054c.387-.46.387-1.22-.007-1.68m-3.6-.42-3.22 3.22a.5.5 0 0 1-.706 0L5.233 8.347a.503.503 0 0 1 0-.707.503.503 0 0 1 .707 0L7.2 8.9l2.867-2.866a.503.503 0 0 1 .706 0 .503.503 0 0 1 0 .706\",\n },\n ],\n },\n 24: {\n outlined: [\n {\n d: \"M10.79 15.17a.75.75 0 0 1-.53-.22l-2.42-2.42a.754.754 0 0 1 0-1.06c.29-.29.77-.29 1.06 0l1.89 1.89 4.3-4.3c.29-.29.77-.29 1.06 0s.29.77 0 1.06l-4.83 4.83a.75.75 0 0 1-.53.22\",\n },\n {\n d: \"M12 22.75c-.63 0-1.26-.21-1.75-.63l-1.58-1.36c-.16-.14-.56-.28-.77-.28H6.18A2.68 2.68 0 0 1 3.5 17.8v-1.71c0-.21-.14-.6-.28-.76l-1.35-1.59c-.82-.97-.82-2.5 0-3.47l1.35-1.59c.14-.16.28-.55.28-.76V6.2c0-1.48 1.2-2.68 2.68-2.68h1.73c.21 0 .61-.15.77-.28l1.58-1.36c.98-.84 2.51-.84 3.49 0l1.58 1.36c.16.14.56.28.77.28h1.7c1.48 0 2.68 1.2 2.68 2.68v1.7c0 .21.15.61.29.77l1.36 1.58c.84.98.84 2.51 0 3.49l-1.36 1.58c-.14.16-.29.56-.29.77v1.7c0 1.48-1.2 2.68-2.68 2.68h-1.7c-.21 0-.61.15-.77.28l-1.58 1.36c-.49.43-1.12.64-1.75.64M6.18 5.02C5.53 5.02 5 5.55 5 6.2v1.71c0 .57-.27 1.3-.64 1.73l-1.35 1.59c-.35.41-.35 1.12 0 1.53l1.35 1.59c.37.44.64 1.16.64 1.73v1.71c0 .65.53 1.18 1.18 1.18h1.73c.58 0 1.31.27 1.75.65l1.58 1.36c.41.35 1.13.35 1.54 0l1.58-1.36c.44-.37 1.17-.65 1.75-.65h1.7c.65 0 1.18-.53 1.18-1.18v-1.7c0-.58.27-1.31.65-1.75L21 12.76c.35-.41.35-1.13 0-1.54l-1.36-1.58c-.38-.44-.65-1.17-.65-1.75V6.2c0-.65-.53-1.18-1.18-1.18h-1.7c-.58 0-1.31-.27-1.75-.65l-1.58-1.36c-.41-.35-1.13-.35-1.54 0L9.66 4.38c-.44.37-1.18.64-1.75.64z\",\n },\n ],\n filled: [\n {\n d: \"M21.56 10.74 20.2 9.16c-.26-.3-.47-.86-.47-1.26V6.2c0-1.06-.87-1.93-1.93-1.93h-1.7c-.39 0-.96-.21-1.26-.47l-1.58-1.36c-.69-.59-1.82-.59-2.52 0L9.17 3.81c-.3.25-.87.46-1.26.46H6.18c-1.06 0-1.93.87-1.93 1.93v1.71c0 .39-.21.95-.46 1.25l-1.35 1.59c-.58.69-.58 1.81 0 2.5l1.35 1.59c.25.3.46.86.46 1.25v1.71c0 1.06.87 1.93 1.93 1.93h1.73c.39 0 .96.21 1.26.47l1.58 1.36c.69.59 1.82.59 2.52 0l1.58-1.36c.3-.26.86-.47 1.26-.47h1.7c1.06 0 1.93-.87 1.93-1.93v-1.7c0-.39.21-.96.47-1.26l1.36-1.58c.58-.69.58-1.83-.01-2.52m-5.4-.63-4.83 4.83a.75.75 0 0 1-1.06 0l-2.42-2.42a.754.754 0 0 1 0-1.06c.29-.29.77-.29 1.06 0l1.89 1.89 4.3-4.3c.29-.29.77-.29 1.06 0s.29.77 0 1.06\",\n },\n ],\n },\n 32: {\n outlined: [\n {\n d: \"M14.387 20.226a1 1 0 0 1-.707-.294l-3.227-3.226a1.006 1.006 0 0 1 0-1.414 1.006 1.006 0 0 1 1.413 0l2.52 2.52 5.734-5.733a1.006 1.006 0 0 1 1.413 0 1.006 1.006 0 0 1 0 1.413l-6.44 6.44a1 1 0 0 1-.707.294\",\n },\n {\n d: \"M16 30.333c-.84 0-1.68-.28-2.334-.84L11.56 27.68c-.213-.187-.746-.373-1.026-.373H8.24a3.574 3.574 0 0 1-3.574-3.574v-2.28c0-.28-.186-.8-.373-1.013l-1.8-2.12c-1.093-1.294-1.093-3.334 0-4.627l1.8-2.12c.187-.213.373-.733.373-1.013V8.267c0-1.974 1.6-3.574 3.574-3.574h2.306c.28 0 .814-.2 1.027-.373l2.107-1.814c1.306-1.12 3.346-1.12 4.653 0L20.44 4.32c.213.186.746.373 1.026.373h2.267c1.973 0 3.573 1.6 3.573 3.574v2.266c0 .28.2.814.387 1.027l1.813 2.106c1.12 1.307 1.12 3.347 0 4.654l-1.813 2.107c-.187.213-.387.746-.387 1.026v2.267c0 1.973-1.6 3.573-3.573 3.573h-2.267c-.28 0-.813.2-1.027.373l-2.106 1.814c-.653.573-1.493.853-2.333.853M8.24 6.693c-.867 0-1.574.707-1.574 1.574v2.28c0 .76-.36 1.733-.853 2.306l-1.8 2.12c-.467.547-.467 1.493 0 2.04l1.8 2.12c.493.587.853 1.547.853 2.307v2.28c0 .867.707 1.573 1.574 1.573h2.306c.774 0 1.747.36 2.334.867l2.106 1.813c.547.467 1.507.467 2.053 0l2.107-1.813c.587-.494 1.56-.867 2.334-.867h2.266c.867 0 1.574-.706 1.574-1.573v-2.267c0-.773.36-1.747.866-2.333L28 17.013c.466-.547.466-1.507 0-2.053l-1.814-2.107c-.506-.586-.866-1.56-.866-2.333V8.267c0-.867-.707-1.574-1.574-1.574H21.48c-.774 0-1.747-.36-2.334-.866L17.04 4.013c-.546-.466-1.506-.466-2.053 0L12.88 5.84c-.586.493-1.573.853-2.333.853z\",\n },\n ],\n filled: [\n {\n d: \"m28.747 14.32-1.814-2.106c-.346-.4-.626-1.147-.626-1.68V8.267a2.583 2.583 0 0 0-2.574-2.573h-2.266c-.52 0-1.28-.28-1.68-.627L17.68 3.254c-.92-.787-2.427-.787-3.36 0l-2.093 1.827c-.4.333-1.16.613-1.68.613H8.24a2.583 2.583 0 0 0-2.573 2.573v2.28c0 .52-.28 1.267-.614 1.667l-1.8 2.12c-.773.92-.773 2.413 0 3.333l1.8 2.12c.334.4.614 1.147.614 1.667v2.28a2.583 2.583 0 0 0 2.573 2.573h2.307c.52 0 1.28.28 1.68.627l2.106 1.813c.92.787 2.427.787 3.36 0l2.107-1.813c.4-.347 1.147-.627 1.68-.627h2.267a2.583 2.583 0 0 0 2.573-2.573v-2.267c0-.52.28-1.28.627-1.68l1.813-2.106c.773-.92.773-2.44-.013-3.36m-7.2-.84-6.44 6.44a1 1 0 0 1-1.414 0l-3.226-3.226a1.006 1.006 0 0 1 0-1.413 1.006 1.006 0 0 1 1.413 0l2.52 2.52 5.733-5.734a1.006 1.006 0 0 1 1.414 0 1.006 1.006 0 0 1 0 1.414\",\n },\n ],\n },\n};\n\n/** Props for {@link VerifiedIcon}. See {@link BaseIconProps} for the shared shape. */\nexport type VerifiedIconProps = BaseIconProps;\n\n/**\n * Verify icon. Renders at sizes 16, 24, or 32 px with outlined and filled variants.\n * Defaults to the filled variant.\n *\n * @example\n * ```tsx\n * <VerifiedIcon size={24} />\n * ```\n */\nexport const VerifiedIcon = React.forwardRef<SVGSVGElement, VerifiedIconProps>(\n ({ filled = true, ...props }, ref) => (\n <BaseIcon ref={ref} variants={VARIANTS} filled={filled} {...props} />\n ),\n);\n\nVerifiedIcon.displayName = \"VerifiedIcon\";\n"],"names":[],"mappings":";;;;AAIA,MAAM,WAAyB;AAAA,EAC7B,IAAI;AAAA,IACF,UAAU;AAAA,MACR;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,MAEL;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,IAEF,QAAQ;AAAA,MACN;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,EACF;AAAA,EAEF,IAAI;AAAA,IACF,UAAU;AAAA,MACR;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,MAEL;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,IAEF,QAAQ;AAAA,MACN;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,EACF;AAAA,EAEF,IAAI;AAAA,IACF,UAAU;AAAA,MACR;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,MAEL;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,IAEF,QAAQ;AAAA,MACN;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,EACF;AAEJ;AAcO,MAAM,eAAe,MAAM;AAAA,EAChC,CAAC,EAAE,SAAS,MAAM,GAAG,MAAA,GAAS,QAC5B,oBAAC,YAAS,KAAU,UAAU,UAAU,QAAiB,GAAG,MAAA,CAAO;AAEvE;AAEA,aAAa,cAAc;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../../utils/cn.mjs";
|
|
5
|
+
const InlineEmptyState = React.forwardRef(
|
|
6
|
+
({ className, children, ...props }, ref) => {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
"p",
|
|
9
|
+
{
|
|
10
|
+
ref,
|
|
11
|
+
className: cn(
|
|
12
|
+
"typography-body-small-14px-regular m-0 flex min-h-20 items-center justify-center px-4 text-center text-content-tertiary",
|
|
13
|
+
className
|
|
14
|
+
),
|
|
15
|
+
...props,
|
|
16
|
+
children: /* @__PURE__ */ jsx("span", { className: "min-w-0 [overflow-wrap:anywhere]", children })
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
InlineEmptyState.displayName = "InlineEmptyState";
|
|
22
|
+
export {
|
|
23
|
+
InlineEmptyState
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=InlineEmptyState.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlineEmptyState.mjs","sources":["../../../src/components/InlineEmptyState/InlineEmptyState.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface InlineEmptyStateProps\n extends Omit<React.HTMLAttributes<HTMLParagraphElement>, \"dangerouslySetInnerHTML\"> {\n /** The message. Keep it to one short sentence. */\n children?: React.ReactNode;\n}\n\n/**\n * An empty or coming-soon state as one quiet, centred line in an 80px block. Use it inside a\n * card, table or panel that has nothing to show yet. For a state with a title, artwork or\n * actions, use {@link EmptyState}.\n *\n * @example\n * ```tsx\n * <InlineEmptyState>No links in this campaign yet.</InlineEmptyState>\n * ```\n */\nexport const InlineEmptyState = React.forwardRef<HTMLParagraphElement, InlineEmptyStateProps>(\n ({ className, children, ...props }, ref) => {\n return (\n <p\n ref={ref}\n className={cn(\n \"typography-body-small-14px-regular m-0 flex min-h-20 items-center justify-center px-4 text-center text-content-tertiary\",\n className,\n )}\n {...props}\n >\n <span className=\"min-w-0 [overflow-wrap:anywhere]\">{children}</span>\n </p>\n );\n },\n);\n\nInlineEmptyState.displayName = \"InlineEmptyState\";\n"],"names":[],"mappings":";;;;AAmBO,MAAM,mBAAmB,MAAM;AAAA,EACpC,CAAC,EAAE,WAAW,UAAU,GAAG,MAAA,GAAS,QAAQ;AAC1C,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA;AAAA,QAAA;AAAA,QAED,GAAG;AAAA,QAEJ,UAAA,oBAAC,QAAA,EAAK,WAAU,oCAAoC,SAAA,CAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAGnE;AACF;AAEA,iBAAiB,cAAc;"}
|