@hellboy/ds 0.1.3 → 0.2.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.
Files changed (298) hide show
  1. package/README.md +512 -162
  2. package/{src/style/components/badge → dist/components}/badge.css +9 -25
  3. package/dist/components/badge.d.mts +12 -0
  4. package/dist/components/badge.d.ts +12 -0
  5. package/dist/components/badge.js +42 -0
  6. package/dist/components/badge.mjs +15 -0
  7. package/dist/components/banner.css +280 -0
  8. package/dist/components/banner.d.mts +12 -0
  9. package/dist/components/banner.d.ts +12 -0
  10. package/dist/components/banner.js +184 -0
  11. package/dist/components/banner.mjs +147 -0
  12. package/dist/components/button-group.css +289 -0
  13. package/dist/components/button-group.d.mts +81 -0
  14. package/dist/components/button-group.d.ts +81 -0
  15. package/dist/components/button-group.js +180 -0
  16. package/dist/components/button-group.mjs +143 -0
  17. package/{src/style/components/button → dist/components}/button.css +59 -62
  18. package/dist/components/button.d.mts +57 -0
  19. package/dist/components/button.d.ts +57 -0
  20. package/dist/components/button.js +129 -0
  21. package/dist/components/button.mjs +92 -0
  22. package/{src/style/components/card → dist/components}/card.css +9 -30
  23. package/dist/components/card.d.mts +31 -0
  24. package/dist/components/card.d.ts +31 -0
  25. package/dist/components/card.js +59 -0
  26. package/dist/components/card.mjs +32 -0
  27. package/{src/style → dist}/components/checkbox.css +51 -43
  28. package/dist/components/checkbox.d.mts +31 -0
  29. package/dist/components/checkbox.d.ts +31 -0
  30. package/dist/components/checkbox.js +130 -0
  31. package/dist/components/checkbox.mjs +93 -0
  32. package/{src/style/components/code-block → dist/components}/code-block.css +3 -7
  33. package/dist/components/code-block.d.mts +24 -0
  34. package/dist/components/code-block.d.ts +24 -0
  35. package/dist/components/code-block.js +43 -0
  36. package/dist/components/code-block.mjs +16 -0
  37. package/dist/components/color-control.css +285 -0
  38. package/dist/components/color-control.d.mts +5 -0
  39. package/dist/components/color-control.d.ts +5 -0
  40. package/dist/components/color-control.js +534 -0
  41. package/dist/components/color-control.mjs +497 -0
  42. package/dist/components/dialog.css +930 -0
  43. package/dist/components/dialog.d.mts +32 -0
  44. package/dist/components/dialog.d.ts +32 -0
  45. package/dist/components/dialog.js +1111 -0
  46. package/dist/components/dialog.mjs +1074 -0
  47. package/dist/components/divider.css +356 -0
  48. package/dist/components/divider.d.mts +32 -0
  49. package/dist/components/divider.d.ts +32 -0
  50. package/dist/components/divider.js +344 -0
  51. package/dist/components/divider.mjs +307 -0
  52. package/{src/style/components/drag-handle → dist/components}/drag-handle.css +3 -18
  53. package/dist/components/drag-handle.d.mts +11 -0
  54. package/dist/components/drag-handle.d.ts +11 -0
  55. package/dist/components/drag-handle.js +103 -0
  56. package/dist/components/drag-handle.mjs +66 -0
  57. package/dist/components/drawer.css +1027 -0
  58. package/dist/components/drawer.d.mts +14 -0
  59. package/dist/components/drawer.d.ts +14 -0
  60. package/dist/components/drawer.js +1072 -0
  61. package/dist/components/drawer.mjs +1035 -0
  62. package/dist/components/floating-bar.css +17 -0
  63. package/dist/components/floating-bar.d.mts +25 -0
  64. package/dist/components/floating-bar.d.ts +25 -0
  65. package/dist/components/floating-bar.js +52 -0
  66. package/dist/components/floating-bar.mjs +25 -0
  67. package/dist/components/footer.css +40 -0
  68. package/dist/components/footer.d.mts +8 -0
  69. package/dist/components/footer.d.ts +8 -0
  70. package/dist/components/footer.js +44 -0
  71. package/dist/components/footer.mjs +17 -0
  72. package/dist/components/grid.css +47 -0
  73. package/dist/components/grid.d.mts +27 -0
  74. package/dist/components/grid.d.ts +27 -0
  75. package/dist/components/grid.js +52 -0
  76. package/dist/components/grid.mjs +25 -0
  77. package/dist/components/header.css +1075 -0
  78. package/dist/components/header.d.mts +35 -0
  79. package/dist/components/header.d.ts +35 -0
  80. package/dist/components/header.js +1402 -0
  81. package/dist/components/header.mjs +1365 -0
  82. package/dist/components/hero.css +121 -0
  83. package/dist/components/hero.d.mts +111 -0
  84. package/dist/components/hero.d.ts +111 -0
  85. package/dist/components/hero.js +285 -0
  86. package/dist/components/hero.mjs +248 -0
  87. package/{src/style/components/icons → dist/components}/icons.css +14 -15
  88. package/dist/components/icons.d.mts +104 -0
  89. package/dist/components/icons.d.ts +104 -0
  90. package/dist/components/icons.js +239 -0
  91. package/dist/components/icons.mjs +203 -0
  92. package/{src/style/components/input → dist/components}/input.css +189 -102
  93. package/dist/components/input.d.mts +114 -0
  94. package/dist/components/input.d.ts +114 -0
  95. package/dist/components/input.js +926 -0
  96. package/dist/components/input.mjs +879 -0
  97. package/dist/components/layout.css +551 -0
  98. package/dist/components/layout.d.mts +16 -0
  99. package/dist/components/layout.d.ts +16 -0
  100. package/dist/components/layout.js +387 -0
  101. package/dist/components/layout.mjs +352 -0
  102. package/{src/style/components/list → dist/components}/list.css +47 -41
  103. package/dist/components/list.d.mts +46 -0
  104. package/dist/components/list.d.ts +46 -0
  105. package/dist/components/list.js +124 -0
  106. package/dist/components/list.mjs +96 -0
  107. package/dist/components/navbar.css +706 -0
  108. package/dist/components/navbar.d.mts +56 -0
  109. package/dist/components/navbar.d.ts +56 -0
  110. package/dist/components/navbar.js +994 -0
  111. package/dist/components/navbar.mjs +952 -0
  112. package/{src/style/components/page-index → dist/components}/page-index.css +2 -47
  113. package/dist/components/page-index.d.mts +25 -0
  114. package/dist/components/page-index.d.ts +25 -0
  115. package/dist/components/page-index.js +239 -0
  116. package/dist/components/page-index.mjs +202 -0
  117. package/{src/style/components/page → dist/components}/page.css +4 -15
  118. package/dist/components/page.d.mts +30 -0
  119. package/dist/components/page.d.ts +30 -0
  120. package/dist/components/page.js +40 -0
  121. package/dist/components/page.mjs +13 -0
  122. package/dist/components/popover.css +87 -0
  123. package/dist/components/popover.d.mts +22 -0
  124. package/dist/components/popover.d.ts +22 -0
  125. package/dist/components/popover.js +243 -0
  126. package/dist/components/popover.mjs +206 -0
  127. package/{src/style → dist}/components/radio.css +8 -51
  128. package/dist/components/radio.d.mts +59 -0
  129. package/dist/components/radio.d.ts +59 -0
  130. package/dist/components/radio.js +133 -0
  131. package/dist/components/radio.mjs +95 -0
  132. package/dist/components/section.css +993 -0
  133. package/dist/components/section.d.mts +33 -0
  134. package/dist/components/section.d.ts +33 -0
  135. package/dist/components/section.js +1401 -0
  136. package/dist/components/section.mjs +1364 -0
  137. package/dist/components/select.css +391 -0
  138. package/dist/components/select.d.mts +63 -0
  139. package/dist/components/select.d.ts +63 -0
  140. package/dist/components/select.js +452 -0
  141. package/dist/components/select.mjs +415 -0
  142. package/{src/style/components/slider → dist/components}/slider.css +55 -33
  143. package/dist/components/slider.d.mts +69 -0
  144. package/dist/components/slider.d.ts +69 -0
  145. package/dist/components/slider.js +254 -0
  146. package/dist/components/slider.mjs +217 -0
  147. package/dist/components/switch.css +1081 -0
  148. package/dist/components/switch.d.mts +33 -0
  149. package/dist/components/switch.d.ts +33 -0
  150. package/dist/components/switch.js +1092 -0
  151. package/dist/components/switch.mjs +1055 -0
  152. package/{src/style/components/table → dist/components}/table.css +3 -28
  153. package/dist/components/table.d.mts +42 -0
  154. package/dist/components/table.d.ts +42 -0
  155. package/dist/components/table.js +108 -0
  156. package/dist/components/table.mjs +76 -0
  157. package/dist/components/tag.css +97 -0
  158. package/dist/components/tag.d.mts +12 -0
  159. package/dist/components/tag.d.ts +12 -0
  160. package/dist/components/tag.js +42 -0
  161. package/dist/components/tag.mjs +15 -0
  162. package/dist/components/textarea.css +1359 -0
  163. package/dist/components/textarea.d.mts +84 -0
  164. package/dist/components/textarea.d.ts +84 -0
  165. package/dist/components/textarea.js +1962 -0
  166. package/dist/components/textarea.mjs +1924 -0
  167. package/{src/style/components/theme-control → dist/components}/theme-control.css +3 -7
  168. package/dist/components/theme-control.d.mts +9 -0
  169. package/dist/components/theme-control.d.ts +9 -0
  170. package/dist/components/theme-control.js +235 -0
  171. package/dist/components/theme-control.mjs +200 -0
  172. package/{src/style/components/tooltip → dist/components}/tooltip.css +5 -13
  173. package/dist/components/tooltip.d.mts +12 -0
  174. package/dist/components/tooltip.d.ts +12 -0
  175. package/dist/components/tooltip.js +200 -0
  176. package/dist/components/tooltip.mjs +163 -0
  177. package/dist/icons-Czahnf-r.d.mts +15 -0
  178. package/dist/icons-Czahnf-r.d.ts +15 -0
  179. package/dist/index.css +2914 -2067
  180. package/dist/index.d.mts +144 -721
  181. package/dist/index.d.ts +144 -721
  182. package/dist/index.js +4076 -2282
  183. package/dist/index.mjs +4132 -2366
  184. package/dist/theme.css +34 -34
  185. package/package.json +27 -8
  186. package/dist/index.css.map +0 -1
  187. package/dist/index.js.map +0 -1
  188. package/dist/index.mjs.map +0 -1
  189. package/hellboy-ds-0.1.2.tgz +0 -0
  190. package/src/components/badge/Badge.tsx +0 -29
  191. package/src/components/badge/index.ts +0 -1
  192. package/src/components/banner/Banner.tsx +0 -48
  193. package/src/components/banner/banner.css +0 -44
  194. package/src/components/banner/index.ts +0 -1
  195. package/src/components/button/button.tsx +0 -127
  196. package/src/components/button/index.ts +0 -1
  197. package/src/components/card/card.tsx +0 -57
  198. package/src/components/card/index.ts +0 -1
  199. package/src/components/checkbox/Checkbox.tsx +0 -98
  200. package/src/components/checkbox/index.ts +0 -1
  201. package/src/components/code-block/code-block.tsx +0 -44
  202. package/src/components/code-block/index.ts +0 -1
  203. package/src/components/color-control/color-control.tsx +0 -322
  204. package/src/components/color-control/index.ts +0 -1
  205. package/src/components/drag-handle/DragHandle.tsx +0 -78
  206. package/src/components/drag-handle/index.ts +0 -1
  207. package/src/components/drawer/drawer.tsx +0 -82
  208. package/src/components/drawer/index.ts +0 -1
  209. package/src/components/floating-bar/floating-bar.tsx +0 -52
  210. package/src/components/floating-bar/index.ts +0 -2
  211. package/src/components/footer/footer.tsx +0 -28
  212. package/src/components/footer/index.ts +0 -1
  213. package/src/components/grid/Grid.tsx +0 -53
  214. package/src/components/grid/index.ts +0 -1
  215. package/src/components/header/header.tsx +0 -57
  216. package/src/components/header/index.ts +0 -1
  217. package/src/components/icons/icons.tsx +0 -44
  218. package/src/components/icons/index.ts +0 -1
  219. package/src/components/index.ts +0 -29
  220. package/src/components/input/DatePicker.tsx +0 -133
  221. package/src/components/input/Input.tsx +0 -220
  222. package/src/components/input/InputDate.tsx +0 -10
  223. package/src/components/input/InputDateTime.tsx +0 -10
  224. package/src/components/input/InputEmail.tsx +0 -10
  225. package/src/components/input/InputField.tsx +0 -137
  226. package/src/components/input/InputNumber.tsx +0 -10
  227. package/src/components/input/InputPassword.tsx +0 -10
  228. package/src/components/input/InputSearch.tsx +0 -10
  229. package/src/components/input/InputTel.tsx +0 -10
  230. package/src/components/input/InputText.tsx +0 -10
  231. package/src/components/input/InputTime.tsx +0 -10
  232. package/src/components/input/InputUrl.tsx +0 -10
  233. package/src/components/input/TimePicker.tsx +0 -151
  234. package/src/components/input/index.ts +0 -11
  235. package/src/components/layout/Layout.tsx +0 -244
  236. package/src/components/layout/index.ts +0 -1
  237. package/src/components/list/List.tsx +0 -159
  238. package/src/components/list/index.ts +0 -1
  239. package/src/components/navbar/MenuCategory.tsx +0 -20
  240. package/src/components/navbar/MenuGroup.tsx +0 -288
  241. package/src/components/navbar/MenuItem.tsx +0 -65
  242. package/src/components/navbar/Navbar.tsx +0 -23
  243. package/src/components/navbar/index.ts +0 -4
  244. package/src/components/page/index.ts +0 -1
  245. package/src/components/page/page.tsx +0 -46
  246. package/src/components/page-index/PageIndex.tsx +0 -275
  247. package/src/components/page-index/index.ts +0 -1
  248. package/src/components/popover/index.ts +0 -1
  249. package/src/components/popover/popover.tsx +0 -199
  250. package/src/components/radio/Radio.tsx +0 -176
  251. package/src/components/radio/index.ts +0 -1
  252. package/src/components/section/index.ts +0 -1
  253. package/src/components/section/section.tsx +0 -66
  254. package/src/components/select/Select.tsx +0 -212
  255. package/src/components/select/index.ts +0 -1
  256. package/src/components/slider/Slider.tsx +0 -267
  257. package/src/components/slider/index.ts +0 -1
  258. package/src/components/switch/index.ts +0 -1
  259. package/src/components/switch/switch.tsx +0 -99
  260. package/src/components/table/Table.tsx +0 -147
  261. package/src/components/table/index.ts +0 -1
  262. package/src/components/theme-control/index.ts +0 -1
  263. package/src/components/theme-control/theme-control.tsx +0 -78
  264. package/src/components/tooltip/index.ts +0 -1
  265. package/src/components/tooltip/tooltip.tsx +0 -207
  266. package/src/contexts/NavbarTooltipContext.tsx +0 -48
  267. package/src/contexts/index.ts +0 -1
  268. package/src/foundations/motion.md +0 -136
  269. package/src/index.ts +0 -40
  270. package/src/style/_shared/field.css +0 -69
  271. package/src/style/components/color-control/color-control.css +0 -126
  272. package/src/style/components/drawer/drawer.css +0 -210
  273. package/src/style/components/floating-bar/floating-bar.css +0 -39
  274. package/src/style/components/footer/footer.css +0 -108
  275. package/src/style/components/grid/grid.css +0 -33
  276. package/src/style/components/header/header.css +0 -44
  277. package/src/style/components/layout/layout.css +0 -205
  278. package/src/style/components/navbar/navbar.css +0 -342
  279. package/src/style/components/popover/popover.css +0 -44
  280. package/src/style/components/section/section.css +0 -67
  281. package/src/style/components/select/select.css +0 -143
  282. package/src/style/components/switch/switch.css +0 -267
  283. package/src/style/foundations/global.css +0 -316
  284. package/src/style/foundations/motion.css +0 -164
  285. package/src/style/foundations/spacing.css +0 -51
  286. package/src/style/foundations/typography.css +0 -39
  287. package/src/style/foundations/z-index.css +0 -81
  288. package/src/style/modes/dark.css +0 -146
  289. package/src/style/modes/light.css +0 -147
  290. package/src/style/semantic.css +0 -52
  291. package/src/style/styles.css +0 -51
  292. package/src/style/themes/theme.json +0 -37
  293. package/src/utils/README.md +0 -305
  294. package/src/utils/USER_PREFERENCES.md +0 -558
  295. package/src/utils/theme.ts +0 -127
  296. package/src/utils/user-preferences.ts +0 -577
  297. package/tsconfig.json +0 -25
  298. package/tsup.config.ts +0 -52
