asheeui 0.6.7 → 0.6.9

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 (114) hide show
  1. package/dist/components/autocomplete/Autocomplete.d.ts +34 -17
  2. package/dist/components/autocomplete/Autocomplete.d.ts.map +1 -1
  3. package/dist/components/autocomplete/Autocomplete.js +90 -106
  4. package/dist/components/autocomplete/autocomplete-config.d.ts +2 -20
  5. package/dist/components/autocomplete/autocomplete-config.d.ts.map +1 -1
  6. package/dist/components/autocomplete/autocomplete-config.js +9 -13
  7. package/dist/components/button/Button.d.ts +31 -5
  8. package/dist/components/button/Button.d.ts.map +1 -1
  9. package/dist/components/button/Button.js +68 -64
  10. package/dist/components/card/Card.d.ts +58 -54
  11. package/dist/components/card/Card.d.ts.map +1 -1
  12. package/dist/components/card/Card.js +152 -158
  13. package/dist/components/card/card-config.d.ts +66 -33
  14. package/dist/components/card/card-config.d.ts.map +1 -1
  15. package/dist/components/card/card-config.js +9 -9
  16. package/dist/components/date-picker/Calendar.d.ts +57 -0
  17. package/dist/components/date-picker/Calendar.d.ts.map +1 -0
  18. package/dist/components/date-picker/Calendar.js +224 -0
  19. package/dist/components/date-picker/DatePicker.d.ts +68 -155
  20. package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
  21. package/dist/components/date-picker/DatePicker.js +194 -466
  22. package/dist/components/date-picker/TimeSpinner.d.ts +46 -0
  23. package/dist/components/date-picker/TimeSpinner.d.ts.map +1 -0
  24. package/dist/components/date-picker/TimeSpinner.js +84 -0
  25. package/dist/components/date-picker/date-picker-config.d.ts +21 -1
  26. package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
  27. package/dist/components/date-picker/date-picker-config.js +10 -14
  28. package/dist/components/date-picker/date-picker-styles.d.ts.map +1 -1
  29. package/dist/components/date-picker/date-picker-styles.js +4 -11
  30. package/dist/components/date-picker/date-picker.helpers.d.ts +111 -0
  31. package/dist/components/date-picker/date-picker.helpers.d.ts.map +1 -0
  32. package/dist/components/date-picker/date-picker.helpers.js +110 -0
  33. package/dist/components/date-picker/index.js +3 -0
  34. package/dist/components/input/Input.d.ts +13 -7
  35. package/dist/components/input/Input.d.ts.map +1 -1
  36. package/dist/components/input/Input.js +96 -91
  37. package/dist/components/keyboard/KeyboardContext.d.ts +130 -0
  38. package/dist/components/keyboard/KeyboardContext.d.ts.map +1 -0
  39. package/dist/components/keyboard/KeyboardContext.js +13 -0
  40. package/dist/components/keyboard/KeyboardProvider.d.ts +78 -0
  41. package/dist/components/keyboard/KeyboardProvider.d.ts.map +1 -0
  42. package/dist/components/keyboard/KeyboardProvider.js +183 -0
  43. package/dist/components/keyboard/OnScreenKeyboard.d.ts +65 -43
  44. package/dist/components/keyboard/OnScreenKeyboard.d.ts.map +1 -1
  45. package/dist/components/keyboard/OnScreenKeyboard.js +119 -113
  46. package/dist/components/keyboard/index.d.ts +2 -1
  47. package/dist/components/keyboard/index.d.ts.map +1 -1
  48. package/dist/components/keyboard/index.js +2 -1
  49. package/dist/components/keyboard/keyboard-config.d.ts +40 -36
  50. package/dist/components/keyboard/keyboard-config.d.ts.map +1 -1
  51. package/dist/components/keyboard/keyboard-config.js +15 -10
  52. package/dist/components/keyboard/use-keyboard-field.d.ts +6 -4
  53. package/dist/components/keyboard/use-keyboard-field.d.ts.map +1 -1
  54. package/dist/components/keyboard/use-keyboard-field.js +12 -12
  55. package/dist/components/modal/Modal.d.ts.map +1 -1
  56. package/dist/components/modal/Modal.js +59 -65
  57. package/dist/components/multi-select/MultiSelect.d.ts +75 -40
  58. package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
  59. package/dist/components/multi-select/MultiSelect.js +188 -188
  60. package/dist/components/multi-select/multi-select-config.d.ts +2 -20
  61. package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
  62. package/dist/components/multi-select/multi-select-config.js +10 -14
  63. package/dist/components/select/Select.d.ts +60 -45
  64. package/dist/components/select/Select.d.ts.map +1 -1
  65. package/dist/components/select/Select.js +149 -161
  66. package/dist/components/select/select-config.d.ts +3 -29
  67. package/dist/components/select/select-config.d.ts.map +1 -1
  68. package/dist/components/select/select-config.js +6 -14
  69. package/dist/components/select/select-styles.js +1 -6
  70. package/dist/components/select-menu/SelectMenu.d.ts +48 -42
  71. package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
  72. package/dist/components/select-menu/SelectMenu.js +137 -123
  73. package/dist/components/select-menu/select-menu-config.d.ts +33 -2
  74. package/dist/components/select-menu/select-menu-config.d.ts.map +1 -1
  75. package/dist/components/select-menu/select-menu-config.js +3 -1
  76. package/dist/components/sidebar/Sidebar.js +1 -1
  77. package/dist/components/switch/Switch.d.ts +9 -33
  78. package/dist/components/switch/Switch.d.ts.map +1 -1
  79. package/dist/components/switch/Switch.js +68 -74
  80. package/dist/components/switch/switch-styles.d.ts +1 -6
  81. package/dist/components/switch/switch-styles.d.ts.map +1 -1
  82. package/dist/components/switch/switch-styles.js +6 -12
  83. package/dist/components/tabs/Tabs.js +1 -1
  84. package/dist/components/textarea/Textarea.d.ts +19 -1
  85. package/dist/components/textarea/Textarea.d.ts.map +1 -1
  86. package/dist/components/textarea/Textarea.js +95 -90
  87. package/dist/components/toast/ToastContext.d.ts +122 -0
  88. package/dist/components/toast/ToastContext.d.ts.map +1 -0
  89. package/dist/components/toast/ToastContext.js +28 -0
  90. package/dist/components/toast/ToastProvider.d.ts +98 -0
  91. package/dist/components/toast/ToastProvider.d.ts.map +1 -0
  92. package/dist/components/toast/ToastProvider.js +188 -0
  93. package/dist/components/toast/index.d.ts +2 -1
  94. package/dist/components/toast/index.d.ts.map +1 -1
  95. package/dist/components/toast/index.js +2 -1
  96. package/dist/components/toast/toast-config.d.ts +36 -0
  97. package/dist/components/toast/toast-config.d.ts.map +1 -1
  98. package/dist/icons/ChevronUpIcon.d.ts +3 -0
  99. package/dist/icons/ChevronUpIcon.d.ts.map +1 -0
  100. package/dist/icons/ChevronUpIcon.js +21 -0
  101. package/dist/icons/index.d.ts +2 -0
  102. package/dist/icons/index.d.ts.map +1 -1
  103. package/dist/index.css +24 -2
  104. package/dist/index.d.ts +1 -0
  105. package/dist/index.d.ts.map +1 -1
  106. package/dist/index.js +62 -59
  107. package/dist/theme/color.js +2 -2
  108. package/package.json +1 -1
  109. package/dist/components/keyboard/keyboard-context.d.ts +0 -118
  110. package/dist/components/keyboard/keyboard-context.d.ts.map +0 -1
  111. package/dist/components/keyboard/keyboard-context.js +0 -90
  112. package/dist/components/toast/toast-context.d.ts +0 -163
  113. package/dist/components/toast/toast-context.d.ts.map +0 -1
  114. package/dist/components/toast/toast-context.js +0 -177
