@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
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { Surface } from '../../layout';
|
|
4
|
-
import { ButtonBase } from '../../primitives/button-base';
|
|
5
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
6
|
-
import type { CardProps } from './types';
|
|
7
|
-
|
|
8
|
-
function resolveCardStateBackground(
|
|
9
|
-
variant: NonNullable<CardProps['variant']>,
|
|
10
|
-
pressed: boolean,
|
|
11
|
-
hovered: boolean,
|
|
12
|
-
themeBackgrounds: {
|
|
13
|
-
base: string;
|
|
14
|
-
subtle: string;
|
|
15
|
-
hover: string;
|
|
16
|
-
active: string;
|
|
17
|
-
},
|
|
18
|
-
) {
|
|
19
|
-
if (variant === 'outline') {
|
|
20
|
-
return pressed ? themeBackgrounds.active : hovered ? themeBackgrounds.hover : 'transparent';
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (variant === 'subtle') {
|
|
24
|
-
return pressed
|
|
25
|
-
? themeBackgrounds.active
|
|
26
|
-
: hovered
|
|
27
|
-
? themeBackgrounds.hover
|
|
28
|
-
: themeBackgrounds.subtle;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return pressed
|
|
32
|
-
? themeBackgrounds.active
|
|
33
|
-
: hovered
|
|
34
|
-
? themeBackgrounds.hover
|
|
35
|
-
: themeBackgrounds.base;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function Card({
|
|
39
|
-
children,
|
|
40
|
-
variant = 'default',
|
|
41
|
-
onPress,
|
|
42
|
-
disabled = false,
|
|
43
|
-
testID,
|
|
44
|
-
style,
|
|
45
|
-
...props
|
|
46
|
-
}: CardProps) {
|
|
47
|
-
const { theme } = useTheme();
|
|
48
|
-
|
|
49
|
-
if (!onPress) {
|
|
50
|
-
return (
|
|
51
|
-
<Surface {...props} style={style} testID={testID} variant={variant}>
|
|
52
|
-
{children}
|
|
53
|
-
</Surface>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<ButtonBase accessibilityRole="button" disabled={disabled} onPress={onPress} testID={testID}>
|
|
59
|
-
{(state) => (
|
|
60
|
-
<Surface
|
|
61
|
-
{...props}
|
|
62
|
-
style={[
|
|
63
|
-
{
|
|
64
|
-
backgroundColor: resolveCardStateBackground(variant, state.pressed, state.hovered, {
|
|
65
|
-
active: theme.semantics.neutral.surfaceActive,
|
|
66
|
-
base: theme.semantics.surface.default,
|
|
67
|
-
hover: theme.semantics.neutral.surfaceHover,
|
|
68
|
-
subtle: theme.semantics.surface.subtle,
|
|
69
|
-
}),
|
|
70
|
-
opacity: state.disabled ? 0.72 : 1,
|
|
71
|
-
},
|
|
72
|
-
style,
|
|
73
|
-
]}
|
|
74
|
-
variant={variant}
|
|
75
|
-
>
|
|
76
|
-
{children}
|
|
77
|
-
</Surface>
|
|
78
|
-
)}
|
|
79
|
-
</ButtonBase>
|
|
80
|
-
);
|
|
81
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
resolveFieldState,
|
|
5
|
-
resolveIndicatorSize,
|
|
6
|
-
resolveSelectionControlColors,
|
|
7
|
-
resolveSelectionControlNextChecked,
|
|
8
|
-
} from '../../internal/resolvers';
|
|
9
|
-
import { useControllableState } from '../../internal/useControllableState';
|
|
10
|
-
import { Box } from '../../layout';
|
|
11
|
-
import { ButtonBase } from '../../primitives/button-base';
|
|
12
|
-
import { Text } from '../../primitives/text';
|
|
13
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
14
|
-
import type { CheckboxProps } from './types';
|
|
15
|
-
|
|
16
|
-
export function Checkbox({
|
|
17
|
-
children,
|
|
18
|
-
checked,
|
|
19
|
-
defaultChecked = false,
|
|
20
|
-
onCheckedChange,
|
|
21
|
-
color = 'primary',
|
|
22
|
-
size = 'm',
|
|
23
|
-
disabled = false,
|
|
24
|
-
invalid = false,
|
|
25
|
-
readOnly = false,
|
|
26
|
-
accessibilityLabel,
|
|
27
|
-
testID,
|
|
28
|
-
...props
|
|
29
|
-
}: CheckboxProps) {
|
|
30
|
-
const { theme } = useTheme();
|
|
31
|
-
const [isChecked, setChecked] = useControllableState<boolean>({
|
|
32
|
-
value: checked,
|
|
33
|
-
defaultValue: defaultChecked,
|
|
34
|
-
onChange: onCheckedChange,
|
|
35
|
-
});
|
|
36
|
-
const indicatorSize = resolveIndicatorSize(size);
|
|
37
|
-
const nextChecked = resolveSelectionControlNextChecked({
|
|
38
|
-
checked: isChecked,
|
|
39
|
-
disabled,
|
|
40
|
-
kind: 'checkbox',
|
|
41
|
-
readOnly,
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<ButtonBase
|
|
46
|
-
{...props}
|
|
47
|
-
accessibilityLabel={accessibilityLabel}
|
|
48
|
-
accessibilityRole="checkbox"
|
|
49
|
-
accessibilityState={{ checked: isChecked }}
|
|
50
|
-
disabled={disabled}
|
|
51
|
-
onPress={
|
|
52
|
-
nextChecked === null
|
|
53
|
-
? undefined
|
|
54
|
-
: () => {
|
|
55
|
-
setChecked(nextChecked);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
testID={testID}
|
|
59
|
-
>
|
|
60
|
-
{(interactionState) => {
|
|
61
|
-
const fieldState = resolveFieldState({
|
|
62
|
-
disabled,
|
|
63
|
-
focused: interactionState.focused,
|
|
64
|
-
invalid,
|
|
65
|
-
readOnly,
|
|
66
|
-
});
|
|
67
|
-
const colors = resolveSelectionControlColors(theme, {
|
|
68
|
-
checked: isChecked,
|
|
69
|
-
fieldState,
|
|
70
|
-
hovered: interactionState.hovered,
|
|
71
|
-
pressed: interactionState.pressed,
|
|
72
|
-
color,
|
|
73
|
-
});
|
|
74
|
-
const labelEmphasis =
|
|
75
|
-
colors.labelColor === theme.semantics.content.muted ? 'muted' : 'default';
|
|
76
|
-
const indicatorColor = fieldState.invalid ? 'error' : color;
|
|
77
|
-
const indicatorEmphasis = disabled ? 'muted' : 'inverse';
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<Box
|
|
81
|
-
style={{
|
|
82
|
-
alignItems: 'center',
|
|
83
|
-
flexDirection: 'row',
|
|
84
|
-
opacity: colors.opacity,
|
|
85
|
-
}}
|
|
86
|
-
>
|
|
87
|
-
<Box
|
|
88
|
-
radius="s"
|
|
89
|
-
style={{
|
|
90
|
-
alignItems: 'center',
|
|
91
|
-
backgroundColor: colors.backgroundColor,
|
|
92
|
-
borderColor: colors.borderColor,
|
|
93
|
-
borderWidth: 1.5,
|
|
94
|
-
height: indicatorSize.checkbox,
|
|
95
|
-
justifyContent: 'center',
|
|
96
|
-
width: indicatorSize.checkbox,
|
|
97
|
-
}}
|
|
98
|
-
>
|
|
99
|
-
{isChecked ? (
|
|
100
|
-
<Text
|
|
101
|
-
color={disabled ? undefined : indicatorColor}
|
|
102
|
-
emphasis={indicatorEmphasis}
|
|
103
|
-
variant="caption"
|
|
104
|
-
weight="bold"
|
|
105
|
-
>
|
|
106
|
-
✓
|
|
107
|
-
</Text>
|
|
108
|
-
) : null}
|
|
109
|
-
</Box>
|
|
110
|
-
{children ? (
|
|
111
|
-
<Box ml="s">
|
|
112
|
-
<Text emphasis={labelEmphasis}>{children}</Text>
|
|
113
|
-
</Box>
|
|
114
|
-
) : null}
|
|
115
|
-
</Box>
|
|
116
|
-
);
|
|
117
|
-
}}
|
|
118
|
-
</ButtonBase>
|
|
119
|
-
);
|
|
120
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
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 { useTheme } from '../../theme/ThemeContext';
|
|
8
|
-
import type { IconButtonProps } from './types';
|
|
9
|
-
|
|
10
|
-
export function IconButton({
|
|
11
|
-
icon,
|
|
12
|
-
accessibilityLabel,
|
|
13
|
-
variant = 'ghost',
|
|
14
|
-
color = 'primary',
|
|
15
|
-
size = 'm',
|
|
16
|
-
disabled = false,
|
|
17
|
-
onPress,
|
|
18
|
-
testID,
|
|
19
|
-
...props
|
|
20
|
-
}: IconButtonProps) {
|
|
21
|
-
const { theme } = useTheme();
|
|
22
|
-
const controlSize = resolveControlSize(theme, size);
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<ButtonBase
|
|
26
|
-
{...props}
|
|
27
|
-
accessibilityLabel={accessibilityLabel}
|
|
28
|
-
disabled={disabled}
|
|
29
|
-
onPress={onPress}
|
|
30
|
-
testID={testID}
|
|
31
|
-
>
|
|
32
|
-
{(state) => {
|
|
33
|
-
const colors = resolveButtonColors(theme, { color, state, variant });
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<Box
|
|
37
|
-
radius={controlSize.borderRadius}
|
|
38
|
-
style={{
|
|
39
|
-
minHeight: controlSize.minHeight,
|
|
40
|
-
minWidth: controlSize.minHeight,
|
|
41
|
-
alignItems: 'center',
|
|
42
|
-
justifyContent: 'center',
|
|
43
|
-
backgroundColor: colors.backgroundColor,
|
|
44
|
-
borderColor: colors.borderColor,
|
|
45
|
-
borderWidth: variant === 'solid' ? 0 : 1,
|
|
46
|
-
opacity: colors.opacity,
|
|
47
|
-
}}
|
|
48
|
-
>
|
|
49
|
-
<Icon {...icon} color={colors.contentColor} size={resolveIconSize(theme, size)} />
|
|
50
|
-
</Box>
|
|
51
|
-
);
|
|
52
|
-
}}
|
|
53
|
-
</ButtonBase>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ControlSize } from '../../internal/resolvers/resolveControlSize';
|
|
2
|
-
import type { ButtonVariant } from '../../internal/resolvers/resolveInteractiveColors';
|
|
3
|
-
import type { ButtonBaseProps } from '../../primitives/button-base';
|
|
4
|
-
import type { IconSource } from '../../primitives/icon';
|
|
5
|
-
import type { SurfaceColor } from '../../surfaceColor';
|
|
6
|
-
|
|
7
|
-
export interface IconButtonProps extends Omit<
|
|
8
|
-
ButtonBaseProps,
|
|
9
|
-
'children' | 'style' | 'accessibilityLabel'
|
|
10
|
-
> {
|
|
11
|
-
icon: IconSource;
|
|
12
|
-
accessibilityLabel: string;
|
|
13
|
-
variant?: ButtonVariant;
|
|
14
|
-
color?: SurfaceColor;
|
|
15
|
-
size?: ControlSize;
|
|
16
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
resolveFieldState,
|
|
5
|
-
resolveIndicatorSize,
|
|
6
|
-
resolveSelectionControlColors,
|
|
7
|
-
resolveSelectionControlNextChecked,
|
|
8
|
-
} from '../../internal/resolvers';
|
|
9
|
-
import { useControllableState } from '../../internal/useControllableState';
|
|
10
|
-
import { Box } from '../../layout';
|
|
11
|
-
import { ButtonBase } from '../../primitives/button-base';
|
|
12
|
-
import { Text } from '../../primitives/text';
|
|
13
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
14
|
-
import { isRadioTextContent } from './isRadioTextContent';
|
|
15
|
-
import type { RadioProps } from './types';
|
|
16
|
-
|
|
17
|
-
/***
|
|
18
|
-
* Renders one radio control with either text or structured label content.
|
|
19
|
-
*/
|
|
20
|
-
export function Radio({
|
|
21
|
-
children,
|
|
22
|
-
checked,
|
|
23
|
-
defaultChecked = false,
|
|
24
|
-
onCheckedChange,
|
|
25
|
-
color = 'primary',
|
|
26
|
-
size = 'm',
|
|
27
|
-
disabled = false,
|
|
28
|
-
invalid = false,
|
|
29
|
-
readOnly = false,
|
|
30
|
-
accessibilityLabel,
|
|
31
|
-
testID,
|
|
32
|
-
...props
|
|
33
|
-
}: RadioProps) {
|
|
34
|
-
const { theme } = useTheme();
|
|
35
|
-
const [isChecked, setChecked] = useControllableState<boolean>({
|
|
36
|
-
value: checked,
|
|
37
|
-
defaultValue: defaultChecked,
|
|
38
|
-
onChange: onCheckedChange,
|
|
39
|
-
});
|
|
40
|
-
const indicatorSize = resolveIndicatorSize(size);
|
|
41
|
-
const nextChecked = resolveSelectionControlNextChecked({
|
|
42
|
-
checked: isChecked,
|
|
43
|
-
disabled,
|
|
44
|
-
kind: 'radio',
|
|
45
|
-
readOnly,
|
|
46
|
-
});
|
|
47
|
-
const hasContent = children !== undefined && children !== null && children !== false;
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<ButtonBase
|
|
51
|
-
{...props}
|
|
52
|
-
accessibilityLabel={accessibilityLabel}
|
|
53
|
-
accessibilityRole="radio"
|
|
54
|
-
accessibilityState={{ checked: isChecked }}
|
|
55
|
-
disabled={disabled}
|
|
56
|
-
onPress={
|
|
57
|
-
nextChecked === null
|
|
58
|
-
? undefined
|
|
59
|
-
: () => {
|
|
60
|
-
setChecked(nextChecked);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
testID={testID}
|
|
64
|
-
>
|
|
65
|
-
{(interactionState) => {
|
|
66
|
-
const fieldState = resolveFieldState({
|
|
67
|
-
disabled,
|
|
68
|
-
focused: interactionState.focused,
|
|
69
|
-
invalid,
|
|
70
|
-
readOnly,
|
|
71
|
-
});
|
|
72
|
-
const colors = resolveSelectionControlColors(theme, {
|
|
73
|
-
checked: isChecked,
|
|
74
|
-
fieldState,
|
|
75
|
-
hovered: interactionState.hovered,
|
|
76
|
-
pressed: interactionState.pressed,
|
|
77
|
-
color,
|
|
78
|
-
});
|
|
79
|
-
const labelEmphasis =
|
|
80
|
-
colors.labelColor === theme.semantics.content.muted ? 'muted' : 'default';
|
|
81
|
-
const isTextContent = isRadioTextContent(children);
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
<Box
|
|
85
|
-
style={{
|
|
86
|
-
alignItems: 'center',
|
|
87
|
-
flexDirection: 'row',
|
|
88
|
-
opacity: colors.opacity,
|
|
89
|
-
}}
|
|
90
|
-
>
|
|
91
|
-
<Box
|
|
92
|
-
radius="full"
|
|
93
|
-
style={{
|
|
94
|
-
alignItems: 'center',
|
|
95
|
-
backgroundColor: colors.backgroundColor,
|
|
96
|
-
borderColor: colors.borderColor,
|
|
97
|
-
borderWidth: 1.5,
|
|
98
|
-
height: indicatorSize.radio,
|
|
99
|
-
justifyContent: 'center',
|
|
100
|
-
width: indicatorSize.radio,
|
|
101
|
-
}}
|
|
102
|
-
>
|
|
103
|
-
{isChecked ? (
|
|
104
|
-
<Box
|
|
105
|
-
radius="full"
|
|
106
|
-
style={{
|
|
107
|
-
backgroundColor: colors.indicatorColor,
|
|
108
|
-
height: indicatorSize.radioDot,
|
|
109
|
-
width: indicatorSize.radioDot,
|
|
110
|
-
}}
|
|
111
|
-
/>
|
|
112
|
-
) : null}
|
|
113
|
-
</Box>
|
|
114
|
-
{hasContent ? (
|
|
115
|
-
<Box flex={1} ml="s">
|
|
116
|
-
{isTextContent ? <Text emphasis={labelEmphasis}>{children}</Text> : children}
|
|
117
|
-
</Box>
|
|
118
|
-
) : null}
|
|
119
|
-
</Box>
|
|
120
|
-
);
|
|
121
|
-
}}
|
|
122
|
-
</ButtonBase>
|
|
123
|
-
);
|
|
124
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Platform, TextInput as ReactNativeTextInput, View } from 'react-native';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
resolveControlSize,
|
|
6
|
-
resolveFieldState,
|
|
7
|
-
resolveFocusRingStyles,
|
|
8
|
-
resolveInputColors,
|
|
9
|
-
resolveTextStyles,
|
|
10
|
-
} from '../../internal/resolvers';
|
|
11
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
12
|
-
import type { TextInputProps } from './types';
|
|
13
|
-
|
|
14
|
-
export function TextInput({
|
|
15
|
-
value,
|
|
16
|
-
defaultValue,
|
|
17
|
-
onChangeText,
|
|
18
|
-
placeholder,
|
|
19
|
-
size = 'm',
|
|
20
|
-
disabled = false,
|
|
21
|
-
readOnly = false,
|
|
22
|
-
invalid = false,
|
|
23
|
-
leadingAccessory,
|
|
24
|
-
trailingAccessory,
|
|
25
|
-
interactionPolicy = 'enabled',
|
|
26
|
-
style,
|
|
27
|
-
testID,
|
|
28
|
-
onFocus,
|
|
29
|
-
onBlur,
|
|
30
|
-
...props
|
|
31
|
-
}: TextInputProps) {
|
|
32
|
-
const { theme } = useTheme();
|
|
33
|
-
const controlSize = resolveControlSize(theme, size);
|
|
34
|
-
const [focused, setFocused] = React.useState(false);
|
|
35
|
-
const fieldState = resolveFieldState({
|
|
36
|
-
disabled,
|
|
37
|
-
focused,
|
|
38
|
-
invalid,
|
|
39
|
-
readOnly,
|
|
40
|
-
});
|
|
41
|
-
const colors = resolveInputColors(theme, fieldState);
|
|
42
|
-
const resolvedTextStyle = resolveTextStyles(theme, {
|
|
43
|
-
variant: controlSize.textVariant,
|
|
44
|
-
});
|
|
45
|
-
const resolvedLineHeight =
|
|
46
|
-
typeof resolvedTextStyle.lineHeight === 'number'
|
|
47
|
-
? resolvedTextStyle.lineHeight
|
|
48
|
-
: controlSize.minHeight - controlSize.paddingVertical * 2;
|
|
49
|
-
const lineCount = Math.max(props.numberOfLines ?? 1, 1);
|
|
50
|
-
const inputMinHeight = props.multiline
|
|
51
|
-
? resolvedLineHeight * lineCount
|
|
52
|
-
: controlSize.minHeight - controlSize.paddingVertical * 2;
|
|
53
|
-
const containerMinHeight = props.multiline
|
|
54
|
-
? inputMinHeight + controlSize.paddingVertical * 2
|
|
55
|
-
: controlSize.minHeight;
|
|
56
|
-
const passive = interactionPolicy === 'passive';
|
|
57
|
-
|
|
58
|
-
const handleFocus: NonNullable<TextInputProps['onFocus']> = (event) => {
|
|
59
|
-
setFocused(true);
|
|
60
|
-
onFocus?.(event);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const handleBlur: NonNullable<TextInputProps['onBlur']> = (event) => {
|
|
64
|
-
setFocused(false);
|
|
65
|
-
onBlur?.(event);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<View
|
|
70
|
-
style={[
|
|
71
|
-
{
|
|
72
|
-
minHeight: containerMinHeight,
|
|
73
|
-
paddingHorizontal: controlSize.paddingHorizontal,
|
|
74
|
-
paddingVertical: controlSize.paddingVertical,
|
|
75
|
-
borderRadius: controlSize.borderRadius,
|
|
76
|
-
borderWidth: 1,
|
|
77
|
-
borderColor: colors.borderColor,
|
|
78
|
-
backgroundColor: colors.backgroundColor,
|
|
79
|
-
flexDirection: 'row',
|
|
80
|
-
alignItems: props.multiline ? 'flex-start' : 'center',
|
|
81
|
-
opacity: colors.opacity,
|
|
82
|
-
},
|
|
83
|
-
resolveFocusRingStyles(theme.semantics.border.focus, focused, Platform.OS === 'web'),
|
|
84
|
-
]}
|
|
85
|
-
>
|
|
86
|
-
{leadingAccessory ? (
|
|
87
|
-
<View style={{ marginRight: theme.spacing.s }}>{leadingAccessory}</View>
|
|
88
|
-
) : null}
|
|
89
|
-
<ReactNativeTextInput
|
|
90
|
-
{...props}
|
|
91
|
-
defaultValue={defaultValue}
|
|
92
|
-
editable={passive ? false : !disabled && !readOnly}
|
|
93
|
-
numberOfLines={props.multiline ? props.numberOfLines : 1}
|
|
94
|
-
onBlur={handleBlur}
|
|
95
|
-
onChangeText={(nextValue) => {
|
|
96
|
-
if (passive) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
onChangeText?.(nextValue);
|
|
101
|
-
}}
|
|
102
|
-
onFocus={handleFocus}
|
|
103
|
-
placeholder={placeholder}
|
|
104
|
-
placeholderTextColor={colors.placeholderColor}
|
|
105
|
-
readOnly={readOnly}
|
|
106
|
-
style={[
|
|
107
|
-
{
|
|
108
|
-
flex: 1,
|
|
109
|
-
minHeight: inputMinHeight,
|
|
110
|
-
padding: 0,
|
|
111
|
-
color: colors.contentColor,
|
|
112
|
-
textAlignVertical: props.multiline ? 'top' : 'center',
|
|
113
|
-
},
|
|
114
|
-
style,
|
|
115
|
-
]}
|
|
116
|
-
testID={testID}
|
|
117
|
-
value={value}
|
|
118
|
-
/>
|
|
119
|
-
{trailingAccessory ? (
|
|
120
|
-
<View style={{ marginLeft: theme.spacing.s }}>{trailingAccessory}</View>
|
|
121
|
-
) : null}
|
|
122
|
-
</View>
|
|
123
|
-
);
|
|
124
|
-
}
|
package/src/layout/Container.tsx
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
|
|
4
|
-
import { resolveResponsive, type Responsive, useResponsiveRuntime } from '../core/responsive';
|
|
5
|
-
import { useTheme } from '../theme/ThemeContext';
|
|
6
|
-
import type { SurfaceTheme } from '../theme/types';
|
|
7
|
-
import { Box, type BoxProps } from './Box';
|
|
8
|
-
import { resolveSpacing } from './helpers';
|
|
9
|
-
|
|
10
|
-
export interface ContainerProps extends Omit<BoxProps, 'children'> {
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
maxWidth?: Responsive<number>;
|
|
13
|
-
px?: Responsive<number | keyof SurfaceTheme['spacing']>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function Container({
|
|
17
|
-
children,
|
|
18
|
-
maxWidth = { base: Number.MAX_SAFE_INTEGER, lg: 1120 },
|
|
19
|
-
px = { base: 16, md: 24, lg: 32 },
|
|
20
|
-
...props
|
|
21
|
-
}: ContainerProps) {
|
|
22
|
-
const { theme } = useTheme();
|
|
23
|
-
const { breakpoint } = useResponsiveRuntime();
|
|
24
|
-
|
|
25
|
-
const activeMaxWidth = resolveResponsive(maxWidth, breakpoint);
|
|
26
|
-
const activePx = resolveSpacing(theme, resolveResponsive(px, breakpoint));
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<Box {...props} width="100%" style={[{ width: '100%' }, props.style]}>
|
|
30
|
-
<View
|
|
31
|
-
style={{
|
|
32
|
-
width: '100%',
|
|
33
|
-
maxWidth: activeMaxWidth,
|
|
34
|
-
alignSelf: 'center',
|
|
35
|
-
paddingLeft: activePx,
|
|
36
|
-
paddingRight: activePx,
|
|
37
|
-
}}
|
|
38
|
-
>
|
|
39
|
-
{children}
|
|
40
|
-
</View>
|
|
41
|
-
</Box>
|
|
42
|
-
);
|
|
43
|
-
}
|
package/src/layout/Grid.tsx
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View, type ViewStyle } from 'react-native';
|
|
3
|
-
|
|
4
|
-
import { resolveResponsive, type Responsive, useResponsiveRuntime } from '../core/responsive';
|
|
5
|
-
import { useTheme } from '../theme/ThemeContext';
|
|
6
|
-
import { Box, type BoxProps } from './Box';
|
|
7
|
-
import { resolveSpacing, type SpaceValue } from './helpers';
|
|
8
|
-
|
|
9
|
-
export interface GridProps extends Omit<BoxProps, 'children'> {
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
cols: Responsive<number>;
|
|
12
|
-
gap?: Responsive<SpaceValue>;
|
|
13
|
-
rowGap?: Responsive<SpaceValue>;
|
|
14
|
-
colGap?: Responsive<SpaceValue>;
|
|
15
|
-
minItemWidth?: Responsive<number>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function Grid({
|
|
19
|
-
children,
|
|
20
|
-
cols,
|
|
21
|
-
gap = 0,
|
|
22
|
-
rowGap,
|
|
23
|
-
colGap,
|
|
24
|
-
minItemWidth,
|
|
25
|
-
...props
|
|
26
|
-
}: GridProps) {
|
|
27
|
-
const { theme } = useTheme();
|
|
28
|
-
const { breakpoint } = useResponsiveRuntime();
|
|
29
|
-
|
|
30
|
-
const activeCols = Math.max(1, Math.floor(resolveResponsive(cols, breakpoint) ?? 1));
|
|
31
|
-
const defaultGap = resolveResponsive(gap, breakpoint) ?? 0;
|
|
32
|
-
const activeRowGap = resolveResponsive(rowGap, breakpoint) ?? defaultGap;
|
|
33
|
-
const activeColGap = resolveResponsive(colGap, breakpoint) ?? defaultGap;
|
|
34
|
-
const rowSpacing = Number(resolveSpacing(theme, activeRowGap) ?? 0);
|
|
35
|
-
const colSpacing = Number(resolveSpacing(theme, activeColGap) ?? 0);
|
|
36
|
-
const activeMinItemWidth = resolveResponsive(minItemWidth, breakpoint);
|
|
37
|
-
|
|
38
|
-
const basisPercent: `${number}%` = `${100 / activeCols}%`;
|
|
39
|
-
const nodes = React.Children.toArray(children);
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<Box {...props}>
|
|
43
|
-
<View
|
|
44
|
-
style={{
|
|
45
|
-
flexDirection: 'row',
|
|
46
|
-
flexWrap: 'wrap',
|
|
47
|
-
marginTop: -rowSpacing / 2,
|
|
48
|
-
marginLeft: -colSpacing / 2,
|
|
49
|
-
marginRight: -colSpacing / 2,
|
|
50
|
-
}}
|
|
51
|
-
>
|
|
52
|
-
{nodes.map((node, index) => {
|
|
53
|
-
const itemStyle: ViewStyle =
|
|
54
|
-
activeMinItemWidth !== undefined
|
|
55
|
-
? {
|
|
56
|
-
minWidth: activeMinItemWidth,
|
|
57
|
-
flexBasis: activeMinItemWidth,
|
|
58
|
-
flexGrow: 1,
|
|
59
|
-
}
|
|
60
|
-
: {
|
|
61
|
-
width: basisPercent,
|
|
62
|
-
flexBasis: basisPercent,
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<View
|
|
67
|
-
key={String(index)}
|
|
68
|
-
style={{
|
|
69
|
-
paddingTop: rowSpacing / 2,
|
|
70
|
-
paddingBottom: rowSpacing / 2,
|
|
71
|
-
paddingLeft: colSpacing / 2,
|
|
72
|
-
paddingRight: colSpacing / 2,
|
|
73
|
-
...itemStyle,
|
|
74
|
-
}}
|
|
75
|
-
>
|
|
76
|
-
{node}
|
|
77
|
-
</View>
|
|
78
|
-
);
|
|
79
|
-
})}
|
|
80
|
-
</View>
|
|
81
|
-
</Box>
|
|
82
|
-
);
|
|
83
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
KeyboardAvoidingView as ReactNativeKeyboardAvoidingView,
|
|
4
|
-
type KeyboardAvoidingViewProps as ReactNativeKeyboardAvoidingViewProps,
|
|
5
|
-
} from 'react-native';
|
|
6
|
-
|
|
7
|
-
/*** Preserve React Native keyboard avoidance behind the stable Surface layout boundary. */
|
|
8
|
-
export function KeyboardAvoidingView(props: KeyboardAvoidingViewProps) {
|
|
9
|
-
return <ReactNativeKeyboardAvoidingView {...props} />;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type KeyboardAvoidingViewBehavior = NonNullable<
|
|
13
|
-
ReactNativeKeyboardAvoidingViewProps['behavior']
|
|
14
|
-
>;
|
|
15
|
-
|
|
16
|
-
export type KeyboardAvoidingViewProps = ReactNativeKeyboardAvoidingViewProps;
|