@pibit.ai/cure-design-system 0.5.4 → 0.5.7

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,27 +1,27 @@
1
1
  import { jsx as c } from "react/jsx-runtime";
2
- import { useState as F, useRef as E, useEffect as p, useCallback as h } from "react";
2
+ import { useState as F, useRef as K, useEffect as p, useCallback as h } from "react";
3
3
  import { SearchMd as T } from "@untitledui/icons";
4
- import { ButtonUtility as _ } from "../button/button-utility.js";
5
- import j from "./SearchInput.js";
6
- import { cx as K } from "../../utils/cn.js";
4
+ import { ButtonUtility as j } from "../button/button-utility.js";
5
+ import G from "./SearchInput.js";
6
+ import { cx as v } from "../../utils/cn.js";
7
7
  import { motion as x } from "../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
8
- import { AnimatePresence as G } from "../../node_modules/framer-motion/dist/es/components/AnimatePresence/index.js";
9
- const M = { sm: 36, md: 40, lg: 44 }, U = 300, Z = ({
8
+ import { AnimatePresence as M } from "../../node_modules/framer-motion/dist/es/components/AnimatePresence/index.js";
9
+ const U = { xs: 32, sm: 36, md: 40, lg: 44 }, V = 300, _ = ({
10
10
  size: w = "sm",
11
11
  placeholder: S,
12
12
  value: u,
13
13
  onChange: C,
14
14
  onBlur: f,
15
- onFocus: L,
15
+ onFocus: N,
16
16
  onKeyDown: d,
17
- className: N,
18
- expandedWidth: q = U,
17
+ className: L,
18
+ expandedWidth: q = V,
19
19
  "aria-label": g,
20
20
  collapsible: r = !0,
21
21
  shortcut: y = !1,
22
22
  isDisabled: m = !1
23
23
  }) => {
24
- const i = !!(u != null && u.trim()), [I, a] = F(r ? i : !0), o = !r || I, s = E(null), l = E(r), A = M[w];
24
+ const i = !!(u != null && u.trim()), [I, a] = F(r ? i : !0), o = !r || I, s = K(null), l = K(r), A = U[w];
25
25
  p(() => {
26
26
  const t = l.current === !1;
27
27
  l.current = r, !r || i ? a(!0) : t && r && a(!1);
@@ -49,12 +49,12 @@ const M = { sm: 36, md: 40, lg: 44 }, U = 300, Z = ({
49
49
  [f, i, r]
50
50
  ), R = h(
51
51
  (t) => {
52
- var n, v;
52
+ var n, E;
53
53
  if ((t.metaKey || t.ctrlKey) && !t.shiftKey && !t.altKey && t.key.toLowerCase() === "k") {
54
54
  t.preventDefault(), t.stopPropagation();
55
55
  return;
56
56
  }
57
- t.key === "Escape" && r && !i && (a(!1), (v = (n = s.current) == null ? void 0 : n.querySelector("button")) == null || v.focus()), d == null || d(t);
57
+ t.key === "Escape" && r && !i && (a(!1), (E = (n = s.current) == null ? void 0 : n.querySelector("button")) == null || E.focus()), d == null || d(t);
58
58
  },
59
59
  [d, i, r]
60
60
  ), k = h(() => {
@@ -70,18 +70,20 @@ const M = { sm: 36, md: 40, lg: 44 }, U = 300, Z = ({
70
70
  const t = (e) => {
71
71
  (e.metaKey || e.ctrlKey) && !e.shiftKey && !e.altKey && e.key.toLowerCase() === "k" && (e.preventDefault(), e.stopPropagation(), k());
72
72
  };
73
- return window.addEventListener("keydown", t, { capture: !0 }), () => window.removeEventListener("keydown", t, { capture: !0 });
73
+ return window.addEventListener("keydown", t, { capture: !0 }), () => window.removeEventListener("keydown", t, {
74
+ capture: !0
75
+ });
74
76
  }, [y, m, k]);
75
77
  const W = { type: "spring", damping: 25, stiffness: 300 };
76
78
  return /* @__PURE__ */ c(
77
79
  x.div,
78
80
  {
79
81
  ref: s,
80
- className: K("flex items-center overflow-hidden", N),
82
+ className: v("flex items-center overflow-hidden", L),
81
83
  onBlur: P,
82
84
  animate: { width: o ? q : A },
83
85
  transition: W,
84
- children: /* @__PURE__ */ c(G, { initial: !1, mode: "popLayout", children: o ? /* @__PURE__ */ c(
86
+ children: /* @__PURE__ */ c(M, { initial: !1, mode: "popLayout", children: o ? /* @__PURE__ */ c(
85
87
  x.div,
86
88
  {
87
89
  initial: { opacity: 0 },
@@ -90,20 +92,20 @@ const M = { sm: 36, md: 40, lg: 44 }, U = 300, Z = ({
90
92
  transition: { duration: 0.08 },
91
93
  className: "min-w-0 flex-1",
92
94
  children: /* @__PURE__ */ c(
93
- j,
95
+ G,
94
96
  {
95
97
  size: w,
96
98
  placeholder: S,
97
99
  value: u,
98
100
  onChange: C,
99
- onFocus: L,
101
+ onFocus: N,
100
102
  onKeyDown: R,
101
103
  className: "w-full min-w-0",
102
104
  "aria-label": g,
103
105
  shortcut: y,
104
106
  registerShortcut: !1,
105
107
  isDisabled: m,
106
- bordered: !0
108
+ innerClassName: "border border-secondary rounded-lg"
107
109
  }
108
110
  )
109
111
  },
@@ -117,16 +119,14 @@ const M = { sm: 36, md: 40, lg: 44 }, U = 300, Z = ({
117
119
  transition: { duration: 0.08 },
118
120
  className: "flex flex-shrink-0",
119
121
  children: /* @__PURE__ */ c(
120
- _,
122
+ j,
121
123
  {
122
124
  icon: T,
123
125
  size: "xs",
124
126
  color: "tertiary",
125
127
  isDisabled: m,
126
128
  tooltip: g || S || "Search",
127
- className: K(
128
- i && "bg-brand_subtle text-brand-500 hover:text-brand-600 hover:bg-brand_subtle/80"
129
- ),
129
+ className: v(i && "text-brand-500 hover:text-brand-600"),
130
130
  onClick: () => a(!0)
131
131
  }
132
132
  )
@@ -137,5 +137,5 @@ const M = { sm: 36, md: 40, lg: 44 }, U = 300, Z = ({
137
137
  );
138
138
  };
139
139
  export {
140
- Z as ExpandableSearchInput
140
+ _ as ExpandableSearchInput
141
141
  };
@@ -4,7 +4,7 @@ export interface SearchInputProps {
4
4
  hint?: string;
5
5
  tooltip?: string;
6
6
  placeholder?: string;
7
- size?: "sm" | "md" | "lg";
7
+ size?: "xs" | "sm" | "md" | "lg";
8
8
  value?: string;
9
9
  onChange?: (value: string) => void;
10
10
  onBlur?: FocusEventHandler;
@@ -18,6 +18,19 @@ export interface SearchInputProps {
18
18
  * (dropdowns, filter bars) keep the borderless look and avoid double borders.
19
19
  */
20
20
  bordered?: boolean;
21
+ /**
22
+ * Class applied to the field itself rather than the ComboBox wrapper. It lands
23
+ * after the size classes, so a caller can override the rounding — which is how
24
+ * platform-ui's expandable search gets its `lg` corners.
25
+ */
26
+ innerClassName?: string;
27
+ /**
28
+ * When true, focuses the input after mount, deferred via a double rAF so it
29
+ * wins races with modal focus traps. Do not pass this through to the
30
+ * underlying `<input autoFocus>`: React's built-in fires synchronously and
31
+ * loses when the field mounts inside a just-opened modal.
32
+ */
33
+ autoFocus?: boolean;
21
34
  /** When true, shows the platform-specific primary keyboard shortcut hint (⌘K on Apple platforms, Ctrl+K elsewhere). */
22
35
  shortcut?: boolean;
23
36
  /** When true, registers the platform-specific primary shortcut to focus the input. Defaults to `shortcut`. */
@@ -26,5 +39,5 @@ export interface SearchInputProps {
26
39
  className?: string;
27
40
  "aria-label"?: string;
28
41
  }
29
- export default function SearchInput({ size, shortcut, registerShortcut, bordered, placeholder, shortcutClassName, value, onChange, onKeyDown, className, isDisabled, "aria-label": ariaLabel, ...props }: SearchInputProps): import("react/jsx-runtime").JSX.Element;
42
+ export default function SearchInput({ size, shortcut, registerShortcut, bordered, innerClassName, autoFocus, placeholder, shortcutClassName, value, onChange, onKeyDown, className, isDisabled, "aria-label": ariaLabel, ...props }: SearchInputProps): import("react/jsx-runtime").JSX.Element;
30
43
  //# sourceMappingURL=SearchInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SearchInput.d.ts","sourceRoot":"","sources":["../../../src/primitives/select/SearchInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAC1B,MAAM,OAAO,CAAC;AAYf,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EA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M,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uHAAuH;IACvH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8GAA8G;IAC9G,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAyGD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,IAAW,EACX,QAAgB,EAChB,gBAAgB,EAChB,QAAgB,EAChB,cAAc,EACd,SAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,KAAK,EACL,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAkB,EAClB,YAAY,EAAE,SAAS,EACvB,GAAG,KAAK,EACT,EAAE,gBAAgB,2CAuGlB"}
@@ -1,161 +1,175 @@
1
- import { jsx as a, jsxs as x, Fragment as C } from "react/jsx-runtime";
2
- import { useRef as I, useCallback as h, useEffect as L, useMemo as E } from "react";
3
- import { SearchMd as P, XClose as z } from "@untitledui/icons";
4
- import { ComboBox as R, Group as _, Input as j } from "react-aria-components";
5
- import { cx as u } from "../../utils/cn.js";
6
- import { getPlatformShortcutLabel as q } from "../../utils/keyboard-shortcut.js";
7
- import { sizes as w } from "./select.js";
8
- import { ButtonUtility as B } from "../button/button-utility.js";
9
- const G = {
1
+ import { jsx as r, jsxs as F, Fragment as z } from "react/jsx-runtime";
2
+ import { useRef as L, useCallback as b, useEffect as k, useMemo as q } from "react";
3
+ import { SearchMd as A, XClose as E } from "@untitledui/icons";
4
+ import { ComboBox as P, Group as R, Input as j } from "react-aria-components";
5
+ import { cx as i } from "../../utils/cn.js";
6
+ import { getPlatformShortcutLabel as B } from "../../utils/keyboard-shortcut.js";
7
+ import { sizes as g } from "./select.js";
8
+ import { ButtonUtility as G } from "../button/button-utility.js";
9
+ const M = {
10
+ xs: "h-7",
10
11
  sm: "h-8",
11
12
  md: "h-9",
12
13
  lg: "h-11"
13
- }, M = ({
14
- size: s,
15
- shortcut: i,
16
- bordered: p = !1,
17
- placeholder: m,
18
- shortcutClassName: d,
19
- onKeyDown: f,
20
- onClear: o,
21
- hasValue: r,
22
- className: l
23
- }) => /* @__PURE__ */ a(
24
- _,
25
- {
26
- className: ({ isFocusWithin: n, isDisabled: c }) => u(
27
- "relative flex w-full items-center gap-2 rounded-md bg-primary outline-hidden transition-shadow duration-100 ease-linear ring-inset",
28
- p && "border border-secondary",
29
- c && "cursor-not-allowed bg-disabled_subtle",
30
- n && "ring-1 ring-brand",
31
- G[s],
32
- w[s].root,
33
- l
34
- ),
35
- children: ({ isDisabled: n }) => /* @__PURE__ */ x(C, { children: [
36
- /* @__PURE__ */ a(
37
- P,
38
- {
39
- color: "var(--color-utility-gray-300)",
40
- className: "pointer-events-none size-4 flex-shrink-0"
41
- }
14
+ }, _ = ({
15
+ size: u,
16
+ shortcut: l,
17
+ bordered: h = !1,
18
+ placeholder: y,
19
+ shortcutClassName: x,
20
+ onKeyDown: d,
21
+ onClear: m,
22
+ hasValue: o,
23
+ className: s
24
+ }) => {
25
+ const n = g[u] ? u : "sm";
26
+ return /* @__PURE__ */ r(
27
+ R,
28
+ {
29
+ className: ({ isFocusWithin: a, isDisabled: p }) => i(
30
+ "relative flex w-full items-center gap-2 rounded-md bg-primary outline-hidden transition-shadow duration-100 ease-linear ring-inset",
31
+ h && "border border-secondary",
32
+ p && "cursor-not-allowed bg-disabled_subtle",
33
+ a && "ring-1 ring-brand",
34
+ M[n],
35
+ g[n].root,
36
+ s
42
37
  ),
43
- /* @__PURE__ */ a("div", { className: "relative flex w-full items-center gap-2", children: /* @__PURE__ */ a(
44
- j,
45
- {
46
- placeholder: m,
47
- onKeyDown: f,
48
- className: u(
49
- "z-10 w-full appearance-none bg-transparent text-sm text-primary caret-alpha-black/90 placeholder:text-placeholder_subtle focus:outline-hidden disabled:cursor-not-allowed disabled:text-disabled disabled:placeholder:text-disabled",
50
- r && "pr-6",
51
- i && !r && "pr-12"
52
- )
53
- }
54
- ) }),
55
- /* @__PURE__ */ x("div", { className: "flex-shrink-0", children: [
56
- r && !n && /* @__PURE__ */ a(
57
- B,
38
+ children: ({ isDisabled: a }) => /* @__PURE__ */ F(z, { children: [
39
+ /* @__PURE__ */ r(
40
+ A,
41
+ {
42
+ color: "var(--color-utility-gray-300)",
43
+ className: "pointer-events-none size-4 flex-shrink-0"
44
+ }
45
+ ),
46
+ /* @__PURE__ */ r("div", { className: "relative flex w-full items-center gap-2", children: /* @__PURE__ */ r(
47
+ j,
58
48
  {
59
- icon: /* @__PURE__ */ a(z, { size: 14 }),
49
+ placeholder: y,
50
+ onKeyDown: d,
51
+ className: i(
52
+ "z-10 w-full appearance-none bg-transparent text-xs text-primary caret-alpha-black/90 placeholder:text-placeholder_subtle focus:outline-hidden disabled:cursor-not-allowed disabled:text-disabled disabled:placeholder:text-disabled",
53
+ o && "pr-6",
54
+ l && !o && "pr-12"
55
+ )
56
+ }
57
+ ) }),
58
+ /* @__PURE__ */ r("div", { className: "flex-shrink-0", children: o && !a && /* @__PURE__ */ r(
59
+ G,
60
+ {
61
+ icon: /* @__PURE__ */ r(E, { size: 14 }),
60
62
  color: "tertiary",
61
- onClick: o,
63
+ onClick: m,
62
64
  "aria-label": "Clear search"
63
65
  }
64
- ),
65
- i && !r && /* @__PURE__ */ a(
66
+ ) }),
67
+ l && !o && /* @__PURE__ */ r(
66
68
  "div",
67
69
  {
68
- className: u(
70
+ className: i(
69
71
  "pointer-events-none absolute inset-y-0.5 right-0.5 z-10 flex items-center rounded-r-[inherit] bg-linear-to-r from-transparent pl-8",
70
- n && "to-bg-disabled_subtle",
71
- w[s].shortcut,
72
- d
72
+ g[n].shortcut,
73
+ x
73
74
  ),
74
- children: /* @__PURE__ */ a(
75
+ children: /* @__PURE__ */ r(
75
76
  "span",
76
77
  {
77
- className: u(
78
+ className: i(
78
79
  "pointer-events-none rounded px-1 py-px text-xs font-medium text-quaternary ring-1 ring-secondary select-none ring-inset",
79
- n && "bg-transparent text-disabled"
80
+ a && "bg-transparent text-disabled"
80
81
  ),
81
82
  "aria-hidden": "true",
82
- children: q(["meta"], "K")
83
+ children: B(["meta"], "K")
83
84
  }
84
85
  )
85
86
  }
86
87
  )
87
88
  ] })
88
- ] })
89
- }
90
- );
91
- function Q({
92
- size: s = "sm",
93
- shortcut: i = !1,
94
- registerShortcut: p,
95
- bordered: m = !1,
96
- placeholder: d,
97
- shortcutClassName: f,
98
- value: o,
99
- onChange: r,
100
- onKeyDown: l,
101
- className: n,
89
+ }
90
+ );
91
+ };
92
+ function Y({
93
+ size: u = "sm",
94
+ shortcut: l = !1,
95
+ registerShortcut: h,
96
+ bordered: y = !1,
97
+ innerClassName: x,
98
+ autoFocus: d = !1,
99
+ placeholder: m,
100
+ shortcutClassName: o,
101
+ value: s,
102
+ onChange: n,
103
+ onKeyDown: a,
104
+ className: p,
102
105
  isDisabled: c = !1,
103
- "aria-label": k,
104
- ...v
106
+ "aria-label": v,
107
+ ...K
105
108
  }) {
106
- const y = I(null), b = p ?? i, g = h(() => {
109
+ const w = L(null), S = h ?? l, f = b(() => {
107
110
  var e, t;
108
- (t = (e = y.current) == null ? void 0 : e.querySelector("input")) == null || t.focus();
111
+ (t = (e = w.current) == null ? void 0 : e.querySelector("input")) == null || t.focus();
109
112
  }, []);
110
- L(() => {
111
- if (!b || c) return;
113
+ k(() => {
114
+ if (!d || c) return;
115
+ let e = 0;
116
+ const t = requestAnimationFrame(() => {
117
+ e = requestAnimationFrame(() => f());
118
+ });
119
+ return () => {
120
+ cancelAnimationFrame(t), cancelAnimationFrame(e);
121
+ };
122
+ }, [d, c, f]), k(() => {
123
+ if (!S || c) return;
112
124
  const e = (t) => {
113
- (t.metaKey || t.ctrlKey) && !t.shiftKey && !t.altKey && t.key.toLowerCase() === "k" && (t.preventDefault(), t.stopPropagation(), g());
125
+ (t.metaKey || t.ctrlKey) && !t.shiftKey && !t.altKey && t.key.toLowerCase() === "k" && (t.preventDefault(), t.stopPropagation(), f());
114
126
  };
115
- return window.addEventListener("keydown", e, { capture: !0 }), () => window.removeEventListener("keydown", e, { capture: !0 });
116
- }, [b, c, g]);
117
- const S = h(
127
+ return window.addEventListener("keydown", e, { capture: !0 }), () => window.removeEventListener("keydown", e, {
128
+ capture: !0
129
+ });
130
+ }, [S, c, f]);
131
+ const N = b(
118
132
  (e) => {
119
133
  if ((e.metaKey || e.ctrlKey) && !e.shiftKey && !e.altKey && e.key.toLowerCase() === "k") {
120
134
  e.preventDefault(), e.stopPropagation();
121
135
  return;
122
136
  }
123
- e.key === "Enter" && (e.preventDefault(), e.stopPropagation()), l == null || l(e);
137
+ e.key === "Enter" && (e.preventDefault(), e.stopPropagation()), a == null || a(e);
124
138
  },
125
- [l]
126
- ), K = h(() => {
127
- r == null || r("");
128
- }, [r]), N = E(() => !!o && o.length > 0, [o]);
129
- return /* @__PURE__ */ a(
130
- R,
139
+ [a]
140
+ ), I = b(() => {
141
+ n == null || n("");
142
+ }, [n]), C = q(() => !!s && s.length > 0, [s]);
143
+ return /* @__PURE__ */ r(
144
+ P,
131
145
  {
132
- ...v,
133
- ref: y,
134
- inputValue: o,
135
- onInputChange: r,
146
+ ...K,
147
+ ref: w,
148
+ inputValue: s,
149
+ onInputChange: n,
136
150
  menuTrigger: "manual",
137
151
  items: [],
138
152
  allowsCustomValue: !0,
139
153
  isDisabled: c,
140
- "aria-label": k || d || "Search",
141
- className: u("w-xs", n),
142
- children: () => /* @__PURE__ */ a(
143
- M,
154
+ "aria-label": v || m || "Search",
155
+ className: i("w-xs", p),
156
+ children: () => /* @__PURE__ */ r(
157
+ _,
144
158
  {
145
- size: s,
146
- shortcut: i,
147
- bordered: m,
148
- placeholder: d,
149
- shortcutClassName: f,
150
- onKeyDown: S,
151
- onClear: K,
152
- hasValue: N,
153
- className: n
159
+ size: u,
160
+ shortcut: l,
161
+ bordered: y,
162
+ placeholder: m,
163
+ shortcutClassName: o,
164
+ onKeyDown: N,
165
+ onClear: I,
166
+ hasValue: C,
167
+ className: i(p, x)
154
168
  }
155
169
  )
156
170
  }
157
171
  );
158
172
  }
159
173
  export {
160
- Q as default
174
+ Y as default
161
175
  };
@@ -2,6 +2,7 @@ export { Select, type SelectProps } from './select';
2
2
  export { SelectItem, type SelectItemProps } from './select-item';
3
3
  export { SearchableSelect, type SearchableSelectProps, } from './searchable-select';
4
4
  export { MultiSelect, type MultiSelectProps } from './multi-select';
5
+ export { default as SearchInput, type SearchInputProps } from './SearchInput';
5
6
  export { Popover, type PopoverProps } from './popover';
6
7
  export { ExpandableSearchInput, type ExpandableSearchInputProps, } from './ExpandableSearchInput';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/select/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,GAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/select/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,GAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIpE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,yBAAyB,CAAC"}
@@ -32,6 +32,10 @@ export interface SelectProps extends Omit<AriaSelectProps<SelectItemType>, "chil
32
32
  isDeselectable?: boolean;
33
33
  }
34
34
  export declare const sizes: {
35
+ xs: {
36
+ root: string;
37
+ shortcut: string;
38
+ };
35
39
  sm: {
36
40
  root: string;
37
41
  shortcut: string;
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/primitives/select/select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAO,aAAa,EAAE,MAAM,OAAO,CAAC;AAG/D,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAUjF,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe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,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,WACf,SACE,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,EAC3D,aAAa,CAAC,cAAc,CAAC,EAC7B,WAAW;IACb,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC;IACjC,QAAQ,EAAE,SAAS,GAAG,CAAC,CAAC,IAAI,EAAE,cAAc,KAAK,SAAS,CAAC,CAAC;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uHAAuH;IACvH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2GAA2G;IAC3G,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAiBD,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;CAOjB,CAAC;AAQF,eAAO,MAAM,SAAS;;;;CAIrB,CAAC;AA4IF,eAAO,MAAM,aAAa;UAClB,IAAI,GAAG,IAAI,GAAG,IAAI;qBACP,OAAO;kBACV,GAAG,GAAG,IAAI;wBACJ,MAAM,IAAI;EACd,CAAC;AAEnB,QAAA,MAAM,MAAM,GAAI,yJAeb,WAAW,4CA0Gb,CAAC;AAEF,QAAA,MAAM,OAAO,EAAa,OAAO,MAAM,GAAG;IACxC,QAAQ,EAAE,OAAO,QAAQ,CAAC;IAC1B,IAAI,EAAE,OAAO,UAAU,CAAC;IACxB,UAAU,EAAE,OAAO,gBAAgB,CAAC;CACrC,CAAC;AAKF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC"}
@@ -12,6 +12,9 @@ import { SearchableSelect as X } from "./searchable-select.js";
12
12
  import { cx as i } from "../../utils/cn.js";
13
13
  import { isReactComponent as G } from "../../utils/is-react-component.js";
14
14
  const J = {
15
+ // xs exists because platform-ui's search fields use it. Select itself does not
16
+ // offer it yet; the map is shared with SearchInput, which does.
17
+ xs: { root: "py-1 px-2 h-7", shortcut: "pr-1.5" },
15
18
  sm: { root: "py-1.5 px-2 h-8", shortcut: "pr-2" },
16
19
  md: { root: "py-1.5 px-3 h-9", shortcut: "pr-2.5" },
17
20
  lg: { root: "py-2.5 px-3.5 h-11", shortcut: "pr-3" }
@@ -36,11 +39,11 @@ const J = {
36
39
  isFocused: B,
37
40
  isDisabled: c,
38
41
  size: n,
39
- placeholder: u,
40
- placeholderIcon: p,
42
+ placeholder: m,
43
+ placeholderIcon: f,
41
44
  ref: x,
42
45
  textStyles: I,
43
- showChevron: f = !0,
46
+ showChevron: p = !0,
44
47
  isClearable: N = !1,
45
48
  onClear: a,
46
49
  selectedItem: h
@@ -65,10 +68,10 @@ const J = {
65
68
  J[n].root
66
69
  ),
67
70
  children: (r) => {
68
- var o, m, s, v, S;
69
- const t = ((o = r.selectedItem) == null ? void 0 : o.icon) || p;
71
+ var o, u, s, v, S;
72
+ const t = ((o = r.selectedItem) == null ? void 0 : o.icon) || f;
70
73
  return /* @__PURE__ */ b(K, { children: [
71
- (m = r.selectedItem) != null && m.avatarUrl ? /* @__PURE__ */ e(
74
+ (u = r.selectedItem) != null && u.avatarUrl ? /* @__PURE__ */ e(
72
75
  $,
73
76
  {
74
77
  size: "sm",
@@ -104,10 +107,10 @@ const J = {
104
107
  w[n],
105
108
  c && "text-disabled"
106
109
  ),
107
- children: u
110
+ children: m
108
111
  }
109
112
  ),
110
- f && /* @__PURE__ */ e(
113
+ p && /* @__PURE__ */ e(
111
114
  k,
112
115
  {
113
116
  "aria-hidden": "true",
@@ -144,25 +147,34 @@ const J = {
144
147
  placeholderIcon: B,
145
148
  size: c = "sm",
146
149
  children: n,
147
- items: u,
148
- label: p,
150
+ items: m,
151
+ label: f,
149
152
  hint: x,
150
153
  tooltip: I,
151
- className: f,
154
+ className: p,
152
155
  textStyles: N,
153
156
  showChevron: a = !0,
154
157
  isClearable: h = !1,
155
158
  isDeselectable: d = !1,
156
159
  ...g
157
160
  }) => {
158
- const { selectedKey: r, onSelectionChange: t, ...o } = g, m = T(!1), s = r === void 0 ? void 0 : r == null || String(r) === "" ? null : r, v = j(() => {
161
+ const {
162
+ selectedKey: r,
163
+ onSelectionChange: t,
164
+ ...o
165
+ } = g, u = T(!1), s = r === void 0 ? void 0 : r == null || String(r) === "" ? null : r, v = j(() => {
159
166
  var l;
160
- !d || s == null || (m.current = !0, t == null || t(null), (l = o.onOpenChange) == null || l.call(o, !1), queueMicrotask(() => {
161
- m.current = !1;
167
+ !d || s == null || (u.current = !0, t == null || t(null), (l = o.onOpenChange) == null || l.call(o, !1), queueMicrotask(() => {
168
+ u.current = !1;
162
169
  }));
163
- }, [o.onOpenChange, d, t, s]), S = j(
170
+ }, [
171
+ o.onOpenChange,
172
+ d,
173
+ t,
174
+ s
175
+ ]), S = j(
164
176
  (l) => {
165
- if (m.current) return;
177
+ if (u.current) return;
166
178
  const C = l == null || String(l) === "" ? null : l;
167
179
  t == null || t(C);
168
180
  },
@@ -185,16 +197,16 @@ const J = {
185
197
  onSelectionChange: S,
186
198
  className: (l) => i(
187
199
  "flex flex-col gap-1.5",
188
- typeof f == "function" ? f(l) : f
200
+ typeof p == "function" ? p(l) : p
189
201
  ),
190
202
  children: (l) => /* @__PURE__ */ b(K, { children: [
191
- p && /* @__PURE__ */ e(
203
+ f && /* @__PURE__ */ e(
192
204
  E,
193
205
  {
194
206
  isRequired: l.isRequired,
195
207
  tooltip: I,
196
208
  className: W[c],
197
- children: p
209
+ children: f
198
210
  }
199
211
  ),
200
212
  /* @__PURE__ */ e(
@@ -208,12 +220,19 @@ const J = {
208
220
  showChevron: a,
209
221
  isClearable: h,
210
222
  onClear: h && t ? () => t(null) : void 0,
211
- selectedItem: s != null && u ? u.find(
223
+ selectedItem: s != null && m ? m.find(
212
224
  (C) => String(C.id) === String(s)
213
225
  ) ?? null : null
214
226
  }
215
227
  ),
216
- /* @__PURE__ */ e(H, { size: c, className: i(o.popoverClassName), children: /* @__PURE__ */ e(O, { items: u, className: "size-full outline-hidden ", children: n }) }),
228
+ /* @__PURE__ */ e(
229
+ H,
230
+ {
231
+ size: c,
232
+ className: i(o.popoverClassName),
233
+ children: /* @__PURE__ */ e(O, { items: m, className: "size-full outline-hidden ", children: n })
234
+ }
235
+ ),
217
236
  x && /* @__PURE__ */ e(A, { isInvalid: l.isInvalid, children: x })
218
237
  ] })
219
238
  }