@idealyst/components 1.2.13 → 1.2.15

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 (95) hide show
  1. package/package.json +3 -3
  2. package/src/Accordion/Accordion.web.tsx +1 -1
  3. package/src/ActivityIndicator/ActivityIndicator.native.tsx +3 -3
  4. package/src/ActivityIndicator/ActivityIndicator.web.tsx +3 -3
  5. package/src/Alert/Alert.native.tsx +1 -1
  6. package/src/Alert/Alert.web.tsx +1 -1
  7. package/src/Avatar/Avatar.native.tsx +1 -1
  8. package/src/Badge/Badge.web.tsx +6 -2
  9. package/src/Badge/types.ts +5 -0
  10. package/src/Breadcrumb/Breadcrumb.native.tsx +20 -21
  11. package/src/Button/Button.native.tsx +3 -3
  12. package/src/Button/Button.web.tsx +5 -1
  13. package/src/Button/types.ts +5 -0
  14. package/src/Card/Card.web.tsx +4 -1
  15. package/src/Card/types.ts +5 -0
  16. package/src/Dialog/Dialog.native.tsx +3 -3
  17. package/src/Divider/Divider.web.tsx +2 -2
  18. package/src/Icon/Icon.web.tsx +2 -2
  19. package/src/Icon/types.ts +3 -0
  20. package/src/Image/Image.styles.tsx +5 -5
  21. package/src/Image/Image.web.tsx +3 -3
  22. package/src/List/List.native.tsx +1 -2
  23. package/src/List/List.web.tsx +1 -2
  24. package/src/List/ListSection.web.tsx +3 -3
  25. package/src/Menu/Menu.web.tsx +8 -10
  26. package/src/Menu/MenuItem.web.tsx +1 -1
  27. package/src/Popover/Popover.web.tsx +1 -1
  28. package/src/Pressable/Pressable.web.tsx +1 -1
  29. package/src/Progress/Progress.styles.tsx +76 -30
  30. package/src/Progress/Progress.web.tsx +13 -15
  31. package/src/SVGImage/SVGImage.web.tsx +1 -1
  32. package/src/Select/Select.web.tsx +2 -2
  33. package/src/Skeleton/Skeleton.native.tsx +3 -3
  34. package/src/Skeleton/Skeleton.web.tsx +3 -3
  35. package/src/Slider/Slider.native.tsx +2 -2
  36. package/src/Slider/Slider.styles.tsx +131 -44
  37. package/src/Slider/Slider.web.tsx +22 -22
  38. package/src/TabBar/TabBar.native.tsx +2 -2
  39. package/src/Text/Text.web.tsx +29 -3
  40. package/src/Text/types.ts +14 -1
  41. package/src/TextArea/TextArea.styles.tsx +96 -57
  42. package/src/TextArea/TextArea.web.tsx +19 -28
  43. package/src/Tooltip/Tooltip.web.tsx +3 -3
  44. package/src/Video/Video.styles.tsx +3 -3
  45. package/src/Video/Video.web.tsx +1 -1
  46. package/src/View/View.styles.tsx +2 -2
  47. package/src/View/View.web.tsx +93 -9
  48. package/src/View/types.ts +5 -1
  49. package/src/examples/ViewExamples.tsx +34 -0
  50. package/src/extensions/index.ts +0 -7
  51. package/src/hooks/useMergeRefs.ts +12 -6
  52. package/src/index.native.ts +1 -1
  53. package/src/index.ts +1 -1
  54. package/src/utils/accessibility/keyboardPatterns.ts +4 -0
  55. package/src/utils/accessibility/types.ts +5 -1
  56. package/src/utils/accessibility/useAnnounce.ts +1 -1
  57. package/src/utils/accessibility/useKeyboardNavigation.ts +1 -1
  58. package/src/utils/index.ts +0 -3
  59. package/src/utils/viewStyleProps.ts +2 -0
  60. package/src/Accordion/Accordion.styles.old.tsx +0 -298
  61. package/src/ActivityIndicator/ActivityIndicator.styles.old.tsx +0 -94
  62. package/src/Alert/Alert.styles.old.tsx +0 -209
  63. package/src/Avatar/Avatar.styles.old.tsx +0 -99
  64. package/src/Badge/Badge.styles.old.tsx +0 -157
  65. package/src/Breadcrumb/Breadcrumb.styles.old.tsx +0 -231
  66. package/src/Card/Card.styles.old.tsx +0 -160
  67. package/src/Checkbox/Checkbox.styles.old.tsx +0 -271
  68. package/src/Chip/Chip.styles.old.tsx +0 -184
  69. package/src/Dialog/Dialog.styles.old.tsx +0 -202
  70. package/src/Divider/Divider.styles.old.tsx +0 -172
  71. package/src/Icon/Icon.styles.old.tsx +0 -81
  72. package/src/Image/Image.styles.old.tsx +0 -69
  73. package/src/Input/Input.styles.old.tsx +0 -289
  74. package/src/List/List.styles.old.tsx +0 -242
  75. package/src/Menu/Menu.styles.old.tsx +0 -197
  76. package/src/Menu/MenuItem.styles.old.tsx +0 -114
  77. package/src/Popover/Popover.styles.old.tsx +0 -135
  78. package/src/Pressable/Pressable.styles.old.tsx +0 -27
  79. package/src/Progress/Progress.styles.old.tsx +0 -200
  80. package/src/RadioButton/RadioButton.styles.old.tsx +0 -175
  81. package/src/SVGImage/SVGImage.styles.old.tsx +0 -86
  82. package/src/Screen/Screen.styles.old.tsx +0 -87
  83. package/src/Select/Select.styles.old.tsx +0 -353
  84. package/src/Skeleton/Skeleton.styles.old.tsx +0 -67
  85. package/src/Slider/Slider.styles.old.tsx +0 -259
  86. package/src/Switch/Switch.styles.old.tsx +0 -203
  87. package/src/TabBar/TabBar.styles.old.tsx +0 -343
  88. package/src/Table/Table.styles.old.tsx +0 -311
  89. package/src/Text/Text.styles.old.tsx +0 -219
  90. package/src/TextArea/TextArea.styles.old.tsx +0 -213
  91. package/src/Tooltip/Tooltip.styles.old.tsx +0 -82
  92. package/src/Video/Video.styles.old.tsx +0 -51
  93. package/src/View/View.styles.old.tsx +0 -125
  94. package/src/extensions/applyExtension.ts +0 -210
  95. package/src/utils/buildSizeVariants.ts +0 -16
