@calcifer-design/ui 0.3.0 → 0.4.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/Checkbox/Checkbox.d.ts +23 -0
- package/dist/components/Checkbox/Checkbox.js +33 -0
- package/dist/components/Checkbox/Checkbox.module.js +6 -0
- package/dist/components/Checkbox/Checkbox_module.css +16 -0
- package/dist/components/Field/Field.d.ts +118 -0
- package/dist/components/Field/Field.js +84 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +35 -0
- package/dist/components/RadioGroup/RadioGroup.js +64 -0
- package/dist/components/RadioGroup/RadioGroup.module.js +6 -0
- package/dist/components/RadioGroup/RadioGroup_module.css +13 -0
- package/dist/components/Select/Select.d.ts +42 -0
- package/dist/components/Select/Select.js +90 -0
- package/dist/components/Select/Select.module.js +9 -0
- package/dist/components/Select/Select_module.css +70 -0
- package/dist/components/Switch/Switch.d.ts +23 -0
- package/dist/components/Switch/Switch.js +25 -0
- package/dist/components/Switch/Switch.module.js +6 -0
- package/dist/components/Switch/Switch_module.css +41 -0
- package/dist/components/TextInput/TextInput.d.ts +17 -0
- package/dist/components/TextInput/TextInput.js +18 -0
- package/dist/icons/CheckIcon.d.ts +6 -0
- package/dist/icons/CheckIcon.js +17 -0
- package/dist/icons/ChevronDownIcon.d.ts +6 -0
- package/dist/icons/ChevronDownIcon.js +17 -0
- package/dist/icons/MinusIcon.d.ts +5 -0
- package/dist/icons/MinusIcon.js +16 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +6 -0
- package/dist/styles/field.module.js +15 -0
- package/dist/styles/field_module.css +133 -0
- package/dist/styles/popup_module.css +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type FieldFrameProps } from '../Field/Field.js';
|
|
3
|
+
export interface CheckboxProps extends FieldFrameProps {
|
|
4
|
+
/** The text beside the box, and the checkbox's accessible name. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Sits under the row and joins the checkbox's `aria-describedby`. */
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
/** Controlled. Pair it with `onCheckedChange`; use `defaultChecked` for an uncontrolled box. */
|
|
9
|
+
checked?: boolean;
|
|
10
|
+
defaultChecked?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Neither ticked nor unticked: `aria-checked="mixed"`, and a bar instead of a tick. The
|
|
13
|
+
* "select all" state above a list of boxes.
|
|
14
|
+
*/
|
|
15
|
+
indeterminate?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The new checked state. One argument, as on every other control in the tier: Base UI calls
|
|
18
|
+
* its own callback `(checked, eventDetails)` and this wrapper drops the second, which no
|
|
19
|
+
* consumer can read without a cast.
|
|
20
|
+
*/
|
|
21
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare function Checkbox({ label, name, description, error, checked, defaultChecked, indeterminate, onCheckedChange, required, disabled, }: CheckboxProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Checkbox } from "@base-ui/react/checkbox";
|
|
3
|
+
import { CheckIcon } from "../../icons/CheckIcon.js";
|
|
4
|
+
import { MinusIcon } from "../../icons/MinusIcon.js";
|
|
5
|
+
import field_module from "../../styles/field.module.js";
|
|
6
|
+
import { InlineField } from "../Field/Field.js";
|
|
7
|
+
import Checkbox_module from "./Checkbox.module.js";
|
|
8
|
+
function Checkbox_Checkbox({ label, name, description, error, checked, defaultChecked, indeterminate = false, onCheckedChange, required = false, disabled = false }) {
|
|
9
|
+
return /*#__PURE__*/ jsx(InlineField, {
|
|
10
|
+
label: label,
|
|
11
|
+
name: name,
|
|
12
|
+
description: description,
|
|
13
|
+
error: error,
|
|
14
|
+
required: required,
|
|
15
|
+
disabled: disabled,
|
|
16
|
+
children: /*#__PURE__*/ jsx(Checkbox.Root, {
|
|
17
|
+
className: [
|
|
18
|
+
field_module.controlBox,
|
|
19
|
+
Checkbox_module.box
|
|
20
|
+
].join(' '),
|
|
21
|
+
checked: checked,
|
|
22
|
+
defaultChecked: defaultChecked,
|
|
23
|
+
indeterminate: indeterminate,
|
|
24
|
+
onCheckedChange: (nextChecked)=>onCheckedChange?.(nextChecked),
|
|
25
|
+
required: required,
|
|
26
|
+
children: /*#__PURE__*/ jsx(Checkbox.Indicator, {
|
|
27
|
+
className: Checkbox_module.indicator,
|
|
28
|
+
children: indeterminate ? /*#__PURE__*/ jsx(MinusIcon, {}) : /*#__PURE__*/ jsx(CheckIcon, {})
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export { Checkbox_Checkbox as Checkbox };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.box-DHMQq {
|
|
2
|
+
border-radius: var(--radius-sm);
|
|
3
|
+
width: 1.25rem;
|
|
4
|
+
height: 1.25rem;
|
|
5
|
+
color: var(--color-accent-text);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.indicator-g_8JY {
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.indicator-g_8JY > svg {
|
|
13
|
+
width: .875rem;
|
|
14
|
+
height: .875rem;
|
|
15
|
+
}
|
|
16
|
+
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/** Internal. Read by `TextInput`; not exported from the barrel. */
|
|
3
|
+
export declare function useFieldRequired(): boolean;
|
|
4
|
+
export interface FieldMessagesProps {
|
|
5
|
+
/** Sits under the control and joins the control's `aria-describedby`. */
|
|
6
|
+
description: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* The description node's own id. Left `undefined` lets Base UI generate one; a later
|
|
9
|
+
* component's own frame passes an id of its own when something else needs to point at the
|
|
10
|
+
* same node.
|
|
11
|
+
*/
|
|
12
|
+
descriptionId?: string;
|
|
13
|
+
/** The validation message. Its presence — not its content — is the error state. */
|
|
14
|
+
error: string | undefined;
|
|
15
|
+
/** The error node's own id, on the same terms as `descriptionId`. */
|
|
16
|
+
errorId?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The description/error block every Tier 3 field frame renders: a description that shows
|
|
20
|
+
* whenever one is given, and an error that only shows once one is given. Exported, but
|
|
21
|
+
* deliberately absent from `src/index.ts` — not part of the barrel, exactly as
|
|
22
|
+
* `useFieldRequired` above and `icons/CloseIcon` are reachable across modules without being
|
|
23
|
+
* published. `Field` is the first of six components that render this exact pair; `Select`,
|
|
24
|
+
* `Checkbox`, `RadioGroup` and `Switch` import it from here in later tasks, each supplying its
|
|
25
|
+
* own frame's `description` and `error` and, where its frame does not already sit inside a
|
|
26
|
+
* `Field.Root` whose context wires `aria-describedby` on its own, the ids that frame needs the
|
|
27
|
+
* nodes to carry.
|
|
28
|
+
*/
|
|
29
|
+
export declare function FieldMessages({ description, descriptionId, error, errorId }: FieldMessagesProps): import("react").JSX.Element;
|
|
30
|
+
export interface RequiredMarkProps {
|
|
31
|
+
/** Draws the mark when true. Every frame passes its own `required` prop straight in. */
|
|
32
|
+
when: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The required mark every Tier 3 frame draws after its label. Childless and `aria-hidden` on
|
|
36
|
+
* purpose: the control's own `required` attribute is what carries the requirement into the
|
|
37
|
+
* accessibility tree, and the asterisk is generated content, because a text child would join
|
|
38
|
+
* the label's raw text content — which is what Testing Library's `getByLabelText` matches
|
|
39
|
+
* against. `field.module.css`'s `.required` has the long version. One line written five times
|
|
40
|
+
* before this, and written wrong in two of them. Internal, like `FieldMessages`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function RequiredMark({ when }: RequiredMarkProps): import("react").JSX.Element | null;
|
|
43
|
+
/**
|
|
44
|
+
* The prop set every Tier 3 field frame takes. `Field`, `Select`, `Checkbox`, `RadioGroup`,
|
|
45
|
+
* `Switch` and the `InlineField` below all extend it and restate only the members their own
|
|
46
|
+
* anatomy rewords — a checkbox's label sits beside its box, a radio group's description sits
|
|
47
|
+
* under its options, and `Field` is the one frame whose control is a real `<input>`, so its
|
|
48
|
+
* `required` behaves differently on submit. `TextInput` is the tier's exception: it has no
|
|
49
|
+
* frame of its own and reads `name`, `disabled` and `required` off the one around it.
|
|
50
|
+
*/
|
|
51
|
+
export interface FieldFrameProps {
|
|
52
|
+
/** The visible label, and the control's accessible name. */
|
|
53
|
+
label: string;
|
|
54
|
+
/** Identifies the field when a form is submitted. */
|
|
55
|
+
name?: string;
|
|
56
|
+
/** Sits under the control and joins the control's `aria-describedby`. */
|
|
57
|
+
description?: ReactNode;
|
|
58
|
+
/**
|
|
59
|
+
* The validation message. Its presence — not its content — is the error state: the frame
|
|
60
|
+
* becomes `invalid`, the control gets `aria-invalid="true"` and the message joins the
|
|
61
|
+
* control's `aria-describedby`. Validation itself belongs to the consuming app; the library
|
|
62
|
+
* owns only how an error looks and how it is announced.
|
|
63
|
+
*/
|
|
64
|
+
error?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Draws the required mark and puts `required` on the control. Base UI carries it on the
|
|
67
|
+
* visually hidden, `aria-hidden`, `tabindex="-1"` companion input it submits with — the exact
|
|
68
|
+
* shape a browser refuses to report a validation message on, so the native bubble blocks the
|
|
69
|
+
* submit silently instead. A form driven by a form library must carry `noValidate` on the
|
|
70
|
+
* `<form>`, as `Field`'s own `required` documents and the composed example does.
|
|
71
|
+
*/
|
|
72
|
+
required?: boolean;
|
|
73
|
+
disabled?: boolean;
|
|
74
|
+
}
|
|
75
|
+
export interface FieldProps extends FieldFrameProps {
|
|
76
|
+
/**
|
|
77
|
+
* Identifies the field when a form is submitted. It takes precedence over any `name` the
|
|
78
|
+
* control carries, which is why no control in this tier has one.
|
|
79
|
+
*/
|
|
80
|
+
name?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Draws the required mark and puts `required` on the control. Note that a native `required`
|
|
83
|
+
* also arms the browser's own validation bubble on submit; a form driven by TanStack Form or
|
|
84
|
+
* any other library should carry `noValidate` on the `<form>`, as such forms normally do.
|
|
85
|
+
* `Field`'s control is a real `<input>`, so the browser reports the message rather than
|
|
86
|
+
* blocking the submit in silence, which is what the other four frames' `required` documents.
|
|
87
|
+
*/
|
|
88
|
+
required?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* The control. `TextInput` is the one this tier ships for it; anything else Base UI's field
|
|
91
|
+
* context reaches works too, and `TextInput`'s `render` prop is how a caller's own element —
|
|
92
|
+
* a `<textarea>`, an `<input type="file">` — gets the same wiring and the same skin.
|
|
93
|
+
*
|
|
94
|
+
* `Select`, `Checkbox`, `RadioGroup` and `Switch` are **not** composed in here: each owns its
|
|
95
|
+
* own field frame, because a `<label for>` above a control is not the anatomy any of them has.
|
|
96
|
+
*/
|
|
97
|
+
children: ReactNode;
|
|
98
|
+
}
|
|
99
|
+
export declare function Field({ label, name, description, error, required, disabled, children, }: FieldProps): import("react").JSX.Element;
|
|
100
|
+
export interface InlineFieldProps extends FieldFrameProps {
|
|
101
|
+
/** The text beside the control, and the control's accessible name. */
|
|
102
|
+
label: string;
|
|
103
|
+
/** Sits under the row and joins the control's `aria-describedby`. */
|
|
104
|
+
description?: ReactNode;
|
|
105
|
+
/** Draws the required mark. The control in the row still takes its own `required`. */
|
|
106
|
+
required?: boolean;
|
|
107
|
+
/** The control that sits at the head of the row: a `Checkbox.Root`, a `Switch.Root`. */
|
|
108
|
+
children: ReactNode;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The frame `Checkbox` and `Switch` share: a row whose label wraps the control and the text,
|
|
112
|
+
* with the description and the error beneath it. That is the whole difference between this
|
|
113
|
+
* frame and `Field`'s — the label sits beside the control rather than above it — and it is why
|
|
114
|
+
* neither of those two is composed inside `Field`. Exported, but deliberately absent from
|
|
115
|
+
* `src/index.ts`, on the same terms as `FieldMessages` and `useFieldRequired` above: a
|
|
116
|
+
* consumer composes a `Checkbox` or a `Switch`, not the frame under them.
|
|
117
|
+
*/
|
|
118
|
+
export declare function InlineField({ label, name, description, error, required, disabled, children, }: InlineFieldProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Field } from "@base-ui/react/field";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
import field_module from "../../styles/field.module.js";
|
|
5
|
+
const FieldRequiredContext = /*#__PURE__*/ createContext(false);
|
|
6
|
+
function useFieldRequired() {
|
|
7
|
+
return useContext(FieldRequiredContext);
|
|
8
|
+
}
|
|
9
|
+
function FieldMessages({ description, descriptionId, error, errorId }) {
|
|
10
|
+
const hasDescription = null != description && false !== description;
|
|
11
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
12
|
+
children: [
|
|
13
|
+
hasDescription ? /*#__PURE__*/ jsx(Field.Description, {
|
|
14
|
+
id: descriptionId,
|
|
15
|
+
className: field_module.description,
|
|
16
|
+
children: description
|
|
17
|
+
}) : null,
|
|
18
|
+
void 0 === error ? null : /*#__PURE__*/ jsx(Field.Error, {
|
|
19
|
+
id: errorId,
|
|
20
|
+
className: field_module.error,
|
|
21
|
+
match: true,
|
|
22
|
+
children: error
|
|
23
|
+
})
|
|
24
|
+
]
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function RequiredMark({ when }) {
|
|
28
|
+
return when ? /*#__PURE__*/ jsx("span", {
|
|
29
|
+
className: field_module.required,
|
|
30
|
+
"aria-hidden": "true"
|
|
31
|
+
}) : null;
|
|
32
|
+
}
|
|
33
|
+
function Field_Field({ label, name, description, error, required = false, disabled = false, children }) {
|
|
34
|
+
return /*#__PURE__*/ jsxs(Field.Root, {
|
|
35
|
+
className: field_module.frame,
|
|
36
|
+
name: name,
|
|
37
|
+
disabled: disabled,
|
|
38
|
+
invalid: void 0 !== error,
|
|
39
|
+
children: [
|
|
40
|
+
/*#__PURE__*/ jsxs(Field.Label, {
|
|
41
|
+
className: field_module.label,
|
|
42
|
+
children: [
|
|
43
|
+
label,
|
|
44
|
+
/*#__PURE__*/ jsx(RequiredMark, {
|
|
45
|
+
when: required
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
}),
|
|
49
|
+
/*#__PURE__*/ jsx(FieldRequiredContext.Provider, {
|
|
50
|
+
value: required,
|
|
51
|
+
children: children
|
|
52
|
+
}),
|
|
53
|
+
/*#__PURE__*/ jsx(FieldMessages, {
|
|
54
|
+
description: description,
|
|
55
|
+
error: error
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function InlineField({ label, name, description, error, required = false, disabled = false, children }) {
|
|
61
|
+
return /*#__PURE__*/ jsxs(Field.Root, {
|
|
62
|
+
className: field_module.inlineFrame,
|
|
63
|
+
name: name,
|
|
64
|
+
disabled: disabled,
|
|
65
|
+
invalid: void 0 !== error,
|
|
66
|
+
children: [
|
|
67
|
+
/*#__PURE__*/ jsxs(Field.Label, {
|
|
68
|
+
className: field_module.optionLabel,
|
|
69
|
+
children: [
|
|
70
|
+
children,
|
|
71
|
+
label,
|
|
72
|
+
/*#__PURE__*/ jsx(RequiredMark, {
|
|
73
|
+
when: required
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
}),
|
|
77
|
+
/*#__PURE__*/ jsx(FieldMessages, {
|
|
78
|
+
description: description,
|
|
79
|
+
error: error
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
export { FieldMessages, Field_Field as Field, InlineField, RequiredMark, useFieldRequired };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type FieldFrameProps } from '../Field/Field.js';
|
|
3
|
+
export interface RadioOption {
|
|
4
|
+
/** Submitted with the form, and what `value`/`onValueChange` speak in. */
|
|
5
|
+
value: string;
|
|
6
|
+
/** The visible text, and that one radio's accessible name. */
|
|
7
|
+
label: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface RadioGroupProps extends FieldFrameProps {
|
|
11
|
+
/** Names the group. Rendered as a plain element, not a `<label>` — see the note below. */
|
|
12
|
+
label: string;
|
|
13
|
+
options: RadioOption[];
|
|
14
|
+
/** Sits under the options and joins the group's `aria-describedby`. */
|
|
15
|
+
description?: ReactNode;
|
|
16
|
+
/** Controlled. Pair it with `onValueChange`; use `defaultValue` for an uncontrolled group. */
|
|
17
|
+
value?: string;
|
|
18
|
+
defaultValue?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The newly chosen option's value. One argument, as on every other control in the tier:
|
|
21
|
+
* Base UI calls its own callback `(value, eventDetails)` and this wrapper drops the second,
|
|
22
|
+
* which no consumer can read without a cast.
|
|
23
|
+
*/
|
|
24
|
+
onValueChange?: (value: string) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Called when the focus leaves a radio. A form library marks a field touched on blur, and the
|
|
27
|
+
* adapter in `FormExample` spreads one `onBlur` onto every control; without this prop the
|
|
28
|
+
* group silently dropped it. React's blur bubbles, so moving between the options with the
|
|
29
|
+
* arrow keys fires it too — a form library counts that as touched either way.
|
|
30
|
+
*/
|
|
31
|
+
onBlur?: () => void;
|
|
32
|
+
/** `horizontal` wraps the options along a row; the arrow keys work on both axes either way. */
|
|
33
|
+
orientation?: 'vertical' | 'horizontal';
|
|
34
|
+
}
|
|
35
|
+
export declare function RadioGroup({ label, options, name, description, error, value, defaultValue, onValueChange, onBlur, required, disabled, orientation, }: RadioGroupProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,64 @@
|
|
|
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 field_module from "../../styles/field.module.js";
|
|
7
|
+
import { FieldMessages, RequiredMark } from "../Field/Field.js";
|
|
8
|
+
import RadioGroup_module from "./RadioGroup.module.js";
|
|
9
|
+
function RadioGroup_RadioGroup({ label, options, name, description, error, value, defaultValue, onValueChange, onBlur, required = false, disabled = false, orientation = 'vertical' }) {
|
|
10
|
+
const labelId = useId();
|
|
11
|
+
return /*#__PURE__*/ jsxs(Field.Root, {
|
|
12
|
+
className: field_module.frame,
|
|
13
|
+
name: name,
|
|
14
|
+
disabled: disabled,
|
|
15
|
+
invalid: void 0 !== error,
|
|
16
|
+
children: [
|
|
17
|
+
/*#__PURE__*/ jsxs("span", {
|
|
18
|
+
className: field_module.legend,
|
|
19
|
+
id: labelId,
|
|
20
|
+
"data-disabled": disabled ? '' : void 0,
|
|
21
|
+
children: [
|
|
22
|
+
label,
|
|
23
|
+
/*#__PURE__*/ jsx(RequiredMark, {
|
|
24
|
+
when: required
|
|
25
|
+
})
|
|
26
|
+
]
|
|
27
|
+
}),
|
|
28
|
+
/*#__PURE__*/ jsx(RadioGroup, {
|
|
29
|
+
className: field_module.options,
|
|
30
|
+
"data-orientation": orientation,
|
|
31
|
+
"aria-labelledby": labelId,
|
|
32
|
+
value: value,
|
|
33
|
+
defaultValue: defaultValue,
|
|
34
|
+
onValueChange: (nextValue)=>onValueChange?.(nextValue),
|
|
35
|
+
onBlur: onBlur,
|
|
36
|
+
required: required,
|
|
37
|
+
children: options.map((option)=>/*#__PURE__*/ jsx(Field.Item, {
|
|
38
|
+
disabled: option.disabled,
|
|
39
|
+
children: /*#__PURE__*/ jsxs(Field.Label, {
|
|
40
|
+
className: field_module.optionLabel,
|
|
41
|
+
children: [
|
|
42
|
+
/*#__PURE__*/ jsx(Radio.Root, {
|
|
43
|
+
className: [
|
|
44
|
+
field_module.controlBox,
|
|
45
|
+
RadioGroup_module.dot
|
|
46
|
+
].join(' '),
|
|
47
|
+
value: option.value,
|
|
48
|
+
children: /*#__PURE__*/ jsx(Radio.Indicator, {
|
|
49
|
+
className: RadioGroup_module.mark
|
|
50
|
+
})
|
|
51
|
+
}),
|
|
52
|
+
option.label
|
|
53
|
+
]
|
|
54
|
+
})
|
|
55
|
+
}, option.value))
|
|
56
|
+
}),
|
|
57
|
+
/*#__PURE__*/ jsx(FieldMessages, {
|
|
58
|
+
description: description,
|
|
59
|
+
error: error
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export { RadioGroup_RadioGroup as RadioGroup };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type FieldFrameProps } from '../Field/Field.js';
|
|
3
|
+
import type { PopupAlign, PopupSide } from '../Popover/Popover.js';
|
|
4
|
+
export interface SelectOption {
|
|
5
|
+
/** Submitted with the form, and what `value`/`onValueChange` speak in. */
|
|
6
|
+
value: string;
|
|
7
|
+
/** The visible text, on the option and — once chosen — on the trigger. */
|
|
8
|
+
label: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface SelectProps extends FieldFrameProps {
|
|
12
|
+
/** The visible label, and the trigger's accessible name. */
|
|
13
|
+
label: string;
|
|
14
|
+
options: SelectOption[];
|
|
15
|
+
/** Sits under the trigger and joins its `aria-describedby`. */
|
|
16
|
+
description?: ReactNode;
|
|
17
|
+
/** Shown on the trigger while nothing is chosen. */
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
/**
|
|
20
|
+
* `null` is a real state — a select that has been cleared — so it is in the type rather than
|
|
21
|
+
* narrowed away. Use with `onValueChange` for a controlled select; `defaultValue` otherwise.
|
|
22
|
+
*/
|
|
23
|
+
value?: string | null;
|
|
24
|
+
defaultValue?: string | null;
|
|
25
|
+
/**
|
|
26
|
+
* The chosen value, or `null` once the select has been cleared. One argument, as on every
|
|
27
|
+
* other control in the tier: Base UI calls its own callback `(value, eventDetails)` and this
|
|
28
|
+
* wrapper drops the second, which no consumer can read without a cast.
|
|
29
|
+
*/
|
|
30
|
+
onValueChange?: (value: string | null) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Called when the focus leaves the trigger — including when the popup opens and takes it.
|
|
33
|
+
* A form library marks a field touched on blur, and the adapter in `FormExample` spreads one
|
|
34
|
+
* `onBlur` onto every control; without this prop the select silently dropped it.
|
|
35
|
+
*/
|
|
36
|
+
onBlur?: () => void;
|
|
37
|
+
side?: PopupSide;
|
|
38
|
+
align?: PopupAlign;
|
|
39
|
+
/** Gap between the trigger and the popup, in pixels. */
|
|
40
|
+
sideOffset?: number;
|
|
41
|
+
}
|
|
42
|
+
export declare function Select({ label, options, name, description, error, required, disabled, placeholder, value, defaultValue, onValueChange, onBlur, side, align, sideOffset, }: SelectProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Field } from "@base-ui/react/field";
|
|
3
|
+
import { Select } from "@base-ui/react/select";
|
|
4
|
+
import { CheckIcon } from "../../icons/CheckIcon.js";
|
|
5
|
+
import { ChevronDownIcon } from "../../icons/ChevronDownIcon.js";
|
|
6
|
+
import field_module from "../../styles/field.module.js";
|
|
7
|
+
import popup_module from "../../styles/popup.module.js";
|
|
8
|
+
import { FieldMessages, RequiredMark } from "../Field/Field.js";
|
|
9
|
+
import Select_module from "./Select.module.js";
|
|
10
|
+
function Select_Select({ label, options, name, description, error, required = false, disabled = false, placeholder = 'Select…', value, defaultValue, onValueChange, onBlur, side = 'bottom', align = 'start', sideOffset = 8 }) {
|
|
11
|
+
return /*#__PURE__*/ jsxs(Field.Root, {
|
|
12
|
+
className: field_module.frame,
|
|
13
|
+
name: name,
|
|
14
|
+
disabled: disabled,
|
|
15
|
+
invalid: void 0 !== error,
|
|
16
|
+
children: [
|
|
17
|
+
/*#__PURE__*/ jsxs(Field.Label, {
|
|
18
|
+
className: field_module.label,
|
|
19
|
+
nativeLabel: false,
|
|
20
|
+
render: /*#__PURE__*/ jsx("span", {}),
|
|
21
|
+
children: [
|
|
22
|
+
label,
|
|
23
|
+
/*#__PURE__*/ jsx(RequiredMark, {
|
|
24
|
+
when: required
|
|
25
|
+
})
|
|
26
|
+
]
|
|
27
|
+
}),
|
|
28
|
+
/*#__PURE__*/ jsxs(Select.Root, {
|
|
29
|
+
items: options,
|
|
30
|
+
value: value,
|
|
31
|
+
defaultValue: defaultValue,
|
|
32
|
+
onValueChange: (nextValue)=>onValueChange?.(nextValue),
|
|
33
|
+
required: required,
|
|
34
|
+
children: [
|
|
35
|
+
/*#__PURE__*/ jsxs(Select.Trigger, {
|
|
36
|
+
className: [
|
|
37
|
+
field_module.control,
|
|
38
|
+
Select_module.trigger
|
|
39
|
+
].join(' '),
|
|
40
|
+
onBlur: onBlur,
|
|
41
|
+
children: [
|
|
42
|
+
/*#__PURE__*/ jsx(Select.Value, {
|
|
43
|
+
className: Select_module.value,
|
|
44
|
+
placeholder: placeholder
|
|
45
|
+
}),
|
|
46
|
+
/*#__PURE__*/ jsx(Select.Icon, {
|
|
47
|
+
className: Select_module.icon,
|
|
48
|
+
children: /*#__PURE__*/ jsx(ChevronDownIcon, {})
|
|
49
|
+
})
|
|
50
|
+
]
|
|
51
|
+
}),
|
|
52
|
+
/*#__PURE__*/ jsx(Select.Portal, {
|
|
53
|
+
children: /*#__PURE__*/ jsx(Select.Positioner, {
|
|
54
|
+
className: popup_module.layer,
|
|
55
|
+
side: side,
|
|
56
|
+
align: align,
|
|
57
|
+
sideOffset: sideOffset,
|
|
58
|
+
alignItemWithTrigger: false,
|
|
59
|
+
children: /*#__PURE__*/ jsx(Select.Popup, {
|
|
60
|
+
className: popup_module.surface,
|
|
61
|
+
"data-popup": "select",
|
|
62
|
+
children: /*#__PURE__*/ jsx(Select.List, {
|
|
63
|
+
children: options.map((option)=>/*#__PURE__*/ jsxs(Select.Item, {
|
|
64
|
+
className: Select_module.option,
|
|
65
|
+
value: option.value,
|
|
66
|
+
disabled: option.disabled,
|
|
67
|
+
children: [
|
|
68
|
+
/*#__PURE__*/ jsx(Select.ItemText, {
|
|
69
|
+
children: option.label
|
|
70
|
+
}),
|
|
71
|
+
/*#__PURE__*/ jsx(Select.ItemIndicator, {
|
|
72
|
+
className: Select_module.indicator,
|
|
73
|
+
children: /*#__PURE__*/ jsx(CheckIcon, {})
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
}, option.value))
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
}),
|
|
83
|
+
/*#__PURE__*/ jsx(FieldMessages, {
|
|
84
|
+
description: description,
|
|
85
|
+
error: error
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
export { Select_Select as Select };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
.trigger-UPubf {
|
|
2
|
+
justify-content: space-between;
|
|
3
|
+
gap: var(--space-3);
|
|
4
|
+
text-align: start;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.value-fKND1 {
|
|
9
|
+
white-space: nowrap;
|
|
10
|
+
text-overflow: ellipsis;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.value-fKND1[data-placeholder] {
|
|
15
|
+
color: var(--color-text-subtle);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.icon-_ToIv {
|
|
19
|
+
color: var(--color-text-muted);
|
|
20
|
+
transition-property: transform;
|
|
21
|
+
transition-duration: var(--motion-duration-1);
|
|
22
|
+
transition-timing-function: var(--motion-ease);
|
|
23
|
+
flex: none;
|
|
24
|
+
display: inline-flex;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.icon-_ToIv > svg {
|
|
28
|
+
width: 1rem;
|
|
29
|
+
height: 1rem;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.icon-_ToIv[data-popup-open] {
|
|
33
|
+
transform: rotate(180deg);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.option-vv9zm {
|
|
37
|
+
justify-content: space-between;
|
|
38
|
+
align-items: center;
|
|
39
|
+
gap: var(--space-3);
|
|
40
|
+
min-height: var(--size-touch);
|
|
41
|
+
padding-inline: var(--space-3);
|
|
42
|
+
border-radius: var(--radius-md);
|
|
43
|
+
color: var(--color-text);
|
|
44
|
+
font-size: var(--text-md);
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
-webkit-user-select: none;
|
|
47
|
+
user-select: none;
|
|
48
|
+
display: flex;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.option-vv9zm[data-highlighted] {
|
|
52
|
+
background: var(--color-surface-2);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.option-vv9zm[data-disabled] {
|
|
56
|
+
cursor: not-allowed;
|
|
57
|
+
opacity: .45;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.indicator-O12DN {
|
|
61
|
+
color: var(--color-accent);
|
|
62
|
+
flex: none;
|
|
63
|
+
display: inline-flex;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.indicator-O12DN > svg {
|
|
67
|
+
width: 1rem;
|
|
68
|
+
height: 1rem;
|
|
69
|
+
}
|
|
70
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type FieldFrameProps } from '../Field/Field.js';
|
|
3
|
+
export interface SwitchProps extends FieldFrameProps {
|
|
4
|
+
/** The text beside the track, and the switch's accessible name. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Sits under the row and joins the switch's `aria-describedby`. */
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* The validation message. It is rendered and announced; the track itself is not restyled,
|
|
10
|
+
* because a switch's state is binary and already visible.
|
|
11
|
+
*/
|
|
12
|
+
error?: string;
|
|
13
|
+
/** Controlled. Pair it with `onCheckedChange`; use `defaultChecked` for an uncontrolled one. */
|
|
14
|
+
checked?: boolean;
|
|
15
|
+
defaultChecked?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The new checked state. One argument, as on every other control in the tier: Base UI calls
|
|
18
|
+
* its own callback `(checked, eventDetails)` and this wrapper drops the second, which no
|
|
19
|
+
* consumer can read without a cast.
|
|
20
|
+
*/
|
|
21
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare function Switch({ label, name, description, error, checked, defaultChecked, onCheckedChange, required, disabled, }: SwitchProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Switch } from "@base-ui/react/switch";
|
|
3
|
+
import { InlineField } from "../Field/Field.js";
|
|
4
|
+
import Switch_module from "./Switch.module.js";
|
|
5
|
+
function Switch_Switch({ label, name, description, error, checked, defaultChecked, onCheckedChange, required = false, disabled = false }) {
|
|
6
|
+
return /*#__PURE__*/ jsx(InlineField, {
|
|
7
|
+
label: label,
|
|
8
|
+
name: name,
|
|
9
|
+
description: description,
|
|
10
|
+
error: error,
|
|
11
|
+
required: required,
|
|
12
|
+
disabled: disabled,
|
|
13
|
+
children: /*#__PURE__*/ jsx(Switch.Root, {
|
|
14
|
+
className: Switch_module.track,
|
|
15
|
+
checked: checked,
|
|
16
|
+
defaultChecked: defaultChecked,
|
|
17
|
+
onCheckedChange: (nextChecked)=>onCheckedChange?.(nextChecked),
|
|
18
|
+
required: required,
|
|
19
|
+
children: /*#__PURE__*/ jsx(Switch.Thumb, {
|
|
20
|
+
className: Switch_module.thumb
|
|
21
|
+
})
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export { Switch_Switch as Switch };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
.track-vswWH {
|
|
2
|
+
width: 2.5rem;
|
|
3
|
+
height: 1.5rem;
|
|
4
|
+
padding: var(--space-1);
|
|
5
|
+
border: 1px solid var(--color-border-strong);
|
|
6
|
+
border-radius: var(--radius-full);
|
|
7
|
+
background: var(--color-surface-3);
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
transition-property: background-color, border-color;
|
|
10
|
+
transition-duration: var(--motion-duration-1);
|
|
11
|
+
transition-timing-function: var(--motion-ease);
|
|
12
|
+
flex: none;
|
|
13
|
+
align-items: center;
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.track-vswWH[data-checked] {
|
|
18
|
+
border-color: var(--color-accent);
|
|
19
|
+
background: var(--color-accent);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.track-vswWH[data-disabled] {
|
|
23
|
+
cursor: not-allowed;
|
|
24
|
+
opacity: .55;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.thumb-aDkgm {
|
|
28
|
+
border-radius: var(--radius-full);
|
|
29
|
+
background: var(--color-surface-raised);
|
|
30
|
+
width: 1rem;
|
|
31
|
+
height: 1rem;
|
|
32
|
+
box-shadow: var(--elevation-1);
|
|
33
|
+
transition-property: transform;
|
|
34
|
+
transition-duration: var(--motion-duration-1);
|
|
35
|
+
transition-timing-function: var(--motion-ease);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.thumb-aDkgm[data-checked] {
|
|
39
|
+
transform: translateX(.875rem);
|
|
40
|
+
}
|
|
41
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactElement } from 'react';
|
|
2
|
+
export type TextInputType = 'text' | 'email' | 'password' | 'search' | 'tel' | 'url' | 'date' | 'number';
|
|
3
|
+
export interface TextInputProps extends Omit<ComponentPropsWithoutRef<'input'>, 'className' | 'type' | 'value' | 'defaultValue' | 'onChange' | 'required' | 'name' | 'disabled'> {
|
|
4
|
+
/** Ignored when `render` is given: the caller's element brings its own. */
|
|
5
|
+
type?: TextInputType;
|
|
6
|
+
value?: string;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
/** Base UI reports the new value directly; there is no event to read `.target.value` off. */
|
|
9
|
+
onValueChange?: (value: string) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Render a different element in place of the `<input>`, keeping the field wiring and the
|
|
12
|
+
* control skin: a `<textarea rows={4} />`, an `<input type="file" />`, a masked input. This
|
|
13
|
+
* is the tier's escape hatch for a control the library does not ship.
|
|
14
|
+
*/
|
|
15
|
+
render?: ReactElement;
|
|
16
|
+
}
|
|
17
|
+
export declare function TextInput({ type, value, defaultValue, onValueChange, render, ...rest }: TextInputProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Input } from "@base-ui/react/input";
|
|
3
|
+
import { useFieldRequired } from "../Field/Field.js";
|
|
4
|
+
import field_module from "../../styles/field.module.js";
|
|
5
|
+
function TextInput({ type = 'text', value, defaultValue, onValueChange, render, ...rest }) {
|
|
6
|
+
const required = useFieldRequired();
|
|
7
|
+
return /*#__PURE__*/ jsx(Input, {
|
|
8
|
+
...rest,
|
|
9
|
+
className: field_module.control,
|
|
10
|
+
type: void 0 === render ? type : void 0,
|
|
11
|
+
value: value,
|
|
12
|
+
defaultValue: defaultValue,
|
|
13
|
+
onValueChange: onValueChange,
|
|
14
|
+
required: required,
|
|
15
|
+
render: render
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export { TextInput };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tick inside a selected `Select` option and a ticked `Checkbox`. Internal, like
|
|
3
|
+
* `CloseIcon` and `ChevronDownIcon`; decorative in both places, because the option's text and
|
|
4
|
+
* the checkbox's label carry the meaning.
|
|
5
|
+
*/
|
|
6
|
+
export declare function CheckIcon(): import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
function CheckIcon() {
|
|
3
|
+
return /*#__PURE__*/ jsx("svg", {
|
|
4
|
+
viewBox: "0 0 16 16",
|
|
5
|
+
fill: "none",
|
|
6
|
+
stroke: "currentColor",
|
|
7
|
+
strokeWidth: "2",
|
|
8
|
+
strokeLinecap: "round",
|
|
9
|
+
strokeLinejoin: "round",
|
|
10
|
+
"aria-hidden": "true",
|
|
11
|
+
focusable: "false",
|
|
12
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
13
|
+
d: "m3.5 8.5 3 3 6-7"
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export { CheckIcon };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chevron on a `Select` trigger. Internal, exactly as `CloseIcon` is: the barrel does not
|
|
3
|
+
* export it, so consumers bring their own icon set. It is decorative — Base UI marks
|
|
4
|
+
* `Select.Icon` `aria-hidden` itself — and declares no size; the control that holds it sizes it.
|
|
5
|
+
*/
|
|
6
|
+
export declare function ChevronDownIcon(): import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
function ChevronDownIcon() {
|
|
3
|
+
return /*#__PURE__*/ jsx("svg", {
|
|
4
|
+
viewBox: "0 0 16 16",
|
|
5
|
+
fill: "none",
|
|
6
|
+
stroke: "currentColor",
|
|
7
|
+
strokeWidth: "1.5",
|
|
8
|
+
strokeLinecap: "round",
|
|
9
|
+
strokeLinejoin: "round",
|
|
10
|
+
"aria-hidden": "true",
|
|
11
|
+
focusable: "false",
|
|
12
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
13
|
+
d: "m4 6.25 4 4 4-4"
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export { ChevronDownIcon };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
function MinusIcon() {
|
|
3
|
+
return /*#__PURE__*/ jsx("svg", {
|
|
4
|
+
viewBox: "0 0 16 16",
|
|
5
|
+
fill: "none",
|
|
6
|
+
stroke: "currentColor",
|
|
7
|
+
strokeWidth: "2",
|
|
8
|
+
strokeLinecap: "round",
|
|
9
|
+
"aria-hidden": "true",
|
|
10
|
+
focusable: "false",
|
|
11
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
12
|
+
d: "M4 8h8"
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export { MinusIcon };
|
package/dist/index.d.ts
CHANGED
|
@@ -45,3 +45,15 @@ export { TooltipProvider, TOOLTIP_DELAY } from './components/Tooltip/TooltipProv
|
|
|
45
45
|
export type { TooltipProviderProps } from './components/Tooltip/TooltipProvider.js';
|
|
46
46
|
export { ToastRegion, createToastManager } from './components/ToastRegion/ToastRegion.js';
|
|
47
47
|
export type { ToastRegionProps, ToastManager, ToastOptions, ToastTone, ToastAction, } from './components/ToastRegion/ToastRegion.js';
|
|
48
|
+
export { Field } from './components/Field/Field.js';
|
|
49
|
+
export type { FieldProps } from './components/Field/Field.js';
|
|
50
|
+
export { TextInput } from './components/TextInput/TextInput.js';
|
|
51
|
+
export type { TextInputProps, TextInputType } from './components/TextInput/TextInput.js';
|
|
52
|
+
export { Select } from './components/Select/Select.js';
|
|
53
|
+
export type { SelectProps, SelectOption } from './components/Select/Select.js';
|
|
54
|
+
export { Checkbox } from './components/Checkbox/Checkbox.js';
|
|
55
|
+
export type { CheckboxProps } from './components/Checkbox/Checkbox.js';
|
|
56
|
+
export { RadioGroup } from './components/RadioGroup/RadioGroup.js';
|
|
57
|
+
export type { RadioGroupProps, RadioOption } from './components/RadioGroup/RadioGroup.js';
|
|
58
|
+
export { Switch } from './components/Switch/Switch.js';
|
|
59
|
+
export type { SwitchProps } from './components/Switch/Switch.js';
|
package/dist/index.js
CHANGED
|
@@ -22,3 +22,9 @@ export { Menu } from "./components/Menu/Menu.js";
|
|
|
22
22
|
export { Tooltip } from "./components/Tooltip/Tooltip.js";
|
|
23
23
|
export { TOOLTIP_DELAY, TooltipProvider } from "./components/Tooltip/TooltipProvider.js";
|
|
24
24
|
export { ToastRegion, createToastManager } from "./components/ToastRegion/ToastRegion.js";
|
|
25
|
+
export { Field } from "./components/Field/Field.js";
|
|
26
|
+
export { TextInput } from "./components/TextInput/TextInput.js";
|
|
27
|
+
export { Select } from "./components/Select/Select.js";
|
|
28
|
+
export { Checkbox } from "./components/Checkbox/Checkbox.js";
|
|
29
|
+
export { RadioGroup } from "./components/RadioGroup/RadioGroup.js";
|
|
30
|
+
export { Switch } from "./components/Switch/Switch.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./field_module.css";
|
|
2
|
+
const field_module = {
|
|
3
|
+
frame: "frame-J0Ojt",
|
|
4
|
+
inlineFrame: "inlineFrame-zSCRB",
|
|
5
|
+
label: "label-biJfU",
|
|
6
|
+
legend: "legend-de1mj",
|
|
7
|
+
required: "required-Gk1aH",
|
|
8
|
+
optionLabel: "optionLabel-iP92d",
|
|
9
|
+
options: "options-hWZ0_",
|
|
10
|
+
description: "description-nT8MY",
|
|
11
|
+
error: "error-WHv_B",
|
|
12
|
+
control: "control-Hqf8o",
|
|
13
|
+
controlBox: "controlBox-m9xtL"
|
|
14
|
+
};
|
|
15
|
+
export default field_module;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
.frame-J0Ojt, .inlineFrame-zSCRB {
|
|
2
|
+
gap: var(--space-2);
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
display: flex;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.inlineFrame-zSCRB {
|
|
8
|
+
gap: var(--space-1);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.label-biJfU, .legend-de1mj {
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: var(--space-1);
|
|
14
|
+
color: var(--color-text);
|
|
15
|
+
font-size: var(--text-sm);
|
|
16
|
+
font-weight: 500;
|
|
17
|
+
line-height: var(--leading-snug);
|
|
18
|
+
display: flex;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.label-biJfU[data-disabled], .legend-de1mj[data-disabled] {
|
|
22
|
+
color: var(--color-text-muted);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.required-Gk1aH {
|
|
26
|
+
color: var(--color-danger);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.required-Gk1aH:after {
|
|
30
|
+
content: "*";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.optionLabel-iP92d {
|
|
34
|
+
align-items: center;
|
|
35
|
+
gap: var(--space-3);
|
|
36
|
+
color: var(--color-text);
|
|
37
|
+
font-size: var(--text-md);
|
|
38
|
+
line-height: var(--leading-snug);
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
display: flex;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.optionLabel-iP92d[data-disabled] {
|
|
44
|
+
cursor: not-allowed;
|
|
45
|
+
color: var(--color-text-muted);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.options-hWZ0_ {
|
|
49
|
+
gap: var(--space-2);
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
display: flex;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.options-hWZ0_[data-orientation="horizontal"] {
|
|
55
|
+
gap: var(--space-4);
|
|
56
|
+
flex-flow: wrap;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.description-nT8MY {
|
|
60
|
+
color: var(--color-text-muted);
|
|
61
|
+
font-size: var(--text-sm);
|
|
62
|
+
line-height: var(--leading-prose);
|
|
63
|
+
margin: 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.error-WHv_B {
|
|
67
|
+
color: var(--color-danger);
|
|
68
|
+
font-size: var(--text-sm);
|
|
69
|
+
line-height: var(--leading-snug);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.control-Hqf8o {
|
|
73
|
+
width: 100%;
|
|
74
|
+
min-height: var(--size-touch);
|
|
75
|
+
padding: var(--space-2) var(--space-3);
|
|
76
|
+
border: 1px solid var(--color-border-strong);
|
|
77
|
+
border-radius: var(--radius-md);
|
|
78
|
+
background: var(--color-surface-input);
|
|
79
|
+
color: var(--color-text);
|
|
80
|
+
font-size: var(--text-md);
|
|
81
|
+
line-height: var(--leading-snug);
|
|
82
|
+
transition-property: border-color, background-color;
|
|
83
|
+
transition-duration: var(--motion-duration-1);
|
|
84
|
+
transition-timing-function: var(--motion-ease);
|
|
85
|
+
align-items: center;
|
|
86
|
+
display: flex;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.control-Hqf8o::placeholder {
|
|
90
|
+
color: var(--color-text-subtle);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.control-Hqf8o:focus-visible {
|
|
94
|
+
border-color: var(--color-accent);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.control-Hqf8o[data-invalid] {
|
|
98
|
+
border-color: var(--color-danger-border);
|
|
99
|
+
background: var(--color-danger-surface);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.control-Hqf8o[data-disabled] {
|
|
103
|
+
cursor: not-allowed;
|
|
104
|
+
opacity: .55;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.controlBox-m9xtL {
|
|
108
|
+
border: 1px solid var(--color-border-strong);
|
|
109
|
+
background: var(--color-surface-input);
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
transition-property: background-color, border-color;
|
|
112
|
+
transition-duration: var(--motion-duration-1);
|
|
113
|
+
transition-timing-function: var(--motion-ease);
|
|
114
|
+
flex: none;
|
|
115
|
+
justify-content: center;
|
|
116
|
+
align-items: center;
|
|
117
|
+
display: inline-flex;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.controlBox-m9xtL[data-checked], .controlBox-m9xtL[data-indeterminate] {
|
|
121
|
+
border-color: var(--color-accent);
|
|
122
|
+
background: var(--color-accent);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.controlBox-m9xtL[data-invalid] {
|
|
126
|
+
border-color: var(--color-danger-border);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.controlBox-m9xtL[data-disabled] {
|
|
130
|
+
cursor: not-allowed;
|
|
131
|
+
opacity: .55;
|
|
132
|
+
}
|
|
133
|
+
|
|
@@ -63,6 +63,12 @@
|
|
|
63
63
|
box-shadow: var(--elevation-3);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
.surface-_qTRv[data-popup="select"] {
|
|
67
|
+
min-width: max(var(--anchor-width), 10rem);
|
|
68
|
+
padding: var(--space-1);
|
|
69
|
+
gap: 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
66
72
|
.surface-_qTRv[data-starting-style], .surface-_qTRv[data-ending-style] {
|
|
67
73
|
opacity: 0;
|
|
68
74
|
transform: scale(.96);
|