@pibit.ai/cure-design-system 0.5.6 → 0.5.8

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.
Files changed (83) hide show
  1. package/dist/applications/date-picker/calendar.d.ts +42 -0
  2. package/dist/applications/date-picker/calendar.d.ts.map +1 -0
  3. package/dist/applications/date-picker/calendar.js +310 -0
  4. package/dist/applications/date-picker/cell.d.ts +15 -0
  5. package/dist/applications/date-picker/cell.d.ts.map +1 -0
  6. package/dist/applications/date-picker/cell.js +90 -0
  7. package/dist/applications/date-picker/date-input.d.ts +7 -0
  8. package/dist/applications/date-picker/date-input.d.ts.map +1 -0
  9. package/dist/applications/date-picker/date-input.js +39 -0
  10. package/dist/applications/date-picker/date-picker.d.ts +47 -0
  11. package/dist/applications/date-picker/date-picker.d.ts.map +1 -0
  12. package/dist/applications/date-picker/date-picker.js +237 -0
  13. package/dist/applications/date-picker/date-range-picker.d.ts +44 -0
  14. package/dist/applications/date-picker/date-range-picker.d.ts.map +1 -0
  15. package/dist/applications/date-picker/date-range-picker.js +335 -0
  16. package/dist/applications/date-picker/date-range-presets.d.ts +50 -0
  17. package/dist/applications/date-picker/date-range-presets.d.ts.map +1 -0
  18. package/dist/applications/date-picker/date-range-presets.js +86 -0
  19. package/dist/applications/date-picker/date-time-calendar.d.ts +34 -0
  20. package/dist/applications/date-picker/date-time-calendar.d.ts.map +1 -0
  21. package/dist/applications/date-picker/date-time-calendar.js +140 -0
  22. package/dist/applications/date-picker/index.d.ts +12 -0
  23. package/dist/applications/date-picker/index.d.ts.map +1 -0
  24. package/dist/applications/date-picker/index.js +36 -0
  25. package/dist/applications/date-picker/range-calendar.d.ts +23 -0
  26. package/dist/applications/date-picker/range-calendar.d.ts.map +1 -0
  27. package/dist/applications/date-picker/range-calendar.js +210 -0
  28. package/dist/applications/date-picker/range-preset.d.ts +10 -0
  29. package/dist/applications/date-picker/range-preset.d.ts.map +1 -0
  30. package/dist/applications/date-picker/range-preset.js +27 -0
  31. package/dist/applications/date-picker/styles.d.ts +8 -0
  32. package/dist/applications/date-picker/styles.d.ts.map +1 -0
  33. package/dist/applications/date-picker/styles.js +14 -0
  34. package/dist/applications/date-picker/time-field.d.ts +7 -0
  35. package/dist/applications/date-picker/time-field.d.ts.map +1 -0
  36. package/dist/applications/date-picker/time-field.js +116 -0
  37. package/dist/applications/date-picker/time-list.d.ts +23 -0
  38. package/dist/applications/date-picker/time-list.d.ts.map +1 -0
  39. package/dist/applications/date-picker/time-list.js +89 -0
  40. package/dist/hooks/use-breakpoint.d.ts +10 -0
  41. package/dist/hooks/use-breakpoint.d.ts.map +1 -0
  42. package/dist/hooks/use-breakpoint.js +21 -0
  43. package/dist/index.d.ts +2 -1
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +331 -304
  46. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.js +6 -6
  47. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.js +6 -6
  48. package/dist/primitives/select/ExpandableSearchInput.d.ts +1 -1
  49. package/dist/primitives/select/ExpandableSearchInput.d.ts.map +1 -1
  50. package/dist/primitives/select/ExpandableSearchInput.js +23 -23
  51. package/dist/primitives/select/SearchInput.d.ts +15 -2
  52. package/dist/primitives/select/SearchInput.d.ts.map +1 -1
  53. package/dist/primitives/select/SearchInput.js +128 -114
  54. package/dist/primitives/select/index.d.ts +1 -0
  55. package/dist/primitives/select/index.d.ts.map +1 -1
  56. package/dist/primitives/select/multi-select.js +81 -82
  57. package/dist/primitives/select/select.d.ts +4 -0
  58. package/dist/primitives/select/select.d.ts.map +1 -1
  59. package/dist/primitives/select/select.js +40 -21
  60. package/dist/styles/components.css +1 -1
  61. package/package.json +8 -1
  62. package/dist/node_modules/@react-aria/focus/dist/FocusScope.js +0 -442
  63. package/dist/node_modules/@react-aria/i18n/dist/context.js +0 -10
  64. package/dist/node_modules/@react-aria/i18n/dist/useCollator.js +0 -11
  65. package/dist/node_modules/@react-aria/i18n/dist/useDefaultLocale.js +0 -36
  66. package/dist/node_modules/@react-aria/i18n/dist/useFilter.js +0 -35
  67. package/dist/node_modules/@react-aria/i18n/dist/utils.js +0 -44
  68. package/dist/node_modules/@react-aria/interactions/dist/focusSafely.js +0 -18
  69. package/dist/node_modules/@react-aria/interactions/dist/useFocusVisible.js +0 -62
  70. package/dist/node_modules/@react-aria/interactions/dist/utils.js +0 -5
  71. package/dist/node_modules/@react-aria/ssr/dist/SSRProvider.js +0 -49
  72. package/dist/node_modules/@react-aria/utils/dist/DOMFunctions.js +0 -27
  73. package/dist/node_modules/@react-aria/utils/dist/ShadowTreeWalker.js +0 -130
  74. package/dist/node_modules/@react-aria/utils/dist/domHelpers.js +0 -15
  75. package/dist/node_modules/@react-aria/utils/dist/focusWithoutScrolling.js +0 -45
  76. package/dist/node_modules/@react-aria/utils/dist/isElementVisible.js +0 -25
  77. package/dist/node_modules/@react-aria/utils/dist/isFocusable.js +0 -37
  78. package/dist/node_modules/@react-aria/utils/dist/isVirtualEvent.js +0 -7
  79. package/dist/node_modules/@react-aria/utils/dist/openLink.js +0 -28
  80. package/dist/node_modules/@react-aria/utils/dist/platform.js +0 -47
  81. package/dist/node_modules/@react-aria/utils/dist/runAfterTransition.js +0 -35
  82. package/dist/node_modules/@react-aria/utils/dist/useLayoutEffect.js +0 -6
  83. package/dist/node_modules/@react-stately/flags/dist/import.js +0 -7