@@ -1,202 +0,0 @@
1
- import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, StylesheetStyles } from '@idealyst/theme';
3
- import { applyExtensions } from '../extensions/applyExtension';
4
- type DialogSize = 'sm' | 'md' | 'lg' | 'fullscreen';
5
- type DialogType = 'default' | 'alert' | 'confirmation';
6
-
7
- type DialogVariants = {
8
- size: DialogSize;
9
- type: DialogType;
10
- }
11
-
12
- export type ExpandedDialogStyles = StylesheetStyles<keyof DialogVariants>;
13
-
14
- export type DialogStylesheet = {
15
- backdrop: ExpandedDialogStyles;
16
- container: ExpandedDialogStyles;
17
- header: ExpandedDialogStyles;
18
- title: ExpandedDialogStyles;
19
- closeButton: ExpandedDialogStyles;
20
- closeButtonText: ExpandedDialogStyles;
21
- content: ExpandedDialogStyles;
22
- modal: ExpandedDialogStyles;
23
- }
24
-
25
- /**
26
- * Create size variants for container
27
- */
28
- function createContainerSizeVariants() {
29
- return {
30
- sm: {
31
- width: '90%',
32
- maxWidth: 400,
33
- },
34
- md: {
35
- width: '90%',
36
- maxWidth: 600,
37
- },
38
- lg: {
39
- width: '90%',
40
- maxWidth: 800,
41
- },
42
- fullscreen: {
43
- width: '100%',
44
- height: '100%',
45
- borderRadius: 0,
46
- maxHeight: '100%',
47
- },
48
- } as const;
49
- }
50
-
51
- /**
52
- * Create type variants for container
53
- */
54
- function createContainerTypeVariants(theme: Theme) {
55
- return {
56
- standard: {},
57
- alert: {
58
- borderTopWidth: 4,
59
- borderTopColor: theme.colors.border.primary,
60
- },
61
- confirmation: {
62
- borderTopWidth: 4,
63
- borderTopColor: theme.colors.border.primary,
64
- },
65
- } as const;
66
- }
67
-
68
- // Helper functions to create static styles wrapped in dynamic functions
69
- function createBackdropStyles() {
70
- return () => ({
71
- position: 'absolute' as const,
72
- top: 0,
73
- left: 0,
74
- right: 0,
75
- bottom: 0,
76
- backgroundColor: 'rgba(0, 0, 0, 0.5)',
77
- display: 'flex' as const,
78
- alignItems: 'center' as const,
79
- justifyContent: 'center' as const,
80
- zIndex: 1000,
81
- _web: {
82
- position: 'fixed',
83
- transition: 'opacity 150ms ease-out',
84
- },
85
- });
86
- }
87
-
88
- function createDialogContainerStyles(theme: Theme) {
89
- return () => ({
90
- backgroundColor: theme.colors.surface.primary,
91
- borderRadius: 12,
92
- shadowColor: '#000',
93
- shadowOffset: { width: 0, height: 10 },
94
- shadowOpacity: 0.25,
95
- shadowRadius: 20,
96
- elevation: 10,
97
- maxHeight: '90%',
98
- variants: {
99
- size: createContainerSizeVariants(),
100
- type: createContainerTypeVariants(theme),
101
- },
102
- _web: {
103
- position: 'relative',
104
- display: 'flex',
105
- flexDirection: 'column',
106
- overflow: 'auto',
107
- boxShadow: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)',
108
- transition: 'opacity 150ms ease-out, transform 150ms ease-out',
109
- transformOrigin: 'center center',
110
- },
111
- });
112
- }
113
-
114
- function createHeaderStyles(theme: Theme) {
115
- return () => ({
116
- borderBottomWidth: 1,
117
- borderBottomColor: theme.colors.border.primary,
118
- display: 'flex' as const,
119
- flexDirection: 'row' as const,
120
- alignItems: 'center' as const,
121
- justifyContent: 'space-between' as const,
122
- _web: {
123
- borderBottomStyle: 'solid',
124
- },
125
- });
126
- }
127
-
128
- function createTitleStyles(theme: Theme) {
129
- return () => ({
130
- marginLeft: 24,
131
- fontSize: 18,
132
- paddingVertical: 16,
133
- fontWeight: '600' as const,
134
- color: theme.colors.text.primary,
135
- flex: 1,
136
- _web: {
137
- paddingVertical: 4,
138
- },
139
- });
140
- }
141
-
142
- function createCloseButtonStyles(theme: Theme) {
143
- return () => ({
144
- width: 32,
145
- height: 32,
146
- marginRight: 16,
147
- borderRadius: 16,
148
- backgroundColor: 'transparent' as const,
149
- display: 'flex' as const,
150
- alignItems: 'center' as const,
151
- justifyContent: 'center' as const,
152
- _web: {
153
- border: 'none',
154
- cursor: 'pointer',
155
- _hover: {
156
- backgroundColor: theme.colors.surface.secondary,
157
- },
158
- },
159
- });
160
- }
161
-
162
- function createCloseButtonTextStyles(theme: Theme) {
163
- return () => ({
164
- fontSize: 18,
165
- color: theme.colors.text.secondary,
166
- fontWeight: '500' as const,
167
- });
168
- }
169
-
170
- function createContentStyles() {
171
- return () => ({
172
- padding: 24,
173
- _web: {
174
- overflow: 'visible',
175
- maxHeight: 'none',
176
- },
177
- });
178
- }
179
-
180
- function createModalStyles() {
181
- return () => ({
182
- margin: 0,
183
- justifyContent: 'center' as const,
184
- alignItems: 'center' as const,
185
- });
186
- }
187
-
188
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel transform on native cannot resolve function calls to extract variant structures.
189
- export const dialogStyles = StyleSheet.create((theme: Theme) => {
190
- // Apply extensions to main visual elements
191
-
192
- return applyExtensions('Dialog', theme, {backdrop: createBackdropStyles(),
193
- container: createDialogContainerStyles(theme),
194
- header: createHeaderStyles(theme),
195
- content: createContentStyles(),
196
- // Additional styles (merged from return)
197
- // Minor utility styles (not extended)
198
- title: createTitleStyles(theme)(),
199
- closeButton: createCloseButtonStyles(theme)(),
200
- closeButtonText: createCloseButtonTextStyles(theme)(),
201
- modal: createModalStyles()()});
202
- });
@@ -1,172 +0,0 @@
1
- import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, Intent } from '@idealyst/theme';
3
- import { applyExtensions } from '../extensions/applyExtension';
4
-
5
- type DividerOrientation = 'horizontal' | 'vertical';
6
- type DividerThickness = 'thin' | 'md' | 'thick';
7
- type DividerType = 'solid' | 'dashed' | 'dotted';
8
- type DividerIntent = Intent | 'secondary' | 'neutral' | 'info';
9
- type DividerLength = 'full' | 'auto';
10
- type DividerSpacing = 'none' | 'sm' | 'md' | 'lg';
11
-
12
- type DividerDynamicProps = {
13
- orientation?: DividerOrientation;
14
- thickness?: DividerThickness;
15
- type?: DividerType;
16
- intent?: DividerIntent;
17
- spacing?: DividerSpacing;
18
- };
19
-
20
- type LineDynamicProps = {
21
- orientation?: DividerOrientation;
22
- thickness?: DividerThickness;
23
- };
24
-
25
- function getIntentColor(theme: Theme, intent: DividerIntent): string {
26
- if (intent === 'secondary') return theme.colors.border.primary;
27
- if (intent === 'neutral') return theme.colors.border.secondary;
28
- if (intent === 'info') return theme.intents.primary.primary;
29
- return theme.intents[intent as Intent].primary;
30
- }
31
-
32
- function getThicknessValue(thickness: DividerThickness): number {
33
- switch (thickness) {
34
- case 'thin': return 1;
35
- case 'md': return 2;
36
- case 'thick': return 4;
37
- default: return 1;
38
- }
39
- }
40
-
41
- function getSpacingValue(spacing: DividerSpacing): number {
42
- switch (spacing) {
43
- case 'none': return 0;
44
- case 'sm': return 8;
45
- case 'md': return 16;
46
- case 'lg': return 24;
47
- default: return 0;
48
- }
49
- }
50
-
51
- /**
52
- * Create dynamic divider styles
53
- */
54
- function createDividerStyles(theme: Theme) {
55
- return ({
56
- orientation = 'horizontal',
57
- thickness = 'thin',
58
- type = 'solid',
59
- intent = 'neutral',
60
- spacing = 'md'
61
- }: DividerDynamicProps) => {
62
- const color = getIntentColor(theme, intent);
63
- const thicknessValue = getThicknessValue(thickness);
64
- const spacingValue = getSpacingValue(spacing);
65
-
66
- const isHorizontal = orientation === 'horizontal';
67
- const isDashedOrDotted = type === 'dashed' || type === 'dotted';
68
-
69
- // Base dimension styles based on orientation and thickness
70
- const dimensionStyles = isHorizontal
71
- ? { width: '100%', height: thicknessValue, flexDirection: 'row' as const }
72
- : { width: thicknessValue, height: '100%', flexDirection: 'column' as const };
73
-
74
- // Spacing styles based on orientation
75
- const spacingStyles = isHorizontal
76
- ? { marginVertical: spacingValue }
77
- : { marginHorizontal: spacingValue };
78
-
79
- // Web-specific border styles for dashed/dotted
80
- const webBorderStyles = isDashedOrDotted ? {
81
- border: 'none',
82
- backgroundColor: 'transparent',
83
- ...(isHorizontal
84
- ? { borderTop: `${thicknessValue}px ${type} ${color}` }
85
- : { borderLeft: `${thicknessValue}px ${type} ${color}` }
86
- ),
87
- } : {};
88
-
89
- return {
90
- backgroundColor: isDashedOrDotted ? 'transparent' : color,
91
- ...dimensionStyles,
92
- ...spacingStyles,
93
- variants: {
94
- length: {
95
- full: {},
96
- auto: {},
97
- },
98
- },
99
- _web: webBorderStyles,
100
- } as const;
101
- };
102
- }
103
-
104
- /**
105
- * Create dynamic line styles (for dividers with content)
106
- */
107
- function createLineStyles(theme: Theme) {
108
- return ({ orientation = 'horizontal', thickness = 'thin' }: LineDynamicProps) => {
109
- const thicknessValue = getThicknessValue(thickness);
110
- const isHorizontal = orientation === 'horizontal';
111
-
112
- return {
113
- backgroundColor: theme.colors.border.secondary,
114
- flex: 1,
115
- ...(isHorizontal
116
- ? { height: thicknessValue }
117
- : { width: thicknessValue }
118
- ),
119
- } as const;
120
- };
121
- }
122
-
123
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
124
- // transform on native cannot resolve function calls to extract variant structures.
125
- export const dividerStyles = StyleSheet.create((theme: Theme) => {
126
- // Apply extensions to main visual elements
127
-
128
- return applyExtensions('Divider', theme, {divider: createDividerStyles(theme),
129
- // Additional styles (merged from return)
130
- // Minor utility styles (not extended)
131
- container: {
132
- alignItems: 'center',
133
- justifyContent: 'center',
134
- display: 'flex',
135
- variants: {
136
- orientation: {
137
- horizontal: {
138
- flexDirection: 'row',
139
- width: '100%',
140
- },
141
- vertical: {
142
- flexDirection: 'column',
143
- height: '100%',
144
- },
145
- },
146
- spacing: {
147
- none: { gap: 0 },
148
- xs: { gap: 4 },
149
- sm: { gap: 8 },
150
- md: { gap: 16 },
151
- lg: { gap: 24 },
152
- xl: { gap: 32 },
153
- },
154
- },
155
- },
156
- content: {
157
- backgroundColor: theme.colors.surface.primary,
158
- color: theme.colors.text.secondary,
159
- fontSize: 14,
160
- variants: {
161
- orientation: {
162
- horizontal: {
163
- paddingHorizontal: 8,
164
- },
165
- vertical: {
166
- paddingVertical: 8,
167
- },
168
- },
169
- },
170
- },
171
- line: createLineStyles(theme)});
172
- });
@@ -1,81 +0,0 @@
1
- import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, StylesheetStyles, Intent, Color, getColorFromString } from '@idealyst/theme';
3
- import { buildSizeVariants } from '../utils/buildSizeVariants';
4
- import { IconSizeVariant } from './types';
5
- import { applyExtensions } from '../extensions/applyExtension';
6
-
7
- type IconVariants = {
8
- size: IconSizeVariant;
9
- intent?: Intent;
10
- color?: Color;
11
- }
12
-
13
- export type ExpandedIconStyles = StylesheetStyles<keyof IconVariants>;
14
-
15
- export type IconStylesheet = {
16
- icon: ExpandedIconStyles;
17
- }
18
-
19
- /**
20
- * Create color variants for icon
21
- */
22
- function getIconColor(theme: Theme, color?: Color, intent?: Intent): string {
23
- if (intent) {
24
- return theme.intents[intent]?.primary
25
- } else if (color) {
26
- return getColorFromString(theme, color);
27
- }
28
- return theme.colors.text.primary;
29
- }
30
-
31
- export function buildIconSize(theme: Theme, size?: IconSizeVariant) {
32
- // Handle direct numeric sizes
33
- if (typeof size === 'number') {
34
- return {
35
- width: size,
36
- height: size,
37
- };
38
- }
39
-
40
- // Default to 'md' if size is undefined
41
- const sizeKey = size || 'md';
42
- const iconSize = theme.sizes.icon[sizeKey];
43
-
44
- if (typeof iconSize === 'number') {
45
- return {
46
- width: iconSize,
47
- height: iconSize,
48
- };
49
- }
50
-
51
- return buildSizeVariants(theme, 'icon', (size) => ({
52
- width: size.width,
53
- height: size.height,
54
- }))[sizeKey];
55
- }
56
-
57
- function createIconStyles(theme: Theme) {
58
- return ({ color, intent, size }: Partial<IconVariants>) => {
59
- const iconSize = buildIconSize(theme, size);
60
- return {
61
- width: iconSize.width,
62
- height: iconSize.height,
63
- color: getIconColor(theme, color, intent),
64
- _web: {
65
- display: 'inline-block',
66
- verticalAlign: 'middle',
67
- flexShrink: 0,
68
- lineHeight: 0,
69
- },
70
- } as const;
71
- }
72
- }
73
-
74
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
75
- // transform on native cannot resolve function calls to extract variant structures.
76
- export const iconStyles = StyleSheet.create((theme: Theme) => {
77
- // Apply extensions to main visual elements
78
- return applyExtensions('Icon', theme, {
79
- icon: createIconStyles(theme),
80
- });
81
- });
@@ -1,69 +0,0 @@
1
- import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, StylesheetStyles} from '@idealyst/theme';
3
- import { applyExtensions } from '../extensions/applyExtension';
4
-
5
- type ImageVariants = {}
6
-
7
- export type ExpandedImageStyles = StylesheetStyles<keyof ImageVariants>;
8
-
9
- export type ImageStylesheet = {
10
- container: ExpandedImageStyles;
11
- image: ExpandedImageStyles;
12
- placeholder: ExpandedImageStyles;
13
- fallback: ExpandedImageStyles;
14
- loadingIndicator: ExpandedImageStyles;
15
- }
16
-
17
- // Style creators for extension support
18
- function createContainerStyles(theme: Theme) {
19
- return () => ({
20
- position: 'relative' as const,
21
- overflow: 'hidden' as const,
22
- backgroundColor: theme.colors['gray.200'],
23
- });
24
- }
25
-
26
- function createImageStyles() {
27
- return () => ({
28
- width: '100%' as const,
29
- height: '100%' as const,
30
- });
31
- }
32
-
33
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
34
- // transform on native cannot resolve function calls to extract variant structures.
35
- // @ts-ignore - TS language server needs restart to pick up theme structure changes
36
- export const imageStyles = StyleSheet.create((theme: Theme) => {
37
- // Apply extensions to main visual elements
38
-
39
- return applyExtensions('Image', theme, {container: createContainerStyles(theme),
40
- image: createImageStyles(),
41
- // Additional styles (merged from return)
42
- // Minor utility styles (not extended)
43
- placeholder: {
44
- position: 'absolute',
45
- top: 0,
46
- left: 0,
47
- right: 0,
48
- bottom: 0,
49
- display: 'flex',
50
- alignItems: 'center',
51
- justifyContent: 'center',
52
- backgroundColor: theme.colors['gray.200'],
53
- },
54
- fallback: {
55
- position: 'absolute',
56
- top: 0,
57
- left: 0,
58
- right: 0,
59
- bottom: 0,
60
- display: 'flex',
61
- alignItems: 'center',
62
- justifyContent: 'center',
63
- backgroundColor: theme.colors['gray.300'],
64
- color: theme.colors['gray.600'],
65
- },
66
- loadingIndicator: {
67
- color: theme.colors['gray.600'],
68
- }});
69
- });