jaci-ui 0.8.0 → 0.9.1

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 (89) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +62 -0
  3. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  4. package/dist/components/carousel/carousel.cjs +342 -0
  5. package/dist/components/carousel/carousel.cjs.map +1 -0
  6. package/dist/components/carousel/carousel.d.cts +44 -0
  7. package/dist/components/carousel/carousel.d.ts +44 -0
  8. package/dist/components/carousel/carousel.js +330 -0
  9. package/dist/components/carousel/carousel.js.map +1 -0
  10. package/dist/components/carousel/index.d.cts +2 -0
  11. package/dist/components/carousel/index.d.ts +2 -0
  12. package/dist/components/code/code.cjs +32 -5
  13. package/dist/components/code/code.cjs.map +1 -1
  14. package/dist/components/code/code.d.cts +1 -0
  15. package/dist/components/code/code.d.ts +1 -0
  16. package/dist/components/code/code.js +34 -7
  17. package/dist/components/code/code.js.map +1 -1
  18. package/dist/components/color-swatch/color-swatch.cjs +33 -0
  19. package/dist/components/color-swatch/color-swatch.cjs.map +1 -0
  20. package/dist/components/color-swatch/color-swatch.d.cts +13 -0
  21. package/dist/components/color-swatch/color-swatch.d.ts +13 -0
  22. package/dist/components/color-swatch/color-swatch.js +33 -0
  23. package/dist/components/color-swatch/color-swatch.js.map +1 -0
  24. package/dist/components/color-swatch/index.d.cts +2 -0
  25. package/dist/components/color-swatch/index.d.ts +2 -0
  26. package/dist/components/command/command.cjs +3 -1
  27. package/dist/components/command/command.cjs.map +1 -1
  28. package/dist/components/command/command.js +3 -1
  29. package/dist/components/command/command.js.map +1 -1
  30. package/dist/components/download-trigger/download-trigger.cjs +25 -0
  31. package/dist/components/download-trigger/download-trigger.cjs.map +1 -0
  32. package/dist/components/download-trigger/download-trigger.d.cts +12 -0
  33. package/dist/components/download-trigger/download-trigger.d.ts +12 -0
  34. package/dist/components/download-trigger/download-trigger.js +25 -0
  35. package/dist/components/download-trigger/download-trigger.js.map +1 -0
  36. package/dist/components/download-trigger/index.d.cts +2 -0
  37. package/dist/components/download-trigger/index.d.ts +2 -0
  38. package/dist/components/qr-code/index.d.cts +2 -0
  39. package/dist/components/qr-code/index.d.ts +2 -0
  40. package/dist/components/qr-code/qr-code.cjs +118 -0
  41. package/dist/components/qr-code/qr-code.cjs.map +1 -0
  42. package/dist/components/qr-code/qr-code.d.cts +17 -0
  43. package/dist/components/qr-code/qr-code.d.ts +17 -0
  44. package/dist/components/qr-code/qr-code.js +116 -0
  45. package/dist/components/qr-code/qr-code.js.map +1 -0
  46. package/dist/components/spacer/index.d.cts +2 -0
  47. package/dist/components/spacer/index.d.ts +2 -0
  48. package/dist/components/spacer/spacer.cjs +24 -0
  49. package/dist/components/spacer/spacer.cjs.map +1 -0
  50. package/dist/components/spacer/spacer.d.cts +10 -0
  51. package/dist/components/spacer/spacer.d.ts +10 -0
  52. package/dist/components/spacer/spacer.js +24 -0
  53. package/dist/components/spacer/spacer.js.map +1 -0
  54. package/dist/index.cjs +10 -0
  55. package/dist/index.cjs.map +1 -1
  56. package/dist/index.d.cts +11 -1
  57. package/dist/index.d.ts +11 -1
  58. package/dist/index.js +6 -1
  59. package/dist/index.js.map +1 -1
  60. package/dist/styled-system/recipes/carousel.cjs +48 -0
  61. package/dist/styled-system/recipes/carousel.cjs.map +1 -0
  62. package/dist/styled-system/recipes/carousel.js +48 -0
  63. package/dist/styled-system/recipes/carousel.js.map +1 -0
  64. package/dist/styled-system/recipes/code.cjs +4 -2
  65. package/dist/styled-system/recipes/code.cjs.map +1 -1
  66. package/dist/styled-system/recipes/code.js +4 -2
  67. package/dist/styled-system/recipes/code.js.map +1 -1
  68. package/dist/styled-system/recipes/color-swatch.cjs +37 -0
  69. package/dist/styled-system/recipes/color-swatch.cjs.map +1 -0
  70. package/dist/styled-system/recipes/color-swatch.js +37 -0
  71. package/dist/styled-system/recipes/color-swatch.js.map +1 -0
  72. package/dist/styled-system/recipes/download-trigger.cjs +39 -0
  73. package/dist/styled-system/recipes/download-trigger.cjs.map +1 -0
  74. package/dist/styled-system/recipes/download-trigger.js +39 -0
  75. package/dist/styled-system/recipes/download-trigger.js.map +1 -0
  76. package/dist/styled-system/recipes/layout-spacer.cjs +88 -0
  77. package/dist/styled-system/recipes/layout-spacer.cjs.map +1 -0
  78. package/dist/styled-system/recipes/layout-spacer.js +88 -0
  79. package/dist/styled-system/recipes/layout-spacer.js.map +1 -0
  80. package/dist/styled-system/recipes/qr-code.cjs +25 -0
  81. package/dist/styled-system/recipes/qr-code.cjs.map +1 -0
  82. package/dist/styled-system/recipes/qr-code.js +25 -0
  83. package/dist/styled-system/recipes/qr-code.js.map +1 -0
  84. package/dist/styles.css +794 -116
  85. package/dist/theme/theme-provider.cjs +29 -1
  86. package/dist/theme/theme-provider.cjs.map +1 -1
  87. package/dist/theme/theme-provider.js +29 -1
  88. package/dist/theme/theme-provider.js.map +1 -1
  89. package/package.json +7 -4
