@a-type/ui 6.0.22 → 6.0.23

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 (50) hide show
  1. package/dist/components/forms/CheckboxField.d.ts +3 -1
  2. package/dist/components/forms/CheckboxField.js +5 -6
  3. package/dist/components/forms/CheckboxField.js.map +1 -1
  4. package/dist/components/forms/EmojiField.d.ts +3 -1
  5. package/dist/components/forms/EmojiField.js +10 -11
  6. package/dist/components/forms/EmojiField.js.map +1 -1
  7. package/dist/components/forms/Field.d.ts +16 -0
  8. package/dist/components/forms/Field.js +37 -0
  9. package/dist/components/forms/Field.js.map +1 -0
  10. package/dist/components/forms/Field.module.css +51 -0
  11. package/dist/components/forms/Form.module.css +1 -1
  12. package/dist/components/forms/FormikForm.d.ts +2 -2
  13. package/dist/components/forms/FormikForm.stories.d.ts +2 -2
  14. package/dist/components/forms/FormikForm.stories.js +1 -1
  15. package/dist/components/forms/FormikForm.stories.js.map +1 -1
  16. package/dist/components/forms/NumberStepperField.d.ts +3 -1
  17. package/dist/components/forms/NumberStepperField.js +6 -9
  18. package/dist/components/forms/NumberStepperField.js.map +1 -1
  19. package/dist/components/forms/SwitchField.d.ts +3 -1
  20. package/dist/components/forms/SwitchField.js +5 -6
  21. package/dist/components/forms/SwitchField.js.map +1 -1
  22. package/dist/components/forms/TextField.d.ts +7 -5
  23. package/dist/components/forms/TextField.js +5 -7
  24. package/dist/components/forms/TextField.js.map +1 -1
  25. package/dist/components/forms/ToggleGroupField.d.ts +3 -1
  26. package/dist/components/forms/ToggleGroupField.js +10 -11
  27. package/dist/components/forms/ToggleGroupField.js.map +1 -1
  28. package/dist/components/forms/index.d.ts +1 -1
  29. package/dist/components/forms/index.js +1 -1
  30. package/dist/components/forms/index.js.map +1 -1
  31. package/dist/components/switch/Switch.module.css +1 -1
  32. package/package.json +1 -1
  33. package/src/components/forms/CheckboxField.tsx +23 -15
  34. package/src/components/forms/EmojiField.tsx +50 -33
  35. package/src/components/forms/Field.module.css +51 -0
  36. package/src/components/forms/Field.tsx +43 -0
  37. package/src/components/forms/Form.module.css +1 -1
  38. package/src/components/forms/FormikForm.stories.tsx +25 -5
  39. package/src/components/forms/NumberStepperField.tsx +24 -17
  40. package/src/components/forms/SwitchField.tsx +23 -15
  41. package/src/components/forms/TextField.tsx +49 -25
  42. package/src/components/forms/ToggleGroupField.tsx +29 -19
  43. package/src/components/forms/index.tsx +1 -1
  44. package/src/components/switch/Switch.module.css +1 -1
  45. package/dist/components/forms/FieldLabel.d.ts +0 -2
  46. package/dist/components/forms/FieldLabel.js +0 -5
  47. package/dist/components/forms/FieldLabel.js.map +0 -1
  48. package/dist/components/forms/FieldLabel.module.css +0 -20
  49. package/src/components/forms/FieldLabel.module.css +0 -20
  50. package/src/components/forms/FieldLabel.tsx +0 -9
@@ -1,8 +1,10 @@
1
+ import { ReactNode } from 'react';
1
2
  export interface CheckboxFieldProps {
2
3
  name: string;
3
4
  label?: string;
4
5
  required?: boolean;
5
6
  className?: string;
6
7
  id?: string;
8
+ description?: ReactNode;
7
9
  }
