fluent-styles 1.62.4 → 1.62.6

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 (129) hide show
  1. package/lib/commonjs/badge/index.js +13 -8
  2. package/lib/commonjs/badge/index.js.map +1 -1
  3. package/lib/commonjs/button/index.js +4 -3
  4. package/lib/commonjs/button/index.js.map +1 -1
  5. package/lib/commonjs/card/index.js +23 -15
  6. package/lib/commonjs/card/index.js.map +1 -1
  7. package/lib/commonjs/checkBox/index.js +5 -3
  8. package/lib/commonjs/checkBox/index.js.map +1 -1
  9. package/lib/commonjs/dropdown/index.js +10 -6
  10. package/lib/commonjs/dropdown/index.js.map +1 -1
  11. package/lib/commonjs/header/index.js +59 -55
  12. package/lib/commonjs/header/index.js.map +1 -1
  13. package/lib/commonjs/image/index.js +5 -3
  14. package/lib/commonjs/image/index.js.map +1 -1
  15. package/lib/commonjs/index.js +7 -0
  16. package/lib/commonjs/index.js.map +1 -1
  17. package/lib/commonjs/input/index.js +5 -3
  18. package/lib/commonjs/input/index.js.map +1 -1
  19. package/lib/commonjs/page/index.js +20 -4
  20. package/lib/commonjs/page/index.js.map +1 -1
  21. package/lib/commonjs/safeAreaView/index.js +4 -0
  22. package/lib/commonjs/safeAreaView/index.js.map +1 -1
  23. package/lib/commonjs/seperator/index.js +5 -3
  24. package/lib/commonjs/seperator/index.js.map +1 -1
  25. package/lib/commonjs/shape/cycle.js +5 -3
  26. package/lib/commonjs/shape/cycle.js.map +1 -1
  27. package/lib/commonjs/shape/index.js +6 -3
  28. package/lib/commonjs/shape/index.js.map +1 -1
  29. package/lib/commonjs/spinner/index.js +17 -11
  30. package/lib/commonjs/spinner/index.js.map +1 -1
  31. package/lib/commonjs/utiles/styled.js +14 -32
  32. package/lib/commonjs/utiles/styled.js.map +1 -1
  33. package/lib/module/badge/index.js +10 -8
  34. package/lib/module/badge/index.js.map +1 -1
  35. package/lib/module/button/index.js +4 -3
  36. package/lib/module/button/index.js.map +1 -1
  37. package/lib/module/card/index.js +20 -15
  38. package/lib/module/card/index.js.map +1 -1
  39. package/lib/module/checkBox/index.js +5 -4
  40. package/lib/module/checkBox/index.js.map +1 -1
  41. package/lib/module/dropdown/index.js +9 -7
  42. package/lib/module/dropdown/index.js.map +1 -1
  43. package/lib/module/header/index.js +52 -48
  44. package/lib/module/header/index.js.map +1 -1
  45. package/lib/module/image/index.js +4 -3
  46. package/lib/module/image/index.js.map +1 -1
  47. package/lib/module/index.js +1 -1
  48. package/lib/module/index.js.map +1 -1
  49. package/lib/module/input/index.js +5 -4
  50. package/lib/module/input/index.js.map +1 -1
  51. package/lib/module/page/index.js +21 -4
  52. package/lib/module/page/index.js.map +1 -1
  53. package/lib/module/safeAreaView/index.js +4 -0
  54. package/lib/module/safeAreaView/index.js.map +1 -1
  55. package/lib/module/seperator/index.js +4 -3
  56. package/lib/module/seperator/index.js.map +1 -1
  57. package/lib/module/shape/cycle.js +4 -3
  58. package/lib/module/shape/cycle.js.map +1 -1
  59. package/lib/module/shape/index.js +6 -3
  60. package/lib/module/shape/index.js.map +1 -1
  61. package/lib/module/spinner/index.js +13 -10
  62. package/lib/module/spinner/index.js.map +1 -1
  63. package/lib/module/utiles/styled.js +13 -31
  64. package/lib/module/utiles/styled.js.map +1 -1
  65. package/lib/typescript/badge/index.d.ts +13 -6
  66. package/lib/typescript/badge/index.d.ts.map +1 -1
  67. package/lib/typescript/button/index.d.ts +12 -8
  68. package/lib/typescript/button/index.d.ts.map +1 -1
  69. package/lib/typescript/card/index.d.ts +37 -10
  70. package/lib/typescript/card/index.d.ts.map +1 -1
  71. package/lib/typescript/checkBox/index.d.ts +12 -1
  72. package/lib/typescript/checkBox/index.d.ts.map +1 -1
  73. package/lib/typescript/dialog/index.d.ts +6 -3
  74. package/lib/typescript/dialog/index.d.ts.map +1 -1
  75. package/lib/typescript/divider/index.d.ts +6 -3
  76. package/lib/typescript/divider/index.d.ts.map +1 -1
  77. package/lib/typescript/dropdown/index.d.ts +12 -2
  78. package/lib/typescript/dropdown/index.d.ts.map +1 -1
  79. package/lib/typescript/header/index.d.ts +6 -8
  80. package/lib/typescript/header/index.d.ts.map +1 -1
  81. package/lib/typescript/image/index.d.ts +9 -4
  82. package/lib/typescript/image/index.d.ts.map +1 -1
  83. package/lib/typescript/index.d.ts +1 -1
  84. package/lib/typescript/index.d.ts.map +1 -1
  85. package/lib/typescript/input/index.d.ts +12 -1
  86. package/lib/typescript/input/index.d.ts.map +1 -1
  87. package/lib/typescript/page/index.d.ts +17 -7
  88. package/lib/typescript/page/index.d.ts.map +1 -1
  89. package/lib/typescript/pressable/index.d.ts +6 -3
  90. package/lib/typescript/pressable/index.d.ts.map +1 -1
  91. package/lib/typescript/safeAreaProvider/index.d.ts +6 -3
  92. package/lib/typescript/safeAreaProvider/index.d.ts.map +1 -1
  93. package/lib/typescript/safeAreaView/index.d.ts +6 -3
  94. package/lib/typescript/safeAreaView/index.d.ts.map +1 -1
  95. package/lib/typescript/scrollView/index.d.ts +6 -3
  96. package/lib/typescript/scrollView/index.d.ts.map +1 -1
  97. package/lib/typescript/seperator/index.d.ts +7 -2
  98. package/lib/typescript/seperator/index.d.ts.map +1 -1
  99. package/lib/typescript/shape/cycle.d.ts +12 -4
  100. package/lib/typescript/shape/cycle.d.ts.map +1 -1
  101. package/lib/typescript/shape/index.d.ts +7 -4
  102. package/lib/typescript/shape/index.d.ts.map +1 -1
  103. package/lib/typescript/spacer/index.d.ts +6 -3
  104. package/lib/typescript/spacer/index.d.ts.map +1 -1
  105. package/lib/typescript/spinner/index.d.ts +18 -3
  106. package/lib/typescript/spinner/index.d.ts.map +1 -1
  107. package/lib/typescript/stack/index.d.ts +18 -9
  108. package/lib/typescript/stack/index.d.ts.map +1 -1
  109. package/lib/typescript/text/index.d.ts +6 -3
  110. package/lib/typescript/text/index.d.ts.map +1 -1
  111. package/lib/typescript/utiles/styled.d.ts +7 -4
  112. package/lib/typescript/utiles/styled.d.ts.map +1 -1
  113. package/package.json +1 -1
  114. package/src/badge/index.tsx +7 -17
  115. package/src/button/index.tsx +7 -12
  116. package/src/card/index.tsx +21 -23
  117. package/src/checkBox/index.tsx +16 -21
  118. package/src/dropdown/index.tsx +59 -67
  119. package/src/header/index.tsx +119 -112
  120. package/src/image/index.tsx +2 -2
  121. package/src/index.ts +1 -1
  122. package/src/input/index.tsx +56 -59
  123. package/src/page/index.tsx +21 -3
  124. package/src/safeAreaView/index.tsx +6 -2
  125. package/src/seperator/index.tsx +4 -10
  126. package/src/shape/cycle.tsx +10 -12
  127. package/src/shape/index.tsx +7 -3
  128. package/src/spinner/index.tsx +49 -55
  129. package/src/utiles/styled.tsx +14 -27
