jaci-ui 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +48 -0
- package/dist/components/calendar/calendar.cjs +377 -0
- package/dist/components/calendar/calendar.cjs.map +1 -0
- package/dist/components/calendar/calendar.d.cts +56 -0
- package/dist/components/calendar/calendar.d.ts +56 -0
- package/dist/components/calendar/calendar.js +368 -0
- package/dist/components/calendar/calendar.js.map +1 -0
- package/dist/components/calendar/index.d.cts +2 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/combobox/combobox.cjs +13 -1
- package/dist/components/combobox/combobox.cjs.map +1 -1
- package/dist/components/combobox/combobox.d.cts +7 -2
- package/dist/components/combobox/combobox.d.ts +7 -2
- package/dist/components/combobox/combobox.js +13 -2
- package/dist/components/combobox/combobox.js.map +1 -1
- package/dist/components/combobox/index.d.cts +2 -2
- package/dist/components/combobox/index.d.ts +2 -2
- package/dist/components/controls/input.cjs +26 -5
- package/dist/components/controls/input.cjs.map +1 -1
- package/dist/components/controls/input.d.cts +5 -2
- package/dist/components/controls/input.d.ts +5 -2
- package/dist/components/controls/input.js +28 -7
- package/dist/components/controls/input.js.map +1 -1
- package/dist/components/controls/textarea.cjs +26 -5
- package/dist/components/controls/textarea.cjs.map +1 -1
- package/dist/components/controls/textarea.d.cts +5 -2
- package/dist/components/controls/textarea.d.ts +5 -2
- package/dist/components/controls/textarea.js +28 -7
- package/dist/components/controls/textarea.js.map +1 -1
- package/dist/components/date-picker/date-picker.cjs +9 -9
- package/dist/components/date-picker/date-picker.cjs.map +1 -1
- package/dist/components/date-picker/date-picker.d.cts +3 -1
- package/dist/components/date-picker/date-picker.d.ts +3 -1
- package/dist/components/date-picker/date-picker.js +9 -9
- package/dist/components/date-picker/date-picker.js.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.cjs +589 -0
- package/dist/components/date-range-picker/date-range-picker.cjs.map +1 -0
- package/dist/components/date-range-picker/date-range-picker.d.cts +134 -0
- package/dist/components/date-range-picker/date-range-picker.d.ts +134 -0
- package/dist/components/date-range-picker/date-range-picker.js +568 -0
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -0
- package/dist/components/date-range-picker/index.d.cts +2 -0
- package/dist/components/date-range-picker/index.d.ts +2 -0
- package/dist/components/field/field.cjs +106 -11
- package/dist/components/field/field.cjs.map +1 -1
- package/dist/components/field/field.d.cts +22 -4
- package/dist/components/field/field.d.ts +22 -4
- package/dist/components/field/field.js +107 -13
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/field/index.d.cts +2 -2
- package/dist/components/field/index.d.ts +2 -2
- package/dist/components/pin-input/index.d.cts +2 -0
- package/dist/components/pin-input/index.d.ts +2 -0
- package/dist/components/pin-input/pin-input.cjs +266 -0
- package/dist/components/pin-input/pin-input.cjs.map +1 -0
- package/dist/components/pin-input/pin-input.d.cts +46 -0
- package/dist/components/pin-input/pin-input.d.ts +46 -0
- package/dist/components/pin-input/pin-input.js +258 -0
- package/dist/components/pin-input/pin-input.js.map +1 -0
- package/dist/components/select/index.d.cts +2 -2
- package/dist/components/select/index.d.ts +2 -2
- package/dist/components/select/select.cjs +80 -3
- package/dist/components/select/select.cjs.map +1 -1
- package/dist/components/select/select.d.cts +18 -3
- package/dist/components/select/select.d.ts +18 -3
- package/dist/components/select/select.js +78 -5
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/tags-input/tags-input.cjs +83 -5
- package/dist/components/tags-input/tags-input.cjs.map +1 -1
- package/dist/components/tags-input/tags-input.d.cts +3 -0
- package/dist/components/tags-input/tags-input.d.ts +3 -0
- package/dist/components/tags-input/tags-input.js +83 -5
- package/dist/components/tags-input/tags-input.js.map +1 -1
- package/dist/components/upload/index.d.cts +2 -2
- package/dist/components/upload/index.d.ts +2 -2
- package/dist/components/upload/upload.cjs +90 -10
- package/dist/components/upload/upload.cjs.map +1 -1
- package/dist/components/upload/upload.d.cts +25 -2
- package/dist/components/upload/upload.d.ts +25 -2
- package/dist/components/upload/upload.js +89 -11
- package/dist/components/upload/upload.js.map +1 -1
- package/dist/index.cjs +52 -1
- package/dist/index.d.cts +11 -5
- package/dist/index.d.ts +11 -5
- package/dist/index.js +9 -6
- package/dist/styled-system/recipes/calendar.cjs +43 -0
- package/dist/styled-system/recipes/calendar.cjs.map +1 -0
- package/dist/styled-system/recipes/calendar.js +43 -0
- package/dist/styled-system/recipes/calendar.js.map +1 -0
- package/dist/styled-system/recipes/combobox.cjs +1 -0
- package/dist/styled-system/recipes/combobox.cjs.map +1 -1
- package/dist/styled-system/recipes/combobox.js +1 -0
- package/dist/styled-system/recipes/combobox.js.map +1 -1
- package/dist/styled-system/recipes/date-range-picker.cjs +52 -0
- package/dist/styled-system/recipes/date-range-picker.cjs.map +1 -0
- package/dist/styled-system/recipes/date-range-picker.js +52 -0
- package/dist/styled-system/recipes/date-range-picker.js.map +1 -0
- package/dist/styled-system/recipes/pin-input.cjs +39 -0
- package/dist/styled-system/recipes/pin-input.cjs.map +1 -0
- package/dist/styled-system/recipes/pin-input.js +39 -0
- package/dist/styled-system/recipes/pin-input.js.map +1 -0
- package/dist/styled-system/recipes/select.cjs +5 -1
- package/dist/styled-system/recipes/select.cjs.map +1 -1
- package/dist/styled-system/recipes/select.js +5 -1
- package/dist/styled-system/recipes/select.js.map +1 -1
- package/dist/styled-system/recipes/upload.cjs +2 -0
- package/dist/styled-system/recipes/upload.cjs.map +1 -1
- package/dist/styled-system/recipes/upload.js +2 -0
- package/dist/styled-system/recipes/upload.js.map +1 -1
- package/dist/styles.css +745 -81
- package/package.json +3 -2
|
@@ -8,6 +8,8 @@ interface ComboboxRootProps<Value, Multiple extends boolean | undefined = false>
|
|
|
8
8
|
size?: ComboboxSize;
|
|
9
9
|
/** Marks the field invalid when an external validator owns its state. */
|
|
10
10
|
invalid?: boolean;
|
|
11
|
+
/** Shows a loading state through the optional Loading slot. */
|
|
12
|
+
loading?: boolean;
|
|
11
13
|
/** Direct error content rendered through the surrounding Field context. */
|
|
12
14
|
errors?: ReactNode | ReactNode[];
|
|
13
15
|
children?: ReactNode;
|
|
@@ -18,7 +20,7 @@ interface ComboboxRootProps<Value, Multiple extends boolean | undefined = false>
|
|
|
18
20
|
* controlled `value`/`onValueChange` and uncontrolled `defaultValue` APIs,
|
|
19
21
|
* object values, grouped items, filtering and multiple selection.
|
|
20
22
|
*/
|
|
21
|
-
declare function ComboboxRoot$1<Value = string, Multiple extends boolean | undefined = false>({ children, className, errors, invalid, name, size, ...props }: ComboboxRootProps<Value, Multiple>): import("react").JSX.Element;
|
|
23
|
+
declare function ComboboxRoot$1<Value = string, Multiple extends boolean | undefined = false>({ children, className, errors, invalid, loading: _loading, name, size, ...props }: ComboboxRootProps<Value, Multiple>): import("react").JSX.Element;
|
|
22
24
|
type ComboboxLabelProps = ComponentPropsWithoutRef<typeof Field.Label>;
|
|
23
25
|
declare const ComboboxLabel: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").FieldLabelProps, "ref"> & import("react").RefAttributes<HTMLElement>, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
24
26
|
type ComboboxInputGroupProps = ComponentPropsWithoutRef<typeof Combobox.InputGroup>;
|
|
@@ -50,6 +52,8 @@ type ComboboxEmptyProps = ComponentPropsWithoutRef<typeof Combobox.Empty>;
|
|
|
50
52
|
declare const ComboboxEmpty: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AutocompleteEmptyProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
51
53
|
type ComboboxClearProps = ComponentPropsWithoutRef<typeof Combobox.Clear>;
|
|
52
54
|
declare const ComboboxClear: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AutocompleteClearProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
55
|
+
type ComboboxLoadingProps = ComponentPropsWithoutRef<"div">;
|
|
56
|
+
declare const ComboboxLoading: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
53
57
|
type ComboboxStatusProps = ComponentPropsWithoutRef<typeof Combobox.Status>;
|
|
54
58
|
declare const ComboboxStatus: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AutocompleteStatusProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
55
59
|
type ComboboxArrowProps = ComponentPropsWithoutRef<typeof Combobox.Arrow>;
|
|
@@ -71,11 +75,12 @@ declare const Combobox$1: {
|
|
|
71
75
|
Group: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AutocompleteGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
72
76
|
GroupLabel: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AutocompleteGroupLabelProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
73
77
|
Empty: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AutocompleteEmptyProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
78
|
+
Loading: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
74
79
|
Clear: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AutocompleteClearProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
75
80
|
Status: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AutocompleteStatusProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
76
81
|
Arrow: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AutocompleteArrowProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
77
82
|
useFilter: typeof Combobox.useFilter;
|
|
78
83
|
};
|
|
79
84
|
//#endregion
|
|
80
|
-
export { Combobox$1 as Combobox, ComboboxArrow, ComboboxArrowProps, ComboboxClear, ComboboxClearProps, ComboboxEmpty, ComboboxEmptyProps, ComboboxGroup, ComboboxGroupLabel, ComboboxGroupLabelProps, ComboboxGroupProps, ComboboxIcon, ComboboxIconProps, ComboboxInput, ComboboxInputGroup, ComboboxInputGroupProps, ComboboxInputProps, ComboboxItem, ComboboxItemIndicator, ComboboxItemIndicatorProps, ComboboxItemProps, ComboboxLabel, ComboboxLabelProps, ComboboxList, ComboboxListProps, ComboboxPopup, ComboboxPopupProps, ComboboxPortal, ComboboxPositioner, ComboboxPositionerProps, ComboboxRoot$1 as ComboboxRoot, ComboboxRootProps, ComboboxSize, ComboboxStatus, ComboboxStatusProps, ComboboxTrigger, ComboboxTriggerProps, ComboboxValue, ComboboxValueProps };
|
|
85
|
+
export { Combobox$1 as Combobox, ComboboxArrow, ComboboxArrowProps, ComboboxClear, ComboboxClearProps, ComboboxEmpty, ComboboxEmptyProps, ComboboxGroup, ComboboxGroupLabel, ComboboxGroupLabelProps, ComboboxGroupProps, ComboboxIcon, ComboboxIconProps, ComboboxInput, ComboboxInputGroup, ComboboxInputGroupProps, ComboboxInputProps, ComboboxItem, ComboboxItemIndicator, ComboboxItemIndicatorProps, ComboboxItemProps, ComboboxLabel, ComboboxLabelProps, ComboboxList, ComboboxListProps, ComboboxLoading, ComboboxLoadingProps, ComboboxPopup, ComboboxPopupProps, ComboboxPortal, ComboboxPositioner, ComboboxPositionerProps, ComboboxRoot$1 as ComboboxRoot, ComboboxRootProps, ComboboxSize, ComboboxStatus, ComboboxStatusProps, ComboboxTrigger, ComboboxTriggerProps, ComboboxValue, ComboboxValueProps };
|
|
81
86
|
//# sourceMappingURL=combobox.d.ts.map
|
|
@@ -17,7 +17,7 @@ function useComboboxStyles() {
|
|
|
17
17
|
* controlled `value`/`onValueChange` and uncontrolled `defaultValue` APIs,
|
|
18
18
|
* object values, grouped items, filtering and multiple selection.
|
|
19
19
|
*/
|
|
20
|
-
function ComboboxRoot$1({ children, className, errors, invalid, name, size = "md", ...props }) {
|
|
20
|
+
function ComboboxRoot$1({ children, className, errors, invalid, loading: _loading, name, size = "md", ...props }) {
|
|
21
21
|
const fieldProps = {
|
|
22
22
|
className: cx(combobox({ size }).root, className),
|
|
23
23
|
...errors === void 0 ? {} : { errors },
|
|
@@ -155,6 +155,16 @@ const ComboboxClear = forwardRef(function ComboboxClear({ children = "×", class
|
|
|
155
155
|
children
|
|
156
156
|
});
|
|
157
157
|
});
|
|
158
|
+
const ComboboxLoading = forwardRef(function ComboboxLoading({ children = "Loading…", className, ...props }, ref) {
|
|
159
|
+
return /* @__PURE__ */ jsx("div", {
|
|
160
|
+
...props,
|
|
161
|
+
ref,
|
|
162
|
+
"aria-live": "polite",
|
|
163
|
+
className: cx(useComboboxStyles().loading, className),
|
|
164
|
+
"data-slot": "combobox-loading",
|
|
165
|
+
children
|
|
166
|
+
});
|
|
167
|
+
});
|
|
158
168
|
const ComboboxStatus = forwardRef(function ComboboxStatus({ className, ...props }, ref) {
|
|
159
169
|
return /* @__PURE__ */ jsx(Combobox.Status, {
|
|
160
170
|
...props,
|
|
@@ -188,12 +198,13 @@ const Combobox$1 = {
|
|
|
188
198
|
Group: ComboboxGroup,
|
|
189
199
|
GroupLabel: ComboboxGroupLabel,
|
|
190
200
|
Empty: ComboboxEmpty,
|
|
201
|
+
Loading: ComboboxLoading,
|
|
191
202
|
Clear: ComboboxClear,
|
|
192
203
|
Status: ComboboxStatus,
|
|
193
204
|
Arrow: ComboboxArrow,
|
|
194
205
|
useFilter: Combobox.useFilter
|
|
195
206
|
};
|
|
196
207
|
//#endregion
|
|
197
|
-
export { Combobox$1 as Combobox, ComboboxArrow, ComboboxClear, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxIcon, ComboboxInput, ComboboxInputGroup, ComboboxItem, ComboboxItemIndicator, ComboboxLabel, ComboboxList, ComboboxPopup, ComboboxPortal, ComboboxPositioner, ComboboxRoot$1 as ComboboxRoot, ComboboxStatus, ComboboxTrigger, ComboboxValue };
|
|
208
|
+
export { Combobox$1 as Combobox, ComboboxArrow, ComboboxClear, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxIcon, ComboboxInput, ComboboxInputGroup, ComboboxItem, ComboboxItemIndicator, ComboboxLabel, ComboboxList, ComboboxLoading, ComboboxPopup, ComboboxPortal, ComboboxPositioner, ComboboxRoot$1 as ComboboxRoot, ComboboxStatus, ComboboxTrigger, ComboboxValue };
|
|
198
209
|
|
|
199
210
|
//# sourceMappingURL=combobox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.js","names":["ComboboxRoot","Field","BaseCombobox","BaseField","Combobox"],"sources":["../../../src/components/combobox/combobox.tsx"],"sourcesContent":["\"use client\";\n\nimport { Combobox as BaseCombobox } from \"@base-ui/react/combobox\";\nimport { forwardRef, createContext, useContext } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\nimport type { ComboboxRoot as BaseComboboxRoot } from \"@base-ui/react/combobox\";\nimport { Field as BaseField } from \"@base-ui/react/field\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { combobox } from \"../../styled-system/recipes\";\nimport { Field } from \"../field\";\nimport { withRecipeClassName } from \"../base-ui\";\n\nexport type ComboboxSize = \"sm\" | \"md\" | \"lg\";\n\nconst ComboboxSizeContext = createContext<ComboboxSize>(\"md\");\n\nfunction useComboboxStyles() {\n return combobox({ size: useContext(ComboboxSizeContext) });\n}\n\nexport interface ComboboxRootProps<Value, Multiple extends boolean | undefined = false>\n extends Omit<BaseComboboxRoot.Props<Value, Multiple>, \"children\" | \"className\"> {\n /** Visual size shared by the input and trigger. */\n size?: ComboboxSize;\n /** Marks the field invalid when an external validator owns its state. */\n invalid?: boolean;\n /** Direct error content rendered through the surrounding Field context. */\n errors?: ReactNode | ReactNode[];\n children?: ReactNode;\n className?: string;\n}\n\n/**\n * A searchable Base UI combobox with Field integration. It supports the\n * controlled `value`/`onValueChange` and uncontrolled `defaultValue` APIs,\n * object values, grouped items, filtering and multiple selection.\n */\nexport function ComboboxRoot<Value = string, Multiple extends boolean | undefined = false>({\n children,\n className,\n errors,\n invalid,\n name,\n size = \"md\",\n ...props\n}: ComboboxRootProps<Value, Multiple>) {\n const styles = combobox({ size });\n const fieldProps = {\n className: cx(styles.root, className),\n ...(errors === undefined ? {} : { errors }),\n ...(invalid === undefined ? {} : { invalid }),\n ...(name === undefined ? {} : { name }),\n };\n\n return (\n <ComboboxSizeContext.Provider value={size}>\n <Field {...fieldProps}>\n <BaseCombobox.Root {...props} {...(name === undefined ? {} : { name })}>\n {children}\n </BaseCombobox.Root>\n </Field>\n </ComboboxSizeContext.Provider>\n );\n}\n\nexport type ComboboxLabelProps = ComponentPropsWithoutRef<typeof BaseField.Label>;\n\nexport const ComboboxLabel = forwardRef<HTMLElement, ComboboxLabelProps>(function ComboboxLabel(\n { className, ...props },\n ref,\n) {\n return (\n <BaseField.Label\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().label, className)}\n data-slot=\"combobox-label\"\n />\n );\n});\n\nexport type ComboboxInputGroupProps = ComponentPropsWithoutRef<typeof BaseCombobox.InputGroup>;\n\nexport const ComboboxInputGroup = forwardRef<HTMLDivElement, ComboboxInputGroupProps>(\n function ComboboxInputGroup({ className, ...props }, ref) {\n return (\n <BaseCombobox.InputGroup\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().inputGroup, className)}\n data-slot=\"combobox-input-group\"\n />\n );\n },\n);\n\nexport type ComboboxInputProps = ComponentPropsWithoutRef<typeof BaseCombobox.Input>;\n\nexport const ComboboxInput = forwardRef<HTMLInputElement, ComboboxInputProps>(\n function ComboboxInput({ className, ...props }, ref) {\n return (\n <BaseCombobox.Input\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().input, className)}\n data-jaci-component=\"combobox\"\n data-slot=\"combobox-input\"\n />\n );\n },\n);\n\nexport type ComboboxTriggerProps = ComponentPropsWithoutRef<typeof BaseCombobox.Trigger>;\n\nexport const ComboboxTrigger = forwardRef<HTMLButtonElement, ComboboxTriggerProps>(\n function ComboboxTrigger({ className, ...props }, ref) {\n return (\n <BaseCombobox.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().trigger, className)}\n data-slot=\"combobox-trigger\"\n />\n );\n },\n);\n\nexport type ComboboxIconProps = ComponentPropsWithoutRef<typeof BaseCombobox.Icon>;\n\nexport const ComboboxIcon = forwardRef<HTMLSpanElement, ComboboxIconProps>(function ComboboxIcon(\n { children = \"⌄\", className, ...props },\n ref,\n) {\n return (\n <BaseCombobox.Icon\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().icon, className)}\n data-slot=\"combobox-icon\"\n >\n {children}\n </BaseCombobox.Icon>\n );\n});\n\nexport type ComboboxValueProps = ComponentPropsWithoutRef<typeof BaseCombobox.Value>;\nexport const ComboboxValue = BaseCombobox.Value;\n\nexport const ComboboxPortal = BaseCombobox.Portal;\n\nexport type ComboboxPositionerProps = ComponentPropsWithoutRef<typeof BaseCombobox.Positioner>;\nexport const ComboboxPositioner = forwardRef<HTMLDivElement, ComboboxPositionerProps>(\n function ComboboxPositioner({ className, ...props }, ref) {\n return (\n <BaseCombobox.Positioner\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().positioner, className)}\n data-slot=\"combobox-positioner\"\n />\n );\n },\n);\n\nexport type ComboboxPopupProps = ComponentPropsWithoutRef<typeof BaseCombobox.Popup>;\nexport const ComboboxPopup = forwardRef<HTMLDivElement, ComboboxPopupProps>(function ComboboxPopup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseCombobox.Popup\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().popup, className)}\n data-slot=\"combobox-popup\"\n />\n );\n});\n\nexport type ComboboxListProps = ComponentPropsWithoutRef<typeof BaseCombobox.List>;\nexport const ComboboxList = forwardRef<HTMLDivElement, ComboboxListProps>(function ComboboxList(\n { className, ...props },\n ref,\n) {\n return (\n <BaseCombobox.List\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().list, className)}\n data-slot=\"combobox-list\"\n />\n );\n});\n\nexport type ComboboxItemProps = ComponentPropsWithoutRef<typeof BaseCombobox.Item>;\nexport const ComboboxItem = forwardRef<HTMLDivElement, ComboboxItemProps>(function ComboboxItem(\n { className, ...props },\n ref,\n) {\n return (\n <BaseCombobox.Item\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().item, className)}\n data-slot=\"combobox-item\"\n />\n );\n});\n\nexport type ComboboxItemIndicatorProps = ComponentPropsWithoutRef<\n typeof BaseCombobox.ItemIndicator\n>;\nexport const ComboboxItemIndicator = forwardRef<HTMLSpanElement, ComboboxItemIndicatorProps>(\n function ComboboxItemIndicator({ children = \"✓\", className, ...props }, ref) {\n return (\n <BaseCombobox.ItemIndicator\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().itemIndicator, className)}\n data-slot=\"combobox-item-indicator\"\n >\n {children}\n </BaseCombobox.ItemIndicator>\n );\n },\n);\n\nexport type ComboboxGroupProps = ComponentPropsWithoutRef<typeof BaseCombobox.Group>;\nexport const ComboboxGroup = forwardRef<HTMLDivElement, ComboboxGroupProps>(function ComboboxGroup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseCombobox.Group\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().group, className)}\n data-slot=\"combobox-group\"\n />\n );\n});\n\nexport type ComboboxGroupLabelProps = ComponentPropsWithoutRef<typeof BaseCombobox.GroupLabel>;\nexport const ComboboxGroupLabel = forwardRef<HTMLDivElement, ComboboxGroupLabelProps>(\n function ComboboxGroupLabel({ className, ...props }, ref) {\n return (\n <BaseCombobox.GroupLabel\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().groupLabel, className)}\n data-slot=\"combobox-group-label\"\n />\n );\n },\n);\n\nexport type ComboboxEmptyProps = ComponentPropsWithoutRef<typeof BaseCombobox.Empty>;\nexport const ComboboxEmpty = forwardRef<HTMLDivElement, ComboboxEmptyProps>(function ComboboxEmpty(\n { className, ...props },\n ref,\n) {\n return (\n <BaseCombobox.Empty\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().empty, className)}\n data-slot=\"combobox-empty\"\n />\n );\n});\n\nexport type ComboboxClearProps = ComponentPropsWithoutRef<typeof BaseCombobox.Clear>;\nexport const ComboboxClear = forwardRef<HTMLButtonElement, ComboboxClearProps>(\n function ComboboxClear({ children = \"×\", className, ...props }, ref) {\n return (\n <BaseCombobox.Clear\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().clear, className)}\n data-slot=\"combobox-clear\"\n aria-label={props[\"aria-label\"] ?? \"Clear selection\"}\n >\n {children}\n </BaseCombobox.Clear>\n );\n },\n);\n\nexport type ComboboxStatusProps = ComponentPropsWithoutRef<typeof BaseCombobox.Status>;\nexport const ComboboxStatus = forwardRef<HTMLDivElement, ComboboxStatusProps>(\n function ComboboxStatus({ className, ...props }, ref) {\n return (\n <BaseCombobox.Status\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().status, className)}\n data-slot=\"combobox-status\"\n />\n );\n },\n);\n\nexport type ComboboxArrowProps = ComponentPropsWithoutRef<typeof BaseCombobox.Arrow>;\nexport const ComboboxArrow = forwardRef<HTMLDivElement, ComboboxArrowProps>(function ComboboxArrow(\n { className, ...props },\n ref,\n) {\n return (\n <BaseCombobox.Arrow\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().arrow, className)}\n data-slot=\"combobox-arrow\"\n />\n );\n});\n\nexport const Combobox = {\n Root: ComboboxRoot,\n Label: ComboboxLabel,\n InputGroup: ComboboxInputGroup,\n Input: ComboboxInput,\n Trigger: ComboboxTrigger,\n Icon: ComboboxIcon,\n Value: ComboboxValue,\n Portal: ComboboxPortal,\n Positioner: ComboboxPositioner,\n Popup: ComboboxPopup,\n List: ComboboxList,\n Item: ComboboxItem,\n ItemIndicator: ComboboxItemIndicator,\n Group: ComboboxGroup,\n GroupLabel: ComboboxGroupLabel,\n Empty: ComboboxEmpty,\n Clear: ComboboxClear,\n Status: ComboboxStatus,\n Arrow: ComboboxArrow,\n useFilter: BaseCombobox.useFilter,\n};\n"],"mappings":";;;;;;;;;;AAeA,MAAM,sBAAsB,cAA4B,IAAI;AAE5D,SAAS,oBAAoB;CAC3B,OAAO,SAAS,EAAE,MAAM,WAAW,mBAAmB,EAAE,CAAC;AAC3D;;;;;;AAmBA,SAAgBA,eAA2E,EACzF,UACA,WACA,QACA,SACA,MACA,OAAO,MACP,GAAG,SACkC;CAErC,MAAM,aAAa;EACjB,WAAW,GAFE,SAAS,EAAE,KAAK,CAEV,CAAC,CAAC,MAAM,SAAS;EACpC,GAAI,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO;EACzC,GAAI,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ;EAC3C,GAAI,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,KAAK;CACvC;CAEA,OACE,oBAAC,oBAAoB,UAArB;EAA8B,OAAO;YACnC,oBAACC,SAAD;GAAO,GAAI;aACT,oBAACC,SAAa,MAAd;IAAmB,GAAI;IAAO,GAAK,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,KAAK;IACjE;GACgB,CAAA;EACd,CAAA;CACqB,CAAA;AAElC;AAIA,MAAa,gBAAgB,WAA4C,SAAS,cAChF,EAAE,WAAW,GAAG,SAChB,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gBAAgB,WAA+C,SAAS,cACnF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,oBAACA,SAAa,OAAd;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,kBAAkB,CAAC,CAAC,OAAO,SAAS;EACnE,aAAU;CACX,CAAA;AAEL,CAAC;AAGD,MAAa,gBAAgB,WAC3B,SAAS,cAAc,EAAE,WAAW,KAAK,WAAW,GAAG,SAAS,KAAK;CACnE,OACE,oBAACA,SAAa,OAAd;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,kBAAkB,CAAC,CAAC,OAAO,SAAS;EACnE,aAAU;EACV,cAAY,MAAM,iBAAiB;EAElC;CACiB,CAAA;AAExB,CACF;AAGA,MAAa,iBAAiB,WAC5B,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,OACE,oBAACA,SAAa,QAAd;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,kBAAkB,CAAC,CAAC,QAAQ,SAAS;EACpE,aAAU;CACX,CAAA;AAEL,CACF;AAGA,MAAa,gBAAgB,WAA+C,SAAS,cACnF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,oBAACA,SAAa,OAAd;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,kBAAkB,CAAC,CAAC,OAAO,SAAS;EACnE,aAAU;CACX,CAAA;AAEL,CAAC;AAED,MAAaE,aAAW;CACtB,MAAMJ;CACN,OAAO;CACP,YAAY;CACZ,OAAO;CACP,SAAS;CACT,MAAM;CACN,OAAO;CACP,QAAQ;CACR,YAAY;CACZ,OAAO;CACP,MAAM;CACN,MAAM;CACN,eAAe;CACf,OAAO;CACP,YAAY;CACZ,OAAO;CACP,OAAO;CACP,QAAQ;CACR,OAAO;CACP,WAAWE,SAAa;AAC1B"}
|
|
1
|
+
{"version":3,"file":"combobox.js","names":["ComboboxRoot","Field","BaseCombobox","BaseField","Combobox"],"sources":["../../../src/components/combobox/combobox.tsx"],"sourcesContent":["\"use client\";\n\nimport { Combobox as BaseCombobox } from \"@base-ui/react/combobox\";\nimport { forwardRef, createContext, useContext } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\nimport type { ComboboxRoot as BaseComboboxRoot } from \"@base-ui/react/combobox\";\nimport { Field as BaseField } from \"@base-ui/react/field\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { combobox } from \"../../styled-system/recipes\";\nimport { Field } from \"../field\";\nimport { withRecipeClassName } from \"../base-ui\";\n\nexport type ComboboxSize = \"sm\" | \"md\" | \"lg\";\n\nconst ComboboxSizeContext = createContext<ComboboxSize>(\"md\");\n\nfunction useComboboxStyles() {\n return combobox({ size: useContext(ComboboxSizeContext) });\n}\n\nexport interface ComboboxRootProps<Value, Multiple extends boolean | undefined = false>\n extends Omit<BaseComboboxRoot.Props<Value, Multiple>, \"children\" | \"className\"> {\n /** Visual size shared by the input and trigger. */\n size?: ComboboxSize;\n /** Marks the field invalid when an external validator owns its state. */\n invalid?: boolean;\n /** Shows a loading state through the optional Loading slot. */\n loading?: boolean;\n /** Direct error content rendered through the surrounding Field context. */\n errors?: ReactNode | ReactNode[];\n children?: ReactNode;\n className?: string;\n}\n\n/**\n * A searchable Base UI combobox with Field integration. It supports the\n * controlled `value`/`onValueChange` and uncontrolled `defaultValue` APIs,\n * object values, grouped items, filtering and multiple selection.\n */\nexport function ComboboxRoot<Value = string, Multiple extends boolean | undefined = false>({\n children,\n className,\n errors,\n invalid,\n loading: _loading,\n name,\n size = \"md\",\n ...props\n}: ComboboxRootProps<Value, Multiple>) {\n const styles = combobox({ size });\n const fieldProps = {\n className: cx(styles.root, className),\n ...(errors === undefined ? {} : { errors }),\n ...(invalid === undefined ? {} : { invalid }),\n ...(name === undefined ? {} : { name }),\n };\n\n return (\n <ComboboxSizeContext.Provider value={size}>\n <Field {...fieldProps}>\n <BaseCombobox.Root {...props} {...(name === undefined ? {} : { name })}>\n {children}\n </BaseCombobox.Root>\n </Field>\n </ComboboxSizeContext.Provider>\n );\n}\n\nexport type ComboboxLabelProps = ComponentPropsWithoutRef<typeof BaseField.Label>;\n\nexport const ComboboxLabel = forwardRef<HTMLElement, ComboboxLabelProps>(function ComboboxLabel(\n { className, ...props },\n ref,\n) {\n return (\n <BaseField.Label\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().label, className)}\n data-slot=\"combobox-label\"\n />\n );\n});\n\nexport type ComboboxInputGroupProps = ComponentPropsWithoutRef<typeof BaseCombobox.InputGroup>;\n\nexport const ComboboxInputGroup = forwardRef<HTMLDivElement, ComboboxInputGroupProps>(\n function ComboboxInputGroup({ className, ...props }, ref) {\n return (\n <BaseCombobox.InputGroup\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().inputGroup, className)}\n data-slot=\"combobox-input-group\"\n />\n );\n },\n);\n\nexport type ComboboxInputProps = ComponentPropsWithoutRef<typeof BaseCombobox.Input>;\n\nexport const ComboboxInput = forwardRef<HTMLInputElement, ComboboxInputProps>(\n function ComboboxInput({ className, ...props }, ref) {\n return (\n <BaseCombobox.Input\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().input, className)}\n data-jaci-component=\"combobox\"\n data-slot=\"combobox-input\"\n />\n );\n },\n);\n\nexport type ComboboxTriggerProps = ComponentPropsWithoutRef<typeof BaseCombobox.Trigger>;\n\nexport const ComboboxTrigger = forwardRef<HTMLButtonElement, ComboboxTriggerProps>(\n function ComboboxTrigger({ className, ...props }, ref) {\n return (\n <BaseCombobox.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().trigger, className)}\n data-slot=\"combobox-trigger\"\n />\n );\n },\n);\n\nexport type ComboboxIconProps = ComponentPropsWithoutRef<typeof BaseCombobox.Icon>;\n\nexport const ComboboxIcon = forwardRef<HTMLSpanElement, ComboboxIconProps>(function ComboboxIcon(\n { children = \"⌄\", className, ...props },\n ref,\n) {\n return (\n <BaseCombobox.Icon\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().icon, className)}\n data-slot=\"combobox-icon\"\n >\n {children}\n </BaseCombobox.Icon>\n );\n});\n\nexport type ComboboxValueProps = ComponentPropsWithoutRef<typeof BaseCombobox.Value>;\nexport const ComboboxValue = BaseCombobox.Value;\n\nexport const ComboboxPortal = BaseCombobox.Portal;\n\nexport type ComboboxPositionerProps = ComponentPropsWithoutRef<typeof BaseCombobox.Positioner>;\nexport const ComboboxPositioner = forwardRef<HTMLDivElement, ComboboxPositionerProps>(\n function ComboboxPositioner({ className, ...props }, ref) {\n return (\n <BaseCombobox.Positioner\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().positioner, className)}\n data-slot=\"combobox-positioner\"\n />\n );\n },\n);\n\nexport type ComboboxPopupProps = ComponentPropsWithoutRef<typeof BaseCombobox.Popup>;\nexport const ComboboxPopup = forwardRef<HTMLDivElement, ComboboxPopupProps>(function ComboboxPopup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseCombobox.Popup\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().popup, className)}\n data-slot=\"combobox-popup\"\n />\n );\n});\n\nexport type ComboboxListProps = ComponentPropsWithoutRef<typeof BaseCombobox.List>;\nexport const ComboboxList = forwardRef<HTMLDivElement, ComboboxListProps>(function ComboboxList(\n { className, ...props },\n ref,\n) {\n return (\n <BaseCombobox.List\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().list, className)}\n data-slot=\"combobox-list\"\n />\n );\n});\n\nexport type ComboboxItemProps = ComponentPropsWithoutRef<typeof BaseCombobox.Item>;\nexport const ComboboxItem = forwardRef<HTMLDivElement, ComboboxItemProps>(function ComboboxItem(\n { className, ...props },\n ref,\n) {\n return (\n <BaseCombobox.Item\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().item, className)}\n data-slot=\"combobox-item\"\n />\n );\n});\n\nexport type ComboboxItemIndicatorProps = ComponentPropsWithoutRef<\n typeof BaseCombobox.ItemIndicator\n>;\nexport const ComboboxItemIndicator = forwardRef<HTMLSpanElement, ComboboxItemIndicatorProps>(\n function ComboboxItemIndicator({ children = \"✓\", className, ...props }, ref) {\n return (\n <BaseCombobox.ItemIndicator\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().itemIndicator, className)}\n data-slot=\"combobox-item-indicator\"\n >\n {children}\n </BaseCombobox.ItemIndicator>\n );\n },\n);\n\nexport type ComboboxGroupProps = ComponentPropsWithoutRef<typeof BaseCombobox.Group>;\nexport const ComboboxGroup = forwardRef<HTMLDivElement, ComboboxGroupProps>(function ComboboxGroup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseCombobox.Group\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().group, className)}\n data-slot=\"combobox-group\"\n />\n );\n});\n\nexport type ComboboxGroupLabelProps = ComponentPropsWithoutRef<typeof BaseCombobox.GroupLabel>;\nexport const ComboboxGroupLabel = forwardRef<HTMLDivElement, ComboboxGroupLabelProps>(\n function ComboboxGroupLabel({ className, ...props }, ref) {\n return (\n <BaseCombobox.GroupLabel\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().groupLabel, className)}\n data-slot=\"combobox-group-label\"\n />\n );\n },\n);\n\nexport type ComboboxEmptyProps = ComponentPropsWithoutRef<typeof BaseCombobox.Empty>;\nexport const ComboboxEmpty = forwardRef<HTMLDivElement, ComboboxEmptyProps>(function ComboboxEmpty(\n { className, ...props },\n ref,\n) {\n return (\n <BaseCombobox.Empty\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().empty, className)}\n data-slot=\"combobox-empty\"\n />\n );\n});\n\nexport type ComboboxClearProps = ComponentPropsWithoutRef<typeof BaseCombobox.Clear>;\nexport const ComboboxClear = forwardRef<HTMLButtonElement, ComboboxClearProps>(\n function ComboboxClear({ children = \"×\", className, ...props }, ref) {\n return (\n <BaseCombobox.Clear\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().clear, className)}\n data-slot=\"combobox-clear\"\n aria-label={props[\"aria-label\"] ?? \"Clear selection\"}\n >\n {children}\n </BaseCombobox.Clear>\n );\n },\n);\n\nexport type ComboboxLoadingProps = ComponentPropsWithoutRef<\"div\">;\nexport const ComboboxLoading = forwardRef<HTMLDivElement, ComboboxLoadingProps>(\n function ComboboxLoading({ children = \"Loading…\", className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n aria-live=\"polite\"\n className={cx(useComboboxStyles().loading, className)}\n data-slot=\"combobox-loading\"\n >\n {children}\n </div>\n );\n },\n);\n\nexport type ComboboxStatusProps = ComponentPropsWithoutRef<typeof BaseCombobox.Status>;\nexport const ComboboxStatus = forwardRef<HTMLDivElement, ComboboxStatusProps>(\n function ComboboxStatus({ className, ...props }, ref) {\n return (\n <BaseCombobox.Status\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().status, className)}\n data-slot=\"combobox-status\"\n />\n );\n },\n);\n\nexport type ComboboxArrowProps = ComponentPropsWithoutRef<typeof BaseCombobox.Arrow>;\nexport const ComboboxArrow = forwardRef<HTMLDivElement, ComboboxArrowProps>(function ComboboxArrow(\n { className, ...props },\n ref,\n) {\n return (\n <BaseCombobox.Arrow\n {...props}\n ref={ref}\n className={withRecipeClassName(useComboboxStyles().arrow, className)}\n data-slot=\"combobox-arrow\"\n />\n );\n});\n\nexport const Combobox = {\n Root: ComboboxRoot,\n Label: ComboboxLabel,\n InputGroup: ComboboxInputGroup,\n Input: ComboboxInput,\n Trigger: ComboboxTrigger,\n Icon: ComboboxIcon,\n Value: ComboboxValue,\n Portal: ComboboxPortal,\n Positioner: ComboboxPositioner,\n Popup: ComboboxPopup,\n List: ComboboxList,\n Item: ComboboxItem,\n ItemIndicator: ComboboxItemIndicator,\n Group: ComboboxGroup,\n GroupLabel: ComboboxGroupLabel,\n Empty: ComboboxEmpty,\n Loading: ComboboxLoading,\n Clear: ComboboxClear,\n Status: ComboboxStatus,\n Arrow: ComboboxArrow,\n useFilter: BaseCombobox.useFilter,\n};\n"],"mappings":";;;;;;;;;;AAe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AAY,WAAW,GAAG,SAAS,KAAK;CAC5E,OACE,oBAAC,OAAD;EACE,GAAI;EACC;EACL,aAAU;EACV,WAAW,GAAG,kBAAkB,CAAC,CAAC,SAAS,SAAS;EACpD,aAAU;EAET;CACE,CAAA;AAET,CACF;AAGA,MAAa,iBAAiB,WAC5B,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,OACE,oBAACA,SAAa,QAAd;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,kBAAkB,CAAC,CAAC,QAAQ,SAAS;EACpE,aAAU;CACX,CAAA;AAEL,CACF;AAGA,MAAa,gBAAgB,WAA+C,SAAS,cACnF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,oBAACA,SAAa,OAAd;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,kBAAkB,CAAC,CAAC,OAAO,SAAS;EACnE,aAAU;CACX,CAAA;AAEL,CAAC;AAED,MAAaE,aAAW;CACtB,MAAMJ;CACN,OAAO;CACP,YAAY;CACZ,OAAO;CACP,SAAS;CACT,MAAM;CACN,OAAO;CACP,QAAQ;CACR,YAAY;CACZ,OAAO;CACP,MAAM;CACN,MAAM;CACN,eAAe;CACf,OAAO;CACP,YAAY;CACZ,OAAO;CACP,SAAS;CACT,OAAO;CACP,QAAQ;CACR,OAAO;CACP,WAAWE,SAAa;AAC1B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Combobox, ComboboxArrow, ComboboxArrowProps, ComboboxClear, ComboboxClearProps, ComboboxEmpty, ComboboxEmptyProps, ComboboxGroup, ComboboxGroupLabel, ComboboxGroupLabelProps, ComboboxGroupProps, ComboboxIcon, ComboboxIconProps, ComboboxInput, ComboboxInputGroup, ComboboxInputGroupProps, ComboboxInputProps, ComboboxItem, ComboboxItemIndicator, ComboboxItemIndicatorProps, ComboboxItemProps, ComboboxLabel, ComboboxLabelProps, ComboboxList, ComboboxListProps, ComboboxPopup, ComboboxPopupProps, ComboboxPortal, ComboboxPositioner, ComboboxPositionerProps, ComboboxRoot, ComboboxRootProps, ComboboxSize, ComboboxStatus, ComboboxStatusProps, ComboboxTrigger, ComboboxTriggerProps, ComboboxValue, ComboboxValueProps } from "./combobox.cjs";
|
|
2
|
-
export { Combobox, ComboboxArrow, type ComboboxArrowProps, ComboboxClear, type ComboboxClearProps, ComboboxEmpty, type ComboboxEmptyProps, ComboboxGroup, ComboboxGroupLabel, type ComboboxGroupLabelProps, type ComboboxGroupProps, ComboboxIcon, type ComboboxIconProps, ComboboxInput, ComboboxInputGroup, type ComboboxInputGroupProps, type ComboboxInputProps, ComboboxItem, ComboboxItemIndicator, type ComboboxItemIndicatorProps, type ComboboxItemProps, ComboboxLabel, type ComboboxLabelProps, ComboboxList, type ComboboxListProps, ComboboxPopup, type ComboboxPopupProps, ComboboxPortal, ComboboxPositioner, type ComboboxPositionerProps, ComboboxRoot, type ComboboxRootProps, type ComboboxSize, ComboboxStatus, type ComboboxStatusProps, ComboboxTrigger, type ComboboxTriggerProps, ComboboxValue, type ComboboxValueProps };
|
|
1
|
+
import { Combobox, ComboboxArrow, ComboboxArrowProps, ComboboxClear, ComboboxClearProps, ComboboxEmpty, ComboboxEmptyProps, ComboboxGroup, ComboboxGroupLabel, ComboboxGroupLabelProps, ComboboxGroupProps, ComboboxIcon, ComboboxIconProps, ComboboxInput, ComboboxInputGroup, ComboboxInputGroupProps, ComboboxInputProps, ComboboxItem, ComboboxItemIndicator, ComboboxItemIndicatorProps, ComboboxItemProps, ComboboxLabel, ComboboxLabelProps, ComboboxList, ComboboxListProps, ComboboxLoading, ComboboxLoadingProps, ComboboxPopup, ComboboxPopupProps, ComboboxPortal, ComboboxPositioner, ComboboxPositionerProps, ComboboxRoot, ComboboxRootProps, ComboboxSize, ComboboxStatus, ComboboxStatusProps, ComboboxTrigger, ComboboxTriggerProps, ComboboxValue, ComboboxValueProps } from "./combobox.cjs";
|
|
2
|
+
export { Combobox, ComboboxArrow, type ComboboxArrowProps, ComboboxClear, type ComboboxClearProps, ComboboxEmpty, type ComboboxEmptyProps, ComboboxGroup, ComboboxGroupLabel, type ComboboxGroupLabelProps, type ComboboxGroupProps, ComboboxIcon, type ComboboxIconProps, ComboboxInput, ComboboxInputGroup, type ComboboxInputGroupProps, type ComboboxInputProps, ComboboxItem, ComboboxItemIndicator, type ComboboxItemIndicatorProps, type ComboboxItemProps, ComboboxLabel, type ComboboxLabelProps, ComboboxList, type ComboboxListProps, ComboboxLoading, type ComboboxLoadingProps, ComboboxPopup, type ComboboxPopupProps, ComboboxPortal, ComboboxPositioner, type ComboboxPositionerProps, ComboboxRoot, type ComboboxRootProps, type ComboboxSize, ComboboxStatus, type ComboboxStatusProps, ComboboxTrigger, type ComboboxTriggerProps, ComboboxValue, type ComboboxValueProps };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Combobox, ComboboxArrow, ComboboxArrowProps, ComboboxClear, ComboboxClearProps, ComboboxEmpty, ComboboxEmptyProps, ComboboxGroup, ComboboxGroupLabel, ComboboxGroupLabelProps, ComboboxGroupProps, ComboboxIcon, ComboboxIconProps, ComboboxInput, ComboboxInputGroup, ComboboxInputGroupProps, ComboboxInputProps, ComboboxItem, ComboboxItemIndicator, ComboboxItemIndicatorProps, ComboboxItemProps, ComboboxLabel, ComboboxLabelProps, ComboboxList, ComboboxListProps, ComboboxPopup, ComboboxPopupProps, ComboboxPortal, ComboboxPositioner, ComboboxPositionerProps, ComboboxRoot, ComboboxRootProps, ComboboxSize, ComboboxStatus, ComboboxStatusProps, ComboboxTrigger, ComboboxTriggerProps, ComboboxValue, ComboboxValueProps } from "./combobox.js";
|
|
2
|
-
export { Combobox, ComboboxArrow, type ComboboxArrowProps, ComboboxClear, type ComboboxClearProps, ComboboxEmpty, type ComboboxEmptyProps, ComboboxGroup, ComboboxGroupLabel, type ComboboxGroupLabelProps, type ComboboxGroupProps, ComboboxIcon, type ComboboxIconProps, ComboboxInput, ComboboxInputGroup, type ComboboxInputGroupProps, type ComboboxInputProps, ComboboxItem, ComboboxItemIndicator, type ComboboxItemIndicatorProps, type ComboboxItemProps, ComboboxLabel, type ComboboxLabelProps, ComboboxList, type ComboboxListProps, ComboboxPopup, type ComboboxPopupProps, ComboboxPortal, ComboboxPositioner, type ComboboxPositionerProps, ComboboxRoot, type ComboboxRootProps, type ComboboxSize, ComboboxStatus, type ComboboxStatusProps, ComboboxTrigger, type ComboboxTriggerProps, ComboboxValue, type ComboboxValueProps };
|
|
1
|
+
import { Combobox, ComboboxArrow, ComboboxArrowProps, ComboboxClear, ComboboxClearProps, ComboboxEmpty, ComboboxEmptyProps, ComboboxGroup, ComboboxGroupLabel, ComboboxGroupLabelProps, ComboboxGroupProps, ComboboxIcon, ComboboxIconProps, ComboboxInput, ComboboxInputGroup, ComboboxInputGroupProps, ComboboxInputProps, ComboboxItem, ComboboxItemIndicator, ComboboxItemIndicatorProps, ComboboxItemProps, ComboboxLabel, ComboboxLabelProps, ComboboxList, ComboboxListProps, ComboboxLoading, ComboboxLoadingProps, ComboboxPopup, ComboboxPopupProps, ComboboxPortal, ComboboxPositioner, ComboboxPositionerProps, ComboboxRoot, ComboboxRootProps, ComboboxSize, ComboboxStatus, ComboboxStatusProps, ComboboxTrigger, ComboboxTriggerProps, ComboboxValue, ComboboxValueProps } from "./combobox.js";
|
|
2
|
+
export { Combobox, ComboboxArrow, type ComboboxArrowProps, ComboboxClear, type ComboboxClearProps, ComboboxEmpty, type ComboboxEmptyProps, ComboboxGroup, ComboboxGroupLabel, type ComboboxGroupLabelProps, type ComboboxGroupProps, ComboboxIcon, type ComboboxIconProps, ComboboxInput, ComboboxInputGroup, type ComboboxInputGroupProps, type ComboboxInputProps, ComboboxItem, ComboboxItemIndicator, type ComboboxItemIndicatorProps, type ComboboxItemProps, ComboboxLabel, type ComboboxLabelProps, ComboboxList, type ComboboxListProps, ComboboxLoading, type ComboboxLoadingProps, ComboboxPopup, type ComboboxPopupProps, ComboboxPortal, ComboboxPositioner, type ComboboxPositionerProps, ComboboxRoot, type ComboboxRootProps, type ComboboxSize, ComboboxStatus, type ComboboxStatusProps, ComboboxTrigger, type ComboboxTriggerProps, ComboboxValue, type ComboboxValueProps };
|
|
@@ -1,27 +1,48 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
const require_cx = require("../../styled-system/css/cx.cjs");
|
|
3
3
|
const require_input = require("../../styled-system/recipes/input.cjs");
|
|
4
|
+
const require_index = require("../layout/index.cjs");
|
|
4
5
|
const require_field = require("../field/field.cjs");
|
|
6
|
+
const require_input_group = require("../input-group/input-group.cjs");
|
|
5
7
|
let react = require("react");
|
|
6
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
-
let _base_ui_react_field = require("@base-ui/react/field");
|
|
8
9
|
//#region src/components/controls/input.tsx
|
|
9
|
-
const Input = (0, react.forwardRef)(function Input({ className, size = "md", ...props }, ref) {
|
|
10
|
+
const Input = (0, react.forwardRef)(function Input({ className, loading = false, prefix, size = "md", suffix, ...props }, ref) {
|
|
10
11
|
const { insideField } = require_field.useFieldState();
|
|
11
12
|
const controlProps = {
|
|
12
13
|
...props,
|
|
14
|
+
"aria-busy": loading || void 0,
|
|
13
15
|
className: require_cx.cx(require_input.input({ size }), className),
|
|
14
16
|
"data-jaci-component": "input",
|
|
17
|
+
"data-loading": loading || void 0,
|
|
15
18
|
"data-slot": "input"
|
|
16
19
|
};
|
|
17
|
-
|
|
20
|
+
const control = insideField ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_field.FieldControl, {
|
|
18
21
|
...controlProps,
|
|
19
22
|
ref
|
|
20
|
-
})
|
|
21
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
23
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
22
24
|
...controlProps,
|
|
23
25
|
ref
|
|
24
26
|
});
|
|
27
|
+
if (prefix !== void 0 || suffix !== void 0 || loading) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_input_group.InputGroup, { children: [
|
|
28
|
+
prefix !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_input_group.InputGroup.Addon, {
|
|
29
|
+
"data-slot": "input-prefix",
|
|
30
|
+
children: prefix
|
|
31
|
+
}) : null,
|
|
32
|
+
control,
|
|
33
|
+
loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_input_group.InputGroup.Addon, {
|
|
34
|
+
"aria-hidden": "true",
|
|
35
|
+
"data-slot": "input-loading",
|
|
36
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.Spinner, {
|
|
37
|
+
label: "",
|
|
38
|
+
size: "sm"
|
|
39
|
+
})
|
|
40
|
+
}) : suffix !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_input_group.InputGroup.Addon, {
|
|
41
|
+
"data-slot": "input-suffix",
|
|
42
|
+
children: suffix
|
|
43
|
+
}) : null
|
|
44
|
+
] });
|
|
45
|
+
return control;
|
|
25
46
|
});
|
|
26
47
|
//#endregion
|
|
27
48
|
exports.Input = Input;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.cjs","names":["useFieldState","cx","input","
|
|
1
|
+
{"version":3,"file":"input.cjs","names":["useFieldState","cx","input","FieldControl","InputGroup","Spinner"],"sources":["../../../src/components/controls/input.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, Ref } from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { input } from \"../../styled-system/recipes\";\nimport { FieldControl, useFieldState } from \"../field\";\nimport { InputGroup } from \"../input-group\";\nimport { Spinner } from \"../layout\";\n\nexport interface InputProps extends Omit<ComponentPropsWithoutRef<\"input\">, \"prefix\" | \"size\"> {\n size?: \"sm\" | \"md\" | \"lg\";\n prefix?: ReactNode;\n suffix?: ReactNode;\n loading?: boolean;\n}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n { className, loading = false, prefix, size = \"md\", suffix, ...props },\n ref,\n) {\n const { insideField } = useFieldState();\n const controlProps = {\n ...props,\n \"aria-busy\": loading || undefined,\n className: cx(input({ size }), className),\n \"data-jaci-component\": \"input\",\n \"data-loading\": loading || undefined,\n \"data-slot\": \"input\",\n };\n const control = insideField ? (\n <FieldControl {...controlProps} ref={ref as Ref<HTMLElement>} />\n ) : (\n <input {...controlProps} ref={ref} />\n );\n\n if (prefix !== undefined || suffix !== undefined || loading) {\n return (\n <InputGroup>\n {prefix !== undefined ? (\n <InputGroup.Addon data-slot=\"input-prefix\">{prefix}</InputGroup.Addon>\n ) : null}\n {control}\n {loading ? (\n <InputGroup.Addon aria-hidden=\"true\" data-slot=\"input-loading\">\n <Spinner label=\"\" size=\"sm\" />\n </InputGroup.Addon>\n ) : suffix !== undefined ? (\n <InputGroup.Addon data-slot=\"input-suffix\">{suffix}</InputGroup.Addon>\n ) : null}\n </InputGroup>\n );\n }\n\n return control;\n});\n"],"mappings":";;;;;;;;;AAmBA,MAAa,SAAA,GAAA,MAAA,WAAA,CAAiD,SAAS,MACrE,EAAE,WAAW,UAAU,OAAO,QAAQ,OAAO,MAAM,QAAQ,GAAG,SAC9D,KACA;CACA,MAAM,EAAE,gBAAgBA,cAAAA,cAAc;CACtC,MAAM,eAAe;EACnB,GAAG;EACH,aAAa,WAAW,KAAA;EACxB,WAAWC,WAAAA,GAAGC,cAAAA,MAAM,EAAE,KAAK,CAAC,GAAG,SAAS;EACxC,uBAAuB;EACvB,gBAAgB,WAAW,KAAA;EAC3B,aAAa;CACf;CACA,MAAM,UAAU,cACd,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,cAAD;EAAc,GAAI;EAAmB;CAA0B,CAAA,IAE/D,iBAAA,GAAA,kBAAA,IAAA,CAAC,SAAD;EAAO,GAAI;EAAmB;CAAM,CAAA;CAGtC,IAAI,WAAW,KAAA,KAAa,WAAW,KAAA,KAAa,SAClD,OACE,iBAAA,GAAA,kBAAA,KAAA,CAACC,oBAAAA,YAAD,EAAA,UAAA;EACG,WAAW,KAAA,IACV,iBAAA,GAAA,kBAAA,IAAA,CAACA,oBAAAA,WAAW,OAAZ;GAAkB,aAAU;aAAgB;EAAyB,CAAA,IACnE;EACH;EACA,UACC,iBAAA,GAAA,kBAAA,IAAA,CAACA,oBAAAA,WAAW,OAAZ;GAAkB,eAAY;GAAO,aAAU;aAC7C,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,SAAD;IAAS,OAAM;IAAG,MAAK;GAAM,CAAA;EACb,CAAA,IAChB,WAAW,KAAA,IACb,iBAAA,GAAA,kBAAA,IAAA,CAACD,oBAAAA,WAAW,OAAZ;GAAkB,aAAU;aAAgB;EAAyB,CAAA,IACnE;CACM,EAAA,CAAA;CAIhB,OAAO;AACT,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from "react";
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
2
|
//#region src/components/controls/input.d.ts
|
|
3
|
-
interface InputProps extends Omit<ComponentPropsWithoutRef<"input">, "size"> {
|
|
3
|
+
interface InputProps extends Omit<ComponentPropsWithoutRef<"input">, "prefix" | "size"> {
|
|
4
4
|
size?: "sm" | "md" | "lg";
|
|
5
|
+
prefix?: ReactNode;
|
|
6
|
+
suffix?: ReactNode;
|
|
7
|
+
loading?: boolean;
|
|
5
8
|
}
|
|
6
9
|
declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
7
10
|
//#endregion
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from "react";
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
2
|
//#region src/components/controls/input.d.ts
|
|
3
|
-
interface InputProps extends Omit<ComponentPropsWithoutRef<"input">, "size"> {
|
|
3
|
+
interface InputProps extends Omit<ComponentPropsWithoutRef<"input">, "prefix" | "size"> {
|
|
4
4
|
size?: "sm" | "md" | "lg";
|
|
5
|
+
prefix?: ReactNode;
|
|
6
|
+
suffix?: ReactNode;
|
|
7
|
+
loading?: boolean;
|
|
5
8
|
}
|
|
6
9
|
declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
7
10
|
//#endregion
|
|
@@ -1,27 +1,48 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx } from "../../styled-system/css/cx.js";
|
|
3
3
|
import { input } from "../../styled-system/recipes/input.js";
|
|
4
|
-
import {
|
|
4
|
+
import { Spinner } from "../layout/index.js";
|
|
5
|
+
import { FieldControl, useFieldState } from "../field/field.js";
|
|
6
|
+
import { InputGroup } from "../input-group/input-group.js";
|
|
5
7
|
import { forwardRef } from "react";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import { Field } from "@base-ui/react/field";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
//#region src/components/controls/input.tsx
|
|
9
|
-
const Input = forwardRef(function Input({ className, size = "md", ...props }, ref) {
|
|
10
|
+
const Input = forwardRef(function Input({ className, loading = false, prefix, size = "md", suffix, ...props }, ref) {
|
|
10
11
|
const { insideField } = useFieldState();
|
|
11
12
|
const controlProps = {
|
|
12
13
|
...props,
|
|
14
|
+
"aria-busy": loading || void 0,
|
|
13
15
|
className: cx(input({ size }), className),
|
|
14
16
|
"data-jaci-component": "input",
|
|
17
|
+
"data-loading": loading || void 0,
|
|
15
18
|
"data-slot": "input"
|
|
16
19
|
};
|
|
17
|
-
|
|
20
|
+
const control = insideField ? /* @__PURE__ */ jsx(FieldControl, {
|
|
18
21
|
...controlProps,
|
|
19
22
|
ref
|
|
20
|
-
})
|
|
21
|
-
return /* @__PURE__ */ jsx("input", {
|
|
23
|
+
}) : /* @__PURE__ */ jsx("input", {
|
|
22
24
|
...controlProps,
|
|
23
25
|
ref
|
|
24
26
|
});
|
|
27
|
+
if (prefix !== void 0 || suffix !== void 0 || loading) return /* @__PURE__ */ jsxs(InputGroup, { children: [
|
|
28
|
+
prefix !== void 0 ? /* @__PURE__ */ jsx(InputGroup.Addon, {
|
|
29
|
+
"data-slot": "input-prefix",
|
|
30
|
+
children: prefix
|
|
31
|
+
}) : null,
|
|
32
|
+
control,
|
|
33
|
+
loading ? /* @__PURE__ */ jsx(InputGroup.Addon, {
|
|
34
|
+
"aria-hidden": "true",
|
|
35
|
+
"data-slot": "input-loading",
|
|
36
|
+
children: /* @__PURE__ */ jsx(Spinner, {
|
|
37
|
+
label: "",
|
|
38
|
+
size: "sm"
|
|
39
|
+
})
|
|
40
|
+
}) : suffix !== void 0 ? /* @__PURE__ */ jsx(InputGroup.Addon, {
|
|
41
|
+
"data-slot": "input-suffix",
|
|
42
|
+
children: suffix
|
|
43
|
+
}) : null
|
|
44
|
+
] });
|
|
45
|
+
return control;
|
|
25
46
|
});
|
|
26
47
|
//#endregion
|
|
27
48
|
export { Input };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","names":[
|
|
1
|
+
{"version":3,"file":"input.js","names":[],"sources":["../../../src/components/controls/input.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, Ref } from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { input } from \"../../styled-system/recipes\";\nimport { FieldControl, useFieldState } from \"../field\";\nimport { InputGroup } from \"../input-group\";\nimport { Spinner } from \"../layout\";\n\nexport interface InputProps extends Omit<ComponentPropsWithoutRef<\"input\">, \"prefix\" | \"size\"> {\n size?: \"sm\" | \"md\" | \"lg\";\n prefix?: ReactNode;\n suffix?: ReactNode;\n loading?: boolean;\n}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n { className, loading = false, prefix, size = \"md\", suffix, ...props },\n ref,\n) {\n const { insideField } = useFieldState();\n const controlProps = {\n ...props,\n \"aria-busy\": loading || undefined,\n className: cx(input({ size }), className),\n \"data-jaci-component\": \"input\",\n \"data-loading\": loading || undefined,\n \"data-slot\": \"input\",\n };\n const control = insideField ? (\n <FieldControl {...controlProps} ref={ref as Ref<HTMLElement>} />\n ) : (\n <input {...controlProps} ref={ref} />\n );\n\n if (prefix !== undefined || suffix !== undefined || loading) {\n return (\n <InputGroup>\n {prefix !== undefined ? (\n <InputGroup.Addon data-slot=\"input-prefix\">{prefix}</InputGroup.Addon>\n ) : null}\n {control}\n {loading ? (\n <InputGroup.Addon aria-hidden=\"true\" data-slot=\"input-loading\">\n <Spinner label=\"\" size=\"sm\" />\n </InputGroup.Addon>\n ) : suffix !== undefined ? (\n <InputGroup.Addon data-slot=\"input-suffix\">{suffix}</InputGroup.Addon>\n ) : null}\n </InputGroup>\n );\n }\n\n return control;\n});\n"],"mappings":";;;;;;;;;AAmBA,MAAa,QAAQ,WAAyC,SAAS,MACrE,EAAE,WAAW,UAAU,OAAO,QAAQ,OAAO,MAAM,QAAQ,GAAG,SAC9D,KACA;CACA,MAAM,EAAE,gBAAgB,cAAc;CACtC,MAAM,eAAe;EACnB,GAAG;EACH,aAAa,WAAW,KAAA;EACxB,WAAW,GAAG,MAAM,EAAE,KAAK,CAAC,GAAG,SAAS;EACxC,uBAAuB;EACvB,gBAAgB,WAAW,KAAA;EAC3B,aAAa;CACf;CACA,MAAM,UAAU,cACd,oBAAC,cAAD;EAAc,GAAI;EAAmB;CAA0B,CAAA,IAE/D,oBAAC,SAAD;EAAO,GAAI;EAAmB;CAAM,CAAA;CAGtC,IAAI,WAAW,KAAA,KAAa,WAAW,KAAA,KAAa,SAClD,OACE,qBAAC,YAAD,EAAA,UAAA;EACG,WAAW,KAAA,IACV,oBAAC,WAAW,OAAZ;GAAkB,aAAU;aAAgB;EAAyB,CAAA,IACnE;EACH;EACA,UACC,oBAAC,WAAW,OAAZ;GAAkB,eAAY;GAAO,aAAU;aAC7C,oBAAC,SAAD;IAAS,OAAM;IAAG,MAAK;GAAM,CAAA;EACb,CAAA,IAChB,WAAW,KAAA,IACb,oBAAC,WAAW,OAAZ;GAAkB,aAAU;aAAgB;EAAyB,CAAA,IACnE;CACM,EAAA,CAAA;CAIhB,OAAO;AACT,CAAC"}
|
|
@@ -1,28 +1,49 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
const require_cx = require("../../styled-system/css/cx.cjs");
|
|
3
3
|
const require_textarea = require("../../styled-system/recipes/textarea.cjs");
|
|
4
|
+
const require_index = require("../layout/index.cjs");
|
|
4
5
|
const require_field = require("../field/field.cjs");
|
|
6
|
+
const require_input_group = require("../input-group/input-group.cjs");
|
|
5
7
|
let react = require("react");
|
|
6
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
-
let _base_ui_react_field = require("@base-ui/react/field");
|
|
8
9
|
//#region src/components/controls/textarea.tsx
|
|
9
|
-
const Textarea = (0, react.forwardRef)(function Textarea({ className, size = "md", ...props }, ref) {
|
|
10
|
+
const Textarea = (0, react.forwardRef)(function Textarea({ className, loading = false, prefix, size = "md", suffix, ...props }, ref) {
|
|
10
11
|
const { insideField } = require_field.useFieldState();
|
|
11
12
|
const controlProps = {
|
|
12
13
|
...props,
|
|
14
|
+
"aria-busy": loading || void 0,
|
|
13
15
|
className: require_cx.cx(require_textarea.textarea({ size }), className),
|
|
14
16
|
"data-jaci-component": "textarea",
|
|
17
|
+
"data-loading": loading || void 0,
|
|
15
18
|
"data-slot": "textarea"
|
|
16
19
|
};
|
|
17
|
-
|
|
20
|
+
const control = insideField ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_field.FieldControl, {
|
|
18
21
|
...controlProps,
|
|
19
22
|
ref,
|
|
20
23
|
render: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {})
|
|
21
|
-
})
|
|
22
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
24
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
23
25
|
...controlProps,
|
|
24
26
|
ref
|
|
25
27
|
});
|
|
28
|
+
if (prefix !== void 0 || suffix !== void 0 || loading) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_input_group.InputGroup, { children: [
|
|
29
|
+
prefix !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_input_group.InputGroup.Addon, {
|
|
30
|
+
"data-slot": "textarea-prefix",
|
|
31
|
+
children: prefix
|
|
32
|
+
}) : null,
|
|
33
|
+
control,
|
|
34
|
+
loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_input_group.InputGroup.Addon, {
|
|
35
|
+
"aria-hidden": "true",
|
|
36
|
+
"data-slot": "textarea-loading",
|
|
37
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.Spinner, {
|
|
38
|
+
label: "",
|
|
39
|
+
size: "sm"
|
|
40
|
+
})
|
|
41
|
+
}) : suffix !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_input_group.InputGroup.Addon, {
|
|
42
|
+
"data-slot": "textarea-suffix",
|
|
43
|
+
children: suffix
|
|
44
|
+
}) : null
|
|
45
|
+
] });
|
|
46
|
+
return control;
|
|
26
47
|
});
|
|
27
48
|
//#endregion
|
|
28
49
|
exports.Textarea = Textarea;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.cjs","names":["useFieldState","cx","textarea","
|
|
1
|
+
{"version":3,"file":"textarea.cjs","names":["useFieldState","cx","textarea","FieldControl","InputGroup","Spinner"],"sources":["../../../src/components/controls/textarea.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef } from \"react\";\nimport type { ComponentProps, ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { textarea } from \"../../styled-system/recipes\";\nimport { FieldControl, useFieldState } from \"../field\";\nimport { InputGroup } from \"../input-group\";\nimport { Spinner } from \"../layout\";\n\nexport interface TextareaProps extends Omit<ComponentPropsWithoutRef<\"textarea\">, \"prefix\"> {\n size?: \"sm\" | \"md\" | \"lg\";\n prefix?: ReactNode;\n suffix?: ReactNode;\n loading?: boolean;\n}\n\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(\n { className, loading = false, prefix, size = \"md\", suffix, ...props },\n ref,\n) {\n const { insideField } = useFieldState();\n const controlProps = {\n ...props,\n \"aria-busy\": loading || undefined,\n className: cx(textarea({ size }), className),\n \"data-jaci-component\": \"textarea\",\n \"data-loading\": loading || undefined,\n \"data-slot\": \"textarea\",\n };\n const control = insideField ? (\n <FieldControl\n {...(controlProps as unknown as ComponentProps<typeof FieldControl>)}\n ref={ref as Ref<HTMLElement>}\n render={<textarea />}\n />\n ) : (\n <textarea {...controlProps} ref={ref} />\n );\n\n if (prefix !== undefined || suffix !== undefined || loading) {\n return (\n <InputGroup>\n {prefix !== undefined ? (\n <InputGroup.Addon data-slot=\"textarea-prefix\">{prefix}</InputGroup.Addon>\n ) : null}\n {control}\n {loading ? (\n <InputGroup.Addon aria-hidden=\"true\" data-slot=\"textarea-loading\">\n <Spinner label=\"\" size=\"sm\" />\n </InputGroup.Addon>\n ) : suffix !== undefined ? (\n <InputGroup.Addon data-slot=\"textarea-suffix\">{suffix}</InputGroup.Addon>\n ) : null}\n </InputGroup>\n );\n }\n\n return control;\n});\n"],"mappings":";;;;;;;;;AAkBA,MAAa,YAAA,GAAA,MAAA,WAAA,CAA0D,SAAS,SAC9E,EAAE,WAAW,UAAU,OAAO,QAAQ,OAAO,MAAM,QAAQ,GAAG,SAC9D,KACA;CACA,MAAM,EAAE,gBAAgBA,cAAAA,cAAc;CACtC,MAAM,eAAe;EACnB,GAAG;EACH,aAAa,WAAW,KAAA;EACxB,WAAWC,WAAAA,GAAGC,iBAAAA,SAAS,EAAE,KAAK,CAAC,GAAG,SAAS;EAC3C,uBAAuB;EACvB,gBAAgB,WAAW,KAAA;EAC3B,aAAa;CACf;CACA,MAAM,UAAU,cACd,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,cAAD;EACE,GAAK;EACA;EACL,QAAQ,iBAAA,GAAA,kBAAA,IAAA,CAAC,YAAD,CAAW,CAAA;CACpB,CAAA,IAED,iBAAA,GAAA,kBAAA,IAAA,CAAC,YAAD;EAAU,GAAI;EAAmB;CAAM,CAAA;CAGzC,IAAI,WAAW,KAAA,KAAa,WAAW,KAAA,KAAa,SAClD,OACE,iBAAA,GAAA,kBAAA,KAAA,CAACC,oBAAAA,YAAD,EAAA,UAAA;EACG,WAAW,KAAA,IACV,iBAAA,GAAA,kBAAA,IAAA,CAACA,oBAAAA,WAAW,OAAZ;GAAkB,aAAU;aAAmB;EAAyB,CAAA,IACtE;EACH;EACA,UACC,iBAAA,GAAA,kBAAA,IAAA,CAACA,oBAAAA,WAAW,OAAZ;GAAkB,eAAY;GAAO,aAAU;aAC7C,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,SAAD;IAAS,OAAM;IAAG,MAAK;GAAM,CAAA;EACb,CAAA,IAChB,WAAW,KAAA,IACb,iBAAA,GAAA,kBAAA,IAAA,CAACD,oBAAAA,WAAW,OAAZ;GAAkB,aAAU;aAAmB;EAAyB,CAAA,IACtE;CACM,EAAA,CAAA;CAIhB,OAAO;AACT,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from "react";
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
2
|
//#region src/components/controls/textarea.d.ts
|
|
3
|
-
interface TextareaProps extends ComponentPropsWithoutRef<"textarea"> {
|
|
3
|
+
interface TextareaProps extends Omit<ComponentPropsWithoutRef<"textarea">, "prefix"> {
|
|
4
4
|
size?: "sm" | "md" | "lg";
|
|
5
|
+
prefix?: ReactNode;
|
|
6
|
+
suffix?: ReactNode;
|
|
7
|
+
loading?: boolean;
|
|
5
8
|
}
|
|
6
9
|
declare const Textarea: import("react").ForwardRefExoticComponent<TextareaProps & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
7
10
|
//#endregion
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from "react";
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
2
|
//#region src/components/controls/textarea.d.ts
|
|
3
|
-
interface TextareaProps extends ComponentPropsWithoutRef<"textarea"> {
|
|
3
|
+
interface TextareaProps extends Omit<ComponentPropsWithoutRef<"textarea">, "prefix"> {
|
|
4
4
|
size?: "sm" | "md" | "lg";
|
|
5
|
+
prefix?: ReactNode;
|
|
6
|
+
suffix?: ReactNode;
|
|
7
|
+
loading?: boolean;
|
|
5
8
|
}
|
|
6
9
|
declare const Textarea: import("react").ForwardRefExoticComponent<TextareaProps & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
7
10
|
//#endregion
|
|
@@ -1,28 +1,49 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx } from "../../styled-system/css/cx.js";
|
|
3
3
|
import { textarea } from "../../styled-system/recipes/textarea.js";
|
|
4
|
-
import {
|
|
4
|
+
import { Spinner } from "../layout/index.js";
|
|
5
|
+
import { FieldControl, useFieldState } from "../field/field.js";
|
|
6
|
+
import { InputGroup } from "../input-group/input-group.js";
|
|
5
7
|
import { forwardRef } from "react";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import { Field } from "@base-ui/react/field";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
//#region src/components/controls/textarea.tsx
|
|
9
|
-
const Textarea = forwardRef(function Textarea({ className, size = "md", ...props }, ref) {
|
|
10
|
+
const Textarea = forwardRef(function Textarea({ className, loading = false, prefix, size = "md", suffix, ...props }, ref) {
|
|
10
11
|
const { insideField } = useFieldState();
|
|
11
12
|
const controlProps = {
|
|
12
13
|
...props,
|
|
14
|
+
"aria-busy": loading || void 0,
|
|
13
15
|
className: cx(textarea({ size }), className),
|
|
14
16
|
"data-jaci-component": "textarea",
|
|
17
|
+
"data-loading": loading || void 0,
|
|
15
18
|
"data-slot": "textarea"
|
|
16
19
|
};
|
|
17
|
-
|
|
20
|
+
const control = insideField ? /* @__PURE__ */ jsx(FieldControl, {
|
|
18
21
|
...controlProps,
|
|
19
22
|
ref,
|
|
20
23
|
render: /* @__PURE__ */ jsx("textarea", {})
|
|
21
|
-
})
|
|
22
|
-
return /* @__PURE__ */ jsx("textarea", {
|
|
24
|
+
}) : /* @__PURE__ */ jsx("textarea", {
|
|
23
25
|
...controlProps,
|
|
24
26
|
ref
|
|
25
27
|
});
|
|
28
|
+
if (prefix !== void 0 || suffix !== void 0 || loading) return /* @__PURE__ */ jsxs(InputGroup, { children: [
|
|
29
|
+
prefix !== void 0 ? /* @__PURE__ */ jsx(InputGroup.Addon, {
|
|
30
|
+
"data-slot": "textarea-prefix",
|
|
31
|
+
children: prefix
|
|
32
|
+
}) : null,
|
|
33
|
+
control,
|
|
34
|
+
loading ? /* @__PURE__ */ jsx(InputGroup.Addon, {
|
|
35
|
+
"aria-hidden": "true",
|
|
36
|
+
"data-slot": "textarea-loading",
|
|
37
|
+
children: /* @__PURE__ */ jsx(Spinner, {
|
|
38
|
+
label: "",
|
|
39
|
+
size: "sm"
|
|
40
|
+
})
|
|
41
|
+
}) : suffix !== void 0 ? /* @__PURE__ */ jsx(InputGroup.Addon, {
|
|
42
|
+
"data-slot": "textarea-suffix",
|
|
43
|
+
children: suffix
|
|
44
|
+
}) : null
|
|
45
|
+
] });
|
|
46
|
+
return control;
|
|
26
47
|
});
|
|
27
48
|
//#endregion
|
|
28
49
|
export { Textarea };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.js","names":[
|
|
1
|
+
{"version":3,"file":"textarea.js","names":[],"sources":["../../../src/components/controls/textarea.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef } from \"react\";\nimport type { ComponentProps, ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { textarea } from \"../../styled-system/recipes\";\nimport { FieldControl, useFieldState } from \"../field\";\nimport { InputGroup } from \"../input-group\";\nimport { Spinner } from \"../layout\";\n\nexport interface TextareaProps extends Omit<ComponentPropsWithoutRef<\"textarea\">, \"prefix\"> {\n size?: \"sm\" | \"md\" | \"lg\";\n prefix?: ReactNode;\n suffix?: ReactNode;\n loading?: boolean;\n}\n\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(\n { className, loading = false, prefix, size = \"md\", suffix, ...props },\n ref,\n) {\n const { insideField } = useFieldState();\n const controlProps = {\n ...props,\n \"aria-busy\": loading || undefined,\n className: cx(textarea({ size }), className),\n \"data-jaci-component\": \"textarea\",\n \"data-loading\": loading || undefined,\n \"data-slot\": \"textarea\",\n };\n const control = insideField ? (\n <FieldControl\n {...(controlProps as unknown as ComponentProps<typeof FieldControl>)}\n ref={ref as Ref<HTMLElement>}\n render={<textarea />}\n />\n ) : (\n <textarea {...controlProps} ref={ref} />\n );\n\n if (prefix !== undefined || suffix !== undefined || loading) {\n return (\n <InputGroup>\n {prefix !== undefined ? (\n <InputGroup.Addon data-slot=\"textarea-prefix\">{prefix}</InputGroup.Addon>\n ) : null}\n {control}\n {loading ? (\n <InputGroup.Addon aria-hidden=\"true\" data-slot=\"textarea-loading\">\n <Spinner label=\"\" size=\"sm\" />\n </InputGroup.Addon>\n ) : suffix !== undefined ? (\n <InputGroup.Addon data-slot=\"textarea-suffix\">{suffix}</InputGroup.Addon>\n ) : null}\n </InputGroup>\n );\n }\n\n return control;\n});\n"],"mappings":";;;;;;;;;AAkBA,MAAa,WAAW,WAA+C,SAAS,SAC9E,EAAE,WAAW,UAAU,OAAO,QAAQ,OAAO,MAAM,QAAQ,GAAG,SAC9D,KACA;CACA,MAAM,EAAE,gBAAgB,cAAc;CACtC,MAAM,eAAe;EACnB,GAAG;EACH,aAAa,WAAW,KAAA;EACxB,WAAW,GAAG,SAAS,EAAE,KAAK,CAAC,GAAG,SAAS;EAC3C,uBAAuB;EACvB,gBAAgB,WAAW,KAAA;EAC3B,aAAa;CACf;CACA,MAAM,UAAU,cACd,oBAAC,cAAD;EACE,GAAK;EACA;EACL,QAAQ,oBAAC,YAAD,CAAW,CAAA;CACpB,CAAA,IAED,oBAAC,YAAD;EAAU,GAAI;EAAmB;CAAM,CAAA;CAGzC,IAAI,WAAW,KAAA,KAAa,WAAW,KAAA,KAAa,SAClD,OACE,qBAAC,YAAD,EAAA,UAAA;EACG,WAAW,KAAA,IACV,oBAAC,WAAW,OAAZ;GAAkB,aAAU;aAAmB;EAAyB,CAAA,IACtE;EACH;EACA,UACC,oBAAC,WAAW,OAAZ;GAAkB,eAAY;GAAO,aAAU;aAC7C,oBAAC,SAAD;IAAS,OAAM;IAAG,MAAK;GAAM,CAAA;EACb,CAAA,IAChB,WAAW,KAAA,IACb,oBAAC,WAAW,OAAZ;GAAkB,aAAU;aAAmB;EAAyB,CAAA,IACtE;CACM,EAAA,CAAA;CAIhB,OAAO;AACT,CAAC"}
|
|
@@ -23,17 +23,17 @@ function composeRefs(first, second) {
|
|
|
23
23
|
else if (first) first.current = value;
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
function DatePickerRoot({ children, closeOnSelect: closeOnSelectProp, defaultValue = null, disabled = false, granularity = "day", isDateDisabled, locale = "pt-BR", maxDate, minDate, name, onValueChange, onMonthChange, placeholder = "Select a date", size = "md", value: controlledValue, weekStartsOn = 0, yearRange: configuredYearRange, actionsRef: externalActionsRef, ...popoverProps }) {
|
|
26
|
+
function DatePickerRoot({ children, closeOnSelect: closeOnSelectProp, defaultValue = null, disabled = false, granularity = "day", isDateDisabled, locale = "pt-BR", maxDate, minDate, name, onValueChange, onMonthChange, placeholder = "Select a date", size = "md", value: controlledValue, weekStartsOn = 0, yearRange: configuredYearRange, referenceDate, actionsRef: externalActionsRef, ...popoverProps }) {
|
|
27
27
|
const [uncontrolledValue, setUncontrolledValue] = (0, react.useState)(defaultValue);
|
|
28
28
|
const selected = controlledValue === void 0 ? uncontrolledValue : controlledValue;
|
|
29
|
-
const [month, setMonthState] = (0, react.useState)(() => require_date_utils.startOfMonth(selected ?? /* @__PURE__ */ new Date()));
|
|
30
|
-
const [focusedDate, setFocusedDate] = (0, react.useState)(selected ?? month);
|
|
29
|
+
const [month, setMonthState] = (0, react.useState)(() => require_date_utils.startOfMonth(selected ?? referenceDate ?? /* @__PURE__ */ new Date()));
|
|
30
|
+
const [focusedDate, setFocusedDate] = (0, react.useState)(selected ?? referenceDate ?? month);
|
|
31
31
|
const previousMonthRef = (0, react.useRef)(month);
|
|
32
32
|
const internalActionsRef = (0, react.useRef)(null);
|
|
33
33
|
const dayRefs = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
34
34
|
const labelId = (0, react.useId)();
|
|
35
35
|
const triggerId = (0, react.useId)();
|
|
36
|
-
const today = (0, react.useMemo)(() => /* @__PURE__ */ new Date(), []);
|
|
36
|
+
const today = (0, react.useMemo)(() => referenceDate ?? /* @__PURE__ */ new Date(), [referenceDate]);
|
|
37
37
|
const styles = require_date_picker.datePicker({ size });
|
|
38
38
|
const minMonth = minDate ? require_date_utils.startOfMonth(minDate) : void 0;
|
|
39
39
|
const maxMonth = maxDate ? require_date_utils.startOfMonth(maxDate) : void 0;
|
|
@@ -92,9 +92,9 @@ function DatePickerRoot({ children, closeOnSelect: closeOnSelectProp, defaultVal
|
|
|
92
92
|
(externalActionsRef ?? internalActionsRef).current?.close();
|
|
93
93
|
}, [externalActionsRef]);
|
|
94
94
|
const setValue = (0, react.useCallback)((nextValue) => {
|
|
95
|
-
setUncontrolledValue(nextValue);
|
|
95
|
+
if (controlledValue === void 0) setUncontrolledValue(nextValue);
|
|
96
96
|
onValueChange?.(nextValue);
|
|
97
|
-
}, [onValueChange]);
|
|
97
|
+
}, [controlledValue, onValueChange]);
|
|
98
98
|
const monthDisabled = (0, react.useCallback)((candidate) => {
|
|
99
99
|
const firstDay = require_date_utils.startOfMonth(candidate);
|
|
100
100
|
const lastDay = require_date_utils.createCalendarDate(candidate.getFullYear(), candidate.getMonth() + 1, 0);
|
|
@@ -466,7 +466,7 @@ const DatePickerNext = (0, react.forwardRef)(function DatePickerNext(props, ref)
|
|
|
466
466
|
});
|
|
467
467
|
});
|
|
468
468
|
const DatePickerDay = (0, react.forwardRef)(function DatePickerDay({ children, className, date, disabled, onClick, onKeyDown, ...props }, ref) {
|
|
469
|
-
const { dateDisabled, disabled: pickerDisabled, focusDate, focusedDate, locale, month, onSelect, registerDay, selected, styles, today } = useDatePickerContext();
|
|
469
|
+
const { dateDisabled, disabled: pickerDisabled, focusDate, focusedDate, locale, month, onSelect, registerDay, selected, styles, today, weekStartsOn } = useDatePickerContext();
|
|
470
470
|
const key = require_date_utils.dateKey(date);
|
|
471
471
|
const outsideMonth = !isSameMonth(date, month);
|
|
472
472
|
const isDisabled = disabled || pickerDisabled || dateDisabled(date);
|
|
@@ -491,10 +491,10 @@ const DatePickerDay = (0, react.forwardRef)(function DatePickerDay({ children, c
|
|
|
491
491
|
nextDate = require_date_utils.addDays(date, 7);
|
|
492
492
|
break;
|
|
493
493
|
case "Home":
|
|
494
|
-
nextDate = require_date_utils.addDays(date, -date.getDay());
|
|
494
|
+
nextDate = require_date_utils.addDays(date, -((date.getDay() - weekStartsOn + 7) % 7));
|
|
495
495
|
break;
|
|
496
496
|
case "End":
|
|
497
|
-
nextDate = require_date_utils.addDays(date, 6 - date.getDay());
|
|
497
|
+
nextDate = require_date_utils.addDays(date, 6 - (date.getDay() - weekStartsOn + 7) % 7);
|
|
498
498
|
break;
|
|
499
499
|
case "PageUp":
|
|
500
500
|
nextDate = require_date_utils.addMonths(date, event.shiftKey ? -12 : -1);
|