@@ -0,0 +1,46 @@
1
+ import { Color } from '../../shared';
2
+ interface TimeSpinnerProps {
3
+ /**
4
+ * The current value of the spinner.
5
+ * Range is 0-23 for hours, 0-59 for minutes and seconds.
6
+ */
7
+ value: number;
8
+ /**
9
+ * The maximum value for the spinner.
10
+ * Used for wrapping when incrementing/decrementing past the limit.
11
+ */
12
+ max: number;
13
+ /**
14
+ * Display label for the spinner.
15
+ * Typically "HH", "MM", or "SS".
16
+ */
17
+ label: string;
18
+ /**
19
+ * Callback fired when the value changes.
20
+ * Receives the new value.
21
+ */
22
+ onChange: (v: number) => void;
23
+ /**
24
+ * Resolved color for the spinner.
25
+ * Used for hover states and accent colors.
26
+ */
27
+ resolvedColor: Color;
28
+ /**
29
+ * CSS class for corner rounding.
30
+ * Applied to the increment/decrement buttons and input.
31
+ */
32
+ radiusClass: string;
33
+ }
34
+ /**
35
+ * Time spinner control for selecting hours, minutes, or seconds.
36
+ *
37
+ * TimeSpinner renders a vertical spinner with increment and decrement
38
+ * buttons around a display input. The value wraps around when reaching
39
+ * the min or max limits (0 to max, and max to 0). It also allows direct
40
+ * keyboard input with automatic validation and fallback.
41
+ *
42
+ * @param props - TimeSpinner configuration options.
43
+ */
44
+ export declare function TimeSpinner({ value, max, label, onChange, resolvedColor, radiusClass, }: TimeSpinnerProps): import("react").JSX.Element;
45
+ export {};
46
+ //# sourceMappingURL=TimeSpinner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeSpinner.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/TimeSpinner.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAO1C,UAAU,gBAAgB;IACxB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B;;;OAGG;IACH,aAAa,EAAE,KAAK,CAAC;IACrB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,GAAG,EACH,KAAK,EACL,QAAQ,EACR,aAAa,EACb,WAAW,GACZ,EAAE,gBAAgB,+BAgGlB"}
@@ -0,0 +1,84 @@
1
+ "use client";
2
+ import { jsxs as w, jsx as r } from "react/jsx-runtime";
3
+ import { useState as D, useEffect as v } from "react";
4
+ import { pad2 as c } from "./date-picker.helpers.js";
5
+ import { CALENDAR_COLOR_CLASSES as d } from "./date-picker-styles.js";
6
+ import { ChevronUpIcon as N } from "../../icons/ChevronUpIcon.js";
7
+ import { cn as f } from "../../utils/cn.js";
8
+ import { ChevronDownIcon as k } from "../../icons/ChevronDownIcon.js";
9
+ function V({
10
+ value: t,
11
+ max: i,
12
+ label: n,
13
+ onChange: s,
14
+ resolvedColor: h,
15
+ radiusClass: a
16
+ }) {
17
+ const [l, o] = D(c(t));
18
+ v(() => {
19
+ o(c(t));
20
+ }, [t]);
21
+ const u = () => s(t >= i ? 0 : t + 1), p = () => s(t <= 0 ? i : t - 1), x = (e) => {
22
+ const y = e.target.value.replace(/\D/g, "");
23
+ o(y);
24
+ }, b = () => {
25
+ const e = parseInt(l, 10);
26
+ Number.isNaN(e) || e < 0 || e > i ? o(c(t)) : (s(e), o(c(e)));
27
+ }, g = (e) => {
28
+ e.key === "Enter" ? (e.preventDefault(), e.currentTarget.blur()) : e.key === "ArrowUp" ? (e.preventDefault(), u()) : e.key === "ArrowDown" && (e.preventDefault(), p());
29
+ }, m = d[h] ?? d.primary;
30
+ return /* @__PURE__ */ w("div", { className: "flex flex-col items-center gap-1 group", children: [
31
+ /* @__PURE__ */ r("span", { className: "text-[10px] font-medium uppercase tracking-widest text-foreground/50 select-none mb-0.5", children: n }),
32
+ /* @__PURE__ */ r(
33
+ "button",
34
+ {
35
+ type: "button",
36
+ className: f(
37
+ "w-10 h-7 flex items-center justify-center text-foreground/50 transition-all",
38
+ "hover:text-foreground active:scale-95",
39
+ a,
40
+ m.hover
41
+ ),
42
+ onClick: u,
43
+ "aria-label": `Increment ${n}`,
44
+ children: /* @__PURE__ */ r(N, {})
45
+ }
46
+ ),
47
+ /* @__PURE__ */ r(
48
+ "input",
49
+ {
50
+ type: "text",
51
+ inputMode: "numeric",
52
+ maxLength: 2,
53
+ value: l,
54
+ onChange: x,
55
+ onBlur: b,
56
+ onKeyDown: g,
57
+ "aria-label": `${n} input`,
58
+ className: f(
59
+ "w-11 h-11 text-center text-base font-mono font-medium text-foreground bg-background transition-shadow",
60
+ "border border-border/70 hover:border-border focus:outline-none focus:ring-2 focus:border-transparent focus:z-10",
61
+ a
62
+ )
63
+ }
64
+ ),
65
+ /* @__PURE__ */ r(
66
+ "button",
67
+ {
68
+ type: "button",
69
+ className: f(
70
+ "w-10 h-7 flex items-center justify-center text-foreground/50 transition-all",
71
+ "hover:text-foreground active:scale-95",
72
+ a,
73
+ m.hover
74
+ ),
75
+ onClick: p,
76
+ "aria-label": `Decrement ${n}`,
77
+ children: /* @__PURE__ */ r(k, {})
78
+ }
79
+ )
80
+ ] });
81
+ }
82
+ export {
83
+ V as TimeSpinner
84
+ };
@@ -25,6 +25,17 @@ export interface DatePickerConfig extends FieldConfig {
25
25
  * @default "date"
26
26
  */
27
27
  mode?: PickerMode;
28
+ /**
29
+ * Picker configuration for the calendar popover.
30
+ * Controls portal behavior and other picker-specific settings.
31
+ */
32
+ picker?: PickerConfig;
33
+ }
34
+ /**
35
+ * Picker configuration for the DatePicker component.
36
+ * Extends DatePickerConfig to allow override of portal settings.
37
+ */
38
+ export interface PickerConfig {
28
39
  /**
29
40
  * Whether to render the calendar popover in a React portal.
30
41
  * When true, the popover is rendered at the document body level,
@@ -52,7 +63,16 @@ export declare const defaultDatePickerConfig: DatePickerConfig;
52
63
  * These values are used when instance props, component config,
53
64
  * and global defaults are all undefined.
54
65
  */
55
- export declare const FALLBACK_DATE_PICKER_CONFIG: Required<DatePickerConfig>;
66
+ export declare const FALLBACK_DATE_PICKER_CONFIG: {
67
+ readonly mode: "date";
68
+ readonly size: FieldSizeKey;
69
+ readonly radius: import('../..').Radius;
70
+ readonly variant: import('../..').Variant;
71
+ readonly color: import('../..').Color;
72
+ readonly labelAlign: import('../field').LabelAlign;
73
+ readonly fullWidth: boolean;
74
+ readonly status: import('../field').FieldStatus;
75
+ };
56
76
  declare module "../../libs/registry" {
57
77
  interface ComponentTypeConfigRegistry {
58
78
  datePicker: DatePickerConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker-config.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/date-picker-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAE/B;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD;;;;;OAKG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACnC;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAKrC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,gBAAgB,CAKzD,CAAC;AAEX,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,2BAA2B;QACnC,UAAU,EAAE,gBAAgB,CAAC;KAC9B;CACF"}
1
+ {"version":3,"file":"date-picker-config.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/date-picker-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAE/B;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD;;;;;OAKG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACnC;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAGrC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;CAG9B,CAAC;AAEX,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,2BAA2B;QACnC,UAAU,EAAE,gBAAgB,CAAC;KAC9B;CACF"}
@@ -1,19 +1,15 @@
1
1
  "use client";
2
- import { registerComponentDefaults as t } from "../../libs/registry.js";
3
- import { FALLBACK_FIELD_CONFIG as e, defaultFieldConfig as o } from "../field/field-config.js";
4
- const r = {
2
+ import { registerComponentDefaults as e } from "../../libs/registry.js";
3
+ import { FALLBACK_FIELD_CONFIG as t, defaultFieldConfig as o } from "../field/field-config.js";
4
+ const i = {
5
5
  ...o,
6
- mode: "date",
7
- portal: !0,
8
- portalTarget: null
9
- }, i = {
10
- ...e,
11
- mode: "date",
12
- portal: !0,
13
- portalTarget: null
6
+ mode: "date"
7
+ }, C = {
8
+ ...t,
9
+ mode: "date"
14
10
  };
15
- t("datePicker", r);
11
+ e("datePicker", i);
16
12
  export {
17
- i as FALLBACK_DATE_PICKER_CONFIG,
18
- r as defaultDatePickerConfig
13
+ C as FALLBACK_DATE_PICKER_CONFIG,
14
+ i as defaultDatePickerConfig
19
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker-styles.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/date-picker-styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGvE;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAI/D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAIpE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAC7C,CAAC;AAE5B;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CACzC,KAAK,GAAG,MAAM,EACd;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAsC5D,CAAC"}
1
+ {"version":3,"file":"date-picker-styles.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/date-picker-styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKvE;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAI/D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAIpE,CAAC;AAIF;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAC7C,CAAC;AAI5B;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CACzC,KAAK,GAAG,MAAM,EACd;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAsC5D,CAAC"}
@@ -1,14 +1,9 @@
1
1
  "use client";
2
- import { FIELD_STATUS_BORDER_CLASS as r } from "../field/field-styles.js";
3
- const t = {
4
- sm: "h-8 px-2.5 text-xs",
5
- md: "h-10 px-3 text-sm",
6
- lg: "h-12 px-4 text-base"
7
- }, o = {
2
+ const r = {
8
3
  sm: "size-7 text-xs",
9
4
  md: "size-8 text-xs",
10
5
  lg: "size-9 text-sm"
11
- }, g = r, s = {
6
+ }, e = {
12
7
  default: {
13
8
  bg: "bg-foreground text-background",
14
9
  text: "text-foreground",
@@ -47,8 +42,6 @@ const t = {
47
42
  }
48
43
  };
49
44
  export {
50
- s as CALENDAR_COLOR_CLASSES,
51
- o as DATE_PICKER_CELL_SIZE_CLASS,
52
- t as DATE_PICKER_SIZE_CLASS,
53
- g as DATE_PICKER_STATUS_BORDER_CLASS
45
+ e as CALENDAR_COLOR_CLASSES,
46
+ r as DATE_PICKER_CELL_SIZE_CLASS
54
47
  };
@@ -0,0 +1,111 @@
1
+ /**
2
+ * DatePicker helper functions for AsheeUI.
3
+ * This file provides utility functions for date formatting, parsing,
4
+ * calendar grid building, and input cursor management.
5
+ */
6
+ /**
7
+ * Array of abbreviated day names starting with Sunday.
8
+ * Used for the calendar header.
9
+ */
10
+ export declare const DAYS_OF_WEEK: readonly ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
11
+ /**
12
+ * Array of full month names from January to December.
13
+ * Used for the calendar month header.
14
+ */
15
+ export declare const MONTHS: readonly ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
16
+ /**
17
+ * The selection mode of the date picker.
18
+ * - `date`: Select only a date.
19
+ * - `time`: Select only a time.
20
+ * - `datetime`: Select both date and time.
21
+ */
22
+ export type PickerMode = "date" | "time" | "datetime";
23
+ /**
24
+ * Pads a number with leading zero to two digits.
25
+ * Used for formatting hours, minutes, and seconds.
26
+ *
27
+ * @param n - The number to pad.
28
+ * @returns The zero-padded string representation.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * pad2(5) // "05"
33
+ * pad2(23) // "23"
34
+ * ```
35
+ */
36
+ export declare function pad2(n: number): string;
37
+ /**
38
+ * Formats a date object as a string based on the mode.
39
+ *
40
+ * @param date - The date to format.
41
+ * @param mode - The picker mode.
42
+ * @returns A formatted date string.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * const date = new Date(2024, 0, 15, 14, 30, 45);
47
+ * formatDisplay(date, "date") // "15/01/2024"
48
+ * formatDisplay(date, "time") // "14:30:45"
49
+ * formatDisplay(date, "datetime") // "15/01/2024 14:30:45"
50
+ * ```
51
+ */
52
+ export declare function formatDisplay(date: Date, mode: PickerMode): string;
53
+ /**
54
+ * Gets the default placeholder text for the input based on mode.
55
+ *
56
+ * @param mode - The picker mode.
57
+ * @returns The placeholder text.
58
+ */
59
+ export declare function getDefaultPlaceholder(mode: PickerMode): string;
60
+ /**
61
+ * Builds a 2D array of day numbers for the calendar grid.
62
+ * Returns a flat array where null values represent empty slots
63
+ * before the first day of the month.
64
+ *
65
+ * @param year - The year of the month to display.
66
+ * @param month - The month (0-indexed) to display.
67
+ * @returns A flat array of day numbers and null values.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * // For January 2024 (starts on Monday)
72
+ * buildDayCells(2024, 0)
73
+ * // [null, 1, 2, 3, 4, 5, 6, 7, ..., 31, null, null]
74
+ * ```
75
+ */
76
+ export declare function buildDayCells(year: number, month: number): (number | null)[];
77
+ /**
78
+ * Parses a digit string into a Date object based on the mode.
79
+ * Supports partial input and auto-completes missing fields.
80
+ *
81
+ * @param input - The digit string to parse.
82
+ * @param mode - The picker mode.
83
+ * @param fallbackDate - Optional fallback date for missing values.
84
+ * @returns The parsed date or null if no digits provided.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * parseDateString("15012024", "date") // Date(2024, 0, 15)
89
+ * parseDateString("1430", "time") // Date with 14:30
90
+ * parseDateString("150120241430", "datetime") // Date(2024, 0, 15, 14, 30)
91
+ * ```
92
+ */
93
+ export declare function parseDateString(input: string, mode: PickerMode, fallbackDate?: Date): Date | null;
94
+ /**
95
+ * Calculates the new cursor position after input formatting.
96
+ * Ensures the cursor stays at the correct position when the
97
+ * input value is automatically formatted.
98
+ *
99
+ * @param oldValue - The value before formatting.
100
+ * @param newValue - The value after formatting.
101
+ * @param oldSelectionStart - The cursor position before formatting.
102
+ * @returns The new cursor position.
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * // User typed "15" in a date input
107
+ * getNewCursorPosition("", "15/01/2024", 0) // 2 (after "15")
108
+ * ```
109
+ */
110
+ export declare function getNewCursorPosition(oldValue: string, newValue: string, oldSelectionStart: number): number;
111
+ //# sourceMappingURL=date-picker.helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-picker.helpers.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/date-picker.helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;GAGG;AACH,eAAO,MAAM,YAAY,qDAAsD,CAAC;AAEhF;;;GAGG;AACH,eAAO,MAAM,MAAM,qIAaT,CAAC;AAIX;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;AAItD;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEtC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAgBlE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAS9D;AAID;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAS5E;AAID;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,UAAU,EAChB,YAAY,CAAC,EAAE,IAAI,GAClB,IAAI,GAAG,IAAI,CAsDb;AAID;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,MAAM,GACxB,MAAM,CAqBR"}
@@ -0,0 +1,110 @@
1
+ "use client";
2
+ const d = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], D = [
3
+ "January",
4
+ "February",
5
+ "March",
6
+ "April",
7
+ "May",
8
+ "June",
9
+ "July",
10
+ "August",
11
+ "September",
12
+ "October",
13
+ "November",
14
+ "December"
15
+ ];
16
+ function l(n) {
17
+ return String(n).padStart(2, "0");
18
+ }
19
+ function p(n, r) {
20
+ const o = l(n.getDate()), t = l(n.getMonth() + 1), s = n.getFullYear(), i = l(n.getHours()), c = l(n.getMinutes()), e = l(n.getSeconds());
21
+ switch (r) {
22
+ case "date":
23
+ return `${o}/${t}/${s}`;
24
+ case "time":
25
+ return `${i}:${c}:${e}`;
26
+ case "datetime":
27
+ return `${o}/${t}/${s} ${i}:${c}:${e}`;
28
+ }
29
+ }
30
+ function M(n) {
31
+ switch (n) {
32
+ case "date":
33
+ return "Select date...";
34
+ case "time":
35
+ return "Select time...";
36
+ case "datetime":
37
+ return "Select date & time...";
38
+ }
39
+ }
40
+ function y(n, r) {
41
+ const o = new Date(n, r + 1, 0).getDate(), t = new Date(n, r, 1).getDay(), s = [
42
+ ...Array(t).fill(null),
43
+ ...Array.from({ length: o }, (i, c) => c + 1)
44
+ ];
45
+ for (; s.length % 7 !== 0; ) s.push(null);
46
+ return s;
47
+ }
48
+ function I(n, r, o) {
49
+ const t = n.replace(/\D/g, "");
50
+ if (t.length === 0) return null;
51
+ const s = o ?? /* @__PURE__ */ new Date();
52
+ switch (r) {
53
+ case "date": {
54
+ const i = parseInt(t.slice(0, 2), 10) || 1, c = parseInt(t.slice(2, 4), 10) || 1;
55
+ let e = parseInt(t.slice(4, 8), 10) || s.getFullYear();
56
+ t.length === 4 && (e = 2e3 + e), t.length === 2 && (e = s.getFullYear());
57
+ const a = Math.min(c - 1, 11), u = new Date(e, a + 1, 0).getDate(), h = Math.min(i, u);
58
+ return new Date(e, a, h);
59
+ }
60
+ case "time": {
61
+ const i = parseInt(t.slice(0, 2), 10) || 0, c = parseInt(t.slice(2, 4), 10) || 0, e = parseInt(t.slice(4, 6), 10) || 0, a = s;
62
+ return new Date(
63
+ a.getFullYear(),
64
+ a.getMonth(),
65
+ a.getDate(),
66
+ Math.min(i, 23),
67
+ Math.min(c, 59),
68
+ Math.min(e, 59)
69
+ );
70
+ }
71
+ case "datetime": {
72
+ const i = parseInt(t.slice(0, 2), 10) || 1, c = parseInt(t.slice(2, 4), 10) || 1;
73
+ let e = parseInt(t.slice(4, 8), 10) || s.getFullYear();
74
+ t.length >= 4 && t.length < 8 && (e = 2e3 + e), t.length < 4 && (e = s.getFullYear());
75
+ const a = parseInt(t.slice(8, 10), 10) || 0, u = parseInt(t.slice(10, 12), 10) || 0, h = parseInt(t.slice(12, 14), 10) || 0, g = Math.min(c - 1, 11), m = new Date(e, g + 1, 0).getDate(), f = Math.min(i, m);
76
+ return new Date(
77
+ e,
78
+ g,
79
+ f,
80
+ Math.min(a, 23),
81
+ Math.min(u, 59),
82
+ Math.min(h, 59)
83
+ );
84
+ }
85
+ }
86
+ }
87
+ function $(n, r, o) {
88
+ if (o >= n.length) return r.length;
89
+ const s = (n.slice(0, o).match(/\d/g) || []).length;
90
+ let i = 0;
91
+ for (let c = 0; c < r.length; c++)
92
+ if (/\d/.test(r[c]) && i++, i > s) {
93
+ let e = 0;
94
+ for (let a = 0; a < r.length; a++)
95
+ if (/\d/.test(r[a]) && e++, e === s + 1)
96
+ return a + 1;
97
+ return r.length;
98
+ }
99
+ return r.length;
100
+ }
101
+ export {
102
+ d as DAYS_OF_WEEK,
103
+ D as MONTHS,
104
+ y as buildDayCells,
105
+ p as formatDisplay,
106
+ M as getDefaultPlaceholder,
107
+ $ as getNewCursorPosition,
108
+ l as pad2,
109
+ I as parseDateString
110
+ };
@@ -1,3 +1,6 @@
1
+ export * from "./Calendar.js";
1
2
  export * from "./DatePicker.js";
3
+ export * from "./TimeSpinner.js";
2
4
  export * from "./date-picker-config.js";
3
5
  export * from "./date-picker-styles.js";
6
+ export * from "./date-picker.helpers.js";
@@ -1,4 +1,5 @@
1
1
  import { default as React, InputHTMLAttributes, ReactNode } from 'react';
2
+ import { KeyboardOpenOptions } from '../keyboard';
2
3
  import { InputConfig } from './input-config';
3
4
  type BaseInputProps = InputConfig & Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "color" | "children">;
4
5
  /**
@@ -48,9 +49,12 @@ export interface InputProps extends BaseInputProps {
48
49
  * Whether the virtual keyboard should be enabled for mobile devices.
49
50
  * Controls the inputmode attribute.
50
51
  *
52
+ * When enabled, the input will use the virtual keyboard system.
53
+ * Can also be an object to configure the keyboard behavior.
54
+ *
51
55
  * @default true
52
56
  */
53
- enableVirtualKeyboard?: boolean;
57
+ enableVirtualKeyboard?: boolean | KeyboardOpenOptions;
54
58
  }
55
59
  /**
56
60
  * A form input field with label, description, validation message,
@@ -110,19 +114,21 @@ export interface InputProps extends BaseInputProps {
110
114
  *
111
115
  * @example
112
116
  * ```tsx
113
- * // With validation state
117
+ * // With virtual keyboard configuration
114
118
  * <Input
115
- * label="Password"
116
- * type="password"
117
- * status="error"
118
- * message="Password must be at least 8 characters"
119
- * required
119
+ * label="Numeric Input"
120
+ * enableVirtualKeyboard={{
121
+ * layout: "numeric",
122
+ * size: "lg",
123
+ * color: "primary"
124
+ * }}
120
125
  * />
121
126
  * ```
122
127
  *
123
128
  * @see InputConfig - The configuration type for component defaults.
124
129
  * @see FieldShell - The wrapper component for label and validation.
125
130
  * @see useAsheeConfig - Hook for accessing the global configuration.
131
+ * @see useKeyboardField - Hook for connecting inputs to the virtual keyboard.
126
132
  */
127
133
  export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
128
134
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/input/Input.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,EAEZ,KAAK,mBAAmB,EACxB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAqBf,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKlD,KAAK,cAAc,GAAG,WAAW,GAC/B,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC,CAAC;AAE7E;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IAEzB;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IAEvB;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AACH,eAAO,MAAM,KAAK,qFA4LjB,CAAC"}
1
+ {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/input/Input.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,EAEZ,KAAK,mBAAmB,EACxB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAoBf,OAAO,EAAE,KAAK,mBAAmB,EAAoB,MAAM,aAAa,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKlD,KAAK,cAAc,GAAG,WAAW,GAC/B,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC,CAAC;AAE7E;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IAEzB;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IAEvB;;;;;;;;OAQG;IACH,qBAAqB,CAAC,EAAE,OAAO,GAAG,mBAAmB,CAAC;CACvD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AACH,eAAO,MAAM,KAAK,qFAyMjB,CAAC"}