@donotdev/components 0.0.23 → 0.0.25
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.
- package/dist/CarouselContent-HEXWLSR2.css +1 -0
- package/dist/CarouselContent-WGDMI6BH.js +1 -0
- package/dist/CodeContent-EYAMBIQ2.css +1 -0
- package/dist/CodeContent-RW7AXCX3.js +2 -0
- package/dist/CrawlContent-5CUKBDIN.js +1 -0
- package/dist/MarqueeContent-25D2GMPK.css +1 -0
- package/dist/MarqueeContent-DOKPFDYK.js +1 -0
- package/dist/advanced/Carousel/CarouselContent.js +2 -2
- package/dist/advanced/Carousel/CarouselSkeleton.js +1 -1
- package/dist/advanced/Code/CodeContent.js +1 -1
- package/dist/advanced/Code/CodeSkeleton.js +1 -1
- package/dist/advanced/Crawl/Crawl.d.ts.map +1 -1
- package/dist/advanced/Crawl/Crawl.js +1 -1
- package/dist/advanced/JsonViewer/JsonViewer.js +1 -1
- package/dist/advanced/Marquee/Marquee.d.ts.map +1 -1
- package/dist/advanced/Marquee/Marquee.js +1 -1
- package/dist/advanced/Marquee/MarqueeContent.js +3 -3
- package/dist/advanced/Marquee/MarqueeSkeleton.js +2 -2
- package/dist/advanced/Reveal/Reveal.js +1 -1
- package/dist/advanced/Roadmap/RoadmapContent.d.ts.map +1 -1
- package/dist/advanced/Roadmap/RoadmapContent.js +3 -3
- package/dist/advanced/SplitReveal/SplitReveal.d.ts.map +1 -1
- package/dist/advanced/SplitReveal/SplitReveal.js +2 -2
- package/dist/advanced/StackedCards/StackedCardsContent.d.ts.map +1 -1
- package/dist/advanced/StackedCards/StackedCardsContent.js +2 -2
- package/dist/atomic/Alert/index.d.ts +1 -1
- package/dist/atomic/Badge/index.d.ts +1 -1
- package/dist/atomic/Button/index.d.ts +1 -1
- package/dist/atomic/Button/index.d.ts.map +1 -1
- package/dist/atomic/Button/index.js +1 -1
- package/dist/atomic/ButtonGroup/index.d.ts +93 -0
- package/dist/atomic/ButtonGroup/index.d.ts.map +1 -0
- package/dist/atomic/ButtonGroup/index.js +57 -0
- package/dist/atomic/Calendar/index.d.ts.map +1 -1
- package/dist/atomic/Calendar/index.js +5 -4
- package/dist/atomic/Collapsible/CollapsiblePrimitive.d.ts +7 -0
- package/dist/atomic/Collapsible/CollapsiblePrimitive.d.ts.map +1 -1
- package/dist/atomic/Collapsible/CollapsiblePrimitive.js +1 -1
- package/dist/atomic/ColorPicker/index.d.ts +100 -0
- package/dist/atomic/ColorPicker/index.d.ts.map +1 -0
- package/dist/atomic/ColorPicker/index.js +195 -0
- package/dist/atomic/Combobox/index.d.ts.map +1 -1
- package/dist/atomic/Combobox/index.js +28 -5
- package/dist/atomic/CommandDialog/index.d.ts.map +1 -1
- package/dist/atomic/CommandDialog/index.js +5 -5
- package/dist/atomic/Dialog/index.d.ts +1 -1
- package/dist/atomic/Dialog/index.d.ts.map +1 -1
- package/dist/atomic/Dialog/index.js +1 -1
- package/dist/atomic/HeroSection/index.d.ts +1 -1
- package/dist/atomic/HoverCard/index.d.ts.map +1 -1
- package/dist/atomic/HoverCard/index.js +1 -1
- package/dist/atomic/Icons/Partner/providerIcons.js +11 -11
- package/dist/atomic/Input/index.d.ts +1 -1
- package/dist/atomic/Input/index.d.ts.map +1 -1
- package/dist/atomic/Input/index.js +1 -1
- package/dist/atomic/Pagination/index.d.ts.map +1 -1
- package/dist/atomic/Pagination/index.js +2 -2
- package/dist/atomic/RadioGroup/index.d.ts +10 -5
- package/dist/atomic/RadioGroup/index.d.ts.map +1 -1
- package/dist/atomic/RadioGroup/index.js +9 -4
- package/dist/atomic/RangeInput/index.js +1 -1
- package/dist/atomic/Rating/index.d.ts +10 -1
- package/dist/atomic/Rating/index.d.ts.map +1 -1
- package/dist/atomic/Rating/index.js +2 -2
- package/dist/atomic/SkipLink/index.d.ts +38 -0
- package/dist/atomic/SkipLink/index.d.ts.map +1 -0
- package/dist/atomic/SkipLink/index.js +56 -0
- package/dist/atomic/Stepper/index.d.ts +1 -1
- package/dist/atomic/Tabs/index.d.ts +1 -1
- package/dist/atomic/Tag/index.d.ts +1 -1
- package/dist/atomic/Toaster/ToastPrimitive.d.ts +1 -1
- package/dist/atomic/Toaster/index.d.ts.map +1 -1
- package/dist/atomic/Toaster/index.js +1 -1
- package/dist/atomic/Toggle/index.d.ts +1 -1
- package/dist/atomic/TreeView/index.d.ts +116 -0
- package/dist/atomic/TreeView/index.d.ts.map +1 -0
- package/dist/atomic/TreeView/index.js +316 -0
- package/dist/atomic/VideoPlayer/index.d.ts.map +1 -1
- package/dist/atomic/index.d.ts +8 -0
- package/dist/atomic/index.d.ts.map +1 -1
- package/dist/atomic/index.js +4 -0
- package/dist/chunk-E54ZWOWD.js +1 -0
- package/dist/chunk-FA4BDD6N.js +1 -0
- package/dist/chunk-IFHHPSKN.js +1 -0
- package/dist/chunk-O2XFH626.js +1 -0
- package/dist/chunk-Q3J75GL4.js +1 -0
- package/dist/chunk-U37VKGRT.js +3 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useClickOutside.d.ts +0 -1
- package/dist/hooks/useClickOutside.d.ts.map +1 -1
- package/dist/hooks/useClickOutside.js +0 -1
- package/dist/hooks/useSwipeToClose.d.ts.map +1 -1
- package/dist/hooks/useSwipeToClose.js +2 -1
- package/dist/hooks/useToast.d.ts +2 -3
- package/dist/hooks/useToast.d.ts.map +1 -1
- package/dist/hooks/useToast.js +1 -2
- package/dist/index.js +4 -7
- package/dist/styles/index.css +456 -51
- package/dist/utils/variants.d.ts +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
import './ColorPicker.css';
|
|
3
|
+
/** A preset color swatch */
|
|
4
|
+
export interface ColorSwatch {
|
|
5
|
+
/** Hex color value (e.g., '#ff0000') */
|
|
6
|
+
value: string;
|
|
7
|
+
/** Human-readable name — used as aria-label for accessibility */
|
|
8
|
+
label: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const COLOR_PRESETS: {
|
|
11
|
+
readonly BASIC: "basic";
|
|
12
|
+
readonly MATERIAL: "material";
|
|
13
|
+
readonly PASTEL: "pastel";
|
|
14
|
+
};
|
|
15
|
+
export type ColorPreset = (typeof COLOR_PRESETS)[keyof typeof COLOR_PRESETS];
|
|
16
|
+
export interface ColorPickerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
|
|
17
|
+
/** Controlled hex color value (e.g., '#00bcd4') */
|
|
18
|
+
value?: string;
|
|
19
|
+
/** Default hex color value (uncontrolled) */
|
|
20
|
+
defaultValue?: string;
|
|
21
|
+
/** Callback when color changes. Returns hex string. */
|
|
22
|
+
onChange?: (color: string) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Preset swatch palette name, or custom array.
|
|
25
|
+
* @default 'basic'
|
|
26
|
+
*/
|
|
27
|
+
swatches?: ColorPreset | ColorSwatch[];
|
|
28
|
+
/**
|
|
29
|
+
* Number of columns in swatch grid.
|
|
30
|
+
* @default 8
|
|
31
|
+
*/
|
|
32
|
+
columns?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Show native color input for custom color selection.
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
showCustom?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Show hex value display below swatches.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
showHexValue?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the picker is disabled.
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
/** Accessible label for the color picker */
|
|
49
|
+
'aria-label'?: string;
|
|
50
|
+
/** Additional CSS classes */
|
|
51
|
+
className?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Color selection component with preset swatch grid and native color input.
|
|
55
|
+
* Full ARIA radiogroup pattern with roving tabindex for keyboard navigation.
|
|
56
|
+
*
|
|
57
|
+
* @component
|
|
58
|
+
* @example
|
|
59
|
+
* ```tsx
|
|
60
|
+
* // Basic usage with preset palette
|
|
61
|
+
* <ColorPicker
|
|
62
|
+
* value={color}
|
|
63
|
+
* onChange={setColor}
|
|
64
|
+
* aria-label="Choose accent color"
|
|
65
|
+
* />
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```tsx
|
|
70
|
+
* // Material palette with hex display
|
|
71
|
+
* <ColorPicker
|
|
72
|
+
* swatches="material"
|
|
73
|
+
* showHexValue
|
|
74
|
+
* defaultValue="#2196f3"
|
|
75
|
+
* onChange={(hex) => console.log(hex)}
|
|
76
|
+
* aria-label="Theme color"
|
|
77
|
+
* />
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```tsx
|
|
82
|
+
* // Custom swatches, no native picker
|
|
83
|
+
* <ColorPicker
|
|
84
|
+
* swatches={[
|
|
85
|
+
* { value: '#ff0000', label: 'Red' },
|
|
86
|
+
* { value: '#00ff00', label: 'Green' },
|
|
87
|
+
* { value: '#0000ff', label: 'Blue' },
|
|
88
|
+
* ]}
|
|
89
|
+
* showCustom={false}
|
|
90
|
+
* columns={3}
|
|
91
|
+
* aria-label="Primary color"
|
|
92
|
+
* />
|
|
93
|
+
* ```
|
|
94
|
+
*
|
|
95
|
+
* @param {ColorPickerProps} props - The props for the color picker
|
|
96
|
+
* @returns {JSX.Element} The rendered color picker
|
|
97
|
+
*/
|
|
98
|
+
declare const ColorPicker: import("react").ForwardRefExoticComponent<ColorPickerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
99
|
+
export default ColorPicker;
|
|
100
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/ColorPicker/index.tsx"],"names":[],"mappings":"AAgBA,OAAO,KA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/ColorPicker/index.tsx
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview ColorPicker component
|
|
5
|
+
* @description Color selection component with preset swatch grid, native color input fallback,
|
|
6
|
+
* and full ARIA radiogroup pattern with roving tabindex. SSR-safe, no external dependencies.
|
|
7
|
+
*
|
|
8
|
+
* @version 0.0.1
|
|
9
|
+
* @since 0.0.1
|
|
10
|
+
* @author AMBROISE PARK Consulting
|
|
11
|
+
*/
|
|
12
|
+
import { forwardRef, useCallback, useMemo, useRef, useState } from 'react';
|
|
13
|
+
import { cn } from '../../utils/helpers';
|
|
14
|
+
import './ColorPicker.css';
|
|
15
|
+
export const COLOR_PRESETS = {
|
|
16
|
+
BASIC: 'basic',
|
|
17
|
+
MATERIAL: 'material',
|
|
18
|
+
PASTEL: 'pastel',
|
|
19
|
+
};
|
|
20
|
+
const BASIC_SWATCHES = [
|
|
21
|
+
{ value: '#000000', label: 'Black' },
|
|
22
|
+
{ value: '#ffffff', label: 'White' },
|
|
23
|
+
{ value: '#6b7280', label: 'Gray' },
|
|
24
|
+
{ value: '#9ca3af', label: 'Light gray' },
|
|
25
|
+
{ value: '#dc2626', label: 'Red' },
|
|
26
|
+
{ value: '#ea580c', label: 'Orange' },
|
|
27
|
+
{ value: '#d97706', label: 'Amber' },
|
|
28
|
+
{ value: '#eab308', label: 'Yellow' },
|
|
29
|
+
{ value: '#84cc16', label: 'Lime' },
|
|
30
|
+
{ value: '#16a34a', label: 'Green' },
|
|
31
|
+
{ value: '#14b8a6', label: 'Teal' },
|
|
32
|
+
{ value: '#06b6d4', label: 'Cyan' },
|
|
33
|
+
{ value: '#2563eb', label: 'Blue' },
|
|
34
|
+
{ value: '#7c3aed', label: 'Purple' },
|
|
35
|
+
{ value: '#db2777', label: 'Pink' },
|
|
36
|
+
{ value: '#e11d48', label: 'Rose' },
|
|
37
|
+
];
|
|
38
|
+
const MATERIAL_SWATCHES = [
|
|
39
|
+
{ value: '#f44336', label: 'Red' },
|
|
40
|
+
{ value: '#e91e63', label: 'Pink' },
|
|
41
|
+
{ value: '#9c27b0', label: 'Purple' },
|
|
42
|
+
{ value: '#673ab7', label: 'Deep purple' },
|
|
43
|
+
{ value: '#3f51b5', label: 'Indigo' },
|
|
44
|
+
{ value: '#2196f3', label: 'Blue' },
|
|
45
|
+
{ value: '#03a9f4', label: 'Light blue' },
|
|
46
|
+
{ value: '#00bcd4', label: 'Cyan' },
|
|
47
|
+
{ value: '#009688', label: 'Teal' },
|
|
48
|
+
{ value: '#4caf50', label: 'Green' },
|
|
49
|
+
{ value: '#8bc34a', label: 'Light green' },
|
|
50
|
+
{ value: '#cddc39', label: 'Lime' },
|
|
51
|
+
{ value: '#ffeb3b', label: 'Yellow' },
|
|
52
|
+
{ value: '#ffc107', label: 'Amber' },
|
|
53
|
+
{ value: '#ff9800', label: 'Orange' },
|
|
54
|
+
{ value: '#ff5722', label: 'Deep orange' },
|
|
55
|
+
];
|
|
56
|
+
const PASTEL_SWATCHES = [
|
|
57
|
+
{ value: '#fecdd3', label: 'Pastel rose' },
|
|
58
|
+
{ value: '#fbcfe8', label: 'Pastel pink' },
|
|
59
|
+
{ value: '#e9d5ff', label: 'Pastel purple' },
|
|
60
|
+
{ value: '#c7d2fe', label: 'Pastel indigo' },
|
|
61
|
+
{ value: '#bfdbfe', label: 'Pastel blue' },
|
|
62
|
+
{ value: '#a5f3fc', label: 'Pastel cyan' },
|
|
63
|
+
{ value: '#99f6e4', label: 'Pastel teal' },
|
|
64
|
+
{ value: '#bbf7d0', label: 'Pastel green' },
|
|
65
|
+
{ value: '#d9f99d', label: 'Pastel lime' },
|
|
66
|
+
{ value: '#fef08a', label: 'Pastel yellow' },
|
|
67
|
+
{ value: '#fed7aa', label: 'Pastel orange' },
|
|
68
|
+
{ value: '#fecaca', label: 'Pastel red' },
|
|
69
|
+
{ value: '#e5e7eb', label: 'Pastel gray' },
|
|
70
|
+
{ value: '#f5f5f4', label: 'Pastel stone' },
|
|
71
|
+
{ value: '#fce7f3', label: 'Pastel fuchsia' },
|
|
72
|
+
{ value: '#dbeafe', label: 'Pastel sky' },
|
|
73
|
+
];
|
|
74
|
+
const PRESET_MAP = {
|
|
75
|
+
[COLOR_PRESETS.BASIC]: BASIC_SWATCHES,
|
|
76
|
+
[COLOR_PRESETS.MATERIAL]: MATERIAL_SWATCHES,
|
|
77
|
+
[COLOR_PRESETS.PASTEL]: PASTEL_SWATCHES,
|
|
78
|
+
};
|
|
79
|
+
/** Determine if a hex color is light (for checkmark contrast) */
|
|
80
|
+
function isLightColor(hex) {
|
|
81
|
+
const r = parseInt(hex.slice(1, 3), 16);
|
|
82
|
+
const g = parseInt(hex.slice(3, 5), 16);
|
|
83
|
+
const b = parseInt(hex.slice(5, 7), 16);
|
|
84
|
+
return (r * 299 + g * 587 + b * 114) / 1000 > 128;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Color selection component with preset swatch grid and native color input.
|
|
88
|
+
* Full ARIA radiogroup pattern with roving tabindex for keyboard navigation.
|
|
89
|
+
*
|
|
90
|
+
* @component
|
|
91
|
+
* @example
|
|
92
|
+
* ```tsx
|
|
93
|
+
* // Basic usage with preset palette
|
|
94
|
+
* <ColorPicker
|
|
95
|
+
* value={color}
|
|
96
|
+
* onChange={setColor}
|
|
97
|
+
* aria-label="Choose accent color"
|
|
98
|
+
* />
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```tsx
|
|
103
|
+
* // Material palette with hex display
|
|
104
|
+
* <ColorPicker
|
|
105
|
+
* swatches="material"
|
|
106
|
+
* showHexValue
|
|
107
|
+
* defaultValue="#2196f3"
|
|
108
|
+
* onChange={(hex) => console.log(hex)}
|
|
109
|
+
* aria-label="Theme color"
|
|
110
|
+
* />
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```tsx
|
|
115
|
+
* // Custom swatches, no native picker
|
|
116
|
+
* <ColorPicker
|
|
117
|
+
* swatches={[
|
|
118
|
+
* { value: '#ff0000', label: 'Red' },
|
|
119
|
+
* { value: '#00ff00', label: 'Green' },
|
|
120
|
+
* { value: '#0000ff', label: 'Blue' },
|
|
121
|
+
* ]}
|
|
122
|
+
* showCustom={false}
|
|
123
|
+
* columns={3}
|
|
124
|
+
* aria-label="Primary color"
|
|
125
|
+
* />
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* @param {ColorPickerProps} props - The props for the color picker
|
|
129
|
+
* @returns {JSX.Element} The rendered color picker
|
|
130
|
+
*/
|
|
131
|
+
const ColorPicker = forwardRef(function ColorPicker({ value, defaultValue = '#000000', onChange, swatches = COLOR_PRESETS.BASIC, columns = 8, showCustom = true, showHexValue = false, disabled = false, 'aria-label': ariaLabel = 'Color picker', className, ...props }, ref) {
|
|
132
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
133
|
+
const isControlled = value !== undefined;
|
|
134
|
+
const currentValue = isControlled ? value : internalValue;
|
|
135
|
+
const swatchesRef = useRef(null);
|
|
136
|
+
const [focusedIndex, setFocusedIndex] = useState(-1);
|
|
137
|
+
const resolvedSwatches = useMemo(() => typeof swatches === 'string'
|
|
138
|
+
? (PRESET_MAP[swatches] ?? BASIC_SWATCHES)
|
|
139
|
+
: swatches, [swatches]);
|
|
140
|
+
const selectColor = useCallback((hex) => {
|
|
141
|
+
if (!isControlled)
|
|
142
|
+
setInternalValue(hex);
|
|
143
|
+
onChange?.(hex);
|
|
144
|
+
}, [isControlled, onChange]);
|
|
145
|
+
const handleSwatchKeyDown = useCallback((e) => {
|
|
146
|
+
const total = resolvedSwatches.length;
|
|
147
|
+
if (total === 0)
|
|
148
|
+
return;
|
|
149
|
+
let nextIndex = focusedIndex;
|
|
150
|
+
switch (e.key) {
|
|
151
|
+
case 'ArrowRight':
|
|
152
|
+
case 'ArrowDown':
|
|
153
|
+
e.preventDefault();
|
|
154
|
+
nextIndex = (focusedIndex + 1) % total;
|
|
155
|
+
break;
|
|
156
|
+
case 'ArrowLeft':
|
|
157
|
+
case 'ArrowUp':
|
|
158
|
+
e.preventDefault();
|
|
159
|
+
nextIndex = (focusedIndex - 1 + total) % total;
|
|
160
|
+
break;
|
|
161
|
+
case 'Home':
|
|
162
|
+
e.preventDefault();
|
|
163
|
+
nextIndex = 0;
|
|
164
|
+
break;
|
|
165
|
+
case 'End':
|
|
166
|
+
e.preventDefault();
|
|
167
|
+
nextIndex = total - 1;
|
|
168
|
+
break;
|
|
169
|
+
case 'Enter':
|
|
170
|
+
case ' ':
|
|
171
|
+
e.preventDefault();
|
|
172
|
+
if (focusedIndex >= 0 && focusedIndex < total) {
|
|
173
|
+
const swatch = resolvedSwatches[focusedIndex];
|
|
174
|
+
if (swatch)
|
|
175
|
+
selectColor(swatch.value);
|
|
176
|
+
}
|
|
177
|
+
return;
|
|
178
|
+
default:
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
setFocusedIndex(nextIndex);
|
|
182
|
+
// Focus the swatch button
|
|
183
|
+
const buttons = swatchesRef.current?.querySelectorAll('[role="radio"]');
|
|
184
|
+
buttons?.[nextIndex]?.focus();
|
|
185
|
+
}, [focusedIndex, resolvedSwatches, selectColor]);
|
|
186
|
+
// Determine which swatch is "active" for roving tabindex
|
|
187
|
+
const activeIndex = resolvedSwatches.findIndex((s) => s.value.toLowerCase() === currentValue?.toLowerCase());
|
|
188
|
+
const tabbableIndex = focusedIndex >= 0 ? focusedIndex : Math.max(activeIndex, 0);
|
|
189
|
+
return (_jsxs("div", { ref: ref, className: cn('dndev-color-picker', className), "aria-disabled": disabled || undefined, ...props, children: [_jsx("div", { ref: swatchesRef, role: "radiogroup", "aria-label": ariaLabel, className: "dndev-color-swatches", style: { '--color-picker-columns': columns }, onKeyDown: handleSwatchKeyDown, children: resolvedSwatches.map((swatch, index) => {
|
|
190
|
+
const isSelected = swatch.value.toLowerCase() === currentValue?.toLowerCase();
|
|
191
|
+
return (_jsx("button", { type: "button", role: "radio", "aria-checked": isSelected, "aria-label": `${swatch.label} (${swatch.value})`, tabIndex: index === tabbableIndex ? 0 : -1, disabled: disabled, className: "dndev-color-swatch", "data-light": isLightColor(swatch.value), style: { '--swatch-color': swatch.value }, onClick: () => selectColor(swatch.value), onFocus: () => setFocusedIndex(index) }, swatch.value));
|
|
192
|
+
}) }), showCustom && (_jsx("div", { className: "dndev-color-custom", children: _jsxs("label", { className: "dndev-color-custom-label", children: [_jsx("span", { children: "Custom" }), _jsx("input", { type: "color", value: currentValue, disabled: disabled, "aria-label": "Custom color", onChange: (e) => selectColor(e.target.value) })] }) })), showHexValue && (_jsx("output", { className: "dndev-color-hex", "aria-live": "polite", children: currentValue }))] }));
|
|
193
|
+
});
|
|
194
|
+
ColorPicker.displayName = 'ColorPicker';
|
|
195
|
+
export default ColorPicker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Combobox/index.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAM7E,OAAO,gBAAgB,CAAC;AAExB,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE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M,CAAC;IACrB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+EAA+E;IAC/E,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,yEAAyE;IACzE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iFAAiF;IACjF,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACzB;AAkBD,QAAA,MAAM,QAAQ,GAAI,kOAoBf,aAAa,4CAkYf,CAAC;AAEF,eAAe,QAAQ,CAAC;AACxB,OAAO,EAAE,eAAe,IAAI,gBAAgB,EAAE,CAAC;AAC/C,YAAY,EAAE,cAAc,IAAI,eAAe,EAAE,CAAC"}
|
|
@@ -27,6 +27,8 @@ const Combobox = ({ value, onValueChange, placeholder = 'Select...', emptyMessag
|
|
|
27
27
|
const id = useId();
|
|
28
28
|
const [open, setOpen] = useState(false);
|
|
29
29
|
const [search, setSearch] = useState('');
|
|
30
|
+
/** Tracks whether the user has typed in the input during this open session */
|
|
31
|
+
const isSearchingRef = useRef(false);
|
|
30
32
|
const [highlightedIndex, setHighlightedIndex] = useState(0);
|
|
31
33
|
const containerRef = useRef(null);
|
|
32
34
|
const inputRef = useRef(null);
|
|
@@ -74,10 +76,18 @@ const Combobox = ({ value, onValueChange, placeholder = 'Select...', emptyMessag
|
|
|
74
76
|
if (open) {
|
|
75
77
|
setHighlightedIndex(0);
|
|
76
78
|
}
|
|
77
|
-
else
|
|
78
|
-
|
|
79
|
+
else {
|
|
80
|
+
isSearchingRef.current = false;
|
|
81
|
+
if (!multiple) {
|
|
82
|
+
setSearch('');
|
|
83
|
+
}
|
|
79
84
|
}
|
|
80
85
|
}, [open, multiple]);
|
|
86
|
+
// Cleanup debounce timer on unmount
|
|
87
|
+
useEffect(() => () => {
|
|
88
|
+
if (searchTimerRef.current)
|
|
89
|
+
clearTimeout(searchTimerRef.current);
|
|
90
|
+
}, []);
|
|
81
91
|
useEffect(() => {
|
|
82
92
|
if (open && listRef.current) {
|
|
83
93
|
const highlightedElement = listRef.current.children[highlightedIndex];
|
|
@@ -100,7 +110,6 @@ const Combobox = ({ value, onValueChange, placeholder = 'Select...', emptyMessag
|
|
|
100
110
|
document.addEventListener('mousedown', handleClickOutside);
|
|
101
111
|
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
102
112
|
}
|
|
103
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- handleOpenChange is stable enough (only calls setOpen + onOpenChange)
|
|
104
113
|
}, [open]);
|
|
105
114
|
const handleSelect = (optionValue) => {
|
|
106
115
|
if (multiple) {
|
|
@@ -157,6 +166,9 @@ const Combobox = ({ value, onValueChange, placeholder = 'Select...', emptyMessag
|
|
|
157
166
|
onValueChange?.(multiple ? [] : '');
|
|
158
167
|
};
|
|
159
168
|
const getDisplayValue = () => {
|
|
169
|
+
// User is actively typing/backspacing — always show the search text (even if empty)
|
|
170
|
+
if (open && isSearchingRef.current)
|
|
171
|
+
return search;
|
|
160
172
|
if (open && search)
|
|
161
173
|
return search;
|
|
162
174
|
if (selectedValues.length === 0)
|
|
@@ -168,12 +180,23 @@ const Combobox = ({ value, onValueChange, placeholder = 'Select...', emptyMessag
|
|
|
168
180
|
};
|
|
169
181
|
const displayValue = getDisplayValue();
|
|
170
182
|
const hasSelection = selectedValues.length > 0;
|
|
183
|
+
const searchTimerRef = useRef(null);
|
|
171
184
|
const handleInputChange = (e) => {
|
|
172
185
|
const newValue = e.target.value;
|
|
186
|
+
isSearchingRef.current = true;
|
|
173
187
|
setSearch(newValue);
|
|
174
|
-
onSearchChange?.(newValue);
|
|
175
188
|
if (!open)
|
|
176
189
|
handleOpenChange(true);
|
|
190
|
+
// Backspaced to empty while having a selection → clear the value
|
|
191
|
+
if (newValue === '' && hasSelection && !multiple) {
|
|
192
|
+
onValueChange?.('');
|
|
193
|
+
}
|
|
194
|
+
// Debounce onSearchChange (300ms) — callers may trigger API calls
|
|
195
|
+
if (onSearchChange) {
|
|
196
|
+
if (searchTimerRef.current)
|
|
197
|
+
clearTimeout(searchTimerRef.current);
|
|
198
|
+
searchTimerRef.current = setTimeout(() => onSearchChange(newValue), 300);
|
|
199
|
+
}
|
|
177
200
|
};
|
|
178
201
|
const handleInputFocus = () => {
|
|
179
202
|
if (!disabled) {
|
|
@@ -192,7 +215,7 @@ const Combobox = ({ value, onValueChange, placeholder = 'Select...', emptyMessag
|
|
|
192
215
|
const showClear = clearable && hasSelection && !disabled;
|
|
193
216
|
const reservedCount = (showCreate ? 1 : 0) + (clearable ? 1 : 0);
|
|
194
217
|
const trailingPad = computeTrailingPad(reservedCount);
|
|
195
|
-
return (_jsxs("div", { ref: containerRef, className: cn('dndev-relative', open && 'dndev-combobox-open'), style: { width: '100%' }, children: [_jsxs("div", { className: cn('dndev-relative dndev-combobox-wrapper', chips && 'dndev-combobox-wrapper--chips'), style: { '--combobox-pad-end': trailingPad }, onClick: chips ? handleInputClick : undefined, children: [chips, _jsx(Input, { ref: inputRef, id: id, label: chips ? undefined : label, value: displayValue, onChange: handleInputChange, onFocus: handleInputFocus, onClick: chips ? undefined : handleInputClick, onKeyDown: handleKeyDown, placeholder: hasSelection && chips ? '' : placeholder, disabled: disabled, required: required, bare: !!chips, role: "combobox", "aria-expanded": open, "aria-controls": `${id}-listbox`, "aria-autocomplete": "list", "data-variant": variant }), _jsxs("div", { className: "dndev-combobox-trailing", children: [showCreate && (_jsx("button", { type: "button", className: "dndev-combobox-action-btn dndev-combobox-action-btn--create", onClick: (e) => {
|
|
218
|
+
return (_jsxs("div", { ref: containerRef, className: cn('dndev-relative', open && 'dndev-combobox-open'), style: { width: '100%' }, children: [_jsxs("div", { className: cn('dndev-relative dndev-combobox-wrapper', chips && 'dndev-combobox-wrapper--chips'), style: { '--combobox-pad-end': trailingPad }, onClick: chips ? handleInputClick : undefined, children: [chips, _jsx(Input, { ref: inputRef, id: id, label: chips ? undefined : label, value: displayValue, onChange: handleInputChange, onFocus: handleInputFocus, onClick: chips ? undefined : handleInputClick, onKeyDown: handleKeyDown, placeholder: hasSelection && chips ? '' : placeholder, disabled: disabled, required: required, bare: !!chips, role: "combobox", "aria-expanded": open, "aria-controls": `${id}-listbox`, autoComplete: "one-time-code", "aria-autocomplete": "list", "data-variant": variant }), _jsxs("div", { className: "dndev-combobox-trailing", children: [showCreate && (_jsx("button", { type: "button", className: "dndev-combobox-action-btn dndev-combobox-action-btn--create", onClick: (e) => {
|
|
196
219
|
e.stopPropagation();
|
|
197
220
|
onCreateClick();
|
|
198
221
|
}, "aria-label": createActionLabel || createLabel || 'Create new', children: _jsx(Plus, {}) })), showClear && (_jsx("button", { type: "button", className: "dndev-combobox-action-btn dndev-combobox-action-btn--clear", onClick: handleClear, "aria-label": "Clear", children: _jsx(X, {}) })), isLoading ? (_jsx("span", { className: "dndev-combobox-spinner", children: _jsx(Spinner, {}) })) : (_jsx("span", { className: "dndev-combobox-chevron", children: _jsx(ChevronDown, {}) }))] })] }), open && (_jsx("div", { className: "dndev-floating dndev-menu-content dndev-z-tooltip dndev-combobox-content", style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/CommandDialog/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/CommandDialog/index.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,kDAAkD;AAClD,eAAO,MAAM,qBAAqB,eAH2B,IAAI,aAIvB,CAAC;AAE3C,MAAM,WAAW,kBAAkB;IACjC,mDAAmD;IACnD,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,mBAAmB;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,qBAAqB;IACrB,MAAM,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC1B,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,QAAA,MAAM,aAAa,GAAI,4FAUpB,kBAAkB,4CAyEpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -8,16 +8,16 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
8
8
|
* @since 0.0.1
|
|
9
9
|
* @author AMBROISE PARK Consulting
|
|
10
10
|
*/
|
|
11
|
-
import { createContext, useContext, useRef } from 'react';
|
|
12
|
-
/** Context for CommandDialog to pass onClose to children without cloneElement */
|
|
13
|
-
const CommandDialogContext = createContext({});
|
|
14
|
-
/** Hook for Command to access dialog's onClose */
|
|
15
|
-
export const useCommandDialogClose = () => useContext(CommandDialogContext).onClose;
|
|
16
11
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
17
12
|
import { X } from 'lucide-react';
|
|
13
|
+
import { createContext, useContext, useRef } from 'react';
|
|
18
14
|
import { useSwipeToClose } from '../../hooks';
|
|
19
15
|
import { cn } from '../../utils/helpers';
|
|
20
16
|
import Button, { BUTTON_VARIANT } from '../Button';
|
|
17
|
+
/** Context for CommandDialog to pass onClose to children without cloneElement */
|
|
18
|
+
const CommandDialogContext = createContext({});
|
|
19
|
+
/** Hook for Command to access dialog's onClose */
|
|
20
|
+
export const useCommandDialogClose = () => useContext(CommandDialogContext).onClose;
|
|
21
21
|
const CommandDialog = ({ trigger, open, onOpenChange, title, description, children, footer, className, noSwipe = false, }) => {
|
|
22
22
|
const handleClose = () => {
|
|
23
23
|
onOpenChange?.(false);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { DialogContent as ContentPrimitive } from './DialogPrimitive';
|
|
1
2
|
import { type SurfaceVariant } from '../../utils/constants';
|
|
2
3
|
import { type ButtonVariant } from '../Button';
|
|
3
|
-
import { DialogContent as ContentPrimitive } from './DialogPrimitive';
|
|
4
4
|
import type { ReactNode, ComponentProps, RefObject } from 'react';
|
|
5
5
|
export type ContentSize = 'auto' | 'form' | 'text' | 'image' | 'code' | 'full';
|
|
6
6
|
declare const DialogContent: ({ className, children, noSwipe, closeButtonRef, onOpenChange, ...props }: ComponentProps<typeof ContentPrimitive> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Dialog/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Dialog/index.tsx"],"names":[],"mappings":"AAcA,OAAO,EAGL,aAAa,IAAI,gBAAgB,EAQlC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE7E,OAAe,EAAkB,KAAK,aAAa,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R,MAAM,CAAC,EAAE;YACP,KAAK,EAAE,MAAM,CAAC;YACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;SACtB,CAAC;QACF,OAAO,CAAC,EAAE;YACR,KAAK,EAAE,MAAM,CAAC;YACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;YACrB,OAAO,CAAC,EAAE,aAAa,CAAC;SACzB,CAAC;KACH,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,QAAA,MAAM,MAAM,GAAI,yIAcb,WAAW,4CAkFb,CAAC;AAEF,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,eAAe,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC1E,YAAY,EAAE,cAAc,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -10,11 +10,11 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
10
10
|
*/
|
|
11
11
|
import { X } from 'lucide-react';
|
|
12
12
|
import { useRef } from 'react';
|
|
13
|
+
import { Dialog as Root, DialogTrigger as Trigger, DialogContent as ContentPrimitive, DialogHeader as HeaderPrimitive, DialogFooter as FooterPrimitive, DialogTitle as TitlePrimitive, DialogDescription as DescriptionPrimitive, DialogClose as Close, DialogOverlay as OverlayPrimitive, DialogPortal, } from './DialogPrimitive';
|
|
13
14
|
import { useSwipeToClose } from '../../hooks';
|
|
14
15
|
import { SURFACE_VARIANT } from '../../utils/constants';
|
|
15
16
|
import { cn, getVariantDataAttrs } from '../../utils/helpers';
|
|
16
17
|
import Button, { BUTTON_VARIANT } from '../Button';
|
|
17
|
-
import { Dialog as Root, DialogTrigger as Trigger, DialogContent as ContentPrimitive, DialogHeader as HeaderPrimitive, DialogFooter as FooterPrimitive, DialogTitle as TitlePrimitive, DialogDescription as DescriptionPrimitive, DialogClose as Close, DialogOverlay as OverlayPrimitive, DialogPortal, } from './DialogPrimitive';
|
|
18
18
|
// Wrapper components that apply dndev-* classes
|
|
19
19
|
const DialogOverlay = ({ className, ...props }) => (_jsx(OverlayPrimitive, { className: cn('dndev-overlay', className), ...props }));
|
|
20
20
|
const DialogContent = ({ className, children, noSwipe = false, closeButtonRef, onOpenChange, ...props }) => {
|
|
@@ -25,7 +25,7 @@ import { type ElementType, type ComponentPropsWithRef, type ReactNode } from 're
|
|
|
25
25
|
import { type Tone } from '../../utils/constants';
|
|
26
26
|
import './HeroSection.css';
|
|
27
27
|
declare const heroSectionVariants: (props?: ({
|
|
28
|
-
variant?: "
|
|
28
|
+
variant?: "primary" | "accent" | "subtle" | null | undefined;
|
|
29
29
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
30
30
|
interface HeroSectionOwnProps extends VariantProps<typeof heroSectionVariants> {
|
|
31
31
|
/** Element type to render as @default 'section' */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/HoverCard/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/HoverCard/index.tsx"],"names":[],"mappings":"AAoBA,OAAa,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,cAAe,SAAQ,IAAI,CAC1C,SAAS,EACT,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CACjE;IACC,mDAAmD;IACnD,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACnC,8BAA8B;IAC9B,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,4BAA4B;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,iBAAS,SAAS,CAAC,EACjB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,OAAO,EACP,MAAM,EACN,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,YAAY,EACZ,SAAa,EACb,UAAc,EACd,KAAgB,EAChB,IAAe,EACf,UAAc,EACd,SAAS,GACV,EAAE,cAAc,2CA4ChB;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -11,8 +11,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
*/
|
|
12
12
|
import { useState } from 'react';
|
|
13
13
|
import { HoverCardPrimitive, HoverCardTrigger, HoverCardContent, } from './HoverCardPrimitive';
|
|
14
|
-
import Card, {} from '../Card';
|
|
15
14
|
import { cn } from '../../utils/helpers';
|
|
15
|
+
import Card, {} from '../Card';
|
|
16
16
|
/**
|
|
17
17
|
* Accessible hover card component.
|
|
18
18
|
* Shows rich content on hover using Radix HoverCard primitive.
|
|
@@ -9,23 +9,23 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
9
9
|
* @author AMBROISE PARK Consulting
|
|
10
10
|
*/
|
|
11
11
|
import { Mail, MailCheck } from 'lucide-react';
|
|
12
|
-
import GoogleIcon from './GoogleIcon';
|
|
13
|
-
import GitHubIcon from './GitHubIcon';
|
|
14
|
-
import MicrosoftIcon from './MicrosoftIcon';
|
|
15
12
|
import AppleIcon from './AppleIcon';
|
|
16
13
|
import DiscordIcon from './DiscordIcon';
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
14
|
+
import FacebookIcon from './FacebookIcon';
|
|
15
|
+
import GitHubIcon from './GitHubIcon';
|
|
16
|
+
import GoogleIcon from './GoogleIcon';
|
|
20
17
|
import LinkedInIcon from './LinkedinIcon';
|
|
21
|
-
import
|
|
22
|
-
import NotionIcon from './NotionIcon';
|
|
18
|
+
import MastodonIcon from './MastodonIcon';
|
|
23
19
|
import MediumIcon from './MediumIcon';
|
|
20
|
+
import MicrosoftIcon from './MicrosoftIcon';
|
|
21
|
+
import NotionIcon from './NotionIcon';
|
|
22
|
+
import RedditIcon from './RedditIcon';
|
|
23
|
+
import SlackIcon from './SlackIcon';
|
|
24
|
+
import SpotifyIcon from './SpotifyIcon';
|
|
25
|
+
import TwitchIcon from './TwitchIcon';
|
|
24
26
|
import XIcon from './XIcon';
|
|
25
|
-
import MastodonIcon from './MastodonIcon';
|
|
26
|
-
import YouTubeIcon from './YouTubeIcon';
|
|
27
27
|
import YahooIcon from './YahooIcon';
|
|
28
|
-
import
|
|
28
|
+
import YouTubeIcon from './YouTubeIcon';
|
|
29
29
|
// Import all the existing icon components
|
|
30
30
|
// Default Icon (fallback) - Handshake icon
|
|
31
31
|
function DefaultProviderIcon({ className = '', ...props }) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IconType } from '../../types';
|
|
2
1
|
import './Input.css';
|
|
2
|
+
import type { IconType } from '../../types';
|
|
3
3
|
import type { InputHTMLAttributes, Ref } from 'react';
|
|
4
4
|
export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
5
5
|
/** Optional icon to display inside the input */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Input/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Input/index.tsx"],"names":[],"mappings":"AAgBA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEtD,MAAM,WAAW,UAAW,SAAQ,mBAAmB,CAAC,gBAAgB,CAAC;IACvE,gDAAgD;IAChD,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,kCAAkC;IAClC,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,KAAK,GAAI,yGAaZ,UAAU,4CA6EZ,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -44,7 +44,7 @@ const Input = ({ className, type, icon, iconEnd = false, label, bare, value, onF
|
|
|
44
44
|
// Explicitly exclude children to prevent void element error (input is a void element)
|
|
45
45
|
// If we have a label, extract style to pass to FloatingLabel wrapper instead of input
|
|
46
46
|
const { children: _children, style, ...inputProps } = props;
|
|
47
|
-
const inputElement = (_jsx("input", { id: id, type: type, value: value, required: required, className: inputClasses, "data-bare": isBare || undefined, ...inputProps,
|
|
47
|
+
const inputElement = (_jsx("input", { id: id, type: type, value: value, required: required, autoComplete: "one-time-code", className: inputClasses, "data-bare": isBare || undefined, ...inputProps,
|
|
48
48
|
// Only apply style to input if there's no label (label wrapper gets it)
|
|
49
49
|
style: hasLabel ? undefined : style }));
|
|
50
50
|
const needsWrapper = hasIcon || hasLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Pagination/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Pagination/index.tsx"],"names":[],"mappings":"AAKA,OAAO,kBAAkB,CAAC;AAM1B,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,UAAU,GAAI,gNAcjB,eAAe,4CA0LjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// packages/components/src/atomic/Pagination/index.tsx
|
|
3
|
-
import { useMemo, useState } from 'react';
|
|
4
3
|
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
4
|
+
import { useMemo, useState } from 'react';
|
|
5
5
|
import './Pagination.css';
|
|
6
|
+
import { cn } from '../../utils/helpers';
|
|
6
7
|
import Button from '../Button';
|
|
7
8
|
import Select from '../Select';
|
|
8
9
|
import Text from '../Text';
|
|
9
|
-
import { cn } from '../../utils/helpers';
|
|
10
10
|
const Pagination = ({ currentPage, totalPages, onPageChange, pageSize: pageSizeProp, total: totalProp, onPageSizeChange, maxVisible = 5, // Default to 5 to fit safe on mobile (48px * 7 items ~= 336px)
|
|
11
11
|
showNavigation = true, previousLabel = 'Previous', nextLabel = 'Next', itemsPerPagePlaceholder = 'Items per page', showingLabel, className, }) => {
|
|
12
12
|
const [internalPageSize, setInternalPageSize] = useState(12);
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CONTROL_VARIANT, type ControlVariant } from '../../utils/constants';
|
|
1
|
+
import { CONTROL_VARIANT } from '../../utils/constants';
|
|
3
2
|
import type { ReactNode } from 'react';
|
|
3
|
+
import type { RadioOption, RadioGroupRootProps } from './RadioGroupPrimitive';
|
|
4
|
+
import type { ControlVariant } from '../../utils/constants';
|
|
5
|
+
import type { GridCols } from '../Grid';
|
|
4
6
|
import './RadioGroup.css';
|
|
5
7
|
export interface RadioGroupProps extends Omit<RadioGroupRootProps, 'children'> {
|
|
6
8
|
/** Semantic color variant */
|
|
7
9
|
variant?: ControlVariant;
|
|
8
10
|
/** List of radio options (alternative to children) */
|
|
9
11
|
items?: RadioOption[];
|
|
10
|
-
/** Grid columns
|
|
11
|
-
gridCols?:
|
|
12
|
+
/** Grid columns — same as Grid cols prop: number, responsive array, or template string */
|
|
13
|
+
gridCols?: GridCols;
|
|
12
14
|
/** Custom content to render (for power users) */
|
|
13
15
|
children?: ReactNode;
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
18
|
* Accessible radio group component with semantic color variants.
|
|
17
19
|
* Supports props-based API with items prop for 90% use cases.
|
|
20
|
+
* When gridCols is provided, items are laid out using the Grid component.
|
|
18
21
|
*
|
|
19
22
|
* @component
|
|
20
23
|
* @example
|
|
@@ -22,9 +25,11 @@ export interface RadioGroupProps extends Omit<RadioGroupRootProps, 'children'> {
|
|
|
22
25
|
* <RadioGroup
|
|
23
26
|
* value={value}
|
|
24
27
|
* onValueChange={handleChange}
|
|
28
|
+
* gridCols={[1, 1, 3, 3]}
|
|
25
29
|
* items={[
|
|
26
30
|
* { value: 'option1', label: 'Option 1' },
|
|
27
|
-
* { value: 'option2', label: 'Option 2' }
|
|
31
|
+
* { value: 'option2', label: 'Option 2' },
|
|
32
|
+
* { value: 'option3', label: 'Option 3' }
|
|
28
33
|
* ]}
|
|
29
34
|
* />
|
|
30
35
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/RadioGroup/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/RadioGroup/index.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAIxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,kBAAkB,CAAC;AAoB1B,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC;IAC5E,6BAA6B;IAC7B,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,sDAAsD;IACtD,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;IACtB,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,QAAA,MAAM,UAAU,GAAI,6DAOjB,eAAe,4CAoCjB,CAAC;AAEF,eAAe,UAAU,CAAC;AAC1B,OAAO,EAAE,eAAe,IAAI,kBAAkB,EAAE,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,cAAc,IAAI,iBAAiB,EAAE,CAAC"}
|