cpk-ui 0.5.4 → 0.7.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.
- package/README.md +80 -147
- package/components/modals/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/components/modals/AlertDialog/AlertDialog.js +14 -7
- package/components/modals/Snackbar/Snackbar.d.ts.map +1 -1
- package/components/modals/Snackbar/Snackbar.js +20 -17
- package/components/uis/Accordion/AccordionItem.d.ts.map +1 -1
- package/components/uis/Accordion/AccordionItem.js +41 -17
- package/components/uis/Button/Button.d.ts +2 -1
- package/components/uis/Button/Button.d.ts.map +1 -1
- package/components/uis/Button/Button.js +11 -11
- package/components/uis/Card/Card.d.ts +2 -1
- package/components/uis/Card/Card.d.ts.map +1 -1
- package/components/uis/Card/Card.js +12 -3
- package/components/uis/Checkbox/Checkbox.d.ts +2 -1
- package/components/uis/Checkbox/Checkbox.d.ts.map +1 -1
- package/components/uis/Checkbox/Checkbox.js +2 -2
- package/components/uis/CustomPressable/CustomPressable.d.ts.map +1 -1
- package/components/uis/CustomPressable/CustomPressable.js +6 -6
- package/components/uis/EditText/EditText.d.ts +1 -0
- package/components/uis/EditText/EditText.d.ts.map +1 -1
- package/components/uis/EditText/EditText.js +18 -13
- package/components/uis/Fab/Fab.d.ts +2 -2
- package/components/uis/Fab/Fab.d.ts.map +1 -1
- package/components/uis/Fab/Fab.js +22 -4
- package/components/uis/Icon/Icon.d.ts.map +1 -1
- package/components/uis/Icon/Icon.js +6 -3
- package/components/uis/IconButton/IconButton.d.ts +2 -1
- package/components/uis/IconButton/IconButton.d.ts.map +1 -1
- package/components/uis/IconButton/IconButton.js +44 -42
- package/components/uis/LoadingIndicator/LoadingIndicator.d.ts +2 -1
- package/components/uis/LoadingIndicator/LoadingIndicator.d.ts.map +1 -1
- package/components/uis/LoadingIndicator/LoadingIndicator.js +4 -4
- package/components/uis/RadioGroup/RadioButton.d.ts +2 -1
- package/components/uis/RadioGroup/RadioButton.d.ts.map +1 -1
- package/components/uis/RadioGroup/RadioButton.js +2 -2
- package/components/uis/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/components/uis/RadioGroup/RadioGroup.js +16 -3
- package/components/uis/Rating/Rating.d.ts.map +1 -1
- package/components/uis/Rating/Rating.js +23 -19
- package/components/uis/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/components/uis/SegmentedControl/SegmentedControl.js +1 -1
- package/components/uis/StatusbarBrightness/StatusBarBrightness.d.ts +2 -2
- package/components/uis/StatusbarBrightness/StatusBarBrightness.d.ts.map +1 -1
- package/components/uis/StatusbarBrightness/StatusBarBrightness.js +1 -1
- package/components/uis/SwitchToggle/SwitchToggle.d.ts +2 -1
- package/components/uis/SwitchToggle/SwitchToggle.d.ts.map +1 -1
- package/components/uis/SwitchToggle/SwitchToggle.js +2 -2
- package/hooks/useHoverState.d.ts +8 -0
- package/hooks/useHoverState.d.ts.map +1 -0
- package/hooks/useHoverState.js +16 -0
- package/package.json +18 -6
- package/providers/ThemeProvider.d.ts.map +1 -1
- package/providers/ThemeProvider.js +0 -1
- package/providers/index.d.ts.map +1 -1
- package/providers/index.js +3 -2
- package/components/uis/Icon/selection.json +0 -1
- package/src/components/common/ErrorBoundary/ErrorBoundary.tsx +0 -75
- package/src/components/modals/AlertDialog/AlertDialog.stories.tsx +0 -216
- package/src/components/modals/AlertDialog/AlertDialog.test.tsx +0 -251
- package/src/components/modals/AlertDialog/AlertDialog.tsx +0 -356
- package/src/components/modals/Snackbar/Snackbar.stories.tsx +0 -182
- package/src/components/modals/Snackbar/Snackbar.test.tsx +0 -319
- package/src/components/modals/Snackbar/Snackbar.tsx +0 -260
- package/src/components/modals/Snackbar/const.ts +0 -4
- package/src/components/uis/Accordion/Accordion.stories.tsx +0 -167
- package/src/components/uis/Accordion/Accordion.test.tsx +0 -272
- package/src/components/uis/Accordion/Accordion.tsx +0 -109
- package/src/components/uis/Accordion/AccordionItem.tsx +0 -306
- package/src/components/uis/Button/Button.stories.tsx +0 -218
- package/src/components/uis/Button/Button.test.tsx +0 -620
- package/src/components/uis/Button/Button.tsx +0 -436
- package/src/components/uis/Card/Card.test.tsx +0 -146
- package/src/components/uis/Card/Card.tsx +0 -102
- package/src/components/uis/Checkbox/Checkbox.stories.tsx +0 -216
- package/src/components/uis/Checkbox/Checkbox.test.tsx +0 -173
- package/src/components/uis/Checkbox/Checkbox.tsx +0 -220
- package/src/components/uis/CustomPressable/CustomPressable.tsx +0 -48
- package/src/components/uis/EditText/EditText.stories.tsx +0 -124
- package/src/components/uis/EditText/EditText.test.tsx +0 -477
- package/src/components/uis/EditText/EditText.tsx +0 -590
- package/src/components/uis/Fab/Fab.stories.tsx +0 -133
- package/src/components/uis/Fab/Fab.test.tsx +0 -110
- package/src/components/uis/Fab/Fab.tsx +0 -168
- package/src/components/uis/Hr/Hr.test.tsx +0 -26
- package/src/components/uis/Hr/Hr.tsx +0 -19
- package/src/components/uis/Icon/Icon.stories.tsx +0 -98
- package/src/components/uis/Icon/Icon.test.tsx +0 -49
- package/src/components/uis/Icon/Icon.tsx +0 -3819
- package/src/components/uis/IconButton/IconButton.test.tsx +0 -165
- package/src/components/uis/IconButton/IconButton.tsx +0 -275
- package/src/components/uis/LoadingIndicator/LoadingIndicator.tsx +0 -126
- package/src/components/uis/LoadingIndicator/LodingIndicator.stories.tsx +0 -81
- package/src/components/uis/PinchZoom/PinchZoom.stories.tsx +0 -266
- package/src/components/uis/PinchZoom/PinchZoom.test.tsx +0 -113
- package/src/components/uis/PinchZoom/PinchZoom.tsx +0 -424
- package/src/components/uis/RadioGroup/RadioButton.tsx +0 -188
- package/src/components/uis/RadioGroup/RadioGroup.stories.tsx +0 -188
- package/src/components/uis/RadioGroup/RadioGroup.test.tsx +0 -287
- package/src/components/uis/RadioGroup/RadioGroup.tsx +0 -109
- package/src/components/uis/Rating/Rating.test.tsx +0 -98
- package/src/components/uis/Rating/Rating.tsx +0 -200
- package/src/components/uis/SegmentedControl/SegmentedControl.stories.tsx +0 -546
- package/src/components/uis/SegmentedControl/SegmentedControl.test.tsx +0 -274
- package/src/components/uis/SegmentedControl/SegmentedControl.tsx +0 -229
- package/src/components/uis/StatusbarBrightness/StatusBarBrightness.test.tsx +0 -41
- package/src/components/uis/StatusbarBrightness/StatusBarBrightness.tsx +0 -26
- package/src/components/uis/Styled/StyledComponents.tsx +0 -217
- package/src/components/uis/SwitchToggle/SwitchToggle.stories.tsx +0 -75
- package/src/components/uis/SwitchToggle/SwitchToggle.test.tsx +0 -105
- package/src/components/uis/SwitchToggle/SwitchToggle.tsx +0 -305
- package/src/components/uis/Typography/Typography.stories.tsx +0 -149
- package/src/components/uis/Typography/Typography.test.tsx +0 -58
- package/src/components/uis/Typography/Typography.tsx +0 -386
- package/src/hooks/index.ts +0 -2
- package/src/hooks/useAnimations.ts +0 -71
- package/src/hooks/useDebouncedColorScheme.tsx +0 -30
- package/src/hooks/useOptimizedStyles.ts +0 -22
- package/src/hooks/usePerformance.ts +0 -93
- package/src/index.tsx +0 -38
- package/src/providers/ThemeProvider.tsx +0 -177
- package/src/providers/index.tsx +0 -130
- package/src/test/testUtils.tsx +0 -101
- package/src/types/common.ts +0 -77
- package/src/types/index.ts +0 -1
- package/src/types/kstyled.d.ts +0 -6
- package/src/utils/accessibility.ts +0 -110
- package/src/utils/colors.ts +0 -151
- package/src/utils/createCtx.tsx +0 -26
- package/src/utils/guards.ts +0 -93
- package/src/utils/index.ts +0 -2
- package/src/utils/performanceTest.ts +0 -174
- package/src/utils/platform.ts +0 -69
- package/src/utils/theme.ts +0 -38
- package/test/testUtils.d.ts +0 -113
- package/test/testUtils.d.ts.map +0 -1
- package/test/testUtils.js +0 -65
|
@@ -8,7 +8,7 @@ import React from 'react';
|
|
|
8
8
|
import { View } from 'react-native';
|
|
9
9
|
import { styled } from 'kstyled';
|
|
10
10
|
import { useTheme } from '../../../providers/ThemeProvider';
|
|
11
|
-
export default function Card({ testID = 'card-container', children, elevation = 2, borderRadius = 8, padding = 16, margin = 0, backgroundColor, style, styles, onPress, }) {
|
|
11
|
+
export default function Card({ testID = 'card-container', accessibilityLabel, children, elevation = 2, borderRadius = 8, padding = 16, margin = 0, backgroundColor, style, styles, onPress, }) {
|
|
12
12
|
const { theme } = useTheme();
|
|
13
13
|
const shadowStyle = React.useMemo(() => ({
|
|
14
14
|
elevation: elevation,
|
|
@@ -30,9 +30,18 @@ export default function Card({ testID = 'card-container', children, elevation =
|
|
|
30
30
|
shadowStyle,
|
|
31
31
|
style,
|
|
32
32
|
styles?.container,
|
|
33
|
-
], [
|
|
33
|
+
], [
|
|
34
|
+
backgroundColor,
|
|
35
|
+
theme.bg.paper,
|
|
36
|
+
borderRadius,
|
|
37
|
+
padding,
|
|
38
|
+
margin,
|
|
39
|
+
shadowStyle,
|
|
40
|
+
style,
|
|
41
|
+
styles?.container,
|
|
42
|
+
]);
|
|
34
43
|
if (onPress) {
|
|
35
|
-
return (_jsx(TouchableContainer, { testID: testID, style: containerStyle, onPress: onPress, activeOpacity: 0.8, children: _jsx(View, { style: styles?.content, children: children }) }));
|
|
44
|
+
return (_jsx(TouchableContainer, { accessibilityLabel: accessibilityLabel, accessibilityRole: "button", testID: testID, style: containerStyle, onPress: onPress, activeOpacity: 0.8, children: _jsx(View, { style: styles?.content, children: children }) }));
|
|
36
45
|
}
|
|
37
46
|
return (_jsx(Container, { testID: testID, style: containerStyle, children: _jsx(View, { style: styles?.content, children: children }) }));
|
|
38
47
|
}
|
|
@@ -18,8 +18,9 @@ export interface CheckboxProps {
|
|
|
18
18
|
checked?: boolean;
|
|
19
19
|
text?: string | ReactElement;
|
|
20
20
|
direction?: 'left' | 'right';
|
|
21
|
+
accessibilityLabel?: string;
|
|
21
22
|
}
|
|
22
|
-
export declare function Checkbox({ style, styles, text, direction, color, size, disabled, checked, onPress, }: CheckboxProps): ReactElement;
|
|
23
|
+
export declare function Checkbox({ style, styles, text, direction, color, size, disabled, checked, onPress, accessibilityLabel, }: CheckboxProps): ReactElement;
|
|
23
24
|
declare const _default: typeof Checkbox;
|
|
24
25
|
export default _default;
|
|
25
26
|
//# sourceMappingURL=Checkbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/uis/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAc,EAA0C,KAAK,YAAY,EAAC,MAAM,OAAO,CAAC;AACxF,OAAO,KAAK,EAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAYlE,KAAK,MAAM,GAAG;IACZ,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAChC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,WAAW,GACX,SAAS,GACT,QAAQ,GACR,SAAS,GACT,MAAM,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAErE,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/uis/Checkbox/Chec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Q;AAAtD,wBAAuD"}
|
|
@@ -29,7 +29,7 @@ const StyledCheck = styled(Icon) `
|
|
|
29
29
|
font-weight: bold;
|
|
30
30
|
color: ${({ theme, $checked }) => ($checked ? theme.bg.basic : 'transparent')};
|
|
31
31
|
`;
|
|
32
|
-
export function Checkbox({ style, styles, text, direction = 'right', color = 'primary', size = 'medium', disabled = false, checked = false, onPress, }) {
|
|
32
|
+
export function Checkbox({ style, styles, text, direction = 'right', color = 'primary', size = 'medium', disabled = false, checked = false, onPress, accessibilityLabel, }) {
|
|
33
33
|
const checkboxSize = typeof size === 'number'
|
|
34
34
|
? size
|
|
35
35
|
: size === 'small'
|
|
@@ -109,7 +109,7 @@ export function Checkbox({ style, styles, text, direction = 'right', color = 'pr
|
|
|
109
109
|
}
|
|
110
110
|
return text;
|
|
111
111
|
}, [text, textStyles]);
|
|
112
|
-
return (_jsx(Container, { activeOpacity: 0.9, disabled: disabled, onPress: onPress, style: style, children: _jsxs(View, { style: containerStyles, children: [_jsx(StyledCheckboxOutlined, { "$checked": checked, "$disabled": disabled, style: [checkboxSizeStyles, styles?.checkbox], testID: "cpk-ui-checkbox", "$type": color, children: _jsx(AnimatedCheckbox, { style: animatedStyles, children: _jsx(StyledCheck, { "$checked": checked, name: "Check", size: checkboxSize * 0.7, style: styles?.check }) }) }), TextElement] }) }));
|
|
112
|
+
return (_jsx(Container, { accessibilityLabel: accessibilityLabel ?? (typeof text === 'string' ? text : undefined), accessibilityRole: "checkbox", accessibilityState: { checked, disabled }, "aria-checked": checked, "aria-disabled": disabled, activeOpacity: 0.9, disabled: disabled, onPress: onPress, style: style, children: _jsxs(View, { style: containerStyles, children: [_jsx(StyledCheckboxOutlined, { "$checked": checked, "$disabled": disabled, style: [checkboxSizeStyles, styles?.checkbox], testID: "cpk-ui-checkbox", "$type": color, children: _jsx(AnimatedCheckbox, { style: animatedStyles, children: _jsx(StyledCheck, { "$checked": checked, name: "Check", size: checkboxSize * 0.7, style: styles?.check }) }) }), TextElement] }) }));
|
|
113
113
|
}
|
|
114
114
|
// Export memoized component for better performance
|
|
115
115
|
export default React.memo(Checkbox);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomPressable.d.ts","sourceRoot":"","sources":["../../../../src/components/uis/CustomPressable/CustomPressable.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAU,KAAK,YAAY,EAAC,MAAM,OAAO,CAAC;AACxD,OAAO,KAAK,EAAC,cAAc,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAOvE,iBAAS,eAAe,CACtB,KAAK,EAAE,cAAc,GAAG;IAAC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAAC,GACrD,YAAY,
|
|
1
|
+
{"version":3,"file":"CustomPressable.d.ts","sourceRoot":"","sources":["../../../../src/components/uis/CustomPressable/CustomPressable.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAU,KAAK,YAAY,EAAC,MAAM,OAAO,CAAC;AACxD,OAAO,KAAK,EAAC,cAAc,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAOvE,iBAAS,eAAe,CACtB,KAAK,EAAE,cAAc,GAAG;IAAC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAAC,GACrD,YAAY,CAyCd;wBAG6C,OAAO,eAAe;AAApE,wBAAqE;AACrE,OAAO,EAAC,eAAe,EAAC,CAAC"}
|
|
@@ -2,24 +2,24 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
3
|
import { Pressable } from 'react-native';
|
|
4
4
|
import { css } from 'kstyled';
|
|
5
|
-
import {
|
|
5
|
+
import { useTheme } from '../../../providers/ThemeProvider';
|
|
6
6
|
const DEFAULT_HIT_SLOP = { top: 4, bottom: 4, left: 6, right: 6 };
|
|
7
7
|
function CustomPressable(props) {
|
|
8
|
-
const { children, style, hitSlop, ...restProps } = props;
|
|
9
|
-
const { theme } =
|
|
8
|
+
const { accessibilityRole = 'button', children, style, hitSlop, ...restProps } = props;
|
|
9
|
+
const { theme } = useTheme();
|
|
10
10
|
const effectiveHitSlop = useMemo(() => hitSlop || DEFAULT_HIT_SLOP, [hitSlop]);
|
|
11
11
|
const styleFunction = useMemo(() => ({ pressed }) => {
|
|
12
12
|
if (pressed) {
|
|
13
13
|
return [
|
|
14
14
|
css `
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
background-color: ${theme.role.underlay};
|
|
16
|
+
`,
|
|
17
17
|
style,
|
|
18
18
|
];
|
|
19
19
|
}
|
|
20
20
|
return style;
|
|
21
21
|
}, [theme.role.underlay, style]);
|
|
22
|
-
return (_jsx(Pressable, { hitSlop: effectiveHitSlop, style: styleFunction, ...restProps, children: children }));
|
|
22
|
+
return (_jsx(Pressable, { accessibilityRole: accessibilityRole, hitSlop: effectiveHitSlop, style: styleFunction, ...restProps, children: children }));
|
|
23
23
|
}
|
|
24
24
|
// Export memoized component for better performance
|
|
25
25
|
export default React.memo(CustomPressable);
|
|
@@ -47,6 +47,7 @@ export type EditTextProps = {
|
|
|
47
47
|
numberOfLines?: TextInputProps['numberOfLines'];
|
|
48
48
|
maxLength?: TextInputProps['maxLength'];
|
|
49
49
|
hideCounter?: boolean;
|
|
50
|
+
accessibilityLabel?: string;
|
|
50
51
|
textInputProps?: Omit<TextInputProps, 'value' | 'onChange' | 'numberOfLines' | 'multiline' | 'onChange' | 'onChangeText' | 'placeholder' | 'placeholderTextColor' | 'onFocus' | 'onBlur' | 'editable' | 'autoComplete' | 'autoCapitalize' | 'secureTextEntry' | 'onSubmitEditing' | 'maxLength'>;
|
|
51
52
|
colors?: {
|
|
52
53
|
basic?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditText.d.ts","sourceRoot":"","sources":["../../../../src/components/uis/EditText/EditText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAa,SAAS,EAAC,M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AAc,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IACtC,YAAY,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;IAC9C,cAAc,CAAC,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC;IAClD,eAAe,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;IACpD,eAAe,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;IACpD,aAAa,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;IAChD,SAAS,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;IACxC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,cAAc,CAAC,EAAE,IAAI,CACnB,cAAc,EACZ,OAAO,GACP,UAAU,GACV,eAAe,GACf,WAAW,GACX,UAAU,GACV,cAAc,GACd,aAAa,GACb,sBAAsB,GACtB,SAAS,GACT,QAAQ,GACR,UAAU,GACV,cAAc,GACd,gBAAgB,GAChB,iBAAiB,GACjB,iBAAiB,GACjB,WAAW,CACd,CAAC;IAEF,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,QAAQ,iFA+dpB,CAAC;wBAGqC,OAAO,QAAQ;AAAtD,wBAAuD"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { forwardRef, isValidElement, useCallback, useMemo, useRef, useState, } from 'react';
|
|
3
|
-
import { Text, TextInput, TouchableWithoutFeedback, View
|
|
4
|
-
import { useHover } from 'react-native-web-hooks';
|
|
3
|
+
import { Text, TextInput, TouchableWithoutFeedback, View } from 'react-native';
|
|
5
4
|
import { css } from 'kstyled';
|
|
6
5
|
import { Icon } from '../Icon/Icon';
|
|
7
6
|
import { cloneElemWithDefaultColors } from '../../../utils/guards';
|
|
8
7
|
import { useTheme } from '../../../providers/ThemeProvider';
|
|
9
8
|
import { Typography } from '../Typography/Typography';
|
|
10
|
-
import { isWeb
|
|
11
|
-
|
|
9
|
+
import { isWeb } from '../../../utils/platform';
|
|
10
|
+
import { useHoverState } from '../../../hooks/useHoverState';
|
|
11
|
+
export const EditText = forwardRef(({ testID, textInputProps, style, styles, size = 'medium', label, error, startElement, endElement, multiline = false, value = '', placeholder, placeholderColor, onChange, onChangeText, onFocus, onBlur, onSubmitEditing, numberOfLines, maxLength, hideCounter = false, autoComplete, autoCapitalize = 'none', secureTextEntry = false, editable = true, direction = 'column', decoration = 'underline', colors = {}, required = false, accessibilityLabel, }, ref) => {
|
|
12
12
|
EditText.displayName = 'EditText';
|
|
13
13
|
const { theme } = useTheme();
|
|
14
14
|
// Calculate sizes based on size prop
|
|
@@ -57,15 +57,14 @@ export const EditText = forwardRef(({ testID, textInputProps, style, styles, siz
|
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
}, [size]);
|
|
60
|
-
const webRef = useRef(null);
|
|
61
60
|
const [focused, setFocused] = useState(false);
|
|
62
61
|
const defaultInputRef = useRef(null);
|
|
63
62
|
const inputRef = ref || defaultInputRef;
|
|
64
|
-
const hovered =
|
|
63
|
+
const { hovered, hoverProps } = useHoverState();
|
|
65
64
|
// Memoize default container style
|
|
66
65
|
const defaultContainerStyle = useMemo(() => css `
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
flex-direction: ${direction};
|
|
67
|
+
`, [direction]);
|
|
69
68
|
// Memoize default color calculation
|
|
70
69
|
const defaultColor = useMemo(() => {
|
|
71
70
|
if (!editable)
|
|
@@ -119,7 +118,9 @@ export const EditText = forwardRef(({ testID, textInputProps, style, styles, siz
|
|
|
119
118
|
function Wrapper({ children }) {
|
|
120
119
|
return (_jsxs(View, { style: [
|
|
121
120
|
css `
|
|
122
|
-
margin-bottom: ${decoration === 'boxed'
|
|
121
|
+
margin-bottom: ${decoration === 'boxed'
|
|
122
|
+
? sizeConfig.labelMargin
|
|
123
|
+
: 0}px;
|
|
123
124
|
|
|
124
125
|
flex-direction: row;
|
|
125
126
|
align-items: center;
|
|
@@ -199,7 +200,9 @@ export const EditText = forwardRef(({ testID, textInputProps, style, styles, siz
|
|
|
199
200
|
align-self: stretch;
|
|
200
201
|
`,
|
|
201
202
|
css `
|
|
202
|
-
padding: ${decoration === 'boxed'
|
|
203
|
+
padding: ${decoration === 'boxed'
|
|
204
|
+
? `${sizeConfig.padding * 0.4}px 0`
|
|
205
|
+
: `${sizeConfig.padding * 0.2}px 0`};
|
|
203
206
|
|
|
204
207
|
flex-direction: row;
|
|
205
208
|
align-items: center;
|
|
@@ -215,7 +218,8 @@ export const EditText = forwardRef(({ testID, textInputProps, style, styles, siz
|
|
|
215
218
|
margin-right: 4px;
|
|
216
219
|
`,
|
|
217
220
|
})
|
|
218
|
-
: startElement, _jsx(TextInput, {
|
|
221
|
+
: startElement, _jsx(TextInput, { accessibilityLabel: accessibilityLabel ??
|
|
222
|
+
(typeof label === 'string' ? label : placeholder), autoCapitalize: autoCapitalize, autoComplete: autoComplete, editable: editable, maxLength: maxLength, multiline: multiline, numberOfLines: numberOfLines, onBlur: (e) => {
|
|
219
223
|
setFocused(false);
|
|
220
224
|
onBlur?.(e);
|
|
221
225
|
}, onChange: onChange, onChangeText: onChangeText, onFocus: (e) => {
|
|
@@ -242,7 +246,8 @@ export const EditText = forwardRef(({ testID, textInputProps, style, styles, siz
|
|
|
242
246
|
`,
|
|
243
247
|
css `
|
|
244
248
|
color: ${defaultColor};
|
|
245
|
-
padding: ${sizeConfig.padding}px 0
|
|
249
|
+
padding: ${sizeConfig.padding}px 0
|
|
250
|
+
${sizeConfig.padding * 1.2}px 0;
|
|
246
251
|
`,
|
|
247
252
|
styles?.input,
|
|
248
253
|
], testID: testID, value: value, ...textInputProps }), isValidElement(endElement)
|
|
@@ -316,7 +321,7 @@ export const EditText = forwardRef(({ testID, textInputProps, style, styles, siz
|
|
|
316
321
|
theme.text.placeholder,
|
|
317
322
|
value.length,
|
|
318
323
|
]);
|
|
319
|
-
return (_jsxs(View, {
|
|
324
|
+
return (_jsxs(View, { ...hoverProps, style: [
|
|
320
325
|
css `
|
|
321
326
|
width: 100%;
|
|
322
327
|
`,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { type ReactElement } from 'react';
|
|
2
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
import { IconName } from '../Icon/Icon';
|
|
4
|
-
import { ButtonSizeType } from '../Button/Button';
|
|
3
|
+
import type { IconName } from '../Icon/Icon';
|
|
4
|
+
import type { ButtonSizeType } from '../Button/Button';
|
|
5
5
|
import { IconButton } from '../IconButton/IconButton';
|
|
6
6
|
type Styles = {
|
|
7
7
|
Fab?: StyleProp<ViewStyle>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fab.d.ts","sourceRoot":"","sources":["../../../../src/components/uis/Fab/Fab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Fab.d.ts","sourceRoot":"","sources":["../../../../src/components/uis/Fab/Fab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAKZ,KAAK,YAAY,EAClB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAoB,SAAS,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAE1E,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AAEpD,KAAK,MAAM,GAAG;IACZ,GAAG,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC3B,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,QAAQ,KAAK,IAAI,CAAC;IACxC,UAAU,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;IACrC,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,IAAI,CACpB,KAAK,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,EACvC,MAAM,GAAG,SAAS,GAAG,MAAM,CAC5B,CAAC;CACH,CAAC;AAEF,iBAAS,qBAAqB,CAAC,EAC7B,QAAgB,EAChB,KAAK,EACL,MAAM,EACN,OAAgB,EAChB,KAAU,EACV,UAAU,EACV,WAAW,EACX,UAAqB,EACrB,GAGQ,EACR,iBAAuB,EACvB,eAAe,GAChB,EAAE,QAAQ,GAAG,YAAY,CAqKzB;AAED,OAAO,EAAC,qBAAqB,IAAI,GAAG,EAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useLayoutEffect, useMemo, useRef, useCallback } from 'react';
|
|
2
|
+
import { useLayoutEffect, useMemo, useRef, useCallback, } from 'react';
|
|
3
3
|
import { Animated, Easing, Platform, View } from 'react-native';
|
|
4
4
|
import { IconButton } from '../IconButton/IconButton';
|
|
5
5
|
function FloatingActionButtons({ isActive = false, style, styles, fabIcon = 'Plus', icons = [], onPressFab, onPressItem, buttonSize = 'medium', gap = Platform.select({
|
|
@@ -66,13 +66,31 @@ function FloatingActionButtons({ isActive = false, style, styles, fabIcon = 'Plu
|
|
|
66
66
|
Fab,
|
|
67
67
|
], [spinInterpolation, Fab]);
|
|
68
68
|
// Memoize icon items rendering
|
|
69
|
-
const iconItems = useMemo(() => icons.map((icon, idx) => (_jsx(Animated.View, { style: [
|
|
69
|
+
const iconItems = useMemo(() => icons.map((icon, idx) => (_jsx(Animated.View, { accessibilityElementsHidden: !isActive, "aria-hidden": !isActive, importantForAccessibility: isActive ? 'auto' : 'no-hide-descendants', style: [
|
|
70
70
|
{
|
|
71
|
+
pointerEvents: isActive ? 'auto' : 'none',
|
|
71
72
|
position: 'absolute',
|
|
72
73
|
transform: [{ translateY: offsets[idx] }],
|
|
73
74
|
},
|
|
74
75
|
FabItem,
|
|
75
|
-
], children: _jsx(IconButton, { icon: icon, onPress: () => handleItemPress(icon), size: buttonSize, testID: icon
|
|
76
|
-
|
|
76
|
+
], testID: `fab-item-${icon}`, children: _jsx(IconButton, { ...iconButtonProps, disabled: !isActive || iconButtonProps?.disabled, icon: icon, onPress: () => handleItemPress(icon), size: buttonSize, testID: icon }) }, `${icon}-${idx}`))), [
|
|
77
|
+
icons,
|
|
78
|
+
offsets,
|
|
79
|
+
FabItem,
|
|
80
|
+
handleItemPress,
|
|
81
|
+
buttonSize,
|
|
82
|
+
iconButtonProps,
|
|
83
|
+
isActive,
|
|
84
|
+
]);
|
|
85
|
+
const mainTouchableProps = useMemo(() => ({
|
|
86
|
+
...iconButtonProps?.touchableHighlightProps,
|
|
87
|
+
accessibilityState: {
|
|
88
|
+
...iconButtonProps?.touchableHighlightProps?.accessibilityState,
|
|
89
|
+
expanded: isActive,
|
|
90
|
+
},
|
|
91
|
+
'aria-expanded': isActive,
|
|
92
|
+
}), [iconButtonProps?.touchableHighlightProps, isActive]);
|
|
93
|
+
return (_jsxs(View, { style: containerStyles, children: [iconItems, _jsx(Animated.View, { onLayout: onLayout, style: mainFabStyles, children: _jsx(IconButton, { ...iconButtonProps, accessibilityLabel: iconButtonProps?.accessibilityLabel ??
|
|
94
|
+
(isActive ? 'Close actions' : 'Open actions'), icon: fabIcon, onPress: handleFabPress, size: buttonSize, testID: iconButtonProps?.testID ?? 'fab-toggle', touchableHighlightProps: mainTouchableProps }) })] }));
|
|
77
95
|
}
|
|
78
96
|
export { FloatingActionButtons as Fab };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../../src/components/uis/Icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAC,KAAK,EAAE,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../../src/components/uis/Icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAC,KAAK,EAAE,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAIvD,eAAO,MAAM,QAAQ,kx+DA4rHX,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,OAAO,QAAQ,CAAC;AACxC,MAAM,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAEjE,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAsBF,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAW9B,CAAC;AAGF,eAAe,IAAI,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { styled } from 'kstyled';
|
|
3
|
-
import
|
|
4
|
-
import collectingFontIconSelection from './selection.json';
|
|
3
|
+
import createIconSet from '@expo/vector-icons/createIconSet';
|
|
5
4
|
export const iconList = [
|
|
6
5
|
'AddressBook',
|
|
7
6
|
'Airplane',
|
|
@@ -3775,8 +3774,12 @@ export const iconList = [
|
|
|
3775
3774
|
'YinYangFill',
|
|
3776
3775
|
'YoutubeLogoFill',
|
|
3777
3776
|
];
|
|
3777
|
+
const glyphMap = iconList.reduce((map, name, index) => {
|
|
3778
|
+
map[name] = 59648 + index;
|
|
3779
|
+
return map;
|
|
3780
|
+
}, {});
|
|
3778
3781
|
// Create the base icon component once at module level
|
|
3779
|
-
const BaseIconComponent =
|
|
3782
|
+
const BaseIconComponent = createIconSet(glyphMap, 'cpk', require('./cpk.ttf'));
|
|
3780
3783
|
const StyledIcon = styled(BaseIconComponent) `
|
|
3781
3784
|
color: ${({ theme, color }) => color || theme?.text?.basic || '#000'};
|
|
3782
3785
|
`;
|
|
@@ -27,8 +27,9 @@ export type IconButtonProps = {
|
|
|
27
27
|
activeOpacity?: number;
|
|
28
28
|
touchableHighlightProps?: Omit<TouchableHighlightProps, 'onPress' | 'style'>;
|
|
29
29
|
hapticFeedback?: Haptics.ImpactFeedbackStyle;
|
|
30
|
+
accessibilityLabel?: string;
|
|
30
31
|
};
|
|
31
|
-
export declare function IconButton({ testID, type, color, size, disabled, loading, loadingElement, icon, iconElement, style, styles, onPress, activeOpacity, touchableHighlightProps, hapticFeedback, }: IconButtonProps): ReactElement;
|
|
32
|
+
export declare function IconButton({ testID, type, color, size, disabled, loading, loadingElement, icon, iconElement, style, styles, onPress, activeOpacity, touchableHighlightProps, hapticFeedback, accessibilityLabel, }: IconButtonProps): ReactElement;
|
|
32
33
|
declare const _default: typeof IconButton;
|
|
33
34
|
export default _default;
|
|
34
35
|
//# sourceMappingURL=IconButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../../src/components/uis/IconButton/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAc,
|
|
1
|
+
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../../src/components/uis/IconButton/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAuB,KAAK,YAAY,EAAC,MAAM,OAAO,CAAC;AACrE,OAAO,KAAK,EAAC,SAAS,EAAE,uBAAuB,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAIhF,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAK3C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AAGxC,KAAK,MAAM,GAAG;IACZ,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5B,QAAQ,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAChC,CAAC;AAEF,KAAK,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;AAEhD,KAAK,eAAe,GAChB,SAAS,GACT,WAAW,GACX,SAAS,GACT,QAAQ,GACR,SAAS,GACT,MAAM,GACN,OAAO,CAAC;AAEZ,KAAK,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAkD5D,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,YAAY,CAAC;IAC9B,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAC7C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uBAAuB,CAAC,EAAE,IAAI,CAAC,uBAAuB,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC;IAC7E,cAAc,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC;IAC7C,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,IAAc,EACd,KAAiB,EACjB,IAAe,EACf,QAAQ,EACR,OAAe,EACf,cAAc,EACd,IAAI,EACJ,WAAW,EACX,KAAK,EACL,MAAM,EACN,OAAO,EACP,aAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,kBAAkB,GACnB,EAAE,eAAe,GAAG,YAAY,CAwLhC;wBAGwC,OAAO,UAAU;AAA1D,wBAA2D"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import React, { useCallback, useMemo
|
|
3
|
-
import {
|
|
4
|
-
import { useHover } from 'react-native-web-hooks';
|
|
2
|
+
import React, { useCallback, useMemo } from 'react';
|
|
3
|
+
import { TouchableHighlight, View } from 'react-native';
|
|
5
4
|
import { css } from 'kstyled';
|
|
6
5
|
import { Icon } from '../Icon/Icon';
|
|
7
6
|
import { LoadingIndicator } from '../LoadingIndicator/LoadingIndicator';
|
|
8
7
|
import { useTheme } from '../../../providers/ThemeProvider';
|
|
9
8
|
import * as Haptics from 'expo-haptics';
|
|
9
|
+
import { useHoverState } from '../../../hooks/useHoverState';
|
|
10
10
|
// Memoized styles calculation function
|
|
11
11
|
const ButtonStyles = ({ theme, type, color, loading, disabled, }) => {
|
|
12
12
|
const isDisabled = disabled || loading;
|
|
@@ -20,12 +20,8 @@ const ButtonStyles = ({ theme, type, color, loading, disabled, }) => {
|
|
|
20
20
|
borderColor = backgroundColor;
|
|
21
21
|
}
|
|
22
22
|
if (type === 'outlined') {
|
|
23
|
-
backgroundColor = isDisabled
|
|
24
|
-
|
|
25
|
-
: theme.bg.basic;
|
|
26
|
-
borderColor = isDisabled
|
|
27
|
-
? theme.bg.disabled
|
|
28
|
-
: theme.button[color].bg;
|
|
23
|
+
backgroundColor = isDisabled ? theme.bg.disabled : theme.bg.basic;
|
|
24
|
+
borderColor = isDisabled ? theme.bg.disabled : theme.button[color].bg;
|
|
29
25
|
}
|
|
30
26
|
if (type === 'solid' || color === 'light') {
|
|
31
27
|
iconColor = theme.button[color].text;
|
|
@@ -40,9 +36,8 @@ const ButtonStyles = ({ theme, type, color, loading, disabled, }) => {
|
|
|
40
36
|
disabledTextColor: theme.button.disabled.text,
|
|
41
37
|
};
|
|
42
38
|
};
|
|
43
|
-
export function IconButton({ testID, type = 'solid', color = 'primary', size = 'medium', disabled, loading = false, loadingElement, icon, iconElement, style, styles, onPress, activeOpacity = 0.95, touchableHighlightProps, hapticFeedback, }) {
|
|
44
|
-
const
|
|
45
|
-
const hovered = useHover(ref);
|
|
39
|
+
export function IconButton({ testID, type = 'solid', color = 'primary', size = 'medium', disabled, loading = false, loadingElement, icon, iconElement, style, styles, onPress, activeOpacity = 0.95, touchableHighlightProps, hapticFeedback, accessibilityLabel, }) {
|
|
40
|
+
const { hovered, hoverProps } = useHoverState();
|
|
46
41
|
const { theme } = useTheme();
|
|
47
42
|
// Memoize button styles
|
|
48
43
|
const buttonStylesConfig = useMemo(() => ButtonStyles({
|
|
@@ -69,24 +64,24 @@ export function IconButton({ testID, type = 'solid', color = 'primary', size = '
|
|
|
69
64
|
const compositeStyles = useMemo(() => ({
|
|
70
65
|
container: [
|
|
71
66
|
css `
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
background-color: ${buttonStylesConfig.backgroundColor};
|
|
68
|
+
border-color: ${buttonStylesConfig.borderColor};
|
|
69
|
+
border-width: ${borderWidthStr};
|
|
70
|
+
padding: 12px;
|
|
71
|
+
`,
|
|
77
72
|
styles?.container,
|
|
78
73
|
],
|
|
79
74
|
icon: [
|
|
80
75
|
css `
|
|
81
|
-
|
|
82
|
-
|
|
76
|
+
color: ${buttonStylesConfig.iconColor};
|
|
77
|
+
`,
|
|
83
78
|
styles?.icon,
|
|
84
79
|
],
|
|
85
80
|
disabled: [
|
|
86
81
|
css `
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
background-color: ${buttonStylesConfig.disabledBackgroundColor};
|
|
83
|
+
border-color: ${buttonStylesConfig.disabledBorderColor};
|
|
84
|
+
`,
|
|
90
85
|
styles?.disabled,
|
|
91
86
|
],
|
|
92
87
|
hovered: [
|
|
@@ -108,40 +103,47 @@ export function IconButton({ testID, type = 'solid', color = 'primary', size = '
|
|
|
108
103
|
}, [onPress, hapticFeedback]);
|
|
109
104
|
// Memoize loading view
|
|
110
105
|
const LoadingView = useMemo(() => loadingElement || (_jsx(LoadingIndicator, { color: theme.text.disabled, size: "small", style: css `
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
106
|
+
justify-content: center;
|
|
107
|
+
align-items: center;
|
|
108
|
+
height: ${iconSize}px;
|
|
109
|
+
width: ${iconSize}px;
|
|
110
|
+
` })), [loadingElement, theme.text.disabled, iconSize]);
|
|
116
111
|
// Memoize icon view
|
|
117
|
-
const IconView = useMemo(() => iconElement || (_jsx(Icon, { color: buttonStylesConfig.iconColor, name: icon || 'QuestBoxFill', size: iconSize, style: compositeStyles?.icon })), [
|
|
112
|
+
const IconView = useMemo(() => iconElement || (_jsx(Icon, { color: buttonStylesConfig.iconColor, name: icon || 'QuestBoxFill', size: iconSize, style: compositeStyles?.icon })), [
|
|
113
|
+
iconElement,
|
|
114
|
+
buttonStylesConfig.iconColor,
|
|
115
|
+
icon,
|
|
116
|
+
iconSize,
|
|
117
|
+
compositeStyles?.icon,
|
|
118
|
+
]);
|
|
118
119
|
// Memoize container styles
|
|
119
120
|
const containerStyles = useMemo(() => [
|
|
120
121
|
css `
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
flex-direction: row;
|
|
123
|
+
border-radius: ${borderRadiusStr};
|
|
124
|
+
`,
|
|
124
125
|
style,
|
|
125
126
|
], [borderRadiusStr, style]);
|
|
126
127
|
// Memoize inner container styles
|
|
127
128
|
const innerContainerStyles = useMemo(() => [
|
|
128
129
|
css `
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
130
|
+
padding: 4px;
|
|
131
|
+
border-radius: ${borderRadiusStr};
|
|
132
|
+
flex-direction: row;
|
|
133
|
+
justify-content: center;
|
|
134
|
+
align-items: center;
|
|
135
|
+
`,
|
|
135
136
|
compositeStyles.container,
|
|
136
137
|
hovered && !disabled && compositeStyles.hovered,
|
|
137
138
|
disabled && compositeStyles.disabled,
|
|
138
139
|
], [borderRadiusStr, compositeStyles, hovered, disabled]);
|
|
139
|
-
return (_jsx(View, { style: containerStyles, children: _jsx(TouchableHighlight, { activeOpacity: activeOpacity, delayPressIn: 50, disabled: disabled || loading, onPress: handlePress,
|
|
140
|
-
web: ref,
|
|
141
|
-
default: undefined,
|
|
142
|
-
}), style: css `
|
|
140
|
+
return (_jsx(View, { style: containerStyles, children: _jsx(TouchableHighlight, { accessibilityLabel: accessibilityLabel ?? icon, accessibilityRole: "button", "aria-busy": loading, "aria-disabled": !!disabled || loading, activeOpacity: activeOpacity, delayPressIn: 50, disabled: disabled || loading, onPress: handlePress, style: css `
|
|
143
141
|
border-radius: ${borderRadiusStr};
|
|
144
|
-
`, testID: testID, underlayColor: theme.role.underlay, ...touchableHighlightProps,
|
|
142
|
+
`, testID: testID, underlayColor: theme.role.underlay, ...touchableHighlightProps, accessibilityState: {
|
|
143
|
+
...touchableHighlightProps?.accessibilityState,
|
|
144
|
+
busy: loading,
|
|
145
|
+
disabled: !!disabled || loading,
|
|
146
|
+
}, ...hoverProps, children: _jsx(View, { style: innerContainerStyles, testID: loading ? 'loading-view' : 'button-container', children: loading ? LoadingView : IconView }) }) }));
|
|
145
147
|
}
|
|
146
148
|
// Export memoized component for better performance
|
|
147
149
|
export default React.memo(IconButton);
|
|
@@ -7,6 +7,7 @@ type Styles = {
|
|
|
7
7
|
};
|
|
8
8
|
export type LoadingIndicatorSizeType = 'small' | 'medium' | 'large' | number;
|
|
9
9
|
export interface LoadingIndicatorProps extends BaseComponentProps {
|
|
10
|
+
accessibilityLabel?: string;
|
|
10
11
|
style?: StyleProp<ViewStyle>;
|
|
11
12
|
styles?: Styles;
|
|
12
13
|
color?: string;
|
|
@@ -14,7 +15,7 @@ export interface LoadingIndicatorProps extends BaseComponentProps {
|
|
|
14
15
|
imgSource?: string | ImageSourcePropType;
|
|
15
16
|
customElement?: ReactElement | (() => ReactElement);
|
|
16
17
|
}
|
|
17
|
-
declare function LoadingIndicator({ customElement, style, styles, size, color, imgSource, testID, }: LoadingIndicatorProps): ReactElement;
|
|
18
|
+
declare function LoadingIndicator({ accessibilityLabel, customElement, style, styles, size, color, imgSource, testID, }: LoadingIndicatorProps): ReactElement;
|
|
18
19
|
declare const _default: typeof LoadingIndicator;
|
|
19
20
|
export default _default;
|
|
20
21
|
export { LoadingIndicator };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingIndicator.d.ts","sourceRoot":"","sources":["../../../../src/components/uis/LoadingIndicator/LoadingIndicator.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAuB,KAAK,YAAY,EAAC,MAAM,OAAO,CAAC;AACrE,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC;AAE9D,KAAK,MAAM,GAAG;IACZ,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAE7E,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,wBAAwB,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAAC;IACzC,aAAa,CAAC,EAAE,YAAY,GAAG,CAAC,MAAM,YAAY,CAAC,CAAC;CACrD;AAOD,iBAAS,gBAAgB,CAAC,EACxB,aAAa,EACb,KAAK,EACL,MAAM,EACN,IAAc,EACd,KAAK,EACL,SAAS,EACT,MAAM,GACP,EAAE,qBAAqB,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"LoadingIndicator.d.ts","sourceRoot":"","sources":["../../../../src/components/uis/LoadingIndicator/LoadingIndicator.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAuB,KAAK,YAAY,EAAC,MAAM,OAAO,CAAC;AACrE,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC;AAE9D,KAAK,MAAM,GAAG;IACZ,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAE7E,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,wBAAwB,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAAC;IACzC,aAAa,CAAC,EAAE,YAAY,GAAG,CAAC,MAAM,YAAY,CAAC,CAAC;CACrD;AAOD,iBAAS,gBAAgB,CAAC,EACxB,kBAA8B,EAC9B,aAAa,EACb,KAAK,EACL,MAAM,EACN,IAAc,EACd,KAAK,EACL,SAAS,EACT,MAAM,GACP,EAAE,qBAAqB,GAAG,YAAY,CAgFtC;wBAG8C,OAAO,gBAAgB;AAAtE,wBAAuE;AAGvE,OAAO,EAAC,gBAAgB,EAAC,CAAC"}
|
|
@@ -7,7 +7,7 @@ const Container = styled(View) `
|
|
|
7
7
|
justify-content: center;
|
|
8
8
|
align-items: center;
|
|
9
9
|
`;
|
|
10
|
-
function LoadingIndicator({ customElement, style, styles, size = "large", color, imgSource, testID, }) {
|
|
10
|
+
function LoadingIndicator({ accessibilityLabel = "Loading", customElement, style, styles, size = "large", color, imgSource, testID, }) {
|
|
11
11
|
const { theme } = useTheme();
|
|
12
12
|
// Convert size to ActivityIndicator compatible format
|
|
13
13
|
// Note: iOS only supports 'small' | 'large', Android also supports numbers
|
|
@@ -57,10 +57,10 @@ function LoadingIndicator({ customElement, style, styles, size = "large", color,
|
|
|
57
57
|
return typeof customElement === "function" ? customElement() : customElement;
|
|
58
58
|
}
|
|
59
59
|
if (imageSource) {
|
|
60
|
-
return (_jsx(Image, { source: imageSource, style: imageStyle, testID: `${testID}-image` }));
|
|
60
|
+
return (_jsx(Image, { accessibilityLabel: accessibilityLabel, source: imageSource, style: imageStyle, testID: `${testID}-image` }));
|
|
61
61
|
}
|
|
62
|
-
return (_jsx(ActivityIndicator, { color: activityIndicatorColor, size: activityIndicatorSize, style: styles?.activityIndicator, testID: `${testID}-activity-indicator` }));
|
|
63
|
-
}, [customElement, imageSource, imageStyle, testID, activityIndicatorColor, activityIndicatorSize, styles?.activityIndicator]);
|
|
62
|
+
return (_jsx(ActivityIndicator, { accessibilityLabel: accessibilityLabel, color: activityIndicatorColor, size: activityIndicatorSize, style: styles?.activityIndicator, testID: `${testID}-activity-indicator` }));
|
|
63
|
+
}, [accessibilityLabel, customElement, imageSource, imageStyle, testID, activityIndicatorColor, activityIndicatorSize, styles?.activityIndicator]);
|
|
64
64
|
return (_jsx(Container, { style: style, testID: testID, children: renderContent() }));
|
|
65
65
|
}
|
|
66
66
|
// Export memoized component for better performance
|
|
@@ -21,8 +21,9 @@ export type RadioButtonProps = {
|
|
|
21
21
|
selected?: boolean;
|
|
22
22
|
endElement?: ReactElement;
|
|
23
23
|
startElement?: ReactElement;
|
|
24
|
+
accessibilityLabel?: string;
|
|
24
25
|
};
|
|
25
|
-
export default function RadioButton({ testID, style, styles, endElement, startElement, type, size, disabled, selected, onPress, label, labelPosition, }: RadioButtonProps): ReactElement;
|
|
26
|
+
export default function RadioButton({ testID, style, styles, endElement, startElement, type, size, disabled, selected, onPress, label, labelPosition, accessibilityLabel, }: RadioButtonProps): ReactElement;
|
|
26
27
|
declare const MemoizedRadioButton: React.MemoExoticComponent<typeof RadioButton>;
|
|
27
28
|
export { MemoizedRadioButton as RadioButton };
|
|
28
29
|
//# sourceMappingURL=RadioButton.d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AC;IACnB,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AASF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,MAAM,EACN,KAAK,EACL,MAAM,EACN,UAAU,EACV,YAAY,EACZ,IAAgB,EAChB,IAAe,EACf,QAAgB,EAChB,QAAQ,EACR,OAAO,EACP,KAAK,EACL,aAAuB,EACvB,kBAAkB,GACnB,EAAE,gBAAgB,GAAG,YAAY,CA8HjC;AAGD,QAAA,MAAM,mBAAmB,+CAA0B,CAAC;AACpD,OAAO,EAAC,mBAAmB,IAAI,WAAW,EAAC,CAAC"}
|
|
@@ -8,7 +8,7 @@ const Container = styled.TouchableOpacity `
|
|
|
8
8
|
align-items: center;
|
|
9
9
|
`;
|
|
10
10
|
const StyledRadioCircle = Animated.createAnimatedComponent(RadioWrapper);
|
|
11
|
-
export default function RadioButton({ testID, style, styles, endElement, startElement, type = 'primary', size = 'medium', disabled = false, selected, onPress, label, labelPosition = 'right', }) {
|
|
11
|
+
export default function RadioButton({ testID, style, styles, endElement, startElement, type = 'primary', size = 'medium', disabled = false, selected, onPress, label, labelPosition = 'right', accessibilityLabel, }) {
|
|
12
12
|
const [innerLayout, setInnerLayout] = useState();
|
|
13
13
|
const fadeAnim = useRef(new Animated.Value(selected ? 1 : 0)).current;
|
|
14
14
|
const scaleAnim = useRef(new Animated.Value(selected ? 1 : 0)).current;
|
|
@@ -62,7 +62,7 @@ export default function RadioButton({ testID, style, styles, endElement, startEl
|
|
|
62
62
|
transform: [{ scale: scaleAnim }],
|
|
63
63
|
},
|
|
64
64
|
], [innerLayout, styles?.circle, fadeAnim, scaleAnim]);
|
|
65
|
-
return (_jsx(Container, { activeOpacity: 0.9, disabled: disabled, onPress: onPress, style: style, testID: testID, children: _jsxs(View, { style: containerStyles, children: [startElement, label && labelPosition === 'left' ? (_jsx(ColoredText, { "$disabled": !!disabled, "$selected": !!selected, "$size": size, style: styles?.label, "$type": type, children: label })) : null, _jsx(RadioButtonWrapper, { "$disabled": disabled, "$selected": !!selected, "$size": size, style: styles?.circleWrapper, "$type": type, children: _jsx(StyledRadioCircle, { "$disabled": !!disabled, onLayout: handleLayout, "$selected": !!selected, style: animatedStyles, testID: `circle-${testID}`, "$type": type }) }), label && labelPosition === 'right' ? (_jsx(ColoredText, { "$disabled": !!disabled, "$selected": !!selected, "$size": size, style: styles?.label, "$type": type, children: label })) : null, endElement] }) }));
|
|
65
|
+
return (_jsx(Container, { accessibilityLabel: accessibilityLabel ?? label, accessibilityRole: "radio", accessibilityState: { checked: !!selected, disabled }, "aria-checked": !!selected, "aria-disabled": disabled, activeOpacity: 0.9, disabled: disabled, onPress: onPress, style: style, testID: testID, children: _jsxs(View, { style: containerStyles, children: [startElement, label && labelPosition === 'left' ? (_jsx(ColoredText, { "$disabled": !!disabled, "$selected": !!selected, "$size": size, style: styles?.label, "$type": type, children: label })) : null, _jsx(RadioButtonWrapper, { "$disabled": disabled, "$selected": !!selected, "$size": size, style: styles?.circleWrapper, "$type": type, children: _jsx(StyledRadioCircle, { "$disabled": !!disabled, onLayout: handleLayout, "$selected": !!selected, style: animatedStyles, testID: `circle-${testID}`, "$type": type }) }), label && labelPosition === 'right' ? (_jsx(ColoredText, { "$disabled": !!disabled, "$selected": !!selected, "$size": size, style: styles?.label, "$type": type, children: label })) : null, endElement] }) }));
|
|
66
66
|
}
|
|
67
67
|
// Export memoized component for better performance
|
|
68
68
|
const MemoizedRadioButton = React.memo(RadioButton);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/uis/RadioGroup/RadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAuB,KAAK,YAAY,EAAC,MAAM,OAAO,CAAC;AACrE,OAAO,KAAK,EAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,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