@@ -0,0 +1,330 @@
1
+ "use client";
2
+ import { cx } from "../../styled-system/css/cx.js";
3
+ import { carousel } from "../../styled-system/recipes/carousel.js";
4
+ import { createContext, forwardRef, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ //#region src/components/carousel/carousel.tsx
7
+ const CarouselContext = createContext(null);
8
+ function useCarouselContext() {
9
+ const context = useContext(CarouselContext);
10
+ if (!context) throw new Error("Carousel parts must be rendered inside Carousel.Root.");
11
+ return context;
12
+ }
13
+ const CarouselRoot = forwardRef(function CarouselRoot({ autoplay = false, autoplayInterval = 5e3, children, className, defaultIndex = 0, disabled = false, index, onBlur, onFocus, loop = true, onIndexChange, onKeyDown, onPointerEnter, onPointerLeave, orientation = "horizontal", pauseOnFocus = true, pauseOnHover = true, style, swipeable = true, ...props }, ref) {
14
+ const [uncontrolledIndex, setUncontrolledIndex] = useState(Math.max(0, defaultIndex));
15
+ const [registered, setRegistered] = useState(() => /* @__PURE__ */ new Set());
16
+ const [paused, setPaused] = useState(false);
17
+ const [focusWithin, setFocusWithin] = useState(false);
18
+ const swipeRef = useRef(null);
19
+ const isControlled = index !== void 0;
20
+ const indexCount = registered.size ? Math.max(...registered) + 1 : 0;
21
+ const currentIndex = Math.max(0, Math.min(indexCount ? indexCount - 1 : 0, index ?? uncontrolledIndex));
22
+ const styles = carousel({
23
+ orientation,
24
+ active: true
25
+ });
26
+ const setIndex = useCallback((nextIndex) => {
27
+ if (disabled || !indexCount) return;
28
+ const next = loop ? (nextIndex + indexCount) % indexCount : Math.max(0, Math.min(indexCount - 1, nextIndex));
29
+ if (!isControlled) setUncontrolledIndex(next);
30
+ if (next !== currentIndex) onIndexChange?.(next);
31
+ }, [
32
+ currentIndex,
33
+ disabled,
34
+ indexCount,
35
+ isControlled,
36
+ loop,
37
+ onIndexChange
38
+ ]);
39
+ const getNextIndex = useCallback((direction) => currentIndex + direction, [currentIndex]);
40
+ const registerIndex = useCallback((itemIndex) => {
41
+ setRegistered((previous) => {
42
+ if (previous.has(itemIndex)) return previous;
43
+ const next = new Set(previous);
44
+ next.add(itemIndex);
45
+ return next;
46
+ });
47
+ return () => setRegistered((previous) => {
48
+ if (!previous.has(itemIndex)) return previous;
49
+ const next = new Set(previous);
50
+ next.delete(itemIndex);
51
+ return next;
52
+ });
53
+ }, []);
54
+ const onRootKeyDown = useCallback((event) => {
55
+ if (disabled) return;
56
+ const forward = orientation === "horizontal" ? event.key === "ArrowRight" : event.key === "ArrowDown";
57
+ const backward = orientation === "horizontal" ? event.key === "ArrowLeft" : event.key === "ArrowUp";
58
+ if (forward || backward) {
59
+ event.preventDefault();
60
+ setIndex(getNextIndex(forward ? 1 : -1));
61
+ } else if (event.key === "Home") {
62
+ event.preventDefault();
63
+ setIndex(0);
64
+ } else if (event.key === "End") {
65
+ event.preventDefault();
66
+ setIndex(indexCount - 1);
67
+ }
68
+ onKeyDown?.(event);
69
+ }, [
70
+ disabled,
71
+ getNextIndex,
72
+ indexCount,
73
+ onKeyDown,
74
+ orientation,
75
+ setIndex
76
+ ]);
77
+ const startSwipe = useCallback((event) => {
78
+ if (!swipeable || disabled || event.pointerType === "mouse") return;
79
+ swipeRef.current = {
80
+ pointerId: event.pointerId,
81
+ startX: event.clientX,
82
+ startY: event.clientY
83
+ };
84
+ event.currentTarget.setPointerCapture?.(event.pointerId);
85
+ }, [disabled, swipeable]);
86
+ const moveSwipe = useCallback(() => void 0, []);
87
+ const endSwipe = useCallback((event) => {
88
+ const start = swipeRef.current;
89
+ swipeRef.current = null;
90
+ if (!start || start.pointerId !== event.pointerId) return;
91
+ const delta = orientation === "horizontal" ? event.clientX - start.startX : event.clientY - start.startY;
92
+ if (Math.abs(delta) < 40) return;
93
+ setIndex(getNextIndex(delta < 0 ? 1 : -1));
94
+ }, [
95
+ getNextIndex,
96
+ orientation,
97
+ setIndex
98
+ ]);
99
+ useEffect(() => {
100
+ if (!autoplay || paused || disabled || indexCount < 2) return;
101
+ const interval = Number.isFinite(autoplayInterval) && autoplayInterval > 0 ? autoplayInterval : 5e3;
102
+ const timer = window.setInterval(() => setIndex(getNextIndex(1)), interval);
103
+ return () => window.clearInterval(timer);
104
+ }, [
105
+ autoplay,
106
+ autoplayInterval,
107
+ disabled,
108
+ getNextIndex,
109
+ indexCount,
110
+ paused,
111
+ setIndex
112
+ ]);
113
+ const value = useMemo(() => ({
114
+ currentIndex,
115
+ disabled,
116
+ endSwipe,
117
+ getNextIndex,
118
+ indexCount,
119
+ loop,
120
+ moveSwipe,
121
+ onKeyDown: onRootKeyDown,
122
+ orientation,
123
+ registerIndex,
124
+ setIndex,
125
+ startSwipe,
126
+ styles
127
+ }), [
128
+ currentIndex,
129
+ disabled,
130
+ endSwipe,
131
+ getNextIndex,
132
+ indexCount,
133
+ loop,
134
+ moveSwipe,
135
+ onRootKeyDown,
136
+ orientation,
137
+ registerIndex,
138
+ setIndex,
139
+ startSwipe,
140
+ styles
141
+ ]);
142
+ return /* @__PURE__ */ jsx(CarouselContext.Provider, {
143
+ value,
144
+ children: /* @__PURE__ */ jsx("section", {
145
+ ...props,
146
+ ref,
147
+ "aria-roledescription": "carousel",
148
+ className: cx(styles.root, className),
149
+ "data-jaci-component": "carousel",
150
+ "data-orientation": orientation,
151
+ "data-slot": "carousel",
152
+ "data-state": paused ? "paused" : "running",
153
+ role: "region",
154
+ tabIndex: disabled ? -1 : 0,
155
+ onBlur: (event) => {
156
+ if (!event.currentTarget.contains(event.relatedTarget)) {
157
+ setFocusWithin(false);
158
+ if (pauseOnFocus) setPaused(false);
159
+ }
160
+ onBlur?.(event);
161
+ },
162
+ onFocus: (event) => {
163
+ setFocusWithin(true);
164
+ if (pauseOnFocus) setPaused(true);
165
+ onFocus?.(event);
166
+ },
167
+ onKeyDown: onRootKeyDown,
168
+ onPointerCancel: endSwipe,
169
+ onPointerDown: startSwipe,
170
+ onPointerEnter: (event) => {
171
+ if (pauseOnHover) setPaused(true);
172
+ onPointerEnter?.(event);
173
+ },
174
+ onPointerLeave: (event) => {
175
+ if (pauseOnHover && !(pauseOnFocus && focusWithin)) setPaused(false);
176
+ onPointerLeave?.(event);
177
+ },
178
+ onPointerMove: moveSwipe,
179
+ onPointerUp: endSwipe,
180
+ style: {
181
+ "--jaci-carousel-index": currentIndex,
182
+ ...style
183
+ },
184
+ children
185
+ })
186
+ });
187
+ });
188
+ const CarouselViewport = forwardRef(function CarouselViewport({ className, ...props }, ref) {
189
+ const { styles } = useCarouselContext();
190
+ return /* @__PURE__ */ jsx("div", {
191
+ ...props,
192
+ ref,
193
+ className: cx(styles.viewport, className),
194
+ "data-slot": "carousel-viewport"
195
+ });
196
+ });
197
+ const CarouselTrack = forwardRef(function CarouselTrack({ className, style, ...props }, ref) {
198
+ const { currentIndex, orientation, styles } = useCarouselContext();
199
+ const transform = orientation === "horizontal" ? `translateX(-${currentIndex * 100}%)` : `translateY(-${currentIndex * 100}%)`;
200
+ return /* @__PURE__ */ jsx("div", {
201
+ ...props,
202
+ ref,
203
+ className: cx(styles.track, className),
204
+ "data-slot": "carousel-track",
205
+ style: {
206
+ transform,
207
+ ...style
208
+ }
209
+ });
210
+ });
211
+ const CarouselItem = forwardRef(function CarouselItem({ children, className, index, ...props }, ref) {
212
+ const { currentIndex, registerIndex, styles } = useCarouselContext();
213
+ useEffect(() => registerIndex(index), [index, registerIndex]);
214
+ const active = currentIndex === index;
215
+ return /* @__PURE__ */ jsx("div", {
216
+ ...props,
217
+ ref,
218
+ "aria-hidden": !active,
219
+ "aria-roledescription": "slide",
220
+ className: cx(styles.item, className),
221
+ "data-index": index,
222
+ "data-jaci-component": "carousel-item",
223
+ "data-selected": active || void 0,
224
+ "data-slot": "carousel-item",
225
+ role: "group",
226
+ tabIndex: active ? 0 : -1,
227
+ children
228
+ });
229
+ });
230
+ function createSimpleSlot(slot) {
231
+ return forwardRef(function CarouselSlot({ className, ...props }, ref) {
232
+ const { styles } = useCarouselContext();
233
+ if (slot === "title") return /* @__PURE__ */ jsx("h3", {
234
+ ...props,
235
+ ref,
236
+ className: cx(styles.title, className),
237
+ "data-slot": `carousel-${slot}`
238
+ });
239
+ if (slot === "description") return /* @__PURE__ */ jsx("p", {
240
+ ...props,
241
+ ref,
242
+ className: cx(styles.description, className),
243
+ "data-slot": `carousel-${slot}`
244
+ });
245
+ return /* @__PURE__ */ jsx("div", {
246
+ ...props,
247
+ ref,
248
+ className: cx(styles[slot], className),
249
+ "data-slot": `carousel-${slot}`
250
+ });
251
+ });
252
+ }
253
+ const CarouselMedia = createSimpleSlot("media");
254
+ const CarouselCaption = createSimpleSlot("caption");
255
+ const CarouselTitle = createSimpleSlot("title");
256
+ const CarouselDescription = createSimpleSlot("description");
257
+ const CarouselPrevious = forwardRef(function CarouselPrevious({ "aria-label": ariaLabel = "Previous slide", children, className, disabled, ...props }, ref) {
258
+ const { disabled: contextDisabled, getNextIndex, orientation, setIndex, styles } = useCarouselContext();
259
+ return /* @__PURE__ */ jsx("button", {
260
+ ...props,
261
+ ref,
262
+ "aria-label": ariaLabel,
263
+ className: cx(styles.control, className),
264
+ "data-slot": "carousel-previous",
265
+ disabled: disabled ?? contextDisabled,
266
+ onClick: () => setIndex(getNextIndex(-1)),
267
+ type: "button",
268
+ children: children ?? (orientation === "vertical" ? "↑" : "‹")
269
+ });
270
+ });
271
+ const CarouselNext = forwardRef(function CarouselNext({ "aria-label": ariaLabel = "Next slide", children, className, disabled, ...props }, ref) {
272
+ const { disabled: contextDisabled, getNextIndex, orientation, setIndex, styles } = useCarouselContext();
273
+ return /* @__PURE__ */ jsx("button", {
274
+ ...props,
275
+ ref,
276
+ "aria-label": ariaLabel,
277
+ className: cx(styles.control, className),
278
+ "data-slot": "carousel-next",
279
+ disabled: disabled ?? contextDisabled,
280
+ onClick: () => setIndex(getNextIndex(1)),
281
+ type: "button",
282
+ children: children ?? (orientation === "vertical" ? "↓" : "›")
283
+ });
284
+ });
285
+ const CarouselIndicator = forwardRef(function CarouselIndicator({ "aria-label": ariaLabel, className, index, ...props }, ref) {
286
+ const { currentIndex, disabled, setIndex, styles } = useCarouselContext();
287
+ return /* @__PURE__ */ jsx("button", {
288
+ ...props,
289
+ ref,
290
+ "aria-label": ariaLabel ?? `Go to slide ${index + 1}`,
291
+ "aria-selected": currentIndex === index,
292
+ className: cx(styles.indicator, className),
293
+ "data-selected": currentIndex === index || void 0,
294
+ "data-slot": "carousel-indicator",
295
+ disabled,
296
+ onClick: () => setIndex(index),
297
+ role: "tab",
298
+ type: "button"
299
+ });
300
+ });
301
+ const CarouselIndicators = forwardRef(function CarouselIndicators({ children, className, ...props }, ref) {
302
+ const { indexCount, styles } = useCarouselContext();
303
+ return /* @__PURE__ */ jsx("div", {
304
+ ...props,
305
+ ref,
306
+ "aria-label": "Slides",
307
+ className: cx(styles.indicators, className),
308
+ "data-slot": "carousel-indicators",
309
+ role: "tablist",
310
+ children: children ?? Array.from({ length: indexCount }, (_, index) => /* @__PURE__ */ jsx(CarouselIndicator, { index }, `indicator-${index}`))
311
+ });
312
+ });
313
+ const Carousel = {
314
+ Root: CarouselRoot,
315
+ Viewport: CarouselViewport,
316
+ Track: CarouselTrack,
317
+ Item: CarouselItem,
318
+ Media: CarouselMedia,
319
+ Caption: CarouselCaption,
320
+ Title: CarouselTitle,
321
+ Description: CarouselDescription,
322
+ Previous: CarouselPrevious,
323
+ Next: CarouselNext,
324
+ Indicators: CarouselIndicators,
325
+ Indicator: CarouselIndicator
326
+ };
327
+ //#endregion
328
+ export { Carousel, CarouselCaption, CarouselDescription, CarouselIndicator, CarouselIndicators, CarouselItem, CarouselMedia, CarouselNext, CarouselPrevious, CarouselRoot, CarouselTitle, CarouselTrack, CarouselViewport };
329
+
330
+ //# sourceMappingURL=carousel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"carousel.js","names":[],"sources":["../../../src/components/carousel/carousel.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type {\n ComponentPropsWithoutRef,\n CSSProperties,\n FocusEvent,\n KeyboardEvent,\n PointerEvent,\n ReactNode,\n Ref,\n} from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { carousel } from \"../../styled-system/recipes\";\n\nexport type CarouselOrientation = \"horizontal\" | \"vertical\";\n\ninterface CarouselContextValue {\n currentIndex: number;\n disabled: boolean;\n getNextIndex: (direction: -1 | 1) => number;\n indexCount: number;\n loop: boolean;\n onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;\n registerIndex: (index: number) => () => void;\n setIndex: (index: number) => void;\n startSwipe: (event: PointerEvent<HTMLElement>) => void;\n moveSwipe: (event: PointerEvent<HTMLElement>) => void;\n endSwipe: (event: PointerEvent<HTMLElement>) => void;\n orientation: CarouselOrientation;\n styles: ReturnType<typeof carousel>;\n}\n\nconst CarouselContext = createContext<CarouselContextValue | null>(null);\n\nfunction useCarouselContext() {\n const context = useContext(CarouselContext);\n if (!context) throw new Error(\"Carousel parts must be rendered inside Carousel.Root.\");\n return context;\n}\n\nexport interface CarouselRootProps extends ComponentPropsWithoutRef<\"section\"> {\n index?: number;\n defaultIndex?: number;\n onIndexChange?: (index: number) => void;\n orientation?: CarouselOrientation;\n loop?: boolean;\n swipeable?: boolean;\n autoplay?: boolean;\n autoplayInterval?: number;\n pauseOnHover?: boolean;\n pauseOnFocus?: boolean;\n disabled?: boolean;\n}\n\nexport const CarouselRoot = forwardRef<HTMLElement, CarouselRootProps>(function CarouselRoot(\n {\n autoplay = false,\n autoplayInterval = 5000,\n children,\n className,\n defaultIndex = 0,\n disabled = false,\n index,\n onBlur,\n onFocus,\n loop = true,\n onIndexChange,\n onKeyDown,\n onPointerEnter,\n onPointerLeave,\n orientation = \"horizontal\",\n pauseOnFocus = true,\n pauseOnHover = true,\n style,\n swipeable = true,\n ...props\n },\n ref,\n) {\n const [uncontrolledIndex, setUncontrolledIndex] = useState(Math.max(0, defaultIndex));\n const [registered, setRegistered] = useState<Set<number>>(() => new Set());\n const [paused, setPaused] = useState(false);\n const [focusWithin, setFocusWithin] = useState(false);\n const swipeRef = useRef<{ pointerId: number; startX: number; startY: number } | null>(null);\n const isControlled = index !== undefined;\n const indexCount = registered.size ? Math.max(...registered) + 1 : 0;\n const currentIndex = Math.max(\n 0,\n Math.min(indexCount ? indexCount - 1 : 0, index ?? uncontrolledIndex),\n );\n const styles = carousel({ orientation, active: true });\n\n const setIndex = useCallback(\n (nextIndex: number) => {\n if (disabled || !indexCount) return;\n const next = loop\n ? (nextIndex + indexCount) % indexCount\n : Math.max(0, Math.min(indexCount - 1, nextIndex));\n if (!isControlled) setUncontrolledIndex(next);\n if (next !== currentIndex) onIndexChange?.(next);\n },\n [currentIndex, disabled, indexCount, isControlled, loop, onIndexChange],\n );\n\n const getNextIndex = useCallback((direction: -1 | 1) => currentIndex + direction, [currentIndex]);\n\n const registerIndex = useCallback((itemIndex: number) => {\n setRegistered((previous) => {\n if (previous.has(itemIndex)) return previous;\n const next = new Set(previous);\n next.add(itemIndex);\n return next;\n });\n return () =>\n setRegistered((previous) => {\n if (!previous.has(itemIndex)) return previous;\n const next = new Set(previous);\n next.delete(itemIndex);\n return next;\n });\n }, []);\n\n const onRootKeyDown = useCallback(\n (event: KeyboardEvent<HTMLElement>) => {\n if (disabled) return;\n const forward =\n orientation === \"horizontal\" ? event.key === \"ArrowRight\" : event.key === \"ArrowDown\";\n const backward =\n orientation === \"horizontal\" ? event.key === \"ArrowLeft\" : event.key === \"ArrowUp\";\n if (forward || backward) {\n event.preventDefault();\n setIndex(getNextIndex(forward ? 1 : -1));\n } else if (event.key === \"Home\") {\n event.preventDefault();\n setIndex(0);\n } else if (event.key === \"End\") {\n event.preventDefault();\n setIndex(indexCount - 1);\n }\n onKeyDown?.(event);\n },\n [disabled, getNextIndex, indexCount, onKeyDown, orientation, setIndex],\n );\n\n const startSwipe = useCallback(\n (event: PointerEvent<HTMLElement>) => {\n if (!swipeable || disabled || event.pointerType === \"mouse\") return;\n swipeRef.current = {\n pointerId: event.pointerId,\n startX: event.clientX,\n startY: event.clientY,\n };\n event.currentTarget.setPointerCapture?.(event.pointerId);\n },\n [disabled, swipeable],\n );\n\n const moveSwipe = useCallback(() => undefined, []);\n\n const endSwipe = useCallback(\n (event: PointerEvent<HTMLElement>) => {\n const start = swipeRef.current;\n swipeRef.current = null;\n if (!start || start.pointerId !== event.pointerId) return;\n const delta =\n orientation === \"horizontal\" ? event.clientX - start.startX : event.clientY - start.startY;\n if (Math.abs(delta) < 40) return;\n setIndex(getNextIndex(delta < 0 ? 1 : -1));\n },\n [getNextIndex, orientation, setIndex],\n );\n\n useEffect(() => {\n if (!autoplay || paused || disabled || indexCount < 2) return;\n const interval =\n Number.isFinite(autoplayInterval) && autoplayInterval > 0 ? autoplayInterval : 5000;\n const timer = window.setInterval(() => setIndex(getNextIndex(1)), interval);\n return () => window.clearInterval(timer);\n }, [autoplay, autoplayInterval, disabled, getNextIndex, indexCount, paused, setIndex]);\n\n const value = useMemo<CarouselContextValue>(\n () => ({\n currentIndex,\n disabled,\n endSwipe,\n getNextIndex,\n indexCount,\n loop,\n moveSwipe,\n onKeyDown: onRootKeyDown,\n orientation,\n registerIndex,\n setIndex,\n startSwipe,\n styles,\n }),\n [\n currentIndex,\n disabled,\n endSwipe,\n getNextIndex,\n indexCount,\n loop,\n moveSwipe,\n onRootKeyDown,\n orientation,\n registerIndex,\n setIndex,\n startSwipe,\n styles,\n ],\n );\n\n return (\n <CarouselContext.Provider value={value}>\n <section\n {...props}\n ref={ref}\n aria-roledescription=\"carousel\"\n className={cx(styles.root, className)}\n data-jaci-component=\"carousel\"\n data-orientation={orientation}\n data-slot=\"carousel\"\n data-state={paused ? \"paused\" : \"running\"}\n role=\"region\"\n tabIndex={disabled ? -1 : 0}\n onBlur={(event: FocusEvent<HTMLElement>) => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) {\n setFocusWithin(false);\n if (pauseOnFocus) setPaused(false);\n }\n onBlur?.(event);\n }}\n onFocus={(event: FocusEvent<HTMLElement>) => {\n setFocusWithin(true);\n if (pauseOnFocus) {\n setPaused(true);\n }\n onFocus?.(event);\n }}\n onKeyDown={onRootKeyDown}\n onPointerCancel={endSwipe}\n onPointerDown={startSwipe}\n onPointerEnter={(event) => {\n if (pauseOnHover) setPaused(true);\n onPointerEnter?.(event);\n }}\n onPointerLeave={(event) => {\n if (pauseOnHover && !(pauseOnFocus && focusWithin)) setPaused(false);\n onPointerLeave?.(event);\n }}\n onPointerMove={moveSwipe}\n onPointerUp={endSwipe}\n style={{ \"--jaci-carousel-index\": currentIndex, ...style } as CSSProperties}\n >\n {children}\n </section>\n </CarouselContext.Provider>\n );\n});\n\nexport type CarouselViewportProps = ComponentPropsWithoutRef<\"div\">;\nexport const CarouselViewport = forwardRef<HTMLDivElement, CarouselViewportProps>(\n function CarouselViewport({ className, ...props }, ref) {\n const { styles } = useCarouselContext();\n return (\n <div\n {...props}\n ref={ref}\n className={cx(styles.viewport, className)}\n data-slot=\"carousel-viewport\"\n />\n );\n },\n);\n\nexport type CarouselTrackProps = ComponentPropsWithoutRef<\"div\">;\nexport const CarouselTrack = forwardRef<HTMLDivElement, CarouselTrackProps>(function CarouselTrack(\n { className, style, ...props },\n ref,\n) {\n const { currentIndex, orientation, styles } = useCarouselContext();\n const transform =\n orientation === \"horizontal\"\n ? `translateX(-${currentIndex * 100}%)`\n : `translateY(-${currentIndex * 100}%)`;\n return (\n <div\n {...props}\n ref={ref}\n className={cx(styles.track, className)}\n data-slot=\"carousel-track\"\n style={{ transform, ...style }}\n />\n );\n});\n\nexport interface CarouselItemProps extends ComponentPropsWithoutRef<\"div\"> {\n index: number;\n}\nexport const CarouselItem = forwardRef<HTMLDivElement, CarouselItemProps>(function CarouselItem(\n { children, className, index, ...props },\n ref,\n) {\n const { currentIndex, registerIndex, styles } = useCarouselContext();\n useEffect(() => registerIndex(index), [index, registerIndex]);\n const active = currentIndex === index;\n return (\n // biome-ignore lint/a11y/useSemanticElements: carousel slides use the ARIA group role.\n <div\n {...props}\n ref={ref}\n aria-hidden={!active}\n aria-roledescription=\"slide\"\n className={cx(styles.item, className)}\n data-index={index}\n data-jaci-component=\"carousel-item\"\n data-selected={active || undefined}\n data-slot=\"carousel-item\"\n role=\"group\"\n tabIndex={active ? 0 : -1}\n >\n {children}\n </div>\n );\n});\n\nfunction createSimpleSlot(slot: \"media\" | \"caption\" | \"title\" | \"description\") {\n return forwardRef<HTMLElement, ComponentPropsWithoutRef<\"div\">>(function CarouselSlot(\n { className, ...props },\n ref,\n ) {\n const { styles } = useCarouselContext();\n if (slot === \"title\")\n return (\n <h3\n {...props}\n ref={ref as Ref<HTMLHeadingElement>}\n className={cx(styles.title, className)}\n data-slot={`carousel-${slot}`}\n />\n );\n if (slot === \"description\")\n return (\n <p\n {...props}\n ref={ref as Ref<HTMLParagraphElement>}\n className={cx(styles.description, className)}\n data-slot={`carousel-${slot}`}\n />\n );\n return (\n <div\n {...props}\n ref={ref as Ref<HTMLDivElement>}\n className={cx(styles[slot], className)}\n data-slot={`carousel-${slot}`}\n />\n );\n });\n}\n\nexport const CarouselMedia = createSimpleSlot(\"media\");\nexport const CarouselCaption = createSimpleSlot(\"caption\");\nexport const CarouselTitle = createSimpleSlot(\"title\");\nexport const CarouselDescription = createSimpleSlot(\"description\");\n\nexport interface CarouselControlProps extends ComponentPropsWithoutRef<\"button\"> {\n children?: ReactNode;\n}\nexport const CarouselPrevious = forwardRef<HTMLButtonElement, CarouselControlProps>(\n function CarouselPrevious(\n { \"aria-label\": ariaLabel = \"Previous slide\", children, className, disabled, ...props },\n ref,\n ) {\n const {\n disabled: contextDisabled,\n getNextIndex,\n orientation,\n setIndex,\n styles,\n } = useCarouselContext();\n return (\n <button\n {...props}\n ref={ref}\n aria-label={ariaLabel}\n className={cx(styles.control, className)}\n data-slot=\"carousel-previous\"\n disabled={disabled ?? contextDisabled}\n onClick={() => setIndex(getNextIndex(-1))}\n type=\"button\"\n >\n {children ?? (orientation === \"vertical\" ? \"↑\" : \"‹\")}\n </button>\n );\n },\n);\n\nexport const CarouselNext = forwardRef<HTMLButtonElement, CarouselControlProps>(\n function CarouselNext(\n { \"aria-label\": ariaLabel = \"Next slide\", children, className, disabled, ...props },\n ref,\n ) {\n const {\n disabled: contextDisabled,\n getNextIndex,\n orientation,\n setIndex,\n styles,\n } = useCarouselContext();\n return (\n <button\n {...props}\n ref={ref}\n aria-label={ariaLabel}\n className={cx(styles.control, className)}\n data-slot=\"carousel-next\"\n disabled={disabled ?? contextDisabled}\n onClick={() => setIndex(getNextIndex(1))}\n type=\"button\"\n >\n {children ?? (orientation === \"vertical\" ? \"↓\" : \"›\")}\n </button>\n );\n },\n);\n\nexport interface CarouselIndicatorProps extends ComponentPropsWithoutRef<\"button\"> {\n index: number;\n}\nexport const CarouselIndicator = forwardRef<HTMLButtonElement, CarouselIndicatorProps>(\n function CarouselIndicator({ \"aria-label\": ariaLabel, className, index, ...props }, ref) {\n const { currentIndex, disabled, setIndex, styles } = useCarouselContext();\n return (\n <button\n {...props}\n ref={ref}\n aria-label={ariaLabel ?? `Go to slide ${index + 1}`}\n aria-selected={currentIndex === index}\n className={cx(styles.indicator, className)}\n data-selected={currentIndex === index || undefined}\n data-slot=\"carousel-indicator\"\n disabled={disabled}\n onClick={() => setIndex(index)}\n role=\"tab\"\n type=\"button\"\n />\n );\n },\n);\n\nexport const CarouselIndicators = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<\"div\">>(\n function CarouselIndicators({ children, className, ...props }, ref) {\n const { indexCount, styles } = useCarouselContext();\n return (\n <div\n {...props}\n ref={ref}\n aria-label=\"Slides\"\n className={cx(styles.indicators, className)}\n data-slot=\"carousel-indicators\"\n role=\"tablist\"\n >\n {children ??\n Array.from({ length: indexCount }, (_, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: indicators are stable by slide index.\n <CarouselIndicator index={index} key={`indicator-${index}`} />\n ))}\n </div>\n );\n },\n);\n\nexport const Carousel = {\n Root: CarouselRoot,\n Viewport: CarouselViewport,\n Track: CarouselTrack,\n Item: CarouselItem,\n Media: CarouselMedia,\n Caption: CarouselCaption,\n Title: CarouselTitle,\n Description: CarouselDescription,\n Previous: CarouselPrevious,\n Next: CarouselNext,\n Indicators: CarouselIndicators,\n Indicator: CarouselIndicator,\n};\n"],"mappings":";;;;;;AA2CA,MAAM,kBAAkB,cAA2C,IAAI;AAEvE,SAAS,qBAAqB;CAC5B,MAAM,UAAU,WAAW,eAAe;CAC1C,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,uDAAuD;CACrF,OAAO;AACT;AAgBA,MAAa,eAAe,WAA2C,SAAS,aAC9E,EACE,WAAW,OACX,mBAAmB,KACnB,UACA,WACA,eAAe,GACf,WAAW,OACX,OACA,QACA,SACA,OAAO,MACP,eACA,WACA,gBACA,gBACA,cAAc,cACd,eAAe,MACf,eAAe,MACf,OACA,YAAY,MACZ,GAAG,SAEL,KACA;CACA,MAAM,CAAC,mBAAmB,wBAAwB,SAAS,KAAK,IAAI,GAAG,YAAY,CAAC;C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,SAAS;EACzC,iBAAe,iBAAiB,SAAS,KAAA;EACzC,aAAU;EACA;EACV,eAAe,SAAS,KAAK;EAC7B,MAAK;EACL,MAAK;CACN,CAAA;AAEL,CACF;AAEA,MAAa,qBAAqB,WAChC,SAAS,mBAAmB,EAAE,UAAU,WAAW,GAAG,SAAS,KAAK;CAClE,MAAM,EAAE,YAAY,WAAW,mBAAmB;CAClD,OACE,oBAAC,OAAD;EACE,GAAI;EACC;EACL,cAAW;EACX,WAAW,GAAG,OAAO,YAAY,SAAS;EAC1C,aAAU;EACV,MAAK;YAEJ,YACC,MAAM,KAAK,EAAE,QAAQ,WAAW,IAAI,GAAG,UAErC,oBAAC,mBAAD,EAA0B,MAAmC,GAAvB,aAAa,OAAU,CAC9D;CACA,CAAA;AAET,CACF;AAEA,MAAa,WAAW;CACtB,MAAM;CACN,UAAU;CACV,OAAO;CACP,MAAM;CACN,OAAO;CACP,SAAS;CACT,OAAO;CACP,aAAa;CACb,UAAU;CACV,MAAM;CACN,YAAY;CACZ,WAAW;AACb"}
@@ -0,0 +1,2 @@
1
+ import { Carousel, CarouselControlProps, CarouselIndicatorProps, CarouselItemProps, CarouselOrientation, CarouselRootProps, CarouselTrackProps, CarouselViewportProps } from "./carousel.cjs";
2
+ export { Carousel, type CarouselControlProps, type CarouselIndicatorProps, type CarouselItemProps, type CarouselOrientation, type CarouselRootProps, type CarouselTrackProps, type CarouselViewportProps };
@@ -0,0 +1,2 @@
1
+ import { Carousel, CarouselControlProps, CarouselIndicatorProps, CarouselItemProps, CarouselOrientation, CarouselRootProps, CarouselTrackProps, CarouselViewportProps } from "./carousel.js";
2
+ export { Carousel, type CarouselControlProps, type CarouselIndicatorProps, type CarouselItemProps, type CarouselOrientation, type CarouselRootProps, type CarouselTrackProps, type CarouselViewportProps };
@@ -3,24 +3,51 @@ const require_code = require("../../styled-system/recipes/code.cjs");
3
3
  let react = require("react");
4
4
  let react_jsx_runtime = require("react/jsx-runtime");
5
5
  //#region src/components/code/code.tsx
6
- const Code = (0, react.forwardRef)(function Code({ children, className, language, truncate = false, variant = "inline", wrap = false, ...props }, ref) {
6
+ function getTextLines(children) {
7
+ const nodes = react.Children.toArray(children);
8
+ if (!nodes.every((node) => typeof node === "string" || typeof node === "number")) return null;
9
+ return nodes.map(String).join("").split("\n");
10
+ }
11
+ function getLineKeys(lines) {
12
+ const occurrences = /* @__PURE__ */ new Map();
13
+ return lines.map((line) => {
14
+ const occurrence = occurrences.get(line) ?? 0;
15
+ occurrences.set(line, occurrence + 1);
16
+ return `line-${line}-${occurrence}`;
17
+ });
18
+ }
19
+ const Code = (0, react.forwardRef)(function Code({ children, className, language, lineNumbers = false, truncate = false, variant = "inline", wrap = false, ...props }, ref) {
20
+ const lines = variant === "block" && lineNumbers ? getTextLines(children) : null;
21
+ const lineKeys = lines ? getLineKeys(lines) : null;
7
22
  const classNames = require_cx.cx(require_code.code({
23
+ lineNumbers: Boolean(lines),
8
24
  truncate,
9
25
  variant,
10
26
  wrap
11
27
  }), className);
12
- if (variant === "block") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
28
+ if (variant === "block") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("pre", {
13
29
  ...props,
14
30
  ref,
15
31
  className: classNames,
16
32
  "data-jaci-component": "code",
17
33
  "data-language": language || void 0,
34
+ "data-line-numbers": lines ? "true" : void 0,
18
35
  "data-slot": "code",
19
36
  "data-variant": variant,
20
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
37
+ children: [lines ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
38
+ "aria-hidden": "true",
39
+ "data-slot": "code-gutter",
40
+ children: lines.map((_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
41
+ "data-slot": "code-line-number",
42
+ children: index + 1
43
+ }, lineKeys?.[index]))
44
+ }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
21
45
  "data-slot": "code-content",
22
- children
23
- })
46
+ children: lines ? lines.map((line, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
47
+ "data-slot": "code-line",
48
+ children: [line, index < lines.length - 1 ? "\n" : null]
49
+ }, lineKeys?.[index])) : children
50
+ })]
24
51
  });
