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
package/README.md
CHANGED
|
@@ -1,190 +1,123 @@
|
|
|
1
1
|
# cpk-ui
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[](https://npmjs.org/package/cpk-ui)
|
|
6
|
-
[](https://npmjs.org/package/cpk-ui)
|
|
3
|
+
[](https://www.npmjs.com/package/cpk-ui)
|
|
7
4
|
[](https://github.com/crossplatformkorea/cpk-ui/actions/workflows/ci.yml)
|
|
8
|
-
[](https://opencollective.com/crossplatformkorea/tiers/badge.svg)
|
|
11
|
-
|
|
12
|
-
<img src="https://github.com/user-attachments/assets/c31ac1c2-cc0e-4f13-a542-c35045c266cd" width="320"/>
|
|
13
|
-
|
|
14
|
-
## Demo
|
|
15
|
-
|
|
16
|
-
Check out [ui.crossplatformkorea.com](https://ui.crossplatformkorea.com)
|
|
17
|
-
|
|
18
|
-
## Introduction
|
|
19
|
-
|
|
20
|
-
`cpk-ui` is a foundational design system and UI components library managed by Cross-Platform Korea. It is built using our preferred technologies, including [kstyled](https://hyodotdev.github.io/kstyled), [typescript](https://www.typescriptlang.org/), [jest](https://jestjs.io), [react-native-testing-library](https://github.com/callstack/react-native-testing-library), [expo](https://expo.io), and [storybook](https://storybook.js.org).
|
|
5
|
+
[](https://ui.crossplatformkorea.com)
|
|
6
|
+
[](./LICENSE)
|
|
21
7
|
|
|
22
|
-
|
|
8
|
+
React Native components with one API across iOS, Android, and web. cpk-ui is
|
|
9
|
+
maintained by Cross Platform Korea and uses
|
|
10
|
+
[kstyled](https://crossplatformkorea.github.io/kstyled) for typed,
|
|
11
|
+
compile-time-aware styling.
|
|
23
12
|
|
|
24
|
-
`cpk-ui`
|
|
13
|
+
`cpk-ui@0.7.0` pairs with `kstyled@0.4.1`. Keep the runtime and Babel plugin on
|
|
14
|
+
the same kstyled version.
|
|
25
15
|
|
|
26
|
-
|
|
16
|
+
## Install
|
|
27
17
|
|
|
28
|
-
|
|
18
|
+
### Expo
|
|
29
19
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
For detailed performance information, see our [Performance Guide](docs/PERFORMANCE.md).
|
|
37
|
-
|
|
38
|
-
### Installation
|
|
39
|
-
|
|
40
|
-
#### For Expo
|
|
41
|
-
|
|
42
|
-
```sh
|
|
43
|
-
expo install cpk-ui kstyled @expo/vector-icons react-native-gesture-handler react-native-svg expo-screen-orientation @expo/match-media expo-haptics
|
|
44
|
-
|
|
45
|
-
# Install dev dependencies
|
|
46
|
-
npm install -D babel-plugin-kstyled
|
|
20
|
+
```bash
|
|
21
|
+
npx expo install cpk-ui@0.7.0 kstyled@0.4.1 @expo/vector-icons \
|
|
22
|
+
react-native-gesture-handler react-native-svg expo-screen-orientation \
|
|
23
|
+
@expo/match-media expo-haptics
|
|
24
|
+
bun add --dev babel-plugin-kstyled@0.4.1
|
|
47
25
|
```
|
|
48
26
|
|
|
49
|
-
|
|
27
|
+
### React Native CLI
|
|
50
28
|
|
|
51
|
-
|
|
52
|
-
# Using yarn
|
|
53
|
-
yarn add cpk-ui kstyled @expo/vector-icons react-native-gesture-handler react-native-svg expo-screen-orientation @expo/match-media
|
|
54
|
-
yarn add -D babel-plugin-kstyled
|
|
29
|
+
Install Expo modules first, then add the same runtime dependencies:
|
|
55
30
|
|
|
56
|
-
|
|
31
|
+
```bash
|
|
57
32
|
npx install-expo-modules@latest
|
|
33
|
+
bun add cpk-ui@0.7.0 kstyled@0.4.1 @expo/vector-icons \
|
|
34
|
+
react-native-gesture-handler react-native-svg expo-screen-orientation \
|
|
35
|
+
@expo/match-media expo-haptics
|
|
36
|
+
bun add --dev babel-plugin-kstyled@0.4.1
|
|
58
37
|
```
|
|
59
38
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
Add `babel-plugin-kstyled` to your `babel.config.js`:
|
|
39
|
+
Configure kstyled before plugins that must run last:
|
|
63
40
|
|
|
64
|
-
```
|
|
41
|
+
```js title="babel.config.js"
|
|
65
42
|
module.exports = {
|
|
66
43
|
presets: ['babel-preset-expo'],
|
|
67
|
-
plugins: [
|
|
44
|
+
plugins: [
|
|
45
|
+
['babel-plugin-kstyled', {strict: true}],
|
|
46
|
+
'react-native-reanimated/plugin',
|
|
47
|
+
],
|
|
68
48
|
};
|
|
69
49
|
```
|
|
70
50
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
We focus on supporting `iOS`, `Android`, and `web` platforms, enabling [expo](https://expo.io) users to write efficient and reliable cross-platform code. For more insights into the project’s direction, refer to the [cpk-ui strategy](https://github.com/hyochan/cpk-ui/issues).
|
|
74
|
-
|
|
75
|
-
```tsx
|
|
76
|
-
import {CpkProvider} from 'cpk-ui';
|
|
77
|
-
|
|
78
|
-
<CpkProvider>
|
|
79
|
-
<App />
|
|
80
|
-
</CpkProvider>;
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Theming
|
|
84
|
-
|
|
85
|
-
> The embedded `theme` module functionality provides the ability to create `light` and `dark` themes.
|
|
86
|
-
|
|
87
|
-
### Customizing Theme
|
|
88
|
-
|
|
89
|
-
#### 1. Define colors for `light` and `dark` theme
|
|
90
|
-
|
|
91
|
-
The `light` and `dark` theme color definitions are provided as examples above. They are objects that contain color properties for different UI components and states.
|
|
92
|
-
|
|
93
|
-
#### 2. Integrating with `CpkProvider`
|
|
94
|
-
|
|
95
|
-
When integrating with `CpkProvider`, you will provide your defined light and dark themes as the custom theme:
|
|
96
|
-
|
|
97
|
-
```tsx
|
|
98
|
-
<CpkProvider customTheme={{light, dark}}>
|
|
99
|
-
<App />
|
|
100
|
-
</CpkProvider>
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### Fonts
|
|
51
|
+
## Provider
|
|
104
52
|
|
|
105
|
-
|
|
53
|
+
Wrap the application once near the root:
|
|
106
54
|
|
|
107
55
|
```tsx
|
|
108
|
-
import {useCPK} from 'cpk-ui';
|
|
109
|
-
|
|
110
|
-
const {assetLoaded} = useCPK();
|
|
56
|
+
import {CpkProvider, useCPK} from 'cpk-ui';
|
|
111
57
|
|
|
112
|
-
|
|
113
|
-
return
|
|
58
|
+
export function Root() {
|
|
59
|
+
return (
|
|
60
|
+
<CpkProvider>
|
|
61
|
+
<App />
|
|
62
|
+
</CpkProvider>
|
|
63
|
+
);
|
|
114
64
|
}
|
|
115
65
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
### Icons
|
|
120
|
-
|
|
121
|
-
Integrate [Phosphoricons](https://phosphoricons.com) easily using the `Icon` component.
|
|
122
|
-
|
|
123
|
-
```tsx
|
|
124
|
-
import {Icon} from 'cpk-ui';
|
|
125
|
-
|
|
126
|
-
<Icon name="..." color="#AAA" size={32} />;
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
### Installing Fonts (Recommended)
|
|
130
|
-
|
|
131
|
-
`cpk-ui` uses [Pretendard](https://github.com/orioncactus/pretendard) as its default font. The font families include `Pretendard`, `Pretendard-Bold`, and `Pretendard-Thin`. From version `0.2.1`, these fonts are automatically installed when you add `cpk-ui`. However, it is important to ensure that the fonts are loaded properly using `assetLoaded` from the `CpkProvider`.
|
|
132
|
-
|
|
133
|
-
```tsx
|
|
134
|
-
import {useCPK} from 'cpk-ui';
|
|
135
|
-
|
|
136
|
-
const {assetLoaded} = useCPK();
|
|
66
|
+
function App() {
|
|
67
|
+
const {assetLoaded} = useCPK();
|
|
137
68
|
|
|
138
|
-
if (!assetLoaded)
|
|
139
|
-
|
|
140
|
-
return ...;
|
|
69
|
+
if (!assetLoaded) return null;
|
|
70
|
+
return <Main />;
|
|
141
71
|
}
|
|
142
|
-
|
|
143
|
-
return <Main/>
|
|
144
72
|
```
|
|
145
73
|
|
|
146
|
-
|
|
74
|
+
`CpkProvider` loads the bundled Pretendard font families and supplies light or
|
|
75
|
+
dark theme tokens. Applications that provide product-specific tokens can pass
|
|
76
|
+
`customTheme={{light, dark}}`.
|
|
147
77
|
|
|
148
|
-
|
|
149
|
-
| :----------------: | :-----: |
|
|
150
|
-
| react | >=16.13 |
|
|
151
|
-
| react-native | >=0.58 |
|
|
152
|
-
| kstyled | >=0.1.0 |
|
|
153
|
-
| @expo/vector-icons | \* |
|
|
78
|
+
## Component Surface
|
|
154
79
|
|
|
155
|
-
|
|
80
|
+
| Area | Components |
|
|
81
|
+
| ---------------- | ---------------------------------------------------------------------- |
|
|
82
|
+
| Actions | Button, CustomPressable, Fab, IconButton |
|
|
83
|
+
| Inputs | Checkbox, EditText, RadioGroup, Rating, SegmentedControl, SwitchToggle |
|
|
84
|
+
| Feedback | AlertDialog, ErrorBoundary, LoadingIndicator, Snackbar |
|
|
85
|
+
| Display | Accordion, Card, Hr, Icon, Typography |
|
|
86
|
+
| Media and system | PinchZoom, StatusBarBrightness |
|
|
156
87
|
|
|
157
|
-
|
|
88
|
+
Each public component has automated tests and Storybook coverage for its main
|
|
89
|
+
states. Use the [live Storybook](https://ui.crossplatformkorea.com) to inspect
|
|
90
|
+
controls, responsive behavior, accessibility results, and source examples.
|
|
158
91
|
|
|
159
|
-
|
|
92
|
+
## Release Matrix
|
|
160
93
|
|
|
161
|
-
|
|
94
|
+
The 0.7.0 release is verified with Expo 54, React Native 0.81, React 19,
|
|
95
|
+
kstyled 0.4, and React Native Web 0.21. This is the release validation matrix,
|
|
96
|
+
not a claim that every consumer must use those exact React or React Native
|
|
97
|
+
versions.
|
|
162
98
|
|
|
163
|
-
|
|
164
|
-
yarn add @expo/webpack-config
|
|
165
|
-
```
|
|
99
|
+
## Quality Gates
|
|
166
100
|
|
|
167
|
-
|
|
101
|
+
```bash
|
|
102
|
+
bun run test:all
|
|
103
|
+
bun run build
|
|
104
|
+
bun run e2e-smoke
|
|
105
|
+
bun run storybook:build
|
|
106
|
+
bun run pack:dry
|
|
107
|
+
```
|
|
168
108
|
|
|
169
|
-
|
|
109
|
+
The npm publish guard rejects local publishing. Releases run only from the
|
|
110
|
+
main-branch GitHub Actions publish workflow with provenance.
|
|
170
111
|
|
|
171
|
-
|
|
172
|
-
const createExpoWebpackConfigAsync = require('@expo/webpack-config');
|
|
112
|
+
## Documentation
|
|
173
113
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
argv,
|
|
183
|
-
);
|
|
184
|
-
return config;
|
|
185
|
-
};
|
|
186
|
-
```
|
|
114
|
+
- [Storybook](https://ui.crossplatformkorea.com)
|
|
115
|
+
- [0.7.0 release notes](./docs/releases/0.7.0.md)
|
|
116
|
+
- [0.7 engineering notes](./docs/blog/2026-07-11-cpk-ui-0.7.0.md)
|
|
117
|
+
- [Performance guide](./docs/PERFORMANCE.md)
|
|
118
|
+
- [Changelog](./CHANGELOG.md)
|
|
119
|
+
- [Contributing](./CONTRIBUTING.md)
|
|
187
120
|
|
|
188
|
-
|
|
121
|
+
## License
|
|
189
122
|
|
|
190
|
-
|
|
123
|
+
MIT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/modals/AlertDialog/AlertDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAQZ,KAAK,YAAY,EAClB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AA6DlE,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAExE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,aAAa,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5B,eAAe,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,kB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,CAAC;IAC5B,eAAe,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,IAAI,CAAC,EAAE,mBAAmB,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,CAAC,kBAAkB,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACpD,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;;AAqSF,wBAEE"}
|
|
@@ -131,10 +131,12 @@ function AlertDialog({ style }, ref) {
|
|
|
131
131
|
? `rgba(0,0,0,${backdropOpacity})`
|
|
132
132
|
: `rgba(255,255,255,${backdropOpacity})`, [themeType, backdropOpacity]);
|
|
133
133
|
// Memoize shadow styles
|
|
134
|
-
const shadowStyles = useMemo(() => Platform.OS !== 'web'
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
const shadowStyles = useMemo(() => Platform.OS !== 'web'
|
|
135
|
+
? {
|
|
136
|
+
shadowOffset: { width: 0, height: 4 },
|
|
137
|
+
shadowColor: theme.text.basic,
|
|
138
|
+
}
|
|
139
|
+
: {}, [theme.text.basic]);
|
|
138
140
|
// Memoize container styles
|
|
139
141
|
const containerStyles = useMemo(() => StyleSheet.flatten([shadowStyles, styles?.container]), [shadowStyles, styles?.container]);
|
|
140
142
|
// Memoize backdrop press handler
|
|
@@ -158,10 +160,15 @@ function AlertDialog({ style }, ref) {
|
|
|
158
160
|
},
|
|
159
161
|
})) })) : null, [actions, sizeConfig.actionMarginTop, styles?.actionContainer]);
|
|
160
162
|
// Memoize close button content
|
|
161
|
-
const closeButtonContent = useMemo(() => showCloseButton ? (_jsx(Button, { onPress: handleCloseButtonPress, borderRadius: 24, text: _jsx(Icon, { color: theme.text.basic, name: "X", size: sizeConfig.iconSize }), type: "text" })) : null, [
|
|
163
|
+
const closeButtonContent = useMemo(() => showCloseButton ? (_jsx(Button, { accessibilityLabel: "Close dialog", onPress: handleCloseButtonPress, borderRadius: 24, text: _jsx(Icon, { color: theme.text.basic, name: "X", size: sizeConfig.iconSize }), type: "text" })) : null, [
|
|
164
|
+
showCloseButton,
|
|
165
|
+
handleCloseButtonPress,
|
|
166
|
+
sizeConfig.iconSize,
|
|
167
|
+
theme.text.basic,
|
|
168
|
+
]);
|
|
162
169
|
const AlertDialogContent = useMemo(() => (_jsxs(Container, { style: css `
|
|
163
|
-
|
|
164
|
-
|
|
170
|
+
background-color: ${backdropColor};
|
|
171
|
+
`, children: [_jsx(TouchableWithoutFeedback, { onPress: closeOnTouchOutside ? handleCloseButtonPress : undefined, children: _jsx(View, { style: StyleSheet.absoluteFill }) }), _jsxs(AlertDialogContainer, { "$size": size, accessibilityRole: "alert", accessibilityLabel: typeof title === 'string' ? title : 'Alert dialog', style: containerStyles, children: [_jsxs(TitleRow, { style: styles?.titleContainer, children: [titleContent, closeButtonContent] }), _jsx(BodyRow, { "$marginTop": sizeConfig.bodyMarginTop, "$marginBottom": sizeConfig.bodyMarginBottom, style: styles?.bodyContainer, children: bodyContent }), actionsContent] })] })), [
|
|
165
172
|
backdropColor,
|
|
166
173
|
closeOnTouchOutside,
|
|
167
174
|
handleCloseButtonPress,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Snackbar.d.ts","sourceRoot":"","sources":["../../../../src/components/modals/Snackbar/Snackbar.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Snackbar.d.ts","sourceRoot":"","s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forwardRef, useImperativeHandle, useState, useCallback, useMemo } from 'react';
|
|
3
|
-
import { Modal, Platform,
|
|
2
|
+
import React, { forwardRef, useImperativeHandle, useState, useCallback, useMemo, } from 'react';
|
|
3
|
+
import { Modal, Platform, StyleSheet, View } from 'react-native';
|
|
4
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
4
5
|
import { styled, css } from 'kstyled';
|
|
5
6
|
import { SnackbarTimer } from './const';
|
|
6
7
|
import { Button } from '../../uis/Button/Button';
|
|
@@ -70,7 +71,7 @@ function Snackbar({ style }, ref) {
|
|
|
70
71
|
open: handleOpen,
|
|
71
72
|
close: handleClose,
|
|
72
73
|
}), [handleOpen, handleClose]);
|
|
73
|
-
const { text, styles, actionText, color = 'primary', size = 'medium' } = options ?? {};
|
|
74
|
+
const { text, styles, actionText, color = 'primary', size = 'medium', } = options ?? {};
|
|
74
75
|
// Calculate sizes based on size prop
|
|
75
76
|
const sizeConfig = useMemo(() => {
|
|
76
77
|
if (typeof size === 'number') {
|
|
@@ -98,25 +99,27 @@ function Snackbar({ style }, ref) {
|
|
|
98
99
|
}
|
|
99
100
|
}, [size]);
|
|
100
101
|
// Memoize shadow styles
|
|
101
|
-
const shadowStyles = useMemo(() => Platform.OS !== 'web'
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
const shadowStyles = useMemo(() => Platform.OS !== 'web'
|
|
103
|
+
? {
|
|
104
|
+
shadowOffset: { width: 0, height: 4 },
|
|
105
|
+
shadowColor: theme.text.basic,
|
|
106
|
+
}
|
|
107
|
+
: {}, [theme.text.basic]);
|
|
105
108
|
// Memoize container styles
|
|
106
109
|
const containerStyles = useMemo(() => StyleSheet.flatten([shadowStyles, styles?.container]), [shadowStyles, styles?.container]);
|
|
107
110
|
// Memoize text styles
|
|
108
111
|
const textStyles = useMemo(() => StyleSheet.flatten([
|
|
109
112
|
css `
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
color: ${theme.button[color].text};
|
|
114
|
+
font-size: ${sizeConfig.fontSize}px;
|
|
115
|
+
`,
|
|
113
116
|
styles?.text,
|
|
114
117
|
]), [theme.button, color, sizeConfig.fontSize, styles?.text]);
|
|
115
118
|
// Memoize action text styles
|
|
116
119
|
const actionTextStyles = useMemo(() => StyleSheet.flatten([
|
|
117
120
|
css `
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
color: ${theme.button[color].text};
|
|
122
|
+
`,
|
|
120
123
|
styles?.actionText,
|
|
121
124
|
]), [theme.button, color, styles?.actionText]);
|
|
122
125
|
// Memoize action button handler
|
|
@@ -124,14 +127,14 @@ function Snackbar({ style }, ref) {
|
|
|
124
127
|
// Memoize modal styles
|
|
125
128
|
const modalStyles = useMemo(() => [
|
|
126
129
|
css `
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
flex: 1;
|
|
131
|
+
align-self: stretch;
|
|
132
|
+
`,
|
|
130
133
|
style,
|
|
131
134
|
], [style]);
|
|
132
|
-
const SnackbarContent = useMemo(() => (_jsx(Container, { children: _jsxs(SnackbarContainer, { "$color": color, "$size": size, style: containerStyles, children: [_jsx(SnackbarText, { "$color": color, "$size": size, style: textStyles, children: text }), _jsx(ActionContainer, { style: styles?.actionContainer, children: actionText ? (_jsx(Button, { onPress: handleActionPress, styles: {
|
|
135
|
+
const SnackbarContent = useMemo(() => (_jsx(Container, { children: _jsxs(SnackbarContainer, { "$color": color, "$size": size, accessibilityLabel: text, accessibilityLiveRegion: "polite", accessibilityRole: "alert", style: containerStyles, testID: "snackbar-container", children: [_jsx(SnackbarText, { "$color": color, "$size": size, style: textStyles, children: text }), _jsx(ActionContainer, { style: styles?.actionContainer, children: actionText ? (_jsx(Button, { accessibilityLabel: actionText, onPress: handleActionPress, styles: {
|
|
133
136
|
text: actionTextStyles,
|
|
134
|
-
}, text: actionText, type: "text" })) : (_jsx(Button, { onPress: handleActionPress, text: _jsx(Icon, { color: theme.button[color].text, name: "X", size: sizeConfig.iconSize }), type: "text" })) })] }) })), [
|
|
137
|
+
}, text: actionText, type: "text" })) : (_jsx(Button, { accessibilityLabel: "Dismiss notification", onPress: handleActionPress, text: _jsx(Icon, { color: theme.button[color].text, name: "X", size: sizeConfig.iconSize }), type: "text" })) })] }) })), [
|
|
135
138
|
color,
|
|
136
139
|
size,
|
|
137
140
|
containerStyles,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionItem.d.ts","sourceRoot":"","sources":["../../../../src/components/uis/Accordion/AccordionItem.tsx"],"names":[],"mappings":"AACA,OAAc,
|
|
1
|
+
{"version":3,"file":"AccordionItem.d.ts","sourceRoot":"","sources":["../../../../src/components/uis/Accordion/AccordionItem.tsx"],"names":[],"mappings":"AACA,OAAc,EAMZ,KAAK,YAAY,EAClB,MAAM,OAAO,CAAC;AAQf,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,aAAa,CAAC;AA+DpD,MAAM,MAAM,qBAAqB,CAAC,CAAC,EAAE,CAAC,IAAI;IACxC,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,CAAC,EAAE,CAAC;CACZ,CAAC;AAEF,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAC3E,CAAC;AAEF,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,EAClC,MAAM,EACN,IAAI,EAAE,IAAI,EACV,IAAe,EACf,aAAoB,EACpB,eAAsB,EACtB,YAAkB,EAClB,aAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,WAAW,EACX,WAAW,EACX,UAAU,EACV,MAAM,GACP,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,YAAY,CAmR5B;wBAG2C,OAAO,aAAa;AAAhE,wBAAiE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// Caveat: Expo web needs React to be imported
|
|
3
|
-
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
4
4
|
import { Animated, Easing, TouchableOpacity, View } from 'react-native';
|
|
5
5
|
import { styled, css } from 'kstyled';
|
|
6
6
|
import { Icon } from '../Icon/Icon';
|
|
@@ -75,8 +75,12 @@ export function AccordionItem({ testID, data: data, size = 'medium', shouldAnima
|
|
|
75
75
|
// Calculate icon size based on accordion size
|
|
76
76
|
const iconSize = typeof size === 'number'
|
|
77
77
|
? size * 0.7
|
|
78
|
-
: size === 'small'
|
|
79
|
-
|
|
78
|
+
: size === 'small'
|
|
79
|
+
? 12
|
|
80
|
+
: size === 'large'
|
|
81
|
+
? 16
|
|
82
|
+
: 14;
|
|
83
|
+
const defaultToggleElement = (_jsx(StyledIcon, { name: "CaretDown", "$size": size, size: iconSize }));
|
|
80
84
|
const dropDownAnimValueRef = useRef(new Animated.Value(0));
|
|
81
85
|
const rotateAnimValueRef = useRef(new Animated.Value(0));
|
|
82
86
|
const fadeItemAnim = useRef(new Animated.Value(0)).current;
|
|
@@ -124,12 +128,18 @@ export function AccordionItem({ testID, data: data, size = 'medium', shouldAnima
|
|
|
124
128
|
// Calculate margin based on size
|
|
125
129
|
const toggleMargin = typeof size === 'number'
|
|
126
130
|
? size * 0.6
|
|
127
|
-
: size === 'small'
|
|
131
|
+
: size === 'small'
|
|
132
|
+
? 10
|
|
133
|
+
: size === 'large'
|
|
134
|
+
? 14
|
|
135
|
+
: 12;
|
|
128
136
|
// Memoize toggle element container
|
|
129
137
|
const toggleElContainer = useMemo(() => (_jsx(Animated.View, { style: [
|
|
130
138
|
css `
|
|
131
|
-
|
|
132
|
-
|
|
139
|
+
margin-right: ${toggleElementPosition === 'left'
|
|
140
|
+
? toggleMargin
|
|
141
|
+
: 0}px;
|
|
142
|
+
`,
|
|
133
143
|
{
|
|
134
144
|
transform: [
|
|
135
145
|
{
|
|
@@ -141,22 +151,28 @@ export function AccordionItem({ testID, data: data, size = 'medium', shouldAnima
|
|
|
141
151
|
],
|
|
142
152
|
},
|
|
143
153
|
styles?.toggleElement,
|
|
144
|
-
], children: toggleElement || defaultToggleElement })), [
|
|
154
|
+
], children: toggleElement || defaultToggleElement })), [
|
|
155
|
+
toggleElement,
|
|
156
|
+
defaultToggleElement,
|
|
157
|
+
toggleElementPosition,
|
|
158
|
+
toggleMargin,
|
|
159
|
+
styles?.toggleElement,
|
|
160
|
+
]);
|
|
145
161
|
// Memoize container styles
|
|
146
162
|
const containerStyles = useMemo(() => [
|
|
147
163
|
css `
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
164
|
+
background-color: transparent;
|
|
165
|
+
overflow: hidden;
|
|
166
|
+
flex-direction: column-reverse;
|
|
167
|
+
`,
|
|
152
168
|
styles?.container,
|
|
153
169
|
], [styles?.container]);
|
|
154
170
|
const titleContainerStyles = useMemo(() => [
|
|
155
171
|
css `
|
|
156
|
-
|
|
172
|
+
justify-content: ${toggleElementPosition === 'right'
|
|
157
173
|
? 'space-between'
|
|
158
174
|
: 'flex-start'};
|
|
159
|
-
|
|
175
|
+
`,
|
|
160
176
|
styles?.titleContainer,
|
|
161
177
|
], [toggleElementPosition, styles?.titleContainer]);
|
|
162
178
|
// Memoize animated styles
|
|
@@ -172,14 +188,22 @@ export function AccordionItem({ testID, data: data, size = 'medium', shouldAnima
|
|
|
172
188
|
// Calculate font sizes based on size prop
|
|
173
189
|
const titleFontSize = typeof size === 'number'
|
|
174
190
|
? size
|
|
175
|
-
: size === 'small'
|
|
191
|
+
: size === 'small'
|
|
192
|
+
? 14
|
|
193
|
+
: size === 'large'
|
|
194
|
+
? 18
|
|
195
|
+
: 16;
|
|
176
196
|
const itemFontSize = typeof size === 'number'
|
|
177
197
|
? size * 0.875
|
|
178
|
-
: size === 'small'
|
|
179
|
-
|
|
198
|
+
: size === 'small'
|
|
199
|
+
? 12
|
|
200
|
+
: size === 'large'
|
|
201
|
+
? 16
|
|
202
|
+
: 14;
|
|
203
|
+
return (_jsxs(Animated.View, { style: containerStyles, children: [_jsx(View, { accessibilityElementsHidden: true, "aria-hidden": true, importantForAccessibility: "no-hide-descendants", onLayout: handleLayout, style: css `
|
|
180
204
|
position: absolute;
|
|
181
205
|
opacity: 0;
|
|
182
|
-
`, children: data.items.map((body, index) => (_jsx(ItemTouch, { activeOpacity: activeOpacity, onPress: () => handleItemPress(body), "$size": size, children: typeof body === 'string' && !renderItem ? (_jsx(Typography.Body3, { style: [{ fontSize: itemFontSize }, styles?.itemText], children: body })) : (renderItem?.(body)) }, `body-${index}`))) }), _jsx(Animated.View, { accessibilityState: { expanded: !collapsed }, style: animatedItemStyles, testID: `body-${testID}`, children: data.items.map((body, index) => (_jsx(ItemTouch, { activeOpacity: activeOpacity, onPress: () => handleItemPress(body), style: styles?.itemContainer, "$size": size, children: typeof body === 'string' && !renderItem ? (_jsx(Typography.Body3, { style: [{ fontSize: itemFontSize }, styles?.itemText], children: body })) : (renderItem?.(body)) }, `body-${index}`))) }), _jsxs(TitleTouch, { activeOpacity: activeOpacity, onPress: handleToggle, accessibilityRole: "button", accessibilityLabel: typeof data.title === 'string' ? data.title : 'Accordion section', accessibilityState: { expanded: !collapsed }, accessibilityHint: collapsed ? 'Double tap to expand' : 'Double tap to collapse', style: titleContainerStyles, testID: `title-${testID}`, "$size": size, children: [toggleElementPosition === 'left' ? toggleElContainer : null, typeof data.title === 'string' && !renderTitle ? (_jsx(Typography.Heading4, { style: [{ fontSize: titleFontSize }, styles?.titleText], children: data.title })) : (renderTitle?.(data.title)), toggleElementPosition === 'right' ? toggleElContainer : null] })] }));
|
|
206
|
+
`, testID: `measure-body-${testID}`, children: data.items.map((body, index) => (_jsx(ItemTouch, { accessible: false, activeOpacity: activeOpacity, disabled: true, onPress: () => handleItemPress(body), "$size": size, children: typeof body === 'string' && !renderItem ? (_jsx(Typography.Body3, { style: [{ fontSize: itemFontSize }, styles?.itemText], children: body })) : (renderItem?.(body)) }, `body-${index}`))) }), _jsx(Animated.View, { accessibilityElementsHidden: collapsed, accessibilityState: { expanded: !collapsed }, "aria-hidden": collapsed, importantForAccessibility: collapsed ? 'no-hide-descendants' : 'auto', style: animatedItemStyles, testID: `body-${testID}`, children: data.items.map((body, index) => (_jsx(ItemTouch, { activeOpacity: activeOpacity, disabled: collapsed, onPress: () => handleItemPress(body), style: styles?.itemContainer, "$size": size, children: typeof body === 'string' && !renderItem ? (_jsx(Typography.Body3, { style: [{ fontSize: itemFontSize }, styles?.itemText], children: body })) : (renderItem?.(body)) }, `body-${index}`))) }), _jsxs(TitleTouch, { activeOpacity: activeOpacity, "aria-expanded": !collapsed, onPress: handleToggle, accessibilityRole: "button", accessibilityLabel: typeof data.title === 'string' ? data.title : 'Accordion section', accessibilityState: { expanded: !collapsed }, accessibilityHint: collapsed ? 'Double tap to expand' : 'Double tap to collapse', style: titleContainerStyles, testID: `title-${testID}`, "$size": size, children: [toggleElementPosition === 'left' ? toggleElContainer : null, typeof data.title === 'string' && !renderTitle ? (_jsx(Typography.Heading4, { style: [{ fontSize: titleFontSize }, styles?.titleText], children: data.title })) : (renderTitle?.(data.title)), toggleElementPosition === 'right' ? toggleElContainer : null] })] }));
|
|
183
207
|
}
|
|
184
208
|
// Export memoized component for better performance
|
|
185
209
|
export default React.memo(AccordionItem);
|
|
@@ -24,6 +24,7 @@ export type Props = {
|
|
|
24
24
|
touchableHighlightProps?: Omit<TouchableHighlightProps, 'onPress' | 'activeOpacity' | 'style'>;
|
|
25
25
|
hitSlop?: null | Insets | number | undefined;
|
|
26
26
|
hapticFeedback?: Haptics.ImpactFeedbackStyle;
|
|
27
|
+
accessibilityLabel?: string;
|
|
27
28
|
};
|
|
28
29
|
type Styles = {
|
|
29
30
|
container?: StyleProp<ViewStyle>;
|
|
@@ -34,7 +35,7 @@ type Styles = {
|
|
|
34
35
|
disabledText?: StyleProp<TextStyle>;
|
|
35
36
|
hovered?: StyleProp<ViewStyle>;
|
|
36
37
|
};
|
|
37
|
-
export declare function Button({ testID, type, color, size, disabled, loading, loadingElement, text, startElement, endElement, style, styles, onPress, activeOpacity, touchableHighlightProps, borderRadius, loadingColor, hitSlop, hapticFeedback, }: Props): ReactElement;
|
|
38
|
+
export declare function Button({ testID, type, color, size, disabled, loading, loadingElement, text, startElement, endElement, style, styles, onPress, activeOpacity, touchableHighlightProps, borderRadius, loadingColor, hitSlop, hapticFeedback, accessibilityLabel, }: Props): ReactElement;
|
|
38
39
|
declare const _default: typeof Button;
|
|
39
40
|
export default _default;
|
|
40
41
|
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/uis/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAc,
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/uis/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAuB,KAAK,YAAY,EAAC,MAAM,OAAO,CAAC;AACrE,OAAO,KAAK,EACV,MAAM,EACN,SAAS,EACT,SAAS,EACT,uBAAuB,EACvB,SAAS,EACV,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AAGxC,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;AACvD,MAAM,MAAM,eAAe,GACvB,SAAS,GACT,WAAW,GACX,SAAS,GACT,QAAQ,GACR,SAAS,GACT,MAAM,GACN,OAAO,CAAC;AACZ,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AA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AAC,CAAC;IAC5B,QAAQ,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAChC,CAAC;AAgKF,wBAAgB,MAAM,CAAC,EACrB,MAAM,EACN,IAAc,EACd,KAAiB,EACjB,IAAe,EACf,QAAQ,EACR,OAAe,EACf,cAAc,EACd,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,KAAK,EACL,MAAM,EACN,OAAO,EACP,aAAmB,EACnB,uBAAuB,EACvB,YAAgB,EAChB,YAAY,EACZ,OAAgD,EAChD,cAAc,EACd,kBAAkB,GACnB,EAAE,KAAK,GAAG,YAAY,CAsMtB;wBAGoC,OAAO,MAAM;AAAlD,wBAAmD"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } 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 { styled, css } from 'kstyled';
|
|
6
5
|
import { useTheme } from '../../../providers/ThemeProvider';
|
|
7
6
|
import { cloneElemWithDefaultColors } from '../../../utils/guards';
|
|
8
7
|
import { LoadingIndicator } from '../LoadingIndicator/LoadingIndicator';
|
|
9
8
|
import { Typography } from '../Typography/Typography';
|
|
10
9
|
import * as Haptics from 'expo-haptics';
|
|
10
|
+
import { useHoverState } from '../../../hooks/useHoverState';
|
|
11
11
|
const ButtonContainer = styled.View `
|
|
12
12
|
align-self: stretch;
|
|
13
13
|
flex-direction: row;
|
|
@@ -114,9 +114,8 @@ const useButtonState = ({ disabled, onPress, loading, }) => {
|
|
|
114
114
|
isLoading: loading,
|
|
115
115
|
}), [disabled, onPress, loading]);
|
|
116
116
|
};
|
|
117
|
-
export function Button({ testID, type = 'solid', color = 'primary', size = 'medium', disabled, loading = false, loadingElement, text, startElement, endElement, style, styles, onPress, activeOpacity = 0.8, touchableHighlightProps, borderRadius = 4, loadingColor, hitSlop = { top: 8, bottom: 8, left: 8, right: 8 }, hapticFeedback, }) {
|
|
118
|
-
const
|
|
119
|
-
const hovered = useHover(ref);
|
|
117
|
+
export function Button({ testID, type = 'solid', color = 'primary', size = 'medium', disabled, loading = false, loadingElement, text, startElement, endElement, style, styles, onPress, activeOpacity = 0.8, touchableHighlightProps, borderRadius = 4, loadingColor, hitSlop = { top: 8, bottom: 8, left: 8, right: 8 }, hapticFeedback, accessibilityLabel, }) {
|
|
118
|
+
const { hovered, hoverProps } = useHoverState();
|
|
120
119
|
const { theme } = useTheme();
|
|
121
120
|
const { innerDisabled } = useButtonState({ disabled, onPress, loading });
|
|
122
121
|
// Memoize styles calculation
|
|
@@ -183,7 +182,7 @@ export function Button({ testID, type = 'solid', color = 'primary', size = 'medi
|
|
|
183
182
|
`,
|
|
184
183
|
innerDisabled && compositeStyles.disabled,
|
|
185
184
|
!!borderRadius && { borderRadius },
|
|
186
|
-
], testID: loading ? 'loading-view' : 'button-container', "$type": type, children: [_jsx(View, { style: compositeStyles.content, children: children }), _jsx(View, { style: compositeStyles.loading, children: loadingView })] })), [
|
|
185
|
+
], testID: loading ? 'loading-view' : 'button-container', "$type": type, children: [_jsx(View, { style: compositeStyles.content, children: children }), _jsx(View, { style: compositeStyles.loading, children: loading ? loadingView : null })] })), [
|
|
187
186
|
innerDisabled,
|
|
188
187
|
size,
|
|
189
188
|
compositeStyles.container,
|
|
@@ -209,10 +208,11 @@ export function Button({ testID, type = 'solid', color = 'primary', size = 'medi
|
|
|
209
208
|
border-radius: ${borderRadius}px;
|
|
210
209
|
`,
|
|
211
210
|
], [style, borderRadius]);
|
|
212
|
-
return (_jsx(TouchableHighlight, { activeOpacity: activeOpacity, delayPressIn: 30, disabled: innerDisabled || loading || !onPress, hitSlop: hitSlop, onPress: handlePress,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
211
|
+
return (_jsx(TouchableHighlight, { accessibilityLabel: accessibilityLabel ?? (typeof text === 'string' ? text : undefined), accessibilityRole: "button", "aria-busy": loading, "aria-disabled": innerDisabled || loading || !onPress, activeOpacity: activeOpacity, delayPressIn: 30, disabled: innerDisabled || loading || !onPress, hitSlop: hitSlop, onPress: handlePress, style: buttonStyles, testID: testID, underlayColor: type === 'text' ? 'transparent' : theme.role.underlay, ...touchableHighlightProps, accessibilityState: {
|
|
212
|
+
...touchableHighlightProps?.accessibilityState,
|
|
213
|
+
busy: loading,
|
|
214
|
+
disabled: innerDisabled || loading || !onPress,
|
|
215
|
+
}, ...hoverProps, children: renderContainer({
|
|
216
216
|
children: ChildView,
|
|
217
217
|
loadingView: LoadingView,
|
|
218
218
|
}) }));
|
|
@@ -11,6 +11,7 @@ type Styles = {
|
|
|
11
11
|
};
|
|
12
12
|
export type CardProps = {
|
|
13
13
|
testID?: string;
|
|
14
|
+
accessibilityLabel?: string;
|
|
14
15
|
children?: React.ReactNode;
|
|
15
16
|
elevation?: number;
|
|
16
17
|
borderRadius?: number;
|
|
@@ -21,6 +22,6 @@ export type CardProps = {
|
|
|
21
22
|
styles?: Styles;
|
|
22
23
|
onPress?: () => void;
|
|
23
24
|
};
|
|
24
|
-
export default function Card({ testID, children, elevation, borderRadius, padding, margin, backgroundColor, style, styles, onPress, }: CardProps): JSX.Element;
|
|
25
|
+
export default function Card({ testID, accessibilityLabel, children, elevation, borderRadius, padding, margin, backgroundColor, style, styles, onPress, }: CardProps): JSX.Element;
|
|
25
26
|
export { Card };
|
|
26
27
|
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../src/components/uis/Card/Card.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,M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