@mohirlab/react 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.
Files changed (34) hide show
  1. package/dist/components/choice/choice.d.ts +46 -0
  2. package/dist/components/choice/choice.d.ts.map +1 -0
  3. package/dist/components/choice/choice.js +184 -0
  4. package/dist/components/choice/choice.js.map +1 -0
  5. package/dist/components/choice/choice.styles.js +21 -0
  6. package/dist/components/choice/choice.styles.js.map +1 -0
  7. package/dist/components/choice/index.d.ts +2 -0
  8. package/dist/components/field/use-field-control.js +21 -0
  9. package/dist/components/field/use-field-control.js.map +1 -0
  10. package/dist/components/input/index.d.ts +2 -2
  11. package/dist/components/input/input.css.d.ts.map +1 -1
  12. package/dist/components/input/input.d.ts +12 -0
  13. package/dist/components/input/input.d.ts.map +1 -1
  14. package/dist/components/input/input.js +32 -11
  15. package/dist/components/input/input.js.map +1 -1
  16. package/dist/components/input/input.styles.js +3 -1
  17. package/dist/components/select/index.d.ts +2 -0
  18. package/dist/components/select/select.d.ts +14 -0
  19. package/dist/components/select/select.d.ts.map +1 -0
  20. package/dist/components/select/select.js +44 -0
  21. package/dist/components/select/select.js.map +1 -0
  22. package/dist/components/select/select.styles.js +7 -0
  23. package/dist/components/select/select.styles.js.map +1 -0
  24. package/dist/components/slider/index.d.ts +2 -0
  25. package/dist/components/slider/slider.d.ts +18 -0
  26. package/dist/components/slider/slider.d.ts.map +1 -0
  27. package/dist/components/slider/slider.js +50 -0
  28. package/dist/components/slider/slider.js.map +1 -0
  29. package/dist/components/slider/slider.styles.js +7 -0
  30. package/dist/components/slider/slider.styles.js.map +1 -0
  31. package/dist/index.d.ts +8 -2
  32. package/dist/index.js +6 -3
  33. package/dist/styles.css +445 -74
  34. package/package.json +2 -1