8
- export declare function CheckboxField({ name, label, className, required, id: providedId, ...rest }: CheckboxFieldProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function CheckboxField({ name, label, className, required, id: providedId, description, ...rest }: CheckboxFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -12,15 +12,14 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useField } from 'formik';
14
14
  import { useIdOrGenerated } from '../../hooks/useIdOrGenerated.js';
15
- import { Box } from '../box/Box.js';
16
15
  import { Checkbox } from '../checkbox/index.js';
17
- import { HorizontalFieldLabel } from './FieldLabel.js';
16
+ import { Field } from './Field.js';
18
17
  export function CheckboxField(_a) {
19
- var { name, label, className, required, id: providedId } = _a, rest = __rest(_a, ["name", "label", "className", "required", "id"]);
18
+ var { name, label, className, required, id: providedId, description } = _a, rest = __rest(_a, ["name", "label", "className", "required", "id", "description"]);
20
19
  const [props, _, tools] = useField({ name, required, type: 'checkbox' });
21
20
  const id = useIdOrGenerated(providedId);
22
- return (_jsxs(Box, { gap: "md", className: className, children: [_jsx(Checkbox, Object.assign({}, props, { checked: props.checked, onCheckedChange: (v) => {
23
- tools.setValue(!!v);
24
- }, id: id }, rest)), label && (_jsx(HorizontalFieldLabel, { htmlFor: id, children: label }))] }));
21
+ return (_jsxs(Field, { horizontal: true, className: className, children: [_jsx(Field.Control, { children: _jsx(Checkbox, Object.assign({}, props, { checked: props.checked, onCheckedChange: (v) => {
22
+ tools.setValue(!!v);
23
+ }, id: id, "aria-describedby": description ? `${id}-description` : undefined }, rest)) }), label && _jsx(Field.Label, { htmlFor: id, children: label }), description && (_jsx(Field.Description, { id: `${id}-description`, children: description }))] }));
25
24
  }
26
25
  //# sourceMappingURL=CheckboxField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxField.js","sourceRoot":"","sources":["../../../src/components/forms/CheckboxField.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAUvD,MAAM,UAAU,aAAa,CAAC,EAOT;QAPS,EAC7B,IAAI,EACJ,KAAK,EACL,SAAS,EACT,QAAQ,EACR,EAAE,EAAE,UAAU,OAEM,EADjB,IAAI,cANsB,gDAO7B,CADO;IAEP,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;IACzE,MAAM,EAAE,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,KAAK,IACT,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,eAAe,EAAE,CAAC,CAAC,EAAE,EAAE;wBACtB,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBACrB,CAAC,EACD,EAAE,EAAE,EAAE,sBACY,WAAW,CAAC,CAAC,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC,SAAS,IAC3D,IAAI,EACP,GACa,EACf,KAAK,IAAI,KAAC,KAAK,CAAC,KAAK,IAAC,OAAO,EAAE,EAAE,YAAG,KAAK,GAAe,EACxD,WAAW,IAAI,CACf,KAAC,KAAK,CAAC,WAAW,IAAC,EAAE,EAAE,GAAG,EAAE,cAAc,YACxC,WAAW,GACO,CACpB,IACM,CACR,CAAC;AACH,CAAC"}
@@ -1,8 +1,10 @@
1
+ import { ReactNode } from 'react';
1
2
  import { ButtonProps } from '../button/Button.js';
2
3
  export type EmojiFieldProps = Omit<ButtonProps, 'className'> & {
3
4
  name: string;
4
5
  label?: string;
5
6
  required?: string;
6
7
  className?: string;
8
+ description?: ReactNode;
7
9
  };
8
- export declare function EmojiField({ name, label, className, required, id: providedId, ...rest }: EmojiFieldProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function EmojiField({ name, label, className, required, id: providedId, description, ...rest }: EmojiFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -13,26 +13,25 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useField } from 'formik';
14
14
  import { useState } from 'react';
15
15
  import { useIdOrGenerated } from '../../hooks/useIdOrGenerated.js';
16
- import { Box } from '../box/Box.js';
17
16
  import { Button } from '../button/Button.js';
18
17
  import { EmojiPicker } from '../emojiPicker/EmojiPicker.js';
19
18
  import { Icon } from '../icon/Icon.js';
20
19
  import { Popover } from '../popover/Popover.js';
21
20
  import cls from './EmojiField.module.css';
22
- import { HorizontalFieldLabel } from './FieldLabel.js';
21
+ import { Field } from './Field.js';
23
22
  export function EmojiField(_a) {
24
- var { name, label, className, required, id: providedId } = _a, rest = __rest(_a, ["name", "label", "className", "required", "id"]);
23
+ var { name, label, className, required, id: providedId, description } = _a, rest = __rest(_a, ["name", "label", "className", "required", "id", "description"]);
25
24
  const [props, _, tools] = useField({ name });
26
25
  const id = useIdOrGenerated(providedId);
27
26
  const [open, setOpen] = useState(false);
28
- return (_jsxs(Box, { gap: "md", className: className, children: [_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(Popover.Trigger, { render: _jsx(Button, Object.assign({ id: id, "aria-label": "Select emoji", size: "wrapper" }, rest, { children: _jsx(Button.Icon, { className: cls.triggerIcon, children: props.value || _jsx(Icon, { name: "smile" }) }) })) }), _jsx(Popover.Content, { children: _jsx(EmojiPicker, { onValueChange: (v) => {
29
- tools.setValue(v);
30
- setOpen(false);
31
- }, onClear: required
32
- ? undefined
33
- : () => {
34
- tools.setValue('');
27
+ return (_jsxs(Field, { horizontal: true, className: className, children: [_jsx(Field.Control, { children: _jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx("input", Object.assign({ type: "hidden" }, props, { id: id, "aria-describedby": description ? `${id}-description` : undefined })), _jsx(Popover.Trigger, { render: _jsx(Button, Object.assign({ id: `${id}-trigger`, "aria-label": "Select emoji", size: "wrapper" }, rest, { children: _jsx(Button.Icon, { className: cls.triggerIcon, children: props.value || _jsx(Icon, { name: "smile" }) }) })) }), _jsx(Popover.Content, { children: _jsx(EmojiPicker, { onValueChange: (v) => {
28
+ tools.setValue(v);
35
29
  setOpen(false);
36
- }, id: id }) })] }), label && (_jsx(HorizontalFieldLabel, { htmlFor: id, children: label }))] }));
30
+ }, onClear: required
31
+ ? undefined
32
+ : () => {
33
+ tools.setValue('');
34
+ setOpen(false);
35
+ }, id: id }) })] }) }), label && _jsx(Field.Label, { htmlFor: id, children: label }), description && (_jsx(Field.Description, { id: `${id}-description`, children: description }))] }));
37
36
  }
38
37
  //# sourceMappingURL=EmojiField.js.map
