@calcifer-design/ui 0.6.0 → 0.7.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/components/Alert/Alert.d.ts +5 -2
- package/dist/components/Alert/Alert.js +1 -0
- package/dist/components/Alert/Alert.module.js +5 -5
- package/dist/components/Alert/Alert_module.css +20 -17
- package/dist/components/Avatar/Avatar.d.ts +16 -2
- package/dist/components/Avatar/Avatar.js +23 -7
- package/dist/components/Avatar/Avatar.module.js +3 -3
- package/dist/components/Avatar/Avatar_module.css +58 -17
- package/dist/components/Avatar/avatarColor.d.ts +12 -0
- package/dist/components/Avatar/avatarColor.js +12 -0
- package/dist/components/AvatarGroup/AvatarGroup.d.ts +37 -0
- package/dist/components/AvatarGroup/AvatarGroup.js +52 -0
- package/dist/components/AvatarGroup/AvatarGroup.module.js +8 -0
- package/dist/components/AvatarGroup/AvatarGroup_module.css +67 -0
- package/dist/components/Breadcrumb/Breadcrumb.module.js +6 -6
- package/dist/components/Breadcrumb/Breadcrumb_module.css +7 -7
- package/dist/components/Button/Button.d.ts +40 -4
- package/dist/components/Button/Button.js +48 -11
- package/dist/components/Button/Button.module.js +6 -2
- package/dist/components/Button/Button_module.css +143 -17
- package/dist/components/Button/LinkButton.d.ts +10 -3
- package/dist/components/Button/LinkButton.js +16 -5
- package/dist/components/Card/Card.module.js +5 -5
- package/dist/components/Card/Card_module.css +15 -9
- package/dist/components/CardList/CardList.module.js +3 -3
- package/dist/components/CardList/CardList_module.css +5 -3
- package/dist/components/Checkbox/Checkbox.module.js +2 -2
- package/dist/components/Checkbox/Checkbox_module.css +3 -3
- package/dist/components/ChoiceCard/ChoiceCard.d.ts +34 -0
- package/dist/components/ChoiceCard/ChoiceCard.js +81 -0
- package/dist/components/ChoiceCard/ChoiceCard.module.js +12 -0
- package/dist/components/ChoiceCard/ChoiceCard_module.css +161 -0
- package/dist/components/Collapsible/Collapsible.d.ts +39 -0
- package/dist/components/Collapsible/Collapsible.js +63 -0
- package/dist/components/Collapsible/Collapsible.module.js +10 -0
- package/dist/components/Collapsible/Collapsible_module.css +80 -0
- package/dist/components/DataGrid/DataGrid.module.js +32 -32
- package/dist/components/DataGrid/DataGrid_module.css +67 -62
- package/dist/components/DataTable/DataTable.module.js +9 -9
- package/dist/components/DataTable/DataTable_module.css +24 -21
- package/dist/components/DatePicker/DatePicker.d.ts +15 -1
- package/dist/components/DatePicker/DatePicker.js +30 -5
- package/dist/components/DatePicker/DatePicker.module.js +10 -10
- package/dist/components/DatePicker/DatePicker_module.css +22 -21
- package/dist/components/Descriptions/Descriptions.module.js +4 -4
- package/dist/components/Descriptions/Descriptions_module.css +12 -8
- package/dist/components/Dialog/Dialog.d.ts +30 -2
- package/dist/components/Dialog/Dialog.js +52 -11
- package/dist/components/Dialog/Dialog.module.js +8 -6
- package/dist/components/Dialog/Dialog_module.css +60 -13
- package/dist/components/EmptyState/EmptyState.d.ts +41 -0
- package/dist/components/EmptyState/EmptyState.js +39 -0
- package/dist/components/EmptyState/EmptyState.module.js +9 -0
- package/dist/components/EmptyState/EmptyState_module.css +65 -0
- package/dist/components/ErrorBoundary/ErrorBoundary.d.ts +5 -2
- package/dist/components/ErrorBoundary/ErrorBoundary.module.js +1 -1
- package/dist/components/ErrorBoundary/ErrorBoundary_module.css +1 -1
- package/dist/components/Field/AffixInput.d.ts +28 -0
- package/dist/components/Field/AffixInput.js +50 -0
- package/dist/components/Field/GroupFrame.d.ts +19 -0
- package/dist/components/Field/GroupFrame.js +31 -0
- package/dist/components/Field/PickerField.d.ts +8 -2
- package/dist/components/Field/PickerField.js +12 -8
- package/dist/components/Field/PickerField.module.js +4 -4
- package/dist/components/Field/PickerField_module.css +11 -6
- package/dist/components/FilterBar/FilterBar.module.js +9 -9
- package/dist/components/FilterBar/FilterBar_module.css +13 -13
- package/dist/components/Form/Form.d.ts +9 -7
- package/dist/components/Form/Form.module.js +1 -1
- package/dist/components/Form/Form_module.css +1 -1
- package/dist/components/IconButton/IconButton.d.ts +1 -1
- package/dist/components/IconButton/IconButton.module.js +2 -2
- package/dist/components/IconButton/IconButton_module.css +28 -17
- package/dist/components/Menu/Menu.js +3 -0
- package/dist/components/Menu/Menu.module.js +2 -2
- package/dist/components/Menu/Menu_module.css +5 -4
- package/dist/components/NavMenu/NavMenu.d.ts +27 -4
- package/dist/components/NavMenu/NavMenu.js +10 -8
- package/dist/components/NavMenu/NavMenu.module.js +6 -6
- package/dist/components/NavMenu/NavMenu_module.css +37 -19
- package/dist/components/NavMenu/currentPath.d.ts +9 -0
- package/dist/components/NavMenu/currentPath.js +5 -0
- package/dist/components/PageHeading/PageHeading.module.js +3 -3
- package/dist/components/PageHeading/PageHeading_module.css +12 -9
- package/dist/components/PageShell/PageShell.module.js +5 -5
- package/dist/components/PageShell/PageShell_module.css +9 -9
- package/dist/components/Popover/Popover.js +3 -0
- package/dist/components/Popover/Popover.module.js +2 -2
- package/dist/components/Popover/Popover_module.css +6 -3
- package/dist/components/ProgressBar/ProgressBar.d.ts +55 -0
- package/dist/components/ProgressBar/ProgressBar.js +76 -0
- package/dist/components/ProgressBar/ProgressBar.module.js +12 -0
- package/dist/components/ProgressBar/ProgressBar_module.css +120 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/RadioGroup/RadioGroup.js +35 -49
- package/dist/components/RadioGroup/RadioGroup.module.js +2 -2
- package/dist/components/RadioGroup/RadioGroup_module.css +2 -2
- package/dist/components/SearchField/SearchField.d.ts +32 -0
- package/dist/components/SearchField/SearchField.js +100 -0
- package/dist/components/SearchField/SearchField.module.js +8 -0
- package/dist/components/SearchField/SearchField_module.css +34 -0
- package/dist/components/Segmented/Segmented.d.ts +23 -6
- package/dist/components/Segmented/Segmented.js +37 -20
- package/dist/components/Segmented/Segmented.module.js +4 -3
- package/dist/components/Segmented/Segmented_module.css +46 -20
- package/dist/components/Select/Select.js +3 -0
- package/dist/components/Select/Select.module.js +5 -5
- package/dist/components/Select/Select_module.css +12 -11
- package/dist/components/Skeleton/Skeleton.module.js +3 -3
- package/dist/components/Skeleton/Skeleton_module.css +9 -9
- package/dist/components/SkipLink/SkipLink.module.js +1 -1
- package/dist/components/SkipLink/SkipLink_module.css +4 -4
- package/dist/components/Spinner/Spinner.module.js +3 -3
- package/dist/components/Spinner/Spinner_module.css +7 -7
- package/dist/components/StatusDot/StatusDot.module.js +5 -5
- package/dist/components/StatusDot/StatusDot_module.css +11 -11
- package/dist/components/Steps/Steps.module.js +6 -6
- package/dist/components/Steps/Steps_module.css +19 -19
- package/dist/components/Switch/Switch.module.js +2 -2
- package/dist/components/Switch/Switch_module.css +5 -5
- package/dist/components/TabBar/TabBar.d.ts +26 -0
- package/dist/components/TabBar/TabBar.js +52 -0
- package/dist/components/TabBar/TabBar.module.js +11 -0
- package/dist/components/TabBar/TabBar_module.css +100 -0
- package/dist/components/Tabs/Tabs.module.js +4 -4
- package/dist/components/Tabs/Tabs_module.css +9 -8
- package/dist/components/Tag/Tag.module.js +1 -1
- package/dist/components/Tag/Tag_module.css +3 -2
- package/dist/components/TextArea/TextArea.module.js +1 -1
- package/dist/components/TextArea/TextArea_module.css +6 -2
- package/dist/components/TextInput/TextInput.d.ts +14 -2
- package/dist/components/TextInput/TextInput.js +4 -5
- package/dist/components/ThemeScope/PortalContainerContext.d.ts +17 -0
- package/dist/components/ThemeScope/PortalContainerContext.js +6 -0
- package/dist/components/ThemeScope/ThemeScope.d.ts +23 -0
- package/dist/components/ThemeScope/ThemeScope.js +29 -0
- package/dist/components/ThemeScope/ThemeScope.module.js +6 -0
- package/dist/components/ThemeScope/ThemeScope_module.css +10 -0
- package/dist/components/TimePicker/TimePicker.d.ts +15 -2
- package/dist/components/TimePicker/TimePicker.js +5 -5
- package/dist/components/Timeline/Timeline.module.js +8 -8
- package/dist/components/Timeline/Timeline_module.css +15 -13
- package/dist/components/ToastRegion/ToastRegion.js +3 -0
- package/dist/components/ToastRegion/ToastRegion.module.js +6 -6
- package/dist/components/ToastRegion/ToastRegion_module.css +23 -19
- package/dist/components/ToggleChip/ToggleChip.d.ts +49 -0
- package/dist/components/ToggleChip/ToggleChip.js +45 -0
- package/dist/components/ToggleChip/ToggleChip.module.js +9 -0
- package/dist/components/ToggleChip/ToggleChipGroup.d.ts +57 -0
- package/dist/components/ToggleChip/ToggleChipGroup.js +93 -0
- package/dist/components/ToggleChip/ToggleChip_module.css +97 -0
- package/dist/components/Toolbar/Toolbar.module.js +3 -3
- package/dist/components/Toolbar/Toolbar_module.css +5 -5
- package/dist/components/Tooltip/Tooltip.js +3 -0
- package/dist/components/Tree/Tree.module.js +8 -8
- package/dist/components/Tree/Tree_module.css +20 -20
- package/dist/components/TreeSelect/TreeSelect.js +3 -0
- package/dist/components/TreeSelect/TreeSelect.module.js +3 -3
- package/dist/components/TreeSelect/TreeSelect_module.css +4 -4
- package/dist/components/Upload/Upload.module.js +8 -8
- package/dist/components/Upload/Upload_module.css +16 -16
- package/dist/components/ViewField/ViewField.module.js +2 -2
- package/dist/components/ViewField/ViewField_module.css +3 -3
- package/dist/hooks/useControllable.d.ts +11 -0
- package/dist/hooks/useControllable.js +13 -0
- package/dist/hooks/useIndexedToggleGroup.d.ts +30 -0
- package/dist/hooks/useIndexedToggleGroup.js +26 -0
- package/dist/hooks/useOverflowFocusable.d.ts +17 -0
- package/dist/hooks/useOverflowFocusable.js +36 -0
- package/dist/icons/SearchIcon.d.ts +9 -0
- package/dist/icons/SearchIcon.js +23 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +12 -0
- package/dist/styles/a11y.module.js +1 -1
- package/dist/styles/a11y_module.css +1 -1
- package/dist/styles/base.css +17 -0
- package/dist/styles/closeCircle.module.js +5 -0
- package/dist/styles/closeCircle_module.css +12 -0
- package/dist/styles/field.module.js +14 -11
- package/dist/styles/field_module.css +92 -23
- package/dist/styles/pair.module.js +2 -2
- package/dist/styles/pair_module.css +5 -3
- package/dist/styles/popup.module.js +5 -5
- package/dist/styles/popup_module.css +35 -28
- package/dist/utils/focusInputFromPill.d.ts +12 -0
- package/dist/utils/focusInputFromPill.js +7 -0
- package/dist/utils/hasContent.d.ts +8 -0
- package/dist/utils/hasContent.js +4 -0
- package/package.json +2 -2
|
@@ -1,10 +1,28 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from "@base-ui/react/button";
|
|
3
|
+
import { hasContent } from "../../utils/hasContent.js";
|
|
4
|
+
import { Spinner } from "../Spinner/Spinner.js";
|
|
3
5
|
import Button_module from "./Button.module.js";
|
|
4
|
-
function Button_Button({ variant = 'primary', size = 'md', loading = false, disabled, className, children, nativeButton, ...rest }) {
|
|
5
|
-
const
|
|
6
|
+
function Button_Button({ variant = 'primary', size = 'md', tone = 'accent', badge, startIcon, endIcon, loading = false, pending = false, disabled, className, children, nativeButton, ...rest }) {
|
|
7
|
+
const isBusy = loading || pending;
|
|
8
|
+
const showsPending = pending && !disabled;
|
|
6
9
|
const isNativeButton = nativeButton ?? !rest.render;
|
|
7
|
-
|
|
10
|
+
let leading = null;
|
|
11
|
+
if (hasContent(startIcon)) leading = /*#__PURE__*/ jsx("span", {
|
|
12
|
+
className: Button_module.icon,
|
|
13
|
+
"aria-hidden": "true",
|
|
14
|
+
children: showsPending ? /*#__PURE__*/ jsx(Spinner, {
|
|
15
|
+
size: "sm"
|
|
16
|
+
}) : startIcon
|
|
17
|
+
});
|
|
18
|
+
else if (showsPending) leading = /*#__PURE__*/ jsx("span", {
|
|
19
|
+
className: Button_module.pendingOverlay,
|
|
20
|
+
"aria-hidden": "true",
|
|
21
|
+
children: /*#__PURE__*/ jsx(Spinner, {
|
|
22
|
+
size: "sm"
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
return /*#__PURE__*/ jsxs(Button, {
|
|
8
26
|
...rest,
|
|
9
27
|
nativeButton: isNativeButton,
|
|
10
28
|
className: [
|
|
@@ -13,14 +31,33 @@ function Button_Button({ variant = 'primary', size = 'md', loading = false, disa
|
|
|
13
31
|
].filter(Boolean).join(' '),
|
|
14
32
|
"data-variant": variant,
|
|
15
33
|
"data-size": size,
|
|
34
|
+
"data-tone": tone,
|
|
16
35
|
"data-loading": loading ? '' : void 0,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
36
|
+
"data-pending": showsPending ? '' : void 0,
|
|
37
|
+
disabled: Boolean(disabled) || isBusy,
|
|
38
|
+
focusableWhenDisabled: isBusy,
|
|
39
|
+
"aria-busy": isBusy || void 0,
|
|
40
|
+
children: [
|
|
41
|
+
leading,
|
|
42
|
+
/*#__PURE__*/ jsx("span", {
|
|
43
|
+
className: Button_module.label,
|
|
44
|
+
children: children
|
|
45
|
+
}),
|
|
46
|
+
hasContent(badge) ? /*#__PURE__*/ jsxs(Fragment, {
|
|
47
|
+
children: [
|
|
48
|
+
' ',
|
|
49
|
+
/*#__PURE__*/ jsx("span", {
|
|
50
|
+
className: Button_module.badge,
|
|
51
|
+
children: badge
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
}) : null,
|
|
55
|
+
hasContent(endIcon) ? /*#__PURE__*/ jsx("span", {
|
|
56
|
+
className: Button_module.endIcon,
|
|
57
|
+
"aria-hidden": "true",
|
|
58
|
+
children: endIcon
|
|
59
|
+
}) : null
|
|
60
|
+
]
|
|
24
61
|
});
|
|
25
62
|
}
|
|
26
63
|
export { Button_Button as Button };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import "./Button_module.css";
|
|
2
2
|
const Button_module = {
|
|
3
|
-
root: "root-kIffN",
|
|
4
|
-
label: "label-Ujxp1"
|
|
3
|
+
root: "ui0-7-0-root-kIffN",
|
|
4
|
+
label: "ui0-7-0-label-Ujxp1",
|
|
5
|
+
badge: "ui0-7-0-badge-adYec",
|
|
6
|
+
icon: "ui0-7-0-icon-w_os0",
|
|
7
|
+
endIcon: "ui0-7-0-endIcon-AN5p5",
|
|
8
|
+
pendingOverlay: "ui0-7-0-pendingOverlay-TB_PT"
|
|
5
9
|
};
|
|
6
10
|
export default Button_module;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
.root-kIffN {
|
|
1
|
+
.ui0-7-0-root-kIffN {
|
|
2
2
|
justify-content: center;
|
|
3
3
|
align-items: center;
|
|
4
4
|
gap: var(--space-2);
|
|
5
|
-
min-height: var(--size-
|
|
5
|
+
min-height: var(--size-control);
|
|
6
6
|
min-width: var(--size-touch);
|
|
7
7
|
padding: var(--space-2) var(--space-5);
|
|
8
8
|
border-radius: var(--radius-full);
|
|
9
|
+
font-family: var(--font-sans);
|
|
9
10
|
font-size: var(--text-md);
|
|
10
|
-
font-weight:
|
|
11
|
+
font-weight: var(--font-weight-button);
|
|
11
12
|
line-height: var(--leading-snug);
|
|
12
13
|
letter-spacing: var(--tracking-body);
|
|
13
14
|
cursor: pointer;
|
|
@@ -21,59 +22,184 @@
|
|
|
21
22
|
display: inline-flex;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
.root-kIffN[data-size="sm"] {
|
|
25
|
-
min-height:
|
|
25
|
+
.ui0-7-0-root-kIffN[data-size="sm"] {
|
|
26
|
+
min-height: var(--size-control-sm);
|
|
26
27
|
padding: var(--space-1) var(--space-4);
|
|
27
28
|
font-size: var(--text-sm);
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
.root-kIffN[data-
|
|
31
|
+
.ui0-7-0-root-kIffN[data-size="lg"] {
|
|
32
|
+
--button-lg-padding-inline: calc(var(--space-5) + var(--space-1));
|
|
33
|
+
min-height: 3rem;
|
|
34
|
+
padding: var(--space-2) var(--button-lg-padding-inline);
|
|
35
|
+
font-family: var(--font-display);
|
|
36
|
+
font-size: var(--text-lg);
|
|
37
|
+
font-weight: var(--font-weight-display);
|
|
38
|
+
font-stretch: var(--font-stretch-display);
|
|
39
|
+
text-transform: var(--text-transform-display);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.ui0-7-0-root-kIffN[data-variant="primary"] {
|
|
31
43
|
background: var(--color-accent);
|
|
32
44
|
color: var(--color-accent-text);
|
|
45
|
+
box-shadow: var(--shadow-action);
|
|
33
46
|
}
|
|
34
47
|
|
|
35
|
-
.root-kIffN[data-variant="secondary"] {
|
|
36
|
-
border-radius: var(--radius-
|
|
48
|
+
.ui0-7-0-root-kIffN[data-variant="secondary"] {
|
|
49
|
+
border-radius: var(--radius-control);
|
|
37
50
|
background: var(--color-surface-raised);
|
|
38
51
|
color: var(--color-text);
|
|
39
52
|
border-color: var(--color-border-strong);
|
|
40
53
|
}
|
|
41
54
|
|
|
42
|
-
.root-kIffN[data-variant="ghost"] {
|
|
55
|
+
.ui0-7-0-root-kIffN[data-variant="ghost"] {
|
|
43
56
|
padding-inline: var(--space-2);
|
|
44
|
-
border-radius: var(--radius-
|
|
57
|
+
border-radius: var(--radius-control);
|
|
45
58
|
color: var(--color-link);
|
|
46
59
|
background: none;
|
|
47
60
|
}
|
|
48
61
|
|
|
62
|
+
.ui0-7-0-root-kIffN[data-variant="row"] {
|
|
63
|
+
text-align: start;
|
|
64
|
+
white-space: normal;
|
|
65
|
+
width: 100%;
|
|
66
|
+
min-height: var(--size-touch);
|
|
67
|
+
padding: var(--space-2) var(--space-3);
|
|
68
|
+
border-radius: var(--radius-md);
|
|
69
|
+
color: var(--color-text);
|
|
70
|
+
background: none;
|
|
71
|
+
border-color: #0000;
|
|
72
|
+
justify-content: flex-start;
|
|
73
|
+
display: flex;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.ui0-7-0-root-kIffN[data-variant="primary"][data-tone="inverse"] {
|
|
77
|
+
background: var(--color-inverse);
|
|
78
|
+
color: var(--color-inverse-text);
|
|
79
|
+
box-shadow: var(--shadow-action-inverse);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.ui0-7-0-root-kIffN[data-variant="secondary"][data-tone="inverse"] {
|
|
83
|
+
background: var(--color-inverse-soft);
|
|
84
|
+
color: var(--color-inverse-soft-text);
|
|
85
|
+
border-color: #0000;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.ui0-7-0-root-kIffN[data-variant="primary"][data-tone="selected"] {
|
|
89
|
+
background: var(--color-selected);
|
|
90
|
+
color: var(--color-selected-text);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.ui0-7-0-root-kIffN[data-variant="secondary"][data-tone="selected"] {
|
|
94
|
+
background: var(--color-selected-soft);
|
|
95
|
+
color: var(--color-selected-soft-text);
|
|
96
|
+
border-color: #0000;
|
|
97
|
+
}
|
|
98
|
+
|
|
49
99
|
@media (hover: hover) {
|
|
50
|
-
.root-kIffN[data-variant="primary"]:hover:not([data-disabled]) {
|
|
100
|
+
.ui0-7-0-root-kIffN[data-variant="primary"][data-tone="accent"]:hover:not([data-disabled]) {
|
|
51
101
|
background: var(--color-accent-hover);
|
|
52
102
|
}
|
|
53
103
|
|
|
54
|
-
.root-kIffN[data-variant="secondary"]:hover:not([data-disabled]) {
|
|
104
|
+
.ui0-7-0-root-kIffN[data-variant="secondary"][data-tone="accent"]:hover:not([data-disabled]) {
|
|
55
105
|
background: var(--color-surface-2);
|
|
56
106
|
}
|
|
57
107
|
|
|
58
|
-
.root-kIffN[data-variant="ghost"]:hover:not([data-disabled]) {
|
|
108
|
+
.ui0-7-0-root-kIffN[data-variant="ghost"]:hover:not([data-disabled]) {
|
|
59
109
|
text-decoration: underline;
|
|
60
110
|
}
|
|
111
|
+
|
|
112
|
+
.ui0-7-0-root-kIffN[data-variant="row"]:hover:not([data-disabled]) {
|
|
113
|
+
background: var(--color-surface-2);
|
|
114
|
+
}
|
|
61
115
|
}
|
|
62
116
|
|
|
63
|
-
.root-kIffN:active:not([data-disabled]) {
|
|
117
|
+
.ui0-7-0-root-kIffN:active:not([data-disabled]) {
|
|
64
118
|
transform: scale(.98);
|
|
65
119
|
}
|
|
66
120
|
|
|
67
|
-
.root-kIffN[data-disabled] {
|
|
121
|
+
.ui0-7-0-root-kIffN[data-variant="row"]:active:not([data-disabled]) {
|
|
122
|
+
background: var(--color-surface-2);
|
|
123
|
+
transform: none;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.ui0-7-0-root-kIffN[data-disabled] {
|
|
68
127
|
cursor: not-allowed;
|
|
69
128
|
opacity: .45;
|
|
70
129
|
}
|
|
71
130
|
|
|
72
|
-
|
|
131
|
+
@supports (color: color-mix(in srgb, red, blue)) {
|
|
132
|
+
.ui0-7-0-root-kIffN[data-variant="primary"][data-tone="inverse"][data-disabled]:not([data-pending]) {
|
|
133
|
+
--button-inverse-disabled-fill: color-mix(in srgb, var(--color-inverse) 55%, transparent);
|
|
134
|
+
--button-inverse-disabled-ink: color-mix(in srgb, var(--color-inverse-text) 50%, transparent);
|
|
135
|
+
opacity: 1;
|
|
136
|
+
background: var(--button-inverse-disabled-fill);
|
|
137
|
+
color: var(--button-inverse-disabled-ink);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.ui0-7-0-root-kIffN[data-pending] {
|
|
142
|
+
opacity: 1;
|
|
143
|
+
cursor: progress;
|
|
144
|
+
position: relative;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.ui0-7-0-label-Ujxp1 {
|
|
73
148
|
display: inline-block;
|
|
74
149
|
}
|
|
75
150
|
|
|
76
|
-
.
|
|
151
|
+
.ui0-7-0-badge-adYec {
|
|
152
|
+
display: inline-flex;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.ui0-7-0-icon-w_os0, .ui0-7-0-endIcon-AN5p5 {
|
|
156
|
+
flex: none;
|
|
157
|
+
display: inline-flex;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.ui0-7-0-icon-w_os0 > svg, .ui0-7-0-endIcon-AN5p5 > svg {
|
|
161
|
+
width: 1rem;
|
|
162
|
+
height: 1rem;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.ui0-7-0-pendingOverlay-TB_PT {
|
|
166
|
+
pointer-events: none;
|
|
167
|
+
justify-content: center;
|
|
168
|
+
align-items: center;
|
|
169
|
+
display: flex;
|
|
170
|
+
position: absolute;
|
|
171
|
+
inset: 0;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.ui0-7-0-root-kIffN[data-variant="primary"] .ui0-7-0-icon-w_os0, .ui0-7-0-root-kIffN[data-variant="primary"] .ui0-7-0-pendingOverlay-TB_PT {
|
|
175
|
+
--color-accent: currentcolor;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.ui0-7-0-pendingOverlay-TB_PT + .ui0-7-0-label-Ujxp1 {
|
|
179
|
+
opacity: 0;
|
|
180
|
+
color: #0000;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.ui0-7-0-pendingOverlay-TB_PT ~ .ui0-7-0-badge-adYec, .ui0-7-0-pendingOverlay-TB_PT ~ .ui0-7-0-endIcon-AN5p5 {
|
|
184
|
+
opacity: 0;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.ui0-7-0-root-kIffN[data-variant="row"] .ui0-7-0-label-Ujxp1 {
|
|
188
|
+
flex: auto;
|
|
189
|
+
min-width: 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.ui0-7-0-root-kIffN[data-variant="row"] .ui0-7-0-endIcon-AN5p5 {
|
|
193
|
+
color: var(--color-text-muted);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.ui0-7-0-root-kIffN[data-loading] .ui0-7-0-label-Ujxp1 {
|
|
77
197
|
opacity: .7;
|
|
78
198
|
}
|
|
79
199
|
|
|
200
|
+
@media (forced-colors: active) {
|
|
201
|
+
.ui0-7-0-root-kIffN[data-tone="selected"][data-variant]:is([data-variant="primary"], [data-variant="secondary"]) {
|
|
202
|
+
border-color: highlight;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { useRender } from '@base-ui/react/use-render';
|
|
2
|
-
import type { ComponentPropsWithRef } from 'react';
|
|
3
|
-
import type { ButtonSize, ButtonVariant } from './Button.js';
|
|
2
|
+
import type { ComponentPropsWithRef, ReactNode } from 'react';
|
|
3
|
+
import type { ButtonSize, ButtonTone, ButtonVariant } from './Button.js';
|
|
4
4
|
export interface LinkButtonProps extends ComponentPropsWithRef<'a'> {
|
|
5
5
|
variant?: ButtonVariant;
|
|
6
6
|
size?: ButtonSize;
|
|
7
|
+
tone?: ButtonTone;
|
|
8
|
+
/**
|
|
9
|
+
* A decorative glyph after the label, such as a row's chevron. It is hidden from assistive
|
|
10
|
+
* technology and never part of the link's accessible name; put a count in the label, since a
|
|
11
|
+
* link has no `badge` slot.
|
|
12
|
+
*/
|
|
13
|
+
endIcon?: ReactNode;
|
|
7
14
|
/**
|
|
8
15
|
* Replaces the rendered `<a>` so a router link can wear the button styling; the
|
|
9
16
|
* element's own props are merged with the ones this component supplies.
|
|
@@ -16,4 +23,4 @@ export interface LinkButtonProps extends ComponentPropsWithRef<'a'> {
|
|
|
16
23
|
* destination change rather than an action. Use it for navigation; use `Button` for
|
|
17
24
|
* anything that acts on the current page.
|
|
18
25
|
*/
|
|
19
|
-
export declare function LinkButton({ variant, size, className, children, render, ref, ...rest }: LinkButtonProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
26
|
+
export declare function LinkButton({ variant, size, tone, endIcon, className, children, render, ref, ...rest }: LinkButtonProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
import { hasContent } from "../../utils/hasContent.js";
|
|
3
4
|
import Button_module from "./Button.module.js";
|
|
4
|
-
function LinkButton({ variant = 'primary', size = 'md', className, children, render, ref, ...rest }) {
|
|
5
|
+
function LinkButton({ variant = 'primary', size = 'md', tone = 'accent', endIcon, className, children, render, ref, ...rest }) {
|
|
5
6
|
return useRender({
|
|
6
7
|
defaultTagName: 'a',
|
|
7
8
|
render,
|
|
@@ -14,9 +15,19 @@ function LinkButton({ variant = 'primary', size = 'md', className, children, ren
|
|
|
14
15
|
].filter(Boolean).join(' '),
|
|
15
16
|
'data-variant': variant,
|
|
16
17
|
'data-size': size,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
children:
|
|
18
|
+
'data-tone': tone,
|
|
19
|
+
children: /*#__PURE__*/ jsxs(Fragment, {
|
|
20
|
+
children: [
|
|
21
|
+
/*#__PURE__*/ jsx("span", {
|
|
22
|
+
className: Button_module.label,
|
|
23
|
+
children: children
|
|
24
|
+
}),
|
|
25
|
+
hasContent(endIcon) ? /*#__PURE__*/ jsx("span", {
|
|
26
|
+
className: Button_module.endIcon,
|
|
27
|
+
"aria-hidden": "true",
|
|
28
|
+
children: endIcon
|
|
29
|
+
}) : null
|
|
30
|
+
]
|
|
20
31
|
})
|
|
21
32
|
}
|
|
22
33
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./Card_module.css";
|
|
2
2
|
const Card_module = {
|
|
3
|
-
root: "root-Burn_",
|
|
4
|
-
header: "header-vKZVf",
|
|
5
|
-
heading: "heading-ZZrOA",
|
|
6
|
-
body: "body-na04U",
|
|
7
|
-
footer: "footer-bRVor"
|
|
3
|
+
root: "ui0-7-0-root-Burn_",
|
|
4
|
+
header: "ui0-7-0-header-vKZVf",
|
|
5
|
+
heading: "ui0-7-0-heading-ZZrOA",
|
|
6
|
+
body: "ui0-7-0-body-na04U",
|
|
7
|
+
footer: "ui0-7-0-footer-bRVor"
|
|
8
8
|
};
|
|
9
9
|
export default Card_module;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
.root-Burn_ {
|
|
1
|
+
.ui0-7-0-root-Burn_ {
|
|
2
2
|
gap: var(--space-3);
|
|
3
3
|
padding: var(--space-5);
|
|
4
4
|
background: var(--color-surface-raised);
|
|
5
5
|
border: 1px solid var(--color-card-border);
|
|
6
|
-
border-radius: var(--radius-
|
|
7
|
-
box-shadow: var(--
|
|
6
|
+
border-radius: var(--radius-card);
|
|
7
|
+
box-shadow: var(--shadow-soft);
|
|
8
8
|
transition-property: transform, box-shadow;
|
|
9
9
|
transition-duration: var(--motion-duration-3);
|
|
10
10
|
transition-timing-function: var(--motion-ease);
|
|
@@ -14,39 +14,45 @@
|
|
|
14
14
|
container-type: inline-size;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.root-Burn_[data-tone="danger"] {
|
|
17
|
+
.ui0-7-0-root-Burn_[data-tone="danger"] {
|
|
18
18
|
background: var(--color-danger-surface);
|
|
19
19
|
border-color: var(--color-danger-border);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
@media (hover: hover) {
|
|
23
|
-
.root-Burn_[data-interactive]:hover {
|
|
23
|
+
.ui0-7-0-root-Burn_[data-interactive]:hover {
|
|
24
24
|
box-shadow: var(--elevation-2);
|
|
25
25
|
transform: translateY(-2px);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
.header-vKZVf {
|
|
29
|
+
.ui0-7-0-header-vKZVf {
|
|
30
30
|
justify-content: space-between;
|
|
31
31
|
align-items: center;
|
|
32
32
|
gap: var(--space-2);
|
|
33
33
|
display: flex;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
.heading-ZZrOA {
|
|
36
|
+
.ui0-7-0-heading-ZZrOA {
|
|
37
37
|
font-size: var(--text-h3);
|
|
38
|
+
font-family: var(--font-display);
|
|
39
|
+
font-weight: var(--font-weight-display);
|
|
40
|
+
font-stretch: var(--font-stretch-display);
|
|
41
|
+
text-transform: var(--text-transform-display);
|
|
38
42
|
line-height: var(--leading-snug);
|
|
39
43
|
letter-spacing: var(--tracking-heading);
|
|
40
44
|
}
|
|
41
45
|
|
|
42
|
-
.body-na04U {
|
|
46
|
+
.ui0-7-0-body-na04U {
|
|
43
47
|
gap: var(--space-3);
|
|
44
48
|
color: var(--color-text-muted);
|
|
49
|
+
font-family: var(--font-body);
|
|
50
|
+
font-weight: var(--font-weight-body);
|
|
45
51
|
flex-direction: column;
|
|
46
52
|
display: flex;
|
|
47
53
|
}
|
|
48
54
|
|
|
49
|
-
.footer-bRVor {
|
|
55
|
+
.ui0-7-0-footer-bRVor {
|
|
50
56
|
gap: var(--space-2);
|
|
51
57
|
flex-wrap: wrap;
|
|
52
58
|
margin-top: auto;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.list-sqMJI {
|
|
1
|
+
.ui0-7-0-list-sqMJI {
|
|
2
2
|
--card-list-track: minmax(min(var(--card-list-min-column, 16rem), 100%), 1fr);
|
|
3
3
|
grid-template-columns: repeat(auto-fill, var(--card-list-track));
|
|
4
4
|
gap: var(--space-4);
|
|
@@ -8,12 +8,14 @@
|
|
|
8
8
|
display: grid;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
.item-b8vTh {
|
|
11
|
+
.ui0-7-0-item-b8vTh {
|
|
12
12
|
min-width: 0;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
.empty-G1gXX {
|
|
15
|
+
.ui0-7-0-empty-G1gXX {
|
|
16
16
|
color: var(--color-text-muted);
|
|
17
|
+
font-family: var(--font-body);
|
|
18
|
+
font-weight: var(--font-weight-body);
|
|
17
19
|
font-size: var(--text-md);
|
|
18
20
|
line-height: var(--leading-prose);
|
|
19
21
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
.box-DHMQq {
|
|
1
|
+
.ui0-7-0-box-DHMQq {
|
|
2
2
|
border-radius: var(--radius-sm);
|
|
3
3
|
width: 1.25rem;
|
|
4
4
|
height: 1.25rem;
|
|
5
5
|
color: var(--color-accent-text);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
.indicator-g_8JY {
|
|
8
|
+
.ui0-7-0-indicator-g_8JY {
|
|
9
9
|
display: inline-flex;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
.indicator-g_8JY > svg {
|
|
12
|
+
.ui0-7-0-indicator-g_8JY > svg {
|
|
13
13
|
width: .875rem;
|
|
14
14
|
height: .875rem;
|
|
15
15
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { FieldFrameProps } from '../Field/Field.js';
|
|
3
|
+
export interface ChoiceCardOption {
|
|
4
|
+
/** Submitted with the form, and what `value`/`onValueChange` speak in. */
|
|
5
|
+
value: string;
|
|
6
|
+
/** The card's title, and its radio's accessible name. The description is not part of it. */
|
|
7
|
+
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* A line under the title. Phrasing content only: the card is one `<label>`. It joins the
|
|
10
|
+
* radio's accessible description, not its name.
|
|
11
|
+
*/
|
|
12
|
+
description?: ReactNode;
|
|
13
|
+
/** Drawn in a disc above the title. Decorative, so it stays out of the accessible name. */
|
|
14
|
+
icon?: ReactNode;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface ChoiceCardProps extends FieldFrameProps {
|
|
18
|
+
/** Names the group. Rendered as a plain element, not a `<label>`, as `RadioGroup` does. */
|
|
19
|
+
label: string;
|
|
20
|
+
options: readonly ChoiceCardOption[];
|
|
21
|
+
/** Controlled; `null` chooses nothing. Pair it with `onValueChange`, or use `defaultValue`. */
|
|
22
|
+
value?: string | null;
|
|
23
|
+
defaultValue?: string | null;
|
|
24
|
+
/**
|
|
25
|
+
* The newly chosen option's value. One argument, as on every other control in the tier: Base UI
|
|
26
|
+
* calls its own callback `(value, eventDetails)` and this wrapper drops the second.
|
|
27
|
+
*/
|
|
28
|
+
onValueChange?: (value: string) => void;
|
|
29
|
+
/** Called when the focus leaves a card, as `RadioGroup`'s `onBlur` is. */
|
|
30
|
+
onBlur?: () => void;
|
|
31
|
+
/** How many cards sit side by side. The arrow keys follow the cards' order either way. */
|
|
32
|
+
columns?: 1 | 2;
|
|
33
|
+
}
|
|
34
|
+
export declare function ChoiceCard({ label, options, name, description, error, value, defaultValue, onValueChange, onBlur, required, disabled, columns, }: ChoiceCardProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Field } from "@base-ui/react/field";
|
|
3
|
+
import { Radio } from "@base-ui/react/radio";
|
|
4
|
+
import { RadioGroup } from "@base-ui/react/radio-group";
|
|
5
|
+
import { useId } from "react";
|
|
6
|
+
import { useControllable } from "../../hooks/useControllable.js";
|
|
7
|
+
import { CheckIcon } from "../../icons/CheckIcon.js";
|
|
8
|
+
import { hasContent } from "../../utils/hasContent.js";
|
|
9
|
+
import { GroupFrame } from "../Field/GroupFrame.js";
|
|
10
|
+
import ChoiceCard_module from "./ChoiceCard.module.js";
|
|
11
|
+
function ChoiceCardItem({ option, checked }) {
|
|
12
|
+
const titleId = useId();
|
|
13
|
+
const descriptionId = useId();
|
|
14
|
+
const hasDescription = hasContent(option.description);
|
|
15
|
+
return /*#__PURE__*/ jsx(Field.Item, {
|
|
16
|
+
className: ChoiceCard_module.item,
|
|
17
|
+
disabled: option.disabled,
|
|
18
|
+
children: /*#__PURE__*/ jsxs(Field.Label, {
|
|
19
|
+
className: ChoiceCard_module.card,
|
|
20
|
+
"data-checked": checked ? '' : void 0,
|
|
21
|
+
children: [
|
|
22
|
+
hasContent(option.icon) ? /*#__PURE__*/ jsx("span", {
|
|
23
|
+
className: ChoiceCard_module.disc,
|
|
24
|
+
"aria-hidden": "true",
|
|
25
|
+
children: option.icon
|
|
26
|
+
}) : null,
|
|
27
|
+
/*#__PURE__*/ jsx("span", {
|
|
28
|
+
className: ChoiceCard_module.title,
|
|
29
|
+
id: titleId,
|
|
30
|
+
children: option.label
|
|
31
|
+
}),
|
|
32
|
+
hasDescription ? /*#__PURE__*/ jsx("span", {
|
|
33
|
+
className: ChoiceCard_module.description,
|
|
34
|
+
id: descriptionId,
|
|
35
|
+
children: option.description
|
|
36
|
+
}) : null,
|
|
37
|
+
/*#__PURE__*/ jsx(Radio.Root, {
|
|
38
|
+
className: ChoiceCard_module.ring,
|
|
39
|
+
value: option.value,
|
|
40
|
+
"aria-labelledby": titleId,
|
|
41
|
+
"aria-describedby": hasDescription ? descriptionId : void 0,
|
|
42
|
+
children: /*#__PURE__*/ jsx(Radio.Indicator, {
|
|
43
|
+
className: ChoiceCard_module.mark,
|
|
44
|
+
children: /*#__PURE__*/ jsx(CheckIcon, {})
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function ChoiceCard({ label, options, name, description, error, value, defaultValue, onValueChange, onBlur, required = false, disabled = false, columns = 2 }) {
|
|
52
|
+
const labelId = useId();
|
|
53
|
+
const [chosenValue, setChosenValue] = useControllable(value, defaultValue ?? null);
|
|
54
|
+
return /*#__PURE__*/ jsx(GroupFrame, {
|
|
55
|
+
labelId: labelId,
|
|
56
|
+
label: label,
|
|
57
|
+
name: name,
|
|
58
|
+
description: description,
|
|
59
|
+
error: error,
|
|
60
|
+
required: required,
|
|
61
|
+
disabled: disabled,
|
|
62
|
+
children: /*#__PURE__*/ jsx(RadioGroup, {
|
|
63
|
+
className: ChoiceCard_module.grid,
|
|
64
|
+
"data-columns": columns,
|
|
65
|
+
"aria-labelledby": labelId,
|
|
66
|
+
value: chosenValue,
|
|
67
|
+
onValueChange: (nextValue)=>{
|
|
68
|
+
if (null === nextValue) return;
|
|
69
|
+
setChosenValue(nextValue);
|
|
70
|
+
onValueChange?.(nextValue);
|
|
71
|
+
},
|
|
72
|
+
onBlur: onBlur,
|
|
73
|
+
required: required,
|
|
74
|
+
children: options.map((option)=>/*#__PURE__*/ jsx(ChoiceCardItem, {
|
|
75
|
+
option: option,
|
|
76
|
+
checked: chosenValue === option.value
|
|
77
|
+
}, option.value))
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
export { ChoiceCard };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "./ChoiceCard_module.css";
|
|
2
|
+
const ChoiceCard_module = {
|
|
3
|
+
grid: "ui0-7-0-grid-oumaG",
|
|
4
|
+
item: "ui0-7-0-item-eo3zz",
|
|
5
|
+
card: "ui0-7-0-card-bDmw_",
|
|
6
|
+
ring: "ui0-7-0-ring-eysJU",
|
|
7
|
+
disc: "ui0-7-0-disc-sj8HT",
|
|
8
|
+
title: "ui0-7-0-title-bCoo6",
|
|
9
|
+
description: "ui0-7-0-description-oa_zk",
|
|
10
|
+
mark: "ui0-7-0-mark-PphgZ"
|
|
11
|
+
};
|
|
12
|
+
export default ChoiceCard_module;
|