@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
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
.ui0-7-0-root-Gqpml {
|
|
2
|
+
gap: var(--space-3);
|
|
3
|
+
padding: var(--space-5);
|
|
4
|
+
border-radius: var(--radius-card);
|
|
5
|
+
background: var(--color-surface-raised);
|
|
6
|
+
box-shadow: var(--shadow-soft);
|
|
7
|
+
color: var(--color-text);
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
display: flex;
|
|
10
|
+
position: relative;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ui0-7-0-root-Gqpml[data-align="center"] {
|
|
14
|
+
text-align: center;
|
|
15
|
+
align-items: center;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ui0-7-0-root-Gqpml[data-align="start"] {
|
|
19
|
+
text-align: start;
|
|
20
|
+
align-items: flex-start;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ui0-7-0-root-Gqpml[data-tone="selected"] {
|
|
24
|
+
background: var(--color-selected);
|
|
25
|
+
color: var(--color-selected-text);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ui0-7-0-illustration-gt1N5 {
|
|
29
|
+
display: flex;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ui0-7-0-heading-aF5X5 {
|
|
33
|
+
font-size: var(--empty-state-heading-size, var(--text-h3));
|
|
34
|
+
font-family: var(--font-display);
|
|
35
|
+
font-weight: var(--font-weight-display);
|
|
36
|
+
font-stretch: var(--font-stretch-display);
|
|
37
|
+
text-transform: var(--text-transform-display);
|
|
38
|
+
letter-spacing: var(--tracking-heading);
|
|
39
|
+
line-height: var(--leading-display);
|
|
40
|
+
margin: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.ui0-7-0-body-uj_Dd {
|
|
44
|
+
max-width: 28ch;
|
|
45
|
+
font-size: var(--text-md);
|
|
46
|
+
font-family: var(--font-body);
|
|
47
|
+
font-weight: var(--font-weight-body);
|
|
48
|
+
line-height: var(--leading-prose);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.ui0-7-0-root-Gqpml[data-tone="neutral"] .ui0-7-0-body-uj_Dd {
|
|
52
|
+
color: var(--color-text-muted);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.ui0-7-0-actions-AwsGn {
|
|
56
|
+
gap: var(--space-2);
|
|
57
|
+
margin-top: var(--space-2);
|
|
58
|
+
flex-wrap: wrap;
|
|
59
|
+
display: flex;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.ui0-7-0-root-Gqpml[data-align="center"] .ui0-7-0-actions-AwsGn {
|
|
63
|
+
justify-content: center;
|
|
64
|
+
}
|
|
65
|
+
|
|
@@ -17,8 +17,11 @@ export interface ErrorBoundaryProps {
|
|
|
17
17
|
resetKeys?: readonly unknown[];
|
|
18
18
|
/** The default fallback's heading. */
|
|
19
19
|
heading?: string;
|
|
20
|
-
/**
|
|
21
|
-
|
|
20
|
+
/**
|
|
21
|
+
* The heading's level. Match it to where the alert sits in the page's outline. Use 1 only when
|
|
22
|
+
* the boundary is the page's main heading, e.g. a full-page error.
|
|
23
|
+
*/
|
|
24
|
+
headingLevel?: 1 | 2 | 3 | 4;
|
|
22
25
|
/** The default fallback's retry control. */
|
|
23
26
|
retryLabel?: string;
|
|
24
27
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Input as BaseInput } from '@base-ui/react/input';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
export interface AffixInputProps extends Omit<BaseInput.Props, 'className' | 'ref'> {
|
|
4
|
+
/**
|
|
5
|
+
* A glyph before the text, decorative: the wrapper marks it `aria-hidden`, and the field's label
|
|
6
|
+
* names the input. Absent (or `null`, `false`), there is no wrapper and the input wears the skin
|
|
7
|
+
* itself.
|
|
8
|
+
*/
|
|
9
|
+
startIcon?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* With `startIcon`, the browser's own picker button is hidden (the icon sits where it would be
|
|
12
|
+
* looked for) and a press on the icon opens the picker instead. `TimePicker` asks for it; typing
|
|
13
|
+
* in the input is unchanged.
|
|
14
|
+
*/
|
|
15
|
+
iconOpensPicker?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The `Input` that `TextInput` and `TimePicker` share, with room for a leading icon. Internal: not
|
|
19
|
+
* exported from `src/index.ts`.
|
|
20
|
+
*
|
|
21
|
+
* With an icon, the skin moves to a pill around the icon and the input (`.control` and `.affix`),
|
|
22
|
+
* and the input drops to `.affixInput`: borderless and stretched across what the icon leaves. Every
|
|
23
|
+
* other prop reaches the input exactly as it does without an icon, so the surrounding `Field`'s
|
|
24
|
+
* label, `aria-describedby`, `aria-invalid` and `data-invalid` land on the input and not on the
|
|
25
|
+
* pill. The pill reads the input's `data-invalid` and `data-disabled` through `:has`, because the
|
|
26
|
+
* state Base UI writes is on the input.
|
|
27
|
+
*/
|
|
28
|
+
export declare function AffixInput({ startIcon, iconOpensPicker, ...inputProps }: AffixInputProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Input } from "@base-ui/react/input";
|
|
3
|
+
import { useRef } from "react";
|
|
4
|
+
import field_module from "../../styles/field.module.js";
|
|
5
|
+
import { focusInputFromPill } from "../../utils/focusInputFromPill.js";
|
|
6
|
+
const PICKER_REFUSALS = new Set([
|
|
7
|
+
'NotAllowedError',
|
|
8
|
+
'InvalidStateError',
|
|
9
|
+
'SecurityError'
|
|
10
|
+
]);
|
|
11
|
+
function showPickerOf(input) {
|
|
12
|
+
try {
|
|
13
|
+
input.showPicker?.();
|
|
14
|
+
} catch (error) {
|
|
15
|
+
if (!(error instanceof DOMException) || !PICKER_REFUSALS.has(error.name)) throw error;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function AffixInput({ startIcon, iconOpensPicker = false, ...inputProps }) {
|
|
19
|
+
const inputRef = useRef(null);
|
|
20
|
+
if (!startIcon) return /*#__PURE__*/ jsx(Input, {
|
|
21
|
+
...inputProps,
|
|
22
|
+
className: field_module.control
|
|
23
|
+
});
|
|
24
|
+
function handlePillMouseDown(event) {
|
|
25
|
+
const input = inputRef.current;
|
|
26
|
+
if (!focusInputFromPill(event, input)) return;
|
|
27
|
+
if (iconOpensPicker && input instanceof HTMLInputElement && event.target instanceof Element && null !== event.target.closest(`.${field_module.affixIcon}`)) showPickerOf(input);
|
|
28
|
+
}
|
|
29
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
30
|
+
className: [
|
|
31
|
+
field_module.control,
|
|
32
|
+
field_module.affix
|
|
33
|
+
].join(' '),
|
|
34
|
+
"data-icon-opens-picker": iconOpensPicker ? '' : void 0,
|
|
35
|
+
onMouseDown: handlePillMouseDown,
|
|
36
|
+
children: [
|
|
37
|
+
/*#__PURE__*/ jsx("span", {
|
|
38
|
+
className: field_module.affixIcon,
|
|
39
|
+
"aria-hidden": "true",
|
|
40
|
+
children: startIcon
|
|
41
|
+
}),
|
|
42
|
+
/*#__PURE__*/ jsx(Input, {
|
|
43
|
+
...inputProps,
|
|
44
|
+
ref: inputRef,
|
|
45
|
+
className: field_module.affixInput
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export { AffixInput };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface GroupFrameProps {
|
|
3
|
+
/** The legend's id. The group inside points its `aria-labelledby` at it. */
|
|
4
|
+
labelId: string;
|
|
5
|
+
label: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
error?: string;
|
|
9
|
+
required: boolean;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
/** The group itself, and anything that sits between it and the messages. */
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Internal, not exported from `src/index.ts`. The frame of a field whose control is a group of
|
|
16
|
+
* options (`RadioGroup`, `ChoiceCard`, `ToggleChipGroup`): the `Field.Root`, a legend naming the
|
|
17
|
+
* group, the group, then the description and error.
|
|
18
|
+
*/
|
|
19
|
+
export declare function GroupFrame({ labelId, label, name, description, error, required, disabled, children, }: GroupFrameProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Field } from "@base-ui/react/field";
|
|
3
|
+
import field_module from "../../styles/field.module.js";
|
|
4
|
+
import { FieldMessages, RequiredMark } from "./Field.js";
|
|
5
|
+
function GroupFrame({ labelId, label, name, description, error, required, disabled, children }) {
|
|
6
|
+
return /*#__PURE__*/ jsxs(Field.Root, {
|
|
7
|
+
className: field_module.frame,
|
|
8
|
+
name: name,
|
|
9
|
+
disabled: disabled,
|
|
10
|
+
invalid: void 0 !== error,
|
|
11
|
+
children: [
|
|
12
|
+
/*#__PURE__*/ jsxs("span", {
|
|
13
|
+
className: field_module.legend,
|
|
14
|
+
id: labelId,
|
|
15
|
+
"data-disabled": disabled ? '' : void 0,
|
|
16
|
+
children: [
|
|
17
|
+
label,
|
|
18
|
+
/*#__PURE__*/ jsx(RequiredMark, {
|
|
19
|
+
when: required
|
|
20
|
+
})
|
|
21
|
+
]
|
|
22
|
+
}),
|
|
23
|
+
children,
|
|
24
|
+
/*#__PURE__*/ jsx(FieldMessages, {
|
|
25
|
+
description: description,
|
|
26
|
+
error: error
|
|
27
|
+
})
|
|
28
|
+
]
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export { GroupFrame };
|
|
@@ -7,8 +7,14 @@ export interface PickerFieldProps extends FieldFrameProps {
|
|
|
7
7
|
value: string | null;
|
|
8
8
|
/** The trigger's words: the value as it reads, or the placeholder. */
|
|
9
9
|
valueText: string;
|
|
10
|
-
/** Sits at the end of the trigger
|
|
10
|
+
/** Sits at the end of the trigger, or at the start with `iconPlacement`. */
|
|
11
11
|
icon: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Which end of the trigger the icon sits at. `start` puts its wrapper before the value and writes
|
|
14
|
+
* `data-icon-placement="start"` on the trigger, which then packs both to the start; `end` is the
|
|
15
|
+
* trigger as it was, with no attribute.
|
|
16
|
+
*/
|
|
17
|
+
iconPlacement?: 'start' | 'end';
|
|
12
18
|
/** Added to the icon's wrapper, for a picker whose icon reacts to the popup. */
|
|
13
19
|
iconClassName?: string;
|
|
14
20
|
/** Joins the trigger's accessible name when the field is `required`. */
|
|
@@ -38,4 +44,4 @@ export interface PickerFieldProps extends FieldFrameProps {
|
|
|
38
44
|
* element gets the name, the description, `aria-invalid`, `Form`'s focus and the clearing of a
|
|
39
45
|
* `Form` error as any Base UI control does, none of which a hidden input could use.
|
|
40
46
|
*/
|
|
41
|
-
export declare function PickerField({ label, name, description, error, required, disabled, value, valueText, icon, iconClassName, requiredWord, validate, onReset, clearable, clearLabel, onClear, onBlur, onTriggerKeyDown, open, onOpenChange, modal, children, }: PickerFieldProps): import("react").JSX.Element;
|
|
47
|
+
export declare function PickerField({ label, name, description, error, required, disabled, value, valueText, icon, iconPlacement, iconClassName, requiredWord, validate, onReset, clearable, clearLabel, onClear, onBlur, onTriggerKeyDown, open, onOpenChange, modal, children, }: PickerFieldProps): import("react").JSX.Element;
|
|
@@ -9,12 +9,20 @@ import { useFormValue } from "../Form/FormContext.js";
|
|
|
9
9
|
import { IconButton } from "../IconButton/IconButton.js";
|
|
10
10
|
import { FieldMessages, RequiredMark } from "./Field.js";
|
|
11
11
|
import PickerField_module from "./PickerField.module.js";
|
|
12
|
-
function PickerField({ label, name, description, error, required = false, disabled = false, value, valueText, icon, iconClassName, requiredWord, validate, onReset, clearable, clearLabel, onClear, onBlur, onTriggerKeyDown, open, onOpenChange, modal, children }) {
|
|
12
|
+
function PickerField({ label, name, description, error, required = false, disabled = false, value, valueText, icon, iconPlacement = 'end', iconClassName, requiredWord, validate, onReset, clearable, clearLabel, onClear, onBlur, onTriggerKeyDown, open, onOpenChange, modal, children }) {
|
|
13
13
|
const labelId = useId();
|
|
14
14
|
const valueId = useId();
|
|
15
15
|
const requiredId = useId();
|
|
16
16
|
const triggerRef = useRef(null);
|
|
17
|
+
const iconAtStart = 'start' === iconPlacement;
|
|
17
18
|
const hiddenInputRef = useRef(null);
|
|
19
|
+
const iconSpan = /*#__PURE__*/ jsx("span", {
|
|
20
|
+
className: [
|
|
21
|
+
PickerField_module.icon,
|
|
22
|
+
iconClassName
|
|
23
|
+
].filter(Boolean).join(' '),
|
|
24
|
+
children: icon
|
|
25
|
+
});
|
|
18
26
|
useFormValue(disabled ? void 0 : name, value);
|
|
19
27
|
useFormReset(hiddenInputRef, onReset);
|
|
20
28
|
return /*#__PURE__*/ jsxs(Field.Root, {
|
|
@@ -60,24 +68,20 @@ function PickerField({ label, name, description, error, required = false, disabl
|
|
|
60
68
|
required ? requiredId : null,
|
|
61
69
|
valueId
|
|
62
70
|
].filter(Boolean).join(' '),
|
|
71
|
+
"data-icon-placement": iconAtStart ? 'start' : void 0,
|
|
63
72
|
render: /*#__PURE__*/ jsx("button", {
|
|
64
73
|
type: "button"
|
|
65
74
|
})
|
|
66
75
|
}),
|
|
67
76
|
children: [
|
|
77
|
+
iconAtStart ? iconSpan : null,
|
|
68
78
|
/*#__PURE__*/ jsx("span", {
|
|
69
79
|
id: valueId,
|
|
70
80
|
className: PickerField_module.value,
|
|
71
81
|
"data-placeholder": null === value ? '' : void 0,
|
|
72
82
|
children: valueText
|
|
73
83
|
}),
|
|
74
|
-
|
|
75
|
-
className: [
|
|
76
|
-
PickerField_module.icon,
|
|
77
|
-
iconClassName
|
|
78
|
-
].filter(Boolean).join(' '),
|
|
79
|
-
children: icon
|
|
80
|
-
})
|
|
84
|
+
iconAtStart ? null : iconSpan
|
|
81
85
|
]
|
|
82
86
|
}),
|
|
83
87
|
children
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./PickerField_module.css";
|
|
2
2
|
const PickerField_module = {
|
|
3
|
-
row: "row-nA5dt",
|
|
4
|
-
trigger: "trigger-EkNQz",
|
|
5
|
-
value: "value-iJ2rA",
|
|
6
|
-
icon: "icon-fNz5y"
|
|
3
|
+
row: "ui0-7-0-row-nA5dt",
|
|
4
|
+
trigger: "ui0-7-0-trigger-EkNQz",
|
|
5
|
+
value: "ui0-7-0-value-iJ2rA",
|
|
6
|
+
icon: "ui0-7-0-icon-fNz5y"
|
|
7
7
|
};
|
|
8
8
|
export default PickerField_module;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
.row-nA5dt {
|
|
1
|
+
.ui0-7-0-row-nA5dt {
|
|
2
2
|
align-items: center;
|
|
3
3
|
gap: var(--space-2);
|
|
4
4
|
display: flex;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
.trigger-EkNQz {
|
|
7
|
+
.ui0-7-0-trigger-EkNQz {
|
|
8
8
|
justify-content: space-between;
|
|
9
9
|
gap: var(--space-3);
|
|
10
10
|
text-align: start;
|
|
@@ -13,23 +13,28 @@
|
|
|
13
13
|
min-width: 0;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
.
|
|
16
|
+
.ui0-7-0-trigger-EkNQz[data-icon-placement="start"] {
|
|
17
|
+
justify-content: flex-start;
|
|
18
|
+
gap: var(--space-2);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.ui0-7-0-value-iJ2rA {
|
|
17
22
|
white-space: nowrap;
|
|
18
23
|
text-overflow: ellipsis;
|
|
19
24
|
overflow: hidden;
|
|
20
25
|
}
|
|
21
26
|
|
|
22
|
-
.value-iJ2rA[data-placeholder] {
|
|
27
|
+
.ui0-7-0-value-iJ2rA[data-placeholder] {
|
|
23
28
|
color: var(--color-text-muted);
|
|
24
29
|
}
|
|
25
30
|
|
|
26
|
-
.icon-fNz5y {
|
|
31
|
+
.ui0-7-0-icon-fNz5y {
|
|
27
32
|
color: var(--color-text-muted);
|
|
28
33
|
flex: none;
|
|
29
34
|
display: inline-flex;
|
|
30
35
|
}
|
|
31
36
|
|
|
32
|
-
.icon-fNz5y > svg {
|
|
37
|
+
.ui0-7-0-icon-fNz5y > svg {
|
|
33
38
|
width: 1rem;
|
|
34
39
|
height: 1rem;
|
|
35
40
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import "./FilterBar_module.css";
|
|
2
2
|
const FilterBar_module = {
|
|
3
|
-
root: "root-qnTXQ",
|
|
4
|
-
controls: "controls-UYZLG",
|
|
5
|
-
search: "search-tu3RA",
|
|
6
|
-
summary: "summary-CSd_P",
|
|
7
|
-
count: "count-dGqXH",
|
|
8
|
-
chips: "chips-BHcAD",
|
|
9
|
-
chip: "chip-wCX2N",
|
|
10
|
-
chipLabel: "chipLabel-lhx4e",
|
|
11
|
-
remove: "remove-RNUMA"
|
|
3
|
+
root: "ui0-7-0-root-qnTXQ",
|
|
4
|
+
controls: "ui0-7-0-controls-UYZLG",
|
|
5
|
+
search: "ui0-7-0-search-tu3RA",
|
|
6
|
+
summary: "ui0-7-0-summary-CSd_P",
|
|
7
|
+
count: "ui0-7-0-count-dGqXH",
|
|
8
|
+
chips: "ui0-7-0-chips-BHcAD",
|
|
9
|
+
chip: "ui0-7-0-chip-wCX2N",
|
|
10
|
+
chipLabel: "ui0-7-0-chipLabel-lhx4e",
|
|
11
|
+
remove: "ui0-7-0-remove-RNUMA"
|
|
12
12
|
};
|
|
13
13
|
export default FilterBar_module;
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
.root-qnTXQ {
|
|
1
|
+
.ui0-7-0-root-qnTXQ {
|
|
2
2
|
gap: var(--space-3);
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
min-width: 0;
|
|
5
5
|
display: flex;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
.controls-UYZLG {
|
|
8
|
+
.ui0-7-0-controls-UYZLG {
|
|
9
9
|
align-items: flex-end;
|
|
10
10
|
gap: var(--space-3);
|
|
11
11
|
flex-wrap: wrap;
|
|
12
12
|
display: flex;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
.controls-UYZLG > * {
|
|
15
|
+
.ui0-7-0-controls-UYZLG > * {
|
|
16
16
|
min-width: 0;
|
|
17
17
|
max-width: 100%;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
.search-tu3RA {
|
|
20
|
+
.ui0-7-0-search-tu3RA {
|
|
21
21
|
flex: 16rem;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
.summary-CSd_P {
|
|
24
|
+
.ui0-7-0-summary-CSd_P {
|
|
25
25
|
align-items: center;
|
|
26
26
|
gap: var(--space-2);
|
|
27
27
|
flex-wrap: wrap;
|
|
28
28
|
display: flex;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.count-dGqXH {
|
|
31
|
+
.ui0-7-0-count-dGqXH {
|
|
32
32
|
color: var(--color-text-muted);
|
|
33
33
|
font-size: var(--text-sm);
|
|
34
34
|
line-height: var(--leading-snug);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
.chips-BHcAD {
|
|
37
|
+
.ui0-7-0-chips-BHcAD {
|
|
38
38
|
gap: var(--space-2);
|
|
39
39
|
flex-wrap: wrap;
|
|
40
40
|
min-width: 0;
|
|
@@ -44,19 +44,19 @@
|
|
|
44
44
|
display: flex;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
.chip-wCX2N {
|
|
47
|
+
.ui0-7-0-chip-wCX2N {
|
|
48
48
|
min-width: 0;
|
|
49
49
|
max-width: 100%;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
.chipLabel-lhx4e {
|
|
52
|
+
.ui0-7-0-chipLabel-lhx4e {
|
|
53
53
|
min-width: 0;
|
|
54
54
|
padding-block: var(--space-1);
|
|
55
55
|
white-space: normal;
|
|
56
56
|
overflow-wrap: anywhere;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
.remove-RNUMA {
|
|
59
|
+
.ui0-7-0-remove-RNUMA {
|
|
60
60
|
width: 1.5rem;
|
|
61
61
|
height: 1.5rem;
|
|
62
62
|
border-radius: var(--radius-full);
|
|
@@ -77,20 +77,20 @@
|
|
|
77
77
|
position: relative;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
.remove-RNUMA:after {
|
|
80
|
+
.ui0-7-0-remove-RNUMA:after {
|
|
81
81
|
--remove-reach: calc(var(--space-2) * -1);
|
|
82
82
|
content: "";
|
|
83
83
|
inset: var(--remove-reach);
|
|
84
84
|
position: absolute;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
.remove-RNUMA > svg {
|
|
87
|
+
.ui0-7-0-remove-RNUMA > svg {
|
|
88
88
|
width: .875rem;
|
|
89
89
|
height: .875rem;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
@media (hover: hover) {
|
|
93
|
-
.remove-RNUMA:hover {
|
|
93
|
+
.ui0-7-0-remove-RNUMA:hover {
|
|
94
94
|
background: var(--color-surface-3);
|
|
95
95
|
color: var(--color-text);
|
|
96
96
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
export interface FormProps<Values extends object = Record<string, unknown>> {
|
|
3
3
|
/**
|
|
4
|
-
* The values as a plain object keyed by field `name`, once nothing is invalid. A text control
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* browser
|
|
4
|
+
* The values as a plain object keyed by field `name`, once nothing is invalid. A text control or
|
|
5
|
+
* a `Select` gives a string, `''` when empty; a `RadioGroup` a string or `null`; `Checkbox` and
|
|
6
|
+
* `Switch` a boolean; `DatePicker` a `YYYY-MM-DD` string or `null`; `TreeSelect` a node's `id` or
|
|
7
|
+
* `null`; `ToggleChipGroup` the pressed value or `null` when single, and an array of the pressed
|
|
8
|
+
* values in the options' order, empty when none is, when multiple; and `Upload` an array of
|
|
9
|
+
* `File`s, empty when none is chosen and an array even without `multiple`. A disabled control is
|
|
10
|
+
* left out, as a browser leaves it out, and so is an input that is not one of the library's: a
|
|
11
|
+
* raw `<input name>` has no field frame to report through. The browser's own submit never
|
|
12
|
+
* happens, so `Form` takes no `action`.
|
|
11
13
|
*/
|
|
12
14
|
onSubmit: (values: Values) => void;
|
|
13
15
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Button as BaseButton } from '@base-ui/react/button';
|
|
2
2
|
import type { ComponentPropsWithoutRef } from 'react';
|
|
3
|
-
export type IconButtonVariant = 'primary' | 'secondary' | 'ghost';
|
|
3
|
+
export type IconButtonVariant = 'primary' | 'secondary' | 'ghost' | 'soft';
|
|
4
4
|
export type IconButtonSize = 'md' | 'sm';
|
|
5
5
|
export interface IconButtonProps extends Omit<ComponentPropsWithoutRef<typeof BaseButton>, 'className' | 'aria-label' | 'aria-labelledby'> {
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
.root-TzUP5 {
|
|
2
|
-
min-height: var(--size-
|
|
3
|
-
min-width: var(--size-
|
|
1
|
+
.ui0-7-0-root-TzUP5 {
|
|
2
|
+
min-height: var(--size-control);
|
|
3
|
+
min-width: var(--size-control);
|
|
4
4
|
border-radius: var(--radius-full);
|
|
5
5
|
color: var(--color-text-muted);
|
|
6
6
|
cursor: pointer;
|
|
@@ -16,57 +16,68 @@
|
|
|
16
16
|
display: inline-flex;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
.root-TzUP5[data-size="sm"] {
|
|
20
|
-
min-
|
|
21
|
-
min-
|
|
19
|
+
.ui0-7-0-root-TzUP5[data-size="sm"] {
|
|
20
|
+
min-height: var(--size-control-sm);
|
|
21
|
+
min-width: var(--size-control-sm);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
.root-TzUP5[data-variant="secondary"] {
|
|
25
|
-
border-radius: var(--radius-
|
|
24
|
+
.ui0-7-0-root-TzUP5[data-variant="secondary"] {
|
|
25
|
+
border-radius: var(--radius-control);
|
|
26
26
|
background: var(--color-surface-raised);
|
|
27
27
|
border-color: var(--color-border-strong);
|
|
28
28
|
color: var(--color-text);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.root-TzUP5[data-variant="primary"] {
|
|
31
|
+
.ui0-7-0-root-TzUP5[data-variant="primary"] {
|
|
32
32
|
background: var(--color-accent);
|
|
33
33
|
color: var(--color-accent-text);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
.ui0-7-0-root-TzUP5[data-variant="soft"] {
|
|
37
|
+
background: var(--color-surface-2);
|
|
38
|
+
color: var(--color-text);
|
|
39
|
+
box-shadow: var(--icon-button-shadow, none);
|
|
40
|
+
border-color: #0000;
|
|
41
|
+
}
|
|
42
|
+
|
|
36
43
|
@media (hover: hover) {
|
|
37
|
-
.root-TzUP5[data-variant="ghost"]:hover:not([data-disabled]) {
|
|
44
|
+
.ui0-7-0-root-TzUP5[data-variant="ghost"]:hover:not([data-disabled]) {
|
|
38
45
|
background: var(--color-surface-2);
|
|
39
46
|
color: var(--color-text);
|
|
40
47
|
}
|
|
41
48
|
|
|
42
|
-
.root-TzUP5[data-variant="secondary"]:hover:not([data-disabled]) {
|
|
49
|
+
.ui0-7-0-root-TzUP5[data-variant="secondary"]:hover:not([data-disabled]) {
|
|
43
50
|
background: var(--color-surface-2);
|
|
44
51
|
}
|
|
45
52
|
|
|
46
|
-
.root-TzUP5[data-variant="primary"]:hover:not([data-disabled]) {
|
|
53
|
+
.ui0-7-0-root-TzUP5[data-variant="primary"]:hover:not([data-disabled]) {
|
|
47
54
|
background: var(--color-accent-hover);
|
|
48
55
|
}
|
|
56
|
+
|
|
57
|
+
.ui0-7-0-root-TzUP5[data-variant="soft"]:hover:not([data-disabled]) {
|
|
58
|
+
background: var(--color-surface-3);
|
|
59
|
+
}
|
|
49
60
|
}
|
|
50
61
|
|
|
51
|
-
.root-TzUP5:active:not([data-disabled]) {
|
|
62
|
+
.ui0-7-0-root-TzUP5:active:not([data-disabled]) {
|
|
52
63
|
transform: scale(.96);
|
|
53
64
|
}
|
|
54
65
|
|
|
55
|
-
.root-TzUP5[data-disabled] {
|
|
66
|
+
.ui0-7-0-root-TzUP5[data-disabled] {
|
|
56
67
|
cursor: not-allowed;
|
|
57
68
|
opacity: .45;
|
|
58
69
|
}
|
|
59
70
|
|
|
60
|
-
.icon-WceXT {
|
|
71
|
+
.ui0-7-0-icon-WceXT {
|
|
61
72
|
display: inline-flex;
|
|
62
73
|
}
|
|
63
74
|
|
|
64
|
-
.icon-WceXT > svg {
|
|
75
|
+
.ui0-7-0-icon-WceXT > svg {
|
|
65
76
|
width: 1.25rem;
|
|
66
77
|
height: 1.25rem;
|
|
67
78
|
}
|
|
68
79
|
|
|
69
|
-
.root-TzUP5[data-size="sm"] .icon-WceXT > svg {
|
|
80
|
+
.ui0-7-0-root-TzUP5[data-size="sm"] .ui0-7-0-icon-WceXT > svg, .ui0-7-0-root-TzUP5[data-variant="soft"] .ui0-7-0-icon-WceXT > svg {
|
|
70
81
|
width: 1rem;
|
|
71
82
|
height: 1rem;
|
|
72
83
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Menu } from "@base-ui/react/menu";
|
|
3
3
|
import { Fragment } from "react";
|
|
4
|
+
import { usePortalContainer } from "../ThemeScope/PortalContainerContext.js";
|
|
4
5
|
import popup_module from "../../styles/popup.module.js";
|
|
5
6
|
import Menu_module from "./Menu.module.js";
|
|
6
7
|
function Menu_Menu({ trigger, items, side = 'bottom', align = 'end', sideOffset = 8, modal = false, open, defaultOpen, onOpenChange }) {
|
|
8
|
+
const container = usePortalContainer();
|
|
7
9
|
return /*#__PURE__*/ jsxs(Menu.Root, {
|
|
8
10
|
open: open,
|
|
9
11
|
defaultOpen: defaultOpen,
|
|
@@ -14,6 +16,7 @@ function Menu_Menu({ trigger, items, side = 'bottom', align = 'end', sideOffset
|
|
|
14
16
|
render: trigger
|
|
15
17
|
}),
|
|
16
18
|
/*#__PURE__*/ jsx(Menu.Portal, {
|
|
19
|
+
container: container,
|
|
17
20
|
children: /*#__PURE__*/ jsx(Menu.Positioner, {
|
|
18
21
|
className: popup_module.layer,
|
|
19
22
|
side: side,
|