haze-ui 1.12.1 → 1.13.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.
Files changed (137) hide show
  1. package/README.md +99 -31
  2. package/dist/components/Checkbox/Checkbox.js +13 -20
  3. package/dist/components/Checkbox/CheckboxCore.js +23 -0
  4. package/dist/components/ColorPicker/ColorPicker.js +13 -42
  5. package/dist/components/ColorPicker/ColorPickerCore.js +38 -0
  6. package/dist/components/Combobox/Combobox.js +45 -34
  7. package/dist/components/Command/Command.js +72 -37
  8. package/dist/components/ContextMenu/ContextMenu.js +19 -17
  9. package/dist/components/ContextMenu/ContextMenuContent.js +24 -12
  10. package/dist/components/ContextMenu/ContextMenuItem.js +2 -0
  11. package/dist/components/DateRangePicker/DateRangePicker.js +17 -35
  12. package/dist/components/DateRangePicker/DateRangePickerCore.js +33 -0
  13. package/dist/components/Datepicker/Calendar.js +58 -44
  14. package/dist/components/Datepicker/Datepicker.js +15 -39
  15. package/dist/components/Datepicker/DatepickerCore.js +50 -0
  16. package/dist/components/DropdownMenu/DropdownMenu.js +20 -20
  17. package/dist/components/DropdownMenu/DropdownMenuContent.js +38 -45
  18. package/dist/components/DropdownMenu/DropdownMenuTrigger.js +9 -7
  19. package/dist/components/InlineEdit/InlineEdit.js +1 -0
  20. package/dist/components/Input/Input.js +11 -22
  21. package/dist/components/Input/InputCore.js +26 -0
  22. package/dist/components/Menu/Menu.js +38 -26
  23. package/dist/components/Menu/MenuItem.js +1 -0
  24. package/dist/components/ModelPicker/ModelPicker.js +1 -0
  25. package/dist/components/NumberInput/NumberInput.js +16 -53
  26. package/dist/components/NumberInput/NumberInputCore.js +56 -0
  27. package/dist/components/OTPInput/OTPInput.js +11 -45
  28. package/dist/components/OTPInput/OTPInputCore.js +44 -0
  29. package/dist/components/PasswordInput/PasswordInput.js +14 -29
  30. package/dist/components/PasswordInput/PasswordInputCore.js +31 -0
  31. package/dist/components/Popover/Popover.js +32 -75
  32. package/dist/components/Progress/Progress.js +2 -0
  33. package/dist/components/Radio/RadioGroup.js +12 -21
  34. package/dist/components/Radio/RadioGroupCore.js +24 -0
  35. package/dist/components/Rating/Rating.js +14 -46
  36. package/dist/components/Rating/RatingCore.js +48 -0
  37. package/dist/components/Segmented/Segmented.js +12 -37
  38. package/dist/components/Segmented/SegmentedCore.js +39 -0
  39. package/dist/components/Select/Select.js +12 -23
  40. package/dist/components/Select/SelectCore.js +27 -0
  41. package/dist/components/Slider/Slider.js +10 -15
  42. package/dist/components/Slider/SliderCore.js +19 -0
  43. package/dist/components/Switch/Switch.js +11 -38
  44. package/dist/components/Switch/SwitchCore.js +42 -0
  45. package/dist/components/TagInput/TagInput.js +18 -72
  46. package/dist/components/TagInput/TagInputCore.js +68 -0
  47. package/dist/components/Textarea/Textarea.js +11 -22
  48. package/dist/components/Textarea/TextareaCore.js +26 -0
  49. package/dist/components/TimePicker/TimePicker.js +10 -15
  50. package/dist/components/TimePicker/TimePickerCore.js +18 -0
  51. package/dist/components/Tooltip/Tooltip.js +50 -24
  52. package/dist/components/Tree/TreeItem.js +44 -41
  53. package/dist/components/Upload/Upload.js +1 -0
  54. package/dist/css/checkbox.css +1 -1
  55. package/dist/css/color-picker.css +1 -1
  56. package/dist/css/combobox.css +2 -1
  57. package/dist/css/command.css +1 -1
  58. package/dist/css/context-menu.css +1 -0
  59. package/dist/css/date-range-picker.css +1 -1
  60. package/dist/css/datepicker.css +3 -2
  61. package/dist/css/dropdown-menu.css +2 -1
  62. package/dist/css/input.css +1 -1
  63. package/dist/css/menu.css +2 -1
  64. package/dist/css/number-input.css +1 -1
  65. package/dist/css/otp-input.css +1 -1
  66. package/dist/css/password-input.css +1 -1
  67. package/dist/css/popover.css +2 -1
  68. package/dist/css/radio.css +1 -1
  69. package/dist/css/rating.css +1 -1
  70. package/dist/css/segmented.css +1 -1
  71. package/dist/css/select.css +1 -1
  72. package/dist/css/slider.css +1 -1
  73. package/dist/css/switch.css +1 -1
  74. package/dist/css/tag-input.css +1 -1
  75. package/dist/css/textarea.css +1 -1
  76. package/dist/css/time-picker.css +1 -1
  77. package/dist/css/tooltip.css +2 -1
  78. package/dist/form/FormItem.js +41 -33
  79. package/dist/haze-ui.css +31 -24
  80. package/dist/index.js +138 -122
  81. package/dist/types/components/Checkbox/CheckboxCore.d.ts +12 -0
  82. package/dist/types/components/Checkbox/index.d.ts +2 -0
  83. package/dist/types/components/ColorPicker/ColorPickerCore.d.ts +8 -0
  84. package/dist/types/components/ColorPicker/index.d.ts +2 -0
  85. package/dist/types/components/ContextMenu/ContextMenuContent.d.ts +1 -1
  86. package/dist/types/components/ContextMenu/ContextMenuContext.d.ts +5 -1
  87. package/dist/types/components/DateRangePicker/DateRangePickerCore.d.ts +11 -0
  88. package/dist/types/components/DateRangePicker/index.d.ts +2 -0
  89. package/dist/types/components/Datepicker/DatepickerCore.d.ts +12 -0
  90. package/dist/types/components/Datepicker/index.d.ts +2 -0
  91. package/dist/types/components/DropdownMenu/DropdownMenuContent.d.ts +1 -1
  92. package/dist/types/components/DropdownMenu/DropdownMenuContext.d.ts +3 -0
  93. package/dist/types/components/DropdownMenu/DropdownMenuTrigger.d.ts +1 -1
  94. package/dist/types/components/Input/InputCore.d.ts +13 -0
  95. package/dist/types/components/Input/index.d.ts +2 -0
  96. package/dist/types/components/NumberInput/NumberInputCore.d.ts +15 -0
  97. package/dist/types/components/NumberInput/index.d.ts +2 -0
  98. package/dist/types/components/OTPInput/OTPInputCore.d.ts +8 -0
  99. package/dist/types/components/OTPInput/index.d.ts +2 -0
  100. package/dist/types/components/PasswordInput/PasswordInputCore.d.ts +9 -0
  101. package/dist/types/components/PasswordInput/index.d.ts +2 -0
  102. package/dist/types/components/Radio/RadioContext.d.ts +1 -2
  103. package/dist/types/components/Radio/RadioGroupCore.d.ts +10 -0
  104. package/dist/types/components/Radio/index.d.ts +2 -0
  105. package/dist/types/components/Rating/RatingCore.d.ts +9 -0
  106. package/dist/types/components/Rating/index.d.ts +2 -0
  107. package/dist/types/components/Segmented/Segmented.d.ts +1 -6
  108. package/dist/types/components/Segmented/SegmentedCore.d.ts +15 -0
  109. package/dist/types/components/Segmented/index.d.ts +2 -0
  110. package/dist/types/components/Select/SelectCore.d.ts +13 -0
  111. package/dist/types/components/Select/index.d.ts +2 -0
  112. package/dist/types/components/Slider/SliderCore.d.ts +11 -0
  113. package/dist/types/components/Slider/index.d.ts +2 -0
  114. package/dist/types/components/Switch/Switch.d.ts +1 -1
  115. package/dist/types/components/Switch/SwitchCore.d.ts +12 -0
  116. package/dist/types/components/Switch/index.d.ts +2 -0
  117. package/dist/types/components/TagInput/TagInputCore.d.ts +20 -0
  118. package/dist/types/components/TagInput/index.d.ts +2 -0
  119. package/dist/types/components/Textarea/TextareaCore.d.ts +12 -0
  120. package/dist/types/components/Textarea/index.d.ts +2 -0
  121. package/dist/types/components/TimePicker/TimePickerCore.d.ts +9 -0
  122. package/dist/types/components/TimePicker/index.d.ts +2 -0
  123. package/dist/types/components/Tooltip/Tooltip.d.ts +5 -1
  124. package/dist/types/form/FormItem.d.ts +86 -19
  125. package/dist/types/form/index.d.ts +2 -3
  126. package/dist/types/index.d.ts +36 -36
  127. package/dist/types/utils/floating.d.ts +99 -0
  128. package/dist/types/utils/menuKeyboard.d.ts +43 -0
  129. package/dist/utils/floating.js +181 -0
  130. package/dist/utils/menuKeyboard.js +88 -0
  131. package/package.json +45 -19
  132. package/dist/components/DropdownMenu/useMenuKeyboard.js +0 -52
  133. package/dist/form/useFormControl.js +0 -54
  134. package/dist/types/components/DropdownMenu/useMenuKeyboard.d.ts +0 -19
  135. package/dist/types/form/useFormControl.d.ts +0 -35
  136. package/dist/types/hooks/index.d.ts +0 -1
  137. package/dist/types/utils/index.d.ts +0 -1