@@ -1,4 +1,4 @@
1
- import React, { forwardRef } from 'react';
1
+ import React from 'react';
2
2
  import {
3
3
  ActivityIndicator,
4
4
  ActivityIndicatorProps,
@@ -94,22 +94,21 @@ const StyledActivityIndicator = styled<any>(ActivityIndicator, {
94
94
  * - Theme integration
95
95
  * - Accessibility support
96
96
  */
97
- const StyledSpinner = forwardRef<any, SpinnerProps>(
98
- (
99
- {
100
- size = 'medium',
101
- variant = 'primary',
102
- color,
103
- overlay = false,
104
- overlayColor = 'rgba(0, 0, 0, 0.3)',
105
- label,
106
- labelColor,
107
- labelSize = 14,
108
- accessibilityLabel = 'Loading',
109
- ...rest
110
- },
111
- ref
112
- ) => {
97
+ const StyledSpinner = (
98
+ {
99
+ size = 'medium',
100
+ variant = 'primary',
101
+ color,
102
+ overlay = false,
103
+ overlayColor = 'rgba(0, 0, 0, 0.3)',
104
+ label,
105
+ labelColor,
106
+ labelSize = 14,
107
+ accessibilityLabel = 'Loading',
108
+ ref,
109
+ ...rest
110
+ }: SpinnerProps & { ref?: React.Ref<any> }
111
+ ) => {
113
112
  // Determine size
114
113
  const finalSize = typeof size === 'number' ? size : sizeConfig[size];
115
114
 
@@ -178,8 +177,7 @@ const StyledSpinner = forwardRef<any, SpinnerProps>(
178
177
  </YStack>
179
178
  </YStack>
180
179
  );
181
- }
182
- );
180
+ };
183
181
 
184
182
  StyledSpinner.displayName = 'StyledSpinner';
185
183
 
@@ -198,22 +196,21 @@ interface SpinnerContainerProps extends Omit<SpinnerProps, 'ref' | 'overlay'> {
198
196
  *
199
197
  * Use for: Page loading, data fetching, async operations
200
198
  */
201
- const SpinnerContainer = forwardRef<any, SpinnerContainerProps>(
202
- (
203
- {
204
- isVisible = true,
205
- size = 'large',
206
- variant = 'primary',
207
- color,
208
- backdropColor = 'rgba(0, 0, 0, 0.5)',
209
- message,
210
- labelColor,
211
- labelSize = 14,
212
- onBackdropPress,
213
- ...rest
214
- },
215
- ref
216
- ) => {
199
+ const SpinnerContainer = (
200
+ {
201
+ isVisible = true,
202
+ size = 'large',
203
+ variant = 'primary',
204
+ color,
205
+ backdropColor = 'rgba(0, 0, 0, 0.5)',
206
+ message,
207
+ labelColor,
208
+ labelSize = 14,
209
+ onBackdropPress,
210
+ ref,
211
+ ...rest
212
+ }: SpinnerContainerProps & { ref?: React.Ref<any> }
213
+ ) => {
217
214
  if (!isVisible) return null;
218
215
 
219
216
  // Determine size
@@ -283,8 +280,7 @@ const SpinnerContainer = forwardRef<any, SpinnerContainerProps>(
283
280
  {spinnerContent}
284
281
  </StyledButton>
285
282
  );
286
- }
287
- );
283
+ };
288
284
 
289
285
  SpinnerContainer.displayName = 'SpinnerContainer';
290
286
 
@@ -302,22 +298,21 @@ interface InlineSpinnerProps extends Omit<SpinnerProps, 'overlay'> {
302
298
  *
303
299
  * Use for: Button loading states, inline operations, compact loading indicators
304
300
  */
305
- const InlineSpinner = forwardRef<any, InlineSpinnerProps>(
306
- (
307
- {
308
- size = 'small',
309
- variant = 'primary',
310
- color,
311
- text,
312
- labelColor,
313
- labelSize = 12,
314
- direction = 'row',
315
- gap = 8,
316
- accessibilityLabel = 'Loading',
317
- ...rest
318
- },
319
- ref
320
- ) => {
301
+ const InlineSpinner = (
302
+ {
303
+ size = 'small',
304
+ variant = 'primary',
305
+ color,
306
+ text,
307
+ labelColor,
308
+ labelSize = 12,
309
+ direction = 'row',
310
+ gap = 8,
311
+ accessibilityLabel = 'Loading',
312
+ ref,
313
+ ...rest
314
+ }: InlineSpinnerProps & { ref?: React.Ref<any> }
315
+ ) => {
321
316
  // Determine size
322
317
  const finalSize = typeof size === 'number' ? size : sizeConfig[size];
323
318
 
@@ -348,8 +343,7 @@ const InlineSpinner = forwardRef<any, InlineSpinnerProps>(
348
343
  )}
349
344
  </StackComponent>
350
345
  );
351
- }
352
- );
346
+ };
353
347
 
354
348
  InlineSpinner.displayName = 'InlineSpinner';
355
349
 
@@ -1,5 +1,5 @@
1
1
 
2
- import React, { ComponentType, Ref, forwardRef } from "react";
2
+ import React, { ComponentType } from "react";
3
3
  import { ViewStyle, TextStyle, ImageStyle } from "react-native";
4
4
 
5
5
  type Style = ViewStyle | TextStyle | ImageStyle;
@@ -13,52 +13,39 @@ interface StyledOptions {
13
13
  };
14
14
  }
15
15
 
16
- // React 19 passes ref as a regular prop; React 18 and below do not.
17
- const isReact19 = typeof React.version === "string" && parseInt(React.version) >= 19;
18
-
19
16
  const styled = <P extends object>(
20
17
  Component: ComponentType<P>,
21
18
  { base, variants }: StyledOptions = {}
22
19
  ) => {
23
- function buildStyles(options: Record<string, any>): Style {
20
+ const StyledComponent = (props: P & { ref?: React.Ref<any> }) => {
24
21
  const styles: Style = { ...(base || {}) };
22
+ const options = props as Record<string, any>;
23
+ const cleanProps = { ...options };
25
24
 
26
25
  if (variants) {
27
26
  Object.keys(variants).forEach((category) => {
27
+ delete cleanProps[category];
28
28
  const variantSelected = options[category];
29
29
  const variantValue = variants[category];
30
30
 
31
31
  if (typeof variantValue === "function") {
32
32
  const style = variantValue(variantSelected, options);
33
33
  if (style) Object.assign(styles, style);
34
- } else if (variantValue && variantValue[variantSelected]) {
34
+ } else if (variantValue?.[variantSelected]) {
35
35
  const value = variantValue[variantSelected];
36
- Object.assign(
37
- styles,
38
- typeof value === "function" ? value(variantSelected, options) : value
39
- );
36
+ Object.assign(styles, typeof value === "function" ? value(variantSelected, options) : value);
40
37
  }
41
38
  });
42
39
  }
43
40
 
44
- return styles;
45
- }
41
+ return <Component {...(cleanProps as P)} style={styles} />;
42
+ };
46
43
 
47
- if (isReact19) {
48
- // React 19: ref is a plain prop
49
- function StyledComponent19(props: P & { ref?: Ref<any> }) {
50
- const { ref, ...rest } = props as any;
51
- const styles = buildStyles(rest);
52
- return <Component {...(rest as any)} style={styles} ref={ref} />;
53
- }
54
- return StyledComponent19;
55
- }
44
+ StyledComponent.displayName = `Styled(${
45
+ typeof Component === "string" ? Component : Component.displayName ?? Component.name ?? "Component"
46
+ })`;
56
47
 
57
- // React 18 and below: use forwardRef
58
- return forwardRef<any, P>((props, ref) => {
59
- const styles = buildStyles(props as Record<string, any>);
60
- return <Component {...(props as any)} style={styles} ref={ref} />;
61
- });
48
+ return StyledComponent;
62
49
  };
63
50
 
64
- export { styled };
51
+ export { styled };