@fuf-stack/uniform 0.9.1 → 0.9.3

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.
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkU3PJEVXLcjs = require('../chunk-U3PJEVXL.cjs');
4
+ var _chunkCVLA7A3Ycjs = require('../chunk-CVLA7A3Y.cjs');
5
5
  require('../chunk-KMMS4G7A.cjs');
6
6
  require('../chunk-QTL5FREE.cjs');
7
7
  require('../chunk-LDCRR7FP.cjs');
@@ -9,5 +9,5 @@ require('../chunk-BBB4FEY6.cjs');
9
9
 
10
10
 
11
11
 
12
- exports.Select = _chunkU3PJEVXLcjs.Select_default; exports.default = _chunkU3PJEVXLcjs.Select_default2;
12
+ exports.Select = _chunkCVLA7A3Ycjs.Select_default; exports.default = _chunkCVLA7A3Ycjs.Select_default2;
13
13
  //# sourceMappingURL=index.cjs.map
@@ -1,5 +1,5 @@
1
- import { S as Select } from '../Select-2IgkXjF0.cjs';
2
- export { a as SelectProps } from '../Select-2IgkXjF0.cjs';
1
+ import { S as Select } from '../Select-zUYKczzn.cjs';
2
+ export { a as SelectProps } from '../Select-zUYKczzn.cjs';
3
3
  import 'react/jsx-runtime';
4
4
  import 'tailwind-variants';
5
5
  import 'tailwind-variants/dist/config.js';
@@ -1,5 +1,5 @@
1
- import { S as Select } from '../Select-2IgkXjF0.js';
2
- export { a as SelectProps } from '../Select-2IgkXjF0.js';
1
+ import { S as Select } from '../Select-zUYKczzn.js';
2
+ export { a as SelectProps } from '../Select-zUYKczzn.js';
3
3
  import 'react/jsx-runtime';
4
4
  import 'tailwind-variants';
5
5
  import 'tailwind-variants/dist/config.js';
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Select_default,
3
3
  Select_default2
4
- } from "../chunk-I2R4W3KH.js";
4
+ } from "../chunk-VEYDHNYQ.js";
5
5
  import "../chunk-T3CCNJHK.js";
6
6
  import "../chunk-DBLODROX.js";
7
7
  import "../chunk-HWDQZO7X.js";
