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