@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,52 @@
|
|
|
1
|
+
import type { FontAwesomeIconName } from '@react-native-vector-icons/fontawesome/static';
|
|
2
|
+
import type {
|
|
3
|
+
FontAwesome5BrandIconName,
|
|
4
|
+
FontAwesome5RegularIconName,
|
|
5
|
+
FontAwesome5SolidIconName,
|
|
6
|
+
} from '@react-native-vector-icons/fontawesome5/static';
|
|
7
|
+
import type {
|
|
8
|
+
FontAwesome6BrandIconName,
|
|
9
|
+
FontAwesome6RegularIconName,
|
|
10
|
+
FontAwesome6SolidIconName,
|
|
11
|
+
} from '@react-native-vector-icons/fontawesome6/static';
|
|
12
|
+
import type { IoniconsIconName } from '@react-native-vector-icons/ionicons/static';
|
|
13
|
+
import type { MaterialDesignIconsIconName } from '@react-native-vector-icons/material-design-icons/static';
|
|
14
|
+
import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
15
|
+
|
|
16
|
+
import type { SurfaceTheme } from '../theme/types';
|
|
17
|
+
import type { SurfaceImageSource } from './image';
|
|
18
|
+
|
|
19
|
+
export type IconProvider =
|
|
20
|
+
'Ionicons' | 'FontAwesome' | 'FontAwesome5' | 'FontAwesome6' | 'MaterialDesignIcons';
|
|
21
|
+
|
|
22
|
+
export type IconVariant = 'regular' | 'solid' | 'brand';
|
|
23
|
+
|
|
24
|
+
export type FontIconSource =
|
|
25
|
+
| { name: IoniconsIconName; provider?: 'Ionicons'; variant?: never }
|
|
26
|
+
| { name: FontAwesomeIconName; provider: 'FontAwesome'; variant?: never }
|
|
27
|
+
| { name: FontAwesome5RegularIconName; provider: 'FontAwesome5'; variant: 'regular' }
|
|
28
|
+
| { name: FontAwesome5SolidIconName; provider: 'FontAwesome5'; variant: 'solid' }
|
|
29
|
+
| { name: FontAwesome5BrandIconName; provider: 'FontAwesome5'; variant: 'brand' }
|
|
30
|
+
| { name: FontAwesome6RegularIconName; provider: 'FontAwesome6'; variant: 'regular' }
|
|
31
|
+
| { name: FontAwesome6SolidIconName; provider: 'FontAwesome6'; variant: 'solid' }
|
|
32
|
+
| { name: FontAwesome6BrandIconName; provider: 'FontAwesome6'; variant: 'brand' }
|
|
33
|
+
| { name: MaterialDesignIconsIconName; provider: 'MaterialDesignIcons'; variant?: never };
|
|
34
|
+
|
|
35
|
+
export interface SvgIconSource {
|
|
36
|
+
source: SurfaceImageSource;
|
|
37
|
+
name?: never;
|
|
38
|
+
provider?: never;
|
|
39
|
+
variant?: never;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type IconSource = FontIconSource | SvgIconSource;
|
|
43
|
+
|
|
44
|
+
interface IconPresentationProps {
|
|
45
|
+
size?: keyof SurfaceTheme['spacing'] | number;
|
|
46
|
+
color?: keyof SurfaceTheme['colors'] | string;
|
|
47
|
+
testID?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type IconProps =
|
|
51
|
+
| (FontIconSource & IconPresentationProps & { style?: StyleProp<TextStyle> })
|
|
52
|
+
| (SvgIconSource & IconPresentationProps & { style?: StyleProp<ViewStyle> });
|
|
@@ -2,13 +2,13 @@ import type {
|
|
|
2
2
|
ImageProps as ReactNativeImageProps,
|
|
3
3
|
ImageResizeMode,
|
|
4
4
|
ImageSourcePropType,
|
|
5
|
+
ImageStyle,
|
|
6
|
+
StyleProp,
|
|
5
7
|
} from 'react-native';
|
|
6
|
-
import type { ImageStyle, StyleProp } from 'react-native';
|
|
7
8
|
|
|
8
|
-
import type { SurfaceTheme } from '
|
|
9
|
+
import type { SurfaceTheme } from '../theme/types';
|
|
9
10
|
|
|
10
11
|
export type SurfaceImageSource = string | ImageSourcePropType;
|
|
11
|
-
|
|
12
12
|
export type ImageFit = ImageResizeMode;
|
|
13
13
|
|
|
14
14
|
export interface ImageProps {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { KeyboardAvoidingViewProps as ReactNativeKeyboardAvoidingViewProps } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export type KeyboardAvoidingViewBehavior = NonNullable<
|
|
4
|
+
ReactNativeKeyboardAvoidingViewProps['behavior']
|
|
5
|
+
>;
|
|
6
|
+
export type KeyboardAvoidingViewProps = ReactNativeKeyboardAvoidingViewProps;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { StyleProp, ViewProps as ReactNativeViewProps, ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import type { Responsive } from '../core/responsive';
|
|
5
|
+
import type { SurfaceTheme } from '../theme/types';
|
|
6
|
+
|
|
7
|
+
type SpaceToken = keyof SurfaceTheme['spacing'];
|
|
8
|
+
type RadiusToken = keyof SurfaceTheme['radii'];
|
|
9
|
+
type ColorToken = keyof SurfaceTheme['colors'];
|
|
10
|
+
type RadiusValue = number | RadiusToken;
|
|
11
|
+
|
|
12
|
+
export type SpaceValue = number | SpaceToken;
|
|
13
|
+
export type ColorValue = string | ColorToken;
|
|
14
|
+
|
|
15
|
+
export interface BoxStyleProps {
|
|
16
|
+
p?: Responsive<SpaceValue>;
|
|
17
|
+
px?: Responsive<SpaceValue>;
|
|
18
|
+
py?: Responsive<SpaceValue>;
|
|
19
|
+
pt?: Responsive<SpaceValue>;
|
|
20
|
+
pb?: Responsive<SpaceValue>;
|
|
21
|
+
pl?: Responsive<SpaceValue>;
|
|
22
|
+
pr?: Responsive<SpaceValue>;
|
|
23
|
+
m?: Responsive<SpaceValue>;
|
|
24
|
+
mx?: Responsive<SpaceValue>;
|
|
25
|
+
my?: Responsive<SpaceValue>;
|
|
26
|
+
mt?: Responsive<SpaceValue>;
|
|
27
|
+
mb?: Responsive<SpaceValue>;
|
|
28
|
+
ml?: Responsive<SpaceValue>;
|
|
29
|
+
mr?: Responsive<SpaceValue>;
|
|
30
|
+
bg?: Responsive<ColorValue>;
|
|
31
|
+
radius?: Responsive<RadiusValue>;
|
|
32
|
+
borderWidth?: Responsive<number>;
|
|
33
|
+
borderColor?: Responsive<ColorValue>;
|
|
34
|
+
width?: Responsive<number | string>;
|
|
35
|
+
height?: Responsive<number | string>;
|
|
36
|
+
minWidth?: Responsive<number | string>;
|
|
37
|
+
maxWidth?: Responsive<number | string>;
|
|
38
|
+
minHeight?: Responsive<number | string>;
|
|
39
|
+
maxHeight?: Responsive<number | string>;
|
|
40
|
+
flex?: Responsive<number>;
|
|
41
|
+
flexGrow?: Responsive<number>;
|
|
42
|
+
flexShrink?: Responsive<number>;
|
|
43
|
+
flexBasis?: Responsive<number | string>;
|
|
44
|
+
alignSelf?: Responsive<ViewStyle['alignSelf']>;
|
|
45
|
+
position?: Responsive<ViewStyle['position']>;
|
|
46
|
+
top?: Responsive<number>;
|
|
47
|
+
bottom?: Responsive<number>;
|
|
48
|
+
left?: Responsive<number>;
|
|
49
|
+
right?: Responsive<number>;
|
|
50
|
+
overflow?: Responsive<ViewStyle['overflow']>;
|
|
51
|
+
zIndex?: Responsive<number>;
|
|
52
|
+
opacity?: Responsive<number>;
|
|
53
|
+
style?: StyleProp<ViewStyle>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface BoxProps extends BoxStyleProps {
|
|
57
|
+
accessibilityLabel?: ReactNativeViewProps['accessibilityLabel'];
|
|
58
|
+
accessibilityRole?: ReactNativeViewProps['accessibilityRole'];
|
|
59
|
+
accessibilityState?: ReactNativeViewProps['accessibilityState'];
|
|
60
|
+
accessible?: ReactNativeViewProps['accessible'];
|
|
61
|
+
children?: React.ReactNode;
|
|
62
|
+
pointerEvents?: ReactNativeViewProps['pointerEvents'];
|
|
63
|
+
testID?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface ContainerProps extends Omit<BoxProps, 'children'> {
|
|
67
|
+
children?: React.ReactNode;
|
|
68
|
+
maxWidth?: Responsive<number>;
|
|
69
|
+
px?: Responsive<number | keyof SurfaceTheme['spacing']>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface DividerProps extends Omit<BoxProps, 'bg' | 'height' | 'width'> {
|
|
73
|
+
orientation?: 'horizontal' | 'vertical';
|
|
74
|
+
color?: ColorValue;
|
|
75
|
+
thickness?: number;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface GridProps extends Omit<BoxProps, 'children'> {
|
|
79
|
+
children?: React.ReactNode;
|
|
80
|
+
cols: Responsive<number>;
|
|
81
|
+
gap?: Responsive<SpaceValue>;
|
|
82
|
+
rowGap?: Responsive<SpaceValue>;
|
|
83
|
+
colGap?: Responsive<SpaceValue>;
|
|
84
|
+
minItemWidth?: Responsive<number>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface StackProps extends Omit<BoxProps, 'children'> {
|
|
88
|
+
children?: React.ReactNode;
|
|
89
|
+
direction?: Responsive<'row' | 'column'>;
|
|
90
|
+
gap?: Responsive<SpaceValue>;
|
|
91
|
+
align?: Responsive<'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline'>;
|
|
92
|
+
justify?: Responsive<
|
|
93
|
+
'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly'
|
|
94
|
+
>;
|
|
95
|
+
wrap?: Responsive<'nowrap' | 'wrap'>;
|
|
96
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
|
|
3
|
-
import type { ControlSize } from '
|
|
4
|
-
import type { ButtonBaseProps } from '
|
|
5
|
-
import type { SurfaceColor } from '
|
|
3
|
+
import type { ControlSize } from '../internal/resolvers/resolveControlSize';
|
|
4
|
+
import type { ButtonBaseProps } from '../primitives/button-base';
|
|
5
|
+
import type { SurfaceColor } from '../surfaceColor';
|
|
6
6
|
|
|
7
7
|
export interface RadioProps extends Omit<
|
|
8
8
|
ButtonBaseProps,
|
|
@@ -5,8 +5,8 @@ import type {
|
|
|
5
5
|
TextStyle,
|
|
6
6
|
} from 'react-native';
|
|
7
7
|
|
|
8
|
-
import type { InteractionPolicy } from '
|
|
9
|
-
import type { ControlSize } from '
|
|
8
|
+
import type { InteractionPolicy } from '../interactionPolicy';
|
|
9
|
+
import type { ControlSize } from '../internal/resolvers/resolveControlSize';
|
|
10
10
|
|
|
11
11
|
export interface TextInputProps extends Omit<
|
|
12
12
|
ReactNativeTextInputProps,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { TextStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import type { TextVariant, TextWeight } from '../internal/resolvers/resolveTextStyles';
|
|
5
|
+
import type { SurfaceColor, SurfaceEmphasis } from '../surfaceColor';
|
|
6
|
+
|
|
7
|
+
export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
8
|
+
|
|
9
|
+
export interface HeadingProps {
|
|
10
|
+
text?: string;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
level?: HeadingLevel;
|
|
13
|
+
align?: 'auto' | 'left' | 'right' | 'center' | 'justify';
|
|
14
|
+
color?: SurfaceColor;
|
|
15
|
+
emphasis?: SurfaceEmphasis;
|
|
16
|
+
numberOfLines?: number;
|
|
17
|
+
i18nKey?: string;
|
|
18
|
+
testID?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface TextProps {
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
i18nKey?: string;
|
|
24
|
+
variant?: TextVariant;
|
|
25
|
+
emphasis?: SurfaceEmphasis;
|
|
26
|
+
color?: SurfaceColor;
|
|
27
|
+
align?: TextStyle['textAlign'];
|
|
28
|
+
weight?: TextWeight;
|
|
29
|
+
italic?: boolean;
|
|
30
|
+
numberOfLines?: number;
|
|
31
|
+
testID?: string;
|
|
32
|
+
}
|
|
@@ -1,41 +1,25 @@
|
|
|
1
1
|
import { describe, expect, test } from 'bun:test';
|
|
2
2
|
|
|
3
3
|
import type { SurfaceTheme } from '../theme/types';
|
|
4
|
-
import { resolveBoxStyles } from './
|
|
4
|
+
import { resolveBoxStyles } from './resolveBoxStyles';
|
|
5
5
|
|
|
6
6
|
const mockTheme = {
|
|
7
|
-
spacing: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
l: 16,
|
|
11
|
-
},
|
|
12
|
-
radii: {
|
|
13
|
-
m: 8,
|
|
14
|
-
},
|
|
15
|
-
colors: {
|
|
16
|
-
primary: '#007AFF',
|
|
17
|
-
surface: '#FFFFFF',
|
|
18
|
-
},
|
|
7
|
+
spacing: { s: 4, m: 8, l: 16 },
|
|
8
|
+
radii: { m: 8 },
|
|
9
|
+
colors: { primary: '#007AFF', surface: '#FFFFFF' },
|
|
19
10
|
} as unknown as SurfaceTheme;
|
|
20
11
|
|
|
21
12
|
describe('resolveBoxStyles', () => {
|
|
22
13
|
test('resolves padding and margins correctly', () => {
|
|
23
|
-
const styles = resolveBoxStyles(mockTheme, 'base', {
|
|
24
|
-
p: 's',
|
|
25
|
-
m: 8,
|
|
26
|
-
});
|
|
14
|
+
const styles = resolveBoxStyles(mockTheme, 'base', { p: 's', m: 8 });
|
|
27
15
|
expect(styles.padding).toBe(4);
|
|
28
16
|
expect(styles.margin).toBe(8);
|
|
29
17
|
});
|
|
30
18
|
|
|
31
19
|
test('resolves responsive properties', () => {
|
|
32
|
-
const props = {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const baseStyles = resolveBoxStyles(mockTheme, 'base', props);
|
|
36
|
-
const lgStyles = resolveBoxStyles(mockTheme, 'lg', props);
|
|
37
|
-
expect(baseStyles.padding).toBe(4);
|
|
38
|
-
expect(lgStyles.padding).toBe(16);
|
|
20
|
+
const props = { p: { base: 's', lg: 'l' } } as const;
|
|
21
|
+
expect(resolveBoxStyles(mockTheme, 'base', props).padding).toBe(4);
|
|
22
|
+
expect(resolveBoxStyles(mockTheme, 'lg', props).padding).toBe(16);
|
|
39
23
|
});
|
|
40
24
|
|
|
41
25
|
test('resolves colors and border styles', () => {
|
|
@@ -57,7 +41,6 @@ describe('resolveBoxStyles', () => {
|
|
|
57
41
|
minHeight: 'l',
|
|
58
42
|
maxWidth: '50%',
|
|
59
43
|
});
|
|
60
|
-
|
|
61
44
|
expect(styles.width).toBe(8);
|
|
62
45
|
expect(styles.minHeight).toBe(16);
|
|
63
46
|
expect(styles.maxWidth).toBe('50%');
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import { resolveResponsive } from '../core/responsive/resolve';
|
|
4
|
+
import type { Breakpoint } from '../core/responsive/types';
|
|
5
|
+
import { resolveToken } from '../theme/resolveToken';
|
|
6
|
+
import type { SurfaceTheme } from '../theme/types';
|
|
7
|
+
import type { BoxStyleProps, ColorValue } from '../types/layout';
|
|
8
|
+
import { resolveSpacing } from './resolveSpacing';
|
|
9
|
+
|
|
10
|
+
/*** Resolves responsive Box style props into one React Native view style. */
|
|
11
|
+
export function resolveBoxStyles(
|
|
12
|
+
theme: SurfaceTheme,
|
|
13
|
+
breakpoint: Breakpoint,
|
|
14
|
+
props: BoxStyleProps,
|
|
15
|
+
): ViewStyle {
|
|
16
|
+
return {
|
|
17
|
+
elevation: 0,
|
|
18
|
+
...resolveSpacingStyles(theme, breakpoint, props),
|
|
19
|
+
...resolveVisualStyles(theme, breakpoint, props),
|
|
20
|
+
...resolveDimensionStyles(theme, breakpoint, props),
|
|
21
|
+
...resolveLayoutStyles(breakpoint, props),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/*** Resolves padding and margin styles from responsive spacing props. */
|
|
26
|
+
function resolveSpacingStyles(
|
|
27
|
+
theme: SurfaceTheme,
|
|
28
|
+
breakpoint: Breakpoint,
|
|
29
|
+
props: BoxStyleProps,
|
|
30
|
+
): ViewStyle {
|
|
31
|
+
return {
|
|
32
|
+
padding: resolveSpacing(theme, resolveResponsive(props.p, breakpoint)),
|
|
33
|
+
paddingHorizontal: resolveSpacing(theme, resolveResponsive(props.px, breakpoint)),
|
|
34
|
+
paddingVertical: resolveSpacing(theme, resolveResponsive(props.py, breakpoint)),
|
|
35
|
+
paddingTop: resolveSpacing(theme, resolveResponsive(props.pt, breakpoint)),
|
|
36
|
+
paddingBottom: resolveSpacing(theme, resolveResponsive(props.pb, breakpoint)),
|
|
37
|
+
paddingLeft: resolveSpacing(theme, resolveResponsive(props.pl, breakpoint)),
|
|
38
|
+
paddingRight: resolveSpacing(theme, resolveResponsive(props.pr, breakpoint)),
|
|
39
|
+
margin: resolveSpacing(theme, resolveResponsive(props.m, breakpoint)),
|
|
40
|
+
marginHorizontal: resolveSpacing(theme, resolveResponsive(props.mx, breakpoint)),
|
|
41
|
+
marginVertical: resolveSpacing(theme, resolveResponsive(props.my, breakpoint)),
|
|
42
|
+
marginTop: resolveSpacing(theme, resolveResponsive(props.mt, breakpoint)),
|
|
43
|
+
marginBottom: resolveSpacing(theme, resolveResponsive(props.mb, breakpoint)),
|
|
44
|
+
marginLeft: resolveSpacing(theme, resolveResponsive(props.ml, breakpoint)),
|
|
45
|
+
marginRight: resolveSpacing(theme, resolveResponsive(props.mr, breakpoint)),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/*** Resolves background, radius, and border styles. */
|
|
50
|
+
function resolveVisualStyles(
|
|
51
|
+
theme: SurfaceTheme,
|
|
52
|
+
breakpoint: Breakpoint,
|
|
53
|
+
props: BoxStyleProps,
|
|
54
|
+
): ViewStyle {
|
|
55
|
+
return {
|
|
56
|
+
backgroundColor: resolveColor(theme, resolveResponsive(props.bg, breakpoint)),
|
|
57
|
+
borderRadius: resolveRadius(theme, resolveResponsive(props.radius, breakpoint)),
|
|
58
|
+
borderWidth: resolveResponsive(props.borderWidth, breakpoint),
|
|
59
|
+
borderColor: resolveColor(theme, resolveResponsive(props.borderColor, breakpoint)),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/*** Resolves responsive dimension props through spacing tokens. */
|
|
64
|
+
function resolveDimensionStyles(
|
|
65
|
+
theme: SurfaceTheme,
|
|
66
|
+
breakpoint: Breakpoint,
|
|
67
|
+
props: BoxStyleProps,
|
|
68
|
+
): ViewStyle {
|
|
69
|
+
return {
|
|
70
|
+
width: resolveDimension(
|
|
71
|
+
theme,
|
|
72
|
+
resolveResponsive(props.width, breakpoint),
|
|
73
|
+
) as ViewStyle['width'],
|
|
74
|
+
height: resolveDimension(
|
|
75
|
+
theme,
|
|
76
|
+
resolveResponsive(props.height, breakpoint),
|
|
77
|
+
) as ViewStyle['height'],
|
|
78
|
+
minWidth: resolveDimension(
|
|
79
|
+
theme,
|
|
80
|
+
resolveResponsive(props.minWidth, breakpoint),
|
|
81
|
+
) as ViewStyle['minWidth'],
|
|
82
|
+
maxWidth: resolveDimension(
|
|
83
|
+
theme,
|
|
84
|
+
resolveResponsive(props.maxWidth, breakpoint),
|
|
85
|
+
) as ViewStyle['maxWidth'],
|
|
86
|
+
minHeight: resolveDimension(
|
|
87
|
+
theme,
|
|
88
|
+
resolveResponsive(props.minHeight, breakpoint),
|
|
89
|
+
) as ViewStyle['minHeight'],
|
|
90
|
+
maxHeight: resolveDimension(
|
|
91
|
+
theme,
|
|
92
|
+
resolveResponsive(props.maxHeight, breakpoint),
|
|
93
|
+
) as ViewStyle['maxHeight'],
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/*** Resolves responsive flex, positioning, and visibility styles. */
|
|
98
|
+
function resolveLayoutStyles(breakpoint: Breakpoint, props: BoxStyleProps): ViewStyle {
|
|
99
|
+
return {
|
|
100
|
+
flex: resolveResponsive(props.flex, breakpoint),
|
|
101
|
+
flexGrow: resolveResponsive(props.flexGrow, breakpoint),
|
|
102
|
+
flexShrink: resolveResponsive(props.flexShrink, breakpoint),
|
|
103
|
+
flexBasis: resolveResponsive(props.flexBasis, breakpoint) as ViewStyle['flexBasis'],
|
|
104
|
+
alignSelf: resolveResponsive(props.alignSelf, breakpoint),
|
|
105
|
+
position: resolveResponsive(props.position, breakpoint),
|
|
106
|
+
top: resolveResponsive(props.top, breakpoint),
|
|
107
|
+
bottom: resolveResponsive(props.bottom, breakpoint),
|
|
108
|
+
left: resolveResponsive(props.left, breakpoint),
|
|
109
|
+
right: resolveResponsive(props.right, breakpoint),
|
|
110
|
+
overflow: resolveResponsive(props.overflow, breakpoint),
|
|
111
|
+
zIndex: resolveResponsive(props.zIndex, breakpoint),
|
|
112
|
+
opacity: resolveResponsive(props.opacity, breakpoint),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/*** Resolves a Surface radius token or raw number. */
|
|
117
|
+
function resolveRadius(
|
|
118
|
+
theme: SurfaceTheme,
|
|
119
|
+
value: number | keyof SurfaceTheme['radii'] | undefined,
|
|
120
|
+
): number | undefined {
|
|
121
|
+
return resolveToken(theme.radii, value);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/*** Resolves a Surface color token while preserving arbitrary color strings. */
|
|
125
|
+
function resolveColor(theme: SurfaceTheme, value: ColorValue | undefined): string | undefined {
|
|
126
|
+
return resolveToken(theme.colors, value);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/*** Resolves spacing-token dimensions while preserving raw dimension strings. */
|
|
130
|
+
function resolveDimension(
|
|
131
|
+
theme: SurfaceTheme,
|
|
132
|
+
value: number | string | undefined,
|
|
133
|
+
): number | string | undefined {
|
|
134
|
+
return resolveToken(theme.spacing, value);
|
|
135
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { resolveToken } from '../theme/resolveToken';
|
|
2
|
+
import type { SurfaceTheme } from '../theme/types';
|
|
3
|
+
import type { SpaceValue } from '../types/layout';
|
|
4
|
+
|
|
5
|
+
/*** Resolves a numeric spacing value or a Surface spacing token. */
|
|
6
|
+
export function resolveSpacing(
|
|
7
|
+
theme: SurfaceTheme,
|
|
8
|
+
value: SpaceValue | undefined,
|
|
9
|
+
): number | undefined {
|
|
10
|
+
return resolveToken(theme.spacing, value);
|
|
11
|
+
}
|
|
@@ -8,9 +8,8 @@ await mock.module('react-native', () => ReactNativeWeb);
|
|
|
8
8
|
|
|
9
9
|
const scrollContentStyle = { padding: 4 };
|
|
10
10
|
|
|
11
|
-
const { Container } = await import('./layout/
|
|
12
|
-
const {
|
|
13
|
-
const { KeyboardAvoidingView } = await import('./layout/KeyboardAvoidingView');
|
|
11
|
+
const { Container, Grid } = await import('./features/layout/public');
|
|
12
|
+
const { KeyboardAvoidingView } = await import('./features/keyboard-avoiding-view/public');
|
|
14
13
|
const { ScrollArea } = await import('./layout/ScrollArea');
|
|
15
14
|
const { Show } = await import('./layout/Show');
|
|
16
15
|
const { OverlayProvider } = await import('./internal/overlay/OverlayProvider');
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/components/badge/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,KAAK,CAAC,EACpB,OAAO,EACP,OAAgB,EAChB,KAAiB,EACjB,IAAU,EACV,MAAM,GACP,EAAE,UAAU,qBAqCZ"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { resolveButtonColors, resolveControlSize } from '../../internal/resolvers';
|
|
3
|
-
import { Box } from '../../layout';
|
|
4
|
-
import { Text } from '../../primitives/text';
|
|
5
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
6
|
-
export function Badge({ content, variant = 'soft', color = 'primary', size = 's', testID, }) {
|
|
7
|
-
const { theme } = useTheme();
|
|
8
|
-
const controlSize = resolveControlSize(theme, size);
|
|
9
|
-
const colors = resolveButtonColors(theme, {
|
|
10
|
-
variant,
|
|
11
|
-
color,
|
|
12
|
-
state: {
|
|
13
|
-
disabled: false,
|
|
14
|
-
focused: false,
|
|
15
|
-
hovered: false,
|
|
16
|
-
pressed: false,
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
return (<Box px={Math.max(theme.spacing.xs, controlSize.paddingHorizontal - 4)} py={Math.max(4, controlSize.paddingVertical - 2)} radius={controlSize.borderRadius} style={{
|
|
20
|
-
alignSelf: 'flex-start',
|
|
21
|
-
backgroundColor: colors.backgroundColor,
|
|
22
|
-
borderColor: colors.borderColor,
|
|
23
|
-
borderWidth: variant === 'solid' ? 0 : 1,
|
|
24
|
-
}} testID={testID}>
|
|
25
|
-
<Text color={color} emphasis={variant === 'solid' ? 'inverse' : 'default'} variant="bodySmall" weight="medium">
|
|
26
|
-
{content}
|
|
27
|
-
</Text>
|
|
28
|
-
</Box>);
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=Badge.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../../src/components/badge/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,MAAM,UAAU,KAAK,CAAC,EACpB,OAAO,EACP,OAAO,GAAG,MAAM,EAChB,KAAK,GAAG,SAAS,EACjB,IAAI,GAAG,GAAG,EACV,MAAM,GACK;IACX,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,WAAW,GAAG,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,mBAAmB,CAAC,KAAK,EAAE;QACxC,OAAO;QACP,KAAK;QACL,KAAK,EAAE;YACL,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,KAAK;SACf;KACF,CAAC,CAAC;IAEH,OAAO,CACL,CAAC,GAAG,CACF,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,WAAW,CAAC,iBAAiB,GAAG,CAAC,CAAC,CAAC,CAClE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC,CACjD,MAAM,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,CACjC,KAAK,CAAC,CAAC;YACL,SAAS,EAAE,YAAY;YACvB,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,WAAW,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACzC,CAAC,CACF,MAAM,CAAC,CAAC,MAAM,CAAC,CAEf;MAAA,CAAC,IAAI,CACH,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,QAAQ,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CACtD,OAAO,CAAC,WAAW,CACnB,MAAM,CAAC,QAAQ,CAEf;QAAA,CAAC,OAAO,CACV;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport { resolveButtonColors, resolveControlSize } from '../../internal/resolvers';\nimport { Box } from '../../layout';\nimport { Text } from '../../primitives/text';\nimport { useTheme } from '../../theme/ThemeContext';\nimport type { BadgeProps } from './types';\n\nexport function Badge({\n content,\n variant = 'soft',\n color = 'primary',\n size = 's',\n testID,\n}: BadgeProps) {\n const { theme } = useTheme();\n const controlSize = resolveControlSize(theme, size);\n const colors = resolveButtonColors(theme, {\n variant,\n color,\n state: {\n disabled: false,\n focused: false,\n hovered: false,\n pressed: false,\n },\n });\n\n return (\n <Box\n px={Math.max(theme.spacing.xs, controlSize.paddingHorizontal - 4)}\n py={Math.max(4, controlSize.paddingVertical - 2)}\n radius={controlSize.borderRadius}\n style={{\n alignSelf: 'flex-start',\n backgroundColor: colors.backgroundColor,\n borderColor: colors.borderColor,\n borderWidth: variant === 'solid' ? 0 : 1,\n }}\n testID={testID}\n >\n <Text\n color={color}\n emphasis={variant === 'solid' ? 'inverse' : 'default'}\n variant=\"bodySmall\"\n weight=\"medium\"\n >\n {content}\n </Text>\n </Box>\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/badge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/badge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC","sourcesContent":["export { Badge } from './Badge';\nexport type { BadgeProps } from './types';\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { ControlSize } from '../../internal/resolvers/resolveControlSize';
|
|
3
|
-
import type { ButtonVariant } from '../../internal/resolvers/resolveInteractiveColors';
|
|
4
|
-
import type { SurfaceColor } from '../../surfaceColor';
|
|
5
|
-
export interface BadgeProps {
|
|
6
|
-
content?: React.ReactNode;
|
|
7
|
-
variant?: Extract<ButtonVariant, 'solid' | 'soft' | 'outline'>;
|
|
8
|
-
color?: SurfaceColor;
|
|
9
|
-
size?: ControlSize;
|
|
10
|
-
testID?: string;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/badge/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mDAAmD,CAAC;AACvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;IAC/D,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/badge/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { ControlSize } from '../../internal/resolvers/resolveControlSize';\nimport type { ButtonVariant } from '../../internal/resolvers/resolveInteractiveColors';\nimport type { SurfaceColor } from '../../surfaceColor';\n\nexport interface BadgeProps {\n content?: React.ReactNode;\n variant?: Extract<ButtonVariant, 'solid' | 'soft' | 'outline'>;\n color?: SurfaceColor;\n size?: ControlSize;\n testID?: string;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,OAAiB,EACjB,KAAiB,EACjB,IAAU,EACV,QAAgB,EAChB,OAAe,EACf,WAAW,EACX,YAAY,EACZ,SAAiB,EACjB,OAAO,EACP,MAAM,EACN,GAAG,KAAK,EACT,EAAE,WAAW,qBAyEb"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ActivityIndicator, View } from 'react-native';
|
|
3
|
-
import { resolveButtonColors, resolveControlSize, resolveIconSize } from '../../internal/resolvers';
|
|
4
|
-
import { Box } from '../../layout';
|
|
5
|
-
import { ButtonBase } from '../../primitives/button-base';
|
|
6
|
-
import { Icon } from '../../primitives/icon';
|
|
7
|
-
import { Text } from '../../primitives/text';
|
|
8
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
9
|
-
export function Button({ children, variant = 'solid', color = 'primary', size = 'm', disabled = false, loading = false, leadingIcon, trailingIcon, fullWidth = false, onPress, testID, ...props }) {
|
|
10
|
-
const { theme } = useTheme();
|
|
11
|
-
const controlSize = resolveControlSize(theme, size);
|
|
12
|
-
return (<ButtonBase {...props} disabled={disabled || loading} onPress={onPress} style={{
|
|
13
|
-
alignSelf: fullWidth ? 'stretch' : 'flex-start',
|
|
14
|
-
}} testID={testID}>
|
|
15
|
-
{(state) => {
|
|
16
|
-
const colors = resolveButtonColors(theme, {
|
|
17
|
-
variant,
|
|
18
|
-
color,
|
|
19
|
-
state,
|
|
20
|
-
});
|
|
21
|
-
const textEmphasis = colors.contentColor === theme.semantics.content.muted ? 'muted' : 'default';
|
|
22
|
-
const resolvedTextColor = textEmphasis === 'muted' ? undefined : color;
|
|
23
|
-
const resolvedTextEmphasis = textEmphasis === 'muted' ? 'muted' : variant === 'solid' ? 'inverse' : 'default';
|
|
24
|
-
const iconSize = resolveIconSize(theme, size);
|
|
25
|
-
return (<Box px={controlSize.paddingHorizontal} py={controlSize.paddingVertical} radius={controlSize.borderRadius} style={{
|
|
26
|
-
minHeight: controlSize.minHeight,
|
|
27
|
-
width: fullWidth ? '100%' : undefined,
|
|
28
|
-
flexDirection: 'row',
|
|
29
|
-
alignItems: 'center',
|
|
30
|
-
justifyContent: 'center',
|
|
31
|
-
backgroundColor: colors.backgroundColor,
|
|
32
|
-
borderColor: colors.borderColor,
|
|
33
|
-
borderWidth: variant === 'solid' ? 0 : 1,
|
|
34
|
-
opacity: colors.opacity,
|
|
35
|
-
}}>
|
|
36
|
-
{loading ? (<ActivityIndicator color={colors.contentColor} size="small"/>) : (<>
|
|
37
|
-
{leadingIcon ? (<View style={{ marginRight: theme.spacing.s }}>
|
|
38
|
-
<Icon {...leadingIcon} color={colors.contentColor} size={iconSize}/>
|
|
39
|
-
</View>) : null}
|
|
40
|
-
<Text color={resolvedTextColor} emphasis={resolvedTextEmphasis} variant={controlSize.textVariant} weight="semiBold">
|
|
41
|
-
{children}
|
|
42
|
-
</Text>
|
|
43
|
-
{trailingIcon ? (<View style={{ marginLeft: theme.spacing.s }}>
|
|
44
|
-
<Icon {...trailingIcon} color={colors.contentColor} size={iconSize}/>
|
|
45
|
-
</View>) : null}
|
|
46
|
-
</>)}
|
|
47
|
-
</Box>);
|
|
48
|
-
}}
|
|
49
|
-
</ButtonBase>);
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/button/Button.tsx"],"names":[],"mappings":"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","sourcesContent":["import React from 'react';\nimport { ActivityIndicator, View } from 'react-native';\n\nimport { resolveButtonColors, resolveControlSize, resolveIconSize } from '../../internal/resolvers';\nimport { Box } from '../../layout';\nimport { ButtonBase } from '../../primitives/button-base';\nimport { Icon } from '../../primitives/icon';\nimport { Text } from '../../primitives/text';\nimport { useTheme } from '../../theme/ThemeContext';\nimport type { ButtonProps } from './types';\n\nexport function Button({\n children,\n variant = 'solid',\n color = 'primary',\n size = 'm',\n disabled = false,\n loading = false,\n leadingIcon,\n trailingIcon,\n fullWidth = false,\n onPress,\n testID,\n ...props\n}: ButtonProps) {\n const { theme } = useTheme();\n const controlSize = resolveControlSize(theme, size);\n\n return (\n <ButtonBase\n {...props}\n disabled={disabled || loading}\n onPress={onPress}\n style={{\n alignSelf: fullWidth ? 'stretch' : 'flex-start',\n }}\n testID={testID}\n >\n {(state) => {\n const colors = resolveButtonColors(theme, {\n variant,\n color,\n state,\n });\n const textEmphasis =\n colors.contentColor === theme.semantics.content.muted ? 'muted' : 'default';\n const resolvedTextColor = textEmphasis === 'muted' ? undefined : color;\n const resolvedTextEmphasis =\n textEmphasis === 'muted' ? 'muted' : variant === 'solid' ? 'inverse' : 'default';\n const iconSize = resolveIconSize(theme, size);\n\n return (\n <Box\n px={controlSize.paddingHorizontal}\n py={controlSize.paddingVertical}\n radius={controlSize.borderRadius}\n style={{\n minHeight: controlSize.minHeight,\n width: fullWidth ? '100%' : undefined,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: colors.backgroundColor,\n borderColor: colors.borderColor,\n borderWidth: variant === 'solid' ? 0 : 1,\n opacity: colors.opacity,\n }}\n >\n {loading ? (\n <ActivityIndicator color={colors.contentColor} size=\"small\" />\n ) : (\n <>\n {leadingIcon ? (\n <View style={{ marginRight: theme.spacing.s }}>\n <Icon {...leadingIcon} color={colors.contentColor} size={iconSize} />\n </View>\n ) : null}\n <Text\n color={resolvedTextColor}\n emphasis={resolvedTextEmphasis}\n variant={controlSize.textVariant}\n weight=\"semiBold\"\n >\n {children}\n </Text>\n {trailingIcon ? (\n <View style={{ marginLeft: theme.spacing.s }}>\n <Icon {...trailingIcon} color={colors.contentColor} size={iconSize} />\n </View>\n ) : null}\n </>\n )}\n </Box>\n );\n }}\n </ButtonBase>\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export { Button } from './Button';\nexport type { ButtonIconSpec, ButtonProps } from './types';\n"]}
|