@fuf-stack/uniform 0.9.0 → 0.9.1

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Select/Select.tsx","../src/Select/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { Props } from 'react-select';\n\nimport { useState } from 'react';\nimport { Controller } from 'react-hook-form';\nimport ReactSelect, { components } from 'react-select';\n\nimport { useSelect } from '@nextui-org/select';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport const selectVariants = tv({\n slots: {\n base: '',\n clearIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-foreground-800',\n control:\n 'rounded-lg border-2 border-default-200 shadow-sm !duration-150 transition-background hover:border-default-400 motion-reduce:transition-none',\n control_focused: 'border-primary hover:border-primary',\n crossIcon: '',\n downChevron: '',\n dropdownIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-black',\n group: '',\n groupHeading: 'mb-1 ml-3 mt-2 text-sm text-foreground-500',\n indicatorsContainer: 'gap-1 p-1',\n indicatorSeparator: 'bg-default-300',\n input: 'py-0.5 pl-1',\n loadingIndicator: '',\n loadingMessage: '',\n menu: 'mt-2 rounded-xl border border-default-200 bg-background p-1 shadow-lg',\n menuList: '',\n // ensure menu has same z-index as modal so it is visible when rendered in modal\n // see: https://github.com/nextui-org/nextui/blob/main/packages/core/theme/src/components/modal.ts (see z-50)\n menuPortal: '!z-50',\n multiValue: 'items-center gap-1.5 rounded bg-default-100 py-0.5 pl-2 pr-1',\n multiValueContainer: '',\n multiValueLabel: 'py-0.5 leading-6',\n multiValueRemove:\n 'rounded text-default-500 hover:cursor-pointer hover:border-default-300 hover:text-default-800',\n noOptionsMessage: 'rounded-sm p-2 text-foreground-500',\n option: 'rounded px-3 py-2 hover:cursor-pointer',\n option_selected: 'bg-default-300',\n option_focused: 'bg-default-100 active:bg-default-200',\n placeholder: 'py-0.5 pl-1 text-foreground-500',\n selectContainer: '',\n singleValue: '!ml-1 !leading-7',\n valueContainer: 'gap-1 p-1',\n },\n variants: {\n invalid: {\n true: {\n control: 'border-danger hover:border-danger',\n },\n },\n },\n});\n\ntype SelectOption = {\n /** option label */\n label?: React.ReactNode;\n /** option value */\n value: string;\n};\n\ntype VariantProps = TVProps<typeof selectVariants>;\ntype ClassName = TVClassName<typeof selectVariants>;\n\nexport interface SelectProps extends VariantProps {\n /** CSS class name */\n className?: ClassName; // string;\n /** Determine if the */\n clearable?: boolean;\n /** Set the select to disabled state. */\n disabled?: boolean;\n /** Filter Select Options */\n filterOption?:\n | undefined\n | ((option?: SelectOption, inputValue?: string) => boolean);\n /** Format the label of the option */\n formatOptionLabel?: undefined | Props['formatOptionLabel'];\n /** The value of the search input */\n inputValue?: string;\n /** Label that should be associated with the select. */\n label?: React.ReactNode;\n /** Set the select to a loading state. */\n loading?: boolean;\n /** switch between single and multi select mode. */\n multiSelect?: boolean;\n /** The name for the Select component, used by react-hook-form */\n name: string;\n /** Placeholder that is displayed when nothing is selected */\n placeholder?: string;\n /** The options for the Select component */\n options: SelectOption[];\n /** Handle change events on the input */\n onInputChange?: Props['onInputChange'];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\nconst InputComponent: typeof components.Input = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/prop-types, react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_input`;\n // eslint-disable-next-line react/jsx-props-no-spreading\n return <components.Input data-testid={testId} {...props} />;\n};\n\nconst OptionComponent: typeof components.Option = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/prop-types, react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_option_${props?.data?.testId ?? props?.data?.value}`;\n return (\n <div data-testid={testId}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <components.Option {...props} />\n </div>\n );\n};\n\nconst DropdownIndicatorComponent: typeof components.DropdownIndicator = (\n props,\n) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/prop-types\n const testId = props?.selectProps['data-testid'] as string;\n return (\n <div data-testid={`${testId}_dropdown`}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <components.DropdownIndicator {...props} />\n </div>\n );\n};\n\n/** Select component based on [NextUI Select](https://nextui.org/docs/components/select) and [React-Select](https://react-select.com/home) */\nconst Select = ({\n className = undefined,\n clearable = true,\n disabled = false,\n filterOption = undefined,\n formatOptionLabel = undefined,\n inputValue = undefined,\n label: _label = undefined,\n loading = false,\n multiSelect = false,\n name,\n onInputChange = undefined,\n options,\n placeholder = undefined,\n testId: _testId = undefined,\n}: SelectProps) => {\n const { control, getFieldState } = useFormContext();\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n const [isFocused, setIsFocused] = useState(false);\n\n const variants = selectVariants({ invalid });\n const classNames = variantsToClassNames(variants, className, 'base');\n\n const {\n label,\n getBaseProps,\n getLabelProps,\n getTriggerProps,\n getValueProps,\n getMainWrapperProps,\n getHelperWrapperProps,\n getErrorMessageProps,\n } = useSelect({\n isLoading: loading,\n isInvalid: invalid,\n isRequired: required,\n isDisabled: disabled,\n errorMessage: JSON.stringify(error),\n label: _label,\n labelPlacement: 'outside',\n placeholder: ' ',\n children: [],\n classNames,\n });\n\n return (\n <Controller\n control={control}\n name={name}\n render={({\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n field: { onChange, value, ref, onBlur },\n }) => (\n <div\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...getBaseProps()}\n className={cn(classNames.base, 'group mt-2')}\n data-testid={testId}\n >\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <div {...getMainWrapperProps()}>\n <div className=\"relative\">\n {label && (\n <label\n htmlFor={`react-select-${name}-input`}\n className={cn(\n getLabelProps()\n .className.replace('absolute', 'relative')\n .replace('block', ''),\n '!pointer-events-auto bottom-2 ml-1',\n )}\n >\n {label}\n <FieldCopyTestIdButton testId={testId} />\n </label>\n )}\n <ReactSelect\n aria-errormessage=\"\"\n aria-invalid={invalid}\n // Does not affect the testId of the select, but is needed to pass it to sub-components\n data-testid={`${testId}_select`}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/naming-convention\n const { className: _className, ...rest } = getTriggerProps();\n return rest;\n }}\n aria-labelledby={\n getTriggerProps()['aria-labelledby']?.split(' ')[1]\n }\n classNames={{\n control: () =>\n cn(classNames.control, {\n [classNames.control_focused]: isFocused && !invalid,\n }),\n placeholder: () => classNames.placeholder,\n input: () => classNames.input,\n valueContainer: () => classNames.valueContainer,\n singleValue: () =>\n cn(classNames.singleValue, `${getValueProps().className}`),\n multiValue: () => classNames.multiValue,\n multiValueLabel: () =>\n cn(\n classNames.multiValueLabel,\n `${getValueProps().className}`,\n ),\n multiValueRemove: () => classNames.multiValueRemove,\n indicatorsContainer: () => classNames.indicatorsContainer,\n clearIndicator: () => classNames.clearIndicator,\n indicatorSeparator: () => classNames.indicatorSeparator,\n dropdownIndicator: () => classNames.dropdownIndicator,\n menu: () => classNames.menu,\n groupHeading: () => classNames.groupHeading,\n option: ({\n isFocused: optionIsFocused,\n isSelected: optionIsSelected,\n }) =>\n cn(classNames.option, {\n [classNames.option_focused]: optionIsFocused,\n [classNames.option_selected]: optionIsSelected,\n }),\n noOptionsMessage: () => classNames.noOptionsMessage,\n menuPortal: () => classNames.menuPortal,\n }}\n components={{\n Input: InputComponent,\n Option: OptionComponent,\n DropdownIndicator: DropdownIndicatorComponent,\n }}\n filterOption={filterOption}\n formatOptionLabel={formatOptionLabel}\n instanceId={name}\n inputValue={inputValue}\n isClearable={clearable}\n isDisabled={disabled}\n isLoading={loading}\n isMulti={multiSelect}\n options={options}\n placeholder={placeholder}\n unstyled\n onChange={(option) => {\n if (multiSelect) {\n const transformedOptions: string[] = [];\n // @ts-expect-error in this case option is an array.\n option?.forEach((o: { value: string }) => {\n transformedOptions.push(o.value);\n });\n onChange(transformedOptions);\n } else {\n // @ts-expect-error in this case option is of type SelectOption and has the property value.\n onChange(option && option.value);\n }\n }}\n onInputChange={onInputChange}\n // attach menu modal or body so it works in card and modal\n menuPortalTarget={\n (document.getElementById('modal_body')?.parentNode\n ?.parentNode as HTMLElement) || document.body\n }\n value={options.find((option) => option.value === value)}\n onBlur={(_e) => {\n setIsFocused(false);\n return onBlur();\n }}\n onFocus={(_e) => {\n setIsFocused(true);\n }}\n name={name}\n ref={ref}\n />\n </div>\n {error && (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <div {...getHelperWrapperProps()}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <div {...getErrorMessageProps()}>\n <FieldValidationError error={error} />\n </div>\n </div>\n )}\n </div>\n </div>\n )}\n />\n );\n};\n\nexport default Select;\n","import Select from './Select';\n\nexport type { SelectProps } from './Select';\n\nexport { Select };\n\nexport default Select;\n"],"mappings":";;;;;;;;;;;AAGA,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,OAAO,eAAe,kBAAkB;AAExC,SAAS,iBAAiB;AAE1B,SAAS,IAAI,IAAI,4BAA4B;AAqGpC,cA8FO,YA9FP;AA/FF,IAAM,iBAAiB,GAAG;AAAA,EAC/B,OAAO;AAAA,IACL,MAAM;AAAA,IACN,gBACE;AAAA,IACF,SACE;AAAA,IACF,iBAAiB;AAAA,IACjB,WAAW;AAAA,IACX,aAAa;AAAA,IACb,mBACE;AAAA,IACF,OAAO;AAAA,IACP,cAAc;AAAA,IACd,qBAAqB;AAAA,IACrB,oBAAoB;AAAA,IACpB,OAAO;AAAA,IACP,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,IAChB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kBACrB;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA,YAAY;AAAA,kBACZ;AAAA,kBACA,aAAa;AAAA,kBACb,YAAY;AAAA,kBACZ,WAAW;AAAA,kBACX,SAAS;AAAA,kBACT;AAAA,kBACA;AAAA,kBACA,UAAQ;AAAA,kBACR,UAAU,CAAC,WAAW;AACpB,wBAAI,aAAa;AACf,4BAAM,qBAA+B,CAAC;AAEtC,8BAAQ,QAAQ,CAAC,MAAyB;AACxC,2CAAmB,KAAK,EAAE,KAAK;AAAA,sBACjC,CAAC;AACD,+BAAS,kBAAkB;AAAA,oBAC7B,OAAO;AAEL,+BAAS,UAAU,OAAO,KAAK;AAAA,oBACjC;AAAA,kBACF;AAAA,kBACA;AAAA,kBAEA,kBACG,SAAS,eAAe,YAAY,GAAG,YACpC,cAA8B,SAAS;AAAA,kBAE7C,OAAO,QAAQ,KAAK,CAAC,WAAW,OAAO,UAAU,KAAK;AAAA,kBACtD,QAAQ,CAAC,OAAO;AACd,iCAAa,KAAK;AAClB,2BAAO,OAAO;AAAA,kBAChB;AAAA,kBACA,SAAS,CAAC,OAAO;AACf,iCAAa,IAAI;AAAA,kBACnB;AAAA,kBACA;AAAA,kBACA;AAAA;AAAA,cACF;AAAA,eACF;AAAA,YACC;AAAA,YAEC,oBAAC,SAAK,GAAG,sBAAsB,GAE7B,8BAAC,SAAK,GAAG,qBAAqB,GAC5B,8BAAC,gCAAqB,OAAc,GACtC,GACF;AAAA,aAEJ;AAAA;AAAA,MACF;AAAA;AAAA,EAEJ;AAEJ;AAEA,IAAO,iBAAQ;;;AClUf,IAAOA,kBAAQ;","names":["Select_default"]}
@@ -0,0 +1,244 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkKMMS4G7Acjs = require('./chunk-KMMS4G7A.cjs');
4
+
5
+
6
+ var _chunkQTL5FREEcjs = require('./chunk-QTL5FREE.cjs');
7
+
8
+
9
+ var _chunkLDCRR7FPcjs = require('./chunk-LDCRR7FP.cjs');
10
+
11
+ // src/Select/Select.tsx
12
+ var _react = require('react');
13
+ var _reacthookform = require('react-hook-form');
14
+ var _reactselect = require('react-select'); var _reactselect2 = _interopRequireDefault(_reactselect);
15
+ var _select = require('@nextui-org/select');
16
+ var _pixelutils = require('@fuf-stack/pixel-utils');
17
+ var _jsxruntime = require('react/jsx-runtime');
18
+ var selectVariants = _pixelutils.tv.call(void 0, {
19
+ slots: {
20
+ base: "",
21
+ clearIndicator: "rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-foreground-800",
22
+ control: "rounded-lg border-2 border-default-200 shadow-sm !duration-150 transition-background hover:border-default-400 motion-reduce:transition-none",
23
+ control_focused: "border-primary hover:border-primary",
24
+ crossIcon: "",
25
+ downChevron: "",
26
+ dropdownIndicator: "rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-black",
27
+ group: "",
28
+ groupHeading: "mb-1 ml-3 mt-2 text-sm text-foreground-500",
29
+ indicatorsContainer: "gap-1 p-1",
30
+ indicatorSeparator: "bg-default-300",
31
+ input: "py-0.5 pl-1",
32
+ loadingIndicator: "",
33
+ loadingMessage: "",
34
+ menu: "mt-2 rounded-xl border border-default-200 bg-background p-1 shadow-lg",
35
+ menuList: "",
36
+ // ensure menu has same z-index as modal so it is visible when rendered in modal
37
+ // see: https://github.com/nextui-org/nextui/blob/main/packages/core/theme/src/components/modal.ts (see z-50)
38
+ menuPortal: "!z-50",
39
+ multiValue: "items-center gap-1.5 rounded bg-default-100 py-0.5 pl-2 pr-1",
40
+ multiValueContainer: "",
41
+ multiValueLabel: "py-0.5 leading-6",
42
+ multiValueRemove: "rounded text-default-500 hover:cursor-pointer hover:border-default-300 hover:text-default-800",
43
+ noOptionsMessage: "rounded-sm p-2 text-foreground-500",
44
+ option: "rounded px-3 py-2 hover:cursor-pointer",
45
+ option_selected: "bg-default-300",
46
+ option_focused: "bg-default-100 active:bg-default-200",
47
+ placeholder: "py-0.5 pl-1 text-foreground-500",
48
+ selectContainer: "",
49
+ singleValue: "!ml-1 !leading-7",
50
+ valueContainer: "gap-1 p-1"
51
+ },
52
+ variants: {
53
+ invalid: {
54
+ true: {
55
+ control: "border-danger hover:border-danger"
56
+ }
57
+ }
58
+ }
59
+ });
60
+ var InputComponent = (props) => {
61
+ const testId = `${props.selectProps["data-testid"]}_input`;
62
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactselect.components.Input, { "data-testid": testId, ...props });
63
+ };
64
+ var OptionComponent = (props) => {
65
+ const testId = `${props.selectProps["data-testid"]}_option_${_nullishCoalesce(_optionalChain([props, 'optionalAccess', _ => _.data, 'optionalAccess', _2 => _2.testId]), () => ( _optionalChain([props, 'optionalAccess', _3 => _3.data, 'optionalAccess', _4 => _4.value])))}`;
66
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { "data-testid": testId, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactselect.components.Option, { ...props }) });
67
+ };
68
+ var DropdownIndicatorComponent = (props) => {
69
+ const testId = _optionalChain([props, 'optionalAccess', _5 => _5.selectProps, 'access', _6 => _6["data-testid"]]);
70
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { "data-testid": `${testId}_dropdown`, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactselect.components.DropdownIndicator, { ...props }) });
71
+ };
72
+ var Select = ({
73
+ className = void 0,
74
+ clearable = true,
75
+ disabled = false,
76
+ filterOption = void 0,
77
+ formatOptionLabel = void 0,
78
+ inputValue = void 0,
79
+ label: _label = void 0,
80
+ loading = false,
81
+ multiSelect = false,
82
+ name,
83
+ onInputChange = void 0,
84
+ options,
85
+ placeholder = void 0,
86
+ testId: _testId = void 0
87
+ }) => {
88
+ const { control, getFieldState } = _chunkLDCRR7FPcjs.useFormContext.call(void 0, );
89
+ const { error, invalid, required, testId } = getFieldState(name, _testId);
90
+ const [isFocused, setIsFocused] = _react.useState.call(void 0, false);
91
+ const variants = selectVariants({ invalid });
92
+ const classNames = _pixelutils.variantsToClassNames.call(void 0, variants, className, "base");
93
+ const {
94
+ label,
95
+ getBaseProps,
96
+ getLabelProps,
97
+ getTriggerProps,
98
+ getValueProps,
99
+ getMainWrapperProps,
100
+ getHelperWrapperProps,
101
+ getErrorMessageProps
102
+ } = _select.useSelect.call(void 0, {
103
+ isLoading: loading,
104
+ isInvalid: invalid,
105
+ isRequired: required,
106
+ isDisabled: disabled,
107
+ errorMessage: JSON.stringify(error),
108
+ label: _label,
109
+ labelPlacement: "outside",
110
+ placeholder: " ",
111
+ children: [],
112
+ classNames
113
+ });
114
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
115
+ _reacthookform.Controller,
116
+ {
117
+ control,
118
+ name,
119
+ render: ({
120
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
121
+ field: { onChange, value, ref, onBlur }
122
+ }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
123
+ "div",
124
+ {
125
+ ...getBaseProps(),
126
+ className: _pixelutils.cn.call(void 0, classNames.base, "group mt-2"),
127
+ "data-testid": testId,
128
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...getMainWrapperProps(), children: [
129
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative", children: [
130
+ label && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
131
+ "label",
132
+ {
133
+ htmlFor: `react-select-${name}-input`,
134
+ className: _pixelutils.cn.call(void 0,
135
+ getLabelProps().className.replace("absolute", "relative").replace("block", ""),
136
+ "!pointer-events-auto bottom-2 ml-1"
137
+ ),
138
+ children: [
139
+ label,
140
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKMMS4G7Acjs.FieldCopyTestIdButton_default, { testId })
141
+ ]
142
+ }
143
+ ),
144
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
145
+ _reactselect2.default,
146
+ {
147
+ "aria-errormessage": "",
148
+ "aria-invalid": invalid,
149
+ "data-testid": `${testId}_select`,
150
+ ...() => {
151
+ const { className: _className, ...rest } = getTriggerProps();
152
+ return rest;
153
+ },
154
+ "aria-labelledby": _optionalChain([getTriggerProps, 'call', _7 => _7(), 'access', _8 => _8["aria-labelledby"], 'optionalAccess', _9 => _9.split, 'call', _10 => _10(" "), 'access', _11 => _11[1]]),
155
+ classNames: {
156
+ control: () => _pixelutils.cn.call(void 0, classNames.control, {
157
+ [classNames.control_focused]: isFocused && !invalid
158
+ }),
159
+ placeholder: () => classNames.placeholder,
160
+ input: () => classNames.input,
161
+ valueContainer: () => classNames.valueContainer,
162
+ singleValue: () => _pixelutils.cn.call(void 0, classNames.singleValue, `${getValueProps().className}`),
163
+ multiValue: () => classNames.multiValue,
164
+ multiValueLabel: () => _pixelutils.cn.call(void 0,
165
+ classNames.multiValueLabel,
166
+ `${getValueProps().className}`
167
+ ),
168
+ multiValueRemove: () => classNames.multiValueRemove,
169
+ indicatorsContainer: () => classNames.indicatorsContainer,
170
+ clearIndicator: () => classNames.clearIndicator,
171
+ indicatorSeparator: () => classNames.indicatorSeparator,
172
+ dropdownIndicator: () => classNames.dropdownIndicator,
173
+ menu: () => classNames.menu,
174
+ groupHeading: () => classNames.groupHeading,
175
+ option: ({
176
+ isFocused: optionIsFocused,
177
+ isSelected: optionIsSelected
178
+ }) => _pixelutils.cn.call(void 0, classNames.option, {
179
+ [classNames.option_focused]: optionIsFocused,
180
+ [classNames.option_selected]: optionIsSelected
181
+ }),
182
+ noOptionsMessage: () => classNames.noOptionsMessage,
183
+ menuPortal: () => classNames.menuPortal
184
+ },
185
+ components: {
186
+ Input: InputComponent,
187
+ Option: OptionComponent,
188
+ DropdownIndicator: DropdownIndicatorComponent
189
+ },
190
+ filterOption,
191
+ formatOptionLabel,
192
+ instanceId: name,
193
+ inputValue,
194
+ isClearable: clearable,
195
+ isDisabled: disabled,
196
+ isLoading: loading,
197
+ isMulti: multiSelect,
198
+ options,
199
+ placeholder,
200
+ unstyled: true,
201
+ onChange: (option) => {
202
+ if (multiSelect) {
203
+ const transformedOptions = [];
204
+ _optionalChain([option, 'optionalAccess', _12 => _12.forEach, 'call', _13 => _13((o) => {
205
+ transformedOptions.push(o.value);
206
+ })]);
207
+ onChange(transformedOptions);
208
+ } else {
209
+ onChange(option && option.value);
210
+ }
211
+ },
212
+ onInputChange,
213
+ menuPortalTarget: _optionalChain([document, 'access', _14 => _14.getElementById, 'call', _15 => _15("modal_body"), 'optionalAccess', _16 => _16.parentNode, 'optionalAccess', _17 => _17.parentNode]) || document.body,
214
+ value: options.find((option) => option.value === value),
215
+ onBlur: (_e) => {
216
+ setIsFocused(false);
217
+ return onBlur();
218
+ },
219
+ onFocus: (_e) => {
220
+ setIsFocused(true);
221
+ },
222
+ name,
223
+ ref
224
+ }
225
+ )
226
+ ] }),
227
+ error && // eslint-disable-next-line react/jsx-props-no-spreading
228
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...getHelperWrapperProps(), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...getErrorMessageProps(), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQTL5FREEcjs.FieldValidationError_default, { error }) }) })
229
+ ] })
230
+ }
231
+ )
232
+ }
233
+ );
234
+ };
235
+ var Select_default = Select;
236
+
237
+ // src/Select/index.ts
238
+ var Select_default2 = Select_default;
239
+
240
+
241
+
242
+
243
+ exports.Select_default = Select_default; exports.Select_default2 = Select_default2;
244
+ //# sourceMappingURL=chunk-U3PJEVXL.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/uniform/uniform/packages/uniform/dist/chunk-U3PJEVXL.cjs","../src/Select/Select.tsx","../src/Select/index.ts"],"names":["Select_default"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACPA,8BAAyB;AACzB,gDAA2B;AAC3B,qGAAwC;AAExC,4CAA0B;AAE1B,oDAA6C;AAqGpC,+CAAA;AA/FF,IAAM,eAAA,EAAiB,4BAAA;AAAG,EAC/B,KAAA,EAAO;AAAA,IACL,IAAA,EAAM,EAAA;AAAA,IACN,cAAA,EACE,wGAAA;AAAA,IACF,OAAA,EACE,6IAAA;AAAA,IACF,eAAA,EAAiB,qCAAA;AAAA,IACjB,SAAA,EAAW,EAAA;AAAA,IACX,WAAA,EAAa,EAAA;AAAA,IACb,iBAAA,EACE,+FAAA;AAAA,IACF,KAAA,EAAO,EAAA;AAAA,IACP,YAAA,EAAc,4CAAA;AAAA,IACd,mBAAA,EAAqB,WAAA;AAAA,IACrB,kBAAA,EAAoB,gBAAA;AAAA,IACpB,KAAA,EAAO,aAAA;AAAA,IACP,gBAAA,EAAkB,EAAA;AAAA,IAClB,cAAA,EAAgB,EAAA;AAAA,IAChB,IAAA,EAAM,uEAAA;AAAA,IACN,QAAA,EAAU,EAAA;AAAA;AAAA;AAAA,IAGV,UAAA,EAAY,OAAA;AAAA,IACZ,UAAA,EAAY,8DAAA;AAAA,IACZ,mBAAA,EAAqB,EAAA;AAAA,IACrB,eAAA,EAAiB,kBAAA;AAAA,IACjB,gBAAA,EACE,+FAAA;AAAA,IACF,gBAAA,EAAkB,oCAAA;AAAA,IAClB,MAAA,EAAQ,wCAAA;AAAA,IACR,eAAA,EAAiB,gBAAA;AAAA,IACjB,c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FwOW;AACA;AACA;AACA;AACA","file":"/home/runner/work/uniform/uniform/packages/uniform/dist/chunk-U3PJEVXL.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { Props } from 'react-select';\n\nimport { useState } from 'react';\nimport { Controller } from 'react-hook-form';\nimport ReactSelect, { components } from 'react-select';\n\nimport { useSelect } from '@nextui-org/select';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport const selectVariants = tv({\n slots: {\n base: '',\n clearIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-foreground-800',\n control:\n 'rounded-lg border-2 border-default-200 shadow-sm !duration-150 transition-background hover:border-default-400 motion-reduce:transition-none',\n control_focused: 'border-primary hover:border-primary',\n crossIcon: '',\n downChevron: '',\n dropdownIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-black',\n group: '',\n groupHeading: 'mb-1 ml-3 mt-2 text-sm text-foreground-500',\n indicatorsContainer: 'gap-1 p-1',\n indicatorSeparator: 'bg-default-300',\n input: 'py-0.5 pl-1',\n loadingIndicator: '',\n loadingMessage: '',\n menu: 'mt-2 rounded-xl border border-default-200 bg-background p-1 shadow-lg',\n menuList: '',\n // ensure menu has same z-index as modal so it is visible when rendered in modal\n // see: https://github.com/nextui-org/nextui/blob/main/packages/core/theme/src/components/modal.ts (see z-50)\n menuPortal: '!z-50',\n multiValue: 'items-center gap-1.5 rounded bg-default-100 py-0.5 pl-2 pr-1',\n multiValueContainer: '',\n multiValueLabel: 'py-0.5 leading-6',\n multiValueRemove:\n 'rounded text-default-500 hover:cursor-pointer hover:border-default-300 hover:text-default-800',\n noOptionsMessage: 'rounded-sm p-2 text-foreground-500',\n option: 'rounded px-3 py-2 hover:cursor-pointer',\n option_selected: 'bg-default-300',\n option_focused: 'bg-default-100 active:bg-default-200',\n placeholder: 'py-0.5 pl-1 text-foreground-500',\n selectContainer: '',\n singleValue: '!ml-1 !leading-7',\n valueContainer: 'gap-1 p-1',\n },\n variants: {\n invalid: {\n true: {\n control: 'border-danger hover:border-danger',\n },\n },\n },\n});\n\ntype SelectOption = {\n /** option label */\n label?: React.ReactNode;\n /** option value */\n value: string;\n};\n\ntype VariantProps = TVProps<typeof selectVariants>;\ntype ClassName = TVClassName<typeof selectVariants>;\n\nexport interface SelectProps extends VariantProps {\n /** CSS class name */\n className?: ClassName; // string;\n /** Determine if the */\n clearable?: boolean;\n /** Set the select to disabled state. */\n disabled?: boolean;\n /** Filter Select Options */\n filterOption?:\n | undefined\n | ((option?: SelectOption, inputValue?: string) => boolean);\n /** Format the label of the option */\n formatOptionLabel?: undefined | Props['formatOptionLabel'];\n /** The value of the search input */\n inputValue?: string;\n /** Label that should be associated with the select. */\n label?: React.ReactNode;\n /** Set the select to a loading state. */\n loading?: boolean;\n /** switch between single and multi select mode. */\n multiSelect?: boolean;\n /** The name for the Select component, used by react-hook-form */\n name: string;\n /** Placeholder that is displayed when nothing is selected */\n placeholder?: string;\n /** The options for the Select component */\n options: SelectOption[];\n /** Handle change events on the input */\n onInputChange?: Props['onInputChange'];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\nconst InputComponent: typeof components.Input = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/prop-types, react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_input`;\n // eslint-disable-next-line react/jsx-props-no-spreading\n return <components.Input data-testid={testId} {...props} />;\n};\n\nconst OptionComponent: typeof components.Option = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/prop-types, react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_option_${props?.data?.testId ?? props?.data?.value}`;\n return (\n <div data-testid={testId}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <components.Option {...props} />\n </div>\n );\n};\n\nconst DropdownIndicatorComponent: typeof components.DropdownIndicator = (\n props,\n) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/prop-types\n const testId = props?.selectProps['data-testid'] as string;\n return (\n <div data-testid={`${testId}_dropdown`}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <components.DropdownIndicator {...props} />\n </div>\n );\n};\n\n/** Select component based on [NextUI Select](https://nextui.org/docs/components/select) and [React-Select](https://react-select.com/home) */\nconst Select = ({\n className = undefined,\n clearable = true,\n disabled = false,\n filterOption = undefined,\n formatOptionLabel = undefined,\n inputValue = undefined,\n label: _label = undefined,\n loading = false,\n multiSelect = false,\n name,\n onInputChange = undefined,\n options,\n placeholder = undefined,\n testId: _testId = undefined,\n}: SelectProps) => {\n const { control, getFieldState } = useFormContext();\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n const [isFocused, setIsFocused] = useState(false);\n\n const variants = selectVariants({ invalid });\n const classNames = variantsToClassNames(variants, className, 'base');\n\n const {\n label,\n getBaseProps,\n getLabelProps,\n getTriggerProps,\n getValueProps,\n getMainWrapperProps,\n getHelperWrapperProps,\n getErrorMessageProps,\n } = useSelect({\n isLoading: loading,\n isInvalid: invalid,\n isRequired: required,\n isDisabled: disabled,\n errorMessage: JSON.stringify(error),\n label: _label,\n labelPlacement: 'outside',\n placeholder: ' ',\n children: [],\n classNames,\n });\n\n return (\n <Controller\n control={control}\n name={name}\n render={({\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n field: { onChange, value, ref, onBlur },\n }) => (\n <div\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...getBaseProps()}\n className={cn(classNames.base, 'group mt-2')}\n data-testid={testId}\n >\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <div {...getMainWrapperProps()}>\n <div className=\"relative\">\n {label && (\n <label\n htmlFor={`react-select-${name}-input`}\n className={cn(\n getLabelProps()\n .className.replace('absolute', 'relative')\n .replace('block', ''),\n '!pointer-events-auto bottom-2 ml-1',\n )}\n >\n {label}\n <FieldCopyTestIdButton testId={testId} />\n </label>\n )}\n <ReactSelect\n aria-errormessage=\"\"\n aria-invalid={invalid}\n // Does not affect the testId of the select, but is needed to pass it to sub-components\n data-testid={`${testId}_select`}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/naming-convention\n const { className: _className, ...rest } = getTriggerProps();\n return rest;\n }}\n aria-labelledby={\n getTriggerProps()['aria-labelledby']?.split(' ')[1]\n }\n classNames={{\n control: () =>\n cn(classNames.control, {\n [classNames.control_focused]: isFocused && !invalid,\n }),\n placeholder: () => classNames.placeholder,\n input: () => classNames.input,\n valueContainer: () => classNames.valueContainer,\n singleValue: () =>\n cn(classNames.singleValue, `${getValueProps().className}`),\n multiValue: () => classNames.multiValue,\n multiValueLabel: () =>\n cn(\n classNames.multiValueLabel,\n `${getValueProps().className}`,\n ),\n multiValueRemove: () => classNames.multiValueRemove,\n indicatorsContainer: () => classNames.indicatorsContainer,\n clearIndicator: () => classNames.clearIndicator,\n indicatorSeparator: () => classNames.indicatorSeparator,\n dropdownIndicator: () => classNames.dropdownIndicator,\n menu: () => classNames.menu,\n groupHeading: () => classNames.groupHeading,\n option: ({\n isFocused: optionIsFocused,\n isSelected: optionIsSelected,\n }) =>\n cn(classNames.option, {\n [classNames.option_focused]: optionIsFocused,\n [classNames.option_selected]: optionIsSelected,\n }),\n noOptionsMessage: () => classNames.noOptionsMessage,\n menuPortal: () => classNames.menuPortal,\n }}\n components={{\n Input: InputComponent,\n Option: OptionComponent,\n DropdownIndicator: DropdownIndicatorComponent,\n }}\n filterOption={filterOption}\n formatOptionLabel={formatOptionLabel}\n instanceId={name}\n inputValue={inputValue}\n isClearable={clearable}\n isDisabled={disabled}\n isLoading={loading}\n isMulti={multiSelect}\n options={options}\n placeholder={placeholder}\n unstyled\n onChange={(option) => {\n if (multiSelect) {\n const transformedOptions: string[] = [];\n // @ts-expect-error in this case option is an array.\n option?.forEach((o: { value: string }) => {\n transformedOptions.push(o.value);\n });\n onChange(transformedOptions);\n } else {\n // @ts-expect-error in this case option is of type SelectOption and has the property value.\n onChange(option && option.value);\n }\n }}\n onInputChange={onInputChange}\n // attach menu modal or body so it works in card and modal\n menuPortalTarget={\n (document.getElementById('modal_body')?.parentNode\n ?.parentNode as HTMLElement) || document.body\n }\n value={options.find((option) => option.value === value)}\n onBlur={(_e) => {\n setIsFocused(false);\n return onBlur();\n }}\n onFocus={(_e) => {\n setIsFocused(true);\n }}\n name={name}\n ref={ref}\n />\n </div>\n {error && (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <div {...getHelperWrapperProps()}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <div {...getErrorMessageProps()}>\n <FieldValidationError error={error} />\n </div>\n </div>\n )}\n </div>\n </div>\n )}\n />\n );\n};\n\nexport default Select;\n","import Select from './Select';\n\nexport type { SelectProps } from './Select';\n\nexport { Select };\n\nexport default Select;\n"]}
package/dist/index.cjs CHANGED
@@ -27,7 +27,7 @@ var _chunk5UHHZ7KYcjs = require('./chunk-5UHHZ7KY.cjs');
27
27
  var _chunkYUAJN6HWcjs = require('./chunk-YUAJN6HW.cjs');