@@ -0,0 +1,46 @@
1
+ import { ComponentPropsWithRef, ReactNode } from "react";
2
+ type NativeInput = Omit<ComponentPropsWithRef<'input'>, 'type' | 'size'>;
3
+ interface ChoiceText {
4
+ /** Visible label. The whole row is clickable. */
5
+ label: ReactNode;
6
+ /** Secondary text under the label, linked with `aria-describedby`. */
7
+ description?: ReactNode;
8
+ invalid?: boolean;
9
+ }
10
+ export interface CheckboxProps extends NativeInput, ChoiceText {
11
+ /** Mixed state, e.g. "some items selected". Shown as a dash; clicking resolves it. */
12
+ indeterminate?: boolean;
13
+ }
14
+ /** A native checkbox, drawn in the Mohirlab style. */
15
+ export declare function Checkbox({ label, description, invalid, indeterminate, className, ref, ...rest }: CheckboxProps): import("react").JSX.Element;
16
+ export interface SwitchProps extends NativeInput, ChoiceText {}
17
+ /**
18
+ * An on/off setting that applies immediately (no Save button). A native checkbox with
19
+ * `role="switch"`, so it is announced as a switch and submits with forms.
20
+ */
21
+ export declare function Switch({ label, description, invalid, className, ...rest }: SwitchProps): import("react").JSX.Element;
22
+ export interface RadioGroupProps extends Omit<ComponentPropsWithRef<'fieldset'>, 'onChange' | 'defaultValue'> {
23
+ /** Names the group for assistive technology. */
24
+ legend: ReactNode;
25
+ /** Shared `name`; generated if omitted. */
26
+ name?: string;
27
+ value?: string;
28
+ defaultValue?: string;
29
+ onValueChange?: (value: string) => void;
30
+ hint?: ReactNode;
31
+ error?: ReactNode;
32
+ orientation?: 'vertical' | 'horizontal';
33
+ children: ReactNode;
34
+ }
35
+ /**
36
+ * A `<fieldset>` of radios: arrow keys move between options natively, the legend names
37
+ * the group, and hint and error are linked to it.
38
+ */
39
+ export declare function RadioGroup({ legend, name, value, defaultValue, onValueChange, hint, error, orientation, disabled, className, children, ...rest }: RadioGroupProps): import("react").JSX.Element;
40
+ export interface RadioProps extends Omit<NativeInput, 'name'>, Omit<ChoiceText, 'invalid'> {
41
+ value: string;
42
+ }
43
+ /** One option of a `RadioGroup`. */
44
+ export declare function Radio({ label, description, value, className, ...rest }: RadioProps): import("react").JSX.Element;
45
+ export {};
46
+ //# sourceMappingURL=choice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"choice.d.ts","names":[],"sources":["../../../src/components/choice/choice.tsx"],"mappings":";KAeK,cAAc,KAAK;UAEd;;EAER,OAAO;;EAEP,cAAc;EACd;;iBAmCe,sBAAsB,aAAa;;EAElD;;;wBAIc,WACd,OACA,aACA,SACA,eACA,WACA,QACG,QACF,gCAAa,IAAA;iBAkCC,oBAAoB,aAAa;;;;;wBAMlC,SAAS,OAAO,aAAa,SAAS,cAAc,QAAQ,8BAAW,IAAA;iBAwCtE,wBAAwB,KACvC;;EAIA,QAAQ;;EAER;EACA;EACA;EACA,iBAAiB;EACjB,OAAO;EACP,QAAQ;EACR;EACA,UAAU;;;;;;wBAOI,aACd,QACA,MACA,OACA,cACA,eACA,MACA,OACA,aACA,UACA,WACA,aACG,QACF,kCAAe,IAAA;iBAiDD,mBAAmB,KAAK,sBAAsB,KAAK;EAClE;;;wBAIc,QAAQ,OAAO,aAAa,OAAO,cAAc,QAAQ,6BAAU,IAAA"}
@@ -0,0 +1,184 @@
1
+ import { createContext, useContext, useEffect, useId, useRef } from "react";
2
+ import { iconCheck, iconMinus } from "@mohirlab/icons";
3
+ import { cx } from "../../utils/cx.js";
4
+ import { Icon } from "../icon/icon.js";
5
+ import { box, check, checkbox, dash, dot, group, item, label, legend, options, radio, row, thumb, track } from "./choice.styles.js";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ // src/components/choice/choice.tsx
8
+ function Row({ control, label: label$1, description: description$1, descriptionId, className, kind }) {
9
+ return /* @__PURE__ */ jsxs("div", {
10
+ className: cx(item, className),
11
+ "data-kind": kind,
12
+ children: [/* @__PURE__ */ jsxs("label", {
13
+ className: row,
14
+ children: [control, /* @__PURE__ */ jsx("span", {
15
+ className: label,
16
+ children: label$1
17
+ })]
18
+ }), description$1 && /* @__PURE__ */ jsx("span", {
19
+ id: descriptionId,
20
+ className: "ml_m1yyzl3",
21
+ children: description$1
22
+ })]
23
+ });
24
+ }
25
+ /** A native checkbox, drawn in the Mohirlab style. */
26
+ function Checkbox({ label, description, invalid, indeterminate = false, className, ref, ...rest }) {
27
+ const descriptionId = useId();
28
+ const inner = useRef(null);
29
+ useEffect(() => {
30
+ if (inner.current) inner.current.indeterminate = indeterminate;
31
+ }, [indeterminate]);
32
+ return /* @__PURE__ */ jsx(Row, {
33
+ className,
34
+ label,
35
+ description,
36
+ descriptionId,
37
+ control: /* @__PURE__ */ jsxs("span", {
38
+ className: box,
39
+ children: [
40
+ /* @__PURE__ */ jsx("input", {
41
+ ...rest,
42
+ ref: (el) => {
43
+ inner.current = el;
44
+ if (typeof ref === "function") ref(el);
45
+ else if (ref) ref.current = el;
46
+ },
47
+ type: "checkbox",
48
+ className: checkbox,
49
+ "aria-invalid": invalid || void 0,
50
+ "aria-describedby": description ? descriptionId : rest["aria-describedby"]
51
+ }),
52
+ /* @__PURE__ */ jsx(Icon, {
53
+ icon: iconCheck,
54
+ size: 14,
55
+ strokeWidth: 2.25,
56
+ className: check
57
+ }),
58
+ /* @__PURE__ */ jsx(Icon, {
59
+ icon: iconMinus,
60
+ size: 14,
61
+ strokeWidth: 2.25,
62
+ className: dash
63
+ })
64
+ ]
65
+ })
66
+ });
67
+ }
68
+ /**
69
+ * An on/off setting that applies immediately (no Save button). A native checkbox with
70
+ * `role="switch"`, so it is announced as a switch and submits with forms.
71
+ */
72
+ function Switch({ label, description, invalid, className, ...rest }) {
73
+ const descriptionId = useId();
74
+ return /* @__PURE__ */ jsx(Row, {
75
+ kind: "switch",
76
+ className,
77
+ label,
78
+ description,
79
+ descriptionId,
80
+ control: /* @__PURE__ */ jsxs("span", {
81
+ className: box,
82
+ children: [/* @__PURE__ */ jsx("input", {
83
+ ...rest,
84
+ type: "checkbox",
85
+ role: "switch",
86
+ className: track,
87
+ "aria-invalid": invalid || void 0,
88
+ "aria-describedby": description ? descriptionId : rest["aria-describedby"]
89
+ }), /* @__PURE__ */ jsx("span", {
90
+ className: thumb,
91
+ "aria-hidden": "true"
92
+ })]
93
+ })
94
+ });
95
+ }
96
+ const RadioGroupContext = createContext(null);
97
+ /**
98
+ * A `<fieldset>` of radios: arrow keys move between options natively, the legend names
99
+ * the group, and hint and error are linked to it.
100
+ */
101
+ function RadioGroup({ legend: legend$1, name, value, defaultValue, onValueChange, hint, error, orientation = "vertical", disabled, className, children, ...rest }) {
102
+ const generated = useId();
103
+ const hintId = useId();
104
+ const errorId = useId();
105
+ const legendId = useId();
106
+ const describedBy = [error ? errorId : null, hint ? hintId : null].filter(Boolean).join(" ") || void 0;
107
+ return /* @__PURE__ */ jsxs("fieldset", {
108
+ ...rest,
109
+ role: "radiogroup",
110
+ disabled,
111
+ "aria-labelledby": legendId,
112
+ "aria-describedby": describedBy,
113
+ "aria-invalid": error ? true : void 0,
114
+ className: cx(group, className),
115
+ children: [
116
+ /* @__PURE__ */ jsx("legend", {
117
+ id: legendId,
118
+ className: legend,
119
+ children: legend$1
120
+ }),
121
+ /* @__PURE__ */ jsx(RadioGroupContext.Provider, {
122
+ value: {
123
+ name: name ?? `ml-radio-${generated}`,
124
+ value,
125
+ defaultValue,
126
+ disabled,
127
+ invalid: Boolean(error),
128
+ onChange: onValueChange ? (event) => onValueChange(event.target.value) : void 0
129
+ },
130
+ children: /* @__PURE__ */ jsx("div", {
131
+ className: options,
132
+ "data-orientation": orientation,
133
+ children
134
+ })
135
+ }),
136
+ error && /* @__PURE__ */ jsx("p", {
137
+ id: errorId,
138
+ className: "ml_m1yyzlg",
139
+ children: error
140
+ }),
141
+ hint && /* @__PURE__ */ jsx("p", {
142
+ id: hintId,
143
+ className: "ml_m1yyzlf",
144
+ children: hint
145
+ })
146
+ ]
147
+ });
148
+ }
149
+ /** One option of a `RadioGroup`. */
150
+ function Radio({ label, description, value, className, ...rest }) {
151
+ const group = useContext(RadioGroupContext);
152
+ const descriptionId = useId();
153
+ if (!group) throw new Error("<Radio> must be used inside <RadioGroup>.");
154
+ const controlled = group.value !== void 0;
155
+ return /* @__PURE__ */ jsx(Row, {
156
+ className,
157
+ label,
158
+ description,
159
+ descriptionId,
160
+ control: /* @__PURE__ */ jsxs("span", {
161
+ className: box,
162
+ children: [/* @__PURE__ */ jsx("input", {
163
+ ...rest,
164
+ type: "radio",
165
+ name: group.name,
166
+ value,
167
+ checked: controlled ? group.value === value : void 0,
168
+ defaultChecked: !controlled && group.defaultValue !== void 0 ? group.defaultValue === value : void 0,
169
+ onChange: (event) => {
170
+ rest.onChange?.(event);
171
+ group.onChange?.(event);
172
+ },
173
+ className: radio,
174
+ "aria-describedby": description ? descriptionId : void 0
175
+ }), /* @__PURE__ */ jsx("span", {
176
+ className: dot,
177
+ "aria-hidden": "true"
178
+ })]
179
+ })
180
+ });
181
+ }
182
+ export { Checkbox, Radio, RadioGroup, Switch };
183
+
184
+ //# sourceMappingURL=choice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"choice.js","names":["label","description","styles.item","styles.row","styles.label","styles.box","styles.checkbox","styles.check","styles.dash","styles.track","styles.thumb","legend","styles.group","styles.legend","styles.options","styles.radio","styles.dot"],"sources":["../../../src/components/choice/choice.tsx"],"sourcesContent":["import {\n createContext,\n useContext,\n useEffect,\n useId,\n useRef,\n type ChangeEvent,\n type ComponentPropsWithRef,\n type ReactNode,\n} from 'react';\nimport { iconCheck, iconMinus } from '@mohirlab/icons';\nimport { cx } from '../../utils/cx';\nimport { Icon } from '../icon';\nimport * as styles from './choice.css';\n\ntype NativeInput = Omit<ComponentPropsWithRef<'input'>, 'type' | 'size'>;\n\ninterface ChoiceText {\n /** Visible label. The whole row is clickable. */\n label: ReactNode;\n /** Secondary text under the label, linked with `aria-describedby`. */\n description?: ReactNode;\n invalid?: boolean;\n}\n\nfunction Row({\n control,\n label,\n description,\n descriptionId,\n className,\n kind,\n}: {\n control: ReactNode;\n label: ReactNode;\n description?: ReactNode;\n descriptionId: string;\n className?: string;\n kind?: 'switch';\n}) {\n // The description stays outside the <label>: inside, it would become part of the\n // accessible name. It is linked with aria-describedby instead.\n return (\n <div className={cx(styles.item, className)} data-kind={kind}>\n <label className={styles.row}>\n {control}\n <span className={styles.label}>{label}</span>\n </label>\n {description && (\n <span id={descriptionId} className={styles.description}>\n {description}\n </span>\n )}\n </div>\n );\n}\n\nexport interface CheckboxProps extends NativeInput, ChoiceText {\n /** Mixed state, e.g. \"some items selected\". Shown as a dash; clicking resolves it. */\n indeterminate?: boolean;\n}\n\n/** A native checkbox, drawn in the Mohirlab style. */\nexport function Checkbox({\n label,\n description,\n invalid,\n indeterminate = false,\n className,\n ref,\n ...rest\n}: CheckboxProps) {\n const descriptionId = useId();\n const inner = useRef<HTMLInputElement>(null);\n useEffect(() => {\n if (inner.current) inner.current.indeterminate = indeterminate;\n }, [indeterminate]);\n return (\n <Row\n className={className}\n label={label}\n description={description}\n descriptionId={descriptionId}\n control={\n <span className={styles.box}>\n <input\n {...rest}\n ref={(el) => {\n inner.current = el;\n if (typeof ref === 'function') ref(el);\n else if (ref) ref.current = el;\n }}\n type=\"checkbox\"\n className={styles.checkbox}\n aria-invalid={invalid || undefined}\n aria-describedby={description ? descriptionId : rest['aria-describedby']}\n />\n <Icon icon={iconCheck} size={14} strokeWidth={2.25} className={styles.check} />\n <Icon icon={iconMinus} size={14} strokeWidth={2.25} className={styles.dash} />\n </span>\n }\n />\n );\n}\n\nexport interface SwitchProps extends NativeInput, ChoiceText {}\n\n/**\n * An on/off setting that applies immediately (no Save button). A native checkbox with\n * `role=\"switch\"`, so it is announced as a switch and submits with forms.\n */\nexport function Switch({ label, description, invalid, className, ...rest }: SwitchProps) {\n const descriptionId = useId();\n return (\n <Row\n kind=\"switch\"\n className={className}\n label={label}\n description={description}\n descriptionId={descriptionId}\n control={\n <span className={styles.box}>\n <input\n {...rest}\n type=\"checkbox\"\n // The browser exposes a native checkbox's checked state to the switch role;\n // a hand-set aria-checked could only drift out of sync.\n // oxlint-disable-next-line jsx-a11y/role-has-required-aria-props\n role=\"switch\"\n className={styles.track}\n aria-invalid={invalid || undefined}\n aria-describedby={description ? descriptionId : rest['aria-describedby']}\n />\n <span className={styles.thumb} aria-hidden=\"true\" />\n </span>\n }\n />\n );\n}\n\ninterface RadioGroupContextValue {\n name: string;\n value?: string;\n defaultValue?: string;\n disabled?: boolean;\n invalid: boolean;\n onChange?: (event: ChangeEvent<HTMLInputElement>) => void;\n}\n\nconst RadioGroupContext = createContext<RadioGroupContextValue | null>(null);\n\nexport interface RadioGroupProps extends Omit<\n ComponentPropsWithRef<'fieldset'>,\n 'onChange' | 'defaultValue'\n> {\n /** Names the group for assistive technology. */\n legend: ReactNode;\n /** Shared `name`; generated if omitted. */\n name?: string;\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n hint?: ReactNode;\n error?: ReactNode;\n orientation?: 'vertical' | 'horizontal';\n children: ReactNode;\n}\n\n/**\n * A `<fieldset>` of radios: arrow keys move between options natively, the legend names\n * the group, and hint and error are linked to it.\n */\nexport function RadioGroup({\n legend,\n name,\n value,\n defaultValue,\n onValueChange,\n hint,\n error,\n orientation = 'vertical',\n disabled,\n className,\n children,\n ...rest\n}: RadioGroupProps) {\n const generated = useId();\n const hintId = useId();\n const errorId = useId();\n const legendId = useId();\n const describedBy = [error ? errorId : null, hint ? hintId : null].filter(Boolean).join(' ') || undefined;\n return (\n // role=\"radiogroup\" (rather than the fieldset's implicit \"group\") is what carries\n // aria-invalid for the whole set; individual radios cannot.\n <fieldset\n {...rest}\n role=\"radiogroup\"\n disabled={disabled}\n aria-labelledby={legendId}\n aria-describedby={describedBy}\n aria-invalid={error ? true : undefined}\n className={cx(styles.group, className)}\n >\n <legend id={legendId} className={styles.legend}>\n {legend}\n </legend>\n <RadioGroupContext.Provider\n value={{\n name: name ?? `ml-radio-${generated}`,\n value,\n defaultValue,\n disabled,\n invalid: Boolean(error),\n onChange: onValueChange ? (event) => onValueChange(event.target.value) : undefined,\n }}\n >\n <div className={styles.options} data-orientation={orientation}>\n {children}\n </div>\n </RadioGroupContext.Provider>\n {error && (\n <p id={errorId} className={styles.groupError}>\n {error}\n </p>\n )}\n {hint && (\n <p id={hintId} className={styles.groupHint}>\n {hint}\n </p>\n )}\n </fieldset>\n );\n}\n\nexport interface RadioProps extends Omit<NativeInput, 'name'>, Omit<ChoiceText, 'invalid'> {\n value: string;\n}\n\n/** One option of a `RadioGroup`. */\nexport function Radio({ label, description, value, className, ...rest }: RadioProps) {\n const group = useContext(RadioGroupContext);\n const descriptionId = useId();\n if (!group) throw new Error('<Radio> must be used inside <RadioGroup>.');\n const controlled = group.value !== undefined;\n return (\n <Row\n className={className}\n label={label}\n description={description}\n descriptionId={descriptionId}\n control={\n <span className={styles.box}>\n <input\n {...rest}\n type=\"radio\"\n name={group.name}\n value={value}\n checked={controlled ? group.value === value : undefined}\n defaultChecked={\n !controlled && group.defaultValue !== undefined ? group.defaultValue === value : undefined\n }\n onChange={(event) => {\n rest.onChange?.(event);\n group.onChange?.(event);\n }}\n className={styles.radio}\n aria-describedby={description ? descriptionId : undefined}\n />\n <span className={styles.dot} aria-hidden=\"true\" />\n </span>\n }\n />\n );\n}\n"],"mappings":"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"}
@@ -0,0 +1,21 @@
1
+ // src/components/choice/choice.css.ts
2
+ var box = "ml_m1yyzl4";
3
+ var check = "ml_m1yyzl7";
4
+ var checkbox = "ml_m1yyzl5";
5
+ var dash = "ml_m1yyzl8";
6
+ var description = "ml_m1yyzl3";
7
+ var dot = "ml_m1yyzl9";
8
+ var group = "ml_m1yyzlc";
9
+ var groupError = "ml_m1yyzlg";
10
+ var groupHint = "ml_m1yyzlf";
11
+ var item = "ml_m1yyzl1";
12
+ var label = "ml_m1yyzl2";
13
+ var legend = "ml_m1yyzld";
14
+ var options = "ml_m1yyzle";
15
+ var radio = "ml_m1yyzl6";
16
+ var row = "ml_m1yyzl0";
17
+ var thumb = "ml_m1yyzlb";
18
+ var track = "ml_m1yyzla";
19
+ export { box, check, checkbox, dash, description, dot, group, groupError, groupHint, item, label, legend, options, radio, row, thumb, track };
20
+
21
+ //# sourceMappingURL=choice.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"choice.styles.js","names":[],"sources":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import { Checkbox, CheckboxProps, Radio, RadioGroup, RadioGroupProps, RadioProps, Switch, SwitchProps } from "./choice.js";
2
+ export { Checkbox, type CheckboxProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Switch, type SwitchProps };
@@ -0,0 +1,21 @@
1
+ import { useField } from "./field-context.js";
2
+ // src/components/field/use-field-control.ts
3
+ /**
4
+ * Props a form control takes from the surrounding `<Field>`: id (for the label),
5
+ * required, disabled, invalid state and the hint/error description. Anything set
6
+ * on the control itself wins; descriptions are merged.
7
+ */
8
+ function useFieldControl({ id, required, disabled, invalid, "aria-describedby": describedBy }) {
9
+ const field = useField();
10
+ const isInvalid = invalid ?? field?.invalid ?? false;
11
+ return {
12
+ id: id ?? field?.id,
13
+ required: required ?? field?.required,
14
+ disabled: disabled ?? field?.disabled,
15
+ "aria-invalid": isInvalid || void 0,
16
+ "aria-describedby": [field?.describedBy, describedBy].filter(Boolean).join(" ") || void 0
17
+ };
18
+ }
19
+ export { useFieldControl };
20
+
21
+ //# sourceMappingURL=use-field-control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-field-control.js","names":[],"sources":["../../../src/components/field/use-field-control.ts"],"sourcesContent":["import { useField } from './field-context';\n\ninterface ControlProps {\n id?: string;\n required?: boolean;\n disabled?: boolean;\n invalid?: boolean;\n 'aria-describedby'?: string;\n}\n\n/**\n * Props a form control takes from the surrounding `<Field>`: id (for the label),\n * required, disabled, invalid state and the hint/error description. Anything set\n * on the control itself wins; descriptions are merged.\n */\nexport function useFieldControl({\n id,\n required,\n disabled,\n invalid,\n 'aria-describedby': describedBy,\n}: ControlProps) {\n const field = useField();\n const isInvalid = invalid ?? field?.invalid ?? false;\n return {\n id: id ?? field?.id,\n required: required ?? field?.required,\n disabled: disabled ?? field?.disabled,\n 'aria-invalid': isInvalid || undefined,\n 'aria-describedby': [field?.describedBy, describedBy].filter(Boolean).join(' ') || undefined,\n } as const;\n}\n"],"mappings":";;;;;;;AAeA,SAAgB,gBAAgB,EAC9B,IACA,UACA,UACA,SACA,oBAAoB,eACL;CACf,MAAM,QAAQ,SAAS;CACvB,MAAM,YAAY,WAAW,OAAO,WAAW;CAC/C,OAAO;EACL,IAAI,MAAM,OAAO;EACjB,UAAU,YAAY,OAAO;EAC7B,UAAU,YAAY,OAAO;EAC7B,gBAAgB,aAAa,KAAA;EAC7B,oBAAoB,CAAC,OAAO,aAAa,WAAW,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,KAAK,KAAA;CACrF;AACF"}
@@ -1,2 +1,2 @@
1
- import { Input, InputProps } from "./input.js";
2
- export { Input, type InputProps };
1
+ import { Input, InputProps, Textarea, TextareaProps } from "./input.js";
2
+ export { Input, type InputProps, Textarea, type TextareaProps };
@@ -1 +1 @@
1
- {"version":3,"file":"input.css.d.ts","names":[],"sources":["../../../src/components/input/input.css.ts"],"mappings":";;;;;qBAea,0CAAK;;IAoCZ,mCAAE;IACF,mCAAE;IACF,mCAAE;;;YAMI,gBAAgB,YAAY,sBAAsB"}
1
+ {"version":3,"file":"input.css.d.ts","names":[],"sources":["../../../src/components/input/input.css.ts"],"mappings":";;;;;qBAgBa,0CAAK;;IAqCZ,mCAAE;IACF,mCAAE;IACF,mCAAE;;;YAMI,gBAAgB,YAAY,sBAAsB"}
@@ -6,4 +6,16 @@ export interface InputProps extends Omit<ComponentPropsWithRef<'input'>, 'size'>
6
6
  invalid?: boolean;
