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.
- package/lib/commonjs/badge/index.js +13 -8
- package/lib/commonjs/badge/index.js.map +1 -1
- package/lib/commonjs/button/index.js +4 -3
- package/lib/commonjs/button/index.js.map +1 -1
- package/lib/commonjs/card/index.js +23 -15
- package/lib/commonjs/card/index.js.map +1 -1
- package/lib/commonjs/checkBox/index.js +5 -3
- package/lib/commonjs/checkBox/index.js.map +1 -1
- package/lib/commonjs/dropdown/index.js +10 -6
- package/lib/commonjs/dropdown/index.js.map +1 -1
- package/lib/commonjs/header/index.js +59 -55
- package/lib/commonjs/header/index.js.map +1 -1
- package/lib/commonjs/image/index.js +5 -3
- package/lib/commonjs/image/index.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/input/index.js +5 -3
- package/lib/commonjs/input/index.js.map +1 -1
- package/lib/commonjs/page/index.js +20 -4
- package/lib/commonjs/page/index.js.map +1 -1
- package/lib/commonjs/safeAreaView/index.js +4 -0
- package/lib/commonjs/safeAreaView/index.js.map +1 -1
- package/lib/commonjs/seperator/index.js +5 -3
- package/lib/commonjs/seperator/index.js.map +1 -1
- package/lib/commonjs/shape/cycle.js +5 -3
- package/lib/commonjs/shape/cycle.js.map +1 -1
- package/lib/commonjs/shape/index.js +6 -3
- package/lib/commonjs/shape/index.js.map +1 -1
- package/lib/commonjs/spinner/index.js +17 -11
- package/lib/commonjs/spinner/index.js.map +1 -1
- package/lib/commonjs/utiles/styled.js +14 -32
- package/lib/commonjs/utiles/styled.js.map +1 -1
- package/lib/module/badge/index.js +10 -8
- package/lib/module/badge/index.js.map +1 -1
- package/lib/module/button/index.js +4 -3
- package/lib/module/button/index.js.map +1 -1
- package/lib/module/card/index.js +20 -15
- package/lib/module/card/index.js.map +1 -1
- package/lib/module/checkBox/index.js +5 -4
- package/lib/module/checkBox/index.js.map +1 -1
- package/lib/module/dropdown/index.js +9 -7
- package/lib/module/dropdown/index.js.map +1 -1
- package/lib/module/header/index.js +52 -48
- package/lib/module/header/index.js.map +1 -1
- package/lib/module/image/index.js +4 -3
- package/lib/module/image/index.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/input/index.js +5 -4
- package/lib/module/input/index.js.map +1 -1
- package/lib/module/page/index.js +21 -4
- package/lib/module/page/index.js.map +1 -1
- package/lib/module/safeAreaView/index.js +4 -0
- package/lib/module/safeAreaView/index.js.map +1 -1
- package/lib/module/seperator/index.js +4 -3
- package/lib/module/seperator/index.js.map +1 -1
- package/lib/module/shape/cycle.js +4 -3
- package/lib/module/shape/cycle.js.map +1 -1
- package/lib/module/shape/index.js +6 -3
- package/lib/module/shape/index.js.map +1 -1
- package/lib/module/spinner/index.js +13 -10
- package/lib/module/spinner/index.js.map +1 -1
- package/lib/module/utiles/styled.js +13 -31
- package/lib/module/utiles/styled.js.map +1 -1
- package/lib/typescript/badge/index.d.ts +13 -6
- package/lib/typescript/badge/index.d.ts.map +1 -1
- package/lib/typescript/button/index.d.ts +12 -8
- package/lib/typescript/button/index.d.ts.map +1 -1
- package/lib/typescript/card/index.d.ts +37 -10
- package/lib/typescript/card/index.d.ts.map +1 -1
- package/lib/typescript/checkBox/index.d.ts +12 -1
- package/lib/typescript/checkBox/index.d.ts.map +1 -1
- package/lib/typescript/dialog/index.d.ts +6 -3
- package/lib/typescript/dialog/index.d.ts.map +1 -1
- package/lib/typescript/divider/index.d.ts +6 -3
- package/lib/typescript/divider/index.d.ts.map +1 -1
- package/lib/typescript/dropdown/index.d.ts +12 -2
- package/lib/typescript/dropdown/index.d.ts.map +1 -1
- package/lib/typescript/header/index.d.ts +6 -8
- package/lib/typescript/header/index.d.ts.map +1 -1
- package/lib/typescript/image/index.d.ts +9 -4
- package/lib/typescript/image/index.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/input/index.d.ts +12 -1
- package/lib/typescript/input/index.d.ts.map +1 -1
- package/lib/typescript/page/index.d.ts +17 -7
- package/lib/typescript/page/index.d.ts.map +1 -1
- package/lib/typescript/pressable/index.d.ts +6 -3
- package/lib/typescript/pressable/index.d.ts.map +1 -1
- package/lib/typescript/safeAreaProvider/index.d.ts +6 -3
- package/lib/typescript/safeAreaProvider/index.d.ts.map +1 -1
- package/lib/typescript/safeAreaView/index.d.ts +6 -3
- package/lib/typescript/safeAreaView/index.d.ts.map +1 -1
- package/lib/typescript/scrollView/index.d.ts +6 -3
- package/lib/typescript/scrollView/index.d.ts.map +1 -1
- package/lib/typescript/seperator/index.d.ts +7 -2
- package/lib/typescript/seperator/index.d.ts.map +1 -1
- package/lib/typescript/shape/cycle.d.ts +12 -4
- package/lib/typescript/shape/cycle.d.ts.map +1 -1
- package/lib/typescript/shape/index.d.ts +7 -4
- package/lib/typescript/shape/index.d.ts.map +1 -1
- package/lib/typescript/spacer/index.d.ts +6 -3
- package/lib/typescript/spacer/index.d.ts.map +1 -1
- package/lib/typescript/spinner/index.d.ts +18 -3
- package/lib/typescript/spinner/index.d.ts.map +1 -1
- package/lib/typescript/stack/index.d.ts +18 -9
- package/lib/typescript/stack/index.d.ts.map +1 -1
- package/lib/typescript/text/index.d.ts +6 -3
- package/lib/typescript/text/index.d.ts.map +1 -1
- package/lib/typescript/utiles/styled.d.ts +7 -4
- package/lib/typescript/utiles/styled.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/badge/index.tsx +7 -17
- package/src/button/index.tsx +7 -12
- package/src/card/index.tsx +21 -23
- package/src/checkBox/index.tsx +16 -21
- package/src/dropdown/index.tsx +59 -67
- package/src/header/index.tsx +119 -112
- package/src/image/index.tsx +2 -2
- package/src/index.ts +1 -1
- package/src/input/index.tsx +56 -59
- package/src/page/index.tsx +21 -3
- package/src/safeAreaView/index.tsx +6 -2
- package/src/seperator/index.tsx +4 -10
- package/src/shape/cycle.tsx +10 -12
- package/src/shape/index.tsx +7 -3
- package/src/spinner/index.tsx +49 -55
- package/src/utiles/styled.tsx +14 -27
package/src/spinner/index.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import 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 =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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 =
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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 =
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
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
|
|
package/src/utiles/styled.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import React, { ComponentType
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
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 };
|