@flipova/foundation 2.3.0 → 2.4.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 (98) hide show
  1. package/README.md +157 -156
  2. package/components/ui/accordion/ANIMATION_CUSTOMIZATION.md +16 -7
  3. package/components/ui/accordion/AccordionAnimatedHeight.tsx +3 -15
  4. package/components/ui/accordion/AccordionAnimatedIcon.tsx +2 -9
  5. package/components/ui/accordion/AnimatedHeight.tsx +3 -15
  6. package/components/ui/accordion/AnimatedIcon.tsx +2 -9
  7. package/components/ui/accordion/MIGRATION_SUMMARY.md +22 -11
  8. package/components/ui/accordion/USAGE_EXAMPLE.tsx +10 -25
  9. package/components/ui/accordion/index.tsx +71 -139
  10. package/components/ui/actionsheet/index.tsx +63 -105
  11. package/components/ui/alert/index.tsx +20 -50
  12. package/components/ui/alert-dialog/index.tsx +23 -48
  13. package/components/ui/avatar/index.tsx +32 -68
  14. package/components/ui/badge/index.tsx +18 -49
  15. package/components/ui/bottomsheet/index.tsx +20 -52
  16. package/components/ui/box/index.tsx +4 -9
  17. package/components/ui/box/index.web.tsx +3 -9
  18. package/components/ui/button/index.tsx +73 -109
  19. package/components/ui/calendar/creator.tsx +69 -30
  20. package/components/ui/calendar/index.tsx +81 -159
  21. package/components/ui/calendar/styles.tsx +10 -10
  22. package/components/ui/card/index.tsx +8 -9
  23. package/components/ui/card/index.web.tsx +4 -10
  24. package/components/ui/center/index.tsx +6 -11
  25. package/components/ui/center/index.web.tsx +3 -9
  26. package/components/ui/checkbox/index.tsx +46 -107
  27. package/components/ui/date-time-picker/creator.tsx +14 -1
  28. package/components/ui/date-time-picker/index.tsx +107 -156
  29. package/components/ui/date-time-picker/index.web.tsx +11 -33
  30. package/components/ui/date-time-picker/styles.tsx +5 -5
  31. package/components/ui/divider/index.tsx +5 -6
  32. package/components/ui/drawer/index.tsx +108 -128
  33. package/components/ui/fab/index.tsx +25 -68
  34. package/components/ui/flat-list/index.tsx +11 -8
  35. package/components/ui/form-control/index.tsx +49 -90
  36. package/components/ui/gluestack-ui-provider/index.tsx +4 -18
  37. package/components/ui/gluestack-ui-provider/index.web.tsx +10 -11
  38. package/components/ui/gluestack-ui-provider/script.ts +1 -3
  39. package/components/ui/gluestack-ui-provider/theme-context.ts +2 -2
  40. package/components/ui/gluestack-ui-provider/useGluestackColors.ts +2 -6
  41. package/components/ui/grid/index.tsx +128 -165
  42. package/components/ui/grid/index.web.tsx +17 -19
  43. package/components/ui/grid/styles.tsx +1 -3
  44. package/components/ui/heading/index.tsx +146 -169
  45. package/components/ui/heading/index.web.tsx +7 -28
  46. package/components/ui/heading/styles.tsx +5 -5
  47. package/components/ui/hstack/index.tsx +16 -15
  48. package/components/ui/hstack/index.web.tsx +17 -17
  49. package/components/ui/hstack/styles.tsx +5 -5
  50. package/components/ui/icon/index.tsx +95 -486
  51. package/components/ui/icon/index.web.tsx +79 -439
  52. package/components/ui/image/index.tsx +13 -18
  53. package/components/ui/image-viewer/index.tsx +149 -221
  54. package/components/ui/image-viewer/index.web.tsx +88 -113
  55. package/components/ui/input/index.tsx +20 -33
  56. package/components/ui/link/index.tsx +16 -22
  57. package/components/ui/liquid-glass/index.tsx +19 -25
  58. package/components/ui/menu/index.tsx +44 -66
  59. package/components/ui/modal/index.tsx +70 -91
  60. package/components/ui/popover/index.tsx +102 -121
  61. package/components/ui/portal/index.tsx +5 -6
  62. package/components/ui/pressable/index.tsx +5 -9
  63. package/components/ui/progress/index.tsx +4 -11
  64. package/components/ui/radio/index.tsx +47 -83
  65. package/components/ui/select/index.tsx +38 -59
  66. package/components/ui/select/select-actionsheet.tsx +61 -108
  67. package/components/ui/skeleton/index.tsx +22 -43
  68. package/components/ui/skeleton/index.web.tsx +63 -75
  69. package/components/ui/slider/index.tsx +36 -56
  70. package/components/ui/spinner/index.tsx +1 -10
  71. package/components/ui/switch/index.tsx +6 -13
  72. package/components/ui/table/index.tsx +39 -102
  73. package/components/ui/table/index.web.tsx +41 -79
  74. package/components/ui/tabs/TabsAnimatedIndicator.tsx +10 -38
  75. package/components/ui/tabs/creator.tsx +32 -24
  76. package/components/ui/tabs/index.tsx +253 -309
  77. package/components/ui/text/index.tsx +23 -37
  78. package/components/ui/text/index.web.tsx +33 -35
  79. package/components/ui/text/styles.tsx +5 -5
  80. package/components/ui/textarea/index.tsx +24 -38
  81. package/components/ui/toast/index.tsx +47 -52
  82. package/components/ui/tooltip/index.tsx +12 -28
  83. package/components/ui/vstack/index.tsx +17 -17
  84. package/components/ui/vstack/index.web.tsx +17 -17
  85. package/components/ui/vstack/styles.tsx +5 -5
  86. package/design/tools/design.js +15 -12
  87. package/design/tools/npm.js +4 -3
  88. package/dist/{chunk-B277QSR5.mjs → chunk-2R66P5X5.mjs} +1816 -3124
  89. package/dist/chunk-2R66P5X5.mjs.map +1 -0
  90. package/dist/{chunk-GD37RFBR.js → chunk-LCTFQJZM.js} +1816 -3124
  91. package/dist/chunk-LCTFQJZM.js.map +1 -0
  92. package/dist/index.js +294 -294
  93. package/dist/index.mjs +1 -1
  94. package/dist/ui/index.js +294 -294
  95. package/dist/ui/index.mjs +1 -1
  96. package/package.json +12 -7
  97. package/dist/chunk-B277QSR5.mjs.map +0 -1
  98. package/dist/chunk-GD37RFBR.js.map +0 -1