7
7
  }
8
8
  export declare function Input({ size, invalid, className, id, required, disabled, ...rest }: InputProps): import("react").JSX.Element;
9
+ export interface TextareaProps extends ComponentPropsWithRef<'textarea'> {
10
+ invalid?: boolean;
11
+ /**
12
+ * Grow with the content up to `maxRows`, where the browser supports CSS
13
+ * `field-sizing` (Chrome 123, Safari 26.2, Firefox 152). Elsewhere the user can
14
+ * resize it. Default true.
15
+ */
16
+ autoGrow?: boolean;
17
+ /** Upper bound for auto-grow, in lines. Default 10. */
18
+ maxRows?: number;
19
+ }
20
+ export declare function Textarea({ invalid, autoGrow, rows, maxRows, className, style, id, required, disabled, ...rest }: TextareaProps): import("react").JSX.Element;
9
21
  //# sourceMappingURL=input.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","names":[],"sources":["../../../src/components/input/input.tsx"],"mappings":";;iBAKiB,mBAAmB,KAAK;EACvC,OAAO;;EAEP;;wBAGc,QAAQ,MAAM,SAAS,WAAW,IAAI,UAAU,aAAa,QAAQ,6BAAU,IAAA"}
1
+ {"version":3,"file":"input.d.ts","names":[],"sources":["../../../src/components/input/input.tsx"],"mappings":";;iBAMiB,mBAAmB,KAAK;EACvC,OAAO;;EAEP;;wBAGc,QAAQ,MAAM,SAAS,WAAW,IAAI,UAAU,aAAa,QAAQ,6BAAU,IAAA;iBAW9E,sBAAsB;EACrC;;;;;;EAMA;;EAEA;;wBAGc,WACd,SACA,UACA,MACA,SACA,WACA,OACA,IACA,UACA,aACG,QACF,gCAAa,IAAA"}
@@ -1,22 +1,43 @@
1
+ import { assignInlineVars } from "@vanilla-extract/dynamic";
1
2
  import { cx } from "../../utils/cx.js";
2
- import { useField } from "../field/field-context.js";
3
- import { input } from "./input.styles.js";
3
+ import { useFieldControl } from "../field/use-field-control.js";
4
+ import { input, maxRows, textarea } from "./input.styles.js";
4
5
  import { jsx } from "react/jsx-runtime";
5
6
  // src/components/input/input.tsx
6
7
  function Input({ size, invalid, className, id, required, disabled, ...rest }) {
7
- const field = useField();
8
- const describedBy = [field?.describedBy, rest["aria-describedby"]].filter(Boolean).join(" ") || void 0;
9
- const isInvalid = invalid ?? field?.invalid ?? false;
8
+ const control = useFieldControl({
9
+ id,
10
+ required,
11
+ disabled,
12
+ invalid,
13
+ "aria-describedby": rest["aria-describedby"]
14
+ });
10
15
  return /* @__PURE__ */ jsx("input", {
11
16
  ...rest,
12
- id: id ?? field?.id,
13
- required: required ?? field?.required,
14
- disabled: disabled ?? field?.disabled,
15
- "aria-describedby": describedBy,
16
- "aria-invalid": isInvalid || void 0,
17
+ ...control,
17
18
  className: cx(input({ size }), className)
18
19
  });
19
20
  }
20
- export { Input };
21
+ function Textarea({ invalid, autoGrow = true, rows = 3, maxRows: maxRows$1 = 10, className, style, id, required, disabled, ...rest }) {
22
+ const control = useFieldControl({
23
+ id,
24
+ required,
25
+ disabled,
26
+ invalid,
27
+ "aria-describedby": rest["aria-describedby"]
28
+ });
29
+ return /* @__PURE__ */ jsx("textarea", {
30
+ ...rest,
31
+ ...control,
32
+ rows,
33
+ "data-autogrow": autoGrow || void 0,
34
+ className: cx(input({ size: "md" }), textarea, className),
35
+ style: {
36
+ ...style,
37
+ ...assignInlineVars({ [maxRows]: String(maxRows$1) })
38
+ }
39
+ });
40
+ }
41
+ export { Input, Textarea };
21
42
 