28
28
 
29
29
 
30
- var _chunkWCQYZ5RIcjs = require('./chunk-WCQYZ5RI.cjs');
30
+ var _chunkU3PJEVXLcjs = require('./chunk-U3PJEVXL.cjs');
31
31
 
32
32
 
33
33
  var _chunkKMMS4G7Acjs = require('./chunk-KMMS4G7A.cjs');
@@ -57,5 +57,5 @@ var _chunkBBB4FEY6cjs = require('./chunk-BBB4FEY6.cjs');
57
57
 
58
58
 
59
59
 
60
- exports.CheckboxGroup = _chunkW24WP5YEcjs.CheckboxGroup_default; exports.FieldArray = _chunkTNELIBCVcjs.FieldArray_default; exports.FieldCopyTestIdButton = _chunkKMMS4G7Acjs.FieldCopyTestIdButton_default; exports.FieldValidationError = _chunkQTL5FREEcjs.FieldValidationError_default; exports.Form = _chunkQYZV7ZUYcjs.Form_default; exports.Grid = _chunk6GN255GPcjs.Grid_default; exports.Input = _chunk5UHHZ7KYcjs.Input_default; exports.RadioGroup = _chunkYUAJN6HWcjs.RadioGroup_default; exports.Select = _chunkWCQYZ5RIcjs.Select_default; exports.SubmitButton = _chunkMKM7ZYRNcjs.SubmitButton_default; exports.Switch = _chunk3XNW2VQ7cjs.Switch_default; exports.TextArea = _chunkOCR2UWG2cjs.TextArea_default; exports.recursiveFieldKeySearch = _chunkLDCRR7FPcjs.recursiveFieldKeySearch; exports.slugify = _chunkBBB4FEY6cjs.slugify; exports.useFormContext = _chunkLDCRR7FPcjs.useFormContext;
60
+ exports.CheckboxGroup = _chunkW24WP5YEcjs.CheckboxGroup_default; exports.FieldArray = _chunkTNELIBCVcjs.FieldArray_default; exports.FieldCopyTestIdButton = _chunkKMMS4G7Acjs.FieldCopyTestIdButton_default; exports.FieldValidationError = _chunkQTL5FREEcjs.FieldValidationError_default; exports.Form = _chunkQYZV7ZUYcjs.Form_default; exports.Grid = _chunk6GN255GPcjs.Grid_default; exports.Input = _chunk5UHHZ7KYcjs.Input_default; exports.RadioGroup = _chunkYUAJN6HWcjs.RadioGroup_default; exports.Select = _chunkU3PJEVXLcjs.Select_default; exports.SubmitButton = _chunkMKM7ZYRNcjs.SubmitButton_default; exports.Switch = _chunk3XNW2VQ7cjs.Switch_default; exports.TextArea = _chunkOCR2UWG2cjs.TextArea_default; exports.recursiveFieldKeySearch = _chunkLDCRR7FPcjs.recursiveFieldKeySearch; exports.slugify = _chunkBBB4FEY6cjs.slugify; exports.useFormContext = _chunkLDCRR7FPcjs.useFormContext;
61
61
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts CHANGED
@@ -8,7 +8,7 @@ export { I as Input, a as InputProps } from './Input-B6dNQiiD.cjs';
8
8
  export { F as FieldCopyTestIdButton, a as FieldCopyTestIdButtonProps } from './FieldCopyTestIdButton-D-z1usqE.cjs';
