@ankhorage/surface 4.2.0 → 4.2.1
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 +6 -0
- package/dist/components/field/Field.js +1 -1
- package/dist/components/field/Field.js.map +1 -1
- package/dist/components/helper-text/HelperText.js +1 -1
- package/dist/components/helper-text/HelperText.js.map +1 -1
- package/dist/components/label/Label.js +1 -1
- package/dist/components/label/Label.js.map +1 -1
- package/dist/components/list-item/ListItem.js +2 -2
- package/dist/components/list-item/ListItem.js.map +1 -1
- package/dist/components/menu/Menu.d.ts.map +1 -1
- package/dist/components/menu/Menu.js +4 -2
- package/dist/components/menu/Menu.js.map +1 -1
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +2 -1
- package/dist/components/modal/Modal.js.map +1 -1
- package/dist/components/switch/Switch.js +2 -2
- package/dist/components/switch/Switch.js.map +1 -1
- package/dist/components/tabs/Tab.js +2 -2
- package/dist/components/tabs/Tab.js.map +1 -1
- package/dist/components/tabs/TabList.js +1 -1
- package/dist/components/tabs/TabList.js.map +1 -1
- package/dist/components/tabs/Tabs.js +1 -1
- package/dist/components/tabs/Tabs.js.map +1 -1
- package/dist/components/textarea/Textarea.js +1 -1
- package/dist/components/textarea/Textarea.js.map +1 -1
- package/dist/components/textarea/types.d.ts +1 -1
- package/dist/components/textarea/types.d.ts.map +1 -1
- package/dist/components/textarea/types.js.map +1 -1
- package/dist/components/toast/Toast.d.ts.map +1 -1
- package/dist/components/toast/Toast.js +4 -2
- package/dist/components/toast/Toast.js.map +1 -1
- package/dist/components/toast/ToastProvider.js +1 -1
- package/dist/components/toast/ToastProvider.js.map +1 -1
- package/dist/components/tooltip/Tooltip.js +2 -2
- package/dist/components/tooltip/Tooltip.js.map +1 -1
- package/dist/examples/DocsExamples.js +6 -6
- package/dist/examples/DocsExamples.js.map +1 -1
- package/dist/features/badge/adapters/inbound/Badge.d.ts +5 -0
- package/dist/features/badge/adapters/inbound/Badge.d.ts.map +1 -0
- package/dist/features/badge/adapters/inbound/Badge.js +30 -0
- package/dist/features/badge/adapters/inbound/Badge.js.map +1 -0
- package/dist/features/badge/public.d.ts +3 -0
- package/dist/features/badge/public.d.ts.map +1 -0
- package/dist/features/badge/public.js +2 -0
- package/dist/features/badge/public.js.map +1 -0
- package/dist/{components/button → features/button/adapters/inbound}/Button.d.ts +2 -1
- package/dist/features/button/adapters/inbound/Button.d.ts.map +1 -0
- package/dist/features/button/adapters/inbound/Button.js +60 -0
- package/dist/features/button/adapters/inbound/Button.js.map +1 -0
- package/dist/{components/icon-button → features/button/adapters/inbound}/IconButton.d.ts +2 -1
- package/dist/features/button/adapters/inbound/IconButton.d.ts.map +1 -0
- package/dist/features/button/adapters/inbound/IconButton.js +33 -0
- package/dist/features/button/adapters/inbound/IconButton.js.map +1 -0
- package/dist/features/button/public.d.ts +4 -0
- package/dist/features/button/public.d.ts.map +1 -0
- package/dist/features/button/public.js +3 -0
- package/dist/features/button/public.js.map +1 -0
- package/dist/features/card/adapters/inbound/Card.d.ts +5 -0
- package/dist/features/card/adapters/inbound/Card.d.ts.map +1 -0
- package/dist/features/card/adapters/inbound/Card.js +44 -0
- package/dist/features/card/adapters/inbound/Card.js.map +1 -0
- package/dist/features/card/public.d.ts +3 -0
- package/dist/features/card/public.d.ts.map +1 -0
- package/dist/features/card/public.js +2 -0
- package/dist/features/card/public.js.map +1 -0
- package/dist/features/form/checkbox/adapters/inbound/Checkbox.d.ts +5 -0
- package/dist/features/form/checkbox/adapters/inbound/Checkbox.d.ts.map +1 -0
- package/dist/features/form/checkbox/adapters/inbound/Checkbox.js +88 -0
- package/dist/features/form/checkbox/adapters/inbound/Checkbox.js.map +1 -0
- package/dist/features/form/checkbox/public.d.ts +3 -0
- package/dist/features/form/checkbox/public.d.ts.map +1 -0
- package/dist/features/form/checkbox/public.js +2 -0
- package/dist/features/form/checkbox/public.js.map +1 -0
- package/dist/features/form/radio/adapters/inbound/Radio.d.ts +5 -0
- package/dist/features/form/radio/adapters/inbound/Radio.d.ts.map +1 -0
- package/dist/features/form/radio/adapters/inbound/Radio.js +91 -0
- package/dist/features/form/radio/adapters/inbound/Radio.js.map +1 -0
- package/dist/features/form/radio/public.d.ts +3 -0
- package/dist/features/form/radio/public.d.ts.map +1 -0
- package/dist/features/form/radio/public.js +2 -0
- package/dist/features/form/radio/public.js.map +1 -0
- package/dist/features/form/radio/utils/isRadioTextContent.d.ts +4 -0
- package/dist/features/form/radio/utils/isRadioTextContent.d.ts.map +1 -0
- package/dist/features/form/radio/utils/isRadioTextContent.js +5 -0
- package/dist/features/form/radio/utils/isRadioTextContent.js.map +1 -0
- package/dist/features/form/text-input/adapters/inbound/TextInput.d.ts +5 -0
- package/dist/features/form/text-input/adapters/inbound/TextInput.d.ts.map +1 -0
- package/dist/features/form/text-input/adapters/inbound/TextInput.js +41 -0
- package/dist/features/form/text-input/adapters/inbound/TextInput.js.map +1 -0
- package/dist/features/form/text-input/public.d.ts +3 -0
- package/dist/features/form/text-input/public.d.ts.map +1 -0
- package/dist/features/form/text-input/public.js +2 -0
- package/dist/features/form/text-input/public.js.map +1 -0
- package/dist/features/form/text-input/utils/resolveTextInputPresentation.d.ts +15 -0
- package/dist/features/form/text-input/utils/resolveTextInputPresentation.d.ts.map +1 -0
- package/dist/features/form/text-input/utils/resolveTextInputPresentation.js +56 -0
- package/dist/features/form/text-input/utils/resolveTextInputPresentation.js.map +1 -0
- package/dist/features/icon/adapters/inbound/Icon.d.ts +4 -0
- package/dist/features/icon/adapters/inbound/Icon.d.ts.map +1 -0
- package/dist/{primitives/icon → features/icon/adapters/inbound}/Icon.js +3 -3
- package/dist/features/icon/adapters/inbound/Icon.js.map +1 -0
- package/dist/features/icon/adapters/inbound/PortableIcon.d.ts +19 -0
- package/dist/features/icon/adapters/inbound/PortableIcon.d.ts.map +1 -0
- package/dist/{primitives/icon → features/icon/adapters/inbound}/PortableIcon.js +37 -43
- package/dist/features/icon/adapters/inbound/PortableIcon.js.map +1 -0
- package/dist/features/icon/constants.d.ts +2 -0
- package/dist/features/icon/constants.d.ts.map +1 -0
- package/dist/features/icon/constants.js +8 -0
- package/dist/features/icon/constants.js.map +1 -0
- package/dist/features/icon/public.d.ts +4 -0
- package/dist/features/icon/public.d.ts.map +1 -0
- package/dist/features/icon/public.js +3 -0
- package/dist/features/icon/public.js.map +1 -0
- package/dist/{primitives/image → features/image/adapters/inbound}/Image.d.ts +2 -1
- package/dist/features/image/adapters/inbound/Image.d.ts.map +1 -0
- package/dist/features/image/adapters/inbound/Image.js +28 -0
- package/dist/features/image/adapters/inbound/Image.js.map +1 -0
- package/dist/features/image/public.d.ts +3 -0
- package/dist/features/image/public.d.ts.map +1 -0
- package/dist/features/image/public.js +2 -0
- package/dist/features/image/public.js.map +1 -0
- package/dist/features/image/utils/getSourceKey.d.ts +4 -0
- package/dist/features/image/utils/getSourceKey.d.ts.map +1 -0
- package/dist/features/image/utils/getSourceKey.js +33 -0
- package/dist/features/image/utils/getSourceKey.js.map +1 -0
- package/dist/features/image/utils/normalizeSource.d.ts +5 -0
- package/dist/features/image/utils/normalizeSource.d.ts.map +1 -0
- package/dist/features/image/utils/normalizeSource.js +9 -0
- package/dist/features/image/utils/normalizeSource.js.map +1 -0
- package/dist/features/image/utils/resolveAccessibilityLabel.d.ts +4 -0
- package/dist/features/image/utils/resolveAccessibilityLabel.d.ts.map +1 -0
- package/dist/features/image/utils/resolveAccessibilityLabel.js +5 -0
- package/dist/features/image/utils/resolveAccessibilityLabel.js.map +1 -0
- package/dist/features/image/utils/resolveAlt.d.ts +4 -0
- package/dist/features/image/utils/resolveAlt.d.ts.map +1 -0
- package/dist/features/image/utils/resolveAlt.js +5 -0
- package/dist/features/image/utils/resolveAlt.js.map +1 -0
- package/dist/features/image/utils/resolveImageStyle.d.ts +6 -0
- package/dist/features/image/utils/resolveImageStyle.d.ts.map +1 -0
- package/dist/features/image/utils/resolveImageStyle.js +15 -0
- package/dist/features/image/utils/resolveImageStyle.js.map +1 -0
- package/dist/features/image/utils/resolveRenderedSource.d.ts +4 -0
- package/dist/features/image/utils/resolveRenderedSource.d.ts.map +1 -0
- package/dist/features/image/utils/resolveRenderedSource.js +7 -0
- package/dist/features/image/utils/resolveRenderedSource.js.map +1 -0
- package/dist/features/image/utils/resolveResizeMode.d.ts +5 -0
- package/dist/features/image/utils/resolveResizeMode.d.ts.map +1 -0
- package/dist/features/image/utils/resolveResizeMode.js +5 -0
- package/dist/features/image/utils/resolveResizeMode.js.map +1 -0
- package/dist/features/keyboard-avoiding-view/adapters/inbound/KeyboardAvoidingView.d.ts +5 -0
- package/dist/features/keyboard-avoiding-view/adapters/inbound/KeyboardAvoidingView.d.ts.map +1 -0
- package/dist/{layout → features/keyboard-avoiding-view/adapters/inbound}/KeyboardAvoidingView.js +2 -2
- package/dist/features/keyboard-avoiding-view/adapters/inbound/KeyboardAvoidingView.js.map +1 -0
- package/dist/features/keyboard-avoiding-view/public.d.ts +3 -0
- package/dist/features/keyboard-avoiding-view/public.d.ts.map +1 -0
- package/dist/features/keyboard-avoiding-view/public.js +2 -0
- package/dist/features/keyboard-avoiding-view/public.js.map +1 -0
- package/dist/features/layout/adapters/inbound/Box.d.ts +5 -0
- package/dist/features/layout/adapters/inbound/Box.d.ts.map +1 -0
- package/dist/{layout → features/layout/adapters/inbound}/Box.js +5 -4
- package/dist/features/layout/adapters/inbound/Box.js.map +1 -0
- package/dist/features/layout/adapters/inbound/Container.d.ts +5 -0
- package/dist/features/layout/adapters/inbound/Container.d.ts.map +1 -0
- package/dist/features/layout/adapters/inbound/Container.js +28 -0
- package/dist/features/layout/adapters/inbound/Container.js.map +1 -0
- package/dist/features/layout/adapters/inbound/Divider.d.ts +5 -0
- package/dist/features/layout/adapters/inbound/Divider.d.ts.map +1 -0
- package/dist/{layout → features/layout/adapters/inbound}/Divider.js +1 -0
- package/dist/features/layout/adapters/inbound/Divider.js.map +1 -0
- package/dist/features/layout/adapters/inbound/Grid.d.ts +5 -0
- package/dist/features/layout/adapters/inbound/Grid.d.ts.map +1 -0
- package/dist/features/layout/adapters/inbound/Grid.js +48 -0
- package/dist/features/layout/adapters/inbound/Grid.js.map +1 -0
- package/dist/features/layout/adapters/inbound/Stack.d.ts +5 -0
- package/dist/features/layout/adapters/inbound/Stack.d.ts.map +1 -0
- package/dist/{layout → features/layout/adapters/inbound}/Stack.js +4 -3
- package/dist/features/layout/adapters/inbound/Stack.js.map +1 -0
- package/dist/features/layout/public.d.ts +7 -0
- package/dist/features/layout/public.d.ts.map +1 -0
- package/dist/features/layout/public.js +6 -0
- package/dist/features/layout/public.js.map +1 -0
- package/dist/features/surface/adapters/inbound/Surface.d.ts +5 -0
- package/dist/features/surface/adapters/inbound/Surface.d.ts.map +1 -0
- package/dist/{layout → features/surface/adapters/inbound}/Surface.js +17 -28
- package/dist/features/surface/adapters/inbound/Surface.js.map +1 -0
- package/dist/features/surface/public.d.ts +3 -0
- package/dist/features/surface/public.d.ts.map +1 -0
- package/dist/features/surface/public.js +2 -0
- package/dist/features/surface/public.js.map +1 -0
- package/dist/features/typography/adapters/inbound/Heading.d.ts +5 -0
- package/dist/features/typography/adapters/inbound/Heading.d.ts.map +1 -0
- package/dist/features/typography/adapters/inbound/Heading.js +29 -0
- package/dist/features/typography/adapters/inbound/Heading.js.map +1 -0
- package/dist/{primitives/text → features/typography/adapters/inbound}/Text.d.ts +2 -1
- package/dist/features/typography/adapters/inbound/Text.d.ts.map +1 -0
- package/dist/{primitives/text → features/typography/adapters/inbound}/Text.js +18 -25
- package/dist/features/typography/adapters/inbound/Text.js.map +1 -0
- package/dist/features/typography/public.d.ts +4 -0
- package/dist/features/typography/public.d.ts.map +1 -0
- package/dist/features/typography/public.js +3 -0
- package/dist/features/typography/public.js.map +1 -0
- package/dist/features/typography/utils/resolveHeadingTextStyle.d.ts +7 -0
- package/dist/features/typography/utils/resolveHeadingTextStyle.d.ts.map +1 -0
- package/dist/features/typography/utils/resolveHeadingTextStyle.js +10 -0
- package/dist/features/typography/utils/resolveHeadingTextStyle.js.map +1 -0
- package/dist/index.d.ts +24 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -11
- package/dist/index.js.map +1 -1
- package/dist/layout/AppBar.d.ts +1 -1
- package/dist/layout/AppBar.d.ts.map +1 -1
- package/dist/layout/AppBar.js +1 -2
- package/dist/layout/AppBar.js.map +1 -1
- package/dist/layout/Center.d.ts +1 -1
- package/dist/layout/Center.d.ts.map +1 -1
- package/dist/layout/Center.js +1 -1
- package/dist/layout/Center.js.map +1 -1
- package/dist/layout/Inline.d.ts +1 -1
- package/dist/layout/Inline.d.ts.map +1 -1
- package/dist/layout/Inline.js +1 -1
- package/dist/layout/Inline.js.map +1 -1
- package/dist/layout/ScrollArea.d.ts +1 -1
- package/dist/layout/ScrollArea.d.ts.map +1 -1
- package/dist/layout/ScrollArea.js +1 -1
- package/dist/layout/ScrollArea.js.map +1 -1
- package/dist/layout/Spacer.d.ts +1 -1
- package/dist/layout/Spacer.d.ts.map +1 -1
- package/dist/layout/Spacer.js +1 -1
- package/dist/layout/Spacer.js.map +1 -1
- package/dist/layout/Template.d.ts +2 -2
- package/dist/layout/Template.d.ts.map +1 -1
- package/dist/layout/Template.js +2 -2
- package/dist/layout/Template.js.map +1 -1
- package/dist/layout/index.d.ts +0 -14
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +0 -7
- package/dist/layout/index.js.map +1 -1
- package/dist/primitives/button-base/ButtonBase.js +1 -1
- package/dist/primitives/button-base/ButtonBase.js.map +1 -1
- package/dist/primitives/button-base/types.d.ts +1 -1
- package/dist/primitives/button-base/types.d.ts.map +1 -1
- package/dist/primitives/button-base/types.js.map +1 -1
- package/dist/types/badge.d.ts +12 -0
- package/dist/types/badge.d.ts.map +1 -0
- package/dist/types/badge.js +2 -0
- package/dist/types/badge.js.map +1 -0
- package/dist/types/button.d.ts +25 -0
- package/dist/types/button.d.ts.map +1 -0
- package/dist/types/button.js +2 -0
- package/dist/types/button.js.map +1 -0
- package/dist/{components/card/types.d.ts → types/card.d.ts} +2 -2
- package/dist/types/card.d.ts.map +1 -0
- package/dist/types/card.js +2 -0
- package/dist/types/card.js.map +1 -0
- package/dist/{components/checkbox/types.d.ts → types/checkbox.d.ts} +4 -4
- package/dist/types/checkbox.d.ts.map +1 -0
- package/dist/types/checkbox.js +2 -0
- package/dist/types/checkbox.js.map +1 -0
- package/dist/types/icon.d.ts +66 -0
- package/dist/types/icon.d.ts.map +1 -0
- package/dist/types/icon.js +2 -0
- package/dist/types/icon.js.map +1 -0
- package/dist/{primitives/image/types.d.ts → types/image.d.ts} +3 -4
- package/dist/types/image.d.ts.map +1 -0
- package/dist/types/image.js +2 -0
- package/dist/types/image.js.map +1 -0
- package/dist/types/keyboard-avoiding-view.d.ts +4 -0
- package/dist/types/keyboard-avoiding-view.d.ts.map +1 -0
- package/dist/types/keyboard-avoiding-view.js +2 -0
- package/dist/types/keyboard-avoiding-view.js.map +1 -0
- package/dist/{layout/helpers.d.ts → types/layout.d.ts} +39 -5
- package/dist/types/layout.d.ts.map +1 -0
- package/dist/types/layout.js +2 -0
- package/dist/types/layout.js.map +1 -0
- package/dist/{components/radio/types.d.ts → types/radio.d.ts} +4 -4
- package/dist/types/radio.d.ts.map +1 -0
- package/dist/types/radio.js +2 -0
- package/dist/types/radio.js.map +1 -0
- package/dist/types/surface.d.ts +6 -0
- package/dist/types/surface.d.ts.map +1 -0
- package/dist/types/surface.js +2 -0
- package/dist/types/surface.js.map +1 -0
- package/dist/{components/text-input/types.d.ts → types/text-input.d.ts} +3 -3
- package/dist/types/text-input.d.ts.map +1 -0
- package/dist/types/text-input.js +2 -0
- package/dist/types/text-input.js.map +1 -0
- package/dist/types/typography.d.ts +29 -0
- package/dist/types/typography.d.ts.map +1 -0
- package/dist/types/typography.js +2 -0
- package/dist/types/typography.js.map +1 -0
- package/dist/utils/resolveBoxStyles.d.ts +7 -0
- package/dist/utils/resolveBoxStyles.d.ts.map +1 -0
- package/dist/utils/resolveBoxStyles.js +83 -0
- package/dist/utils/resolveBoxStyles.js.map +1 -0
- package/dist/utils/resolveSpacing.d.ts +5 -0
- package/dist/utils/resolveSpacing.d.ts.map +1 -0
- package/dist/utils/resolveSpacing.js +6 -0
- package/dist/utils/resolveSpacing.js.map +1 -0
- package/package.json +1 -1
- package/src/components/field/Field.tsx +1 -1
- package/src/components/helper-text/HelperText.tsx +1 -1
- package/src/components/label/Label.tsx +1 -1
- package/src/components/list-item/ListItem.tsx +2 -2
- package/src/components/menu/Menu.tsx +4 -2
- package/src/components/modal/Modal.tsx +2 -1
- package/src/components/switch/Switch.tsx +2 -2
- package/src/components/tabs/Tab.tsx +2 -2
- package/src/components/tabs/TabList.tsx +1 -1
- package/src/components/tabs/Tabs.tsx +1 -1
- package/src/components/textarea/Textarea.tsx +1 -1
- package/src/components/textarea/types.ts +1 -1
- package/src/components/toast/Toast.tsx +4 -2
- package/src/components/toast/ToastProvider.tsx +1 -1
- package/src/components/tooltip/Tooltip.tsx +2 -2
- package/src/examples/DocsExamples.tsx +6 -6
- package/src/features/badge/adapters/inbound/Badge.tsx +58 -0
- package/src/features/badge/public.ts +2 -0
- package/src/features/button/adapters/inbound/Button.tsx +159 -0
- package/src/features/button/adapters/inbound/IconButton.tsx +69 -0
- package/src/features/button/public.ts +3 -0
- package/src/features/card/adapters/inbound/Card.tsx +88 -0
- package/src/features/card/public.ts +2 -0
- package/src/features/form/checkbox/adapters/inbound/Checkbox.tsx +207 -0
- package/src/features/form/checkbox/public.ts +2 -0
- package/src/{components/radio → features/form/radio/adapters/inbound}/Radio.test.ts +5 -5
- package/src/features/form/radio/adapters/inbound/Radio.tsx +214 -0
- package/src/features/form/radio/public.ts +2 -0
- package/src/{components/radio → features/form/radio/utils}/isRadioTextContent.ts +1 -3
- package/src/features/form/text-input/adapters/inbound/TextInput.tsx +72 -0
- package/src/features/form/text-input/public.ts +2 -0
- package/src/features/form/text-input/utils/resolveTextInputPresentation.ts +91 -0
- package/src/features/icon/adapters/inbound/Icon.tsx +14 -0
- package/src/{primitives/icon → features/icon/adapters/inbound}/PortableIcon.tsx +41 -97
- package/src/{primitives/icon → features/icon/adapters/inbound}/PortableIcon.web.test.tsx +6 -10
- package/src/features/icon/constants.ts +9 -0
- package/src/features/icon/public.ts +10 -0
- package/src/features/image/adapters/inbound/Image.tsx +55 -0
- package/src/features/image/public.ts +2 -0
- package/src/features/image/utils/getSourceKey.ts +32 -0
- package/src/features/image/utils/normalizeSource.ts +12 -0
- package/src/features/image/utils/resolveAccessibilityLabel.ts +9 -0
- package/src/features/image/utils/resolveAlt.ts +9 -0
- package/src/{primitives/image → features/image/utils}/resolveImageProps.test.ts +10 -22
- package/src/features/image/utils/resolveImageStyle.ts +23 -0
- package/src/features/image/utils/resolveRenderedSource.ts +11 -0
- package/src/features/image/utils/resolveResizeMode.ts +11 -0
- package/src/features/keyboard-avoiding-view/adapters/inbound/KeyboardAvoidingView.tsx +9 -0
- package/src/features/keyboard-avoiding-view/public.ts +5 -0
- package/src/{layout → features/layout/adapters/inbound}/Box.tsx +7 -15
- package/src/features/layout/adapters/inbound/Container.tsx +43 -0
- package/src/{layout → features/layout/adapters/inbound}/Divider.tsx +3 -8
- package/src/features/layout/adapters/inbound/Grid.tsx +78 -0
- package/src/{layout → features/layout/adapters/inbound}/Stack.test.ts +0 -1
- package/src/{layout → features/layout/adapters/inbound}/Stack.tsx +6 -15
- package/src/features/layout/public.ts +12 -0
- package/src/{layout → features/surface/adapters/inbound}/Surface.tsx +24 -41
- package/src/features/surface/public.ts +2 -0
- package/src/{primitives/heading → features/typography/adapters/inbound}/Heading.tsx +35 -38
- package/src/{primitives/text → features/typography/adapters/inbound}/Text.tsx +25 -35
- package/src/features/typography/public.ts +3 -0
- package/src/{primitives/heading/resolveHeadingStyle.test.ts → features/typography/utils/resolveHeadingTextStyle.test.ts} +5 -12
- package/src/features/typography/utils/resolveHeadingTextStyle.ts +21 -0
- package/src/index.test.ts +58 -28
- package/src/index.ts +37 -26
- package/src/layout/AppBar.tsx +1 -2
- package/src/layout/Center.tsx +1 -1
- package/src/layout/Inline.tsx +1 -1
- package/src/layout/ScrollArea.tsx +2 -1
- package/src/layout/Spacer.tsx +2 -2
- package/src/layout/Template.tsx +3 -2
- package/src/layout/index.ts +0 -17
- package/src/primitives/button-base/ButtonBase.tsx +1 -1
- package/src/primitives/button-base/types.ts +1 -1
- package/src/{components/badge/types.ts → types/badge.ts} +3 -3
- package/src/types/button.ts +34 -0
- package/src/{components/card/types.ts → types/card.ts} +1 -1
- package/src/{components/checkbox/types.ts → types/checkbox.ts} +3 -3
- package/src/types/icon.ts +52 -0
- package/src/{primitives/image/types.ts → types/image.ts} +3 -3
- package/src/types/keyboard-avoiding-view.ts +6 -0
- package/src/types/layout.ts +96 -0
- package/src/{components/radio/types.ts → types/radio.ts} +3 -3
- package/src/types/surface.ts +7 -0
- package/src/{components/text-input/types.ts → types/text-input.ts} +2 -2
- package/src/types/typography.ts +32 -0
- package/src/{layout/helpers.test.ts → utils/resolveBoxStyles.test.ts} +8 -25
- package/src/utils/resolveBoxStyles.ts +135 -0
- package/src/utils/resolveSpacing.ts +11 -0
- package/src/webAcceptance.test.tsx +2 -3
- package/dist/components/badge/Badge.d.ts +0 -4
- package/dist/components/badge/Badge.d.ts.map +0 -1
- package/dist/components/badge/Badge.js +0 -30
- package/dist/components/badge/Badge.js.map +0 -1
- package/dist/components/badge/index.d.ts +0 -3
- package/dist/components/badge/index.d.ts.map +0 -1
- package/dist/components/badge/index.js +0 -2
- package/dist/components/badge/index.js.map +0 -1
- package/dist/components/badge/types.d.ts +0 -12
- package/dist/components/badge/types.d.ts.map +0 -1
- package/dist/components/badge/types.js +0 -2
- package/dist/components/badge/types.js.map +0 -1
- package/dist/components/button/Button.d.ts.map +0 -1
- package/dist/components/button/Button.js +0 -51
- package/dist/components/button/Button.js.map +0 -1
- package/dist/components/button/index.d.ts +0 -3
- package/dist/components/button/index.d.ts.map +0 -1
- package/dist/components/button/index.js +0 -2
- package/dist/components/button/index.js.map +0 -1
- package/dist/components/button/types.d.ts +0 -18
- package/dist/components/button/types.d.ts.map +0 -1
- package/dist/components/button/types.js +0 -2
- package/dist/components/button/types.js.map +0 -1
- package/dist/components/card/Card.d.ts +0 -4
- package/dist/components/card/Card.d.ts.map +0 -1
- package/dist/components/card/Card.js +0 -46
- package/dist/components/card/Card.js.map +0 -1
- package/dist/components/card/index.d.ts +0 -3
- package/dist/components/card/index.d.ts.map +0 -1
- package/dist/components/card/index.js +0 -2
- package/dist/components/card/index.js.map +0 -1
- package/dist/components/card/types.d.ts.map +0 -1
- package/dist/components/card/types.js +0 -2
- package/dist/components/card/types.js.map +0 -1
- package/dist/components/checkbox/Checkbox.d.ts +0 -4
- package/dist/components/checkbox/Checkbox.d.ts.map +0 -1
- package/dist/components/checkbox/Checkbox.js +0 -69
- package/dist/components/checkbox/Checkbox.js.map +0 -1
- package/dist/components/checkbox/index.d.ts +0 -3
- package/dist/components/checkbox/index.d.ts.map +0 -1
- package/dist/components/checkbox/index.js +0 -2
- package/dist/components/checkbox/index.js.map +0 -1
- package/dist/components/checkbox/types.d.ts.map +0 -1
- package/dist/components/checkbox/types.js +0 -2
- package/dist/components/checkbox/types.js.map +0 -1
- package/dist/components/icon-button/IconButton.d.ts.map +0 -1
- package/dist/components/icon-button/IconButton.js +0 -28
- package/dist/components/icon-button/IconButton.js.map +0 -1
- package/dist/components/icon-button/index.d.ts +0 -3
- package/dist/components/icon-button/index.d.ts.map +0 -1
- package/dist/components/icon-button/index.js +0 -2
- package/dist/components/icon-button/index.js.map +0 -1
- package/dist/components/icon-button/types.d.ts +0 -13
- package/dist/components/icon-button/types.d.ts.map +0 -1
- package/dist/components/icon-button/types.js +0 -2
- package/dist/components/icon-button/types.js.map +0 -1
- package/dist/components/radio/Radio.d.ts +0 -7
- package/dist/components/radio/Radio.d.ts.map +0 -1
- package/dist/components/radio/Radio.js +0 -75
- package/dist/components/radio/Radio.js.map +0 -1
- package/dist/components/radio/index.d.ts +0 -3
- package/dist/components/radio/index.d.ts.map +0 -1
- package/dist/components/radio/index.js +0 -2
- package/dist/components/radio/index.js.map +0 -1
- package/dist/components/radio/isRadioTextContent.d.ts +0 -6
- package/dist/components/radio/isRadioTextContent.d.ts.map +0 -1
- package/dist/components/radio/isRadioTextContent.js +0 -7
- package/dist/components/radio/isRadioTextContent.js.map +0 -1
- package/dist/components/radio/types.d.ts.map +0 -1
- package/dist/components/radio/types.js +0 -2
- package/dist/components/radio/types.js.map +0 -1
- package/dist/components/text-input/TextInput.d.ts +0 -4
- package/dist/components/text-input/TextInput.d.ts.map +0 -1
- package/dist/components/text-input/TextInput.js +0 -72
- package/dist/components/text-input/TextInput.js.map +0 -1
- package/dist/components/text-input/index.d.ts +0 -3
- package/dist/components/text-input/index.d.ts.map +0 -1
- package/dist/components/text-input/index.js +0 -2
- package/dist/components/text-input/index.js.map +0 -1
- package/dist/components/text-input/types.d.ts.map +0 -1
- package/dist/components/text-input/types.js +0 -2
- package/dist/components/text-input/types.js.map +0 -1
- package/dist/layout/Box.d.ts +0 -14
- package/dist/layout/Box.d.ts.map +0 -1
- package/dist/layout/Box.js.map +0 -1
- package/dist/layout/Container.d.ts +0 -11
- package/dist/layout/Container.d.ts.map +0 -1
- package/dist/layout/Container.js +0 -24
- package/dist/layout/Container.js.map +0 -1
- package/dist/layout/Divider.d.ts +0 -10
- package/dist/layout/Divider.d.ts.map +0 -1
- package/dist/layout/Divider.js.map +0 -1
- package/dist/layout/Grid.d.ts +0 -14
- package/dist/layout/Grid.d.ts.map +0 -1
- package/dist/layout/Grid.js +0 -51
- package/dist/layout/Grid.js.map +0 -1
- package/dist/layout/KeyboardAvoidingView.d.ts +0 -7
- package/dist/layout/KeyboardAvoidingView.d.ts.map +0 -1
- package/dist/layout/KeyboardAvoidingView.js.map +0 -1
- package/dist/layout/Stack.d.ts +0 -14
- package/dist/layout/Stack.d.ts.map +0 -1
- package/dist/layout/Stack.js.map +0 -1
- package/dist/layout/Surface.d.ts +0 -8
- package/dist/layout/Surface.d.ts.map +0 -1
- package/dist/layout/Surface.js.map +0 -1
- package/dist/layout/helpers.d.ts.map +0 -1
- package/dist/layout/helpers.js +0 -91
- package/dist/layout/helpers.js.map +0 -1
- package/dist/primitives/heading/Heading.d.ts +0 -4
- package/dist/primitives/heading/Heading.d.ts.map +0 -1
- package/dist/primitives/heading/Heading.js +0 -30
- package/dist/primitives/heading/Heading.js.map +0 -1
- package/dist/primitives/heading/index.d.ts +0 -3
- package/dist/primitives/heading/index.d.ts.map +0 -1
- package/dist/primitives/heading/index.js +0 -2
- package/dist/primitives/heading/index.js.map +0 -1
- package/dist/primitives/heading/resolveHeadingStyle.d.ts +0 -6
- package/dist/primitives/heading/resolveHeadingStyle.d.ts.map +0 -1
- package/dist/primitives/heading/resolveHeadingStyle.js +0 -9
- package/dist/primitives/heading/resolveHeadingStyle.js.map +0 -1
- package/dist/primitives/heading/types.d.ts +0 -15
- package/dist/primitives/heading/types.d.ts.map +0 -1
- package/dist/primitives/heading/types.js +0 -2
- package/dist/primitives/heading/types.js.map +0 -1
- package/dist/primitives/icon/Icon.d.ts +0 -16
- package/dist/primitives/icon/Icon.d.ts.map +0 -1
- package/dist/primitives/icon/Icon.js.map +0 -1
- package/dist/primitives/icon/PortableIcon.d.ts +0 -70
- package/dist/primitives/icon/PortableIcon.d.ts.map +0 -1
- package/dist/primitives/icon/PortableIcon.js.map +0 -1
- package/dist/primitives/icon/index.d.ts +0 -4
- package/dist/primitives/icon/index.d.ts.map +0 -1
- package/dist/primitives/icon/index.js +0 -3
- package/dist/primitives/icon/index.js.map +0 -1
- package/dist/primitives/image/Image.d.ts.map +0 -1
- package/dist/primitives/image/Image.js +0 -26
- package/dist/primitives/image/Image.js.map +0 -1
- package/dist/primitives/image/index.d.ts +0 -3
- package/dist/primitives/image/index.d.ts.map +0 -1
- package/dist/primitives/image/index.js +0 -2
- package/dist/primitives/image/index.js.map +0 -1
- package/dist/primitives/image/resolveImageProps.d.ts +0 -12
- package/dist/primitives/image/resolveImageProps.d.ts.map +0 -1
- package/dist/primitives/image/resolveImageProps.js +0 -67
- package/dist/primitives/image/resolveImageProps.js.map +0 -1
- package/dist/primitives/image/types.d.ts.map +0 -1
- package/dist/primitives/image/types.js +0 -2
- package/dist/primitives/image/types.js.map +0 -1
- package/dist/primitives/text/Text.d.ts.map +0 -1
- package/dist/primitives/text/Text.js.map +0 -1
- package/dist/primitives/text/index.d.ts +0 -3
- package/dist/primitives/text/index.d.ts.map +0 -1
- package/dist/primitives/text/index.js +0 -2
- package/dist/primitives/text/index.js.map +0 -1
- package/dist/primitives/text/types.d.ts +0 -17
- package/dist/primitives/text/types.d.ts.map +0 -1
- package/dist/primitives/text/types.js +0 -2
- package/dist/primitives/text/types.js.map +0 -1
- package/src/components/badge/Badge.tsx +0 -52
- package/src/components/badge/index.ts +0 -2
- package/src/components/button/Button.tsx +0 -98
- package/src/components/button/index.ts +0 -2
- package/src/components/button/types.ts +0 -23
- package/src/components/card/Card.tsx +0 -81
- package/src/components/card/index.ts +0 -2
- package/src/components/checkbox/Checkbox.tsx +0 -120
- package/src/components/checkbox/index.ts +0 -2
- package/src/components/icon-button/IconButton.tsx +0 -55
- package/src/components/icon-button/index.ts +0 -2
- package/src/components/icon-button/types.ts +0 -16
- package/src/components/radio/Radio.tsx +0 -124
- package/src/components/radio/index.ts +0 -2
- package/src/components/text-input/TextInput.tsx +0 -124
- package/src/components/text-input/index.ts +0 -2
- package/src/layout/Container.tsx +0 -43
- package/src/layout/Grid.tsx +0 -83
- package/src/layout/KeyboardAvoidingView.tsx +0 -16
- package/src/layout/helpers.ts +0 -205
- package/src/primitives/heading/index.ts +0 -2
- package/src/primitives/heading/resolveHeadingStyle.ts +0 -20
- package/src/primitives/heading/types.ts +0 -17
- package/src/primitives/icon/Icon.tsx +0 -34
- package/src/primitives/icon/index.ts +0 -10
- package/src/primitives/image/Image.tsx +0 -65
- package/src/primitives/image/index.ts +0 -2
- package/src/primitives/image/resolveImageProps.ts +0 -92
- package/src/primitives/text/index.ts +0 -2
- package/src/primitives/text/types.ts +0 -18
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../../../../src/features/form/radio/adapters/inbound/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAe1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAK7D,mFAAmF;AACnF,wBAAgB,KAAK,CAAC,EACpB,kBAAkB,EAClB,OAAO,EACP,QAAQ,EACR,KAAiB,EACjB,cAAsB,EACtB,QAAgB,EAChB,OAAe,EACf,eAAe,EACf,QAAgB,EAChB,IAAU,EACV,MAAM,EACN,GAAG,WAAW,EACf,EAAE,UAAU,qBAyBZ"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { resolveFieldState, resolveIndicatorSize, resolveSelectionControlColors, resolveSelectionControlNextChecked, } from '../../../../../internal/resolvers';
|
|
3
|
+
import { useControllableState } from '../../../../../internal/useControllableState';
|
|
4
|
+
import { ButtonBase } from '../../../../../primitives/button-base';
|
|
5
|
+
import { useTheme } from '../../../../../theme/ThemeContext';
|
|
6
|
+
import { Box } from '../../../../layout/public';
|
|
7
|
+
import { Text } from '../../../../typography/public';
|
|
8
|
+
import { isRadioTextContent } from '../../utils/isRadioTextContent';
|
|
9
|
+
/*** Renders one accessible radio control with text or structured label content. */
|
|
10
|
+
export function Radio({ accessibilityLabel, checked, children, color = 'primary', defaultChecked = false, disabled = false, invalid = false, onCheckedChange, readOnly = false, size = 'm', testID, ...buttonProps }) {
|
|
11
|
+
const { theme } = useTheme();
|
|
12
|
+
const [isChecked, setChecked] = useControllableState({
|
|
13
|
+
value: checked,
|
|
14
|
+
defaultValue: defaultChecked,
|
|
15
|
+
onChange: onCheckedChange,
|
|
16
|
+
});
|
|
17
|
+
return (<RadioControl accessibilityLabel={accessibilityLabel} buttonProps={buttonProps} color={color} disabled={disabled} invalid={invalid} isChecked={isChecked} readOnly={readOnly} setChecked={setChecked} size={size} testID={testID} theme={theme}>
|
|
18
|
+
{children}
|
|
19
|
+
</RadioControl>);
|
|
20
|
+
}
|
|
21
|
+
/*** Owns the radio interaction boundary around resolved selection content. */
|
|
22
|
+
function RadioControl({ accessibilityLabel, buttonProps, children, color, disabled, invalid, isChecked, readOnly, setChecked, size, testID, theme, }) {
|
|
23
|
+
const nextChecked = resolveSelectionControlNextChecked({
|
|
24
|
+
checked: isChecked,
|
|
25
|
+
disabled,
|
|
26
|
+
kind: 'radio',
|
|
27
|
+
readOnly,
|
|
28
|
+
});
|
|
29
|
+
return (<ButtonBase {...buttonProps} accessibilityLabel={accessibilityLabel} accessibilityRole="radio" accessibilityState={{ checked: isChecked }} disabled={disabled} onPress={nextChecked === null ? undefined : () => setChecked(nextChecked)} testID={testID}>
|
|
30
|
+
{(interactionState) => renderRadioContent({
|
|
31
|
+
children,
|
|
32
|
+
color,
|
|
33
|
+
disabled,
|
|
34
|
+
interactionState,
|
|
35
|
+
invalid,
|
|
36
|
+
isChecked,
|
|
37
|
+
readOnly,
|
|
38
|
+
size,
|
|
39
|
+
theme,
|
|
40
|
+
})}
|
|
41
|
+
</ButtonBase>);
|
|
42
|
+
}
|
|
43
|
+
/*** Renders the radio indicator and optional content for one interaction state. */
|
|
44
|
+
function renderRadioContent(input) {
|
|
45
|
+
const { interactionState, theme } = input;
|
|
46
|
+
const fieldState = resolveFieldState({
|
|
47
|
+
disabled: input.disabled,
|
|
48
|
+
focused: interactionState.focused,
|
|
49
|
+
invalid: input.invalid,
|
|
50
|
+
readOnly: input.readOnly,
|
|
51
|
+
});
|
|
52
|
+
const colors = resolveSelectionControlColors(theme, {
|
|
53
|
+
checked: input.isChecked,
|
|
54
|
+
fieldState,
|
|
55
|
+
hovered: interactionState.hovered,
|
|
56
|
+
pressed: interactionState.pressed,
|
|
57
|
+
color: input.color,
|
|
58
|
+
});
|
|
59
|
+
const indicatorSize = resolveIndicatorSize(input.size);
|
|
60
|
+
const labelEmphasis = colors.labelColor === theme.semantics.content.muted ? 'muted' : 'default';
|
|
61
|
+
const hasContent = input.children !== undefined && input.children !== null && input.children !== false;
|
|
62
|
+
return (<Box style={resolveSelectionRowStyle(colors.opacity)}>
|
|
63
|
+
<Box radius="full" style={resolveRadioIndicatorStyle(colors.backgroundColor, colors.borderColor, indicatorSize.radio)}>
|
|
64
|
+
{input.isChecked ? (<Box radius="full" style={resolveRadioDotStyle(colors.indicatorColor, indicatorSize.radioDot)}/>) : null}
|
|
65
|
+
</Box>
|
|
66
|
+
{hasContent ? (<Box flex={1} ml="s">
|
|
67
|
+
{isRadioTextContent(input.children) ? (<Text emphasis={labelEmphasis}>{input.children}</Text>) : (input.children)}
|
|
68
|
+
</Box>) : null}
|
|
69
|
+
</Box>);
|
|
70
|
+
}
|
|
71
|
+
/*** Resolves the horizontal selection-control row style. */
|
|
72
|
+
function resolveSelectionRowStyle(opacity) {
|
|
73
|
+
return { alignItems: 'center', flexDirection: 'row', opacity };
|
|
74
|
+
}
|
|
75
|
+
/*** Resolves radio indicator dimensions and interaction colors. */
|
|
76
|
+
function resolveRadioIndicatorStyle(backgroundColor, borderColor, size) {
|
|
77
|
+
return {
|
|
78
|
+
alignItems: 'center',
|
|
79
|
+
backgroundColor,
|
|
80
|
+
borderColor,
|
|
81
|
+
borderWidth: 1.5,
|
|
82
|
+
height: size,
|
|
83
|
+
justifyContent: 'center',
|
|
84
|
+
width: size,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/*** Resolves the checked radio dot style. */
|
|
88
|
+
function resolveRadioDotStyle(backgroundColor, size) {
|
|
89
|
+
return { backgroundColor, height: size, width: size };
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=Radio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Radio.js","sourceRoot":"","sources":["../../../../../../src/features/form/radio/adapters/inbound/Radio.tsx"],"names":[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AAa,CAAC,QAAQ,CAAC,CAAC,EAC3E,CACH,CAAC,CAAC,CAAC,IAAI,CACV;MAAA,EAAE,GAAG,CACL;MAAA,CAAC,UAAU,CAAC,CAAC,CAAC,CACZ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAClB;UAAA,CAAC,kBAAkB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CACpC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CACvD,CAAC,CAAC,CAAC,CACF,KAAK,CAAC,QAAQ,CACf,CACH;QAAA,EAAE,GAAG,CAAC,CACP,CAAC,CAAC,CAAC,IAAI,CACV;IAAA,EAAE,GAAG,CAAC,CACP,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,mEAAmE;AACnE,SAAS,0BAA0B,CACjC,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;AAED,6CAA6C;AAC7C,SAAS,oBAAoB,CAAC,eAAuB,EAAE,IAAY;IACjE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACxD,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 { RadioProps } from '../../../../../types/radio';\nimport { Box } from '../../../../layout/public';\nimport { Text } from '../../../../typography/public';\nimport { isRadioTextContent } from '../../utils/isRadioTextContent';\n\n/*** Renders one accessible radio control with text or structured label content. */\nexport function Radio({\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}: RadioProps) {\n const { theme } = useTheme();\n const [isChecked, setChecked] = useControllableState<boolean>({\n value: checked,\n defaultValue: defaultChecked,\n onChange: onCheckedChange,\n });\n\n return (\n <RadioControl\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 </RadioControl>\n );\n}\n\n/*** Owns the radio interaction boundary around resolved selection content. */\nfunction RadioControl({\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}: RadioControlProps) {\n const nextChecked = resolveSelectionControlNextChecked({\n checked: isChecked,\n disabled,\n kind: 'radio',\n readOnly,\n });\n\n return (\n <ButtonBase\n {...buttonProps}\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"radio\"\n accessibilityState={{ checked: isChecked }}\n disabled={disabled}\n onPress={nextChecked === null ? undefined : () => setChecked(nextChecked)}\n testID={testID}\n >\n {(interactionState) =>\n renderRadioContent({\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 radio indicator and optional content for one interaction state. */\nfunction renderRadioContent(input: RadioContentInput) {\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 hasContent =\n input.children !== undefined && input.children !== null && input.children !== false;\n\n return (\n <Box style={resolveSelectionRowStyle(colors.opacity)}>\n <Box\n radius=\"full\"\n style={resolveRadioIndicatorStyle(\n colors.backgroundColor,\n colors.borderColor,\n indicatorSize.radio,\n )}\n >\n {input.isChecked ? (\n <Box\n radius=\"full\"\n style={resolveRadioDotStyle(colors.indicatorColor, indicatorSize.radioDot)}\n />\n ) : null}\n </Box>\n {hasContent ? (\n <Box flex={1} ml=\"s\">\n {isRadioTextContent(input.children) ? (\n <Text emphasis={labelEmphasis}>{input.children}</Text>\n ) : (\n input.children\n )}\n </Box>\n ) : null}\n </Box>\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 radio indicator dimensions and interaction colors. */\nfunction resolveRadioIndicatorStyle(\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\n/*** Resolves the checked radio dot style. */\nfunction resolveRadioDotStyle(backgroundColor: string, size: number): ViewStyle {\n return { backgroundColor, height: size, width: size };\n}\n\ninterface RadioControlProps {\n accessibilityLabel: RadioProps['accessibilityLabel'];\n buttonProps: ButtonBaseProps;\n children: RadioProps['children'];\n color: NonNullable<RadioProps['color']>;\n disabled: boolean;\n invalid: boolean;\n isChecked: boolean;\n readOnly: boolean;\n setChecked: (checked: boolean) => void;\n size: NonNullable<RadioProps['size']>;\n testID: RadioProps['testID'];\n theme: SurfaceTheme;\n}\n\ninterface RadioContentInput {\n children: RadioProps['children'];\n color: NonNullable<RadioProps['color']>;\n disabled: boolean;\n interactionState: InteractionState;\n invalid: boolean;\n isChecked: boolean;\n readOnly: boolean;\n size: NonNullable<RadioProps['size']>;\n theme: SurfaceTheme;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../../src/features/form/radio/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/radio/public.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["export type { RadioProps } from '../../../types/radio';\nexport { Radio } from './adapters/inbound/Radio';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isRadioTextContent.d.ts","sourceRoot":"","sources":["../../../../../src/features/form/radio/utils/isRadioTextContent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,sFAAsF;AACtF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,QAAQ,IAAI,MAAM,GAAG,MAAM,CAEzF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isRadioTextContent.js","sourceRoot":"","sources":["../../../../../src/features/form/radio/utils/isRadioTextContent.ts"],"names":[],"mappings":"AAEA,sFAAsF;AACtF,MAAM,UAAU,kBAAkB,CAAC,QAAyB;IAC1D,OAAO,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,CAAC;AACtE,CAAC","sourcesContent":["import type React from 'react';\n\n/*** Reports whether Radio content should use the built-in text-label presentation. */\nexport function isRadioTextContent(children: React.ReactNode): children is string | number {\n return typeof children === 'string' || typeof children === 'number';\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TextInputProps } from '../../../../../types/text-input';
|
|
3
|
+
/*** Renders a token-aware text input with controlled interaction policy. */
|
|
4
|
+
export declare function TextInput(props: TextInputProps): React.JSX.Element;
|
|
5
|
+
//# sourceMappingURL=TextInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../../../../src/features/form/text-input/adapters/inbound/TextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAGtE,4EAA4E;AAC5E,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,qBA+C9C"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Platform, TextInput as ReactNativeTextInput, View } from 'react-native';
|
|
3
|
+
import { resolveFocusRingStyles } from '../../../../../internal/resolvers';
|
|
4
|
+
import { useTheme } from '../../../../../theme/ThemeContext';
|
|
5
|
+
import { resolveTextInputPresentation } from '../../utils/resolveTextInputPresentation';
|
|
6
|
+
/*** Renders a token-aware text input with controlled interaction policy. */
|
|
7
|
+
export function TextInput(props) {
|
|
8
|
+
const { theme } = useTheme();
|
|
9
|
+
const [focused, setFocused] = React.useState(false);
|
|
10
|
+
const { disabled: _disabled, interactionPolicy = 'enabled', invalid: _invalid, leadingAccessory, readOnly = false, size: _size, trailingAccessory, ...nativeProps } = props;
|
|
11
|
+
const presentation = resolveTextInputPresentation(theme, props, focused);
|
|
12
|
+
return (<View style={[
|
|
13
|
+
presentation.containerStyle,
|
|
14
|
+
resolveFocusRingStyles(theme.semantics.border.focus, focused, Platform.OS === 'web'),
|
|
15
|
+
]}>
|
|
16
|
+
{renderAccessory(leadingAccessory, presentation.accessorySpacing, 'leading')}
|
|
17
|
+
<ReactNativeTextInput {...nativeProps} editable={presentation.editable} numberOfLines={presentation.numberOfLines} onBlur={(event) => {
|
|
18
|
+
setFocused(false);
|
|
19
|
+
nativeProps.onBlur?.(event);
|
|
20
|
+
}} onChangeText={(nextValue) => {
|
|
21
|
+
if (interactionPolicy !== 'passive') {
|
|
22
|
+
nativeProps.onChangeText?.(nextValue);
|
|
23
|
+
}
|
|
24
|
+
}} onFocus={(event) => {
|
|
25
|
+
setFocused(true);
|
|
26
|
+
nativeProps.onFocus?.(event);
|
|
27
|
+
}} placeholderTextColor={presentation.placeholderColor} readOnly={readOnly} style={[presentation.inputStyle, nativeProps.style]}/>
|
|
28
|
+
{renderAccessory(trailingAccessory, presentation.accessorySpacing, 'trailing')}
|
|
29
|
+
</View>);
|
|
30
|
+
}
|
|
31
|
+
/*** Renders one optional TextInput accessory with directional spacing. */
|
|
32
|
+
function renderAccessory(accessory, spacing, position) {
|
|
33
|
+
if (!accessory)
|
|
34
|
+
return null;
|
|
35
|
+
return <View style={resolveAccessoryStyle(spacing, position)}>{accessory}</View>;
|
|
36
|
+
}
|
|
37
|
+
/*** Resolves spacing around a leading or trailing TextInput accessory. */
|
|
38
|
+
function resolveAccessoryStyle(spacing, position) {
|
|
39
|
+
return position === 'leading' ? { marginRight: spacing } : { marginLeft: spacing };
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=TextInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../../../../../src/features/form/text-input/adapters/inbound/TextInput.tsx"],"names":[],"mappings":"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AU,EAAE,OAAO,EAAE,CAAC;AACrF,CAAC","sourcesContent":["import React from 'react';\nimport { Platform, TextInput as ReactNativeTextInput, View, type ViewStyle } from 'react-native';\n\nimport { resolveFocusRingStyles } from '../../../../../internal/resolvers';\nimport { useTheme } from '../../../../../theme/ThemeContext';\nimport type { TextInputProps } from '../../../../../types/text-input';\nimport { resolveTextInputPresentation } from '../../utils/resolveTextInputPresentation';\n\n/*** Renders a token-aware text input with controlled interaction policy. */\nexport function TextInput(props: TextInputProps) {\n const { theme } = useTheme();\n const [focused, setFocused] = React.useState(false);\n const {\n disabled: _disabled,\n interactionPolicy = 'enabled',\n invalid: _invalid,\n leadingAccessory,\n readOnly = false,\n size: _size,\n trailingAccessory,\n ...nativeProps\n } = props;\n const presentation = resolveTextInputPresentation(theme, props, focused);\n\n return (\n <View\n style={[\n presentation.containerStyle,\n resolveFocusRingStyles(theme.semantics.border.focus, focused, Platform.OS === 'web'),\n ]}\n >\n {renderAccessory(leadingAccessory, presentation.accessorySpacing, 'leading')}\n <ReactNativeTextInput\n {...nativeProps}\n editable={presentation.editable}\n numberOfLines={presentation.numberOfLines}\n onBlur={(event) => {\n setFocused(false);\n nativeProps.onBlur?.(event);\n }}\n onChangeText={(nextValue) => {\n if (interactionPolicy !== 'passive') {\n nativeProps.onChangeText?.(nextValue);\n }\n }}\n onFocus={(event) => {\n setFocused(true);\n nativeProps.onFocus?.(event);\n }}\n placeholderTextColor={presentation.placeholderColor}\n readOnly={readOnly}\n style={[presentation.inputStyle, nativeProps.style]}\n />\n {renderAccessory(trailingAccessory, presentation.accessorySpacing, 'trailing')}\n </View>\n );\n}\n\n/*** Renders one optional TextInput accessory with directional spacing. */\nfunction renderAccessory(\n accessory: React.ReactNode,\n spacing: number,\n position: 'leading' | 'trailing',\n) {\n if (!accessory) return null;\n return <View style={resolveAccessoryStyle(spacing, position)}>{accessory}</View>;\n}\n\n/*** Resolves spacing around a leading or trailing TextInput accessory. */\nfunction resolveAccessoryStyle(spacing: number, position: 'leading' | 'trailing'): ViewStyle {\n return position === 'leading' ? { marginRight: spacing } : { marginLeft: spacing };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../../src/features/form/text-input/public.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../../src/features/form/text-input/public.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["export type { TextInputProps } from '../../../types/text-input';\nexport { TextInput } from './adapters/inbound/TextInput';\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TextStyle, ViewStyle } from 'react-native';
|
|
2
|
+
import type { SurfaceTheme } from '../../../../theme/types';
|
|
3
|
+
import type { TextInputProps } from '../../../../types/text-input';
|
|
4
|
+
/*** Resolves layout, colors, and editability for one TextInput state. */
|
|
5
|
+
export declare function resolveTextInputPresentation(theme: SurfaceTheme, props: TextInputProps, focused: boolean): TextInputPresentation;
|
|
6
|
+
interface TextInputPresentation {
|
|
7
|
+
accessorySpacing: number;
|
|
8
|
+
containerStyle: ViewStyle;
|
|
9
|
+
editable: boolean;
|
|
10
|
+
inputStyle: TextStyle;
|
|
11
|
+
numberOfLines: number | undefined;
|
|
12
|
+
placeholderColor: string;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=resolveTextInputPresentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveTextInputPresentation.d.ts","sourceRoot":"","sources":["../../../../../src/features/form/text-input/utils/resolveTextInputPresentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAQzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,yEAAyE;AACzE,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,OAAO,GACf,qBAAqB,CA4CvB;AAuBD,UAAU,qBAAqB;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,SAAS,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,SAAS,CAAC;IACtB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,gBAAgB,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { resolveControlSize, resolveFieldState, resolveInputColors, resolveTextStyles, } from '../../../../internal/resolvers';
|
|
2
|
+
/*** Resolves layout, colors, and editability for one TextInput state. */
|
|
3
|
+
export function resolveTextInputPresentation(theme, props, focused) {
|
|
4
|
+
const controlSize = resolveControlSize(theme, props.size ?? 'm');
|
|
5
|
+
const disabled = props.disabled ?? false;
|
|
6
|
+
const readOnly = props.readOnly ?? false;
|
|
7
|
+
const fieldState = resolveFieldState({
|
|
8
|
+
disabled,
|
|
9
|
+
focused,
|
|
10
|
+
invalid: props.invalid ?? false,
|
|
11
|
+
readOnly,
|
|
12
|
+
});
|
|
13
|
+
const colors = resolveInputColors(theme, fieldState);
|
|
14
|
+
const textStyle = resolveTextStyles(theme, { variant: controlSize.textVariant });
|
|
15
|
+
const heights = resolveTextInputHeights(controlSize, props.multiline, props.numberOfLines, textStyle.lineHeight);
|
|
16
|
+
return {
|
|
17
|
+
accessorySpacing: theme.spacing.s,
|
|
18
|
+
containerStyle: {
|
|
19
|
+
alignItems: props.multiline ? 'flex-start' : 'center',
|
|
20
|
+
backgroundColor: colors.backgroundColor,
|
|
21
|
+
borderColor: colors.borderColor,
|
|
22
|
+
borderRadius: controlSize.borderRadius,
|
|
23
|
+
borderWidth: 1,
|
|
24
|
+
flexDirection: 'row',
|
|
25
|
+
minHeight: heights.container,
|
|
26
|
+
opacity: colors.opacity,
|
|
27
|
+
paddingHorizontal: controlSize.paddingHorizontal,
|
|
28
|
+
paddingVertical: controlSize.paddingVertical,
|
|
29
|
+
},
|
|
30
|
+
editable: props.interactionPolicy === 'passive' ? false : !disabled && !readOnly,
|
|
31
|
+
inputStyle: {
|
|
32
|
+
color: colors.contentColor,
|
|
33
|
+
flex: 1,
|
|
34
|
+
minHeight: heights.input,
|
|
35
|
+
padding: 0,
|
|
36
|
+
textAlignVertical: props.multiline ? 'top' : 'center',
|
|
37
|
+
},
|
|
38
|
+
numberOfLines: props.multiline ? props.numberOfLines : 1,
|
|
39
|
+
placeholderColor: colors.placeholderColor,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/*** Resolves input and container heights from control typography and multiline state. */
|
|
43
|
+
function resolveTextInputHeights(controlSize, multiline, numberOfLines, lineHeight) {
|
|
44
|
+
const resolvedLineHeight = typeof lineHeight === 'number'
|
|
45
|
+
? lineHeight
|
|
46
|
+
: controlSize.minHeight - controlSize.paddingVertical * 2;
|
|
47
|
+
const lineCount = Math.max(numberOfLines ?? 1, 1);
|
|
48
|
+
const input = multiline
|
|
49
|
+
? resolvedLineHeight * lineCount
|
|
50
|
+
: controlSize.minHeight - controlSize.paddingVertical * 2;
|
|
51
|
+
return {
|
|
52
|
+
input,
|
|
53
|
+
container: multiline ? input + controlSize.paddingVertical * 2 : controlSize.minHeight,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=resolveTextInputPresentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveTextInputPresentation.js","sourceRoot":"","sources":["../../../../../src/features/form/text-input/utils/resolveTextInputPresentation.ts"],"names":[],"mappings":"AAEA,OAA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,CAAC","sourcesContent":["import type { TextStyle, ViewStyle } from 'react-native';\n\nimport {\n resolveControlSize,\n resolveFieldState,\n resolveInputColors,\n resolveTextStyles,\n} from '../../../../internal/resolvers';\nimport type { SurfaceTheme } from '../../../../theme/types';\nimport type { TextInputProps } from '../../../../types/text-input';\n\n/*** Resolves layout, colors, and editability for one TextInput state. */\nexport function resolveTextInputPresentation(\n theme: SurfaceTheme,\n props: TextInputProps,\n focused: boolean,\n): TextInputPresentation {\n const controlSize = resolveControlSize(theme, props.size ?? 'm');\n const disabled = props.disabled ?? false;\n const readOnly = props.readOnly ?? false;\n const fieldState = resolveFieldState({\n disabled,\n focused,\n invalid: props.invalid ?? false,\n readOnly,\n });\n const colors = resolveInputColors(theme, fieldState);\n const textStyle = resolveTextStyles(theme, { variant: controlSize.textVariant });\n const heights = resolveTextInputHeights(\n controlSize,\n props.multiline,\n props.numberOfLines,\n textStyle.lineHeight,\n );\n\n return {\n accessorySpacing: theme.spacing.s,\n containerStyle: {\n alignItems: props.multiline ? 'flex-start' : 'center',\n backgroundColor: colors.backgroundColor,\n borderColor: colors.borderColor,\n borderRadius: controlSize.borderRadius,\n borderWidth: 1,\n flexDirection: 'row',\n minHeight: heights.container,\n opacity: colors.opacity,\n paddingHorizontal: controlSize.paddingHorizontal,\n paddingVertical: controlSize.paddingVertical,\n },\n editable: props.interactionPolicy === 'passive' ? false : !disabled && !readOnly,\n inputStyle: {\n color: colors.contentColor,\n flex: 1,\n minHeight: heights.input,\n padding: 0,\n textAlignVertical: props.multiline ? 'top' : 'center',\n },\n numberOfLines: props.multiline ? props.numberOfLines : 1,\n placeholderColor: colors.placeholderColor,\n };\n}\n\n/*** Resolves input and container heights from control typography and multiline state. */\nfunction resolveTextInputHeights(\n controlSize: ReturnType<typeof resolveControlSize>,\n multiline: boolean | undefined,\n numberOfLines: number | undefined,\n lineHeight: TextStyle['lineHeight'],\n) {\n const resolvedLineHeight =\n typeof lineHeight === 'number'\n ? lineHeight\n : controlSize.minHeight - controlSize.paddingVertical * 2;\n const lineCount = Math.max(numberOfLines ?? 1, 1);\n const input = multiline\n ? resolvedLineHeight * lineCount\n : controlSize.minHeight - controlSize.paddingVertical * 2;\n return {\n input,\n container: multiline ? input + controlSize.paddingVertical * 2 : controlSize.minHeight,\n };\n}\n\ninterface TextInputPresentation {\n accessorySpacing: number;\n containerStyle: ViewStyle;\n editable: boolean;\n inputStyle: TextStyle;\n numberOfLines: number | undefined;\n placeholderColor: string;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../../../src/features/icon/adapters/inbound/Icon.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGxD,iFAAiF;AACjF,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,+BAOpC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {} from '
|
|
2
|
-
import {
|
|
3
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
1
|
+
import { resolveToken } from '../../../../theme/resolveToken';
|
|
2
|
+
import { useTheme } from '../../../../theme/ThemeContext';
|
|
4
3
|
import { PortableIcon } from './PortableIcon';
|
|
4
|
+
/*** Renders a theme-aware font or SVG icon through the portable icon adapter. */
|
|
5
5
|
export function Icon(props) {
|
|
6
6
|
const { theme } = useTheme();
|
|
7
7
|
const size = props.size ?? 'm';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../../../src/features/icon/adapters/inbound/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,iFAAiF;AACjF,MAAM,UAAU,IAAI,CAAC,KAAgB;IACnC,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,GAAG,CAAC;IAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,MAAM,CAAC;IACpC,MAAM,YAAY,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACzF,MAAM,aAAa,GAAG,YAAY,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACxD,OAAO,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,EAAG,CAAC;AAC/E,CAAC","sourcesContent":["import { resolveToken } from '../../../../theme/resolveToken';\nimport { useTheme } from '../../../../theme/ThemeContext';\nimport type { IconProps } from '../../../../types/icon';\nimport { PortableIcon } from './PortableIcon';\n\n/*** Renders a theme-aware font or SVG icon through the portable icon adapter. */\nexport function Icon(props: IconProps) {\n const { theme } = useTheme();\n const size = props.size ?? 'm';\n const color = props.color ?? 'text';\n const resolvedSize = typeof size === 'number' ? size : resolveToken(theme.spacing, size);\n const resolvedColor = resolveToken(theme.colors, color);\n return <PortableIcon {...props} color={resolvedColor} size={resolvedSize} />;\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
|
|
3
|
+
import type { FontIconSource, SvgIconSource } from '../../../../types/icon';
|
|
4
|
+
/*** Renders a resolved portable icon using the configured font or SVG runtime. */
|
|
5
|
+
export declare function PortableIcon(props: PortableIconProps): React.JSX.Element;
|
|
6
|
+
interface PortableIconPresentationProps {
|
|
7
|
+
color: string;
|
|
8
|
+
size: number;
|
|
9
|
+
testID?: string;
|
|
10
|
+
}
|
|
11
|
+
type FontPortableIconProps = FontIconSource & PortableIconPresentationProps & {
|
|
12
|
+
style?: StyleProp<TextStyle>;
|
|
13
|
+
};
|
|
14
|
+
type SvgPortableIconProps = SvgIconSource & PortableIconPresentationProps & {
|
|
15
|
+
style?: StyleProp<ViewStyle>;
|
|
16
|
+
};
|
|
17
|
+
type PortableIconProps = FontPortableIconProps | SvgPortableIconProps;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=PortableIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortableIcon.d.ts","sourceRoot":"","sources":["../../../../../src/features/icon/adapters/inbound/PortableIcon.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,KAAK,SAAS,EAEd,KAAK,SAAS,EAEd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,cAAc,EAAc,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGxF,kFAAkF;AAClF,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,qBA0BpD;AAED,UAAU,6BAA6B;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,KAAK,qBAAqB,GAAG,cAAc,GACzC,6BAA6B,GAAG;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAAE,CAAC;AACnE,KAAK,oBAAoB,GAAG,aAAa,GACvC,6BAA6B,GAAG;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAAE,CAAC;AACnE,KAAK,iBAAiB,GAAG,qBAAqB,GAAG,oBAAoB,CAAC"}
|
|
@@ -1,22 +1,40 @@
|
|
|
1
|
-
import { FontAwesome
|
|
2
|
-
import { FontAwesome5
|
|
3
|
-
import { FontAwesome6
|
|
1
|
+
import { FontAwesome } from '@react-native-vector-icons/fontawesome/static';
|
|
2
|
+
import { FontAwesome5 } from '@react-native-vector-icons/fontawesome5/static';
|
|
3
|
+
import { FontAwesome6 } from '@react-native-vector-icons/fontawesome6/static';
|
|
4
4
|
import { Ionicons } from '@react-native-vector-icons/ionicons/static';
|
|
5
|
-
import { MaterialDesignIcons
|
|
5
|
+
import { MaterialDesignIcons } from '@react-native-vector-icons/material-design-icons/static';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { Image, StyleSheet, View, } from 'react-native';
|
|
8
8
|
import { SvgUri } from 'react-native-svg';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
'
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
/*** Renders a resolved portable icon using the configured font or SVG runtime. */
|
|
10
|
+
export function PortableIcon(props) {
|
|
11
|
+
if ('source' in props)
|
|
12
|
+
return renderSvgIcon(props);
|
|
13
|
+
const { provider } = props;
|
|
14
|
+
const sharedProps = {
|
|
15
|
+
color: props.color,
|
|
16
|
+
size: props.size,
|
|
17
|
+
style: props.style,
|
|
18
|
+
testID: props.testID,
|
|
19
|
+
};
|
|
20
|
+
switch (provider) {
|
|
21
|
+
case undefined:
|
|
22
|
+
case 'Ionicons':
|
|
23
|
+
return <Ionicons {...sharedProps} name={props.name}/>;
|
|
24
|
+
case 'FontAwesome':
|
|
25
|
+
return <FontAwesome {...sharedProps} name={props.name}/>;
|
|
26
|
+
case 'FontAwesome5':
|
|
27
|
+
return renderFontAwesome5(props, sharedProps);
|
|
28
|
+
case 'FontAwesome6':
|
|
29
|
+
return renderFontAwesome6(props, sharedProps);
|
|
30
|
+
case 'MaterialDesignIcons':
|
|
31
|
+
return <MaterialDesignIcons {...sharedProps} name={props.name}/>;
|
|
32
|
+
default:
|
|
33
|
+
return assertNever(provider, 'provider');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const styles = StyleSheet.create({ bundledSvgImage: { height: '100%', width: '100%' } });
|
|
37
|
+
/*** Resolves an SVG URI directly or through React Native's bundled-asset API. */
|
|
20
38
|
function resolveSvgIconUri(source) {
|
|
21
39
|
if (typeof source === 'string')
|
|
22
40
|
return source;
|
|
@@ -27,7 +45,7 @@ function resolveSvgIconUri(source) {
|
|
|
27
45
|
return null;
|
|
28
46
|
return Image.resolveAssetSource(source).uri;
|
|
29
47
|
}
|
|
30
|
-
/***
|
|
48
|
+
/*** Renders URI-backed SVGs and bundled SVG image assets. */
|
|
31
49
|
function renderSvgIcon(props) {
|
|
32
50
|
const uri = resolveSvgIconUri(props.source);
|
|
33
51
|
if (uri) {
|
|
@@ -38,9 +56,11 @@ function renderSvgIcon(props) {
|
|
|
38
56
|
<Image source={imageSource} style={styles.bundledSvgImage} tintColor={props.color}/>
|
|
39
57
|
</View>);
|
|
40
58
|
}
|
|
59
|
+
/*** Rejects unsupported icon configuration at runtime. */
|
|
41
60
|
function assertNever(value, configuration) {
|
|
42
61
|
throw new Error(`Unsupported icon ${configuration}: ${String(value)}`);
|
|
43
62
|
}
|
|
63
|
+
/*** Renders one FontAwesome5 variant. */
|
|
44
64
|
function renderFontAwesome5(props, sharedProps) {
|
|
45
65
|
const { variant } = props;
|
|
46
66
|
switch (variant) {
|
|
@@ -54,6 +74,7 @@ function renderFontAwesome5(props, sharedProps) {
|
|
|
54
74
|
return assertNever(variant, 'FontAwesome5 variant');
|
|
55
75
|
}
|
|
56
76
|
}
|
|
77
|
+
/*** Renders one FontAwesome6 variant. */
|
|
57
78
|
function renderFontAwesome6(props, sharedProps) {
|
|
58
79
|
const { variant } = props;
|
|
59
80
|
switch (variant) {
|
|
@@ -67,31 +88,4 @@ function renderFontAwesome6(props, sharedProps) {
|
|
|
67
88
|
return assertNever(variant, 'FontAwesome6 variant');
|
|
68
89
|
}
|
|
69
90
|
}
|
|
70
|
-
export function PortableIcon(props) {
|
|
71
|
-
if ('source' in props) {
|
|
72
|
-
return renderSvgIcon(props);
|
|
73
|
-
}
|
|
74
|
-
const { provider } = props;
|
|
75
|
-
const sharedProps = {
|
|
76
|
-
color: props.color,
|
|
77
|
-
size: props.size,
|
|
78
|
-
style: props.style,
|
|
79
|
-
testID: props.testID,
|
|
80
|
-
};
|
|
81
|
-
switch (provider) {
|
|
82
|
-
case undefined:
|
|
83
|
-
case 'Ionicons':
|
|
84
|
-
return <Ionicons {...sharedProps} name={props.name}/>;
|
|
85
|
-
case 'FontAwesome':
|
|
86
|
-
return <FontAwesome {...sharedProps} name={props.name}/>;
|
|
87
|
-
case 'FontAwesome5':
|
|
88
|
-
return renderFontAwesome5(props, sharedProps);
|
|
89
|
-
case 'FontAwesome6':
|
|
90
|
-
return renderFontAwesome6(props, sharedProps);
|
|
91
|
-
case 'MaterialDesignIcons':
|
|
92
|
-
return <MaterialDesignIcons {...sharedProps} name={props.name}/>;
|
|
93
|
-
default:
|
|
94
|
-
return assertNever(provider, 'provider');
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
91
|
//# sourceMappingURL=PortableIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortableIcon.js","sourceRoot":"","sources":["../../../../../src/features/icon/adapters/inbound/PortableIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,4CAA4C,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yDAAyD,CAAC;AAC9F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,KAAK,EAEL,UAAU,EAEV,IAAI,GAEL,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AA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;YACV,OAAO,CAAC,YAAY,CAAC,IAAI,WAAW,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAG,CAAC;QAC/E,KAAK,SAAS;YACZ,OAAO,CAAC,YAAY,CAAC,IAAI,WAAW,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAG,CAAC;QACjF,KAAK,OAAO;YACV,OAAO,CAAC,YAAY,CAAC,IAAI,WAAW,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAG,CAAC;QAC/E;YACE,OAAO,WAAW,CAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC;IACxD,CAAC;AACH,CAAC","sourcesContent":["import { FontAwesome } from '@react-native-vector-icons/fontawesome/static';\nimport { FontAwesome5 } from '@react-native-vector-icons/fontawesome5/static';\nimport { FontAwesome6 } from '@react-native-vector-icons/fontawesome6/static';\nimport { Ionicons } from '@react-native-vector-icons/ionicons/static';\nimport { MaterialDesignIcons } from '@react-native-vector-icons/material-design-icons/static';\nimport React from 'react';\nimport {\n Image,\n type StyleProp,\n StyleSheet,\n type TextStyle,\n View,\n type ViewStyle,\n} from 'react-native';\nimport { SvgUri } from 'react-native-svg';\n\nimport type { FontIconSource, IconSource, SvgIconSource } from '../../../../types/icon';\nimport type { SurfaceImageSource } from '../../../../types/image';\n\n/*** Renders a resolved portable icon using the configured font or SVG runtime. */\nexport function PortableIcon(props: PortableIconProps) {\n if ('source' in props) return renderSvgIcon(props);\n\n const { provider } = props;\n const sharedProps = {\n color: props.color,\n size: props.size,\n style: props.style,\n testID: props.testID,\n };\n\n switch (provider) {\n case undefined:\n case 'Ionicons':\n return <Ionicons {...sharedProps} name={props.name} />;\n case 'FontAwesome':\n return <FontAwesome {...sharedProps} name={props.name} />;\n case 'FontAwesome5':\n return renderFontAwesome5(props, sharedProps);\n case 'FontAwesome6':\n return renderFontAwesome6(props, sharedProps);\n case 'MaterialDesignIcons':\n return <MaterialDesignIcons {...sharedProps} name={props.name} />;\n default:\n return assertNever(provider, 'provider');\n }\n}\n\ninterface PortableIconPresentationProps {\n color: string;\n size: number;\n testID?: string;\n}\n\ntype FontPortableIconProps = FontIconSource &\n PortableIconPresentationProps & { style?: StyleProp<TextStyle> };\ntype SvgPortableIconProps = SvgIconSource &\n PortableIconPresentationProps & { style?: StyleProp<ViewStyle> };\ntype PortableIconProps = FontPortableIconProps | SvgPortableIconProps;\ntype SharedIconProps = PortableIconPresentationProps & { style?: StyleProp<TextStyle> };\n\nconst styles = StyleSheet.create({ bundledSvgImage: { height: '100%', width: '100%' } });\n\n/*** Resolves an SVG URI directly or through React Native's bundled-asset API. */\nfunction resolveSvgIconUri(source: SurfaceImageSource): string | null {\n if (typeof source === 'string') return source;\n if (!Array.isArray(source) && typeof source === 'object' && typeof source.uri === 'string') {\n return source.uri;\n }\n if (typeof Image.resolveAssetSource !== 'function') return null;\n return Image.resolveAssetSource(source).uri;\n}\n\n/*** Renders URI-backed SVGs and bundled SVG image assets. */\nfunction renderSvgIcon(props: SvgPortableIconProps) {\n const uri = resolveSvgIconUri(props.source);\n if (uri) {\n return (\n <SvgUri\n color={props.color}\n height={props.size}\n style={props.style}\n testID={props.testID}\n uri={uri}\n width={props.size}\n />\n );\n }\n\n const imageSource = typeof props.source === 'string' ? { uri: props.source } : props.source;\n return (\n <View style={[{ height: props.size, width: props.size }, props.style]} testID={props.testID}>\n <Image source={imageSource} style={styles.bundledSvgImage} tintColor={props.color} />\n </View>\n );\n}\n\n/*** Rejects unsupported icon configuration at runtime. */\nfunction assertNever(value: never, configuration: string): never {\n throw new Error(`Unsupported icon ${configuration}: ${String(value)}`);\n}\n\n/*** Renders one FontAwesome5 variant. */\nfunction renderFontAwesome5(\n props: Extract<IconSource, { provider: 'FontAwesome5' }>,\n sharedProps: SharedIconProps,\n) {\n const { variant } = props;\n\n switch (variant) {\n case 'brand':\n return <FontAwesome5 {...sharedProps} iconStyle=\"brand\" name={props.name} />;\n case 'regular':\n return <FontAwesome5 {...sharedProps} iconStyle=\"regular\" name={props.name} />;\n case 'solid':\n return <FontAwesome5 {...sharedProps} iconStyle=\"solid\" name={props.name} />;\n default:\n return assertNever(variant, 'FontAwesome5 variant');\n }\n}\n\n/*** Renders one FontAwesome6 variant. */\nfunction renderFontAwesome6(\n props: Extract<IconSource, { provider: 'FontAwesome6' }>,\n sharedProps: SharedIconProps,\n) {\n const { variant } = props;\n\n switch (variant) {\n case 'brand':\n return <FontAwesome6 {...sharedProps} iconStyle=\"brand\" name={props.name} />;\n case 'regular':\n return <FontAwesome6 {...sharedProps} iconStyle=\"regular\" name={props.name} />;\n case 'solid':\n return <FontAwesome6 {...sharedProps} iconStyle=\"solid\" name={props.name} />;\n default:\n return assertNever(variant, 'FontAwesome6 variant');\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/features/icon/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB,6FAMO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/features/icon/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,UAAU;IACV,aAAa;IACb,cAAc;IACd,cAAc;IACd,qBAAqB;CACqB,CAAC","sourcesContent":["import type { IconProvider } from '../../types/icon';\n\nexport const SUPPORTED_ICON_PROVIDERS = [\n 'Ionicons',\n 'FontAwesome',\n 'FontAwesome5',\n 'FontAwesome6',\n 'MaterialDesignIcons',\n] as const satisfies readonly IconProvider[];\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/icon/public.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,SAAS,EACT,YAAY,EACZ,UAAU,EACV,WAAW,EACX,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/features/icon/public.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export type {\n FontIconSource,\n IconProps,\n IconProvider,\n IconSource,\n IconVariant,\n SvgIconSource,\n} from '../../types/icon';\nexport { Icon } from './adapters/inbound/Icon';\nexport { SUPPORTED_ICON_PROVIDERS } from './constants';\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ImageProps } from '
|
|
2
|
+
import type { ImageProps } from '../../../../types/image';
|
|
3
|
+
/*** Renders a token-aware accessible image with optional fallback source. */
|
|
3
4
|
export declare function Image({ source, fallbackSource, alt, accessibilityLabel, width, height, aspectRatio, fit, resizeMode, radius, style, testID, onError, }: ImageProps): React.JSX.Element | null;
|
|
4
5
|
//# sourceMappingURL=Image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../../../src/features/image/adapters/inbound/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAS1D,6EAA6E;AAC7E,wBAAgB,KAAK,CAAC,EACpB,MAAM,EACN,cAAc,EACd,GAAG,EACH,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,WAAW,EACX,GAAG,EACH,UAAU,EACV,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,GACR,EAAE,UAAU,4BA0BZ"}
|