22
43
  //# sourceMappingURL=input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","names":[],"sources":["../../../src/components/input/input.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react';\nimport { cx } from '../../utils/cx';\nimport { useField } from '../field/field-context';\nimport { input, type InputVariants } from './input.css';\n\nexport interface InputProps extends Omit<ComponentPropsWithRef<'input'>, 'size'> {\n size?: InputVariants['size'];\n /** Mark as invalid. Inside a `<Field error>` this is set for you. */\n invalid?: boolean;\n}\n\nexport function Input({ size, invalid, className, id, required, disabled, ...rest }: InputProps) {\n const field = useField();\n const describedBy = [field?.describedBy, rest['aria-describedby']].filter(Boolean).join(' ') || undefined;\n const isInvalid = invalid ?? field?.invalid ?? false;\n\n return (\n <input\n {...rest}\n id={id ?? field?.id}\n required={required ?? field?.required}\n disabled={disabled ?? field?.disabled}\n aria-describedby={describedBy}\n aria-invalid={isInvalid || undefined}\n className={cx(input({ size }), className)}\n />\n );\n}\n"],"mappings":";;;;;AAWA,SAAgB,MAAM,EAAE,MAAM,SAAS,WAAW,IAAI,UAAU,UAAU,GAAG,QAAoB;CAC/F,MAAM,QAAQ,SAAS;CACvB,MAAM,cAAc,CAAC,OAAO,aAAa,KAAK,mBAAmB,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,KAAK,KAAA;CAChG,MAAM,YAAY,WAAW,OAAO,WAAW;CAE/C,OACE,oBAAC,SAAD;EACE,GAAI;EACJ,IAAI,MAAM,OAAO;EACjB,UAAU,YAAY,OAAO;EAC7B,UAAU,YAAY,OAAO;EAC7B,oBAAkB;EAClB,gBAAc,aAAa,KAAA;EAC3B,WAAW,GAAG,MAAM,EAAE,KAAK,CAAC,GAAG,SAAS;CACzC,CAAA;AAEL"}
1
+ {"version":3,"file":"input.js","names":["maxRows","maxRowsVar"],"sources":["../../../src/components/input/input.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react';\nimport { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { cx } from '../../utils/cx';\nimport { useFieldControl } from '../field/use-field-control';\nimport { input, maxRows as maxRowsVar, textarea, type InputVariants } from './input.css';\n\nexport interface InputProps extends Omit<ComponentPropsWithRef<'input'>, 'size'> {\n size?: InputVariants['size'];\n /** Mark as invalid. Inside a `<Field error>` this is set for you. */\n invalid?: boolean;\n}\n\nexport function Input({ size, invalid, className, id, required, disabled, ...rest }: InputProps) {\n const control = useFieldControl({\n id,\n required,\n disabled,\n invalid,\n 'aria-describedby': rest['aria-describedby'],\n });\n return <input {...rest} {...control} className={cx(input({ size }), className)} />;\n}\n\nexport interface TextareaProps extends ComponentPropsWithRef<'textarea'> {\n invalid?: boolean;\n /**\n * Grow with the content up to `maxRows`, where the browser supports CSS\n * `field-sizing` (Chrome 123, Safari 26.2, Firefox 152). Elsewhere the user can\n * resize it. Default true.\n */\n autoGrow?: boolean;\n /** Upper bound for auto-grow, in lines. Default 10. */\n maxRows?: number;\n}\n\nexport function Textarea({\n invalid,\n autoGrow = true,\n rows = 3,\n maxRows = 10,\n className,\n style,\n id,\n required,\n disabled,\n ...rest\n}: TextareaProps) {\n const control = useFieldControl({\n id,\n required,\n disabled,\n invalid,\n 'aria-describedby': rest['aria-describedby'],\n });\n return (\n <textarea\n {...rest}\n {...control}\n rows={rows}\n data-autogrow={autoGrow || undefined}\n className={cx(input({ size: 'md' }), textarea, className)}\n style={{ ...style, ...assignInlineVars({ [maxRowsVar]: String(maxRows) }) }}\n />\n );\n}\n"],"mappings":";;;;;;AAYA,SAAgB,MAAM,EAAE,MAAM,SAAS,WAAW,IAAI,UAAU,UAAU,GAAG,QAAoB;CAC/F,MAAM,UAAU,gBAAgB;EAC9B;EACA;EACA;EACA;EACA,oBAAoB,KAAK;CAC3B,CAAC;CACD,OAAO,oBAAC,SAAD;EAAO,GAAI;EAAM,GAAI;EAAS,WAAW,GAAG,MAAM,EAAE,KAAK,CAAC,GAAG,SAAS;CAAI,CAAA;AACnF;AAcA,SAAgB,SAAS,EACvB,SACA,WAAW,MACX,OAAO,GACPA,SAAAA,YAAU,IACV,WACA,OACA,IACA,UACA,UACA,GAAG,QACa;CAChB,MAAM,UAAU,gBAAgB;EAC9B;EACA;EACA;EACA;EACA,oBAAoB,KAAK;CAC3B,CAAC;CACD,OACE,oBAAC,YAAD;EACE,GAAI;EACJ,GAAI;EACE;EACN,iBAAe,YAAY,KAAA;EAC3B,WAAW,GAAG,MAAM,EAAE,MAAM,KAAK,CAAC,GAAG,UAAU,SAAS;EACxD,OAAO;GAAE,GAAG;GAAO,GAAG,iBAAiB,GAAGC,UAAa,OAAOD,SAAO,EAAE,CAAC;EAAE;CAC3E,CAAA;AAEL"}
@@ -10,6 +10,8 @@ var input = createRuntimeFn({
10
10
  defaultVariants: { size: "md" },
11
11
  compoundVariants: []
12
12
  });
13
- export { input };
13
+ var maxRows = "var(--ml_18bh0934)";
14
+ var textarea = "ml_18bh0935";
15
+ export { input, maxRows, textarea };
14
16
 
15
17
  //# sourceMappingURL=input.styles.js.map
