@studio-piot/native-ui 0.16.0 → 0.20.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 +13 -7
- package/dist/components/Choice/Choice.d.ts +6 -4
- package/dist/components/Choice/Choice.d.ts.map +1 -1
- package/dist/components/Choice/Choice.js +11 -5
- package/dist/components/Choice/Choice.js.map +1 -1
- package/dist/components/Choice/choiceLayout.d.ts +16 -0
- package/dist/components/Choice/choiceLayout.d.ts.map +1 -1
- package/dist/components/Choice/choiceLayout.js +20 -1
- package/dist/components/Choice/choiceLayout.js.map +1 -1
- package/dist/components/Choice/choiceThemeRoles.d.ts +1 -0
- package/dist/components/Choice/choiceThemeRoles.d.ts.map +1 -1
- package/dist/components/Choice/choiceThemeRoles.js +1 -0
- package/dist/components/Choice/choiceThemeRoles.js.map +1 -1
- package/dist/components/Choice/types.d.ts +7 -0
- package/dist/components/Choice/types.d.ts.map +1 -1
- package/dist/components/DateTime/DateTimePresenter.android.d.ts +4 -0
- package/dist/components/DateTime/DateTimePresenter.android.d.ts.map +1 -0
- package/dist/components/DateTime/DateTimePresenter.android.js +47 -0
- package/dist/components/DateTime/DateTimePresenter.android.js.map +1 -0
- package/dist/components/DateTime/DateTimePresenter.d.ts +4 -0
- package/dist/components/DateTime/DateTimePresenter.d.ts.map +1 -0
- package/dist/components/DateTime/DateTimePresenter.ios.d.ts +9 -0
- package/dist/components/DateTime/DateTimePresenter.ios.d.ts.map +1 -0
- package/dist/components/DateTime/DateTimePresenter.ios.js +69 -0
- package/dist/components/DateTime/DateTimePresenter.ios.js.map +1 -0
- package/dist/components/DateTime/DateTimePresenter.js +8 -0
- package/dist/components/DateTime/DateTimePresenter.js.map +1 -0
- package/dist/components/DateTime/FieldDateTime.d.ts +8 -0
- package/dist/components/DateTime/FieldDateTime.d.ts.map +1 -0
- package/dist/components/DateTime/FieldDateTime.js +90 -0
- package/dist/components/DateTime/FieldDateTime.js.map +1 -0
- package/dist/components/DateTime/dateTimeThemeRoles.d.ts +13 -0
- package/dist/components/DateTime/dateTimeThemeRoles.d.ts.map +1 -0
- package/dist/components/DateTime/dateTimeThemeRoles.js +15 -0
- package/dist/components/DateTime/dateTimeThemeRoles.js.map +1 -0
- package/dist/components/DateTime/dateTimeValue.d.ts +11 -0
- package/dist/components/DateTime/dateTimeValue.d.ts.map +1 -0
- package/dist/components/DateTime/dateTimeValue.js +40 -0
- package/dist/components/DateTime/dateTimeValue.js.map +1 -0
- package/dist/components/DateTime/index.d.ts +5 -0
- package/dist/components/DateTime/index.d.ts.map +1 -0
- package/dist/components/DateTime/index.js +10 -0
- package/dist/components/DateTime/index.js.map +1 -0
- package/dist/components/DateTime/types.d.ts +57 -0
- package/dist/components/DateTime/types.d.ts.map +1 -0
- package/dist/components/DateTime/types.js +3 -0
- package/dist/components/DateTime/types.js.map +1 -0
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.js +2 -9
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +8 -0
- package/dist/components/Tabs/Tabs.d.ts.map +1 -0
- package/dist/components/Tabs/Tabs.js +124 -0
- package/dist/components/Tabs/Tabs.js.map +1 -0
- package/dist/components/Tabs/index.d.ts +4 -0
- package/dist/components/Tabs/index.d.ts.map +1 -0
- package/dist/components/Tabs/index.js +8 -0
- package/dist/components/Tabs/index.js.map +1 -0
- package/dist/components/Tabs/tabsLayout.d.ts +13 -0
- package/dist/components/Tabs/tabsLayout.d.ts.map +1 -0
- package/dist/components/Tabs/tabsLayout.js +20 -0
- package/dist/components/Tabs/tabsLayout.js.map +1 -0
- package/dist/components/Tabs/tabsThemeRoles.d.ts +8 -0
- package/dist/components/Tabs/tabsThemeRoles.d.ts.map +1 -0
- package/dist/components/Tabs/tabsThemeRoles.js +10 -0
- package/dist/components/Tabs/tabsThemeRoles.js.map +1 -0
- package/dist/components/Tabs/types.d.ts +30 -0
- package/dist/components/Tabs/types.d.ts.map +1 -0
- package/dist/components/Tabs/types.js +3 -0
- package/dist/components/Tabs/types.js.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +5 -2
- package/dist/components/index.js.map +1 -1
- package/dist/date-time.d.ts +6 -0
- package/dist/date-time.d.ts.map +1 -0
- package/dist/date-time.js +22 -0
- package/dist/date-time.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/layout/SheetContainer.d.ts +6 -0
- package/dist/layout/SheetContainer.d.ts.map +1 -0
- package/dist/layout/SheetContainer.js +14 -0
- package/dist/layout/SheetContainer.js.map +1 -0
- package/docs/components/choice.md +26 -3
- package/docs/components/field-date-time.md +89 -0
- package/docs/components/tabs.md +85 -0
- package/package.json +16 -2
- package/src/components/Choice/Choice.tsx +17 -6
- package/src/components/Choice/choiceLayout.test.ts +36 -1
- package/src/components/Choice/choiceLayout.ts +25 -0
- package/src/components/Choice/choiceThemeRoles.test.ts +1 -0
- package/src/components/Choice/choiceThemeRoles.ts +1 -0
- package/src/components/Choice/types.ts +7 -0
- package/src/components/DateTime/DateTimePresenter.android.tsx +76 -0
- package/src/components/DateTime/DateTimePresenter.ios.tsx +122 -0
- package/src/components/DateTime/DateTimePresenter.tsx +6 -0
- package/src/components/DateTime/FieldDateTime.tsx +164 -0
- package/src/components/DateTime/dateTimeThemeRoles.test.ts +18 -0
- package/src/components/DateTime/dateTimeThemeRoles.ts +13 -0
- package/src/components/DateTime/dateTimeValue.test.ts +49 -0
- package/src/components/DateTime/dateTimeValue.ts +36 -0
- package/src/components/DateTime/index.ts +4 -0
- package/src/components/DateTime/types.ts +58 -0
- package/src/components/Select/Select.tsx +1 -9
- package/src/components/Tabs/Tabs.tsx +148 -0
- package/src/components/Tabs/index.ts +3 -0
- package/src/components/Tabs/tabsLayout.test.ts +36 -0
- package/src/components/Tabs/tabsLayout.ts +23 -0
- package/src/components/Tabs/tabsThemeRoles.test.ts +14 -0
- package/src/components/Tabs/tabsThemeRoles.ts +8 -0
- package/src/components/Tabs/types.ts +31 -0
- package/src/components/index.ts +7 -0
- package/src/date-time.ts +5 -0
- package/src/index.ts +8 -1
- package/src/layout/SheetContainer.tsx +11 -0
package/README.md
CHANGED
|
@@ -7,10 +7,10 @@ The package is the native counterpart of `@studio-piot/ui`. Apps own their palet
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
pnpm add @studio-piot/native-ui
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
`Select` peers `@gorhom/bottom-sheet`, `react-native-reanimated`, `react-native-gesture-handler`, and `react-native-screens` (iOS `FullWindowOverlay` so the sheet appears above React Navigation modals). `SegmentedControl` uses that same `react-native-reanimated` peer to slide the selection fill. `Slider` peers `@react-native-community/slider`. `ErrorBanner` peers `react-native-svg` for the megaphone and row arrow. `HeaderIcon` and `HeaderCapsule` take an icon render function, so they add no peer; pass `expo-symbols` `SymbolView` or any icon component.
|
|
13
|
+
`Select` peers `@gorhom/bottom-sheet`, `react-native-reanimated`, `react-native-gesture-handler`, and `react-native-screens` (iOS `FullWindowOverlay` so the sheet appears above React Navigation modals). `SegmentedControl` uses that same `react-native-reanimated` peer to slide the selection fill. `Slider` peers `@react-native-community/slider`. `ErrorBanner` peers `react-native-svg` for the megaphone and row arrow. `FieldDateTime` (from `@studio-piot/native-ui/date-time`) needs `@expo/ui`, an optional peer only that entry uses. `HeaderIcon` and `HeaderCapsule` take an icon render function, so they add no peer; pass `expo-symbols` `SymbolView` or any icon component.
|
|
14
14
|
|
|
15
15
|
## Theme roles
|
|
16
16
|
|
|
@@ -30,7 +30,9 @@ Each component doc lists its roles.
|
|
|
30
30
|
- [Theme provider and Button usage](./docs/components/button.md)
|
|
31
31
|
- [LinkBlocks usage](./docs/components/link-blocks.md)
|
|
32
32
|
- [Field usage](./docs/components/field.md)
|
|
33
|
+
- [FieldDateTime usage](./docs/components/field-date-time.md)
|
|
33
34
|
- [Choice usage](./docs/components/choice.md)
|
|
35
|
+
- [Tabs usage](./docs/components/tabs.md)
|
|
34
36
|
- [Form usage](./docs/components/form.md)
|
|
35
37
|
- [HeaderWash usage](./docs/components/header-wash.md)
|
|
36
38
|
- [FormSheet usage](./docs/components/form-sheet.md)
|
|
@@ -71,11 +73,13 @@ export function App() {
|
|
|
71
73
|
## Local development
|
|
72
74
|
|
|
73
75
|
```bash
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
pnpm install
|
|
77
|
+
pnpm dev
|
|
76
78
|
```
|
|
77
79
|
|
|
78
|
-
|
|
80
|
+
This repo uses **pnpm** (`pnpm-lock.yaml`); don't run `npm install` here.
|
|
81
|
+
|
|
82
|
+
`pnpm dev` rebuilds `dist` as you edit. `prepare` also builds on install, so a linked or `file:` dependency in a consumer app stays usable after installing.
|
|
79
83
|
|
|
80
84
|
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.
|
|
81
85
|
|
|
@@ -84,14 +88,16 @@ When this package lives outside the consumer app root (e.g. a monorepo sibling),
|
|
|
84
88
|
1. Add `src/components/YourComponent.tsx`.
|
|
85
89
|
2. Export it from `src/components/index.ts` and `src/index.ts`.
|
|
86
90
|
3. Document it under `docs/components/` and link it from this README.
|
|
87
|
-
4. Run `
|
|
91
|
+
4. Run `pnpm build` and `pnpm test` before publishing.
|
|
88
92
|
|
|
89
93
|
## Publish
|
|
90
94
|
|
|
91
95
|
```bash
|
|
92
|
-
|
|
96
|
+
pnpm publish
|
|
93
97
|
```
|
|
94
98
|
|
|
99
|
+
`pnpm publish` checks you're on a clean `main`; publish from there.
|
|
100
|
+
|
|
95
101
|
`prepublishOnly` builds `dist` first. The package is public (`publishConfig.access`).
|
|
96
102
|
|
|
97
103
|
## License
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { ChoiceProps } from "./types";
|
|
2
2
|
/**
|
|
3
|
-
* One option in a list
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* One option in a list: an icon, a title and an optional description, in a
|
|
4
|
+
* filled row. Tapping it acts straight away (open the next screen), or,
|
|
5
|
+
* with `selected`, selects it among other choices (e.g. candidate routes,
|
|
6
|
+
* each with a drawing in the icon slot). For a form value, use RadioField
|
|
7
|
+
* or Select.
|
|
6
8
|
*/
|
|
7
|
-
export declare function Choice({ title, description, icon, onPress, disabled, iconSize, radius, backgroundColor: backgroundColorProp, titleColor: titleColorProp, descriptionColor: descriptionColorProp, iconColor: iconColorProp, style, }: ChoiceProps): import("react").JSX.Element;
|
|
9
|
+
export declare function Choice({ title, description, icon, onPress, selected, disabled, iconSize, radius, backgroundColor: backgroundColorProp, titleColor: titleColorProp, descriptionColor: descriptionColorProp, iconColor: iconColorProp, selectedColor: selectedColorProp, style, }: ChoiceProps): import("react").JSX.Element;
|
|
8
10
|
//# sourceMappingURL=Choice.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Choice.d.ts","sourceRoot":"","sources":["../../../src/components/Choice/Choice.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C
|
|
1
|
+
{"version":3,"file":"Choice.d.ts","sourceRoot":"","sources":["../../../src/components/Choice/Choice.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,WAAW,EACX,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,QAAgB,EAChB,QAA2B,EAC3B,MAAa,EACb,eAAe,EAAE,mBAAmB,EACpC,UAAU,EAAE,cAAc,EAC1B,gBAAgB,EAAE,oBAAoB,EACtC,SAAS,EAAE,aAAa,EACxB,aAAa,EAAE,iBAAiB,EAChC,KAAK,GACN,EAAE,WAAW,+BA+Db"}
|
|
@@ -9,23 +9,29 @@ const useResolvedFieldColor_1 = require("../Field/useResolvedFieldColor");
|
|
|
9
9
|
const choiceLayout_1 = require("./choiceLayout");
|
|
10
10
|
const choiceThemeRoles_1 = require("./choiceThemeRoles");
|
|
11
11
|
/**
|
|
12
|
-
* One option in a list
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* One option in a list: an icon, a title and an optional description, in a
|
|
13
|
+
* filled row. Tapping it acts straight away (open the next screen), or,
|
|
14
|
+
* with `selected`, selects it among other choices (e.g. candidate routes,
|
|
15
|
+
* each with a drawing in the icon slot). For a form value, use RadioField
|
|
16
|
+
* or Select.
|
|
15
17
|
*/
|
|
16
|
-
function Choice({ title, description, icon, onPress, disabled = false, iconSize = choiceLayout_1.CHOICE_ICON_SIZE, radius = "xl", backgroundColor: backgroundColorProp, titleColor: titleColorProp, descriptionColor: descriptionColorProp, iconColor: iconColorProp, style, }) {
|
|
18
|
+
function Choice({ title, description, icon, onPress, selected, disabled = false, iconSize = choiceLayout_1.CHOICE_ICON_SIZE, radius = "xl", backgroundColor: backgroundColorProp, titleColor: titleColorProp, descriptionColor: descriptionColorProp, iconColor: iconColorProp, selectedColor: selectedColorProp, style, }) {
|
|
17
19
|
const backgroundColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(backgroundColorProp, choiceThemeRoles_1.CHOICE_THEME_ROLES.backgroundColor);
|
|
18
20
|
const titleColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(titleColorProp, choiceThemeRoles_1.CHOICE_THEME_ROLES.titleColor);
|
|
19
21
|
const descriptionColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(descriptionColorProp, choiceThemeRoles_1.CHOICE_THEME_ROLES.descriptionColor);
|
|
20
22
|
const iconColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(iconColorProp, choiceThemeRoles_1.CHOICE_THEME_ROLES.iconColor);
|
|
23
|
+
const selectedColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(selectedColorProp, choiceThemeRoles_1.CHOICE_THEME_ROLES.selectedColor);
|
|
21
24
|
const slot = (0, choiceLayout_1.choiceIconSlot)(iconSize);
|
|
25
|
+
const selection = (0, choiceLayout_1.choiceSelection)(selected);
|
|
22
26
|
return (
|
|
23
27
|
// No explicit label: the row groups its text, so VoiceOver reads the
|
|
24
28
|
// title and description together ("Running, Outdoors, with GPS, button").
|
|
25
|
-
(0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { accessibilityRole:
|
|
29
|
+
(0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { accessibilityRole: selection.role, accessibilityState: { ...selection.state, disabled }, disabled: disabled, onPress: onPress, style: ({ pressed }) => [
|
|
26
30
|
styles.row,
|
|
27
31
|
{
|
|
28
32
|
backgroundColor,
|
|
33
|
+
borderColor: selection.highlighted ? selectedColor : "transparent",
|
|
34
|
+
borderWidth: selection.borderWidth,
|
|
29
35
|
borderRadius: (0, buttonRadius_1.buttonRadiusValue)(radius),
|
|
30
36
|
opacity: (0, buttonAppearance_1.buttonOpacity)({ disabled, loading: false, pressed }),
|
|
31
37
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Choice.js","sourceRoot":"","sources":["../../../src/components/Choice/Choice.tsx"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"Choice.js","sourceRoot":"","sources":["../../../src/components/Choice/Choice.tsx"],"names":[],"mappings":";;AAeA,wBA8EC;;AA7FD,+CAAiE;AACjE,iEAA2D;AAC3D,yDAA2D;AAC3D,0EAAuE;AACvE,iDAAmF;AACnF,yDAAwD;AAGxD;;;;;;GAMG;AACH,SAAgB,MAAM,CAAC,EACrB,KAAK,EACL,WAAW,EACX,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,+BAAgB,EAC3B,MAAM,GAAG,IAAI,EACb,eAAe,EAAE,mBAAmB,EACpC,UAAU,EAAE,cAAc,EAC1B,gBA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;KACb;CACF,CAAC,CAAC"}
|
|
@@ -4,4 +4,20 @@ export declare const CHOICE_ICON_SIZE = 28;
|
|
|
4
4
|
export declare const CHOICE_ICON_SLOT = 32;
|
|
5
5
|
/** The icon column: the steady slot, or the icon itself when it is larger. Pure so it can be unit-tested. */
|
|
6
6
|
export declare function choiceIconSlot(iconSize: number): number;
|
|
7
|
+
/** Border around a selectable choice; drawn transparent when not selected. */
|
|
8
|
+
export declare const CHOICE_SELECTED_BORDER = 2;
|
|
9
|
+
/**
|
|
10
|
+
* Role, state and border for a choice. Without `selected` it is a plain
|
|
11
|
+
* button. With it, a radio option that keeps its border width either way,
|
|
12
|
+
* so rows do not shift when the selection moves. Pure so it can be unit-tested.
|
|
13
|
+
*/
|
|
14
|
+
export declare function choiceSelection(selected: boolean | undefined): {
|
|
15
|
+
role: "button" | "radio";
|
|
16
|
+
state: {
|
|
17
|
+
selected?: boolean;
|
|
18
|
+
checked?: boolean;
|
|
19
|
+
};
|
|
20
|
+
borderWidth: number;
|
|
21
|
+
highlighted: boolean;
|
|
22
|
+
};
|
|
7
23
|
//# sourceMappingURL=choiceLayout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choiceLayout.d.ts","sourceRoot":"","sources":["../../../src/components/Choice/choiceLayout.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,6GAA6G;AAC7G,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEvD"}
|
|
1
|
+
{"version":3,"file":"choiceLayout.d.ts","sourceRoot":"","sources":["../../../src/components/Choice/choiceLayout.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,6GAA6G;AAC7G,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,8EAA8E;AAC9E,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG;IAC9D,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;IACzB,KAAK,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;CACtB,CAUA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CHOICE_ICON_SLOT = exports.CHOICE_ICON_SIZE = void 0;
|
|
3
|
+
exports.CHOICE_SELECTED_BORDER = exports.CHOICE_ICON_SLOT = exports.CHOICE_ICON_SIZE = void 0;
|
|
4
4
|
exports.choiceIconSlot = choiceIconSlot;
|
|
5
|
+
exports.choiceSelection = choiceSelection;
|
|
5
6
|
/** Default icon box, sized for an SF Symbol next to a two-line label. */
|
|
6
7
|
exports.CHOICE_ICON_SIZE = 28;
|
|
7
8
|
/** Icon column width, so titles line up across a list of choices. */
|
|
@@ -10,4 +11,22 @@ exports.CHOICE_ICON_SLOT = 32;
|
|
|
10
11
|
function choiceIconSlot(iconSize) {
|
|
11
12
|
return Math.max(exports.CHOICE_ICON_SLOT, iconSize);
|
|
12
13
|
}
|
|
14
|
+
/** Border around a selectable choice; drawn transparent when not selected. */
|
|
15
|
+
exports.CHOICE_SELECTED_BORDER = 2;
|
|
16
|
+
/**
|
|
17
|
+
* Role, state and border for a choice. Without `selected` it is a plain
|
|
18
|
+
* button. With it, a radio option that keeps its border width either way,
|
|
19
|
+
* so rows do not shift when the selection moves. Pure so it can be unit-tested.
|
|
20
|
+
*/
|
|
21
|
+
function choiceSelection(selected) {
|
|
22
|
+
if (selected === undefined) {
|
|
23
|
+
return { role: "button", state: {}, borderWidth: 0, highlighted: false };
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
role: "radio",
|
|
27
|
+
state: { selected, checked: selected },
|
|
28
|
+
borderWidth: exports.CHOICE_SELECTED_BORDER,
|
|
29
|
+
highlighted: selected,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
13
32
|
//# sourceMappingURL=choiceLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choiceLayout.js","sourceRoot":"","sources":["../../../src/components/Choice/choiceLayout.ts"],"names":[],"mappings":";;;AAMA,wCAEC;
|
|
1
|
+
{"version":3,"file":"choiceLayout.js","sourceRoot":"","sources":["../../../src/components/Choice/choiceLayout.ts"],"names":[],"mappings":";;;AAMA,wCAEC;AAUD,0CAeC;AAjCD,yEAAyE;AAC5D,QAAA,gBAAgB,GAAG,EAAE,CAAC;AACnC,qEAAqE;AACxD,QAAA,gBAAgB,GAAG,EAAE,CAAC;AAEnC,6GAA6G;AAC7G,SAAgB,cAAc,CAAC,QAAgB;IAC7C,OAAO,IAAI,CAAC,GAAG,CAAC,wBAAgB,EAAE,QAAQ,CAAC,CAAC;AAC9C,CAAC;AAED,8EAA8E;AACjE,QAAA,sBAAsB,GAAG,CAAC,CAAC;AAExC;;;;GAIG;AACH,SAAgB,eAAe,CAAC,QAA6B;IAM3D,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;IAC3E,CAAC;IACD,OAAO;QACL,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE;QACtC,WAAW,EAAE,8BAAsB;QACnC,WAAW,EAAE,QAAQ;KACtB,CAAC;AACJ,CAAC"}
|
|
@@ -3,6 +3,7 @@ export declare const CHOICE_THEME_ROLES: {
|
|
|
3
3
|
readonly titleColor: "choiceTitle";
|
|
4
4
|
readonly descriptionColor: "choiceDescription";
|
|
5
5
|
readonly iconColor: "choiceIcon";
|
|
6
|
+
readonly selectedColor: "choiceSelected";
|
|
6
7
|
};
|
|
7
8
|
export type ChoiceThemeColorProp = keyof typeof CHOICE_THEME_ROLES;
|
|
8
9
|
//# sourceMappingURL=choiceThemeRoles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choiceThemeRoles.d.ts","sourceRoot":"","sources":["../../../src/components/Choice/choiceThemeRoles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"choiceThemeRoles.d.ts","sourceRoot":"","sources":["../../../src/components/Choice/choiceThemeRoles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB;;;;;;CAMrB,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,MAAM,OAAO,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choiceThemeRoles.js","sourceRoot":"","sources":["../../../src/components/Choice/choiceThemeRoles.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG;IAChC,eAAe,EAAE,kBAAkB;IACnC,UAAU,EAAE,aAAa;IACzB,gBAAgB,EAAE,mBAAmB;IACrC,SAAS,EAAE,YAAY;
|
|
1
|
+
{"version":3,"file":"choiceThemeRoles.js","sourceRoot":"","sources":["../../../src/components/Choice/choiceThemeRoles.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG;IAChC,eAAe,EAAE,kBAAkB;IACnC,UAAU,EAAE,aAAa;IACzB,gBAAgB,EAAE,mBAAmB;IACrC,SAAS,EAAE,YAAY;IACvB,aAAa,EAAE,gBAAgB;CACvB,CAAC"}
|
|
@@ -8,6 +8,11 @@ export type ChoiceProps = {
|
|
|
8
8
|
/** `({ color, size }) => ReactNode`, e.g. an expo-symbols `SymbolView`. */
|
|
9
9
|
icon?: ButtonIcon;
|
|
10
10
|
onPress: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Makes the choice a selectable option: a highlight border when true,
|
|
13
|
+
* read as a selected radio. Leave it out for a choice that just acts.
|
|
14
|
+
*/
|
|
15
|
+
selected?: boolean;
|
|
11
16
|
disabled?: boolean;
|
|
12
17
|
/** Icon box. Default 28. */
|
|
13
18
|
iconSize?: number;
|
|
@@ -21,6 +26,8 @@ export type ChoiceProps = {
|
|
|
21
26
|
descriptionColor?: string;
|
|
22
27
|
/** Defaults to theme role `choiceIcon`. */
|
|
23
28
|
iconColor?: string;
|
|
29
|
+
/** Border of a selected choice. Defaults to theme role `choiceSelected`. */
|
|
30
|
+
selectedColor?: string;
|
|
24
31
|
style?: StyleProp<ViewStyle>;
|
|
25
32
|
};
|
|
26
33
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Choice/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,MAAM,CAAC,EAAE,YAAY,CA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AS,CAAC,CAAC;CAC9B,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DateTimePresenterProps } from "./types";
|
|
2
|
+
/** Android: the system date dialog, then the time dialog (for datetime). */
|
|
3
|
+
export declare function DateTimePresenter({ open, value, mode, minimumDate, maximumDate, colors, onConfirm, onClose, }: DateTimePresenterProps): import("react").JSX.Element | null;
|
|
4
|
+
//# sourceMappingURL=DateTimePresenter.android.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateTimePresenter.android.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/DateTimePresenter.android.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAItD,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,WAAW,EACX,WAAW,EACX,MAAM,EACN,SAAS,EACT,OAAO,GACR,EAAE,sBAAsB,sCA0DxB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DateTimePresenter = DateTimePresenter;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const jetpack_compose_1 = require("@expo/ui/jetpack-compose");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const dateTimeValue_1 = require("./dateTimeValue");
|
|
8
|
+
/** Android: the system date dialog, then the time dialog (for datetime). */
|
|
9
|
+
function DateTimePresenter({ open, value, mode, minimumDate, maximumDate, colors, onConfirm, onClose, }) {
|
|
10
|
+
const [step, setStep] = (0, react_1.useState)(null);
|
|
11
|
+
const [draft, setDraft] = (0, react_1.useState)(value);
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
13
|
+
if (open) {
|
|
14
|
+
setDraft(value);
|
|
15
|
+
setStep(mode === "time" ? "time" : "date");
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
setStep(null);
|
|
19
|
+
}
|
|
20
|
+
// Restart from the value only when opened.
|
|
21
|
+
}, [open]);
|
|
22
|
+
const close = () => {
|
|
23
|
+
setStep(null);
|
|
24
|
+
onClose();
|
|
25
|
+
};
|
|
26
|
+
if (step === "date") {
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(jetpack_compose_1.Host, { children: (0, jsx_runtime_1.jsx)(jetpack_compose_1.DatePickerDialog, { color: colors.accent, initialDate: draft.toISOString(), onDateSelected: (day) => {
|
|
28
|
+
const next = (0, dateTimeValue_1.withDay)(draft, day);
|
|
29
|
+
if (mode === "datetime") {
|
|
30
|
+
setDraft(next);
|
|
31
|
+
setStep("time");
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
setStep(null);
|
|
35
|
+
onConfirm(next);
|
|
36
|
+
}
|
|
37
|
+
}, onDismissRequest: close, selectableDates: { start: minimumDate, end: maximumDate } }) }));
|
|
38
|
+
}
|
|
39
|
+
if (step === "time") {
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(jetpack_compose_1.Host, { children: (0, jsx_runtime_1.jsx)(jetpack_compose_1.TimePickerDialog, { color: colors.accent, initialDate: draft.toISOString(), is24Hour: true, onDateSelected: (time) => {
|
|
41
|
+
setStep(null);
|
|
42
|
+
onConfirm((0, dateTimeValue_1.withTime)(draft, time));
|
|
43
|
+
}, onDismissRequest: close }) }));
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=DateTimePresenter.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateTimePresenter.android.js","sourceRoot":"","sources":["../../../src/components/DateTime/DateTimePresenter.android.tsx"],"names":[],"mappings":";;AAQA,8CAmEC;;AA3ED,8DAAoF;AACpF,iCAA4C;AAC5C,mDAAoD;AAKpD,4EAA4E;AAC5E,SAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,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ACD,gBAAgB,EAAE,KAAK,EACvB,eAAe,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,WAAW,EAAE,GACzD,GACG,CACR,CAAC;IACJ,CAAC;IACD,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACpB,OAAO,CACL,uBAAC,sBAAI,cACH,uBAAC,kCAAgB,IACf,KAAK,EAAE,MAAM,CAAC,MAAM,EACpB,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,EAChC,QAAQ,QACR,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE;oBACvB,OAAO,CAAC,IAAI,CAAC,CAAC;oBACd,SAAS,CAAC,IAAA,wBAAQ,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;gBACnC,CAAC,EACD,gBAAgB,EAAE,KAAK,GACvB,GACG,CACR,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateTimePresenter.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/DateTimePresenter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,sBAAsB,QAE/D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DateTimePresenterProps } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* iOS: a bottom panel in a React Native Modal with SwiftUI's picker — a
|
|
4
|
+
* calendar for dates, wheels for times — and Done. Tapping outside keeps
|
|
5
|
+
* the old value. A Modal (not a bottom-sheet modal) so it opens from
|
|
6
|
+
* anywhere, including inside another sheet or a native modal.
|
|
7
|
+
*/
|
|
8
|
+
export declare function DateTimePresenter({ open, value, mode, minimumDate, maximumDate, title, doneLabel, colors, onConfirm, onClose, }: DateTimePresenterProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=DateTimePresenter.ios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateTimePresenter.ios.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/DateTimePresenter.ios.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAItD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,WAAW,EACX,WAAW,EACX,KAAK,EACL,SAAS,EACT,MAAM,EACN,SAAS,EACT,OAAO,GACR,EAAE,sBAAsB,+BA2DxB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DateTimePresenter = DateTimePresenter;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const swift_ui_1 = require("@expo/ui/swift-ui");
|
|
6
|
+
const modifiers_1 = require("@expo/ui/swift-ui/modifiers");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const react_native_1 = require("react-native");
|
|
9
|
+
const react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
10
|
+
const sheet_1 = require("../../layout/sheet");
|
|
11
|
+
const BACKDROP = "rgba(0, 0, 0, 0.4)";
|
|
12
|
+
/**
|
|
13
|
+
* iOS: a bottom panel in a React Native Modal with SwiftUI's picker — a
|
|
14
|
+
* calendar for dates, wheels for times — and Done. Tapping outside keeps
|
|
15
|
+
* the old value. A Modal (not a bottom-sheet modal) so it opens from
|
|
16
|
+
* anywhere, including inside another sheet or a native modal.
|
|
17
|
+
*/
|
|
18
|
+
function DateTimePresenter({ open, value, mode, minimumDate, maximumDate, title, doneLabel, colors, onConfirm, onClose, }) {
|
|
19
|
+
const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
|
|
20
|
+
const [draft, setDraft] = (0, react_1.useState)(value);
|
|
21
|
+
(0, react_1.useEffect)(() => {
|
|
22
|
+
// Start from the field's value each time the picker opens.
|
|
23
|
+
if (open)
|
|
24
|
+
setDraft(value);
|
|
25
|
+
}, [open]);
|
|
26
|
+
const components = mode === "date" ? ["date"] : mode === "time" ? ["hourAndMinute"] : ["date", "hourAndMinute"];
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Modal, { animationType: "slide", onRequestClose: onClose, transparent: true, visible: open, children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.root, children: [(0, jsx_runtime_1.jsx)(react_native_1.Pressable, { accessibilityLabel: "Close", accessibilityRole: "button", onPress: onClose, style: [react_native_1.StyleSheet.absoluteFill, { backgroundColor: BACKDROP }] }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
28
|
+
styles.panel,
|
|
29
|
+
{ backgroundColor: colors.background, paddingBottom: insets.bottom + 16 },
|
|
30
|
+
], children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.header, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { accessibilityRole: "header", style: [styles.title, { color: colors.text }], children: title }), (0, jsx_runtime_1.jsx)(react_native_1.Pressable, { accessibilityRole: "button", hitSlop: 8, onPress: () => onConfirm(draft), children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.done, { color: colors.accent }], children: doneLabel }) })] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [styles.divider, { backgroundColor: colors.border }] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.picker, children: (0, jsx_runtime_1.jsx)(swift_ui_1.Host, { matchContents: true, children: (0, jsx_runtime_1.jsx)(swift_ui_1.DatePicker, { displayedComponents: components, modifiers: [
|
|
31
|
+
(0, modifiers_1.datePickerStyle)(mode === "date" ? "graphical" : "wheel"),
|
|
32
|
+
(0, modifiers_1.tint)(colors.accent),
|
|
33
|
+
], onDateChange: setDraft, range: { start: minimumDate, end: maximumDate }, selection: draft }) }) })] })] }) }));
|
|
34
|
+
}
|
|
35
|
+
const styles = react_native_1.StyleSheet.create({
|
|
36
|
+
root: {
|
|
37
|
+
flex: 1,
|
|
38
|
+
justifyContent: "flex-end",
|
|
39
|
+
},
|
|
40
|
+
panel: {
|
|
41
|
+
borderTopLeftRadius: sheet_1.SHEET_TOP_RADIUS,
|
|
42
|
+
borderTopRightRadius: sheet_1.SHEET_TOP_RADIUS,
|
|
43
|
+
},
|
|
44
|
+
header: {
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
flexDirection: "row",
|
|
47
|
+
gap: 12,
|
|
48
|
+
paddingHorizontal: 16,
|
|
49
|
+
paddingVertical: 14,
|
|
50
|
+
},
|
|
51
|
+
title: {
|
|
52
|
+
flex: 1,
|
|
53
|
+
fontSize: 17,
|
|
54
|
+
fontWeight: "600",
|
|
55
|
+
},
|
|
56
|
+
done: {
|
|
57
|
+
fontSize: 17,
|
|
58
|
+
fontWeight: "600",
|
|
59
|
+
},
|
|
60
|
+
divider: {
|
|
61
|
+
height: react_native_1.StyleSheet.hairlineWidth,
|
|
62
|
+
},
|
|
63
|
+
picker: {
|
|
64
|
+
alignItems: "center",
|
|
65
|
+
paddingHorizontal: 16,
|
|
66
|
+
paddingTop: 8,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=DateTimePresenter.ios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateTimePresenter.ios.js","sourceRoot":"","sources":["../../../src/components/DateTime/DateTimePresenter.ios.tsx"],"names":[],"mappings":";;AAgBA,8CAsEC;;AAtFD,gDAAqD;AACrD,2DAAoE;AACpE,iCAA4C;AAC5C,+CAAwE;AACxE,mFAAmE;AACnE,8CAAsD;AAGtD,MAAM,QAAQ,GAAG,oBAAoB,CAAC;AAEtC;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,WAAW,EACX,WAAW,EACX,KAAK,EACL,SAAS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QACP,iBAAiB,EAAE,EAAE;QACrB,eAAe,EAAE,EAAE;KACpB;IACD,KAAK,EAAE;QACL,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;KAClB;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;KAClB;IACD,OAAO,EAAE;QACP,MAAM,EAAE,yBAAU,CAAC,aAAa;KACjC;IACD,MAAM,EAAE;QACN,UAAU,EAAE,QAAQ;QACpB,iBAAiB,EAAE,EAAE;QACrB,UAAU,EAAE,CAAC;KACd;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DateTimePresenter = DateTimePresenter;
|
|
4
|
+
/** Web and other platforms: no native picker; the field shows its value only. */
|
|
5
|
+
function DateTimePresenter(_props) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=DateTimePresenter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateTimePresenter.js","sourceRoot":"","sources":["../../../src/components/DateTime/DateTimePresenter.tsx"],"names":[],"mappings":";;AAGA,8CAEC;AAHD,iFAAiF;AACjF,SAAgB,iBAAiB,CAAC,MAA8B;IAC9D,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FieldDateTimeProps } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* A date, time, or date-and-time field. Looks like Select: label, value,
|
|
4
|
+
* description or error. Tapping opens the native picker — a sheet with
|
|
5
|
+
* Done on iOS, the system dialogs on Android. Needs `@expo/ui`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function FieldDateTime({ name, value, onChange, mode, label, description, error, placeholder, minimumDate, maximumDate, formatValue, sheetTitle, doneLabel, radius, editable, backgroundColor: backgroundColorProp, textColor: textColorProp, placeholderColor: placeholderColorProp, labelColor: labelColorProp, descriptionColor: descriptionColorProp, borderColor: borderColorProp, errorColor: errorColorProp, accentColor: accentColorProp, style, }: FieldDateTimeProps): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=FieldDateTime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldDateTime.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/FieldDateTime.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,IAAiB,EACjB,KAAK,EACL,WAAW,EACX,KAAK,EACL,WAAiE,EACjE,WAAW,EACX,WAAW,EACX,WAAW,EACX,UAAU,EACV,SAAkB,EAClB,MAAa,EACb,QAAe,EACf,eAAe,EAAE,mBAAmB,EACpC,SAAS,EAAE,aAAa,EACxB,gBAAgB,EAAE,oBAAoB,EACtC,UAAU,EAAE,cAAc,EAC1B,gBAAgB,EAAE,oBAAoB,EACtC,WAAW,EAAE,eAAe,EAC5B,UAAU,EAAE,cAAc,EAC1B,WAAW,EAAE,eAAe,EAC5B,KAAK,GACN,EAAE,kBAAkB,+BAsFpB"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FieldDateTime = FieldDateTime;
|
|
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 ErrorBanner_1 = require("../ErrorBanner");
|
|
9
|
+
const useResolvedFieldColor_1 = require("../Field/useResolvedFieldColor");
|
|
10
|
+
const DateTimePresenter_1 = require("./DateTimePresenter");
|
|
11
|
+
const dateTimeThemeRoles_1 = require("./dateTimeThemeRoles");
|
|
12
|
+
const dateTimeValue_1 = require("./dateTimeValue");
|
|
13
|
+
/**
|
|
14
|
+
* A date, time, or date-and-time field. Looks like Select: label, value,
|
|
15
|
+
* description or error. Tapping opens the native picker — a sheet with
|
|
16
|
+
* Done on iOS, the system dialogs on Android. Needs `@expo/ui`.
|
|
17
|
+
*/
|
|
18
|
+
function FieldDateTime({ name, value, onChange, mode = "datetime", label, description, error, placeholder = mode === "time" ? "Choose a time" : "Choose a date", minimumDate, maximumDate, formatValue, sheetTitle, doneLabel = "Done", radius = "xl", editable = true, backgroundColor: backgroundColorProp, textColor: textColorProp, placeholderColor: placeholderColorProp, labelColor: labelColorProp, descriptionColor: descriptionColorProp, borderColor: borderColorProp, errorColor: errorColorProp, accentColor: accentColorProp, style, }) {
|
|
19
|
+
const backgroundColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(backgroundColorProp, dateTimeThemeRoles_1.DATE_TIME_THEME_ROLES.backgroundColor);
|
|
20
|
+
const textColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(textColorProp, dateTimeThemeRoles_1.DATE_TIME_THEME_ROLES.textColor);
|
|
21
|
+
const placeholderColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(placeholderColorProp, dateTimeThemeRoles_1.DATE_TIME_THEME_ROLES.placeholderColor);
|
|
22
|
+
const labelColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(labelColorProp, dateTimeThemeRoles_1.DATE_TIME_THEME_ROLES.labelColor);
|
|
23
|
+
const descriptionColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(descriptionColorProp, dateTimeThemeRoles_1.DATE_TIME_THEME_ROLES.descriptionColor);
|
|
24
|
+
const borderColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(borderColorProp, dateTimeThemeRoles_1.DATE_TIME_THEME_ROLES.borderColor);
|
|
25
|
+
const errorColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(errorColorProp, dateTimeThemeRoles_1.DATE_TIME_THEME_ROLES.errorColor);
|
|
26
|
+
const accentColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(accentColorProp, dateTimeThemeRoles_1.DATE_TIME_THEME_ROLES.accentColor);
|
|
27
|
+
const [open, setOpen] = (0, react_1.useState)(false);
|
|
28
|
+
const dismissBanner = (0, ErrorBanner_1.useErrorBannerDismiss)();
|
|
29
|
+
const { viewRef, listed } = (0, ErrorBanner_1.useErrorBannerField)(name, () => setOpen(true));
|
|
30
|
+
const hasError = Boolean(error) || Boolean(listed);
|
|
31
|
+
const inlineError = listed ? undefined : error;
|
|
32
|
+
const display = value
|
|
33
|
+
? (formatValue ?? ((date) => (0, dateTimeValue_1.formatDateTimeValue)(date, mode)))(value)
|
|
34
|
+
: placeholder;
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { ref: viewRef, collapsable: false, 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.Pressable, { accessibilityHint: listed?.message ?? "Opens a date and time picker", accessibilityLabel: label ? `${label}. ${display}` : display, accessibilityRole: "button", accessibilityState: { disabled: !editable }, disabled: !editable, onPress: () => setOpen(true), style: [
|
|
36
|
+
styles.trigger,
|
|
37
|
+
{
|
|
38
|
+
backgroundColor,
|
|
39
|
+
borderColor: hasError ? errorColor : borderColor,
|
|
40
|
+
borderRadius: (0, buttonRadius_1.buttonRadiusValue)(radius),
|
|
41
|
+
},
|
|
42
|
+
], children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { numberOfLines: 1, style: [styles.triggerText, { color: value ? textColor : placeholderColor }], children: display }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: [styles.chevron, { color: placeholderColor }], children: "\u203A" })] }), inlineError ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.helper, { color: errorColor }], children: inlineError })) : description ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.helper, { color: descriptionColor }], children: description })) : null, (0, jsx_runtime_1.jsx)(DateTimePresenter_1.DateTimePresenter, { colors: {
|
|
43
|
+
background: backgroundColor,
|
|
44
|
+
text: textColor,
|
|
45
|
+
handle: placeholderColor,
|
|
46
|
+
border: borderColor,
|
|
47
|
+
accent: accentColor,
|
|
48
|
+
}, doneLabel: doneLabel, maximumDate: maximumDate, minimumDate: minimumDate, mode: mode, onClose: () => setOpen(false), onConfirm: (next) => {
|
|
49
|
+
setOpen(false);
|
|
50
|
+
onChange((0, dateTimeValue_1.clampDate)(next, minimumDate, maximumDate));
|
|
51
|
+
dismissBanner();
|
|
52
|
+
}, open: open, title: sheetTitle ?? label ?? "Date and time", value: (0, dateTimeValue_1.clampDate)(value ?? new Date(), minimumDate, maximumDate) })] }));
|
|
53
|
+
}
|
|
54
|
+
const styles = react_native_1.StyleSheet.create({
|
|
55
|
+
column: {
|
|
56
|
+
gap: 6,
|
|
57
|
+
width: "100%",
|
|
58
|
+
},
|
|
59
|
+
blocked: {
|
|
60
|
+
opacity: 0.4,
|
|
61
|
+
},
|
|
62
|
+
label: {
|
|
63
|
+
fontSize: 13,
|
|
64
|
+
fontWeight: "600",
|
|
65
|
+
},
|
|
66
|
+
trigger: {
|
|
67
|
+
alignItems: "center",
|
|
68
|
+
borderWidth: 1,
|
|
69
|
+
flexDirection: "row",
|
|
70
|
+
gap: 8,
|
|
71
|
+
minHeight: 48,
|
|
72
|
+
paddingHorizontal: 14,
|
|
73
|
+
paddingVertical: 12,
|
|
74
|
+
width: "100%",
|
|
75
|
+
},
|
|
76
|
+
triggerText: {
|
|
77
|
+
flex: 1,
|
|
78
|
+
fontSize: 17,
|
|
79
|
+
},
|
|
80
|
+
chevron: {
|
|
81
|
+
fontSize: 22,
|
|
82
|
+
fontWeight: "300",
|
|
83
|
+
lineHeight: 24,
|
|
84
|
+
transform: [{ rotate: "90deg" }],
|
|
85
|
+
},
|
|
86
|
+
helper: {
|
|
87
|
+
fontSize: 13,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
//# sourceMappingURL=FieldDateTime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldDateTime.js","sourceRoot":"","sources":["../../../src/components/DateTime/FieldDateTime.tsx"],"names":[],"mappings":";;AAeA,sCA+GC;;AA9HD,iCAAiC;AACjC,+CAAiE;AACjE,yDAA2D;AAC3D,gDAA4E;AAC5E,0EAAuE;AACvE,2DAAwD;AACxD,6DAA6D;AAC7D,mDAAiE;AAGjE;;;;GAIG;AACH,SAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,IAAI,GAAG,UAAU,EACjB,KAAK,EACL,WAAW,EACX,KAAK,EACL,WAAW,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,EACjE,WAAW,EACX,WAAW,EACX,WAAW,EACX,UAAU,EACV,SAAS,GAAG,MAAM,EAClB,MAAM,GAAG,IAAI,EACb,QAAQ,GAAG,IAAI,EACf,eAAe,EAAE,mBAAmB,EACpC,SAAS,EAAE,aAAa,EACxB,gBAAgB,EAAE,oBAAoB,EACtC,UAAU,EAAE,cAAc,EAC1B,gBAAgB,EAAE,oBAAoB,EACtC,WAAW,EAAE,eAAe,EAC5B,UAAU,EAAE,cAAc,EAC1B,WAAW,EAAE,eAAe,EAC5B,KAAK,GACc;IACnB,MAAM,eAAe,GAAG,IAAA,6CAAqB,EAAC,mBAAmB,EAAE,0CAAqB,CAAC,eAAe,CAAC,CAAC;IAC1G,MAAM,SAAS,GAAG,IAAA,6CAAqB,EAAC,aAAa,EAAE,0CAAqB,CAAC,SAAS,CAAC,CAAC;IACxF,MAAM,gBAAgB,GAAG,IAAA,6CAAqB,EAAC,oBAAoB,EAAE,0CAAqB,CAAC,gBAAgB,CAAC,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AE,KAAK;KAClB;IACD,OAAO,EAAE;QACP,UAAU,EAAE,QAAQ;QACpB,WAAW,EAAE,CAAC;QACd,aAAa,EAAE,KAAK;QACpB,GAAG,EAAE,CAAC;QACN,SAAS,EAAE,EAAE;QACb,iBAAiB,EAAE,EAAE;QACrB,eAAe,EAAE,EAAE;QACnB,KAAK,EAAE,MAAM;KACd;IACD,WAAW,EAAE;QACX,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,EAAE;KACb;IACD,OAAO,EAAE;QACP,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,EAAE;QACd,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;KACjC;IACD,MAAM,EAAE;QACN,QAAQ,EAAE,EAAE;KACb;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** The same roles as FieldText and Select, so date fields match the form. */
|
|
2
|
+
export declare const DATE_TIME_THEME_ROLES: {
|
|
3
|
+
readonly backgroundColor: "fieldBackground";
|
|
4
|
+
readonly textColor: "fieldText";
|
|
5
|
+
readonly placeholderColor: "fieldPlaceholder";
|
|
6
|
+
readonly labelColor: "fieldLabel";
|
|
7
|
+
readonly descriptionColor: "fieldDescription";
|
|
8
|
+
readonly borderColor: "fieldBorder";
|
|
9
|
+
readonly errorColor: "fieldError";
|
|
10
|
+
readonly accentColor: "fieldSelectSelected";
|
|
11
|
+
};
|
|
12
|
+
export type DateTimeThemeColorProp = keyof typeof DATE_TIME_THEME_ROLES;
|
|
13
|
+
//# sourceMappingURL=dateTimeThemeRoles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateTimeThemeRoles.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/dateTimeThemeRoles.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB;;;;;;;;;CASxB,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAAG,MAAM,OAAO,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DATE_TIME_THEME_ROLES = void 0;
|
|
4
|
+
/** The same roles as FieldText and Select, so date fields match the form. */
|
|
5
|
+
exports.DATE_TIME_THEME_ROLES = {
|
|
6
|
+
backgroundColor: "fieldBackground",
|
|
7
|
+
textColor: "fieldText",
|
|
8
|
+
placeholderColor: "fieldPlaceholder",
|
|
9
|
+
labelColor: "fieldLabel",
|
|
10
|
+
descriptionColor: "fieldDescription",
|
|
11
|
+
borderColor: "fieldBorder",
|
|
12
|
+
errorColor: "fieldError",
|
|
13
|
+
accentColor: "fieldSelectSelected",
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=dateTimeThemeRoles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateTimeThemeRoles.js","sourceRoot":"","sources":["../../../src/components/DateTime/dateTimeThemeRoles.ts"],"names":[],"mappings":";;;AAAA,6EAA6E;AAChE,QAAA,qBAAqB,GAAG;IACnC,eAAe,EAAE,iBAAiB;IAClC,SAAS,EAAE,WAAW;IACtB,gBAAgB,EAAE,kBAAkB;IACpC,UAAU,EAAE,YAAY;IACxB,gBAAgB,EAAE,kBAAkB;IACpC,WAAW,EAAE,aAAa;IAC1B,UAAU,EAAE,YAAY;IACxB,WAAW,EAAE,qBAAqB;CAC1B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Which parts of the value the field edits. */
|
|
2
|
+
export type DateTimeMode = "date" | "time" | "datetime";
|
|
3
|
+
/** Default display: "Sat 3 Oct 2026", "08:05" or "Sat 3 Oct 2026 · 08:05", local time. Pure. */
|
|
4
|
+
export declare function formatDateTimeValue(value: Date, mode: DateTimeMode): string;
|
|
5
|
+
/** `value` moved to the calendar day of `day`, keeping its time. */
|
|
6
|
+
export declare function withDay(value: Date, day: Date): Date;
|
|
7
|
+
/** `value` at the hour and minute of `time`, keeping its day. */
|
|
8
|
+
export declare function withTime(value: Date, time: Date): Date;
|
|
9
|
+
/** `value` moved inside the optional limits. */
|
|
10
|
+
export declare function clampDate(value: Date, minimum?: Date, maximum?: Date): Date;
|
|
11
|
+
//# sourceMappingURL=dateTimeValue.d.ts.map
|