@propellerads/select 6.0.1 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import { ReactNode, Ref, ReactElement } from 'react';
2
2
  import { GroupBase, SelectInstance, StylesConfig } from 'react-select';
3
3
  export { components } from 'react-select';
4
- import { ReactNode, Ref } from 'react';
5
4
  import { AsyncProps } from 'react-select/async';
6
5
  import { CreatableProps } from 'react-select/creatable';
7
6
 
@@ -67,12 +66,9 @@ type OwnProps<O, M extends boolean, G extends GroupBase<O>> = {
67
66
  */
68
67
  type SelectProps<O = Option, M extends boolean = boolean, G extends GroupBase<O> = GroupBase<O>> = Omit<Partial<AsyncProps<O, M, G> & CreatableProps<O, M, G>>, 'id' | 'onCreateOption'> & OwnProps<O, M, G>;
69
68
 
70
- /**
71
- * A select on react-select with the library's look: one field for a single
72
- * value, several as chips, a list that loads as the user types, and new values
73
- * the user creates. Every react-select prop is accepted and passed on.
74
- */
75
- declare const Select: <O = Option, M extends boolean = false, G extends GroupBase<O> = OptionGroup<O>>(props: SelectProps<O, M, G>) => react_jsx_runtime.JSX.Element;
69
+ declare const Select: (<O = Option, M extends boolean = false, G extends GroupBase<O> = OptionGroup<O>>(props: SelectProps<O, M, G>) => ReactElement) & {
70
+ displayName?: string;
71
+ };
76
72
 
77
73
  export { Select, SelectTone, Select as default };
78
74
  export type { Option, OptionGroup, SelectProps };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import e from "@propellerads/error-label";
2
- import { useEffect as t, useId as n, useRef as r, useState as i } from "react";
3
- import a, { components as o } from "react-select";
4
- import s from "react-select/async";
5
- import ee from "react-select/async-creatable";
2
+ import { forwardRef as t, useEffect as n, useId as r, useRef as i, useState as a } from "react";
3
+ import o, { components as s } from "react-select";
4
+ import ee from "react-select/async";
5
+ import te from "react-select/async-creatable";
6
6
  import c from "react-select/creatable";
7
7
  import { clsx as l } from "clsx";
8
8
  import { jsx as u, jsxs as d } from "react/jsx-runtime";
@@ -48,18 +48,18 @@ var f = (...e) => l(e), p = {
48
48
  strokeLinecap: "round",
49
49
  strokeLinejoin: "round"
50
50
  })