@@ -1,28 +1,17 @@
1
-
2
- import { classnames as e } from "../../utils/classnames.js";
3
- /* empty css */
1
+ import e from "./InputCore.js";
4
2
  import { jsx as t } from "react/jsx-runtime";
5
3
  import { useControl as n } from "react-use-control";
6
4
  //#region src/lib/components/Input/Input.tsx
7
- var r = "haze-Input__base", i = {
8
- sm: "haze-Input__sm",
9
- md: "haze-Input__md",
10
- lg: "haze-Input__lg"
11
- };
12
- function a({ value: a, size: o = "md", className: s, onChange: c, ...l }) {
13
- let [u, d] = n(a, "");
14
- return /* @__PURE__ */ t("input", {
15
- value: u,
16
- onChange: (e) => {
17
- d(e.target.value), c?.(e);
18
- },
19
- ...l,
20
- className: e([
21
- r,
22
- i[o],
23
- s
24
- ])
5
+ function r({ value: r, size: i, className: a, onChange: o, ...s }) {
6
+ let [c, l] = n(r, "");
7
+ return /* @__PURE__ */ t(e, {
8
+ value: c,
9
+ onChange: l,
10
+ onNativeChange: o,
11
+ size: i,
12
+ className: a,
13
+ ...s
25
14
  });
26
15
  }
27
16
  //#endregion
28
- export { a as default };
17
+ export { r as default };
@@ -0,0 +1,26 @@
1
+
2
+ import { classnames as e } from "../../utils/classnames.js";
3
+ /* empty css */
4
+ import { jsx as t } from "react/jsx-runtime";
5
+ //#region src/lib/components/Input/InputCore.tsx
6
+ var n = "haze-InputCore__base", r = {
7
+ sm: "haze-InputCore__sm",
8
+ md: "haze-InputCore__md",
9
+ lg: "haze-InputCore__lg"
10
+ };
11
+ function i({ value: i, onChange: a, onNativeChange: o, size: s = "md", className: c, ...l }) {
12
+ return /* @__PURE__ */ t("input", {
13
+ value: i,
14
+ onChange: (e) => {
15
+ a(e.target.value), o?.(e);
16
+ },
17
+ ...l,
18
+ className: e([
19
+ n,
20
+ r[s],
21
+ c
22
+ ])
23
+ });
24
+ }
25
+ //#endregion
26
+ export { i as default };
@@ -1,35 +1,47 @@
1
1
 
2
2
  import { classnames as e } from "../../utils/classnames.js";
3
+ import { FloatingPanel as t, useFloating as n } from "../../utils/floating.js";
4
+ import { useMenuKeyboard as r, useRovingTabindex as i } from "../../utils/menuKeyboard.js";
3
5
  /* empty css */
4
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
5
- import { useControl as r } from "react-use-control";
6
- import { useEffect as i, useRef as a } from "react";
6
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
+ import { useControl as s } from "react-use-control";
8
+ import { useRef as c } from "react";
7
9
  //#region src/lib/components/Menu/Menu.tsx
8
- var o = "haze-Menu__container", s = "haze-Menu__panel", c = "haze-Menu__hidden";
9
- function l({ open: l, trigger: u, className: d, children: f }) {
10
- let [p, m] = r(l, !1), h = a(null);
11
- return i(() => {
12
- if (!p) return;
13
- let e = (e) => {
14
- h.current && !h.current.contains(e.target) && m(!1);
15
- };
16
- return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
17
- }, [p, m]), /* @__PURE__ */ n("div", {
18
- ref: h,
19
- className: o,
20
- children: [/* @__PURE__ */ t("span", {
21
- onClick: () => m((e) => !e),
22
- children: u
23
- }), /* @__PURE__ */ t("div", {
24
- role: "menu",
25
- className: e([
26
- s,
27
- !p && c,
28
- d
29
- ]),
10
+ var l = "haze-Menu__container", u = "haze-Menu__panel";
11
+ function d({ open: d, trigger: f, className: p, children: m }) {
12
+ let [h, g] = s(d, !1), _ = c(null), v = c(null), y = n({
13
+ open: h,
14
+ setOpen: g,
15
+ triggerRef: _,
16
+ panelRef: v
17
+ });
18
+ i({
19
+ menuRef: v,
20
+ active: h
21
+ });
22
+ let b = r({
23
+ menuRef: v,
24
+ onClose: () => g(!1)
25
+ });
26
+ return /* @__PURE__ */ o("div", {
27
+ className: e(l),
28
+ children: [/* @__PURE__ */ a("span", {
29
+ ref: _,
30
+ style: y.triggerStyle,
31
+ onPointerDown: y.onTriggerPointerDown,
32
+ onClick: y.onTriggerClick,
30
33
  children: f
34
+ }), /* @__PURE__ */ a(t, {
35
+ ref: v,
36
+ behavior: y,
37
+ placement: "bottom",
38
+ role: "menu",
39
+ visualClass: u,
40
+ className: p,
41
+ onKeyDown: b,
42
+ children: m
31
43
  })]
32
44
  });
33
45
  }
34
46
  //#endregion
35
- export { l as default };
47
+ export { d as default };
@@ -8,6 +8,7 @@ function r({ onSelect: r, disabled: i = !1, className: a, children: o }) {
8
8
  return /* @__PURE__ */ t("button", {
9
9
  type: "button",
10
10
  role: "menuitem",
11
+ tabIndex: -1,
11
12
  disabled: i,
12
13
  onClick: r,
13
14
  className: e([n, a]),
@@ -10,6 +10,7 @@ function o({ value: o, onChange: s, options: c, disabled: l, className: u }) {
10
10
  return /* @__PURE__ */ t("div", {
11
11
  className: e([i, u]),
12
12
  children: t("select", {
13
+ "aria-label": "Model",
13
14
  value: d,
14
15
  onChange: (e) => {
15
16
  f(e.target.value), s?.(e.target.value);
@@ -1,57 +1,20 @@
1
-
2
- import { classnames as e } from "../../utils/classnames.js";
3
- /* empty css */
4
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
5
- import { useControl as r } from "react-use-control";
1
+ import e from "./NumberInputCore.js";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import { useControl as n } from "react-use-control";
6
4
  //#region src/lib/components/NumberInput/NumberInput.tsx
7
- var i = "haze-NumberInput__wrapper", a = "haze-NumberInput__input", o = "haze-NumberInput__stepBtn", s = "haze-NumberInput__inputSm", c = "haze-NumberInput__inputMd", l = "haze-NumberInput__inputLg", u = "haze-NumberInput__btnSm", d = "haze-NumberInput__btnMd", f = "haze-NumberInput__btnLg", p = {
8
- sm: s,
9
- md: c,
10
- lg: l
11
- }, m = {
12
- sm: u,
13
- md: d,
14
- lg: f
15
- };
16
- function h({ value: s, min: c, max: l, step: u = 1, size: d = "md", className: f, onChange: h, ...g }) {
17
- let [_, v] = r(s, 0), y = (e) => {
18
- let t = Math.round(e * 1e10) / 1e10;
19
- return c !== void 0 && t < c ? c : l !== void 0 && t > l ? l : t;
20
- };
21
- return /* @__PURE__ */ n("div", {
22
- className: e([i, f]),
23
- children: [
24
- /* @__PURE__ */ t("button", {
25
- type: "button",
26
- onClick: () => v(y(_ - u)),
27
- disabled: c !== void 0 && _ <= c,
28
- "aria-label": "Decrease",
29
- className: e([o, m[d]]),
30
- children: "−"
31
- }),
32
- /* @__PURE__ */ t("input", {
33
- type: "number",
34
- value: _,
35
- min: c,
36
- max: l,
37
- step: u,
38
- onChange: (e) => {
39
- let t = Number(e.target.value);
40
- Number.isNaN(t) || v(y(t)), h?.(e);
41
- },
42
- ...g,
43
- className: e([a, p[d]])
44
- }),
45
- /* @__PURE__ */ t("button", {
46
- type: "button",
47
- onClick: () => v(y(_ + u)),
48
- disabled: l !== void 0 && _ >= l,
49
- "aria-label": "Increase",
50
- className: e([o, m[d]]),
51
- children: "+"
52
- })
53
- ]
5
+ function r({ value: r, min: i, max: a, step: o, size: s, className: c, onChange: l, ...u }) {
6
+ let [d, f] = n(r, 0);
7
+ return /* @__PURE__ */ t(e, {
8
+ value: d,
9
+ onChange: f,
10
+ onNativeChange: l,
11
+ min: i,
12
+ max: a,
13
+ step: o,
14
+ size: s,
15
+ className: c,
16
+ ...u
54
17
  });
55
18
  }
56
19
  //#endregion
57
- export { h as default };
20
+ export { r as default };
@@ -0,0 +1,56 @@
1
+
2
+ import { classnames as e } from "../../utils/classnames.js";
3
+ /* empty css */
4
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
5
+ //#region src/lib/components/NumberInput/NumberInputCore.tsx
6
+ var r = "haze-NumberInputCore__wrapper", i = "haze-NumberInputCore__input", a = "haze-NumberInputCore__stepBtn", o = "haze-NumberInputCore__inputSm", s = "haze-NumberInputCore__inputMd", c = "haze-NumberInputCore__inputLg", l = "haze-NumberInputCore__btnSm", u = "haze-NumberInputCore__btnMd", d = "haze-NumberInputCore__btnLg", f = {
7
+ sm: o,
8
+ md: s,
9
+ lg: c
10
+ }, p = {
11
+ sm: l,
12
+ md: u,
13
+ lg: d
14
+ };
15
+ function m({ value: o, onChange: s, onNativeChange: c, min: l, max: u, step: d = 1, size: m = "md", className: h, ...g }) {
16
+ let _ = (e) => {
17
+ let t = Math.round(e * 1e10) / 1e10;
18
+ return l !== void 0 && t < l ? l : u !== void 0 && t > u ? u : t;
19
+ };
20
+ return /* @__PURE__ */ n("div", {
21
+ className: e([r, h]),
22
+ children: [
23
+ /* @__PURE__ */ t("button", {
24
+ type: "button",
25
+ onClick: () => s(_(o - d)),
26
+ disabled: l !== void 0 && o <= l,
27
+ "aria-label": "Decrease",
28
+ className: e([a, p[m]]),
29
+ children: "−"
30
+ }),
31
+ /* @__PURE__ */ t("input", {
32
+ type: "number",
33
+ value: o,
34
+ min: l,
35
+ max: u,
36
+ step: d,
37
+ onChange: (e) => {
38
+ let t = Number(e.target.value);
39
+ Number.isNaN(t) || s(_(t)), c?.(e);
40
+ },
41
+ ...g,
42
+ className: e([i, f[m]])
43
+ }),
44
+ /* @__PURE__ */ t("button", {
45
+ type: "button",
46
+ onClick: () => s(_(o + d)),
47
+ disabled: u !== void 0 && o >= u,
48
+ "aria-label": "Increase",
49
+ className: e([a, p[m]]),
50
+ children: "+"
51
+ })
52
+ ]
53
+ });
54
+ }
55
+ //#endregion
56
+ export { m as default };
@@ -1,51 +1,17 @@
1
-
2
- import { classnames as e } from "../../utils/classnames.js";
3
- /* empty css */
1
+ import e from "./OTPInputCore.js";
4
2
  import { jsx as t } from "react/jsx-runtime";
5
3
  import { useControl as n } from "react-use-control";
6
- import { useCallback as r, useRef as i } from "react";
7
4
  //#region src/lib/components/OTPInput/OTPInput.tsx
8
- var a = "haze-OTPInput__container", o = "haze-OTPInput__cell";
9
- function s({ length: s = 6, value: c, onChange: l, className: u }) {
10
- let [d, f] = n(c, ""), p = i([]), m = r((e, t) => {
11
- let n = d.split("");
12
- n[e] = t.slice(-1);
13
- let r = n.join("").slice(0, s);
14
- f(r), l?.(r), t && e < s - 1 && p.current[e + 1]?.focus();
15
- }, [
16
- d,
17
- s,
18
- f,
19
- l
20
- ]), h = r((e, t) => {
21
- t.key === "Backspace" && !d[e] && e > 0 && p.current[e - 1]?.focus();
22
- }, [d]), g = r((e) => {
23
- e.preventDefault();
24
- let t = e.clipboardData.getData("text").slice(0, s);
25
- f(t), l?.(t);
26
- let n = Math.min(t.length, s - 1);
27
- p.current[n]?.focus();
28
- }, [
29
- s,
30
- f,
31
- l
32
- ]);
33
- return /* @__PURE__ */ t("div", {
34
- className: e([a, u]),
35
- children: Array.from({ length: s }, (n, r) => /* @__PURE__ */ t("input", {
36
- ref: (e) => {
37
- p.current[r] = e;
38
- },
39
- type: "text",
40
- inputMode: "numeric",
41
- maxLength: 1,
42
- value: d[r] ?? "",
43
- onChange: (e) => m(r, e.target.value),
44
- onKeyDown: (e) => h(r, e),
45
- onPaste: g,
46
- className: e([o])
47
- }, r))
5
+ function r({ length: r, value: i, onChange: a, className: o }) {
6
+ let [s, c] = n(i, "");
7
+ return /* @__PURE__ */ t(e, {
8
+ length: r,
9
+ value: s,
10
+ onChange: (e) => {
11
+ c(e), a?.(e);
12
+ },
13
+ className: o
48
14
  });
49
15
  }
50
16
  //#endregion
51
- export { s as default };
17
+ export { r as default };
@@ -0,0 +1,44 @@
1
+
2
+ import { classnames as e } from "../../utils/classnames.js";
3
+ /* empty css */
4
+ import { jsx as t } from "react/jsx-runtime";
5
+ import { useCallback as n, useRef as r } from "react";
6
+ //#region src/lib/components/OTPInput/OTPInputCore.tsx
7
+ var i = "haze-OTPInputCore__container", a = "haze-OTPInputCore__cell";
8
+ function o({ length: o = 6, value: s, onChange: c, className: l }) {
9
+ let u = r([]), d = n((e, t) => {
10
+ let n = s.split("");
11
+ n[e] = t.slice(-1), c(n.join("").slice(0, o)), t && e < o - 1 && u.current[e + 1]?.focus();
12
+ }, [
13
+ s,
14
+ o,
15
+ c
16
+ ]), f = n((e, t) => {
17
+ t.key === "Backspace" && !s[e] && e > 0 && u.current[e - 1]?.focus();
18
+ }, [s]), p = n((e) => {
19
+ e.preventDefault();
20
+ let t = e.clipboardData.getData("text").slice(0, o);
21
+ c(t);
22
+ let n = Math.min(t.length, o - 1);
23
+ u.current[n]?.focus();
24
+ }, [o, c]);
25
+ return /* @__PURE__ */ t("div", {
26
+ className: e([i, l]),
27
+ children: Array.from({ length: o }, (n, r) => /* @__PURE__ */ t("input", {
28
+ ref: (e) => {
29
+ u.current[r] = e;
30
+ },
31
+ type: "text",
32
+ inputMode: "numeric",
33
+ maxLength: 1,
34
+ "aria-label": `Digit ${r + 1} of ${o}`,
35
+ value: s[r] ?? "",
36
+ onChange: (e) => d(r, e.target.value),
37
+ onKeyDown: (e) => f(r, e),
38
+ onPaste: p,
39
+ className: e([a])
40
+ }, r))
41
+ });
42
+ }
43
+ //#endregion
44
+ export { o as default };
@@ -1,33 +1,18 @@
1
-
2
- import { classnames as e } from "../../utils/classnames.js";
3
- /* empty css */
4
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
5
- import { useControl as r } from "react-use-control";
6
- import { useState as i } from "react";
1
+ import e from "./PasswordInputCore.js";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import { useControl as n } from "react-use-control";
7
4
  //#region src/lib/components/PasswordInput/PasswordInput.tsx
8
- var a = "haze-PasswordInput__wrapper", o = "haze-PasswordInput__input", s = "haze-PasswordInput__toggle";
9
- function c({ value: c, onChange: l, placeholder: u, disabled: d, className: f }) {
10
- let [p, m] = r(c, ""), [h, g] = i(!1);
11
- return /* @__PURE__ */ n("div", {
12
- className: e([a, f]),
13
- children: [/* @__PURE__ */ t("input", {
14
- type: h ? "text" : "password",
15
- value: p,
16
- onChange: (e) => {
17
- m(e.target.value), l?.(e.target.value);
18
- },
19
- placeholder: u,
20
- disabled: d,
21
- className: e([o])
22
- }), /* @__PURE__ */ t("button", {
23
- type: "button",
24
- onClick: () => g(!h),
25
- tabIndex: -1,
26
- "aria-label": h ? "Hide password" : "Show password",
27
- className: e([s]),
28
- children: h ? "🙈" : "👁"
29
- })]
5
+ function r({ value: r, onChange: i, placeholder: a, disabled: o, className: s }) {
6
+ let [c, l] = n(r, "");
7
+ return /* @__PURE__ */ t(e, {
8
+ value: c,
9
+ onChange: (e) => {
10
+ l(e), i?.(e);
11
+ },
12
+ placeholder: a,
13
+ disabled: o,
14
+ className: s
30
15
  });
31
16
  }
32
17
  //#endregion
33
- export { c as default };
18
+ export { r as default };
@@ -0,0 +1,31 @@
1
+
2
+ import { classnames as e } from "../../utils/classnames.js";
3
+ /* empty css */
4
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
5
+ import { useState as r } from "react";
6
+ //#region src/lib/components/PasswordInput/PasswordInputCore.tsx
7
+ var i = "haze-PasswordInputCore__wrapper", a = "haze-PasswordInputCore__input", o = "haze-PasswordInputCore__toggle";
8
+ function s({ value: s, onChange: c, placeholder: l, disabled: u, className: d }) {
9
+ let [f, p] = r(!1);
10
+ return /* @__PURE__ */ n("div", {
11
+ className: e([i, d]),
12
+ children: [/* @__PURE__ */ t("input", {
13
+ type: f ? "text" : "password",
14
+ "aria-label": "Password",
15
+ value: s,
16
+ onChange: (e) => c(e.target.value),
17
+ placeholder: l,
18
+ disabled: u,
19
+ className: e([a])
20
+ }), /* @__PURE__ */ t("button", {
21
+ type: "button",
22
+ onClick: () => p(!f),
23
+ tabIndex: -1,
24
+ "aria-label": f ? "Hide password" : "Show password",
25
+ className: e([o]),
26
+ children: f ? "🙈" : "👁"
27
+ })]
28
+ });
29
+ }
30
+ //#endregion
31
+ export { s as default };
@@ -1,82 +1,39 @@
1
1
 
2
- import { classnames as e } from "../../utils/classnames.js";
2
+ import { FloatingPanel as e, useFloating as t } from "../../utils/floating.js";
3
3
  /* empty css */
4
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
5
- import { useControl as r } from "react-use-control";
6
- import { useEffect as i, useId as a, useRef as o } from "react";
4
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
5
+ import { useControl as i } from "react-use-control";
6
+ import { useId as a, useRef as o } from "react";
7
7
  //#region src/lib/components/Popover/Popover.tsx
8
- var s = 500;
9
- function c() {
10
- return typeof HTMLElement < "u" && "popover" in HTMLElement.prototype;
11
- }
12
- function l() {
13
- return c() && typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("anchor-name: --haze-popover-probe");
14
- }
15
- var u = "haze-Popover__container", d = "haze-Popover__panelVisuals", f = "haze-Popover__panelFallback", p = "haze-Popover__hidden", m = "haze-Popover__panelNative", h = "haze-Popover__panelAnchored", g = "haze-Popover__panelJsPositioned";
16
- function _({ content: _, open: v, className: y, children: b }) {
17
- let [x, S] = r(v, !1), C = a(), w = `--haze-popover-${C.replace(/[^a-zA-Z0-9]/g, "")}`, T = c(), E = l(), D = o(null), O = o(null), k = o(!1), A = o(0), j = o(0);
18
- return i(() => {
19
- let e = O.current;
20
- if (!e || !T) return;
21
- let t = (e) => {
22
- let t = e.newState;
23
- k.current = t === "open", t === "closed" && x ? (performance.now() - A.current < s && (j.current = performance.now()), A.current = 0, S(!1)) : t === "open" && !x && S(!0);
24
- };
25
- return e.addEventListener("toggle", t), x && !k.current ? e.showPopover() : !x && k.current && e.hidePopover(), () => e.removeEventListener("toggle", t);
26
- }, [
27
- T,
28
- x,
29
- S
30
- ]), i(() => {
31
- if (!T || E || !x) return;
32
- let e = O.current, t = D.current;
33
- if (!e || !t) return;
34
- let n = () => {
35
- let n = t.getBoundingClientRect(), r = parseFloat(getComputedStyle(e).marginTop) || 0;
36
- e.style.top = `${n.bottom + r}px`, e.style.left = `${n.left}px`;
37
- };
38
- return n(), window.addEventListener("scroll", n, !0), window.addEventListener("resize", n), () => {
39
- window.removeEventListener("scroll", n, !0), window.removeEventListener("resize", n);
40
- };
41
- }, [
42
- T,
43
- E,
44
- x
45
- ]), /* @__PURE__ */ n("span", {
46
- className: u,
47
- children: [/* @__PURE__ */ t("span", {
48
- ref: D,
49
- "aria-expanded": x,
50
- "aria-controls": C,
51
- style: E ? { anchorName: w } : void 0,
52
- onPointerDown: () => {
53
- x && (A.current = performance.now());
54
- },
55
- onClick: () => {
56
- if (performance.now() - j.current < s) {
57
- j.current = 0;
58
- return;
59
- }
60
- S((e) => !e);
61
- },
62
- children: b
63
- }), /* @__PURE__ */ t("div", {
64
- id: C,
65
- ref: O,
66
- popover: T ? "auto" : void 0,
67
- style: T && E ? { "--haze-popover-anchor": w } : void 0,
68
- className: e([
69
- d,
70
- T && m,
71
- T && E && h,
72
- T && !E && g,
73
- !T && f,
74
- !T && !x && p,
75
- y
76
- ]),
77
- children: _
8
+ var s = "haze-Popover__container", c = "haze-Popover__panelVisuals";
9
+ function l({ content: l, open: u, className: d, children: f }) {
10
+ let [p, m] = i(u, !1), h = a(), g = o(null), _ = o(null), v = t({
11
+ open: p,
12
+ setOpen: m,
13
+ triggerRef: g,
14
+ panelRef: _
15
+ });
16
+ return /* @__PURE__ */ r("span", {
17
+ className: s,
18
+ children: [/* @__PURE__ */ n("span", {
19
+ ref: g,
20
+ style: v.triggerStyle,
21
+ role: "button",
22
+ "aria-expanded": p,
23
+ "aria-controls": h,
24
+ onPointerDown: v.onTriggerPointerDown,
25
+ onClick: v.onTriggerClick,
26
+ children: f
27
+ }), /* @__PURE__ */ n(e, {
28
+ ref: _,
29
+ behavior: v,
30
+ placement: "bottom-span",
31
+ id: h,
32
+ visualClass: c,
33
+ className: d,
34
+ children: l
78
35
  })]
79
36
  });
80
37
  }
81
38
  //#endregion
82
- export { _ as default };
39
+ export { l as default };
@@ -36,6 +36,7 @@ function m({ value: m = 0, variant: h = "bar", size: g = "md", color: _ = "prima
36
36
  let r = p[g], i = f[g], a = 2 * Math.PI * r, o = a - y / 100 * a;
37
37
  return /* @__PURE__ */ t("div", {
38
38
  role: "progressbar",
39
+ "aria-label": "Progress",
39
40
  "aria-valuemin": 0,
40
41
  "aria-valuemax": 100,
41
42
  "aria-valuenow": y,
@@ -66,6 +67,7 @@ function m({ value: m = 0, variant: h = "bar", size: g = "md", color: _ = "prima
66
67
  }
67
68
  return /* @__PURE__ */ t("div", {
68
69
  role: "progressbar",
70
+ "aria-label": "Progress",
69
71
  "aria-valuemin": 0,
70
72
  "aria-valuemax": 100,
71
73
  "aria-valuenow": y,
@@ -1,25 +1,16 @@
1
-
2
- import { classnames as e } from "../../utils/classnames.js";
3
- import { RadioProvider as t } from "./RadioContext.js";
4
- /* empty css */
5
- import { jsx as n } from "react/jsx-runtime";
6
- import { useControl as r } from "react-use-control";
7
- import { useId as i } from "react";
1
+ import e from "./RadioGroupCore.js";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import { useControl as n } from "react-use-control";
8
4
  //#region src/lib/components/Radio/RadioGroup.tsx
9
- var a = "haze-RadioGroup__base";
10
- function o({ value: o, name: s, className: c, children: l }) {
11
- let [u, d] = r(o, ""), f = i();
12
- return /* @__PURE__ */ n("fieldset", {
13
- className: e([a, c]),
14
- children: n(t, {
15
- value: {
16
- name: s ?? f,
17
- value: u,
18
- setValue: d
19
- },
20
- children: l
21
- })
5
+ function r({ value: r, name: i, className: a, children: o }) {
6
+ let [s, c] = n(r, "");
7
+ return /* @__PURE__ */ t(e, {
8
+ value: s,
9
+ onChange: c,
10
+ name: i,
11
+ className: a,
12
+ children: o
22
13
  });
23
14
  }
24
15
  //#endregion
25
- export { o as default };
16
+ export { r as default };