9
9
  export { F as FieldValidationError, a as FieldValidationErrorProps } from './FieldValidationError-BSXedjCA.cjs';
10
10
  export { R as RadioGroup, a as RadioGroupProps } from './RadioGroup-BU4K9cnS.cjs';
11
- export { S as Select, a as SelectProps } from './Select-Mp6Y00dT.cjs';
11
+ export { S as Select, a as SelectProps } from './Select-2IgkXjF0.cjs';
12
12
  export { S as SubmitButton, a as SubmitButtonProps } from './SubmitButton-BEp_zzwf.cjs';
13
13
  export { S as Switch, a as SwitchProps } from './Switch-DmjDKgKs.cjs';
14
14
  export { T as TextArea, a as TextAreaProps } from './TextArea-B-sKvTkd.cjs';
@@ -17,5 +17,8 @@ import 'react-hook-form';
17
17
  import '@fuf-stack/veto';
18
18
  import 'react';
19
19
  import 'slug';
20
+ import 'tailwind-variants';
21
+ import 'tailwind-variants/dist/config.js';
22
+ import '@fuf-stack/pixel-utils';
20
23
  import 'react-select';
21
24
  import '@fuf-stack/pixels';
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export { I as Input, a as InputProps } from './Input-B6dNQiiD.js';
8
8
  export { F as FieldCopyTestIdButton, a as FieldCopyTestIdButtonProps } from './FieldCopyTestIdButton-D-z1usqE.js';