@@ -1 +1 @@
1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AS;oCACX,CAAC,CAAC,GAAG,EAAE;wCACL,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;wCACnB,OAAO,CAAC,KAAK,CAAC,CAAC;oCACf,CAAC,EAEL,EAAE,EAAE,EAAE,GACL,GACe,IACT,GACK,EACf,KAAK,IAAI,KAAC,KAAK,CAAC,KAAK,IAAC,OAAO,EAAE,EAAE,YAAG,KAAK,GAAe,EACxD,WAAW,IAAI,CACf,KAAC,KAAK,CAAC,WAAW,IAAC,EAAE,EAAE,GAAG,EAAE,cAAc,YACxC,WAAW,GACO,CACpB,IACM,CACR,CAAC;AACH,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { ComponentProps } from 'react';
2
+ import { SlotDiv } from '../utility/SlotDiv.js';
3
+ export interface FieldRootProps extends ComponentProps<'div'> {
4
+ horizontal?: boolean;
5
+ stretch?: boolean;
6
+ }
7
+ declare function FieldRoot({ className, horizontal, ...props }: FieldRootProps): import("react/jsx-runtime").JSX.Element;
8
+ declare function FieldControl({ className, ...props }: ComponentProps<typeof SlotDiv>): import("react/jsx-runtime").JSX.Element;
9
+ declare function FieldLabel({ className, ...props }: ComponentProps<'label'>): import("react/jsx-runtime").JSX.Element;
10
+ declare function FieldDescription({ className, ...props }: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
11
+ export declare const Field: typeof FieldRoot & {
12
+ Label: typeof FieldLabel;
13
+ Description: typeof FieldDescription;
14
+ Control: typeof FieldControl;
15
+ };
16
+ export {};
@@ -0,0 +1,37 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import clsx from 'clsx';
14
+ import { SlotDiv } from '../utility/SlotDiv.js';
15
+ import cls from './Field.module.css';
16
+ function FieldRoot(_a) {
17
+ var { className, horizontal } = _a, props = __rest(_a, ["className", "horizontal"]);
18
+ return (_jsx(SlotDiv, Object.assign({ className: clsx(cls.root, className), "data-horizontal": horizontal ? '' : undefined, "data-stretch": props.stretch ? '' : undefined }, props)));
19
+ }
20
+ function FieldControl(_a) {
21
+ var { className } = _a, props = __rest(_a, ["className"]);
22
+ return _jsx(SlotDiv, Object.assign({ className: clsx(cls.control, className) }, props));
23
+ }
24
+ function FieldLabel(_a) {
25
+ var { className } = _a, props = __rest(_a, ["className"]);
26
+ return _jsx("label", Object.assign({ className: clsx(cls.label, className) }, props));
27
+ }
28
+ function FieldDescription(_a) {
29
+ var { className } = _a, props = __rest(_a, ["className"]);
30
+ return (_jsx("div", Object.assign({ className: clsx('@mode-dense', cls.description, className) }, props)));
31
+ }
32
+ export const Field = Object.assign(FieldRoot, {
33
+ Label: FieldLabel,
34
+ Description: FieldDescription,
35
+ Control: FieldControl,
36
+ });
37
+ //# sourceMappingURL=Field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Field.js","sourceRoot":"","sources":["../../../src/components/forms/Field.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,GAAG,MAAM,oBAAoB,CAAC;AAOrC,SAAS,SAAS,CAAC,EAAmD;QAAnD,EAAE,SAAS,EAAE,UAAU,OAA4B,EAAvB,KAAK,cAAjC,2BAAmC,CAAF;IACnD,OAAO,CACN,KAAC,OAAO,kBACP,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,qBACnB,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,kBAC9B,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,IACxC,KAAK,EACR,CACF,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,EAAuD;QAAvD,EAAE,SAAS,OAA4C,EAAvC,KAAK,cAArB,aAAuB,CAAF;IAC1C,OAAO,KAAC,OAAO,kBAAC,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,IAAM,KAAK,EAAI,CAAC;AACxE,CAAC;AAED,SAAS,UAAU,CAAC,EAAgD;QAAhD,EAAE,SAAS,OAAqC,EAAhC,KAAK,cAArB,aAAuB,CAAF;IACxC,OAAO,8BAAO,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,IAAM,KAAK,EAAI,CAAC;AACpE,CAAC;AAED,SAAS,gBAAgB,CAAC,EAA8C;QAA9C,EAAE,SAAS,OAAmC,EAA9B,KAAK,cAArB,aAAuB,CAAF;IAC9C,OAAO,CACN,4BACC,SAAS,EAAE,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,IACtD,KAAK,EACR,CACF,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE;IAC7C,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE,gBAAgB;IAC7B,OAAO,EAAE,YAAY;CACrB,CAAC,CAAC"}
@@ -0,0 +1,51 @@
1
+ .root {
2
+ display: grid;
3
+ grid-template-areas: 'label' 'control' 'description';
4
+ justify-content: start;
5
+
6
+ &[data-horizontal] {
7
+ flex-direction: row;
8
+ align-items: center;
9
+ grid-template-areas: 'control label' 'description description';
10
+ grid-template-columns: auto 1fr;
11
+ }
12
+
13
+ &[data-stretch] {
14
+ align-self: stretch;
15
+ justify-content: stretch;
16
+ }
17
+ }
18
+
19
+ .control {
20
+ grid-area: control;
21
+ }
22
+ :where(.control) {
23
+ display: flex;
24
+ flex-direction: column;
25
+ align-items: center;
26
+ gap: var(--m-space-sm);
27
+ }
28
+
29
+ .label {
30
+ grid-area: label;
31
+ @apply --mx-prose-ambient;
32
+ @apply --mx-fg(var(--m-color-neutral-heavy));
33
+ font-weight: var(--m-text-weight-bold);
34
+ margin-bottom: var(--m-space-xs);
35
+ margin-left: calc(var(--m-global-shape-roundness) * var(--m-space-md));
36
+
37
+ [data-horizontal] & {
38
+ @apply --mx-fg(var(--m-color-neutral-ink));
39
+ font-weight: var(--m-text-weight-normal);
40
+ margin-block-start: --fn-literal(5px);
41
+ }
42
+ }
43
+
44
+ .description {
45
+ grid-area: description;
46
+ @apply --mx-prose-ambient;
47
+ @apply --mx-fg(var(--m-color-neutral-heavy));
48
+ font-style: italic;
49
+ margin-top: var(--m-space-sm);
50
+ margin-left: calc(var(--m-global-shape-roundness) * var(--m-space-md));
51
+ }
@@ -2,5 +2,5 @@
2
2
  display: flex;
3
3
  align-items: start;
4
4
  flex-direction: column;
5
- gap: var(--m-space-md);
5
+ gap: var(--m-space-lg);
6
6
  }
@@ -11,13 +11,13 @@ export interface FormikFormProps<T extends FormikValues = FormikValues> extends
11
11
  export { FieldArray } from 'formik';
12
12
  export declare function FormikFormRoot<Values extends FormikValues>({ className, children, onSubmit, ...props }: FormikFormProps<Values>): import("react/jsx-runtime").JSX.Element;