@@ -0,0 +1,2 @@
1
+ import { Select, SelectProps } from "./select.js";
2
+ export { Select, type SelectProps };
@@ -0,0 +1,14 @@
1
+ import { ComponentPropsWithRef } from "react";
2
+ import { InputVariants } from "../input/input.css.js";
3
+ export interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'size'> {
4
+ size?: InputVariants['size'];
5
+ invalid?: boolean;
6
+ /** Shown first and not selectable again once a choice is made, e.g. "Choose a country". */
7
+ placeholder?: string;
8
+ }
9
+ /**
10
+ * The native `<select>`, styled like `Input`. Phones get the system picker, keyboards
11
+ * and screen readers get native behaviour, and forms submit it as is.
12
+ */
13
+ export declare function Select({ size, invalid, placeholder, className, id, required, disabled, children, defaultValue, value, ...rest }: SelectProps): import("react").JSX.Element;
14
+ //# sourceMappingURL=select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.d.ts","names":[],"sources":["../../../src/components/select/select.tsx"],"mappings":";;iBAQiB,oBAAoB,KAAK;EACxC,OAAO;EACP;;EAEA;;;;;;wBAOc,SACd,MACA,SACA,aACA,WACA,IACA,UACA,UACA,UACA,cACA,UACG,QACF,8BAAW,IAAA"}
@@ -0,0 +1,44 @@
1
+ import { iconChevronDown } from "@mohirlab/icons";
2
+ import { cx } from "../../utils/cx.js";
3
+ import { useFieldControl } from "../field/use-field-control.js";
4
+ import { Icon } from "../icon/icon.js";
5
+ import { input } from "../input/input.styles.js";
6
+ import { chevron, select, wrap } from "./select.styles.js";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ // src/components/select/select.tsx
9
+ /**
10
+ * The native `<select>`, styled like `Input`. Phones get the system picker, keyboards
11
+ * and screen readers get native behaviour, and forms submit it as is.
12
+ */
13
+ function Select({ size, invalid, placeholder, className, id, required, disabled, children, defaultValue, value, ...rest }) {
14
+ const control = useFieldControl({
15
+ id,
16
+ required,
17
+ disabled,
18
+ invalid,
19
+ "aria-describedby": rest["aria-describedby"]
20
+ });
21
+ const initial = placeholder && value === void 0 && defaultValue === void 0 ? "" : defaultValue;
22
+ return /* @__PURE__ */ jsxs("span", {
23
+ className: wrap,
24
+ children: [/* @__PURE__ */ jsxs("select", {
25
+ ...rest,
26
+ ...control,
27
+ value,
28
+ defaultValue: initial,
29
+ className: cx(input({ size }), select, className),
30
+ children: [placeholder && /* @__PURE__ */ jsx("option", {
31
+ value: "",
32
+ disabled: true,
33
+ children: placeholder
34
+ }), children]
35
+ }), /* @__PURE__ */ jsx(Icon, {
36
+ icon: iconChevronDown,
37
+ className: chevron,
38
+ size: 18
39
+ })]
40
+ });
41
+ }
42
+ export { Select };
43
+
44
+ //# sourceMappingURL=select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.js","names":["styles.wrap","styles.select","styles.chevron"],"sources":["../../../src/components/select/select.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react';\nimport { iconChevronDown } from '@mohirlab/icons';\nimport { cx } from '../../utils/cx';\nimport { useFieldControl } from '../field/use-field-control';\nimport { Icon } from '../icon';\nimport { input, type InputVariants } from '../input/input.css';\nimport * as styles from './select.css';\n\nexport interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'size'> {\n size?: InputVariants['size'];\n invalid?: boolean;\n /** Shown first and not selectable again once a choice is made, e.g. \"Choose a country\". */\n placeholder?: string;\n}\n\n/**\n * The native `<select>`, styled like `Input`. Phones get the system picker, keyboards\n * and screen readers get native behaviour, and forms submit it as is.\n */\nexport function Select({\n size,\n invalid,\n placeholder,\n className,\n id,\n required,\n disabled,\n children,\n defaultValue,\n value,\n ...rest\n}: SelectProps) {\n const control = useFieldControl({\n id,\n required,\n disabled,\n invalid,\n 'aria-describedby': rest['aria-describedby'],\n });\n // With a placeholder and no value given, start on the placeholder option.\n const initial = placeholder && value === undefined && defaultValue === undefined ? '' : defaultValue;\n return (\n <span className={styles.wrap}>\n <select\n {...rest}\n {...control}\n value={value}\n defaultValue={initial}\n className={cx(input({ size }), styles.select, className)}\n >\n {placeholder && (\n <option value=\"\" disabled>\n {placeholder}\n </option>\n )}\n {children}\n </select>\n <Icon icon={iconChevronDown} className={styles.chevron} size={18} />\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,SAAgB,OAAO,EACrB,MACA,SACA,aACA,WACA,IACA,UACA,UACA,UACA,cACA,OACA,GAAG,QACW;CACd,MAAM,UAAU,gBAAgB;EAC9B;EACA;EACA;EACA;EACA,oBAAoB,KAAK;CAC3B,CAAC;CAED,MAAM,UAAU,eAAe,UAAU,KAAA,KAAa,iBAAiB,KAAA,IAAY,KAAK;CACxF,OACE,qBAAC,QAAD;EAAM,WAAWA;EAAjB,UAAA,CACE,qBAAC,UAAD;GACE,GAAI;GACJ,GAAI;GACG;GACP,cAAc;GACd,WAAW,GAAG,MAAM,EAAE,KAAK,CAAC,GAAGC,QAAe,SAAS;GALzD,UAAA,CAOG,eACC,oBAAC,UAAD;IAAQ,OAAM;IAAG,UAAA;IACd,UAAA;GACK,CAAA,GAET,QACK;EACR,CAAA,GAAA,oBAAC,MAAD;GAAM,MAAM;GAAiB,WAAWC;GAAgB,MAAM;EAAK,CAAA,CAC/D;;AAEV"}
@@ -0,0 +1,7 @@
1
+ // src/components/select/select.css.ts
2
+ var chevron = "ml_1bax71n2";
3
+ var select = "ml_1bax71n1";
4
+ var wrap = "ml_1bax71n0";
5
+ export { chevron, select, wrap };
6
+
7
+ //# sourceMappingURL=select.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.styles.js","names":[],"sources":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import { Slider, SliderProps, SliderValue } from "./slider.js";
2
+ export { Slider, type SliderProps, SliderValue };
@@ -0,0 +1,18 @@
1
+ import { ComponentPropsWithRef, ReactNode } from "react";
2
+ export interface SliderProps extends Omit<ComponentPropsWithRef<'input'>, 'type' | 'value' | 'defaultValue' | 'size'> {
3
+ value?: number;
4
+ defaultValue?: number;
5
+ onValueChange?: (value: number) => void;
6
+ min?: number;
7
+ max?: number;
8
+ step?: number;
9
+ /** Format the value for `aria-valuetext` and for `SliderValue`, e.g. `(v) => \`${v}%\``. */
10
+ format?: (value: number) => string;
11
+ }
12
+ /** A native range input with a filled track. Arrow keys, Page Up/Down, Home and End work natively. */
13
+ export declare function Slider({ value, defaultValue, onValueChange, min, max, step, format, className, style, id, required, disabled, onChange, ...rest }: SliderProps): import("react").JSX.Element;
14
+ /** Label row for a slider inside a `Field`: puts the current value at the end. */
15
+ export declare function SliderValue({ children }: {
16
+ children: ReactNode;
17
+ }): import("react").JSX.Element;
18
+ //# sourceMappingURL=slider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slider.d.ts","names":[],"sources":["../../../src/components/slider/slider.tsx"],"mappings":";iBAMiB,oBAAoB,KACnC;EAGA;EACA;EACA,iBAAiB;EACjB;EACA;EACA;;EAEA,UAAU;;;wBAII,SACd,OACA,cACA,eACA,KACA,KACA,MACA,QACA,WACA,OACA,IACA,UACA,UACA,aACG,QACF,8BAAW,IAAA;;wBA4BE,cAAc;EAAc,UAAU;oBAAW,IAAA"}
@@ -0,0 +1,50 @@
1
+ import { useState } from "react";
2
+ import { assignInlineVars } from "@vanilla-extract/dynamic";
3
+ import { cx } from "../../utils/cx.js";
4
+ import { useFieldControl } from "../field/use-field-control.js";
5
+ import { fill, output, slider } from "./slider.styles.js";
6
+ import { jsx } from "react/jsx-runtime";
7
+ // src/components/slider/slider.tsx
8
+ /** A native range input with a filled track. Arrow keys, Page Up/Down, Home and End work natively. */
9
+ function Slider({ value, defaultValue, onValueChange, min = 0, max = 100, step = 1, format, className, style, id, required, disabled, onChange, ...rest }) {
10
+ const control = useFieldControl({
11
+ id,
12
+ required,
13
+ disabled,
14
+ "aria-describedby": rest["aria-describedby"]
15
+ });
16
+ const [internal, setInternal] = useState(defaultValue ?? (min + max) / 2);
17
+ const current = value ?? internal;
18
+ const percent = max === min ? 0 : (current - min) / (max - min) * 100;
19
+ return /* @__PURE__ */ jsx("input", {
20
+ ...rest,
21
+ ...control,
22
+ type: "range",
23
+ min,
24
+ max,
25
+ step,
26
+ value: current,
27
+ "aria-valuetext": format?.(current),
28
+ onChange: (event) => {
29
+ onChange?.(event);
30
+ const next = Number(event.target.value);
31
+ if (value === void 0) setInternal(next);
32
+ onValueChange?.(next);
33
+ },
34
+ className: cx(slider, className),
35
+ style: {
36
+ ...style,
37
+ ...assignInlineVars({ [fill]: `${percent}%` })
38
+ }
39
+ });
40
+ }
41
+ /** Label row for a slider inside a `Field`: puts the current value at the end. */
42
+ function SliderValue({ children }) {
43
+ return /* @__PURE__ */ jsx("output", {
44
+ className: output,
45
+ children
46
+ });
47
+ }
48
+ export { Slider, SliderValue };
49
+
50
+ //# sourceMappingURL=slider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slider.js","names":["styles.slider","styles.fill","styles.output"],"sources":["../../../src/components/slider/slider.tsx"],"sourcesContent":["import { useState, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { cx } from '../../utils/cx';\nimport { useFieldControl } from '../field/use-field-control';\nimport * as styles from './slider.css';\n\nexport interface SliderProps extends Omit<\n ComponentPropsWithRef<'input'>,\n 'type' | 'value' | 'defaultValue' | 'size'\n> {\n value?: number;\n defaultValue?: number;\n onValueChange?: (value: number) => void;\n min?: number;\n max?: number;\n step?: number;\n /** Format the value for `aria-valuetext` and for `SliderValue`, e.g. `(v) => \\`${v}%\\``. */\n format?: (value: number) => string;\n}\n\n/** A native range input with a filled track. Arrow keys, Page Up/Down, Home and End work natively. */\nexport function Slider({\n value,\n defaultValue,\n onValueChange,\n min = 0,\n max = 100,\n step = 1,\n format,\n className,\n style,\n id,\n required,\n disabled,\n onChange,\n ...rest\n}: SliderProps) {\n const control = useFieldControl({ id, required, disabled, 'aria-describedby': rest['aria-describedby'] });\n const [internal, setInternal] = useState(defaultValue ?? (min + max) / 2);\n const current = value ?? internal;\n const percent = max === min ? 0 : ((current - min) / (max - min)) * 100;\n return (\n <input\n {...rest}\n {...control}\n type=\"range\"\n min={min}\n max={max}\n step={step}\n value={current}\n aria-valuetext={format?.(current)}\n onChange={(event) => {\n onChange?.(event);\n const next = Number(event.target.value);\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n }}\n className={cx(styles.slider, className)}\n style={{ ...style, ...assignInlineVars({ [styles.fill]: `${percent}%` }) }}\n />\n );\n}\n\n/** Label row for a slider inside a `Field`: puts the current value at the end. */\nexport function SliderValue({ children }: { children: ReactNode }) {\n return <output className={styles.output}>{children}</output>;\n}\n"],"mappings":";;;;;;;;AAqBA,SAAgB,OAAO,EACrB,OACA,cACA,eACA,MAAM,GACN,MAAM,KACN,OAAO,GACP,QACA,WACA,OACA,IACA,UACA,UACA,UACA,GAAG,QACW;CACd,MAAM,UAAU,gBAAgB;EAAE;EAAI;EAAU;EAAU,oBAAoB,KAAK;CAAoB,CAAC;CACxG,MAAM,CAAC,UAAU,eAAe,SAAS,iBAAiB,MAAM,OAAO,CAAC;CACxE,MAAM,UAAU,SAAS;CACzB,MAAM,UAAU,QAAQ,MAAM,KAAM,UAAU,QAAQ,MAAM,OAAQ;CACpE,OACE,oBAAC,SAAD;EACE,GAAI;EACJ,GAAI;EACJ,MAAK;EACA;EACA;EACC;EACN,OAAO;EACP,kBAAgB,SAAS,OAAO;EAChC,WAAW,UAAU;GACnB,WAAW,KAAK;GAChB,MAAM,OAAO,OAAO,MAAM,OAAO,KAAK;GACtC,IAAI,UAAU,KAAA,GAAW,YAAY,IAAI;GACzC,gBAAgB,IAAI;EACtB;EACA,WAAW,GAAGA,QAAe,SAAS;EACtC,OAAO;GAAE,GAAG;GAAO,GAAG,iBAAiB,GAAGC,OAAc,GAAG,QAAQ,GAAG,CAAC;EAAE;CAC1E,CAAA;AAEL;;AAGA,SAAgB,YAAY,EAAE,YAAqC;CACjE,OAAO,oBAAC,UAAD;EAAQ,WAAWC;EAAgB;CAAiB,CAAA;AAC7D"}
@@ -0,0 +1,7 @@
1
+ // src/components/slider/slider.css.ts
2
+ var fill = "var(--ml_kzlle60)";
3
+ var output = "ml_kzlle63";
4
+ var slider = "ml_kzlle61";
5
+ export { fill, output, slider };
6
+
7
+ //# sourceMappingURL=slider.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slider.styles.js","names":[],"sources":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -10,6 +10,8 @@ import "./components/button/index.js";
10
10
  import { Card, CardHeader, CardProps } from "./components/card/card.js";
11
11
  import { CardMedia, CardMediaProps } from "./components/card/card-media.js";
12
12
  import "./components/card/index.js";
13
+ import { Checkbox, CheckboxProps, Radio, RadioGroup, RadioGroupProps, RadioProps, Switch, SwitchProps } from "./components/choice/choice.js";
14
+ import "./components/choice/index.js";
13
15
  import { Dialog, DialogActions, DialogBody, DialogProps } from "./components/dialog/dialog.js";
14
16
  import "./components/dialog/index.js";
15
17
  import { Field, FieldProps } from "./components/field/field.js";
@@ -17,11 +19,15 @@ import { FieldContextValue, useField } from "./components/field/field-context.js
17
19
  import "./components/field/index.js";
18
20
  import { Icon, IconProps } from "./components/icon/icon.js";
19
21
  import "./components/icon/index.js";
20
- import { Input, InputProps } from "./components/input/input.js";
22
+ import { Input, InputProps, Textarea, TextareaProps } from "./components/input/input.js";
21
23
  import "./components/input/index.js";
22
24
  import { Placement } from "./components/popover/popover.css.js";