9
9
  export { F as FieldValidationError, a as FieldValidationErrorProps } from './FieldValidationError-BSXedjCA.js';
10
10
  export { R as RadioGroup, a as RadioGroupProps } from './RadioGroup-BU4K9cnS.js';
11
- export { S as Select, a as SelectProps } from './Select-Mp6Y00dT.js';
11
+ export { S as Select, a as SelectProps } from './Select-2IgkXjF0.js';
12
12
  export { S as SubmitButton, a as SubmitButtonProps } from './SubmitButton-BEp_zzwf.js';
13
13
  export { S as Switch, a as SwitchProps } from './Switch-DmjDKgKs.js';
14
14
  export { T as TextArea, a as TextAreaProps } from './TextArea-B-sKvTkd.js';
@@ -17,5 +17,8 @@ import 'react-hook-form';
17
17
  import '@fuf-stack/veto';
18
18
  import 'react';
19
19
  import 'slug';
20
+ import 'tailwind-variants';
21
+ import 'tailwind-variants/dist/config.js';
22
+ import '@fuf-stack/pixel-utils';
20
23
  import 'react-select';
21
24
  import '@fuf-stack/pixels';
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  } from "./chunk-ARUVDZFG.js";
28
28
  import {
29
29
  Select_default
30
- } from "./chunk-C2AWFTC5.js";
30
+ } from "./chunk-I2R4W3KH.js";
31
31
  import {
32
32
  FieldCopyTestIdButton_default
33
33
  } from "./chunk-T3CCNJHK.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuf-stack/uniform",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "fuf react form library",