13
13
  export declare const FormikForm: typeof FormikFormRoot & {
14
- TextField: ({ ref, name, label, className, autoFocusDelay, autoFocus, inputRef, onChange, onFocus, onBlur, id: providedId, inputClassName, ...rest }: import("./TextField.js").TextFieldProps) => import("react/jsx-runtime").JSX.Element;
14
+ TextField: ({ ref, name, label, className, autoFocusDelay, autoFocus, inputRef, onChange, onFocus, onBlur, id: providedId, inputClassName, description, ...rest }: import("./TextField.js").TextFieldProps) => import("react/jsx-runtime").JSX.Element;
15
15
  TextAreaField: typeof TextAreaField;
16
16
  NumberStepperField: typeof NumberStepperField;
17
17
  SubmitButton: typeof SubmitButton;
18
18
  CheckboxField: typeof CheckboxField;
19
19
  SwitchField: typeof SwitchField;
20
- ToggleGroupField: (({ name, label, required, className, type, multiple, id, ...props }: import("./ToggleGroupField.js").ToggleGroupFieldProps<string>) => import("react/jsx-runtime").JSX.Element) & {
20
+ ToggleGroupField: (({ name, label, required, className, type, multiple, description, id, ...props }: import("./ToggleGroupField.js").ToggleGroupFieldProps<string>) => import("react/jsx-runtime").JSX.Element) & {
21
21
  Item: import("react").FunctionComponent<import("@base-ui/react").Toggle.Props<string> & import("react").RefAttributes<HTMLButtonElement>>;
22
22
  };
23
23
  EmojiField: typeof EmojiField;
@@ -8,13 +8,13 @@ import { SwitchField } from './SwitchField.js';
8
8
  declare const meta: {
9
9
  title: string;
10
10
  component: typeof import("./FormikForm.js").FormikFormRoot & {
11
- TextField: ({ ref, name, label, className, autoFocusDelay, autoFocus, inputRef, onChange, onFocus, onBlur, id: providedId, inputClassName, ...rest }: import("./TextField.js").TextFieldProps) => import("react/jsx-runtime").JSX.Element;
11
+ TextField: ({ ref, name, label, className, autoFocusDelay, autoFocus, inputRef, onChange, onFocus, onBlur, id: providedId, inputClassName, description, ...rest }: import("./TextField.js").TextFieldProps) => import("react/jsx-runtime").JSX.Element;
12
12
  TextAreaField: typeof import("./TextField.js").TextAreaField;
13
13
  NumberStepperField: typeof NumberStepperField;
14
14
  SubmitButton: typeof SubmitButton;
15
15
  CheckboxField: typeof CheckboxField;
16
16
  SwitchField: typeof SwitchField;
17
- ToggleGroupField: (({ name, label, required, className, type, multiple, id, ...props }: import("./ToggleGroupField.js").ToggleGroupFieldProps<string>) => import("react/jsx-runtime").JSX.Element) & {
17
+ ToggleGroupField: (({ name, label, required, className, type, multiple, description, id, ...props }: import("./ToggleGroupField.js").ToggleGroupFieldProps<string>) => import("react/jsx-runtime").JSX.Element) & {
18
18
  Item: import("react").FunctionComponent<import("@base-ui/react").Toggle.Props<string> & import("react").RefAttributes<HTMLButtonElement>>;
19
19
  };
20
20
  EmojiField: typeof EmojiField;
@@ -43,7 +43,7 @@ export const Default = {
43
43
  newsletter: false,
44
44
  plan: 'basic',
45
45
  emoji: '',
46
- } }, args, { children: [_jsx(TextField, { name: "email", type: "email", label: "Email", placeholder: "you@example.com" }), _jsx(TextField, { name: "password", type: "password", label: "Password" }), _jsx(NumberStepperField, { name: "age", label: "Age", min: 13, max: 100 }), _jsx(CheckboxField, { name: "tos", label: "I agree" }), _jsx(SwitchField, { name: "newsletter", label: "Subscribe to newsletter" }), _jsxs(ToggleGroupField, { type: "single", name: "plan", label: "Select your plan", required: true, children: [_jsx(ToggleGroupField.Item, { value: "basic", children: "Basic" }), _jsx(ToggleGroupField.Item, { value: "pro", children: "Pro" }), _jsx(ToggleGroupField.Item, { value: "enterprise", children: "Enterprise" })] }), _jsx(EmojiField, { name: "emoji", label: "Favorite Emoji" }), _jsx(SubmitButton, { children: "Sign up" })] })));
46
+ } }, args, { children: [_jsx(TextField, { name: "email", type: "email", label: "Email", placeholder: "you@example.com" }), _jsx(TextField, { name: "password", type: "password", label: "Password", description: "Make it a good one" }), _jsx(NumberStepperField, { name: "age", label: "Age", min: 13, max: 100, description: "You can mail your government ID to us, don't worry, we're the good guys" }), _jsx(CheckboxField, { name: "tos", label: "I agree", description: "To what? Not telling." }), _jsx(SwitchField, { name: "newsletter", label: "Subscribe to newsletter", description: "Don't worry, we don't bother you much" }), _jsxs(ToggleGroupField, { type: "single", name: "plan", label: "Select your plan", required: true, description: "Please do the expensive one!!!", children: [_jsx(ToggleGroupField.Item, { value: "basic", children: "Basic" }), _jsx(ToggleGroupField.Item, { value: "pro", children: "Pro" }), _jsx(ToggleGroupField.Item, { value: "enterprise", className: "@mode-accent", children: "Enterprise" })] }), _jsx(EmojiField, { name: "emoji", label: "Favorite Emoji" }), _jsx(SubmitButton, { children: "Sign up" })] })));
47
47
  },
48
48
  };
49
49
  //# sourceMappingURL=FormikForm.stories.js.map
