@react-xp/design-system 1.0.0-beta.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/LICENSE +21 -0
- package/README.md +325 -0
- package/dist/cjs/helpers/a11y.js +176 -0
- package/dist/cjs/helpers/index.js +18 -0
- package/dist/cjs/helpers/styles.js +172 -0
- package/dist/cjs/index.js +19 -0
- package/dist/cjs/styles/avatars.js +63 -0
- package/dist/cjs/styles/badges.js +59 -0
- package/dist/cjs/styles/bottomSheets.js +76 -0
- package/dist/cjs/styles/buttons.js +129 -0
- package/dist/cjs/styles/cards.js +71 -0
- package/dist/cjs/styles/checkboxes.js +70 -0
- package/dist/cjs/styles/chips.js +98 -0
- package/dist/cjs/styles/datePickers.js +113 -0
- package/dist/cjs/styles/dividers.js +12 -0
- package/dist/cjs/styles/emptyStates.js +40 -0
- package/dist/cjs/styles/forms.js +32 -0
- package/dist/cjs/styles/headers.js +46 -0
- package/dist/cjs/styles/index.js +43 -0
- package/dist/cjs/styles/inputs.js +101 -0
- package/dist/cjs/styles/listItems.js +65 -0
- package/dist/cjs/styles/modals.js +92 -0
- package/dist/cjs/styles/pagination.js +39 -0
- package/dist/cjs/styles/popovers.js +64 -0
- package/dist/cjs/styles/progress.js +33 -0
- package/dist/cjs/styles/radios.js +70 -0
- package/dist/cjs/styles/selects.js +137 -0
- package/dist/cjs/styles/skeletons.js +34 -0
- package/dist/cjs/styles/steppers.js +71 -0
- package/dist/cjs/styles/switches.js +76 -0
- package/dist/cjs/styles/tables.js +57 -0
- package/dist/cjs/styles/tabs.js +71 -0
- package/dist/cjs/styles/toasts.js +82 -0
- package/dist/cjs/styles/tooltips.js +46 -0
- package/dist/cjs/types/index.js +18 -0
- package/dist/cjs/types/states.js +8 -0
- package/dist/cjs/types/tokens.js +18 -0
- package/dist/esm/helpers/a11y.js +169 -0
- package/dist/esm/helpers/index.js +2 -0
- package/dist/esm/helpers/styles.js +158 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/styles/avatars.js +59 -0
- package/dist/esm/styles/badges.js +55 -0
- package/dist/esm/styles/bottomSheets.js +72 -0
- package/dist/esm/styles/buttons.js +125 -0
- package/dist/esm/styles/cards.js +67 -0
- package/dist/esm/styles/checkboxes.js +66 -0
- package/dist/esm/styles/chips.js +94 -0
- package/dist/esm/styles/datePickers.js +108 -0
- package/dist/esm/styles/dividers.js +8 -0
- package/dist/esm/styles/emptyStates.js +36 -0
- package/dist/esm/styles/forms.js +28 -0
- package/dist/esm/styles/headers.js +42 -0
- package/dist/esm/styles/index.js +27 -0
- package/dist/esm/styles/inputs.js +97 -0
- package/dist/esm/styles/listItems.js +61 -0
- package/dist/esm/styles/modals.js +88 -0
- package/dist/esm/styles/pagination.js +35 -0
- package/dist/esm/styles/popovers.js +60 -0
- package/dist/esm/styles/progress.js +27 -0
- package/dist/esm/styles/radios.js +66 -0
- package/dist/esm/styles/selects.js +133 -0
- package/dist/esm/styles/skeletons.js +29 -0
- package/dist/esm/styles/steppers.js +66 -0
- package/dist/esm/styles/switches.js +72 -0
- package/dist/esm/styles/tables.js +53 -0
- package/dist/esm/styles/tabs.js +66 -0
- package/dist/esm/styles/toasts.js +77 -0
- package/dist/esm/styles/tooltips.js +42 -0
- package/dist/esm/types/index.js +2 -0
- package/dist/esm/types/states.js +3 -0
- package/dist/esm/types/tokens.js +12 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/types/helpers/a11y.d.ts +20 -0
- package/dist/types/helpers/a11y.d.ts.map +1 -0
- package/dist/types/helpers/index.d.ts +3 -0
- package/dist/types/helpers/index.d.ts.map +1 -0
- package/dist/types/helpers/styles.d.ts +31 -0
- package/dist/types/helpers/styles.d.ts.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/styles/avatars.d.ts +10 -0
- package/dist/types/styles/avatars.d.ts.map +1 -0
- package/dist/types/styles/badges.d.ts +8 -0
- package/dist/types/styles/badges.d.ts.map +1 -0
- package/dist/types/styles/bottomSheets.d.ts +15 -0
- package/dist/types/styles/bottomSheets.d.ts.map +1 -0
- package/dist/types/styles/buttons.d.ts +22 -0
- package/dist/types/styles/buttons.d.ts.map +1 -0
- package/dist/types/styles/cards.d.ts +18 -0
- package/dist/types/styles/cards.d.ts.map +1 -0
- package/dist/types/styles/checkboxes.d.ts +18 -0
- package/dist/types/styles/checkboxes.d.ts.map +1 -0
- package/dist/types/styles/chips.d.ts +20 -0
- package/dist/types/styles/chips.d.ts.map +1 -0
- package/dist/types/styles/datePickers.d.ts +30 -0
- package/dist/types/styles/datePickers.d.ts.map +1 -0
- package/dist/types/styles/dividers.d.ts +4 -0
- package/dist/types/styles/dividers.d.ts.map +1 -0
- package/dist/types/styles/emptyStates.d.ts +10 -0
- package/dist/types/styles/emptyStates.d.ts.map +1 -0
- package/dist/types/styles/forms.d.ts +10 -0
- package/dist/types/styles/forms.d.ts.map +1 -0
- package/dist/types/styles/headers.d.ts +11 -0
- package/dist/types/styles/headers.d.ts.map +1 -0
- package/dist/types/styles/index.d.ts +28 -0
- package/dist/types/styles/index.d.ts.map +1 -0
- package/dist/types/styles/inputs.d.ts +19 -0
- package/dist/types/styles/inputs.d.ts.map +1 -0
- package/dist/types/styles/listItems.d.ts +19 -0
- package/dist/types/styles/listItems.d.ts.map +1 -0
- package/dist/types/styles/modals.d.ts +15 -0
- package/dist/types/styles/modals.d.ts.map +1 -0
- package/dist/types/styles/pagination.d.ts +9 -0
- package/dist/types/styles/pagination.d.ts.map +1 -0
- package/dist/types/styles/popovers.d.ts +12 -0
- package/dist/types/styles/popovers.d.ts.map +1 -0
- package/dist/types/styles/progress.d.ts +11 -0
- package/dist/types/styles/progress.d.ts.map +1 -0
- package/dist/types/styles/radios.d.ts +17 -0
- package/dist/types/styles/radios.d.ts.map +1 -0
- package/dist/types/styles/selects.d.ts +25 -0
- package/dist/types/styles/selects.d.ts.map +1 -0
- package/dist/types/styles/skeletons.d.ts +13 -0
- package/dist/types/styles/skeletons.d.ts.map +1 -0
- package/dist/types/styles/steppers.d.ts +21 -0
- package/dist/types/styles/steppers.d.ts.map +1 -0
- package/dist/types/styles/switches.d.ts +17 -0
- package/dist/types/styles/switches.d.ts.map +1 -0
- package/dist/types/styles/tables.d.ts +13 -0
- package/dist/types/styles/tables.d.ts.map +1 -0
- package/dist/types/styles/tabs.d.ts +19 -0
- package/dist/types/styles/tabs.d.ts.map +1 -0
- package/dist/types/styles/toasts.d.ts +13 -0
- package/dist/types/styles/toasts.d.ts.map +1 -0
- package/dist/types/styles/tooltips.d.ts +9 -0
- package/dist/types/styles/tooltips.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +3 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/states.d.ts +26 -0
- package/dist/types/types/states.d.ts.map +1 -0
- package/dist/types/types/tokens.d.ts +16 -0
- package/dist/types/types/tokens.d.ts.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// styles/inputs.ts
|
|
2
|
+
import { merge, tok, } from '../types/tokens';
|
|
3
|
+
const sizeStyles = (t) => ({
|
|
4
|
+
sm: {
|
|
5
|
+
fieldWrapper: {
|
|
6
|
+
minHeight: tok(t, 'tap-target-min'),
|
|
7
|
+
paddingHorizontal: tok(t, 'space-3'),
|
|
8
|
+
paddingVertical: tok(t, 'space-2'),
|
|
9
|
+
},
|
|
10
|
+
inputText: { fontSize: tok(t, 'typography-font-size-2') },
|
|
11
|
+
},
|
|
12
|
+
md: {
|
|
13
|
+
fieldWrapper: {
|
|
14
|
+
minHeight: tok(t, 'tap-target-min'),
|
|
15
|
+
paddingHorizontal: tok(t, 'space-4'),
|
|
16
|
+
paddingVertical: tok(t, 'space-2'),
|
|
17
|
+
},
|
|
18
|
+
inputText: { fontSize: tok(t, 'typography-font-size-3') },
|
|
19
|
+
},
|
|
20
|
+
lg: {
|
|
21
|
+
fieldWrapper: {
|
|
22
|
+
minHeight: tok(t, 'tap-target-min'),
|
|
23
|
+
paddingHorizontal: tok(t, 'space-5'),
|
|
24
|
+
paddingVertical: tok(t, 'space-3'),
|
|
25
|
+
},
|
|
26
|
+
inputText: { fontSize: tok(t, 'typography-font-size-4') },
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
export const getInputParts = (t, opts = {}) => {
|
|
30
|
+
const size = opts.size ?? 'md';
|
|
31
|
+
const isDisabled = Boolean(opts.disabled);
|
|
32
|
+
const isError = Boolean(opts.error);
|
|
33
|
+
const isFocused = Boolean(opts.focused);
|
|
34
|
+
const s = sizeStyles(t)[size];
|
|
35
|
+
const base = {
|
|
36
|
+
label: {
|
|
37
|
+
marginBottom: tok(t, 'space-1'),
|
|
38
|
+
color: tok(t, 'color-fg-muted'),
|
|
39
|
+
fontFamily: tok(t, 'typography-font-family-base'),
|
|
40
|
+
fontSize: tok(t, 'typography-font-size-2'),
|
|
41
|
+
fontWeight: tok(t, 'typography-font-weight-medium'),
|
|
42
|
+
lineHeight: tok(t, 'typography-line-height-default'),
|
|
43
|
+
},
|
|
44
|
+
fieldWrapper: merge({
|
|
45
|
+
backgroundColor: tok(t, 'color-input-bg'),
|
|
46
|
+
borderColor: tok(t, 'color-input-border'),
|
|
47
|
+
borderWidth: tok(t, 'border-width-default'),
|
|
48
|
+
borderRadius: tok(t, 'radius-2'),
|
|
49
|
+
justifyContent: 'center',
|
|
50
|
+
}, s.fieldWrapper),
|
|
51
|
+
inputText: merge({
|
|
52
|
+
color: tok(t, 'color-fg-default'),
|
|
53
|
+
fontFamily: tok(t, 'typography-font-family-base'),
|
|
54
|
+
lineHeight: tok(t, 'typography-line-height-default'),
|
|
55
|
+
}, s.inputText),
|
|
56
|
+
placeholder: {
|
|
57
|
+
color: tok(t, 'color-input-placeholder'),
|
|
58
|
+
},
|
|
59
|
+
helper: {
|
|
60
|
+
marginTop: tok(t, 'space-1'),
|
|
61
|
+
color: tok(t, 'color-fg-subtle'),
|
|
62
|
+
fontFamily: tok(t, 'typography-font-family-base'),
|
|
63
|
+
fontSize: tok(t, 'typography-font-size-1'),
|
|
64
|
+
lineHeight: tok(t, 'typography-line-height-default'),
|
|
65
|
+
},
|
|
66
|
+
focusRing: {
|
|
67
|
+
outlineStyle: 'solid',
|
|
68
|
+
outlineWidth: tok(t, 'border-width-focus'),
|
|
69
|
+
outlineColor: tok(t, 'color-focus-ring'),
|
|
70
|
+
outlineOffset: tok(t, 'focus-ring-gap'),
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
const focused = {
|
|
74
|
+
fieldWrapper: { borderColor: tok(t, 'color-input-border-focus') },
|
|
75
|
+
};
|
|
76
|
+
const error = {
|
|
77
|
+
fieldWrapper: { borderColor: tok(t, 'color-status-error') },
|
|
78
|
+
helper: { color: tok(t, 'color-status-error') },
|
|
79
|
+
};
|
|
80
|
+
const disabled = {
|
|
81
|
+
fieldWrapper: {
|
|
82
|
+
backgroundColor: tok(t, 'color-state-disabled-bg'),
|
|
83
|
+
borderColor: tok(t, 'color-state-disabled-bg'),
|
|
84
|
+
},
|
|
85
|
+
label: { color: tok(t, 'color-state-disabled-fg') },
|
|
86
|
+
inputText: { color: tok(t, 'color-state-disabled-fg') },
|
|
87
|
+
helper: { color: tok(t, 'color-state-disabled-fg') },
|
|
88
|
+
};
|
|
89
|
+
return {
|
|
90
|
+
label: merge(base.label, isDisabled && disabled.label),
|
|
91
|
+
fieldWrapper: merge(base.fieldWrapper, isFocused && focused.fieldWrapper, isError && error.fieldWrapper, isDisabled && disabled.fieldWrapper),
|
|
92
|
+
inputText: merge(base.inputText, isDisabled && disabled.inputText),
|
|
93
|
+
placeholder: merge(base.placeholder),
|
|
94
|
+
helper: merge(base.helper, isError && error.helper, isDisabled && disabled.helper),
|
|
95
|
+
focusRing: merge(isFocused ? base.focusRing : undefined),
|
|
96
|
+
};
|
|
97
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// styles/listItems.ts
|
|
2
|
+
import { merge, tok, } from '../types/tokens';
|
|
3
|
+
export const getListItemParts = (t, s = {}) => {
|
|
4
|
+
const disabled = Boolean(s.disabled);
|
|
5
|
+
const base = {
|
|
6
|
+
container: {
|
|
7
|
+
minHeight: tok(t, 'tap-target-min'),
|
|
8
|
+
paddingVertical: tok(t, 'space-2'),
|
|
9
|
+
paddingHorizontal: tok(t, 'space-4'),
|
|
10
|
+
flexDirection: 'row',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
gap: tok(t, 'space-3'),
|
|
13
|
+
borderRadius: tok(t, 'radius-3'),
|
|
14
|
+
},
|
|
15
|
+
left: {
|
|
16
|
+
width: tok(t, 'tap-target-min'),
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
},
|
|
20
|
+
content: { flex: 1, gap: tok(t, 'space-1') },
|
|
21
|
+
right: {
|
|
22
|
+
minWidth: tok(t, 'tap-target-min'),
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
},
|
|
26
|
+
title: {
|
|
27
|
+
color: tok(t, 'color-fg-default'),
|
|
28
|
+
fontFamily: tok(t, 'typography-font-family-base'),
|
|
29
|
+
fontSize: tok(t, 'typography-font-size-3'),
|
|
30
|
+
fontWeight: tok(t, 'typography-font-weight-medium'),
|
|
31
|
+
lineHeight: tok(t, 'typography-line-height-default'),
|
|
32
|
+
},
|
|
33
|
+
subtitle: {
|
|
34
|
+
color: tok(t, 'color-fg-muted'),
|
|
35
|
+
fontFamily: tok(t, 'typography-font-family-base'),
|
|
36
|
+
fontSize: tok(t, 'typography-font-size-2'),
|
|
37
|
+
fontWeight: tok(t, 'typography-font-weight-regular'),
|
|
38
|
+
lineHeight: tok(t, 'typography-line-height-default'),
|
|
39
|
+
},
|
|
40
|
+
focusRing: {
|
|
41
|
+
outlineStyle: 'solid',
|
|
42
|
+
outlineWidth: tok(t, 'border-width-focus'),
|
|
43
|
+
outlineColor: tok(t, 'color-focus-ring'),
|
|
44
|
+
outlineOffset: tok(t, 'focus-ring-gap'),
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
const selected = { backgroundColor: tok(t, 'color-surface-alt') };
|
|
48
|
+
const hover = { backgroundColor: tok(t, 'color-bg-subtle') };
|
|
49
|
+
const pressed = { opacity: tok(t, 'opacity-pressed') };
|
|
50
|
+
const disabledS = { opacity: tok(t, 'opacity-disabled') };
|
|
51
|
+
const disabledText = { color: tok(t, 'color-state-disabled-fg') };
|
|
52
|
+
return {
|
|
53
|
+
container: merge(base.container, s.selected && selected, s.hovered && hover, s.pressed && pressed, disabled && disabledS),
|
|
54
|
+
left: base.left,
|
|
55
|
+
content: base.content,
|
|
56
|
+
right: base.right,
|
|
57
|
+
title: merge(base.title, disabled && disabledText),
|
|
58
|
+
subtitle: merge(base.subtitle, disabled && disabledText),
|
|
59
|
+
focusRing: merge(s.focusVisible ? base.focusRing : undefined),
|
|
60
|
+
};
|
|
61
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// styles/modals.ts
|
|
2
|
+
import { merge, motion, tok, } from '../types/tokens';
|
|
3
|
+
export const getModalParts = (t, opts) => {
|
|
4
|
+
const enter = motion(t, 'motion-emphasis-enter');
|
|
5
|
+
const exit = motion(t, 'motion-emphasis-exit');
|
|
6
|
+
const base = {
|
|
7
|
+
backdrop: {
|
|
8
|
+
position: 'absolute',
|
|
9
|
+
inset: 0,
|
|
10
|
+
backgroundColor: tok(t, 'color-overlay-backdrop'),
|
|
11
|
+
zIndex: tok(t, 'z-index-layer-overlay'),
|
|
12
|
+
},
|
|
13
|
+
container: {
|
|
14
|
+
position: 'absolute',
|
|
15
|
+
inset: 0,
|
|
16
|
+
alignItems: 'center',
|
|
17
|
+
justifyContent: 'center',
|
|
18
|
+
padding: tok(t, 'space-4'),
|
|
19
|
+
zIndex: tok(t, 'z-index-layer-modal'),
|
|
20
|
+
},
|
|
21
|
+
surface: {
|
|
22
|
+
width: '100%',
|
|
23
|
+
backgroundColor: tok(t, 'color-surface'),
|
|
24
|
+
borderRadius: tok(t, 'radius-4'),
|
|
25
|
+
borderWidth: tok(t, 'border-width-default'),
|
|
26
|
+
borderColor: tok(t, 'color-border-subtle'),
|
|
27
|
+
shadow: tok(t, 'shadow-level-4'),
|
|
28
|
+
overflow: 'hidden',
|
|
29
|
+
// semântico (runtime aplica animação)
|
|
30
|
+
animationEnterDurationMs: enter.durationMs,
|
|
31
|
+
animationEnterEasing: enter.easing,
|
|
32
|
+
animationExitDurationMs: exit.durationMs,
|
|
33
|
+
animationExitEasing: exit.easing,
|
|
34
|
+
},
|
|
35
|
+
header: {
|
|
36
|
+
paddingHorizontal: tok(t, 'space-4'),
|
|
37
|
+
paddingTop: tok(t, 'space-4'),
|
|
38
|
+
paddingBottom: tok(t, 'space-2'),
|
|
39
|
+
borderBottomWidth: tok(t, 'border-width-default'),
|
|
40
|
+
borderBottomColor: tok(t, 'color-border-subtle'),
|
|
41
|
+
},
|
|
42
|
+
body: {
|
|
43
|
+
paddingHorizontal: tok(t, 'space-4'),
|
|
44
|
+
paddingVertical: tok(t, 'space-3'),
|
|
45
|
+
},
|
|
46
|
+
footer: {
|
|
47
|
+
paddingHorizontal: tok(t, 'space-4'),
|
|
48
|
+
paddingTop: tok(t, 'space-2'),
|
|
49
|
+
paddingBottom: tok(t, 'space-4'),
|
|
50
|
+
borderTopWidth: tok(t, 'border-width-default'),
|
|
51
|
+
borderTopColor: tok(t, 'color-border-subtle'),
|
|
52
|
+
flexDirection: 'row',
|
|
53
|
+
justifyContent: 'flex-end',
|
|
54
|
+
gap: tok(t, 'space-2'),
|
|
55
|
+
},
|
|
56
|
+
title: {
|
|
57
|
+
color: tok(t, 'color-fg-default'),
|
|
58
|
+
fontFamily: tok(t, 'typography-font-family-heading'),
|
|
59
|
+
fontSize: tok(t, 'typography-font-size-5'),
|
|
60
|
+
fontWeight: tok(t, 'typography-font-weight-strong'),
|
|
61
|
+
lineHeight: tok(t, 'typography-line-height-tight'),
|
|
62
|
+
},
|
|
63
|
+
subtitle: {
|
|
64
|
+
marginTop: tok(t, 'space-1'),
|
|
65
|
+
color: tok(t, 'color-fg-muted'),
|
|
66
|
+
fontFamily: tok(t, 'typography-font-family-base'),
|
|
67
|
+
fontSize: tok(t, 'typography-font-size-3'),
|
|
68
|
+
fontWeight: tok(t, 'typography-font-weight-regular'),
|
|
69
|
+
lineHeight: tok(t, 'typography-line-height-default'),
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
if (!opts?.dense)
|
|
73
|
+
return base;
|
|
74
|
+
return {
|
|
75
|
+
...base,
|
|
76
|
+
header: merge(base.header, {
|
|
77
|
+
paddingHorizontal: tok(t, 'space-3'),
|
|
78
|
+
paddingTop: tok(t, 'space-3'),
|
|
79
|
+
}),
|
|
80
|
+
body: merge(base.body, {
|
|
81
|
+
paddingHorizontal: tok(t, 'space-3'),
|
|
82
|
+
}),
|
|
83
|
+
footer: merge(base.footer, {
|
|
84
|
+
paddingHorizontal: tok(t, 'space-3'),
|
|
85
|
+
paddingBottom: tok(t, 'space-3'),
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// styles/pagination.ts
|
|
2
|
+
import { tok } from '../types/tokens';
|
|
3
|
+
export const getPaginationParts = (t) => ({
|
|
4
|
+
container: {
|
|
5
|
+
flexDirection: 'row',
|
|
6
|
+
alignItems: 'center',
|
|
7
|
+
justifyContent: 'space-between',
|
|
8
|
+
gap: tok(t, 'space-3'),
|
|
9
|
+
paddingVertical: tok(t, 'space-2'),
|
|
10
|
+
},
|
|
11
|
+
pageInfo: {
|
|
12
|
+
color: tok(t, 'color-fg-muted'),
|
|
13
|
+
fontFamily: tok(t, 'typography-font-family-base'),
|
|
14
|
+
fontSize: tok(t, 'typography-font-size-2'),
|
|
15
|
+
lineHeight: tok(t, 'typography-line-height-default'),
|
|
16
|
+
},
|
|
17
|
+
button: {
|
|
18
|
+
minHeight: tok(t, 'tap-target-min'),
|
|
19
|
+
minWidth: tok(t, 'tap-target-min'),
|
|
20
|
+
borderRadius: tok(t, 'radius-3'),
|
|
21
|
+
borderWidth: tok(t, 'border-width-default'),
|
|
22
|
+
borderColor: tok(t, 'color-border-subtle'),
|
|
23
|
+
backgroundColor: tok(t, 'color-surface'),
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
justifyContent: 'center',
|
|
26
|
+
paddingHorizontal: tok(t, 'space-3'),
|
|
27
|
+
},
|
|
28
|
+
buttonLabel: {
|
|
29
|
+
color: tok(t, 'color-fg-default'),
|
|
30
|
+
fontFamily: tok(t, 'typography-font-family-base'),
|
|
31
|
+
fontSize: tok(t, 'typography-font-size-2'),
|
|
32
|
+
fontWeight: tok(t, 'typography-font-weight-medium'),
|
|
33
|
+
lineHeight: tok(t, 'typography-line-height-default'),
|
|
34
|
+
},
|
|
35
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// styles/popovers.ts
|
|
2
|
+
import { motion, tok, } from '../types/tokens';
|
|
3
|
+
export const getPopoverParts = (t) => {
|
|
4
|
+
const m = motion(t, 'motion-emphasis-enter');
|
|
5
|
+
return {
|
|
6
|
+
container: {
|
|
7
|
+
zIndex: tok(t, 'z-index-layer-dropdown'),
|
|
8
|
+
backgroundColor: tok(t, 'color-surface'),
|
|
9
|
+
borderColor: tok(t, 'color-border-subtle'),
|
|
10
|
+
borderWidth: tok(t, 'border-width-default'),
|
|
11
|
+
borderRadius: tok(t, 'radius-4'),
|
|
12
|
+
shadow: tok(t, 'shadow-level-4'),
|
|
13
|
+
overflow: 'hidden',
|
|
14
|
+
minWidth: 240,
|
|
15
|
+
animationDurationMs: m.durationMs,
|
|
16
|
+
animationEasing: m.easing,
|
|
17
|
+
},
|
|
18
|
+
header: {
|
|
19
|
+
paddingHorizontal: tok(t, 'space-4'),
|
|
20
|
+
paddingTop: tok(t, 'space-4'),
|
|
21
|
+
paddingBottom: tok(t, 'space-2'),
|
|
22
|
+
borderBottomWidth: tok(t, 'border-width-default'),
|
|
23
|
+
borderBottomColor: tok(t, 'color-border-subtle'),
|
|
24
|
+
},
|
|
25
|
+
body: {
|
|
26
|
+
paddingHorizontal: tok(t, 'space-4'),
|
|
27
|
+
paddingVertical: tok(t, 'space-3'),
|
|
28
|
+
},
|
|
29
|
+
footer: {
|
|
30
|
+
paddingHorizontal: tok(t, 'space-4'),
|
|
31
|
+
paddingTop: tok(t, 'space-2'),
|
|
32
|
+
paddingBottom: tok(t, 'space-4'),
|
|
33
|
+
borderTopWidth: tok(t, 'border-width-default'),
|
|
34
|
+
borderTopColor: tok(t, 'color-border-subtle'),
|
|
35
|
+
},
|
|
36
|
+
title: {
|
|
37
|
+
color: tok(t, 'color-fg-default'),
|
|
38
|
+
fontFamily: tok(t, 'typography-font-family-heading'),
|
|
39
|
+
fontSize: tok(t, 'typography-font-size-3'),
|
|
40
|
+
fontWeight: tok(t, 'typography-font-weight-strong'),
|
|
41
|
+
lineHeight: tok(t, 'typography-line-height-tight'),
|
|
42
|
+
},
|
|
43
|
+
subtitle: {
|
|
44
|
+
marginTop: tok(t, 'space-1'),
|
|
45
|
+
color: tok(t, 'color-fg-muted'),
|
|
46
|
+
fontFamily: tok(t, 'typography-font-family-base'),
|
|
47
|
+
fontSize: tok(t, 'typography-font-size-2'),
|
|
48
|
+
fontWeight: tok(t, 'typography-font-weight-regular'),
|
|
49
|
+
lineHeight: tok(t, 'typography-line-height-default'),
|
|
50
|
+
},
|
|
51
|
+
arrow: {
|
|
52
|
+
width: tok(t, 'space-2'),
|
|
53
|
+
height: tok(t, 'space-2'),
|
|
54
|
+
backgroundColor: tok(t, 'color-surface'),
|
|
55
|
+
borderWidth: tok(t, 'border-width-default'),
|
|
56
|
+
borderColor: tok(t, 'color-border-subtle'),
|
|
57
|
+
transform: 'rotate(45deg)',
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// styles/progress.ts
|
|
2
|
+
import { tok } from '../types/tokens';
|
|
3
|
+
export const getProgressParts = (t) => ({
|
|
4
|
+
track: {
|
|
5
|
+
backgroundColor: tok(t, 'color-bg-subtle'),
|
|
6
|
+
borderRadius: tok(t, 'radius-full'),
|
|
7
|
+
overflow: 'hidden',
|
|
8
|
+
},
|
|
9
|
+
fill: {
|
|
10
|
+
backgroundColor: tok(t, 'color-action-primary'),
|
|
11
|
+
borderRadius: tok(t, 'radius-full'),
|
|
12
|
+
},
|
|
13
|
+
label: {
|
|
14
|
+
color: tok(t, 'color-fg-muted'),
|
|
15
|
+
fontFamily: tok(t, 'typography-font-family-base'),
|
|
16
|
+
fontSize: tok(t, 'typography-font-size-2'),
|
|
17
|
+
lineHeight: tok(t, 'typography-line-height-default'),
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
// Helpers semânticos para tamanhos
|
|
21
|
+
export const getLinearProgressStyle = (t, heightToken = 'space-2') => ({
|
|
22
|
+
height: tok(t, heightToken),
|
|
23
|
+
});
|
|
24
|
+
export const getCircularProgressStyle = (t, size) => ({
|
|
25
|
+
width: size,
|
|
26
|
+
height: size,
|
|
27
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// styles/radios.ts
|
|
2
|
+
import { merge, tok, } from '../types/tokens';
|
|
3
|
+
export const getRadioParts = (t, s = {}) => {
|
|
4
|
+
const isOn = Boolean(s.selected);
|
|
5
|
+
const isDisabled = Boolean(s.disabled);
|
|
6
|
+
const wrapper = {
|
|
7
|
+
minHeight: tok(t, 'tap-target-min'),
|
|
8
|
+
paddingVertical: tok(t, 'space-2'),
|
|
9
|
+
paddingHorizontal: tok(t, 'space-2'),
|
|
10
|
+
flexDirection: 'row',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
gap: tok(t, 'space-2'),
|
|
13
|
+
};
|
|
14
|
+
const outerBase = {
|
|
15
|
+
width: tok(t, 'typography-font-size-5'),
|
|
16
|
+
height: tok(t, 'typography-font-size-5'),
|
|
17
|
+
borderRadius: tok(t, 'radius-full'),
|
|
18
|
+
borderWidth: tok(t, 'border-width-default'),
|
|
19
|
+
borderColor: tok(t, 'color-border-strong'),
|
|
20
|
+
backgroundColor: tok(t, 'color-surface'),
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
justifyContent: 'center',
|
|
23
|
+
};
|
|
24
|
+
const outerOn = {
|
|
25
|
+
borderColor: tok(t, 'color-accent'),
|
|
26
|
+
};
|
|
27
|
+
const outerDisabled = {
|
|
28
|
+
borderColor: tok(t, 'color-state-disabled-bg'),
|
|
29
|
+
backgroundColor: tok(t, 'color-state-disabled-bg'),
|
|
30
|
+
};
|
|
31
|
+
const inner = {
|
|
32
|
+
width: tok(t, 'space-2'),
|
|
33
|
+
height: tok(t, 'space-2'),
|
|
34
|
+
borderRadius: tok(t, 'radius-full'),
|
|
35
|
+
backgroundColor: isDisabled
|
|
36
|
+
? tok(t, 'color-state-disabled-fg')
|
|
37
|
+
: tok(t, 'color-accent'),
|
|
38
|
+
opacity: isOn ? 1 : 0,
|
|
39
|
+
};
|
|
40
|
+
const label = {
|
|
41
|
+
color: isDisabled
|
|
42
|
+
? tok(t, 'color-state-disabled-fg')
|
|
43
|
+
: tok(t, 'color-fg-default'),
|
|
44
|
+
fontFamily: tok(t, 'typography-font-family-base'),
|
|
45
|
+
fontSize: tok(t, 'typography-font-size-3'),
|
|
46
|
+
lineHeight: tok(t, 'typography-line-height-default'),
|
|
47
|
+
};
|
|
48
|
+
const focusRing = {
|
|
49
|
+
outlineStyle: 'solid',
|
|
50
|
+
outlineWidth: tok(t, 'border-width-focus'),
|
|
51
|
+
outlineColor: tok(t, 'color-focus-ring'),
|
|
52
|
+
outlineOffset: tok(t, 'focus-ring-gap'),
|
|
53
|
+
};
|
|
54
|
+
const interaction = s.pressed
|
|
55
|
+
? { opacity: tok(t, 'opacity-pressed') }
|
|
56
|
+
: s.hovered
|
|
57
|
+
? { opacity: 0.96 }
|
|
58
|
+
: {};
|
|
59
|
+
return {
|
|
60
|
+
wrapper: merge(wrapper, interaction),
|
|
61
|
+
outer: merge(outerBase, isOn && outerOn, isDisabled && outerDisabled),
|
|
62
|
+
inner: merge(inner),
|
|
63
|
+
label: merge(label),
|
|
64
|
+
focusRing: merge(s.focusVisible ? focusRing : undefined),
|
|
65
|
+
};
|
|
66
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// styles/selects.ts
|
|
2
|
+
import { merge, tok, } from '../types/tokens';
|
|
3
|
+
const sizeStyles = (t) => ({
|
|
4
|
+
sm: {
|
|
5
|
+
trigger: {
|
|
6
|
+
minHeight: tok(t, 'tap-target-min'),
|
|
7
|
+
paddingHorizontal: tok(t, 'space-3'),
|
|
8
|
+
paddingVertical: tok(t, 'space-2'),
|
|
9
|
+
},
|
|
10
|
+
valueText: { fontSize: tok(t, 'typography-font-size-2') },
|
|
11
|
+
},
|
|
12
|
+
md: {
|
|
13
|
+
trigger: {
|
|
14
|
+
minHeight: tok(t, 'tap-target-min'),
|
|
15
|
+
paddingHorizontal: tok(t, 'space-4'),
|
|
16
|
+
paddingVertical: tok(t, 'space-2'),
|
|
17
|
+
},
|
|
18
|
+
valueText: { fontSize: tok(t, 'typography-font-size-3') },
|
|
19
|
+
},
|
|
20
|
+
lg: {
|
|
21
|
+
trigger: {
|
|
22
|
+
minHeight: tok(t, 'tap-target-min'),
|
|
23
|
+
paddingHorizontal: tok(t, 'space-5'),
|
|
24
|
+
paddingVertical: tok(t, 'space-3'),
|
|
25
|
+
},
|
|
26
|
+
valueText: { fontSize: tok(t, 'typography-font-size-4') },
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
export const getSelectParts = (t, opts = {}) => {
|
|
30
|
+
const size = opts.size ?? 'md';
|
|
31
|
+
const isDisabled = Boolean(opts.disabled);
|
|
32
|
+
const isError = Boolean(opts.error);
|
|
33
|
+
const isFocused = Boolean(opts.focused);
|
|
34
|
+
const isOpen = Boolean(opts.open);
|
|
35
|
+
const s = sizeStyles(t)[size];
|
|
36
|
+
const label = {
|
|
37
|
+
marginBottom: tok(t, 'space-1'),
|
|
38
|
+
color: tok(t, 'color-fg-muted'),
|
|
39
|
+
fontFamily: tok(t, 'typography-font-family-base'),
|
|
40
|
+
fontSize: tok(t, 'typography-font-size-2'),
|
|
41
|
+
fontWeight: tok(t, 'typography-font-weight-medium'),
|
|
42
|
+
lineHeight: tok(t, 'typography-line-height-default'),
|
|
43
|
+
};
|
|
44
|
+
const triggerBase = {
|
|
45
|
+
backgroundColor: tok(t, 'color-input-bg'),
|
|
46
|
+
borderColor: tok(t, 'color-input-border'),
|
|
47
|
+
borderWidth: tok(t, 'border-width-default'),
|
|
48
|
+
borderRadius: tok(t, 'radius-2'),
|
|
49
|
+
flexDirection: 'row',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
justifyContent: 'space-between',
|
|
52
|
+
gap: tok(t, 'space-2'),
|
|
53
|
+
};
|
|
54
|
+
const valueText = merge({
|
|
55
|
+
color: tok(t, 'color-fg-default'),
|
|
56
|
+
fontFamily: tok(t, 'typography-font-family-base'),
|
|
57
|
+
lineHeight: tok(t, 'typography-line-height-default'),
|
|
58
|
+
flex: 1,
|
|
59
|
+
}, s.valueText);
|
|
60
|
+
const placeholder = { color: tok(t, 'color-input-placeholder') };
|
|
61
|
+
const helper = {
|
|
62
|
+
marginTop: tok(t, 'space-1'),
|
|
63
|
+
color: isError ? tok(t, 'color-status-error') : tok(t, 'color-fg-subtle'),
|
|
64
|
+
fontFamily: tok(t, 'typography-font-family-base'),
|
|
65
|
+
fontSize: tok(t, 'typography-font-size-1'),
|
|
66
|
+
lineHeight: tok(t, 'typography-line-height-default'),
|
|
67
|
+
};
|
|
68
|
+
const focusRing = {
|
|
69
|
+
outlineStyle: 'solid',
|
|
70
|
+
outlineWidth: tok(t, 'border-width-focus'),
|
|
71
|
+
outlineColor: tok(t, 'color-focus-ring'),
|
|
72
|
+
outlineOffset: tok(t, 'focus-ring-gap'),
|
|
73
|
+
};
|
|
74
|
+
const triggerFocused = {
|
|
75
|
+
borderColor: tok(t, 'color-input-border-focus'),
|
|
76
|
+
};
|
|
77
|
+
const triggerError = { borderColor: tok(t, 'color-status-error') };
|
|
78
|
+
const triggerDisabled = {
|
|
79
|
+
backgroundColor: tok(t, 'color-state-disabled-bg'),
|
|
80
|
+
borderColor: tok(t, 'color-state-disabled-bg'),
|
|
81
|
+
};
|
|
82
|
+
const textDisabled = { color: tok(t, 'color-state-disabled-fg') };
|
|
83
|
+
const rightIcon = {
|
|
84
|
+
width: tok(t, 'typography-font-size-4'),
|
|
85
|
+
height: tok(t, 'typography-font-size-4'),
|
|
86
|
+
color: isDisabled
|
|
87
|
+
? tok(t, 'color-state-disabled-fg')
|
|
88
|
+
: tok(t, 'color-fg-muted'),
|
|
89
|
+
};
|
|
90
|
+
// Dropdown menu
|
|
91
|
+
const dropdown = {
|
|
92
|
+
zIndex: tok(t, 'z-index-layer-dropdown'),
|
|
93
|
+
backgroundColor: tok(t, 'color-surface'),
|
|
94
|
+
borderColor: tok(t, 'color-border-subtle'),
|
|
95
|
+
borderWidth: tok(t, 'border-width-default'),
|
|
96
|
+
borderRadius: tok(t, 'radius-3'),
|
|
97
|
+
shadow: tok(t, 'shadow-level-3'),
|
|
98
|
+
paddingVertical: tok(t, 'space-2'),
|
|
99
|
+
overflow: 'hidden',
|
|
100
|
+
display: isOpen ? 'flex' : 'none',
|
|
101
|
+
};
|
|
102
|
+
const item = {
|
|
103
|
+
minHeight: tok(t, 'tap-target-min'),
|
|
104
|
+
paddingHorizontal: tok(t, 'space-4'),
|
|
105
|
+
paddingVertical: tok(t, 'space-2'),
|
|
106
|
+
flexDirection: 'row',
|
|
107
|
+
alignItems: 'center',
|
|
108
|
+
justifyContent: 'space-between',
|
|
109
|
+
gap: tok(t, 'space-2'),
|
|
110
|
+
};
|
|
111
|
+
const itemLabel = {
|
|
112
|
+
color: tok(t, 'color-fg-default'),
|
|
113
|
+
fontFamily: tok(t, 'typography-font-family-base'),
|
|
114
|
+
fontSize: tok(t, 'typography-font-size-3'),
|
|
115
|
+
lineHeight: tok(t, 'typography-line-height-default'),
|
|
116
|
+
};
|
|
117
|
+
const itemSelected = {
|
|
118
|
+
backgroundColor: tok(t, 'color-surface-alt'),
|
|
119
|
+
};
|
|
120
|
+
return {
|
|
121
|
+
label,
|
|
122
|
+
trigger: merge(triggerBase, s.trigger, isFocused && triggerFocused, isError && triggerError, isDisabled && triggerDisabled),
|
|
123
|
+
valueText: merge(valueText, isDisabled && textDisabled),
|
|
124
|
+
placeholder: merge(placeholder),
|
|
125
|
+
helper,
|
|
126
|
+
rightIcon,
|
|
127
|
+
focusRing: merge(isFocused ? focusRing : undefined),
|
|
128
|
+
dropdown,
|
|
129
|
+
item,
|
|
130
|
+
itemLabel,
|
|
131
|
+
itemSelected,
|
|
132
|
+
};
|
|
133
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// styles/skeleton.ts
|
|
2
|
+
import { merge, motion, tok, } from '../types/tokens';
|
|
3
|
+
export const getSkeletonParts = (t) => {
|
|
4
|
+
const m = motion(t, 'micro-interaction');
|
|
5
|
+
return {
|
|
6
|
+
base: {
|
|
7
|
+
backgroundColor: tok(t, 'color-bg-subtle'),
|
|
8
|
+
overflow: 'hidden',
|
|
9
|
+
},
|
|
10
|
+
animation: {
|
|
11
|
+
animationPreset: 'micro-interaction',
|
|
12
|
+
animationDurationMs: m.durationMs,
|
|
13
|
+
animationEasing: m.easing,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export const getSkeletonStyle = (t, opts = {}) => {
|
|
18
|
+
const variant = opts.variant ?? 'rect';
|
|
19
|
+
const radiusByVariant = {
|
|
20
|
+
text: { borderRadius: tok(t, 'radius-2') },
|
|
21
|
+
rect: { borderRadius: tok(t, 'radius-3') },
|
|
22
|
+
circle: { borderRadius: tok(t, 'radius-full') },
|
|
23
|
+
};
|
|
24
|
+
return merge(getSkeletonParts(t).base, radiusByVariant[variant], {
|
|
25
|
+
width: opts.width ?? '100%',
|
|
26
|
+
height: opts.height ??
|
|
27
|
+
(variant === 'text' ? tok(t, 'space-3') : tok(t, 'tap-target-min')),
|
|
28
|
+
}, getSkeletonParts(t).animation);
|
|
29
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// styles/steppers.ts
|
|
2
|
+
import { merge, tok, } from '../types/tokens';
|
|
3
|
+
export const getStepperParts = (t) => ({
|
|
4
|
+
container: {
|
|
5
|
+
flexDirection: 'row',
|
|
6
|
+
alignItems: 'center',
|
|
7
|
+
gap: tok(t, 'space-3'),
|
|
8
|
+
},
|
|
9
|
+
step: { flexDirection: 'column', gap: tok(t, 'space-1') },
|
|
10
|
+
bullet: {
|
|
11
|
+
width: tok(t, 'space-4'),
|
|
12
|
+
height: tok(t, 'space-4'),
|
|
13
|
+
borderRadius: tok(t, 'radius-full'),
|
|
14
|
+
borderWidth: tok(t, 'border-width-default'),
|
|
15
|
+
borderColor: tok(t, 'color-border-strong'),
|
|
16
|
+
backgroundColor: tok(t, 'color-surface'),
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
},
|
|
20
|
+
line: {
|
|
21
|
+
height: tok(t, 'border-width-default'),
|
|
22
|
+
flex: 1,
|
|
23
|
+
backgroundColor: tok(t, 'color-border-subtle'),
|
|
24
|
+
},
|
|
25
|
+
label: {
|
|
26
|
+
color: tok(t, 'color-fg-default'),
|
|
27
|
+
fontFamily: tok(t, 'typography-font-family-base'),
|
|
28
|
+
fontSize: tok(t, 'typography-font-size-2'),
|
|
29
|
+
fontWeight: tok(t, 'typography-font-weight-medium'),
|
|
30
|
+
lineHeight: tok(t, 'typography-line-height-default'),
|
|
31
|
+
},
|
|
32
|
+
subtitle: {
|
|
33
|
+
color: tok(t, 'color-fg-muted'),
|
|
34
|
+
fontFamily: tok(t, 'typography-font-family-base'),
|
|
35
|
+
fontSize: tok(t, 'typography-font-size-1'),
|
|
36
|
+
fontWeight: tok(t, 'typography-font-weight-regular'),
|
|
37
|
+
lineHeight: tok(t, 'typography-line-height-default'),
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
export const getStepVisual = (t, s = {}) => {
|
|
41
|
+
const completed = Boolean(s.completed);
|
|
42
|
+
const active = Boolean(s.active);
|
|
43
|
+
const disabled = Boolean(s.disabled);
|
|
44
|
+
const bulletCompleted = {
|
|
45
|
+
backgroundColor: tok(t, 'color-status-success'),
|
|
46
|
+
borderColor: tok(t, 'color-status-success'),
|
|
47
|
+
};
|
|
48
|
+
const bulletActive = {
|
|
49
|
+
backgroundColor: tok(t, 'color-action-primary'),
|
|
50
|
+
borderColor: tok(t, 'color-action-primary'),
|
|
51
|
+
};
|
|
52
|
+
const bulletDisabled = {
|
|
53
|
+
backgroundColor: tok(t, 'color-state-disabled-bg'),
|
|
54
|
+
borderColor: tok(t, 'color-state-disabled-bg'),
|
|
55
|
+
};
|
|
56
|
+
const lineCompleted = {
|
|
57
|
+
backgroundColor: tok(t, 'color-status-success'),
|
|
58
|
+
};
|
|
59
|
+
const lineActive = { backgroundColor: tok(t, 'color-action-primary') };
|
|
60
|
+
const labelDisabled = { color: tok(t, 'color-state-disabled-fg') };
|
|
61
|
+
return {
|
|
62
|
+
bullet: merge(getStepperParts(t).bullet, completed && bulletCompleted, active && bulletActive, disabled && bulletDisabled),
|
|
63
|
+
line: merge(getStepperParts(t).line, completed && lineCompleted, active && lineActive),
|
|
64
|
+
label: merge(getStepperParts(t).label, disabled && labelDisabled),
|
|
65
|
+
};
|
|
66
|
+
};
|