@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.
Files changed (145) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +325 -0
  3. package/dist/cjs/helpers/a11y.js +176 -0
  4. package/dist/cjs/helpers/index.js +18 -0
  5. package/dist/cjs/helpers/styles.js +172 -0
  6. package/dist/cjs/index.js +19 -0
  7. package/dist/cjs/styles/avatars.js +63 -0
  8. package/dist/cjs/styles/badges.js +59 -0
  9. package/dist/cjs/styles/bottomSheets.js +76 -0
  10. package/dist/cjs/styles/buttons.js +129 -0
  11. package/dist/cjs/styles/cards.js +71 -0
  12. package/dist/cjs/styles/checkboxes.js +70 -0
  13. package/dist/cjs/styles/chips.js +98 -0
  14. package/dist/cjs/styles/datePickers.js +113 -0
  15. package/dist/cjs/styles/dividers.js +12 -0
  16. package/dist/cjs/styles/emptyStates.js +40 -0
  17. package/dist/cjs/styles/forms.js +32 -0
  18. package/dist/cjs/styles/headers.js +46 -0
  19. package/dist/cjs/styles/index.js +43 -0
  20. package/dist/cjs/styles/inputs.js +101 -0
  21. package/dist/cjs/styles/listItems.js +65 -0
  22. package/dist/cjs/styles/modals.js +92 -0
  23. package/dist/cjs/styles/pagination.js +39 -0
  24. package/dist/cjs/styles/popovers.js +64 -0
  25. package/dist/cjs/styles/progress.js +33 -0
  26. package/dist/cjs/styles/radios.js +70 -0
  27. package/dist/cjs/styles/selects.js +137 -0
  28. package/dist/cjs/styles/skeletons.js +34 -0
  29. package/dist/cjs/styles/steppers.js +71 -0
  30. package/dist/cjs/styles/switches.js +76 -0
  31. package/dist/cjs/styles/tables.js +57 -0
  32. package/dist/cjs/styles/tabs.js +71 -0
  33. package/dist/cjs/styles/toasts.js +82 -0
  34. package/dist/cjs/styles/tooltips.js +46 -0
  35. package/dist/cjs/types/index.js +18 -0
  36. package/dist/cjs/types/states.js +8 -0
  37. package/dist/cjs/types/tokens.js +18 -0
  38. package/dist/esm/helpers/a11y.js +169 -0
  39. package/dist/esm/helpers/index.js +2 -0
  40. package/dist/esm/helpers/styles.js +158 -0
  41. package/dist/esm/index.js +3 -0
  42. package/dist/esm/styles/avatars.js +59 -0
  43. package/dist/esm/styles/badges.js +55 -0
  44. package/dist/esm/styles/bottomSheets.js +72 -0
  45. package/dist/esm/styles/buttons.js +125 -0
  46. package/dist/esm/styles/cards.js +67 -0
  47. package/dist/esm/styles/checkboxes.js +66 -0
  48. package/dist/esm/styles/chips.js +94 -0
  49. package/dist/esm/styles/datePickers.js +108 -0
  50. package/dist/esm/styles/dividers.js +8 -0
  51. package/dist/esm/styles/emptyStates.js +36 -0
  52. package/dist/esm/styles/forms.js +28 -0
  53. package/dist/esm/styles/headers.js +42 -0
  54. package/dist/esm/styles/index.js +27 -0
  55. package/dist/esm/styles/inputs.js +97 -0
  56. package/dist/esm/styles/listItems.js +61 -0
  57. package/dist/esm/styles/modals.js +88 -0
  58. package/dist/esm/styles/pagination.js +35 -0
  59. package/dist/esm/styles/popovers.js +60 -0
  60. package/dist/esm/styles/progress.js +27 -0
  61. package/dist/esm/styles/radios.js +66 -0
  62. package/dist/esm/styles/selects.js +133 -0
  63. package/dist/esm/styles/skeletons.js +29 -0
  64. package/dist/esm/styles/steppers.js +66 -0
  65. package/dist/esm/styles/switches.js +72 -0
  66. package/dist/esm/styles/tables.js +53 -0
  67. package/dist/esm/styles/tabs.js +66 -0
  68. package/dist/esm/styles/toasts.js +77 -0
  69. package/dist/esm/styles/tooltips.js +42 -0
  70. package/dist/esm/types/index.js +2 -0
  71. package/dist/esm/types/states.js +3 -0
  72. package/dist/esm/types/tokens.js +12 -0
  73. package/dist/tsconfig.cjs.tsbuildinfo +1 -0
  74. package/dist/tsconfig.esm.tsbuildinfo +1 -0
  75. package/dist/types/helpers/a11y.d.ts +20 -0
  76. package/dist/types/helpers/a11y.d.ts.map +1 -0
  77. package/dist/types/helpers/index.d.ts +3 -0
  78. package/dist/types/helpers/index.d.ts.map +1 -0
  79. package/dist/types/helpers/styles.d.ts +31 -0
  80. package/dist/types/helpers/styles.d.ts.map +1 -0
  81. package/dist/types/index.d.ts +4 -0
  82. package/dist/types/index.d.ts.map +1 -0
  83. package/dist/types/styles/avatars.d.ts +10 -0
  84. package/dist/types/styles/avatars.d.ts.map +1 -0
  85. package/dist/types/styles/badges.d.ts +8 -0
  86. package/dist/types/styles/badges.d.ts.map +1 -0
  87. package/dist/types/styles/bottomSheets.d.ts +15 -0
  88. package/dist/types/styles/bottomSheets.d.ts.map +1 -0
  89. package/dist/types/styles/buttons.d.ts +22 -0
  90. package/dist/types/styles/buttons.d.ts.map +1 -0
  91. package/dist/types/styles/cards.d.ts +18 -0
  92. package/dist/types/styles/cards.d.ts.map +1 -0
  93. package/dist/types/styles/checkboxes.d.ts +18 -0
  94. package/dist/types/styles/checkboxes.d.ts.map +1 -0
  95. package/dist/types/styles/chips.d.ts +20 -0
  96. package/dist/types/styles/chips.d.ts.map +1 -0
  97. package/dist/types/styles/datePickers.d.ts +30 -0
  98. package/dist/types/styles/datePickers.d.ts.map +1 -0
  99. package/dist/types/styles/dividers.d.ts +4 -0
  100. package/dist/types/styles/dividers.d.ts.map +1 -0
  101. package/dist/types/styles/emptyStates.d.ts +10 -0
  102. package/dist/types/styles/emptyStates.d.ts.map +1 -0
  103. package/dist/types/styles/forms.d.ts +10 -0
  104. package/dist/types/styles/forms.d.ts.map +1 -0
  105. package/dist/types/styles/headers.d.ts +11 -0
  106. package/dist/types/styles/headers.d.ts.map +1 -0
  107. package/dist/types/styles/index.d.ts +28 -0
  108. package/dist/types/styles/index.d.ts.map +1 -0
  109. package/dist/types/styles/inputs.d.ts +19 -0
  110. package/dist/types/styles/inputs.d.ts.map +1 -0
  111. package/dist/types/styles/listItems.d.ts +19 -0
  112. package/dist/types/styles/listItems.d.ts.map +1 -0
  113. package/dist/types/styles/modals.d.ts +15 -0
  114. package/dist/types/styles/modals.d.ts.map +1 -0
  115. package/dist/types/styles/pagination.d.ts +9 -0
  116. package/dist/types/styles/pagination.d.ts.map +1 -0
  117. package/dist/types/styles/popovers.d.ts +12 -0
  118. package/dist/types/styles/popovers.d.ts.map +1 -0
  119. package/dist/types/styles/progress.d.ts +11 -0
  120. package/dist/types/styles/progress.d.ts.map +1 -0
  121. package/dist/types/styles/radios.d.ts +17 -0
  122. package/dist/types/styles/radios.d.ts.map +1 -0
  123. package/dist/types/styles/selects.d.ts +25 -0
  124. package/dist/types/styles/selects.d.ts.map +1 -0
  125. package/dist/types/styles/skeletons.d.ts +13 -0
  126. package/dist/types/styles/skeletons.d.ts.map +1 -0
  127. package/dist/types/styles/steppers.d.ts +21 -0
  128. package/dist/types/styles/steppers.d.ts.map +1 -0
  129. package/dist/types/styles/switches.d.ts +17 -0
  130. package/dist/types/styles/switches.d.ts.map +1 -0
  131. package/dist/types/styles/tables.d.ts +13 -0
  132. package/dist/types/styles/tables.d.ts.map +1 -0
  133. package/dist/types/styles/tabs.d.ts +19 -0
  134. package/dist/types/styles/tabs.d.ts.map +1 -0
  135. package/dist/types/styles/toasts.d.ts +13 -0
  136. package/dist/types/styles/toasts.d.ts.map +1 -0
  137. package/dist/types/styles/tooltips.d.ts +9 -0
  138. package/dist/types/styles/tooltips.d.ts.map +1 -0
  139. package/dist/types/types/index.d.ts +3 -0
  140. package/dist/types/types/index.d.ts.map +1 -0
  141. package/dist/types/types/states.d.ts +26 -0
  142. package/dist/types/types/states.d.ts.map +1 -0
  143. package/dist/types/types/tokens.d.ts +16 -0
  144. package/dist/types/types/tokens.d.ts.map +1 -0
  145. package/package.json +73 -0
