@yamada-ui/react 2.2.1-dev-20260412135527 → 2.2.1-dev-20260412142743
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/autocomplete/autocomplete.cjs +9 -20
- package/dist/cjs/components/autocomplete/autocomplete.cjs.map +1 -1
- package/dist/cjs/components/data-list/data-list.cjs +5 -8
- package/dist/cjs/components/data-list/data-list.cjs.map +1 -1
- package/dist/esm/components/autocomplete/autocomplete.js +9 -20
- package/dist/esm/components/autocomplete/autocomplete.js.map +1 -1
- package/dist/esm/components/data-list/data-list.js +5 -8
- package/dist/esm/components/data-list/data-list.js.map +1 -1
- package/dist/types/components/accordion/accordion.d.ts +2 -4
- package/dist/types/components/accordion/accordion.style.d.ts +1 -1
- package/dist/types/components/accordion/use-accordion.d.ts +11 -11
- package/dist/types/components/action-bar/action-bar.d.ts +2 -3
- package/dist/types/components/airy/airy.d.ts +2 -3
- package/dist/types/components/alert/alert.d.ts +2 -5
- package/dist/types/components/alpha-slider/alpha-slider.d.ts +2 -3
- package/dist/types/components/aspect-ratio/aspect-ratio.d.ts +2 -2
- package/dist/types/components/autocomplete/autocomplete.d.ts +2 -4
- package/dist/types/components/autocomplete/autocomplete.style.d.ts +1 -1
- package/dist/types/components/autocomplete/use-autocomplete.d.ts +5 -7
- package/dist/types/components/avatar/avatar.d.ts +5 -5
- package/dist/types/components/avatar/use-avatar-group.d.ts +2 -2
- package/dist/types/components/badge/badge.d.ts +2 -2
- package/dist/types/components/bleed/bleed.d.ts +2 -2
- package/dist/types/components/blockquote/blockquote.d.ts +2 -2
- package/dist/types/components/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/types/components/breadcrumb/breadcrumb.style.d.ts +1 -1
- package/dist/types/components/breadcrumb/use-breadcrumb.d.ts +2 -2
- package/dist/types/components/button/button-group.d.ts +0 -1
- package/dist/types/components/button/button.d.ts +2 -3
- package/dist/types/components/button/icon-button.d.ts +2 -2
- package/dist/types/components/calendar/calendar.d.ts +2 -3
- package/dist/types/components/calendar/calendar.style.d.ts +2 -2
- package/dist/types/components/calendar/use-calendar.d.ts +8 -9
- package/dist/types/components/card/card.d.ts +2 -2
- package/dist/types/components/carousel/carousel.d.ts +2 -3
- package/dist/types/components/carousel/carousel.style.d.ts +2 -2
- package/dist/types/components/carousel/use-carousel.d.ts +3 -3
- package/dist/types/components/center/center.d.ts +2 -2
- package/dist/types/components/chart/chart.d.ts +5 -5
- package/dist/types/components/chart/composed-chart.d.ts +2 -2
- package/dist/types/components/chart/donut-chart.d.ts +2 -2
- package/dist/types/components/chart/line-chart.d.ts +2 -2
- package/dist/types/components/chart/pie-chart.d.ts +2 -2
- package/dist/types/components/chart/use-chart.d.ts +2 -2
- package/dist/types/components/checkbox/checkbox-group.d.ts +0 -2
- package/dist/types/components/checkbox/checkbox.d.ts +4 -5
- package/dist/types/components/checkbox/use-checkbox-group.d.ts +2 -3
- package/dist/types/components/checkbox/use-checkbox.d.ts +0 -1
- package/dist/types/components/checkbox-card/checkbox-card-group.d.ts +0 -3
- package/dist/types/components/checkbox-card/checkbox-card.d.ts +5 -7
- package/dist/types/components/checkbox-card/checkbox-card.style.d.ts +1 -1
- package/dist/types/components/circle-progress/circle-progress.d.ts +2 -3
- package/dist/types/components/close-button/close-button.d.ts +2 -3
- package/dist/types/components/code/code.d.ts +2 -2
- package/dist/types/components/collapse/collapse.d.ts +2 -3
- package/dist/types/components/color-picker/color-picker.d.ts +2 -6
- package/dist/types/components/color-picker/use-color-picker.d.ts +2 -5
- package/dist/types/components/color-selector/color-selector.d.ts +2 -6
- package/dist/types/components/color-selector/use-color-selector.d.ts +3 -5
- package/dist/types/components/color-swatch/color-swatch.d.ts +2 -2
- package/dist/types/components/container/container.d.ts +2 -2
- package/dist/types/components/data-list/data-list.d.ts +2 -2
- package/dist/types/components/data-list/data-list.style.d.ts +1 -1
- package/dist/types/components/date-picker/date-picker.d.ts +2 -5
- package/dist/types/components/date-picker/use-date-picker.d.ts +4 -7
- package/dist/types/components/drawer/drawer.d.ts +2 -5
- package/dist/types/components/drawer/use-drawer.d.ts +0 -2
- package/dist/types/components/dropzone/dropzone.d.ts +4 -7
- package/dist/types/components/dropzone/use-dropzone.d.ts +0 -1
- package/dist/types/components/editable/editable.d.ts +4 -5
- package/dist/types/components/editable/use-editable.d.ts +2 -3
- package/dist/types/components/em/em.d.ts +2 -2
- package/dist/types/components/empty-state/empty-state.d.ts +2 -2
- package/dist/types/components/empty-state/empty-state.style.d.ts +2 -2
- package/dist/types/components/fade/fade.d.ts +2 -3
- package/dist/types/components/fade-scale/fade-scale.d.ts +0 -1
- package/dist/types/components/field/field.d.ts +3 -3
- package/dist/types/components/field/use-field-props.d.ts +3 -3
- package/dist/types/components/fieldset/fieldset.d.ts +3 -4
- package/dist/types/components/file-button/file-button.d.ts +2 -4
- package/dist/types/components/file-button/use-file-button.d.ts +18 -20
- package/dist/types/components/file-input/file-input.d.ts +2 -4
- package/dist/types/components/file-input/use-file-input.d.ts +15 -16
- package/dist/types/components/flex/flex.d.ts +2 -2
- package/dist/types/components/flip/flip.d.ts +4 -5
- package/dist/types/components/flip/flip.style.d.ts +1 -1
- package/dist/types/components/float/float.d.ts +2 -2
- package/dist/types/components/form/form.d.ts +3 -4
- package/dist/types/components/format/format-byte.d.ts +4 -4
- package/dist/types/components/format/format-date-time.d.ts +4 -4
- package/dist/types/components/format/format-number.d.ts +2 -2
- package/dist/types/components/format/use-format-byte.d.ts +0 -1
- package/dist/types/components/format/use-format-date-time.d.ts +0 -1
- package/dist/types/components/format/use-format-number.d.ts +0 -1
- package/dist/types/components/grid/grid-item.d.ts +2 -2
- package/dist/types/components/grid/grid.d.ts +2 -2
- package/dist/types/components/group/group.d.ts +2 -3
- package/dist/types/components/group/use-group.d.ts +2 -2
- package/dist/types/components/heading/heading.d.ts +2 -2
- package/dist/types/components/highlight/highlight.d.ts +0 -2
- package/dist/types/components/hue-slider/hue-slider.d.ts +3 -4
- package/dist/types/components/icon/icon.d.ts +5 -5
- package/dist/types/components/image/image.d.ts +2 -2
- package/dist/types/components/indicator/indicator.d.ts +4 -5
- package/dist/types/components/infinite-scroll-area/infinite-scroll-area.d.ts +2 -2
- package/dist/types/components/input/input-addon.d.ts +2 -2
- package/dist/types/components/input/input-element.d.ts +2 -2
- package/dist/types/components/input/input-group.d.ts +0 -2
- package/dist/types/components/input/input.d.ts +2 -3
- package/dist/types/components/kbd/kbd.d.ts +2 -2
- package/dist/types/components/link/link.d.ts +2 -2
- package/dist/types/components/link-box/link-box.d.ts +2 -2
- package/dist/types/components/list/list.d.ts +2 -2
- package/dist/types/components/list/list.style.d.ts +2 -2
- package/dist/types/components/loading/loading-provider.d.ts +2 -2
- package/dist/types/components/loading/loading.d.ts +3 -4
- package/dist/types/components/loading/use-loading-component.d.ts +0 -1
- package/dist/types/components/mark/mark.d.ts +2 -2
- package/dist/types/components/menu/menu.d.ts +2 -3
- package/dist/types/components/menu/menu.style.d.ts +2 -2
- package/dist/types/components/menu/use-menu.d.ts +11 -11
- package/dist/types/components/modal/modal.d.ts +2 -6
- package/dist/types/components/native-accordion/native-accordion.d.ts +2 -2
- package/dist/types/components/native-accordion/native-accordion.style.d.ts +2 -2
- package/dist/types/components/native-accordion/use-native-accordion.d.ts +2 -2
- package/dist/types/components/native-popover/native-popover.d.ts +2 -2
- package/dist/types/components/native-select/native-select.d.ts +2 -4
- package/dist/types/components/native-select/use-native-select.d.ts +0 -1
- package/dist/types/components/native-table/native-table.d.ts +4 -4
- package/dist/types/components/notice/notice.style.d.ts +1 -1
- package/dist/types/components/notice/use-notice.d.ts +0 -3
- package/dist/types/components/number-input/number-input.d.ts +2 -3
- package/dist/types/components/number-input/number-input.style.d.ts +1 -1
- package/dist/types/components/number-input/use-number-input.d.ts +0 -1
- package/dist/types/components/pagination/pagination.d.ts +2 -3
- package/dist/types/components/pagination/pagination.style.d.ts +1 -1
- package/dist/types/components/pagination/use-pagination.d.ts +2 -2
- package/dist/types/components/password-input/password-input.d.ts +2 -3
- package/dist/types/components/password-input/strength-meter.d.ts +2 -2
- package/dist/types/components/password-input/use-password-input.d.ts +2 -3
- package/dist/types/components/picture/picture.d.ts +0 -1
- package/dist/types/components/pin-input/pin-input.d.ts +2 -4
- package/dist/types/components/pin-input/use-pin-input.d.ts +7 -8
- package/dist/types/components/popover/popover.d.ts +2 -3
- package/dist/types/components/progress/progress.d.ts +4 -4
- package/dist/types/components/progress/use-progress.d.ts +706 -706
- package/dist/types/components/qr-code/qr-code.d.ts +2 -2
- package/dist/types/components/radio/radio-group.d.ts +0 -2
- package/dist/types/components/radio/radio.d.ts +4 -5
- package/dist/types/components/radio/use-radio-group.d.ts +2 -3
- package/dist/types/components/radio/use-radio.d.ts +0 -1
- package/dist/types/components/radio-card/radio-card-group.d.ts +0 -3
- package/dist/types/components/radio-card/radio-card.d.ts +5 -7
- package/dist/types/components/radio-card/radio-card.style.d.ts +1 -1
- package/dist/types/components/rating/rating.style.d.ts +2 -2
- package/dist/types/components/rating/use-rating.d.ts +7 -8
- package/dist/types/components/reorder/reorder.d.ts +2 -3
- package/dist/types/components/reorder/reorder.style.d.ts +1 -1
- package/dist/types/components/reorder/use-reorder.d.ts +3 -3
- package/dist/types/components/resizable/resizable.d.ts +2 -2
- package/dist/types/components/resizable/resizable.style.d.ts +2 -2
- package/dist/types/components/resizable/use-resizable.d.ts +2 -2
- package/dist/types/components/ripple/ripple.d.ts +2 -3
- package/dist/types/components/ripple/use-ripple.d.ts +2 -2
- package/dist/types/components/rotate/rotate.d.ts +2 -3
- package/dist/types/components/saturation-slider/saturation-slider.d.ts +2 -2
- package/dist/types/components/saturation-slider/use-saturation-slider.d.ts +2 -3
- package/dist/types/components/scroll-area/scroll-area.d.ts +2 -2
- package/dist/types/components/segmented-control/segmented-control.d.ts +2 -3
- package/dist/types/components/segmented-control/segmented-control.style.d.ts +2 -2
- package/dist/types/components/segmented-control/use-segmented-control.d.ts +9 -10
- package/dist/types/components/select/select.d.ts +2 -4
- package/dist/types/components/select/select.style.d.ts +1 -1
- package/dist/types/components/select/use-select.d.ts +4 -6
- package/dist/types/components/separator/separator.d.ts +2 -2
- package/dist/types/components/sidebar/sidebar.d.ts +2 -7
- package/dist/types/components/sidebar/use-sidebar.d.ts +9 -9
- package/dist/types/components/simple-grid/simple-grid.d.ts +2 -3
- package/dist/types/components/skeleton/skeleton.d.ts +2 -2
- package/dist/types/components/slide/slide.d.ts +2 -3
- package/dist/types/components/slide-fade/slide-fade.d.ts +2 -3
- package/dist/types/components/slider/slider.d.ts +2 -2
- package/dist/types/components/slider/use-slider.d.ts +2 -3
- package/dist/types/components/snacks/snacks.d.ts +0 -2
- package/dist/types/components/snacks/use-snacks.d.ts +0 -1
- package/dist/types/components/stack/h-stack.d.ts +2 -2
- package/dist/types/components/stack/stack.d.ts +2 -2
- package/dist/types/components/stack/v-stack.d.ts +2 -2
- package/dist/types/components/stack/z-stack.d.ts +2 -2
- package/dist/types/components/stat/stat.d.ts +2 -2
- package/dist/types/components/status/status.d.ts +2 -2
- package/dist/types/components/steps/steps.d.ts +2 -2
- package/dist/types/components/steps/steps.style.d.ts +1 -1
- package/dist/types/components/steps/use-steps.d.ts +10 -10
- package/dist/types/components/switch/switch.d.ts +2 -2
- package/dist/types/components/switch/use-switch.d.ts +0 -1
- package/dist/types/components/table/table.d.ts +2 -4
- package/dist/types/components/tabs/tabs.d.ts +2 -2
- package/dist/types/components/tabs/use-tabs.d.ts +16 -16
- package/dist/types/components/tag/tag.d.ts +2 -2
- package/dist/types/components/text/text.d.ts +2 -2
- package/dist/types/components/textarea/textarea.d.ts +2 -4
- package/dist/types/components/textarea/use-autosize.d.ts +2 -2
- package/dist/types/components/timeline/timeline.d.ts +5 -5
- package/dist/types/components/timeline/timeline.style.d.ts +1 -1
- package/dist/types/components/tip/tip.d.ts +0 -3
- package/dist/types/components/toggle/toggle-group.d.ts +1 -1
- package/dist/types/components/toggle/toggle.d.ts +3 -5
- package/dist/types/components/toggle/use-toggle-group.d.ts +2 -2
- package/dist/types/components/toggle/use-toggle.d.ts +2 -3
- package/dist/types/components/tooltip/tooltip.d.ts +2 -4
- package/dist/types/components/tree/tree.d.ts +2 -6
- package/dist/types/components/tree/tree.style.d.ts +1 -1
- package/dist/types/components/tree/use-tree.d.ts +182 -183
- package/dist/types/components/visually-hidden/visually-hidden.d.ts +2 -2
- package/dist/types/components/wrap/wrap.d.ts +2 -3
- package/dist/types/core/components/create-component.d.ts +9 -7
- package/dist/types/core/components/index.types.d.ts +1 -0
- package/dist/types/core/components/use-component-style.d.ts +2 -0
- package/dist/types/core/components/utils.d.ts +1 -0
- package/dist/types/core/constant.d.ts +1 -0
- package/dist/types/core/css/calc.d.ts +1 -0
- package/dist/types/core/css/config.d.ts +1 -0
- package/dist/types/core/css/css.d.ts +1 -0
- package/dist/types/core/css/index.types.d.ts +1 -0
- package/dist/types/core/css/styles.d.ts +1 -0
- package/dist/types/core/css/token.d.ts +1 -0
- package/dist/types/core/css/use-css.d.ts +1 -0
- package/dist/types/core/css/utils.d.ts +2 -0
- package/dist/types/core/generated-theme-tokens.types.d.ts +1 -0
- package/dist/types/core/index.d.ts +2 -0
- package/dist/types/core/system/color-mode-provider.d.ts +2 -2
- package/dist/types/core/system/config.d.ts +1 -0
- package/dist/types/core/system/create-system.d.ts +1 -0
- package/dist/types/core/system/factory.d.ts +1 -0
- package/dist/types/core/system/index.types.d.ts +1 -0
- package/dist/types/core/system/styled.d.ts +3 -2
- package/dist/types/core/system/system-provider.d.ts +2 -2
- package/dist/types/core/system/var.d.ts +2 -0
- package/dist/types/hooks/use-async-callback/index.d.ts +0 -1
- package/dist/types/hooks/use-breakpoint/use-breakpoint-state.d.ts +2 -2
- package/dist/types/hooks/use-clipboard/index.d.ts +2 -2
- package/dist/types/hooks/use-combobox/index.d.ts +12 -13
- package/dist/types/hooks/use-descendants/index.d.ts +2 -2
- package/dist/types/hooks/use-field-sizing/index.d.ts +2 -2
- package/dist/types/hooks/use-popper/index.d.ts +2 -2
- package/dist/types/hooks/use-resize-observer/index.d.ts +3 -3
- package/dist/types/index.d.ts +0 -106
- package/dist/types/providers/i18n-provider/i18n-provider.d.ts +2 -2
- package/dist/types/providers/ui-provider/ui-provider.d.ts +0 -1
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
4
4
|
const require_utils_index = require('../../utils/index.cjs');
|
|
5
5
|
const require_factory = require('../../core/system/factory.cjs');
|
|
6
|
+
const require_props = require('../../core/components/props.cjs');
|
|
6
7
|
const require_create_component = require('../../core/components/create-component.cjs');
|
|
7
8
|
require('../../core/index.cjs');
|
|
8
9
|
const require_check_icon = require('../icon/icons/check-icon.cjs');
|
|
@@ -107,13 +108,11 @@ const AutocompleteRoot = withProvider((props) => {
|
|
|
107
108
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_popover.PopoverRoot, {
|
|
108
109
|
...mergedPopoverProps,
|
|
109
110
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_input_group.InputGroupRoot, {
|
|
110
|
-
className,
|
|
111
|
-
css,
|
|
112
111
|
colorScheme,
|
|
113
|
-
...
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}),
|
|
112
|
+
...require_props.mergeProps({
|
|
113
|
+
className,
|
|
114
|
+
css
|
|
115
|
+
}, getRootProps(groupItemProps), rootProps)(),
|
|
117
116
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_popover.PopoverTrigger, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AutocompleteField, {
|
|
118
117
|
...getFieldProps(varProps),
|
|
119
118
|
children: fieldChildren
|
|
@@ -138,10 +137,7 @@ const AutocompleteRoot = withProvider((props) => {
|
|
|
138
137
|
})
|
|
139
138
|
});
|
|
140
139
|
}, "root")((props) => {
|
|
141
|
-
return
|
|
142
|
-
...require_input.useInputPropsContext(),
|
|
143
|
-
...props
|
|
144
|
-
};
|
|
140
|
+
return require_props.mergeProps(require_input.useInputPropsContext(), props)();
|
|
145
141
|
});
|
|
146
142
|
const AutocompleteField = withContext("div", "field")({ "data-group-propagate": "" }, ({ children, ...rest }) => {
|
|
147
143
|
const { getInputProps, inputProps } = useComponentContext();
|
|
@@ -162,10 +158,7 @@ const AutocompleteLabel = withContext("span", "label")(void 0, (props) => {
|
|
|
162
158
|
});
|
|
163
159
|
const AutocompleteGroup = withContext(({ children, label, labelProps, ...rest }) => {
|
|
164
160
|
const { groupProps } = useComponentContext();
|
|
165
|
-
const { getGroupProps, getLabelProps } = require_hooks_use_combobox_index.useComboboxGroup(
|
|
166
|
-
...groupProps,
|
|
167
|
-
...rest
|
|
168
|
-
});
|
|
161
|
+
const { getGroupProps, getLabelProps } = require_hooks_use_combobox_index.useComboboxGroup(require_props.mergeProps(groupProps, rest)());
|
|
169
162
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_hooks_use_combobox_index.ComboboxGroupContext, {
|
|
170
163
|
value: (0, react.useMemo)(() => ({ getLabelProps }), [getLabelProps]),
|
|
171
164
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_factory.styled.div, {
|
|
@@ -179,10 +172,7 @@ const AutocompleteGroup = withContext(({ children, label, labelProps, ...rest })
|
|
|
179
172
|
}, "group")();
|
|
180
173
|
const AutocompleteOption = withContext(({ children, icon: iconProp, ...rest }) => {
|
|
181
174
|
const { optionProps: { icon, ...optionProps } = {} } = useComponentContext();
|
|
182
|
-
const { getIndicatorProps, getOptionProps } = require_use_autocomplete.useAutocompleteOption(
|
|
183
|
-
...optionProps,
|
|
184
|
-
...rest
|
|
185
|
-
});
|
|
175
|
+
const { getIndicatorProps, getOptionProps } = require_use_autocomplete.useAutocompleteOption(require_props.mergeProps(optionProps, rest)());
|
|
186
176
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_factory.styled.div, {
|
|
187
177
|
...getOptionProps(),
|
|
188
178
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AutocompleteIndicator, {
|
|
@@ -194,8 +184,7 @@ const AutocompleteOption = withContext(({ children, icon: iconProp, ...rest }) =
|
|
|
194
184
|
const AutocompleteEmpty = withContext(({ children, icon, ...rest }) => {
|
|
195
185
|
const { emptyIcon, emptyProps } = useComponentContext();
|
|
196
186
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_factory.styled.div, {
|
|
197
|
-
...emptyProps,
|
|
198
|
-
...rest,
|
|
187
|
+
...require_props.mergeProps(emptyProps, rest)(),
|
|
199
188
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AutocompleteIndicator, { children: icon ?? emptyIcon ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_minus_icon.MinusIcon, {}) }), children]
|
|
200
189
|
});
|
|
201
190
|
}, "empty")();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.cjs","names":["createSlotComponent","autocompleteStyle","XIcon","useGroupItemProps","usePopoverStyleProps","useAutocomplete","createComboboxItem","createComboboxChildren","useInputBorder","ComboboxDescendantsContext","ComboboxContext","AutocompleteContext","useInputPropsContext","ChevronDownIcon","useComboboxGroupContext","useComboboxGroup","ComboboxGroupContext","styled","useAutocompleteOption","CheckIcon","MinusIcon"],"sources":["../../../../src/components/autocomplete/autocomplete.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type {\n ComboboxItem,\n UseComboboxGroupProps,\n} from \"../../hooks/use-combobox\"\nimport type { Merge } from \"../../utils\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { UsePopoverStyleProps, UsePopupAnimationProps } from \"../popover\"\nimport type { AutocompleteStyle } from \"./autocomplete.style\"\nimport type {\n UseAutocompleteOptionProps,\n UseAutocompleteProps,\n UseAutocompleteReturn,\n} from \"./use-autocomplete\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport {\n ComboboxContext,\n ComboboxDescendantsContext,\n ComboboxGroupContext,\n createComboboxChildren,\n createComboboxItem,\n useComboboxGroup,\n useComboboxGroupContext,\n} from \"../../hooks/use-combobox\"\nimport { cast, isArray } from \"../../utils\"\nimport { useGroupItemProps } from \"../group\"\nimport { CheckIcon, ChevronDownIcon, MinusIcon, XIcon } from \"../icon\"\nimport { InputGroup, useInputBorder, useInputPropsContext } from \"../input\"\nimport { Popover, usePopoverStyleProps } from \"../popover\"\nimport { autocompleteStyle } from \"./autocomplete.style\"\nimport {\n AutocompleteContext,\n useAutocomplete,\n useAutocompleteOption,\n} from \"./use-autocomplete\"\n\ninterface ComponentContext\n extends\n Pick<UseAutocompleteReturn, \"getInputProps\" | \"getSeparatorProps\">,\n Pick<\n AutocompleteRootProps,\n \"emptyIcon\" | \"emptyProps\" | \"groupProps\" | \"inputProps\" | \"optionProps\"\n > {}\n\nexport interface AutocompleteRootProps<Multiple extends boolean = false>\n extends\n Omit<\n HTMLStyledProps,\n \"defaultValue\" | \"filter\" | \"offset\" | \"onChange\" | \"ref\" | \"value\"\n >,\n Merge<UseAutocompleteProps<Multiple>, UsePopoverStyleProps>,\n UsePopupAnimationProps,\n ThemeProps<AutocompleteStyle>,\n UseInputBorderProps {\n /**\n * If `true`, display the clear icon.\n *\n * @default true\n */\n clearable?: boolean\n /**\n * The icon to be used in the clear button.\n */\n clearIcon?: ReactNode\n /**\n * The icon to be used in the empty element.\n */\n emptyIcon?: ReactNode\n /**\n * The icon to be used in the autocomplete.\n */\n icon?: ReactNode\n /**\n * Props for content element.\n */\n contentProps?: AutocompleteContentProps\n /**\n * The props for the end element.\n */\n elementProps?: InputGroup.ElementProps\n /**\n * Props for empty element.\n */\n emptyProps?: AutocompleteEmptyProps\n /**\n * Props for group element.\n */\n groupProps?: Omit<AutocompleteGroupProps, \"children\" | \"label\">\n /**\n * Props for icon element.\n */\n iconProps?: AutocompleteIconProps\n /**\n * The props for the input element.\n */\n inputProps?: HTMLStyledProps<\"input\">\n /**\n * Props for option element.\n */\n optionProps?: Omit<AutocompleteOptionProps, \"children\" | \"value\">\n /**\n * Props for root element.\n */\n rootProps?: InputGroup.RootProps\n}\n\nconst {\n ComponentContext,\n PropsContext: AutocompletePropsContext,\n useComponentContext,\n usePropsContext: useAutocompletePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<\n AutocompleteRootProps,\n AutocompleteStyle,\n ComponentContext\n>(\"autocomplete\", autocompleteStyle)\n\nexport { AutocompletePropsContext, useAutocompletePropsContext }\n\n/**\n * `Autocomplete` is a component used to display suggestions in response to user text input.\n *\n * @see https://yamada-ui.com/docs/components/autocomplete\n */\nexport const AutocompleteRoot = withProvider(\n <Multiple extends boolean = false>(\n props: AutocompleteRootProps<Multiple>,\n ) => {\n const [\n groupItemProps,\n {\n className,\n css,\n colorScheme,\n animationScheme = \"block-start\",\n children,\n clearable = true,\n clearIcon = <XIcon />,\n duration,\n emptyIcon,\n errorBorderColor,\n focusBorderColor,\n icon,\n items: itemsProp,\n contentProps,\n elementProps,\n emptyProps,\n groupProps,\n iconProps,\n inputProps,\n optionProps,\n rootProps,\n ...rest\n },\n ] = useGroupItemProps(props)\n const popoverStyleProps = usePopoverStyleProps(rest)\n const items = useMemo<ComboboxItem[]>(() => {\n if (itemsProp) return itemsProp\n\n return createComboboxItem(children, {\n Group: AutocompleteGroup,\n Label: AutocompleteLabel,\n Option: AutocompleteOption,\n })\n }, [itemsProp, children])\n const {\n children: fieldChildren,\n descendants,\n items: computedItems,\n max,\n value,\n getClearIconProps,\n getContentProps,\n getFieldProps,\n getIconProps,\n getInputProps,\n getRootProps,\n getSeparatorProps,\n popoverProps,\n onActiveDescendant,\n onClose,\n onSelect,\n } = useAutocomplete({ items, ...rest, ...popoverStyleProps })\n const mergedPopoverProps = useMemo<Popover.RootProps>(\n () => ({\n animationScheme,\n duration,\n ...popoverProps,\n }),\n [animationScheme, duration, popoverProps],\n )\n const computedChildren = useMemo(\n () =>\n createComboboxChildren(computedItems, {\n Empty: AutocompleteEmpty,\n Group: AutocompleteGroup,\n Option: AutocompleteOption,\n }),\n [computedItems],\n )\n const varProps = useInputBorder({ errorBorderColor, focusBorderColor })\n const comboboxContext = useMemo(\n () => ({ onActiveDescendant, onClose, onSelect }),\n [onActiveDescendant, onClose, onSelect],\n )\n const autocompleteContext = useMemo(() => ({ max, value }), [value, max])\n const componentContext = useMemo(\n () => ({\n emptyIcon,\n emptyProps,\n getInputProps,\n getSeparatorProps,\n groupProps,\n inputProps,\n optionProps,\n }),\n [\n emptyIcon,\n emptyProps,\n getInputProps,\n getSeparatorProps,\n groupProps,\n inputProps,\n optionProps,\n ],\n )\n const hasValue = isArray(value) ? !!value.length : !!value\n\n return (\n <ComboboxDescendantsContext value={descendants}>\n <ComboboxContext value={comboboxContext}>\n <AutocompleteContext value={autocompleteContext}>\n <ComponentContext value={componentContext}>\n <Popover.Root {...mergedPopoverProps}>\n <InputGroup.Root\n className={className}\n css={css}\n colorScheme={colorScheme}\n {...getRootProps({ ...groupItemProps, ...rootProps })}\n >\n <Popover.Trigger>\n <AutocompleteField {...getFieldProps(varProps)}>\n {fieldChildren}\n </AutocompleteField>\n </Popover.Trigger>\n\n <InputGroup.Element\n {...{ clickable: clearable && hasValue, ...elementProps }}\n >\n {clearable && hasValue ? (\n <AutocompleteIcon\n icon={clearIcon}\n {...getClearIconProps(iconProps)}\n />\n ) : (\n <AutocompleteIcon\n icon={icon}\n {...getIconProps(iconProps)}\n />\n )}\n </InputGroup.Element>\n </InputGroup.Root>\n\n <AutocompleteContent\n {...cast<AutocompleteContentProps>(\n getContentProps(cast<HTMLProps>(contentProps)),\n )}\n >\n {computedChildren}\n </AutocompleteContent>\n </Popover.Root>\n </ComponentContext>\n </AutocompleteContext>\n </ComboboxContext>\n </ComboboxDescendantsContext>\n )\n },\n \"root\",\n)((props) => {\n const context = useInputPropsContext()\n\n return { ...context, ...props }\n}) as GenericsComponent<{\n <Multiple extends boolean = false>(\n props: AutocompleteRootProps<Multiple>,\n ): ReactElement\n}>\n\ninterface AutocompleteFieldProps extends HTMLStyledProps {}\n\nconst AutocompleteField = withContext<\"div\", AutocompleteFieldProps>(\n \"div\",\n \"field\",\n)({ \"data-group-propagate\": \"\" }, ({ children, ...rest }) => {\n const { getInputProps, inputProps } = useComponentContext()\n\n return {\n ...rest,\n children: (\n <>\n {children}\n <AutocompleteInput {...getInputProps(inputProps)} />\n </>\n ),\n }\n})\n\ninterface AutocompleteInputProps extends HTMLStyledProps<\"input\"> {}\n\nconst AutocompleteInput = withContext<\"input\", AutocompleteInputProps>(\n \"input\",\n \"input\",\n)()\n\ninterface AutocompleteIconProps extends HTMLStyledProps {\n icon?: ReactNode\n}\n\nconst AutocompleteIcon = withContext<\"div\", AutocompleteIconProps>(\n \"div\",\n \"icon\",\n)(undefined, ({ children, icon, ...rest }) => ({\n children: icon || children || <ChevronDownIcon />,\n ...rest,\n}))\n\ninterface AutocompleteContentProps extends Popover.ContentProps {}\n\nconst AutocompleteContent = withContext<\"div\", AutocompleteContentProps>(\n Popover.Content,\n \"content\",\n)()\n\nexport interface AutocompleteLabelProps extends HTMLStyledProps<\"span\"> {}\n\nexport const AutocompleteLabel = withContext<\"span\", AutocompleteLabelProps>(\n \"span\",\n \"label\",\n)(undefined, (props) => {\n const { getLabelProps } = useComboboxGroupContext()\n\n return getLabelProps(props)\n})\n\nexport interface AutocompleteGroupProps\n extends UseComboboxGroupProps, HTMLStyledProps {\n /**\n * The label of the group.\n */\n label?: ReactNode\n /**\n * Props for the label component.\n */\n labelProps?: AutocompleteLabelProps\n}\n\nexport const AutocompleteGroup = withContext<\"div\", AutocompleteGroupProps>(\n ({ children, label, labelProps, ...rest }) => {\n const { groupProps } = useComponentContext()\n const { getGroupProps, getLabelProps } = useComboboxGroup({\n ...groupProps,\n ...rest,\n })\n const context = useMemo(() => ({ getLabelProps }), [getLabelProps])\n\n return (\n <ComboboxGroupContext value={context}>\n <styled.div {...getGroupProps()}>\n {label ? (\n <AutocompleteLabel {...labelProps}>{label}</AutocompleteLabel>\n ) : null}\n {children}\n </styled.div>\n </ComboboxGroupContext>\n )\n },\n \"group\",\n)()\n\nexport interface AutocompleteOptionProps\n extends UseAutocompleteOptionProps, HTMLStyledProps {\n /**\n * The icon to be used in the autocomplete option.\n */\n icon?: ReactNode\n}\n\nexport const AutocompleteOption = withContext<\"div\", AutocompleteOptionProps>(\n ({ children, icon: iconProp, ...rest }) => {\n const { optionProps: { icon, ...optionProps } = {} } = useComponentContext()\n const { getIndicatorProps, getOptionProps } = useAutocompleteOption({\n ...optionProps,\n ...rest,\n })\n\n return (\n <styled.div {...getOptionProps()}>\n <AutocompleteIndicator {...getIndicatorProps()}>\n {iconProp ?? icon ?? <CheckIcon />}\n </AutocompleteIndicator>\n {children}\n </styled.div>\n )\n },\n \"option\",\n)()\n\ninterface AutocompleteEmptyProps extends HTMLStyledProps {\n /**\n * The icon to be used in the autocomplete option.\n */\n icon?: ReactNode\n}\n\nconst AutocompleteEmpty = withContext<\"div\", AutocompleteEmptyProps>(\n ({ children, icon, ...rest }) => {\n const { emptyIcon, emptyProps } = useComponentContext()\n\n return (\n <styled.div {...emptyProps} {...rest}>\n <AutocompleteIndicator>\n {icon ?? emptyIcon ?? <MinusIcon />}\n </AutocompleteIndicator>\n {children}\n </styled.div>\n )\n },\n \"empty\",\n)()\n\ninterface AutocompleteIndicatorProps extends HTMLStyledProps {}\n\nconst AutocompleteIndicator = withContext<\"div\", AutocompleteIndicatorProps>(\n \"div\",\n \"indicator\",\n)()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmHA,MAAM,EACJ,kBACA,cAAc,0BACd,qBACA,iBAAiB,6BACjB,aACA,iBACEA,6CAIF,gBAAgBC,6CAAkB;;;;;;AASpC,MAAa,mBAAmB,cAE5B,UACG;CACH,MAAM,CACJ,gBACA,EACE,WACA,KACA,aACA,kBAAkB,eAClB,UACA,YAAY,MACZ,YA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AAC;YAI/D,4CAACC,uBAAO;GAAI,GAAI,eAAe;cAC5B,QACC,2CAAC;IAAkB,GAAI;cAAa;KAA0B,GAC5D,MACH;IACU;GACQ;GAG3B,QACD,EAAE;AAUH,MAAa,qBAAqB,aAC/B,EAAE,UAAU,MAAM,UAAU,GAAG,WAAW;CACzC,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,gBAAgB,EAAE,KAAK,qBAAqB;CAC5E,MAAM,EAAE,mBAAmB,mBAAmBC,+CAAsB;EAClE,GAAG;EACH,GAAG;EACJ,CAAC;AAEF,QACE,4CAACD,uBAAO;EAAI,GAAI,gBAAgB;aAC9B,2CAAC;GAAsB,GAAI,mBAAmB;aAC3C,YAAY,QAAQ,2CAACE,iCAAY;IACZ,EACvB;GACU;GAGjB,SACD,EAAE;AASH,MAAM,oBAAoB,aACvB,EAAE,UAAU,MAAM,GAAG,WAAW;CAC/B,MAAM,EAAE,WAAW,eAAe,qBAAqB;AAEvD,QACE,4CAACF,uBAAO;EAAI,GAAI;EAAY,GAAI;aAC9B,2CAAC,mCACE,QAAQ,aAAa,2CAACG,iCAAY,GACb,EACvB;GACU;GAGjB,QACD,EAAE;AAIH,MAAM,wBAAwB,YAC5B,OACA,YACD,EAAE"}
|
|
1
|
+
{"version":3,"file":"autocomplete.cjs","names":["createSlotComponent","autocompleteStyle","XIcon","useGroupItemProps","usePopoverStyleProps","useAutocomplete","createComboboxItem","createComboboxChildren","useInputBorder","ComboboxDescendantsContext","ComboboxContext","AutocompleteContext","mergeProps","useInputPropsContext","ChevronDownIcon","useComboboxGroupContext","useComboboxGroup","ComboboxGroupContext","styled","useAutocompleteOption","CheckIcon","MinusIcon"],"sources":["../../../../src/components/autocomplete/autocomplete.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type {\n ComboboxItem,\n UseComboboxGroupProps,\n} from \"../../hooks/use-combobox\"\nimport type { Merge } from \"../../utils\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { UsePopoverStyleProps, UsePopupAnimationProps } from \"../popover\"\nimport type { AutocompleteStyle } from \"./autocomplete.style\"\nimport type {\n UseAutocompleteOptionProps,\n UseAutocompleteProps,\n UseAutocompleteReturn,\n} from \"./use-autocomplete\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport {\n ComboboxContext,\n ComboboxDescendantsContext,\n ComboboxGroupContext,\n createComboboxChildren,\n createComboboxItem,\n useComboboxGroup,\n useComboboxGroupContext,\n} from \"../../hooks/use-combobox\"\nimport { cast, isArray } from \"../../utils\"\nimport { useGroupItemProps } from \"../group\"\nimport { CheckIcon, ChevronDownIcon, MinusIcon, XIcon } from \"../icon\"\nimport { InputGroup, useInputBorder, useInputPropsContext } from \"../input\"\nimport { Popover, usePopoverStyleProps } from \"../popover\"\nimport { autocompleteStyle } from \"./autocomplete.style\"\nimport {\n AutocompleteContext,\n useAutocomplete,\n useAutocompleteOption,\n} from \"./use-autocomplete\"\n\ninterface ComponentContext\n extends\n Pick<UseAutocompleteReturn, \"getInputProps\" | \"getSeparatorProps\">,\n Pick<\n AutocompleteRootProps,\n \"emptyIcon\" | \"emptyProps\" | \"groupProps\" | \"inputProps\" | \"optionProps\"\n > {}\n\nexport interface AutocompleteRootProps<Multiple extends boolean = false>\n extends\n Omit<\n HTMLStyledProps,\n \"defaultValue\" | \"filter\" | \"offset\" | \"onChange\" | \"ref\" | \"value\"\n >,\n Merge<UseAutocompleteProps<Multiple>, UsePopoverStyleProps>,\n UsePopupAnimationProps,\n ThemeProps<AutocompleteStyle>,\n UseInputBorderProps {\n /**\n * If `true`, display the clear icon.\n *\n * @default true\n */\n clearable?: boolean\n /**\n * The icon to be used in the clear button.\n */\n clearIcon?: ReactNode\n /**\n * The icon to be used in the empty element.\n */\n emptyIcon?: ReactNode\n /**\n * The icon to be used in the autocomplete.\n */\n icon?: ReactNode\n /**\n * Props for content element.\n */\n contentProps?: AutocompleteContentProps\n /**\n * The props for the end element.\n */\n elementProps?: InputGroup.ElementProps\n /**\n * Props for empty element.\n */\n emptyProps?: AutocompleteEmptyProps\n /**\n * Props for group element.\n */\n groupProps?: Omit<AutocompleteGroupProps, \"children\" | \"label\">\n /**\n * Props for icon element.\n */\n iconProps?: AutocompleteIconProps\n /**\n * The props for the input element.\n */\n inputProps?: HTMLStyledProps<\"input\">\n /**\n * Props for option element.\n */\n optionProps?: Omit<AutocompleteOptionProps, \"children\" | \"value\">\n /**\n * Props for root element.\n */\n rootProps?: InputGroup.RootProps\n}\n\nconst {\n ComponentContext,\n PropsContext: AutocompletePropsContext,\n useComponentContext,\n usePropsContext: useAutocompletePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<\n AutocompleteRootProps,\n AutocompleteStyle,\n ComponentContext\n>(\"autocomplete\", autocompleteStyle)\n\nexport { AutocompletePropsContext, useAutocompletePropsContext }\n\n/**\n * `Autocomplete` is a component used to display suggestions in response to user text input.\n *\n * @see https://yamada-ui.com/docs/components/autocomplete\n */\nexport const AutocompleteRoot = withProvider(\n <Multiple extends boolean = false>(\n props: AutocompleteRootProps<Multiple>,\n ) => {\n const [\n groupItemProps,\n {\n className,\n css,\n colorScheme,\n animationScheme = \"block-start\",\n children,\n clearable = true,\n clearIcon = <XIcon />,\n duration,\n emptyIcon,\n errorBorderColor,\n focusBorderColor,\n icon,\n items: itemsProp,\n contentProps,\n elementProps,\n emptyProps,\n groupProps,\n iconProps,\n inputProps,\n optionProps,\n rootProps,\n ...rest\n },\n ] = useGroupItemProps(props)\n const popoverStyleProps = usePopoverStyleProps(rest)\n const items = useMemo<ComboboxItem[]>(() => {\n if (itemsProp) return itemsProp\n\n return createComboboxItem(children, {\n Group: AutocompleteGroup,\n Label: AutocompleteLabel,\n Option: AutocompleteOption,\n })\n }, [itemsProp, children])\n const {\n children: fieldChildren,\n descendants,\n items: computedItems,\n max,\n value,\n getClearIconProps,\n getContentProps,\n getFieldProps,\n getIconProps,\n getInputProps,\n getRootProps,\n getSeparatorProps,\n popoverProps,\n onActiveDescendant,\n onClose,\n onSelect,\n } = useAutocomplete({ items, ...rest, ...popoverStyleProps })\n const mergedPopoverProps = useMemo<Popover.RootProps>(\n () => ({\n animationScheme,\n duration,\n ...popoverProps,\n }),\n [animationScheme, duration, popoverProps],\n )\n const computedChildren = useMemo(\n () =>\n createComboboxChildren(computedItems, {\n Empty: AutocompleteEmpty,\n Group: AutocompleteGroup,\n Option: AutocompleteOption,\n }),\n [computedItems],\n )\n const varProps = useInputBorder({ errorBorderColor, focusBorderColor })\n const comboboxContext = useMemo(\n () => ({ onActiveDescendant, onClose, onSelect }),\n [onActiveDescendant, onClose, onSelect],\n )\n const autocompleteContext = useMemo(() => ({ max, value }), [value, max])\n const componentContext = useMemo(\n () => ({\n emptyIcon,\n emptyProps,\n getInputProps,\n getSeparatorProps,\n groupProps,\n inputProps,\n optionProps,\n }),\n [\n emptyIcon,\n emptyProps,\n getInputProps,\n getSeparatorProps,\n groupProps,\n inputProps,\n optionProps,\n ],\n )\n const hasValue = isArray(value) ? !!value.length : !!value\n\n return (\n <ComboboxDescendantsContext value={descendants}>\n <ComboboxContext value={comboboxContext}>\n <AutocompleteContext value={autocompleteContext}>\n <ComponentContext value={componentContext}>\n <Popover.Root {...mergedPopoverProps}>\n <InputGroup.Root\n colorScheme={colorScheme}\n {...mergeProps(\n { className, css },\n getRootProps(groupItemProps),\n rootProps,\n )()}\n >\n <Popover.Trigger>\n <AutocompleteField {...getFieldProps(varProps)}>\n {fieldChildren}\n </AutocompleteField>\n </Popover.Trigger>\n\n <InputGroup.Element\n {...{ clickable: clearable && hasValue, ...elementProps }}\n >\n {clearable && hasValue ? (\n <AutocompleteIcon\n icon={clearIcon}\n {...getClearIconProps(iconProps)}\n />\n ) : (\n <AutocompleteIcon\n icon={icon}\n {...getIconProps(iconProps)}\n />\n )}\n </InputGroup.Element>\n </InputGroup.Root>\n\n <AutocompleteContent\n {...cast<AutocompleteContentProps>(\n getContentProps(cast<HTMLProps>(contentProps)),\n )}\n >\n {computedChildren}\n </AutocompleteContent>\n </Popover.Root>\n </ComponentContext>\n </AutocompleteContext>\n </ComboboxContext>\n </ComboboxDescendantsContext>\n )\n },\n \"root\",\n)((props) => {\n const context = useInputPropsContext()\n\n return mergeProps(context, props)()\n}) as GenericsComponent<{\n <Multiple extends boolean = false>(\n props: AutocompleteRootProps<Multiple>,\n ): ReactElement\n}>\n\ninterface AutocompleteFieldProps extends HTMLStyledProps {}\n\nconst AutocompleteField = withContext<\"div\", AutocompleteFieldProps>(\n \"div\",\n \"field\",\n)({ \"data-group-propagate\": \"\" }, ({ children, ...rest }) => {\n const { getInputProps, inputProps } = useComponentContext()\n\n return {\n ...rest,\n children: (\n <>\n {children}\n <AutocompleteInput {...getInputProps(inputProps)} />\n </>\n ),\n }\n})\n\ninterface AutocompleteInputProps extends HTMLStyledProps<\"input\"> {}\n\nconst AutocompleteInput = withContext<\"input\", AutocompleteInputProps>(\n \"input\",\n \"input\",\n)()\n\ninterface AutocompleteIconProps extends HTMLStyledProps {\n icon?: ReactNode\n}\n\nconst AutocompleteIcon = withContext<\"div\", AutocompleteIconProps>(\n \"div\",\n \"icon\",\n)(undefined, ({ children, icon, ...rest }) => ({\n children: icon || children || <ChevronDownIcon />,\n ...rest,\n}))\n\ninterface AutocompleteContentProps extends Popover.ContentProps {}\n\nconst AutocompleteContent = withContext<\"div\", AutocompleteContentProps>(\n Popover.Content,\n \"content\",\n)()\n\nexport interface AutocompleteLabelProps extends HTMLStyledProps<\"span\"> {}\n\nexport const AutocompleteLabel = withContext<\"span\", AutocompleteLabelProps>(\n \"span\",\n \"label\",\n)(undefined, (props) => {\n const { getLabelProps } = useComboboxGroupContext()\n\n return getLabelProps(props)\n})\n\nexport interface AutocompleteGroupProps\n extends UseComboboxGroupProps, HTMLStyledProps {\n /**\n * The label of the group.\n */\n label?: ReactNode\n /**\n * Props for the label component.\n */\n labelProps?: AutocompleteLabelProps\n}\n\nexport const AutocompleteGroup = withContext<\"div\", AutocompleteGroupProps>(\n ({ children, label, labelProps, ...rest }) => {\n const { groupProps } = useComponentContext()\n const { getGroupProps, getLabelProps } = useComboboxGroup(\n mergeProps(groupProps, rest)(),\n )\n const context = useMemo(() => ({ getLabelProps }), [getLabelProps])\n\n return (\n <ComboboxGroupContext value={context}>\n <styled.div {...getGroupProps()}>\n {label ? (\n <AutocompleteLabel {...labelProps}>{label}</AutocompleteLabel>\n ) : null}\n {children}\n </styled.div>\n </ComboboxGroupContext>\n )\n },\n \"group\",\n)()\n\nexport interface AutocompleteOptionProps\n extends UseAutocompleteOptionProps, HTMLStyledProps {\n /**\n * The icon to be used in the autocomplete option.\n */\n icon?: ReactNode\n}\n\nexport const AutocompleteOption = withContext<\"div\", AutocompleteOptionProps>(\n ({ children, icon: iconProp, ...rest }) => {\n const { optionProps: { icon, ...optionProps } = {} } = useComponentContext()\n const { getIndicatorProps, getOptionProps } = useAutocompleteOption(\n mergeProps(optionProps, rest)(),\n )\n\n return (\n <styled.div {...getOptionProps()}>\n <AutocompleteIndicator {...getIndicatorProps()}>\n {iconProp ?? icon ?? <CheckIcon />}\n </AutocompleteIndicator>\n {children}\n </styled.div>\n )\n },\n \"option\",\n)()\n\ninterface AutocompleteEmptyProps extends HTMLStyledProps {\n /**\n * The icon to be used in the autocomplete option.\n */\n icon?: ReactNode\n}\n\nconst AutocompleteEmpty = withContext<\"div\", AutocompleteEmptyProps>(\n ({ children, icon, ...rest }) => {\n const { emptyIcon, emptyProps } = useComponentContext()\n\n return (\n <styled.div {...mergeProps(emptyProps, rest)()}>\n <AutocompleteIndicator>\n {icon ?? emptyIcon ?? <MinusIcon />}\n </AutocompleteIndicator>\n {children}\n </styled.div>\n )\n },\n \"empty\",\n)()\n\ninterface AutocompleteIndicatorProps extends HTMLStyledProps {}\n\nconst AutocompleteIndicator = withContext<\"div\", AutocompleteIndicatorProps>(\n \"div\",\n \"ind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D,QAAO,cAAc,MAAM;EAC3B;AAcF,MAAa,oBAAoB,aAC9B,EAAE,UAAU,OAAO,YAAY,GAAG,WAAW;CAC5C,MAAM,EAAE,eAAe,qBAAqB;CAC5C,MAAM,EAAE,eAAe,kBAAkBC,kDACvCJ,yBAAW,YAAY,KAAK,EAAE,CAC/B;AAGD,QACE,2CAACK;EAAqB,iCAHO,EAAE,eAAe,GAAG,CAAC,cAAc,CAAC;YAI/D,4CAACC,uBAAO;GAAI,GAAI,eAAe;cAC5B,QACC,2CAAC;IAAkB,GAAI;cAAa;KAA0B,GAC5D,MACH;IACU;GACQ;GAG3B,QACD,EAAE;AAUH,MAAa,qBAAqB,aAC/B,EAAE,UAAU,MAAM,UAAU,GAAG,WAAW;CACzC,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,gBAAgB,EAAE,KAAK,qBAAqB;CAC5E,MAAM,EAAE,mBAAmB,mBAAmBC,+CAC5CP,yBAAW,aAAa,KAAK,EAAE,CAChC;AAED,QACE,4CAACM,uBAAO;EAAI,GAAI,gBAAgB;aAC9B,2CAAC;GAAsB,GAAI,mBAAmB;aAC3C,YAAY,QAAQ,2CAACE,iCAAY;IACZ,EACvB;GACU;GAGjB,SACD,EAAE;AASH,MAAM,oBAAoB,aACvB,EAAE,UAAU,MAAM,GAAG,WAAW;CAC/B,MAAM,EAAE,WAAW,eAAe,qBAAqB;AAEvD,QACE,4CAACF,uBAAO;EAAI,GAAIN,yBAAW,YAAY,KAAK,EAAE;aAC5C,2CAAC,mCACE,QAAQ,aAAa,2CAACS,iCAAY,GACb,EACvB;GACU;GAGjB,QACD,EAAE;AAIH,MAAM,wBAAwB,YAC5B,OACA,YACD,EAAE"}
|
|
@@ -4,6 +4,7 @@ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
|
4
4
|
const require_children = require('../../utils/children.cjs');
|
|
5
5
|
const require_utils_index = require('../../utils/index.cjs');
|
|
6
6
|
const require_factory = require('../../core/system/factory.cjs');
|
|
7
|
+
const require_props = require('../../core/components/props.cjs');
|
|
7
8
|
const require_create_component = require('../../core/components/create-component.cjs');
|
|
8
9
|
require('../../core/index.cjs');
|
|
9
10
|
const require_data_list_style = require('./data-list.style.cjs');
|
|
@@ -64,21 +65,17 @@ const DataListItem = withContext(({ children, description, term, descriptionProp
|
|
|
64
65
|
...rest,
|
|
65
66
|
children: [
|
|
66
67
|
!(0, require_utils_index.utils_exports.isEmpty)(customTerms) ? customTerms : (0, require_utils_index.utils_exports.isArray)(term) ? term.map((item, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataListTerm, {
|
|
67
|
-
...termProps,
|
|
68
|
-
...customTermProps,
|
|
68
|
+
...require_props.mergeProps(termProps, customTermProps)(),
|
|
69
69
|
children: item
|
|
70
70
|
}, index)) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataListTerm, {
|
|
71
|
-
...termProps,
|
|
72
|
-
...customTermProps,
|
|
71
|
+
...require_props.mergeProps(termProps, customTermProps)(),
|
|
73
72
|
children: term
|
|
74
73
|
}),
|
|
75
74
|
!(0, require_utils_index.utils_exports.isEmpty)(customDescriptions) ? customDescriptions : (0, require_utils_index.utils_exports.isArray)(description) ? description.map((item, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataListDescription, {
|
|
76
|
-
...descriptionProps,
|
|
77
|
-
...customDescriptionProps,
|
|
75
|
+
...require_props.mergeProps(descriptionProps, customDescriptionProps)(),
|
|
78
76
|
children: item
|
|
79
77
|
}, index)) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataListDescription, {
|
|
80
|
-
...descriptionProps,
|
|
81
|
-
...customDescriptionProps,
|
|
78
|
+
...require_props.mergeProps(descriptionProps, customDescriptionProps)(),
|
|
82
79
|
children: description
|
|
83
80
|
}),
|
|
84
81
|
omittedChildren
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-list.cjs","names":["createSlotComponent","dataListStyle","col","pickChildren","getValidChildren","styled","customTerms","customDescriptions","omitChildren"],"sources":["../../../../src/components/data-list/data-list.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { DataListStyle } from \"./data-list.style\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport {\n getValidChildren,\n isArray,\n isEmpty,\n omitChildren,\n pickChildren,\n} from \"../../utils\"\nimport { dataListStyle } from \"./data-list.style\"\n\nexport interface DataListItem extends DataListItemProps {}\n\nexport interface DataListRootProps\n extends HTMLStyledProps<\"dl\">, ThemeProps<DataListStyle> {\n /**\n * If provided, generate elements based on items.\n */\n items?: DataListItem[]\n /**\n * The props for the data list description component.\n */\n descriptionProps?: DataListDescriptionProps\n /**\n * The props for the data list term component.\n */\n termProps?: DataListTermProps\n}\n\ninterface ComponentContext extends Pick<\n DataListRootProps,\n \"descriptionProps\" | \"termProps\"\n> {}\n\nconst {\n ComponentContext,\n PropsContext: DataListPropsContext,\n useComponentContext,\n usePropsContext: useDataListPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<DataListRootProps, DataListStyle, ComponentContext>(\n \"data-list\",\n dataListStyle,\n)\n\nexport { DataListPropsContext, useDataListPropsContext }\n\n/**\n * `DataList` is used to display a list of data items.\n *\n * @see https://yamada-ui.com/docs/components/data-list\n */\nexport const DataListRoot = withProvider<\"dl\", DataListRootProps>(\n ({ style, children, items = [], descriptionProps, termProps, ...rest }) => {\n const col = useMemo(() => {\n let col = 0\n\n if (children) {\n const validChildren = getValidChildren(children)\n const dataListItems = pickChildren(validChildren, DataListItem)\n\n dataListItems.forEach(({ props }) => {\n const validChildren = getValidChildren(props.children)\n const pickedChildren = pickChildren(\n validChildren,\n DataListTerm,\n DataListDescription,\n )\n\n col = Math.max(col, pickedChildren.length)\n })\n } else {\n items.forEach(({ description, term }) => {\n const termCount = !term ? 0 : isArray(term) ? term.length : 1\n const descriptionCount = !description\n ? 0\n : isArray(description)\n ? description.length\n : 1\n\n col = Math.max(col, termCount + descriptionCount)\n })\n }\n\n return col\n }, [children, items])\n const computedChildren = useMemo(\n () =>\n items.map((props, index) => <DataListItem key={index} {...props} />),\n [items],\n )\n const context = useMemo(\n () => ({\n descriptionProps,\n termProps,\n }),\n [descriptionProps, termProps],\n )\n\n return (\n <ComponentContext value={context}>\n <styled.dl style={{ \"--col\": col, ...style }} {...rest}>\n {children ?? computedChildren}\n </styled.dl>\n </ComponentContext>\n )\n },\n \"root\",\n)()\n\nexport interface DataListItemProps extends HTMLStyledProps {\n /**\n * The data list description to use.\n */\n description?: ReactNode | ReactNode[]\n /**\n * The data list term to use.\n */\n term?: ReactNode | ReactNode[]\n /**\n * The props for the data list description component.\n */\n descriptionProps?: DataListDescriptionProps\n /**\n * The props for the data list term component.\n */\n termProps?: DataListTermProps\n}\n\nexport const DataListItem = withContext<\"div\", DataListItemProps>(\n ({\n children,\n description,\n term,\n descriptionProps: customDescriptionProps,\n termProps: customTermProps,\n ...rest\n }) => {\n const { descriptionProps, termProps } = useComponentContext()\n\n const [omittedChildren, customTerms, customDescriptions] = useMemo(() => {\n const validChildren = getValidChildren(children)\n\n if (isEmpty(validChildren)) return [children]\n\n const customTerms = pickChildren(validChildren, DataListTerm)\n const customDescriptions = pickChildren(\n validChildren,\n DataListDescription,\n )\n const omittedChildren = omitChildren(\n validChildren,\n DataListTerm,\n DataListDescription,\n )\n\n return [omittedChildren, customTerms, customDescriptions] as const\n }, [children])\n\n return (\n <styled.div {...rest}>\n {!isEmpty(customTerms) ? (\n customTerms\n ) : isArray(term) ? (\n term.map((item, index) => (\n <DataListTerm
|
|
1
|
+
{"version":3,"file":"data-list.cjs","names":["createSlotComponent","dataListStyle","col","pickChildren","getValidChildren","styled","customTerms","customDescriptions","omitChildren","mergeProps"],"sources":["../../../../src/components/data-list/data-list.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { DataListStyle } from \"./data-list.style\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport {\n getValidChildren,\n isArray,\n isEmpty,\n omitChildren,\n pickChildren,\n} from \"../../utils\"\nimport { dataListStyle } from \"./data-list.style\"\n\nexport interface DataListItem extends DataListItemProps {}\n\nexport interface DataListRootProps\n extends HTMLStyledProps<\"dl\">, ThemeProps<DataListStyle> {\n /**\n * If provided, generate elements based on items.\n */\n items?: DataListItem[]\n /**\n * The props for the data list description component.\n */\n descriptionProps?: DataListDescriptionProps\n /**\n * The props for the data list term component.\n */\n termProps?: DataListTermProps\n}\n\ninterface ComponentContext extends Pick<\n DataListRootProps,\n \"descriptionProps\" | \"termProps\"\n> {}\n\nconst {\n ComponentContext,\n PropsContext: DataListPropsContext,\n useComponentContext,\n usePropsContext: useDataListPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<DataListRootProps, DataListStyle, ComponentContext>(\n \"data-list\",\n dataListStyle,\n)\n\nexport { DataListPropsContext, useDataListPropsContext }\n\n/**\n * `DataList` is used to display a list of data items.\n *\n * @see https://yamada-ui.com/docs/components/data-list\n */\nexport const DataListRoot = withProvider<\"dl\", DataListRootProps>(\n ({ style, children, items = [], descriptionProps, termProps, ...rest }) => {\n const col = useMemo(() => {\n let col = 0\n\n if (children) {\n const validChildren = getValidChildren(children)\n const dataListItems = pickChildren(validChildren, DataListItem)\n\n dataListItems.forEach(({ props }) => {\n const validChildren = getValidChildren(props.children)\n const pickedChildren = pickChildren(\n validChildren,\n DataListTerm,\n DataListDescription,\n )\n\n col = Math.max(col, pickedChildren.length)\n })\n } else {\n items.forEach(({ description, term }) => {\n const termCount = !term ? 0 : isArray(term) ? term.length : 1\n const descriptionCount = !description\n ? 0\n : isArray(description)\n ? description.length\n : 1\n\n col = Math.max(col, termCount + descriptionCount)\n })\n }\n\n return col\n }, [children, items])\n const computedChildren = useMemo(\n () =>\n items.map((props, index) => <DataListItem key={index} {...props} />),\n [items],\n )\n const context = useMemo(\n () => ({\n descriptionProps,\n termProps,\n }),\n [descriptionProps, termProps],\n )\n\n return (\n <ComponentContext value={context}>\n <styled.dl style={{ \"--col\": col, ...style }} {...rest}>\n {children ?? computedChildren}\n </styled.dl>\n </ComponentContext>\n )\n },\n \"root\",\n)()\n\nexport interface DataListItemProps extends HTMLStyledProps {\n /**\n * The data list description to use.\n */\n description?: ReactNode | ReactNode[]\n /**\n * The data list term to use.\n */\n term?: ReactNode | ReactNode[]\n /**\n * The props for the data list description component.\n */\n descriptionProps?: DataListDescriptionProps\n /**\n * The props for the data list term component.\n */\n termProps?: DataListTermProps\n}\n\nexport const DataListItem = withContext<\"div\", DataListItemProps>(\n ({\n children,\n description,\n term,\n descriptionProps: customDescriptionProps,\n termProps: customTermProps,\n ...rest\n }) => {\n const { descriptionProps, termProps } = useComponentContext()\n\n const [omittedChildren, customTerms, customDescriptions] = useMemo(() => {\n const validChildren = getValidChildren(children)\n\n if (isEmpty(validChildren)) return [children]\n\n const customTerms = pickChildren(validChildren, DataListTerm)\n const customDescriptions = pickChildren(\n validChildren,\n DataListDescription,\n )\n const omittedChildren = omitChildren(\n validChildren,\n DataListTerm,\n DataListDescription,\n )\n\n return [omittedChildren, customTerms, customDescriptions] as const\n }, [children])\n\n return (\n <styled.div {...rest}>\n {!isEmpty(customTerms) ? (\n customTerms\n ) : isArray(term) ? (\n term.map((item, index) => (\n <DataListTerm\n key={index}\n {...mergeProps(termProps, customTermProps)()}\n >\n {item}\n </DataListTerm>\n ))\n ) : (\n <DataListTerm {...mergeProps(termProps, customTermProps)()}>\n {term}\n </DataListTerm>\n )}\n\n {!isEmpty(customDescriptions) ? (\n customDescriptions\n ) : isArray(description) ? (\n description.map((item, index) => (\n <DataListDescription\n key={index}\n {...mergeProps(descriptionProps, customDescriptionProps)()}\n >\n {item}\n </DataListDescription>\n ))\n ) : (\n <DataListDescription\n {...mergeProps(descriptionProps, customDescriptionProps)()}\n >\n {description}\n </DataListDescription>\n )}\n\n {omittedChildren}\n </styled.div>\n )\n },\n \"item\",\n)()\n\nexport interface DataListTermProps extends HTMLStyledProps<\"dt\"> {}\n\nexport const DataListTerm = withContext<\"dt\", DataListTermProps>(\"dt\", \"term\")()\n\nexport interface DataListDescriptionProps extends HTMLStyledProps<\"dd\"> {}\n\nexport const DataListDescription = withContext<\"dd\", DataListDescriptionProps>(\n \"dd\",\n \"description\",\n)()\n"],"mappings":";;;;;;;;;;;;;;AAuCA,MAAM,EACJ,kBACA,cAAc,sBACd,qBACA,iBAAiB,yBACjB,aACA,iBACEA,6CACF,aACAC,sCACD;;;;;;AASD,MAAa,eAAe,cACzB,EAAE,OAAO,UAAU,QAAQ,EAAE,EAAE,kBAAkB,WAAW,GAAG,WAAW;CACzE,MAAM,+BAAoB;EACxB,IAAIC,QAAM;AAEV,MAAI,SAIF,CAFsBC,8BADAC,kCAAiB,SAAS,EACE,aAAa,CAEjD,SAAS,EAAE,YAAY;GAEnC,MAAM,iBAAiBD,8BADDC,kCAAiB,MAAM,SAAS,EAGpD,cACA,oBACD;AAED,WAAM,KAAK,IAAIF,OAAK,eAAe,OAAO;IAC1C;MAEF,OAAM,SAAS,EAAE,aAAa,WAAW;GACvC,MAAM,YAAY,CAAC,OAAO,mDAAY,KAAK,GAAG,KAAK,SAAS;GAC5D,MAAM,mBAAmB,CAAC,cACtB,mDACQ,YAAY,GAClB,YAAY,SACZ;AAEN,WAAM,KAAK,IAAIA,OAAK,YAAY,iBAAiB;IACjD;AAGJ,SAAOA;IACN,CAAC,UAAU,MAAM,CAAC;CACrB,MAAM,4CAEF,MAAM,KAAK,OAAO,UAAU,2CAAC,gBAAyB,GAAI,SAAX,MAAoB,CAAC,EACtE,CAAC,MAAM,CACR;AASD,QACE,2CAAC;EAAiB,iCARX;GACL;GACA;GACD,GACD,CAAC,kBAAkB,UAAU,CAC9B;YAIG,2CAACG,uBAAO;GAAG,OAAO;IAAE,SAAS;IAAK,GAAG;IAAO;GAAE,GAAI;aAC/C,YAAY;IACH;GACK;GAGvB,OACD,EAAE;AAqBH,MAAa,eAAe,aACzB,EACC,UACA,aACA,MACA,kBAAkB,wBAClB,WAAW,iBACX,GAAG,WACC;CACJ,MAAM,EAAE,kBAAkB,cAAc,qBAAqB;CAE7D,MAAM,CAAC,iBAAiB,aAAa,+CAAoC;EACvE,MAAM,gBAAgBD,kCAAiB,SAAS;AAEhD,qDAAY,cAAc,CAAE,QAAO,CAAC,SAAS;EAE7C,MAAME,gBAAcH,8BAAa,eAAe,aAAa;EAC7D,MAAMI,uBAAqBJ,8BACzB,eACA,oBACD;AAOD,SAAO;GANiBK,8BACtB,eACA,cACA,oBACD;GAEwBF;GAAaC;GAAmB;IACxD,CAAC,SAAS,CAAC;AAEd,QACE,4CAACF,uBAAO;EAAI,GAAI;;GACb,gDAAS,YAAY,GACpB,6DACU,KAAK,GACf,KAAK,KAAK,MAAM,UACd,2CAAC;IAEC,GAAII,yBAAW,WAAW,gBAAgB,EAAE;cAE3C;MAHI,MAIQ,CACf,GAEF,2CAAC;IAAa,GAAIA,yBAAW,WAAW,gBAAgB,EAAE;cACvD;KACY;GAGhB,gDAAS,mBAAmB,GAC3B,oEACU,YAAY,GACtB,YAAY,KAAK,MAAM,UACrB,2CAAC;IAEC,GAAIA,yBAAW,kBAAkB,uBAAuB,EAAE;cAEzD;MAHI,MAIe,CACtB,GAEF,2CAAC;IACC,GAAIA,yBAAW,kBAAkB,uBAAuB,EAAE;cAEzD;KACmB;GAGvB;;GACU;GAGjB,OACD,EAAE;AAIH,MAAa,eAAe,YAAqC,MAAM,OAAO,EAAE;AAIhF,MAAa,sBAAsB,YACjC,MACA,cACD,EAAE"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { utils_exports } from "../../utils/index.js";
|
|
4
4
|
import { styled } from "../../core/system/factory.js";
|
|
5
|
+
import { mergeProps } from "../../core/components/props.js";
|
|
5
6
|
import { createSlotComponent } from "../../core/components/create-component.js";
|
|
6
7
|
import "../../core/index.js";
|
|
7
8
|
import { CheckIcon } from "../icon/icons/check-icon.js";
|
|
@@ -106,13 +107,11 @@ const AutocompleteRoot = withProvider((props) => {
|
|
|
106
107
|
children: /* @__PURE__ */ jsxs(PopoverRoot, {
|
|
107
108
|
...mergedPopoverProps,
|
|
108
109
|
children: [/* @__PURE__ */ jsxs(InputGroupRoot, {
|
|
109
|
-
className,
|
|
110
|
-
css,
|
|
111
110
|
colorScheme,
|
|
112
|
-
...
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}),
|
|
111
|
+
...mergeProps({
|
|
112
|
+
className,
|
|
113
|
+
css
|
|
114
|
+
}, getRootProps(groupItemProps), rootProps)(),
|
|
116
115
|
children: [/* @__PURE__ */ jsx(PopoverTrigger, { children: /* @__PURE__ */ jsx(AutocompleteField, {
|
|
117
116
|
...getFieldProps(varProps),
|
|
118
117
|
children: fieldChildren
|
|
@@ -137,10 +136,7 @@ const AutocompleteRoot = withProvider((props) => {
|
|
|
137
136
|
})
|
|
138
137
|
});
|
|
139
138
|
}, "root")((props) => {
|
|
140
|
-
return
|
|
141
|
-
...useInputPropsContext(),
|
|
142
|
-
...props
|
|
143
|
-
};
|
|
139
|
+
return mergeProps(useInputPropsContext(), props)();
|
|
144
140
|
});
|
|
145
141
|
const AutocompleteField = withContext("div", "field")({ "data-group-propagate": "" }, ({ children, ...rest }) => {
|
|
146
142
|
const { getInputProps, inputProps } = useComponentContext();
|
|
@@ -161,10 +157,7 @@ const AutocompleteLabel = withContext("span", "label")(void 0, (props) => {
|
|
|
161
157
|
});
|
|
162
158
|
const AutocompleteGroup = withContext(({ children, label, labelProps, ...rest }) => {
|
|
163
159
|
const { groupProps } = useComponentContext();
|
|
164
|
-
const { getGroupProps, getLabelProps } = useComboboxGroup(
|
|
165
|
-
...groupProps,
|
|
166
|
-
...rest
|
|
167
|
-
});
|
|
160
|
+
const { getGroupProps, getLabelProps } = useComboboxGroup(mergeProps(groupProps, rest)());
|
|
168
161
|
return /* @__PURE__ */ jsx(ComboboxGroupContext, {
|
|
169
162
|
value: useMemo(() => ({ getLabelProps }), [getLabelProps]),
|
|
170
163
|
children: /* @__PURE__ */ jsxs(styled.div, {
|
|
@@ -178,10 +171,7 @@ const AutocompleteGroup = withContext(({ children, label, labelProps, ...rest })
|
|
|
178
171
|
}, "group")();
|
|
179
172
|
const AutocompleteOption = withContext(({ children, icon: iconProp, ...rest }) => {
|
|
180
173
|
const { optionProps: { icon, ...optionProps } = {} } = useComponentContext();
|
|
181
|
-
const { getIndicatorProps, getOptionProps } = useAutocompleteOption(
|
|
182
|
-
...optionProps,
|
|
183
|
-
...rest
|
|
184
|
-
});
|
|
174
|
+
const { getIndicatorProps, getOptionProps } = useAutocompleteOption(mergeProps(optionProps, rest)());
|
|
185
175
|
return /* @__PURE__ */ jsxs(styled.div, {
|
|
186
176
|
...getOptionProps(),
|
|
187
177
|
children: [/* @__PURE__ */ jsx(AutocompleteIndicator, {
|
|
@@ -193,8 +183,7 @@ const AutocompleteOption = withContext(({ children, icon: iconProp, ...rest }) =
|
|
|
193
183
|
const AutocompleteEmpty = withContext(({ children, icon, ...rest }) => {
|
|
194
184
|
const { emptyIcon, emptyProps } = useComponentContext();
|
|
195
185
|
return /* @__PURE__ */ jsxs(styled.div, {
|
|
196
|
-
...emptyProps,
|
|
197
|
-
...rest,
|
|
186
|
+
...mergeProps(emptyProps, rest)(),
|
|
198
187
|
children: [/* @__PURE__ */ jsx(AutocompleteIndicator, { children: icon ?? emptyIcon ?? /* @__PURE__ */ jsx(MinusIcon, {}) }), children]
|
|
199
188
|
});
|
|
200
189
|
}, "empty")();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.js","names":["Popover.Root","InputGroup.Root","Popover.Trigger","InputGroup.Element","Popover.Content"],"sources":["../../../../src/components/autocomplete/autocomplete.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type {\n ComboboxItem,\n UseComboboxGroupProps,\n} from \"../../hooks/use-combobox\"\nimport type { Merge } from \"../../utils\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { UsePopoverStyleProps, UsePopupAnimationProps } from \"../popover\"\nimport type { AutocompleteStyle } from \"./autocomplete.style\"\nimport type {\n UseAutocompleteOptionProps,\n UseAutocompleteProps,\n UseAutocompleteReturn,\n} from \"./use-autocomplete\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport {\n ComboboxContext,\n ComboboxDescendantsContext,\n ComboboxGroupContext,\n createComboboxChildren,\n createComboboxItem,\n useComboboxGroup,\n useComboboxGroupContext,\n} from \"../../hooks/use-combobox\"\nimport { cast, isArray } from \"../../utils\"\nimport { useGroupItemProps } from \"../group\"\nimport { CheckIcon, ChevronDownIcon, MinusIcon, XIcon } from \"../icon\"\nimport { InputGroup, useInputBorder, useInputPropsContext } from \"../input\"\nimport { Popover, usePopoverStyleProps } from \"../popover\"\nimport { autocompleteStyle } from \"./autocomplete.style\"\nimport {\n AutocompleteContext,\n useAutocomplete,\n useAutocompleteOption,\n} from \"./use-autocomplete\"\n\ninterface ComponentContext\n extends\n Pick<UseAutocompleteReturn, \"getInputProps\" | \"getSeparatorProps\">,\n Pick<\n AutocompleteRootProps,\n \"emptyIcon\" | \"emptyProps\" | \"groupProps\" | \"inputProps\" | \"optionProps\"\n > {}\n\nexport interface AutocompleteRootProps<Multiple extends boolean = false>\n extends\n Omit<\n HTMLStyledProps,\n \"defaultValue\" | \"filter\" | \"offset\" | \"onChange\" | \"ref\" | \"value\"\n >,\n Merge<UseAutocompleteProps<Multiple>, UsePopoverStyleProps>,\n UsePopupAnimationProps,\n ThemeProps<AutocompleteStyle>,\n UseInputBorderProps {\n /**\n * If `true`, display the clear icon.\n *\n * @default true\n */\n clearable?: boolean\n /**\n * The icon to be used in the clear button.\n */\n clearIcon?: ReactNode\n /**\n * The icon to be used in the empty element.\n */\n emptyIcon?: ReactNode\n /**\n * The icon to be used in the autocomplete.\n */\n icon?: ReactNode\n /**\n * Props for content element.\n */\n contentProps?: AutocompleteContentProps\n /**\n * The props for the end element.\n */\n elementProps?: InputGroup.ElementProps\n /**\n * Props for empty element.\n */\n emptyProps?: AutocompleteEmptyProps\n /**\n * Props for group element.\n */\n groupProps?: Omit<AutocompleteGroupProps, \"children\" | \"label\">\n /**\n * Props for icon element.\n */\n iconProps?: AutocompleteIconProps\n /**\n * The props for the input element.\n */\n inputProps?: HTMLStyledProps<\"input\">\n /**\n * Props for option element.\n */\n optionProps?: Omit<AutocompleteOptionProps, \"children\" | \"value\">\n /**\n * Props for root element.\n */\n rootProps?: InputGroup.RootProps\n}\n\nconst {\n ComponentContext,\n PropsContext: AutocompletePropsContext,\n useComponentContext,\n usePropsContext: useAutocompletePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<\n AutocompleteRootProps,\n AutocompleteStyle,\n ComponentContext\n>(\"autocomplete\", autocompleteStyle)\n\nexport { AutocompletePropsContext, useAutocompletePropsContext }\n\n/**\n * `Autocomplete` is a component used to display suggestions in response to user text input.\n *\n * @see https://yamada-ui.com/docs/components/autocomplete\n */\nexport const AutocompleteRoot = withProvider(\n <Multiple extends boolean = false>(\n props: AutocompleteRootProps<Multiple>,\n ) => {\n const [\n groupItemProps,\n {\n className,\n css,\n colorScheme,\n animationScheme = \"block-start\",\n children,\n clearable = true,\n clearIcon = <XIcon />,\n duration,\n emptyIcon,\n errorBorderColor,\n focusBorderColor,\n icon,\n items: itemsProp,\n contentProps,\n elementProps,\n emptyProps,\n groupProps,\n iconProps,\n inputProps,\n optionProps,\n rootProps,\n ...rest\n },\n ] = useGroupItemProps(props)\n const popoverStyleProps = usePopoverStyleProps(rest)\n const items = useMemo<ComboboxItem[]>(() => {\n if (itemsProp) return itemsProp\n\n return createComboboxItem(children, {\n Group: AutocompleteGroup,\n Label: AutocompleteLabel,\n Option: AutocompleteOption,\n })\n }, [itemsProp, children])\n const {\n children: fieldChildren,\n descendants,\n items: computedItems,\n max,\n value,\n getClearIconProps,\n getContentProps,\n getFieldProps,\n getIconProps,\n getInputProps,\n getRootProps,\n getSeparatorProps,\n popoverProps,\n onActiveDescendant,\n onClose,\n onSelect,\n } = useAutocomplete({ items, ...rest, ...popoverStyleProps })\n const mergedPopoverProps = useMemo<Popover.RootProps>(\n () => ({\n animationScheme,\n duration,\n ...popoverProps,\n }),\n [animationScheme, duration, popoverProps],\n )\n const computedChildren = useMemo(\n () =>\n createComboboxChildren(computedItems, {\n Empty: AutocompleteEmpty,\n Group: AutocompleteGroup,\n Option: AutocompleteOption,\n }),\n [computedItems],\n )\n const varProps = useInputBorder({ errorBorderColor, focusBorderColor })\n const comboboxContext = useMemo(\n () => ({ onActiveDescendant, onClose, onSelect }),\n [onActiveDescendant, onClose, onSelect],\n )\n const autocompleteContext = useMemo(() => ({ max, value }), [value, max])\n const componentContext = useMemo(\n () => ({\n emptyIcon,\n emptyProps,\n getInputProps,\n getSeparatorProps,\n groupProps,\n inputProps,\n optionProps,\n }),\n [\n emptyIcon,\n emptyProps,\n getInputProps,\n getSeparatorProps,\n groupProps,\n inputProps,\n optionProps,\n ],\n )\n const hasValue = isArray(value) ? !!value.length : !!value\n\n return (\n <ComboboxDescendantsContext value={descendants}>\n <ComboboxContext value={comboboxContext}>\n <AutocompleteContext value={autocompleteContext}>\n <ComponentContext value={componentContext}>\n <Popover.Root {...mergedPopoverProps}>\n <InputGroup.Root\n className={className}\n css={css}\n colorScheme={colorScheme}\n {...getRootProps({ ...groupItemProps, ...rootProps })}\n >\n <Popover.Trigger>\n <AutocompleteField {...getFieldProps(varProps)}>\n {fieldChildren}\n </AutocompleteField>\n </Popover.Trigger>\n\n <InputGroup.Element\n {...{ clickable: clearable && hasValue, ...elementProps }}\n >\n {clearable && hasValue ? (\n <AutocompleteIcon\n icon={clearIcon}\n {...getClearIconProps(iconProps)}\n />\n ) : (\n <AutocompleteIcon\n icon={icon}\n {...getIconProps(iconProps)}\n />\n )}\n </InputGroup.Element>\n </InputGroup.Root>\n\n <AutocompleteContent\n {...cast<AutocompleteContentProps>(\n getContentProps(cast<HTMLProps>(contentProps)),\n )}\n >\n {computedChildren}\n </AutocompleteContent>\n </Popover.Root>\n </ComponentContext>\n </AutocompleteContext>\n </ComboboxContext>\n </ComboboxDescendantsContext>\n )\n },\n \"root\",\n)((props) => {\n const context = useInputPropsContext()\n\n return { ...context, ...props }\n}) as GenericsComponent<{\n <Multiple extends boolean = false>(\n props: AutocompleteRootProps<Multiple>,\n ): ReactElement\n}>\n\ninterface AutocompleteFieldProps extends HTMLStyledProps {}\n\nconst AutocompleteField = withContext<\"div\", AutocompleteFieldProps>(\n \"div\",\n \"field\",\n)({ \"data-group-propagate\": \"\" }, ({ children, ...rest }) => {\n const { getInputProps, inputProps } = useComponentContext()\n\n return {\n ...rest,\n children: (\n <>\n {children}\n <AutocompleteInput {...getInputProps(inputProps)} />\n </>\n ),\n }\n})\n\ninterface AutocompleteInputProps extends HTMLStyledProps<\"input\"> {}\n\nconst AutocompleteInput = withContext<\"input\", AutocompleteInputProps>(\n \"input\",\n \"input\",\n)()\n\ninterface AutocompleteIconProps extends HTMLStyledProps {\n icon?: ReactNode\n}\n\nconst AutocompleteIcon = withContext<\"div\", AutocompleteIconProps>(\n \"div\",\n \"icon\",\n)(undefined, ({ children, icon, ...rest }) => ({\n children: icon || children || <ChevronDownIcon />,\n ...rest,\n}))\n\ninterface AutocompleteContentProps extends Popover.ContentProps {}\n\nconst AutocompleteContent = withContext<\"div\", AutocompleteContentProps>(\n Popover.Content,\n \"content\",\n)()\n\nexport interface AutocompleteLabelProps extends HTMLStyledProps<\"span\"> {}\n\nexport const AutocompleteLabel = withContext<\"span\", AutocompleteLabelProps>(\n \"span\",\n \"label\",\n)(undefined, (props) => {\n const { getLabelProps } = useComboboxGroupContext()\n\n return getLabelProps(props)\n})\n\nexport interface AutocompleteGroupProps\n extends UseComboboxGroupProps, HTMLStyledProps {\n /**\n * The label of the group.\n */\n label?: ReactNode\n /**\n * Props for the label component.\n */\n labelProps?: AutocompleteLabelProps\n}\n\nexport const AutocompleteGroup = withContext<\"div\", AutocompleteGroupProps>(\n ({ children, label, labelProps, ...rest }) => {\n const { groupProps } = useComponentContext()\n const { getGroupProps, getLabelProps } = useComboboxGroup({\n ...groupProps,\n ...rest,\n })\n const context = useMemo(() => ({ getLabelProps }), [getLabelProps])\n\n return (\n <ComboboxGroupContext value={context}>\n <styled.div {...getGroupProps()}>\n {label ? (\n <AutocompleteLabel {...labelProps}>{label}</AutocompleteLabel>\n ) : null}\n {children}\n </styled.div>\n </ComboboxGroupContext>\n )\n },\n \"group\",\n)()\n\nexport interface AutocompleteOptionProps\n extends UseAutocompleteOptionProps, HTMLStyledProps {\n /**\n * The icon to be used in the autocomplete option.\n */\n icon?: ReactNode\n}\n\nexport const AutocompleteOption = withContext<\"div\", AutocompleteOptionProps>(\n ({ children, icon: iconProp, ...rest }) => {\n const { optionProps: { icon, ...optionProps } = {} } = useComponentContext()\n const { getIndicatorProps, getOptionProps } = useAutocompleteOption({\n ...optionProps,\n ...rest,\n })\n\n return (\n <styled.div {...getOptionProps()}>\n <AutocompleteIndicator {...getIndicatorProps()}>\n {iconProp ?? icon ?? <CheckIcon />}\n </AutocompleteIndicator>\n {children}\n </styled.div>\n )\n },\n \"option\",\n)()\n\ninterface AutocompleteEmptyProps extends HTMLStyledProps {\n /**\n * The icon to be used in the autocomplete option.\n */\n icon?: ReactNode\n}\n\nconst AutocompleteEmpty = withContext<\"div\", AutocompleteEmptyProps>(\n ({ children, icon, ...rest }) => {\n const { emptyIcon, emptyProps } = useComponentContext()\n\n return (\n <styled.div {...emptyProps} {...rest}>\n <AutocompleteIndicator>\n {icon ?? emptyIcon ?? <MinusIcon />}\n </AutocompleteIndicator>\n {children}\n </styled.div>\n )\n },\n \"empty\",\n)()\n\ninterface AutocompleteIndicatorProps extends HTMLStyledProps {}\n\nconst AutocompleteIndicator = withContext<\"div\", AutocompleteIndicatorProps>(\n \"div\",\n \"indicator\",\n)()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAmHA,MAAM,EACJ,kBACA,cAAc,0BACd,qBACA,iBAAiB,6BACjB,aACA,iBACE,oBAIF,gBAAgB,kBAAkB;;;;;;AASpC,MAAa,mBAAmB,cAE5B,UACG;CACH,MAAM,CACJ,gBACA,EACE,WACA,KACA,aACA,kBAAkB,eAClB,UACA,YAAY,MACZ,YAAY,oBAAC,UAAQ,EACrB,UACA,WACA,kBACA,kBACA,MACA,OAAO,WACP,cACA,cACA,YACA,YACA,WACA,YACA,aACA,WACA,GAAG,UAEH,kBAAkB,MAAM;CAC5B,MAAM,oBAAoB,qBAAqB,KAAK;CAUpD,MAAM,EACJ,UAAU,eACV,aACA,OAAO,eACP,KACA,OACA,mBACA,iBACA,eACA,cACA,eACA,cACA,mBACA,cACA,oBACA,SACA,aACE,gBAAgB;EAAE,OA1BR,cAA8B;AAC1C,OAAI,UAAW,QAAO;AAEtB,UAAO,mBAAmB,UAAU;IAClC,OAAO;IACP,OAAO;IACP,QAAQ;IACT,CAAC;KACD,CAAC,WAAW,SAAS,CAAC;EAkBI,GAAG;EAAM,GAAG;EAAmB,CAAC;CAC7D,MAAM,qBAAqB,eAClB;EACL;EACA;EACA,GAAG;EACJ,GACD;EAAC;EAAiB;EAAU;EAAa,CAC1C;CACD,MAAM,mBAAmB,cAErB,uBAAuB,eAAe;EACpC,OAAO;EACP,OAAO;EACP,QAAQ;EACT,CAAC,EACJ,CAAC,cAAc,CAChB;CACD,MAAM,WAAW,eAAe;EAAE;EAAkB;EAAkB,CAAC;CACvE,MAAM,kBAAkB,eACf;EAAE;EAAoB;EAAS;EAAU,GAChD;EAAC;EAAoB;EAAS;EAAS,CACxC;CACD,MAAM,sBAAsB,eAAe;EAAE;EAAK;EAAO,GAAG,CAAC,OAAO,IAAI,CAAC;CACzE,MAAM,mBAAmB,eAChB;EACL;EACA;EACA;EACA;EACA;E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AAIH,MAAa,oBAAoB,YAC/B,QACA,QACD,CAAC,SAAY,UAAU;CACtB,MAAM,EAAE,kBAAkB,yBAAyB;AAEnD,QAAO,cAAc,MAAM;EAC3B;AAcF,MAAa,oBAAoB,aAC9B,EAAE,UAAU,OAAO,YAAY,GAAG,WAAW;CAC5C,MAAM,EAAE,eAAe,qBAAqB;CAC5C,MAAM,EAAE,eAAe,kBAAkB,iBAAiB;EACxD,GAAG;EACH,GAAG;EACJ,CAAC;AAGF,QACE,oBAAC;EAAqB,OAHR,eAAe,EAAE,eAAe,GAAG,CAAC,cAAc,CAAC;YAI/D,qBAAC,OAAO;GAAI,GAAI,eAAe;cAC5B,QACC,oBAAC;IAAkB,GAAI;cAAa;KAA0B,GAC5D,MACH;IACU;GACQ;GAG3B,QACD,EAAE;AAUH,MAAa,qBAAqB,aAC/B,EAAE,UAAU,MAAM,UAAU,GAAG,WAAW;CACzC,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,gBAAgB,EAAE,KAAK,qBAAqB;CAC5E,MAAM,EAAE,mBAAmB,mBAAmB,sBAAsB;EAClE,GAAG;EACH,GAAG;EACJ,CAAC;AAEF,QACE,qBAAC,OAAO;EAAI,GAAI,gBAAgB;aAC9B,oBAAC;GAAsB,GAAI,mBAAmB;aAC3C,YAAY,QAAQ,oBAAC,cAAY;IACZ,EACvB;GACU;GAGjB,SACD,EAAE;AASH,MAAM,oBAAoB,aACvB,EAAE,UAAU,MAAM,GAAG,WAAW;CAC/B,MAAM,EAAE,WAAW,eAAe,qBAAqB;AAEvD,QACE,qBAAC,OAAO;EAAI,GAAI;EAAY,GAAI;aAC9B,oBAAC,mCACE,QAAQ,aAAa,oBAAC,cAAY,GACb,EACvB;GACU;GAGjB,QACD,EAAE;AAIH,MAAM,wBAAwB,YAC5B,OACA,YACD,EAAE"}
|
|
1
|
+
{"version":3,"file":"autocomplete.js","names":["Popover.Root","InputGroup.Root","Popover.Trigger","InputGroup.Element","Popover.Content"],"sources":["../../../../src/components/autocomplete/autocomplete.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type {\n ComboboxItem,\n UseComboboxGroupProps,\n} from \"../../hooks/use-combobox\"\nimport type { Merge } from \"../../utils\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { UsePopoverStyleProps, UsePopupAnimationProps } from \"../popover\"\nimport type { AutocompleteStyle } from \"./autocomplete.style\"\nimport type {\n UseAutocompleteOptionProps,\n UseAutocompleteProps,\n UseAutocompleteReturn,\n} from \"./use-autocomplete\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport {\n ComboboxContext,\n ComboboxDescendantsContext,\n ComboboxGroupContext,\n createComboboxChildren,\n createComboboxItem,\n useComboboxGroup,\n useComboboxGroupContext,\n} from \"../../hooks/use-combobox\"\nimport { cast, isArray } from \"../../utils\"\nimport { useGroupItemProps } from \"../group\"\nimport { CheckIcon, ChevronDownIcon, MinusIcon, XIcon } from \"../icon\"\nimport { InputGroup, useInputBorder, useInputPropsContext } from \"../input\"\nimport { Popover, usePopoverStyleProps } from \"../popover\"\nimport { autocompleteStyle } from \"./autocomplete.style\"\nimport {\n AutocompleteContext,\n useAutocomplete,\n useAutocompleteOption,\n} from \"./use-autocomplete\"\n\ninterface ComponentContext\n extends\n Pick<UseAutocompleteReturn, \"getInputProps\" | \"getSeparatorProps\">,\n Pick<\n AutocompleteRootProps,\n \"emptyIcon\" | \"emptyProps\" | \"groupProps\" | \"inputProps\" | \"optionProps\"\n > {}\n\nexport interface AutocompleteRootProps<Multiple extends boolean = false>\n extends\n Omit<\n HTMLStyledProps,\n \"defaultValue\" | \"filter\" | \"offset\" | \"onChange\" | \"ref\" | \"value\"\n >,\n Merge<UseAutocompleteProps<Multiple>, UsePopoverStyleProps>,\n UsePopupAnimationProps,\n ThemeProps<AutocompleteStyle>,\n UseInputBorderProps {\n /**\n * If `true`, display the clear icon.\n *\n * @default true\n */\n clearable?: boolean\n /**\n * The icon to be used in the clear button.\n */\n clearIcon?: ReactNode\n /**\n * The icon to be used in the empty element.\n */\n emptyIcon?: ReactNode\n /**\n * The icon to be used in the autocomplete.\n */\n icon?: ReactNode\n /**\n * Props for content element.\n */\n contentProps?: AutocompleteContentProps\n /**\n * The props for the end element.\n */\n elementProps?: InputGroup.ElementProps\n /**\n * Props for empty element.\n */\n emptyProps?: AutocompleteEmptyProps\n /**\n * Props for group element.\n */\n groupProps?: Omit<AutocompleteGroupProps, \"children\" | \"label\">\n /**\n * Props for icon element.\n */\n iconProps?: AutocompleteIconProps\n /**\n * The props for the input element.\n */\n inputProps?: HTMLStyledProps<\"input\">\n /**\n * Props for option element.\n */\n optionProps?: Omit<AutocompleteOptionProps, \"children\" | \"value\">\n /**\n * Props for root element.\n */\n rootProps?: InputGroup.RootProps\n}\n\nconst {\n ComponentContext,\n PropsContext: AutocompletePropsContext,\n useComponentContext,\n usePropsContext: useAutocompletePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<\n AutocompleteRootProps,\n AutocompleteStyle,\n ComponentContext\n>(\"autocomplete\", autocompleteStyle)\n\nexport { AutocompletePropsContext, useAutocompletePropsContext }\n\n/**\n * `Autocomplete` is a component used to display suggestions in response to user text input.\n *\n * @see https://yamada-ui.com/docs/components/autocomplete\n */\nexport const AutocompleteRoot = withProvider(\n <Multiple extends boolean = false>(\n props: AutocompleteRootProps<Multiple>,\n ) => {\n const [\n groupItemProps,\n {\n className,\n css,\n colorScheme,\n animationScheme = \"block-start\",\n children,\n clearable = true,\n clearIcon = <XIcon />,\n duration,\n emptyIcon,\n errorBorderColor,\n focusBorderColor,\n icon,\n items: itemsProp,\n contentProps,\n elementProps,\n emptyProps,\n groupProps,\n iconProps,\n inputProps,\n optionProps,\n rootProps,\n ...rest\n },\n ] = useGroupItemProps(props)\n const popoverStyleProps = usePopoverStyleProps(rest)\n const items = useMemo<ComboboxItem[]>(() => {\n if (itemsProp) return itemsProp\n\n return createComboboxItem(children, {\n Group: AutocompleteGroup,\n Label: AutocompleteLabel,\n Option: AutocompleteOption,\n })\n }, [itemsProp, children])\n const {\n children: fieldChildren,\n descendants,\n items: computedItems,\n max,\n value,\n getClearIconProps,\n getContentProps,\n getFieldProps,\n getIconProps,\n getInputProps,\n getRootProps,\n getSeparatorProps,\n popoverProps,\n onActiveDescendant,\n onClose,\n onSelect,\n } = useAutocomplete({ items, ...rest, ...popoverStyleProps })\n const mergedPopoverProps = useMemo<Popover.RootProps>(\n () => ({\n animationScheme,\n duration,\n ...popoverProps,\n }),\n [animationScheme, duration, popoverProps],\n )\n const computedChildren = useMemo(\n () =>\n createComboboxChildren(computedItems, {\n Empty: AutocompleteEmpty,\n Group: AutocompleteGroup,\n Option: AutocompleteOption,\n }),\n [computedItems],\n )\n const varProps = useInputBorder({ errorBorderColor, focusBorderColor })\n const comboboxContext = useMemo(\n () => ({ onActiveDescendant, onClose, onSelect }),\n [onActiveDescendant, onClose, onSelect],\n )\n const autocompleteContext = useMemo(() => ({ max, value }), [value, max])\n const componentContext = useMemo(\n () => ({\n emptyIcon,\n emptyProps,\n getInputProps,\n getSeparatorProps,\n groupProps,\n inputProps,\n optionProps,\n }),\n [\n emptyIcon,\n emptyProps,\n getInputProps,\n getSeparatorProps,\n groupProps,\n inputProps,\n optionProps,\n ],\n )\n const hasValue = isArray(value) ? !!value.length : !!value\n\n return (\n <ComboboxDescendantsContext value={descendants}>\n <ComboboxContext value={comboboxContext}>\n <AutocompleteContext value={autocompleteContext}>\n <ComponentContext value={componentContext}>\n <Popover.Root {...mergedPopoverProps}>\n <InputGroup.Root\n colorScheme={colorScheme}\n {...mergeProps(\n { className, css },\n getRootProps(groupItemProps),\n rootProps,\n )()}\n >\n <Popover.Trigger>\n <AutocompleteField {...getFieldProps(varProps)}>\n {fieldChildren}\n </AutocompleteField>\n </Popover.Trigger>\n\n <InputGroup.Element\n {...{ clickable: clearable && hasValue, ...elementProps }}\n >\n {clearable && hasValue ? (\n <AutocompleteIcon\n icon={clearIcon}\n {...getClearIconProps(iconProps)}\n />\n ) : (\n <AutocompleteIcon\n icon={icon}\n {...getIconProps(iconProps)}\n />\n )}\n </InputGroup.Element>\n </InputGroup.Root>\n\n <AutocompleteContent\n {...cast<AutocompleteContentProps>(\n getContentProps(cast<HTMLProps>(contentProps)),\n )}\n >\n {computedChildren}\n </AutocompleteContent>\n </Popover.Root>\n </ComponentContext>\n </AutocompleteContext>\n </ComboboxContext>\n </ComboboxDescendantsContext>\n )\n },\n \"root\",\n)((props) => {\n const context = useInputPropsContext()\n\n return mergeProps(context, props)()\n}) as GenericsComponent<{\n <Multiple extends boolean = false>(\n props: AutocompleteRootProps<Multiple>,\n ): ReactElement\n}>\n\ninterface AutocompleteFieldProps extends HTMLStyledProps {}\n\nconst AutocompleteField = withContext<\"div\", AutocompleteFieldProps>(\n \"div\",\n \"field\",\n)({ \"data-group-propagate\": \"\" }, ({ children, ...rest }) => {\n const { getInputProps, inputProps } = useComponentContext()\n\n return {\n ...rest,\n children: (\n <>\n {children}\n <AutocompleteInput {...getInputProps(inputProps)} />\n </>\n ),\n }\n})\n\ninterface AutocompleteInputProps extends HTMLStyledProps<\"input\"> {}\n\nconst AutocompleteInput = withContext<\"input\", AutocompleteInputProps>(\n \"input\",\n \"input\",\n)()\n\ninterface AutocompleteIconProps extends HTMLStyledProps {\n icon?: ReactNode\n}\n\nconst AutocompleteIcon = withContext<\"div\", AutocompleteIconProps>(\n \"div\",\n \"icon\",\n)(undefined, ({ children, icon, ...rest }) => ({\n children: icon || children || <ChevronDownIcon />,\n ...rest,\n}))\n\ninterface AutocompleteContentProps extends Popover.ContentProps {}\n\nconst AutocompleteContent = withContext<\"div\", AutocompleteContentProps>(\n Popover.Content,\n \"content\",\n)()\n\nexport interface AutocompleteLabelProps extends HTMLStyledProps<\"span\"> {}\n\nexport const AutocompleteLabel = withContext<\"span\", AutocompleteLabelProps>(\n \"span\",\n \"label\",\n)(undefined, (props) => {\n const { getLabelProps } = useComboboxGroupContext()\n\n return getLabelProps(props)\n})\n\nexport interface AutocompleteGroupProps\n extends UseComboboxGroupProps, HTMLStyledProps {\n /**\n * The label of the group.\n */\n label?: ReactNode\n /**\n * Props for the label component.\n */\n labelProps?: AutocompleteLabelProps\n}\n\nexport const AutocompleteGroup = withContext<\"div\", AutocompleteGroupProps>(\n ({ children, label, labelProps, ...rest }) => {\n const { groupProps } = useComponentContext()\n const { getGroupProps, getLabelProps } = useComboboxGroup(\n mergeProps(groupProps, rest)(),\n )\n const context = useMemo(() => ({ getLabelProps }), [getLabelProps])\n\n return (\n <ComboboxGroupContext value={context}>\n <styled.div {...getGroupProps()}>\n {label ? (\n <AutocompleteLabel {...labelProps}>{label}</AutocompleteLabel>\n ) : null}\n {children}\n </styled.div>\n </ComboboxGroupContext>\n )\n },\n \"group\",\n)()\n\nexport interface AutocompleteOptionProps\n extends UseAutocompleteOptionProps, HTMLStyledProps {\n /**\n * The icon to be used in the autocomplete option.\n */\n icon?: ReactNode\n}\n\nexport const AutocompleteOption = withContext<\"div\", AutocompleteOptionProps>(\n ({ children, icon: iconProp, ...rest }) => {\n const { optionProps: { icon, ...optionProps } = {} } = useComponentContext()\n const { getIndicatorProps, getOptionProps } = useAutocompleteOption(\n mergeProps(optionProps, rest)(),\n )\n\n return (\n <styled.div {...getOptionProps()}>\n <AutocompleteIndicator {...getIndicatorProps()}>\n {iconProp ?? icon ?? <CheckIcon />}\n </AutocompleteIndicator>\n {children}\n </styled.div>\n )\n },\n \"option\",\n)()\n\ninterface AutocompleteEmptyProps extends HTMLStyledProps {\n /**\n * The icon to be used in the autocomplete option.\n */\n icon?: ReactNode\n}\n\nconst AutocompleteEmpty = withContext<\"div\", AutocompleteEmptyProps>(\n ({ children, icon, ...rest }) => {\n const { emptyIcon, emptyProps } = useComponentContext()\n\n return (\n <styled.div {...mergeProps(emptyProps, rest)()}>\n <AutocompleteIndicator>\n {icon ?? emptyIcon ?? <MinusIcon />}\n </AutocompleteIndicator>\n {children}\n </styled.div>\n )\n },\n \"empty\",\n)()\n\ninterface AutocompleteIndicatorProps extends HTMLStyledProps {}\n\nconst AutocompleteIndicator = withContext<\"div\", AutocompleteIndicatorProps>(\n \"div\",\n \"indicator\",\n)()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmHA,MAAM,EACJ,kBACA,cAAc,0BACd,qBACA,iBAAiB,6BACjB,aACA,iBACE,oBAIF,gBAAgB,kBAAkB;;;;;;AASpC,MAAa,mBAAmB,cAE5B,UACG;CACH,MAAM,CACJ,gBACA,EACE,WACA,KACA,aACA,kBAAkB,eAClB,UACA,YAAY,MACZ,YAAY,oBAAC,UAAQ,EACrB,UACA,WACA,kBACA,kBACA,MACA,OAAO,WACP,cACA,cACA,YACA,YACA,WACA,YACA,aACA,WACA,GAAG,UAEH,kBAAkB,MAAM;CAC5B,MAAM,oBAAoB,qBAAqB,KAAK;CAUpD,MAAM,EACJ,UAAU,eACV,aACA,OAAO,eACP,KACA,OACA,mBACA,iBACA,eACA,cACA,eACA,cACA,mBACA,cACA,oBACA,SACA,aACE,gBAAgB;EAAE,OA1BR,cAA8B;AAC1C,OAAI,UAAW,QAAO;AAEtB,UAAO,mBAAmB,UAAU;IAClC,OAAO;IACP,OAAO;IACP,QAAQ;IACT,CAAC;KACD,CAAC,WAAW,SAAS,CAAC;EAkBI,GAAG;EAAM,GAAG;EAAmB,CAAC;CAC7D,MAAM,qBAAqB,eAClB;EACL;EACA;EACA,GAAG;EACJ,GACD;EAAC;EAAiB;EAAU;EAAa,CAC1C;CACD,MAAM,mBAAmB,cAErB,uBAAuB,eAAe;EACpC,OAAO;EACP,OAAO;EACP,QAAQ;EACT,CAAC,EACJ,CAAC,cAAc,CAChB;CACD,MAAM,WAAW,eAAe;EAAE;EAAkB;EAAkB,CAAC;CACvE,MAAM,kBAAkB,eACf;EAAE;EAAoB;EAAS;EAAU,GAChD;EAAC;EAAoB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MAAM,wBAAwB,YAC5B,OACA,YACD,EAAE"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { getValidChildren, omitChildren, pickChildren } from "../../utils/children.js";
|
|
4
4
|
import { utils_exports } from "../../utils/index.js";
|
|
5
5
|
import { styled } from "../../core/system/factory.js";
|
|
6
|
+
import { mergeProps } from "../../core/components/props.js";
|
|
6
7
|
import { createSlotComponent } from "../../core/components/create-component.js";
|
|
7
8
|
import "../../core/index.js";
|
|
8
9
|
import { dataListStyle } from "./data-list.style.js";
|
|
@@ -63,21 +64,17 @@ const DataListItem = withContext(({ children, description, term, descriptionProp
|
|
|
63
64
|
...rest,
|
|
64
65
|
children: [
|
|
65
66
|
!(0, utils_exports.isEmpty)(customTerms) ? customTerms : (0, utils_exports.isArray)(term) ? term.map((item, index) => /* @__PURE__ */ jsx(DataListTerm, {
|
|
66
|
-
...termProps,
|
|
67
|
-
...customTermProps,
|
|
67
|
+
...mergeProps(termProps, customTermProps)(),
|
|
68
68
|
children: item
|
|
69
69
|
}, index)) : /* @__PURE__ */ jsx(DataListTerm, {
|
|
70
|
-
...termProps,
|
|
71
|
-
...customTermProps,
|
|
70
|
+
...mergeProps(termProps, customTermProps)(),
|
|
72
71
|
children: term
|
|
73
72
|
}),
|
|
74
73
|
!(0, utils_exports.isEmpty)(customDescriptions) ? customDescriptions : (0, utils_exports.isArray)(description) ? description.map((item, index) => /* @__PURE__ */ jsx(DataListDescription, {
|
|
75
|
-
...descriptionProps,
|
|
76
|
-
...customDescriptionProps,
|
|
74
|
+
...mergeProps(descriptionProps, customDescriptionProps)(),
|
|
77
75
|
children: item
|
|
78
76
|
}, index)) : /* @__PURE__ */ jsx(DataListDescription, {
|
|
79
|
-
...descriptionProps,
|
|
80
|
-
...customDescriptionProps,
|
|
77
|
+
...mergeProps(descriptionProps, customDescriptionProps)(),
|
|
81
78
|
children: description
|
|
82
79
|
}),
|
|
83
80
|
omittedChildren
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-list.js","names":["col","customTerms","customDescriptions"],"sources":["../../../../src/components/data-list/data-list.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { DataListStyle } from \"./data-list.style\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport {\n getValidChildren,\n isArray,\n isEmpty,\n omitChildren,\n pickChildren,\n} from \"../../utils\"\nimport { dataListStyle } from \"./data-list.style\"\n\nexport interface DataListItem extends DataListItemProps {}\n\nexport interface DataListRootProps\n extends HTMLStyledProps<\"dl\">, ThemeProps<DataListStyle> {\n /**\n * If provided, generate elements based on items.\n */\n items?: DataListItem[]\n /**\n * The props for the data list description component.\n */\n descriptionProps?: DataListDescriptionProps\n /**\n * The props for the data list term component.\n */\n termProps?: DataListTermProps\n}\n\ninterface ComponentContext extends Pick<\n DataListRootProps,\n \"descriptionProps\" | \"termProps\"\n> {}\n\nconst {\n ComponentContext,\n PropsContext: DataListPropsContext,\n useComponentContext,\n usePropsContext: useDataListPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<DataListRootProps, DataListStyle, ComponentContext>(\n \"data-list\",\n dataListStyle,\n)\n\nexport { DataListPropsContext, useDataListPropsContext }\n\n/**\n * `DataList` is used to display a list of data items.\n *\n * @see https://yamada-ui.com/docs/components/data-list\n */\nexport const DataListRoot = withProvider<\"dl\", DataListRootProps>(\n ({ style, children, items = [], descriptionProps, termProps, ...rest }) => {\n const col = useMemo(() => {\n let col = 0\n\n if (children) {\n const validChildren = getValidChildren(children)\n const dataListItems = pickChildren(validChildren, DataListItem)\n\n dataListItems.forEach(({ props }) => {\n const validChildren = getValidChildren(props.children)\n const pickedChildren = pickChildren(\n validChildren,\n DataListTerm,\n DataListDescription,\n )\n\n col = Math.max(col, pickedChildren.length)\n })\n } else {\n items.forEach(({ description, term }) => {\n const termCount = !term ? 0 : isArray(term) ? term.length : 1\n const descriptionCount = !description\n ? 0\n : isArray(description)\n ? description.length\n : 1\n\n col = Math.max(col, termCount + descriptionCount)\n })\n }\n\n return col\n }, [children, items])\n const computedChildren = useMemo(\n () =>\n items.map((props, index) => <DataListItem key={index} {...props} />),\n [items],\n )\n const context = useMemo(\n () => ({\n descriptionProps,\n termProps,\n }),\n [descriptionProps, termProps],\n )\n\n return (\n <ComponentContext value={context}>\n <styled.dl style={{ \"--col\": col, ...style }} {...rest}>\n {children ?? computedChildren}\n </styled.dl>\n </ComponentContext>\n )\n },\n \"root\",\n)()\n\nexport interface DataListItemProps extends HTMLStyledProps {\n /**\n * The data list description to use.\n */\n description?: ReactNode | ReactNode[]\n /**\n * The data list term to use.\n */\n term?: ReactNode | ReactNode[]\n /**\n * The props for the data list description component.\n */\n descriptionProps?: DataListDescriptionProps\n /**\n * The props for the data list term component.\n */\n termProps?: DataListTermProps\n}\n\nexport const DataListItem = withContext<\"div\", DataListItemProps>(\n ({\n children,\n description,\n term,\n descriptionProps: customDescriptionProps,\n termProps: customTermProps,\n ...rest\n }) => {\n const { descriptionProps, termProps } = useComponentContext()\n\n const [omittedChildren, customTerms, customDescriptions] = useMemo(() => {\n const validChildren = getValidChildren(children)\n\n if (isEmpty(validChildren)) return [children]\n\n const customTerms = pickChildren(validChildren, DataListTerm)\n const customDescriptions = pickChildren(\n validChildren,\n DataListDescription,\n )\n const omittedChildren = omitChildren(\n validChildren,\n DataListTerm,\n DataListDescription,\n )\n\n return [omittedChildren, customTerms, customDescriptions] as const\n }, [children])\n\n return (\n <styled.div {...rest}>\n {!isEmpty(customTerms) ? (\n customTerms\n ) : isArray(term) ? (\n term.map((item, index) => (\n <DataListTerm
|
|
1
|
+
{"version":3,"file":"data-list.js","names":["col","customTerms","customDescriptions"],"sources":["../../../../src/components/data-list/data-list.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { DataListStyle } from \"./data-list.style\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport {\n getValidChildren,\n isArray,\n isEmpty,\n omitChildren,\n pickChildren,\n} from \"../../utils\"\nimport { dataListStyle } from \"./data-list.style\"\n\nexport interface DataListItem extends DataListItemProps {}\n\nexport interface DataListRootProps\n extends HTMLStyledProps<\"dl\">, ThemeProps<DataListStyle> {\n /**\n * If provided, generate elements based on items.\n */\n items?: DataListItem[]\n /**\n * The props for the data list description component.\n */\n descriptionProps?: DataListDescriptionProps\n /**\n * The props for the data list term component.\n */\n termProps?: DataListTermProps\n}\n\ninterface ComponentContext extends Pick<\n DataListRootProps,\n \"descriptionProps\" | \"termProps\"\n> {}\n\nconst {\n ComponentContext,\n PropsContext: DataListPropsContext,\n useComponentContext,\n usePropsContext: useDataListPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<DataListRootProps, DataListStyle, ComponentContext>(\n \"data-list\",\n dataListStyle,\n)\n\nexport { DataListPropsContext, useDataListPropsContext }\n\n/**\n * `DataList` is used to display a list of data items.\n *\n * @see https://yamada-ui.com/docs/components/data-list\n */\nexport const DataListRoot = withProvider<\"dl\", DataListRootProps>(\n ({ style, children, items = [], descriptionProps, termProps, ...rest }) => {\n const col = useMemo(() => {\n let col = 0\n\n if (children) {\n const validChildren = getValidChildren(children)\n const dataListItems = pickChildren(validChildren, DataListItem)\n\n dataListItems.forEach(({ props }) => {\n const validChildren = getValidChildren(props.children)\n const pickedChildren = pickChildren(\n validChildren,\n DataListTerm,\n DataListDescription,\n )\n\n col = Math.max(col, pickedChildren.length)\n })\n } else {\n items.forEach(({ description, term }) => {\n const termCount = !term ? 0 : isArray(term) ? term.length : 1\n const descriptionCount = !description\n ? 0\n : isArray(description)\n ? description.length\n : 1\n\n col = Math.max(col, termCount + descriptionCount)\n })\n }\n\n return col\n }, [children, items])\n const computedChildren = useMemo(\n () =>\n items.map((props, index) => <DataListItem key={index} {...props} />),\n [items],\n )\n const context = useMemo(\n () => ({\n descriptionProps,\n termProps,\n }),\n [descriptionProps, termProps],\n )\n\n return (\n <ComponentContext value={context}>\n <styled.dl style={{ \"--col\": col, ...style }} {...rest}>\n {children ?? computedChildren}\n </styled.dl>\n </ComponentContext>\n )\n },\n \"root\",\n)()\n\nexport interface DataListItemProps extends HTMLStyledProps {\n /**\n * The data list description to use.\n */\n description?: ReactNode | ReactNode[]\n /**\n * The data list term to use.\n */\n term?: ReactNode | ReactNode[]\n /**\n * The props for the data list description component.\n */\n descriptionProps?: DataListDescriptionProps\n /**\n * The props for the data list term component.\n */\n termProps?: DataListTermProps\n}\n\nexport const DataListItem = withContext<\"div\", DataListItemProps>(\n ({\n children,\n description,\n term,\n descriptionProps: customDescriptionProps,\n termProps: customTermProps,\n ...rest\n }) => {\n const { descriptionProps, termProps } = useComponentContext()\n\n const [omittedChildren, customTerms, customDescriptions] = useMemo(() => {\n const validChildren = getValidChildren(children)\n\n if (isEmpty(validChildren)) return [children]\n\n const customTerms = pickChildren(validChildren, DataListTerm)\n const customDescriptions = pickChildren(\n validChildren,\n DataListDescription,\n )\n const omittedChildren = omitChildren(\n validChildren,\n DataListTerm,\n DataListDescription,\n )\n\n return [omittedChildren, customTerms, customDescriptions] as const\n }, [children])\n\n return (\n <styled.div {...rest}>\n {!isEmpty(customTerms) ? (\n customTerms\n ) : isArray(term) ? (\n term.map((item, index) => (\n <DataListTerm\n key={index}\n {...mergeProps(termProps, customTermProps)()}\n >\n {item}\n </DataListTerm>\n ))\n ) : (\n <DataListTerm {...mergeProps(termProps, customTermProps)()}>\n {term}\n </DataListTerm>\n )}\n\n {!isEmpty(customDescriptions) ? (\n customDescriptions\n ) : isArray(description) ? (\n description.map((item, index) => (\n <DataListDescription\n key={index}\n {...mergeProps(descriptionProps, customDescriptionProps)()}\n >\n {item}\n </DataListDescription>\n ))\n ) : (\n <DataListDescription\n {...mergeProps(descriptionProps, customDescriptionProps)()}\n >\n {description}\n </DataListDescription>\n )}\n\n {omittedChildren}\n </styled.div>\n )\n },\n \"item\",\n)()\n\nexport interface DataListTermProps extends HTMLStyledProps<\"dt\"> {}\n\nexport const DataListTerm = withContext<\"dt\", DataListTermProps>(\"dt\", \"term\")()\n\nexport interface DataListDescriptionProps extends HTMLStyledProps<\"dd\"> {}\n\nexport const DataListDescription = withContext<\"dd\", DataListDescriptionProps>(\n \"dd\",\n \"description\",\n)()\n"],"mappings":";;;;;;;;;;;;;AAuCA,MAAM,EACJ,kBACA,cAAc,sBACd,qBACA,iBAAiB,yBACjB,aACA,iBACE,oBACF,aACA,cACD;;;;;;AASD,MAAa,eAAe,cACzB,EAAE,OAAO,UAAU,QAAQ,EAAE,EAAE,kBAAkB,WAAW,GAAG,WAAW;CACzE,MAAM,MAAM,cAAc;EACxB,IAAIA,QAAM;AAEV,MAAI,SAIF,CAFsB,aADA,iBAAiB,SAAS,EACE,aAAa,CAEjD,SAAS,EAAE,YAAY;GAEnC,MAAM,iBAAiB,aADD,iBAAiB,MAAM,SAAS,EAGpD,cACA,oBACD;AAED,WAAM,KAAK,IAAIA,OAAK,eAAe,OAAO;IAC1C;MAEF,OAAM,SAAS,EAAE,aAAa,WAAW;GACvC,MAAM,YAAY,CAAC,OAAO,+BAAY,KAAK,GAAG,KAAK,SAAS;GAC5D,MAAM,mBAAmB,CAAC,cACtB,+BACQ,YAAY,GAClB,YAAY,SACZ;AAEN,WAAM,KAAK,IAAIA,OAAK,YAAY,iBAAiB;IACjD;AAGJ,SAAOA;IACN,CAAC,UAAU,MAAM,CAAC;CACrB,MAAM,mBAAmB,cAErB,MAAM,KAAK,OAAO,UAAU,oBAAC,gBAAyB,GAAI,SAAX,MAAoB,CAAC,EACtE,CAAC,MAAM,CACR;AASD,QACE,oBAAC;EAAiB,OATJ,eACP;GACL;GACA;GACD,GACD,CAAC,kBAAkB,UAAU,CAC9B;YAIG,oBAAC,OAAO;GAAG,OAAO;IAAE,SAAS;IAAK,GAAG;IAAO;GAAE,GAAI;aAC/C,YAAY;IACH;GACK;GAGvB,OACD,EAAE;AAqBH,MAAa,eAAe,aACzB,EACC,UACA,aACA,MACA,kBAAkB,wBAClB,WAAW,iBACX,GAAG,WACC;CACJ,MAAM,EAAE,kBAAkB,cAAc,qBAAqB;CAE7D,MAAM,CAAC,iBAAiB,aAAa,sBAAsB,cAAc;EACvE,MAAM,gBAAgB,iBAAiB,SAAS;AAEhD,iCAAY,cAAc,CAAE,QAAO,CAAC,SAAS;EAE7C,MAAMC,gBAAc,aAAa,eAAe,aAAa;EAC7D,MAAMC,uBAAqB,aACzB,eACA,oBACD;AAOD,SAAO;GANiB,aACtB,eACA,cACA,oBACD;GAEwBD;GAAaC;GAAmB;IACxD,CAAC,SAAS,CAAC;AAEd,QACE,qBAAC,OAAO;EAAI,GAAI;;GACb,4BAAS,YAAY,GACpB,yCACU,KAAK,GACf,KAAK,KAAK,MAAM,UACd,oBAAC;IAEC,GAAI,WAAW,WAAW,gBAAgB,EAAE;cAE3C;MAHI,MAIQ,CACf,GAEF,oBAAC;IAAa,GAAI,WAAW,WAAW,gBAAgB,EAAE;cACvD;KACY;GAGhB,4BAAS,mBAAmB,GAC3B,gDACU,YAAY,GACtB,YAAY,KAAK,MAAM,UACrB,oBAAC;IAEC,GAAI,WAAW,kBAAkB,uBAAuB,EAAE;cAEzD;MAHI,MAIe,CACtB,GAEF,oBAAC;IACC,GAAI,WAAW,kBAAkB,uBAAuB,EAAE;cAEzD;KACmB;GAGvB;;GACU;GAGjB,OACD,EAAE;AAIH,MAAa,eAAe,YAAqC,MAAM,OAAO,EAAE;AAIhF,MAAa,sBAAsB,YACjC,MACA,cACD,EAAE"}
|
|
@@ -3,13 +3,11 @@ import { ThemeProps } from "../../core/system/index.types.js";
|
|
|
3
3
|
import { Component, HTMLStyledProps } from "../../core/components/index.types.js";
|
|
4
4
|
import "../../core/index.js";
|
|
5
5
|
import { WithTransitionProps } from "../motion/index.types.js";
|
|
6
|
-
import "../motion/index.js";
|
|
7
6
|
import { CollapseProps } from "../collapse/collapse.js";
|
|
8
|
-
import "../collapse/index.js";
|
|
9
7
|
import "../../index.js";
|
|
10
8
|
import { AccordionStyle } from "./accordion.style.js";
|
|
11
9
|
import { UseAccordionItemProps, UseAccordionProps } from "./use-accordion.js";
|
|
12
|
-
import * as
|
|
10
|
+
import * as react194 from "react";
|
|
13
11
|
|
|
14
12
|
//#region src/components/accordion/accordion.d.ts
|
|
15
13
|
interface AccordionCallBackProps {
|
|
@@ -33,7 +31,7 @@ interface AccordionRootProps extends Omit<HTMLStyledProps, "onChange">, ThemePro
|
|
|
33
31
|
*/
|
|
34
32
|
items?: AccordionItem[];
|
|
35
33
|
}
|
|
36
|
-
declare const AccordionPropsContext:
|
|
34
|
+
declare const AccordionPropsContext: react194.Context<Partial<AccordionRootProps> | undefined>, useAccordionPropsContext: () => Partial<AccordionRootProps> | undefined;
|
|
37
35
|
/**
|
|
38
36
|
* `Accordion` is a component for a list that displays information in an expandable or collapsible manner.
|
|
39
37
|
*
|
|
@@ -3,7 +3,7 @@ import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/
|
|
|
3
3
|
import "../../index.js";
|
|
4
4
|
|
|
5
5
|
//#region src/components/accordion/accordion.style.d.ts
|
|
6
|
-
declare const accordionStyle: ComponentSlotStyle<"button" | "panel" | "icon" | "
|
|
6
|
+
declare const accordionStyle: ComponentSlotStyle<"button" | "panel" | "icon" | "item" | "root", CSSPropObject<CSSSlotObject<"button" | "panel" | "icon" | "item" | "root">>, CSSModifierObject<CSSSlotObject<"button" | "panel" | "icon" | "item" | "root">>, {
|
|
7
7
|
panel: {
|
|
8
8
|
button: {
|
|
9
9
|
rounded: "l2";
|
|
@@ -2,10 +2,10 @@ import { HTMLProps, PropGetter } from "../../core/components/index.types.js";
|
|
|
2
2
|
import "../../core/index.js";
|
|
3
3
|
import { Descendant } from "../../hooks/use-descendants/index.js";
|
|
4
4
|
import "../../index.js";
|
|
5
|
-
import * as
|
|
5
|
+
import * as react182 from "react";
|
|
6
6
|
|
|
7
7
|
//#region src/components/accordion/use-accordion.d.ts
|
|
8
|
-
declare const AccordionDescendantsContext:
|
|
8
|
+
declare const AccordionDescendantsContext: react182.Context<{
|
|
9
9
|
active: (target?: HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null | undefined, options?: FocusOptions) => void;
|
|
10
10
|
count: (props?: Partial<{}> | undefined) => number;
|
|
11
11
|
destroy: () => void;
|
|
@@ -24,7 +24,7 @@ declare const AccordionDescendantsContext: react981.Context<{
|
|
|
24
24
|
prevValue: (indexOrNode: number | HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null, loop?: boolean, props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}> | undefined;
|
|
25
25
|
register: (props?: {
|
|
26
26
|
disabled?: boolean | ((node: HTMLButtonElement) => boolean) | undefined;
|
|
27
|
-
} | undefined) =>
|
|
27
|
+
} | undefined) => react182.RefCallback<HTMLButtonElement>;
|
|
28
28
|
unregister: (node?: HTMLButtonElement | null | undefined) => void;
|
|
29
29
|
value: (indexOrNode: number | HTMLButtonElement | null) => Descendant<HTMLButtonElement, {}> | undefined;
|
|
30
30
|
values: (props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}>[];
|
|
@@ -50,12 +50,12 @@ declare const AccordionDescendantsContext: react981.Context<{
|
|
|
50
50
|
prevValue: (indexOrNode: number | HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null, loop?: boolean, props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}> | undefined;
|
|
51
51
|
register: (props?: {
|
|
52
52
|
disabled?: boolean | ((node: HTMLButtonElement) => boolean) | undefined;
|
|
53
|
-
} | undefined) =>
|
|
53
|
+
} | undefined) => react182.RefCallback<HTMLButtonElement>;
|
|
54
54
|
unregister: (node?: HTMLButtonElement | null | undefined) => void;
|
|
55
55
|
value: (indexOrNode: number | HTMLButtonElement | null) => Descendant<HTMLButtonElement, {}> | undefined;
|
|
56
56
|
values: (props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}>[];
|
|
57
57
|
};
|
|
58
|
-
register:
|
|
58
|
+
register: react182.RefCallback<HTMLButtonElement>;
|
|
59
59
|
}, useAccordionDescendants: () => {
|
|
60
60
|
active: (target?: HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null | undefined, options?: FocusOptions) => void;
|
|
61
61
|
count: (props?: Partial<{}> | undefined) => number;
|
|
@@ -75,15 +75,15 @@ declare const AccordionDescendantsContext: react981.Context<{
|
|
|
75
75
|
prevValue: (indexOrNode: number | HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null, loop?: boolean, props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}> | undefined;
|
|
76
76
|
register: (props?: {
|
|
77
77
|
disabled?: boolean | ((node: HTMLButtonElement) => boolean) | undefined;
|
|
78
|
-
} | undefined) =>
|
|
78
|
+
} | undefined) => react182.RefCallback<HTMLButtonElement>;
|
|
79
79
|
unregister: (node?: HTMLButtonElement | null | undefined) => void;
|
|
80
80
|
value: (indexOrNode: number | HTMLButtonElement | null) => Descendant<HTMLButtonElement, {}> | undefined;
|
|
81
81
|
values: (props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}>[];
|
|
82
82
|
};
|
|
83
83
|
interface AccordionContext extends Omit<UseAccordionReturn, "descendants" | "getRootProps"> {}
|
|
84
|
-
declare const AccordionContext:
|
|
84
|
+
declare const AccordionContext: react182.Context<AccordionContext>, useAccordionContext: () => AccordionContext;
|
|
85
85
|
interface AccordionItemContext extends Omit<UseAccordionItemReturn, "getItemProps"> {}
|
|
86
|
-
declare const AccordionItemContext:
|
|
86
|
+
declare const AccordionItemContext: react182.Context<AccordionItemContext>, useAccordionItemContext: () => AccordionItemContext;
|
|
87
87
|
interface UseAccordionProps extends Omit<HTMLProps, "onChange"> {
|
|
88
88
|
/**
|
|
89
89
|
* The initial index(es) of the accordion item to expand.
|
|
@@ -137,7 +137,7 @@ declare const useAccordion: ({
|
|
|
137
137
|
prevValue: (indexOrNode: number | HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null, loop?: boolean, props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}> | undefined;
|
|
138
138
|
register: (props?: {
|
|
139
139
|
disabled?: boolean | ((node: HTMLButtonElement) => boolean) | undefined;
|
|
140
|
-
} | undefined) =>
|
|
140
|
+
} | undefined) => react182.RefCallback<HTMLButtonElement>;
|
|
141
141
|
unregister: (node?: HTMLButtonElement | null | undefined) => void;
|
|
142
142
|
value: (indexOrNode: number | HTMLButtonElement | null) => Descendant<HTMLButtonElement, {}> | undefined;
|
|
143
143
|
values: (props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}>[];
|
|
@@ -145,8 +145,8 @@ declare const useAccordion: ({
|
|
|
145
145
|
focusedIndex: number;
|
|
146
146
|
index: number | number[];
|
|
147
147
|
multiple: boolean | undefined;
|
|
148
|
-
setFocusedIndex:
|
|
149
|
-
setIndex:
|
|
148
|
+
setFocusedIndex: react182.Dispatch<react182.SetStateAction<number>>;
|
|
149
|
+
setIndex: react182.Dispatch<react182.SetStateAction<number | number[]>>;
|
|
150
150
|
toggle: boolean | undefined;
|
|
151
151
|
getRootProps: PropGetter<"div", undefined, undefined>;
|
|
152
152
|
};
|
|
@@ -4,10 +4,9 @@ import "../../core/index.js";
|
|
|
4
4
|
import { ActionBarStyle } from "./action-bar.style.js";
|
|
5
5
|
import { PortalProps } from "../portal/portal.js";
|
|
6
6
|
import { UsePopupAnimationProps } from "../popover/popover.js";
|
|
7
|
-
import "../popover/index.js";
|
|
8
7
|
import { UseActionBarProps } from "./use-action-bar.js";
|
|
9
8
|
import "../../index.js";
|
|
10
|
-
import * as
|
|
9
|
+
import * as react181 from "react";
|
|
11
10
|
import { PropsWithChildren, ReactNode } from "react";
|
|
12
11
|
|
|
13
12
|
//#region src/components/action-bar/action-bar.d.ts
|
|
@@ -29,7 +28,7 @@ interface ActionBarRootProps extends Omit<HTMLStyledProps, "content">, ThemeProp
|
|
|
29
28
|
*/
|
|
30
29
|
onCloseComplete?: () => void;
|
|
31
30
|
}
|
|
32
|
-
declare const ActionBarPropsContext:
|
|
31
|
+
declare const ActionBarPropsContext: react181.Context<Partial<ActionBarRootProps> | undefined>, useActionBarPropsContext: () => Partial<ActionBarRootProps> | undefined;
|
|
33
32
|
/**
|
|
34
33
|
* `ActionBar` is a component that is used to display a bottom action bar with a set of actions.
|
|
35
34
|
*
|