@ankhorage/surface 4.2.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/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/accordion/adapters/inbound/Accordion.d.ts +5 -0
- package/dist/features/accordion/adapters/inbound/Accordion.d.ts.map +1 -0
- package/dist/features/accordion/adapters/inbound/Accordion.js +46 -0
- package/dist/features/accordion/adapters/inbound/Accordion.js.map +1 -0
- package/dist/features/accordion/adapters/inbound/AccordionContent.d.ts +5 -0
- package/dist/features/accordion/adapters/inbound/AccordionContent.d.ts.map +1 -0
- package/dist/features/accordion/adapters/inbound/AccordionContent.js +16 -0
- package/dist/features/accordion/adapters/inbound/AccordionContent.js.map +1 -0
- package/dist/features/accordion/adapters/inbound/AccordionContext.d.ts +4 -0
- package/dist/features/accordion/adapters/inbound/AccordionContext.d.ts.map +1 -0
- package/dist/features/accordion/adapters/inbound/AccordionContext.js +3 -0
- package/dist/features/accordion/adapters/inbound/AccordionContext.js.map +1 -0
- package/dist/features/accordion/adapters/inbound/AccordionItem.d.ts +5 -0
- package/dist/features/accordion/adapters/inbound/AccordionItem.d.ts.map +1 -0
- package/dist/features/accordion/adapters/inbound/AccordionItem.js +28 -0
- package/dist/features/accordion/adapters/inbound/AccordionItem.js.map +1 -0
- package/dist/features/accordion/adapters/inbound/AccordionItemContext.d.ts +4 -0
- package/dist/features/accordion/adapters/inbound/AccordionItemContext.d.ts.map +1 -0
- package/dist/features/accordion/adapters/inbound/AccordionItemContext.js +3 -0
- package/dist/features/accordion/adapters/inbound/AccordionItemContext.js.map +1 -0
- package/dist/features/accordion/adapters/inbound/AccordionTrigger.d.ts +5 -0
- package/dist/features/accordion/adapters/inbound/AccordionTrigger.d.ts.map +1 -0
- package/dist/features/accordion/adapters/inbound/AccordionTrigger.js +17 -0
- package/dist/features/accordion/adapters/inbound/AccordionTrigger.js.map +1 -0
- package/dist/features/accordion/public.d.ts +6 -0
- package/dist/features/accordion/public.d.ts.map +1 -0
- package/dist/features/accordion/public.js +5 -0
- package/dist/features/accordion/public.js.map +1 -0
- package/dist/features/accordion/utils/resolveAccordionToggle.d.ts +11 -0
- package/dist/features/accordion/utils/resolveAccordionToggle.d.ts.map +1 -0
- package/dist/features/accordion/utils/resolveAccordionToggle.js +13 -0
- package/dist/features/accordion/utils/resolveAccordionToggle.js.map +1 -0
- 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 +26 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -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/accordion.d.ts +54 -0
- package/dist/types/accordion.d.ts.map +1 -0
- package/dist/types/accordion.js +2 -0
- package/dist/types/accordion.js.map +1 -0
- 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/accordion/adapters/inbound/Accordion.tsx +83 -0
- package/src/features/accordion/adapters/inbound/AccordionContent.tsx +30 -0
- package/src/features/accordion/adapters/inbound/AccordionContext.ts +5 -0
- package/src/features/accordion/adapters/inbound/AccordionItem.tsx +42 -0
- package/src/features/accordion/adapters/inbound/AccordionItemContext.ts +5 -0
- package/src/features/accordion/adapters/inbound/AccordionTrigger.tsx +34 -0
- package/src/features/accordion/public.ts +13 -0
- package/src/features/accordion/utils/resolveAccordionToggle.test.ts +57 -0
- package/src/features/accordion/utils/resolveAccordionToggle.ts +28 -0
- 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 +52 -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/types/accordion.ts +69 -0
- 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,83 @@
|
|
|
1
|
+
import { resolveResponsive } from '../core/responsive/resolve';
|
|
2
|
+
import { resolveToken } from '../theme/resolveToken';
|
|
3
|
+
import { resolveSpacing } from './resolveSpacing';
|
|
4
|
+
/*** Resolves responsive Box style props into one React Native view style. */
|
|
5
|
+
export function resolveBoxStyles(theme, breakpoint, props) {
|
|
6
|
+
return {
|
|
7
|
+
elevation: 0,
|
|
8
|
+
...resolveSpacingStyles(theme, breakpoint, props),
|
|
9
|
+
...resolveVisualStyles(theme, breakpoint, props),
|
|
10
|
+
...resolveDimensionStyles(theme, breakpoint, props),
|
|
11
|
+
...resolveLayoutStyles(breakpoint, props),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/*** Resolves padding and margin styles from responsive spacing props. */
|
|
15
|
+
function resolveSpacingStyles(theme, breakpoint, props) {
|
|
16
|
+
return {
|
|
17
|
+
padding: resolveSpacing(theme, resolveResponsive(props.p, breakpoint)),
|
|
18
|
+
paddingHorizontal: resolveSpacing(theme, resolveResponsive(props.px, breakpoint)),
|
|
19
|
+
paddingVertical: resolveSpacing(theme, resolveResponsive(props.py, breakpoint)),
|
|
20
|
+
paddingTop: resolveSpacing(theme, resolveResponsive(props.pt, breakpoint)),
|
|
21
|
+
paddingBottom: resolveSpacing(theme, resolveResponsive(props.pb, breakpoint)),
|
|
22
|
+
paddingLeft: resolveSpacing(theme, resolveResponsive(props.pl, breakpoint)),
|
|
23
|
+
paddingRight: resolveSpacing(theme, resolveResponsive(props.pr, breakpoint)),
|
|
24
|
+
margin: resolveSpacing(theme, resolveResponsive(props.m, breakpoint)),
|
|
25
|
+
marginHorizontal: resolveSpacing(theme, resolveResponsive(props.mx, breakpoint)),
|
|
26
|
+
marginVertical: resolveSpacing(theme, resolveResponsive(props.my, breakpoint)),
|
|
27
|
+
marginTop: resolveSpacing(theme, resolveResponsive(props.mt, breakpoint)),
|
|
28
|
+
marginBottom: resolveSpacing(theme, resolveResponsive(props.mb, breakpoint)),
|
|
29
|
+
marginLeft: resolveSpacing(theme, resolveResponsive(props.ml, breakpoint)),
|
|
30
|
+
marginRight: resolveSpacing(theme, resolveResponsive(props.mr, breakpoint)),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/*** Resolves background, radius, and border styles. */
|
|
34
|
+
function resolveVisualStyles(theme, breakpoint, props) {
|
|
35
|
+
return {
|
|
36
|
+
backgroundColor: resolveColor(theme, resolveResponsive(props.bg, breakpoint)),
|
|
37
|
+
borderRadius: resolveRadius(theme, resolveResponsive(props.radius, breakpoint)),
|
|
38
|
+
borderWidth: resolveResponsive(props.borderWidth, breakpoint),
|
|
39
|
+
borderColor: resolveColor(theme, resolveResponsive(props.borderColor, breakpoint)),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/*** Resolves responsive dimension props through spacing tokens. */
|
|
43
|
+
function resolveDimensionStyles(theme, breakpoint, props) {
|
|
44
|
+
return {
|
|
45
|
+
width: resolveDimension(theme, resolveResponsive(props.width, breakpoint)),
|
|
46
|
+
height: resolveDimension(theme, resolveResponsive(props.height, breakpoint)),
|
|
47
|
+
minWidth: resolveDimension(theme, resolveResponsive(props.minWidth, breakpoint)),
|
|
48
|
+
maxWidth: resolveDimension(theme, resolveResponsive(props.maxWidth, breakpoint)),
|
|
49
|
+
minHeight: resolveDimension(theme, resolveResponsive(props.minHeight, breakpoint)),
|
|
50
|
+
maxHeight: resolveDimension(theme, resolveResponsive(props.maxHeight, breakpoint)),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/*** Resolves responsive flex, positioning, and visibility styles. */
|
|
54
|
+
function resolveLayoutStyles(breakpoint, props) {
|
|
55
|
+
return {
|
|
56
|
+
flex: resolveResponsive(props.flex, breakpoint),
|
|
57
|
+
flexGrow: resolveResponsive(props.flexGrow, breakpoint),
|
|
58
|
+
flexShrink: resolveResponsive(props.flexShrink, breakpoint),
|
|
59
|
+
flexBasis: resolveResponsive(props.flexBasis, breakpoint),
|
|
60
|
+
alignSelf: resolveResponsive(props.alignSelf, breakpoint),
|
|
61
|
+
position: resolveResponsive(props.position, breakpoint),
|
|
62
|
+
top: resolveResponsive(props.top, breakpoint),
|
|
63
|
+
bottom: resolveResponsive(props.bottom, breakpoint),
|
|
64
|
+
left: resolveResponsive(props.left, breakpoint),
|
|
65
|
+
right: resolveResponsive(props.right, breakpoint),
|
|
66
|
+
overflow: resolveResponsive(props.overflow, breakpoint),
|
|
67
|
+
zIndex: resolveResponsive(props.zIndex, breakpoint),
|
|
68
|
+
opacity: resolveResponsive(props.opacity, breakpoint),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/*** Resolves a Surface radius token or raw number. */
|
|
72
|
+
function resolveRadius(theme, value) {
|
|
73
|
+
return resolveToken(theme.radii, value);
|
|
74
|
+
}
|
|
75
|
+
/*** Resolves a Surface color token while preserving arbitrary color strings. */
|
|
76
|
+
function resolveColor(theme, value) {
|
|
77
|
+
return resolveToken(theme.colors, value);
|
|
78
|
+
}
|
|
79
|
+
/*** Resolves spacing-token dimensions while preserving raw dimension strings. */
|
|
80
|
+
function resolveDimension(theme, value) {
|
|
81
|
+
return resolveToken(theme.spacing, value);
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=resolveBoxStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveBoxStyles.js","sourceRoot":"","sources":["../../src/utils/resolveBoxStyles.ts"],"names":[],"mappings":"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","sourcesContent":["import type { ViewStyle } from 'react-native';\n\nimport { resolveResponsive } from '../core/responsive/resolve';\nimport type { Breakpoint } from '../core/responsive/types';\nimport { resolveToken } from '../theme/resolveToken';\nimport type { SurfaceTheme } from '../theme/types';\nimport type { BoxStyleProps, ColorValue } from '../types/layout';\nimport { resolveSpacing } from './resolveSpacing';\n\n/*** Resolves responsive Box style props into one React Native view style. */\nexport function resolveBoxStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: BoxStyleProps,\n): ViewStyle {\n return {\n elevation: 0,\n ...resolveSpacingStyles(theme, breakpoint, props),\n ...resolveVisualStyles(theme, breakpoint, props),\n ...resolveDimensionStyles(theme, breakpoint, props),\n ...resolveLayoutStyles(breakpoint, props),\n };\n}\n\n/*** Resolves padding and margin styles from responsive spacing props. */\nfunction resolveSpacingStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: BoxStyleProps,\n): ViewStyle {\n return {\n padding: resolveSpacing(theme, resolveResponsive(props.p, breakpoint)),\n paddingHorizontal: resolveSpacing(theme, resolveResponsive(props.px, breakpoint)),\n paddingVertical: resolveSpacing(theme, resolveResponsive(props.py, breakpoint)),\n paddingTop: resolveSpacing(theme, resolveResponsive(props.pt, breakpoint)),\n paddingBottom: resolveSpacing(theme, resolveResponsive(props.pb, breakpoint)),\n paddingLeft: resolveSpacing(theme, resolveResponsive(props.pl, breakpoint)),\n paddingRight: resolveSpacing(theme, resolveResponsive(props.pr, breakpoint)),\n margin: resolveSpacing(theme, resolveResponsive(props.m, breakpoint)),\n marginHorizontal: resolveSpacing(theme, resolveResponsive(props.mx, breakpoint)),\n marginVertical: resolveSpacing(theme, resolveResponsive(props.my, breakpoint)),\n marginTop: resolveSpacing(theme, resolveResponsive(props.mt, breakpoint)),\n marginBottom: resolveSpacing(theme, resolveResponsive(props.mb, breakpoint)),\n marginLeft: resolveSpacing(theme, resolveResponsive(props.ml, breakpoint)),\n marginRight: resolveSpacing(theme, resolveResponsive(props.mr, breakpoint)),\n };\n}\n\n/*** Resolves background, radius, and border styles. */\nfunction resolveVisualStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: BoxStyleProps,\n): ViewStyle {\n return {\n backgroundColor: resolveColor(theme, resolveResponsive(props.bg, breakpoint)),\n borderRadius: resolveRadius(theme, resolveResponsive(props.radius, breakpoint)),\n borderWidth: resolveResponsive(props.borderWidth, breakpoint),\n borderColor: resolveColor(theme, resolveResponsive(props.borderColor, breakpoint)),\n };\n}\n\n/*** Resolves responsive dimension props through spacing tokens. */\nfunction resolveDimensionStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: BoxStyleProps,\n): ViewStyle {\n return {\n width: resolveDimension(\n theme,\n resolveResponsive(props.width, breakpoint),\n ) as ViewStyle['width'],\n height: resolveDimension(\n theme,\n resolveResponsive(props.height, breakpoint),\n ) as ViewStyle['height'],\n minWidth: resolveDimension(\n theme,\n resolveResponsive(props.minWidth, breakpoint),\n ) as ViewStyle['minWidth'],\n maxWidth: resolveDimension(\n theme,\n resolveResponsive(props.maxWidth, breakpoint),\n ) as ViewStyle['maxWidth'],\n minHeight: resolveDimension(\n theme,\n resolveResponsive(props.minHeight, breakpoint),\n ) as ViewStyle['minHeight'],\n maxHeight: resolveDimension(\n theme,\n resolveResponsive(props.maxHeight, breakpoint),\n ) as ViewStyle['maxHeight'],\n };\n}\n\n/*** Resolves responsive flex, positioning, and visibility styles. */\nfunction resolveLayoutStyles(breakpoint: Breakpoint, props: BoxStyleProps): ViewStyle {\n return {\n flex: resolveResponsive(props.flex, breakpoint),\n flexGrow: resolveResponsive(props.flexGrow, breakpoint),\n flexShrink: resolveResponsive(props.flexShrink, breakpoint),\n flexBasis: resolveResponsive(props.flexBasis, breakpoint) as ViewStyle['flexBasis'],\n alignSelf: resolveResponsive(props.alignSelf, breakpoint),\n position: resolveResponsive(props.position, breakpoint),\n top: resolveResponsive(props.top, breakpoint),\n bottom: resolveResponsive(props.bottom, breakpoint),\n left: resolveResponsive(props.left, breakpoint),\n right: resolveResponsive(props.right, breakpoint),\n overflow: resolveResponsive(props.overflow, breakpoint),\n zIndex: resolveResponsive(props.zIndex, breakpoint),\n opacity: resolveResponsive(props.opacity, breakpoint),\n };\n}\n\n/*** Resolves a Surface radius token or raw number. */\nfunction resolveRadius(\n theme: SurfaceTheme,\n value: number | keyof SurfaceTheme['radii'] | undefined,\n): number | undefined {\n return resolveToken(theme.radii, value);\n}\n\n/*** Resolves a Surface color token while preserving arbitrary color strings. */\nfunction resolveColor(theme: SurfaceTheme, value: ColorValue | undefined): string | undefined {\n return resolveToken(theme.colors, value);\n}\n\n/*** Resolves spacing-token dimensions while preserving raw dimension strings. */\nfunction resolveDimension(\n theme: SurfaceTheme,\n value: number | string | undefined,\n): number | string | undefined {\n return resolveToken(theme.spacing, value);\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SurfaceTheme } from '../theme/types';
|
|
2
|
+
import type { SpaceValue } from '../types/layout';
|
|
3
|
+
/*** Resolves a numeric spacing value or a Surface spacing token. */
|
|
4
|
+
export declare function resolveSpacing(theme: SurfaceTheme, value: SpaceValue | undefined): number | undefined;
|
|
5
|
+
//# sourceMappingURL=resolveSpacing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveSpacing.d.ts","sourceRoot":"","sources":["../../src/utils/resolveSpacing.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,oEAAoE;AACpE,wBAAgB,cAAc,CAC5B,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,UAAU,GAAG,SAAS,GAC5B,MAAM,GAAG,SAAS,CAEpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveSpacing.js","sourceRoot":"","sources":["../../src/utils/resolveSpacing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAIrD,oEAAoE;AACpE,MAAM,UAAU,cAAc,CAC5B,KAAmB,EACnB,KAA6B;IAE7B,OAAO,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["import { resolveToken } from '../theme/resolveToken';\nimport type { SurfaceTheme } from '../theme/types';\nimport type { SpaceValue } from '../types/layout';\n\n/*** Resolves a numeric spacing value or a Surface spacing token. */\nexport function resolveSpacing(\n theme: SurfaceTheme,\n value: SpaceValue | undefined,\n): number | undefined {\n return resolveToken(theme.spacing, value);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
import { Box, Stack } from '../../features/layout/public';
|
|
3
4
|
import { resolveFieldPresentation, resolveFieldState } from '../../internal/resolvers';
|
|
4
|
-
import { Box, Stack } from '../../layout';
|
|
5
5
|
import { HelperText } from '../helper-text';
|
|
6
6
|
import { Label } from '../label';
|
|
7
7
|
import type { FieldProps } from './types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { Text } from '../../
|
|
3
|
+
import { Text } from '../../features/typography/public';
|
|
4
4
|
import type { HelperTextProps } from './types';
|
|
5
5
|
|
|
6
6
|
export function HelperText({ children, emphasis = 'muted', color, testID }: HelperTextProps) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import { Box } from '../../layout';
|
|
4
|
+
import { Box } from '../../features/layout/public';
|
|
5
|
+
import { Text } from '../../features/typography/public';
|
|
5
6
|
import { ButtonBase } from '../../primitives/button-base';
|
|
6
|
-
import { Text } from '../../primitives/text';
|
|
7
7
|
import { useTheme } from '../../theme/ThemeContext';
|
|
8
8
|
import type { ListItemProps } from './types';
|
|
9
9
|
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type LayoutRectangle, Pressable, View } from 'react-native';
|
|
3
3
|
|
|
4
|
+
import { Box, Stack } from '../../features/layout/public';
|
|
5
|
+
import { Surface } from '../../features/surface/public';
|
|
6
|
+
import { Text } from '../../features/typography/public';
|
|
4
7
|
import { FocusScope } from '../../internal/focus/FocusScope';
|
|
5
8
|
import { useFocusManager } from '../../internal/focus/useFocusManager';
|
|
6
9
|
import { Portal } from '../../internal/overlay/Portal';
|
|
7
10
|
import { resolvePointerEvents } from '../../internal/resolvePointerEvents';
|
|
8
11
|
import { resolveOverlayAnimation } from '../../internal/resolvers';
|
|
9
|
-
import {
|
|
12
|
+
import { Inline } from '../../layout';
|
|
10
13
|
import { ButtonBase } from '../../primitives/button-base';
|
|
11
|
-
import { Text } from '../../primitives/text';
|
|
12
14
|
import { useTheme } from '../../theme/ThemeContext';
|
|
13
15
|
import { resolveNextMenuIndex } from './navigation';
|
|
14
16
|
import type { MenuAction, MenuProps } from './types';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Pressable, View } from 'react-native';
|
|
3
3
|
|
|
4
|
+
import { Surface } from '../../features/surface/public';
|
|
4
5
|
import { FocusScope } from '../../internal/focus/FocusScope';
|
|
5
6
|
import { Portal } from '../../internal/overlay/Portal';
|
|
6
7
|
import { resolvePointerEvents } from '../../internal/resolvePointerEvents';
|
|
7
8
|
import { resolveOverlayAnimation } from '../../internal/resolvers';
|
|
8
|
-
import { Center
|
|
9
|
+
import { Center } from '../../layout';
|
|
9
10
|
import { useTheme } from '../../theme/ThemeContext';
|
|
10
11
|
import type { ModalProps } from './types';
|
|
11
12
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
import { Box } from '../../features/layout/public';
|
|
4
|
+
import { Text } from '../../features/typography/public';
|
|
3
5
|
import {
|
|
4
6
|
resolveFieldState,
|
|
5
7
|
resolveIndicatorSize,
|
|
@@ -7,9 +9,7 @@ import {
|
|
|
7
9
|
resolveSelectionControlNextChecked,
|
|
8
10
|
} from '../../internal/resolvers';
|
|
9
11
|
import { useControllableState } from '../../internal/useControllableState';
|
|
10
|
-
import { Box } from '../../layout';
|
|
11
12
|
import { ButtonBase } from '../../primitives/button-base';
|
|
12
|
-
import { Text } from '../../primitives/text';
|
|
13
13
|
import { useTheme } from '../../theme/ThemeContext';
|
|
14
14
|
import type { SwitchProps } from './types';
|
|
15
15
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Pressable } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import { Box } from '../../layout';
|
|
5
|
-
import { Text } from '../../
|
|
4
|
+
import { Box } from '../../features/layout/public';
|
|
5
|
+
import { Text } from '../../features/typography/public';
|
|
6
6
|
import { useTheme } from '../../theme/ThemeContext';
|
|
7
7
|
import { useTabsContext } from './context';
|
|
8
8
|
import type { TabProps } from './types';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
import { Box } from '../../features/layout/public';
|
|
3
4
|
import { useFocusManager } from '../../internal/focus/useFocusManager';
|
|
4
|
-
import { Box } from '../../layout';
|
|
5
5
|
import { useTabsContext } from './context';
|
|
6
6
|
import { resolveNextTabValue } from './navigation';
|
|
7
7
|
import type { TabListProps } from './types';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
import { Box } from '../../features/layout/public';
|
|
3
4
|
import { useControllableState } from '../../internal/useControllableState';
|
|
4
|
-
import { Box } from '../../layout';
|
|
5
5
|
import { getTabId as resolveTabId, getTabPanelId as resolveTabPanelId } from './a11y';
|
|
6
6
|
import { type TabRegistration, TabsContext } from './context';
|
|
7
7
|
import type { TabsProps } from './types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { TextInput } from '
|
|
3
|
+
import { TextInput } from '../../features/form/text-input/public';
|
|
4
4
|
import type { TextareaProps } from './types';
|
|
5
5
|
|
|
6
6
|
export function Textarea({ rows = 4, numberOfLines, style, ...props }: TextareaProps) {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Pressable } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import { Box
|
|
5
|
-
import {
|
|
4
|
+
import { Box } from '../../features/layout/public';
|
|
5
|
+
import { Surface } from '../../features/surface/public';
|
|
6
|
+
import { Text } from '../../features/typography/public';
|
|
7
|
+
import { Inline } from '../../layout';
|
|
6
8
|
import type { SurfaceColor } from '../../surfaceColor';
|
|
7
9
|
import { useTheme } from '../../theme/ThemeContext';
|
|
8
10
|
import type { SurfaceTheme } from '../../theme/types';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
import { Stack } from '../../features/layout/public';
|
|
3
4
|
import { Portal } from '../../internal/overlay/Portal';
|
|
4
5
|
import { resolveOverlayAnimation } from '../../internal/resolvers';
|
|
5
|
-
import { Stack } from '../../layout';
|
|
6
6
|
import { Toast } from './Toast';
|
|
7
7
|
import type { ToastOptions } from './types';
|
|
8
8
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type LayoutRectangle, Platform, Pressable, View } from 'react-native';
|
|
3
3
|
|
|
4
|
+
import { Surface } from '../../features/surface/public';
|
|
5
|
+
import { Text } from '../../features/typography/public';
|
|
4
6
|
import { Portal } from '../../internal/overlay/Portal';
|
|
5
7
|
import { resolvePointerEvents } from '../../internal/resolvePointerEvents';
|
|
6
8
|
import { resolveOverlayAnimation } from '../../internal/resolvers';
|
|
7
|
-
import { Surface } from '../../layout';
|
|
8
|
-
import { Text } from '../../primitives/text';
|
|
9
9
|
import { useTheme } from '../../theme/ThemeContext';
|
|
10
10
|
import type { TooltipProps } from './types';
|
|
11
11
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { Button } from '../components/button';
|
|
4
|
-
import { Card } from '../components/card';
|
|
5
|
-
import { Checkbox } from '../components/checkbox';
|
|
6
3
|
import { Field } from '../components/field';
|
|
7
4
|
import { HelperText } from '../components/helper-text';
|
|
8
5
|
import { Menu } from '../components/menu';
|
|
9
6
|
import { Modal } from '../components/modal';
|
|
10
7
|
import { Tab, TabList, TabPanel, Tabs } from '../components/tabs';
|
|
11
|
-
import { TextInput } from '../components/text-input';
|
|
12
8
|
import { ToastProvider, useToast } from '../components/toast';
|
|
13
9
|
import { Tooltip } from '../components/tooltip';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
10
|
+
import { Button } from '../features/button/public';
|
|
11
|
+
import { Card } from '../features/card/public';
|
|
12
|
+
import { Checkbox } from '../features/form/checkbox/public';
|
|
13
|
+
import { TextInput } from '../features/form/text-input/public';
|
|
14
|
+
import { Box, Stack } from '../features/layout/public';
|
|
15
|
+
import { Text } from '../features/typography/public';
|
|
16
16
|
import { ThemeProvider } from '../theme';
|
|
17
17
|
import type { ThemeConfig } from '../theme/types';
|
|
18
18
|
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import type {
|
|
5
|
+
AccordionMode,
|
|
6
|
+
AccordionMultipleProps,
|
|
7
|
+
AccordionProps,
|
|
8
|
+
AccordionSingleProps,
|
|
9
|
+
} from '../../../../types/accordion';
|
|
10
|
+
import { resolveAccordionToggle } from '../../utils/resolveAccordionToggle';
|
|
11
|
+
import { AccordionContext } from './AccordionContext';
|
|
12
|
+
|
|
13
|
+
/*** Coordinates controlled or uncontrolled accordion expansion state. */
|
|
14
|
+
export function Accordion(props: AccordionProps) {
|
|
15
|
+
const {
|
|
16
|
+
children,
|
|
17
|
+
collapsible = false,
|
|
18
|
+
defaultValue,
|
|
19
|
+
disabled = false,
|
|
20
|
+
interactionPolicy = 'enabled',
|
|
21
|
+
onValueChange: _onValueChange,
|
|
22
|
+
type = 'single',
|
|
23
|
+
value,
|
|
24
|
+
...viewProps
|
|
25
|
+
} = props;
|
|
26
|
+
const [uncontrolledValues, setUncontrolledValues] = React.useState<readonly string[]>(() =>
|
|
27
|
+
normalizeAccordionValues(type, defaultValue),
|
|
28
|
+
);
|
|
29
|
+
const controlled = value !== undefined;
|
|
30
|
+
const openValues = controlled ? normalizeAccordionValues(type, value) : uncontrolledValues;
|
|
31
|
+
|
|
32
|
+
const toggleValue = React.useCallback(
|
|
33
|
+
(itemValue: string) => {
|
|
34
|
+
if (disabled || interactionPolicy === 'passive') return;
|
|
35
|
+
|
|
36
|
+
const nextValues = resolveAccordionToggle({
|
|
37
|
+
collapsible,
|
|
38
|
+
mode: type,
|
|
39
|
+
openValues,
|
|
40
|
+
value: itemValue,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (!controlled) setUncontrolledValues(nextValues);
|
|
44
|
+
notifyValueChange(props, nextValues);
|
|
45
|
+
},
|
|
46
|
+
[collapsible, controlled, disabled, interactionPolicy, openValues, props, type],
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const contextValue = React.useMemo(
|
|
50
|
+
() => ({ disabled, interactionPolicy, mode: type, openValues, toggleValue }),
|
|
51
|
+
[disabled, interactionPolicy, openValues, toggleValue, type],
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<AccordionContext.Provider value={contextValue}>
|
|
56
|
+
<View {...viewProps}>{children}</View>
|
|
57
|
+
</AccordionContext.Provider>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/*** Normalizes the public single/multiple value shapes for internal state. */
|
|
62
|
+
function normalizeAccordionValues(
|
|
63
|
+
mode: AccordionMode,
|
|
64
|
+
value: string | readonly string[] | undefined,
|
|
65
|
+
): readonly string[] {
|
|
66
|
+
if (mode === 'multiple') {
|
|
67
|
+
return typeof value === 'string' || value === undefined ? [] : value;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return typeof value === 'string' ? [value] : [];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/*** Emits the public value shape matching the configured accordion mode. */
|
|
74
|
+
function notifyValueChange(props: AccordionProps, values: readonly string[]) {
|
|
75
|
+
if (props.type === 'multiple') {
|
|
76
|
+
const multipleProps: AccordionMultipleProps = props;
|
|
77
|
+
multipleProps.onValueChange?.(values);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const singleProps: AccordionSingleProps = props;
|
|
82
|
+
singleProps.onValueChange?.(values[0]);
|
|
83
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, type ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import type { AccordionContentProps } from '../../../../types/accordion';
|
|
5
|
+
import { AccordionItemContext } from './AccordionItemContext';
|
|
6
|
+
|
|
7
|
+
/*** Renders an accordion item's content when expanded or force-mounted. */
|
|
8
|
+
export function AccordionContent({
|
|
9
|
+
children,
|
|
10
|
+
forceMount = false,
|
|
11
|
+
style,
|
|
12
|
+
...viewProps
|
|
13
|
+
}: AccordionContentProps) {
|
|
14
|
+
const item = React.useContext(AccordionItemContext);
|
|
15
|
+
if (!item) throw new Error('AccordionContent must be rendered inside AccordionItem.');
|
|
16
|
+
if (!item.open && !forceMount) return null;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<View
|
|
20
|
+
{...viewProps}
|
|
21
|
+
accessibilityLabelledBy={item.triggerId}
|
|
22
|
+
nativeID={item.contentId}
|
|
23
|
+
style={[!item.open ? hiddenContentStyle : undefined, style]}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
</View>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const hiddenContentStyle: ViewStyle = { display: 'none' };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import type { AccordionItemProps } from '../../../../types/accordion';
|
|
5
|
+
import { AccordionContext } from './AccordionContext';
|
|
6
|
+
import { AccordionItemContext } from './AccordionItemContext';
|
|
7
|
+
|
|
8
|
+
/*** Provides one accordion item's value, state, and trigger/content identifiers. */
|
|
9
|
+
export function AccordionItem({
|
|
10
|
+
children,
|
|
11
|
+
disabled = false,
|
|
12
|
+
interactionPolicy,
|
|
13
|
+
value,
|
|
14
|
+
...viewProps
|
|
15
|
+
}: AccordionItemProps) {
|
|
16
|
+
const accordion = React.useContext(AccordionContext);
|
|
17
|
+
if (!accordion) throw new Error('AccordionItem must be rendered inside Accordion.');
|
|
18
|
+
|
|
19
|
+
const reactId = React.useId();
|
|
20
|
+
const resolvedDisabled = accordion.disabled || disabled;
|
|
21
|
+
const resolvedInteractionPolicy = interactionPolicy ?? accordion.interactionPolicy;
|
|
22
|
+
const open = accordion.openValues.includes(value);
|
|
23
|
+
const toggle = React.useCallback(() => accordion.toggleValue(value), [accordion, value]);
|
|
24
|
+
const contextValue = React.useMemo(
|
|
25
|
+
() => ({
|
|
26
|
+
contentId: `accordion-${reactId}-content`,
|
|
27
|
+
disabled: resolvedDisabled,
|
|
28
|
+
interactionPolicy: resolvedInteractionPolicy,
|
|
29
|
+
open,
|
|
30
|
+
toggle,
|
|
31
|
+
triggerId: `accordion-${reactId}-trigger`,
|
|
32
|
+
value,
|
|
33
|
+
}),
|
|
34
|
+
[open, reactId, resolvedDisabled, resolvedInteractionPolicy, toggle, value],
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<AccordionItemContext.Provider value={contextValue}>
|
|
39
|
+
<View {...viewProps}>{children}</View>
|
|
40
|
+
</AccordionItemContext.Provider>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pressable, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import type { AccordionTriggerProps } from '../../../../types/accordion';
|
|
5
|
+
import { AccordionItemContext } from './AccordionItemContext';
|
|
6
|
+
|
|
7
|
+
/*** Renders the accessible button that toggles its owning accordion item. */
|
|
8
|
+
export function AccordionTrigger({
|
|
9
|
+
children,
|
|
10
|
+
disabled = false,
|
|
11
|
+
interactionPolicy,
|
|
12
|
+
...pressableProps
|
|
13
|
+
}: AccordionTriggerProps) {
|
|
14
|
+
const item = React.useContext(AccordionItemContext);
|
|
15
|
+
if (!item) throw new Error('AccordionTrigger must be rendered inside AccordionItem.');
|
|
16
|
+
|
|
17
|
+
const resolvedDisabled = item.disabled || disabled;
|
|
18
|
+
const resolvedInteractionPolicy = interactionPolicy ?? item.interactionPolicy;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<View accessibilityRole="header">
|
|
22
|
+
<Pressable
|
|
23
|
+
{...pressableProps}
|
|
24
|
+
accessibilityRole="button"
|
|
25
|
+
accessibilityState={{ disabled: resolvedDisabled, expanded: item.open }}
|
|
26
|
+
disabled={resolvedDisabled}
|
|
27
|
+
nativeID={item.triggerId}
|
|
28
|
+
onPress={resolvedInteractionPolicy === 'passive' ? undefined : item.toggle}
|
|
29
|
+
>
|
|
30
|
+
{children}
|
|
31
|
+
</Pressable>
|
|
32
|
+
</View>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
AccordionContentProps,
|
|
3
|
+
AccordionItemProps,
|
|
4
|
+
AccordionMode,
|
|
5
|
+
AccordionMultipleProps,
|
|
6
|
+
AccordionProps,
|
|
7
|
+
AccordionSingleProps,
|
|
8
|
+
AccordionTriggerProps,
|
|
9
|
+
} from '../../types/accordion';
|
|
10
|
+
export { Accordion } from './adapters/inbound/Accordion';
|
|
11
|
+
export { AccordionContent } from './adapters/inbound/AccordionContent';
|
|
12
|
+
export { AccordionItem } from './adapters/inbound/AccordionItem';
|
|
13
|
+
export { AccordionTrigger } from './adapters/inbound/AccordionTrigger';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import { resolveAccordionToggle } from './resolveAccordionToggle';
|
|
4
|
+
|
|
5
|
+
describe('resolveAccordionToggle', () => {
|
|
6
|
+
test('opens one value in single mode', () => {
|
|
7
|
+
expect(
|
|
8
|
+
resolveAccordionToggle({
|
|
9
|
+
collapsible: false,
|
|
10
|
+
mode: 'single',
|
|
11
|
+
openValues: ['general'],
|
|
12
|
+
value: 'appearance',
|
|
13
|
+
}),
|
|
14
|
+
).toEqual(['appearance']);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('keeps the active value open when single mode is not collapsible', () => {
|
|
18
|
+
const openValues = ['general'] as const;
|
|
19
|
+
expect(
|
|
20
|
+
resolveAccordionToggle({
|
|
21
|
+
collapsible: false,
|
|
22
|
+
mode: 'single',
|
|
23
|
+
openValues,
|
|
24
|
+
value: 'general',
|
|
25
|
+
}),
|
|
26
|
+
).toBe(openValues);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('closes the active value when single mode is collapsible', () => {
|
|
30
|
+
expect(
|
|
31
|
+
resolveAccordionToggle({
|
|
32
|
+
collapsible: true,
|
|
33
|
+
mode: 'single',
|
|
34
|
+
openValues: ['general'],
|
|
35
|
+
value: 'general',
|
|
36
|
+
}),
|
|
37
|
+
).toEqual([]);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('adds and removes values independently in multiple mode', () => {
|
|
41
|
+
const opened = resolveAccordionToggle({
|
|
42
|
+
collapsible: false,
|
|
43
|
+
mode: 'multiple',
|
|
44
|
+
openValues: ['general'],
|
|
45
|
+
value: 'appearance',
|
|
46
|
+
});
|
|
47
|
+
expect(opened).toEqual(['general', 'appearance']);
|
|
48
|
+
expect(
|
|
49
|
+
resolveAccordionToggle({
|
|
50
|
+
collapsible: false,
|
|
51
|
+
mode: 'multiple',
|
|
52
|
+
openValues: opened,
|
|
53
|
+
value: 'general',
|
|
54
|
+
}),
|
|
55
|
+
).toEqual(['appearance']);
|
|
56
|
+
});
|
|
57
|
+
});
|