@@ -1 +1 @@
1
- {"version":3,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AE;aACT,IACG,IAAI,eAER,KAAC,SAAS,IACT,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,OAAO,EACZ,KAAK,EAAC,OAAO,EACb,WAAW,EAAC,iBAAiB,GAC5B,EACF,KAAC,SAAS,IAAC,IAAI,EAAC,UAAU,EAAC,IAAI,EAAC,UAAU,EAAC,KAAK,EAAC,UAAU,GAAG,EAC9D,KAAC,kBAAkB,IAAC,IAAI,EAAC,KAAK,EAAC,KAAK,EAAC,KAAK,EAAC,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,GAAI,EAChE,KAAC,aAAa,IAAC,IAAI,EAAC,KAAK,EAAC,KAAK,EAAC,SAAS,GAAG,EAC5C,KAAC,WAAW,IAAC,IAAI,EAAC,YAAY,EAAC,KAAK,EAAC,yBAAyB,GAAG,EACjE,MAAC,gBAAgB,IAChB,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,kBAAkB,EACxB,QAAQ,mBAER,KAAC,gBAAgB,CAAC,IAAI,IAAC,KAAK,EAAC,OAAO,sBAA8B,EAClE,KAAC,gBAAgB,CAAC,IAAI,IAAC,KAAK,EAAC,KAAK,oBAA4B,EAC9D,KAAC,gBAAgB,CAAC,IAAI,IAAC,KAAK,EAAC,YAAY,2BAEjB,IACN,EACnB,KAAC,UAAU,IAAC,IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,gBAAgB,GAAG,EAClD,KAAC,YAAY,0BAAuB,KACxB,CACb,CAAC;IACH,CAAC;CACD,CAAC"}
1
+ {"version":3,"file":"FormikForm.stories.js","sourceRoot":"","sources":["../../../src/components/forms/FormikForm.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,kBA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KAAC,kBAAkB,IAClB,IAAI,EAAC,KAAK,EACV,KAAK,EAAC,KAAK,EACX,GAAG,EAAE,EAAE,EACP,GAAG,EAAE,GAAG,EACR,WAAW,EAAC,yEAAyE,GACpF,EACF,KAAC,aAAa,IACb,IAAI,EAAC,KAAK,EACV,KAAK,EAAC,SAAS,EACf,WAAW,EAAC,uBAAuB,GAClC,EACF,KAAC,WAAW,IACX,IAAI,EAAC,YAAY,EACjB,KAAK,EAAC,yBAAyB,EAC/B,WAAW,EAAC,uCAAuC,GAClD,EACF,MAAC,gBAAgB,IAChB,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,kBAAkB,EACxB,QAAQ,QACR,WAAW,EAAC,gCAAgC,aAE5C,KAAC,gBAAgB,CAAC,IAAI,IAAC,KAAK,EAAC,OAAO,sBAA8B,EAClE,KAAC,gBAAgB,CAAC,IAAI,IAAC,KAAK,EAAC,KAAK,oBAA4B,EAC9D,KAAC,gBAAgB,CAAC,IAAI,IAAC,KAAK,EAAC,YAAY,EAAC,SAAS,EAAC,cAAc,2BAE1C,IACN,EACnB,KAAC,UAAU,IAAC,IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,gBAAgB,GAAG,EAClD,KAAC,YAAY,0BAAuB,KACxB,CACb,CAAC;IACH,CAAC;CACD,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { ReactNode } from 'react';
1
2
  import { NumberStepperProps } from '../numberStepper/NumberStepper.js';
2
3
  export interface NumberStepperFieldProps extends Omit<NumberStepperProps, 'value' | 'onChange'> {
3
4
  name: string;
@@ -5,5 +6,6 @@ export interface NumberStepperFieldProps extends Omit<NumberStepperProps, 'value
5
6
  className?: string;
6
7
  id?: string;
7
8
  onChange?: (value: number) => void;
9
+ description?: ReactNode;
8
10
  }
9
- export declare function NumberStepperField({ name, label, className, id: providedId, onChange, ...rest }: NumberStepperFieldProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function NumberStepperField({ name, label, className, id: providedId, onChange, description, ...rest }: NumberStepperFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -11,19 +11,16 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useField } from 'formik';
14
- import { withClassName } from '../../hooks.js';
15
14
  import { useIdOrGenerated } from '../../hooks/useIdOrGenerated.js';
16
15
  import { NumberStepper, } from '../numberStepper/NumberStepper.js';
17
- import { FieldLabel } from './FieldLabel.js';
18
- import cls from './NumberStepperField.module.css';
16
+ import { Field } from './Field.js';
19
17
  export function NumberStepperField(_a) {
20
- var { name, label, className, id: providedId, onChange } = _a, rest = __rest(_a, ["name", "label", "className", "id", "onChange"]);
18
+ var { name, label, className, id: providedId, onChange, description } = _a, rest = __rest(_a, ["name", "label", "className", "id", "onChange", "description"]);
21
19
  const [_, field, tools] = useField({ name });
22
20
  const id = useIdOrGenerated(providedId);
23
- return (_jsxs(FieldRoot, { className: className, children: [label && _jsx(FieldLabel, { htmlFor: id, children: label }), _jsx(NumberStepper, Object.assign({ value: field.value, onChange: (v) => {
24
- tools.setValue(v);
25
- onChange === null || onChange === void 0 ? void 0 : onChange(v);
26
- }, id: id }, rest))] }));
21
+ return (_jsxs(Field, { className: className, horizontal: true, children: [label && _jsx(Field.Label, { htmlFor: id, children: label }), _jsx(Field.Control, { children: _jsx(NumberStepper, Object.assign({ value: field.value, onChange: (v) => {
22
+ tools.setValue(v);
23
+ onChange === null || onChange === void 0 ? void 0 : onChange(v);
24
+ }, id: id, "aria-describedby": description ? `${id}-description` : undefined }, rest)) }), description && (_jsx(Field.Description, { id: `${id}-description`, children: description }))] }));
27
25
  }
28
- const FieldRoot = withClassName('div', cls.root);
29
26
  //# sourceMappingURL=NumberStepperField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NumberStepperField.js","sourceRoot":"","sources":["../../../src/components/forms/NumberStepperField.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OA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label?: string;
4
5
  required?: boolean;
5
6
  className?: string;
6
7
  id?: string;
8
+ description?: ReactNode;
7
9
  }
8
- export declare function SwitchField({ name, label, className, required, id: providedId, ...rest }: SwitchFieldProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function SwitchField({ name, label, className, required, id: providedId, description, ...rest }: SwitchFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -12,15 +12,14 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useField } from 'formik';
14
14
  import { useIdOrGenerated } from '../../hooks/useIdOrGenerated.js';
15
- import { Box } from '../box/Box.js';
16
15
  import { Switch } from '../switch/Switch.js';
17
- import { HorizontalFieldLabel } from './FieldLabel.js';
16
+ import { Field } from './Field.js';
18
17
  export function SwitchField(_a) {
19
- var { name, label, className, required, id: providedId } = _a, rest = __rest(_a, ["name", "label", "className", "required", "id"]);
18
+ var { name, label, className, required, id: providedId, description } = _a, rest = __rest(_a, ["name", "label", "className", "required", "id", "description"]);
20
19
  const [props, _, tools] = useField({ name, required, type: 'checkbox' });
21
20
  const id = useIdOrGenerated(providedId);
22
- return (_jsxs(Box, { gap: "md", className: className, children: [_jsx(Switch, Object.assign({}, props, { checked: props.checked, onCheckedChange: (v) => {
23
- tools.setValue(!!v);
24
- }, id: id }, rest)), label && (_jsx(HorizontalFieldLabel, { htmlFor: id, children: label }))] }));
21
+ return (_jsxs(Field, { horizontal: true, className: className, children: [_jsx(Field.Control, { children: _jsx(Switch, Object.assign({}, props, { checked: props.checked, onCheckedChange: (v) => {
22
+ tools.setValue(!!v);
23
+ }, id: id, "aria-describedby": description ? `${id}-description` : undefined }, rest)) }), label && _jsx(Field.Label, { htmlFor: id, children: label }), description && (_jsx(Field.Description, { id: `${id}-description`, children: description }))] }));
25
24
  }
26
25
  //# sourceMappingURL=SwitchField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SwitchField.js","sourceRoot":"","sources":["../../../src/components/forms/SwitchField.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAUvD,MAAM,UAAU,WAAW,CAAC,EAOT;QAPS,EAC3B,IAAI,EACJ,KAAK,EACL,SAAS,EACT,QAAQ,EACR,EAAE,EAAE,UAAU,OAEI,EADf,IAAI,cANoB,gDAO3B,CADO;IAEP,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;IACzE,MAAM,EAAE,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACxC,OAAO,CACN,MAAC,GAAG,IAAC,GAAG,EAAC,IAAI,EAAC,SAAS,EAAE,SAAS,aACjC,KAAC,MAAM,oBACF,KAAK,IACT,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,eAAe,EAAE,CAAC,CAAC,EAAE,EAAE;oBACtB,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACrB,CAAC,EACD,EAAE,EAAE,EAAE,IACF,IAAI,EACP,EACD,KAAK,IAAI,CACT,KAAC,oBAAoB,IAAC,OAAO,EAAE,EAAE,YAAG,KAAK,GAAwB,CACjE,IACI,CACN,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"SwitchField.js","sourceRoot":"","sources":["../../../src/components/forms/SwitchField.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAWnC,MAAM,UAAU,WAAW,CAAC,EAQT;QARS,EAC3B,IAAI,EACJ,KAAK,EACL,SAAS,EACT,QAAQ,EACR,EAAE,EAAE,UAAU,EACd,WAAW,OAEO,EADf,IAAI,cAPoB,+DAQ3B,CADO;IAEP,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;IACzE,MAAM,EAAE,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACxC,OAAO,CACN,MAAC,KAAK,IAAC,UAAU,QAAC,SAAS,EAAE,SAAS,aACrC,KAAC,KAAK,CAAC,OAAO,cACb,KAAC,MAAM,oBACF,KAAK,IACT,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,eAAe,EAAE,CAAC,CAAC,EAAE,EAAE;wBACtB,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBACrB,CAAC,EACD,EAAE,EAAE,EAAE,sBACY,WAAW,CAAC,CAAC,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC,SAAS,IAC3D,IAAI,EACP,GACa,EACf,KAAK,IAAI,KAAC,KAAK,CAAC,KAAK,IAAC,OAAO,EAAE,EAAE,YAAG,KAAK,GAAe,EACxD,WAAW,IAAI,CACf,KAAC,KAAK,CAAC,WAAW,IAAC,EAAE,EAAE,GAAG,EAAE,cAAc,YACxC,WAAW,GACO,CACpB,IACM,CACR,CAAC;AACH,CAAC"}
@@ -1,4 +1,4 @@
1
- import { InputHTMLAttributes, Ref } from 'react';
1
+ import { InputHTMLAttributes, ReactNode, Ref } from 'react';
2
2
  import { InputProps } from '../input/Input.js';
3
3
  import { TextAreaProps } from '../textArea/TextArea.js';
4
4
  export type TextFieldProps = {
@@ -9,8 +9,9 @@ export type TextFieldProps = {
9
9
  inputRef?: Ref<HTMLInputElement>;
10
10
  inputClassName?: string;
11
11
  ref?: Ref<HTMLDivElement>;
12
+ description?: ReactNode;
12
13
  } & Omit<InputProps, 'ref'>;
13
- export declare const TextField: ({ ref, name, label, className, autoFocusDelay, autoFocus, inputRef, onChange, onFocus, onBlur, id: providedId, inputClassName, ...rest }: TextFieldProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const TextField: ({ ref, name, label, className, autoFocusDelay, autoFocus, inputRef, onChange, onFocus, onBlur, id: providedId, inputClassName, description, ...rest }: TextFieldProps) => import("react/jsx-runtime").JSX.Element;
14
15
  export type TextAreaFieldProps = {
15
16
  name: string;
16
17
  label?: string;
@@ -21,6 +22,7 @@ export type TextAreaFieldProps = {
21
22
  inputRef?: Ref<HTMLTextAreaElement>;
22
23
  submitOnEnter?: boolean;
23
24
  textAreaClassName?: string;
24
- } & TextAreaProps;
25
- export declare function TextAreaField({ name, label, className, inputRef, onKeyDown, submitOnEnter, id: providedId, textAreaClassName, ...rest }: TextAreaFieldProps): import("react/jsx-runtime").JSX.Element;
26
- export declare const FieldRoot: import("react").FunctionComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
25
+ description?: ReactNode;
26
+ ref?: Ref<HTMLDivElement>;
27
+ } & Omit<TextAreaProps, 'ref'>;
28
+ export declare function TextAreaField({ name, label, className, inputRef, onKeyDown, submitOnEnter, id: providedId, textAreaClassName, description, ref, ...rest }: TextAreaFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -13,16 +13,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import clsx from 'clsx';
14
14
  import { useField, useFormikContext } from 'formik';
15
15
  import { useCallback, useEffect, useRef, } from 'react';
16
- import { withClassName } from '../../hooks.js';
17
16
  import { useIdOrGenerated } from '../../hooks/useIdOrGenerated.js';
18
17
  import useMergedRef from '../../hooks/useMergedRef.js';
19
18
  import { Input } from '../input/Input.js';
20
19
  import { TextArea } from '../textArea/TextArea.js';
21
- import { FieldLabel } from './FieldLabel.js';
20
+ import { Field } from './Field.js';
22
21
  import cls from './TextField.module.css';
23
22
  const emptyRef = (() => { });
24
23
  export const TextField = function TextField(_a) {
25
- var { ref, name, label, className, autoFocusDelay, autoFocus, inputRef, onChange, onFocus, onBlur, id: providedId, inputClassName } = _a, rest = __rest(_a, ["ref", "name", "label", "className", "autoFocusDelay", "autoFocus", "inputRef", "onChange", "onFocus", "onBlur", "id", "inputClassName"]);
24
+ var { ref, name, label, className, autoFocusDelay, autoFocus, inputRef, onChange, onFocus, onBlur, id: providedId, inputClassName, description } = _a, rest = __rest(_a, ["ref", "name", "label", "className", "autoFocusDelay", "autoFocus", "inputRef", "onChange", "onFocus", "onBlur", "id", "inputClassName", "description"]);
26
25
  const [props] = useField({
27
26
  name,
28
27
  onChange,
@@ -39,10 +38,10 @@ export const TextField = function TextField(_a) {
39
38
  }, autoFocusDelay);
40
39
  }
41
40
  }, [autoFocusDelay]);
42
- return (_jsxs(FieldRoot, { className: className, ref: ref, children: [label && _jsx(FieldLabel, { htmlFor: id, children: label }), _jsx(Input, Object.assign({}, props, rest, { id: id, autoFocus: autoFocus, className: clsx(cls.input, inputClassName), ref: useMergedRef(innerInputRef, inputRef || emptyRef) }))] }));
41
+ return (_jsxs(Field, { className: className, stretch: true, ref: ref, children: [label && _jsx(Field.Label, { htmlFor: id, children: label }), _jsx(Field.Control, { render: _jsx(Input, Object.assign({}, props, rest, { id: id, autoFocus: autoFocus, className: clsx(cls.input, inputClassName), ref: useMergedRef(innerInputRef, inputRef || emptyRef), "aria-describedby": description ? `${id}-description` : undefined })) }), description && (_jsx(Field.Description, { id: `${id}-description`, children: description }))] }));
43
42
  };
44
43
  export function TextAreaField(_a) {
45
- var { name, label, className, inputRef, onKeyDown, submitOnEnter, id: providedId, textAreaClassName } = _a, rest = __rest(_a, ["name", "label", "className", "inputRef", "onKeyDown", "submitOnEnter", "id", "textAreaClassName"]);
44
+ var { name, label, className, inputRef, onKeyDown, submitOnEnter, id: providedId, textAreaClassName, description, ref } = _a, rest = __rest(_a, ["name", "label", "className", "inputRef", "onKeyDown", "submitOnEnter", "id", "textAreaClassName", "description", "ref"]);
46
45
  const [props] = useField(name);
47
46
  const { submitForm } = useFormikContext();
48
47
  const onKeyDownInner = useCallback((e) => {
@@ -53,7 +52,6 @@ export function TextAreaField(_a) {
53
52
  onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
54
53
  }, [submitOnEnter, onKeyDown, submitForm]);
55
54
  const id = useIdOrGenerated(providedId);
56
- return (_jsxs(FieldRoot, { className: className, children: [label && _jsx(FieldLabel, { htmlFor: id, children: label }), _jsx(TextArea, Object.assign({ ref: inputRef }, props, rest, { className: clsx('layer-composed:w-full', textAreaClassName), id: id, onKeyDown: onKeyDownInner }))] }));
55
+ return (_jsxs(Field, { stretch: true, className: className, ref: ref, children: [label && _jsx(Field.Label, { htmlFor: id, children: label }), _jsx(Field.Control, { render: _jsx(TextArea, Object.assign({ ref: inputRef }, props, rest, { className: clsx(cls.input, textAreaClassName), id: id, onKeyDown: onKeyDownInner, "aria-describedby": description ? `${id}-description` : undefined })) }), description && (_jsx(Field.Description, { id: `${id}-description`, children: description }))] }));
57
56
  }
58
- export const FieldRoot = withClassName('div', cls.root);
59
57
  //# sourceMappingURL=TextField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.js","sourceRoot":"","sources":["../../../src/components/forms/TextField.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAIN,WAAW,EACX,SAAS,EACT,MAAM,GACN,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,aAAa,EAAE,MAAM,gB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type ToggleGroupFieldProps<Value extends string> = ToggleGroupProps<Value> & {
3
4
  name: string;
@@ -6,8 +7,9 @@ export type ToggleGroupFieldProps<Value extends string> = ToggleGroupProps<Value
6
7
  className?: string;
7
8
  id?: string;
8
9
  type?: 'single' | 'multiple';
10
+ description?: ReactNode;
9
11
  };
10
- declare function ToggleGroupFieldDefault({ name, label, required, className, type, multiple, id, ...props }: ToggleGroupFieldProps<string>): import("react/jsx-runtime").JSX.Element;
12
+ declare function ToggleGroupFieldDefault({ name, label, required, className, type, multiple, description, id, ...props }: ToggleGroupFieldProps<string>): import("react/jsx-runtime").JSX.Element;
11
13
  export declare const ToggleGroupField: typeof ToggleGroupFieldDefault & {
12
14
  Item: import("react").FunctionComponent<import("@base-ui/react").Toggle.Props<string> & import("react").RefAttributes<HTMLButtonElement>>;
13
15
  };
@@ -12,19 +12,18 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useField } from 'formik';
14
14
  import { ToggleGroup } from '../toggleGroup/toggleGroup.js';
15
- import { FieldLabel } from './FieldLabel.js';
16
- import { FieldRoot } from './TextField.js';
15
+ import { Field } from './Field.js';
17
16
  function ToggleGroupFieldDefault(_a) {
18
- var { name, label, required, className, type = 'single', multiple, id } = _a, props = __rest(_a, ["name", "label", "required", "className", "type", "multiple", "id"]);
17
+ var { name, label, required, className, type = 'single', multiple, description, id } = _a, props = __rest(_a, ["name", "label", "required", "className", "type", "multiple", "description", "id"]);
19
18
  const [fieldProps, _, tools] = useField(Object.assign({ name, required }, props));
20
- return (_jsxs(FieldRoot, { children: [label && _jsx(FieldLabel, { htmlFor: id, children: label }), _jsx(ToggleGroup, Object.assign({}, fieldProps, { onValueChange: (v) => {
21
- if (multiple || type === 'multiple') {
22
- tools.setValue(v);
23
- }
24
- else {
25
- tools.setValue(v[0]);
26
- }
27
- }, multiple: multiple || type === 'multiple' }, props, { id: id, className: className }))] }));
19
+ return (_jsxs(Field, { children: [label && _jsx(Field.Label, { htmlFor: id, children: label }), _jsx(Field.Control, { children: _jsx(ToggleGroup, Object.assign({}, fieldProps, { onValueChange: (v) => {
20
+ if (multiple || type === 'multiple') {
21
+ tools.setValue(v);
22
+ }
23
+ else {
24
+ tools.setValue(v[0]);
25
+ }
26
+ }, multiple: multiple || type === 'multiple' }, props, { id: id, className: className, "aria-describedby": description ? `${id}-description` : undefined })) }), description && (_jsx(Field.Description, { id: `${id}-description`, children: description }))] }));
28
27
  }
29
28
  export const ToggleGroupField = Object.assign(ToggleGroupFieldDefault, {
30
29
  Item: ToggleGroup.Item,
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleGroupField.js","sourceRoot":"","sources":["../../../src/components/forms/ToggleGroupField.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,WAAW,EAAoB,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAY3C,SAAS,uBAAuB,CAAC,EASD;QATC,EAChC,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,SAAS,EACT,IAAI,GAAG,QAAQ,EACf,QAAQ,EACR,EAAE,OAE6B,EAD5B,KAAK,cARwB,oEAShC,CADQ;IAER,MAAM,CAAC,UAAU,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,QAAQ,iBAAG,IAAI,EAAE,QAAQ,IAAK,KAAK,EAAG,CAAC;IAEtE,OAAO,CACN,MAAC,SAAS,eACR,KAAK,IAAI,KAAC,UAAU,IAAC,OAAO,EAAE,EAAE,YAAG,KAAK,GAAc,EACvD,KAAC,WAAW,oBACP,UAAU,IACd,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE;oBACpB,IAAI,QAAQ,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;wBACrC,KAAK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AAK,UAAU,EAAE,CAAC;4BACrC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;wBACnB,CAAC;6BAAM,CAAC;4BACP,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;wBACtB,CAAC;oBACF,CAAC,EACD,QAAQ,EAAE,QAAQ,IAAI,IAAI,KAAK,UAAU,IACrC,KAAK,IACT,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,SAAS,sBACF,WAAW,CAAC,CAAC,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC,SAAS,IAC9D,GACa,EACf,WAAW,IAAI,CACf,KAAC,KAAK,CAAC,WAAW,IAAC,EAAE,EAAE,GAAG,EAAE,cAAc,YACxC,WAAW,GACO,CACpB,IACM,CACR,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,uBAAuB,EAAE;IACtE,IAAI,EAAE,WAAW,CAAC,IAAI;CACtB,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export * from './CheckboxField.js';
2
- export * from './FieldLabel.js';
2
+ export * from './Field.js';
3
3
  export * from './Form.js';
4
4
  export * from './FormikForm.js';
5
5
  export * from './hooks.js';
@@ -1,5 +1,5 @@
1
1
  export * from './CheckboxField.js';
2
- export * from './FieldLabel.js';
2
+ export * from './Field.js';
3
3
  export * from './Form.js';
4
4
  export * from './FormikForm.js';
5
5
  export * from './hooks.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/forms/index.tsx"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/forms/index.tsx"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
@@ -15,7 +15,7 @@
15
15
  --mx-shadow-value: inset var(--m-shadow-sm);
16
16
 
17
17
  @apply --mx-bg(var(--m-control-bg));
18
- @apply --mx-borderColor(var(--m-control-border));
18
+ @apply --mx-borderColor(var(--m-control-borderColor));
19
19
  border-radius: var(--m-radius-lg);
20
20
 
21
21
  &[data-checked] {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a-type/ui",
3
- "version": "6.0.22",
3
+ "version": "6.0.23",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "url": "https://github.com/a-type/ui"