@@ -0,0 +1,72 @@
1
+ // styles/bottomSheets.ts
2
+ import { merge, motion, tok, } from '../types/tokens';
3
+ export const getBottomSheetParts = (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
+ justifyContent: 'flex-end',
17
+ zIndex: tok(t, 'z-index-layer-modal'),
18
+ },
19
+ surface: {
20
+ backgroundColor: tok(t, 'color-surface'),
21
+ borderTopLeftRadius: tok(t, 'radius-4'),
22
+ borderTopRightRadius: tok(t, 'radius-4'),
23
+ borderWidth: tok(t, 'border-width-default'),
24
+ borderColor: tok(t, 'color-border-subtle'),
25
+ shadow: tok(t, 'shadow-level-4'),
26
+ paddingBottom: tok(t, 'space-4'),
27
+ overflow: 'hidden',
28
+ // semântico (runtime anima slide-up/down)
29
+ animationEnterDurationMs: enter.durationMs,
30
+ animationEnterEasing: enter.easing,
31
+ animationExitDurationMs: exit.durationMs,
32
+ animationExitEasing: exit.easing,
33
+ },
34
+ handle: {
35
+ alignSelf: 'center',
36
+ width: tok(t, 'space-6'),
37
+ height: tok(t, 'space-1'),
38
+ borderRadius: tok(t, 'radius-full'),
39
+ backgroundColor: tok(t, 'color-border-subtle'),
40
+ marginTop: tok(t, 'space-2'),
41
+ marginBottom: tok(t, 'space-2'),
42
+ },
43
+ header: {
44
+ paddingHorizontal: tok(t, 'space-4'),
45
+ paddingBottom: tok(t, 'space-2'),
46
+ },
47
+ body: {
48
+ paddingHorizontal: tok(t, 'space-4'),
49
+ paddingVertical: tok(t, 'space-3'),
50
+ },
51
+ footer: {
52
+ paddingHorizontal: tok(t, 'space-4'),
53
+ paddingTop: tok(t, 'space-2'),
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-4'),
60
+ fontWeight: tok(t, 'typography-font-weight-strong'),
61
+ lineHeight: tok(t, 'typography-line-height-tight'),
62
+ },
63
+ };
64
+ if (!opts?.dense)
65
+ return base;
66
+ return {
67
+ ...base,
68
+ header: merge(base.header, { paddingHorizontal: tok(t, 'space-3') }),
69
+ body: merge(base.body, { paddingHorizontal: tok(t, 'space-3') }),
70
+ footer: merge(base.footer, { paddingHorizontal: tok(t, 'space-3') }),
71
+ };
72
+ };
@@ -0,0 +1,125 @@
1
+ // styles/buttons.ts
2
+ import { merge, tok, } from '../types/tokens';
3
+ const variantStyles = (t) => ({
4
+ primary: {
5
+ container: {
6
+ backgroundColor: tok(t, 'color-action-primary'),
7
+ borderColor: 'transparent',
8
+ },
9
+ label: { color: tok(t, 'color-action-primary-fg') },
10
+ },
11
+ secondary: {
12
+ container: {
13
+ backgroundColor: tok(t, 'color-action-secondary'),
14
+ borderColor: 'transparent',
15
+ },
16
+ label: { color: tok(t, 'color-action-secondary-fg') },
17
+ },
18
+ ghost: {
19
+ container: {
20
+ backgroundColor: 'transparent',
21
+ borderColor: tok(t, 'color-border-subtle'),
22
+ },
23
+ label: { color: tok(t, 'color-fg-default') },
24
+ },
25
+ danger: {
26
+ container: {
27
+ backgroundColor: tok(t, 'color-status-error'),
28
+ borderColor: 'transparent',
29
+ },
30
+ label: { color: tok(t, 'color-status-error-fg') },
31
+ },
32
+ });
33
+ const sizeStyles = (t) => ({
34
+ sm: {
35
+ container: {
36
+ minHeight: tok(t, 'tap-target-min'),
37
+ paddingHorizontal: tok(t, 'space-3'),
38
+ paddingVertical: tok(t, 'space-2'),
39
+ },
40
+ label: {
41
+ fontSize: tok(t, 'typography-font-size-2'),
42
+ },
43
+ icon: {
44
+ width: tok(t, 'typography-font-size-4'),
45
+ height: tok(t, 'typography-font-size-4'),
46
+ },
47
+ },
48
+ md: {
49
+ container: {
50
+ minHeight: tok(t, 'tap-target-min'),
51
+ paddingHorizontal: tok(t, 'space-4'),
52
+ paddingVertical: tok(t, 'space-2'),
53
+ },
54
+ label: {
55
+ fontSize: tok(t, 'typography-font-size-3'),
56
+ },
57
+ icon: {
58
+ width: tok(t, 'typography-font-size-4'),
59
+ height: tok(t, 'typography-font-size-4'),
60
+ },
61
+ },
62
+ lg: {
63
+ container: {
64
+ minHeight: tok(t, 'tap-target-min'),
65
+ paddingHorizontal: tok(t, 'space-5'),
66
+ paddingVertical: tok(t, 'space-3'),
67
+ },
68
+ label: {
69
+ fontSize: tok(t, 'typography-font-size-4'),
70
+ },
71
+ icon: {
72
+ width: tok(t, 'typography-font-size-5'),
73
+ height: tok(t, 'typography-font-size-5'),
74
+ },
75
+ },
76
+ });
77
+ export const getButtonParts = (t, opts = {}) => {
78
+ const variant = opts.variant ?? 'primary';
79
+ const size = opts.size ?? 'md';
80
+ const isDisabled = Boolean(opts.disabled || opts.loading);
81
+ const baseContainer = {
82
+ borderWidth: tok(t, 'border-width-default'),
83
+ borderRadius: tok(t, 'radius-3'),
84
+ alignItems: 'center',
85
+ justifyContent: 'center',
86
+ flexDirection: 'row',
87
+ gap: tok(t, 'space-2'),
88
+ };
89
+ const baseLabel = {
90
+ fontFamily: tok(t, 'typography-font-family-base'),
91
+ fontWeight: tok(t, 'typography-font-weight-medium'),
92
+ lineHeight: tok(t, 'typography-line-height-default'),
93
+ };
94
+ const focusRing = {
95
+ outlineStyle: 'solid',
96
+ outlineWidth: tok(t, 'border-width-focus'),
97
+ outlineColor: tok(t, 'color-focus-ring'),
98
+ outlineOffset: tok(t, 'focus-ring-gap'),
99
+ };
100
+ const disabledStyles = {
101
+ container: {
102
+ backgroundColor: tok(t, 'color-state-disabled-bg'),
103
+ borderColor: tok(t, 'color-state-disabled-bg'),
104
+ opacity: tok(t, 'opacity-disabled'),
105
+ },
106
+ label: { color: tok(t, 'color-state-disabled-fg') },
107
+ };
108
+ const interaction = {
109
+ hovered: { container: { opacity: 0.96 } },
110
+ pressed: { container: { opacity: tok(t, 'opacity-pressed') } },
111
+ fullWidth: { container: { alignSelf: 'stretch' } },
112
+ };
113
+ const v = variantStyles(t)[variant];
114
+ const s = sizeStyles(t)[size];
115
+ return {
116
+ container: merge(baseContainer, s.container, v.container, opts.fullWidth && interaction.fullWidth.container, opts.hovered && interaction.hovered.container, opts.pressed && interaction.pressed.container, isDisabled && disabledStyles.container),
117
+ label: merge(baseLabel, s.label, v.label, isDisabled && disabledStyles.label),
118
+ icon: merge(s.icon, {
119
+ color: (isDisabled
120
+ ? disabledStyles.label.color
121
+ : v.label.color),
122
+ }),
123
+ focusRing: merge(opts.focusVisible ? focusRing : undefined),
124
+ };
125
+ };
@@ -0,0 +1,67 @@
1
+ // styles/cards.ts
2
+ import { merge, tok, } from '../types/tokens';
3
+ const variantStyles = (t) => ({
4
+ default: {
5
+ container: {
6
+ backgroundColor: tok(t, 'color-surface'),
7
+ borderColor: tok(t, 'color-border-subtle'),
8
+ shadow: tok(t, 'shadow-level-1'),
9
+ },
10
+ },
11
+ elevated: {
12
+ container: {
13
+ backgroundColor: tok(t, 'color-surface'),
14
+ borderColor: tok(t, 'color-border-subtle'),
15
+ shadow: tok(t, 'shadow-level-2'),
16
+ },
17
+ },
18
+ outlined: {
19
+ container: {
20
+ backgroundColor: tok(t, 'color-surface'),
21
+ borderColor: tok(t, 'color-border-strong'),
22
+ shadow: 'none',
23
+ },
24
+ },
25
+ subtle: {
26
+ container: {
27
+ backgroundColor: tok(t, 'color-surface-alt'),
28
+ borderColor: tok(t, 'color-border-subtle'),
29
+ shadow: 'none',
30
+ },
31
+ },
32
+ });
33
+ export const getCardParts = (t, opts = {}) => {
34
+ const variant = opts.variant ?? 'default';
35
+ const v = variantStyles(t)[variant];
36
+ const baseContainer = {
37
+ borderWidth: tok(t, 'border-width-default'),
38
+ borderRadius: tok(t, 'radius-3'),
39
+ padding: tok(t, 'space-4'),
40
+ };
41
+ const hover = { shadow: tok(t, 'shadow-level-3') };
42
+ const pressed = {
43
+ opacity: tok(t, 'opacity-pressed'),
44
+ shadow: tok(t, 'shadow-level-2'),
45
+ };
46
+ return {
47
+ container: merge(baseContainer, v.container, opts.hovered && hover, opts.pressed && pressed),
48
+ header: { marginBottom: tok(t, 'space-3') },
49
+ body: {},
50
+ footer: { marginTop: tok(t, 'space-3') },
51
+ title: {
52
+ color: tok(t, 'color-fg-default'),
53
+ fontFamily: tok(t, 'typography-font-family-heading'),
54
+ fontSize: tok(t, 'typography-font-size-4'),
55
+ fontWeight: tok(t, 'typography-font-weight-strong'),
56
+ lineHeight: tok(t, 'typography-line-height-tight'),
57
+ },
58
+ subtitle: {
59
+ marginTop: tok(t, 'space-1'),
60
+ color: tok(t, 'color-fg-muted'),
61
+ fontFamily: tok(t, 'typography-font-family-base'),
62
+ fontSize: tok(t, 'typography-font-size-3'),
63
+ fontWeight: tok(t, 'typography-font-weight-regular'),
64
+ lineHeight: tok(t, 'typography-line-height-default'),
65
+ },
66
+ };
67
+ };
@@ -0,0 +1,66 @@
1
+ // styles/checkboxes.ts
2
+ import { merge, tok, } from '../types/tokens';
3
+ export const getCheckboxParts = (t, s = {}) => {
4
+ const isOn = Boolean(s.checked || s.indeterminate);
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 boxBase = {
15
+ width: tok(t, 'typography-font-size-5'),
16
+ height: tok(t, 'typography-font-size-5'),
17
+ borderRadius: tok(t, 'radius-2'),
18
+ borderWidth: tok(t, 'border-width-default'),
19
+ backgroundColor: tok(t, 'color-surface'),
20
+ borderColor: tok(t, 'color-border-strong'),
21
+ alignItems: 'center',
22
+ justifyContent: 'center',
23
+ };
24
+ const boxOn = {
25
+ backgroundColor: tok(t, 'color-accent'),
26
+ borderColor: tok(t, 'color-accent'),
27
+ };
28
+ const boxDisabled = {
29
+ backgroundColor: tok(t, 'color-state-disabled-bg'),
30
+ borderColor: tok(t, 'color-state-disabled-bg'),
31
+ };
32
+ const checkmark = {
33
+ color: isDisabled
34
+ ? tok(t, 'color-state-disabled-fg')
35
+ : tok(t, 'color-accent-fg'),
36
+ width: tok(t, 'typography-font-size-4'),
37
+ height: tok(t, 'typography-font-size-4'),
38
+ };
39
+ const label = {
40
+ color: isDisabled
41
+ ? tok(t, 'color-state-disabled-fg')
42
+ : tok(t, 'color-fg-default'),
43
+ fontFamily: tok(t, 'typography-font-family-base'),
44
+ fontSize: tok(t, 'typography-font-size-3'),
45
+ lineHeight: tok(t, 'typography-line-height-default'),
46
+ fontWeight: tok(t, 'typography-font-weight-regular'),
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
+ box: merge(boxBase, isOn && boxOn, isDisabled && boxDisabled),
62
+ checkmark: merge(checkmark),
63
+ label: merge(label),
64
+ focusRing: merge(s.focusVisible ? focusRing : undefined),
65
+ };
66
+ };
@@ -0,0 +1,94 @@
1
+ // styles/chips.ts
2
+ import { merge, tok, } from '../types/tokens';
3
+ export const getChipParts = (t, opts = {}) => {
4
+ const variant = opts.variant ?? 'filled';
5
+ const selected = Boolean(opts.selected);
6
+ const disabled = Boolean(opts.disabled);
7
+ const base = {
8
+ container: {
9
+ minHeight: tok(t, 'tap-target-min'),
10
+ alignSelf: 'flex-start',
11
+ flexDirection: 'row',
12
+ alignItems: 'center',
13
+ gap: tok(t, 'space-2'),
14
+ paddingHorizontal: tok(t, 'space-3'),
15
+ paddingVertical: tok(t, 'space-2'),
16
+ borderRadius: tok(t, 'radius-full'),
17
+ borderWidth: tok(t, 'border-width-default'),
18
+ },
19
+ label: {
20
+ fontFamily: tok(t, 'typography-font-family-base'),
21
+ fontSize: tok(t, 'typography-font-size-2'),
22
+ fontWeight: tok(t, 'typography-font-weight-medium'),
23
+ lineHeight: tok(t, 'typography-line-height-default'),
24
+ },
25
+ leftIcon: {
26
+ width: tok(t, 'typography-font-size-4'),
27
+ height: tok(t, 'typography-font-size-4'),
28
+ },
29
+ rightIcon: {
30
+ width: tok(t, 'typography-font-size-4'),
31
+ height: tok(t, 'typography-font-size-4'),
32
+ },
33
+ focusRing: {
34
+ outlineStyle: 'solid',
35
+ outlineWidth: tok(t, 'border-width-focus'),
36
+ outlineColor: tok(t, 'color-focus-ring'),
37
+ outlineOffset: tok(t, 'focus-ring-gap'),
38
+ },
39
+ };
40
+ const filled = {
41
+ backgroundColor: selected
42
+ ? tok(t, 'color-action-primary')
43
+ : tok(t, 'color-surface-alt'),
44
+ borderColor: selected
45
+ ? tok(t, 'color-action-primary')
46
+ : tok(t, 'color-border-subtle'),
47
+ };
48
+ const filledLabel = {
49
+ color: selected
50
+ ? tok(t, 'color-action-primary-fg')
51
+ : tok(t, 'color-fg-default'),
52
+ };
53
+ const outlined = {
54
+ backgroundColor: 'transparent',
55
+ borderColor: selected
56
+ ? tok(t, 'color-action-primary')
57
+ : tok(t, 'color-border-strong'),
58
+ };
59
+ const outlinedLabel = {
60
+ color: selected
61
+ ? tok(t, 'color-action-primary')
62
+ : tok(t, 'color-fg-default'),
63
+ };
64
+ const disabledS = {
65
+ backgroundColor: tok(t, 'color-state-disabled-bg'),
66
+ borderColor: tok(t, 'color-state-disabled-bg'),
67
+ opacity: tok(t, 'opacity-disabled'),
68
+ };
69
+ const disabledLabel = { color: tok(t, 'color-state-disabled-fg') };
70
+ const interaction = opts.pressed
71
+ ? { opacity: tok(t, 'opacity-pressed') }
72
+ : opts.hovered
73
+ ? { opacity: 0.96 }
74
+ : {};
75
+ return {
76
+ container: merge(base.container, variant === 'filled' ? filled : outlined, interaction, disabled && disabledS),
77
+ label: merge(base.label, variant === 'filled' ? filledLabel : outlinedLabel, disabled && disabledLabel),
78
+ leftIcon: merge(base.leftIcon, {
79
+ color: (disabled
80
+ ? disabledLabel.color
81
+ : variant === 'filled'
82
+ ? filledLabel.color
83
+ : outlinedLabel.color),
84
+ }),
85
+ rightIcon: merge(base.rightIcon, {
86
+ color: (disabled
87
+ ? disabledLabel.color
88
+ : variant === 'filled'
89
+ ? filledLabel.color
90
+ : outlinedLabel.color),
91
+ }),
92
+ focusRing: merge(opts.focusVisible ? base.focusRing : undefined),
93
+ };
94
+ };
@@ -0,0 +1,108 @@
1
+ // styles/datePickers.ts
2
+ import { merge, tok, } from '../types/tokens';
3
+ export const getDatePickerParts = (t) => {
4
+ return {
5
+ container: {
6
+ backgroundColor: tok(t, 'color-surface'),
7
+ borderColor: tok(t, 'color-border-subtle'),
8
+ borderWidth: tok(t, 'border-width-default'),
9
+ borderRadius: tok(t, 'radius-4'),
10
+ shadow: tok(t, 'shadow-level-2'),
11
+ padding: tok(t, 'space-3'),
12
+ },
13
+ header: {
14
+ flexDirection: 'row',
15
+ alignItems: 'center',
16
+ justifyContent: 'space-between',
17
+ paddingBottom: tok(t, 'space-2'),
18
+ marginBottom: tok(t, 'space-2'),
19
+ borderBottomWidth: tok(t, 'border-width-default'),
20
+ borderBottomColor: tok(t, 'color-border-subtle'),
21
+ },
22
+ monthLabel: {
23
+ color: tok(t, 'color-fg-default'),
24
+ fontFamily: tok(t, 'typography-font-family-heading'),
25
+ fontSize: tok(t, 'typography-font-size-3'),
26
+ fontWeight: tok(t, 'typography-font-weight-strong'),
27
+ lineHeight: tok(t, 'typography-line-height-tight'),
28
+ },
29
+ navButton: {
30
+ minHeight: tok(t, 'tap-target-min'),
31
+ minWidth: tok(t, 'tap-target-min'),
32
+ borderRadius: tok(t, 'radius-full'),
33
+ alignItems: 'center',
34
+ justifyContent: 'center',
35
+ },
36
+ weekRow: {
37
+ flexDirection: 'row',
38
+ justifyContent: 'space-between',
39
+ marginBottom: tok(t, 'space-2'),
40
+ },
41
+ weekdayLabel: {
42
+ width: tok(t, 'tap-target-min'),
43
+ textAlign: 'center',
44
+ color: tok(t, 'color-fg-muted'),
45
+ fontFamily: tok(t, 'typography-font-family-base'),
46
+ fontSize: tok(t, 'typography-font-size-2'),
47
+ fontWeight: tok(t, 'typography-font-weight-medium'),
48
+ },
49
+ dayCell: {
50
+ width: tok(t, 'tap-target-min'),
51
+ height: tok(t, 'tap-target-min'),
52
+ borderRadius: tok(t, 'radius-full'),
53
+ alignItems: 'center',
54
+ justifyContent: 'center',
55
+ },
56
+ dayText: {
57
+ color: tok(t, 'color-fg-default'),
58
+ fontFamily: tok(t, 'typography-font-family-base'),
59
+ fontSize: tok(t, 'typography-font-size-2'),
60
+ fontWeight: tok(t, 'typography-font-weight-regular'),
61
+ lineHeight: tok(t, 'typography-line-height-default'),
62
+ },
63
+ dayFocusRing: {
64
+ outlineStyle: 'solid',
65
+ outlineWidth: tok(t, 'border-width-focus'),
66
+ outlineColor: tok(t, 'color-focus-ring'),
67
+ outlineOffset: tok(t, 'focus-ring-gap'),
68
+ },
69
+ rangeFill: {
70
+ backgroundColor: tok(t, 'color-surface-alt'),
71
+ borderRadius: tok(t, 'radius-full'),
72
+ },
73
+ };
74
+ };
75
+ export const getCalendarDayParts = (t, s = {}) => {
76
+ const base = getDatePickerParts(t);
77
+ const disabled = {
78
+ backgroundColor: 'transparent',
79
+ opacity: tok(t, 'opacity-disabled'),
80
+ };
81
+ const outside = {
82
+ opacity: 0.5,
83
+ };
84
+ const today = {
85
+ borderWidth: tok(t, 'border-width-default'),
86
+ borderColor: tok(t, 'color-border-strong'),
87
+ };
88
+ const selected = {
89
+ backgroundColor: tok(t, 'color-action-primary'),
90
+ };
91
+ const selectedText = {
92
+ color: tok(t, 'color-action-primary-fg'),
93
+ fontWeight: tok(t, 'typography-font-weight-strong'),
94
+ };
95
+ const inRange = {
96
+ backgroundColor: tok(t, 'color-surface-alt'),
97
+ };
98
+ const interaction = s.pressed
99
+ ? { opacity: tok(t, 'opacity-pressed') }
100
+ : s.hovered
101
+ ? { opacity: 0.96 }
102
+ : {};
103
+ return {
104
+ cell: merge(base.dayCell, s.isInRange && inRange, s.isToday && today, s.isSelected && selected, s.isOutsideMonth && outside, s.isDisabled && disabled, interaction),
105
+ text: merge(base.dayText, s.isSelected && selectedText, s.isDisabled && { color: tok(t, 'color-state-disabled-fg') }),
106
+ focusRing: merge(s.focusVisible ? base.dayFocusRing : undefined),
107
+ };
108
+ };
@@ -0,0 +1,8 @@
1
+ // styles/dividers.ts
2
+ import { tok } from '../types/tokens';
3
+ export const getDividerStyle = (t, variant = 'subtle') => ({
4
+ height: tok(t, 'border-width-default'),
5
+ backgroundColor: variant === 'strong'
6
+ ? tok(t, 'color-border-strong')
7
+ : tok(t, 'color-border-subtle'),
8
+ });
@@ -0,0 +1,36 @@
1
+ // styles/emptyStates.ts
2
+ import { tok } from '../types/tokens';
3
+ export const getEmptyStateParts = (t) => ({
4
+ container: {
5
+ alignItems: 'center',
6
+ justifyContent: 'center',
7
+ padding: tok(t, 'space-6'),
8
+ gap: tok(t, 'space-3'),
9
+ },
10
+ icon: {
11
+ width: tok(t, 'typography-font-size-6'),
12
+ height: tok(t, 'typography-font-size-6'),
13
+ color: tok(t, 'color-fg-muted'),
14
+ },
15
+ title: {
16
+ color: tok(t, 'color-fg-default'),
17
+ fontFamily: tok(t, 'typography-font-family-heading'),
18
+ fontSize: tok(t, 'typography-font-size-5'),
19
+ fontWeight: tok(t, 'typography-font-weight-strong'),
20
+ lineHeight: tok(t, 'typography-line-height-tight'),
21
+ textAlign: 'center',
22
+ },
23
+ message: {
24
+ color: tok(t, 'color-fg-muted'),
25
+ fontFamily: tok(t, 'typography-font-family-base'),
26
+ fontSize: tok(t, 'typography-font-size-3'),
27
+ fontWeight: tok(t, 'typography-font-weight-regular'),
28
+ lineHeight: tok(t, 'typography-line-height-default'),
29
+ textAlign: 'center',
30
+ },
31
+ actions: {
32
+ marginTop: tok(t, 'space-2'),
33
+ flexDirection: 'row',
34
+ gap: tok(t, 'space-2'),
35
+ },
36
+ });
@@ -0,0 +1,28 @@
1
+ // styles/forms.ts
2
+ import { tok } from '../types/tokens';
3
+ export const getFormLayout = (t) => ({
4
+ form: {
5
+ gap: tok(t, 'space-4'),
6
+ },
7
+ field: {
8
+ gap: tok(t, 'space-1'),
9
+ },
10
+ row: {
11
+ flexDirection: 'row',
12
+ gap: tok(t, 'space-3'),
13
+ },
14
+ section: {
15
+ padding: tok(t, 'space-4'),
16
+ backgroundColor: tok(t, 'color-surface'),
17
+ borderRadius: tok(t, 'radius-4'),
18
+ borderWidth: tok(t, 'border-width-default'),
19
+ borderColor: tok(t, 'color-border-subtle'),
20
+ gap: tok(t, 'space-3'),
21
+ },
22
+ actions: {
23
+ marginTop: tok(t, 'space-2'),
24
+ flexDirection: 'row',
25
+ justifyContent: 'flex-end',
26
+ gap: tok(t, 'space-2'),
27
+ },
28
+ });
@@ -0,0 +1,42 @@
1
+ // styles/headers.ts
2
+ import { tok } from '../types/tokens';
3
+ export const getHeaderParts = (t) => ({
4
+ container: {
5
+ minHeight: tok(t, 'tap-target-min'),
6
+ paddingHorizontal: tok(t, 'space-4'),
7
+ paddingVertical: tok(t, 'space-3'),
8
+ backgroundColor: tok(t, 'color-surface'),
9
+ borderBottomWidth: tok(t, 'border-width-default'),
10
+ borderBottomColor: tok(t, 'color-border-subtle'),
11
+ flexDirection: 'row',
12
+ alignItems: 'center',
13
+ justifyContent: 'space-between',
14
+ zIndex: tok(t, 'z-index-layer-navbar'),
15
+ },
16
+ left: {
17
+ minWidth: tok(t, 'tap-target-min'),
18
+ alignItems: 'flex-start',
19
+ justifyContent: 'center',
20
+ },
21
+ center: { flex: 1, alignItems: 'center', justifyContent: 'center' },
22
+ right: {
23
+ minWidth: tok(t, 'tap-target-min'),
24
+ alignItems: 'flex-end',
25
+ justifyContent: 'center',
26
+ },
27
+ title: {
28
+ color: tok(t, 'color-fg-default'),
29
+ fontFamily: tok(t, 'typography-font-family-heading'),
30
+ fontSize: tok(t, 'typography-font-size-4'),
31
+ fontWeight: tok(t, 'typography-font-weight-strong'),
32
+ lineHeight: tok(t, 'typography-line-height-tight'),
33
+ },
34
+ subtitle: {
35
+ marginTop: tok(t, 'space-1'),
36
+ color: tok(t, 'color-fg-muted'),
37
+ fontFamily: tok(t, 'typography-font-family-base'),
38
+ fontSize: tok(t, 'typography-font-size-2'),
39
+ fontWeight: tok(t, 'typography-font-weight-regular'),
40
+ lineHeight: tok(t, 'typography-line-height-default'),
41
+ },
42
+ });
@@ -0,0 +1,27 @@
1
+ export * from './avatars';
2
+ export * from './badges';
3
+ export * from './bottomSheets';
4
+ export * from './buttons';
5
+ export * from './cards';
6
+ export * from './checkboxes';
7
+ export * from './chips';
8
+ export * from './datePickers';
9
+ export * from './dividers';
10
+ export * from './emptyStates';
11
+ export * from './forms';
12
+ export * from './headers';
13
+ export * from './inputs';
14
+ export * from './listItems';
15
+ export * from './modals';
16
+ export * from './pagination';
17
+ export * from './popovers';
18
+ export * from './progress';
19
+ export * from './radios';
20
+ export * from './selects';
21
+ export * from './skeletons';
22
+ export * from './steppers';
23
+ export * from './switches';
24
+ export * from './tables';
25
+ export * from './tabs';
26
+ export * from './toasts';
27
+ export * from './tooltips';