51
- }), te = ({ children: e, ...t }) => {
51
+ }), ne = ({ children: e, ...t }) => {
52
52
  let { icon: n } = m(t);
53
- return /* @__PURE__ */ d(o.Control, {
53
+ return /* @__PURE__ */ d(s.Control, {
54
54
  ...t,
55
55
  children: [n && /* @__PURE__ */ u("span", {
56
56
  className: "select__icon",
57
57
  children: n
58
58
  }), e]
59
59
  });
60
- }, ne = ({ children: t, ...n }) => {
61
- let { id: r, errors: i, showErrors: a, tone: s } = m(n);
62
- return /* @__PURE__ */ d(o.IndicatorsContainer, {
60
+ }, re = ({ children: t, ...n }) => {
61
+ let { id: r, errors: i, showErrors: a, tone: o } = m(n);
62
+ return /* @__PURE__ */ d(s.IndicatorsContainer, {
63
63
  ...n,
64
64
  children: [a && i.length > 0 && /* @__PURE__ */ u("span", {
65
65
  className: "select__errors",
@@ -67,16 +67,16 @@ var f = (...e) => l(e), p = {
67
67
  children: /* @__PURE__ */ u(e, {
68
68
  elementId: r,
69
69
  errors: [...i],
70
- errorColor: s === p.Warning ? "var(--color-warning)" : void 0
70
+ errorColor: o === p.Warning ? "var(--color-warning)" : void 0
71
71
  })
72
72
  }), t]
73
73
  });
74
- }, re = (e) => /* @__PURE__ */ u(o.DropdownIndicator, {
74
+ }, v = (e) => /* @__PURE__ */ u(s.DropdownIndicator, {
75
75
  ...e,
76
76
  children: /* @__PURE__ */ u(h, {})
77
77
  }), ie = (e) => {
78
78
  let { id: t } = m(e);
79
- return /* @__PURE__ */ u(o.ClearIndicator, {
79
+ return /* @__PURE__ */ u(s.ClearIndicator, {
80
80
  ...e,
81
81
  innerProps: {
82
82
  ...e.innerProps,
@@ -84,10 +84,10 @@ var f = (...e) => l(e), p = {
84
84
  },
85
85
  children: /* @__PURE__ */ u(g, {})
86
86
  });
87
- }, v = (e) => /* @__PURE__ */ u(o.MultiValueRemove, {
87
+ }, ae = (e) => /* @__PURE__ */ u(s.MultiValueRemove, {
88
88
  ...e,
89
89
  children: /* @__PURE__ */ u(g, { size: 12 })
90
- }), ae = ({ children: e, ...t }) => /* @__PURE__ */ d(o.Option, {
90
+ }), oe = ({ children: e, ...t }) => /* @__PURE__ */ d(s.Option, {
91
91
  ...t,
92
92
  children: [e, t.isSelected && !t.isMulti && /* @__PURE__ */ u("span", {
93
93
  className: "select__option-check",
@@ -98,7 +98,7 @@ var f = (...e) => l(e), p = {
98
98
  className: "select__indicator select__loading-indicator",
99
99
  role: "status",
100
100
  "aria-label": "Loading"
101
- }), oe = (e = {}) => {
101
+ }), b = (e = {}) => {
102
102
  let t = {
103
103
  control: (e) => f("select__control", e.isFocused && "select__control--focused", e.isDisabled && "select__control--disabled", e.menuIsOpen && "select__control--menu-is-open"),
104
104
  valueContainer: (e) => f("select__value-container", e.isMulti && "select__value-container--is-multi", e.hasValue && "select__value-container--has-value"),
@@ -127,7 +127,7 @@ var f = (...e) => l(e), p = {
127
127
  n[r] = (e) => f(i?.(e), a?.(e));
128
128
  }
129
129
  return n;
130
- }, se = ["label"], ce = (e) => {
130
+ }, x = ["label"], se = (e) => {
131
131
  for (let t of [
132
132
  /\n+/,
133
133
  /,\s/,
@@ -137,24 +137,24 @@ var f = (...e) => l(e), p = {
137
137
  if (n.length > 1) return n;
138
138
  }
139
139
  return e.split(/\s+/);
140
- }, b = (e) => e.flatMap((e) => e && typeof e == "object" && "options" in e ? [...e.options] : [e]), x = (e) => {
141
- let { id: o, elementId: l, errors: d = [], showErrors: m, isErrorLabelVisible: h, tone: g = p.Danger, icon: _ = null, isCreatable: x = !1, isAsync: S = !1, onCreateOption: C, createOptionPlaceholder: le = "Create ", minSearchLength: ue, searchableKeys: de = se, promiseOptions: w, customStyles: fe, actionColor: T, minHeightInput: pe, styles: E, classNames: D, components: O, className: k, ref: A, isMulti: j, isDisabled: M = !1, isLoading: N, isSearchable: P, isOptionDisabled: F, placeholder: I = "Select", menuPlacement: L = "auto", loadOptions: R, noOptionsMessage: z, formatCreateLabel: B, options: V, value: H, onChange: U, ...me } = e, he = n(), W = o ?? l ?? he, ge = d.length > 0, [G, K] = i(!1), q = r(!0), J = r(null);
142
- t(() => () => {
140
+ }, ce = (e) => e.flatMap((e) => e && typeof e == "object" && "options" in e ? [...e.options] : [e]), S = t((e, t) => {
141
+ let { id: s, elementId: l, errors: d = [], showErrors: m, isErrorLabelVisible: h, tone: g = p.Danger, icon: _ = null, isCreatable: S = !1, isAsync: C = !1, onCreateOption: w, createOptionPlaceholder: le = "Create ", minSearchLength: ue, searchableKeys: de = x, promiseOptions: T, customStyles: fe, actionColor: E, minHeightInput: pe, styles: D, classNames: O, components: k, className: A, isMulti: j, isDisabled: M = !1, isLoading: N, isSearchable: P, isOptionDisabled: F, placeholder: I = "Select", menuPlacement: L = "auto", loadOptions: R, noOptionsMessage: z, formatCreateLabel: B, options: V, value: H, onChange: U, ...me } = e, he = r(), W = s ?? l ?? he, ge = d.length > 0, [G, K] = a(!1), q = i(!0), J = i(null);
142
+ n(() => () => {
143
143
  q.current = !1;
144
144
  }, []);
145
145
  let _e = (e) => {
146
- J.current = e, typeof A == "function" ? A(e) : A && (A.current = e);
147
- }, Y = ue ?? (w ? 2 : 0), X = R ?? w, ve = async (e) => {
148
- if (C) try {
149
- K(!0), await C(e);
146
+ J.current = e, typeof t == "function" ? t(e) : t && (t.current = e);
147
+ }, Y = ue ?? (T ? 2 : 0), X = R ?? T, ve = async (e) => {
148
+ if (w) try {
149
+ K(!0), await w(e);
150
150
  } finally {
151
151
  q.current && K(!1);
152
152
  }
153
153
  }, ye = (e) => {
154
154
  if (!j || !V || !U) return;
155
- let t = ce(e.clipboardData.getData("text/plain")).map((e) => e.trim().toLowerCase()).filter(Boolean);
155
+ let t = se(e.clipboardData.getData("text/plain")).map((e) => e.trim().toLowerCase()).filter(Boolean);
156
156
  if (t.length < 2) return;
157
- let n = b(V).filter((e) => de.some((n) => t.includes(String(e[n]).toLowerCase())));
157
+ let n = ce(V).filter((e) => de.some((n) => t.includes(String(e[n]).toLowerCase())));
158
158
  if (n.length === 0) return;
159
159
  let r = Array.isArray(H) ? H : [], i = [...r, ...n.filter((e) => !r.includes(e))];
160
160
  e.preventDefault(), U(i, {
@@ -168,15 +168,15 @@ var f = (...e) => l(e), p = {
168
168
  tone: g,
169
169
  icon: _
170
170
  }, xe = {
171
- Control: te,
172
- IndicatorsContainer: ne,
171
+ Control: ne,
172
+ IndicatorsContainer: re,
173
173
  IndicatorSeparator: null,
174
- DropdownIndicator: re,
174
+ DropdownIndicator: v,
175
175
  ClearIndicator: ie,
176
- MultiValueRemove: v,
177
- Option: ae,
176
+ MultiValueRemove: ae,
177
+ Option: oe,
178
178
  LoadingIndicator: y,
179
- ...O
179
+ ...k
180
180
  }, Z = {
181
181
  ...me,
182
182
  id: W,
@@ -194,44 +194,45 @@ var f = (...e) => l(e), p = {
194
194
  isLoading: N || G,
195
195
  styles: {
196
196
  ...fe,
197
- ...E
197
+ ...D
198
198
  },
199
- classNames: oe(D),
199
+ classNames: b(O),
200
200
  components: xe,
201
201
  noOptionsMessage: (e) => e.inputValue.length < Y ? `Enter ${Y} or more characters` : z?.(e) ?? "No options",
202
202
  ref: _e
203
203
  }, Q = {
204
204
  formatCreateLabel: B ?? ((e) => `${le}"${e}"`),
205
- ...C && { onCreateOption: ve }
205
+ ...w && { onCreateOption: ve }
206
206
  }, $ = { loadOptions: (e, t) => {
207
207
  if (e.length < Y || !X) {
208
208
  t([]);
209
209
  return;
210
210
  }
211
211
  return X(e, t);
212
- } }, Se = S && x ? /* @__PURE__ */ u(ee, {
212
+ } }, Se = C && S ? /* @__PURE__ */ u(te, {
213
213
  ...Z,
214
214
  ...Q,
215
215
  ...$
216
- }) : S ? /* @__PURE__ */ u(s, {
216
+ }) : C ? /* @__PURE__ */ u(ee, {
217
217
  ...Z,
218
218
  ...$
219
- }) : x ? /* @__PURE__ */ u(c, {
219
+ }) : S ? /* @__PURE__ */ u(c, {
220
220
  ...Z,
221
221
  ...Q
222
- }) : /* @__PURE__ */ u(a, { ...Z }), Ce = T ? {
223
- "--select-chip-bg": T,
222
+ }) : /* @__PURE__ */ u(o, { ...Z }), Ce = E ? {
223
+ "--select-chip-bg": E,
224
224
  "--select-chip-text": "var(--color-light)"
225
225
  } : void 0;
226
226
  return /* @__PURE__ */ u("div", {
227
- className: f("select", ge && "select--invalid", g === p.Warning && "select--warning", k),
227
+ className: f("select", ge && "select--invalid", g === p.Warning && "select--warning", A),
228
228
  "data-is-disabled": M,
229
229
  style: Ce,
230
230
  onPaste: ye,
231
231
  children: Se
232
232
  });
233
- };
233
+ });
234
+ S.displayName = "Select";
234
235
  //#endregion
235
- export { x as Select, x as default, p as SelectTone, o as components };
236
+ export { S as Select, S as default, p as SelectTone, s as components };
236
237
 
237
238
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/cn.ts","../src/types.ts","../src/index.tsx"],"sourcesContent":["import {type ClassValue, clsx} from 'clsx';\n\n/**\n * Joins class names. There is no tailwind-merge here on purpose: the select\n * ships its own stylesheet instead of utility classes, so there is nothing to\n * deduplicate.\n */\nconst cn = (...inputs: ClassValue[]): string => clsx(inputs);\n\nexport {cn};\n","import type {ReactNode, Ref} from 'react';\nimport type {GroupBase, SelectInstance, StylesConfig} from 'react-select';\nimport type {AsyncProps} from 'react-select/async';\nimport type {CreatableProps} from 'react-select/creatable';\n\nexport type Option = {\n value: number | string;\n label: ReactNode;\n /** Read by `isOptionDisabled` when the caller passes one. */\n isOptionDisabled?: boolean;\n /** A chosen value the product flags: its chip takes the danger colours. */\n isException?: boolean;\n};\n\nexport type OptionGroup<O = Option> = GroupBase<O>;\n\n/** Which colour the errors are shown in. */\nexport const SelectTone = {\n Danger: 'danger',\n Warning: 'warning',\n} as const;\nexport type SelectTone = (typeof SelectTone)[keyof typeof SelectTone];\n\ntype OwnProps<O, M extends boolean, G extends GroupBase<O>> = {\n /** Names the select, its `!` mark (`error-label-${id}`) and its clear cross (`${id}-clear`). */\n id?: string;\n /** The `!` mark in the field and the red contour. */\n errors?: ReadonlyArray<string>;\n /** Hides the mark and keeps the contour. @default true */\n showErrors?: boolean;\n /** @default 'danger' */\n tone?: SelectTone;\n /** An icon at the start of the field. */\n icon?: ReactNode;\n /** Lets the user add an option that is not in the list. */\n isCreatable?: boolean;\n /** Loads the options with `loadOptions` as the user types. */\n isAsync?: boolean;\n /** Called with the text of a new option. A promise shows the spinner until it settles. */\n onCreateOption?: (inputValue: string) => void | Promise<void>;\n /** What the create row starts with: `Create \"…\"`. @default 'Create ' */\n createOptionPlaceholder?: string;\n /** How many characters an async search waits for; it says so until then. @default 0 */\n minSearchLength?: number;\n /**\n * The option keys a pasted list is matched against. Pasting \"a, b, c\" into a\n * multi select picks every option whose key equals one of the parts.\n * @default ['label']\n */\n searchableKeys?: Array<keyof O>;\n ref?: Ref<SelectInstance<O, M, G>>;\n\n /** @deprecated TagsInput's name for `id`. */\n elementId?: string;\n /** @deprecated TagsInput's name for `showErrors`. */\n isErrorLabelVisible?: boolean;\n /** @deprecated TagsInput's name for `styles`. */\n customStyles?: StylesConfig<O, M, G>;\n /** @deprecated TagsInput's async loader: `loadOptions` with a two-character minimum. */\n promiseOptions?: (inputValue: string) => Promise<ReadonlyArray<O | G>>;\n /** @deprecated TagsInput's chip colour. Set `--select-chip-bg` on an ancestor instead. */\n actionColor?: string;\n /** @deprecated The field grows with its chips. Accepted and ignored. */\n minHeightInput?: number;\n};\n\n/**\n * Every prop of react-select, of its async and creatable flavours, and the\n * library's own. Nothing is dropped on the way to react-select.\n */\nexport type SelectProps<O = Option, M extends boolean = boolean, G extends GroupBase<O> = GroupBase<O>> = Omit<\n Partial<AsyncProps<O, M, G> & CreatableProps<O, M, G>>,\n 'id' | 'onCreateOption'\n> &\n OwnProps<O, M, G>;\n","import ErrorLabel from '@propellerads/error-label';\nimport {type ClipboardEvent, type CSSProperties, type ReactNode, useEffect, useId, useRef, useState} from 'react';\nimport ReactSelect, {\n type ActionMeta,\n type ClassNamesConfig,\n type ClearIndicatorProps,\n type ControlProps,\n type DropdownIndicatorProps,\n type GroupBase,\n type IndicatorsContainerProps,\n type LoadingIndicatorProps,\n type MultiValueRemoveProps,\n type OnChangeValue,\n type OptionProps,\n components as reactSelectComponents,\n type SelectComponentsConfig,\n type SelectInstance,\n type StylesConfig,\n} from 'react-select';\nimport AsyncSelect from 'react-select/async';\nimport AsyncCreatableSelect from 'react-select/async-creatable';\nimport CreatableSelect from 'react-select/creatable';\nimport './select.css';\nimport {cn} from './cn';\nimport {type Option, type OptionGroup, type SelectProps, SelectTone} from './types';\n\n/*\n * react-select, unstyled, with every part given a class from select.css. The\n * behaviour — keyboard, search, async, creatable, multi, portals — is\n * react-select's own, and every prop it takes reaches it. What the library adds\n * rides on `selectProps.library`, so the parts below can stay the same\n * components across renders: a part created inside a render would remount the\n * menu on every keystroke.\n */\n\ntype Library = {\n id: string;\n errors: ReadonlyArray<string>;\n showErrors: boolean;\n tone: SelectTone;\n icon: ReactNode;\n};\n\ntype AnyProps = {selectProps: unknown};\n\nconst libraryOf = (props: AnyProps): Library => (props.selectProps as {library: Library}).library;\n\nconst ChevronIcon = () => (\n <svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M4 6l4 4 4-4\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n);\n\nconst CrossIcon = ({size = 16}: {size?: number}) => (\n <svg viewBox=\"0 0 16 16\" width={size} height={size} fill=\"none\" aria-hidden=\"true\">\n <path d=\"M4.5 4.5l7 7M11.5 4.5l-7 7\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n </svg>\n);\n\nconst CheckIcon = () => (\n <svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M3 8.5l3 3 7-7\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n);\n\nconst Control = <O, M extends boolean, G extends GroupBase<O>>({children, ...props}: ControlProps<O, M, G>) => {\n const {icon} = libraryOf(props);\n\n return (\n <reactSelectComponents.Control {...props}>\n {icon && <span className=\"select__icon\">{icon}</span>}\n {children}\n </reactSelectComponents.Control>\n );\n};\n\n/** The `!` mark stands with the other indicators, before the clear cross and the chevron. */\nconst IndicatorsContainer = <O, M extends boolean, G extends GroupBase<O>>({\n children,\n ...props\n}: IndicatorsContainerProps<O, M, G>) => {\n const {id, errors, showErrors, tone} = libraryOf(props);\n\n return (\n <reactSelectComponents.IndicatorsContainer {...props}>\n {showErrors && errors.length > 0 && (\n // The field opens its menu on mousedown; the mark keeps its own click.\n <span className=\"select__errors\" onMouseDown={(event) => event.stopPropagation()}>\n <ErrorLabel\n elementId={id}\n errors={[...errors]}\n errorColor={tone === SelectTone.Warning ? 'var(--color-warning)' : undefined}\n />\n </span>\n )}\n {children}\n </reactSelectComponents.IndicatorsContainer>\n );\n};\n\nconst DropdownIndicator = <O, M extends boolean, G extends GroupBase<O>>(props: DropdownIndicatorProps<O, M, G>) => (\n <reactSelectComponents.DropdownIndicator {...props}>\n <ChevronIcon />\n </reactSelectComponents.DropdownIndicator>\n);\n\n/** The clear cross keeps TagsInput's `${id}-clear`, which products and tests find it by. */\nconst ClearIndicator = <O, M extends boolean, G extends GroupBase<O>>(props: ClearIndicatorProps<O, M, G>) => {\n const {id} = libraryOf(props);\n\n return (\n <reactSelectComponents.ClearIndicator {...props} innerProps={{...props.innerProps, id: `${id}-clear`}}>\n <CrossIcon />\n </reactSelectComponents.ClearIndicator>\n );\n};\n\nconst MultiValueRemove = <O, M extends boolean, G extends GroupBase<O>>(props: MultiValueRemoveProps<O, M, G>) => (\n <reactSelectComponents.MultiValueRemove {...props}>\n <CrossIcon size={12} />\n </reactSelectComponents.MultiValueRemove>\n);\n\n/** A single select marks the chosen item with a check, as shadcn's does. */\nconst OptionWithCheck = <O, M extends boolean, G extends GroupBase<O>>({children, ...props}: OptionProps<O, M, G>) => (\n <reactSelectComponents.Option {...props}>\n {children}\n {props.isSelected && !props.isMulti && (\n <span className=\"select__option-check\">\n <CheckIcon />\n </span>\n )}\n </reactSelectComponents.Option>\n);\n\nconst LoadingIndicator = <O, M extends boolean, G extends GroupBase<O>>({\n innerProps,\n}: LoadingIndicatorProps<O, M, G>) => (\n <span {...innerProps} className=\"select__indicator select__loading-indicator\" role=\"status\" aria-label=\"Loading\" />\n);\n\n/** The class every part takes. A product's own `classNames` is added after ours. */\nconst partClassNames = <O, M extends boolean, G extends GroupBase<O>>(\n own: ClassNamesConfig<O, M, G> = {},\n): ClassNamesConfig<O, M, G> => {\n const ours: ClassNamesConfig<O, M, G> = {\n control: (state) =>\n cn(\n 'select__control',\n state.isFocused && 'select__control--focused',\n state.isDisabled && 'select__control--disabled',\n state.menuIsOpen && 'select__control--menu-is-open',\n ),\n valueContainer: (state) =>\n cn(\n 'select__value-container',\n state.isMulti && 'select__value-container--is-multi',\n state.hasValue && 'select__value-container--has-value',\n ),\n placeholder: () => 'select__placeholder',\n singleValue: () => 'select__single-value',\n input: () => 'select__input-container',\n indicatorsContainer: () => 'select__indicators',\n indicatorSeparator: () => 'select__indicator-separator',\n dropdownIndicator: () => 'select__indicator select__dropdown-indicator',\n clearIndicator: () => 'select__indicator select__clear-indicator',\n loadingIndicator: () => 'select__indicator select__loading-indicator',\n multiValue: (state) =>\n cn('select__multi-value', (state.data as Option).isException && 'select__multi-value--exception'),\n multiValueLabel: () => 'select__multi-value-label',\n multiValueRemove: () => 'select__multi-value-remove',\n menu: (state) => cn('select__menu', state.placement === 'top' && 'select__menu--top'),\n menuPortal: () => 'select__menu-portal',\n menuList: () => 'select__menu-list',\n option: (state) =>\n cn(\n 'select__option',\n state.isFocused && 'select__option--focused',\n state.isSelected && 'select__option--selected',\n state.isDisabled && 'select__option--disabled',\n ),\n group: () => 'select__group',\n groupHeading: () => 'select__group-heading',\n noOptionsMessage: () => 'select__menu-notice',\n loadingMessage: () => 'select__menu-notice',\n };\n\n const merged: ClassNamesConfig<O, M, G> = {...ours};\n\n for (const key of Object.keys(own) as Array<keyof ClassNamesConfig<O, M, G>>) {\n const mine = ours[key] as ((state: unknown) => string) | undefined;\n const theirs = own[key] as ((state: unknown) => string) | undefined;\n (merged as Record<string, (state: unknown) => string>)[key] = (state) => cn(mine?.(state), theirs?.(state));\n }\n\n return merged;\n};\n\nconst DEFAULT_KEYS = ['label'];\n\n/** The parts of a pasted list, split the way TagsInput did: by lines, by \", \", by \",\", or by spaces. */\nconst splitPasted = (text: string): string[] => {\n for (const separator of [/\\n+/, /,\\s/, /,+/]) {\n const parts = text.split(separator);\n if (parts.length > 1) {\n return parts;\n }\n }\n\n return text.split(/\\s+/);\n};\n\nconst flatten = <O, G extends GroupBase<O>>(options: ReadonlyArray<O | G>): O[] =>\n options.flatMap((item) =>\n item && typeof item === 'object' && 'options' in item ? [...(item as G).options] : [item as O],\n );\n\n/**\n * A select on react-select with the library's look: one field for a single\n * value, several as chips, a list that loads as the user types, and new values\n * the user creates. Every react-select prop is accepted and passed on.\n */\nconst Select = <O = Option, M extends boolean = false, G extends GroupBase<O> = OptionGroup<O>>(\n props: SelectProps<O, M, G>,\n) => {\n const {\n id: idProp,\n elementId,\n errors = [],\n showErrors,\n isErrorLabelVisible,\n tone = SelectTone.Danger,\n icon = null,\n isCreatable = false,\n isAsync = false,\n onCreateOption,\n createOptionPlaceholder = 'Create ',\n minSearchLength,\n searchableKeys = DEFAULT_KEYS as Array<keyof O>,\n promiseOptions,\n customStyles,\n actionColor,\n minHeightInput: _minHeightInput,\n styles,\n classNames,\n components,\n className,\n ref,\n isMulti,\n isDisabled = false,\n isLoading,\n isSearchable,\n isOptionDisabled,\n placeholder = 'Select',\n menuPlacement = 'auto',\n loadOptions,\n noOptionsMessage,\n formatCreateLabel,\n options,\n value,\n onChange,\n ...rest\n } = props;\n\n const fallbackId = useId();\n const id = idProp ?? elementId ?? fallbackId;\n const isInvalid = errors.length > 0;\n\n const [isCreating, setCreating] = useState(false);\n const isMounted = useRef(true);\n const selectRef = useRef<SelectInstance<O, M, G> | null>(null);\n\n useEffect(\n () => () => {\n isMounted.current = false;\n },\n [],\n );\n\n const setRef = (instance: SelectInstance<O, M, G> | null): void => {\n selectRef.current = instance;\n if (typeof ref === 'function') {\n ref(instance);\n } else if (ref) {\n ref.current = instance;\n }\n };\n\n // TagsInput waited for two characters before it asked the server.\n const minimum = minSearchLength ?? (promiseOptions ? 2 : 0);\n const loader = loadOptions ?? promiseOptions;\n\n const handleCreateOption = async (inputValue: string): Promise<void> => {\n if (!onCreateOption) {\n return;\n }\n\n try {\n setCreating(true);\n await onCreateOption(inputValue);\n } finally {\n if (isMounted.current) {\n setCreating(false);\n }\n }\n };\n\n // Pasting a list into a multi select picks the options it names.\n const handlePaste = (event: ClipboardEvent<HTMLDivElement>): void => {\n if (!isMulti || !options || !onChange) {\n return;\n }\n\n const parts = splitPasted(event.clipboardData.getData('text/plain'))\n .map((part) => part.trim().toLowerCase())\n .filter(Boolean);\n\n if (parts.length < 2) {\n return;\n }\n\n const found = flatten<O, G>(options).filter((option) =>\n searchableKeys.some((key: keyof O) => parts.includes(String(option[key]).toLowerCase())),\n );\n\n if (found.length === 0) {\n return;\n }\n\n const current = (Array.isArray(value) ? value : []) as O[];\n const next = [...current, ...found.filter((option) => !current.includes(option))];\n\n event.preventDefault();\n onChange(next as unknown as OnChangeValue<O, M>, {action: 'select-option', option: found[0]} as ActionMeta<O>);\n setTimeout(() => selectRef.current?.blur(), 0);\n };\n\n const library: Library = {\n id,\n errors,\n showErrors: showErrors ?? isErrorLabelVisible ?? true,\n tone,\n icon,\n };\n\n const parts: Partial<SelectComponentsConfig<O, M, G>> = {\n Control,\n IndicatorsContainer,\n IndicatorSeparator: null,\n DropdownIndicator,\n ClearIndicator,\n MultiValueRemove,\n Option: OptionWithCheck,\n LoadingIndicator,\n ...components,\n };\n\n const selectProps = {\n ...rest,\n id,\n library,\n unstyled: true,\n options,\n value,\n onChange,\n isMulti,\n placeholder,\n menuPlacement,\n // v5 of the single select was not searchable by default; TagsInput was.\n isSearchable: isSearchable ?? Boolean(isMulti),\n // v5 of the single select ignored `isDisabled` on options unless told otherwise.\n isOptionDisabled: isOptionDisabled ?? (isMulti ? undefined : () => false),\n isDisabled: isDisabled || isCreating,\n isLoading: isLoading || isCreating,\n styles: {...customStyles, ...styles} as StylesConfig<O, M, G>,\n classNames: partClassNames(classNames),\n components: parts,\n noOptionsMessage: (input: {inputValue: string}) =>\n input.inputValue.length < minimum\n ? `Enter ${minimum} or more characters`\n : (noOptionsMessage?.(input) ?? 'No options'),\n ref: setRef,\n };\n\n const creatableProps = {\n formatCreateLabel: formatCreateLabel ?? ((inputValue: string) => `${createOptionPlaceholder}\"${inputValue}\"`),\n ...(onCreateOption && {onCreateOption: handleCreateOption}),\n };\n\n const asyncProps = {\n loadOptions: (inputValue: string, callback: (options: ReadonlyArray<O | G>) => void) => {\n if (inputValue.length < minimum || !loader) {\n callback([]);\n return undefined;\n }\n\n return loader(inputValue, callback);\n },\n };\n\n // The four flavours of react-select share one set of props; the casts only\n // tell TypeScript which flavour it is looking at.\n const field = (() => {\n if (isAsync && isCreatable) {\n return <AsyncCreatableSelect {...(selectProps as object)} {...creatableProps} {...asyncProps} />;\n }\n if (isAsync) {\n return <AsyncSelect {...(selectProps as object)} {...asyncProps} />;\n }\n if (isCreatable) {\n return <CreatableSelect {...(selectProps as object)} {...creatableProps} />;\n }\n return <ReactSelect {...(selectProps as object)} />;\n })();\n\n const style = actionColor\n ? ({'--select-chip-bg': actionColor, '--select-chip-text': 'var(--color-light)'} as CSSProperties)\n : undefined;\n\n return (\n <div\n className={cn(\n 'select',\n isInvalid && 'select--invalid',\n tone === SelectTone.Warning && 'select--warning',\n className,\n )}\n data-is-disabled={isDisabled}\n style={style}\n onPaste={handlePaste}\n >\n {field}\n </div>\n );\n};\n\nexport default Select;\n\nexport type {Option, OptionGroup, SelectProps};\nexport {reactSelectComponents as components, Select, SelectTone};\n"],"mappings":";;;;;;;;;AAOA,IAAM,KAAM,GAAG,MAAiC,EAAK,EAAO,ECU/C,IAAa;CACxB,QAAQ;CACR,SAAS;CACV,ECyBK,KAAa,MAA8B,EAAM,YAAmC,SAEpF,UACJ,kBAAC,OAAD;CAAK,SAAQ;CAAY,OAAM;CAAK,QAAO;CAAK,MAAK;CAAO,eAAY;WACtE,kBAAC,QAAD;EAAM,GAAE;EAAe,QAAO;EAAe,aAAY;EAAM,eAAc;EAAQ,gBAAe;EAAU,CAAA;CAC1G,CAAA,EAGF,KAAa,EAAC,UAAO,SACzB,kBAAC,OAAD;CAAK,SAAQ;CAAY,OAAO;CAAM,QAAQ;CAAM,MAAK;CAAO,eAAY;WAC1E,kBAAC,QAAD;EAAM,GAAE;EAA6B,QAAO;EAAe,aAAY;EAAM,eAAc;EAAU,CAAA;CACjG,CAAA,EAGF,UACJ,kBAAC,OAAD;CAAK,SAAQ;CAAY,OAAM;CAAK,QAAO;CAAK,MAAK;CAAO,eAAY;WACtE,kBAAC,QAAD;EAAM,GAAE;EAAiB,QAAO;EAAe,aAAY;EAAM,eAAc;EAAQ,gBAAe;EAAU,CAAA;CAC5G,CAAA,EAGF,MAAyD,EAAC,aAAU,GAAG,QAAkC;CAC7G,IAAM,EAAC,YAAQ,EAAU,EAAM;CAE/B,OACE,kBAAC,EAAsB,SAAvB;EAA+B,GAAI;YAAnC,CACG,KAAQ,kBAAC,QAAD;GAAM,WAAU;aAAgB;GAAY,CAAA,EACpD,EAC6B;;GAK9B,MAAqE,EACzE,aACA,GAAG,QACoC;CACvC,IAAM,EAAC,OAAI,WAAQ,eAAY,YAAQ,EAAU,EAAM;CAEvD,OACE,kBAAC,EAAsB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js","names":[],"sources":["../src/cn.ts","../src/types.ts","../src/index.tsx"],"sourcesContent":["import {type ClassValue, clsx} from 'clsx';\n\n/**\n * Joins class names. There is no tailwind-merge here on purpose: the select\n * ships its own stylesheet instead of utility classes, so there is nothing to\n * deduplicate.\n */\nconst cn = (...inputs: ClassValue[]): string => clsx(inputs);\n\nexport {cn};\n","import type {ReactNode, Ref} from 'react';\nimport type {GroupBase, SelectInstance, StylesConfig} from 'react-select';\nimport type {AsyncProps} from 'react-select/async';\nimport type {CreatableProps} from 'react-select/creatable';\n\nexport type Option = {\n value: number | string;\n label: ReactNode;\n /** Read by `isOptionDisabled` when the caller passes one. */\n isOptionDisabled?: boolean;\n /** A chosen value the product flags: its chip takes the danger colours. */\n isException?: boolean;\n};\n\nexport type OptionGroup<O = Option> = GroupBase<O>;\n\n/** Which colour the errors are shown in. */\nexport const SelectTone = {\n Danger: 'danger',\n Warning: 'warning',\n} as const;\nexport type SelectTone = (typeof SelectTone)[keyof typeof SelectTone];\n\ntype OwnProps<O, M extends boolean, G extends GroupBase<O>> = {\n /** Names the select, its `!` mark (`error-label-${id}`) and its clear cross (`${id}-clear`). */\n id?: string;\n /** The `!` mark in the field and the red contour. */\n errors?: ReadonlyArray<string>;\n /** Hides the mark and keeps the contour. @default true */\n showErrors?: boolean;\n /** @default 'danger' */\n tone?: SelectTone;\n /** An icon at the start of the field. */\n icon?: ReactNode;\n /** Lets the user add an option that is not in the list. */\n isCreatable?: boolean;\n /** Loads the options with `loadOptions` as the user types. */\n isAsync?: boolean;\n /** Called with the text of a new option. A promise shows the spinner until it settles. */\n onCreateOption?: (inputValue: string) => void | Promise<void>;\n /** What the create row starts with: `Create \"…\"`. @default 'Create ' */\n createOptionPlaceholder?: string;\n /** How many characters an async search waits for; it says so until then. @default 0 */\n minSearchLength?: number;\n /**\n * The option keys a pasted list is matched against. Pasting \"a, b, c\" into a\n * multi select picks every option whose key equals one of the parts.\n * @default ['label']\n */\n searchableKeys?: Array<keyof O>;\n ref?: Ref<SelectInstance<O, M, G>>;\n\n /** @deprecated TagsInput's name for `id`. */\n elementId?: string;\n /** @deprecated TagsInput's name for `showErrors`. */\n isErrorLabelVisible?: boolean;\n /** @deprecated TagsInput's name for `styles`. */\n customStyles?: StylesConfig<O, M, G>;\n /** @deprecated TagsInput's async loader: `loadOptions` with a two-character minimum. */\n promiseOptions?: (inputValue: string) => Promise<ReadonlyArray<O | G>>;\n /** @deprecated TagsInput's chip colour. Set `--select-chip-bg` on an ancestor instead. */\n actionColor?: string;\n /** @deprecated The field grows with its chips. Accepted and ignored. */\n minHeightInput?: number;\n};\n\n/**\n * Every prop of react-select, of its async and creatable flavours, and the\n * library's own. Nothing is dropped on the way to react-select.\n */\nexport type SelectProps<O = Option, M extends boolean = boolean, G extends GroupBase<O> = GroupBase<O>> = Omit<\n Partial<AsyncProps<O, M, G> & CreatableProps<O, M, G>>,\n 'id' | 'onCreateOption'\n> &\n OwnProps<O, M, G>;\n","import ErrorLabel from '@propellerads/error-label';\nimport {\n type ClipboardEvent,\n type CSSProperties,\n type ForwardedRef,\n forwardRef,\n type ReactElement,\n type ReactNode,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\nimport ReactSelect, {\n type ActionMeta,\n type ClassNamesConfig,\n type ClearIndicatorProps,\n type ControlProps,\n type DropdownIndicatorProps,\n type GroupBase,\n type IndicatorsContainerProps,\n type LoadingIndicatorProps,\n type MultiValueRemoveProps,\n type OnChangeValue,\n type OptionProps,\n components as reactSelectComponents,\n type SelectComponentsConfig,\n type SelectInstance,\n type StylesConfig,\n} from 'react-select';\nimport AsyncSelect from 'react-select/async';\nimport AsyncCreatableSelect from 'react-select/async-creatable';\nimport CreatableSelect from 'react-select/creatable';\nimport './select.css';\nimport {cn} from './cn';\nimport {type Option, type OptionGroup, type SelectProps, SelectTone} from './types';\n\n/*\n * react-select, unstyled, with every part given a class from select.css. The\n * behaviour — keyboard, search, async, creatable, multi, portals — is\n * react-select's own, and every prop it takes reaches it. What the library adds\n * rides on `selectProps.library`, so the parts below can stay the same\n * components across renders: a part created inside a render would remount the\n * menu on every keystroke.\n */\n\ntype Library = {\n id: string;\n errors: ReadonlyArray<string>;\n showErrors: boolean;\n tone: SelectTone;\n icon: ReactNode;\n};\n\ntype AnyProps = {selectProps: unknown};\n\nconst libraryOf = (props: AnyProps): Library => (props.selectProps as {library: Library}).library;\n\nconst ChevronIcon = () => (\n <svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M4 6l4 4 4-4\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n);\n\nconst CrossIcon = ({size = 16}: {size?: number}) => (\n <svg viewBox=\"0 0 16 16\" width={size} height={size} fill=\"none\" aria-hidden=\"true\">\n <path d=\"M4.5 4.5l7 7M11.5 4.5l-7 7\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n </svg>\n);\n\nconst CheckIcon = () => (\n <svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M3 8.5l3 3 7-7\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n);\n\nconst Control = <O, M extends boolean, G extends GroupBase<O>>({children, ...props}: ControlProps<O, M, G>) => {\n const {icon} = libraryOf(props);\n\n return (\n <reactSelectComponents.Control {...props}>\n {icon && <span className=\"select__icon\">{icon}</span>}\n {children}\n </reactSelectComponents.Control>\n );\n};\n\n/** The `!` mark stands with the other indicators, before the clear cross and the chevron. */\nconst IndicatorsContainer = <O, M extends boolean, G extends GroupBase<O>>({\n children,\n ...props\n}: IndicatorsContainerProps<O, M, G>) => {\n const {id, errors, showErrors, tone} = libraryOf(props);\n\n return (\n <reactSelectComponents.IndicatorsContainer {...props}>\n {showErrors && errors.length > 0 && (\n // The field opens its menu on mousedown; the mark keeps its own click.\n <span className=\"select__errors\" onMouseDown={(event) => event.stopPropagation()}>\n <ErrorLabel\n elementId={id}\n errors={[...errors]}\n errorColor={tone === SelectTone.Warning ? 'var(--color-warning)' : undefined}\n />\n </span>\n )}\n {children}\n </reactSelectComponents.IndicatorsContainer>\n );\n};\n\nconst DropdownIndicator = <O, M extends boolean, G extends GroupBase<O>>(props: DropdownIndicatorProps<O, M, G>) => (\n <reactSelectComponents.DropdownIndicator {...props}>\n <ChevronIcon />\n </reactSelectComponents.DropdownIndicator>\n);\n\n/** The clear cross keeps TagsInput's `${id}-clear`, which products and tests find it by. */\nconst ClearIndicator = <O, M extends boolean, G extends GroupBase<O>>(props: ClearIndicatorProps<O, M, G>) => {\n const {id} = libraryOf(props);\n\n return (\n <reactSelectComponents.ClearIndicator {...props} innerProps={{...props.innerProps, id: `${id}-clear`}}>\n <CrossIcon />\n </reactSelectComponents.ClearIndicator>\n );\n};\n\nconst MultiValueRemove = <O, M extends boolean, G extends GroupBase<O>>(props: MultiValueRemoveProps<O, M, G>) => (\n <reactSelectComponents.MultiValueRemove {...props}>\n <CrossIcon size={12} />\n </reactSelectComponents.MultiValueRemove>\n);\n\n/** A single select marks the chosen item with a check, as shadcn's does. */\nconst OptionWithCheck = <O, M extends boolean, G extends GroupBase<O>>({children, ...props}: OptionProps<O, M, G>) => (\n <reactSelectComponents.Option {...props}>\n {children}\n {props.isSelected && !props.isMulti && (\n <span className=\"select__option-check\">\n <CheckIcon />\n </span>\n )}\n </reactSelectComponents.Option>\n);\n\nconst LoadingIndicator = <O, M extends boolean, G extends GroupBase<O>>({\n innerProps,\n}: LoadingIndicatorProps<O, M, G>) => (\n <span {...innerProps} className=\"select__indicator select__loading-indicator\" role=\"status\" aria-label=\"Loading\" />\n);\n\n/** The class every part takes. A product's own `classNames` is added after ours. */\nconst partClassNames = <O, M extends boolean, G extends GroupBase<O>>(\n own: ClassNamesConfig<O, M, G> = {},\n): ClassNamesConfig<O, M, G> => {\n const ours: ClassNamesConfig<O, M, G> = {\n control: (state) =>\n cn(\n 'select__control',\n state.isFocused && 'select__control--focused',\n state.isDisabled && 'select__control--disabled',\n state.menuIsOpen && 'select__control--menu-is-open',\n ),\n valueContainer: (state) =>\n cn(\n 'select__value-container',\n state.isMulti && 'select__value-container--is-multi',\n state.hasValue && 'select__value-container--has-value',\n ),\n placeholder: () => 'select__placeholder',\n singleValue: () => 'select__single-value',\n input: () => 'select__input-container',\n indicatorsContainer: () => 'select__indicators',\n indicatorSeparator: () => 'select__indicator-separator',\n dropdownIndicator: () => 'select__indicator select__dropdown-indicator',\n clearIndicator: () => 'select__indicator select__clear-indicator',\n loadingIndicator: () => 'select__indicator select__loading-indicator',\n multiValue: (state) =>\n cn('select__multi-value', (state.data as Option).isException && 'select__multi-value--exception'),\n multiValueLabel: () => 'select__multi-value-label',\n multiValueRemove: () => 'select__multi-value-remove',\n menu: (state) => cn('select__menu', state.placement === 'top' && 'select__menu--top'),\n menuPortal: () => 'select__menu-portal',\n menuList: () => 'select__menu-list',\n option: (state) =>\n cn(\n 'select__option',\n state.isFocused && 'select__option--focused',\n state.isSelected && 'select__option--selected',\n state.isDisabled && 'select__option--disabled',\n ),\n group: () => 'select__group',\n groupHeading: () => 'select__group-heading',\n noOptionsMessage: () => 'select__menu-notice',\n loadingMessage: () => 'select__menu-notice',\n };\n\n const merged: ClassNamesConfig<O, M, G> = {...ours};\n\n for (const key of Object.keys(own) as Array<keyof ClassNamesConfig<O, M, G>>) {\n const mine = ours[key] as ((state: unknown) => string) | undefined;\n const theirs = own[key] as ((state: unknown) => string) | undefined;\n (merged as Record<string, (state: unknown) => string>)[key] = (state) => cn(mine?.(state), theirs?.(state));\n }\n\n return merged;\n};\n\nconst DEFAULT_KEYS = ['label'];\n\n/** The parts of a pasted list, split the way TagsInput did: by lines, by \", \", by \",\", or by spaces. */\nconst splitPasted = (text: string): string[] => {\n for (const separator of [/\\n+/, /,\\s/, /,+/]) {\n const parts = text.split(separator);\n if (parts.length > 1) {\n return parts;\n }\n }\n\n return text.split(/\\s+/);\n};\n\nconst flatten = <O, G extends GroupBase<O>>(options: ReadonlyArray<O | G>): O[] =>\n options.flatMap((item) =>\n item && typeof item === 'object' && 'options' in item ? [...(item as G).options] : [item as O],\n );\n\n/**\n * A select on react-select with the library's look: one field for a single\n * value, several as chips, a list that loads as the user types, and new values\n * the user creates. Every react-select prop is accepted and passed on.\n */\nconst SelectInner = <O = Option, M extends boolean = false, G extends GroupBase<O> = OptionGroup<O>>(\n props: SelectProps<O, M, G>,\n ref: ForwardedRef<SelectInstance<O, M, G>>,\n) => {\n const {\n id: idProp,\n elementId,\n errors = [],\n showErrors,\n isErrorLabelVisible,\n tone = SelectTone.Danger,\n icon = null,\n isCreatable = false,\n isAsync = false,\n onCreateOption,\n createOptionPlaceholder = 'Create ',\n minSearchLength,\n searchableKeys = DEFAULT_KEYS as Array<keyof O>,\n promiseOptions,\n customStyles,\n actionColor,\n minHeightInput: _minHeightInput,\n styles,\n classNames,\n components,\n className,\n isMulti,\n isDisabled = false,\n isLoading,\n isSearchable,\n isOptionDisabled,\n placeholder = 'Select',\n menuPlacement = 'auto',\n loadOptions,\n noOptionsMessage,\n formatCreateLabel,\n options,\n value,\n onChange,\n ...rest\n } = props;\n\n const fallbackId = useId();\n const id = idProp ?? elementId ?? fallbackId;\n const isInvalid = errors.length > 0;\n\n const [isCreating, setCreating] = useState(false);\n const isMounted = useRef(true);\n const selectRef = useRef<SelectInstance<O, M, G> | null>(null);\n\n useEffect(\n () => () => {\n isMounted.current = false;\n },\n [],\n );\n\n const setRef = (instance: SelectInstance<O, M, G> | null): void => {\n selectRef.current = instance;\n if (typeof ref === 'function') {\n ref(instance);\n } else if (ref) {\n ref.current = instance;\n }\n };\n\n // TagsInput waited for two characters before it asked the server.\n const minimum = minSearchLength ?? (promiseOptions ? 2 : 0);\n const loader = loadOptions ?? promiseOptions;\n\n const handleCreateOption = async (inputValue: string): Promise<void> => {\n if (!onCreateOption) {\n return;\n }\n\n try {\n setCreating(true);\n await onCreateOption(inputValue);\n } finally {\n if (isMounted.current) {\n setCreating(false);\n }\n }\n };\n\n // Pasting a list into a multi select picks the options it names.\n const handlePaste = (event: ClipboardEvent<HTMLDivElement>): void => {\n if (!isMulti || !options || !onChange) {\n return;\n }\n\n const parts = splitPasted(event.clipboardData.getData('text/plain'))\n .map((part) => part.trim().toLowerCase())\n .filter(Boolean);\n\n if (parts.length < 2) {\n return;\n }\n\n const found = flatten<O, G>(options).filter((option) =>\n searchableKeys.some((key: keyof O) => parts.includes(String(option[key]).toLowerCase())),\n );\n\n if (found.length === 0) {\n return;\n }\n\n const current = (Array.isArray(value) ? value : []) as O[];\n const next = [...current, ...found.filter((option) => !current.includes(option))];\n\n event.preventDefault();\n onChange(next as unknown as OnChangeValue<O, M>, {action: 'select-option', option: found[0]} as ActionMeta<O>);\n setTimeout(() => selectRef.current?.blur(), 0);\n };\n\n const library: Library = {\n id,\n errors,\n showErrors: showErrors ?? isErrorLabelVisible ?? true,\n tone,\n icon,\n };\n\n const parts: Partial<SelectComponentsConfig<O, M, G>> = {\n Control,\n IndicatorsContainer,\n IndicatorSeparator: null,\n DropdownIndicator,\n ClearIndicator,\n MultiValueRemove,\n Option: OptionWithCheck,\n LoadingIndicator,\n ...components,\n };\n\n const selectProps = {\n ...rest,\n id,\n library,\n unstyled: true,\n options,\n value,\n onChange,\n isMulti,\n placeholder,\n menuPlacement,\n // v5 of the single select was not searchable by default; TagsInput was.\n isSearchable: isSearchable ?? Boolean(isMulti),\n // v5 of the single select ignored `isDisabled` on options unless told otherwise.\n isOptionDisabled: isOptionDisabled ?? (isMulti ? undefined : () => false),\n isDisabled: isDisabled || isCreating,\n isLoading: isLoading || isCreating,\n styles: {...customStyles, ...styles} as StylesConfig<O, M, G>,\n classNames: partClassNames(classNames),\n components: parts,\n noOptionsMessage: (input: {inputValue: string}) =>\n input.inputValue.length < minimum\n ? `Enter ${minimum} or more characters`\n : (noOptionsMessage?.(input) ?? 'No options'),\n ref: setRef,\n };\n\n const creatableProps = {\n formatCreateLabel: formatCreateLabel ?? ((inputValue: string) => `${createOptionPlaceholder}\"${inputValue}\"`),\n ...(onCreateOption && {onCreateOption: handleCreateOption}),\n };\n\n const asyncProps = {\n loadOptions: (inputValue: string, callback: (options: ReadonlyArray<O | G>) => void) => {\n if (inputValue.length < minimum || !loader) {\n callback([]);\n return undefined;\n }\n\n return loader(inputValue, callback);\n },\n };\n\n // The four flavours of react-select share one set of props; the casts only\n // tell TypeScript which flavour it is looking at.\n const field = (() => {\n if (isAsync && isCreatable) {\n return <AsyncCreatableSelect {...(selectProps as object)} {...creatableProps} {...asyncProps} />;\n }\n if (isAsync) {\n return <AsyncSelect {...(selectProps as object)} {...asyncProps} />;\n }\n if (isCreatable) {\n return <CreatableSelect {...(selectProps as object)} {...creatableProps} />;\n }\n return <ReactSelect {...(selectProps as object)} />;\n })();\n\n const style = actionColor\n ? ({'--select-chip-bg': actionColor, '--select-chip-text': 'var(--color-light)'} as CSSProperties)\n : undefined;\n\n return (\n <div\n className={cn(\n 'select',\n isInvalid && 'select--invalid',\n tone === SelectTone.Warning && 'select--warning',\n className,\n )}\n data-is-disabled={isDisabled}\n style={style}\n onPaste={handlePaste}\n >\n {field}\n </div>\n );\n};\n\n// `forwardRef` does not keep the generics, so the type is written out by hand.\nconst Select = forwardRef(SelectInner) as unknown as (<\n O = Option,\n M extends boolean = false,\n G extends GroupBase<O> = OptionGroup<O>,\n>(\n props: SelectProps<O, M, G>,\n) => ReactElement) & {displayName?: string};\nSelect.displayName = 'Select';\n\nexport default Select;\n\nexport type {Option, OptionGroup, SelectProps};\nexport {reactSelectComponents as components, Select, SelectTone};\n"],"mappings":";;;;;;;;;AAOA,IAAM,KAAM,GAAG,MAAiC,EAAK,EAAO,ECU/C,IAAa;CACxB,QAAQ;CACR,SAAS;CACV,ECoCK,KAAa,MAA8B,EAAM,YAAmC,SAEpF,UACJ,kBAAC,OAAD;CAAK,SAAQ;CAAY,OAAM;CAAK,QAAO;CAAK,MAA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BAAmB,MACjB,EAAM,WAAW,SAAS,IACtB,SAAS,EAAQ,uBAChB,IAAmB,EAAM,IAAI;EACpC,KAAK;EACN,EAEK,IAAiB;EACrB,mBAAmB,OAAuB,MAAuB,GAAG,GAAwB,GAAG,EAAW;EAC1G,GAAI,KAAkB,EAAC,gBAAgB,IAAmB;EAC3D,EAEK,IAAa,EACjB,cAAc,GAAoB,MAAsD;EACtF,IAAI,EAAW,SAAS,KAAW,CAAC,GAAQ;GAC1C,EAAS,EAAE,CAAC;GACZ;;EAGF,OAAO,EAAO,GAAY,EAAS;IAEtC,EAIK,KACA,KAAW,IACN,kBAAC,IAAD;EAAsB,GAAK;EAAwB,GAAI;EAAgB,GAAI;EAAc,CAAA,GAE9F,IACK,kBAAC,IAAD;EAAa,GAAK;EAAwB,GAAI;EAAc,CAAA,GAEjE,IACK,kBAAC,GAAD;EAAiB,GAAK;EAAwB,GAAI;EAAkB,CAAA,GAEtE,kBAAC,GAAD,EAAa,GAAK,GAA0B,CAAA,EAG/C,KAAQ,IACT;EAAC,oBAAoB;EAAa,sBAAsB;EAAqB,GAC9E,KAAA;CAEJ,OACE,kBAAC,OAAD;EACE,WAAW,EACT,UACA,MAAa,mBACb,MAAS,EAAW,WAAW,mBAC/B,EACD;EACD,oBAAkB;EACX;EACP,SAAS;YAER;EACG,CAAA;EAK4B;AAOtC,EAAO,cAAc"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@propellerads/select",
3
- "version": "6.0.1",
3
+ "version": "7.0.0",
4
4
  "type": "module",
5
5
  "types": "dist/index.d.ts",
6
6
  "style": "dist/index.css",
@@ -29,12 +29,12 @@
29
29
  "homepage": "https://github.com/propellerads/ui-components#readme",
30
30
  "private": false,
31
31
  "dependencies": {
32
- "@propellerads/error-label": "^6.0.0",
32
+ "@propellerads/error-label": "^7.0.0",
33
33
  "clsx": "^2.1.1",
34
34
  "react-select": "^5.10.2"
35
35
  },
36
36
  "peerDependencies": {
37
- "@propellerads/tokens": ">=0.2.0",
37
+ "@propellerads/tokens": ">=0.3.0",
38
38
  "react": "^18.0.0 || ^19.0.0",
39
39
  "react-dom": "^18.0.0 || ^19.0.0"
40
40
  },
@@ -50,7 +50,7 @@
50
50
  "rollup": "^4.60.3",
51
51
  "rollup-plugin-dts": "^6.4.1",
52
52
  "typescript": "^6.0.3",
53
- "vite": "^8.0.10",
53
+ "vite": "^8.0.11",
54
54
  "vite-plugin-lib-inject-css": "^2.2.2"
55
55
  }
56
56
  }