@umituz/web-design-system 5.3.0 → 6.0.0
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/styles.css +1 -1
- package/package.json +1 -1
- package/src/__tests__/cn.test.ts +0 -3
- package/src/__tests__/component-slots.test.tsx +0 -4
- package/src/__tests__/components.smoke.test.tsx +3 -11
- package/src/__tests__/money.test.tsx +0 -3
- package/src/__tests__/productivity-components.test.tsx +135 -0
- package/src/__tests__/styles.contract.test.ts +0 -13
- package/src/domain/tokens/index.ts +0 -7
- package/src/domain/tokens/responsive-map.tokens.ts +18 -107
- package/src/domain/types/breakpoint.types.ts +9 -13
- package/src/domain/types/component.types.ts +0 -4
- package/src/domain/types/index.ts +0 -5
- package/src/global.d.ts +0 -4
- package/src/index.ts +82 -29
- package/src/infrastructure/constants/breakpoint.constants.ts +0 -31
- package/src/infrastructure/constants/component.constants.ts +0 -4
- package/src/infrastructure/constants/index.ts +0 -5
- package/src/infrastructure/constants/size-variant.constants.ts +0 -33
- package/src/infrastructure/constants/spacing.constants.ts +34 -63
- package/src/infrastructure/constants/timing.constants.ts +0 -18
- package/src/infrastructure/constants/typography.constants.ts +22 -54
- package/src/infrastructure/utils/calculation.utils.ts +0 -9
- package/src/infrastructure/utils/cn.util.ts +0 -18
- package/src/infrastructure/utils/hash.util.ts +0 -5
- package/src/infrastructure/utils/index.ts +0 -5
- package/src/infrastructure/utils/money.utils.ts +0 -7
- package/src/infrastructure/utils/responsive.utils.ts +0 -66
- package/src/presentation/atoms/AspectRatio.tsx +0 -10
- package/src/presentation/atoms/Badge.tsx +0 -5
- package/src/presentation/atoms/BatteryPill.tsx +0 -5
- package/src/presentation/atoms/Button.tsx +0 -2
- package/src/presentation/atoms/Checkbox.tsx +0 -4
- package/src/presentation/atoms/CopyButton.tsx +93 -0
- package/src/presentation/atoms/Divider.tsx +0 -4
- package/src/presentation/atoms/HeatmapStrip.tsx +0 -10
- package/src/presentation/atoms/Hide.tsx +0 -24
- package/src/presentation/atoms/Icon.tsx +0 -4
- package/src/presentation/atoms/IconButton.tsx +0 -4
- package/src/presentation/atoms/Input.tsx +0 -4
- package/src/presentation/atoms/Kbd.tsx +0 -4
- package/src/presentation/atoms/Label.tsx +0 -4
- package/src/presentation/atoms/Link.tsx +0 -4
- package/src/presentation/atoms/Money.tsx +0 -6
- package/src/presentation/atoms/Progress.tsx +0 -6
- package/src/presentation/atoms/Radio.tsx +0 -4
- package/src/presentation/atoms/Separator.tsx +0 -4
- package/src/presentation/atoms/Show.tsx +0 -24
- package/src/presentation/atoms/Skeleton.tsx +0 -4
- package/src/presentation/atoms/Slider.tsx +0 -4
- package/src/presentation/atoms/Sparkline.tsx +0 -4
- package/src/presentation/atoms/Spinner.tsx +0 -4
- package/src/presentation/atoms/StatusDot.tsx +79 -0
- package/src/presentation/atoms/Switch.tsx +0 -4
- package/src/presentation/atoms/Text.tsx +0 -4
- package/src/presentation/atoms/Textarea.tsx +0 -4
- package/src/presentation/atoms/Toggle.tsx +0 -4
- package/src/presentation/atoms/Tooltip.tsx +0 -4
- package/src/presentation/atoms/index.ts +9 -9
- package/src/presentation/hooks/index.ts +0 -5
- package/src/presentation/hooks/useClickOutside.ts +0 -6
- package/src/presentation/hooks/useClipboard.ts +0 -4
- package/src/presentation/hooks/useDebounce.ts +0 -8
- package/src/presentation/hooks/useKeyboard.ts +0 -6
- package/src/presentation/hooks/useLocalStorage.ts +0 -4
- package/src/presentation/hooks/useMediaQuery.ts +0 -37
- package/src/presentation/hooks/useScrollLock.ts +0 -5
- package/src/presentation/hooks/useTheme.ts +9 -13
- package/src/presentation/hooks/useToggle.ts +0 -4
- package/src/presentation/molecules/ActiveFilterTags.tsx +0 -4
- package/src/presentation/molecules/Avatar.tsx +0 -5
- package/src/presentation/molecules/BookmarkButton.tsx +0 -15
- package/src/presentation/molecules/CheckboxGroup.tsx +0 -4
- package/src/presentation/molecules/Chip.tsx +0 -5
- package/src/presentation/molecules/CodeBlock.tsx +0 -5
- package/src/presentation/molecules/ConfirmButton.tsx +125 -0
- package/src/presentation/molecules/Field.tsx +0 -7
- package/src/presentation/molecules/FormField.tsx +1 -5
- package/src/presentation/molecules/InputGroup.tsx +0 -4
- package/src/presentation/molecules/ListItem.tsx +0 -4
- package/src/presentation/molecules/OptionTile.tsx +0 -10
- package/src/presentation/molecules/PasswordInput.tsx +43 -0
- package/src/presentation/molecules/RadioGroup.tsx +0 -4
- package/src/presentation/molecules/RatingStars.tsx +0 -8
- package/src/presentation/molecules/ScrollArea.tsx +0 -4
- package/src/presentation/molecules/SearchBox.tsx +0 -4
- package/src/presentation/molecules/SearchInput.tsx +110 -0
- package/src/presentation/molecules/Select.tsx +0 -4
- package/src/presentation/molecules/StatPill.tsx +0 -5
- package/src/presentation/molecules/TagInput.tsx +0 -7
- package/src/presentation/molecules/Textarea.tsx +0 -4
- package/src/presentation/molecules/Toggle.tsx +0 -4
- package/src/presentation/molecules/Toolbar.tsx +36 -0
- package/src/presentation/molecules/index.ts +25 -8
- package/src/presentation/organisms/Accordion.tsx +0 -4
- package/src/presentation/organisms/Alert.tsx +0 -4
- package/src/presentation/organisms/AvatarStack.tsx +0 -5
- package/src/presentation/organisms/Breadcrumb.tsx +0 -7
- package/src/presentation/organisms/Card.tsx +0 -6
- package/src/presentation/organisms/Checklist.tsx +0 -4
- package/src/presentation/organisms/Collapsible.tsx +0 -4
- package/src/presentation/organisms/ConfirmDialog.tsx +0 -8
- package/src/presentation/organisms/CoverArt.tsx +0 -9
- package/src/presentation/organisms/DataTable.tsx +0 -8
- package/src/presentation/organisms/DateRangePicker.tsx +0 -9
- package/src/presentation/organisms/DescriptionList.tsx +113 -0
- package/src/presentation/organisms/Dialog.tsx +0 -4
- package/src/presentation/organisms/Drawer.tsx +0 -6
- package/src/presentation/organisms/DropdownMenu.tsx +0 -4
- package/src/presentation/organisms/ErrorBoundary.tsx +0 -12
- package/src/presentation/organisms/FileUploader.tsx +0 -9
- package/src/presentation/organisms/FilterPopover.tsx +0 -8
- package/src/presentation/organisms/FormModal.tsx +0 -5
- package/src/presentation/organisms/HoverCard.tsx +0 -4
- package/src/presentation/organisms/KeyValueList.tsx +0 -4
- package/src/presentation/organisms/KpiCard.tsx +0 -6
- package/src/presentation/organisms/Lightbox.tsx +0 -7
- package/src/presentation/organisms/LoadingState.tsx +0 -4
- package/src/presentation/organisms/MapPreview.tsx +0 -9
- package/src/presentation/organisms/MetricCard.tsx +1 -5
- package/src/presentation/organisms/Modal.tsx +0 -4
- package/src/presentation/organisms/PhotoGallery.tsx +0 -9
- package/src/presentation/organisms/PlanPicker.tsx +0 -5
- package/src/presentation/organisms/Popover.tsx +0 -4
- package/src/presentation/organisms/Sheet.tsx +0 -4
- package/src/presentation/organisms/StatCard.tsx +0 -5
- package/src/presentation/organisms/StatsGrid.tsx +110 -0
- package/src/presentation/organisms/StatusBadge.tsx +0 -12
- package/src/presentation/organisms/Stepper.tsx +0 -5
- package/src/presentation/organisms/Table.tsx +0 -4
- package/src/presentation/organisms/Tabs.tsx +0 -7
- package/src/presentation/organisms/Timeline.tsx +0 -8
- package/src/presentation/organisms/Toaster.tsx +0 -9
- package/src/presentation/organisms/ToggleGroup.tsx +0 -4
- package/src/presentation/organisms/index.ts +10 -11
- package/src/presentation/templates/CrudPageTemplate.tsx +69 -0
- package/src/presentation/templates/Form.tsx +0 -4
- package/src/presentation/templates/List.tsx +0 -4
- package/src/presentation/templates/PageHeader.tsx +0 -4
- package/src/presentation/templates/PageLayout.tsx +0 -4
- package/src/presentation/templates/ProjectSkeleton.tsx +0 -4
- package/src/presentation/templates/ResponsiveContainer.tsx +0 -43
- package/src/presentation/templates/Section.tsx +0 -4
- package/src/presentation/templates/SettingsLayout.tsx +102 -0
- package/src/presentation/templates/index.ts +7 -6
- package/src/styles/app.css +0 -18
- package/src/styles/bridge.css +0 -34
- package/src/styles/compile.css +0 -13
- package/src/styles/source.css +0 -12
- package/src/styles/theme.css +0 -27
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Styles contract — the precompiled stylesheet is a published artifact.
|
|
3
|
-
*
|
|
4
|
-
* These tests run AFTER `npm run build` (the npm `test` script builds
|
|
5
|
-
* first), so `dist/styles.css` reflects the current source. They fail the
|
|
6
|
-
* release if the compile step breaks, a theme variable goes missing, or a
|
|
7
|
-
* semantic class stops being generated.
|
|
8
|
-
*/
|
|
9
1
|
|
|
10
2
|
import { readFileSync } from 'node:fs';
|
|
11
3
|
import { resolve } from 'node:path';
|
|
@@ -34,15 +26,11 @@ describe('dist/styles.css contract', () => {
|
|
|
34
26
|
});
|
|
35
27
|
|
|
36
28
|
it('compiles component classes used by the source', () => {
|
|
37
|
-
// Button default variant hover state (compiled via color-mix)
|
|
38
29
|
expect(css).toMatch(/hover\\:bg-primary\\\/90:hover\{background-color:color-mix/);
|
|
39
|
-
// Button sizes
|
|
40
30
|
expect(css).toMatch(/\.h-10\{/);
|
|
41
31
|
expect(css).toMatch(/\.h-9\{/);
|
|
42
|
-
// Radius scale
|
|
43
32
|
expect(css).toMatch(/\.rounded-md\{border-radius:var\(--radius-md\)\}/);
|
|
44
33
|
expect(css).toMatch(/\.rounded-lg\{border-radius:var\(--radius-lg\)\}/);
|
|
45
|
-
// Toaster viewport + kind accents
|
|
46
34
|
expect(css).toMatch(/\.border-l-success\{[^}]*var\(--color-success\)/);
|
|
47
35
|
expect(css).toMatch(/\.text-warning\{[^}]*var\(--color-warning\)/);
|
|
48
36
|
expect(css).toMatch(/\.bg-popover\{[^}]*var\(--color-popover\)/);
|
|
@@ -102,7 +90,6 @@ describe('bridge.css contract (published as-is)', () => {
|
|
|
102
90
|
});
|
|
103
91
|
|
|
104
92
|
it('never touches radius or mono font (name-collision doctrine)', () => {
|
|
105
|
-
// Strip doc comments first — the header documents the doctrine by name.
|
|
106
93
|
const declarations = bridge.replace(/\/\*[\s\S]*?\*\//g, '');
|
|
107
94
|
expect(declarations).not.toContain('--radius-');
|
|
108
95
|
expect(declarations).not.toContain('--font-mono');
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Design Tokens
|
|
3
|
-
* @description Responsive scale maps (functional utilities, not theming).
|
|
4
|
-
* Theming lives in CSS: see `src/styles/theme.css` (@theme) — the
|
|
5
|
-
* single source of truth for colors, radius, fonts and shadows.
|
|
6
|
-
* Subpath: @umituz/web-design-system/tokens
|
|
7
|
-
*/
|
|
8
1
|
|
|
9
2
|
export {
|
|
10
3
|
RESPONSIVE_SPACING,
|
|
@@ -1,53 +1,23 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Responsive Design Tokens (Formula-Based)
|
|
3
|
-
* @description Centralized responsive scale generation using formulas
|
|
4
|
-
*
|
|
5
|
-
* All responsive values are generated dynamically from base values and formulas.
|
|
6
|
-
* This provides ZERO code duplication and single source of truth.
|
|
7
|
-
*
|
|
8
|
-
* To modify responsive behavior:
|
|
9
|
-
* 1. Change base values (BASE_* constants)
|
|
10
|
-
* 2. Modify formula functions (*Formula)
|
|
11
|
-
* 3. Entire system updates automatically
|
|
12
|
-
*/
|
|
13
1
|
|
|
14
2
|
import type { SizeVariant, Breakpoint } from '../types';
|
|
15
3
|
import { SPACING_SCALE } from '../../infrastructure/constants/spacing.constants';
|
|
16
4
|
import { TEXT_SIZES, type TextSizeKey } from '../../infrastructure/constants/typography.constants';
|
|
17
5
|
import { BREAKPOINT_ORDER } from '../../infrastructure/constants/breakpoint.constants';
|
|
18
6
|
|
|
19
|
-
/**
|
|
20
|
-
* Type for scale generation formula
|
|
21
|
-
* Input: base value for size variant, current breakpoint
|
|
22
|
-
* Output: spacing scale index (as number, will be converted to string)
|
|
23
|
-
*/
|
|
24
7
|
type ScaleFormula = (base: number, breakpoint: Breakpoint) => number;
|
|
25
8
|
|
|
26
|
-
/**
|
|
27
|
-
* Type for generator result
|
|
28
|
-
*/
|
|
29
9
|
type ResponsiveScale = Record<SizeVariant, Partial<Record<Breakpoint, string>>>;
|
|
30
10
|
|
|
31
|
-
// ============================================================================
|
|
32
|
-
// BASE VALUES - Single source of truth for size variants
|
|
33
|
-
// ============================================================================
|
|
34
11
|
|
|
35
|
-
/**
|
|
36
|
-
* Base spacing values for each size variant
|
|
37
|
-
* Defines the starting point for responsive spacing calculation
|
|
38
|
-
*/
|
|
39
12
|
const SPACING_BASES: Record<SizeVariant, number> = {
|
|
40
|
-
xs: 1,
|
|
41
|
-
sm: 2,
|
|
42
|
-
md: 3,
|
|
43
|
-
lg: 4,
|
|
44
|
-
xl: 5,
|
|
45
|
-
'2xl': 6,
|
|
13
|
+
xs: 1,
|
|
14
|
+
sm: 2,
|
|
15
|
+
md: 3,
|
|
16
|
+
lg: 4,
|
|
17
|
+
xl: 5,
|
|
18
|
+
'2xl': 6,
|
|
46
19
|
};
|
|
47
20
|
|
|
48
|
-
/**
|
|
49
|
-
* Base icon size values for each size variant
|
|
50
|
-
*/
|
|
51
21
|
const ICON_BASES: Record<SizeVariant, number> = {
|
|
52
22
|
xs: 4,
|
|
53
23
|
sm: 5,
|
|
@@ -57,9 +27,6 @@ const ICON_BASES: Record<SizeVariant, number> = {
|
|
|
57
27
|
'2xl': 12,
|
|
58
28
|
};
|
|
59
29
|
|
|
60
|
-
/**
|
|
61
|
-
* Base container size values (for icon wrappers)
|
|
62
|
-
*/
|
|
63
30
|
const CONTAINER_BASES: Record<SizeVariant, number> = {
|
|
64
31
|
xs: 6,
|
|
65
32
|
sm: 8,
|
|
@@ -69,9 +36,6 @@ const CONTAINER_BASES: Record<SizeVariant, number> = {
|
|
|
69
36
|
'2xl': 16,
|
|
70
37
|
};
|
|
71
38
|
|
|
72
|
-
/**
|
|
73
|
-
* Base gap/spacing values for layout
|
|
74
|
-
*/
|
|
75
39
|
const GAP_BASES: Record<SizeVariant, number> = {
|
|
76
40
|
xs: 1,
|
|
77
41
|
sm: 2,
|
|
@@ -81,67 +45,40 @@ const GAP_BASES: Record<SizeVariant, number> = {
|
|
|
81
45
|
'2xl': 6,
|
|
82
46
|
};
|
|
83
47
|
|
|
84
|
-
// ============================================================================
|
|
85
|
-
// FORMULAS - Define responsive behavior for each token type
|
|
86
|
-
// ============================================================================
|
|
87
48
|
|
|
88
|
-
/**
|
|
89
|
-
* Spacing formula for padding, margin, gap
|
|
90
|
-
* Progression: xs/sm→base, md/lg→base+1, xl→base+2, 2xl→base+3
|
|
91
|
-
*/
|
|
92
49
|
const spacingFormula: ScaleFormula = (base, bp) => {
|
|
93
50
|
const bpIndex = BREAKPOINT_ORDER.indexOf(bp);
|
|
94
|
-
if (bpIndex <= 1) return base;
|
|
95
|
-
if (bpIndex <= 3) return base + 1;
|
|
96
|
-
if (bpIndex === 4) return base + 2;
|
|
97
|
-
return base + 3;
|
|
51
|
+
if (bpIndex <= 1) return base;
|
|
52
|
+
if (bpIndex <= 3) return base + 1;
|
|
53
|
+
if (bpIndex === 4) return base + 2;
|
|
54
|
+
return base + 3;
|
|
98
55
|
};
|
|
99
56
|
|
|
100
|
-
/**
|
|
101
|
-
* Icon size formula
|
|
102
|
-
* Progression: More gradual increase across breakpoints
|
|
103
|
-
*/
|
|
104
57
|
const iconFormula: ScaleFormula = (base, bp) => {
|
|
105
58
|
if (bp === 'xs') return base - 1;
|
|
106
59
|
if (bp === 'sm') return base;
|
|
107
60
|
if (bp === 'md') return base + 1;
|
|
108
61
|
if (bp === 'lg') return base + 2;
|
|
109
62
|
if (bp === 'xl') return base + 3;
|
|
110
|
-
return base + 3;
|
|
63
|
+
return base + 3;
|
|
111
64
|
};
|
|
112
65
|
|
|
113
|
-
/**
|
|
114
|
-
* Container size formula (for icon wrappers)
|
|
115
|
-
* Consistent size increase
|
|
116
|
-
*/
|
|
117
66
|
const containerFormula: ScaleFormula = (base, bp) => {
|
|
118
67
|
const bpIndex = BREAKPOINT_ORDER.indexOf(bp);
|
|
119
|
-
if (bpIndex <= 3) return base + 2;
|
|
120
|
-
if (bpIndex === 4) return base + 2;
|
|
121
|
-
return base + 2;
|
|
68
|
+
if (bpIndex <= 3) return base + 2;
|
|
69
|
+
if (bpIndex === 4) return base + 2;
|
|
70
|
+
return base + 2;
|
|
122
71
|
};
|
|
123
72
|
|
|
124
|
-
/**
|
|
125
|
-
* Gap formula for layout spacing
|
|
126
|
-
*/
|
|
127
73
|
const gapFormula: ScaleFormula = (base, bp) => {
|
|
128
74
|
const bpIndex = BREAKPOINT_ORDER.indexOf(bp);
|
|
129
|
-
if (bpIndex <= 1) return base;
|
|
130
|
-
if (bpIndex <= 3) return base + 1;
|
|
131
|
-
if (bpIndex === 4) return base + 1;
|
|
132
|
-
return base + 2;
|
|
75
|
+
if (bpIndex <= 1) return base;
|
|
76
|
+
if (bpIndex <= 3) return base + 1;
|
|
77
|
+
if (bpIndex === 4) return base + 1;
|
|
78
|
+
return base + 2;
|
|
133
79
|
};
|
|
134
80
|
|
|
135
|
-
// ============================================================================
|
|
136
|
-
// GENERATORS - Create responsive scales dynamically
|
|
137
|
-
// ============================================================================
|
|
138
81
|
|
|
139
|
-
/**
|
|
140
|
-
* Generate responsive scale for any token type
|
|
141
|
-
* @param bases - Base values for each size variant
|
|
142
|
-
* @param formula - Formula to calculate value at each breakpoint
|
|
143
|
-
* @returns Complete responsive scale object
|
|
144
|
-
*/
|
|
145
82
|
function generateResponsiveScale(
|
|
146
83
|
bases: Record<SizeVariant, number>,
|
|
147
84
|
formula: ScaleFormula
|
|
@@ -156,7 +93,6 @@ function generateResponsiveScale(
|
|
|
156
93
|
const scaleIndex = formula(base, bp);
|
|
157
94
|
const scaleKey = scaleIndex.toString() as keyof typeof SPACING_SCALE;
|
|
158
95
|
|
|
159
|
-
// Validate and get spacing scale value
|
|
160
96
|
if (scaleKey in SPACING_SCALE) {
|
|
161
97
|
result[size]![bp] = SPACING_SCALE[scaleKey];
|
|
162
98
|
}
|
|
@@ -166,10 +102,6 @@ function generateResponsiveScale(
|
|
|
166
102
|
return result as ResponsiveScale;
|
|
167
103
|
}
|
|
168
104
|
|
|
169
|
-
/**
|
|
170
|
-
* Generate responsive text sizes
|
|
171
|
-
* Text sizes use string literals, not spacing scale
|
|
172
|
-
*/
|
|
173
105
|
function generateResponsiveTextSizes() {
|
|
174
106
|
const textSizeKeys: Record<SizeVariant, { mobile: TextSizeKey; tablet: TextSizeKey }> = {
|
|
175
107
|
xs: { mobile: 'xs', tablet: 'xs' },
|
|
@@ -193,36 +125,15 @@ function generateResponsiveTextSizes() {
|
|
|
193
125
|
return result as Record<SizeVariant, Partial<Record<'mobile' | 'tablet', string>>>;
|
|
194
126
|
}
|
|
195
127
|
|
|
196
|
-
// ============================================================================
|
|
197
|
-
// EXPORTS - All responsive tokens (one line each!)
|
|
198
|
-
// ============================================================================
|
|
199
128
|
|
|
200
|
-
/**
|
|
201
|
-
* Responsive spacing scale for padding, margin, space-*, gap-*
|
|
202
|
-
*/
|
|
203
129
|
export const RESPONSIVE_SPACING = generateResponsiveScale(SPACING_BASES, spacingFormula);
|
|
204
130
|
|
|
205
|
-
/**
|
|
206
|
-
* Responsive icon sizes (height/width)
|
|
207
|
-
*/
|
|
208
131
|
export const RESPONSIVE_ICON_SIZE = generateResponsiveScale(ICON_BASES, iconFormula);
|
|
209
132
|
|
|
210
|
-
/**
|
|
211
|
-
* Responsive container sizes for icon wrappers
|
|
212
|
-
*/
|
|
213
133
|
export const RESPONSIVE_CONTAINER_SIZE = generateResponsiveScale(CONTAINER_BASES, containerFormula);
|
|
214
134
|
|
|
215
|
-
/**
|
|
216
|
-
* Responsive gap/spacing for layouts
|
|
217
|
-
*/
|
|
218
135
|
export const RESPONSIVE_GAP = generateResponsiveScale(GAP_BASES, gapFormula);
|
|
219
136
|
|
|
220
|
-
/**
|
|
221
|
-
* Responsive text sizes (mobile + tablet)
|
|
222
|
-
*/
|
|
223
137
|
export const RESPONSIVE_TEXT_SIZE = generateResponsiveTextSizes();
|
|
224
138
|
|
|
225
|
-
/**
|
|
226
|
-
* Type exports
|
|
227
|
-
*/
|
|
228
139
|
export type SpacingScale = keyof typeof SPACING_SCALE;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Responsive System Type Definitions
|
|
3
|
-
* @description Centralized breakpoint types for responsive design
|
|
4
|
-
*/
|
|
5
1
|
|
|
6
2
|
export type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
7
3
|
|
|
@@ -22,15 +18,15 @@ export interface ResponsiveProps {
|
|
|
22
18
|
}
|
|
23
19
|
|
|
24
20
|
export interface ShowProps {
|
|
25
|
-
above?: Breakpoint;
|
|
26
|
-
below?: Breakpoint;
|
|
27
|
-
at?: Breakpoint;
|
|
21
|
+
above?: Breakpoint;
|
|
22
|
+
below?: Breakpoint;
|
|
23
|
+
at?: Breakpoint;
|
|
28
24
|
}
|
|
29
25
|
|
|
30
26
|
export interface HideProps {
|
|
31
|
-
above?: Breakpoint;
|
|
32
|
-
below?: Breakpoint;
|
|
33
|
-
at?: Breakpoint;
|
|
27
|
+
above?: Breakpoint;
|
|
28
|
+
below?: Breakpoint;
|
|
29
|
+
at?: Breakpoint;
|
|
34
30
|
}
|
|
35
31
|
|
|
36
32
|
export interface BreakpointState {
|
|
@@ -41,9 +37,9 @@ export interface BreakpointState {
|
|
|
41
37
|
isLg: boolean;
|
|
42
38
|
isXl: boolean;
|
|
43
39
|
is2Xl: boolean;
|
|
44
|
-
isMobile: boolean;
|
|
45
|
-
isTablet: boolean;
|
|
46
|
-
isDesktop: boolean;
|
|
40
|
+
isMobile: boolean;
|
|
41
|
+
isTablet: boolean;
|
|
42
|
+
isDesktop: boolean;
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
export interface UseBreakpointReturn extends BreakpointState {
|
package/src/global.d.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,34 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
* @umituz/web-design-system
|
|
3
|
-
*
|
|
4
|
-
* Web Design System - Atomic Design components (Atoms, Molecules, Organisms)
|
|
5
|
-
* for React applications with Tailwind CSS.
|
|
6
|
-
*
|
|
7
|
-
* Apps MUST NOT use this root barrel.
|
|
8
|
-
* Use subpath imports instead: "@umituz/web-design-system/atoms"
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* // CORRECT: Subpath import
|
|
12
|
-
* import { Button, Input } from '@umituz/web-design-system/atoms';
|
|
13
|
-
* import { Card } from '@umituz/web-design-system/organisms';
|
|
14
|
-
*
|
|
15
|
-
* // INCORRECT: Root barrel import
|
|
16
|
-
* import { Button, Card } from '@umituz/web-design-system';
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
// Re-exports for consumers that prefer the single entry point.
|
|
20
|
-
// Subpath imports are still recommended for better tree-shaking.
|
|
1
|
+
// Core Tokens, Types, Constants, Hooks & Utils
|
|
21
2
|
export * from './domain/tokens';
|
|
22
3
|
export * from './domain/types';
|
|
23
4
|
export * from './infrastructure/utils';
|
|
24
5
|
export * from './infrastructure/constants';
|
|
25
|
-
export * from './presentation/templates';
|
|
26
6
|
export * from './presentation/hooks';
|
|
27
7
|
|
|
8
|
+
// Templates
|
|
9
|
+
export * from './presentation/templates';
|
|
10
|
+
|
|
11
|
+
// Organisms
|
|
12
|
+
export * from './presentation/organisms';
|
|
13
|
+
|
|
28
14
|
// Atoms
|
|
29
15
|
export type { ButtonProps } from './presentation/atoms/Button';
|
|
30
|
-
export { Button } from './presentation/atoms/Button';
|
|
31
|
-
export type { BadgeProps } from './presentation/atoms/Badge';
|
|
16
|
+
export { Button, buttonVariants } from './presentation/atoms/Button';
|
|
17
|
+
export type { BadgeProps, BadgeVariant } from './presentation/atoms/Badge';
|
|
32
18
|
export { Badge } from './presentation/atoms/Badge';
|
|
33
19
|
export type { InputProps } from './presentation/atoms/Input';
|
|
34
20
|
export { Input } from './presentation/atoms/Input';
|
|
@@ -54,6 +40,8 @@ export type { TooltipProps } from './presentation/atoms/Tooltip';
|
|
|
54
40
|
export { Tooltip } from './presentation/atoms/Tooltip';
|
|
55
41
|
export type { ProgressProps } from './presentation/atoms/Progress';
|
|
56
42
|
export { Progress } from './presentation/atoms/Progress';
|
|
43
|
+
export type { ProgressRingProps } from './presentation/atoms/ProgressRing';
|
|
44
|
+
export { ProgressRing } from './presentation/atoms/ProgressRing';
|
|
57
45
|
export { Label } from './presentation/atoms/Label';
|
|
58
46
|
export type { AspectRatioProps } from './presentation/atoms/AspectRatio';
|
|
59
47
|
export { AspectRatio } from './presentation/atoms/AspectRatio';
|
|
@@ -61,19 +49,58 @@ export type { SwitchProps } from './presentation/atoms/Switch';
|
|
|
61
49
|
export { Switch } from './presentation/atoms/Switch';
|
|
62
50
|
export { Separator } from './presentation/atoms/Separator';
|
|
63
51
|
export { Toggle as TogglePrimitive, toggleVariants } from './presentation/atoms/Toggle';
|
|
52
|
+
export { Show } from './presentation/atoms/Show';
|
|
53
|
+
export type { ShowComponentProps } from './presentation/atoms/Show';
|
|
54
|
+
export { Hide } from './presentation/atoms/Hide';
|
|
55
|
+
export type { HideComponentProps } from './presentation/atoms/Hide';
|
|
56
|
+
export { IconButton } from './presentation/atoms/IconButton';
|
|
57
|
+
export type { IconButtonProps } from './presentation/atoms/IconButton';
|
|
58
|
+
export { Sparkline } from './presentation/atoms/Sparkline';
|
|
59
|
+
export type { SparklineProps } from './presentation/atoms/Sparkline';
|
|
60
|
+
export { HeatmapStrip } from './presentation/atoms/HeatmapStrip';
|
|
61
|
+
export type { HeatmapStripProps, HeatmapCell } from './presentation/atoms/HeatmapStrip';
|
|
62
|
+
export { NativeSelect } from './presentation/atoms/NativeSelect';
|
|
63
|
+
export type { NativeSelectProps, NativeSelectOption } from './presentation/atoms/NativeSelect';
|
|
64
|
+
export { BatteryPill } from './presentation/atoms/BatteryPill';
|
|
65
|
+
export type { BatteryPillProps } from './presentation/atoms/BatteryPill';
|
|
66
|
+
export { CodeChip } from './presentation/atoms/CodeChip';
|
|
67
|
+
export type { CodeChipProps } from './presentation/atoms/CodeChip';
|
|
68
|
+
export { Kbd } from './presentation/atoms/Kbd';
|
|
69
|
+
export type { KbdProps } from './presentation/atoms/Kbd';
|
|
70
|
+
export { Money } from './presentation/atoms/Money';
|
|
71
|
+
export type { MoneyProps } from './presentation/atoms/Money';
|
|
72
|
+
export { CopyButton } from './presentation/atoms/CopyButton';
|
|
73
|
+
export type { CopyButtonProps } from './presentation/atoms/CopyButton';
|
|
74
|
+
export { StatusDot } from './presentation/atoms/StatusDot';
|
|
75
|
+
export type { StatusDotProps, StatusType } from './presentation/atoms/StatusDot';
|
|
64
76
|
|
|
65
77
|
// Molecules
|
|
66
78
|
export type { FormFieldProps } from './presentation/molecules/FormField';
|
|
67
79
|
export { FormField } from './presentation/molecules/FormField';
|
|
68
80
|
export type { SearchBoxProps } from './presentation/molecules/SearchBox';
|
|
69
81
|
export { SearchBox } from './presentation/molecules/SearchBox';
|
|
70
|
-
export type {
|
|
82
|
+
export type {
|
|
83
|
+
AvatarProps,
|
|
84
|
+
AvatarImageProps,
|
|
85
|
+
AvatarFallbackProps,
|
|
86
|
+
} from './presentation/molecules/Avatar';
|
|
71
87
|
export { Avatar, AvatarImage, AvatarFallback } from './presentation/molecules/Avatar';
|
|
72
88
|
export type { ChipProps } from './presentation/molecules/Chip';
|
|
73
89
|
export { Chip } from './presentation/molecules/Chip';
|
|
74
90
|
export type { ToggleProps } from './presentation/molecules/Toggle';
|
|
75
91
|
export { Toggle } from './presentation/molecules/Toggle';
|
|
76
|
-
export {
|
|
92
|
+
export {
|
|
93
|
+
Select,
|
|
94
|
+
SelectGroup,
|
|
95
|
+
SelectValue,
|
|
96
|
+
SelectTrigger,
|
|
97
|
+
SelectContent,
|
|
98
|
+
SelectLabel,
|
|
99
|
+
SelectItem,
|
|
100
|
+
SelectSeparator,
|
|
101
|
+
SelectScrollUpButton,
|
|
102
|
+
SelectScrollDownButton,
|
|
103
|
+
} from './presentation/molecules/Select';
|
|
77
104
|
export type { TextareaProps } from './presentation/molecules/Textarea';
|
|
78
105
|
export { Textarea } from './presentation/molecules/Textarea';
|
|
79
106
|
export type { RadioGroupProps, RadioOption } from './presentation/molecules/RadioGroup';
|
|
@@ -83,9 +110,35 @@ export { CheckboxGroup } from './presentation/molecules/CheckboxGroup';
|
|
|
83
110
|
export type { InputGroupProps } from './presentation/molecules/InputGroup';
|
|
84
111
|
export { InputGroup, GroupedInput } from './presentation/molecules/InputGroup';
|
|
85
112
|
export { ScrollArea, ScrollBar } from './presentation/molecules/ScrollArea';
|
|
86
|
-
export type { ListItemProps } from './presentation/molecules/ListItem';
|
|
87
|
-
export { ListItem } from './presentation/molecules/ListItem';
|
|
113
|
+
export type { ListItemProps as MoleculeListItemProps } from './presentation/molecules/ListItem';
|
|
114
|
+
export { ListItem as MoleculeListItem } from './presentation/molecules/ListItem';
|
|
88
115
|
export type { BookmarkButtonProps, BookmarkTone } from './presentation/molecules/BookmarkButton';
|
|
89
116
|
export { BookmarkButton } from './presentation/molecules/BookmarkButton';
|
|
90
|
-
|
|
91
|
-
export
|
|
117
|
+
export { PasswordInput } from './presentation/molecules/PasswordInput';
|
|
118
|
+
export type { PasswordInputProps } from './presentation/molecules/PasswordInput';
|
|
119
|
+
export { SearchInput } from './presentation/molecules/SearchInput';
|
|
120
|
+
export type { SearchInputProps } from './presentation/molecules/SearchInput';
|
|
121
|
+
export { ConfirmButton } from './presentation/molecules/ConfirmButton';
|
|
122
|
+
export type { ConfirmButtonProps } from './presentation/molecules/ConfirmButton';
|
|
123
|
+
export { Toolbar } from './presentation/molecules/Toolbar';
|
|
124
|
+
export type { ToolbarProps } from './presentation/molecules/Toolbar';
|
|
125
|
+
export { ActiveFilterTags } from './presentation/molecules/ActiveFilterTags';
|
|
126
|
+
export type { ActiveFilterTagsProps } from './presentation/molecules/ActiveFilterTags';
|
|
127
|
+
export { CodeBlock } from './presentation/molecules/CodeBlock';
|
|
128
|
+
export type { CodeBlockProps } from './presentation/molecules/CodeBlock';
|
|
129
|
+
export { OptionCard } from './presentation/molecules/OptionCard';
|
|
130
|
+
export type { OptionCardProps } from './presentation/molecules/OptionCard';
|
|
131
|
+
export { OptionTile } from './presentation/molecules/OptionTile';
|
|
132
|
+
export type { OptionTileProps, OptionTileState } from './presentation/molecules/OptionTile';
|
|
133
|
+
export { Field } from './presentation/molecules/Field';
|
|
134
|
+
export type { FieldProps } from './presentation/molecules/Field';
|
|
135
|
+
export { Segmented } from './presentation/molecules/Segmented';
|
|
136
|
+
export type { SegmentedProps, SegmentedOption } from './presentation/molecules/Segmented';
|
|
137
|
+
export { RatingStars } from './presentation/molecules/RatingStars';
|
|
138
|
+
export type { RatingStarsProps } from './presentation/molecules/RatingStars';
|
|
139
|
+
export { StatPill } from './presentation/molecules/StatPill';
|
|
140
|
+
export type { StatPillProps, StatPillTone } from './presentation/molecules/StatPill';
|
|
141
|
+
export { TagInput } from './presentation/molecules/TagInput';
|
|
142
|
+
export type { TagInputProps } from './presentation/molecules/TagInput';
|
|
143
|
+
export { MarkdownText } from './presentation/molecules/MarkdownText';
|
|
144
|
+
export type { MarkdownTextProps } from './presentation/molecules/MarkdownText';
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Responsive System Constants
|
|
3
|
-
* @description Centralized breakpoint values matching Tailwind CSS defaults
|
|
4
|
-
*/
|
|
5
1
|
|
|
6
2
|
import type { Breakpoint, BreakpointValue } from '../../domain/types/breakpoint.types';
|
|
7
3
|
|
|
8
|
-
/**
|
|
9
|
-
* Breakpoint values matching Tailwind CSS default breakpoints
|
|
10
|
-
* https://tailwindcss.com/docs/screens
|
|
11
|
-
*/
|
|
12
4
|
export const BREAKPOINTS: Record<Breakpoint, BreakpointValue> = {
|
|
13
5
|
xs: { min: 0 },
|
|
14
6
|
sm: { min: 640 },
|
|
@@ -18,11 +10,6 @@ export const BREAKPOINTS: Record<Breakpoint, BreakpointValue> = {
|
|
|
18
10
|
'2xl': { min: 1536 },
|
|
19
11
|
};
|
|
20
12
|
|
|
21
|
-
/**
|
|
22
|
-
* Create a media query string for a given breakpoint
|
|
23
|
-
* @param breakpoint - The breakpoint to create a query for
|
|
24
|
-
* @returns CSS media query string (e.g., "(min-width: 640px)")
|
|
25
|
-
*/
|
|
26
13
|
export const createMediaQuery = (breakpoint: Breakpoint): string => {
|
|
27
14
|
const bp = BREAKPOINTS[breakpoint];
|
|
28
15
|
if (bp.max) {
|
|
@@ -31,42 +18,24 @@ export const createMediaQuery = (breakpoint: Breakpoint): string => {
|
|
|
31
18
|
return `(min-width: ${bp.min}px)`;
|
|
32
19
|
};
|
|
33
20
|
|
|
34
|
-
/**
|
|
35
|
-
* Create a max-width media query
|
|
36
|
-
* @param breakpoint - The breakpoint to create a max query for
|
|
37
|
-
* @returns CSS media query string (e.g., "(max-width: 639px)")
|
|
38
|
-
*/
|
|
39
21
|
export const createMaxMediaQuery = (breakpoint: Breakpoint): string => {
|
|
40
22
|
const bp = BREAKPOINTS[breakpoint];
|
|
41
23
|
const maxValue = bp.min - 1;
|
|
42
24
|
return `(max-width: ${maxValue}px)`;
|
|
43
25
|
};
|
|
44
26
|
|
|
45
|
-
/**
|
|
46
|
-
* Breakpoint order for comparison operations
|
|
47
|
-
*/
|
|
48
27
|
export const BREAKPOINT_ORDER: Breakpoint[] = ['xs', 'sm', 'md', 'lg', 'xl', '2xl'];
|
|
49
28
|
|
|
50
|
-
/**
|
|
51
|
-
* Compare two breakpoints
|
|
52
|
-
* @returns -1 if a < b, 0 if a === b, 1 if a > b
|
|
53
|
-
*/
|
|
54
29
|
export const compareBreakpoints = (a: Breakpoint, b: Breakpoint): number => {
|
|
55
30
|
const indexA = BREAKPOINT_ORDER.indexOf(a);
|
|
56
31
|
const indexB = BREAKPOINT_ORDER.indexOf(b);
|
|
57
32
|
return indexA - indexB;
|
|
58
33
|
};
|
|
59
34
|
|
|
60
|
-
/**
|
|
61
|
-
* Check if breakpoint A is greater than breakpoint B
|
|
62
|
-
*/
|
|
63
35
|
export const isBreakpointGreaterThan = (a: Breakpoint, b: Breakpoint): boolean => {
|
|
64
36
|
return compareBreakpoints(a, b) > 0;
|
|
65
37
|
};
|
|
66
38
|
|
|
67
|
-
/**
|
|
68
|
-
* Check if breakpoint A is less than breakpoint B
|
|
69
|
-
*/
|
|
70
39
|
export const isBreakpointLessThan = (a: Breakpoint, b: Breakpoint): boolean => {
|
|
71
40
|
return compareBreakpoints(a, b) < 0;
|
|
72
41
|
};
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Size Variant Constants
|
|
3
|
-
* @description Size variants used throughout the design system
|
|
4
|
-
*
|
|
5
|
-
* All size variant values are defined here to provide consistency
|
|
6
|
-
* and prevent hardcoded strings in components.
|
|
7
|
-
*/
|
|
8
1
|
|
|
9
|
-
/**
|
|
10
|
-
* Size variants available in the design system
|
|
11
|
-
* Ordered from smallest to largest
|
|
12
|
-
*/
|
|
13
2
|
export const SIZE_VARIANTS = {
|
|
14
3
|
xs: 'xs',
|
|
15
4
|
sm: 'sm',
|
|
@@ -19,34 +8,18 @@ export const SIZE_VARIANTS = {
|
|
|
19
8
|
'2xl': '2xl',
|
|
20
9
|
} as const;
|
|
21
10
|
|
|
22
|
-
/**
|
|
23
|
-
* Type for size variant keys
|
|
24
|
-
*/
|
|
25
11
|
export type SizeVariantKey = keyof typeof SIZE_VARIANTS;
|
|
26
12
|
|
|
27
|
-
/**
|
|
28
|
-
* Type for size variant values
|
|
29
|
-
*/
|
|
30
13
|
export type SizeVariant = typeof SIZE_VARIANTS[SizeVariantKey];
|
|
31
14
|
|
|
32
|
-
/**
|
|
33
|
-
* Common size combinations used by components
|
|
34
|
-
* These prevent repeating Extract<SizeVariant, '...'> in every component
|
|
35
|
-
*/
|
|
36
15
|
export type SmallSizes = Extract<SizeVariant, 'xs' | 'sm'>;
|
|
37
16
|
export type MediumSizes = Extract<SizeVariant, 'sm' | 'md' | 'lg'>;
|
|
38
17
|
export type RegularSizes = Extract<SizeVariant, 'sm' | 'md' | 'lg' | 'xl'>;
|
|
39
18
|
export type ExtendedSizes = Extract<SizeVariant, 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'>;
|
|
40
19
|
export type AllSizes = SizeVariant;
|
|
41
20
|
|
|
42
|
-
/**
|
|
43
|
-
* Size variant order (for sorting/comparison)
|
|
44
|
-
*/
|
|
45
21
|
export const SIZE_VARIANT_ORDER: SizeVariant[] = ['xs', 'sm', 'md', 'lg', 'xl', '2xl'];
|
|
46
22
|
|
|
47
|
-
/**
|
|
48
|
-
* Get the next larger size variant
|
|
49
|
-
*/
|
|
50
23
|
export function getNextSizeVariant(current: SizeVariant): SizeVariant | null {
|
|
51
24
|
const index = SIZE_VARIANT_ORDER.indexOf(current);
|
|
52
25
|
if (index === -1 || index === SIZE_VARIANT_ORDER.length - 1) {
|
|
@@ -55,9 +28,6 @@ export function getNextSizeVariant(current: SizeVariant): SizeVariant | null {
|
|
|
55
28
|
return SIZE_VARIANT_ORDER[index + 1] ?? null;
|
|
56
29
|
}
|
|
57
30
|
|
|
58
|
-
/**
|
|
59
|
-
* Get the next smaller size variant
|
|
60
|
-
*/
|
|
61
31
|
export function getPrevSizeVariant(current: SizeVariant): SizeVariant | null {
|
|
62
32
|
const index = SIZE_VARIANT_ORDER.indexOf(current);
|
|
63
33
|
if (index <= 0) {
|
|
@@ -66,9 +36,6 @@ export function getPrevSizeVariant(current: SizeVariant): SizeVariant | null {
|
|
|
66
36
|
return SIZE_VARIANT_ORDER[index - 1] ?? null;
|
|
67
37
|
}
|
|
68
38
|
|
|
69
|
-
/**
|
|
70
|
-
* Validate if a value is a valid size variant
|
|
71
|
-
*/
|
|
72
39
|
export function isValidSizeVariant(value: string): value is SizeVariant {
|
|
73
40
|
return Object.values(SIZE_VARIANTS).includes(value as SizeVariant);
|
|
74
41
|
}
|