@baseplate-dev/ui-components 0.6.2 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/LICENSE +114 -123
- package/dist/base-styles.css +5 -4
- package/dist/components/ui/async-combobox-field/async-combobox-field.d.ts +7 -5
- package/dist/components/ui/async-combobox-field/async-combobox-field.d.ts.map +1 -1
- package/dist/components/ui/async-combobox-field/async-combobox-field.js +142 -135
- package/dist/components/ui/async-combobox-field/async-combobox-field.js.map +1 -1
- package/dist/components/ui/async-combobox-field/async-combobox-field.unit.test.d.ts +2 -0
- package/dist/components/ui/async-combobox-field/async-combobox-field.unit.test.d.ts.map +1 -0
- package/dist/components/ui/async-combobox-field/async-combobox-field.unit.test.js +147 -0
- package/dist/components/ui/async-combobox-field/async-combobox-field.unit.test.js.map +1 -0
- package/dist/components/ui/autocomplete/autocomplete.d.ts +32 -0
- package/dist/components/ui/autocomplete/autocomplete.d.ts.map +1 -0
- package/dist/components/ui/autocomplete/autocomplete.js +59 -0
- package/dist/components/ui/autocomplete/autocomplete.js.map +1 -0
- package/dist/components/ui/badge/badge.d.ts +4 -11
- package/dist/components/ui/badge/badge.d.ts.map +1 -1
- package/dist/components/ui/badge/badge.js +22 -16
- package/dist/components/ui/badge/badge.js.map +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb.d.ts +8 -4
- package/dist/components/ui/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb.js +24 -9
- package/dist/components/ui/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/ui/button/button.d.ts +5 -5
- package/dist/components/ui/button/button.d.ts.map +1 -1
- package/dist/components/ui/button/button.js +4 -5
- package/dist/components/ui/button/button.js.map +1 -1
- package/dist/components/ui/checkbox/checkbox.d.ts +2 -3
- package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +2 -2
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/checkbox-field/checkbox-field.d.ts +2 -2
- package/dist/components/ui/checkbox-field/checkbox-field.d.ts.map +1 -1
- package/dist/components/ui/checkbox-field/checkbox-field.js +8 -5
- package/dist/components/ui/checkbox-field/checkbox-field.js.map +1 -1
- package/dist/components/ui/code-editor-field/code-editor-field.d.ts.map +1 -1
- package/dist/components/ui/code-editor-field/code-editor-field.js +7 -7
- package/dist/components/ui/code-editor-field/code-editor-field.js.map +1 -1
- package/dist/components/ui/collapsible/collapsible.d.ts +4 -5
- package/dist/components/ui/collapsible/collapsible.d.ts.map +1 -1
- package/dist/components/ui/collapsible/collapsible.js +3 -4
- package/dist/components/ui/collapsible/collapsible.js.map +1 -1
- package/dist/components/ui/color-picker-field/color-picker-field.d.ts.map +1 -1
- package/dist/components/ui/color-picker-field/color-picker-field.js +9 -9
- package/dist/components/ui/color-picker-field/color-picker-field.js.map +1 -1
- package/dist/components/ui/combobox/combobox.d.ts +31 -69
- package/dist/components/ui/combobox/combobox.d.ts.map +1 -1
- package/dist/components/ui/combobox/combobox.js +62 -167
- package/dist/components/ui/combobox/combobox.js.map +1 -1
- package/dist/components/ui/combobox-field/combobox-field.d.ts +8 -3
- package/dist/components/ui/combobox-field/combobox-field.d.ts.map +1 -1
- package/dist/components/ui/combobox-field/combobox-field.js +15 -23
- package/dist/components/ui/combobox-field/combobox-field.js.map +1 -1
- package/dist/components/ui/date-picker-field/date-picker-field.d.ts.map +1 -1
- package/dist/components/ui/date-picker-field/date-picker-field.js +3 -3
- package/dist/components/ui/date-picker-field/date-picker-field.js.map +1 -1
- package/dist/components/ui/date-time-picker-field/date-time-picker-field.d.ts.map +1 -1
- package/dist/components/ui/date-time-picker-field/date-time-picker-field.js +3 -3
- package/dist/components/ui/date-time-picker-field/date-time-picker-field.js.map +1 -1
- package/dist/components/ui/dialog/dialog.d.ts +15 -13
- package/dist/components/ui/dialog/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog.js +12 -13
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/dropdown/dropdown.d.ts +24 -16
- package/dist/components/ui/dropdown/dropdown.d.ts.map +1 -1
- package/dist/components/ui/dropdown/dropdown.js +31 -27
- package/dist/components/ui/dropdown/dropdown.js.map +1 -1
- package/dist/components/ui/field/field.d.ts +34 -0
- package/dist/components/ui/field/field.d.ts.map +1 -0
- package/dist/components/ui/field/field.js +77 -0
- package/dist/components/ui/field/field.js.map +1 -0
- package/dist/components/ui/form-action-bar/form-action-bar.d.ts.map +1 -1
- package/dist/components/ui/form-action-bar/form-action-bar.js +1 -1
- package/dist/components/ui/form-action-bar/form-action-bar.js.map +1 -1
- package/dist/components/ui/form-item/form-item.d.ts +6 -4
- package/dist/components/ui/form-item/form-item.d.ts.map +1 -1
- package/dist/components/ui/form-item/form-item.js +17 -3
- package/dist/components/ui/form-item/form-item.js.map +1 -1
- package/dist/components/ui/index.d.ts +5 -3
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +5 -3
- package/dist/components/ui/index.js.map +1 -1
- package/dist/components/ui/input-field/input-field.d.ts.map +1 -1
- package/dist/components/ui/input-field/input-field.js +7 -5
- package/dist/components/ui/input-field/input-field.js.map +1 -1
- package/dist/components/ui/input-group/input-group.d.ts +26 -0
- package/dist/components/ui/input-group/input-group.d.ts.map +1 -0
- package/dist/components/ui/input-group/input-group.js +65 -0
- package/dist/components/ui/input-group/input-group.js.map +1 -0
- package/dist/components/ui/label/label.d.ts +1 -2
- package/dist/components/ui/label/label.d.ts.map +1 -1
- package/dist/components/ui/label/label.js +3 -2
- package/dist/components/ui/label/label.js.map +1 -1
- package/dist/components/ui/multi-combobox-field/multi-combobox-field.d.ts +2 -2
- package/dist/components/ui/multi-combobox-field/multi-combobox-field.d.ts.map +1 -1
- package/dist/components/ui/multi-combobox-field/multi-combobox-field.js +23 -24
- package/dist/components/ui/multi-combobox-field/multi-combobox-field.js.map +1 -1
- package/dist/components/ui/multi-switch-field/multi-switch-field.js +3 -3
- package/dist/components/ui/multi-switch-field/multi-switch-field.js.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.d.ts +16 -15
- package/dist/components/ui/navigation-menu/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.js +17 -16
- package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/ui/navigation-tabs/navigation-tabs.d.ts +6 -3
- package/dist/components/ui/navigation-tabs/navigation-tabs.d.ts.map +1 -1
- package/dist/components/ui/navigation-tabs/navigation-tabs.js +16 -4
- package/dist/components/ui/navigation-tabs/navigation-tabs.js.map +1 -1
- package/dist/components/ui/popover/popover.d.ts +8 -10
- package/dist/components/ui/popover/popover.d.ts.map +1 -1
- package/dist/components/ui/popover/popover.js +12 -6
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/scroll-area/scroll-area.d.ts +3 -4
- package/dist/components/ui/scroll-area/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js +2 -4
- package/dist/components/ui/scroll-area/scroll-area.js.map +1 -1
- package/dist/components/ui/select/select.d.ts +12 -17
- package/dist/components/ui/select/select.d.ts.map +1 -1
- package/dist/components/ui/select/select.js +20 -30
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/select-field/select-field.d.ts +1 -0
- package/dist/components/ui/select-field/select-field.d.ts.map +1 -1
- package/dist/components/ui/select-field/select-field.js +6 -12
- package/dist/components/ui/select-field/select-field.js.map +1 -1
- package/dist/components/ui/separator/separator.d.ts +2 -3
- package/dist/components/ui/separator/separator.d.ts.map +1 -1
- package/dist/components/ui/separator/separator.js +3 -3
- package/dist/components/ui/separator/separator.js.map +1 -1
- package/dist/components/ui/sheet/sheet.d.ts +11 -11
- package/dist/components/ui/sheet/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet/sheet.js +7 -10
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/sidebar/sidebar.d.ts +6 -12
- package/dist/components/ui/sidebar/sidebar.d.ts.map +1 -1
- package/dist/components/ui/sidebar/sidebar.js +79 -28
- package/dist/components/ui/sidebar/sidebar.js.map +1 -1
- package/dist/components/ui/skeleton/skeleton.js +1 -1
- package/dist/components/ui/skeleton/skeleton.js.map +1 -1
- package/dist/components/ui/slider/slider.d.ts +13 -0
- package/dist/components/ui/slider/slider.d.ts.map +1 -0
- package/dist/components/ui/slider/slider.js +22 -0
- package/dist/components/ui/slider/slider.js.map +1 -0
- package/dist/components/ui/spinner/spinner.d.ts +10 -0
- package/dist/components/ui/spinner/spinner.d.ts.map +1 -0
- package/dist/components/ui/spinner/spinner.js +13 -0
- package/dist/components/ui/spinner/spinner.js.map +1 -0
- package/dist/components/ui/switch/switch.d.ts +7 -3
- package/dist/components/ui/switch/switch.d.ts.map +1 -1
- package/dist/components/ui/switch/switch.js +6 -3
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/switch-field/switch-field.d.ts +5 -3
- package/dist/components/ui/switch-field/switch-field.d.ts.map +1 -1
- package/dist/components/ui/switch-field/switch-field.js +7 -4
- package/dist/components/ui/switch-field/switch-field.js.map +1 -1
- package/dist/components/ui/tabs/tabs.d.ts +13 -7
- package/dist/components/ui/tabs/tabs.d.ts.map +1 -1
- package/dist/components/ui/tabs/tabs.js +23 -8
- package/dist/components/ui/tabs/tabs.js.map +1 -1
- package/dist/components/ui/textarea/textarea.js +1 -1
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/components/ui/textarea-field/textarea-field.d.ts.map +1 -1
- package/dist/components/ui/textarea-field/textarea-field.js +7 -5
- package/dist/components/ui/textarea-field/textarea-field.js.map +1 -1
- package/dist/components/ui/tooltip/tooltip.d.ts +10 -6
- package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip/tooltip.js +11 -6
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/constants/strings.d.ts +1 -0
- package/dist/constants/strings.d.ts.map +1 -1
- package/dist/constants/strings.js +1 -0
- package/dist/constants/strings.js.map +1 -1
- package/dist/contexts/component-strings.d.ts +1 -0
- package/dist/contexts/component-strings.d.ts.map +1 -1
- package/dist/hooks/use-event-callback.d.ts +2 -2
- package/dist/hooks/use-event-callback.d.ts.map +1 -1
- package/dist/hooks/use-event-callback.js +2 -1
- package/dist/hooks/use-event-callback.js.map +1 -1
- package/dist/styles/button.d.ts +1 -1
- package/dist/styles/button.d.ts.map +1 -1
- package/dist/styles/button.js +15 -11
- package/dist/styles/button.js.map +1 -1
- package/dist/styles/index.d.ts +0 -1
- package/dist/styles/index.d.ts.map +1 -1
- package/dist/styles/index.js +0 -1
- package/dist/styles/index.js.map +1 -1
- package/dist/theme.css +8 -0
- package/dist/utilities.css +100 -0
- package/package.json +10 -10
- package/dist/components/ui/color-picker/color-picker.d.ts +0 -16
- package/dist/components/ui/color-picker/color-picker.d.ts.map +0 -1
- package/dist/components/ui/color-picker/color-picker.js +0 -19
- package/dist/components/ui/color-picker/color-picker.js.map +0 -1
- package/dist/components/ui/combobox/combobox.test.d.ts +0 -2
- package/dist/components/ui/combobox/combobox.test.d.ts.map +0 -1
- package/dist/components/ui/combobox/combobox.test.js +0 -148
- package/dist/components/ui/combobox/combobox.test.js.map +0 -1
- package/dist/components/ui/command/command.d.ts +0 -22
- package/dist/components/ui/command/command.d.ts.map +0 -1
- package/dist/components/ui/command/command.js +0 -40
- package/dist/components/ui/command/command.js.map +0 -1
- package/dist/components/ui/multi-combobox/multi-combobox.d.ts +0 -47
- package/dist/components/ui/multi-combobox/multi-combobox.d.ts.map +0 -1
- package/dist/components/ui/multi-combobox/multi-combobox.js +0 -114
- package/dist/components/ui/multi-combobox/multi-combobox.js.map +0 -1
- package/dist/styles/select.d.ts +0 -9
- package/dist/styles/select.d.ts.map +0 -1
- package/dist/styles/select.js +0 -22
- package/dist/styles/select.js.map +0 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { cn } from '#src/utils/index.js';
|
|
6
|
+
import { Label } from '../label/label.js';
|
|
7
|
+
import { Separator } from '../separator/separator.js';
|
|
8
|
+
/**
|
|
9
|
+
* Field layout components for form fields with orientation support.
|
|
10
|
+
*
|
|
11
|
+
* ShadCN changes:
|
|
12
|
+
* - None
|
|
13
|
+
*
|
|
14
|
+
* https://ui.shadcn.com/docs/components/field
|
|
15
|
+
*/
|
|
16
|
+
function FieldSet({ className, ...props }) {
|
|
17
|
+
return (_jsx("fieldset", { "data-slot": "field-set", className: cn('flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3', className), ...props }));
|
|
18
|
+
}
|
|
19
|
+
function FieldLegend({ className, variant = 'legend', ...props }) {
|
|
20
|
+
return (_jsx("legend", { "data-slot": "field-legend", "data-variant": variant, className: cn('mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base', className), ...props }));
|
|
21
|
+
}
|
|
22
|
+
function FieldGroup({ className, ...props }) {
|
|
23
|
+
return (_jsx("div", { "data-slot": "field-group", className: cn('group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4', className), ...props }));
|
|
24
|
+
}
|
|
25
|
+
const fieldVariants = cva('group/field flex w-full gap-2 data-[invalid=true]:text-destructive', {
|
|
26
|
+
variants: {
|
|
27
|
+
orientation: {
|
|
28
|
+
vertical: 'flex-col *:w-full [&>.sr-only]:w-auto',
|
|
29
|
+
horizontal: 'flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',
|
|
30
|
+
responsive: 'flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
defaultVariants: {
|
|
34
|
+
orientation: 'vertical',
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
function Field({ className, orientation = 'vertical', ...props }) {
|
|
38
|
+
return (_jsx("div", { role: "group", "data-slot": "field", "data-orientation": orientation, className: cn(fieldVariants({ orientation }), className), ...props }));
|
|
39
|
+
}
|
|
40
|
+
function FieldContent({ className, ...props }) {
|
|
41
|
+
return (_jsx("div", { "data-slot": "field-content", className: cn('group/field-content flex flex-1 flex-col gap-0.5 leading-snug', className), ...props }));
|
|
42
|
+
}
|
|
43
|
+
function FieldLabel({ className, ...props }) {
|
|
44
|
+
return (_jsx(Label, { "data-slot": "field-label", className: cn('group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10', 'has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col', className), ...props }));
|
|
45
|
+
}
|
|
46
|
+
function FieldTitle({ className, ...props }) {
|
|
47
|
+
return (_jsx("div", { "data-slot": "field-label", className: cn('flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50', className), ...props }));
|
|
48
|
+
}
|
|
49
|
+
function FieldDescription({ className, ...props }) {
|
|
50
|
+
return (_jsx("p", { "data-slot": "field-description", className: cn('text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5', 'last:mt-0 nth-last-2:-mt-1', '[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary', className), ...props }));
|
|
51
|
+
}
|
|
52
|
+
function FieldSeparator({ children, className, ...props }) {
|
|
53
|
+
return (_jsxs("div", { "data-slot": "field-separator", "data-content": !!children, className: cn('relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2', className), ...props, children: [_jsx(Separator, { className: "absolute inset-0 top-1/2" }), children && (_jsx("span", { className: "relative mx-auto block w-fit bg-background px-2 text-muted-foreground", "data-slot": "field-separator-content", children: children }))] }));
|
|
54
|
+
}
|
|
55
|
+
function FieldError({ className, children, errors, ...props }) {
|
|
56
|
+
const content = React.useMemo(() => {
|
|
57
|
+
if (children) {
|
|
58
|
+
return children;
|
|
59
|
+
}
|
|
60
|
+
if (!errors?.length) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
const uniqueErrors = [
|
|
64
|
+
...new Map(errors.map((error) => [error?.message, error])).values(),
|
|
65
|
+
];
|
|
66
|
+
if (uniqueErrors.length === 1) {
|
|
67
|
+
return uniqueErrors[0]?.message;
|
|
68
|
+
}
|
|
69
|
+
return (_jsx("ul", { className: "ml-4 flex list-disc flex-col gap-1", children: uniqueErrors.map((error, index) => error?.message && _jsx("li", { children: error.message }, index)) }));
|
|
70
|
+
}, [children, errors]);
|
|
71
|
+
if (!content) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
return (_jsx("div", { role: "alert", "data-slot": "field-error", className: cn('text-sm font-normal text-destructive', className), ...props, children: content }));
|
|
75
|
+
}
|
|
76
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, fieldVariants, };
|
|
77
|
+
//# sourceMappingURL=field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field.js","sourceRoot":"","sources":["../../../../src/components/ui/field/field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAIb,OAAO,EAAE,GAAG,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ACV,aAAa,GACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-action-bar.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/form-action-bar/form-action-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAQrD,UAAU,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC9D;;OAEG;IAEH,IAAI,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,iBAAS,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,KAAK,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"form-action-bar.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/form-action-bar/form-action-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAQrD,UAAU,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC9D;;OAEG;IAEH,IAAI,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,iBAAS,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,KAAK,CAAC,YAAY,CAsDpE;AAED,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -26,7 +26,7 @@ function FormActionBar(props) {
|
|
|
26
26
|
form?.reset();
|
|
27
27
|
onReset?.();
|
|
28
28
|
};
|
|
29
|
-
return (_jsx("div", { "data-slot": "form-action-bar", className: cn('absolute inset-x-0 bottom-0 z-50 flex min-h-[var(--action-bar-height,52px)] items-center space-x-4 border-t border-border bg-background pl-4', className), ...rest, children: children ?? (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline",
|
|
29
|
+
return (_jsx("div", { "data-slot": "form-action-bar", className: cn('absolute inset-x-0 bottom-0 z-50 flex min-h-[var(--action-bar-height,52px)] items-center space-x-4 border-t border-border bg-background pl-4', className), ...rest, children: children ?? (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", type: "button", onClick: handleReset, disabled: isResetDisabled, children: "Reset" }), _jsxs(Button, { variant: "default", type: "submit", disabled: isSaveDisabled, children: [_jsx(MdOutlineSave, { className: "mr-2 h-4 w-4" }), "Save"] })] })) }));
|
|
30
30
|
}
|
|
31
31
|
export { FormActionBar };
|
|
32
32
|
//# sourceMappingURL=form-action-bar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-action-bar.js","sourceRoot":"","sources":["../../../../src/components/ui/form-action-bar/form-action-bar.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AA0B7C;;;;;;;GAOG;AACH,SAAS,aAAa,CAAC,KAAyB;IAC9C,MAAM,EACJ,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,qBAAqB,EACrB,GAAG,IAAI,EACR,GAAG,KAAK,CAAC;IAEV,0DAA0D;IAC1D,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC;IACjC,MAAM,qBAAqB,GAAG,SAAS;QACrC,CAAC,CAAC,SAAS,CAAC,YAAY,IAAI,CAAC,CAAC,qBAAqB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;QAC1E,CAAC,CAAC,KAAK,CAAC;IACV,MAAM,sBAAsB,GAAG,SAAS;QACtC,CAAC,CAAC,SAAS,CAAC,YAAY,IAAI,CAAC,SAAS,CAAC,OAAO;QAC9C,CAAC,CAAC,KAAK,CAAC;IACV,MAAM,cAAc,GAAG,QAAQ,IAAI,qBAAqB,CAAC;IACzD,MAAM,eAAe,GAAG,QAAQ,IAAI,sBAAsB,CAAC;IAE3D,MAAM,WAAW,GAAG,GAAS,EAAE;QAC7B,IAAI,EAAE,KAAK,EAAE,CAAC;QACd,OAAO,EAAE,EAAE,CAAC;IACd,CAAC,CAAC;IAEF,OAAO,CACL,2BACY,iBAAiB,EAC3B,SAAS,EAAE,EAAE,CACX,8IAA8I,EAC9I,SAAS,CACV,KACG,IAAI,YAEP,QAAQ,IAAI,CACX,8BACE,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,IAAI,EAAC,
|
|
1
|
+
{"version":3,"file":"form-action-bar.js","sourceRoot":"","sources":["../../../../src/components/ui/form-action-bar/form-action-bar.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AA0B7C;;;;;;;GAOG;AACH,SAAS,aAAa,CAAC,KAAyB;IAC9C,MAAM,EACJ,SAAS,EACT,QAAQ,EACR,QAAQ,EAC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
|
|
3
1
|
import * as React from 'react';
|
|
4
2
|
interface FormItemContextValue {
|
|
5
3
|
id: string;
|
|
@@ -15,8 +13,12 @@ interface FormItemProps extends React.ComponentProps<'div'> {
|
|
|
15
13
|
error?: React.ReactNode | Error;
|
|
16
14
|
}
|
|
17
15
|
declare function FormItem({ className, error, ...props }: FormItemProps): React.ReactElement;
|
|
18
|
-
declare function FormLabel({ className, ...props }: React.ComponentProps<
|
|
19
|
-
|
|
16
|
+
declare function FormLabel({ className, ...props }: React.ComponentProps<'label'>): React.ReactElement | null;
|
|
17
|
+
/**
|
|
18
|
+
* FormControl passes form field attributes (id, aria-describedby, aria-invalid)
|
|
19
|
+
* to its single child element via cloneElement.
|
|
20
|
+
*/
|
|
21
|
+
declare function FormControl({ children, ...props }: React.PropsWithChildren<Record<string, unknown>>): React.ReactElement;
|
|
20
22
|
declare function FormDescription({ className, ...props }: React.ComponentProps<'p'>): React.ReactElement | null;
|
|
21
23
|
declare function FormMessage({ className, ...props }: React.ComponentProps<'p'>): React.ReactElement | null;
|
|
22
24
|
export { FormControl, FormDescription, FormItem, FormLabel, FormMessage, useFormField, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-item.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/form-item/form-item.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"form-item.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/form-item/form-item.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,UAAU,oBAAoB;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,GAAG,SAAS,CAAC;CAC5C;AAID,UAAU,kBAAmB,SAAQ,oBAAoB;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,QAAA,MAAM,YAAY,QAAO,kBAgBxB,CAAC;AAEF,UAAU,aAAc,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACzD,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;CACjC;AAED,iBAAS,QAAQ,CAAC,EAChB,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,aAAa,GAAG,KAAK,CAAC,YAAY,CAYpC;AAED,iBAAS,SAAS,CAAC,EACjB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CAgB3D;AAED;;;GAGG;AACH,iBAAS,WAAW,CAAC,EACnB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC,YAAY,CAiBvE;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CAevD;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CAsBvD;AAED,OAAO,EACL,WAAW,EACX,eAAe,EACf,QAAQ,EACR,SAAS,EACT,WAAW,EACX,YAAY,GACb,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { Slot } from 'radix-ui';
|
|
4
3
|
import * as React from 'react';
|
|
5
4
|
import { cn } from '#src/utils/index.js';
|
|
6
5
|
import { Label } from '../label/label.js';
|
|
@@ -30,9 +29,24 @@ function FormLabel({ className, ...props }) {
|
|
|
30
29
|
}
|
|
31
30
|
return (_jsx(Label, { "data-slot": "form-label", "data-error": !!error, className: cn('data-[error=true]:text-destructive', className), htmlFor: formItemId, ...props }));
|
|
32
31
|
}
|
|
33
|
-
|
|
32
|
+
/**
|
|
33
|
+
* FormControl passes form field attributes (id, aria-describedby, aria-invalid)
|
|
34
|
+
* to its single child element via cloneElement.
|
|
35
|
+
*/
|
|
36
|
+
function FormControl({ children, ...props }) {
|
|
34
37
|
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
35
|
-
|
|
38
|
+
if (!React.isValidElement(children)) {
|
|
39
|
+
throw new Error('FormControl expects a single React element as a child');
|
|
40
|
+
}
|
|
41
|
+
return React.cloneElement(children, {
|
|
42
|
+
'data-slot': 'form-control',
|
|
43
|
+
id: formItemId,
|
|
44
|
+
'aria-describedby': error
|
|
45
|
+
? `${formDescriptionId} ${formMessageId}`
|
|
46
|
+
: formDescriptionId,
|
|
47
|
+
'aria-invalid': !!error,
|
|
48
|
+
...props,
|
|
49
|
+
});
|
|
36
50
|
}
|
|
37
51
|
function FormDescription({ className, ...props }) {
|
|
38
52
|
const { formDescriptionId } = useFormField();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-item.js","sourceRoot":"","sources":["../../../../src/components/ui/form-item/form-item.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"form-item.js","sourceRoot":"","sources":["../../../../src/components/ui/form-item/form-item.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAO1C,MAAM,eAAe,GAAG,KAAK,CAAC,aAAa,CAA8B,IAAI,CAAC,CAAC;AAQ/E,MAAM,YAAY,GAAG,GAAuB,EAAE;IAC5C,MAAM,WAA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AAE,CAAC;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,yBACY,cAAc,EACxB,EAAE,EAAE,aAAa,EACjB,SAAS,EAAE,EAAE,CAAC,0BAA0B,EAAE,SAAS,CAAC,KAChD,KAAK,YAER,IAAI,GACH,CACL,CAAC;AACJ,CAAC;AAED,OAAO,EACL,WAAW,EACX,eAAe,EACf,QAAQ,EACR,SAAS,EACT,WAAW,EACX,YAAY,GACb,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './alert/alert.js';
|
|
2
2
|
export * from './async-combobox-field/async-combobox-field.js';
|
|
3
|
+
export * from './autocomplete/autocomplete.js';
|
|
3
4
|
export * from './badge/badge.js';
|
|
4
5
|
export * from './breadcrumb/breadcrumb.js';
|
|
5
6
|
export * from './button-group/button-group.js';
|
|
@@ -12,10 +13,8 @@ export * from './circular-progress/circular-progress.js';
|
|
|
12
13
|
export * from './code-editor-field/code-editor-field.js';
|
|
13
14
|
export * from './collapsible/collapsible.js';
|
|
14
15
|
export * from './color-picker-field/color-picker-field.js';
|
|
15
|
-
export * from './color-picker/color-picker.js';
|
|
16
16
|
export * from './combobox-field/combobox-field.js';
|
|
17
17
|
export * from './combobox/combobox.js';
|
|
18
|
-
export * from './command/command.js';
|
|
19
18
|
export * from './confirm-dialog/confirm-dialog.js';
|
|
20
19
|
export * from './date-picker-field/date-picker-field.js';
|
|
21
20
|
export * from './date-time-picker-field/date-time-picker-field.js';
|
|
@@ -24,15 +23,16 @@ export * from './dropdown/dropdown.js';
|
|
|
24
23
|
export * from './empty-display/empty-display.js';
|
|
25
24
|
export * from './error-display/error-display.js';
|
|
26
25
|
export * from './errorable-loader/errorable-loader.js';
|
|
26
|
+
export * from './field/field.js';
|
|
27
27
|
export * from './form-action-bar/form-action-bar.js';
|
|
28
28
|
export * from './form-item/form-item.js';
|
|
29
29
|
export * from './input-field/input-field.js';
|
|
30
|
+
export * from './input-group/input-group.js';
|
|
30
31
|
export * from './input/input.js';
|
|
31
32
|
export * from './json-diff-viewer/json-diff-viewer.js';
|
|
32
33
|
export * from './label/label.js';
|
|
33
34
|
export * from './loader/loader.js';
|
|
34
35
|
export * from './multi-combobox-field/multi-combobox-field.js';
|
|
35
|
-
export * from './multi-combobox/multi-combobox.js';
|
|
36
36
|
export * from './multi-switch-field/multi-switch-field.js';
|
|
37
37
|
export * from './navigation-menu/navigation-menu.js';
|
|
38
38
|
export * from './navigation-tabs/navigation-tabs.js';
|
|
@@ -46,6 +46,8 @@ export * from './separator/separator.js';
|
|
|
46
46
|
export * from './sheet/sheet.js';
|
|
47
47
|
export * from './sidebar/sidebar.js';
|
|
48
48
|
export * from './skeleton/skeleton.js';
|
|
49
|
+
export * from './slider/slider.js';
|
|
50
|
+
export * from './spinner/spinner.js';
|
|
49
51
|
export * from './switch-field/switch-field.js';
|
|
50
52
|
export * from './switch/switch.js';
|
|
51
53
|
export * from './table/table.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gDAAgD,CAAC;AAC/D,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oCAAoC,CAAC;AACnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,0CAA0C,CAAC;AACzD,cAAc,0CAA0C,CAAC;AACzD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4CAA4C,CAAC;AAC3D,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gDAAgD,CAAC;AAC/D,cAAc,gCAAgC,CAA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AAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oCAAoC,CAAC;AACnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './alert/alert.js';
|
|
2
2
|
export * from './async-combobox-field/async-combobox-field.js';
|
|
3
|
+
export * from './autocomplete/autocomplete.js';
|
|
3
4
|
export * from './badge/badge.js';
|
|
4
5
|
export * from './breadcrumb/breadcrumb.js';
|
|
5
6
|
export * from './button-group/button-group.js';
|
|
@@ -12,10 +13,8 @@ export * from './circular-progress/circular-progress.js';
|
|
|
12
13
|
export * from './code-editor-field/code-editor-field.js';
|
|
13
14
|
export * from './collapsible/collapsible.js';
|
|
14
15
|
export * from './color-picker-field/color-picker-field.js';
|
|
15
|
-
export * from './color-picker/color-picker.js';
|
|
16
16
|
export * from './combobox-field/combobox-field.js';
|
|
17
17
|
export * from './combobox/combobox.js';
|
|
18
|
-
export * from './command/command.js';
|
|
19
18
|
export * from './confirm-dialog/confirm-dialog.js';
|
|
20
19
|
export * from './date-picker-field/date-picker-field.js';
|
|
21
20
|
export * from './date-time-picker-field/date-time-picker-field.js';
|
|
@@ -24,15 +23,16 @@ export * from './dropdown/dropdown.js';
|
|
|
24
23
|
export * from './empty-display/empty-display.js';
|
|
25
24
|
export * from './error-display/error-display.js';
|
|
26
25
|
export * from './errorable-loader/errorable-loader.js';
|
|
26
|
+
export * from './field/field.js';
|
|
27
27
|
export * from './form-action-bar/form-action-bar.js';
|
|
28
28
|
export * from './form-item/form-item.js';
|
|
29
29
|
export * from './input-field/input-field.js';
|
|
30
|
+
export * from './input-group/input-group.js';
|
|
30
31
|
export * from './input/input.js';
|
|
31
32
|
export * from './json-diff-viewer/json-diff-viewer.js';
|
|
32
33
|
export * from './label/label.js';
|
|
33
34
|
export * from './loader/loader.js';
|
|
34
35
|
export * from './multi-combobox-field/multi-combobox-field.js';
|
|
35
|
-
export * from './multi-combobox/multi-combobox.js';
|
|
36
36
|
export * from './multi-switch-field/multi-switch-field.js';
|
|
37
37
|
export * from './navigation-menu/navigation-menu.js';
|
|
38
38
|
export * from './navigation-tabs/navigation-tabs.js';
|
|
@@ -46,6 +46,8 @@ export * from './separator/separator.js';
|
|
|
46
46
|
export * from './sheet/sheet.js';
|
|
47
47
|
export * from './sidebar/sidebar.js';
|
|
48
48
|
export * from './skeleton/skeleton.js';
|
|
49
|
+
export * from './slider/slider.js';
|
|
50
|
+
export * from './spinner/spinner.js';
|
|
49
51
|
export * from './switch-field/switch-field.js';
|
|
50
52
|
export * from './switch/switch.js';
|
|
51
53
|
export * from './table/table.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gDAAgD,CAAC;AAC/D,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oCAAoC,CAAC;AACnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,0CAA0C,CAAC;AACzD,cAAc,0CAA0C,CAAC;AACzD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4CAA4C,CAAC;AAC3D,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gDAAgD,CAAC;AAC/D,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CA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AAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oCAAoC,CAAC;AACnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-field.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/input-field/input-field.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EACV,OAAO,EAEP,SAAS,EACT,WAAW,EACX,eAAe,EACf,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"input-field.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/input-field/input-field.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EACV,OAAO,EAEP,SAAS,EACT,WAAW,EACX,eAAe,EACf,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAKzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAYzD,MAAM,WAAW,eACf,SACE,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,EAChE,cAAc;IAChB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,qBAAqB,CAAC;CAClC;AAED,iBAAS,UAAU,CAAC,EAClB,KAAK,EACL,WAAW,EACX,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,GAAG,EACH,GAAG,KAAK,EACT,EAAE,eAAe,GAAG,KAAK,CAAC,YAAY,CAsBtC;AAED,MAAM,WAAW,yBAAyB,CACxC,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,UAAU,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,CACpE,SAAQ,eAAe;IACvB,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,IAAI,EAAE,UAAU,CAAC;IACjB,eAAe,CAAC,EAAE,eAAe,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;CAC7D;AAED,iBAAS,oBAAoB,CAC3B,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,UAAU,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,EACpE,EACA,OAAO,EACP,IAAI,EACJ,eAAe,EACf,GAAG,IAAI,EACR,EAAE,yBAAyB,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,YAAY,CAW1E;AAED,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from 'react';
|
|
2
3
|
import { get, useFormState } from 'react-hook-form';
|
|
3
4
|
import { cn, mergeRefs } from '#src/utils/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { Field, FieldDescription, FieldError as FieldErrorDisplay, FieldLabel, } from '../field/field.js';
|
|
5
6
|
import { Input } from '../input/input.js';
|
|
6
7
|
function InputField({ label, description, error, onChange, register, className, ref, ...props }) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const id = useId();
|
|
9
|
+
return (_jsxs(Field, { "data-invalid": !!error, className: cn('gap-1.5', className), children: [_jsx(FieldLabel, { htmlFor: id, children: label }), _jsx(Input, { id: id, onChange: onChange &&
|
|
10
|
+
((e) => {
|
|
11
|
+
onChange(e.target.value);
|
|
12
|
+
}), "aria-invalid": !!error, ref: mergeRefs(ref, register?.ref), ...props, ...register }), _jsx(FieldDescription, { children: description }), _jsx(FieldErrorDisplay, { children: error })] }));
|
|
11
13
|
}
|
|
12
14
|
function InputFieldController({ control, name, registerOptions, ...rest }) {
|
|
13
15
|
const { errors } = useFormState({ control, name });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-field.js","sourceRoot":"","sources":["../../../../src/components/ui/input-field/input-field.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAIpD,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"input-field.js","sourceRoot":"","sources":["../../../../src/components/ui/input-field/input-field.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAIpD,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EACL,KAAK,EACL,gBAAgB,EAChB,UAAU,IAAI,iBAAiB,EAC/B,UAAU,GACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAW1C,SAAS,UAAU,CAAC,EAClB,KAAK,EACL,WAAW,EACX,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,GAAG,EACH,GAAG,KAAK,EACQ;IAChB,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IACnB,OAAO,CACL,MAAC,KAAK,oBAAe,CAAC,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,aAC/D,KAAC,UAAU,IAAC,OAAO,EAAE,EAAE,YAAG,KAAK,GAAc,EAC7C,KAAC,KAAK,IACJ,EAAE,EAAE,EAAE,EACN,QAAQ,EACN,QAAQ;oBACR,CAAC,CAAC,CAAC,EAAE,EAAE;wBACL,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBAC3B,CAAC,CAAC,kBAEU,CAAC,CAAC,KAAK,EACrB,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,CAAC,KAC9B,KAAK,KACL,QAAQ,GACZ,EACF,KAAC,gBAAgB,cAAE,WAAW,GAAoB,EAClD,KAAC,iBAAiB,cAAE,KAAK,GAAqB,IACxC,CACT,CAAC;AACJ,CAAC;AAWD,SAAS,oBAAoB,CAG3B,EACA,OAAO,EACP,IAAI,EACJ,eAAe,EACf,GAAG,IAAI,EAC6C;IACpD,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,EAAE,IAAI,CAA2B,CAAC;IAE1D,OAAO,CACL,KAAC,UAAU,IACT,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC,EACjD,KAAK,EAAE,KAAK,EAAE,OAAO,KACjB,IAAI,GACR,CACH,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
import { Button } from '../button/button.js';
|
|
4
|
+
/**
|
|
5
|
+
* A container for grouping an input with addons, buttons, and other elements.
|
|
6
|
+
*
|
|
7
|
+
* - role="presentation" is used to prevent screen readers from reading the input group as a form control.
|
|
8
|
+
*
|
|
9
|
+
* https://ui.shadcn.com/docs/components/input-group
|
|
10
|
+
*/
|
|
11
|
+
declare function InputGroup({ className, ...props }: React.ComponentProps<'div'>): React.ReactElement;
|
|
12
|
+
declare const inputGroupAddonVariants: (props?: ({
|
|
13
|
+
align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null | undefined;
|
|
14
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
|
+
declare function InputGroupAddon({ className, align, ...props }: React.ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>): React.ReactElement;
|
|
16
|
+
declare const inputGroupButtonVariants: (props?: ({
|
|
17
|
+
size?: "sm" | "xs" | "icon-xs" | "icon-sm" | null | undefined;
|
|
18
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
19
|
+
declare function InputGroupButton({ className, type, variant, size, ...props }: Omit<React.ComponentProps<typeof Button>, 'size' | 'type'> & VariantProps<typeof inputGroupButtonVariants> & {
|
|
20
|
+
type?: 'button' | 'submit' | 'reset';
|
|
21
|
+
}): React.ReactElement;
|
|
22
|
+
declare function InputGroupText({ className, ...props }: React.ComponentProps<'span'>): React.ReactElement;
|
|
23
|
+
declare function InputGroupInput({ className, ...props }: React.ComponentProps<'input'>): React.ReactElement;
|
|
24
|
+
declare function InputGroupTextarea({ className, ...props }: React.ComponentProps<'textarea'>): React.ReactElement;
|
|
25
|
+
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, };
|
|
26
|
+
//# sourceMappingURL=input-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-group.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/input-group/input-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAMpC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI7C;;;;;;GAMG;AACH,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,YAAY,CAYlD;AAED,QAAA,MAAM,uBAAuB;;8EAmB5B,CAAC;AAEF,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,KAAsB,EACtB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAC5B,YAAY,CAAC,OAAO,uBAAuB,CAAC,GAAG,KAAK,CAAC,YAAY,CAgBlE;AAED,QAAA,MAAM,wBAAwB;;8EAgB7B,CAAC;AAEF,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,IAAe,EACf,OAAiB,EACjB,IAAW,EACX,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,GAC3D,YAAY,CAAC,OAAO,wBAAwB,CAAC,GAAG;IAC9C,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;CACtC,GAAG,KAAK,CAAC,YAAY,CAUvB;AAED,iBAAS,cAAc,CAAC,EACtB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,YAAY,CAUnD;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,YAAY,CAWpD;AAED,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,YAAY,CAWvD;AAED,OAAO,EACL,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,kBAAkB,GACnB,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { cn } from '#src/utils/index.js';
|
|
5
|
+
import { Button } from '../button/button.js';
|
|
6
|
+
import { Input } from '../input/input.js';
|
|
7
|
+
import { Textarea } from '../textarea/textarea.js';
|
|
8
|
+
/**
|
|
9
|
+
* A container for grouping an input with addons, buttons, and other elements.
|
|
10
|
+
*
|
|
11
|
+
* - role="presentation" is used to prevent screen readers from reading the input group as a form control.
|
|
12
|
+
*
|
|
13
|
+
* https://ui.shadcn.com/docs/components/input-group
|
|
14
|
+
*/
|
|
15
|
+
function InputGroup({ className, ...props }) {
|
|
16
|
+
return (_jsx("div", { "data-slot": "input-group", role: "group", className: cn('group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5', className), ...props }));
|
|
17
|
+
}
|
|
18
|
+
const inputGroupAddonVariants = cva("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4", {
|
|
19
|
+
variants: {
|
|
20
|
+
align: {
|
|
21
|
+
'inline-start': 'order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]',
|
|
22
|
+
'inline-end': 'order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]',
|
|
23
|
+
'block-start': 'order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2',
|
|
24
|
+
'block-end': 'order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
align: 'inline-start',
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
function InputGroupAddon({ className, align = 'inline-start', ...props }) {
|
|
32
|
+
return (_jsx("div", { role: "presentation", "data-slot": "input-group-addon", "data-align": align, className: cn(inputGroupAddonVariants({ align }), className), onClick: (e) => {
|
|
33
|
+
if (e.target.closest('button')) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
e.currentTarget.parentElement?.querySelector('input')?.focus();
|
|
37
|
+
}, ...props }));
|
|
38
|
+
}
|
|
39
|
+
const inputGroupButtonVariants = cva('flex items-center gap-2 text-sm shadow-none', {
|
|
40
|
+
variants: {
|
|
41
|
+
size: {
|
|
42
|
+
xs: "h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
|
43
|
+
sm: '',
|
|
44
|
+
'icon-xs': 'size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0',
|
|
45
|
+
'icon-sm': 'size-8 p-0 has-[>svg]:p-0',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
defaultVariants: {
|
|
49
|
+
size: 'xs',
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
function InputGroupButton({ className, type = 'button', variant = 'ghost', size = 'xs', ...props }) {
|
|
53
|
+
return (_jsx(Button, { type: type, "data-size": size, variant: variant, className: cn(inputGroupButtonVariants({ size }), className), ...props }));
|
|
54
|
+
}
|
|
55
|
+
function InputGroupText({ className, ...props }) {
|
|
56
|
+
return (_jsx("span", { className: cn("flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", className), ...props }));
|
|
57
|
+
}
|
|
58
|
+
function InputGroupInput({ className, ...props }) {
|
|
59
|
+
return (_jsx(Input, { "data-slot": "input-group-control", className: cn('flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent', className), ...props }));
|
|
60
|
+
}
|
|
61
|
+
function InputGroupTextarea({ className, ...props }) {
|
|
62
|
+
return (_jsx(Textarea, { "data-slot": "input-group-control", className: cn('flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent', className), ...props }));
|
|
63
|
+
}
|
|
64
|
+
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, };
|
|
65
|
+
//# sourceMappingURL=input-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-group.js","sourceRoot":"","sources":["../../../../src/components/ui/input-group/input-group.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAKb,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE/C,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD;;;;;;GAMG;AACH,SAAS,UAAU,CAAC,EAClB,SAAS,EACT,GAAG,KAA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AAS,EACT,IAAI,GAAG,QAAQ,EACf,OAAO,GAAG,OAAO,EACjB,IAAI,GAAG,IAAI,EACX,GAAG,KAAK,EAIP;IACD,OAAO,CACL,KAAC,MAAM,IACL,IAAI,EAAE,IAAI,eACC,IAAI,EACf,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,EAAE,CAAC,wBAAwB,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,CAAC,KACxD,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,EACtB,SAAS,EACT,GAAG,KAAK,EACqB;IAC7B,OAAO,CACL,eACE,SAAS,EAAE,EAAE,CACX,wHAAwH,EACxH,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACsB;IAC9B,OAAO,CACL,KAAC,KAAK,iBACM,qBAAqB,EAC/B,SAAS,EAAE,EAAE,CACX,kLAAkL,EAClL,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,GAAG,KAAK,EACyB;IACjC,OAAO,CACL,KAAC,QAAQ,iBACG,qBAAqB,EAC/B,SAAS,EAAE,EAAE,CACX,mMAAmM,EACnM,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED,OAAO,EACL,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,kBAAkB,GACnB,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type * as React from 'react';
|
|
2
|
-
import { Label as LabelPrimitive } from 'radix-ui';
|
|
3
2
|
/**
|
|
4
3
|
* Renders an accessible label associated with controls.
|
|
5
4
|
*
|
|
6
5
|
* https://ui.shadcn.com/docs/components/label
|
|
7
6
|
*/
|
|
8
|
-
declare function Label({ className, ...props }: React.ComponentProps<
|
|
7
|
+
declare function Label({ className, ...props }: React.ComponentProps<'label'>): React.ReactElement;
|
|
9
8
|
export { Label };
|
|
10
9
|
//# sourceMappingURL=label.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/label/label.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/label/label.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAIpC;;;;GAIG;AACH,iBAAS,KAAK,CAAC,EACb,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,YAAY,CAYpD;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { Label as LabelPrimitive } from 'radix-ui';
|
|
4
3
|
import { cn } from '#src/utils/index.js';
|
|
5
4
|
/**
|
|
6
5
|
* Renders an accessible label associated with controls.
|
|
@@ -8,7 +7,9 @@ import { cn } from '#src/utils/index.js';
|
|
|
8
7
|
* https://ui.shadcn.com/docs/components/label
|
|
9
8
|
*/
|
|
10
9
|
function Label({ className, ...props }) {
|
|
11
|
-
return (
|
|
10
|
+
return (
|
|
11
|
+
// eslint-disable-next-line jsx-a11y/label-has-associated-control -- htmlFor is passed via props by consumers (e.g. FormLabel)
|
|
12
|
+
_jsx("label", { "data-slot": "label", className: cn('flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50', className), ...props }));
|
|
12
13
|
}
|
|
13
14
|
export { Label };
|
|
14
15
|
//# sourceMappingURL=label.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../../../src/components/ui/label/label.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAIb,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../../../src/components/ui/label/label.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAIb,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAEzC;;;;GAIG;AACH,SAAS,KAAK,CAAC,EACb,SAAS,EACT,GAAG,KAAK,EACsB;IAC9B,OAAO;IACL,8HAA8H;IAC9H,6BACY,OAAO,EACjB,SAAS,EAAE,EAAE,CACX,qNAAqN,EACrN,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -7,9 +7,9 @@ export interface MultiComboboxFieldProps<OptionType> extends MultiSelectOptionPr
|
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* Field with label and error states that wraps a
|
|
10
|
+
* Field with label and error states that wraps a Combobox with multi-select (chips) support.
|
|
11
11
|
*/
|
|
12
|
-
declare function MultiComboboxField<OptionType>({ label, description, error, value, placeholder, options, renderItemLabel, onChange, getOptionLabel, getOptionValue, className, noResultsText,
|
|
12
|
+
declare function MultiComboboxField<OptionType>({ label, description, error, value, placeholder, options, renderItemLabel, onChange, getOptionLabel, getOptionValue, className, noResultsText, disabled, }: MultiComboboxFieldProps<OptionType> & AddOptionRequiredFields<OptionType>): React.ReactElement;
|
|
13
13
|
interface MultiComboboxFieldControllerProps<OptionType, TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<MultiComboboxFieldProps<OptionType>, 'value'> {
|
|
14
14
|
control: Control<TFieldValues>;
|
|
15
15
|
name: TFieldName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-combobox-field.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/multi-combobox-field/multi-combobox-field.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"multi-combobox-field.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/multi-combobox-field/multi-combobox-field.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAIvE,OAAO,KAAK,EACV,uBAAuB,EACvB,cAAc,EACd,sBAAsB,EACvB,MAAM,oBAAoB,CAAC;AAwB5B,MAAM,WAAW,uBAAuB,CAAC,UAAU,CACjD,SAAQ,sBAAsB,CAAC,UAAU,CAAC,EAAE,cAAc;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,iBAAS,kBAAkB,CAAC,UAAU,EAAE,EACtC,KAAK,EACL,WAAW,EACX,KAAK,EACL,KAAK,EACL,WAAW,EACX,OAAO,EACP,eAAe,EACf,QAAQ,EACR,cAA0D,EAC1D,cAA0D,EAC1D,SAAS,EACT,aAAa,EACb,QAAQ,GACT,EAAE,uBAAuB,CAAC,UAAU,CAAC,GACpC,uBAAuB,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,YAAY,CAoEzD;AAED,UAAU,iCAAiC,CACzC,UAAU,EACV,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,UAAU,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,CACpE,SAAQ,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC1D,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,iBAAS,4BAA4B,CACnC,UAAU,EACV,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,UAAU,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,EACpE,EACA,IAAI,EACJ,OAAO,EACP,GAAG,IAAI,EACR,EAAE,iCAAiC,CAAC,UAAU,EAAE,YAAY,EAAE,UAAU,CAAC,GACxE,uBAAuB,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,YAAY,CAYzD;AAED,OAAO,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,CAAC"}
|
|
@@ -1,33 +1,32 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
+
import { Fragment, useId, useMemo } from 'react';
|
|
3
4
|
import { useComponentStrings } from '#src/contexts/component-strings.js';
|
|
4
5
|
import { useControllerMerged } from '#src/hooks/use-controller-merged.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
6
|
+
import { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxContent, ComboboxEmpty, ComboboxItem, ComboboxList, ComboboxValue, useComboboxAnchor, } from '../combobox/combobox.js';
|
|
7
|
+
import { Field, FieldDescription, FieldError, FieldLabel, } from '../field/field.js';
|
|
7
8
|
/**
|
|
8
|
-
* Field with label and error states that wraps a
|
|
9
|
+
* Field with label and error states that wraps a Combobox with multi-select (chips) support.
|
|
9
10
|
*/
|
|
10
|
-
function MultiComboboxField({ label, description, error, value, placeholder, options, renderItemLabel, onChange, getOptionLabel = (val) => val.label, getOptionValue = (val) => val.value, className, noResultsText,
|
|
11
|
-
const selectedOptions = value
|
|
12
|
-
?.map((val) => options.find((option) => getOptionValue(option) === val))
|
|
13
|
-
.filter(notEmpty);
|
|
14
|
-
const selectedValues = selectedOptions?.map((option) => ({
|
|
15
|
-
label: getOptionLabel(option),
|
|
16
|
-
value: getOptionValue(option),
|
|
17
|
-
}));
|
|
11
|
+
function MultiComboboxField({ label, description, error, value, placeholder, options, renderItemLabel, onChange, getOptionLabel = (val) => val.label, getOptionValue = (val) => val.value, className, noResultsText, disabled, }) {
|
|
18
12
|
const { comboboxNoResults } = useComponentStrings();
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
13
|
+
const id = useId();
|
|
14
|
+
const chipsRef = useComboboxAnchor();
|
|
15
|
+
const selectedOptions = useMemo(() => options.filter((o) => value?.includes(getOptionValue(o))), [value, options, getOptionValue]);
|
|
16
|
+
return (_jsxs(Field, { "data-invalid": !!error, className: className, children: [_jsx(FieldLabel, { htmlFor: id, children: label }), _jsxs(Combobox, { multiple: true, autoHighlight: true, value: selectedOptions, onValueChange: (selectedOpts) => {
|
|
17
|
+
onChange?.(selectedOpts.map((o) => getOptionValue(o)));
|
|
18
|
+
}, disabled: disabled, items: options, itemToStringLabel: getOptionLabel, itemToStringValue: getOptionValue, children: [_jsx(ComboboxChips, { ref: chipsRef, children: _jsx(ComboboxValue, { children: (values) => (_jsxs(Fragment, { children: [values.map((option) => {
|
|
19
|
+
const val = getOptionValue(option);
|
|
20
|
+
return (_jsx(ComboboxChip, { children: getOptionLabel(option) }, val));
|
|
21
|
+
}), _jsx(ComboboxChipsInput, { id: id, placeholder: values.length > 0 ? '' : placeholder })] })) }) }), _jsxs(ComboboxContent, { anchor: chipsRef, children: [_jsx(ComboboxEmpty, { children: noResultsText ?? comboboxNoResults }), _jsx(ComboboxList, { children: (option) => {
|
|
22
|
+
const val = getOptionValue(option);
|
|
23
|
+
const optionLabel = getOptionLabel(option);
|
|
24
|
+
return (_jsx(ComboboxItem, { value: option, children: renderItemLabel
|
|
25
|
+
? renderItemLabel(option, {
|
|
26
|
+
selected: value?.includes(val) ?? false,
|
|
27
|
+
})
|
|
28
|
+
: optionLabel }, val));
|
|
29
|
+
} })] })] }), _jsx(FieldDescription, { children: description }), _jsx(FieldError, { children: error })] }));
|
|
31
30
|
}
|
|
32
31
|
function MultiComboboxFieldController({ name, control, ...rest }) {
|
|
33
32
|
const { field, fieldState: { error }, } = useControllerMerged({ name, control }, rest);
|