@@ -23,19 +23,19 @@ declare const selectVariants: tailwind_variants.TVReturnType<{
23
23
  indicatorsContainer: string;
24
24
  indicatorSeparator: string;
25
25
  input: string;
26
+ label: string;
26
27
  loadingIndicator: string;
27
28
  loadingMessage: string;
28
29
  menu: string;
29
30
  menuList: string;
30
- menuPortal: string;
31
31
  multiValue: string;
32
32
  multiValueContainer: string;
33
33
  multiValueLabel: string;
34
34
  multiValueRemove: string;
35
35
  noOptionsMessage: string;
36
- option: string;
37
- option_selected: string;
38
36
  option_focused: string;
37
+ option_selected: string;
38
+ option: string;
39
39
  placeholder: string;
40
40
  selectContainer: string;
41
41
  singleValue: string;
@@ -71,19 +71,19 @@ declare const selectVariants: tailwind_variants.TVReturnType<{
71
71
  indicatorsContainer: string;
72
72
  indicatorSeparator: string;
73
73
  input: string;
74
+ label: string;
74
75
  loadingIndicator: string;
75
76
  loadingMessage: string;
76
77
  menu: string;
77
78
  menuList: string;
78
- menuPortal: string;
79
79
  multiValue: string;
80
80
  multiValueContainer: string;
81
81
  multiValueLabel: string;
82
82
  multiValueRemove: string;
83
83
  noOptionsMessage: string;
84
- option: string;
85
- option_selected: string;
86
84
  option_focused: string;
85
+ option_selected: string;
86
+ option: string;
87
87
  placeholder: string;
88
88
  selectContainer: string;
89
89
  singleValue: string;
@@ -107,19 +107,19 @@ declare const selectVariants: tailwind_variants.TVReturnType<{
107
107
  indicatorsContainer: string;
108
108
  indicatorSeparator: string;
109
109
  input: string;
110
+ label: string;
110
111
  loadingIndicator: string;
111
112
  loadingMessage: string;
112
113
  menu: string;
113
114
  menuList: string;
114
- menuPortal: string;
115
115
  multiValue: string;
116
116
  multiValueContainer: string;
117
117
  multiValueLabel: string;
118
118
  multiValueRemove: string;
119
119
  noOptionsMessage: string;
120
- option: string;
121
- option_selected: string;
122
120
  option_focused: string;
121
+ option_selected: string;
122
+ option: string;
123
123
  placeholder: string;
124
124
  selectContainer: string;
125
125
  singleValue: string;
@@ -23,19 +23,19 @@ declare const selectVariants: tailwind_variants.TVReturnType<{
23
23
  indicatorsContainer: string;
24
24
  indicatorSeparator: string;
25
25
  input: string;
26
+ label: string;
26
27
  loadingIndicator: string;
27
28
  loadingMessage: string;
28
29
  menu: string;
29
30
  menuList: string;
30
- menuPortal: string;
31
31
  multiValue: string;
32
32
  multiValueContainer: string;
33
33
  multiValueLabel: string;
34
34
  multiValueRemove: string;
35
35
  noOptionsMessage: string;
36
- option: string;
37
- option_selected: string;
38
36
  option_focused: string;
37
+ option_selected: string;
38
+ option: string;
39
39
  placeholder: string;
40
40
  selectContainer: string;
41
41
  singleValue: string;
@@ -71,19 +71,19 @@ declare const selectVariants: tailwind_variants.TVReturnType<{
71
71
  indicatorsContainer: string;
72
72
  indicatorSeparator: string;
73
73
  input: string;
74
+ label: string;
74
75
  loadingIndicator: string;
75
76
  loadingMessage: string;
76
77
  menu: string;
77
78
  menuList: string;
78
- menuPortal: string;
79
79
  multiValue: string;
80
80
  multiValueContainer: string;
81
81
  multiValueLabel: string;
82
82
  multiValueRemove: string;
83
83
  noOptionsMessage: string;
84
- option: string;
85
- option_selected: string;
86
84
  option_focused: string;
85
+ option_selected: string;
86
+ option: string;
87
87
  placeholder: string;
88
88
  selectContainer: string;
89
89
  singleValue: string;
@@ -107,19 +107,19 @@ declare const selectVariants: tailwind_variants.TVReturnType<{
107
107
  indicatorsContainer: string;
108
108
  indicatorSeparator: string;
109
109
  input: string;
110
+ label: string;
110
111
  loadingIndicator: string;
111
112
  loadingMessage: string;
112
113
  menu: string;
113
114
  menuList: string;
114
- menuPortal: string;
115
115
  multiValue: string;
116
116
  multiValueContainer: string;
117
117
  multiValueLabel: string;
118
118
  multiValueRemove: string;
119
119
  noOptionsMessage: string;
120
- option: string;
121
- option_selected: string;
122
120
  option_focused: string;
121
+ option_selected: string;
122
+ option: string;
123
123
  placeholder: string;
124
124
  selectContainer: string;
125
125
  singleValue: string;
@@ -29,21 +29,19 @@ var selectVariants = _pixelutils.tv.call(void 0, {
29
29
  indicatorsContainer: "gap-1 p-1",
30
30
  indicatorSeparator: "bg-default-300",
31
31
  input: "py-0.5 pl-1",
32
+ label: "!pointer-events-auto relative bottom-2 ml-1 inline",
32
33
  loadingIndicator: "",
33
34
  loadingMessage: "",
34
35
  menu: "mt-2 rounded-xl border border-default-200 bg-background p-1 shadow-lg",
35
36
  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
37
  multiValue: "items-center gap-1.5 rounded bg-default-100 py-0.5 pl-2 pr-1",
40
38
  multiValueContainer: "",
41
39
  multiValueLabel: "py-0.5 leading-6",
42
40
  multiValueRemove: "rounded text-default-500 hover:cursor-pointer hover:border-default-300 hover:text-default-800",
43
41
  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
42
  option_focused: "bg-default-100 active:bg-default-200",
43
+ option_selected: "bg-default-300",
44
+ option: "rounded px-3 py-2 hover:cursor-pointer",
47
45
  placeholder: "py-0.5 pl-1 text-foreground-500",
48
46
  selectContainer: "",
49
47
  singleValue: "!ml-1 !leading-7",
@@ -91,25 +89,25 @@ var Select = ({
91
89
  const variants = selectVariants({ invalid });
92
90
  const classNames = _pixelutils.variantsToClassNames.call(void 0, variants, className, "base");
93
91
  const {
94
- label,
95
92
  getBaseProps,
93
+ getErrorMessageProps,
94
+ getHelperWrapperProps,
96
95
  getLabelProps,
96
+ getMainWrapperProps,
97
97
  getTriggerProps,
98
98
  getValueProps,
99
- getMainWrapperProps,
100
- getHelperWrapperProps,
101
- getErrorMessageProps
99
+ label
102
100
  } = _select.useSelect.call(void 0, {
103
- isLoading: loading,
101
+ children: [],
102
+ classNames,
103
+ errorMessage: JSON.stringify(error),
104
+ isDisabled: disabled,
104
105
  isInvalid: invalid,
106
+ isLoading: loading,
105
107
  isRequired: required,
106
- isDisabled: disabled,
107
- errorMessage: JSON.stringify(error),
108
108
  label: _label,
109
109
  labelPlacement: "outside",
110
- placeholder: " ",
111
- children: [],
112
- classNames
110
+ placeholder: " "
113
111
  });
114
112
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
115
113
  _reacthookform.Controller,
@@ -131,10 +129,7 @@ var Select = ({
131
129
  "label",
132
130
  {
133
131
  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
- ),
132
+ className: _pixelutils.cn.call(void 0, getLabelProps().className, classNames.label),
138
133
  children: [
139
134
  label,
140
135
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKMMS4G7Acjs.FieldCopyTestIdButton_default, { testId })
@@ -145,33 +140,26 @@ var Select = ({
145
140
  _reactselect2.default,
146
141
  {
147
142
  "aria-errormessage": "",
148
- "aria-invalid": invalid,
149
- "data-testid": `${testId}_select`,
150
- ...() => {
151
- const { className: _className, ...rest } = getTriggerProps();
152
- return rest;
153
- },
154
143
  "aria-labelledby": _optionalChain([getTriggerProps, 'call', _7 => _7(), 'access', _8 => _8["aria-labelledby"], 'optionalAccess', _9 => _9.split, 'call', _10 => _10(" "), 'access', _11 => _11[1]]),
144
+ "aria-invalid": invalid,
155
145
  classNames: {
156
146
  control: () => _pixelutils.cn.call(void 0, classNames.control, {
157
147
  [classNames.control_focused]: isFocused && !invalid
158
148
  }),
159
- placeholder: () => classNames.placeholder,
149
+ clearIndicator: () => classNames.clearIndicator,
150
+ dropdownIndicator: () => classNames.dropdownIndicator,
151
+ groupHeading: () => classNames.groupHeading,
152
+ indicatorsContainer: () => classNames.indicatorsContainer,
153
+ indicatorSeparator: () => classNames.indicatorSeparator,
160
154
  input: () => classNames.input,
161
- valueContainer: () => classNames.valueContainer,
162
- singleValue: () => _pixelutils.cn.call(void 0, classNames.singleValue, `${getValueProps().className}`),
155
+ menu: () => classNames.menu,
163
156
  multiValue: () => classNames.multiValue,
164
157
  multiValueLabel: () => _pixelutils.cn.call(void 0,
165
158
  classNames.multiValueLabel,
166
159
  `${getValueProps().className}`
167
160
  ),
168
161
  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,
162
+ noOptionsMessage: () => classNames.noOptionsMessage,
175
163
  option: ({
176
164
  isFocused: optionIsFocused,
177
165
  isSelected: optionIsSelected
@@ -179,25 +167,33 @@ var Select = ({
179
167
  [classNames.option_focused]: optionIsFocused,
180
168
  [classNames.option_selected]: optionIsSelected
181
169
  }),
182
- noOptionsMessage: () => classNames.noOptionsMessage,
183
- menuPortal: () => classNames.menuPortal
170
+ placeholder: () => classNames.placeholder,
171
+ singleValue: () => _pixelutils.cn.call(void 0, classNames.singleValue, `${getValueProps().className}`),
172
+ valueContainer: () => classNames.valueContainer
184
173
  },
185
174
  components: {
186
175
  Input: InputComponent,
187
176
  Option: OptionComponent,
188
177
  DropdownIndicator: DropdownIndicatorComponent
189
178
  },
179
+ "data-testid": `${testId}_select`,
190
180
  filterOption,
191
181
  formatOptionLabel,
192
- instanceId: name,
193
182
  inputValue,
183
+ instanceId: name,
194
184
  isClearable: clearable,
195
185
  isDisabled: disabled,
196
186
  isLoading: loading,
197
187
  isMulti: multiSelect,
188
+ name,
189
+ menuPosition: "fixed",
190
+ menuShouldBlockScroll: true,
198
191
  options,
199
192
  placeholder,
200
- unstyled: true,
193
+ onBlur: (_e) => {
194
+ setIsFocused(false);
195
+ return onBlur();
196
+ },
201
197
  onChange: (option) => {
202
198
  if (multiSelect) {
203
199
  const transformedOptions = [];
@@ -209,18 +205,13 @@ var Select = ({
209
205
  onChange(option && option.value);
210
206
  }
211
207
  },
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
208
  onFocus: (_e) => {
220
209
  setIsFocused(true);
221
210
  },
222
- name,
223
- ref
211
+ onInputChange,
212
+ ref,
213
+ value: options.find((option) => option.value === value),
214
+ unstyled: true
224
215
  }
225
216
  )
226
217
  ] }),
@@ -241,4 +232,4 @@ var Select_default2 = Select_default;
241
232
 
242
233
 
243
234
  exports.Select_default = Select_default; exports.Select_default2 = Select_default2;
244
- //# sourceMappingURL=chunk-U3PJEVXL.cjs.map
235
+ //# sourceMappingURL=chunk-CVLA7A3Y.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/uniform/uniform/packages/uniform/dist/chunk-CVLA7A3Y.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;AAmGpC,+CAAA;AA7FF,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,I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A,kBAAA;AACE,oBAAA;AACE,sBAAA;AAEA,sCAAA;AACE,wBAAA;AAA+B,sBAAA;AAEjC,sBAAA;AAA2B,oBAAA;AAG3B,sBAAA;AAA+B,oBAAA;AAEnC,kBAAA;AACA,kBAAA;AACE,oBAAA;AACF,kBAAA;AACA,kBAAA;AACA,kBAAA;AAEA,kBAAA;AACA,kBAAA;AAAQ,gBAAA;AACV,cAAA;AACF,YAAA;AACC,YAAA;AAEC,4BAAA;AAOJ,UAAA;AAAA,QAAA;AACF,MAAA;AAAA,IAAA;AAEJ,EAAA;AAEJ;AAEO;ADzFW;AACA;AE7NXA;AF+NW;AACA;AACA;AACA;AACA","file":"/home/runner/work/uniform/uniform/packages/uniform/dist/chunk-CVLA7A3Y.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 label: '!pointer-events-auto relative bottom-2 ml-1 inline',\n loadingIndicator: '',\n loadingMessage: '',\n menu: 'mt-2 rounded-xl border border-default-200 bg-background p-1 shadow-lg',\n menuList: '',\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_focused: 'bg-default-100 active:bg-default-200',\n option_selected: 'bg-default-300',\n option: 'rounded px-3 py-2 hover:cursor-pointer',\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 getBaseProps,\n getErrorMessageProps,\n getHelperWrapperProps,\n getLabelProps,\n getMainWrapperProps,\n getTriggerProps,\n getValueProps,\n label,\n } = useSelect({\n children: [],\n classNames,\n errorMessage: JSON.stringify(error),\n isDisabled: disabled,\n isInvalid: invalid,\n isLoading: loading,\n isRequired: required,\n label: _label,\n labelPlacement: 'outside',\n placeholder: ' ',\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(getLabelProps().className, classNames.label)}\n >\n {label}\n <FieldCopyTestIdButton testId={testId} />\n </label>\n )}\n <ReactSelect\n aria-errormessage=\"\"\n aria-labelledby={\n getTriggerProps()['aria-labelledby']?.split(' ')[1]\n }\n aria-invalid={invalid}\n classNames={{\n control: () =>\n cn(classNames.control, {\n [classNames.control_focused]: isFocused && !invalid,\n }),\n clearIndicator: () => classNames.clearIndicator,\n dropdownIndicator: () => classNames.dropdownIndicator,\n groupHeading: () => classNames.groupHeading,\n indicatorsContainer: () => classNames.indicatorsContainer,\n indicatorSeparator: () => classNames.indicatorSeparator,\n input: () => classNames.input,\n menu: () => classNames.menu,\n multiValue: () => classNames.multiValue,\n multiValueLabel: () =>\n cn(\n classNames.multiValueLabel,\n `${getValueProps().className}`,\n ),\n multiValueRemove: () => classNames.multiValueRemove,\n noOptionsMessage: () => classNames.noOptionsMessage,\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 placeholder: () => classNames.placeholder,\n singleValue: () =>\n cn(classNames.singleValue, `${getValueProps().className}`),\n valueContainer: () => classNames.valueContainer,\n }}\n components={{\n Input: InputComponent,\n Option: OptionComponent,\n DropdownIndicator: DropdownIndicatorComponent,\n }}\n // Does not affect the testId of the select, but is needed to pass it to sub-components\n data-testid={`${testId}_select`}\n filterOption={filterOption}\n formatOptionLabel={formatOptionLabel}\n inputValue={inputValue}\n instanceId={name}\n isClearable={clearable}\n isDisabled={disabled}\n isLoading={loading}\n isMulti={multiSelect}\n name={name}\n // set menuPosition to fixed so that menu can be rendered\n // inside Card / Modal components, menuShouldBlockScroll\n // prevents container scroll when menu is open\n menuPosition=\"fixed\"\n menuShouldBlockScroll\n options={options}\n placeholder={placeholder}\n onBlur={(_e) => {\n setIsFocused(false);\n return onBlur();\n }}\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 onFocus={(_e) => {\n setIsFocused(true);\n }}\n onInputChange={onInputChange}\n ref={ref}\n // set complete option as value by current field value\n value={options.find((option) => option.value === value)}\n unstyled\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"]}
@@ -29,21 +29,19 @@ var selectVariants = tv({
29
29
  indicatorsContainer: "gap-1 p-1",
30
30
  indicatorSeparator: "bg-default-300",
31
31
  input: "py-0.5 pl-1",
32
+ label: "!pointer-events-auto relative bottom-2 ml-1 inline",
32
33
  loadingIndicator: "",
33
34
  loadingMessage: "",
34
35
  menu: "mt-2 rounded-xl border border-default-200 bg-background p-1 shadow-lg",
35
36
  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
37
  multiValue: "items-center gap-1.5 rounded bg-default-100 py-0.5 pl-2 pr-1",
40
38
  multiValueContainer: "",
41
39
  multiValueLabel: "py-0.5 leading-6",
42
40
  multiValueRemove: "rounded text-default-500 hover:cursor-pointer hover:border-default-300 hover:text-default-800",
43
41
  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
42
  option_focused: "bg-default-100 active:bg-default-200",
43
+ option_selected: "bg-default-300",
44
+ option: "rounded px-3 py-2 hover:cursor-pointer",
47
45
  placeholder: "py-0.5 pl-1 text-foreground-500",
48
46
  selectContainer: "",
49
47
  singleValue: "!ml-1 !leading-7",
@@ -91,25 +89,25 @@ var Select = ({
91
89
  const variants = selectVariants({ invalid });
92
90
  const classNames = variantsToClassNames(variants, className, "base");
93
91
  const {
94
- label,
95
92
  getBaseProps,
93
+ getErrorMessageProps,
94
+ getHelperWrapperProps,
96
95
  getLabelProps,
96
+ getMainWrapperProps,
97
97
  getTriggerProps,
98
98
  getValueProps,
99
- getMainWrapperProps,
100
- getHelperWrapperProps,
101
- getErrorMessageProps
99
+ label
102
100
  } = useSelect({
103
- isLoading: loading,
101
+ children: [],
102
+ classNames,
103
+ errorMessage: JSON.stringify(error),
104
+ isDisabled: disabled,
104
105
  isInvalid: invalid,
106
+ isLoading: loading,
105
107
  isRequired: required,
106
- isDisabled: disabled,
107
- errorMessage: JSON.stringify(error),
108
108
  label: _label,
109
109
  labelPlacement: "outside",
110
- placeholder: " ",
111
- children: [],
112
- classNames
110
+ placeholder: " "
113
111
  });
114
112
  return /* @__PURE__ */ jsx(
115
113
  Controller,
@@ -131,10 +129,7 @@ var Select = ({
131
129
  "label",
132
130
  {
133
131
  htmlFor: `react-select-${name}-input`,
134
- className: cn(
135
- getLabelProps().className.replace("absolute", "relative").replace("block", ""),
136
- "!pointer-events-auto bottom-2 ml-1"
137
- ),
132
+ className: cn(getLabelProps().className, classNames.label),
138
133
  children: [
139
134
  label,
140
135
  /* @__PURE__ */ jsx(FieldCopyTestIdButton_default, { testId })
@@ -145,33 +140,26 @@ var Select = ({
145
140
  ReactSelect,
146
141
  {
147
142
  "aria-errormessage": "",
148
- "aria-invalid": invalid,
149
- "data-testid": `${testId}_select`,
150
- ...() => {
151
- const { className: _className, ...rest } = getTriggerProps();
152
- return rest;
153
- },
154
143
  "aria-labelledby": getTriggerProps()["aria-labelledby"]?.split(" ")[1],
144
+ "aria-invalid": invalid,
155
145
  classNames: {
156
146
  control: () => cn(classNames.control, {
157
147
  [classNames.control_focused]: isFocused && !invalid
158
148
  }),
159
- placeholder: () => classNames.placeholder,
149
+ clearIndicator: () => classNames.clearIndicator,
150
+ dropdownIndicator: () => classNames.dropdownIndicator,
151
+ groupHeading: () => classNames.groupHeading,
152
+ indicatorsContainer: () => classNames.indicatorsContainer,
153
+ indicatorSeparator: () => classNames.indicatorSeparator,
160
154
  input: () => classNames.input,
161
- valueContainer: () => classNames.valueContainer,
162
- singleValue: () => cn(classNames.singleValue, `${getValueProps().className}`),
155
+ menu: () => classNames.menu,
163
156
  multiValue: () => classNames.multiValue,
164
157
  multiValueLabel: () => cn(
165
158
  classNames.multiValueLabel,
166
159
  `${getValueProps().className}`
167
160
  ),
168
161
  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,
162
+ noOptionsMessage: () => classNames.noOptionsMessage,
175
163
  option: ({
176
164
  isFocused: optionIsFocused,
177
165
  isSelected: optionIsSelected
@@ -179,25 +167,33 @@ var Select = ({
179
167
  [classNames.option_focused]: optionIsFocused,
180
168
  [classNames.option_selected]: optionIsSelected
181
169
  }),
182
- noOptionsMessage: () => classNames.noOptionsMessage,
183
- menuPortal: () => classNames.menuPortal
170
+ placeholder: () => classNames.placeholder,
171
+ singleValue: () => cn(classNames.singleValue, `${getValueProps().className}`),
172
+ valueContainer: () => classNames.valueContainer
184
173
  },
185
174
  components: {
186
175
  Input: InputComponent,
187
176
  Option: OptionComponent,
188
177
  DropdownIndicator: DropdownIndicatorComponent
189
178
  },
179
+ "data-testid": `${testId}_select`,
190
180
  filterOption,
191
181
  formatOptionLabel,
192
- instanceId: name,
193
182
  inputValue,
183
+ instanceId: name,
194
184
  isClearable: clearable,
195
185
  isDisabled: disabled,
196
186
  isLoading: loading,
197
187
  isMulti: multiSelect,
188
+ name,
189
+ menuPosition: "fixed",
190
+ menuShouldBlockScroll: true,
198
191
  options,
199
192
  placeholder,
200
- unstyled: true,
193
+ onBlur: (_e) => {
194
+ setIsFocused(false);
195
+ return onBlur();
196
+ },
201
197
  onChange: (option) => {
202
198
  if (multiSelect) {
203
199
  const transformedOptions = [];
@@ -209,18 +205,13 @@ var Select = ({
209
205
  onChange(option && option.value);
210
206
  }
211
207
  },
212
- onInputChange,
213
- menuPortalTarget: document.getElementById("modal_body")?.parentNode?.parentNode || document.body,
214
- value: options.find((option) => option.value === value),
215
- onBlur: (_e) => {
216
- setIsFocused(false);
217
- return onBlur();
218
- },
219
208
  onFocus: (_e) => {
220
209
  setIsFocused(true);
221
210
  },
222
- name,
223
- ref
211
+ onInputChange,
212
+ ref,
213
+ value: options.find((option) => option.value === value),
214
+ unstyled: true
224
215
  }
225
216
  )
226
217
  ] }),
@@ -241,4 +232,4 @@ export {
241
232
  Select_default,
242
233
  Select_default2
243
234
  };
244
- //# sourceMappingURL=chunk-I2R4W3KH.js.map
235
+ //# sourceMappingURL=chunk-VEYDHNYQ.js.map
@@ -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 label: '!pointer-events-auto relative bottom-2 ml-1 inline',\n loadingIndicator: '',\n loadingMessage: '',\n menu: 'mt-2 rounded-xl border border-default-200 bg-background p-1 shadow-lg',\n menuList: '',\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_focused: 'bg-default-100 active:bg-default-200',\n option_selected: 'bg-default-300',\n option: 'rounded px-3 py-2 hover:cursor-pointer',\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 getBaseProps,\n getErrorMessageProps,\n getHelperWrapperProps,\n getLabelProps,\n getMainWrapperProps,\n getTriggerProps,\n getValueProps,\n label,\n } = useSelect({\n children: [],\n classNames,\n errorMessage: JSON.stringify(error),\n isDisabled: disabled,\n isInvalid: invalid,\n isLoading: loading,\n isRequired: required,\n label: _label,\n labelPlacement: 'outside',\n placeholder: ' ',\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(getLabelProps().className, classNames.label)}\n >\n {label}\n <FieldCopyTestIdButton testId={testId} />\n </label>\n )}\n <ReactSelect\n aria-errormessage=\"\"\n aria-labelledby={\n getTriggerProps()['aria-labelledby']?.split(' ')[1]\n }\n aria-invalid={invalid}\n classNames={{\n control: () =>\n cn(classNames.control, {\n [classNames.control_focused]: isFocused && !invalid,\n }),\n clearIndicator: () => classNames.clearIndicator,\n dropdownIndicator: () => classNames.dropdownIndicator,\n groupHeading: () => classNames.groupHeading,\n indicatorsContainer: () => classNames.indicatorsContainer,\n indicatorSeparator: () => classNames.indicatorSeparator,\n input: () => classNames.input,\n menu: () => classNames.menu,\n multiValue: () => classNames.multiValue,\n multiValueLabel: () =>\n cn(\n classNames.multiValueLabel,\n `${getValueProps().className}`,\n ),\n multiValueRemove: () => classNames.multiValueRemove,\n noOptionsMessage: () => classNames.noOptionsMessage,\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 placeholder: () => classNames.placeholder,\n singleValue: () =>\n cn(classNames.singleValue, `${getValueProps().className}`),\n valueContainer: () => classNames.valueContainer,\n }}\n components={{\n Input: InputComponent,\n Option: OptionComponent,\n DropdownIndicator: DropdownIndicatorComponent,\n }}\n // Does not affect the testId of the select, but is needed to pass it to sub-components\n data-testid={`${testId}_select`}\n filterOption={filterOption}\n formatOptionLabel={formatOptionLabel}\n inputValue={inputValue}\n instanceId={name}\n isClearable={clearable}\n isDisabled={disabled}\n isLoading={loading}\n isMulti={multiSelect}\n name={name}\n // set menuPosition to fixed so that menu can be rendered\n // inside Card / Modal components, menuShouldBlockScroll\n // prevents container scroll when menu is open\n menuPosition=\"fixed\"\n menuShouldBlockScroll\n options={options}\n placeholder={placeholder}\n onBlur={(_e) => {\n setIsFocused(false);\n return onBlur();\n }}\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 onFocus={(_e) => {\n setIsFocused(true);\n }}\n onInputChange={onInputChange}\n ref={ref}\n // set complete option as value by current field value\n value={options.find((option) => option.value === value)}\n unstyled\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;AAmGpC,cA8FO,YA9FP;AA7FF,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,OAAO;AAAA,IACP,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,IAChB,MAAM;AAAA,IACN,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,qBAAqB;AAAA,IACrB,iBAAiB;AAAA,IACjB,kBACE;AAAA,IACF,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,aAAa;AAAA,IACb,gBAAgB;AAAA,EAClB;AAAA,EACA,UAAU;AAAA,IACR,SAAS;AAAA,MACP,MAAM;AAAA,QACJ,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AACF,CAAC;AA6CD,IAAM,iBAA0C,CAAC,UAAU;AAGzD,QAAM,SAAS,GAAG,MAAM,YAAY,aAAa,CAAC;AAElD,SAAO,oBAAC,WAAW,OAAX,EAAiB,eAAa,QAAS,GAAG,OAAO;AAC3D;AAEA,IAAM,kBAA4C,CAAC,UAAU;AAG3D,QAAM,SAAS,GAAG,MAAM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AG,qBAAqB,GAC5B,8BAAC,gCAAqB,OAAc,GACtC,GACF;AAAA,aAEJ;AAAA;AAAA,MACF;AAAA;AAAA,EAEJ;AAEJ;AAEA,IAAO,iBAAQ;;;ACrTf,IAAOA,kBAAQ;","names":["Select_default"]}
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 _chunkU3PJEVXLcjs = require('./chunk-U3PJEVXL.cjs');
30
+ var _chunkCVLA7A3Ycjs = require('./chunk-CVLA7A3Y.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 = _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;
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 = _chunkCVLA7A3Ycjs.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-2IgkXjF0.cjs';
11
+ export { S as Select, a as SelectProps } from './Select-zUYKczzn.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';
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-2IgkXjF0.js';
11
+ export { S as Select, a as SelectProps } from './Select-zUYKczzn.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';
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-I2R4W3KH.js";
30
+ } from "./chunk-VEYDHNYQ.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.1",
3
+ "version": "0.9.3",
4
4
  "description": "fuf react form library",
5
5
  "author": "Hannes Tiede",
6
6
  "homepage": "https://github.com/fuf-stack/uniform#readme",
@@ -135,10 +135,10 @@
135
135
  "@types/slug": "5.0.9",
136
136
  "react": "18.3.1",
137
137
  "react-dom": "18.3.1",
138
- "@repo/storybook-config": "0.0.1",
139
138
  "@repo/tailwind-config": "0.0.1",
140
139
  "@repo/tsup-config": "0.0.1",
141
- "@repo/vite-config": "0.0.1"
140
+ "@repo/vite-config": "0.0.1",
141
+ "@repo/storybook-config": "0.0.1"
142
142
  },
143
143
  "scripts": {
144
144
  "build": "tsup --config node_modules/@repo/tsup-config/config.ts",
@@ -1 +0,0 @@
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,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;AAAA,IAGV,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,qBAAqB;AAAA,IACrB,iBAAiB;AAAA,IACjB,kBACE;AAAA,IACF,kBAAkB;AAAA,IAClB,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,gBAAgB;AAAA,IAChB,a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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"]}
@@ -1 +0,0 @@
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,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,oBAAA;AAC/B,oBAAA;AACgC,oBAAA;AAErC,kBAAA;AACA,kBAAA;AAAY,oBAAA;AACH,oBAAA;AACC,oBAAA;AAEV,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACE,oBAAA;AACE,sBAAA;AAEA,sCAAA;AACE,wBAAA;AAA+B,sBAAA;AAEjC,sBAAA;AAA2B,oBAAA;AAG3B,sBAAA;AAA+B,oBAAA;AAEnC,kBAAA;AACA,kBAAA;AAEA,kBAAA;AAIA,kBAAA;AACA,kBAAA;AACE,oBAAA;AACA,oBAAA;AACF,kBAAA;AACA,kBAAA;AACE,oBAAA;AACF,kBAAA;AACA,kBAAA;AACA,kBAAA;AAAA,gBAAA;AACF,cAAA;AACF,YAAA;AACC,YAAA;AAEC,4BAAA;AAOJ,UAAA;AAAA,QAAA;AACF,MAAA;AAAA,IAAA;AAEJ,EAAA;AAEJ;AAEO;AD7FW;AACA;AEtOXA;AFwOW;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"]}