25
52
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
26
53
  ...props,
@@ -1 +1 @@
1
- {"version":3,"file":"code.cjs","names":["cx","code"],"sources":["../../../src/components/code/code.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { code } from \"../../styled-system/recipes\";\n\nexport type CodeVariant = \"inline\" | \"block\";\n\nexport interface CodeProps extends Omit<ComponentPropsWithoutRef<\"code\">, \"children\"> {\n children?: ReactNode;\n variant?: CodeVariant;\n language?: string;\n wrap?: boolean;\n truncate?: boolean;\n}\n\nexport const Code = forwardRef<HTMLElement, CodeProps>(function Code(\n { children, className, language, truncate = false, variant = \"inline\", wrap = false, ...props },\n ref,\n) {\n const classNames = cx(code({ truncate, variant, wrap }), className);\n\n if (variant === \"block\") {\n return (\n <pre\n {...props}\n ref={ref as React.Ref<HTMLPreElement>}\n className={classNames}\n data-jaci-component=\"code\"\n data-language={language || undefined}\n data-slot=\"code\"\n data-variant={variant}\n >\n <code data-slot=\"code-content\">{children}</code>\n </pre>\n );\n }\n\n return (\n <code\n {...props}\n ref={ref as React.Ref<HTMLElement>}\n className={classNames}\n data-jaci-component=\"code\"\n data-language={language || undefined}\n data-slot=\"code\"\n data-variant={variant}\n >\n {children}\n </code>\n );\n});\n"],"mappings":";;;;;AAgBA,MAAa,QAAA,GAAA,MAAA,WAAA,CAA0C,SAAS,KAC9D,EAAE,UAAU,WAAW,UAAU,WAAW,OAAO,UAAU,UAAU,OAAO,OAAO,GAAG,SACxF,KACA;CACA,MAAM,aAAaA,WAAAA,GAAGC,aAAAA,KAAK;EAAE;EAAU;EAAS;CAAK,CAAC,GAAG,SAAS;CAElE,IAAI,YAAY,SACd,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,GAAI;EACC;EACL,WAAW;EACX,uBAAoB;EACpB,iBAAe,YAAY,KAAA;EAC3B,aAAU;EACV,gBAAc;YAEd,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,aAAU;GAAgB;EAAe,CAAA;CAC5C,CAAA;CAIT,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;EACE,GAAI;EACC;EACL,WAAW;EACX,uBAAoB;EACpB,iBAAe,YAAY,KAAA;EAC3B,aAAU;EACV,gBAAc;EAEb;CACG,CAAA;AAEV,CAAC"}
1
+ {"version":3,"file":"code.cjs","names":["Children","cx","code"],"sources":["../../../src/components/code/code.tsx"],"sourcesContent":["import { Children, forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { code } from \"../../styled-system/recipes\";\n\nexport type CodeVariant = \"inline\" | \"block\";\n\nexport interface CodeProps extends Omit<ComponentPropsWithoutRef<\"code\">, \"children\"> {\n children?: ReactNode;\n variant?: CodeVariant;\n language?: string;\n wrap?: boolean;\n truncate?: boolean;\n lineNumbers?: boolean;\n}\n\nfunction getTextLines(children: ReactNode) {\n const nodes = Children.toArray(children);\n if (!nodes.every((node) => typeof node === \"string\" || typeof node === \"number\")) return null;\n return nodes.map(String).join(\"\").split(\"\\n\");\n}\n\nfunction getLineKeys(lines: readonly string[]) {\n const occurrences = new Map<string, number>();\n return lines.map((line) => {\n const occurrence = occurrences.get(line) ?? 0;\n occurrences.set(line, occurrence + 1);\n return `line-${line}-${occurrence}`;\n });\n}\n\nexport const Code = forwardRef<HTMLElement, CodeProps>(function Code(\n {\n children,\n className,\n language,\n lineNumbers = false,\n truncate = false,\n variant = \"inline\",\n wrap = false,\n ...props\n },\n ref,\n) {\n const lines = variant === \"block\" && lineNumbers ? getTextLines(children) : null;\n const lineKeys = lines ? getLineKeys(lines) : null;\n const classNames = cx(code({ lineNumbers: Boolean(lines), truncate, variant, wrap }), className);\n\n if (variant === \"block\") {\n return (\n <pre\n {...props}\n ref={ref as React.Ref<HTMLPreElement>}\n className={classNames}\n data-jaci-component=\"code\"\n data-language={language || undefined}\n data-line-numbers={lines ? \"true\" : undefined}\n data-slot=\"code\"\n data-variant={variant}\n >\n {lines ? (\n <span aria-hidden=\"true\" data-slot=\"code-gutter\">\n {lines.map((_, index) => (\n <span data-slot=\"code-line-number\" key={lineKeys?.[index]}>\n {index + 1}\n </span>\n ))}\n </span>\n ) : null}\n <code data-slot=\"code-content\">\n {lines\n ? lines.map((line, index) => (\n <span data-slot=\"code-line\" key={lineKeys?.[index]}>\n {line}\n {index < lines.length - 1 ? \"\\n\" : null}\n </span>\n ))\n : children}\n </code>\n </pre>\n );\n }\n\n return (\n <code\n {...props}\n ref={ref as React.Ref<HTMLElement>}\n className={classNames}\n data-jaci-component=\"code\"\n data-language={language || undefined}\n data-slot=\"code\"\n data-variant={variant}\n >\n {children}\n </code>\n );\n});\n"],"mappings":";;;;;AAiBA,SAAS,aAAa,UAAqB;CACzC,MAAM,QAAQA,MAAAA,SAAS,QAAQ,QAAQ;CACvC,IAAI,CAAC,MAAM,OAAO,SAAS,OAAO,SAAS,YAAY,OAAO,SAAS,QAAQ,GAAG,OAAO;CACzF,OAAO,MAAM,IAAI,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,IAAI;AAC9C;AAEA,SAAS,YAAY,OAA0B;CAC7C,MAAM,8BAAc,IAAI,IAAoB;CAC5C,OAAO,MAAM,KAAK,SAAS;EACzB,MAAM,aAAa,YAAY,IAAI,IAAI,KAAK;EAC5C,YAAY,IAAI,MAAM,aAAa,CAAC;EACpC,OAAO,QAAQ,KAAK,GAAG;CACzB,CAAC;AACH;AAEA,MAAa,QAAA,GAAA,MAAA,WAAA,CAA0C,SAAS,KAC9D,EACE,UACA,WACA,UACA,cAAc,OACd,WAAW,OACX,UAAU,UACV,OAAO,OACP,GAAG,SAEL,KACA;CACA,MAAM,QAAQ,YAAY,WAAW,cAAc,aAAa,QAAQ,IAAI;CAC5E,MAAM,WAAW,QAAQ,YAAY,KAAK,IAAI;CAC9C,MAAM,aAAaC,WAAAA,GAAGC,aAAAA,KAAK;EAAE,aAAa,QAAQ,KAAK;EAAG;EAAU;EAAS;CAAK,CAAC,GAAG,SAAS;CAE/F,IAAI,YAAY,SACd,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EACE,GAAI;EACC;EACL,WAAW;EACX,uBAAoB;EACpB,iBAAe,YAAY,KAAA;EAC3B,qBAAmB,QAAQ,SAAS,KAAA;EACpC,aAAU;EACV,gBAAc;YARhB,CAUG,QACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,eAAY;GAAO,aAAU;aAChC,MAAM,KAAK,GAAG,UACb,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAAM,aAAU;cACb,QAAQ;GACL,GAFkC,WAAW,MAE7C,CACP;EACG,CAAA,IACJ,MACJ,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,aAAU;aACb,QACG,MAAM,KAAK,MAAM,UACf,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;IAAM,aAAU;cAAhB,CACG,MACA,QAAQ,MAAM,SAAS,IAAI,OAAO,IAC/B;MAH2B,WAAW,MAGtC,CACP,IACD;EACA,CAAA,CACH;;CAIT,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;EACE,GAAI;EACC;EACL,WAAW;EACX,uBAAoB;EACpB,iBAAe,YAAY,KAAA;EAC3B,aAAU;EACV,gBAAc;EAEb;CACG,CAAA;AAEV,CAAC"}
@@ -7,6 +7,7 @@ interface CodeProps extends Omit<ComponentPropsWithoutRef<"code">, "children"> {
7
7
  language?: string;
8
8
  wrap?: boolean;
9
9
  truncate?: boolean;
10
+ lineNumbers?: boolean;
10
11
  }