@@ -0,0 +1,1364 @@
1
+ // src/components/_shared/Backdrop.tsx
2
+ import * as React from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ var Backdrop = React.forwardRef(
5
+ ({ className = "", blur = true, style, ...props }, ref) => {
6
+ return /* @__PURE__ */ jsx(
7
+ "div",
8
+ {
9
+ ref,
10
+ className: `backdrop ${blur ? "backdrop--blur" : ""} ${className}`,
11
+ style,
12
+ "aria-hidden": "true",
13
+ ...props
14
+ }
15
+ );
16
+ }
17
+ );
18
+ Backdrop.displayName = "Backdrop";
19
+
20
+ // src/components/icons/icons.tsx
21
+ import { Icon as IconifyIcon } from "@iconify/react";
22
+ import { jsx as jsx2 } from "react/jsx-runtime";
23
+ var Icon = ({ name, size = 24, className, loading = false, ...rest }) => {
24
+ const iconName = name.includes(":") ? name : `heroicons:${name}`;
25
+ const classes = ["icon", className].filter(Boolean).join(" ");
26
+ if (loading) {
27
+ const style = { width: size, height: size };
28
+ return /* @__PURE__ */ jsx2(
29
+ "span",
30
+ {
31
+ className: `${classes} icon--skeleton`,
32
+ style,
33
+ "aria-hidden": rest["aria-label"] ? "false" : "true",
34
+ ...rest["aria-label"] ? { "aria-label": rest["aria-label"] } : {}
35
+ }
36
+ );
37
+ }
38
+ return /* @__PURE__ */ jsx2(
39
+ IconifyIcon,
40
+ {
41
+ icon: iconName,
42
+ width: size,
43
+ height: size,
44
+ className: classes,
45
+ ...rest
46
+ }
47
+ );
48
+ };
49
+
50
+ // src/components/icons/iconConstants.ts
51
+ var INPUT_TYPE_ICONS = {
52
+ // Standard HTML input types
53
+ email: "envelope-solid",
54
+ password: "lock-closed-solid",
55
+ search: "magnifying-glass-solid",
56
+ date: "calendar-days-solid",
57
+ time: "clock-solid",
58
+ "datetime-local": "calendar-days-solid",
59
+ tel: "phone-solid",
60
+ url: "link-solid",
61
+ number: "hashtag-solid",
62
+ // Additional semantic types
63
+ username: "user-solid",
64
+ name: "user-solid",
65
+ firstname: "user-solid",
66
+ lastname: "user-solid",
67
+ address: "map-pin-solid",
68
+ city: "building-solid",
69
+ state: "map-solid",
70
+ zip: "map-pin-solid",
71
+ "zip-code": "map-pin-solid",
72
+ country: "globe-americas-solid",
73
+ creditcard: "credit-card-solid",
74
+ card: "credit-card-solid",
75
+ cvv: "lock-closed-solid",
76
+ expiry: "calendar-days-solid",
77
+ "expiration-date": "calendar-days-solid",
78
+ // File and media types
79
+ file: "document-solid",
80
+ image: "photo-solid",
81
+ video: "video-camera-solid",
82
+ audio: "microphone-solid",
83
+ // Communication
84
+ message: "chat-bubble-left-solid",
85
+ comment: "chat-bubble-left-solid",
86
+ feedback: "chat-bubble-left-solid",
87
+ // Actions and states
88
+ submit: "paper-airplane-solid",
89
+ send: "paper-airplane-solid",
90
+ save: "floppy-disk-solid",
91
+ edit: "pencil-solid",
92
+ delete: "trash-solid",
93
+ remove: "x-mark-solid",
94
+ add: "plus-solid",
95
+ create: "plus-solid",
96
+ upload: "arrow-up-tray-solid",
97
+ download: "arrow-down-tray-solid",
98
+ refresh: "arrow-path-solid",
99
+ reload: "arrow-path-solid",
100
+ settings: "cog-solid",
101
+ config: "cog-solid",
102
+ filter: "funnel-solid",
103
+ sort: "bars-arrow-up-solid"
104
+ };
105
+ var ACTION_ICONS = {
106
+ close: "x-mark-solid",
107
+ back: "arrow-left-solid",
108
+ forward: "arrow-right-solid",
109
+ up: "arrow-up-solid",
110
+ down: "arrow-down-solid",
111
+ expand: "chevron-down-solid",
112
+ collapse: "chevron-up-solid",
113
+ menu: "bars-3-solid",
114
+ more: "ellipsis-horizontal-solid",
115
+ check: "check-solid",
116
+ cross: "x-mark-solid",
117
+ plus: "plus-solid",
118
+ minus: "minus-solid",
119
+ search: "magnifying-glass-solid",
120
+ clear: "x-mark-solid",
121
+ loading: "arrow-path-solid",
122
+ error: "exclamation-triangle-solid",
123
+ warning: "exclamation-triangle-solid",
124
+ info: "information-circle-solid",
125
+ success: "check-circle-solid"
126
+ };
127
+
128
+ // src/components/_shared/Thumb.tsx
129
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
130
+
131
+ // src/components/_shared/HeadingAnchor.tsx
132
+ import { useState as useState6, useMemo } from "react";
133
+
134
+ // src/components/dialog/Dialog.tsx
135
+ import * as React3 from "react";
136
+ import { createPortal } from "react-dom";
137
+
138
+ // src/components/button/button.tsx
139
+ import React2 from "react";
140
+ import { Button as AriakitButton } from "@ariakit/react";
141
+ import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
142
+ var Button = React2.forwardRef(
143
+ ({
144
+ variant = "primary",
145
+ size = "md",
146
+ children,
147
+ isLoading = false,
148
+ disabled = false,
149
+ fullWidth = false,
150
+ startIcon,
151
+ endIcon,
152
+ iconOnly = false,
153
+ href,
154
+ active = false,
155
+ className,
156
+ onClick,
157
+ ...props
158
+ }, ref) => {
159
+ const buttonClasses = [
160
+ "btn",
161
+ `btn--${variant}`,
162
+ `btn--${size}`,
163
+ fullWidth && "btn--full-width",
164
+ iconOnly && "btn--icon-only",
165
+ active && "btn--active",
166
+ className
167
+ ].filter(Boolean).join(" ");
168
+ const iconSize = size === "xs" ? 14 : size === "sm" ? 16 : size === "lg" ? 24 : 20;
169
+ const buttonContent = /* @__PURE__ */ jsxs2(Fragment, { children: [
170
+ isLoading && /* @__PURE__ */ jsx4("span", { className: "btn__spinner" }),
171
+ startIcon && (isLoading ? /* @__PURE__ */ jsx4("span", { className: "btn__icon-placeholder", style: { width: iconSize, height: iconSize } }) : /* @__PURE__ */ jsx4(Icon, { name: startIcon, size: iconSize, className: "btn__icon" })),
172
+ !iconOnly && children,
173
+ endIcon && /* @__PURE__ */ jsx4(Icon, { name: endIcon, size: iconSize, className: "btn__icon" })
174
+ ] });
175
+ const handleClick = (e) => {
176
+ if (href && !isLoading && !disabled) {
177
+ window.location.href = href;
178
+ }
179
+ onClick?.(e);
180
+ };
181
+ return /* @__PURE__ */ jsx4(
182
+ AriakitButton,
183
+ {
184
+ ref,
185
+ disabled: disabled || isLoading,
186
+ className: buttonClasses,
187
+ onClick: handleClick,
188
+ ...props,
189
+ children: buttonContent
190
+ }
191
+ );
192
+ }
193
+ );
194
+ Button.displayName = "Button";
195
+
196
+ // src/components/dialog/Dialog.tsx
197
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
198
+ var Dialog = ({
199
+ open,
200
+ onClose,
201
+ title,
202
+ children,
203
+ size = "md",
204
+ footer,
205
+ showCloseButton = true,
206
+ closeOnBackdropClick = true,
207
+ closeOnEscape = true,
208
+ className = "",
209
+ ariaLabel,
210
+ ariaDescribedBy
211
+ }) => {
212
+ const dialogRef = React3.useRef(null);
213
+ React3.useEffect(() => {
214
+ if (!open || !closeOnEscape) return;
215
+ const handleEscape = (e) => {
216
+ if (e.key === "Escape") {
217
+ onClose();
218
+ }
219
+ };
220
+ document.addEventListener("keydown", handleEscape);
221
+ return () => document.removeEventListener("keydown", handleEscape);
222
+ }, [open, closeOnEscape, onClose]);
223
+ React3.useEffect(() => {
224
+ if (open) {
225
+ const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
226
+ document.body.style.overflow = "hidden";
227
+ document.body.style.paddingRight = `${scrollbarWidth}px`;
228
+ } else {
229
+ document.body.style.overflow = "";
230
+ document.body.style.paddingRight = "";
231
+ }
232
+ return () => {
233
+ document.body.style.overflow = "";
234
+ document.body.style.paddingRight = "";
235
+ };
236
+ }, [open]);
237
+ React3.useEffect(() => {
238
+ if (!open || !dialogRef.current) return;
239
+ const dialog = dialogRef.current;
240
+ const focusableElements = dialog.querySelectorAll(
241
+ 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
242
+ );
243
+ const firstElement = focusableElements[0];
244
+ const lastElement = focusableElements[focusableElements.length - 1];
245
+ const handleTab = (e) => {
246
+ if (e.key !== "Tab") return;
247
+ if (e.shiftKey) {
248
+ if (document.activeElement === firstElement) {
249
+ e.preventDefault();
250
+ lastElement?.focus();
251
+ }
252
+ } else {
253
+ if (document.activeElement === lastElement) {
254
+ e.preventDefault();
255
+ firstElement?.focus();
256
+ }
257
+ }
258
+ };
259
+ dialog.addEventListener("keydown", handleTab);
260
+ firstElement?.focus();
261
+ return () => {
262
+ dialog.removeEventListener("keydown", handleTab);
263
+ };
264
+ }, [open]);
265
+ const handleBackdropClick = (e) => {
266
+ if (closeOnBackdropClick && e.target === e.currentTarget) {
267
+ onClose();
268
+ }
269
+ };
270
+ if (!open) return null;
271
+ const dialogContent = /* @__PURE__ */ jsxs3("div", { className: "dialog__portal", children: [
272
+ /* @__PURE__ */ jsx5(Backdrop, { onClick: handleBackdropClick, "data-enter": "" }),
273
+ /* @__PURE__ */ jsxs3(
274
+ "div",
275
+ {
276
+ ref: dialogRef,
277
+ className: `dialog dialog--${size} ${className}`,
278
+ role: "dialog",
279
+ "aria-modal": "true",
280
+ "aria-label": ariaLabel || title,
281
+ "aria-describedby": ariaDescribedBy,
282
+ children: [
283
+ (title || showCloseButton) && /* @__PURE__ */ jsxs3("div", { className: "dialog__header", children: [
284
+ title && /* @__PURE__ */ jsx5("h2", { className: "dialog__title", children: title }),
285
+ showCloseButton && /* @__PURE__ */ jsx5(
286
+ Button,
287
+ {
288
+ variant: "ghost",
289
+ className: "dialog__close",
290
+ startIcon: ACTION_ICONS.close,
291
+ iconOnly: true,
292
+ onClick: onClose,
293
+ "aria-label": "Close dialog"
294
+ }
295
+ )
296
+ ] }),
297
+ /* @__PURE__ */ jsx5("div", { className: "dialog__content scrollable", children }),
298
+ footer && /* @__PURE__ */ jsx5("div", { className: "dialog__footer", children: footer })
299
+ ]
300
+ }
301
+ )
302
+ ] });
303
+ return createPortal(dialogContent, document.body);
304
+ };
305
+
306
+ // src/components/input/InputText.tsx
307
+ import React9 from "react";
308
+
309
+ // src/components/input/Input.tsx
310
+ import * as React8 from "react";
311
+
312
+ // src/components/input/InputField.tsx
313
+ import * as React4 from "react";
314
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
315
+ var InputField = React4.forwardRef(
316
+ ({
317
+ type = "text",
318
+ label,
319
+ helperText,
320
+ error,
321
+ icon,
322
+ iconRight,
323
+ fullWidth = false,
324
+ size = "md",
325
+ className = "",
326
+ disabled,
327
+ id,
328
+ onRightIconClick,
329
+ ...props
330
+ }, ref) => {
331
+ const inputId = id || `input-${React4.useId()}`;
332
+ const containerClasses = [
333
+ "input-container",
334
+ fullWidth && "input-container--full-width",
335
+ className
336
+ ].filter(Boolean).join(" ");
337
+ const inputClasses = [
338
+ "input",
339
+ `input--${size}`,
340
+ error && "input--error",
341
+ disabled && "input--disabled",
342
+ icon && "input--has-icon-left",
343
+ iconRight && "input--has-icon-right"
344
+ ].filter(Boolean).join(" ");
345
+ return /* @__PURE__ */ jsxs4("div", { className: containerClasses, children: [
346
+ label && /* @__PURE__ */ jsx6("label", { htmlFor: inputId, className: "input__label", children: label }),
347
+ /* @__PURE__ */ jsxs4("div", { className: "input__wrapper", children: [
348
+ icon && /* @__PURE__ */ jsx6("span", { className: "input__icon input__icon--left", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(Icon, { name: icon, size: 16 }) }),
349
+ /* @__PURE__ */ jsx6(
350
+ "input",
351
+ {
352
+ ref,
353
+ type,
354
+ id: inputId,
355
+ className: inputClasses,
356
+ disabled,
357
+ ...props
358
+ }
359
+ ),
360
+ iconRight && /* @__PURE__ */ jsx6(
361
+ "button",
362
+ {
363
+ type: "button",
364
+ className: "input__icon input__icon--right",
365
+ onClick: onRightIconClick,
366
+ tabIndex: -1,
367
+ "aria-label": "Icon action",
368
+ children: /* @__PURE__ */ jsx6(Icon, { name: iconRight, size: 16 })
369
+ }
370
+ )
371
+ ] }),
372
+ error && /* @__PURE__ */ jsx6("p", { className: "input__message input__message--error", children: error }),
373
+ helperText && !error && /* @__PURE__ */ jsx6("p", { className: "input__message", children: helperText })
374
+ ] });
375
+ }
376
+ );
377
+
378
+ // src/components/popover/popover.tsx
379
+ import * as React5 from "react";
380
+ import * as ReactDOM from "react-dom";
381
+ import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
382
+ var Popover = ({
383
+ trigger,
384
+ children,
385
+ isOpen,
386
+ onToggle,
387
+ placement = "bottom",
388
+ align = "start",
389
+ offset = 8,
390
+ flip = true,
391
+ closeOnEscape = true,
392
+ closeOnClickOutside = true
393
+ }) => {
394
+ const [internalOpen, setInternalOpen] = React5.useState(false);
395
+ const triggerRef = React5.useRef(null);
396
+ const popoverRef = React5.useRef(null);
397
+ const [popoverStyle, setPopoverStyle] = React5.useState({});
398
+ const [resolvedPlacement, setResolvedPlacement] = React5.useState(placement);
399
+ const isControlled = isOpen !== void 0;
400
+ const open = isControlled ? isOpen : internalOpen;
401
+ const toggle = React5.useCallback(() => {
402
+ if (isControlled) {
403
+ onToggle?.();
404
+ } else {
405
+ setInternalOpen((prev) => !prev);
406
+ }
407
+ }, [isControlled, onToggle]);
408
+ React5.useEffect(() => {
409
+ const handleClickOutside = (event) => {
410
+ if (closeOnClickOutside && triggerRef.current && !triggerRef.current.contains(event.target) && popoverRef.current && !popoverRef.current.contains(event.target)) {
411
+ toggle();
412
+ }
413
+ };
414
+ if (open) {
415
+ document.addEventListener("mousedown", handleClickOutside);
416
+ }
417
+ return () => {
418
+ document.removeEventListener("mousedown", handleClickOutside);
419
+ };
420
+ }, [open, toggle, closeOnClickOutside]);
421
+ React5.useEffect(() => {
422
+ const handleEscapeKey = (event) => {
423
+ if (closeOnEscape && event.key === "Escape" && open) {
424
+ toggle();
425
+ }
426
+ };
427
+ if (open) {
428
+ document.addEventListener("keydown", handleEscapeKey);
429
+ }
430
+ return () => {
431
+ document.removeEventListener("keydown", handleEscapeKey);
432
+ };
433
+ }, [open, toggle, closeOnEscape]);
434
+ React5.useEffect(() => {
435
+ if (!open || !triggerRef.current || !popoverRef.current) {
436
+ return;
437
+ }
438
+ const updatePosition = () => {
439
+ if (!triggerRef.current || !popoverRef.current) {
440
+ return;
441
+ }
442
+ const triggerRect = triggerRef.current.getBoundingClientRect();
443
+ const popoverRect = popoverRef.current.getBoundingClientRect();
444
+ const viewportWidth = window.innerWidth;
445
+ const viewportHeight = window.innerHeight;
446
+ const spaceTop = triggerRect.top;
447
+ const spaceBottom = viewportHeight - triggerRect.bottom;
448
+ const spaceLeft = triggerRect.left;
449
+ const spaceRight = viewportWidth - triggerRect.right;
450
+ let finalPlacement = placement;
451
+ if (flip) {
452
+ if (placement === "right" && spaceRight < popoverRect.width + offset) {
453
+ finalPlacement = spaceLeft >= popoverRect.width + offset ? "left" : "bottom";
454
+ } else if (placement === "left" && spaceLeft < popoverRect.width + offset) {
455
+ finalPlacement = spaceRight >= popoverRect.width + offset ? "right" : "bottom";
456
+ } else if (placement === "bottom" && spaceBottom < popoverRect.height + offset) {
457
+ finalPlacement = spaceTop >= popoverRect.height + offset ? "top" : "bottom";
458
+ } else if (placement === "top" && spaceTop < popoverRect.height + offset) {
459
+ finalPlacement = spaceBottom >= popoverRect.height + offset ? "bottom" : "top";
460
+ }
461
+ }
462
+ setResolvedPlacement(finalPlacement);
463
+ const newStyle = {
464
+ position: "fixed",
465
+ zIndex: "var(--z-popover)",
466
+ opacity: 1,
467
+ visibility: "visible",
468
+ pointerEvents: "auto"
469
+ };
470
+ const getAlignmentOffset = () => {
471
+ let alignmentOffset = 0;
472
+ if (finalPlacement === "left" || finalPlacement === "right") {
473
+ switch (align) {
474
+ case "center":
475
+ alignmentOffset = (triggerRect.height - popoverRect.height) / 2;
476
+ break;
477
+ case "end":
478
+ alignmentOffset = triggerRect.height - popoverRect.height;
479
+ break;
480
+ case "start":
481
+ default:
482
+ alignmentOffset = 0;
483
+ }
484
+ } else {
485
+ switch (align) {
486
+ case "center":
487
+ alignmentOffset = (triggerRect.width - popoverRect.width) / 2;
488
+ break;
489
+ case "end":
490
+ alignmentOffset = triggerRect.width - popoverRect.width;
491
+ break;
492
+ case "start":
493
+ default:
494
+ alignmentOffset = 0;
495
+ }
496
+ }
497
+ return alignmentOffset;
498
+ };
499
+ switch (finalPlacement) {
500
+ case "right":
501
+ newStyle.top = triggerRect.top + getAlignmentOffset();
502
+ newStyle.left = triggerRect.right + offset;
503
+ break;
504
+ case "left":
505
+ newStyle.top = triggerRect.top + getAlignmentOffset();
506
+ newStyle.left = triggerRect.left - popoverRect.width - offset;
507
+ break;
508
+ case "top":
509
+ newStyle.top = triggerRect.top - popoverRect.height - offset;
510
+ newStyle.left = triggerRect.left + getAlignmentOffset();
511
+ break;
512
+ case "bottom":
513
+ default:
514
+ newStyle.top = triggerRect.bottom + offset;
515
+ newStyle.left = triggerRect.left + getAlignmentOffset();
516
+ }
517
+ if (typeof newStyle.left === "number") {
518
+ if (newStyle.left + popoverRect.width > viewportWidth - offset) {
519
+ newStyle.left = viewportWidth - popoverRect.width - offset;
520
+ }
521
+ if (newStyle.left < offset) {
522
+ newStyle.left = offset;
523
+ }
524
+ }
525
+ if (typeof newStyle.top === "number") {
526
+ if (newStyle.top + popoverRect.height > viewportHeight - offset) {
527
+ newStyle.top = viewportHeight - popoverRect.height - offset;
528
+ }
529
+ if (newStyle.top < offset) {
530
+ newStyle.top = offset;
531
+ }
532
+ }
533
+ setPopoverStyle(newStyle);
534
+ };
535
+ requestAnimationFrame(updatePosition);
536
+ window.addEventListener("resize", updatePosition);
537
+ window.addEventListener("scroll", updatePosition, true);
538
+ return () => {
539
+ window.removeEventListener("resize", updatePosition);
540
+ window.removeEventListener("scroll", updatePosition, true);
541
+ };
542
+ }, [open, placement, align, offset, flip]);
543
+ const handleTriggerClick = React5.useCallback(() => {
544
+ toggle();
545
+ }, [toggle]);
546
+ return /* @__PURE__ */ jsxs5(Fragment2, { children: [
547
+ /* @__PURE__ */ jsx7(
548
+ "div",
549
+ {
550
+ ref: triggerRef,
551
+ onClick: handleTriggerClick,
552
+ style: { display: "inline-block", position: "relative" },
553
+ children: React5.isValidElement(trigger) ? React5.cloneElement(trigger, {
554
+ onClick: (e) => {
555
+ e.stopPropagation();
556
+ handleTriggerClick();
557
+ trigger.props?.onClick?.(e);
558
+ }
559
+ }) : trigger
560
+ }
561
+ ),
562
+ open && ReactDOM.createPortal(
563
+ /* @__PURE__ */ jsx7(
564
+ "div",
565
+ {
566
+ ref: popoverRef,
567
+ className: `popover popover--${resolvedPlacement}`,
568
+ style: {
569
+ ...popoverStyle,
570
+ // Start with opacity 0 and visibility hidden to prevent initial flash
571
+ opacity: popoverStyle.top !== void 0 ? 1 : 0,
572
+ visibility: popoverStyle.top !== void 0 ? "visible" : "hidden"
573
+ },
574
+ children: /* @__PURE__ */ jsx7("div", { className: "popover__content", children })
575
+ }
576
+ ),
577
+ document.body
578
+ )
579
+ ] });
580
+ };
581
+
582
+ // src/components/input/DatePicker.tsx
583
+ import * as React6 from "react";
584
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
585
+ var MONTHS = [
586
+ "January",
587
+ "February",
588
+ "March",
589
+ "April",
590
+ "May",
591
+ "June",
592
+ "July",
593
+ "August",
594
+ "September",
595
+ "October",
596
+ "November",
597
+ "December"
598
+ ];
599
+ var DAYS_OF_WEEK = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
600
+ var DatePicker = ({ value, onChange, disabled }) => {
601
+ const parseDate = (dateStr) => {
602
+ if (!dateStr) {
603
+ const today = /* @__PURE__ */ new Date();
604
+ return { year: today.getFullYear(), month: today.getMonth(), day: today.getDate() };
605
+ }
606
+ const [year, month, day] = dateStr.split("-").map(Number);
607
+ return { year, month: month - 1, day };
608
+ };
609
+ const { year: initialYear, month: initialMonth, day: selectedDay } = parseDate(value);
610
+ const [currentYear, setCurrentYear] = React6.useState(initialYear);
611
+ const [currentMonth, setCurrentMonth] = React6.useState(initialMonth);
612
+ const getDaysInMonth = (year, month) => {
613
+ return new Date(year, month + 1, 0).getDate();
614
+ };
615
+ const getFirstDayOfMonth = (year, month) => {
616
+ return new Date(year, month, 1).getDay();
617
+ };
618
+ const handleDateSelect = (day) => {
619
+ if (disabled) return;
620
+ const formattedDate = `${currentYear}-${String(currentMonth + 1).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
621
+ onChange(formattedDate);
622
+ };
623
+ const handlePrevMonth = () => {
624
+ if (currentMonth === 0) {
625
+ setCurrentMonth(11);
626
+ setCurrentYear(currentYear - 1);
627
+ } else {
628
+ setCurrentMonth(currentMonth - 1);
629
+ }
630
+ };
631
+ const handleNextMonth = () => {
632
+ if (currentMonth === 11) {
633
+ setCurrentMonth(0);
634
+ setCurrentYear(currentYear + 1);
635
+ } else {
636
+ setCurrentMonth(currentMonth + 1);
637
+ }
638
+ };
639
+ const daysInMonth = getDaysInMonth(currentYear, currentMonth);
640
+ const firstDay = getFirstDayOfMonth(currentYear, currentMonth);
641
+ const days = [
642
+ ...Array(firstDay).fill(null),
643
+ ...Array.from({ length: daysInMonth }, (_, i) => i + 1)
644
+ ];
645
+ return /* @__PURE__ */ jsxs6("div", { className: "date-picker", children: [
646
+ /* @__PURE__ */ jsxs6("div", { className: "date-picker__header", children: [
647
+ /* @__PURE__ */ jsx8(
648
+ "button",
649
+ {
650
+ type: "button",
651
+ className: "date-picker__nav",
652
+ onClick: handlePrevMonth,
653
+ disabled,
654
+ "aria-label": "Previous month",
655
+ children: "\u2039"
656
+ }
657
+ ),
658
+ /* @__PURE__ */ jsxs6("div", { className: "date-picker__title", children: [
659
+ /* @__PURE__ */ jsx8(
660
+ "select",
661
+ {
662
+ className: "date-picker__select",
663
+ value: currentMonth,
664
+ onChange: (e) => setCurrentMonth(Number(e.target.value)),
665
+ disabled,
666
+ children: MONTHS.map((month, idx) => /* @__PURE__ */ jsx8("option", { value: idx, children: month }, month))
667
+ }
668
+ ),
669
+ /* @__PURE__ */ jsx8(
670
+ "select",
671
+ {
672
+ className: "date-picker__select",
673
+ value: currentYear,
674
+ onChange: (e) => setCurrentYear(Number(e.target.value)),
675
+ disabled,
676
+ children: Array.from({ length: 100 }, (_, i) => currentYear - 50 + i).map((year) => /* @__PURE__ */ jsx8("option", { value: year, children: year }, year))
677
+ }
678
+ )
679
+ ] }),
680
+ /* @__PURE__ */ jsx8(
681
+ "button",
682
+ {
683
+ type: "button",
684
+ className: "date-picker__nav",
685
+ onClick: handleNextMonth,
686
+ disabled,
687
+ "aria-label": "Next month",
688
+ children: "\u203A"
689
+ }
690
+ )
691
+ ] }),
692
+ /* @__PURE__ */ jsx8("div", { className: "date-picker__weekdays", children: DAYS_OF_WEEK.map((day) => /* @__PURE__ */ jsx8("div", { className: "date-picker__weekday", children: day }, day)) }),
693
+ /* @__PURE__ */ jsx8("div", { className: "date-picker__days", children: days.map((day, idx) => /* @__PURE__ */ jsx8(
694
+ "button",
695
+ {
696
+ type: "button",
697
+ className: `date-picker__day ${day === selectedDay ? "date-picker__day--selected" : ""} ${!day ? "date-picker__day--empty" : ""}`,
698
+ onClick: () => day && handleDateSelect(day),
699
+ disabled: !day || disabled,
700
+ children: day || ""
701
+ },
702
+ idx
703
+ )) })
704
+ ] });
705
+ };
706
+
707
+ // src/components/input/TimePicker.tsx
708
+ import * as React7 from "react";
709
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
710
+ var parseTime = (timeStr) => {
711
+ if (!timeStr) return { hours: 0, minutes: 0, seconds: 0, milliseconds: 0 };
712
+ const parts = timeStr.split(":");
713
+ const hours = parseInt(parts[0] || "0", 10);
714
+ const minutes = parseInt(parts[1] || "0", 10);
715
+ const secondsParts = (parts[2] || "0").split(".");
716
+ const seconds = parseInt(secondsParts[0] || "0", 10);
717
+ const milliseconds = parseInt(secondsParts[1] || "0", 10);
718
+ return { hours, minutes, seconds, milliseconds };
719
+ };
720
+ var TimeColumn = ({
721
+ label,
722
+ value,
723
+ max,
724
+ field,
725
+ step,
726
+ disabled,
727
+ onChange
728
+ }) => {
729
+ const items = Array.from({ length: Math.floor(max / step) + 1 }, (_, i) => i * step);
730
+ const columnRef = React7.useRef(null);
731
+ React7.useEffect(() => {
732
+ if (columnRef.current) {
733
+ const selected = columnRef.current.querySelector(".time-picker__item--selected");
734
+ if (selected) {
735
+ selected.scrollIntoView({ block: "center", behavior: "smooth" });
736
+ }
737
+ }
738
+ }, [value]);
739
+ return /* @__PURE__ */ jsxs7("div", { className: "time-picker__column", children: [
740
+ /* @__PURE__ */ jsx9("div", { className: "time-picker__label", children: label }),
741
+ /* @__PURE__ */ jsx9("div", { className: "time-picker__scroll scrollable", ref: columnRef, children: items.map((item) => /* @__PURE__ */ jsx9(
742
+ "button",
743
+ {
744
+ type: "button",
745
+ className: `time-picker__item ${item === value ? "time-picker__item--selected" : ""}`,
746
+ onClick: () => onChange(field, item),
747
+ disabled,
748
+ children: String(item).padStart(field === "milliseconds" ? 3 : 2, "0")
749
+ },
750
+ item
751
+ )) })
752
+ ] });
753
+ };
754
+ var TimePicker = ({
755
+ value,
756
+ onChange,
757
+ disabled,
758
+ showMilliseconds = false,
759
+ minuteStep = 1
760
+ }) => {
761
+ const [internalTime, setInternalTime] = React7.useState(value);
762
+ React7.useEffect(() => {
763
+ setInternalTime(value);
764
+ }, [value]);
765
+ const { hours, minutes, seconds, milliseconds } = parseTime(internalTime);
766
+ const handleChange = (field, newValue) => {
767
+ if (disabled) return;
768
+ const currentParsed = parseTime(internalTime);
769
+ const updated = { ...currentParsed, [field]: newValue };
770
+ let formattedTime = `${String(updated.hours).padStart(2, "0")}:${String(updated.minutes).padStart(2, "0")}:${String(updated.seconds).padStart(2, "0")}`;
771
+ if (showMilliseconds && updated.milliseconds > 0) {
772
+ formattedTime += `.${String(updated.milliseconds).padStart(3, "0")}`;
773
+ }
774
+ setInternalTime(formattedTime);
775
+ onChange(formattedTime);
776
+ };
777
+ return /* @__PURE__ */ jsxs7("div", { className: "time-picker", children: [
778
+ /* @__PURE__ */ jsx9(
779
+ TimeColumn,
780
+ {
781
+ label: "Hours",
782
+ value: hours,
783
+ max: 23,
784
+ field: "hours",
785
+ step: 1,
786
+ disabled,
787
+ onChange: handleChange
788
+ }
789
+ ),
790
+ /* @__PURE__ */ jsx9(
791
+ TimeColumn,
792
+ {
793
+ label: "Minutes",
794
+ value: minutes,
795
+ max: 59,
796
+ field: "minutes",
797
+ step: minuteStep,
798
+ disabled,
799
+ onChange: handleChange
800
+ }
801
+ ),
802
+ /* @__PURE__ */ jsx9(
803
+ TimeColumn,
804
+ {
805
+ label: "Seconds",
806
+ value: seconds,
807
+ max: 59,
808
+ field: "seconds",
809
+ step: 1,
810
+ disabled,
811
+ onChange: handleChange
812
+ }
813
+ ),
814
+ showMilliseconds && /* @__PURE__ */ jsx9(
815
+ TimeColumn,
816
+ {
817
+ label: "ms",
818
+ value: milliseconds,
819
+ max: 999,
820
+ field: "milliseconds",
821
+ step: 1,
822
+ disabled,
823
+ onChange: handleChange
824
+ }
825
+ )
826
+ ] });
827
+ };
828
+
829
+ // src/components/input/Input.tsx
830
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
831
+ var TYPE_ICON_MAP = INPUT_TYPE_ICONS;
832
+ var formatDisplayValue = (val, inputType) => {
833
+ if (!val) return "";
834
+ if (inputType === "date") {
835
+ const [year, month, day] = val.split("-");
836
+ return `${day}/${month}/${year}`;
837
+ }
838
+ if (inputType === "time") {
839
+ return val;
840
+ }
841
+ if (inputType === "datetime-local") {
842
+ const [datePart, timePart] = val.split("T");
843
+ if (datePart && timePart) {
844
+ const [year, month, day] = datePart.split("-");
845
+ return `${day}/${month}/${year} ${timePart}`;
846
+ }
847
+ return val;
848
+ }
849
+ return val;
850
+ };
851
+ var Input = React8.forwardRef(
852
+ ({
853
+ type = "text",
854
+ label,
855
+ helperText,
856
+ error,
857
+ icon,
858
+ fullWidth = false,
859
+ size = "md",
860
+ className = "",
861
+ disabled,
862
+ id,
863
+ showMilliseconds = false,
864
+ minuteStep = 1,
865
+ showClear = true,
866
+ ...props
867
+ }, ref) => {
868
+ const [showPassword, setShowPassword] = React8.useState(false);
869
+ const [showDateTimePicker, setShowDateTimePicker] = React8.useState(false);
870
+ const inputRef = React8.useRef(null);
871
+ const leftIcon = icon || TYPE_ICON_MAP[type];
872
+ const isPasswordType = type === "password";
873
+ const actualType = isPasswordType && showPassword ? "text" : type !== "date" && type !== "time" && type !== "datetime-local" ? type : "text";
874
+ const isDateTimeType = type === "date" || type === "time" || type === "datetime-local";
875
+ const isSearchType = type === "search";
876
+ const hasValue = props.value && String(props.value).length > 0;
877
+ const rightIconName = isPasswordType ? showPassword ? "heroicons:eye-slash-solid" : "heroicons:eye-solid" : isDateTimeType ? "heroicons:chevron-down-solid" : isSearchType && hasValue && showClear ? ACTION_ICONS.clear : void 0;
878
+ const handleRightIconClick = () => {
879
+ if (isPasswordType) {
880
+ setShowPassword(!showPassword);
881
+ } else if (isDateTimeType) {
882
+ setShowDateTimePicker(!showDateTimePicker);
883
+ } else if (isSearchType && hasValue && showClear) {
884
+ if (props.onChange) {
885
+ props.onChange({ target: { value: "" } });
886
+ }
887
+ }
888
+ };
889
+ const handleDateTimeChange = (newValue) => {
890
+ if (props.onChange) {
891
+ props.onChange({ target: { value: newValue } });
892
+ }
893
+ };
894
+ if (!isDateTimeType) {
895
+ return /* @__PURE__ */ jsx10(
896
+ InputField,
897
+ {
898
+ ref: ref || inputRef,
899
+ type: actualType,
900
+ label,
901
+ helperText,
902
+ error,
903
+ icon: leftIcon,
904
+ iconRight: rightIconName,
905
+ onRightIconClick: handleRightIconClick,
906
+ fullWidth,
907
+ size,
908
+ className,
909
+ disabled,
910
+ id,
911
+ ...props
912
+ }
913
+ );
914
+ }
915
+ return /* @__PURE__ */ jsxs8("div", { className: `input-container ${fullWidth ? "input-container--full-width" : ""} ${className}`.trim(), children: [
916
+ label && /* @__PURE__ */ jsx10("label", { htmlFor: id, className: "input__label", children: label }),
917
+ /* @__PURE__ */ jsx10(
918
+ Popover,
919
+ {
920
+ trigger: /* @__PURE__ */ jsx10(
921
+ InputField,
922
+ {
923
+ ref: ref || inputRef,
924
+ type: "text",
925
+ icon: leftIcon,
926
+ iconRight: rightIconName,
927
+ onRightIconClick: () => setShowDateTimePicker(!showDateTimePicker),
928
+ fullWidth,
929
+ size,
930
+ disabled,
931
+ id,
932
+ value: formatDisplayValue(String(props.value || ""), type),
933
+ placeholder: props.placeholder,
934
+ readOnly: true
935
+ }
936
+ ),
937
+ isOpen: showDateTimePicker,
938
+ onToggle: () => setShowDateTimePicker(!showDateTimePicker),
939
+ placement: "bottom",
940
+ children: /* @__PURE__ */ jsxs8("div", { style: { padding: "1rem" }, children: [
941
+ (type === "date" || type === "datetime-local") && /* @__PURE__ */ jsx10(
942
+ DatePicker,
943
+ {
944
+ value: String(props.value || "").split("T")[0],
945
+ onChange: (newDate) => {
946
+ if (type === "datetime-local") {
947
+ const time = String(props.value || "").split("T")[1] || "00:00:00";
948
+ handleDateTimeChange(`${newDate}T${time}`);
949
+ } else {
950
+ handleDateTimeChange(newDate);
951
+ setShowDateTimePicker(false);
952
+ }
953
+ },
954
+ disabled
955
+ }
956
+ ),
957
+ (type === "time" || type === "datetime-local") && /* @__PURE__ */ jsx10(
958
+ TimePicker,
959
+ {
960
+ value: String(props.value || "").split("T")[1] || "00:00:00",
961
+ onChange: (newTime) => {
962
+ if (type === "datetime-local") {
963
+ const date = String(props.value || "").split("T")[0] || (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
964
+ handleDateTimeChange(`${date}T${newTime}`);
965
+ } else {
966
+ handleDateTimeChange(newTime);
967
+ }
968
+ },
969
+ disabled,
970
+ showMilliseconds,
971
+ minuteStep
972
+ }
973
+ )
974
+ ] })
975
+ }
976
+ ),
977
+ error && /* @__PURE__ */ jsx10("p", { className: "input__message input__message--error", children: error }),
978
+ helperText && !error && /* @__PURE__ */ jsx10("p", { className: "input__message", children: helperText })
979
+ ] });
980
+ }
981
+ );
982
+ Input.displayName = "Input";
983
+
984
+ // src/components/input/InputText.tsx
985
+ import { jsx as jsx11 } from "react/jsx-runtime";
986
+ var InputText = React9.forwardRef((props, ref) => {
987
+ return /* @__PURE__ */ jsx11(Input, { ref, ...props, type: "text" });
988
+ });
989
+ InputText.displayName = "InputText";
990
+
991
+ // src/components/input/InputEmail.tsx
992
+ import React10 from "react";
993
+ import { jsx as jsx12 } from "react/jsx-runtime";
994
+ var InputEmail = React10.forwardRef((props, ref) => {
995
+ return /* @__PURE__ */ jsx12(Input, { ref, ...props, type: "email" });
996
+ });
997
+ InputEmail.displayName = "InputEmail";
998
+
999
+ // src/components/input/InputPassword.tsx
1000
+ import React11 from "react";
1001
+ import { jsx as jsx13 } from "react/jsx-runtime";
1002
+ var InputPassword = React11.forwardRef((props, ref) => {
1003
+ return /* @__PURE__ */ jsx13(Input, { ref, ...props, type: "password" });
1004
+ });
1005
+ InputPassword.displayName = "InputPassword";
1006
+
1007
+ // src/components/input/InputSearch.tsx
1008
+ import React12 from "react";
1009
+ import { jsx as jsx14 } from "react/jsx-runtime";
1010
+ var InputSearch = React12.forwardRef((props, ref) => {
1011
+ return /* @__PURE__ */ jsx14(Input, { ref, ...props, type: "search" });
1012
+ });
1013
+ InputSearch.displayName = "InputSearch";
1014
+
1015
+ // src/components/input/InputTel.tsx
1016
+ import React13 from "react";
1017
+ import { jsx as jsx15 } from "react/jsx-runtime";
1018
+ var InputTel = React13.forwardRef((props, ref) => {
1019
+ return /* @__PURE__ */ jsx15(Input, { ref, ...props, type: "tel" });
1020
+ });
1021
+ InputTel.displayName = "InputTel";
1022
+
1023
+ // src/components/input/InputUrl.tsx
1024
+ import React14 from "react";
1025
+ import { jsx as jsx16 } from "react/jsx-runtime";
1026
+ var InputUrl = React14.forwardRef((props, ref) => {
1027
+ return /* @__PURE__ */ jsx16(Input, { ref, ...props, type: "url" });
1028
+ });
1029
+ InputUrl.displayName = "InputUrl";
1030
+
1031
+ // src/components/input/InputNumber.tsx
1032
+ import React15 from "react";
1033
+ import { jsx as jsx17 } from "react/jsx-runtime";
1034
+ var InputNumber = React15.forwardRef((props, ref) => {
1035
+ return /* @__PURE__ */ jsx17(Input, { ref, ...props, type: "number" });
1036
+ });
1037
+ InputNumber.displayName = "InputNumber";
1038
+
1039
+ // src/components/input/InputDate.tsx
1040
+ import React16 from "react";
1041
+ import { jsx as jsx18 } from "react/jsx-runtime";
1042
+ var InputDate = React16.forwardRef((props, ref) => {
1043
+ return /* @__PURE__ */ jsx18(Input, { ref, ...props, type: "date" });
1044
+ });
1045
+ InputDate.displayName = "InputDate";
1046
+
1047
+ // src/components/input/InputTime.tsx
1048
+ import React17 from "react";
1049
+ import { jsx as jsx19 } from "react/jsx-runtime";
1050
+ var InputTime = React17.forwardRef((props, ref) => {
1051
+ return /* @__PURE__ */ jsx19(Input, { ref, ...props, type: "time" });
1052
+ });
1053
+ InputTime.displayName = "InputTime";
1054
+
1055
+ // src/components/input/InputDateTime.tsx
1056
+ import React18 from "react";
1057
+ import { jsx as jsx20 } from "react/jsx-runtime";
1058
+ var InputDateTime = React18.forwardRef((props, ref) => {
1059
+ return /* @__PURE__ */ jsx20(Input, { ref, ...props, type: "datetime-local" });
1060
+ });
1061
+ InputDateTime.displayName = "InputDateTime";
1062
+
1063
+ // src/components/tooltip/tooltip.tsx
1064
+ import * as React19 from "react";
1065
+ import * as ReactDOM2 from "react-dom";
1066
+ import { Fragment as Fragment3, jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
1067
+ var Tooltip = ({
1068
+ content,
1069
+ children,
1070
+ placement = "top",
1071
+ delay = 0,
1072
+ disabled = false
1073
+ }) => {
1074
+ const [isVisible, setIsVisible] = React19.useState(false);
1075
+ const [tooltipStyle, setTooltipStyle] = React19.useState({});
1076
+ const [resolvedPlacement, setResolvedPlacement] = React19.useState(placement);
1077
+ const triggerRef = React19.useRef(null);
1078
+ const tooltipRef = React19.useRef(null);
1079
+ const timeoutRef = React19.useRef();
1080
+ React19.useEffect(() => {
1081
+ if (!isVisible || !triggerRef.current || !tooltipRef.current) {
1082
+ return;
1083
+ }
1084
+ const updatePosition = () => {
1085
+ if (!triggerRef.current || !tooltipRef.current) {
1086
+ return;
1087
+ }
1088
+ const triggerRect = triggerRef.current.getBoundingClientRect();
1089
+ const tooltipRect = tooltipRef.current.getBoundingClientRect();
1090
+ if (tooltipRect.width === 0 || tooltipRect.height === 0) {
1091
+ setTimeout(updatePosition, 10);
1092
+ return;
1093
+ }
1094
+ const gap = 8;
1095
+ const viewportWidth = window.innerWidth;
1096
+ const viewportHeight = window.innerHeight;
1097
+ const spaceTop = triggerRect.top;
1098
+ const spaceBottom = viewportHeight - triggerRect.bottom;
1099
+ const spaceLeft = triggerRect.left;
1100
+ const spaceRight = viewportWidth - triggerRect.right;
1101
+ let finalPlacement = placement;
1102
+ if (placement === "right" && spaceRight < tooltipRect.width + gap) {
1103
+ finalPlacement = spaceLeft >= tooltipRect.width + gap ? "left" : "bottom";
1104
+ } else if (placement === "left" && spaceLeft < tooltipRect.width + gap) {
1105
+ finalPlacement = spaceRight >= tooltipRect.width + gap ? "right" : "bottom";
1106
+ } else if (placement === "bottom" && spaceBottom < tooltipRect.height + gap) {
1107
+ finalPlacement = spaceTop >= tooltipRect.height + gap ? "top" : "bottom";
1108
+ } else if (placement === "top" && spaceTop < tooltipRect.height + gap) {
1109
+ finalPlacement = spaceBottom >= tooltipRect.height + gap ? "bottom" : "top";
1110
+ }
1111
+ setResolvedPlacement(finalPlacement);
1112
+ const newStyle = {
1113
+ position: "fixed",
1114
+ zIndex: 1e4,
1115
+ opacity: 1,
1116
+ visibility: "visible",
1117
+ pointerEvents: "auto"
1118
+ };
1119
+ switch (finalPlacement) {
1120
+ case "right":
1121
+ newStyle.top = triggerRect.top + (triggerRect.height - tooltipRect.height) / 2;
1122
+ newStyle.left = triggerRect.right + gap;
1123
+ break;
1124
+ case "left":
1125
+ newStyle.top = triggerRect.top + (triggerRect.height - tooltipRect.height) / 2;
1126
+ newStyle.left = triggerRect.left - tooltipRect.width - gap;
1127
+ break;
1128
+ case "top":
1129
+ newStyle.top = triggerRect.top - tooltipRect.height - gap;
1130
+ newStyle.left = triggerRect.left + (triggerRect.width - tooltipRect.width) / 2;
1131
+ break;
1132
+ case "bottom":
1133
+ default:
1134
+ newStyle.top = triggerRect.bottom + gap;
1135
+ newStyle.left = triggerRect.left + (triggerRect.width - tooltipRect.width) / 2;
1136
+ }
1137
+ if (newStyle.left < 0) {
1138
+ newStyle.left = 0;
1139
+ } else if (newStyle.left + tooltipRect.width > viewportWidth) {
1140
+ newStyle.left = viewportWidth - tooltipRect.width;
1141
+ }
1142
+ if (newStyle.top < 0) {
1143
+ newStyle.top = 0;
1144
+ } else if (newStyle.top + tooltipRect.height > viewportHeight) {
1145
+ newStyle.top = viewportHeight - tooltipRect.height;
1146
+ }
1147
+ setTooltipStyle(newStyle);
1148
+ };
1149
+ requestAnimationFrame(updatePosition);
1150
+ window.addEventListener("resize", updatePosition);
1151
+ window.addEventListener("scroll", updatePosition, true);
1152
+ return () => {
1153
+ window.removeEventListener("resize", updatePosition);
1154
+ window.removeEventListener("scroll", updatePosition, true);
1155
+ };
1156
+ }, [isVisible, placement]);
1157
+ const handleMouseEnter = () => {
1158
+ if (disabled) return;
1159
+ if (timeoutRef.current) {
1160
+ clearTimeout(timeoutRef.current);
1161
+ }
1162
+ timeoutRef.current = setTimeout(() => {
1163
+ setIsVisible(true);
1164
+ }, delay);
1165
+ };
1166
+ const handleMouseLeave = () => {
1167
+ if (timeoutRef.current) {
1168
+ clearTimeout(timeoutRef.current);
1169
+ }
1170
+ timeoutRef.current = setTimeout(() => {
1171
+ setIsVisible(false);
1172
+ }, 150);
1173
+ };
1174
+ const handleClick = () => {
1175
+ if (timeoutRef.current) {
1176
+ clearTimeout(timeoutRef.current);
1177
+ }
1178
+ setIsVisible(false);
1179
+ };
1180
+ const childElement = React19.Children.only(children);
1181
+ const childWithHandlers = React19.cloneElement(childElement, {
1182
+ ref: triggerRef,
1183
+ onMouseEnter: (e) => {
1184
+ childElement.props?.onMouseEnter?.(e);
1185
+ handleMouseEnter();
1186
+ },
1187
+ onMouseLeave: (e) => {
1188
+ childElement.props?.onMouseLeave?.(e);
1189
+ handleMouseLeave();
1190
+ },
1191
+ onClick: (e) => {
1192
+ childElement.props?.onClick?.(e);
1193
+ handleClick();
1194
+ }
1195
+ });
1196
+ return /* @__PURE__ */ jsxs9(Fragment3, { children: [
1197
+ childWithHandlers,
1198
+ isVisible && !disabled && ReactDOM2.createPortal(
1199
+ /* @__PURE__ */ jsx21(
1200
+ "div",
1201
+ {
1202
+ ref: tooltipRef,
1203
+ className: `tooltip tooltip--${resolvedPlacement}`,
1204
+ style: {
1205
+ ...tooltipStyle,
1206
+ // Start with opacity 0 and visibility hidden to prevent initial flash
1207
+ opacity: tooltipStyle.top !== void 0 ? 1 : 0,
1208
+ visibility: tooltipStyle.top !== void 0 ? "visible" : "hidden"
1209
+ },
1210
+ onMouseEnter: () => {
1211
+ if (timeoutRef.current) {
1212
+ clearTimeout(timeoutRef.current);
1213
+ }
1214
+ },
1215
+ onMouseLeave: handleMouseLeave,
1216
+ children: /* @__PURE__ */ jsx21("div", { className: "tooltip__content", children: content })
1217
+ }
1218
+ ),
1219
+ document.body
1220
+ )
1221
+ ] });
1222
+ };
1223
+
1224
+ // src/components/_shared/HeadingAnchor.tsx
1225
+ import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
1226
+ function generateHeadingId(text) {
1227
+ return text.toLowerCase().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").trim();
1228
+ }
1229
+ var HeadingAnchor = ({
1230
+ title,
1231
+ id: customId,
1232
+ className = "heading-anchor",
1233
+ dialogTitle = "Section Link"
1234
+ }) => {
1235
+ const [isDialogOpen, setIsDialogOpen] = useState6(false);
1236
+ const [copySuccess, setCopySuccess] = useState6(false);
1237
+ const headingId = useMemo(() => {
1238
+ return customId || generateHeadingId(title);
1239
+ }, [title, customId]);
1240
+ const headingUrl = useMemo(() => {
1241
+ if (typeof window !== "undefined") {
1242
+ const baseUrl = window.location.origin + window.location.pathname;
1243
+ return `${baseUrl}#${headingId}`;
1244
+ }
1245
+ return "";
1246
+ }, [headingId]);
1247
+ const handleHashClick = (e) => {
1248
+ e.preventDefault();
1249
+ setIsDialogOpen(true);
1250
+ setCopySuccess(false);
1251
+ };
1252
+ const handleCopyAndClose = async () => {
1253
+ try {
1254
+ await navigator.clipboard.writeText(headingUrl);
1255
+ setCopySuccess(true);
1256
+ setTimeout(() => {
1257
+ setIsDialogOpen(false);
1258
+ setCopySuccess(false);
1259
+ }, 300);
1260
+ } catch (err) {
1261
+ console.error("Failed to copy:", err);
1262
+ }
1263
+ };
1264
+ const handleCloseDialog = () => {
1265
+ setIsDialogOpen(false);
1266
+ setCopySuccess(false);
1267
+ };
1268
+ return /* @__PURE__ */ jsxs10(Fragment4, { children: [
1269
+ /* @__PURE__ */ jsx22(Tooltip, { content: `Copy link to this ${dialogTitle.toLowerCase()}`, placement: "top", children: /* @__PURE__ */ jsx22(
1270
+ Button,
1271
+ {
1272
+ variant: "ghost",
1273
+ size: "sm",
1274
+ className,
1275
+ onClick: handleHashClick,
1276
+ "aria-label": `Copy link to ${title}`,
1277
+ startIcon: "heroicons:hashtag-16-solid",
1278
+ iconOnly: true
1279
+ }
1280
+ ) }),
1281
+ /* @__PURE__ */ jsx22(
1282
+ Dialog,
1283
+ {
1284
+ open: isDialogOpen,
1285
+ onClose: handleCloseDialog,
1286
+ title: dialogTitle,
1287
+ size: "md",
1288
+ footer: /* @__PURE__ */ jsx22(Button, { variant: "secondary", onClick: handleCloseDialog, children: "Close" }),
1289
+ children: /* @__PURE__ */ jsxs10("div", { style: { display: "flex", flexDirection: "column", gap: "var(--spacing-4)" }, children: [
1290
+ /* @__PURE__ */ jsxs10("p", { style: { margin: 0, color: "var(--color-text-secondary)" }, children: [
1291
+ "Copy the link below to share this ",
1292
+ dialogTitle.toLowerCase(),
1293
+ ":"
1294
+ ] }),
1295
+ /* @__PURE__ */ jsx22(
1296
+ InputText,
1297
+ {
1298
+ value: headingUrl,
1299
+ readOnly: true,
1300
+ onClick: (e) => e.currentTarget.select(),
1301
+ style: { fontFamily: "monospace", fontSize: "var(--font-size-sm)" }
1302
+ }
1303
+ ),
1304
+ /* @__PURE__ */ jsx22(
1305
+ Button,
1306
+ {
1307
+ variant: "primary",
1308
+ onClick: handleCopyAndClose,
1309
+ style: { width: "100%" },
1310
+ children: copySuccess ? "Copied! Closing..." : "Copy link and close dialog"
1311
+ }
1312
+ )
1313
+ ] })
1314
+ }
1315
+ )
1316
+ ] });
1317
+ };
1318
+ function useHeadingId(title, customId) {
1319
+ return useMemo(() => {
1320
+ if (customId) return customId;
1321
+ if (typeof title === "string" && title.trim()) {
1322
+ return generateHeadingId(title);
1323
+ }
1324
+ return void 0;
1325
+ }, [title, customId]);
1326
+ }
1327
+
1328
+ // src/components/section/section.tsx
1329
+ import { jsx as jsx23, jsxs as jsxs11 } from "react/jsx-runtime";
1330
+ var Section = ({ title, children, size = "md", className }) => {
1331
+ const sectionClasses = [
1332
+ "section",
1333
+ size !== "md" && `section--${size}`,
1334
+ className
1335
+ ].filter(Boolean).join(" ");
1336
+ const sectionId = useHeadingId(title);
1337
+ const titleText = typeof title === "string" ? title : void 0;
1338
+ return /* @__PURE__ */ jsxs11(
1339
+ "section",
1340
+ {
1341
+ className: sectionClasses,
1342
+ id: sectionId,
1343
+ "data-section-title": titleText,
1344
+ children: [
1345
+ title && /* @__PURE__ */ jsxs11("h2", { className: "section__title", children: [
1346
+ title,
1347
+ sectionId && titleText && /* @__PURE__ */ jsx23(
1348
+ HeadingAnchor,
1349
+ {
1350
+ title: titleText,
1351
+ id: sectionId,
1352
+ className: "section__hash-link",
1353
+ dialogTitle: "Section Link"
1354
+ }
1355
+ )
1356
+ ] }),
1357
+ /* @__PURE__ */ jsx23("div", { className: "section__content", children })
1358
+ ]
1359
+ }
1360
+ );
1361
+ };
1362
+ export {
1363
+ Section
1364
+ };