@studio-piot/native-ui 0.1.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/LICENSE +15 -0
- package/README.md +91 -0
- package/dist/components/Button/Button.d.ts +16 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/Button.js +44 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/buttonRadius.d.ts +3 -0
- package/dist/components/Button/buttonRadius.d.ts.map +1 -0
- package/dist/components/Button/buttonRadius.js +17 -0
- package/dist/components/Button/buttonRadius.js.map +1 -0
- package/dist/components/Button/index.d.ts +3 -0
- package/dist/components/Button/index.d.ts.map +1 -0
- package/dist/components/Button/index.js +8 -0
- package/dist/components/Button/index.js.map +1 -0
- package/dist/components/Field/FieldText.d.ts +3 -0
- package/dist/components/Field/FieldText.d.ts.map +1 -0
- package/dist/components/Field/FieldText.js +9 -0
- package/dist/components/Field/FieldText.js.map +1 -0
- package/dist/components/Field/FieldTextarea.d.ts +3 -0
- package/dist/components/Field/FieldTextarea.d.ts.map +1 -0
- package/dist/components/Field/FieldTextarea.js +10 -0
- package/dist/components/Field/FieldTextarea.js.map +1 -0
- package/dist/components/Field/fieldChrome.d.ts +10 -0
- package/dist/components/Field/fieldChrome.d.ts.map +1 -0
- package/dist/components/Field/fieldChrome.js +100 -0
- package/dist/components/Field/fieldChrome.js.map +1 -0
- package/dist/components/Field/fieldThemeRoles.d.ts +13 -0
- package/dist/components/Field/fieldThemeRoles.d.ts.map +1 -0
- package/dist/components/Field/fieldThemeRoles.js +15 -0
- package/dist/components/Field/fieldThemeRoles.js.map +1 -0
- package/dist/components/Field/index.d.ts +6 -0
- package/dist/components/Field/index.d.ts.map +1 -0
- package/dist/components/Field/index.js +10 -0
- package/dist/components/Field/index.js.map +1 -0
- package/dist/components/Field/resolveFieldBorder.d.ts +16 -0
- package/dist/components/Field/resolveFieldBorder.d.ts.map +1 -0
- package/dist/components/Field/resolveFieldBorder.js +20 -0
- package/dist/components/Field/resolveFieldBorder.js.map +1 -0
- package/dist/components/Field/resolveFieldColor.d.ts +7 -0
- package/dist/components/Field/resolveFieldColor.d.ts.map +1 -0
- package/dist/components/Field/resolveFieldColor.js +21 -0
- package/dist/components/Field/resolveFieldColor.js.map +1 -0
- package/dist/components/Field/types.d.ts +46 -0
- package/dist/components/Field/types.d.ts.map +1 -0
- package/dist/components/Field/types.js +3 -0
- package/dist/components/Field/types.js.map +1 -0
- package/dist/components/Field/useResolvedFieldColor.d.ts +2 -0
- package/dist/components/Field/useResolvedFieldColor.d.ts.map +1 -0
- package/dist/components/Field/useResolvedFieldColor.js +15 -0
- package/dist/components/Field/useResolvedFieldColor.js.map +1 -0
- package/dist/components/Form/Form.d.ts +3 -0
- package/dist/components/Form/Form.d.ts.map +1 -0
- package/dist/components/Form/Form.js +100 -0
- package/dist/components/Form/Form.js.map +1 -0
- package/dist/components/Form/FormCloseButton.d.ts +4 -0
- package/dist/components/Form/FormCloseButton.d.ts.map +1 -0
- package/dist/components/Form/FormCloseButton.js +17 -0
- package/dist/components/Form/FormCloseButton.js.map +1 -0
- package/dist/components/Form/index.d.ts +4 -0
- package/dist/components/Form/index.d.ts.map +1 -0
- package/dist/components/Form/index.js +8 -0
- package/dist/components/Form/index.js.map +1 -0
- package/dist/components/Form/resolveThemeColor.d.ts +11 -0
- package/dist/components/Form/resolveThemeColor.d.ts.map +1 -0
- package/dist/components/Form/resolveThemeColor.js +21 -0
- package/dist/components/Form/resolveThemeColor.js.map +1 -0
- package/dist/components/Form/types.d.ts +30 -0
- package/dist/components/Form/types.d.ts.map +1 -0
- package/dist/components/Form/types.js +3 -0
- package/dist/components/Form/types.js.map +1 -0
- package/dist/components/Form/useResolvedThemeColor.d.ts +2 -0
- package/dist/components/Form/useResolvedThemeColor.d.ts.map +1 -0
- package/dist/components/Form/useResolvedThemeColor.js +15 -0
- package/dist/components/Form/useResolvedThemeColor.js.map +1 -0
- package/dist/components/Form/withAlpha.d.ts +2 -0
- package/dist/components/Form/withAlpha.d.ts.map +1 -0
- package/dist/components/Form/withAlpha.js +12 -0
- package/dist/components/Form/withAlpha.js.map +1 -0
- package/dist/components/LinkBlocks/LinkBlocks.d.ts +3 -0
- package/dist/components/LinkBlocks/LinkBlocks.d.ts.map +1 -0
- package/dist/components/LinkBlocks/LinkBlocks.js +75 -0
- package/dist/components/LinkBlocks/LinkBlocks.js.map +1 -0
- package/dist/components/LinkBlocks/filterGroups.d.ts +3 -0
- package/dist/components/LinkBlocks/filterGroups.d.ts.map +1 -0
- package/dist/components/LinkBlocks/filterGroups.js +7 -0
- package/dist/components/LinkBlocks/filterGroups.js.map +1 -0
- package/dist/components/LinkBlocks/index.d.ts +4 -0
- package/dist/components/LinkBlocks/index.d.ts.map +1 -0
- package/dist/components/LinkBlocks/index.js +8 -0
- package/dist/components/LinkBlocks/index.js.map +1 -0
- package/dist/components/LinkBlocks/types.d.ts +26 -0
- package/dist/components/LinkBlocks/types.d.ts.map +1 -0
- package/dist/components/LinkBlocks/types.js +3 -0
- package/dist/components/LinkBlocks/types.js.map +1 -0
- package/dist/components/RadioField/RadioField.d.ts +3 -0
- package/dist/components/RadioField/RadioField.d.ts.map +1 -0
- package/dist/components/RadioField/RadioField.js +76 -0
- package/dist/components/RadioField/RadioField.js.map +1 -0
- package/dist/components/RadioField/RadioMark.d.ts +7 -0
- package/dist/components/RadioField/RadioMark.d.ts.map +1 -0
- package/dist/components/RadioField/RadioMark.js +32 -0
- package/dist/components/RadioField/RadioMark.js.map +1 -0
- package/dist/components/RadioField/index.d.ts +4 -0
- package/dist/components/RadioField/index.d.ts.map +1 -0
- package/dist/components/RadioField/index.js +8 -0
- package/dist/components/RadioField/index.js.map +1 -0
- package/dist/components/RadioField/radioThemeRoles.d.ts +11 -0
- package/dist/components/RadioField/radioThemeRoles.d.ts.map +1 -0
- package/dist/components/RadioField/radioThemeRoles.js +13 -0
- package/dist/components/RadioField/radioThemeRoles.js.map +1 -0
- package/dist/components/RadioField/types.d.ts +24 -0
- package/dist/components/RadioField/types.d.ts.map +1 -0
- package/dist/components/RadioField/types.js +3 -0
- package/dist/components/RadioField/types.js.map +1 -0
- package/dist/components/Select/Select.d.ts +3 -0
- package/dist/components/Select/Select.d.ts.map +1 -0
- package/dist/components/Select/Select.js +137 -0
- package/dist/components/Select/Select.js.map +1 -0
- package/dist/components/Select/SelectCloseButton.d.ts +4 -0
- package/dist/components/Select/SelectCloseButton.d.ts.map +1 -0
- package/dist/components/Select/SelectCloseButton.js +17 -0
- package/dist/components/Select/SelectCloseButton.js.map +1 -0
- package/dist/components/Select/index.d.ts +6 -0
- package/dist/components/Select/index.d.ts.map +1 -0
- package/dist/components/Select/index.js +14 -0
- package/dist/components/Select/index.js.map +1 -0
- package/dist/components/Select/resolveSelectDetentIndex.d.ts +9 -0
- package/dist/components/Select/resolveSelectDetentIndex.d.ts.map +1 -0
- package/dist/components/Select/resolveSelectDetentIndex.js +16 -0
- package/dist/components/Select/resolveSelectDetentIndex.js.map +1 -0
- package/dist/components/Select/selectThemeRoles.d.ts +12 -0
- package/dist/components/Select/selectThemeRoles.d.ts.map +1 -0
- package/dist/components/Select/selectThemeRoles.js +14 -0
- package/dist/components/Select/selectThemeRoles.js.map +1 -0
- package/dist/components/Select/types.d.ts +35 -0
- package/dist/components/Select/types.d.ts.map +1 -0
- package/dist/components/Select/types.js +3 -0
- package/dist/components/Select/types.js.map +1 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +27 -0
- package/dist/components/index.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +66 -0
- package/dist/index.js.map +1 -0
- package/dist/layout/index.d.ts +2 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/index.js +6 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/layout/screenPadding.d.ts +3 -0
- package/dist/layout/screenPadding.d.ts.map +1 -0
- package/dist/layout/screenPadding.js +6 -0
- package/dist/layout/screenPadding.js.map +1 -0
- package/dist/theme/ThemeProvider.d.ts +11 -0
- package/dist/theme/ThemeProvider.d.ts.map +1 -0
- package/dist/theme/ThemeProvider.js +11 -0
- package/dist/theme/ThemeProvider.js.map +1 -0
- package/dist/theme/index.d.ts +6 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +12 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/resolveColorScheme.d.ts +2 -0
- package/dist/theme/resolveColorScheme.d.ts.map +1 -0
- package/dist/theme/resolveColorScheme.js +7 -0
- package/dist/theme/resolveColorScheme.js.map +1 -0
- package/dist/theme/types.d.ts +8 -0
- package/dist/theme/types.d.ts.map +1 -0
- package/dist/theme/types.js +3 -0
- package/dist/theme/types.js.map +1 -0
- package/dist/theme/useColorScheme.d.ts +2 -0
- package/dist/theme/useColorScheme.d.ts.map +1 -0
- package/dist/theme/useColorScheme.js +16 -0
- package/dist/theme/useColorScheme.js.map +1 -0
- package/dist/theme/useThemeColor.d.ts +5 -0
- package/dist/theme/useThemeColor.d.ts.map +1 -0
- package/dist/theme/useThemeColor.js +25 -0
- package/dist/theme/useThemeColor.js.map +1 -0
- package/docs/components/button.md +162 -0
- package/docs/components/field.md +128 -0
- package/docs/components/form.md +86 -0
- package/docs/components/link-blocks.md +120 -0
- package/docs/components/radio-field.md +100 -0
- package/docs/components/select.md +59 -0
- package/docs/superpowers/plans/2026-09-24-field.md +583 -0
- package/docs/superpowers/plans/2026-09-24-link-blocks.md +414 -0
- package/docs/superpowers/plans/2026-09-24-theme-provider-button.md +493 -0
- package/docs/superpowers/plans/2026-09-25-radio-field.md +516 -0
- package/docs/superpowers/plans/2026-09-25-select.md +22 -0
- package/docs/superpowers/specs/2026-09-24-field-design.md +205 -0
- package/docs/superpowers/specs/2026-09-24-link-blocks-design.md +167 -0
- package/docs/superpowers/specs/2026-09-24-theme-provider-button-design.md +178 -0
- package/docs/superpowers/specs/2026-09-25-radio-field-design.md +136 -0
- package/docs/superpowers/specs/2026-09-25-select-design.md +164 -0
- package/package.json +75 -0
- package/src/components/Button/Button.tsx +97 -0
- package/src/components/Button/buttonRadius.test.ts +16 -0
- package/src/components/Button/buttonRadius.ts +24 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Field/FieldText.tsx +6 -0
- package/src/components/Field/FieldTextarea.tsx +18 -0
- package/src/components/Field/fieldChrome.tsx +219 -0
- package/src/components/Field/fieldThemeRoles.ts +13 -0
- package/src/components/Field/index.ts +5 -0
- package/src/components/Field/resolveFieldBorder.test.ts +76 -0
- package/src/components/Field/resolveFieldBorder.ts +40 -0
- package/src/components/Field/resolveFieldColor.test.ts +92 -0
- package/src/components/Field/resolveFieldColor.ts +26 -0
- package/src/components/Field/types.ts +53 -0
- package/src/components/Field/useResolvedFieldColor.ts +15 -0
- package/src/components/Form/Form.tsx +205 -0
- package/src/components/Form/FormCloseButton.tsx +19 -0
- package/src/components/Form/index.ts +3 -0
- package/src/components/Form/resolveThemeColor.ts +24 -0
- package/src/components/Form/types.ts +30 -0
- package/src/components/Form/useResolvedThemeColor.ts +15 -0
- package/src/components/Form/withAlpha.test.ts +13 -0
- package/src/components/Form/withAlpha.ts +9 -0
- package/src/components/LinkBlocks/LinkBlocks.tsx +165 -0
- package/src/components/LinkBlocks/filterGroups.test.ts +37 -0
- package/src/components/LinkBlocks/filterGroups.ts +7 -0
- package/src/components/LinkBlocks/index.ts +7 -0
- package/src/components/LinkBlocks/types.ts +28 -0
- package/src/components/RadioField/RadioField.tsx +168 -0
- package/src/components/RadioField/RadioMark.tsx +54 -0
- package/src/components/RadioField/index.ts +3 -0
- package/src/components/RadioField/radioThemeRoles.test.ts +15 -0
- package/src/components/RadioField/radioThemeRoles.ts +11 -0
- package/src/components/RadioField/types.ts +25 -0
- package/src/components/Select/Select.tsx +279 -0
- package/src/components/Select/SelectCloseButton.tsx +19 -0
- package/src/components/Select/index.ts +13 -0
- package/src/components/Select/resolveSelectDetentIndex.test.ts +20 -0
- package/src/components/Select/resolveSelectDetentIndex.ts +16 -0
- package/src/components/Select/selectThemeRoles.ts +12 -0
- package/src/components/Select/types.ts +39 -0
- package/src/components/index.ts +42 -0
- package/src/index.ts +50 -0
- package/src/layout/index.ts +1 -0
- package/src/layout/screenPadding.ts +2 -0
- package/src/theme/ThemeProvider.tsx +20 -0
- package/src/theme/index.ts +5 -0
- package/src/theme/resolveColorScheme.test.ts +16 -0
- package/src/theme/resolveColorScheme.ts +5 -0
- package/src/theme/types.ts +5 -0
- package/src/theme/useColorScheme.ts +13 -0
- package/src/theme/useThemeColor.ts +25 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Guillaume Piot
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# @studio-piot/native-ui
|
|
2
|
+
|
|
3
|
+
Shared React Native components for Studio Piot apps.
|
|
4
|
+
|
|
5
|
+
The package is the native counterpart of `@studio-piot/ui`. Apps own their palettes; the package provides theme helpers and presentational components.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @studio-piot/native-ui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`react` and `react-native` are peer dependencies. `Form` also peers `react-native-keyboard-controller` and `react-native-safe-area-context`. `Select` peers `@lodev09/react-native-true-sheet`.
|
|
14
|
+
|
|
15
|
+
## Docs
|
|
16
|
+
|
|
17
|
+
- [Theme provider and Button usage](./docs/components/button.md)
|
|
18
|
+
- [LinkBlocks usage](./docs/components/link-blocks.md)
|
|
19
|
+
- [Field usage](./docs/components/field.md)
|
|
20
|
+
- [Form usage](./docs/components/form.md)
|
|
21
|
+
- [RadioField usage](./docs/components/radio-field.md)
|
|
22
|
+
- [Select usage](./docs/components/select.md)
|
|
23
|
+
- [Design: theme provider and Button](./docs/superpowers/specs/2026-09-24-theme-provider-button-design.md)
|
|
24
|
+
- [Design: LinkBlocks](./docs/superpowers/specs/2026-09-24-link-blocks-design.md)
|
|
25
|
+
- [Design: Field](./docs/superpowers/specs/2026-09-24-field-design.md)
|
|
26
|
+
- [Design: RadioField](./docs/superpowers/specs/2026-09-25-radio-field-design.md)
|
|
27
|
+
- [Design: Select](./docs/superpowers/specs/2026-09-25-select-design.md)
|
|
28
|
+
|
|
29
|
+
## Quick start
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import {
|
|
33
|
+
Button,
|
|
34
|
+
ThemeProvider,
|
|
35
|
+
useThemeColor,
|
|
36
|
+
} from "@studio-piot/native-ui";
|
|
37
|
+
|
|
38
|
+
const Colors = {
|
|
39
|
+
light: { buttonBackground: "#111", buttonLabel: "#fff" },
|
|
40
|
+
dark: { buttonBackground: "#eee", buttonLabel: "#111" },
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
function SaveButton({ onPress }: { onPress: () => void }) {
|
|
44
|
+
return (
|
|
45
|
+
<Button
|
|
46
|
+
label="Save"
|
|
47
|
+
onPress={onPress}
|
|
48
|
+
backgroundColor={useThemeColor("buttonBackground")}
|
|
49
|
+
labelColor={useThemeColor("buttonLabel")}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function App() {
|
|
55
|
+
return (
|
|
56
|
+
<ThemeProvider colors={Colors}>
|
|
57
|
+
<SaveButton onPress={() => undefined} />
|
|
58
|
+
</ThemeProvider>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Local development
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npm install
|
|
67
|
+
npm run dev
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`npm run dev` rebuilds `dist` as you edit. `prepare` also builds on install, so a `file:` dependency in a consumer app stays usable after `npm install`.
|
|
71
|
+
|
|
72
|
+
When this package lives outside the consumer app root (e.g. a monorepo sibling), configure Metro `watchFolders` so the app picks up source changes; add `nodeModulesPaths` if resolution needs it.
|
|
73
|
+
|
|
74
|
+
## Add a component
|
|
75
|
+
|
|
76
|
+
1. Add `src/components/YourComponent.tsx`.
|
|
77
|
+
2. Export it from `src/components/index.ts` and `src/index.ts`.
|
|
78
|
+
3. Document it under `docs/components/` and link it from this README.
|
|
79
|
+
4. Run `npm run build` before publishing.
|
|
80
|
+
|
|
81
|
+
## Publish
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npm publish
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`prepublishOnly` builds `dist` first. The package is public (`publishConfig.access`).
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
ISC
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type StyleProp, type TextStyle, type ViewStyle } from "react-native";
|
|
2
|
+
import { type ButtonRadius } from "./buttonRadius";
|
|
3
|
+
export type ButtonProps = {
|
|
4
|
+
label: string;
|
|
5
|
+
onPress: () => void;
|
|
6
|
+
backgroundColor: string;
|
|
7
|
+
labelColor: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
variant?: "filled" | "outline";
|
|
11
|
+
radius?: ButtonRadius;
|
|
12
|
+
style?: StyleProp<ViewStyle>;
|
|
13
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
14
|
+
};
|
|
15
|
+
export declare function Button({ label, onPress, backgroundColor, labelColor, disabled, loading, variant, radius, style, labelStyle, }: ButtonProps): import("react").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEtE,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC/B,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACnC,CAAC;AAEF,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,OAAO,EACP,eAAe,EACf,UAAU,EACV,QAAgB,EAChB,OAAe,EACf,OAAkB,EAClB,MAAa,EACb,KAAK,EACL,UAAU,GACX,EAAE,WAAW,+BA6Cb"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Button = Button;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const buttonRadius_1 = require("./buttonRadius");
|
|
7
|
+
function Button({ label, onPress, backgroundColor, labelColor, disabled = false, loading = false, variant = "filled", radius = "xl", style, labelStyle, }) {
|
|
8
|
+
const blocked = disabled || loading;
|
|
9
|
+
const isOutline = variant === "outline";
|
|
10
|
+
const borderRadius = (0, buttonRadius_1.buttonRadiusValue)(radius);
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { accessibilityLabel: label, accessibilityRole: "button", accessibilityState: { disabled: blocked, busy: loading }, activeOpacity: 0.75, disabled: blocked, onPress: onPress, style: [
|
|
12
|
+
styles.shell,
|
|
13
|
+
{ borderRadius },
|
|
14
|
+
isOutline
|
|
15
|
+
? {
|
|
16
|
+
backgroundColor: "transparent",
|
|
17
|
+
borderWidth: 1,
|
|
18
|
+
borderColor: backgroundColor,
|
|
19
|
+
}
|
|
20
|
+
: { backgroundColor },
|
|
21
|
+
blocked && styles.blocked,
|
|
22
|
+
style,
|
|
23
|
+
], children: loading ? ((0, jsx_runtime_1.jsx)(react_native_1.ActivityIndicator, { color: isOutline ? backgroundColor : labelColor, size: "small" })) : ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
|
|
24
|
+
styles.label,
|
|
25
|
+
{ color: isOutline ? backgroundColor : labelColor },
|
|
26
|
+
labelStyle,
|
|
27
|
+
], children: label })) }));
|
|
28
|
+
}
|
|
29
|
+
const styles = react_native_1.StyleSheet.create({
|
|
30
|
+
shell: {
|
|
31
|
+
width: "100%",
|
|
32
|
+
minHeight: 52,
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
justifyContent: "center",
|
|
35
|
+
},
|
|
36
|
+
blocked: {
|
|
37
|
+
opacity: 0.4,
|
|
38
|
+
},
|
|
39
|
+
label: {
|
|
40
|
+
fontSize: 17,
|
|
41
|
+
fontWeight: "600",
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":";;AAwBA,wBAwDC;;AAhFD,+CAQsB;AACtB,iDAAsE;AAetE,SAAgB,MAAM,CAAC,EACrB,KAAK,EACL,OAAO,EACP,eAAe,EACf,UAAU,EACV,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK,EACf,OAAO,GAAG,QAAQ,EAClB,MAAM,GAAG,IAAI,EACb,KAAK,EACL,UAAU,GACE;IACZ,MAAM,OAAO,GAAG,QAAQ,IAAI,OAAO,CAAC;IACpC,MAAM,SAAS,GAAG,OAAO,KAAK,SAAS,CAAC;IACxC,MAAM,YAAY,GAAG,IAAA,gCAAiB,EAAC,MAAM,CAAC,CAAC;IAE/C,OAAO,CACL,uBAAC,+BAAgB,IACf,kBAAkB,EAAE,KAAK,EACzB,iBAAiB,EAAC,QAAQ,EAC1B,kBAAkB,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,EACxD,aAAa,EAAE,IAAI,EACnB,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE;YACL,MAAM,CAAC,KAAK;YACZ,EAAE,YAAY,EAAE;YAChB,SAAS;gBACP,CAAC,CAAC;oBACE,eAAe,EAAE,aAAa;oBAC9B,WAAW,EAAE,CAAC;oBACd,WAAW,EAAE,eAAe;iBAC7B;gBACH,CAAC,CAAC,EAAE,eAAe,EAAE;YACvB,OAAO,IAAI,MAAM,CAAC,OAAO;YACzB,KAAK;SACN,YAEA,OAAO,CAAC,CAAC,CAAC,CACT,uBAAC,gCAAiB,IAChB,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,UAAU,EAC/C,IAAI,EAAC,OAAO,GACZ,CACH,CAAC,CAAC,CAAC,CACF,uBAAC,mBAAI,IACH,KAAK,EAAE;gBACL,MAAM,CAAC,KAAK;gBACZ,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,UAAU,EAAE;gBACnD,UAAU;aACX,YAEA,KAAK,GACD,CACR,GACgB,CACpB,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,KAAK,EAAE;QACL,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,EAAE;QACb,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KACzB;IACD,OAAO,EAAE;QACP,OAAO,EAAE,GAAG;KACb;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;KAClB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buttonRadius.d.ts","sourceRoot":"","sources":["../../../src/components/Button/buttonRadius.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,KAAK,GACL,MAAM,CAAC;AAaX,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAE9D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buttonRadiusValue = buttonRadiusValue;
|
|
4
|
+
const RADIUS = {
|
|
5
|
+
none: 0,
|
|
6
|
+
sm: 2,
|
|
7
|
+
md: 6,
|
|
8
|
+
lg: 8,
|
|
9
|
+
xl: 12,
|
|
10
|
+
"2xl": 16,
|
|
11
|
+
"3xl": 24,
|
|
12
|
+
full: 999,
|
|
13
|
+
};
|
|
14
|
+
function buttonRadiusValue(radius) {
|
|
15
|
+
return RADIUS[radius];
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=buttonRadius.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buttonRadius.js","sourceRoot":"","sources":["../../../src/components/Button/buttonRadius.ts"],"names":[],"mappings":";;AAqBA,8CAEC;AAbD,MAAM,MAAM,GAAiC;IAC3C,IAAI,EAAE,CAAC;IACP,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,EAAE;IACN,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,EAAE;IACT,IAAI,EAAE,GAAG;CACV,CAAC;AAEF,SAAgB,iBAAiB,CAAC,MAAoB;IACpD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buttonRadiusValue = exports.Button = void 0;
|
|
4
|
+
var Button_1 = require("./Button");
|
|
5
|
+
Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return Button_1.Button; } });
|
|
6
|
+
var buttonRadius_1 = require("./buttonRadius");
|
|
7
|
+
Object.defineProperty(exports, "buttonRadiusValue", { enumerable: true, get: function () { return buttonRadius_1.buttonRadiusValue; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Button/index.ts"],"names":[],"mappings":";;;AAAA,mCAAoD;AAA3C,gGAAA,MAAM,OAAA;AACf,+CAAsE;AAA7D,iHAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldText.d.ts","sourceRoot":"","sources":["../../../src/components/Field/FieldText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BAE9C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FieldText = FieldText;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const fieldChrome_1 = require("./fieldChrome");
|
|
6
|
+
function FieldText(props) {
|
|
7
|
+
return (0, jsx_runtime_1.jsx)(fieldChrome_1.FieldChrome, { ...props, multiline: false, minHeight: 48 });
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=FieldText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldText.js","sourceRoot":"","sources":["../../../src/components/Field/FieldText.tsx"],"names":[],"mappings":";;AAGA,8BAEC;;AALD,+CAA4C;AAG5C,SAAgB,SAAS,CAAC,KAAqB;IAC7C,OAAO,uBAAC,yBAAW,OAAK,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,GAAI,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldTextarea.d.ts","sourceRoot":"","sources":["../../../src/components/Field/FieldTextarea.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,wBAAgB,aAAa,CAAC,EAC5B,aAAiB,EACjB,GAAG,KAAK,EACT,EAAE,kBAAkB,+BAWpB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FieldTextarea = FieldTextarea;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const fieldChrome_1 = require("./fieldChrome");
|
|
6
|
+
function FieldTextarea({ numberOfLines = 4, ...props }) {
|
|
7
|
+
const minHeight = Math.max(100, numberOfLines * 24);
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)(fieldChrome_1.FieldChrome, { ...props, multiline: true, numberOfLines: numberOfLines, minHeight: minHeight, textAlignVertical: "top" }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=FieldTextarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldTextarea.js","sourceRoot":"","sources":["../../../src/components/Field/FieldTextarea.tsx"],"names":[],"mappings":";;AAGA,sCAcC;;AAjBD,+CAA4C;AAG5C,SAAgB,aAAa,CAAC,EAC5B,aAAa,GAAG,CAAC,EACjB,GAAG,KAAK,EACW;IACnB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,aAAa,GAAG,EAAE,CAAC,CAAC;IACpD,OAAO,CACL,uBAAC,yBAAW,OACN,KAAK,EACT,SAAS,QACT,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS,EACpB,iBAAiB,EAAC,KAAK,GACvB,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type TextInputProps } from "react-native";
|
|
2
|
+
import type { FieldSharedProps } from "./types";
|
|
3
|
+
export type FieldChromeProps = FieldSharedProps & {
|
|
4
|
+
multiline?: boolean;
|
|
5
|
+
numberOfLines?: number;
|
|
6
|
+
minHeight?: number;
|
|
7
|
+
textAlignVertical?: TextInputProps["textAlignVertical"];
|
|
8
|
+
};
|
|
9
|
+
export declare function FieldChrome({ value, onChangeText, borderColor: borderColorProp, focusedBorderColor: focusedBorderColorProp, errorColor: errorColorProp, textColor: textColorProp, labelColor: labelColorProp, placeholderColor: placeholderColorProp, backgroundColor: backgroundColorProp, label, description, error, placeholder, radius, editable, clearIcon, onClear, style, inputStyle, multiline, numberOfLines, minHeight, textAlignVertical, secureTextEntry, keyboardType, autoCapitalize, autoComplete, textContentType, onFocus, onBlur, ref, }: FieldChromeProps): import("react").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=fieldChrome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldChrome.d.ts","sourceRoot":"","sources":["../../../src/components/Field/fieldChrome.tsx"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AAOtB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGhD,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,GAAG;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAAC;CACzD,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,YAAY,EACZ,WAAW,EAAE,eAAe,EAC5B,kBAAkB,EAAE,sBAAsB,EAC1C,UAAU,EAAE,cAAc,EAC1B,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,cAAc,EAC1B,gBAAgB,EAAE,oBAAoB,EACtC,eAAe,EAAE,mBAAmB,EACpC,KAAK,EACL,WAAW,EACX,KAAK,EACL,WAAW,EACX,MAAa,EACb,QAAe,EACf,SAAS,EACT,OAAO,EACP,KAAK,EACL,UAAU,EACV,SAAiB,EACjB,aAAa,EACb,SAAc,EACd,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,eAAe,EACf,OAAO,EACP,MAAM,EACN,GAAG,GACJ,EAAE,gBAAgB,+BAyHlB"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FieldChrome = FieldChrome;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_native_1 = require("react-native");
|
|
7
|
+
const buttonRadius_1 = require("../Button/buttonRadius");
|
|
8
|
+
const fieldThemeRoles_1 = require("./fieldThemeRoles");
|
|
9
|
+
const resolveFieldBorder_1 = require("./resolveFieldBorder");
|
|
10
|
+
const useResolvedFieldColor_1 = require("./useResolvedFieldColor");
|
|
11
|
+
function FieldChrome({ value, onChangeText, borderColor: borderColorProp, focusedBorderColor: focusedBorderColorProp, errorColor: errorColorProp, textColor: textColorProp, labelColor: labelColorProp, placeholderColor: placeholderColorProp, backgroundColor: backgroundColorProp, label, description, error, placeholder, radius = "xl", editable = true, clearIcon, onClear, style, inputStyle, multiline = false, numberOfLines, minHeight = 48, textAlignVertical, secureTextEntry, keyboardType, autoCapitalize, autoComplete, textContentType, onFocus, onBlur, ref, }) {
|
|
12
|
+
const borderColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(borderColorProp, fieldThemeRoles_1.FIELD_THEME_ROLES.borderColor);
|
|
13
|
+
const focusedBorderColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(focusedBorderColorProp, fieldThemeRoles_1.FIELD_THEME_ROLES.focusedBorderColor);
|
|
14
|
+
const errorColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(errorColorProp, fieldThemeRoles_1.FIELD_THEME_ROLES.errorColor);
|
|
15
|
+
const textColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(textColorProp, fieldThemeRoles_1.FIELD_THEME_ROLES.textColor);
|
|
16
|
+
const labelColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(labelColorProp, fieldThemeRoles_1.FIELD_THEME_ROLES.labelColor);
|
|
17
|
+
const placeholderColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(placeholderColorProp, fieldThemeRoles_1.FIELD_THEME_ROLES.placeholderColor);
|
|
18
|
+
const backgroundColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(backgroundColorProp, fieldThemeRoles_1.FIELD_THEME_ROLES.backgroundColor);
|
|
19
|
+
const descriptionColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(undefined, fieldThemeRoles_1.FIELD_THEME_ROLES.descriptionColor);
|
|
20
|
+
const [isFocused, setIsFocused] = (0, react_1.useState)(false);
|
|
21
|
+
const hasError = Boolean(error);
|
|
22
|
+
const showClear = (0, resolveFieldBorder_1.shouldShowFieldClear)(value, clearIcon != null, editable);
|
|
23
|
+
const border = (0, resolveFieldBorder_1.resolveFieldBorder)({
|
|
24
|
+
isFocused,
|
|
25
|
+
hasError,
|
|
26
|
+
borderColor,
|
|
27
|
+
focusedBorderColor,
|
|
28
|
+
errorColor,
|
|
29
|
+
});
|
|
30
|
+
const borderRadius = (0, buttonRadius_1.buttonRadiusValue)(radius);
|
|
31
|
+
const handleClear = () => {
|
|
32
|
+
if (onClear)
|
|
33
|
+
onClear();
|
|
34
|
+
else
|
|
35
|
+
onChangeText("");
|
|
36
|
+
};
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [styles.column, !editable && styles.blocked, style], children: [label ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.label, { color: labelColor }], children: label })) : null, (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.inputWrapper, children: [(0, jsx_runtime_1.jsx)(react_native_1.TextInput, { ref: ref, value: value, onChangeText: onChangeText, placeholder: placeholder, placeholderTextColor: placeholderColor, editable: editable, multiline: multiline, numberOfLines: numberOfLines, textAlignVertical: textAlignVertical, secureTextEntry: secureTextEntry, keyboardType: keyboardType, autoCapitalize: autoCapitalize, autoComplete: autoComplete, textContentType: textContentType, accessibilityLabel: label, accessibilityState: { disabled: !editable }, onFocus: (e) => {
|
|
38
|
+
setIsFocused(true);
|
|
39
|
+
onFocus?.(e);
|
|
40
|
+
}, onBlur: (e) => {
|
|
41
|
+
setIsFocused(false);
|
|
42
|
+
onBlur?.(e);
|
|
43
|
+
}, style: [
|
|
44
|
+
styles.input,
|
|
45
|
+
{
|
|
46
|
+
minHeight,
|
|
47
|
+
color: textColor,
|
|
48
|
+
backgroundColor,
|
|
49
|
+
borderRadius,
|
|
50
|
+
borderColor: border.borderColor,
|
|
51
|
+
borderWidth: border.borderWidth,
|
|
52
|
+
paddingHorizontal: border.paddingHorizontal,
|
|
53
|
+
paddingRight: showClear
|
|
54
|
+
? border.paddingHorizontal + 28
|
|
55
|
+
: border.paddingHorizontal,
|
|
56
|
+
},
|
|
57
|
+
multiline && styles.multiline,
|
|
58
|
+
inputStyle,
|
|
59
|
+
] }), showClear ? ((0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { accessibilityLabel: "Clear", accessibilityRole: "button", hitSlop: { top: 10, bottom: 10, left: 10, right: 10 }, onPress: handleClear, style: styles.clearButton, children: clearIcon })) : null] }), error ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.helper, { color: errorColor }], children: error })) : description ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.helper, { color: descriptionColor }], children: description })) : null] }));
|
|
60
|
+
}
|
|
61
|
+
const styles = react_native_1.StyleSheet.create({
|
|
62
|
+
column: {
|
|
63
|
+
width: "100%",
|
|
64
|
+
gap: 6,
|
|
65
|
+
},
|
|
66
|
+
blocked: {
|
|
67
|
+
opacity: 0.4,
|
|
68
|
+
},
|
|
69
|
+
label: {
|
|
70
|
+
fontSize: 13,
|
|
71
|
+
fontWeight: "600",
|
|
72
|
+
},
|
|
73
|
+
inputWrapper: {
|
|
74
|
+
position: "relative",
|
|
75
|
+
width: "100%",
|
|
76
|
+
justifyContent: "center",
|
|
77
|
+
},
|
|
78
|
+
input: {
|
|
79
|
+
width: "100%",
|
|
80
|
+
paddingVertical: 12,
|
|
81
|
+
fontSize: 17,
|
|
82
|
+
},
|
|
83
|
+
multiline: {
|
|
84
|
+
paddingTop: 16,
|
|
85
|
+
paddingBottom: 16,
|
|
86
|
+
},
|
|
87
|
+
clearButton: {
|
|
88
|
+
position: "absolute",
|
|
89
|
+
right: 8,
|
|
90
|
+
top: 0,
|
|
91
|
+
bottom: 0,
|
|
92
|
+
justifyContent: "center",
|
|
93
|
+
alignItems: "center",
|
|
94
|
+
zIndex: 2,
|
|
95
|
+
},
|
|
96
|
+
helper: {
|
|
97
|
+
fontSize: 13,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
//# sourceMappingURL=fieldChrome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldChrome.js","sourceRoot":"","sources":["../../../src/components/Field/fieldChrome.tsx"],"names":[],"mappings":";;AAyBA,kCAyJC;;AAlLD,iCAAiC;AACjC,+CAOsB;AACtB,yDAA2D;AAC3D,uDAAsD;AACtD,6DAG8B;AAE9B,mEAAgE;AAShE,SAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,YAAY,EACZ,WAAW,EAAE,eAAe,EAC5B,kBAAkB,EAAE,sBAAsB,EAC1C,UAAU,EAAE,cAAc,EAC1B,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,cAAc,EAC1B,gBAAgB,EAAE,oBAAoB,EACtC,eAAe,EAAE,mBAAmB,EACpC,KAAK,EACL,WAAW,EACX,KAAK,EACL,WAAW,EACX,MAAM,GAAG,IAAI,EACb,QAAQ,GAAG,IAAI,EACf,SAAS,EACT,OAAO,EACP,KAAK,EACL,UAAU,EACV,SAAS,GAAG,KAAK,EACjB,aAAa,EACb,SAAS,GAAG,EAAE,EACd,iBAAiB,EACjB,eAAe,EACf,YAAY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AAG,EAAE,CAAC;KACP;IACD,OAAO,EAAE;QACP,OAAO,EAAE,GAAG;KACb;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;KAClB;IACD,YAAY,EAAE;QACZ,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,MAAM;QACb,cAAc,EAAE,QAAQ;KACzB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,EAAE;QACnB,QAAQ,EAAE,EAAE;KACb;IACD,SAAS,EAAE;QACT,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,EAAE;KAClB;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,CAAC;QACN,MAAM,EAAE,CAAC;QACT,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;QACpB,MAAM,EAAE,CAAC;KACV;IACD,MAAM,EAAE;QACN,QAAQ,EAAE,EAAE;KACb;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Theme roles Field uses when colour props are omitted. */
|
|
2
|
+
export declare const FIELD_THEME_ROLES: {
|
|
3
|
+
readonly borderColor: "fieldBorder";
|
|
4
|
+
readonly focusedBorderColor: "fieldFocusedBorder";
|
|
5
|
+
readonly errorColor: "fieldError";
|
|
6
|
+
readonly textColor: "fieldText";
|
|
7
|
+
readonly labelColor: "fieldLabel";
|
|
8
|
+
readonly placeholderColor: "fieldPlaceholder";
|
|
9
|
+
readonly backgroundColor: "fieldBackground";
|
|
10
|
+
readonly descriptionColor: "fieldDescription";
|
|
11
|
+
};
|
|
12
|
+
export type FieldThemeColorProp = keyof typeof FIELD_THEME_ROLES;
|
|
13
|
+
//# sourceMappingURL=fieldThemeRoles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldThemeRoles.d.ts","sourceRoot":"","sources":["../../../src/components/Field/fieldThemeRoles.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,eAAO,MAAM,iBAAiB;;;;;;;;;CASpB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FIELD_THEME_ROLES = void 0;
|
|
4
|
+
/** Theme roles Field uses when colour props are omitted. */
|
|
5
|
+
exports.FIELD_THEME_ROLES = {
|
|
6
|
+
borderColor: "fieldBorder",
|
|
7
|
+
focusedBorderColor: "fieldFocusedBorder",
|
|
8
|
+
errorColor: "fieldError",
|
|
9
|
+
textColor: "fieldText",
|
|
10
|
+
labelColor: "fieldLabel",
|
|
11
|
+
placeholderColor: "fieldPlaceholder",
|
|
12
|
+
backgroundColor: "fieldBackground",
|
|
13
|
+
descriptionColor: "fieldDescription",
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=fieldThemeRoles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldThemeRoles.js","sourceRoot":"","sources":["../../../src/components/Field/fieldThemeRoles.ts"],"names":[],"mappings":";;;AAAA,4DAA4D;AAC/C,QAAA,iBAAiB,GAAG;IAC/B,WAAW,EAAE,aAAa;IAC1B,kBAAkB,EAAE,oBAAoB;IACxC,UAAU,EAAE,YAAY;IACxB,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;IACxB,gBAAgB,EAAE,kBAAkB;IACpC,eAAe,EAAE,iBAAiB;IAClC,gBAAgB,EAAE,kBAAkB;CAC5B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { FieldText } from "./FieldText";
|
|
2
|
+
export { FieldTextarea } from "./FieldTextarea";
|
|
3
|
+
export { FIELD_THEME_ROLES } from "./fieldThemeRoles";
|
|
4
|
+
export type { FieldThemeColorProp } from "./fieldThemeRoles";
|
|
5
|
+
export type { FieldSharedProps, FieldTextProps, FieldTextareaProps } from "./types";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Field/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FIELD_THEME_ROLES = exports.FieldTextarea = exports.FieldText = void 0;
|
|
4
|
+
var FieldText_1 = require("./FieldText");
|
|
5
|
+
Object.defineProperty(exports, "FieldText", { enumerable: true, get: function () { return FieldText_1.FieldText; } });
|
|
6
|
+
var FieldTextarea_1 = require("./FieldTextarea");
|
|
7
|
+
Object.defineProperty(exports, "FieldTextarea", { enumerable: true, get: function () { return FieldTextarea_1.FieldTextarea; } });
|
|
8
|
+
var fieldThemeRoles_1 = require("./fieldThemeRoles");
|
|
9
|
+
Object.defineProperty(exports, "FIELD_THEME_ROLES", { enumerable: true, get: function () { return fieldThemeRoles_1.FIELD_THEME_ROLES; } });
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Field/index.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,qDAAsD;AAA7C,oHAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type ResolveFieldBorderInput = {
|
|
2
|
+
isFocused: boolean;
|
|
3
|
+
hasError: boolean;
|
|
4
|
+
borderColor: string;
|
|
5
|
+
focusedBorderColor: string;
|
|
6
|
+
errorColor: string;
|
|
7
|
+
restingPaddingHorizontal?: number;
|
|
8
|
+
};
|
|
9
|
+
export type ResolveFieldBorderResult = {
|
|
10
|
+
borderColor: string;
|
|
11
|
+
borderWidth: number;
|
|
12
|
+
paddingHorizontal: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function resolveFieldBorder(input: ResolveFieldBorderInput): ResolveFieldBorderResult;
|
|
15
|
+
export declare function shouldShowFieldClear(value: string, hasClearIcon: boolean, editable?: boolean): boolean;
|
|
16
|
+
//# sourceMappingURL=resolveFieldBorder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveFieldBorder.d.ts","sourceRoot":"","sources":["../../../src/components/Field/resolveFieldBorder.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,uBAAuB,GAC7B,wBAAwB,CAY1B;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,OAAO,EACrB,QAAQ,UAAO,GACd,OAAO,CAET"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveFieldBorder = resolveFieldBorder;
|
|
4
|
+
exports.shouldShowFieldClear = shouldShowFieldClear;
|
|
5
|
+
const RESTING_PADDING_HORIZONTAL = 14;
|
|
6
|
+
function resolveFieldBorder(input) {
|
|
7
|
+
const resting = input.restingPaddingHorizontal ?? RESTING_PADDING_HORIZONTAL;
|
|
8
|
+
const borderWidth = input.isFocused ? 2 : 1;
|
|
9
|
+
const borderColor = input.hasError
|
|
10
|
+
? input.errorColor
|
|
11
|
+
: input.isFocused
|
|
12
|
+
? input.focusedBorderColor
|
|
13
|
+
: input.borderColor;
|
|
14
|
+
const paddingHorizontal = input.isFocused ? resting - 1 : resting;
|
|
15
|
+
return { borderColor, borderWidth, paddingHorizontal };
|
|
16
|
+
}
|
|
17
|
+
function shouldShowFieldClear(value, hasClearIcon, editable = true) {
|
|
18
|
+
return value.length > 0 && hasClearIcon && editable;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=resolveFieldBorder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveFieldBorder.js","sourceRoot":"","sources":["../../../src/components/Field/resolveFieldBorder.ts"],"names":[],"mappings":";;AAiBA,gDAcC;AAED,oDAMC;AAvCD,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAiBtC,SAAgB,kBAAkB,CAChC,KAA8B;IAE9B,MAAM,OAAO,GACX,KAAK,CAAC,wBAAwB,IAAI,0BAA0B,CAAC;IAC/D,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,MAAM,WAAW,GAAG,KAAK,CAAC,QAAQ;QAChC,CAAC,CAAC,KAAK,CAAC,UAAU;QAClB,CAAC,CAAC,KAAK,CAAC,SAAS;YACf,CAAC,CAAC,KAAK,CAAC,kBAAkB;YAC1B,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC;IACxB,MAAM,iBAAiB,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAElE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;AACzD,CAAC;AAED,SAAgB,oBAAoB,CAClC,KAAa,EACb,YAAqB,EACrB,QAAQ,GAAG,IAAI;IAEf,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,YAAY,IAAI,QAAQ,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ThemeContextValue } from "../../theme/types";
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a Field colour: explicit prop wins; otherwise read the theme role.
|
|
4
|
+
* Pure helper so it can be unit-tested without rendering.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveFieldColor(prop: string | undefined, role: string, ctx: ThemeContextValue | null, scheme: "light" | "dark"): string;
|
|
7
|
+
//# sourceMappingURL=resolveFieldColor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveFieldColor.d.ts","sourceRoot":"","sources":["../../../src/components/Field/resolveFieldColor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,iBAAiB,GAAG,IAAI,EAC7B,MAAM,EAAE,OAAO,GAAG,MAAM,GACvB,MAAM,CAcR"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveFieldColor = resolveFieldColor;
|
|
4
|
+
/**
|
|
5
|
+
* Resolve a Field colour: explicit prop wins; otherwise read the theme role.
|
|
6
|
+
* Pure helper so it can be unit-tested without rendering.
|
|
7
|
+
*/
|
|
8
|
+
function resolveFieldColor(prop, role, ctx, scheme) {
|
|
9
|
+
if (prop != null) {
|
|
10
|
+
return prop;
|
|
11
|
+
}
|
|
12
|
+
if (!ctx) {
|
|
13
|
+
throw new Error(`Field colour "${role}" was not passed and Field requires ThemeProvider to resolve defaults`);
|
|
14
|
+
}
|
|
15
|
+
const value = ctx.colors[scheme][role];
|
|
16
|
+
if (value == null) {
|
|
17
|
+
throw new Error(`Unknown theme colour "${role}" for scheme "${scheme}"`);
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=resolveFieldColor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveFieldColor.js","sourceRoot":"","sources":["../../../src/components/Field/resolveFieldColor.ts"],"names":[],"mappings":";;AAMA,8CAmBC;AAvBD;;;GAGG;AACH,SAAgB,iBAAiB,CAC/B,IAAwB,EACxB,IAAY,EACZ,GAA6B,EAC7B,MAAwB;IAExB,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,iBAAiB,IAAI,uEAAuE,CAC7F,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,iBAAiB,MAAM,GAAG,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ReactNode, Ref } from "react";
|
|
2
|
+
import type { StyleProp, TextInputProps, TextStyle, ViewStyle } from "react-native";
|
|
3
|
+
import type { ButtonRadius } from "../Button/buttonRadius";
|
|
4
|
+
export type FieldSharedProps = {
|
|
5
|
+
value: string;
|
|
6
|
+
onChangeText: (text: string) => void;
|
|
7
|
+
/** Defaults to theme role `fieldBorder`. */
|
|
8
|
+
borderColor?: string;
|
|
9
|
+
/** Defaults to theme role `fieldFocusedBorder`. */
|
|
10
|
+
focusedBorderColor?: string;
|
|
11
|
+
/** Defaults to theme role `fieldError`. */
|
|
12
|
+
errorColor?: string;
|
|
13
|
+
/** Defaults to theme role `fieldText`. */
|
|
14
|
+
textColor?: string;
|
|
15
|
+
/** Defaults to theme role `fieldLabel`. */
|
|
16
|
+
labelColor?: string;
|
|
17
|
+
/** Defaults to theme role `fieldPlaceholder`. */
|
|
18
|
+
placeholderColor?: string;
|
|
19
|
+
/** Defaults to theme role `fieldBackground`. */
|
|
20
|
+
backgroundColor?: string;
|
|
21
|
+
label?: string;
|
|
22
|
+
/** Helper text under the input. Hidden while `error` is set. */
|
|
23
|
+
description?: string;
|
|
24
|
+
error?: string;
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
radius?: ButtonRadius;
|
|
27
|
+
editable?: boolean;
|
|
28
|
+
clearIcon?: ReactNode;
|
|
29
|
+
onClear?: () => void;
|
|
30
|
+
style?: StyleProp<ViewStyle>;
|
|
31
|
+
inputStyle?: StyleProp<TextStyle>;
|
|
32
|
+
/** Forwarded to TextInput; do not invert. */
|
|
33
|
+
secureTextEntry?: boolean;
|
|
34
|
+
keyboardType?: TextInputProps["keyboardType"];
|
|
35
|
+
autoCapitalize?: TextInputProps["autoCapitalize"];
|
|
36
|
+
autoComplete?: TextInputProps["autoComplete"];
|
|
37
|
+
textContentType?: TextInputProps["textContentType"];
|
|
38
|
+
onFocus?: TextInputProps["onFocus"];
|
|
39
|
+
onBlur?: TextInputProps["onBlur"];
|
|
40
|
+
ref?: Ref<import("react-native").TextInput>;
|
|
41
|
+
};
|
|
42
|
+
export type FieldTextProps = FieldSharedProps;
|
|
43
|
+
export type FieldTextareaProps = FieldSharedProps & {
|
|
44
|
+
numberOfLines?: number;
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Field/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gDAAgD;IAChD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI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