@iress-oss/ids-components 6.1.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ai/components/select.md +16 -0
- package/dist/Autocomplete-DKufjQU5.js +324 -0
- package/dist/{Button-bZPKq0ue.js → Button-BY2qzshw.js} +4 -4
- package/dist/{Provider-DvnuqPfQ.js → Provider-BNuRw7ck.js} +2 -2
- package/dist/{Shadow-D2KoVwxD.js → Shadow-DAfthdT2.js} +3 -3
- package/dist/{Slideout-RnRSkJsj.js → Slideout-BOH2gwIN.js} +3 -3
- package/dist/{Table.styles-BLO9zGfS.js → Table.styles-CKD_vWqh.js} +3 -3
- package/dist/TableProvider-C8bDaWu2.js +80 -0
- package/dist/{TableRows-B3nZnazw.js → TableRows-DXoiLfwt.js} +3 -4
- package/dist/{Text.styles-C0D5aEE_.js → Text.styles-DUvXBRio.js} +2 -2
- package/dist/components/Alert/Alert.js +4 -4
- package/dist/components/Alert/Alert.styles.js +1 -1
- package/dist/components/Autocomplete/Autocomplete.d.ts +1 -1
- package/dist/components/Autocomplete/Autocomplete.js +1 -1
- package/dist/components/Autocomplete/Autocomplete.styles.js +1 -1
- package/dist/components/Autocomplete/components/AutocompleteInstructions.js +4 -1
- package/dist/components/Autocomplete/hooks/useAutocompleteSearch.d.ts +7 -2
- package/dist/components/Autocomplete/hooks/useAutocompleteSearch.js +1 -1
- package/dist/components/Autocomplete/index.js +2 -2
- package/dist/components/Avatar/Avatar.js +3 -3
- package/dist/components/Avatar/Avatar.styles.js +1 -1
- package/dist/components/Avatar/AvatarGroup/AvatarGroup.js +3 -3
- package/dist/components/Avatar/AvatarGroup/AvatarGroup.styles.js +1 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/CloseButton/CloseButton.js +2 -2
- package/dist/components/Button/index.js +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.js +4 -4
- package/dist/components/ButtonGroup/ButtonGroup.styles.js +1 -1
- package/dist/components/Card/Card.js +3 -3
- package/dist/components/Card/Card.styles.js +1 -1
- package/dist/components/Checkbox/Checkbox.js +4 -4
- package/dist/components/Checkbox/Checkbox.styles.js +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.styles.js +1 -1
- package/dist/components/CheckboxMark/CheckboxMark.js +3 -3
- package/dist/components/CheckboxMark/CheckboxMark.styles.js +1 -1
- package/dist/components/Col/Col.js +2 -2
- package/dist/components/Col/Col.styles.js +1 -1
- package/dist/components/Container/Container.js +2 -2
- package/dist/components/Container/Container.styles.js +1 -1
- package/dist/components/Divider/Divider.js +3 -3
- package/dist/components/Divider/Divider.styles.js +1 -1
- package/dist/components/Expander/Expander.js +4 -4
- package/dist/components/Expander/Expander.styles.js +1 -1
- package/dist/components/ExpanderChevron/ExpanderChevron.js +1 -1
- package/dist/components/ExpanderChevron/ExpanderChevron.styles.js +1 -1
- package/dist/components/Field/Field.js +5 -5
- package/dist/components/Field/Field.styles.js +1 -1
- package/dist/components/Field/components/FieldFooter.js +3 -3
- package/dist/components/Field/components/FieldHint.js +3 -3
- package/dist/components/FieldGroup/FieldGroup.js +4 -4
- package/dist/components/FieldGroup/FieldGroup.styles.js +1 -1
- package/dist/components/Hide/Hide.js +1 -1
- package/dist/components/Hide/helpers/normaliseHideValues.js +1 -1
- package/dist/components/Icon/Icon.constants.js +1 -1
- package/dist/components/Icon/Icon.js +5 -5
- package/dist/components/Icon/Icon.styles.js +1 -1
- package/dist/components/Icon/IconProvider.js +2 -2
- package/dist/components/Icon/helpers/getMaterialSymbolsList.js +1 -1
- package/dist/components/Icon/hooks/useDynamicFontSubsetting.js +56 -39
- package/dist/components/Icon/index.js +1 -1
- package/dist/components/Image/Image.js +2 -2
- package/dist/components/Image/Image.styles.js +1 -1
- package/dist/components/Inline/Inline.js +2 -2
- package/dist/components/Inline/Inline.styles.js +1 -1
- package/dist/components/Input/Input.js +4 -4
- package/dist/components/Input/Input.styles.js +1 -1
- package/dist/components/Input/InputBase/InputBase.js +1 -1
- package/dist/components/InputCurrency/InputCurrency.js +1 -1
- package/dist/components/Label/Label.styles.js +1 -1
- package/dist/components/Label/LabelBase/LabelBase.js +2 -2
- package/dist/components/Link/Link.js +3 -3
- package/dist/components/Link/Link.styles.js +1 -1
- package/dist/components/Menu/Menu.js +3 -3
- package/dist/components/Menu/Menu.styles.js +1 -1
- package/dist/components/Menu/MenuDivider/MenuDivider.js +1 -1
- package/dist/components/Menu/MenuGroup/MenuGroup.js +2 -2
- package/dist/components/Menu/MenuGroup/MenuGroup.styles.js +1 -1
- package/dist/components/Menu/MenuHeading/MenuHeading.js +1 -1
- package/dist/components/Menu/MenuItem/MenuItem.js +4 -4
- package/dist/components/Menu/MenuItem/MenuItem.styles.js +1 -1
- package/dist/components/Menu/MenuText/MenuText.js +3 -3
- package/dist/components/Modal/Modal.js +6 -6
- package/dist/components/Modal/Modal.styles.js +1 -1
- package/dist/components/Panel/Panel.js +1 -1
- package/dist/components/Pill/Pill.js +4 -4
- package/dist/components/Pill/Pill.styles.js +1 -1
- package/dist/components/Placeholder/Placeholder.js +1 -1
- package/dist/components/Placeholder/Placeholder.styles.js +1 -1
- package/dist/components/Popover/InputPopover/InputPopover.js +2 -2
- package/dist/components/Popover/Popover.js +4 -4
- package/dist/components/Popover/Popover.styles.js +1 -1
- package/dist/components/Popover/components/PopoverContent.js +54 -44
- package/dist/components/Popover/helpers/handlePopoverTabKey.js +2 -2
- package/dist/components/Popover/hooks/useFloatingPopover.js +1 -1
- package/dist/components/Popover/hooks/usePopoverItem.js +1 -1
- package/dist/components/Popover/hooks/usePopoverNavigation.js +1 -1
- package/dist/components/Progress/Progress.js +5 -5
- package/dist/components/Progress/Progress.styles.js +1 -1
- package/dist/components/Provider/Provider.js +1 -1
- package/dist/components/Provider/index.js +1 -1
- package/dist/components/Radio/Radio.js +4 -4
- package/dist/components/Radio/Radio.styles.js +1 -1
- package/dist/components/RadioGroup/RadioGroup.js +2 -2
- package/dist/components/RadioGroup/RadioGroup.styles.js +1 -1
- package/dist/components/RadioMark/RadioMark.js +3 -3
- package/dist/components/RadioMark/RadioMark.styles.js +1 -1
- package/dist/components/Readonly/Readonly.js +4 -4
- package/dist/components/Readonly/Readonly.styles.js +1 -1
- package/dist/components/Row/Row.js +2 -2
- package/dist/components/Row/Row.styles.js +1 -1
- package/dist/components/Select/Select.d.ts +6 -0
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Select/Select.styles.js +1 -1
- package/dist/components/Select/SelectBody/SelectBody.js +1 -1
- package/dist/components/Select/SelectBody/SelectBody.styles.js +1 -1
- package/dist/components/Select/SelectHeading/SelectHeading.js +2 -2
- package/dist/components/Select/SelectLabel/SelectLabel.js +1 -1
- package/dist/components/Select/SelectLabel/SelectLabel.styles.js +1 -1
- package/dist/components/Select/SelectMenu/SelectMenu.js +1 -1
- package/dist/components/Select/SelectMenu/SelectMenu.styles.js +1 -1
- package/dist/components/Select/SelectMenu/SelectMenuItem.js +1 -1
- package/dist/components/Select/SelectSearch/SelectSearch.js +1 -1
- package/dist/components/Select/SelectSearch/SelectSearch.styles.js +1 -1
- package/dist/components/Select/SelectSearchInput/SelectSearchInput.js +1 -1
- package/dist/components/Select/SelectSearchInput/SelectSearchInput.styles.js +1 -1
- package/dist/components/Select/SelectTags/SelectTags.js +2 -2
- package/dist/components/Select/SelectTags/SelectTags.styles.js +1 -1
- package/dist/components/Select/components/NativeSelect.js +3 -3
- package/dist/components/Select/components/NativeSelect.styles.d.ts +1 -1
- package/dist/components/Select/components/NativeSelect.styles.js +2 -2
- package/dist/components/Select/components/SelectOptions.d.ts +2 -2
- package/dist/components/Select/components/SelectOptions.js +78 -72
- package/dist/components/Select/index.js +1 -1
- package/dist/components/Skeleton/Skeleton.js +1 -1
- package/dist/components/Skeleton/Skeleton.styles.js +1 -1
- package/dist/components/SkipLink/SkipLink.js +2 -2
- package/dist/components/SkipLink/SkipLink.styles.js +1 -1
- package/dist/components/Slideout/Slideout.js +1 -1
- package/dist/components/Slideout/Slideout.styles.js +1 -1
- package/dist/components/Slideout/components/SlideoutInner.js +2 -2
- package/dist/components/Slideout/hooks/usePushElement.js +1 -1
- package/dist/components/Slideout/index.js +1 -1
- package/dist/components/Slider/Slider.js +3 -3
- package/dist/components/Slider/Slider.styles.js +1 -1
- package/dist/components/Slider/components/SliderTicks.js +2 -2
- package/dist/components/Spinner/Spinner.js +1 -1
- package/dist/components/Spinner/Spinner.styles.js +2 -2
- package/dist/components/Stack/Stack.js +2 -2
- package/dist/components/Stack/Stack.styles.js +1 -1
- package/dist/components/Styled/Styled.js +1 -1
- package/dist/components/TabSet/Tab/Tab.js +3 -3
- package/dist/components/TabSet/Tab/Tab.styles.js +1 -1
- package/dist/components/TabSet/TabSet.js +5 -5
- package/dist/components/TabSet/TabSet.styles.js +1 -1
- package/dist/components/Table/Table.js +1 -1
- package/dist/components/Table/Table.styles.js +1 -1
- package/dist/components/Table/TableBody/TableBody.js +1 -1
- package/dist/components/Table/TableProvider.js +2 -43
- package/dist/components/Table/components/TableEmpty.js +1 -1
- package/dist/components/Table/components/TableFilterButton.js +1 -1
- package/dist/components/Table/components/TableHeader.js +1 -1
- package/dist/components/Table/components/TableHeaderCell.js +1 -1
- package/dist/components/Table/components/TableRows.js +1 -1
- package/dist/components/Table/components/TableSortButton.js +1 -1
- package/dist/components/Table/helpers/composeTableColumnDefs.js +1 -1
- package/dist/components/Table/helpers/composeTableInitialColumnFilters.js +1 -1
- package/dist/components/Table/hooks/useTable.js +1 -1
- package/dist/components/Table/hooks/useTableColumnFilter.js +2 -2
- package/dist/components/Table/hooks/useTableColumnSort.js +1 -1
- package/dist/components/Table/hooks/useTableColumnStyles.js +4 -4
- package/dist/components/Table/index.js +2 -2
- package/dist/components/Tag/Tag.js +3 -3
- package/dist/components/Tag/Tag.styles.js +1 -1
- package/dist/components/TagInput/TagInput.styles.js +1 -1
- package/dist/components/Text/Text.js +3 -3
- package/dist/components/Text/Text.styles.js +1 -1
- package/dist/components/Text/index.js +1 -1
- package/dist/components/Toaster/Toaster.js +3 -3
- package/dist/components/Toaster/Toaster.styles.js +1 -1
- package/dist/components/Toaster/components/Toast/Toast.js +2 -2
- package/dist/components/Toaster/components/Toast/Toast.styles.js +1 -1
- package/dist/components/Toggle/Toggle.js +3 -3
- package/dist/components/Toggle/Toggle.styles.js +1 -1
- package/dist/components/Tooltip/Tooltip.js +3 -3
- package/dist/components/Tooltip/Tooltip.styles.js +1 -1
- package/dist/components/ValidationMessage/ValidationLink/ValidationLink.js +1 -1
- package/dist/components/ValidationMessage/ValidationMessage.js +3 -3
- package/dist/components/ValidationMessage/ValidationSummary/ValidationSummary.js +2 -2
- package/dist/{composeTableColumnDefs-B1U_Snxq.js → composeTableColumnDefs-DzUn8D5f.js} +230 -266
- package/dist/constants.js +1 -1
- package/dist/{create-recipe-CYwSzH6a.js → create-recipe-A316lnq3.js} +3 -3
- package/dist/{css-D3KwXbP0.js → css-R34N3rft.js} +32 -32
- package/dist/{cva-BWFp4eLV.js → cva-DcOwIar2.js} +2 -2
- package/dist/{factory-sKbby7-S.js → factory-BKr3zaf6.js} +4 -4
- package/dist/{floating-ui.react-COiJC198.js → floating-ui.react-TDMXDOBr.js} +50 -50
- package/dist/helpers/dom/focusableElements.js +1 -1
- package/dist/helpers/label-value/highlightQueryInLabel.js +378 -2
- package/dist/helpers/label-value/highlightQueryInLabelValue.js +1 -1
- package/dist/helpers/label-value/searchLabelValues.js +3 -2
- package/dist/helpers/styling/iressCss.js +1 -1
- package/dist/hooks/useBreakpoint.js +1 -1
- package/dist/hooks/useResponsiveProps.js +1 -1
- package/dist/index.d-BITk11Vr.js +4 -0
- package/dist/{index.esm-CmxdHJYy.js → index.esm-CapMi3wi.js} +2 -2
- package/dist/{is-valid-prop-BoZ7GJt2.js → is-valid-prop-BVyYPT21.js} +1 -1
- package/dist/{main-BpD96KHv.js → main-TklToXNs.js} +24 -25
- package/dist/main.js +10 -10
- package/dist/patterns/Breadcrumbs/Breadcrumbs.js +2 -2
- package/dist/patterns/Breadcrumbs/Breadcrumbs.styles.js +1 -1
- package/dist/patterns/ContextualMenu/ContextualMenu.js +5 -5
- package/dist/patterns/ContextualMenu/ContextualMenu.styles.js +1 -1
- package/dist/patterns/DropdownMenu/DropdownMenu.js +86 -85
- package/dist/patterns/DropdownMenu/DropdownMenu.styles.js +1 -1
- package/dist/patterns/Form/Form.styles.js +1 -1
- package/dist/patterns/Form/FormField/helpers/getErrorTypeMessage.js +2 -2
- package/dist/patterns/Form/FormField/helpers/transformCustomRulesToValidateRule.js +5 -5
- package/dist/patterns/Form/FormValidationSummary/FormValidationSummary.js +1 -1
- package/dist/patterns/Form/HookForm/HookForm.js +2 -2
- package/dist/patterns/Form/components/LongForm.js +1 -1
- package/dist/patterns/Form/components/ShortForm.js +1 -1
- package/dist/patterns/Loading/Loading.styles.js +1 -1
- package/dist/patterns/Loading/components/ComponentLoading.js +4 -4
- package/dist/patterns/Loading/components/DefaultLoading.js +2 -2
- package/dist/patterns/Loading/components/LongLoading.js +4 -4
- package/dist/patterns/Loading/components/PageLoading.js +2 -2
- package/dist/patterns/Loading/components/StartUpLoading.js +2 -2
- package/dist/patterns/Loading/components/ValidateLoading.js +3 -3
- package/dist/patterns/Shadow/Shadow.js +1 -1
- package/dist/patterns/Shadow/index.js +1 -1
- package/dist/patterns/SideNav/SideNav.js +4 -4
- package/dist/patterns/SideNav/SideNav.styles.js +1 -1
- package/dist/rolldown-runtime-3b4jIN3o.js +13 -0
- package/dist/style.css +1 -1
- package/dist/{sva-DOLIp5Dd.js → sva-DGhdmNso.js} +3 -3
- package/dist/{useAutocompleteSearch-DxKxs6HH.js → useAutocompleteSearch-BYzUn7Ag.js} +45 -44
- package/package.json +16 -16
- package/dist/Autocomplete-BRGD9dSh.js +0 -321
- package/dist/highlightQueryInLabel-BLIy9JHT.js +0 -386
- package/dist/index.d-CLYyYDIv.js +0 -4
- /package/dist/{constants-D0UW4Ewm.js → constants-DJz-xntC.js} +0 -0
- /package/dist/{cx-CZ8IJJTy.js → cx-QcEwjve6.js} +0 -0
- /package/dist/{tokens-CG_Rn1W3.js → tokens-DQsbW5to.js} +0 -0
package/.ai/components/select.md
CHANGED
|
@@ -109,6 +109,22 @@ By default, async searches are triggered after 1 character. Setting a higher val
|
|
|
109
109
|
|
|
110
110
|
[View "AsyncOptionsMinSearchLength" example in Storybook →](https://main--691abcc79dfa560a36d0a74f.chromatic.com/?path=/story/components_components-select--async-options-min-search-length)
|
|
111
111
|
|
|
112
|
+
### Custom error text
|
|
113
|
+
|
|
114
|
+
When using asynchronous options, the `errorText` prop lets you customise the
|
|
115
|
+
error message shown when the options function throws. By default, a generic
|
|
116
|
+
danger alert is displayed.
|
|
117
|
+
|
|
118
|
+
You can pass a `ReactNode` for a static message, or a render function
|
|
119
|
+
`(error: boolean | string) => ReactNode` to access the error value and render
|
|
120
|
+
it dynamically.
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
<SelectAsyncErrorText />
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
[View "ErrorText" example in Storybook →](https://main--691abcc79dfa560a36d0a74f.chromatic.com/?path=/story/components_components-select--error-text)
|
|
127
|
+
|
|
112
128
|
### Initial options
|
|
113
129
|
|
|
114
130
|
If you are using asynchronous options, you can provide an initial set of options to display before the user has interacted with the select using the `initialOptions` prop.
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { t as e } from "./cx-QcEwjve6.js";
|
|
2
|
+
import { GlobalCSSClass as t } from "./enums.js";
|
|
3
|
+
import { idsLogger as n } from "./helpers/utility/idsLogger.js";
|
|
4
|
+
import { IressIcon as r } from "./components/Icon/Icon.js";
|
|
5
|
+
import { IressText as i } from "./components/Text/Text.js";
|
|
6
|
+
import { propagateTestid as a } from "./helpers/utility/propagateTestid.js";
|
|
7
|
+
import { IressSpinner as o } from "./components/Spinner/Spinner.js";
|
|
8
|
+
import { toArray as s } from "./helpers/formatting/toArray.js";
|
|
9
|
+
import { useControlledState as c } from "./hooks/useControlledState.js";
|
|
10
|
+
import { useResponsiveProps as ee } from "./hooks/useResponsiveProps.js";
|
|
11
|
+
import { IressPopover as te } from "./components/Popover/Popover.js";
|
|
12
|
+
import { IressInputPopover as ne } from "./components/Popover/InputPopover/InputPopover.js";
|
|
13
|
+
import { IressAlert as re } from "./components/Alert/Alert.js";
|
|
14
|
+
import { autoComplete as l } from "./components/Autocomplete/Autocomplete.styles.js";
|
|
15
|
+
import { getFormControlValueAsStringIfDefined as ie } from "./helpers/form/getFormControlValueAsStringIfDefined.js";
|
|
16
|
+
import { useNoDefaultValueInForms as ae } from "./patterns/Form/hooks/useNoDefaultValueInForms.js";
|
|
17
|
+
import { IressReadonly as oe } from "./components/Readonly/Readonly.js";
|
|
18
|
+
import { IressInput as u } from "./components/Input/Input.js";
|
|
19
|
+
import { getValueAsEvent as se } from "./helpers/form/getValueAsEvent.js";
|
|
20
|
+
import { t as ce } from "./useAutocompleteSearch-BYzUn7Ag.js";
|
|
21
|
+
import { AutocompleteInstructions as d } from "./components/Autocomplete/components/AutocompleteInstructions.js";
|
|
22
|
+
import { select as le } from "./components/Select/Select.styles.js";
|
|
23
|
+
import { IressInline as f } from "./components/Inline/Inline.js";
|
|
24
|
+
import { SelectActivator as ue } from "./components/Select/components/SelectActivator.js";
|
|
25
|
+
import { IressSelectMenu as p } from "./components/Select/SelectMenu/SelectMenu.js";
|
|
26
|
+
import { SelectOptions as m } from "./components/Select/components/SelectOptions.js";
|
|
27
|
+
import { SelectHiddenInput as de } from "./components/Select/components/SelectHiddenInput.js";
|
|
28
|
+
import { NativeSelect as fe } from "./components/Select/components/NativeSelect.js";
|
|
29
|
+
import { useSelectState as h } from "./components/Select/hooks/useSelectState.js";
|
|
30
|
+
import { forwardRef as g, useCallback as pe, useEffect as _, useImperativeHandle as me, useMemo as v, useRef as y, useState as b } from "react";
|
|
31
|
+
import { Fragment as he, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
32
|
+
//#region src/components/Select/Select.tsx
|
|
33
|
+
var C = (e) => typeof e == "object" && !!e && "label" in e, w = (e, t) => {
|
|
34
|
+
for (let n of t) if (n.children) {
|
|
35
|
+
let t = w(e, n.children);
|
|
36
|
+
if (t) return t;
|
|
37
|
+
} else if (n.value !== void 0 && n.value === e) return n;
|
|
38
|
+
}, T = (e, t) => {
|
|
39
|
+
if (C(e)) return e;
|
|
40
|
+
if (typeof t != "function") return w(e, t) ?? (typeof e == "number" ? w(String(e), t) : void 0);
|
|
41
|
+
}, E = (e, t) => {
|
|
42
|
+
if (e !== void 0) {
|
|
43
|
+
if (Array.isArray(e)) {
|
|
44
|
+
let r = e, i = r.map((e) => T(e, t)).filter((e) => e !== void 0);
|
|
45
|
+
return i.length < r.length && typeof t != "function" && n(`IressSelect: ${r.length - i.length} value(s) could not be resolved to matching options and were dropped.`, "warn"), i;
|
|
46
|
+
}
|
|
47
|
+
return T(e, t);
|
|
48
|
+
}
|
|
49
|
+
}, D = g(({ align: r = "bottom-start", autoHighlight: i = !0, className: a, defaultValue: o, disabled: s, errorText: c, footer: ne, header: re, id: l, matchActivatorWidth: ie = !0, multiSelect: u, multiSelectLimit: se, name: d, onChange: f, onBlur: p, options: g, native: w, placeholder: T, readOnly: D, renderHiddenInput: O, renderLabel: ge, renderOptions: _e, required: k, type: A, value: j, virtualFocus: M, width: N, ...P }, F) => {
|
|
50
|
+
ae({
|
|
51
|
+
component: "IressSelect",
|
|
52
|
+
defaultValue: o
|
|
53
|
+
});
|
|
54
|
+
let [I, L] = b(!1), R = I && !s, [z, ve] = b(""), B = v(() => E(j, g), [j, g]), V = v(() => E(o, g), [o, g]);
|
|
55
|
+
_(() => {
|
|
56
|
+
j !== void 0 && !C(j) && B === void 0 && typeof g == "function" && n("IressSelect: A primitive value was passed but cannot be resolved because options are asynchronous. Pass a LabelValueMeta object instead when using async options, otherwise the component will behave as uncontrolled.", "warn");
|
|
57
|
+
}, [
|
|
58
|
+
j,
|
|
59
|
+
B,
|
|
60
|
+
g
|
|
61
|
+
]);
|
|
62
|
+
let { value: H, setValue: U, getValuesString: W, getLabelsString: ye } = h({
|
|
63
|
+
component: "IressSelect",
|
|
64
|
+
defaultValue: V,
|
|
65
|
+
multiple: u,
|
|
66
|
+
value: B
|
|
67
|
+
}), G = y(null), K = y(null), q = y(null), { value: J } = ee(typeof w == "string" ? {
|
|
68
|
+
xs: !0,
|
|
69
|
+
[w]: !1
|
|
70
|
+
} : { xs: w }, { disabled: !w }), { append: be, debounceThreshold: xe, initialOptions: Y, loadingDelay: Se, minSearchLength: X, onActivated: Ce, onDeactivated: we, prepend: Te, selectedOptionsText: Ee, ...Z } = P, { debouncedQuery: De, error: Oe, results: ke, stopSearch: Ae, loading: je, shouldShowInstructions: Me, shouldShowNoResults: Ne } = ce({
|
|
71
|
+
debounceThreshold: xe,
|
|
72
|
+
disabled: !I || !!J,
|
|
73
|
+
initialOptions: Y,
|
|
74
|
+
loadingDelay: Se,
|
|
75
|
+
minSearchLength: X,
|
|
76
|
+
options: g,
|
|
77
|
+
query: z
|
|
78
|
+
});
|
|
79
|
+
me(F, () => J ? {
|
|
80
|
+
focus: () => K.current?.focus(),
|
|
81
|
+
blur: () => K.current?.blur(),
|
|
82
|
+
input: K.current ?? null
|
|
83
|
+
} : G.current ? {
|
|
84
|
+
...G.current,
|
|
85
|
+
focus: () => G.current?.getActivator()?.focus(),
|
|
86
|
+
blur: () => G.current?.getActivator()?.blur(),
|
|
87
|
+
hiddenInput: q.current ?? void 0,
|
|
88
|
+
input: q.current ?? null
|
|
89
|
+
} : {
|
|
90
|
+
hiddenInput: q.current ?? void 0,
|
|
91
|
+
input: q.current ?? null,
|
|
92
|
+
focus: () => q.current?.focus(),
|
|
93
|
+
blur: () => q.current?.blur()
|
|
94
|
+
}, [J]), _(() => {
|
|
95
|
+
I ? Ce?.() : we?.();
|
|
96
|
+
}, [
|
|
97
|
+
Ce,
|
|
98
|
+
we,
|
|
99
|
+
I
|
|
100
|
+
]);
|
|
101
|
+
let Pe = pe((e) => {
|
|
102
|
+
if (!p) return;
|
|
103
|
+
let t = e.currentTarget, n = e.relatedTarget;
|
|
104
|
+
!I && (!n || !t.contains(n)) && p(e), e.stopPropagation();
|
|
105
|
+
}, [p, I]);
|
|
106
|
+
if (D) return /* @__PURE__ */ x(oe, {
|
|
107
|
+
value: W(),
|
|
108
|
+
ref: q,
|
|
109
|
+
variant: D,
|
|
110
|
+
name: d,
|
|
111
|
+
disabled: s,
|
|
112
|
+
required: k,
|
|
113
|
+
children: ye(", ")
|
|
114
|
+
});
|
|
115
|
+
if (J) {
|
|
116
|
+
if (g instanceof Function) throw Error("[IressSelect] The native select does not support asynchronous options. Please provide options as an array.");
|
|
117
|
+
if (u) throw Error("[IressSelect] The native select does not support multiple selection. Please remove the multiSelect prop or use the non-native select.");
|
|
118
|
+
return /* @__PURE__ */ x(fe, {
|
|
119
|
+
className: e(a, t.Select),
|
|
120
|
+
"data-testid": Z["data-testid"],
|
|
121
|
+
disabled: s,
|
|
122
|
+
id: l,
|
|
123
|
+
name: d,
|
|
124
|
+
onChange: (e, t) => {
|
|
125
|
+
f?.(e, t?.value ?? null, t), U(t);
|
|
126
|
+
},
|
|
127
|
+
options: g,
|
|
128
|
+
placeholder: typeof w == "string" ? T ?? "" : T,
|
|
129
|
+
style: Z.style,
|
|
130
|
+
value: H,
|
|
131
|
+
width: N,
|
|
132
|
+
ref: K
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
let Q = typeof g == "function", Fe = M ?? !Q, Ie = A ?? (Q ? void 0 : "listbox"), $ = le({ width: N }), Le = () => {
|
|
136
|
+
L(!0);
|
|
137
|
+
}, Re = () => {
|
|
138
|
+
L(!1), Ae();
|
|
139
|
+
};
|
|
140
|
+
return /* @__PURE__ */ S(he, { children: [/* @__PURE__ */ x(de, {
|
|
141
|
+
"data-testid": Z["data-testid"],
|
|
142
|
+
getValuesString: W,
|
|
143
|
+
name: d,
|
|
144
|
+
renderHiddenInput: O,
|
|
145
|
+
required: k,
|
|
146
|
+
value: H,
|
|
147
|
+
disabled: s,
|
|
148
|
+
ref: q
|
|
149
|
+
}), /* @__PURE__ */ x(te, {
|
|
150
|
+
...Z,
|
|
151
|
+
activator: /* @__PURE__ */ x(ue, {
|
|
152
|
+
append: be,
|
|
153
|
+
async: Q,
|
|
154
|
+
disabled: s,
|
|
155
|
+
error: Oe,
|
|
156
|
+
id: l,
|
|
157
|
+
loading: je,
|
|
158
|
+
multiSelect: u,
|
|
159
|
+
multiSelectLimit: se,
|
|
160
|
+
onChange: f,
|
|
161
|
+
placeholder: T,
|
|
162
|
+
prepend: Te,
|
|
163
|
+
renderLabel: ge,
|
|
164
|
+
selectedOptionsText: Ee,
|
|
165
|
+
setValue: U,
|
|
166
|
+
setShow: L,
|
|
167
|
+
show: I,
|
|
168
|
+
value: H
|
|
169
|
+
}),
|
|
170
|
+
align: r,
|
|
171
|
+
className: e(a, $.root, t.Select),
|
|
172
|
+
contentClassName: e($.popoverContent),
|
|
173
|
+
contentStyle: {
|
|
174
|
+
...Z.contentStyle,
|
|
175
|
+
p: "none"
|
|
176
|
+
},
|
|
177
|
+
matchActivatorWidth: ie,
|
|
178
|
+
onActivated: Le,
|
|
179
|
+
onDeactivated: Re,
|
|
180
|
+
ref: G,
|
|
181
|
+
show: R,
|
|
182
|
+
type: Ie,
|
|
183
|
+
virtualFocus: Fe,
|
|
184
|
+
onBlur: Pe,
|
|
185
|
+
children: /* @__PURE__ */ S("div", {
|
|
186
|
+
className: $.wrapper,
|
|
187
|
+
children: [
|
|
188
|
+
re,
|
|
189
|
+
/* @__PURE__ */ x(m, {
|
|
190
|
+
autoHighlight: i,
|
|
191
|
+
debouncedQuery: De,
|
|
192
|
+
error: Oe,
|
|
193
|
+
errorText: c,
|
|
194
|
+
initialOptions: Y,
|
|
195
|
+
loading: je,
|
|
196
|
+
minSearchLength: X,
|
|
197
|
+
multiSelect: u,
|
|
198
|
+
onChange: f,
|
|
199
|
+
options: g,
|
|
200
|
+
query: z,
|
|
201
|
+
renderOptions: _e,
|
|
202
|
+
results: ke,
|
|
203
|
+
setQuery: ve,
|
|
204
|
+
setShow: L,
|
|
205
|
+
setValue: U,
|
|
206
|
+
shouldShowInstructions: Me,
|
|
207
|
+
shouldShowNoResults: Ne,
|
|
208
|
+
show: R,
|
|
209
|
+
value: H
|
|
210
|
+
}),
|
|
211
|
+
ne
|
|
212
|
+
]
|
|
213
|
+
})
|
|
214
|
+
})] });
|
|
215
|
+
});
|
|
216
|
+
D.displayName = "IressSelect";
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region src/components/Autocomplete/Autocomplete.tsx
|
|
219
|
+
var O = g(({ alwaysShowOnFocus: n, append: ee = /* @__PURE__ */ x(r, { name: "search" }), autoComplete: te = "off", autoSelect: ae = !0, className: le, clearable: ue = !0, "data-testid": m, debounceThreshold: de, defaultValue: fe, errorText: h = /* @__PURE__ */ x(re, {
|
|
220
|
+
status: "danger",
|
|
221
|
+
mb: "none",
|
|
222
|
+
variant: "full-width",
|
|
223
|
+
children: "An unknown error occurred. Please contact support if the error persists."
|
|
224
|
+
}), initialOptions: g, loadingDelay: pe, limitDesktop: me = 12, limitMobile: v = 6, minSearchLength: y, noResultsText: C, onChange: w, onClear: T, onFocus: E, options: D, popoverProps: { autoHighlight: O = !1, append: ge, prepend: _e, ...k } = {}, readOnly: A, value: j, ...M }, N) => {
|
|
225
|
+
let [P, F] = b(!1), { value: I, setValue: L } = c({
|
|
226
|
+
component: "IressAutocomplete",
|
|
227
|
+
defaultValue: fe,
|
|
228
|
+
value: j
|
|
229
|
+
}), [R, z] = b(!1), { clearError: ve, debouncedQuery: B, error: V, loading: H, results: U, startSearch: W, stopSearch: ye, shouldShowInstructions: G, shouldShowNoResults: K } = ce({
|
|
230
|
+
debounceThreshold: de,
|
|
231
|
+
initialOptions: g,
|
|
232
|
+
loadingDelay: pe,
|
|
233
|
+
minSearchLength: y,
|
|
234
|
+
options: D,
|
|
235
|
+
query: ie(I)
|
|
236
|
+
});
|
|
237
|
+
if (_(() => {
|
|
238
|
+
R && !P && U.length > 0 && I && F(!0);
|
|
239
|
+
}, [
|
|
240
|
+
U.length,
|
|
241
|
+
P,
|
|
242
|
+
R,
|
|
243
|
+
I
|
|
244
|
+
]), _(() => {
|
|
245
|
+
H && R && F(!0);
|
|
246
|
+
}, [H, R]), _(() => {
|
|
247
|
+
V && F(!0);
|
|
248
|
+
}, [V]), A) return /* @__PURE__ */ x(oe, {
|
|
249
|
+
value: I,
|
|
250
|
+
variant: A
|
|
251
|
+
});
|
|
252
|
+
let q = (e, t) => {
|
|
253
|
+
w?.(e, t), L(t), z(!!t);
|
|
254
|
+
}, J = (e) => {
|
|
255
|
+
T?.(e), L("");
|
|
256
|
+
}, be = (e) => {
|
|
257
|
+
E?.(e), g?.length && F(!0);
|
|
258
|
+
}, xe = (e) => {
|
|
259
|
+
let t = s(e)?.[0];
|
|
260
|
+
w?.(se(t?.label), t?.label, t), L(t?.label), F(!1), z(!1);
|
|
261
|
+
}, Y = () => {
|
|
262
|
+
(!n || !I) && ye(), ve(), F(!1), I && z(!1);
|
|
263
|
+
}, Se = (e) => {
|
|
264
|
+
M.onKeyDown?.(e), e.key === "ArrowDown" && (!P || !R) && (U.length || W(!0), z(!0), F(!0));
|
|
265
|
+
}, X = l({ isEmpty: U.length === 0 && !H && !V && !G && !K });
|
|
266
|
+
return /* @__PURE__ */ S(ne, {
|
|
267
|
+
...k,
|
|
268
|
+
activator: /* @__PURE__ */ x(u, {
|
|
269
|
+
...M,
|
|
270
|
+
append: ee,
|
|
271
|
+
autoComplete: te,
|
|
272
|
+
clearable: ue,
|
|
273
|
+
"data-testid": a(m, "input"),
|
|
274
|
+
onChange: q,
|
|
275
|
+
onClear: J,
|
|
276
|
+
onFocus: be,
|
|
277
|
+
onKeyDown: Se,
|
|
278
|
+
value: I,
|
|
279
|
+
ref: N
|
|
280
|
+
}),
|
|
281
|
+
autoHighlight: O,
|
|
282
|
+
className: e(le, k.className, X.root, t.Autocomplete),
|
|
283
|
+
contentClassName: e(k.contentClassName, X.popoverContent),
|
|
284
|
+
contentStyle: k.contentStyle,
|
|
285
|
+
"data-testid": m,
|
|
286
|
+
minLength: 0,
|
|
287
|
+
onActivated: () => (R || n) && F(!0),
|
|
288
|
+
onDeactivated: Y,
|
|
289
|
+
show: P,
|
|
290
|
+
type: "listbox",
|
|
291
|
+
focusStartIndex: 0,
|
|
292
|
+
children: [
|
|
293
|
+
H && !U.length && /* @__PURE__ */ S(f, {
|
|
294
|
+
gap: "sm",
|
|
295
|
+
verticalAlign: "middle",
|
|
296
|
+
p: "spacing.3",
|
|
297
|
+
children: [/* @__PURE__ */ x(o, { color: "colour.neutral.70" }), /* @__PURE__ */ x(i, {
|
|
298
|
+
color: "colour.neutral.70",
|
|
299
|
+
children: "Loading results..."
|
|
300
|
+
})]
|
|
301
|
+
}),
|
|
302
|
+
U.length > 0 && /* @__PURE__ */ S(he, { children: [
|
|
303
|
+
_e,
|
|
304
|
+
/* @__PURE__ */ x(p, {
|
|
305
|
+
changeOnBlur: ae,
|
|
306
|
+
className: e(X.optionList),
|
|
307
|
+
"data-testid": a(m, "menu"),
|
|
308
|
+
items: U,
|
|
309
|
+
limitDesktop: me,
|
|
310
|
+
limitMobile: v,
|
|
311
|
+
onChange: xe,
|
|
312
|
+
selected: { label: B }
|
|
313
|
+
}),
|
|
314
|
+
ge
|
|
315
|
+
] }),
|
|
316
|
+
V && h,
|
|
317
|
+
G && !V && /* @__PURE__ */ x(d, { minSearchLength: y ?? 1 }),
|
|
318
|
+
K && !V && C
|
|
319
|
+
]
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
O.displayName = "IressAutocomplete";
|
|
323
|
+
//#endregion
|
|
324
|
+
export { D as n, O as t };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as e, f as t, l as n, s as r, t as i } from "./css-
|
|
2
|
-
import { t as a } from "./cx-
|
|
3
|
-
import { n as o } from "./is-valid-prop-
|
|
1
|
+
import { a as e, f as t, l as n, s as r, t as i } from "./css-R34N3rft.js";
|
|
2
|
+
import { t as a } from "./cx-QcEwjve6.js";
|
|
3
|
+
import { n as o } from "./is-valid-prop-BVyYPT21.js";
|
|
4
4
|
import { GlobalCSSClass as s } from "./enums.js";
|
|
5
5
|
import { IressIcon as c } from "./components/Icon/Icon.js";
|
|
6
|
-
import { t as l } from "./create-recipe-
|
|
6
|
+
import { t as l } from "./create-recipe-A316lnq3.js";
|
|
7
7
|
import { IressSpinner as u } from "./components/Spinner/Spinner.js";
|
|
8
8
|
import { useButtonGroupItem as d } from "./components/ButtonGroup/hooks/useButtonGroupItem.js";
|
|
9
9
|
import { usePopover as f } from "./components/Popover/hooks/usePopover.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as e, u as t } from "./constants-
|
|
1
|
+
import { p as e, u as t } from "./constants-DJz-xntC.js";
|
|
2
2
|
import { IressIconProvider as n } from "./components/Icon/IconProvider.js";
|
|
3
3
|
import { IressPopoverProvider as r } from "./components/Popover/PopoverProvider.js";
|
|
4
4
|
import { IressModalProvider as i } from "./components/Modal/ModalProvider.js";
|
|
@@ -8,7 +8,7 @@ import { useEffect as s } from "react";
|
|
|
8
8
|
import { createPortal as c } from "react-dom";
|
|
9
9
|
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
10
10
|
//#region ../tokens/dist/enums.js
|
|
11
|
-
var d =
|
|
11
|
+
var d = /*@__PURE__*/ function(e) {
|
|
12
12
|
return e.Color = "color", e.Dimension = "dimension", e.FontFamily = "fontFamily", e.FontSize = "fontSize", e.Background = "background", e.Border = "border", e.Radius = "radius", e.Shadow = "shadow", e.Typography = "typography", e;
|
|
13
13
|
}({}), f = ".875rem", p = "Ubuntu, Helvetica, sans-serif", m = "Inter, Helvetica, sans-serif", h = ["https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap"];
|
|
14
14
|
d.FontSize, d.FontFamily, d.FontFamily, d.Typography, `${p}`, `${f}`, d.Typography, `${p}`, `${f}`, d.Typography, `${p}`, `${f}`, d.Typography, `${p}`, `${f}`, d.Typography, `${p}`, `${f}`, d.Typography, `${m}`, `${f}`, d.Typography, `${m}`, `${f}`, d.Typography, `${m}`, `${f}`, d.Typography, `${m}`, `${f}`, d.Typography, `${m}`, `${f}`, d.Typography, `${m}`, `${f}`, d.Typography, `${m}`, `${f}`, d.Typography, `${m}`, `${f}`, d.Typography, `${f}`;
|