@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,69 @@
1
+ import React__default from 'react';
2
+
3
+ interface SliderProps {
4
+ /**
5
+ * Minimum value
6
+ * @default 0
7
+ */
8
+ min?: number;
9
+ /**
10
+ * Maximum value
11
+ * @default 100
12
+ */
13
+ max?: number;
14
+ /**
15
+ * Current value
16
+ */
17
+ value: number;
18
+ /**
19
+ * Step increment
20
+ * @default 1
21
+ */
22
+ step?: number;
23
+ /**
24
+ * Callback when value changes
25
+ */
26
+ onChange: (value: number) => void;
27
+ /**
28
+ * Callback when drag starts
29
+ */
30
+ onDragStart?: () => void;
31
+ /**
32
+ * Callback when drag ends (value committed)
33
+ */
34
+ onChangeEnd?: (value: number) => void;
35
+ /**
36
+ * Label for the slider
37
+ */
38
+ label?: string;
39
+ /**
40
+ * Show value display
41
+ * @default true
42
+ */
43
+ showValue?: boolean;
44
+ /**
45
+ * Custom class name
46
+ */
47
+ className?: string;
48
+ /**
49
+ * Disabled state
50
+ * @default false
51
+ */
52
+ disabled?: boolean;
53
+ /**
54
+ * Slider type for different backgrounds
55
+ * @default 'default'
56
+ */
57
+ type?: 'default' | 'hue' | 'saturation' | 'lightness';
58
+ /**
59
+ * Base color for saturation/lightness gradients (hsl values)
60
+ */
61
+ baseHue?: number;
62
+ /**
63
+ * Base saturation for lightness gradient (0-100)
64
+ */
65
+ baseSaturation?: number;
66
+ }
67
+ declare const Slider: React__default.FC<SliderProps>;
68
+
69
+ export { Slider, type SliderProps };
@@ -0,0 +1,254 @@
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/slider/index.ts
31
+ var slider_exports = {};
32
+ __export(slider_exports, {
33
+ Slider: () => Slider
34
+ });
35
+ module.exports = __toCommonJS(slider_exports);
36
+
37
+ // src/components/slider/Slider.tsx
38
+ var import_react2 = __toESM(require("react"));
39
+
40
+ // src/components/icons/icons.tsx
41
+ var import_react = require("@iconify/react");
42
+ var import_jsx_runtime = require("react/jsx-runtime");
43
+ var Icon = ({ name, size = 24, className, loading = false, ...rest }) => {
44
+ const iconName = name.includes(":") ? name : `heroicons:${name}`;
45
+ const classes = ["icon", className].filter(Boolean).join(" ");
46
+ if (loading) {
47
+ const style = { width: size, height: size };
48
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
49
+ "span",
50
+ {
51
+ className: `${classes} icon--skeleton`,
52
+ style,
53
+ "aria-hidden": rest["aria-label"] ? "false" : "true",
54
+ ...rest["aria-label"] ? { "aria-label": rest["aria-label"] } : {}
55
+ }
56
+ );
57
+ }
58
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
59
+ import_react.Icon,
60
+ {
61
+ icon: iconName,
62
+ width: size,
63
+ height: size,
64
+ className: classes,
65
+ ...rest
66
+ }
67
+ );
68
+ };
69
+
70
+ // src/components/icons/iconConstants.ts
71
+ var NAVIGATION_ICONS = {
72
+ home: "home-solid",
73
+ dashboard: "squares-2x2-solid",
74
+ profile: "user-solid",
75
+ settings: "cog-solid",
76
+ logout: "arrow-right-on-rectangle-solid",
77
+ login: "arrow-left-on-rectangle-solid",
78
+ notifications: "bell-solid",
79
+ messages: "chat-bubble-left-solid",
80
+ help: "question-mark-circle-solid",
81
+ support: "lifebuoy-solid",
82
+ chevronDown: "chevron-down-solid",
83
+ chevronUp: "chevron-up-solid",
84
+ chevronLeft: "chevron-left-solid",
85
+ chevronRight: "chevron-right-solid"
86
+ };
87
+
88
+ // src/components/slider/Slider.tsx
89
+ var import_jsx_runtime2 = require("react/jsx-runtime");
90
+ var Slider = ({
91
+ min = 0,
92
+ max = 100,
93
+ value,
94
+ step = 1,
95
+ onChange,
96
+ onDragStart,
97
+ onChangeEnd,
98
+ label,
99
+ showValue = true,
100
+ className = "",
101
+ disabled = false,
102
+ type = "default",
103
+ baseHue = 0,
104
+ baseSaturation = 70
105
+ }) => {
106
+ const [isDragging, setIsDragging] = (0, import_react2.useState)(false);
107
+ const inputRef = (0, import_react2.useRef)(null);
108
+ const containerRef = (0, import_react2.useRef)(null);
109
+ const valueRef = (0, import_react2.useRef)(value);
110
+ import_react2.default.useEffect(() => {
111
+ valueRef.current = value;
112
+ }, [value]);
113
+ const handleChange = (0, import_react2.useCallback)((event) => {
114
+ const newValue = parseFloat(event.target.value);
115
+ onChange(newValue);
116
+ }, [onChange]);
117
+ const getValueFromPosition = (0, import_react2.useCallback)((clientX) => {
118
+ if (!containerRef.current) return value;
119
+ const rect = containerRef.current.getBoundingClientRect();
120
+ const percentage = Math.max(0, Math.min(1, (clientX - rect.left) / rect.width));
121
+ const rawValue = min + percentage * (max - min);
122
+ const steppedValue = Math.round(rawValue / step) * step;
123
+ return Math.max(min, Math.min(max, steppedValue));
124
+ }, [min, max, step, value]);
125
+ const handleMouseDown = (0, import_react2.useCallback)((event) => {
126
+ if (disabled) return;
127
+ event.preventDefault();
128
+ setIsDragging(true);
129
+ onDragStart?.();
130
+ const newValue = getValueFromPosition(event.clientX);
131
+ onChange(newValue);
132
+ }, [disabled, onDragStart, getValueFromPosition, onChange]);
133
+ const handleMouseMove = (0, import_react2.useCallback)((event) => {
134
+ if (!isDragging) return;
135
+ event.preventDefault();
136
+ const newValue = getValueFromPosition(event.clientX);
137
+ onChange(newValue);
138
+ }, [isDragging, getValueFromPosition, onChange]);
139
+ const handleMouseUp = (0, import_react2.useCallback)(() => {
140
+ if (!isDragging) return;
141
+ setIsDragging(false);
142
+ onChangeEnd?.(valueRef.current);
143
+ }, [isDragging, onChangeEnd]);
144
+ import_react2.default.useEffect(() => {
145
+ if (!isDragging) return;
146
+ document.addEventListener("mousemove", handleMouseMove);
147
+ document.addEventListener("mouseup", handleMouseUp);
148
+ return () => {
149
+ document.removeEventListener("mousemove", handleMouseMove);
150
+ document.removeEventListener("mouseup", handleMouseUp);
151
+ };
152
+ }, [isDragging, handleMouseMove, handleMouseUp]);
153
+ const handleTouchStart = (0, import_react2.useCallback)((event) => {
154
+ if (disabled) return;
155
+ event.preventDefault();
156
+ setIsDragging(true);
157
+ onDragStart?.();
158
+ const touch = event.touches[0];
159
+ const newValue = getValueFromPosition(touch.clientX);
160
+ onChange(newValue);
161
+ }, [disabled, onDragStart, getValueFromPosition, onChange]);
162
+ const handleTouchMove = (0, import_react2.useCallback)((event) => {
163
+ if (!isDragging) return;
164
+ event.preventDefault();
165
+ const touch = event.touches[0];
166
+ const newValue = getValueFromPosition(touch.clientX);
167
+ onChange(newValue);
168
+ }, [isDragging, getValueFromPosition, onChange]);
169
+ const handleTouchEnd = (0, import_react2.useCallback)(() => {
170
+ if (!isDragging) return;
171
+ setIsDragging(false);
172
+ onChangeEnd?.(valueRef.current);
173
+ }, [isDragging, onChangeEnd]);
174
+ import_react2.default.useEffect(() => {
175
+ if (!isDragging) return;
176
+ document.addEventListener("touchmove", handleTouchMove);
177
+ document.addEventListener("touchend", handleTouchEnd);
178
+ return () => {
179
+ document.removeEventListener("touchmove", handleTouchMove);
180
+ document.removeEventListener("touchend", handleTouchEnd);
181
+ };
182
+ }, [isDragging, handleTouchMove, handleTouchEnd]);
183
+ const sliderClasses = [
184
+ "slider",
185
+ `slider--${type}`,
186
+ isDragging && "slider--dragging",
187
+ disabled && "slider--disabled",
188
+ className
189
+ ].filter(Boolean).join(" ");
190
+ const getBackground = () => {
191
+ switch (type) {
192
+ case "hue":
193
+ return "linear-gradient(to right, hsl(0, 70%, 50%), hsl(60, 70%, 50%), hsl(120, 70%, 50%), hsl(180, 70%, 50%), hsl(240, 70%, 50%), hsl(300, 70%, 50%), hsl(360, 70%, 50%))";
194
+ case "saturation":
195
+ return `linear-gradient(to right, hsl(${baseHue}, 0%, 50%), hsl(${baseHue}, 100%, 50%))`;
196
+ case "lightness":
197
+ return `linear-gradient(to right, hsl(${baseHue}, ${baseSaturation}%, 0%), hsl(${baseHue}, ${baseSaturation}%, 50%), hsl(${baseHue}, ${baseSaturation}%, 100%))`;
198
+ default:
199
+ return "var(--color-action-primary)";
200
+ }
201
+ };
202
+ const inputStyle = { background: getBackground() };
203
+ const stepMarks = step > 1 ? Array.from({ length: Math.floor((max - min) / step) + 1 }, (_, i) => min + i * step) : [];
204
+ const thumbPosition = (value - min) / (max - min) * 100;
205
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: sliderClasses, children: [
206
+ (label || showValue) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "slider__header", children: [
207
+ label && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { className: "slider__label", children: label }),
208
+ showValue && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "slider__value", children: value })
209
+ ] }),
210
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "slider__container", ref: containerRef, onMouseDown: handleMouseDown, onTouchStart: handleTouchStart, children: [
211
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
212
+ "input",
213
+ {
214
+ ref: inputRef,
215
+ type: "range",
216
+ min,
217
+ max,
218
+ step,
219
+ value,
220
+ onChange: handleChange,
221
+ className: "slider__input",
222
+ style: inputStyle,
223
+ disabled,
224
+ readOnly: true
225
+ }
226
+ ),
227
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
228
+ "div",
229
+ {
230
+ className: "slider__thumb",
231
+ style: {
232
+ left: `${thumbPosition}%`,
233
+ transform: "translateX(-50%)"
234
+ },
235
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "slider__thumb-icon", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: NAVIGATION_ICONS.chevronDown, size: 16 }) })
236
+ }
237
+ ),
238
+ stepMarks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "slider__marks", children: stepMarks.map((mark) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
239
+ "div",
240
+ {
241
+ className: "slider__mark",
242
+ style: {
243
+ left: `${(mark - min) / (max - min) * 100}%`
244
+ }
245
+ },
246
+ mark
247
+ )) })
248
+ ] })
249
+ ] });
250
+ };
251
+ // Annotate the CommonJS export names for ESM import in node:
252
+ 0 && (module.exports = {
253
+ Slider
254
+ });
@@ -0,0 +1,217 @@
1
+ // src/components/slider/Slider.tsx
2
+ import React, { useState, useCallback, useRef } from "react";
3
+
4
+ // src/components/icons/icons.tsx
5
+ import { Icon as IconifyIcon } from "@iconify/react";
6
+ import { jsx } from "react/jsx-runtime";
7
+ var Icon = ({ name, size = 24, className, loading = false, ...rest }) => {
8
+ const iconName = name.includes(":") ? name : `heroicons:${name}`;
9
+ const classes = ["icon", className].filter(Boolean).join(" ");
10
+ if (loading) {
11
+ const style = { width: size, height: size };
12
+ return /* @__PURE__ */ jsx(
13
+ "span",
14
+ {
15
+ className: `${classes} icon--skeleton`,
16
+ style,
17
+ "aria-hidden": rest["aria-label"] ? "false" : "true",
18
+ ...rest["aria-label"] ? { "aria-label": rest["aria-label"] } : {}
19
+ }
20
+ );
21
+ }
22
+ return /* @__PURE__ */ jsx(
23
+ IconifyIcon,
24
+ {
25
+ icon: iconName,
26
+ width: size,
27
+ height: size,
28
+ className: classes,
29
+ ...rest
30
+ }
31
+ );
32
+ };
33
+
34
+ // src/components/icons/iconConstants.ts
35
+ var NAVIGATION_ICONS = {
36
+ home: "home-solid",
37
+ dashboard: "squares-2x2-solid",
38
+ profile: "user-solid",
39
+ settings: "cog-solid",
40
+ logout: "arrow-right-on-rectangle-solid",
41
+ login: "arrow-left-on-rectangle-solid",
42
+ notifications: "bell-solid",
43
+ messages: "chat-bubble-left-solid",
44
+ help: "question-mark-circle-solid",
45
+ support: "lifebuoy-solid",
46
+ chevronDown: "chevron-down-solid",
47
+ chevronUp: "chevron-up-solid",
48
+ chevronLeft: "chevron-left-solid",
49
+ chevronRight: "chevron-right-solid"
50
+ };
51
+
52
+ // src/components/slider/Slider.tsx
53
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
54
+ var Slider = ({
55
+ min = 0,
56
+ max = 100,
57
+ value,
58
+ step = 1,
59
+ onChange,
60
+ onDragStart,
61
+ onChangeEnd,
62
+ label,
63
+ showValue = true,
64
+ className = "",
65
+ disabled = false,
66
+ type = "default",
67
+ baseHue = 0,
68
+ baseSaturation = 70
69
+ }) => {
70
+ const [isDragging, setIsDragging] = useState(false);
71
+ const inputRef = useRef(null);
72
+ const containerRef = useRef(null);
73
+ const valueRef = useRef(value);
74
+ React.useEffect(() => {
75
+ valueRef.current = value;
76
+ }, [value]);
77
+ const handleChange = useCallback((event) => {
78
+ const newValue = parseFloat(event.target.value);
79
+ onChange(newValue);
80
+ }, [onChange]);
81
+ const getValueFromPosition = useCallback((clientX) => {
82
+ if (!containerRef.current) return value;
83
+ const rect = containerRef.current.getBoundingClientRect();
84
+ const percentage = Math.max(0, Math.min(1, (clientX - rect.left) / rect.width));
85
+ const rawValue = min + percentage * (max - min);
86
+ const steppedValue = Math.round(rawValue / step) * step;
87
+ return Math.max(min, Math.min(max, steppedValue));
88
+ }, [min, max, step, value]);
89
+ const handleMouseDown = useCallback((event) => {
90
+ if (disabled) return;
91
+ event.preventDefault();
92
+ setIsDragging(true);
93
+ onDragStart?.();
94
+ const newValue = getValueFromPosition(event.clientX);
95
+ onChange(newValue);
96
+ }, [disabled, onDragStart, getValueFromPosition, onChange]);
97
+ const handleMouseMove = useCallback((event) => {
98
+ if (!isDragging) return;
99
+ event.preventDefault();
100
+ const newValue = getValueFromPosition(event.clientX);
101
+ onChange(newValue);
102
+ }, [isDragging, getValueFromPosition, onChange]);
103
+ const handleMouseUp = useCallback(() => {
104
+ if (!isDragging) return;
105
+ setIsDragging(false);
106
+ onChangeEnd?.(valueRef.current);
107
+ }, [isDragging, onChangeEnd]);
108
+ React.useEffect(() => {
109
+ if (!isDragging) return;
110
+ document.addEventListener("mousemove", handleMouseMove);
111
+ document.addEventListener("mouseup", handleMouseUp);
112
+ return () => {
113
+ document.removeEventListener("mousemove", handleMouseMove);
114
+ document.removeEventListener("mouseup", handleMouseUp);
115
+ };
116
+ }, [isDragging, handleMouseMove, handleMouseUp]);
117
+ const handleTouchStart = useCallback((event) => {
118
+ if (disabled) return;
119
+ event.preventDefault();
120
+ setIsDragging(true);
121
+ onDragStart?.();
122
+ const touch = event.touches[0];
123
+ const newValue = getValueFromPosition(touch.clientX);
124
+ onChange(newValue);
125
+ }, [disabled, onDragStart, getValueFromPosition, onChange]);
126
+ const handleTouchMove = useCallback((event) => {
127
+ if (!isDragging) return;
128
+ event.preventDefault();
129
+ const touch = event.touches[0];
130
+ const newValue = getValueFromPosition(touch.clientX);
131
+ onChange(newValue);
132
+ }, [isDragging, getValueFromPosition, onChange]);
133
+ const handleTouchEnd = useCallback(() => {
134
+ if (!isDragging) return;
135
+ setIsDragging(false);
136
+ onChangeEnd?.(valueRef.current);
137
+ }, [isDragging, onChangeEnd]);
138
+ React.useEffect(() => {
139
+ if (!isDragging) return;
140
+ document.addEventListener("touchmove", handleTouchMove);
141
+ document.addEventListener("touchend", handleTouchEnd);
142
+ return () => {
143
+ document.removeEventListener("touchmove", handleTouchMove);
144
+ document.removeEventListener("touchend", handleTouchEnd);
145
+ };
146
+ }, [isDragging, handleTouchMove, handleTouchEnd]);
147
+ const sliderClasses = [
148
+ "slider",
149
+ `slider--${type}`,
150
+ isDragging && "slider--dragging",
151
+ disabled && "slider--disabled",
152
+ className
153
+ ].filter(Boolean).join(" ");
154
+ const getBackground = () => {
155
+ switch (type) {
156
+ case "hue":
157
+ return "linear-gradient(to right, hsl(0, 70%, 50%), hsl(60, 70%, 50%), hsl(120, 70%, 50%), hsl(180, 70%, 50%), hsl(240, 70%, 50%), hsl(300, 70%, 50%), hsl(360, 70%, 50%))";
158
+ case "saturation":
159
+ return `linear-gradient(to right, hsl(${baseHue}, 0%, 50%), hsl(${baseHue}, 100%, 50%))`;
160
+ case "lightness":
161
+ return `linear-gradient(to right, hsl(${baseHue}, ${baseSaturation}%, 0%), hsl(${baseHue}, ${baseSaturation}%, 50%), hsl(${baseHue}, ${baseSaturation}%, 100%))`;
162
+ default:
163
+ return "var(--color-action-primary)";
164
+ }
165
+ };
166
+ const inputStyle = { background: getBackground() };
167
+ const stepMarks = step > 1 ? Array.from({ length: Math.floor((max - min) / step) + 1 }, (_, i) => min + i * step) : [];
168
+ const thumbPosition = (value - min) / (max - min) * 100;
169
+ return /* @__PURE__ */ jsxs("div", { className: sliderClasses, children: [
170
+ (label || showValue) && /* @__PURE__ */ jsxs("div", { className: "slider__header", children: [
171
+ label && /* @__PURE__ */ jsx2("label", { className: "slider__label", children: label }),
172
+ showValue && /* @__PURE__ */ jsx2("span", { className: "slider__value", children: value })
173
+ ] }),
174
+ /* @__PURE__ */ jsxs("div", { className: "slider__container", ref: containerRef, onMouseDown: handleMouseDown, onTouchStart: handleTouchStart, children: [
175
+ /* @__PURE__ */ jsx2(
176
+ "input",
177
+ {
178
+ ref: inputRef,
179
+ type: "range",
180
+ min,
181
+ max,
182
+ step,
183
+ value,
184
+ onChange: handleChange,
185
+ className: "slider__input",
186
+ style: inputStyle,
187
+ disabled,
188
+ readOnly: true
189
+ }
190
+ ),
191
+ /* @__PURE__ */ jsx2(
192
+ "div",
193
+ {
194
+ className: "slider__thumb",
195
+ style: {
196
+ left: `${thumbPosition}%`,
197
+ transform: "translateX(-50%)"
198
+ },
199
+ children: /* @__PURE__ */ jsx2("div", { className: "slider__thumb-icon", children: /* @__PURE__ */ jsx2(Icon, { name: NAVIGATION_ICONS.chevronDown, size: 16 }) })
200
+ }
201
+ ),
202
+ stepMarks.length > 0 && /* @__PURE__ */ jsx2("div", { className: "slider__marks", children: stepMarks.map((mark) => /* @__PURE__ */ jsx2(
203
+ "div",
204
+ {
205
+ className: "slider__mark",
206
+ style: {
207
+ left: `${(mark - min) / (max - min) * 100}%`
208
+ }
209
+ },
210
+ mark
211
+ )) })
212
+ ] })
213
+ ] });
214
+ };
215
+ export {
216
+ Slider
217
+ };