5
5
  "author": "Hannes Tiede",
6
6
  "homepage": "https://github.com/fuf-stack/uniform#readme",
@@ -124,7 +124,7 @@
124
124
  "react-hook-form": "7.53.0",
125
125
  "react-select": "5.8.1",
126
126
  "slug": "9.1.0",
127
- "@fuf-stack/pixel-utils": "0.2.0",
127
+ "@fuf-stack/pixel-utils": "0.3.0",
128
128
  "@fuf-stack/pixels": "0.24.0",
129
129
  "@fuf-stack/veto": "0.5.0"
130
130
  },
@@ -136,9 +136,9 @@
136
136
  "react": "18.3.1",
137
137
  "react-dom": "18.3.1",
138
138
  "@repo/storybook-config": "0.0.1",
139
+ "@repo/tailwind-config": "0.0.1",
139
140
  "@repo/tsup-config": "0.0.1",
140
- "@repo/vite-config": "0.0.1",
141
- "@repo/tailwind-config": "0.0.1"
141
+ "@repo/vite-config": "0.0.1"
142
142
  },
143
143
  "scripts": {
144
144
  "build": "tsup --config node_modules/@repo/tsup-config/config.ts",
@@ -1,40 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { Props } from 'react-select';
3
-
4
- type SelectOption = {
5
- /** option label */
6
- label?: React.ReactNode;
7
- /** option value */
8
- value: string;
9
- };
10
- interface SelectProps {
11
- /** CSS class name */
12
- className?: string;
13
- /** Determine if the */
14
- clearable?: boolean;
15
- /** Set the select to disabled state. */
16
- disabled?: boolean;
17
- filterOption?: undefined | ((option?: SelectOption, inputValue?: string) => boolean);
18
- /** The value of the search input */
19
- inputValue?: string;
20
- /** Label that should be associated with the select. */
21
- label?: React.ReactNode;
22
- /** Set the select to a loading state. */
23
- loading?: boolean;
24
- /** switch between single and multi select mode. */
25
- multiSelect?: boolean;
26
- /** The name for the Select component, used by react-hook-form */
27
- name: string;
28
- /** Placeholder that is displayed when nothing is selected */
29
- placeholder?: string;
30
- /** The options for the Select component */
31
- options: SelectOption[];
32
- /** Handle change events on the input */
33
- onInputChange?: Props['onInputChange'];
34
- /** HTML data-testid attribute used in e2e tests */
35
- testId?: string;
36
- }
37
- /** Select component based on [NextUI Select](https://nextui.org/docs/components/select) and [React-Select](https://react-select.com/home) */
38
- declare const Select: ({ className, clearable, disabled, filterOption, inputValue, label: _label, loading, multiSelect, name, onInputChange, options, placeholder, testId: _testId, }: SelectProps) => react_jsx_runtime.JSX.Element;
39
-
40
- export { Select as S, type SelectProps as a };
@@ -1,40 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { Props } from 'react-select';
3
-
4
- type SelectOption = {
5
- /** option label */
6
- label?: React.ReactNode;
7
- /** option value */
8
- value: string;
9
- };
10
- interface SelectProps {
11
- /** CSS class name */
12
- className?: string;
13
- /** Determine if the */
14
- clearable?: boolean;
15
- /** Set the select to disabled state. */
16
- disabled?: boolean;
17
- filterOption?: undefined | ((option?: SelectOption, inputValue?: string) => boolean);
18
- /** The value of the search input */
19
- inputValue?: string;
20
- /** Label that should be associated with the select. */
21
- label?: React.ReactNode;
22
- /** Set the select to a loading state. */
23
- loading?: boolean;
24
- /** switch between single and multi select mode. */
25
- multiSelect?: boolean;
26
- /** The name for the Select component, used by react-hook-form */
27
- name: string;
28
- /** Placeholder that is displayed when nothing is selected */
29
- placeholder?: string;
30
- /** The options for the Select component */
31
- options: SelectOption[];
32
- /** Handle change events on the input */
33
- onInputChange?: Props['onInputChange'];
34
- /** HTML data-testid attribute used in e2e tests */
35
- testId?: string;
36
- }
37
- /** Select component based on [NextUI Select](https://nextui.org/docs/components/select) and [React-Select](https://react-select.com/home) */
38
- declare const Select: ({ className, clearable, disabled, filterOption, inputValue, label: _label, loading, multiSelect, name, onInputChange, options, placeholder, testId: _testId, }: SelectProps) => react_jsx_runtime.JSX.Element;
39
-
40
- export { Select as S, type SelectProps as a };