@@ -21,22 +21,17 @@ const TableFooterContext = createContext<{
21
21
  isFooterRow: false,
22
22
  });
23
23
 
24
- const Table = React.forwardRef<HTMLTableElement, React.ComponentProps<'table'>>(
25
- function Table({ className, ...props }, ref) {
26
- return (
27
- <table
28
- ref={ref}
29
- className={tableStyle({ class: className })}
30
- {...props}
31
- />
32
- );
33
- }
34
- );
24
+ const Table = React.forwardRef<HTMLTableElement, React.ComponentProps<'table'>>(function Table(
25
+ { className, ...props },
26
+ ref,
27
+ ) {
28
+ return <table ref={ref} className={tableStyle({ class: className })} {...props} />;
29
+ });
35
30
 
36
- const TableHeader = React.forwardRef<
37
- HTMLTableSectionElement,
38
- React.ComponentProps<'thead'>
39
- >(function TableHeader({ className, ...props }, ref) {
31
+ const TableHeader = React.forwardRef<HTMLTableSectionElement, React.ComponentProps<'thead'>>(function TableHeader(
32
+ { className, ...props },
33
+ ref,
34
+ ) {
40
35
  const contextValue = useMemo(() => {
41
36
  return {
42
37
  isHeaderRow: true,
@@ -44,32 +39,22 @@ const TableHeader = React.forwardRef<
44
39
  }, []);
45
40
  return (
46
41
  <TableHeaderContext.Provider value={contextValue}>
47
- <thead
48
- ref={ref}
49
- className={tableHeaderStyle({ class: className })}
50
- {...props}
51
- />
42
+ <thead ref={ref} className={tableHeaderStyle({ class: className })} {...props} />
52
43
  </TableHeaderContext.Provider>
53
44
  );
54
45
  });
55
46
 
56
- const TableBody = React.forwardRef<
57
- HTMLTableSectionElement,
58
- React.ComponentProps<'tbody'>
59
- >(function TableBody({ className, ...props }, ref) {
60
- return (
61
- <tbody
62
- ref={ref}
63
- className={tableBodyStyle({ class: className })}
64
- {...props}
65
- />
66
- );
47
+ const TableBody = React.forwardRef<HTMLTableSectionElement, React.ComponentProps<'tbody'>>(function TableBody(
48
+ { className, ...props },
49
+ ref,
50
+ ) {
51
+ return <tbody ref={ref} className={tableBodyStyle({ class: className })} {...props} />;
67
52
  });
68
53
 
69
- const TableFooter = React.forwardRef<
70
- HTMLTableSectionElement,
71
- React.ComponentProps<'tfoot'>
72
- >(function TableFooter({ className, ...props }, ref) {
54
+ const TableFooter = React.forwardRef<HTMLTableSectionElement, React.ComponentProps<'tfoot'>>(function TableFooter(
55
+ { className, ...props },
56
+ ref,
57
+ ) {
73
58
  const contextValue = useMemo(() => {
74
59
  return {
75
60
  isFooterRow: true,
@@ -77,28 +62,22 @@ const TableFooter = React.forwardRef<
77
62
  }, []);
78
63
  return (
79
64
  <TableFooterContext.Provider value={contextValue}>
80
- <tfoot
81
- ref={ref}
82
- className={tableFooterStyle({ class: className })}
83
- {...props}
84
- />
65
+ <tfoot ref={ref} className={tableFooterStyle({ class: className })} {...props} />
85
66
  </TableFooterContext.Provider>
86
67
  );
87
68
  });
88
69
 
89
- const TableHead = React.forwardRef<
90
- HTMLTableCellElement,
91
- React.ComponentProps<'th'>
92
- >(function TableHead({ className, ...props }, ref) {
93
- return (
94
- <th ref={ref} className={tableHeadStyle({ class: className })} {...props} />
95
- );
70
+ const TableHead = React.forwardRef<HTMLTableCellElement, React.ComponentProps<'th'>>(function TableHead(
71
+ { className, ...props },
72
+ ref,
73
+ ) {
74
+ return <th ref={ref} className={tableHeadStyle({ class: className })} {...props} />;
96
75
  });
97
76
 
98
- const TableRow = React.forwardRef<
99
- HTMLTableRowElement,
100
- React.ComponentProps<'tr'>
101
- >(function TableRow({ className, ...props }, ref) {
77
+ const TableRow = React.forwardRef<HTMLTableRowElement, React.ComponentProps<'tr'>>(function TableRow(
78
+ { className, ...props },
79
+ ref,
80
+ ) {
102
81
  const { isHeaderRow } = useContext(TableHeaderContext);
103
82
  const { isFooterRow } = useContext(TableFooterContext);
104
83
  return (
@@ -114,26 +93,18 @@ const TableRow = React.forwardRef<
114
93
  );
115
94
  });
116
95
 
117
- const TableData = React.forwardRef<
118
- HTMLTableCellElement,
119
- React.ComponentProps<'td'>
120
- >(function TableData({ className, ...props }, ref) {
121
- return (
122
- <td ref={ref} className={tableDataStyle({ class: className })} {...props} />
123
- );
96
+ const TableData = React.forwardRef<HTMLTableCellElement, React.ComponentProps<'td'>>(function TableData(
97
+ { className, ...props },
98
+ ref,
99
+ ) {
100
+ return <td ref={ref} className={tableDataStyle({ class: className })} {...props} />;
124
101
  });
125
102
 
126
- const TableCaption = React.forwardRef<
127
- HTMLTableCaptionElement,
128
- React.ComponentProps<'caption'>
129
- >(function TableCaption({ className, ...props }, ref) {
130
- return (
131
- <caption
132
- ref={ref}
133
- className={tableCaptionStyle({ class: className })}
134
- {...props}
135
- />
136
- );
103
+ const TableCaption = React.forwardRef<HTMLTableCaptionElement, React.ComponentProps<'caption'>>(function TableCaption(
104
+ { className, ...props },
105
+ ref,
106
+ ) {
107
+ return <caption ref={ref} className={tableCaptionStyle({ class: className })} {...props} />;
137
108
  });
138
109
 
139
110
  Table.displayName = 'Table';
@@ -145,13 +116,4 @@ TableRow.displayName = 'TableRow';
145
116
  TableData.displayName = 'TableData';
146
117
  TableCaption.displayName = 'TableCaption';
147
118
 
148
- export {
149
- Table,
150
- TableHeader,
151
- TableBody,
152
- TableFooter,
153
- TableHead,
154
- TableRow,
155
- TableData,
156
- TableCaption,
157
- };
119
+ export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableData, TableCaption };
@@ -21,25 +21,11 @@ interface TabsAnimatedIndicatorProps {
21
21
  className?: string;
22
22
  style?: any;
23
23
  }
24
- Platform.OS === 'web' ? cssInterop(Animated.View,{className:{target:'style'}}) : Animated.View
24
+ Platform.OS === 'web' ? cssInterop(Animated.View, { className: { target: 'style' } }) : Animated.View;
25
25
  const isWeb = Platform.OS === 'web';
26
26
 
27
- export const TabsAnimatedIndicator = React.forwardRef<
28
- any,
29
- TabsAnimatedIndicatorProps
30
- >(
31
- (
32
- {
33
- selectedKey,
34
- orientation,
35
- triggerLayouts,
36
- scrollOffset = 0,
37
- animatedScrollOffset,
38
- className,
39
- style,
40
- },
41
- ref
42
- ) => {
27
+ export const TabsAnimatedIndicator = React.forwardRef<any, TabsAnimatedIndicatorProps>(
28
+ ({ selectedKey, orientation, triggerLayouts, scrollOffset = 0, animatedScrollOffset, className, style }, ref) => {
43
29
  const animatedX = useSharedValue(0);
44
30
  const animatedY = useSharedValue(0);
45
31
  const animatedWidth = useSharedValue(0);
@@ -62,9 +48,7 @@ export const TabsAnimatedIndicator = React.forwardRef<
62
48
  if (layout && layout.width > 0) {
63
49
  // Determine if this is the first time we're setting values
64
50
  const isFirstRender = !hasLayout;
65
- const duration = isFirstRender
66
- ? 0
67
- : tabsAnimationConfig.indicatorDuration;
51
+ const duration = isFirstRender ? 0 : tabsAnimationConfig.indicatorDuration;
68
52
 
69
53
  // Store the absolute x position (not adjusted for scroll)
70
54
  animatedX.value = withDelay(
@@ -72,7 +56,7 @@ export const TabsAnimatedIndicator = React.forwardRef<
72
56
  withTiming(layout.x, {
73
57
  duration: duration,
74
58
  easing: Easing.ease,
75
- })
59
+ }),
76
60
  );
77
61
  animatedY.value = withTiming(layout.y, {
78
62
  duration: duration,
@@ -92,26 +76,14 @@ export const TabsAnimatedIndicator = React.forwardRef<
92
76
  }
93
77
  }
94
78
  }
95
- }, [
96
- selectedKey,
97
- triggerLayouts,
98
- hasLayout,
99
- animatedX,
100
- animatedY,
101
- animatedWidth,
102
- animatedHeight,
103
- ]);
79
+ }, [selectedKey, triggerLayouts, hasLayout, animatedX, animatedY, animatedWidth, animatedHeight]);
104
80
 
105
81
  const animatedStyle = useAnimatedStyle(() => {
106
82
  'worklet';
107
83
 
108
- const scrollOffsetValue = animatedScrollOffset
109
- ? animatedScrollOffset.value
110
- : scrollOffsetShared.value;
84
+ const scrollOffsetValue = animatedScrollOffset ? animatedScrollOffset.value : scrollOffsetShared.value;
111
85
 
112
- const xPos = orientation === 'horizontal'
113
- ? animatedX.value - scrollOffsetValue
114
- : animatedX.value;
86
+ const xPos = orientation === 'horizontal' ? animatedX.value - scrollOffsetValue : animatedX.value;
115
87
 
116
88
  // Web: react-native-reanimated does not reliably flush the transform
117
89
  // array to a CSS transform string, so use left/top instead.
@@ -149,12 +121,12 @@ export const TabsAnimatedIndicator = React.forwardRef<
149
121
  style,
150
122
  {
151
123
  position: 'absolute',
152
- zIndex:1,
124
+ zIndex: 1,
153
125
  },
154
126
  ]}
155
127
  />
156
128
  );
157
- }
129
+ },
158
130
  );
159
131
 
160
132
  TabsAnimatedIndicator.displayName = 'TabsAnimatedIndicator';
@@ -54,7 +54,7 @@ export function createTabs({
54
54
  }: CreateTabsConfig) {
55
55
  const Tabs = React.forwardRef<any, any>(function Tabs(
56
56
  { value, defaultValue, onValueChange, orientation = 'horizontal', children, ...props },
57
- ref
57
+ ref,
58
58
  ) {
59
59
  const [uncontrolledKey, setUncontrolledKey] = React.useState<string | undefined>(defaultValue);
60
60
  const selectedKey = value !== undefined ? value : uncontrolledKey;
@@ -69,18 +69,24 @@ export function createTabs({
69
69
  if (value === undefined) setUncontrolledKey(key);
70
70
  onValueChange?.(key);
71
71
  },
72
- [value, onValueChange]
72
+ [value, onValueChange],
73
73
  );
74
74
 
75
- const registerTriggerLayout = React.useCallback((key: string, layout: LayoutData) => {
76
- triggerLayouts.set(key, layout);
77
- forceRender();
78
- }, [triggerLayouts]);
75
+ const registerTriggerLayout = React.useCallback(
76
+ (key: string, layout: LayoutData) => {
77
+ triggerLayouts.set(key, layout);
78
+ forceRender();
79
+ },
80
+ [triggerLayouts],
81
+ );
79
82
 
80
- const registerContentLayout = React.useCallback((key: string, layout: LayoutData) => {
81
- contentLayouts.set(key, layout);
82
- forceRender();
83
- }, [contentLayouts]);
83
+ const registerContentLayout = React.useCallback(
84
+ (key: string, layout: LayoutData) => {
85
+ contentLayouts.set(key, layout);
86
+ forceRender();
87
+ },
88
+ [contentLayouts],
89
+ );
84
90
 
85
91
  const contextValue = React.useMemo<TabsContextValue>(
86
92
  () => ({
@@ -95,7 +101,16 @@ export function createTabs({
95
101
  registerTriggerLayout,
96
102
  registerContentLayout,
97
103
  }),
98
- [orientation, selectedKey, setSelectedKey, scrollOffset, triggerLayouts, contentLayouts, registerTriggerLayout, registerContentLayout]
104
+ [
105
+ orientation,
106
+ selectedKey,
107
+ setSelectedKey,
108
+ scrollOffset,
109
+ triggerLayouts,
110
+ contentLayouts,
111
+ registerTriggerLayout,
112
+ registerContentLayout,
113
+ ],
99
114
  );
100
115
 
101
116
  return (
@@ -117,7 +132,7 @@ export function createTabs({
117
132
 
118
133
  const TabsTriggerBase = React.forwardRef<any, any>(function TabsTriggerBase(
119
134
  { value, disabled, onPress, onLayout, ...props },
120
- ref
135
+ ref,
121
136
  ) {
122
137
  const context = React.useContext(TabsContext);
123
138
  const isSelected = context?.selectedKey === value;
@@ -128,7 +143,7 @@ export function createTabs({
128
143
  context?.registerTriggerLayout(value, { x, y, width, height });
129
144
  onLayout?.(event);
130
145
  },
131
- [context, value, onLayout]
146
+ [context, value, onLayout],
132
147
  );
133
148
 
134
149
  const handlePress = React.useCallback(
@@ -136,7 +151,7 @@ export function createTabs({
136
151
  if (!disabled) context?.setSelectedKey(value);
137
152
  onPress?.(event);
138
153
  },
139
- [context, disabled, value, onPress]
154
+ [context, disabled, value, onPress],
140
155
  );
141
156
 
142
157
  return (
@@ -153,7 +168,7 @@ export function createTabs({
153
168
 
154
169
  const TabsContentBase = React.forwardRef<any, any>(function TabsContentBase(
155
170
  { value, style, onLayout, ...props },
156
- ref
171
+ ref,
157
172
  ) {
158
173
  const context = React.useContext(TabsContext);
159
174
  const isSelected = context?.selectedKey === value;
@@ -164,17 +179,10 @@ export function createTabs({
164
179
  context?.registerContentLayout(value, { x, y, width, height });
165
180
  onLayout?.(event);
166
181
  },
167
- [context, value, onLayout]
182
+ [context, value, onLayout],
168
183
  );
169
184
 
170
- return (
171
- <Content
172
- ref={ref}
173
- onLayout={handleLayout}
174
- style={[style, !isSelected && { display: 'none' }]}
175
- {...props}
176
- />
177
- );
185
+ return <Content ref={ref} onLayout={handleLayout} style={[style, !isSelected && { display: 'none' }]} {...props} />;
178
186
  });
179
187
 
180
188
  const TabsContentWrapperBase = React.forwardRef<any, any>(function TabsContentWrapperBase(props, ref) {