23
25
  import { Popover, PopoverProps, Tooltip, TooltipProps } from "./components/popover/popover.js";
24
26
  import "./components/popover/index.js";
27
+ import { Select, SelectProps } from "./components/select/select.js";
28
+ import "./components/select/index.js";
29
+ import { Slider, SliderProps, SliderValue } from "./components/slider/slider.js";
30
+ import "./components/slider/index.js";
25
31
  import { Heading, HeadingProps, MarginProps, Text, TextProps } from "./components/text/text.js";
26
32
  import "./components/text/index.js";
27
33
  import { ToastOptions, ToastProvider, ToastProviderProps, ToastTone, useToast } from "./components/toast/toast.js";
@@ -31,4 +37,4 @@ import { PresenceState, usePresence } from "./hooks/use-presence.js";
31
37
  import { useDisclosure } from "./hooks/use-disclosure.js";
32
38
  import "./hooks/index.js";
33
39
  import { cx } from "./utils/cx.js";
34
- export { Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Badge, type BadgeProps, Box, type BoxProps, Button, type ButtonProps, Card, CardHeader, CardMedia, type CardMediaProps, type CardProps, Dialog, DialogActions, DialogBody, type DialogProps, Field, type FieldContextValue, type FieldProps, Heading, type HeadingProps, Icon, type IconProps, Input, type InputProps, type MarginProps, type Placement, Popover, type PopoverProps, type PresenceState, Stack, type StackProps, Text, type TextProps, ThemeScope, type ThemeScopeProps, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, Tooltip, type TooltipProps, cx, splitSprinkles, useDisclosure, useField, usePresence, useToast };
40
+ export { Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Badge, type BadgeProps, Box, type BoxProps, Button, type ButtonProps, Card, CardHeader, CardMedia, type CardMediaProps, type CardProps, Checkbox, type CheckboxProps, Dialog, DialogActions, DialogBody, type DialogProps, Field, type FieldContextValue, type FieldProps, Heading, type HeadingProps, Icon, type IconProps, Input, type InputProps, type MarginProps, type Placement, Popover, type PopoverProps, type PresenceState, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Select, type SelectProps, Slider, type SliderProps, SliderValue, Stack, type StackProps, Switch, type SwitchProps, Text, type TextProps, Textarea, type TextareaProps, ThemeScope, type ThemeScopeProps, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, Tooltip, type TooltipProps, cx, splitSprinkles, useDisclosure, useField, usePresence, useToast };
package/dist/index.js CHANGED
@@ -6,15 +6,18 @@ import { Stack } from "./components/box/stack.js";
6
6
  import { Button } from "./components/button/button.js";
7
7
  import { Card, CardHeader } from "./components/card/card.js";
8
8
  import { CardMedia } from "./components/card/card-media.js";
9
- import { usePresence } from "./hooks/use-presence.js";
10
9
  import { Icon } from "./components/icon/icon.js";
10
+ import { Checkbox, Radio, RadioGroup, Switch } from "./components/choice/choice.js";
11
+ import { usePresence } from "./hooks/use-presence.js";
11
12
  import { Dialog, DialogActions, DialogBody } from "./components/dialog/dialog.js";
12
13
  import { useField } from "./components/field/field-context.js";
13
14
  import { Field } from "./components/field/field.js";
14
- import { Input } from "./components/input/input.js";
15
+ import { Input, Textarea } from "./components/input/input.js";
15
16
  import { Popover, Tooltip } from "./components/popover/popover.js";
17
+ import { Select } from "./components/select/select.js";
18
+ import { Slider, SliderValue } from "./components/slider/slider.js";
16
19
  import { Heading, Text } from "./components/text/text.js";
17
20
  import { ToastProvider, useToast } from "./components/toast/toast.js";
18
21
  import { cx } from "./utils/cx.js";
19
22
  import { useDisclosure } from "./hooks/use-disclosure.js";
20
- export { Avatar, AvatarGroup, Badge, Box, Button, Card, CardHeader, CardMedia, Dialog, DialogActions, DialogBody, Field, Heading, Icon, Input, Popover, Stack, Text, ThemeScope, ToastProvider, Tooltip, cx, splitSprinkles, useDisclosure, useField, usePresence, useToast };
23
+ export { Avatar, AvatarGroup, Badge, Box, Button, Card, CardHeader, CardMedia, Checkbox, Dialog, DialogActions, DialogBody, Field, Heading, Icon, Input, Popover, Radio, RadioGroup, Select, Slider, SliderValue, Stack, Switch, Text, Textarea, ThemeScope, ToastProvider, Tooltip, cx, splitSprinkles, useDisclosure, useField, usePresence, useToast };
package/dist/styles.css CHANGED
@@ -393,6 +393,262 @@
393
393
  @layer ml-theme;
394
394
  @layer ml-components;
395
395
  @layer ml-utilities;