11
12
  declare const Code: import("react").ForwardRefExoticComponent<CodeProps & import("react").RefAttributes<HTMLElement>>;
12
13
  //#endregion
@@ -7,6 +7,7 @@ interface CodeProps extends Omit<ComponentPropsWithoutRef<"code">, "children"> {
7
7
  language?: string;
8
8
  wrap?: boolean;
9
9
  truncate?: boolean;
10
+ lineNumbers?: boolean;
10
11
  }
11
12
  declare const Code: import("react").ForwardRefExoticComponent<CodeProps & import("react").RefAttributes<HTMLElement>>;
12
13
  //#endregion
@@ -1,26 +1,53 @@
1
1
  import { cx } from "../../styled-system/css/cx.js";
2
2
  import { code } from "../../styled-system/recipes/code.js";
3
- import { forwardRef } from "react";
4
- import { jsx } from "react/jsx-runtime";
3
+ import { Children, forwardRef } from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
5
  //#region src/components/code/code.tsx
6
- const Code = forwardRef(function Code({ children, className, language, truncate = false, variant = "inline", wrap = false, ...props }, ref) {
6
+ function getTextLines(children) {
7
+ const nodes = Children.toArray(children);
8
+ if (!nodes.every((node) => typeof node === "string" || typeof node === "number")) return null;
9
+ return nodes.map(String).join("").split("\n");
10
+ }
11
+ function getLineKeys(lines) {
12
+ const occurrences = /* @__PURE__ */ new Map();
13
+ return lines.map((line) => {
14
+ const occurrence = occurrences.get(line) ?? 0;
15
+ occurrences.set(line, occurrence + 1);
16
+ return `line-${line}-${occurrence}`;
17
+ });
18
+ }
19
+ const Code = forwardRef(function Code({ children, className, language, lineNumbers = false, truncate = false, variant = "inline", wrap = false, ...props }, ref) {
20
+ const lines = variant === "block" && lineNumbers ? getTextLines(children) : null;
21
+ const lineKeys = lines ? getLineKeys(lines) : null;
7
22
  const classNames = cx(code({
23
+ lineNumbers: Boolean(lines),
8
24
  truncate,
9
25
  variant,
10
26
  wrap
11
27
  }), className);
12
- if (variant === "block") return /* @__PURE__ */ jsx("pre", {
28
+ if (variant === "block") return /* @__PURE__ */ jsxs("pre", {
13
29
  ...props,
14
30
  ref,
15
31
  className: classNames,
16
32
  "data-jaci-component": "code",
17
33
  "data-language": language || void 0,
34
+ "data-line-numbers": lines ? "true" : void 0,
18
35
  "data-slot": "code",
19
36
  "data-variant": variant,
20
- children: /* @__PURE__ */ jsx("code", {
37
+ children: [lines ? /* @__PURE__ */ jsx("span", {
38
+ "aria-hidden": "true",
39
+ "data-slot": "code-gutter",
40
+ children: lines.map((_, index) => /* @__PURE__ */ jsx("span", {
41
+ "data-slot": "code-line-number",
42
+ children: index + 1
43
+ }, lineKeys?.[index]))
44
+ }) : null, /* @__PURE__ */ jsx("code", {
21
45
  "data-slot": "code-content",
22
- children
23
- })
46
+ children: lines ? lines.map((line, index) => /* @__PURE__ */ jsxs("span", {
47
+ "data-slot": "code-line",
48
+ children: [line, index < lines.length - 1 ? "\n" : null]
49
+ }, lineKeys?.[index])) : children
50
+ })]
24
51
  });
25
52
  return /* @__PURE__ */ jsx("code", {
26
53
  ...props,
@@ -1 +1 @@
1
- {"version":3,"file":"code.js","names":[],"sources":["../../../src/components/code/code.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { code } from \"../../styled-system/recipes\";\n\nexport type CodeVariant = \"inline\" | \"block\";\n\nexport interface CodeProps extends Omit<ComponentPropsWithoutRef<\"code\">, \"children\"> {\n children?: ReactNode;\n variant?: CodeVariant;\n language?: string;\n wrap?: boolean;\n truncate?: boolean;\n}\n\nexport const Code = forwardRef<HTMLElement, CodeProps>(function Code(\n { children, className, language, truncate = false, variant = \"inline\", wrap = false, ...props },\n ref,\n) {\n const classNames = cx(code({ truncate, variant, wrap }), className);\n\n if (variant === \"block\") {\n return (\n <pre\n {...props}\n ref={ref as React.Ref<HTMLPreElement>}\n className={classNames}\n data-jaci-component=\"code\"\n data-language={language || undefined}\n data-slot=\"code\"\n data-variant={variant}\n >\n <code data-slot=\"code-content\">{children}</code>\n </pre>\n );\n }\n\n return (\n <code\n {...props}\n ref={ref as React.Ref<HTMLElement>}\n className={classNames}\n data-jaci-component=\"code\"\n data-language={language || undefined}\n data-slot=\"code\"\n data-variant={variant}\n >\n {children}\n </code>\n );\n});\n"],"mappings":";;;;;AAgBA,MAAa,OAAO,WAAmC,SAAS,KAC9D,EAAE,UAAU,WAAW,UAAU,WAAW,OAAO,UAAU,UAAU,OAAO,OAAO,GAAG,SACxF,KACA;CACA,MAAM,aAAa,GAAG,KAAK;EAAE;EAAU;EAAS;CAAK,CAAC,GAAG,SAAS;CAElE,IAAI,YAAY,SACd,OACE,oBAAC,OAAD;EACE,GAAI;EACC;EACL,WAAW;EACX,uBAAoB;EACpB,iBAAe,YAAY,KAAA;EAC3B,aAAU;EACV,gBAAc;YAEd,oBAAC,QAAD;GAAM,aAAU;GAAgB;EAAe,CAAA;CAC5C,CAAA;CAIT,OACE,oBAAC,QAAD;EACE,GAAI;EACC;EACL,WAAW;EACX,uBAAoB;EACpB,iBAAe,YAAY,KAAA;EAC3B,aAAU;EACV,gBAAc;EAEb;CACG,CAAA;AAEV,CAAC"}
1
+ {"version":3,"file":"code.js","names":[],"sources":["../../../src/components/code/code.tsx"],"sourcesContent":["import { Children, forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { code } from \"../../styled-system/recipes\";\n\nexport type CodeVariant = \"inline\" | \"block\";\n\nexport interface CodeProps extends Omit<ComponentPropsWithoutRef<\"code\">, \"children\"> {\n children?: ReactNode;\n variant?: CodeVariant;\n language?: string;\n wrap?: boolean;\n truncate?: boolean;\n lineNumbers?: boolean;\n}\n\nfunction getTextLines(children: ReactNode) {\n const nodes = Children.toArray(children);\n if (!nodes.every((node) => typeof node === \"string\" || typeof node === \"number\")) return null;\n return nodes.map(String).join(\"\").split(\"\\n\");\n}\n\nfunction getLineKeys(lines: readonly string[]) {\n const occurrences = new Map<string, number>();\n return lines.map((line) => {\n const occurrence = occurrences.get(line) ?? 0;\n occurrences.set(line, occurrence + 1);\n return `line-${line}-${occurrence}`;\n });\n}\n\nexport const Code = forwardRef<HTMLElement, CodeProps>(function Code(\n {\n children,\n className,\n language,\n lineNumbers = false,\n truncate = false,\n variant = \"inline\",\n wrap = false,\n ...props\n },\n ref,\n) {\n const lines = variant === \"block\" && lineNumbers ? getTextLines(children) : null;\n const lineKeys = lines ? getLineKeys(lines) : null;\n const classNames = cx(code({ lineNumbers: Boolean(lines), truncate, variant, wrap }), className);\n\n if (variant === \"block\") {\n return (\n <pre\n {...props}\n ref={ref as React.Ref<HTMLPreElement>}\n className={classNames}\n data-jaci-component=\"code\"\n data-language={language || undefined}\n data-line-numbers={lines ? \"true\" : undefined}\n data-slot=\"code\"\n data-variant={variant}\n >\n {lines ? (\n <span aria-hidden=\"true\" data-slot=\"code-gutter\">\n {lines.map((_, index) => (\n <span data-slot=\"code-line-number\" key={lineKeys?.[index]}>\n {index + 1}\n </span>\n ))}\n </span>\n ) : null}\n <code data-slot=\"code-content\">\n {lines\n ? lines.map((line, index) => (\n <span data-slot=\"code-line\" key={lineKeys?.[index]}>\n {line}\n {index < lines.length - 1 ? \"\\n\" : null}\n </span>\n ))\n : children}\n </code>\n </pre>\n );\n }\n\n return (\n <code\n {...props}\n ref={ref as React.Ref<HTMLElement>}\n className={classNames}\n data-jaci-component=\"code\"\n data-language={language || undefined}\n data-slot=\"code\"\n data-variant={variant}\n >\n {children}\n </code>\n );\n});\n"],"mappings":";;;;;AAiBA,SAAS,aAAa,UAAqB;CACzC,MAAM,QAAQ,SAAS,QAAQ,QAAQ;CACvC,IAAI,CAAC,MAAM,OAAO,SAAS,OAAO,SAAS,YAAY,OAAO,SAAS,QAAQ,GAAG,OAAO;CACzF,OAAO,MAAM,IAAI,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,IAAI;AAC9C;AAEA,SAAS,YAAY,OAA0B;CAC7C,MAAM,8BAAc,IAAI,IAAoB;CAC5C,OAAO,MAAM,KAAK,SAAS;EACzB,MAAM,aAAa,YAAY,IAAI,IAAI,KAAK;EAC5C,YAAY,IAAI,MAAM,aAAa,CAAC;EACpC,OAAO,QAAQ,KAAK,GAAG;CACzB,CAAC;AACH;AAEA,MAAa,OAAO,WAAmC,SAAS,KAC9D,EACE,UACA,WACA,UACA,cAAc,OACd,WAAW,OACX,UAAU,UACV,OAAO,OACP,GAAG,SAEL,KACA;CACA,MAAM,QAAQ,YAAY,WAAW,cAAc,aAAa,QAAQ,IAAI;CAC5E,MAAM,WAAW,QAAQ,YAAY,KAAK,IAAI;CAC9C,MAAM,aAAa,GAAG,KAAK;EAAE,aAAa,QAAQ,KAAK;EAAG;EAAU;EAAS;CAAK,CAAC,GAAG,SAAS;CAE/F,IAAI,YAAY,SACd,OACE,qBAAC,OAAD;EACE,GAAI;EACC;EACL,WAAW;EACX,uBAAoB;EACpB,iBAAe,YAAY,KAAA;EAC3B,qBAAmB,QAAQ,SAAS,KAAA;EACpC,aAAU;EACV,gBAAc;YARhB,CAUG,QACC,oBAAC,QAAD;GAAM,eAAY;GAAO,aAAU;aAChC,MAAM,KAAK,GAAG,UACb,oBAAC,QAAD;IAAM,aAAU;cACb,QAAQ;GACL,GAFkC,WAAW,MAE7C,CACP;EACG,CAAA,IACJ,MACJ,oBAAC,QAAD;GAAM,aAAU;aACb,QACG,MAAM,KAAK,MAAM,UACf,qBAAC,QAAD;IAAM,aAAU;cAAhB,CACG,MACA,QAAQ,MAAM,SAAS,IAAI,OAAO,IAC/B;MAH2B,WAAW,MAGtC,CACP,IACD;EACA,CAAA,CACH;;CAIT,OACE,oBAAC,QAAD;EACE,GAAI;EACC;EACL,WAAW;EACX,uBAAoB;EACpB,iBAAe,YAAY,KAAA;EAC3B,aAAU;EACV,gBAAc;EAEb;CACG,CAAA;AAEV,CAAC"}
@@ -0,0 +1,33 @@
1
+ const require_cx = require("../../styled-system/css/cx.cjs");
2
+ const require_color_swatch = require("../../styled-system/recipes/color-swatch.cjs");
3
+ let react = require("react");
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ //#region src/components/color-swatch/color-swatch.tsx
6
+ const ColorSwatch = (0, react.forwardRef)(function ColorSwatch({ border = true, className, color, label, shape = "circle", size = "md", style, ...props }, ref) {
7
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8
+ ...props,
9
+ ref,
10
+ ...label ? {
11
+ "aria-label": label,
12
+ role: "img"
13
+ } : {},
14
+ className: require_cx.cx(require_color_swatch.colorSwatch({
15
+ border,
16
+ shape,
17
+ size
18
+ }), className),
19
+ "data-color": color,
20
+ "data-jaci-component": "color-swatch",
21
+ "data-shape": shape,
22
+ "data-size": size,
23
+ "data-slot": "color-swatch",
24
+ style: {
25
+ backgroundColor: color,
26
+ ...style
27
+ }
28
+ });
29
+ });
30
+ //#endregion
31
+ exports.ColorSwatch = ColorSwatch;
32
+
33
+ //# sourceMappingURL=color-swatch.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-swatch.cjs","names":["cx","colorSwatch"],"sources":["../../../src/components/color-swatch/color-swatch.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { colorSwatch } from \"../../styled-system/recipes\";\n\nexport interface ColorSwatchProps extends ComponentPropsWithoutRef<\"span\"> {\n color: string;\n size?: \"sm\" | \"md\" | \"lg\";\n shape?: \"circle\" | \"square\";\n border?: boolean;\n label?: string;\n}\n\nexport const ColorSwatch = forwardRef<HTMLSpanElement, ColorSwatchProps>(function ColorSwatch(\n { border = true, className, color, label, shape = \"circle\", size = \"md\", style, ...props },\n ref,\n) {\n return (\n <span\n {...props}\n ref={ref}\n {...(label ? { \"aria-label\": label, role: \"img\" as const } : {})}\n className={cx(colorSwatch({ border, shape, size }), className)}\n data-color={color}\n data-jaci-component=\"color-swatch\"\n data-shape={shape}\n data-size={size}\n data-slot=\"color-swatch\"\n style={{ backgroundColor: color, ...style }}\n />\n );\n});\n"],"mappings":";;;;;AAcA,MAAa,eAAA,GAAA,MAAA,WAAA,CAA4D,SAAS,YAChF,EAAE,SAAS,MAAM,WAAW,OAAO,OAAO,QAAQ,UAAU,OAAO,MAAM,OAAO,GAAG,SACnF,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;EACE,GAAI;EACC;EACL,GAAK,QAAQ;GAAE,cAAc;GAAO,MAAM;EAAe,IAAI,CAAC;EAC9D,WAAWA,WAAAA,GAAGC,qBAAAA,YAAY;GAAE;GAAQ;GAAO;EAAK,CAAC,GAAG,SAAS;EAC7D,cAAY;EACZ,uBAAoB;EACpB,cAAY;EACZ,aAAW;EACX,aAAU;EACV,OAAO;GAAE,iBAAiB;GAAO,GAAG;EAAM;CAC3C,CAAA;AAEL,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { ComponentPropsWithoutRef } from "react";
2
+ //#region src/components/color-swatch/color-swatch.d.ts
3
+ interface ColorSwatchProps extends ComponentPropsWithoutRef<"span"> {
4
+ color: string;
5
+ size?: "sm" | "md" | "lg";
6
+ shape?: "circle" | "square";
7
+ border?: boolean;
8
+ label?: string;
9
+ }
10
+ declare const ColorSwatch: import("react").ForwardRefExoticComponent<ColorSwatchProps & import("react").RefAttributes<HTMLSpanElement>>;
11
+ //#endregion
12
+ export { ColorSwatch, ColorSwatchProps };
13
+ //# sourceMappingURL=color-swatch.d.cts.map
@@ -0,0 +1,13 @@
1
+ import { ComponentPropsWithoutRef } from "react";
2
+ //#region src/components/color-swatch/color-swatch.d.ts
3
+ interface ColorSwatchProps extends ComponentPropsWithoutRef<"span"> {
4
+ color: string;
5
+ size?: "sm" | "md" | "lg";
6
+ shape?: "circle" | "square";
7
+ border?: boolean;
8
+ label?: string;
9
+ }
10
+ declare const ColorSwatch: import("react").ForwardRefExoticComponent<ColorSwatchProps & import("react").RefAttributes<HTMLSpanElement>>;
11
+ //#endregion
12
+ export { ColorSwatch, ColorSwatchProps };
13
+ //# sourceMappingURL=color-swatch.d.ts.map