@@ -4,7 +4,7 @@ import { useId as H, useRef as l, useContext as y, useInsertionEffect as I } fro
4
4
  import { MotionConfigContext as M } from "../../context/MotionConfigContext.js";
5
5
  import { useComposedRefs as W } from "../../utils/use-composed-ref.js";
6
6
  import { isHTMLElement as u } from "../../../../../motion-dom/dist/es/utils/is-html-element.js";
7
- class B extends g.Component {
7
+ class v extends g.Component {
8
8
  getSnapshotBeforeUpdate(i) {
9
9
  const e = this.props.childRef.current;
10
10
  if (e && i.isPresent && !this.props.isPresent) {
@@ -22,7 +22,7 @@ class B extends g.Component {
22
22
  return this.props.children;
23
23
  }
24
24
  }
25
- function D({ children: o, isPresent: i, anchorX: e, anchorY: n, root: p }) {
25
+ function B({ children: o, isPresent: i, anchorX: e, anchorY: n, root: p }) {
26
26
  var c;
27
27
  const r = H(), t = l(null), h = l({
28
28
  width: 0,
@@ -36,7 +36,7 @@ function D({ children: o, isPresent: i, anchorX: e, anchorY: n, root: p }) {
36
36
  const { width: d, height: a, top: C, left: R, right: b, bottom: w } = h.current;
37
37
  if (i || !t.current || !d || !a)
38
38
  return;
39
- const P = e === "left" ? `left: ${R}` : `right: ${b}`, z = n === "bottom" ? `bottom: ${w}` : `top: ${C}`;
39
+ const z = e === "left" ? `left: ${R}` : `right: ${b}`, P = n === "bottom" ? `bottom: ${w}` : `top: ${C}`;
40
40
  t.current.dataset.motionPopId = r;
41
41
  const s = document.createElement("style");
42
42
  m && (s.nonce = m);
@@ -46,14 +46,14 @@ function D({ children: o, isPresent: i, anchorX: e, anchorY: n, root: p }) {
46
46
  position: absolute !important;
47
47
  width: ${d}px !important;
48
48
  height: ${a}px !important;
49
- ${P}px !important;
50
49
  ${z}px !important;
50
+ ${P}px !important;
51
51
  }
52
52
  `), () => {
53
53
  f.contains(s) && f.removeChild(s);
54
54
  };
55
- }, [i]), E(B, { isPresent: i, childRef: t, sizeRef: h, children: g.cloneElement(o, { ref: x }) });
55
+ }, [i]), E(v, { isPresent: i, childRef: t, sizeRef: h, children: g.cloneElement(o, { ref: x }) });
56
56
  }
57
57
  export {
58
- D as PopChild
58
+ B as PopChild
59
59
  };
@@ -1,11 +1,11 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
2
  import * as M from "react";
3
- import { useId as g, useMemo as c } from "react";
4
- import { PresenceContext as w } from "../../context/PresenceContext.js";
5
- import { useConstant as x } from "../../utils/use-constant.js";
3
+ import { useId as w, useMemo as c } from "react";
4
+ import { PresenceContext as x } from "../../context/PresenceContext.js";
5
+ import { useConstant as z } from "../../utils/use-constant.js";
6
6
  import { PopChild as $ } from "./PopChild.js";
7
7
  const X = ({ children: f, initial: i, isPresent: r, onExitComplete: o, custom: m, presenceAffectsLayout: p, mode: l, anchorX: d, anchorY: h, root: C }) => {
8
- const e = x(j), v = g();
8
+ const e = z(g), v = w();
9
9
  let u = !0, n = c(() => (u = !1, {
10
10
  id: v,
11
11
  initial: i,
@@ -24,9 +24,9 @@ const X = ({ children: f, initial: i, isPresent: r, onExitComplete: o, custom: m
24
24
  e.forEach((t, s) => e.set(s, !1));
25
25
  }, [r]), M.useEffect(() => {
26
26
  !r && !e.size && o && o();
27
- }, [r]), l === "popLayout" && (f = a($, { isPresent: r, anchorX: d, anchorY: h, root: C, children: f })), a(w.Provider, { value: n, children: f });
27
+ }, [r]), l === "popLayout" && (f = a($, { isPresent: r, anchorX: d, anchorY: h, root: C, children: f })), a(x.Provider, { value: n, children: f });
28
28
  };
29
- function j() {
29
+ function g() {
30
30
  return /* @__PURE__ */ new Map();
31
31
  }
32
32
  export {
@@ -1,7 +1,7 @@
1
1
  import { FocusEventHandler, KeyboardEventHandler } from 'react';
2
2
  export interface ExpandableSearchInputProps {
3
3
  placeholder?: string;
4
- size?: "sm" | "md" | "lg";
4
+ size?: "xs" | "sm" | "md" | "lg";
5
5
  value?: string;
6
6
  onChange?: (value: string) => void;
7
7
  onBlur?: FocusEventHandler;
@@ -1 +1 @@
1
- {"version":3,"file":"ExpandableSearchInput.d.ts","sourceRoot":"","sources":["../../../src/primitives/select/ExpandableSearchInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAC1B,MAAM,OAAO,CAAC;AAOf,MAAM,WAAW,0BAA0B;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,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AC;CACtB;AAKD,eAAO,MAAM,qBAAqB,GAAI,2JAcnC,0BAA0B,4CA2K5B,CAAC"}
@@ -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,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,C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AK,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"}