396
+ @layer ml-components {
397
+ .ml_m1yyzl0 {
398
+ display: flex;
399
+ align-items: flex-start;
400
+ gap: var(--ml_space-3_uyc1fj12);
401
+ cursor: pointer;
402
+ color: var(--ml_color-text_uyc1fj4);
403
+ -webkit-tap-highlight-color: transparent;
404
+ }
405
+ .ml_m1yyzl0:has(input:disabled) {
406
+ cursor: not-allowed;
407
+ opacity: 0.55;
408
+ }
409
+ .ml_m1yyzl1 {
410
+ display: grid;
411
+ gap: var(--ml_space-0_5_uyc1fj1c);
412
+ }
413
+ .ml_m1yyzl2 {
414
+ font-size: var(--ml_font-size-md_uyc1fj1p);
415
+ line-height: var(--ml_font-leading-snug_uyc1fj20);
416
+ padding-top: 0.0625rem;
417
+ }
418
+ .ml_m1yyzl3 {
419
+ padding-left: calc(1.25rem + var(--ml_space-3_uyc1fj12));
420
+ font-size: var(--ml_font-size-sm_uyc1fj1o);
421
+ color: var(--ml_color-textMuted_uyc1fj5);
422
+ line-height: var(--ml_font-leading-snug_uyc1fj20);
423
+ }
424
+ .ml_m1yyzl1[data-kind="switch"] .ml_m1yyzl3 {
425
+ padding-left: calc(2.25rem + var(--ml_space-3_uyc1fj12));
426
+ }
427
+ .ml_m1yyzl4 {
428
+ position: relative;
429
+ display: inline-flex;
430
+ flex-shrink: 0;
431
+ margin-top: 0.0625rem;
432
+ }
433
+ .ml_m1yyzl5 {
434
+ transition-property: background-color, border-color, box-shadow;
435
+ transition-duration: var(--ml_motion-duration-quick_uyc1fj26);
436
+ transition-timing-function: var(--ml_motion-easing-standard_uyc1fj29);
437
+ appearance: none;
438
+ margin: 0;
439
+ width: 1.25rem;
440
+ height: 1.25rem;
441
+ flex-shrink: 0;
442
+ border: 1.5px solid var(--ml_color-border_uyc1fj9);
443
+ background-color: var(--ml_color-surface_uyc1fj1);
444
+ cursor: inherit;
445
+ outline: none;
446
+ border-radius: var(--ml_radius-xs_uyc1fj1f);
447
+ }
448
+ .ml_m1yyzl5:hover:not(:disabled) {
449
+ border-color: color-mix(in oklch, var(--ml_color-border_uyc1fj9), var(--ml_color-text_uyc1fj4) 30%);
450
+ }
451
+ .ml_m1yyzl5:focus-visible {
452
+ box-shadow: 0 0 0 2px var(--ml_color-canvas_uyc1fj0), 0 0 0 4px var(--ml_color-focus_uyc1fjs);
453
+ }
454
+ .ml_m1yyzl5:checked, .ml_m1yyzl5:indeterminate {
455
+ background-color: var(--ml_color-accent_uyc1fjb);
456
+ border-color: var(--ml_color-accent_uyc1fjb);
457
+ }
458
+ .ml_m1yyzl5[aria-invalid="true"] {
459
+ border-color: var(--ml_color-danger_uyc1fjh);
460
+ }
461
+ .ml_m1yyzl6 {
462
+ transition-property: background-color, border-color, box-shadow;
463
+ transition-duration: var(--ml_motion-duration-quick_uyc1fj26);
464
+ transition-timing-function: var(--ml_motion-easing-standard_uyc1fj29);
465
+ appearance: none;
466
+ margin: 0;
467
+ width: 1.25rem;
468
+ height: 1.25rem;
469
+ flex-shrink: 0;
470
+ border: 1.5px solid var(--ml_color-border_uyc1fj9);
471
+ background-color: var(--ml_color-surface_uyc1fj1);
472
+ cursor: inherit;
473
+ outline: none;
474
+ border-radius: 50%;
475
+ }
476
+ .ml_m1yyzl6:hover:not(:disabled) {
477
+ border-color: color-mix(in oklch, var(--ml_color-border_uyc1fj9), var(--ml_color-text_uyc1fj4) 30%);
478
+ }
479
+ .ml_m1yyzl6:focus-visible {
480
+ box-shadow: 0 0 0 2px var(--ml_color-canvas_uyc1fj0), 0 0 0 4px var(--ml_color-focus_uyc1fjs);
481
+ }
482
+ .ml_m1yyzl6:checked, .ml_m1yyzl6:indeterminate {
483
+ background-color: var(--ml_color-accent_uyc1fjb);
484
+ border-color: var(--ml_color-accent_uyc1fjb);
485
+ }
486
+ .ml_m1yyzl6[aria-invalid="true"] {
487
+ border-color: var(--ml_color-danger_uyc1fjh);
488
+ }
489
+ .ml_m1yyzl7 {
490
+ position: absolute;
491
+ inset: 0;
492
+ margin: auto;
493
+ pointer-events: none;
494
+ color: var(--ml_color-onAccent_uyc1fjg);
495
+ opacity: 0;
496
+ transform: scale(0.6);
497
+ transition: opacity var(--ml_motion-duration-quick_uyc1fj26), transform var(--ml_motion-duration-quick_uyc1fj26) var(--ml_motion-easing-press_uyc1fj2c);
498
+ }
499
+ .ml_m1yyzl5:checked:not(:indeterminate) ~ .ml_m1yyzl7 {
500
+ opacity: 1;
501
+ transform: none;
502
+ }
503
+ .ml_m1yyzl8 {
504
+ position: absolute;
505
+ inset: 0;
506
+ margin: auto;
507
+ pointer-events: none;
508
+ color: var(--ml_color-onAccent_uyc1fjg);
509
+ opacity: 0;
510
+ transform: scale(0.6);
511
+ transition: opacity var(--ml_motion-duration-quick_uyc1fj26), transform var(--ml_motion-duration-quick_uyc1fj26) var(--ml_motion-easing-press_uyc1fj2c);
512
+ }
513
+ .ml_m1yyzl5:indeterminate ~ .ml_m1yyzl8 {
514
+ opacity: 1;
515
+ transform: none;
516
+ }
517
+ .ml_m1yyzl9 {
518
+ position: absolute;
519
+ inset: 0;
520
+ margin: auto;
521
+ pointer-events: none;
522
+ color: var(--ml_color-onAccent_uyc1fjg);
523
+ opacity: 0;
524
+ transform: scale(0.6);
525
+ transition: opacity var(--ml_motion-duration-quick_uyc1fj26), transform var(--ml_motion-duration-quick_uyc1fj26) var(--ml_motion-easing-press_uyc1fj2c);
526
+ width: 0.5rem;
527
+ height: 0.5rem;
528
+ border-radius: 50%;
529
+ background-color: var(--ml_color-onAccent_uyc1fjg);
530
+ }
531
+ .ml_m1yyzl6:checked ~ .ml_m1yyzl9 {
532
+ opacity: 1;
533
+ transform: none;
534
+ }
535
+ .ml_m1yyzla {
536
+ transition-property: background-color, border-color, box-shadow;
537
+ transition-duration: var(--ml_motion-duration-quick_uyc1fj26);
538
+ transition-timing-function: var(--ml_motion-easing-standard_uyc1fj29);
539
+ appearance: none;
540
+ margin: 0;
541
+ width: 2.25rem;
542
+ height: 1.375rem;
543
+ flex-shrink: 0;
544
+ border: 1.5px solid var(--ml_color-border_uyc1fj9);
545
+ background-color: color-mix(in oklch, var(--ml_color-border_uyc1fj9), var(--ml_color-text_uyc1fj4) 12%);
546
+ cursor: inherit;
547
+ outline: none;
548
+ border-radius: var(--ml_radius-round_uyc1fj1k);
549
+ border-color: transparent;
550
+ }
551
+ .ml_m1yyzla:hover:not(:disabled) {
552
+ border-color: color-mix(in oklch, var(--ml_color-border_uyc1fj9), var(--ml_color-text_uyc1fj4) 30%);
553
+ }
554
+ .ml_m1yyzla:focus-visible {
555
+ box-shadow: 0 0 0 2px var(--ml_color-canvas_uyc1fj0), 0 0 0 4px var(--ml_color-focus_uyc1fjs);
556
+ }
557
+ .ml_m1yyzla:checked, .ml_m1yyzla:indeterminate {
558
+ background-color: var(--ml_color-accent_uyc1fjb);
559
+ border-color: var(--ml_color-accent_uyc1fjb);
560
+ }
561
+ .ml_m1yyzla[aria-invalid="true"] {
562
+ border-color: var(--ml_color-danger_uyc1fjh);
563
+ }
564
+ .ml_m1yyzla:checked {
565
+ border-color: transparent;
566
+ }
567
+ .ml_m1yyzlb {
568
+ position: absolute;
569
+ top: 0.1875rem;
570
+ left: 0.1875rem;
571
+ width: 1rem;
572
+ height: 1rem;
573
+ border-radius: 50%;
574
+ background-color: var(--ml_color-onAccent_uyc1fjg);
575
+ box-shadow: var(--ml_shadow-control_uyc1fjy);
576
+ pointer-events: none;
577
+ transition: transform var(--ml_motion-duration-settle_uyc1fj27) var(--ml_motion-easing-press_uyc1fj2c);
578
+ }
579
+ .ml_m1yyzla:checked ~ .ml_m1yyzlb {
580
+ transform: translateX(0.875rem);
581
+ }
582
+ .ml_m1yyzlc {
583
+ border: 0;
584
+ margin: 0;
585
+ padding: 0;
586
+ min-width: 0;
587
+ display: grid;
588
+ gap: var(--ml_space-2_uyc1fj11);
589
+ }
590
+ .ml_m1yyzld {
591
+ padding: 0;
592
+ margin-bottom: var(--ml_space-2_uyc1fj11);
593
+ font-size: var(--ml_font-size-sm_uyc1fj1o);
594
+ font-weight: var(--ml_font-weight-strong_uyc1fj1x);
595
+ color: var(--ml_color-text_uyc1fj4);
596
+ }
597
+ .ml_m1yyzle {
598
+ display: flex;
599
+ flex-direction: column;
600
+ gap: var(--ml_space-3_uyc1fj12);
601
+ }
602
+ .ml_m1yyzle[data-orientation="horizontal"] {
603
+ flex-direction: row;
604
+ flex-wrap: wrap;
605
+ gap: var(--ml_space-5_uyc1fj14);
606
+ }
607
+ .ml_m1yyzlf {
608
+ margin: 0;
609
+ font-size: var(--ml_font-size-sm_uyc1fj1o);
610
+ color: var(--ml_color-textSubtle_uyc1fj6);
611
+ }
612
+ .ml_m1yyzlg {
613
+ margin: 0;
614
+ font-size: var(--ml_font-size-sm_uyc1fj1o);
615
+ font-weight: var(--ml_font-weight-medium_uyc1fj1w);
616
+ color: var(--ml_color-dangerText_uyc1fjk);
617
+ }
618
+ @media (pointer: coarse) {
619
+ .ml_m1yyzl0 {
620
+ min-height: 2.75rem;
621
+ align-items: center;
622
+ }
623
+ }
624
+ @media (prefers-reduced-motion: reduce) {
625
+ .ml_m1yyzl5 {
626
+ transition-duration: 1ms;
627
+ }
628
+ .ml_m1yyzl6 {
629
+ transition-duration: 1ms;
630
+ }
631
+ .ml_m1yyzl7 {
632
+ transition: none;
633
+ }
634
+ .ml_m1yyzl8 {
635
+ transition: none;
636
+ }
637
+ .ml_m1yyzl9 {
638
+ transition: none;
639
+ }
640
+ .ml_m1yyzla {
641
+ transition-duration: 1ms;
642
+ }
643
+ .ml_m1yyzlb {
644
+ transition: none;
645
+ }
646
+ }
647
+ }
648
+ @layer ml-reset;
649
+ @layer ml-theme;
650
+ @layer ml-components;
651
+ @layer ml-utilities;
396
652
  @layer ml-components {
397
653
  .ml_iy25f51 {
398
654
  --ml_iy25f50: 30rem;
@@ -688,80 +944,6 @@
688
944
  @layer ml-theme;
689
945
  @layer ml-components;
690
946
  @layer ml-utilities;
691
- @layer ml-components {
692
- .ml_18bh0930 {
693
- appearance: none;
694
- display: block;
695
- width: 100%;
696
- min-width: 0;
697
- margin: 0;
698
- font-family: inherit;
699
- color: var(--ml_color-text_uyc1fj4);
700
- background-color: var(--ml_color-surface_uyc1fj1);
701
- border: 1px solid var(--ml_color-border_uyc1fj9);
702
- border-radius: var(--ml_radius-md_uyc1fj1h);
703
- box-shadow: var(--ml_shadow-raised_uyc1fjw);
704
- outline: none;
705
- transition-property: border-color, background-color, box-shadow;
706
- transition-duration: var(--ml_motion-duration-quick_uyc1fj26);
707
- transition-timing-function: var(--ml_motion-easing-standard_uyc1fj29);
708
- }
709
- .ml_18bh0930::placeholder {
710
- color: var(--ml_color-textSubtle_uyc1fj6);
711
- opacity: 1;
712
- }
713
- .ml_18bh0930:hover:not(:disabled):not(:focus) {
714
- border-color: color-mix(in oklch, var(--ml_color-border_uyc1fj9), var(--ml_color-text_uyc1fj4) 18%);
715
- }
716
- .ml_18bh0930:focus {
717
- border-color: var(--ml_color-accent_uyc1fjb);
718
- box-shadow: 0 0 0 3px color-mix(in oklch, var(--ml_color-accent_uyc1fjb) 20%, transparent);
719
- }
720
- .ml_18bh0930[aria-invalid="true"] {
721
- border-color: var(--ml_color-danger_uyc1fjh);
722
- }
723
- .ml_18bh0930[aria-invalid="true"]:focus {
724
- box-shadow: 0 0 0 3px color-mix(in oklch, var(--ml_color-danger_uyc1fjh) 20%, transparent);
725
- }
726
- .ml_18bh0930:disabled {
727
- cursor: not-allowed;
728
- color: var(--ml_color-textSubtle_uyc1fj6);
729
- background-color: var(--ml_color-surfaceSunken_uyc1fj2);
730
- box-shadow: none;
731
- }
732
- .ml_18bh0930:read-only:not(:disabled) {
733
- background-color: var(--ml_color-surfaceSunken_uyc1fj2);
734
- box-shadow: none;
735
- }
736
- .ml_size_sm_18bh0931 {
737
- height: 1.875rem;
738
- padding-inline: var(--ml_space-2_uyc1fj11);
739
- font-size: var(--ml_font-size-sm_uyc1fj1o);
740
- gap: var(--ml_space-1_5_uyc1fj1d);
741
- border-radius: var(--ml_radius-sm_uyc1fj1g);
742
- }
743
- .ml_size_md_18bh0932 {
744
- height: 2.375rem;
745
- padding-inline: var(--ml_space-3_uyc1fj12);
746
- font-size: var(--ml_font-size-md_uyc1fj1p);
747
- gap: var(--ml_space-2_uyc1fj11);
748
- }
749
- .ml_size_lg_18bh0933 {
750
- height: 2.875rem;
751
- padding-inline: var(--ml_space-4_uyc1fj13);
752
- font-size: var(--ml_font-size-lg_uyc1fj1q);
753
- gap: var(--ml_space-2_uyc1fj11);
754
- }
755
- @media (prefers-reduced-motion: reduce) {
756
- .ml_18bh0930 {
757
- transition-duration: 1ms;
758
- }
759
- }
760
- }
761
- @layer ml-reset;
762
- @layer ml-theme;
763
- @layer ml-components;
764
- @layer ml-utilities;
765
947
  @layer ml-components {
766
948
  .ml_12557yp0 {
767
949
  position: fixed;
@@ -869,6 +1051,195 @@
869
1051
  @layer ml-theme;
870
1052
  @layer ml-components;
871
1053
  @layer ml-utilities;
1054
+ @layer ml-components {
1055
+ .ml_18bh0930 {
1056
+ appearance: none;
1057
+ display: block;
1058
+ width: 100%;
1059
+ min-width: 0;
1060
+ margin: 0;
1061
+ font-family: inherit;
1062
+ color: var(--ml_color-text_uyc1fj4);
1063
+ background-color: var(--ml_color-surface_uyc1fj1);
1064
+ border: 1px solid var(--ml_color-border_uyc1fj9);
1065
+ border-radius: var(--ml_radius-md_uyc1fj1h);
1066
+ box-shadow: var(--ml_shadow-raised_uyc1fjw);
1067
+ outline: none;
1068
+ transition-property: border-color, background-color, box-shadow;
1069
+ transition-duration: var(--ml_motion-duration-quick_uyc1fj26);
1070
+ transition-timing-function: var(--ml_motion-easing-standard_uyc1fj29);
1071
+ }
1072
+ .ml_18bh0930::placeholder {
1073
+ color: var(--ml_color-textSubtle_uyc1fj6);
1074
+ opacity: 1;
1075
+ }
1076
+ .ml_18bh0930:hover:not(:disabled):not(:focus) {
1077
+ border-color: color-mix(in oklch, var(--ml_color-border_uyc1fj9), var(--ml_color-text_uyc1fj4) 18%);
1078
+ }
1079
+ .ml_18bh0930:focus {
1080
+ border-color: var(--ml_color-accent_uyc1fjb);
1081
+ box-shadow: 0 0 0 3px color-mix(in oklch, var(--ml_color-accent_uyc1fjb) 20%, transparent);
1082
+ }
1083
+ .ml_18bh0930[aria-invalid="true"] {
1084
+ border-color: var(--ml_color-danger_uyc1fjh);
1085
+ }
1086
+ .ml_18bh0930[aria-invalid="true"]:focus {
1087
+ box-shadow: 0 0 0 3px color-mix(in oklch, var(--ml_color-danger_uyc1fjh) 20%, transparent);
1088
+ }
1089
+ .ml_18bh0930:disabled {
1090
+ cursor: not-allowed;
1091
+ color: var(--ml_color-textSubtle_uyc1fj6);
1092
+ background-color: var(--ml_color-surfaceSunken_uyc1fj2);
1093
+ box-shadow: none;
1094
+ }
1095
+ .ml_18bh0930:read-only:not(:disabled):not(select) {
1096
+ background-color: var(--ml_color-surfaceSunken_uyc1fj2);
1097
+ box-shadow: none;
1098
+ }
1099
+ .ml_size_sm_18bh0931 {
1100
+ height: 1.875rem;
1101
+ padding-inline: var(--ml_space-2_uyc1fj11);
1102
+ font-size: var(--ml_font-size-sm_uyc1fj1o);
1103
+ gap: var(--ml_space-1_5_uyc1fj1d);
1104
+ border-radius: var(--ml_radius-sm_uyc1fj1g);
1105
+ }
1106
+ .ml_size_md_18bh0932 {
1107
+ height: 2.375rem;
1108
+ padding-inline: var(--ml_space-3_uyc1fj12);
1109
+ font-size: var(--ml_font-size-md_uyc1fj1p);
1110
+ gap: var(--ml_space-2_uyc1fj11);
1111
+ }
1112
+ .ml_size_lg_18bh0933 {
1113
+ height: 2.875rem;
1114
+ padding-inline: var(--ml_space-4_uyc1fj13);
1115
+ font-size: var(--ml_font-size-lg_uyc1fj1q);
1116
+ gap: var(--ml_space-2_uyc1fj11);
1117
+ }
1118
+ .ml_18bh0935 {
1119
+ height: auto;
1120
+ min-height: 5rem;
1121
+ padding-block: var(--ml_space-2_uyc1fj11);
1122
+ line-height: var(--ml_font-leading-normal_uyc1fj21);
1123
+ resize: vertical;
1124
+ }
1125
+ .ml_18bh0935[data-autogrow] {
1126
+ field-sizing: content;
1127
+ max-height: calc(var(--ml_18bh0934) * 1lh + 2 * var(--ml_space-2_uyc1fj11) + 2px);
1128
+ }
1129
+ @media (prefers-reduced-motion: reduce) {
1130
+ .ml_18bh0930 {
1131
+ transition-duration: 1ms;
1132
+ }
1133
+ }
1134
+ }
1135
+ @layer ml-reset;
1136
+ @layer ml-theme;
1137
+ @layer ml-components;
1138
+ @layer ml-utilities;
1139
+ @layer ml-components {
1140
+ .ml_1bax71n0 {
1141
+ position: relative;
1142
+ display: block;
1143
+ min-width: 0;
1144
+ }
1145
+ .ml_1bax71n1 {
1146
+ padding-right: var(--ml_space-10_uyc1fj17);
1147
+ cursor: pointer;
1148
+ text-overflow: ellipsis;
1149
+ }
1150
+ .ml_1bax71n1:disabled {
1151
+ cursor: not-allowed;
1152
+ }
1153
+ .ml_1bax71n2 {
1154
+ position: absolute;
1155
+ right: var(--ml_space-3_uyc1fj12);
1156
+ top: 50%;
1157
+ transform: translateY(-50%);
1158
+ pointer-events: none;
1159
+ color: var(--ml_color-textSubtle_uyc1fj6);
1160
+ }
1161
+ }
1162
+ @layer ml-reset;
1163
+ @layer ml-theme;
1164
+ @layer ml-components;
1165
+ @layer ml-utilities;
1166
+ @layer ml-components {
1167
+ .ml_kzlle61 {
1168
+ --ml_kzlle60: 50%;
1169
+ appearance: none;
1170
+ display: block;
1171
+ width: 100%;
1172
+ height: 1.25rem;
1173
+ margin: 0;
1174
+ background: transparent;
1175
+ cursor: pointer;
1176
+ outline: none;
1177
+ }
1178
+ .ml_kzlle61::-webkit-slider-runnable-track {
1179
+ height: 0.375rem;
1180
+ border-radius: 999px;
1181
+ background: linear-gradient(to right, var(--ml_color-accent_uyc1fjb) var(--ml_kzlle60), color-mix(in oklch, var(--ml_color-border_uyc1fj9), var(--ml_color-text_uyc1fj4) 8%) var(--ml_kzlle60));
1182
+ }
1183
+ .ml_kzlle61::-moz-range-track {
1184
+ height: 0.375rem;
1185
+ border-radius: 999px;
1186
+ background: linear-gradient(to right, var(--ml_color-accent_uyc1fjb) var(--ml_kzlle60), color-mix(in oklch, var(--ml_color-border_uyc1fj9), var(--ml_color-text_uyc1fj4) 8%) var(--ml_kzlle60));
1187
+ }
1188
+ .ml_kzlle61::-webkit-slider-thumb {
1189
+ width: 1.25rem;
1190
+ height: 1.25rem;
1191
+ border-radius: 50%;
1192
+ background-color: var(--ml_color-onAccent_uyc1fjg);
1193
+ border: 2px solid var(--ml_color-accent_uyc1fjb);
1194
+ box-shadow: var(--ml_shadow-control_uyc1fjy);
1195
+ cursor: grab;
1196
+ appearance: none;
1197
+ margin-top: -0.4375rem;
1198
+ }
1199
+ .ml_kzlle61::-moz-range-thumb {
1200
+ width: 1.25rem;
1201
+ height: 1.25rem;
1202
+ border-radius: 50%;
1203
+ background-color: var(--ml_color-onAccent_uyc1fjg);
1204
+ border: 2px solid var(--ml_color-accent_uyc1fjb);
1205
+ box-shadow: var(--ml_shadow-control_uyc1fjy);
1206
+ cursor: grab;
1207
+ }
1208
+ .ml_kzlle61:active::-webkit-slider-thumb {
1209
+ cursor: grabbing;
1210
+ }
1211
+ .ml_kzlle61:focus-visible::-webkit-slider-thumb {
1212
+ box-shadow: 0 0 0 2px var(--ml_color-canvas_uyc1fj0), 0 0 0 4px var(--ml_color-focus_uyc1fjs);
1213
+ }
1214
+ .ml_kzlle61:focus-visible::-moz-range-thumb {
1215
+ box-shadow: 0 0 0 2px var(--ml_color-canvas_uyc1fj0), 0 0 0 4px var(--ml_color-focus_uyc1fjs);
1216
+ }
1217
+ .ml_kzlle61:disabled {
1218
+ cursor: not-allowed;
1219
+ opacity: 0.5;
1220
+ }
1221
+ .ml_kzlle62 {
1222
+ display: flex;
1223
+ justify-content: space-between;
1224
+ align-items: baseline;
1225
+ gap: var(--ml_space-3_uyc1fj12);
1226
+ }
1227
+ .ml_kzlle63 {
1228
+ font-size: var(--ml_font-size-sm_uyc1fj1o);
1229
+ font-weight: var(--ml_font-weight-strong_uyc1fj1x);
1230
+ font-variant-numeric: tabular-nums;
1231
+ color: var(--ml_color-text_uyc1fj4);
1232
+ }
1233
+ @media (pointer: coarse) {
1234
+ .ml_kzlle61 {
1235
+ height: 2.75rem;
1236
+ }
1237
+ }
1238
+ }
1239
+ @layer ml-reset;
1240
+ @layer ml-theme;
1241
+ @layer ml-components;
1242
+ @layer ml-utilities;
872
1243
  @layer ml-components {
873
1244
  .ml_1pplbdu0 {
874
1245
  margin: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohirlab/react",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Mohirlab React components.",
5
5
  "keywords": [
6
6
  "design-system",
@@ -38,6 +38,7 @@
38
38
  "@mohirlab/motion": "^0.1.2",
39
39
  "@mohirlab/sprinkles": "^0.1.3",
40
40
  "@mohirlab/themes": "^0.3.0",
41
+ "@vanilla-extract/dynamic": "^2.1.5",
41
42
  "@vanilla-extract/recipes": "^0.5.7",
42
43
  "@vanilla-extract/sprinkles": "^1.7.0"
43
44
  },