@ankhorage/surface 5.0.1 → 7.0.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/CHANGELOG.md +12 -0
- package/README.md +1 -2
- package/dist/{layout → core/responsive}/Show.d.ts +2 -1
- package/dist/core/responsive/Show.d.ts.map +1 -0
- package/dist/{layout → core/responsive}/Show.js +3 -1
- package/dist/core/responsive/Show.js.map +1 -0
- package/dist/core/responsive/index.d.ts +1 -0
- package/dist/core/responsive/index.d.ts.map +1 -1
- package/dist/core/responsive/index.js +1 -0
- package/dist/core/responsive/index.js.map +1 -1
- package/dist/features/app-bar/adapters/inbound/AppBar.d.ts +5 -0
- package/dist/features/app-bar/adapters/inbound/AppBar.d.ts.map +1 -0
- package/dist/features/app-bar/adapters/inbound/AppBar.js +40 -0
- package/dist/features/app-bar/adapters/inbound/AppBar.js.map +1 -0
- package/dist/features/app-bar/public.d.ts +3 -0
- package/dist/features/app-bar/public.d.ts.map +1 -0
- package/dist/features/app-bar/public.js +2 -0
- package/dist/features/app-bar/public.js.map +1 -0
- package/dist/features/badge/adapters/inbound/Badge.js +3 -3
- package/dist/features/badge/adapters/inbound/Badge.js.map +1 -1
- package/dist/features/button/adapters/inbound/Button.js +8 -8
- package/dist/features/button/adapters/inbound/Button.js.map +1 -1
- package/dist/features/button/adapters/inbound/IconButton.js +3 -3
- package/dist/features/button/adapters/inbound/IconButton.js.map +1 -1
- package/dist/features/form/checkbox/adapters/inbound/Checkbox.js +7 -7
- package/dist/features/form/checkbox/adapters/inbound/Checkbox.js.map +1 -1
- package/dist/{components/field → features/form/field/adapters/inbound}/Field.d.ts +2 -1
- package/dist/features/form/field/adapters/inbound/Field.d.ts.map +1 -0
- package/dist/features/form/field/adapters/inbound/Field.js +40 -0
- package/dist/features/form/field/adapters/inbound/Field.js.map +1 -0
- package/dist/features/form/field/public.d.ts +3 -0
- package/dist/features/form/field/public.d.ts.map +1 -0
- package/dist/features/form/field/public.js +2 -0
- package/dist/features/form/field/public.js.map +1 -0
- package/dist/features/form/radio/adapters/inbound/Radio.js +8 -8
- package/dist/features/form/radio/adapters/inbound/Radio.js.map +1 -1
- package/dist/{components/switch → features/form/switch/adapters/inbound}/Switch.d.ts +2 -1
- package/dist/features/form/switch/adapters/inbound/Switch.d.ts.map +1 -0
- package/dist/features/form/switch/adapters/inbound/Switch.js +52 -0
- package/dist/features/form/switch/adapters/inbound/Switch.js.map +1 -0
- package/dist/features/form/switch/public.d.ts +3 -0
- package/dist/features/form/switch/public.d.ts.map +1 -0
- package/dist/features/form/switch/public.js +2 -0
- package/dist/features/form/switch/public.js.map +1 -0
- package/dist/features/form/text-input/adapters/inbound/TextInput.d.ts.map +1 -1
- package/dist/features/form/text-input/adapters/inbound/TextInput.js +8 -4
- package/dist/features/form/text-input/adapters/inbound/TextInput.js.map +1 -1
- package/dist/features/layout/adapters/inbound/Divider.js +2 -2
- package/dist/features/layout/adapters/inbound/Divider.js.map +1 -1
- package/dist/features/layout/adapters/inbound/Grid.d.ts.map +1 -1
- package/dist/features/layout/adapters/inbound/Grid.js +7 -9
- package/dist/features/layout/adapters/inbound/Grid.js.map +1 -1
- package/dist/features/layout/adapters/inbound/ScrollView.d.ts +5 -0
- package/dist/features/layout/adapters/inbound/ScrollView.d.ts.map +1 -0
- package/dist/features/layout/adapters/inbound/ScrollView.js +69 -0
- package/dist/features/layout/adapters/inbound/ScrollView.js.map +1 -0
- package/dist/features/layout/adapters/inbound/View.d.ts +5 -0
- package/dist/features/layout/adapters/inbound/View.d.ts.map +1 -0
- package/dist/features/layout/adapters/inbound/View.js +17 -0
- package/dist/features/layout/adapters/inbound/View.js.map +1 -0
- package/dist/features/layout/public.d.ts +3 -4
- package/dist/features/layout/public.d.ts.map +1 -1
- package/dist/features/layout/public.js +2 -3
- package/dist/features/layout/public.js.map +1 -1
- package/dist/features/list/adapters/inbound/List.d.ts +5 -0
- package/dist/features/list/adapters/inbound/List.d.ts.map +1 -0
- package/dist/features/list/adapters/inbound/List.js +7 -0
- package/dist/features/list/adapters/inbound/List.js.map +1 -0
- package/dist/features/list/adapters/inbound/ListItem.d.ts +5 -0
- package/dist/features/list/adapters/inbound/ListItem.d.ts.map +1 -0
- package/dist/features/list/adapters/inbound/ListItem.js +59 -0
- package/dist/features/list/adapters/inbound/ListItem.js.map +1 -0
- package/dist/features/list/public.d.ts +4 -0
- package/dist/features/list/public.d.ts.map +1 -0
- package/dist/features/list/public.js +3 -0
- package/dist/features/list/public.js.map +1 -0
- package/dist/features/modal/adapters/inbound/Modal.d.ts.map +1 -1
- package/dist/features/modal/adapters/inbound/Modal.js +8 -8
- package/dist/features/modal/adapters/inbound/Modal.js.map +1 -1
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.d.ts.map +1 -1
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js +11 -12
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js.map +1 -1
- package/dist/features/surface/adapters/inbound/Surface.d.ts +1 -1
- package/dist/features/surface/adapters/inbound/Surface.d.ts.map +1 -1
- package/dist/features/surface/adapters/inbound/Surface.js +3 -3
- package/dist/features/surface/adapters/inbound/Surface.js.map +1 -1
- package/dist/features/tabs/adapters/inbound/Tab.js +3 -3
- package/dist/features/tabs/adapters/inbound/Tab.js.map +1 -1
- package/dist/features/tabs/adapters/inbound/TabList.d.ts.map +1 -1
- package/dist/features/tabs/adapters/inbound/TabList.js +3 -5
- package/dist/features/tabs/adapters/inbound/TabList.js.map +1 -1
- package/dist/features/tabs/adapters/inbound/Tabs.js +2 -2
- package/dist/features/tabs/adapters/inbound/Tabs.js.map +1 -1
- package/dist/features/toast/adapters/inbound/Toast.js +5 -5
- package/dist/features/toast/adapters/inbound/Toast.js.map +1 -1
- package/dist/features/toast/adapters/inbound/ToastProvider.js +3 -3
- package/dist/features/toast/adapters/inbound/ToastProvider.js.map +1 -1
- package/dist/index.d.ts +10 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -8
- package/dist/index.js.map +1 -1
- package/dist/primitives/button-base/ButtonBase.d.ts +1 -0
- package/dist/primitives/button-base/ButtonBase.d.ts.map +1 -1
- package/dist/primitives/button-base/ButtonBase.js +6 -5
- package/dist/primitives/button-base/ButtonBase.js.map +1 -1
- package/dist/primitives/button-base/types.d.ts +2 -2
- package/dist/primitives/button-base/types.d.ts.map +1 -1
- package/dist/primitives/button-base/types.js.map +1 -1
- package/dist/types/app-bar.d.ts +12 -0
- package/dist/types/app-bar.d.ts.map +1 -0
- package/dist/types/app-bar.js +2 -0
- package/dist/types/app-bar.js.map +1 -0
- package/dist/{components/field/types.d.ts → types/field.d.ts} +1 -1
- package/dist/types/field.d.ts.map +1 -0
- package/dist/types/field.js +2 -0
- package/dist/types/field.js.map +1 -0
- package/dist/types/layout.d.ts +15 -17
- package/dist/types/layout.d.ts.map +1 -1
- package/dist/types/layout.js.map +1 -1
- package/dist/types/list.d.ts +20 -0
- package/dist/types/list.d.ts.map +1 -0
- package/dist/types/list.js +2 -0
- package/dist/types/list.js.map +1 -0
- package/dist/types/surface.d.ts +2 -2
- package/dist/types/surface.d.ts.map +1 -1
- package/dist/types/surface.js.map +1 -1
- package/dist/{components/switch/types.d.ts → types/switch.d.ts} +4 -4
- package/dist/types/switch.d.ts.map +1 -0
- package/dist/types/switch.js +2 -0
- package/dist/types/switch.js.map +1 -0
- package/dist/utils/resolveViewStyles.d.ts +7 -0
- package/dist/utils/resolveViewStyles.d.ts.map +1 -0
- package/dist/utils/{resolveBoxStyles.js → resolveViewStyles.js} +11 -4
- package/dist/utils/resolveViewStyles.js.map +1 -0
- package/package.json +1 -1
- package/src/{layout → core/responsive}/Show.tsx +4 -1
- package/src/core/responsive/index.ts +1 -0
- package/src/features/app-bar/adapters/inbound/AppBar.tsx +69 -0
- package/src/features/app-bar/public.ts +2 -0
- package/src/features/badge/adapters/inbound/Badge.tsx +3 -3
- package/src/features/button/adapters/inbound/Button.tsx +8 -8
- package/src/features/button/adapters/inbound/IconButton.tsx +3 -3
- package/src/features/form/checkbox/adapters/inbound/Checkbox.tsx +7 -7
- package/src/features/form/field/adapters/inbound/Field.tsx +82 -0
- package/src/features/form/field/public.ts +2 -0
- package/src/features/form/radio/adapters/inbound/Radio.tsx +8 -8
- package/src/features/form/switch/adapters/inbound/Switch.tsx +123 -0
- package/src/features/form/switch/public.ts +2 -0
- package/src/features/form/text-input/adapters/inbound/TextInput.tsx +21 -5
- package/src/features/layout/adapters/inbound/Divider.tsx +2 -2
- package/src/features/layout/adapters/inbound/Grid.tsx +12 -14
- package/src/features/layout/adapters/inbound/ScrollView.tsx +102 -0
- package/src/features/layout/adapters/inbound/{Box.tsx → View.tsx} +9 -9
- package/src/features/layout/public.ts +3 -10
- package/src/features/list/adapters/inbound/List.tsx +9 -0
- package/src/features/list/adapters/inbound/ListItem.tsx +128 -0
- package/src/features/list/public.test.ts +13 -0
- package/src/features/list/public.ts +3 -0
- package/src/features/modal/adapters/inbound/Modal.tsx +11 -8
- package/src/features/popover-menu/adapters/inbound/PopoverMenu.tsx +11 -14
- package/src/features/surface/adapters/inbound/Surface.tsx +3 -3
- package/src/features/tabs/adapters/inbound/Tab.tsx +3 -3
- package/src/features/tabs/adapters/inbound/TabList.tsx +3 -6
- package/src/features/tabs/adapters/inbound/Tabs.tsx +2 -2
- package/src/features/toast/adapters/inbound/Toast.tsx +5 -5
- package/src/features/toast/adapters/inbound/ToastProvider.tsx +3 -3
- package/src/index.test.ts +26 -48
- package/src/index.ts +10 -21
- package/src/primitives/button-base/ButtonBase.tsx +6 -8
- package/src/primitives/button-base/types.ts +2 -2
- package/src/types/app-bar.ts +13 -0
- package/src/types/layout.ts +25 -20
- package/src/types/list.ts +22 -0
- package/src/types/surface.ts +2 -2
- package/src/{components/switch/types.ts → types/switch.ts} +3 -3
- package/src/utils/resolveViewStyles.test.ts +71 -0
- package/src/utils/{resolveBoxStyles.ts → resolveViewStyles.ts} +16 -9
- package/src/webAcceptance.test.tsx +8 -9
- package/dist/components/field/Field.d.ts.map +0 -1
- package/dist/components/field/Field.js +0 -26
- package/dist/components/field/Field.js.map +0 -1
- package/dist/components/field/index.d.ts +0 -3
- package/dist/components/field/index.d.ts.map +0 -1
- package/dist/components/field/index.js +0 -2
- package/dist/components/field/index.js.map +0 -1
- package/dist/components/field/types.d.ts.map +0 -1
- package/dist/components/field/types.js +0 -2
- package/dist/components/field/types.js.map +0 -1
- package/dist/components/helper-text/HelperText.d.ts +0 -4
- package/dist/components/helper-text/HelperText.d.ts.map +0 -1
- package/dist/components/helper-text/HelperText.js +0 -8
- package/dist/components/helper-text/HelperText.js.map +0 -1
- package/dist/components/helper-text/index.d.ts +0 -3
- package/dist/components/helper-text/index.d.ts.map +0 -1
- package/dist/components/helper-text/index.js +0 -2
- package/dist/components/helper-text/index.js.map +0 -1
- package/dist/components/helper-text/types.d.ts +0 -9
- package/dist/components/helper-text/types.d.ts.map +0 -1
- package/dist/components/helper-text/types.js +0 -2
- package/dist/components/helper-text/types.js.map +0 -1
- package/dist/components/label/Label.d.ts +0 -4
- package/dist/components/label/Label.d.ts.map +0 -1
- package/dist/components/label/Label.js +0 -11
- package/dist/components/label/Label.js.map +0 -1
- package/dist/components/label/index.d.ts +0 -3
- package/dist/components/label/index.d.ts.map +0 -1
- package/dist/components/label/index.js +0 -2
- package/dist/components/label/index.js.map +0 -1
- package/dist/components/label/types.d.ts +0 -10
- package/dist/components/label/types.d.ts.map +0 -1
- package/dist/components/label/types.js +0 -2
- package/dist/components/label/types.js.map +0 -1
- package/dist/components/list-item/ListItem.d.ts +0 -4
- package/dist/components/list-item/ListItem.d.ts.map +0 -1
- package/dist/components/list-item/ListItem.js +0 -43
- package/dist/components/list-item/ListItem.js.map +0 -1
- package/dist/components/list-item/index.d.ts +0 -3
- package/dist/components/list-item/index.d.ts.map +0 -1
- package/dist/components/list-item/index.js +0 -2
- package/dist/components/list-item/index.js.map +0 -1
- package/dist/components/list-item/types.d.ts +0 -11
- package/dist/components/list-item/types.d.ts.map +0 -1
- package/dist/components/list-item/types.js +0 -2
- package/dist/components/list-item/types.js.map +0 -1
- package/dist/components/switch/Switch.d.ts.map +0 -1
- package/dist/components/switch/Switch.js +0 -71
- package/dist/components/switch/Switch.js.map +0 -1
- package/dist/components/switch/index.d.ts +0 -3
- package/dist/components/switch/index.d.ts.map +0 -1
- package/dist/components/switch/index.js +0 -2
- package/dist/components/switch/index.js.map +0 -1
- package/dist/components/switch/types.d.ts.map +0 -1
- package/dist/components/switch/types.js +0 -2
- package/dist/components/switch/types.js.map +0 -1
- package/dist/components/textarea/Textarea.d.ts +0 -4
- package/dist/components/textarea/Textarea.d.ts.map +0 -1
- package/dist/components/textarea/Textarea.js +0 -6
- package/dist/components/textarea/Textarea.js.map +0 -1
- package/dist/components/textarea/index.d.ts +0 -3
- package/dist/components/textarea/index.d.ts.map +0 -1
- package/dist/components/textarea/index.js +0 -2
- package/dist/components/textarea/index.js.map +0 -1
- package/dist/components/textarea/types.d.ts +0 -5
- package/dist/components/textarea/types.d.ts.map +0 -1
- package/dist/components/textarea/types.js +0 -2
- package/dist/components/textarea/types.js.map +0 -1
- package/dist/features/layout/adapters/inbound/Box.d.ts +0 -5
- package/dist/features/layout/adapters/inbound/Box.d.ts.map +0 -1
- package/dist/features/layout/adapters/inbound/Box.js +0 -17
- package/dist/features/layout/adapters/inbound/Box.js.map +0 -1
- package/dist/features/layout/adapters/inbound/Container.d.ts +0 -5
- package/dist/features/layout/adapters/inbound/Container.d.ts.map +0 -1
- package/dist/features/layout/adapters/inbound/Container.js +0 -28
- package/dist/features/layout/adapters/inbound/Container.js.map +0 -1
- package/dist/features/layout/adapters/inbound/Stack.d.ts +0 -5
- package/dist/features/layout/adapters/inbound/Stack.d.ts.map +0 -1
- package/dist/features/layout/adapters/inbound/Stack.js +0 -27
- package/dist/features/layout/adapters/inbound/Stack.js.map +0 -1
- package/dist/layout/AppBar.d.ts +0 -13
- package/dist/layout/AppBar.d.ts.map +0 -1
- package/dist/layout/AppBar.js +0 -30
- package/dist/layout/AppBar.js.map +0 -1
- package/dist/layout/Center.d.ts +0 -7
- package/dist/layout/Center.d.ts.map +0 -1
- package/dist/layout/Center.js +0 -12
- package/dist/layout/Center.js.map +0 -1
- package/dist/layout/Inline.d.ts +0 -5
- package/dist/layout/Inline.d.ts.map +0 -1
- package/dist/layout/Inline.js +0 -6
- package/dist/layout/Inline.js.map +0 -1
- package/dist/layout/ScrollArea.d.ts +0 -9
- package/dist/layout/ScrollArea.d.ts.map +0 -1
- package/dist/layout/ScrollArea.js +0 -52
- package/dist/layout/ScrollArea.js.map +0 -1
- package/dist/layout/Show.d.ts.map +0 -1
- package/dist/layout/Show.js.map +0 -1
- package/dist/layout/Spacer.d.ts +0 -9
- package/dist/layout/Spacer.d.ts.map +0 -1
- package/dist/layout/Spacer.js +0 -12
- package/dist/layout/Spacer.js.map +0 -1
- package/dist/layout/Template.d.ts +0 -18
- package/dist/layout/Template.d.ts.map +0 -1
- package/dist/layout/Template.js +0 -36
- package/dist/layout/Template.js.map +0 -1
- package/dist/layout/index.d.ts +0 -15
- package/dist/layout/index.d.ts.map +0 -1
- package/dist/layout/index.js +0 -8
- package/dist/layout/index.js.map +0 -1
- package/dist/utils/resolveBoxStyles.d.ts +0 -7
- package/dist/utils/resolveBoxStyles.d.ts.map +0 -1
- package/dist/utils/resolveBoxStyles.js.map +0 -1
- package/src/components/field/Field.tsx +0 -51
- package/src/components/field/index.ts +0 -2
- package/src/components/helper-text/HelperText.tsx +0 -12
- package/src/components/helper-text/index.ts +0 -2
- package/src/components/helper-text/types.ts +0 -10
- package/src/components/label/Label.tsx +0 -23
- package/src/components/label/index.ts +0 -2
- package/src/components/label/types.ts +0 -11
- package/src/components/list-item/ListItem.tsx +0 -72
- package/src/components/list-item/index.ts +0 -2
- package/src/components/list-item/types.ts +0 -11
- package/src/components/switch/Switch.tsx +0 -118
- package/src/components/switch/index.ts +0 -2
- package/src/components/textarea/Textarea.tsx +0 -15
- package/src/components/textarea/index.ts +0 -2
- package/src/components/textarea/types.ts +0 -5
- package/src/features/layout/adapters/inbound/Container.tsx +0 -43
- package/src/features/layout/adapters/inbound/Stack.test.ts +0 -13
- package/src/features/layout/adapters/inbound/Stack.tsx +0 -44
- package/src/layout/AppBar.tsx +0 -60
- package/src/layout/Center.tsx +0 -22
- package/src/layout/Inline.tsx +0 -9
- package/src/layout/ScrollArea.tsx +0 -116
- package/src/layout/Spacer.tsx +0 -22
- package/src/layout/Template.tsx +0 -86
- package/src/layout/index.ts +0 -14
- package/src/utils/resolveBoxStyles.test.ts +0 -54
- /package/src/{components/field/types.ts → types/field.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ankhorage/surface
|
|
2
2
|
|
|
3
|
+
## 7.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 2977e37: Move the remaining legacy component APIs into canonical feature ownership. `Field` and `Switch` now live under the form capability, `List` and `ListItem` share the new list capability, and `Textarea`, `Label`, and `HelperText` are removed in favor of `TextInput multiline` and field-owned presentation.
|
|
8
|
+
|
|
9
|
+
## 6.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- 574a34b: Replace legacy layout aliases with canonical React Native-named `View` and `ScrollView` primitives, remove redundant layout presets, and move AppBar and responsive Show to their owning boundaries.
|
|
14
|
+
|
|
3
15
|
## 5.0.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# @ankhorage/surface
|
|
5
5
|
|
|
6
|
-
         
|
|
7
7
|
|
|
8
8
|
Cross-platform UI foundation for React Native and React Native Web. Provides theming, layout primitives, and core building blocks for modern apps.
|
|
9
9
|
|
|
@@ -34,7 +34,6 @@ Cross-platform UI foundation for React Native and React Native Web. Provides the
|
|
|
34
34
|
- [resolveResponsive sequence](././paradox/diagrams/sequences/resolve-responsive.mmd)
|
|
35
35
|
- [ResponsiveProvider sequence](././paradox/diagrams/sequences/responsive-provider.mmd)
|
|
36
36
|
- [Show sequence](././paradox/diagrams/sequences/show.mmd)
|
|
37
|
-
- [Stack sequence](././paradox/diagrams/sequences/stack.mmd)
|
|
38
37
|
- [Surface sequence](././paradox/diagrams/sequences/surface.mmd)
|
|
39
38
|
- [Switch sequence](././paradox/diagrams/sequences/switch.mmd)
|
|
40
39
|
- [TabList sequence](././paradox/diagrams/sequences/tab-list.mmd)
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { Responsive } from './types';
|
|
3
3
|
export interface ShowProps {
|
|
4
4
|
when: Responsive<boolean>;
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
fallback?: React.ReactNode;
|
|
7
7
|
}
|
|
8
|
+
/*** Conditionally renders one responsive subtree or its fallback. */
|
|
8
9
|
export declare function Show({ when, children, fallback }: ShowProps): React.JSX.Element;
|
|
9
10
|
//# sourceMappingURL=Show.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Show.d.ts","sourceRoot":"","sources":["../../../src/core/responsive/Show.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,qEAAqE;AACrE,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAe,EAAE,EAAE,SAAS,qBAIlE"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { resolveResponsive
|
|
2
|
+
import { resolveResponsive } from './resolve';
|
|
3
|
+
import { useResponsiveRuntime } from './ResponsiveProvider';
|
|
4
|
+
/*** Conditionally renders one responsive subtree or its fallback. */
|
|
3
5
|
export function Show({ when, children, fallback = null }) {
|
|
4
6
|
const { breakpoint } = useResponsiveRuntime();
|
|
5
7
|
const visible = resolveResponsive(when, breakpoint) ?? false;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Show.js","sourceRoot":"","sources":["../../../src/core/responsive/Show.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAS5D,qEAAqE;AACrE,MAAM,UAAU,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,EAAa;IACjE,MAAM,EAAE,UAAU,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC9C,MAAM,OAAO,GAAG,iBAAiB,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,KAAK,CAAC;IAC7D,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC;AAC9C,CAAC","sourcesContent":["import React from 'react';\n\nimport { resolveResponsive } from './resolve';\nimport { useResponsiveRuntime } from './ResponsiveProvider';\nimport type { Responsive } from './types';\n\nexport interface ShowProps {\n when: Responsive<boolean>;\n children: React.ReactNode;\n fallback?: React.ReactNode;\n}\n\n/*** Conditionally renders one responsive subtree or its fallback. */\nexport function Show({ when, children, fallback = null }: ShowProps) {\n const { breakpoint } = useResponsiveRuntime();\n const visible = resolveResponsive(when, breakpoint) ?? false;\n return <>{visible ? children : fallback}</>;\n}\n"]}
|
|
@@ -2,6 +2,7 @@ export { BREAKPOINT_ORDER, BREAKPOINTS } from './breakpoints';
|
|
|
2
2
|
export { getBreakpointFromWidth } from './getBreakpointFromWidth';
|
|
3
3
|
export { resolveResponsive } from './resolve';
|
|
4
4
|
export { ResponsiveProvider, useResponsiveRuntime } from './ResponsiveProvider';
|
|
5
|
+
export { Show, type ShowProps } from './Show';
|
|
5
6
|
export type { Breakpoint, Responsive, ResponsiveRuntime } from './types';
|
|
6
7
|
export { useBreakpoint } from './useBreakpoint';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/responsive/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAChF,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/responsive/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9C,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -2,5 +2,6 @@ export { BREAKPOINT_ORDER, BREAKPOINTS } from './breakpoints';
|
|
|
2
2
|
export { getBreakpointFromWidth } from './getBreakpointFromWidth';
|
|
3
3
|
export { resolveResponsive } from './resolve';
|
|
4
4
|
export { ResponsiveProvider, useResponsiveRuntime } from './ResponsiveProvider';
|
|
5
|
+
export { Show } from './Show';
|
|
5
6
|
export { useBreakpoint } from './useBreakpoint';
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/responsive/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/responsive/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,IAAI,EAAkB,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["export { BREAKPOINT_ORDER, BREAKPOINTS } from './breakpoints';\nexport { getBreakpointFromWidth } from './getBreakpointFromWidth';\nexport { resolveResponsive } from './resolve';\nexport { ResponsiveProvider, useResponsiveRuntime } from './ResponsiveProvider';\nexport { Show, type ShowProps } from './Show';\nexport type { Breakpoint, Responsive, ResponsiveRuntime } from './types';\nexport { useBreakpoint } from './useBreakpoint';\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AppBarProps } from '../../../../types/app-bar';
|
|
3
|
+
/*** Renders application chrome with optional safe-area padding and leading/trailing slots. */
|
|
4
|
+
export declare function AppBar({ leading, trailing, children, safeAreaTop, divider, contentStyle, bg, style, ...props }: AppBarProps): React.JSX.Element;
|
|
5
|
+
//# sourceMappingURL=AppBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppBar.d.ts","sourceRoot":"","sources":["../../../../../src/features/app-bar/adapters/inbound/AppBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAG7D,8FAA8F;AAC9F,wBAAgB,MAAM,CAAC,EACrB,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,WAAkB,EAClB,OAAe,EACf,YAAY,EACZ,EAAE,EACF,KAAK,EACL,GAAG,KAAK,EACT,EAAE,WAAW,qBAiCb"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, View as ReactNativeView } from 'react-native';
|
|
3
|
+
import { SafeAreaInsetsContext } from 'react-native-safe-area-context';
|
|
4
|
+
import { useTheme } from '../../../../theme/ThemeContext';
|
|
5
|
+
import { Divider, View } from '../../../layout/public';
|
|
6
|
+
/*** Renders application chrome with optional safe-area padding and leading/trailing slots. */
|
|
7
|
+
export function AppBar({ leading, trailing, children, safeAreaTop = true, divider = false, contentStyle, bg, style, ...props }) {
|
|
8
|
+
const { theme } = useTheme();
|
|
9
|
+
const insets = React.use(SafeAreaInsetsContext);
|
|
10
|
+
const topInset = safeAreaTop ? (insets?.top ?? 0) : 0;
|
|
11
|
+
const safeAreaStyle = topInset === 0 ? undefined : { paddingTop: topInset };
|
|
12
|
+
return (<View {...props} bg={bg ?? theme.semantics.surface.default} style={style}>
|
|
13
|
+
<ReactNativeView style={safeAreaStyle}>
|
|
14
|
+
<ReactNativeView style={[styles.content, resolveHorizontalPadding(theme.spacing.m), contentStyle]}>
|
|
15
|
+
{leading ? (<ReactNativeView style={[styles.accessory, resolveAccessoryMargin(theme.spacing.s, 'leading')]}>
|
|
16
|
+
{leading}
|
|
17
|
+
</ReactNativeView>) : null}
|
|
18
|
+
<ReactNativeView style={styles.center}>{children}</ReactNativeView>
|
|
19
|
+
{trailing ? (<ReactNativeView style={[styles.accessory, resolveAccessoryMargin(theme.spacing.s, 'trailing')]}>
|
|
20
|
+
{trailing}
|
|
21
|
+
</ReactNativeView>) : null}
|
|
22
|
+
</ReactNativeView>
|
|
23
|
+
{divider ? <Divider color={theme.semantics.neutral.divider} thickness={1}/> : null}
|
|
24
|
+
</ReactNativeView>
|
|
25
|
+
</View>);
|
|
26
|
+
}
|
|
27
|
+
/*** Resolves dynamic horizontal padding for the AppBar content row. */
|
|
28
|
+
function resolveHorizontalPadding(paddingHorizontal) {
|
|
29
|
+
return { paddingHorizontal };
|
|
30
|
+
}
|
|
31
|
+
/*** Resolves directional spacing for one AppBar accessory. */
|
|
32
|
+
function resolveAccessoryMargin(spacing, position) {
|
|
33
|
+
return position === 'leading' ? { marginRight: spacing } : { marginLeft: spacing };
|
|
34
|
+
}
|
|
35
|
+
const styles = StyleSheet.create({
|
|
36
|
+
accessory: { flexShrink: 0 },
|
|
37
|
+
center: { flex: 1, minWidth: 0 },
|
|
38
|
+
content: { alignItems: 'center', flexDirection: 'row', minHeight: 56 },
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=AppBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppBar.js","sourceRoot":"","sources":["../../../../../src/features/app-bar/adapters/inbound/AppBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM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M,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE;IAC5B,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE;IAChC,OAAO,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE;CACvE,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { StyleSheet, View as ReactNativeView, type ViewStyle } from 'react-native';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\n\nimport { useTheme } from '../../../../theme/ThemeContext';\nimport type { AppBarProps } from '../../../../types/app-bar';\nimport { Divider, View } from '../../../layout/public';\n\n/*** Renders application chrome with optional safe-area padding and leading/trailing slots. */\nexport function AppBar({\n leading,\n trailing,\n children,\n safeAreaTop = true,\n divider = false,\n contentStyle,\n bg,\n style,\n ...props\n}: AppBarProps) {\n const { theme } = useTheme();\n const insets = React.use(SafeAreaInsetsContext);\n const topInset = safeAreaTop ? (insets?.top ?? 0) : 0;\n const safeAreaStyle: ViewStyle | undefined =\n topInset === 0 ? undefined : { paddingTop: topInset };\n\n return (\n <View {...props} bg={bg ?? theme.semantics.surface.default} style={style}>\n <ReactNativeView style={safeAreaStyle}>\n <ReactNativeView\n style={[styles.content, resolveHorizontalPadding(theme.spacing.m), contentStyle]}\n >\n {leading ? (\n <ReactNativeView\n style={[styles.accessory, resolveAccessoryMargin(theme.spacing.s, 'leading')]}\n >\n {leading}\n </ReactNativeView>\n ) : null}\n <ReactNativeView style={styles.center}>{children}</ReactNativeView>\n {trailing ? (\n <ReactNativeView\n style={[styles.accessory, resolveAccessoryMargin(theme.spacing.s, 'trailing')]}\n >\n {trailing}\n </ReactNativeView>\n ) : null}\n </ReactNativeView>\n {divider ? <Divider color={theme.semantics.neutral.divider} thickness={1} /> : null}\n </ReactNativeView>\n </View>\n );\n}\n\n/*** Resolves dynamic horizontal padding for the AppBar content row. */\nfunction resolveHorizontalPadding(paddingHorizontal: number): ViewStyle {\n return { paddingHorizontal };\n}\n\n/*** Resolves directional spacing for one AppBar accessory. */\nfunction resolveAccessoryMargin(spacing: number, position: 'leading' | 'trailing'): ViewStyle {\n return position === 'leading' ? { marginRight: spacing } : { marginLeft: spacing };\n}\n\nconst styles = StyleSheet.create({\n accessory: { flexShrink: 0 },\n center: { flex: 1, minWidth: 0 },\n content: { alignItems: 'center', flexDirection: 'row', minHeight: 56 },\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/app-bar/public.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/features/app-bar/public.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC","sourcesContent":["export type { AppBarProps } from '../../types/app-bar';\nexport { AppBar } from './adapters/inbound/AppBar';\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { resolveButtonColors, resolveControlSize } from '../../../../internal/resolvers';
|
|
3
3
|
import { useTheme } from '../../../../theme/ThemeContext';
|
|
4
|
-
import {
|
|
4
|
+
import { View } from '../../../layout/public';
|
|
5
5
|
import { Text } from '../../../typography/public';
|
|
6
6
|
/*** Renders compact semantic status or metadata content. */
|
|
7
7
|
export function Badge({ content, variant = 'soft', color = 'primary', size = 's', testID, }) {
|
|
@@ -12,11 +12,11 @@ export function Badge({ content, variant = 'soft', color = 'primary', size = 's'
|
|
|
12
12
|
color,
|
|
13
13
|
state: { disabled: false, focused: false, hovered: false, pressed: false },
|
|
14
14
|
});
|
|
15
|
-
return (<
|
|
15
|
+
return (<View px={Math.max(theme.spacing.xs, controlSize.paddingHorizontal - 4)} py={Math.max(4, controlSize.paddingVertical - 2)} radius={controlSize.borderRadius} style={resolveBadgeStyle(colors.backgroundColor, colors.borderColor, variant)} testID={testID}>
|
|
16
16
|
<Text color={color} emphasis={variant === 'solid' ? 'inverse' : 'default'} variant="bodySmall" weight="medium">
|
|
17
17
|
{content}
|
|
18
18
|
</Text>
|
|
19
|
-
</
|
|
19
|
+
</View>);
|
|
20
20
|
}
|
|
21
21
|
/*** Resolves the visual container style for one badge variant. */
|
|
22
22
|
function resolveBadgeStyle(backgroundColor, borderColor, variant) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../../../../src/features/badge/adapters/inbound/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../../../../src/features/badge/adapters/inbound/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,4DAA4D;AAC5D,MAAM,UAAU,KAAK,CAAC,EACpB,OAAO,EACP,OAAO,GAAG,MAAM,EAChB,KAAK,GAAG,SAAS,EACjB,IAAI,GAAG,GAAG,EACV,MAAM,GACK;IACX,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC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C,CAAC,CAAC;KACzC,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport type { ViewStyle } from 'react-native';\n\nimport { resolveButtonColors, resolveControlSize } from '../../../../internal/resolvers';\nimport { useTheme } from '../../../../theme/ThemeContext';\nimport type { BadgeProps } from '../../../../types/badge';\nimport { View } from '../../../layout/public';\nimport { Text } from '../../../typography/public';\n\n/*** Renders compact semantic status or metadata content. */\nexport function Badge({\n content,\n variant = 'soft',\n color = 'primary',\n size = 's',\n testID,\n}: BadgeProps) {\n const { theme } = useTheme();\n const controlSize = resolveControlSize(theme, size);\n const colors = resolveButtonColors(theme, {\n variant,\n color,\n state: { disabled: false, focused: false, hovered: false, pressed: false },\n });\n\n return (\n <View\n px={Math.max(theme.spacing.xs, controlSize.paddingHorizontal - 4)}\n py={Math.max(4, controlSize.paddingVertical - 2)}\n radius={controlSize.borderRadius}\n style={resolveBadgeStyle(colors.backgroundColor, colors.borderColor, variant)}\n testID={testID}\n >\n <Text\n color={color}\n emphasis={variant === 'solid' ? 'inverse' : 'default'}\n variant=\"bodySmall\"\n weight=\"medium\"\n >\n {content}\n </Text>\n </View>\n );\n}\n\n/*** Resolves the visual container style for one badge variant. */\nfunction resolveBadgeStyle(\n backgroundColor: string,\n borderColor: string,\n variant: NonNullable<BadgeProps['variant']>,\n): ViewStyle {\n return {\n alignSelf: 'flex-start',\n backgroundColor,\n borderColor,\n borderWidth: variant === 'solid' ? 0 : 1,\n };\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ActivityIndicator, View } from 'react-native';
|
|
2
|
+
import { ActivityIndicator, View as ReactNativeView } from 'react-native';
|
|
3
3
|
import { resolveButtonColors, resolveControlSize, resolveIconSize, } from '../../../../internal/resolvers';
|
|
4
4
|
import { ButtonBase } from '../../../../primitives/button-base';
|
|
5
5
|
import { useTheme } from '../../../../theme/ThemeContext';
|
|
6
6
|
import { Icon } from '../../../icon/public';
|
|
7
|
-
import {
|
|
7
|
+
import { View } from '../../../layout/public';
|
|
8
8
|
import { Text } from '../../../typography/public';
|
|
9
9
|
/*** Renders the primary Surface action control with semantic visual states. */
|
|
10
10
|
export function Button({ children, variant = 'solid', color = 'primary', size = 'm', disabled = false, loading = false, leadingIcon, trailingIcon, fullWidth = false, onPress, testID, ...props }) {
|
|
@@ -21,19 +21,19 @@ function ButtonContent({ children, color, controlSize, fullWidth, leadingIcon, l
|
|
|
21
21
|
const colors = resolveButtonColors(theme, { variant, color, state });
|
|
22
22
|
const muted = colors.contentColor === theme.semantics.content.muted;
|
|
23
23
|
const iconSize = resolveIconSize(theme, size);
|
|
24
|
-
return (<
|
|
24
|
+
return (<View px={controlSize.paddingHorizontal} py={controlSize.paddingVertical} radius={controlSize.borderRadius} style={resolveButtonContentStyle(controlSize, colors, fullWidth, variant)}>
|
|
25
25
|
{loading ? (<ActivityIndicator color={colors.contentColor} size="small"/>) : (<>
|
|
26
|
-
{leadingIcon ? (<
|
|
26
|
+
{leadingIcon ? (<ReactNativeView style={resolveAccessoryStyle(theme.spacing.s, 'leading')}>
|
|
27
27
|
<Icon {...leadingIcon} color={colors.contentColor} size={iconSize}/>
|
|
28
|
-
</
|
|
28
|
+
</ReactNativeView>) : null}
|
|
29
29
|
<Text color={muted ? undefined : color} emphasis={muted ? 'muted' : variant === 'solid' ? 'inverse' : 'default'} variant={controlSize.textVariant} weight="semiBold">
|
|
30
30
|
{children}
|
|
31
31
|
</Text>
|
|
32
|
-
{trailingIcon ? (<
|
|
32
|
+
{trailingIcon ? (<ReactNativeView style={resolveAccessoryStyle(theme.spacing.s, 'trailing')}>
|
|
33
33
|
<Icon {...trailingIcon} color={colors.contentColor} size={iconSize}/>
|
|
34
|
-
</
|
|
34
|
+
</ReactNativeView>) : null}
|
|
35
35
|
</>)}
|
|
36
|
-
</
|
|
36
|
+
</View>);
|
|
37
37
|
}
|
|
38
38
|
/*** Resolves the outer ButtonBase layout style. */
|
|
39
39
|
function resolveButtonBaseStyle(fullWidth) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../../src/features/button/adapters/inbound/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../../src/features/button/adapters/inbound/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,IAAI,IAAI,eAAe,EAAkB,MAAM,cAAc,CAAC;AAE1F,OAAO,EAEL,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,GAChB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAG1D,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,+EAA+E;AAC/E,MAAM,UAAU,MAAM,CAAC,EACrB,QAAQ,EACR,OAAO,GAAG,OAAO,EACjB,KAAK,GAAG,SAAS,EACjB,IAAI,GAAG,GAAG,EACV,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK,EACf,WAAW,EACX,YAAY,EACZ,SAAS,GAAG,KAAK,EACjB,OAAO,EACP,MAAM,EACN,GAAG,KAAK,EACI;IACZ,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,WAAW,GAAG,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEpD,OAAO,CACL,CAAC,UAAU,CACT,IAAI,KAAK,CAAC,CACV,QAAQ,CAAC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CAAC,IAAI,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,EACrE;YAAA,EAAE,eAAe,CAAC,CACnB,CAAC,CAAC,CAAC,IAAI,CACV;QAAA,GAAG,CACJ,CACH;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC;AAED,mDAAmD;AACnD,SAAS,sBAAsB,CAAC,SAAkB;IAChD,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;AAC7D,CAAC;AAED,2DAA2D;AAC3D,SAAS,yBAAyB,CAChC,WAAkD,EAClD,MAA8C,EAC9C,SAAkB,EAClB,OAA4C;IAE5C,OAAO;QACL,UAAU,EAAE,QAAQ;QACpB,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,WAAW,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxC,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,QAAQ;QACxB,SAAS,EAAE,WAAW,CAAC,SAAS;QAChC,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;KACtC,CAAC;AACJ,CAAC;AAED,kEAAkE;AAClE,SAAS,qBAAqB,CAAC,OAAe,EAAE,QAAgC;IAC9E,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;AACrF,CAAC","sourcesContent":["import React from 'react';\nimport { ActivityIndicator, View as ReactNativeView, type ViewStyle } from 'react-native';\n\nimport {\n type InteractionState,\n resolveButtonColors,\n resolveControlSize,\n resolveIconSize,\n} from '../../../../internal/resolvers';\nimport { ButtonBase } from '../../../../primitives/button-base';\nimport { useTheme } from '../../../../theme/ThemeContext';\nimport type { SurfaceTheme } from '../../../../theme/types';\nimport type { ButtonProps } from '../../../../types/button';\nimport { Icon } from '../../../icon/public';\nimport { View } from '../../../layout/public';\nimport { Text } from '../../../typography/public';\n\n/*** Renders the primary Surface action control with semantic visual states. */\nexport function Button({\n children,\n variant = 'solid',\n color = 'primary',\n size = 'm',\n disabled = false,\n loading = false,\n leadingIcon,\n trailingIcon,\n fullWidth = false,\n onPress,\n testID,\n ...props\n}: ButtonProps) {\n const { theme } = useTheme();\n const controlSize = resolveControlSize(theme, size);\n\n return (\n <ButtonBase\n {...props}\n disabled={disabled || loading}\n onPress={onPress}\n style={resolveButtonBaseStyle(fullWidth)}\n testID={testID}\n >\n {(state) => (\n <ButtonContent\n color={color}\n controlSize={controlSize}\n fullWidth={fullWidth}\n leadingIcon={leadingIcon}\n loading={loading}\n size={size}\n state={state}\n theme={theme}\n trailingIcon={trailingIcon}\n variant={variant}\n >\n {children}\n </ButtonContent>\n )}\n </ButtonBase>\n );\n}\n\n/*** Renders Button content after interaction colors have been resolved. */\nfunction ButtonContent({\n children,\n color,\n controlSize,\n fullWidth,\n leadingIcon,\n loading,\n size,\n state,\n theme,\n trailingIcon,\n variant,\n}: ButtonContentProps) {\n const colors = resolveButtonColors(theme, { variant, color, state });\n const muted = colors.contentColor === theme.semantics.content.muted;\n const iconSize = resolveIconSize(theme, size);\n\n return (\n <View\n px={controlSize.paddingHorizontal}\n py={controlSize.paddingVertical}\n radius={controlSize.borderRadius}\n style={resolveButtonContentStyle(controlSize, colors, fullWidth, variant)}\n >\n {loading ? (\n <ActivityIndicator color={colors.contentColor} size=\"small\" />\n ) : (\n <>\n {leadingIcon ? (\n <ReactNativeView style={resolveAccessoryStyle(theme.spacing.s, 'leading')}>\n <Icon {...leadingIcon} color={colors.contentColor} size={iconSize} />\n </ReactNativeView>\n ) : null}\n <Text\n color={muted ? undefined : color}\n emphasis={muted ? 'muted' : variant === 'solid' ? 'inverse' : 'default'}\n variant={controlSize.textVariant}\n weight=\"semiBold\"\n >\n {children}\n </Text>\n {trailingIcon ? (\n <ReactNativeView style={resolveAccessoryStyle(theme.spacing.s, 'trailing')}>\n <Icon {...trailingIcon} color={colors.contentColor} size={iconSize} />\n </ReactNativeView>\n ) : null}\n </>\n )}\n </View>\n );\n}\n\n/*** Resolves the outer ButtonBase layout style. */\nfunction resolveButtonBaseStyle(fullWidth: boolean): ViewStyle {\n return { alignSelf: fullWidth ? 'stretch' : 'flex-start' };\n}\n\n/*** Resolves the themed Button content container style. */\nfunction resolveButtonContentStyle(\n controlSize: ReturnType<typeof resolveControlSize>,\n colors: ReturnType<typeof resolveButtonColors>,\n fullWidth: boolean,\n variant: NonNullable<ButtonProps['variant']>,\n): ViewStyle {\n return {\n alignItems: 'center',\n backgroundColor: colors.backgroundColor,\n borderColor: colors.borderColor,\n borderWidth: variant === 'solid' ? 0 : 1,\n flexDirection: 'row',\n justifyContent: 'center',\n minHeight: controlSize.minHeight,\n opacity: colors.opacity,\n width: fullWidth ? '100%' : undefined,\n };\n}\n\n/*** Resolves spacing around a leading or trailing Button icon. */\nfunction resolveAccessoryStyle(spacing: number, position: 'leading' | 'trailing'): ViewStyle {\n return position === 'leading' ? { marginRight: spacing } : { marginLeft: spacing };\n}\n\ninterface ButtonContentProps {\n children: ButtonProps['children'];\n color: NonNullable<ButtonProps['color']>;\n controlSize: ReturnType<typeof resolveControlSize>;\n fullWidth: boolean;\n leadingIcon: ButtonProps['leadingIcon'];\n loading: boolean;\n size: NonNullable<ButtonProps['size']>;\n state: InteractionState;\n theme: SurfaceTheme;\n trailingIcon: ButtonProps['trailingIcon'];\n variant: NonNullable<ButtonProps['variant']>;\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import { resolveButtonColors, resolveControlSize, resolveIconSize, } from '../..
|
|
|
3
3
|
import { ButtonBase } from '../../../../primitives/button-base';
|
|
4
4
|
import { useTheme } from '../../../../theme/ThemeContext';
|
|
5
5
|
import { Icon } from '../../../icon/public';
|
|
6
|
-
import {
|
|
6
|
+
import { View } from '../../../layout/public';
|
|
7
7
|
/*** Renders a compact accessible icon-only action control. */
|
|
8
8
|
export function IconButton({ icon, accessibilityLabel, variant = 'ghost', color = 'primary', size = 'm', disabled = false, onPress, testID, ...props }) {
|
|
9
9
|
const { theme } = useTheme();
|
|
@@ -11,9 +11,9 @@ export function IconButton({ icon, accessibilityLabel, variant = 'ghost', color
|
|
|
11
11
|
return (<ButtonBase {...props} accessibilityLabel={accessibilityLabel} disabled={disabled} onPress={onPress} testID={testID}>
|
|
12
12
|
{(state) => {
|
|
13
13
|
const colors = resolveButtonColors(theme, { color, state, variant });
|
|
14
|
-
return (<
|
|
14
|
+
return (<View radius={controlSize.borderRadius} style={resolveIconButtonStyle(controlSize, colors, variant)}>
|
|
15
15
|
<Icon {...icon} color={colors.contentColor} size={resolveIconSize(theme, size)}/>
|
|
16
|
-
</
|
|
16
|
+
</View>);
|
|
17
17
|
}}
|
|
18
18
|
</ButtonBase>);
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../../../../../src/features/button/adapters/inbound/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,GAChB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../../../../../src/features/button/adapters/inbound/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG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AAI,CAAC,CAAC,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,EACjF;UAAA,EAAE,IAAI,CAAC,CACR,CAAC;QACJ,CAAC,CACH;IAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC;AAED,gFAAgF;AAChF,SAAS,sBAAsB,CAC7B,WAAkD,EAClD,MAA8C,EAC9C,OAAgD;IAEhD,OAAO;QACL,UAAU,EAAE,QAAQ;QACpB,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,WAAW,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxC,cAAc,EAAE,QAAQ;QACxB,SAAS,EAAE,WAAW,CAAC,SAAS;QAChC,QAAQ,EAAE,WAAW,CAAC,SAAS;QAC/B,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport type { ViewStyle } from 'react-native';\n\nimport {\n resolveButtonColors,\n resolveControlSize,\n resolveIconSize,\n} from '../../../../internal/resolvers';\nimport { ButtonBase } from '../../../../primitives/button-base';\nimport { useTheme } from '../../../../theme/ThemeContext';\nimport type { IconButtonProps } from '../../../../types/button';\nimport { Icon } from '../../../icon/public';\nimport { View } from '../../../layout/public';\n\n/*** Renders a compact accessible icon-only action control. */\nexport function IconButton({\n icon,\n accessibilityLabel,\n variant = 'ghost',\n color = 'primary',\n size = 'm',\n disabled = false,\n onPress,\n testID,\n ...props\n}: IconButtonProps) {\n const { theme } = useTheme();\n const controlSize = resolveControlSize(theme, size);\n\n return (\n <ButtonBase\n {...props}\n accessibilityLabel={accessibilityLabel}\n disabled={disabled}\n onPress={onPress}\n testID={testID}\n >\n {(state) => {\n const colors = resolveButtonColors(theme, { color, state, variant });\n return (\n <View\n radius={controlSize.borderRadius}\n style={resolveIconButtonStyle(controlSize, colors, variant)}\n >\n <Icon {...icon} color={colors.contentColor} size={resolveIconSize(theme, size)} />\n </View>\n );\n }}\n </ButtonBase>\n );\n}\n\n/*** Resolves the visual container style for an IconButton interaction state. */\nfunction resolveIconButtonStyle(\n controlSize: ReturnType<typeof resolveControlSize>,\n colors: ReturnType<typeof resolveButtonColors>,\n variant: NonNullable<IconButtonProps['variant']>,\n): ViewStyle {\n return {\n alignItems: 'center',\n backgroundColor: colors.backgroundColor,\n borderColor: colors.borderColor,\n borderWidth: variant === 'solid' ? 0 : 1,\n justifyContent: 'center',\n minHeight: controlSize.minHeight,\n minWidth: controlSize.minHeight,\n opacity: colors.opacity,\n };\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import { resolveFieldState, resolveIndicatorSize, resolveSelectionControlColors,
|
|
|
3
3
|
import { useControllableState } from '../../../../../internal/useControllableState';
|
|
4
4
|
import { ButtonBase } from '../../../../../primitives/button-base';
|
|
5
5
|
import { useTheme } from '../../../../../theme/ThemeContext';
|
|
6
|
-
import {
|
|
6
|
+
import { View } from '../../../../layout/public';
|
|
7
7
|
import { Text } from '../../../../typography/public';
|
|
8
8
|
/*** Renders a controlled or uncontrolled accessible checkbox. */
|
|
9
9
|
export function Checkbox({ accessibilityLabel, checked, children, color = 'primary', defaultChecked = false, disabled = false, invalid = false, onCheckedChange, readOnly = false, size = 'm', testID, ...buttonProps }) {
|
|
@@ -58,16 +58,16 @@ function renderCheckboxContent(input) {
|
|
|
58
58
|
const indicatorSize = resolveIndicatorSize(input.size);
|
|
59
59
|
const labelEmphasis = colors.labelColor === theme.semantics.content.muted ? 'muted' : 'default';
|
|
60
60
|
const indicatorColor = fieldState.invalid ? 'error' : input.color;
|
|
61
|
-
return (<
|
|
62
|
-
<
|
|
61
|
+
return (<View style={resolveSelectionRowStyle(colors.opacity)}>
|
|
62
|
+
<View radius="s" style={resolveCheckboxIndicatorStyle(colors.backgroundColor, colors.borderColor, indicatorSize.checkbox)}>
|
|
63
63
|
{input.isChecked ? (<Text color={input.disabled ? undefined : indicatorColor} emphasis={input.disabled ? 'muted' : 'inverse'} variant="caption" weight="bold">
|
|
64
64
|
✓
|
|
65
65
|
</Text>) : null}
|
|
66
|
-
</
|
|
67
|
-
{input.children ? (<
|
|
66
|
+
</View>
|
|
67
|
+
{input.children ? (<View ml="s">
|
|
68
68
|
<Text emphasis={labelEmphasis}>{input.children}</Text>
|
|
69
|
-
</
|
|
70
|
-
</
|
|
69
|
+
</View>) : null}
|
|
70
|
+
</View>);
|
|
71
71
|
}
|
|
72
72
|
/*** Resolves the horizontal selection-control row style. */
|
|
73
73
|
function resolveSelectionRowStyle(opacity) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../../../../src/features/form/checkbox/adapters/inbound/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAEL,iBAAiB,EACjB,oBAAoB,EACpB,6BAA6B,EAC7B,kCAAkC,GACnC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAEnE,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAG7D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../../../../src/features/form/checkbox/adapters/inbound/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAEL,iBAAiB,EACjB,oBAAoB,EACpB,6BAA6B,EAC7B,kCAAkC,GACnC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAEnE,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAG7D,OAAO,EAAE,IAAI,EAAE,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AAK,CAAC,QAAQ,CAAC,EAAE,IAAI,CACvD;QAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,IAAI,CACV;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC;AAED,4DAA4D;AAC5D,SAAS,wBAAwB,CAAC,OAA2B;IAC3D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AACjE,CAAC;AAED,sEAAsE;AACtE,SAAS,6BAA6B,CACpC,eAAuB,EACvB,WAAmB,EACnB,IAAY;IAEZ,OAAO;QACL,UAAU,EAAE,QAAQ;QACpB,eAAe;QACf,WAAW;QACX,WAAW,EAAE,GAAG;QAChB,MAAM,EAAE,IAAI;QACZ,cAAc,EAAE,QAAQ;QACxB,KAAK,EAAE,IAAI;KACZ,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport type { ViewStyle } from 'react-native';\n\nimport {\n type InteractionState,\n resolveFieldState,\n resolveIndicatorSize,\n resolveSelectionControlColors,\n resolveSelectionControlNextChecked,\n} from '../../../../../internal/resolvers';\nimport { useControllableState } from '../../../../../internal/useControllableState';\nimport { ButtonBase } from '../../../../../primitives/button-base';\nimport type { ButtonBaseProps } from '../../../../../primitives/button-base/types';\nimport { useTheme } from '../../../../../theme/ThemeContext';\nimport type { SurfaceTheme } from '../../../../../theme/types';\nimport type { CheckboxProps } from '../../../../../types/checkbox';\nimport { View } from '../../../../layout/public';\nimport { Text } from '../../../../typography/public';\n\n/*** Renders a controlled or uncontrolled accessible checkbox. */\nexport function Checkbox({\n accessibilityLabel,\n checked,\n children,\n color = 'primary',\n defaultChecked = false,\n disabled = false,\n invalid = false,\n onCheckedChange,\n readOnly = false,\n size = 'm',\n testID,\n ...buttonProps\n}: CheckboxProps) {\n const { theme } = useTheme();\n const [isChecked, setChecked] = useControllableState<boolean>({\n value: checked,\n defaultValue: defaultChecked,\n onChange: onCheckedChange,\n });\n\n return (\n <CheckboxControl\n accessibilityLabel={accessibilityLabel}\n buttonProps={buttonProps}\n color={color}\n disabled={disabled}\n invalid={invalid}\n isChecked={isChecked}\n readOnly={readOnly}\n setChecked={setChecked}\n size={size}\n testID={testID}\n theme={theme}\n >\n {children}\n </CheckboxControl>\n );\n}\n\n/*** Owns the checkbox interaction boundary around resolved selection content. */\nfunction CheckboxControl({\n accessibilityLabel,\n buttonProps,\n children,\n color,\n disabled,\n invalid,\n isChecked,\n readOnly,\n setChecked,\n size,\n testID,\n theme,\n}: CheckboxControlProps) {\n const nextChecked = resolveSelectionControlNextChecked({\n checked: isChecked,\n disabled,\n kind: 'checkbox',\n readOnly,\n });\n\n return (\n <ButtonBase\n {...buttonProps}\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"checkbox\"\n accessibilityState={{ checked: isChecked }}\n disabled={disabled}\n onPress={nextChecked === null ? undefined : () => setChecked(nextChecked)}\n testID={testID}\n >\n {(interactionState) =>\n renderCheckboxContent({\n children,\n color,\n disabled,\n interactionState,\n invalid,\n isChecked,\n readOnly,\n size,\n theme,\n })\n }\n </ButtonBase>\n );\n}\n\n/*** Renders the checkbox indicator and optional label for one interaction state. */\nfunction renderCheckboxContent(input: CheckboxContentInput) {\n const { interactionState, theme } = input;\n const fieldState = resolveFieldState({\n disabled: input.disabled,\n focused: interactionState.focused,\n invalid: input.invalid,\n readOnly: input.readOnly,\n });\n const colors = resolveSelectionControlColors(theme, {\n checked: input.isChecked,\n fieldState,\n hovered: interactionState.hovered,\n pressed: interactionState.pressed,\n color: input.color,\n });\n const indicatorSize = resolveIndicatorSize(input.size);\n const labelEmphasis = colors.labelColor === theme.semantics.content.muted ? 'muted' : 'default';\n const indicatorColor = fieldState.invalid ? 'error' : input.color;\n\n return (\n <View style={resolveSelectionRowStyle(colors.opacity)}>\n <View\n radius=\"s\"\n style={resolveCheckboxIndicatorStyle(\n colors.backgroundColor,\n colors.borderColor,\n indicatorSize.checkbox,\n )}\n >\n {input.isChecked ? (\n <Text\n color={input.disabled ? undefined : indicatorColor}\n emphasis={input.disabled ? 'muted' : 'inverse'}\n variant=\"caption\"\n weight=\"bold\"\n >\n ✓\n </Text>\n ) : null}\n </View>\n {input.children ? (\n <View ml=\"s\">\n <Text emphasis={labelEmphasis}>{input.children}</Text>\n </View>\n ) : null}\n </View>\n );\n}\n\n/*** Resolves the horizontal selection-control row style. */\nfunction resolveSelectionRowStyle(opacity: number | undefined): ViewStyle {\n return { alignItems: 'center', flexDirection: 'row', opacity };\n}\n\n/*** Resolves checkbox indicator dimensions and interaction colors. */\nfunction resolveCheckboxIndicatorStyle(\n backgroundColor: string,\n borderColor: string,\n size: number,\n): ViewStyle {\n return {\n alignItems: 'center',\n backgroundColor,\n borderColor,\n borderWidth: 1.5,\n height: size,\n justifyContent: 'center',\n width: size,\n };\n}\n\ninterface CheckboxControlProps {\n accessibilityLabel: CheckboxProps['accessibilityLabel'];\n buttonProps: ButtonBaseProps;\n children: CheckboxProps['children'];\n color: NonNullable<CheckboxProps['color']>;\n disabled: boolean;\n invalid: boolean;\n isChecked: boolean;\n readOnly: boolean;\n setChecked: (checked: boolean) => void;\n size: NonNullable<CheckboxProps['size']>;\n testID: CheckboxProps['testID'];\n theme: SurfaceTheme;\n}\n\ninterface CheckboxContentInput {\n children: CheckboxProps['children'];\n color: NonNullable<CheckboxProps['color']>;\n disabled: boolean;\n interactionState: InteractionState;\n invalid: boolean;\n isChecked: boolean;\n readOnly: boolean;\n size: NonNullable<CheckboxProps['size']>;\n theme: SurfaceTheme;\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { FieldProps } from '
|
|
2
|
+
import type { FieldProps } from '../../../../../types/field';
|
|
3
|
+
/*** Composes a control with its label and helper or error message. */
|
|
3
4
|
export declare function Field({ children, label, helperText, errorText, required, disabled, invalid, readOnly, testID, }: FieldProps): React.JSX.Element;
|
|
4
5
|
//# sourceMappingURL=Field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../../../../../src/features/form/field/adapters/inbound/Field.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAI7D,sEAAsE;AACtE,wBAAgB,KAAK,CAAC,EACpB,QAAQ,EACR,KAAK,EACL,UAAU,EACV,SAAS,EACT,QAAgB,EAChB,QAAgB,EAChB,OAAe,EACf,QAAgB,EAChB,MAAM,GACP,EAAE,UAAU,qBAcZ"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { resolveFieldPresentation, resolveFieldState, } from '../../../../../internal/resolvers';
|
|
3
|
+
import { View } from '../../../../layout/public';
|
|
4
|
+
import { Text } from '../../../../typography/public';
|
|
5
|
+
/*** Composes a control with its label and helper or error message. */
|
|
6
|
+
export function Field({ children, label, helperText, errorText, required = false, disabled = false, invalid = false, readOnly = false, testID, }) {
|
|
7
|
+
const hasErrorText = Boolean(errorText);
|
|
8
|
+
const presentation = resolveFieldPresentation(resolveFieldState({ disabled, invalid: invalid || hasErrorText, readOnly }));
|
|
9
|
+
const message = hasErrorText ? errorText : helperText;
|
|
10
|
+
return (<View gap="xs" testID={testID}>
|
|
11
|
+
{renderFieldLabel(label, required, presentation)}
|
|
12
|
+
<View>{children}</View>
|
|
13
|
+
{renderFieldMessage(message, presentation)}
|
|
14
|
+
</View>);
|
|
15
|
+
}
|
|
16
|
+
/*** Renders an optional field label and required indicator. */
|
|
17
|
+
function renderFieldLabel(label, required, presentation) {
|
|
18
|
+
if (label === undefined || label === null)
|
|
19
|
+
return null;
|
|
20
|
+
const labelContent = typeof label === 'string' || typeof label === 'number' ? (<Text color={presentation.labelColor} emphasis={presentation.labelEmphasis} variant="label" weight="medium">
|
|
21
|
+
{label}
|
|
22
|
+
</Text>) : (label);
|
|
23
|
+
return (<View align="center" direction="row" gap="xs">
|
|
24
|
+
<View flex={1}>{labelContent}</View>
|
|
25
|
+
{required ? (<Text color="error" variant="label" weight="medium">
|
|
26
|
+
*
|
|
27
|
+
</Text>) : null}
|
|
28
|
+
</View>);
|
|
29
|
+
}
|
|
30
|
+
/*** Renders an optional helper or error message using field presentation semantics. */
|
|
31
|
+
function renderFieldMessage(message, presentation) {
|
|
32
|
+
if (message === undefined || message === null || message === '')
|
|
33
|
+
return null;
|
|
34
|
+
if (typeof message !== 'string' && typeof message !== 'number')
|
|
35
|
+
return message;
|
|
36
|
+
return (<Text color={presentation.helperColor} emphasis={presentation.helperEmphasis} variant="caption">
|
|
37
|
+
{message}
|
|
38
|
+
</Text>);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=Field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../../../../../../src/features/form/field/adapters/inbound/Field.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAEL,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,sEAAsE;AACtE,MAAM,UAAU,KAAK,CAAC,EACpB,QAAQ,EACR,KAAK,EACL,UAAU,EACV,SAAS,EACT,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,MAAM,GACK;IACX,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IACxC,MAAM,YAAY,GAAG,wBAAwB,CAC3C,iBAAiB,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,QAAQ,EAAE,CAAC,CAC5E,CAAC;IACF,MAAM,OAAO,GAAG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AC,QAAQ,CACjD;;QACF,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,IAAI,CACV;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC;AAED,uFAAuF;AACvF,SAAS,kBAAkB,CAAC,OAAwB,EAAE,YAAuC;IAC3F,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IAC7E,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC;IAE/E,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,SAAS,CAC7F;MAAA,CAAC,OAAO,CACV;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport {\n type ResolvedFieldPresentation,\n resolveFieldPresentation,\n resolveFieldState,\n} from '../../../../../internal/resolvers';\nimport type { FieldProps } from '../../../../../types/field';\nimport { View } from '../../../../layout/public';\nimport { Text } from '../../../../typography/public';\n\n/*** Composes a control with its label and helper or error message. */\nexport function Field({\n children,\n label,\n helperText,\n errorText,\n required = false,\n disabled = false,\n invalid = false,\n readOnly = false,\n testID,\n}: FieldProps) {\n const hasErrorText = Boolean(errorText);\n const presentation = resolveFieldPresentation(\n resolveFieldState({ disabled, invalid: invalid || hasErrorText, readOnly }),\n );\n const message = hasErrorText ? errorText : helperText;\n\n return (\n <View gap=\"xs\" testID={testID}>\n {renderFieldLabel(label, required, presentation)}\n <View>{children}</View>\n {renderFieldMessage(message, presentation)}\n </View>\n );\n}\n\n/*** Renders an optional field label and required indicator. */\nfunction renderFieldLabel(\n label: React.ReactNode,\n required: boolean,\n presentation: ResolvedFieldPresentation,\n) {\n if (label === undefined || label === null) return null;\n const labelContent =\n typeof label === 'string' || typeof label === 'number' ? (\n <Text\n color={presentation.labelColor}\n emphasis={presentation.labelEmphasis}\n variant=\"label\"\n weight=\"medium\"\n >\n {label}\n </Text>\n ) : (\n label\n );\n\n return (\n <View align=\"center\" direction=\"row\" gap=\"xs\">\n <View flex={1}>{labelContent}</View>\n {required ? (\n <Text color=\"error\" variant=\"label\" weight=\"medium\">\n *\n </Text>\n ) : null}\n </View>\n );\n}\n\n/*** Renders an optional helper or error message using field presentation semantics. */\nfunction renderFieldMessage(message: React.ReactNode, presentation: ResolvedFieldPresentation) {\n if (message === undefined || message === null || message === '') return null;\n if (typeof message !== 'string' && typeof message !== 'number') return message;\n\n return (\n <Text color={presentation.helperColor} emphasis={presentation.helperEmphasis} variant=\"caption\">\n {message}\n </Text>\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../../src/features/form/field/public.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../../src/features/form/field/public.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["export type { FieldProps } from '../../../types/field';\nexport { Field } from './adapters/inbound/Field';\n"]}
|
|
@@ -3,7 +3,7 @@ import { resolveFieldState, resolveIndicatorSize, resolveSelectionControlColors,
|
|
|
3
3
|
import { useControllableState } from '../../../../../internal/useControllableState';
|
|
4
4
|
import { ButtonBase } from '../../../../../primitives/button-base';
|
|
5
5
|
import { useTheme } from '../../../../../theme/ThemeContext';
|
|
6
|
-
import {
|
|
6
|
+
import { View } from '../../../../layout/public';
|
|
7
7
|
import { Text } from '../../../../typography/public';
|
|
8
8
|
import { isRadioTextContent } from '../../utils/isRadioTextContent';
|
|
9
9
|
/*** Renders one accessible radio control with text or structured label content. */
|
|
@@ -59,14 +59,14 @@ function renderRadioContent(input) {
|
|
|
59
59
|
const indicatorSize = resolveIndicatorSize(input.size);
|
|
60
60
|
const labelEmphasis = colors.labelColor === theme.semantics.content.muted ? 'muted' : 'default';
|
|
61
61
|
const hasContent = input.children !== undefined && input.children !== null && input.children !== false;
|
|
62
|
-
return (<
|
|
63
|
-
<
|
|
64
|
-
{input.isChecked ? (<
|
|
65
|
-
</
|
|
66
|
-
{hasContent ? (<
|
|
62
|
+
return (<View style={resolveSelectionRowStyle(colors.opacity)}>
|
|
63
|
+
<View radius="full" style={resolveRadioIndicatorStyle(colors.backgroundColor, colors.borderColor, indicatorSize.radio)}>
|
|
64
|
+
{input.isChecked ? (<View radius="full" style={resolveRadioDotStyle(colors.indicatorColor, indicatorSize.radioDot)}/>) : null}
|
|
65
|
+
</View>
|
|
66
|
+
{hasContent ? (<View flex={1} ml="s">
|
|
67
67
|
{isRadioTextContent(input.children) ? (<Text emphasis={labelEmphasis}>{input.children}</Text>) : (input.children)}
|
|
68
|
-
</
|
|
69
|
-
</
|
|
68
|
+
</View>) : null}
|
|
69
|
+
</View>);
|
|
70
70
|
}
|
|
71
71
|
/*** Resolves the horizontal selection-control row style. */
|
|
72
72
|
function resolveSelectionRowStyle(opacity) {
|