@ankhorage/surface 4.1.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 +12 -0
- package/README.md +1 -1
- 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/features/keyboard-avoiding-view/adapters/inbound/KeyboardAvoidingView.js +7 -0
- 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 -12
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +0 -6
- 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 +59 -19
- 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 -12
- 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 +18 -2
- 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/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/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
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';
|
|
3
|
-
export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
4
|
-
export interface HeadingProps {
|
|
5
|
-
text?: string;
|
|
6
|
-
children?: React.ReactNode;
|
|
7
|
-
level?: HeadingLevel;
|
|
8
|
-
align?: 'auto' | 'left' | 'right' | 'center' | 'justify';
|
|
9
|
-
color?: SurfaceColor;
|
|
10
|
-
emphasis?: SurfaceEmphasis;
|
|
11
|
-
numberOfLines?: number;
|
|
12
|
-
i18nKey?: string;
|
|
13
|
-
testID?: string;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/primitives/heading/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAExE,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;IACzD,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/primitives/heading/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';\n\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\nexport interface HeadingProps {\n text?: string;\n children?: React.ReactNode;\n level?: HeadingLevel;\n align?: 'auto' | 'left' | 'right' | 'center' | 'justify';\n color?: SurfaceColor;\n emphasis?: SurfaceEmphasis;\n numberOfLines?: number;\n i18nKey?: string;\n testID?: string;\n}\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
|
|
2
|
-
import type { SurfaceTheme } from '../../theme/types';
|
|
3
|
-
import { type FontIconSource, type SvgIconSource } from './PortableIcon';
|
|
4
|
-
export type { FontIconSource, IconProvider, IconSource, IconVariant, SvgIconSource, } from './PortableIcon';
|
|
5
|
-
interface IconPresentationProps {
|
|
6
|
-
size?: keyof SurfaceTheme['spacing'] | number;
|
|
7
|
-
color?: keyof SurfaceTheme['colors'] | string;
|
|
8
|
-
testID?: string;
|
|
9
|
-
}
|
|
10
|
-
export type IconProps = (FontIconSource & IconPresentationProps & {
|
|
11
|
-
style?: StyleProp<TextStyle>;
|
|
12
|
-
}) | (SvgIconSource & IconPresentationProps & {
|
|
13
|
-
style?: StyleProp<ViewStyle>;
|
|
14
|
-
});
|
|
15
|
-
export declare function Icon(props: IconProps): import("react").JSX.Element;
|
|
16
|
-
//# sourceMappingURL=Icon.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/primitives/icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,KAAK,cAAc,EAAgB,KAAK,a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C,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACzF,MAAM,aAAa,GAAG,YAAY,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAExD,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 { type StyleProp, type TextStyle, type ViewStyle } from 'react-native';\n\nimport { resolveToken } from '../../theme/resolveToken';\nimport { useTheme } from '../../theme/ThemeContext';\nimport type { SurfaceTheme } from '../../theme/types';\nimport { type FontIconSource, PortableIcon, type SvgIconSource } from './PortableIcon';\n\nexport type {\n FontIconSource,\n IconProvider,\n IconSource,\n IconVariant,\n SvgIconSource,\n} from './PortableIcon';\n\ninterface IconPresentationProps {\n size?: keyof SurfaceTheme['spacing'] | number;\n color?: keyof SurfaceTheme['colors'] | string;\n testID?: string;\n}\n\nexport type IconProps =\n | (FontIconSource & IconPresentationProps & { style?: StyleProp<TextStyle> })\n | (SvgIconSource & IconPresentationProps & { style?: StyleProp<ViewStyle> });\n\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\n return <PortableIcon {...props} color={resolvedColor} size={resolvedSize} />;\n}\n"]}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { type FontAwesomeIconName } from '@react-native-vector-icons/fontawesome/static';
|
|
2
|
-
import { type FontAwesome5BrandIconName, type FontAwesome5RegularIconName, type FontAwesome5SolidIconName } from '@react-native-vector-icons/fontawesome5/static';
|
|
3
|
-
import { type FontAwesome6BrandIconName, type FontAwesome6RegularIconName, type FontAwesome6SolidIconName } from '@react-native-vector-icons/fontawesome6/static';
|
|
4
|
-
import { type IoniconsIconName } from '@react-native-vector-icons/ionicons/static';
|
|
5
|
-
import { type MaterialDesignIconsIconName } from '@react-native-vector-icons/material-design-icons/static';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import { type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
|
|
8
|
-
import type { SurfaceImageSource } from '../image';
|
|
9
|
-
export declare const SUPPORTED_ICON_PROVIDERS: readonly ["Ionicons", "FontAwesome", "FontAwesome5", "FontAwesome6", "MaterialDesignIcons"];
|
|
10
|
-
export type IconProvider = (typeof SUPPORTED_ICON_PROVIDERS)[number];
|
|
11
|
-
export type IconVariant = 'regular' | 'solid' | 'brand';
|
|
12
|
-
export type FontIconSource = {
|
|
13
|
-
name: IoniconsIconName;
|
|
14
|
-
provider?: 'Ionicons';
|
|
15
|
-
variant?: never;
|
|
16
|
-
} | {
|
|
17
|
-
name: FontAwesomeIconName;
|
|
18
|
-
provider: 'FontAwesome';
|
|
19
|
-
variant?: never;
|
|
20
|
-
} | {
|
|
21
|
-
name: FontAwesome5RegularIconName;
|
|
22
|
-
provider: 'FontAwesome5';
|
|
23
|
-
variant: 'regular';
|
|
24
|
-
} | {
|
|
25
|
-
name: FontAwesome5SolidIconName;
|
|
26
|
-
provider: 'FontAwesome5';
|
|
27
|
-
variant: 'solid';
|
|
28
|
-
} | {
|
|
29
|
-
name: FontAwesome5BrandIconName;
|
|
30
|
-
provider: 'FontAwesome5';
|
|
31
|
-
variant: 'brand';
|
|
32
|
-
} | {
|
|
33
|
-
name: FontAwesome6RegularIconName;
|
|
34
|
-
provider: 'FontAwesome6';
|
|
35
|
-
variant: 'regular';
|
|
36
|
-
} | {
|
|
37
|
-
name: FontAwesome6SolidIconName;
|
|
38
|
-
provider: 'FontAwesome6';
|
|
39
|
-
variant: 'solid';
|
|
40
|
-
} | {
|
|
41
|
-
name: FontAwesome6BrandIconName;
|
|
42
|
-
provider: 'FontAwesome6';
|
|
43
|
-
variant: 'brand';
|
|
44
|
-
} | {
|
|
45
|
-
name: MaterialDesignIconsIconName;
|
|
46
|
-
provider: 'MaterialDesignIcons';
|
|
47
|
-
variant?: never;
|
|
48
|
-
};
|
|
49
|
-
export interface SvgIconSource {
|
|
50
|
-
source: SurfaceImageSource;
|
|
51
|
-
name?: never;
|
|
52
|
-
provider?: never;
|
|
53
|
-
variant?: never;
|
|
54
|
-
}
|
|
55
|
-
export type IconSource = FontIconSource | SvgIconSource;
|
|
56
|
-
interface PortableIconPresentationProps {
|
|
57
|
-
color: string;
|
|
58
|
-
size: number;
|
|
59
|
-
testID?: string;
|
|
60
|
-
}
|
|
61
|
-
type FontPortableIconProps = FontIconSource & PortableIconPresentationProps & {
|
|
62
|
-
style?: StyleProp<TextStyle>;
|
|
63
|
-
};
|
|
64
|
-
type SvgPortableIconProps = SvgIconSource & PortableIconPresentationProps & {
|
|
65
|
-
style?: StyleProp<ViewStyle>;
|
|
66
|
-
};
|
|
67
|
-
type PortableIconProps = FontPortableIconProps | SvgPortableIconProps;
|
|
68
|
-
export declare function PortableIcon(props: PortableIconProps): React.JSX.Element;
|
|
69
|
-
export {};
|
|
70
|
-
//# sourceMappingURL=PortableIcon.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PortableIcon.d.ts","sourceRoot":"","sources":["../../../src/primitives/icon/PortableIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC/B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC/B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAY,KAAK,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC7F,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,yDAAyD,CAAC;AACjE,O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K,EAAE,KAAK,CAAC,KAAK;QAClB,MAAM,EAAE,KAAK,CAAC,MAAM;KACrB,CAAC;IAEF,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,SAAS,CAAC;QACf,KAAK,UAAU;YACb,OAAO,CAAC,QAAQ,CAAC,IAAI,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAG,CAAC;QACzD,KAAK,aAAa;YAChB,OAAO,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAG,CAAC;QAC5D,KAAK,cAAc;YACjB,OAAO,kBAAkB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAChD,KAAK,cAAc;YACjB,OAAO,kBAAkB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAChD,KAAK,qBAAqB;YACxB,OAAO,CAAC,mBAAmB,CAAC,IAAI,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAG,CAAC;QACpE;YACE,OAAO,WAAW,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC","sourcesContent":["import {\n FontAwesome,\n type FontAwesomeIconName,\n} from '@react-native-vector-icons/fontawesome/static';\nimport {\n FontAwesome5,\n type FontAwesome5BrandIconName,\n type FontAwesome5RegularIconName,\n type FontAwesome5SolidIconName,\n} from '@react-native-vector-icons/fontawesome5/static';\nimport {\n FontAwesome6,\n type FontAwesome6BrandIconName,\n type FontAwesome6RegularIconName,\n type FontAwesome6SolidIconName,\n} from '@react-native-vector-icons/fontawesome6/static';\nimport { Ionicons, type IoniconsIconName } from '@react-native-vector-icons/ionicons/static';\nimport {\n MaterialDesignIcons,\n type MaterialDesignIconsIconName,\n} 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 { SurfaceImageSource } from '../image';\n\nexport const SUPPORTED_ICON_PROVIDERS = [\n 'Ionicons',\n 'FontAwesome',\n 'FontAwesome5',\n 'FontAwesome6',\n 'MaterialDesignIcons',\n] as const;\n\nexport type IconProvider = (typeof SUPPORTED_ICON_PROVIDERS)[number];\nexport type IconVariant = 'regular' | 'solid' | 'brand';\n\nexport type FontIconSource =\n | { name: IoniconsIconName; provider?: 'Ionicons'; variant?: never }\n | { name: FontAwesomeIconName; provider: 'FontAwesome'; variant?: never }\n | { name: FontAwesome5RegularIconName; provider: 'FontAwesome5'; variant: 'regular' }\n | { name: FontAwesome5SolidIconName; provider: 'FontAwesome5'; variant: 'solid' }\n | { name: FontAwesome5BrandIconName; provider: 'FontAwesome5'; variant: 'brand' }\n | { name: FontAwesome6RegularIconName; provider: 'FontAwesome6'; variant: 'regular' }\n | { name: FontAwesome6SolidIconName; provider: 'FontAwesome6'; variant: 'solid' }\n | { name: FontAwesome6BrandIconName; provider: 'FontAwesome6'; variant: 'brand' }\n | { name: MaterialDesignIconsIconName; provider: 'MaterialDesignIcons'; variant?: never };\n\nexport interface SvgIconSource {\n source: SurfaceImageSource;\n name?: never;\n provider?: never;\n variant?: never;\n}\n\nexport type IconSource = FontIconSource | SvgIconSource;\n\ninterface PortableIconPresentationProps {\n color: string;\n size: number;\n testID?: string;\n}\n\ntype FontPortableIconProps = FontIconSource &\n PortableIconPresentationProps & {\n style?: StyleProp<TextStyle>;\n };\n\ntype SvgPortableIconProps = SvgIconSource &\n PortableIconPresentationProps & {\n style?: StyleProp<ViewStyle>;\n };\n\ntype PortableIconProps = FontPortableIconProps | SvgPortableIconProps;\n\ntype SharedIconProps = PortableIconPresentationProps & {\n style?: StyleProp<TextStyle>;\n};\n\nconst styles = StyleSheet.create({\n bundledSvgImage: { height: '100%', width: '100%' },\n});\n\n/*** Resolve an SVG URI directly or through React Native's native bundled-asset API when available. */\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\n return Image.resolveAssetSource(source).uri;\n}\n\n/*** Render URI-backed SVGs through SvgUri and let React Native Web resolve bundled numeric assets through Image. */\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\nfunction assertNever(value: never, configuration: string): never {\n throw new Error(`Unsupported icon ${configuration}: ${String(value)}`);\n}\n\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\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\nexport function PortableIcon(props: PortableIconProps) {\n if ('source' in props) {\n return renderSvgIcon(props);\n }\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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/icon/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,SAAS,EACT,YAAY,EACZ,UAAU,EACV,WAAW,EACX,aAAa,GACd,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/primitives/icon/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export type {\n FontIconSource,\n IconProps,\n IconProvider,\n IconSource,\n IconVariant,\n SvgIconSource,\n} from './Icon';\nexport { Icon } from './Icon';\nexport { SUPPORTED_ICON_PROVIDERS } from './PortableIcon';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../src/primitives/image/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,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,4BAmCZ"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Image as RNImage } from 'react-native';
|
|
3
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
4
|
-
import { getSourceKey, normalizeSource, resolveAccessibilityLabel, resolveAlt, resolveImageStyle, resolveRenderedSource, resolveResizeMode, } from './resolveImageProps';
|
|
5
|
-
export function Image({ source, fallbackSource, alt, accessibilityLabel, width, height, aspectRatio, fit, resizeMode, radius, style, testID, onError, }) {
|
|
6
|
-
const { theme } = useTheme();
|
|
7
|
-
const primaryKey = React.useMemo(() => getSourceKey(source), [source]);
|
|
8
|
-
const [failedPrimaryKey, setFailedPrimaryKey] = React.useState(null);
|
|
9
|
-
const showFallback = primaryKey !== null && failedPrimaryKey === primaryKey;
|
|
10
|
-
const normalizedPrimary = normalizeSource(source);
|
|
11
|
-
const normalizedFallback = normalizeSource(fallbackSource);
|
|
12
|
-
const resolvedSource = resolveRenderedSource(normalizedPrimary, normalizedFallback, showFallback);
|
|
13
|
-
if (!resolvedSource)
|
|
14
|
-
return null;
|
|
15
|
-
const resolvedResizeMode = resolveResizeMode(fit, resizeMode);
|
|
16
|
-
const resolvedAccessibilityLabel = resolveAccessibilityLabel(alt, accessibilityLabel);
|
|
17
|
-
const resolvedAlt = resolveAlt(alt, accessibilityLabel);
|
|
18
|
-
const resolvedStyle = resolveImageStyle(theme, { width, height, aspectRatio, radius });
|
|
19
|
-
return (<RNImage accessibilityLabel={resolvedAccessibilityLabel} accessibilityRole="image" alt={resolvedAlt} onError={(event) => {
|
|
20
|
-
onError?.(event);
|
|
21
|
-
if (!showFallback && normalizedFallback) {
|
|
22
|
-
setFailedPrimaryKey(primaryKey);
|
|
23
|
-
}
|
|
24
|
-
}} resizeMode={resolvedResizeMode} source={resolvedSource} style={[resolvedStyle, style]} testID={testID}/>);
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=Image.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Image.js","sourceRoot":"","sources":["../../../src/primitives/image/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EACL,YAAY,EACZ,eAAe,EACf,yBAAyB,EACzB,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAG7B,MAAM,UAAU,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,GACI;IACX,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IACvE,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACpF,MAAM,YAAY,GAAG,UAAU,KAAK,IAAI,IAAI,gBAAgB,KAAK,UAAU,CAAC;IAE5E,MAAM,iBAAiB,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,kBAAkB,GAAG,eAAe,CAAC,cAAc,CAAC,CAAC;IAC3D,MAAM,cAAc,GAAG,qBAAqB,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,YAAY,CAAC,CAAC;IAElG,IAAI,CAAC,cAAc;QAAE,OAAO,IAAI,CAAC;IAEjC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAC9D,MAAM,0BAA0B,GAAG,yBAAyB,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC;IACtF,MAAM,WAAW,GAAG,UAAU,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC;IACxD,MAAM,aAAa,GAAG,iBAAiB,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC;IAEvF,OAAO,CACL,CAAC,OAAO,CACN,kBAAkB,CAAC,CAAC,0BAA0B,CAAC,CAC/C,iBAAiB,CAAC,OAAO,CACzB,GAAG,CAAC,CAAC,WAAW,CAAC,CACjB,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;YACjB,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;YAEjB,IAAI,CAAC,YAAY,IAAI,kBAAkB,EAAE,CAAC;gBACxC,mBAAmB,CAAC,UAAU,CAAC,CAAC;YAClC,CAAC;QACH,CAAC,CAAC,CACF,UAAU,CAAC,CAAC,kBAAkB,CAAC,CAC/B,MAAM,CAAC,CAAC,cAAc,CAAC,CACvB,KAAK,CAAC,CAAC,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC,CAC9B,MAAM,CAAC,CAAC,MAAM,CAAC,EACf,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { Image as RNImage } from 'react-native';\n\nimport { useTheme } from '../../theme/ThemeContext';\nimport {\n getSourceKey,\n normalizeSource,\n resolveAccessibilityLabel,\n resolveAlt,\n resolveImageStyle,\n resolveRenderedSource,\n resolveResizeMode,\n} from './resolveImageProps';\nimport type { ImageProps } from './types';\n\nexport function Image({\n source,\n fallbackSource,\n alt,\n accessibilityLabel,\n width,\n height,\n aspectRatio,\n fit,\n resizeMode,\n radius,\n style,\n testID,\n onError,\n}: ImageProps) {\n const { theme } = useTheme();\n const primaryKey = React.useMemo(() => getSourceKey(source), [source]);\n const [failedPrimaryKey, setFailedPrimaryKey] = React.useState<string | null>(null);\n const showFallback = primaryKey !== null && failedPrimaryKey === primaryKey;\n\n const normalizedPrimary = normalizeSource(source);\n const normalizedFallback = normalizeSource(fallbackSource);\n const resolvedSource = resolveRenderedSource(normalizedPrimary, normalizedFallback, showFallback);\n\n if (!resolvedSource) return null;\n\n const resolvedResizeMode = resolveResizeMode(fit, resizeMode);\n const resolvedAccessibilityLabel = resolveAccessibilityLabel(alt, accessibilityLabel);\n const resolvedAlt = resolveAlt(alt, accessibilityLabel);\n const resolvedStyle = resolveImageStyle(theme, { width, height, aspectRatio, radius });\n\n return (\n <RNImage\n accessibilityLabel={resolvedAccessibilityLabel}\n accessibilityRole=\"image\"\n alt={resolvedAlt}\n onError={(event) => {\n onError?.(event);\n\n if (!showFallback && normalizedFallback) {\n setFailedPrimaryKey(primaryKey);\n }\n }}\n resizeMode={resolvedResizeMode}\n source={resolvedSource}\n style={[resolvedStyle, style]}\n testID={testID}\n />\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/image/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/primitives/image/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC","sourcesContent":["export { Image } from './Image';\nexport type { ImageFit, ImageProps, SurfaceImageSource } from './types';\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ImageResizeMode, ImageSourcePropType } from 'react-native';
|
|
2
|
-
import type { ImageStyle } from 'react-native';
|
|
3
|
-
import type { SurfaceTheme } from '../../theme/types';
|
|
4
|
-
import type { ImageProps, SurfaceImageSource } from './types';
|
|
5
|
-
export declare function normalizeSource(source: SurfaceImageSource | null | undefined): ImageSourcePropType | undefined;
|
|
6
|
-
export declare function resolveRenderedSource(normalizedPrimary: ImageSourcePropType | undefined, normalizedFallback: ImageSourcePropType | undefined, showFallback: boolean): ImageSourcePropType | undefined;
|
|
7
|
-
export declare function getSourceKey(source: SurfaceImageSource | null | undefined): string | null;
|
|
8
|
-
export declare function resolveResizeMode(fit: ImageProps['fit'], resizeMode: ImageProps['resizeMode']): ImageResizeMode;
|
|
9
|
-
export declare function resolveAccessibilityLabel(alt: ImageProps['alt'], accessibilityLabel: ImageProps['accessibilityLabel']): string | undefined;
|
|
10
|
-
export declare function resolveAlt(alt: ImageProps['alt'], accessibilityLabel: ImageProps['accessibilityLabel']): string | undefined;
|
|
11
|
-
export declare function resolveImageStyle(theme: SurfaceTheme, props: Pick<ImageProps, 'width' | 'height' | 'aspectRatio' | 'radius'>): ImageStyle;
|
|
12
|
-
//# sourceMappingURL=resolveImageProps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveImageProps.d.ts","sourceRoot":"","sources":["../../../src/primitives/image/resolveImageProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE9D,wBAAgB,eAAe,CAC7B,MAAM,EAAE,kBAAkB,GAAG,IAAI,GAAG,SAAS,GAC5C,mBAAmB,GAAG,SAAS,CAIjC;AAED,wBAAgB,qBAAqB,CACnC,iBAAiB,EAAE,mBAAmB,GAAG,SAAS,EAClD,kBAAkB,EAAE,mBAAmB,GAAG,SAAS,EACnD,YAAY,EAAE,OAAO,GACpB,mBAAmB,GAAG,SAAS,CAGjC;AAYD,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAmBzF;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,UAAU,CAAC,KAAK,CAAC,EACtB,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,GACnC,eAAe,CAEjB;AAED,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,UAAU,CAAC,KAAK,CAAC,EACtB,kBAAkB,EAAE,UAAU,CAAC,oBAAoB,CAAC,GACnD,MAAM,GAAG,SAAS,CAEpB;AAED,wBAAgB,UAAU,CACxB,GAAG,EAAE,UAAU,CAAC,KAAK,CAAC,EACtB,kBAAkB,EAAE,UAAU,CAAC,oBAAoB,CAAC,GACnD,MAAM,GAAG,SAAS,CAEpB;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,CAAC,GACrE,UAAU,CAYZ"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { resolveToken } from '../../theme/resolveToken';
|
|
2
|
-
export function normalizeSource(source) {
|
|
3
|
-
if (source === null || source === undefined)
|
|
4
|
-
return undefined;
|
|
5
|
-
if (typeof source === 'string')
|
|
6
|
-
return { uri: source };
|
|
7
|
-
return source;
|
|
8
|
-
}
|
|
9
|
-
export function resolveRenderedSource(normalizedPrimary, normalizedFallback, showFallback) {
|
|
10
|
-
if (showFallback || !normalizedPrimary)
|
|
11
|
-
return normalizedFallback;
|
|
12
|
-
return normalizedPrimary;
|
|
13
|
-
}
|
|
14
|
-
function getUriFromSource(source) {
|
|
15
|
-
if (Array.isArray(source)) {
|
|
16
|
-
const [first] = source;
|
|
17
|
-
return first?.uri;
|
|
18
|
-
}
|
|
19
|
-
if (typeof source === 'number')
|
|
20
|
-
return undefined;
|
|
21
|
-
return source.uri;
|
|
22
|
-
}
|
|
23
|
-
export function getSourceKey(source) {
|
|
24
|
-
if (source === null || source === undefined)
|
|
25
|
-
return null;
|
|
26
|
-
if (typeof source === 'string')
|
|
27
|
-
return `uri:${source}`;
|
|
28
|
-
if (typeof source === 'number')
|
|
29
|
-
return `asset:${source}`;
|
|
30
|
-
if (Array.isArray(source)) {
|
|
31
|
-
const parts = source
|
|
32
|
-
.map((item) => item.uri)
|
|
33
|
-
.filter((value) => typeof value === 'string');
|
|
34
|
-
return `uri-set:${parts.join('|')}`;
|
|
35
|
-
}
|
|
36
|
-
const uri = getUriFromSource(source);
|
|
37
|
-
if (uri)
|
|
38
|
-
return `uri:${uri}`;
|
|
39
|
-
try {
|
|
40
|
-
return `src:${JSON.stringify(source)}`;
|
|
41
|
-
}
|
|
42
|
-
catch {
|
|
43
|
-
return 'src:unknown';
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
export function resolveResizeMode(fit, resizeMode) {
|
|
47
|
-
return fit ?? resizeMode ?? 'cover';
|
|
48
|
-
}
|
|
49
|
-
export function resolveAccessibilityLabel(alt, accessibilityLabel) {
|
|
50
|
-
return accessibilityLabel ?? alt;
|
|
51
|
-
}
|
|
52
|
-
export function resolveAlt(alt, accessibilityLabel) {
|
|
53
|
-
return alt ?? accessibilityLabel;
|
|
54
|
-
}
|
|
55
|
-
export function resolveImageStyle(theme, props) {
|
|
56
|
-
const width = resolveToken(theme.spacing, props.width);
|
|
57
|
-
const height = resolveToken(theme.spacing, props.height);
|
|
58
|
-
const borderRadius = resolveToken(theme.radii, props.radius);
|
|
59
|
-
return {
|
|
60
|
-
width,
|
|
61
|
-
height,
|
|
62
|
-
aspectRatio: props.aspectRatio,
|
|
63
|
-
borderRadius,
|
|
64
|
-
overflow: borderRadius !== undefined ? 'hidden' : undefined,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=resolveImageProps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveImageProps.js","sourceRoot":"","sources":["../../../src/primitives/image/resolveImageProps.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIxD,MAAM,UAAU,eAAe,CAC7B,MAA6C;IAE7C,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC9D,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IACvD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,iBAAkD,EAClD,kBAAmD,EACnD,YAAqB;IAErB,IAAI,YAAY,IAAI,CAAC,iBAAiB;QAAE,OAAO,kBAAkB,CAAC;IAClE,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED,SAAS,gBAAgB,CAAC,MAA2B;IACnD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC;QACvB,OAAO,KAAK,EAAE,GAAG,CAAC;IACpB,CAAC;IAED,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACjD,OAAO,MAAM,CAAC,GAAG,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAA6C;IACxE,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACzD,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAA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AC,MAAM,CAAC,CAAC;IACzD,MAAM,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAE7D,OAAO;QACL,KAAK;QACL,MAAM;QACN,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,YAAY;QACZ,QAAQ,EAAE,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;KAC5D,CAAC;AACJ,CAAC","sourcesContent":["import type { ImageResizeMode, ImageSourcePropType } from 'react-native';\nimport type { ImageStyle } from 'react-native';\n\nimport { resolveToken } from '../../theme/resolveToken';\nimport type { SurfaceTheme } from '../../theme/types';\nimport type { ImageProps, SurfaceImageSource } from './types';\n\nexport function normalizeSource(\n source: SurfaceImageSource | null | undefined,\n): ImageSourcePropType | undefined {\n if (source === null || source === undefined) return undefined;\n if (typeof source === 'string') return { uri: source };\n return source;\n}\n\nexport function resolveRenderedSource(\n normalizedPrimary: ImageSourcePropType | undefined,\n normalizedFallback: ImageSourcePropType | undefined,\n showFallback: boolean,\n): ImageSourcePropType | undefined {\n if (showFallback || !normalizedPrimary) return normalizedFallback;\n return normalizedPrimary;\n}\n\nfunction getUriFromSource(source: ImageSourcePropType): string | undefined {\n if (Array.isArray(source)) {\n const [first] = source;\n return first?.uri;\n }\n\n if (typeof source === 'number') return undefined;\n return source.uri;\n}\n\nexport function getSourceKey(source: SurfaceImageSource | null | undefined): string | null {\n if (source === null || source === undefined) return null;\n if (typeof source === 'string') return `uri:${source}`;\n if (typeof source === 'number') return `asset:${source}`;\n if (Array.isArray(source)) {\n const parts = source\n .map((item) => item.uri)\n .filter((value): value is string => typeof value === 'string');\n return `uri-set:${parts.join('|')}`;\n }\n\n const uri = getUriFromSource(source);\n if (uri) return `uri:${uri}`;\n\n try {\n return `src:${JSON.stringify(source)}`;\n } catch {\n return 'src:unknown';\n }\n}\n\nexport function resolveResizeMode(\n fit: ImageProps['fit'],\n resizeMode: ImageProps['resizeMode'],\n): ImageResizeMode {\n return fit ?? resizeMode ?? 'cover';\n}\n\nexport function resolveAccessibilityLabel(\n alt: ImageProps['alt'],\n accessibilityLabel: ImageProps['accessibilityLabel'],\n): string | undefined {\n return accessibilityLabel ?? alt;\n}\n\nexport function resolveAlt(\n alt: ImageProps['alt'],\n accessibilityLabel: ImageProps['accessibilityLabel'],\n): string | undefined {\n return alt ?? accessibilityLabel;\n}\n\nexport function resolveImageStyle(\n theme: SurfaceTheme,\n props: Pick<ImageProps, 'width' | 'height' | 'aspectRatio' | 'radius'>,\n): ImageStyle {\n const width = resolveToken(theme.spacing, props.width);\n const height = resolveToken(theme.spacing, props.height);\n const borderRadius = resolveToken(theme.radii, props.radius);\n\n return {\n width,\n height,\n aspectRatio: props.aspectRatio,\n borderRadius,\n overflow: borderRadius !== undefined ? 'hidden' : undefined,\n };\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/primitives/image/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,IAAI,qBAAqB,EACnC,eAAe,EACf,mBAAmB,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,mBAAmB,CAAC;AAE9D,MAAM,MAAM,QAAQ,GAAG,eAAe,CAAC;AAEvC,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACnC,cAAc,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC3C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;CAC5C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/primitives/image/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ImageProps as ReactNativeImageProps,\n ImageResizeMode,\n ImageSourcePropType,\n} from 'react-native';\nimport type { ImageStyle, StyleProp } from 'react-native';\n\nimport type { SurfaceTheme } from '../../theme/types';\n\nexport type SurfaceImageSource = string | ImageSourcePropType;\n\nexport type ImageFit = ImageResizeMode;\n\nexport interface ImageProps {\n source?: SurfaceImageSource | null;\n fallbackSource?: SurfaceImageSource | null;\n alt?: string;\n accessibilityLabel?: string;\n width?: number | string;\n height?: number | string;\n aspectRatio?: number;\n fit?: ImageFit;\n resizeMode?: ImageResizeMode;\n radius?: number | keyof SurfaceTheme['radii'];\n style?: StyleProp<ImageStyle>;\n testID?: string;\n onError?: ReactNativeImageProps['onError'];\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/primitives/text/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAwBzC,wBAAgB,IAAI,CAAC,EACnB,QAAQ,EACR,OAAO,EACP,OAAgB,EAChB,QAAoB,EACpB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AC;IAC7B,MAAM,EAAE,CAAC,EAAE,GAAG,qBAAqB,EAAE,CAAC;IACtC,MAAM,OAAO,GAAG,kBAAkB,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IAEzD,OAAO,CACL,CAAC,eAAe,CACd,aAAa,CAAC,CAAC,aAAa,CAAC,CAC7B,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,KAAK,CAAC,CAAC;YACL,iBAAiB,CAAC,KAAK,EAAE;gBACvB,KAAK;gBACL,MAAM;gBACN,OAAO;gBACP,MAAM;aACP,CAAC;YACF;gBACE,KAAK,EAAE,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC;aAChD;SACF,CAAC,CAEF;MAAA,CAAC,OAAO,CACV;IAAA,EAAE,eAAe,CAAC,CACnB,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { Text as ReactNativeText } from 'react-native';\n\nimport { useTranslationContext } from '../../context/TranslationContext';\nimport { resolveTextColor, resolveTextStyles } from '../../internal/resolvers';\nimport { useTheme } from '../../theme/ThemeContext';\nimport type { TextProps } from './types';\n\nfunction resolveTextContent(\n children: TextProps['children'],\n i18nKey: TextProps['i18nKey'],\n translate: (key: string) => string,\n) {\n if (children !== undefined) {\n return children;\n }\n\n if (!i18nKey) {\n return null;\n }\n\n try {\n const translated = translate(i18nKey);\n return translated && translated !== i18nKey ? translated : i18nKey;\n } catch (error) {\n console.warn('[Text] Translation error:', error);\n return i18nKey;\n }\n}\n\nexport function Text({\n children,\n i18nKey,\n variant = 'body',\n emphasis = 'default',\n color,\n align,\n weight,\n italic = false,\n numberOfLines,\n testID,\n}: TextProps) {\n const { theme } = useTheme();\n const { t } = useTranslationContext();\n const content = resolveTextContent(children, i18nKey, t);\n\n return (\n <ReactNativeText\n numberOfLines={numberOfLines}\n testID={testID}\n style={[\n resolveTextStyles(theme, {\n align,\n italic,\n variant,\n weight,\n }),\n {\n color: resolveTextColor(theme, emphasis, color),\n },\n ]}\n >\n {content}\n </ReactNativeText>\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/text/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/primitives/text/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC","sourcesContent":["export { Text } from './Text';\nexport type { TextProps } from './types';\n"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { TextStyle } from 'react-native';
|
|
3
|
-
import type { TextVariant, TextWeight } from '../../internal/resolvers/resolveTextStyles';
|
|
4
|
-
import type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';
|
|
5
|
-
export interface TextProps {
|
|
6
|
-
children?: React.ReactNode;
|
|
7
|
-
i18nKey?: string;
|
|
8
|
-
variant?: TextVariant;
|
|
9
|
-
emphasis?: SurfaceEmphasis;
|
|
10
|
-
color?: SurfaceColor;
|
|
11
|
-
align?: TextStyle['textAlign'];
|
|
12
|
-
weight?: TextWeight;
|
|
13
|
-
italic?: boolean;
|
|
14
|
-
numberOfLines?: number;
|
|
15
|
-
testID?: string;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/primitives/text/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAExE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/primitives/text/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { TextStyle } from 'react-native';\n\nimport type { TextVariant, TextWeight } from '../../internal/resolvers/resolveTextStyles';\nimport type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';\n\nexport interface TextProps {\n children?: React.ReactNode;\n i18nKey?: string;\n variant?: TextVariant;\n emphasis?: SurfaceEmphasis;\n color?: SurfaceColor;\n align?: TextStyle['textAlign'];\n weight?: TextWeight;\n italic?: boolean;\n numberOfLines?: number;\n testID?: string;\n}\n"]}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { resolveButtonColors, resolveControlSize } from '../../internal/resolvers';
|
|
4
|
-
import { Box } from '../../layout';
|
|
5
|
-
import { Text } from '../../primitives/text';
|
|
6
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
7
|
-
import type { BadgeProps } from './types';
|
|
8
|
-
|
|
9
|
-
export function Badge({
|
|
10
|
-
content,
|
|
11
|
-
variant = 'soft',
|
|
12
|
-
color = 'primary',
|
|
13
|
-
size = 's',
|
|
14
|
-
testID,
|
|
15
|
-
}: BadgeProps) {
|
|
16
|
-
const { theme } = useTheme();
|
|
17
|
-
const controlSize = resolveControlSize(theme, size);
|
|
18
|
-
const colors = resolveButtonColors(theme, {
|
|
19
|
-
variant,
|
|
20
|
-
color,
|
|
21
|
-
state: {
|
|
22
|
-
disabled: false,
|
|
23
|
-
focused: false,
|
|
24
|
-
hovered: false,
|
|
25
|
-
pressed: false,
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<Box
|
|
31
|
-
px={Math.max(theme.spacing.xs, controlSize.paddingHorizontal - 4)}
|
|
32
|
-
py={Math.max(4, controlSize.paddingVertical - 2)}
|
|
33
|
-
radius={controlSize.borderRadius}
|
|
34
|
-
style={{
|
|
35
|
-
alignSelf: 'flex-start',
|
|
36
|
-
backgroundColor: colors.backgroundColor,
|
|
37
|
-
borderColor: colors.borderColor,
|
|
38
|
-
borderWidth: variant === 'solid' ? 0 : 1,
|
|
39
|
-
}}
|
|
40
|
-
testID={testID}
|
|
41
|
-
>
|
|
42
|
-
<Text
|
|
43
|
-
color={color}
|
|
44
|
-
emphasis={variant === 'solid' ? 'inverse' : 'default'}
|
|
45
|
-
variant="bodySmall"
|
|
46
|
-
weight="medium"
|
|
47
|
-
>
|
|
48
|
-
{content}
|
|
49
|
-
</Text>
|
|
50
|
-
</Box>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ActivityIndicator, View } from 'react-native';
|
|
3
|
-
|
|
4
|
-
import { resolveButtonColors, resolveControlSize, resolveIconSize } from '../../internal/resolvers';
|
|
5
|
-
import { Box } from '../../layout';
|
|
6
|
-
import { ButtonBase } from '../../primitives/button-base';
|
|
7
|
-
import { Icon } from '../../primitives/icon';
|
|
8
|
-
import { Text } from '../../primitives/text';
|
|
9
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
10
|
-
import type { ButtonProps } from './types';
|
|
11
|
-
|
|
12
|
-
export function Button({
|
|
13
|
-
children,
|
|
14
|
-
variant = 'solid',
|
|
15
|
-
color = 'primary',
|
|
16
|
-
size = 'm',
|
|
17
|
-
disabled = false,
|
|
18
|
-
loading = false,
|
|
19
|
-
leadingIcon,
|
|
20
|
-
trailingIcon,
|
|
21
|
-
fullWidth = false,
|
|
22
|
-
onPress,
|
|
23
|
-
testID,
|
|
24
|
-
...props
|
|
25
|
-
}: ButtonProps) {
|
|
26
|
-
const { theme } = useTheme();
|
|
27
|
-
const controlSize = resolveControlSize(theme, size);
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<ButtonBase
|
|
31
|
-
{...props}
|
|
32
|
-
disabled={disabled || loading}
|
|
33
|
-
onPress={onPress}
|
|
34
|
-
style={{
|
|
35
|
-
alignSelf: fullWidth ? 'stretch' : 'flex-start',
|
|
36
|
-
}}
|
|
37
|
-
testID={testID}
|
|
38
|
-
>
|
|
39
|
-
{(state) => {
|
|
40
|
-
const colors = resolveButtonColors(theme, {
|
|
41
|
-
variant,
|
|
42
|
-
color,
|
|
43
|
-
state,
|
|
44
|
-
});
|
|
45
|
-
const textEmphasis =
|
|
46
|
-
colors.contentColor === theme.semantics.content.muted ? 'muted' : 'default';
|
|
47
|
-
const resolvedTextColor = textEmphasis === 'muted' ? undefined : color;
|
|
48
|
-
const resolvedTextEmphasis =
|
|
49
|
-
textEmphasis === 'muted' ? 'muted' : variant === 'solid' ? 'inverse' : 'default';
|
|
50
|
-
const iconSize = resolveIconSize(theme, size);
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<Box
|
|
54
|
-
px={controlSize.paddingHorizontal}
|
|
55
|
-
py={controlSize.paddingVertical}
|
|
56
|
-
radius={controlSize.borderRadius}
|
|
57
|
-
style={{
|
|
58
|
-
minHeight: controlSize.minHeight,
|
|
59
|
-
width: fullWidth ? '100%' : undefined,
|
|
60
|
-
flexDirection: 'row',
|
|
61
|
-
alignItems: 'center',
|
|
62
|
-
justifyContent: 'center',
|
|
63
|
-
backgroundColor: colors.backgroundColor,
|
|
64
|
-
borderColor: colors.borderColor,
|
|
65
|
-
borderWidth: variant === 'solid' ? 0 : 1,
|
|
66
|
-
opacity: colors.opacity,
|
|
67
|
-
}}
|
|
68
|
-
>
|
|
69
|
-
{loading ? (
|
|
70
|
-
<ActivityIndicator color={colors.contentColor} size="small" />
|
|
71
|
-
) : (
|
|
72
|
-
<>
|
|
73
|
-
{leadingIcon ? (
|
|
74
|
-
<View style={{ marginRight: theme.spacing.s }}>
|
|
75
|
-
<Icon {...leadingIcon} color={colors.contentColor} size={iconSize} />
|
|
76
|
-
</View>
|
|
77
|
-
) : null}
|
|
78
|
-
<Text
|
|
79
|
-
color={resolvedTextColor}
|
|
80
|
-
emphasis={resolvedTextEmphasis}
|
|
81
|
-
variant={controlSize.textVariant}
|
|
82
|
-
weight="semiBold"
|
|
83
|
-
>
|
|
84
|
-
{children}
|
|
85
|
-
</Text>
|
|
86
|
-
{trailingIcon ? (
|
|
87
|
-
<View style={{ marginLeft: theme.spacing.s }}>
|
|
88
|
-
<Icon {...trailingIcon} color={colors.contentColor} size={iconSize} />
|
|
89
|
-
</View>
|
|
90
|
-
) : null}
|
|
91
|
-
</>
|
|
92
|
-
)}
|
|
93
|
-
</Box>
|
|
94
|
-
);
|
|
95
|
-
}}
|
|
96
|
-
</ButtonBase>
|
|
97
|
-
);
|
|
98
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
|
|
3
|
-
import type { ControlSize } from '../../internal/resolvers/resolveControlSize';
|
|
4
|
-
import type { ButtonVariant } from '../../internal/resolvers/resolveInteractiveColors';
|
|
5
|
-
import type { ButtonBaseProps } from '../../primitives/button-base';
|
|
6
|
-
import type { IconSource } from '../../primitives/icon';
|
|
7
|
-
import type { SurfaceColor } from '../../surfaceColor';
|
|
8
|
-
|
|
9
|
-
export type ButtonIconSpec = IconSource;
|
|
10
|
-
|
|
11
|
-
export interface ButtonProps extends Omit<
|
|
12
|
-
ButtonBaseProps,
|
|
13
|
-
'accessibilityLabel' | 'children' | 'style'
|
|
14
|
-
> {
|
|
15
|
-
children?: React.ReactNode;
|
|
16
|
-
variant?: ButtonVariant;
|
|
17
|
-
color?: SurfaceColor;
|
|
18
|
-
size?: ControlSize;
|
|
19
|
-
loading?: boolean;
|
|
20
|
-
leadingIcon?: ButtonIconSpec;
|
|
21
|
-
trailingIcon?: ButtonIconSpec;
|
|
22
|
-
fullWidth?: boolean;
|
|
23
|
-
}
|