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