@audira/carbon-react-native 1.0.0-beta.7 → 1.0.0-beta.8
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/lib/commonjs/components/modal/Modal.js +19 -15
- package/lib/commonjs/components/modal/Modal.js.map +1 -1
- package/lib/module/components/modal/Modal.js +19 -15
- package/lib/module/components/modal/Modal.js.map +1 -1
- package/lib/typescript/commonjs/components/modal/Modal.d.ts.map +1 -1
- package/lib/typescript/module/components/modal/Modal.d.ts.map +1 -1
- package/lib/typescript/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/_internal/contexts/button-group/ButtonGroupContext.ts +25 -0
- package/src/_internal/contexts/button-group/index.tsx +1 -0
- package/src/_internal/contexts/global-config/GlobalConfigContext.ts +30 -0
- package/src/_internal/contexts/global-config/index.ts +1 -0
- package/src/_internal/contexts/index.ts +3 -0
- package/src/_internal/contexts/modal/ModalContext.ts +15 -0
- package/src/_internal/contexts/modal/index.ts +1 -0
- package/src/_internal/globals/breakpoint/index.ts +13 -0
- package/src/_internal/globals/color-scheme/index.ts +13 -0
- package/src/_internal/globals/index.ts +7 -0
- package/src/_internal/helpers/index.ts +5 -0
- package/src/_internal/helpers/math/clamp.ts +3 -0
- package/src/_internal/helpers/math/index.ts +1 -0
- package/src/_internal/providers/breakpoint/BreakpointProvider.tsx +42 -0
- package/src/_internal/providers/breakpoint/BreakpointProviderProps.ts +3 -0
- package/src/_internal/providers/breakpoint/index.tsx +2 -0
- package/src/_internal/providers/global-config/GlobalConfigProvider.tsx +30 -0
- package/src/_internal/providers/global-config/GlobalConfigProviderProps.ts +7 -0
- package/src/_internal/providers/global-config/index.tsx +2 -0
- package/src/_internal/providers/index.ts +3 -0
- package/src/_internal/providers/theme/ThemeProvider.tsx +45 -0
- package/src/_internal/providers/theme/ThemeProviderProps.ts +8 -0
- package/src/_internal/providers/theme/index.tsx +2 -0
- package/src/_internal/style-sheets/common-style-sheet.ts +24 -0
- package/src/_internal/style-sheets/flex-style-sheet.ts +84 -0
- package/src/_internal/style-sheets/index.ts +3 -0
- package/src/_internal/style-sheets/text-style-sheet.ts +62 -0
- package/src/carbon-react-native/CarbonReactNative.tsx +41 -0
- package/src/carbon-react-native/CarbonReactNativeProps.ts +7 -0
- package/src/carbon-react-native/index.tsx +2 -0
- package/src/carbon-style-sheet/breakpoint.ts +16 -0
- package/src/carbon-style-sheet/color.ts +13 -0
- package/src/carbon-style-sheet/create.ts +232 -0
- package/src/carbon-style-sheet/index.tsx +51 -0
- package/src/carbon-style-sheet/use.tsx +16 -0
- package/src/components/accordion/Accordion.tsx +132 -0
- package/src/components/accordion/AccordionHeaderProps.ts +17 -0
- package/src/components/accordion/AccordionItemProps.ts +24 -0
- package/src/components/accordion/AccordionItemRef.ts +10 -0
- package/src/components/accordion/AccordionProps.ts +19 -0
- package/src/components/accordion/AccordionRef.ts +6 -0
- package/src/components/accordion/AccordionSize.ts +4 -0
- package/src/components/accordion/_Header.tsx +201 -0
- package/src/components/accordion/_HeaderBorder.tsx +75 -0
- package/src/components/accordion/_Item.tsx +175 -0
- package/src/components/accordion/_ItemRefBase.ts +7 -0
- package/src/components/accordion/_chevron/Chevron.tsx +97 -0
- package/src/components/accordion/_chevron/ChevronProps.ts +10 -0
- package/src/components/accordion/_chevron/index.ts +2 -0
- package/src/components/accordion/_context.ts +20 -0
- package/src/components/accordion/_motion.ts +27 -0
- package/src/components/accordion/_styles.ts +24 -0
- package/src/components/accordion/index.tsx +7 -0
- package/src/components/button/Size.ts +7 -0
- package/src/components/button/base/Base.tsx +328 -0
- package/src/components/button/base/BaseProps.ts +60 -0
- package/src/components/button/base/BaseRef.ts +6 -0
- package/src/components/button/base/index.tsx +3 -0
- package/src/components/button/base-color/BaseColor.tsx +289 -0
- package/src/components/button/base-color/BaseColorProps.ts +32 -0
- package/src/components/button/base-color/BaseColorRef.ts +6 -0
- package/src/components/button/base-color/BaseColorState.ts +6 -0
- package/src/components/button/base-color/index.tsx +4 -0
- package/src/components/button/ghost/Ghost.tsx +165 -0
- package/src/components/button/ghost/GhostProps.ts +10 -0
- package/src/components/button/ghost/GhostRef.ts +6 -0
- package/src/components/button/ghost/index.tsx +3 -0
- package/src/components/button/ghost-danger/GhostDanger.tsx +165 -0
- package/src/components/button/ghost-danger/GhostDangerProps.ts +10 -0
- package/src/components/button/ghost-danger/GhostDangerRef.ts +6 -0
- package/src/components/button/ghost-danger/index.tsx +3 -0
- package/src/components/button/ghost-icon/GhostIcon.tsx +127 -0
- package/src/components/button/ghost-icon/GhostIconProps.ts +17 -0
- package/src/components/button/ghost-icon/GhostIconRef.ts +6 -0
- package/src/components/button/ghost-icon/index.tsx +3 -0
- package/src/components/button/index.tsx +11 -0
- package/src/components/button/primary/Primary.tsx +140 -0
- package/src/components/button/primary/PrimaryProps.ts +11 -0
- package/src/components/button/primary/PrimaryRef.ts +6 -0
- package/src/components/button/primary/index.tsx +3 -0
- package/src/components/button/primary-danger/PrimaryDanger.tsx +140 -0
- package/src/components/button/primary-danger/PrimaryDangerProps.ts +12 -0
- package/src/components/button/primary-danger/PrimaryDangerRef.ts +6 -0
- package/src/components/button/primary-danger/index.tsx +3 -0
- package/src/components/button/secondary/Secondary.tsx +140 -0
- package/src/components/button/secondary/SecondaryProps.ts +12 -0
- package/src/components/button/secondary/SecondaryRef.ts +6 -0
- package/src/components/button/secondary/index.tsx +3 -0
- package/src/components/button/tertiary/Tertiary.tsx +157 -0
- package/src/components/button/tertiary/TertiaryProps.ts +12 -0
- package/src/components/button/tertiary/TertiaryRef.ts +6 -0
- package/src/components/button/tertiary/index.tsx +3 -0
- package/src/components/button/tertiary-danger/TertiaryDanger.tsx +157 -0
- package/src/components/button/tertiary-danger/TertiaryDangerProps.ts +12 -0
- package/src/components/button/tertiary-danger/TertiaryDangerRef.ts +6 -0
- package/src/components/button/tertiary-danger/index.tsx +3 -0
- package/src/components/button-group/ButtonGroup.tsx +145 -0
- package/src/components/button-group/ButtonGroupProps.ts +37 -0
- package/src/components/button-group/ButtonGroupRef.ts +6 -0
- package/src/components/button-group/index.tsx +3 -0
- package/src/components/checkbox/Checkbox.tsx +221 -0
- package/src/components/checkbox/CheckboxProps.ts +39 -0
- package/src/components/checkbox/CheckboxRef.ts +10 -0
- package/src/components/checkbox/_RefBase.ts +11 -0
- package/src/components/checkbox/index.tsx +3 -0
- package/src/components/checkbox-group/CheckboxGroup.tsx +227 -0
- package/src/components/checkbox-group/CheckboxGroupHelperTextMode.ts +4 -0
- package/src/components/checkbox-group/CheckboxGroupProps.ts +28 -0
- package/src/components/checkbox-group/CheckboxGroupRef.ts +6 -0
- package/src/components/checkbox-group/index.tsx +4 -0
- package/src/components/checkbox-input/CheckboxInput.tsx +340 -0
- package/src/components/checkbox-input/CheckboxInputInteractiveState.ts +6 -0
- package/src/components/checkbox-input/CheckboxInputProps.ts +25 -0
- package/src/components/checkbox-input/CheckboxInputRef.ts +11 -0
- package/src/components/checkbox-input/CheckboxInputValue.ts +6 -0
- package/src/components/checkbox-input/_RefBase.ts +11 -0
- package/src/components/checkbox-input/index.tsx +5 -0
- package/src/components/collapsible/Collapsible.tsx +274 -0
- package/src/components/collapsible/CollapsibleProps.ts +17 -0
- package/src/components/collapsible/CollapsibleRef.ts +11 -0
- package/src/components/collapsible/_RefBase.ts +6 -0
- package/src/components/collapsible/index.ts +3 -0
- package/src/components/form-helper-text/FormHelperText.tsx +109 -0
- package/src/components/form-helper-text/FormHelperTextProps.ts +15 -0
- package/src/components/form-helper-text/FormHelperTextRef.ts +6 -0
- package/src/components/form-helper-text/index.tsx +3 -0
- package/src/components/form-label/FormLabel.tsx +85 -0
- package/src/components/form-label/FormLabelProps.ts +17 -0
- package/src/components/form-label/FormLabelRef.ts +6 -0
- package/src/components/form-label/index.tsx +3 -0
- package/src/components/icon/Icon.tsx +48 -0
- package/src/components/icon/IconProps.ts +11 -0
- package/src/components/icon/index.tsx +2 -0
- package/src/components/index.tsx +35 -0
- package/src/components/inline-loading/InlineLoading.tsx +144 -0
- package/src/components/inline-loading/InlineLoadingProps.ts +24 -0
- package/src/components/inline-loading/InlineLoadingRef.ts +6 -0
- package/src/components/inline-loading/InlineLoadingState.ts +5 -0
- package/src/components/inline-loading/index.tsx +4 -0
- package/src/components/layer/Layer.tsx +87 -0
- package/src/components/layer/LayerContext.ts +9 -0
- package/src/components/layer/LayerProps.ts +16 -0
- package/src/components/layer/LayerRef.ts +6 -0
- package/src/components/layer/index.tsx +4 -0
- package/src/components/loading/Loading.tsx +116 -0
- package/src/components/loading/LoadingProps.ts +14 -0
- package/src/components/loading/LoadingRef.ts +4 -0
- package/src/components/loading/LoadingType.ts +3 -0
- package/src/components/loading/_circular-progress/CircularProgress.tsx +113 -0
- package/src/components/loading/_circular-progress/CircularProgressProps.ts +18 -0
- package/src/components/loading/_circular-progress/index.ts +2 -0
- package/src/components/loading/_map-circle-background-color.ts +26 -0
- package/src/components/loading/_map-circle-stroke-color.ts +13 -0
- package/src/components/loading/index.ts +4 -0
- package/src/components/modal/Modal.tsx +397 -0
- package/src/components/modal/ModalProps.ts +24 -0
- package/src/components/modal/ModalRef.ts +6 -0
- package/src/components/modal/ModalSize.ts +5 -0
- package/src/components/modal/index.tsx +4 -0
- package/src/components/modal-content/ModalContent.tsx +182 -0
- package/src/components/modal-content/ModalContentProps.ts +7 -0
- package/src/components/modal-content/ModalContentRef.ts +6 -0
- package/src/components/modal-content/index.tsx +3 -0
- package/src/components/notification/NotificationColor.ts +3 -0
- package/src/components/notification/_VariantContextProvider.tsx +39 -0
- package/src/components/notification/_status-hooks/_base/UseBaseData.ts +11 -0
- package/src/components/notification/_status-hooks/_base/UseBaseProps.ts +21 -0
- package/src/components/notification/_status-hooks/_base/index.tsx +3 -0
- package/src/components/notification/_status-hooks/_base/useBase.tsx +77 -0
- package/src/components/notification/_status-hooks/error/UseErrorData.ts +11 -0
- package/src/components/notification/_status-hooks/error/UseErrorProps.ts +8 -0
- package/src/components/notification/_status-hooks/error/index.tsx +3 -0
- package/src/components/notification/_status-hooks/error/useError.tsx +122 -0
- package/src/components/notification/_status-hooks/index.tsx +4 -0
- package/src/components/notification/_status-hooks/informational/UseInformationalData.ts +11 -0
- package/src/components/notification/_status-hooks/informational/UseInformationalProps.ts +8 -0
- package/src/components/notification/_status-hooks/informational/index.tsx +3 -0
- package/src/components/notification/_status-hooks/informational/useInformational.tsx +122 -0
- package/src/components/notification/_status-hooks/success/UseSuccessData.ts +11 -0
- package/src/components/notification/_status-hooks/success/UseSuccessProps.ts +8 -0
- package/src/components/notification/_status-hooks/success/index.tsx +3 -0
- package/src/components/notification/_status-hooks/success/useSuccess.tsx +122 -0
- package/src/components/notification/_status-hooks/warning/UseWarningData.ts +11 -0
- package/src/components/notification/_status-hooks/warning/UseWarningProps.ts +8 -0
- package/src/components/notification/_status-hooks/warning/index.tsx +3 -0
- package/src/components/notification/_status-hooks/warning/useWarning.tsx +122 -0
- package/src/components/notification/_variant-context.ts +15 -0
- package/src/components/notification/_variants/_ButtonGhost.tsx +73 -0
- package/src/components/notification/_variants/_ButtonTertiary.tsx +73 -0
- package/src/components/notification/_variants/actionable/ActionableVariant.tsx +70 -0
- package/src/components/notification/_variants/actionable/ActionableVariantProps.ts +46 -0
- package/src/components/notification/_variants/actionable/ActionableVariantRef.ts +6 -0
- package/src/components/notification/_variants/actionable/index.tsx +3 -0
- package/src/components/notification/_variants/actionable-inline/ActionableInlineVariant.tsx +70 -0
- package/src/components/notification/_variants/actionable-inline/ActionableInlineVariantProps.ts +46 -0
- package/src/components/notification/_variants/actionable-inline/ActionableInlineVariantRef.ts +6 -0
- package/src/components/notification/_variants/actionable-inline/index.tsx +3 -0
- package/src/components/notification/_variants/callout/CalloutVariant.tsx +59 -0
- package/src/components/notification/_variants/callout/CalloutVariantProps.ts +26 -0
- package/src/components/notification/_variants/callout/CalloutVariantRef.ts +6 -0
- package/src/components/notification/_variants/callout/index.tsx +3 -0
- package/src/components/notification/_variants/callout-inline/CalloutInlineVariant.tsx +59 -0
- package/src/components/notification/_variants/callout-inline/CalloutInlineVariantProps.ts +26 -0
- package/src/components/notification/_variants/callout-inline/CalloutInlineVariantRef.ts +6 -0
- package/src/components/notification/_variants/callout-inline/index.tsx +3 -0
- package/src/components/notification/_variants/index.tsx +5 -0
- package/src/components/notification/_variants/toast/ToastVariant.tsx +115 -0
- package/src/components/notification/_variants/toast/ToastVariantProps.ts +30 -0
- package/src/components/notification/_variants/toast/ToastVariantRef.ts +6 -0
- package/src/components/notification/_variants/toast/index.tsx +3 -0
- package/src/components/notification/actionable/error/Error.tsx +78 -0
- package/src/components/notification/actionable/error/ErrorProps.ts +14 -0
- package/src/components/notification/actionable/error/ErrorRef.ts +6 -0
- package/src/components/notification/actionable/error/index.tsx +3 -0
- package/src/components/notification/actionable/index.tsx +4 -0
- package/src/components/notification/actionable/informational/Informational.tsx +78 -0
- package/src/components/notification/actionable/informational/InformationalProps.ts +14 -0
- package/src/components/notification/actionable/informational/InformationalRef.ts +6 -0
- package/src/components/notification/actionable/informational/index.tsx +3 -0
- package/src/components/notification/actionable/success/Success.tsx +78 -0
- package/src/components/notification/actionable/success/SuccessProps.ts +14 -0
- package/src/components/notification/actionable/success/SuccessRef.ts +6 -0
- package/src/components/notification/actionable/success/index.tsx +3 -0
- package/src/components/notification/actionable/warning/Warning.tsx +78 -0
- package/src/components/notification/actionable/warning/WarningProps.ts +14 -0
- package/src/components/notification/actionable/warning/WarningRef.ts +6 -0
- package/src/components/notification/actionable/warning/index.tsx +3 -0
- package/src/components/notification/actionable-inline/error/Error.tsx +77 -0
- package/src/components/notification/actionable-inline/error/ErrorProps.ts +14 -0
- package/src/components/notification/actionable-inline/error/ErrorRef.ts +6 -0
- package/src/components/notification/actionable-inline/error/index.tsx +3 -0
- package/src/components/notification/actionable-inline/index.tsx +4 -0
- package/src/components/notification/actionable-inline/informational/Informational.tsx +77 -0
- package/src/components/notification/actionable-inline/informational/InformationalProps.ts +14 -0
- package/src/components/notification/actionable-inline/informational/InformationalRef.ts +6 -0
- package/src/components/notification/actionable-inline/informational/index.tsx +3 -0
- package/src/components/notification/actionable-inline/success/Success.tsx +77 -0
- package/src/components/notification/actionable-inline/success/SuccessProps.ts +14 -0
- package/src/components/notification/actionable-inline/success/SuccessRef.ts +6 -0
- package/src/components/notification/actionable-inline/success/index.tsx +3 -0
- package/src/components/notification/actionable-inline/warning/Warning.tsx +77 -0
- package/src/components/notification/actionable-inline/warning/WarningProps.ts +14 -0
- package/src/components/notification/actionable-inline/warning/WarningRef.ts +6 -0
- package/src/components/notification/actionable-inline/warning/index.tsx +3 -0
- package/src/components/notification/base/Base.tsx +292 -0
- package/src/components/notification/base/BaseProps.ts +59 -0
- package/src/components/notification/base/BaseRef.ts +6 -0
- package/src/components/notification/base/index.tsx +3 -0
- package/src/components/notification/callout/error/Error.tsx +78 -0
- package/src/components/notification/callout/error/ErrorProps.ts +14 -0
- package/src/components/notification/callout/error/ErrorRef.ts +6 -0
- package/src/components/notification/callout/error/index.tsx +3 -0
- package/src/components/notification/callout/index.tsx +4 -0
- package/src/components/notification/callout/informational/Informational.tsx +78 -0
- package/src/components/notification/callout/informational/InformationalProps.ts +14 -0
- package/src/components/notification/callout/informational/InformationalRef.ts +6 -0
- package/src/components/notification/callout/informational/index.tsx +3 -0
- package/src/components/notification/callout/success/Success.tsx +78 -0
- package/src/components/notification/callout/success/SuccessProps.ts +14 -0
- package/src/components/notification/callout/success/SuccessRef.ts +6 -0
- package/src/components/notification/callout/success/index.tsx +3 -0
- package/src/components/notification/callout/warning/Warning.tsx +78 -0
- package/src/components/notification/callout/warning/WarningProps.ts +14 -0
- package/src/components/notification/callout/warning/WarningRef.ts +6 -0
- package/src/components/notification/callout/warning/index.tsx +3 -0
- package/src/components/notification/callout-inline/error/Error.tsx +77 -0
- package/src/components/notification/callout-inline/error/ErrorProps.ts +14 -0
- package/src/components/notification/callout-inline/error/ErrorRef.ts +6 -0
- package/src/components/notification/callout-inline/error/index.tsx +3 -0
- package/src/components/notification/callout-inline/index.tsx +4 -0
- package/src/components/notification/callout-inline/informational/Informational.tsx +77 -0
- package/src/components/notification/callout-inline/informational/InformationalProps.ts +14 -0
- package/src/components/notification/callout-inline/informational/InformationalRef.ts +6 -0
- package/src/components/notification/callout-inline/informational/index.tsx +3 -0
- package/src/components/notification/callout-inline/success/Success.tsx +77 -0
- package/src/components/notification/callout-inline/success/SuccessProps.ts +14 -0
- package/src/components/notification/callout-inline/success/SuccessRef.ts +6 -0
- package/src/components/notification/callout-inline/success/index.tsx +3 -0
- package/src/components/notification/callout-inline/warning/Warning.tsx +77 -0
- package/src/components/notification/callout-inline/warning/WarningProps.ts +14 -0
- package/src/components/notification/callout-inline/warning/WarningRef.ts +6 -0
- package/src/components/notification/callout-inline/warning/index.tsx +3 -0
- package/src/components/notification/index.tsx +18 -0
- package/src/components/notification/subtitle/Subtitle.tsx +75 -0
- package/src/components/notification/subtitle/SubtitleProps.ts +6 -0
- package/src/components/notification/subtitle/SubtitleRef.ts +6 -0
- package/src/components/notification/subtitle/index.tsx +3 -0
- package/src/components/notification/subtitle-link/SubtitleLink.tsx +74 -0
- package/src/components/notification/subtitle-link/SubtitleLinkProps.ts +6 -0
- package/src/components/notification/subtitle-link/SubtitleLinkRef.ts +6 -0
- package/src/components/notification/subtitle-link/index.tsx +3 -0
- package/src/components/notification/toast/error/Error.tsx +78 -0
- package/src/components/notification/toast/error/ErrorProps.ts +14 -0
- package/src/components/notification/toast/error/ErrorRef.ts +6 -0
- package/src/components/notification/toast/error/index.tsx +3 -0
- package/src/components/notification/toast/index.tsx +4 -0
- package/src/components/notification/toast/informational/Informational.tsx +78 -0
- package/src/components/notification/toast/informational/InformationalProps.ts +14 -0
- package/src/components/notification/toast/informational/InformationalRef.ts +6 -0
- package/src/components/notification/toast/informational/index.tsx +3 -0
- package/src/components/notification/toast/success/Success.tsx +78 -0
- package/src/components/notification/toast/success/SuccessProps.ts +14 -0
- package/src/components/notification/toast/success/SuccessRef.ts +6 -0
- package/src/components/notification/toast/success/index.tsx +3 -0
- package/src/components/notification/toast/warning/Warning.tsx +78 -0
- package/src/components/notification/toast/warning/WarningProps.ts +14 -0
- package/src/components/notification/toast/warning/WarningRef.ts +6 -0
- package/src/components/notification/toast/warning/index.tsx +3 -0
- package/src/components/radio-button/RadioButton.tsx +216 -0
- package/src/components/radio-button/RadioButtonProps.ts +44 -0
- package/src/components/radio-button/RadioButtonRef.ts +10 -0
- package/src/components/radio-button/_RefBase.ts +11 -0
- package/src/components/radio-button/index.tsx +3 -0
- package/src/components/radio-button-group/RadioButtonGroup.tsx +246 -0
- package/src/components/radio-button-group/RadioButtonGroupHelperTextMode.ts +4 -0
- package/src/components/radio-button-group/RadioButtonGroupItemProps.ts +10 -0
- package/src/components/radio-button-group/RadioButtonGroupItemRef.ts +6 -0
- package/src/components/radio-button-group/RadioButtonGroupProps.ts +35 -0
- package/src/components/radio-button-group/RadioButtonGroupRef.ts +10 -0
- package/src/components/radio-button-group/_Item.tsx +101 -0
- package/src/components/radio-button-group/_RefBase.ts +11 -0
- package/src/components/radio-button-group/_item-context.tsx +18 -0
- package/src/components/radio-button-group/index.tsx +6 -0
- package/src/components/radio-button-input/RadioButtonInput.tsx +295 -0
- package/src/components/radio-button-input/RadioButtonInputInteractiveState.ts +6 -0
- package/src/components/radio-button-input/RadioButtonInputProps.ts +25 -0
- package/src/components/radio-button-input/RadioButtonInputRef.ts +10 -0
- package/src/components/radio-button-input/_RefBase.ts +7 -0
- package/src/components/radio-button-input/index.tsx +4 -0
- package/src/components/switch/Switch.tsx +487 -0
- package/src/components/switch/SwitchProps.ts +38 -0
- package/src/components/switch/SwitchRef.ts +10 -0
- package/src/components/switch/SwitchSize.ts +4 -0
- package/src/components/switch/SwitchState.ts +4 -0
- package/src/components/switch/_RefBase.ts +7 -0
- package/src/components/switch/index.ts +5 -0
- package/src/components/text/Text.tsx +171 -0
- package/src/components/text/TextProps.ts +20 -0
- package/src/components/text/TextRef.ts +6 -0
- package/src/components/text/index.ts +3 -0
- package/src/components/text-area/TextArea.tsx +266 -0
- package/src/components/text-area/TextAreaProps.ts +13 -0
- package/src/components/text-area/TextAreaRef.ts +10 -0
- package/src/components/text-area/_TextAreaRefBase.ts +7 -0
- package/src/components/text-area/index.tsx +3 -0
- package/src/components/text-area-field/TextAreaField.tsx +75 -0
- package/src/components/text-area-field/TextAreaFieldInteractiveState.ts +5 -0
- package/src/components/text-area-field/TextAreaFieldProps.ts +6 -0
- package/src/components/text-area-field/TextAreaFieldRef.ts +6 -0
- package/src/components/text-area-field/index.tsx +4 -0
- package/src/components/text-area-fluid/TextAreaFluid.tsx +157 -0
- package/src/components/text-area-fluid/TextAreaFluidProps.ts +13 -0
- package/src/components/text-area-fluid/TextAreaFluidRef.ts +6 -0
- package/src/components/text-area-fluid/index.tsx +3 -0
- package/src/components/text-input/TextInput.tsx +270 -0
- package/src/components/text-input/TextInputProps.ts +13 -0
- package/src/components/text-input/TextInputRef.ts +10 -0
- package/src/components/text-input/TextInputSize.ts +5 -0
- package/src/components/text-input/_TextInputRefBase.ts +7 -0
- package/src/components/text-input/index.ts +4 -0
- package/src/components/text-input-field/TextInputField.tsx +435 -0
- package/src/components/text-input-field/TextInputFieldInteractiveState.ts +6 -0
- package/src/components/text-input-field/TextInputFieldProps.ts +31 -0
- package/src/components/text-input-field/TextInputFieldRef.ts +8 -0
- package/src/components/text-input-field/TextInputFieldSize.ts +4 -0
- package/src/components/text-input-field/_rn-text-input/RNTextInput.tsx +161 -0
- package/src/components/text-input-field/_rn-text-input/RNTextInputProps.ts +11 -0
- package/src/components/text-input-field/_rn-text-input/RNTextInputRef.ts +6 -0
- package/src/components/text-input-field/_rn-text-input/index.ts +3 -0
- package/src/components/text-input-field/index.tsx +5 -0
- package/src/components/text-input-fluid/TextInputFluid.tsx +166 -0
- package/src/components/text-input-fluid/TextInputFluidProps.ts +14 -0
- package/src/components/text-input-fluid/TextInputFluidRef.ts +6 -0
- package/src/components/text-input-fluid/index.tsx +3 -0
- package/src/components/toggle/State.ts +5 -0
- package/src/components/toggle/base/Base.tsx +302 -0
- package/src/components/toggle/base/BaseProps.ts +54 -0
- package/src/components/toggle/base/BaseRef.ts +10 -0
- package/src/components/toggle/base/_RefBase.ts +11 -0
- package/src/components/toggle/base/index.tsx +3 -0
- package/src/components/toggle/default/Default.tsx +38 -0
- package/src/components/toggle/default/DefaultProps.ts +9 -0
- package/src/components/toggle/default/DefaultRef.ts +6 -0
- package/src/components/toggle/default/index.tsx +3 -0
- package/src/components/toggle/index.tsx +4 -0
- package/src/components/toggle/small/Small.tsx +38 -0
- package/src/components/toggle/small/SmallProps.ts +7 -0
- package/src/components/toggle/small/SmallRef.ts +6 -0
- package/src/components/toggle/small/index.tsx +3 -0
- package/src/const/dialog-animation-configs/carbon-react.ts +53 -0
- package/src/const/dialog-animation-configs/fade-bottom-up-2.ts +36 -0
- package/src/const/dialog-animation-configs/fade-bottom-up.ts +36 -0
- package/src/const/dialog-animation-configs/index.ts +3 -0
- package/src/const/index.ts +5 -0
- package/src/contexts/breakpoint/BreakpointContext.ts +19 -0
- package/src/contexts/breakpoint/index.ts +1 -0
- package/src/contexts/dialog/DialogContext.ts +27 -0
- package/src/contexts/dialog/DialogData.ts +27 -0
- package/src/contexts/dialog/DialogType.ts +7 -0
- package/src/contexts/dialog/index.ts +2 -0
- package/src/contexts/index.ts +4 -0
- package/src/contexts/theme/ThemeContext.ts +24 -0
- package/src/contexts/theme/index.ts +1 -0
- package/src/contexts/toast/ToastContext.ts +24 -0
- package/src/contexts/toast/ToastContextShowConfig.ts +6 -0
- package/src/contexts/toast/index.ts +2 -0
- package/src/helpers/breakpoint/get-token.ts +20 -0
- package/src/helpers/breakpoint/index.ts +1 -0
- package/src/helpers/color/get-color-scheme.ts +19 -0
- package/src/helpers/color/get-color-token.ts +23 -0
- package/src/helpers/color/hex-to-rgba.ts +11 -0
- package/src/helpers/color/index.ts +3 -0
- package/src/helpers/index.ts +7 -0
- package/src/hooks/breakpoint/index.tsx +1 -0
- package/src/hooks/breakpoint/use.tsx +30 -0
- package/src/hooks/index.tsx +9 -0
- package/src/index.ts +9 -0
- package/src/providers/dialog/DialogProvider.tsx +122 -0
- package/src/providers/dialog/DialogProviderAnimationConfig.ts +49 -0
- package/src/providers/dialog/DialogProviderProps.ts +28 -0
- package/src/providers/dialog/DialogProviderRef.ts +6 -0
- package/src/providers/dialog/_controller/Controller.tsx +223 -0
- package/src/providers/dialog/_controller/ControllerProps.ts +11 -0
- package/src/providers/dialog/_controller/ControllerRef.ts +6 -0
- package/src/providers/dialog/_controller/_modal/Modal.tsx +148 -0
- package/src/providers/dialog/_controller/_modal/ModalProps.ts +11 -0
- package/src/providers/dialog/_controller/_modal/ModalRef.ts +8 -0
- package/src/providers/dialog/_controller/_modal/_Interpolation.ts +9 -0
- package/src/providers/dialog/_controller/_modal/index.ts +3 -0
- package/src/providers/dialog/_controller/_overlay/Overlay.tsx +132 -0
- package/src/providers/dialog/_controller/_overlay/OverlayProps.ts +9 -0
- package/src/providers/dialog/_controller/_overlay/OverlayRef.ts +10 -0
- package/src/providers/dialog/_controller/_overlay/_OverlayRefBase.ts +3 -0
- package/src/providers/dialog/_controller/_overlay/index.ts +3 -0
- package/src/providers/dialog/_controller/index.ts +3 -0
- package/src/providers/dialog/index.ts +4 -0
- package/src/providers/index.ts +2 -0
- package/src/providers/toast/ToastProvider.tsx +73 -0
- package/src/providers/toast/ToastProviderProps.ts +3 -0
- package/src/providers/toast/ToastRef.ts +6 -0
- package/src/providers/toast/_overlay/Overlay.tsx +208 -0
- package/src/providers/toast/_overlay/OverlayRef.ts +6 -0
- package/src/providers/toast/_overlay/_component-wrapper/ComponentWrapper.tsx +168 -0
- package/src/providers/toast/_overlay/_component-wrapper/ComponentWrapperProps.ts +8 -0
- package/src/providers/toast/_overlay/_component-wrapper/ComponentWrapperRef.ts +6 -0
- package/src/providers/toast/_overlay/_component-wrapper/index.ts +3 -0
- package/src/providers/toast/_overlay/index.ts +2 -0
- package/src/providers/toast/index.tsx +3 -0
- package/src/types/index.ts +7 -0
- package/src/types/shared.ts +1 -0
- package/src/types/theme/ColorScheme.ts +1 -0
- package/src/types/theme/index.ts +1 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Easing,
|
|
3
|
+
} from "react-native"
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Motion,
|
|
7
|
+
Spacing,
|
|
8
|
+
} from "@audira/carbon-react-native-elements"
|
|
9
|
+
|
|
10
|
+
import type {
|
|
11
|
+
DialogProviderAnimationConfig,
|
|
12
|
+
} from "../../providers/dialog/DialogProviderAnimationConfig"
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Same animation style like `@carbon/react` library
|
|
16
|
+
*/
|
|
17
|
+
export const CarbonReact = {
|
|
18
|
+
duration: Motion.Duration.moderate_02,
|
|
19
|
+
modalStyleFactory(animatedValue, inputRange) {
|
|
20
|
+
return {
|
|
21
|
+
opacity: animatedValue.interpolate({
|
|
22
|
+
inputRange,
|
|
23
|
+
outputRange: [0, 1, 0],
|
|
24
|
+
}),
|
|
25
|
+
transform: [{
|
|
26
|
+
translateY: animatedValue.interpolate({
|
|
27
|
+
inputRange,
|
|
28
|
+
outputRange: [-Spacing.spacing_06, 0, -Spacing.spacing_06],
|
|
29
|
+
}),
|
|
30
|
+
}],
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
modalEasing: [
|
|
34
|
+
Easing.bezier(
|
|
35
|
+
Motion.Easing.exit.expressive.x1,
|
|
36
|
+
Motion.Easing.exit.expressive.y1,
|
|
37
|
+
Motion.Easing.exit.expressive.x2,
|
|
38
|
+
Motion.Easing.exit.expressive.y2,
|
|
39
|
+
),
|
|
40
|
+
Easing.bezier(
|
|
41
|
+
Motion.Easing.entrance.expressive.x1,
|
|
42
|
+
Motion.Easing.entrance.expressive.y1,
|
|
43
|
+
Motion.Easing.entrance.expressive.x2,
|
|
44
|
+
Motion.Easing.entrance.expressive.y2,
|
|
45
|
+
),
|
|
46
|
+
Easing.bezier(
|
|
47
|
+
Motion.Easing.exit.expressive.x1,
|
|
48
|
+
Motion.Easing.exit.expressive.y1,
|
|
49
|
+
Motion.Easing.exit.expressive.x2,
|
|
50
|
+
Motion.Easing.exit.expressive.y2,
|
|
51
|
+
),
|
|
52
|
+
],
|
|
53
|
+
} as const satisfies Required<DialogProviderAnimationConfig>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Easing,
|
|
3
|
+
} from "react-native"
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Motion,
|
|
7
|
+
Spacing,
|
|
8
|
+
} from "@audira/carbon-react-native-elements"
|
|
9
|
+
|
|
10
|
+
import type {
|
|
11
|
+
DialogProviderAnimationConfig,
|
|
12
|
+
} from "../../providers/dialog/DialogProviderAnimationConfig"
|
|
13
|
+
|
|
14
|
+
export const FadeBottomUp2 = {
|
|
15
|
+
duration: Motion.Duration.moderate_02,
|
|
16
|
+
modalStyleFactory(animatedValue, inputRange) {
|
|
17
|
+
return {
|
|
18
|
+
opacity: animatedValue.interpolate({
|
|
19
|
+
inputRange,
|
|
20
|
+
outputRange: [0, 1, 0],
|
|
21
|
+
}),
|
|
22
|
+
transform: [{
|
|
23
|
+
translateY: animatedValue.interpolate({
|
|
24
|
+
inputRange,
|
|
25
|
+
outputRange: [Spacing.spacing_04, 0, -Spacing.spacing_04],
|
|
26
|
+
}),
|
|
27
|
+
}],
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
modalEasing: Easing.bezier(
|
|
31
|
+
Motion.Easing.entrance.expressive.x1,
|
|
32
|
+
Motion.Easing.entrance.expressive.y1,
|
|
33
|
+
Motion.Easing.entrance.expressive.x2,
|
|
34
|
+
Motion.Easing.entrance.expressive.y2,
|
|
35
|
+
),
|
|
36
|
+
} as const satisfies Required<DialogProviderAnimationConfig>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Easing,
|
|
3
|
+
} from "react-native"
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Motion,
|
|
7
|
+
Spacing,
|
|
8
|
+
} from "@audira/carbon-react-native-elements"
|
|
9
|
+
|
|
10
|
+
import type {
|
|
11
|
+
DialogProviderAnimationConfig,
|
|
12
|
+
} from "../../providers/dialog/DialogProviderAnimationConfig"
|
|
13
|
+
|
|
14
|
+
export const FadeBottomUp = {
|
|
15
|
+
duration: Motion.Duration.moderate_02,
|
|
16
|
+
modalStyleFactory(animatedValue, inputRange) {
|
|
17
|
+
return {
|
|
18
|
+
opacity: animatedValue.interpolate({
|
|
19
|
+
inputRange,
|
|
20
|
+
outputRange: [0, 1, 0],
|
|
21
|
+
}),
|
|
22
|
+
transform: [{
|
|
23
|
+
translateY: animatedValue.interpolate({
|
|
24
|
+
inputRange,
|
|
25
|
+
outputRange: [Spacing.spacing_04, 0, Spacing.spacing_04],
|
|
26
|
+
}),
|
|
27
|
+
}],
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
modalEasing: Easing.bezier(
|
|
31
|
+
Motion.Easing.entrance.expressive.x1,
|
|
32
|
+
Motion.Easing.entrance.expressive.y1,
|
|
33
|
+
Motion.Easing.entrance.expressive.x2,
|
|
34
|
+
Motion.Easing.entrance.expressive.y2,
|
|
35
|
+
),
|
|
36
|
+
} as const satisfies Required<DialogProviderAnimationConfig>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
} from "react"
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Dimensions,
|
|
7
|
+
} from "react-native"
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
BreakpointToken,
|
|
11
|
+
} from "@audira/carbon-react-native-elements"
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
BreakpointHelper,
|
|
15
|
+
} from "../../helpers"
|
|
16
|
+
|
|
17
|
+
export const BreakpointContext = createContext<BreakpointToken>(
|
|
18
|
+
BreakpointHelper.getToken(Dimensions.get("window").width),
|
|
19
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BreakpointContext"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
} from "react"
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
DialogData,
|
|
7
|
+
} from "./DialogData"
|
|
8
|
+
|
|
9
|
+
export interface DialogContext {
|
|
10
|
+
show: (data: DialogData) => void,
|
|
11
|
+
dismiss: () => Promise<void>,
|
|
12
|
+
dismissAll: () => Promise<void>,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const error = new Error("Unitialized `<DialogProvider>`. Make sure you wrap your React app with `<DialogProvider>`")
|
|
16
|
+
|
|
17
|
+
export const DialogContext = createContext<DialogContext>({
|
|
18
|
+
show() {
|
|
19
|
+
throw error
|
|
20
|
+
},
|
|
21
|
+
dismiss() {
|
|
22
|
+
throw error
|
|
23
|
+
},
|
|
24
|
+
dismissAll() {
|
|
25
|
+
throw error
|
|
26
|
+
},
|
|
27
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// import type {
|
|
2
|
+
// DialogType,
|
|
3
|
+
// } from './DialogType'
|
|
4
|
+
|
|
5
|
+
export interface DialogData {
|
|
6
|
+
component: React.ReactNode,
|
|
7
|
+
/**
|
|
8
|
+
* You can open another next dialog while keeping the previous dialog mounted. When you close the next dialog, the previous dialog will be appeared again
|
|
9
|
+
*/
|
|
10
|
+
stack?: boolean,
|
|
11
|
+
/**
|
|
12
|
+
* A `modal` dialog triggers a state (or mode) that focuses the user’s attention exclusively on one task or piece of relevant information. When a modal dialog is active, the content of the underneath page is obscured and inaccessible until the user completes the task or dismisses the modal.
|
|
13
|
+
*
|
|
14
|
+
* When a `non_modal` dialog is active the user can continue viewing and interacting with the main page while the dialog is open. Non-modal dialogs are commonly used to present non-critical information or optional user tasks.
|
|
15
|
+
*
|
|
16
|
+
* Remember! If you use `stack` dialog, the first and subsequent dialogs will use the first `type` value. You can't change the type for the next dialog.
|
|
17
|
+
*
|
|
18
|
+
* @default 'modal'
|
|
19
|
+
* @see https://carbondesignsystem.com/patterns/dialog-pattern/#dialog-types
|
|
20
|
+
*/
|
|
21
|
+
// type?: DialogType,
|
|
22
|
+
/**
|
|
23
|
+
* User can touch/click any area in the overlay to dismiss the dialog
|
|
24
|
+
* @default 'false'
|
|
25
|
+
*/
|
|
26
|
+
overlayTouchDismiss?: boolean,
|
|
27
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Probably better to move to the `GlobalContext`
|
|
2
|
+
// Historically, it also holds all the Carbon color tokens based on what the `colorScheme` is.
|
|
3
|
+
// Holding an object with 150+ properties in the app runtime seems ridiculous
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
createContext,
|
|
7
|
+
} from "react"
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
ColorSchemeGlobal,
|
|
11
|
+
} from "../../_internal/globals"
|
|
12
|
+
|
|
13
|
+
import type {
|
|
14
|
+
ThemeType,
|
|
15
|
+
} from "../../types"
|
|
16
|
+
|
|
17
|
+
export interface ThemeContext {
|
|
18
|
+
colorScheme: ThemeType.ColorScheme,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const ThemeContext =
|
|
22
|
+
createContext<ThemeContext>({
|
|
23
|
+
colorScheme: ColorSchemeGlobal.get(),
|
|
24
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ThemeContext"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
} from "react"
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
ToastContextShowConfig,
|
|
7
|
+
} from "./ToastContextShowConfig"
|
|
8
|
+
|
|
9
|
+
export interface ToastContext {
|
|
10
|
+
show: (
|
|
11
|
+
fn: (id: number) => React.ReactNode,
|
|
12
|
+
config?: ToastContextShowConfig,
|
|
13
|
+
) => void,
|
|
14
|
+
dismiss: (id: number) => void,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const ToastContext = createContext<ToastContext>({
|
|
18
|
+
show() {
|
|
19
|
+
throw new Error("Uninitialized ToastProvider")
|
|
20
|
+
},
|
|
21
|
+
dismiss() {
|
|
22
|
+
throw new Error("Uninitialized ToastProvider")
|
|
23
|
+
},
|
|
24
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Breakpoint,
|
|
3
|
+
type BreakpointToken,
|
|
4
|
+
} from "@audira/carbon-react-native-elements"
|
|
5
|
+
|
|
6
|
+
export function getToken(
|
|
7
|
+
windowWidth: number,
|
|
8
|
+
): BreakpointToken {
|
|
9
|
+
return windowWidth < Breakpoint.medium.value.px ? (
|
|
10
|
+
"small"
|
|
11
|
+
) : windowWidth < Breakpoint.large.value.px ? (
|
|
12
|
+
"medium"
|
|
13
|
+
) : windowWidth < Breakpoint.x_large.value.px ? (
|
|
14
|
+
"large"
|
|
15
|
+
) : windowWidth < Breakpoint.max.value.px ? (
|
|
16
|
+
"x_large"
|
|
17
|
+
) : (
|
|
18
|
+
"max"
|
|
19
|
+
)
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./get-token"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Appearance,
|
|
3
|
+
type ColorSchemeName,
|
|
4
|
+
} from "react-native"
|
|
5
|
+
|
|
6
|
+
import type * as ThemeType from "../../types/theme"
|
|
7
|
+
|
|
8
|
+
export function getColorScheme(
|
|
9
|
+
appearanceColorScheme?: ColorSchemeName,
|
|
10
|
+
): ThemeType.ColorScheme {
|
|
11
|
+
return mapScheme[ appearanceColorScheme || Appearance.getColorScheme() || "light" ]
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const
|
|
15
|
+
mapScheme: Record<Extract<ColorSchemeName, string>, ThemeType.ColorScheme> =
|
|
16
|
+
{
|
|
17
|
+
light: "gray_10",
|
|
18
|
+
dark: "gray_100",
|
|
19
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Color,
|
|
3
|
+
ColorToken,
|
|
4
|
+
} from "@audira/carbon-react-native-elements"
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
ThemeType,
|
|
8
|
+
} from "../../types"
|
|
9
|
+
|
|
10
|
+
export function getColorToken(
|
|
11
|
+
colorScheme: ThemeType.ColorScheme,
|
|
12
|
+
) {
|
|
13
|
+
return mapSchemeToColorToken[ colorScheme ]()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const mapSchemeToColorToken: Record<ThemeType.ColorScheme, () => Record<ColorToken, string>> = {
|
|
17
|
+
gray_10: () => (require("@audira/carbon-react-native-elements") as unknown as {
|
|
18
|
+
Color: typeof Color
|
|
19
|
+
}).Color.Token.gray_10.all,
|
|
20
|
+
gray_100: () => (require("@audira/carbon-react-native-elements") as unknown as {
|
|
21
|
+
Color: typeof Color
|
|
22
|
+
}).Color.Token.gray_100.all,
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function hexToRgba(
|
|
2
|
+
hexCode: string,
|
|
3
|
+
opacity: string,
|
|
4
|
+
): string {
|
|
5
|
+
const values = [
|
|
6
|
+
hexCode.substring(1, 3),
|
|
7
|
+
hexCode.substring(3, 5),
|
|
8
|
+
hexCode.substring(5, 7),
|
|
9
|
+
].map((string) => parseInt(string, 16))
|
|
10
|
+
return `rgba(${values[0]},${values[1]},${values[2]},${opacity})`
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./use"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useContext,
|
|
3
|
+
} from "react"
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Breakpoint,
|
|
7
|
+
type BreakpointData,
|
|
8
|
+
type BreakpointToken,
|
|
9
|
+
} from "@audira/carbon-react-native-elements"
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
BreakpointContext,
|
|
13
|
+
} from "../../contexts"
|
|
14
|
+
|
|
15
|
+
export interface Use extends BreakpointData {
|
|
16
|
+
breakpoint: BreakpointToken,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function use(): Use {
|
|
20
|
+
|
|
21
|
+
const
|
|
22
|
+
breakpoint =
|
|
23
|
+
useContext(BreakpointContext)
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
breakpoint,
|
|
27
|
+
...Breakpoint[breakpoint],
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./carbon-react-native"
|
|
2
|
+
export * from "./carbon-style-sheet"
|
|
3
|
+
export * from "./components"
|
|
4
|
+
export * from "./const"
|
|
5
|
+
export * from "./contexts"
|
|
6
|
+
export * from "./helpers"
|
|
7
|
+
export * from "./hooks"
|
|
8
|
+
export * from "./providers"
|
|
9
|
+
export * from "./types"
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import {
|
|
2
|
+
forwardRef,
|
|
3
|
+
useCallback,
|
|
4
|
+
useImperativeHandle,
|
|
5
|
+
useRef,
|
|
6
|
+
useState,
|
|
7
|
+
} from "react"
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
DialogContext,
|
|
11
|
+
type DialogData,
|
|
12
|
+
} from "../../contexts/dialog"
|
|
13
|
+
|
|
14
|
+
import type {
|
|
15
|
+
DialogProviderProps,
|
|
16
|
+
} from "./DialogProviderProps"
|
|
17
|
+
|
|
18
|
+
import type {
|
|
19
|
+
DialogProviderRef,
|
|
20
|
+
} from "./DialogProviderRef"
|
|
21
|
+
|
|
22
|
+
import {
|
|
23
|
+
Controller,
|
|
24
|
+
type ControllerRef,
|
|
25
|
+
} from "./_controller"
|
|
26
|
+
|
|
27
|
+
export const DialogProvider = forwardRef<DialogProviderRef, DialogProviderProps>(
|
|
28
|
+
function DialogProvider(
|
|
29
|
+
{
|
|
30
|
+
children,
|
|
31
|
+
animationConfig,
|
|
32
|
+
modalProps,
|
|
33
|
+
overlayProps,
|
|
34
|
+
overlayTouchDismiss,
|
|
35
|
+
},
|
|
36
|
+
ref,
|
|
37
|
+
) {
|
|
38
|
+
|
|
39
|
+
const
|
|
40
|
+
controllerRef =
|
|
41
|
+
useRef<ControllerRef>(null),
|
|
42
|
+
|
|
43
|
+
dialogDataQueue =
|
|
44
|
+
useRef<DialogData>(null),
|
|
45
|
+
|
|
46
|
+
[mountController, setMountController] =
|
|
47
|
+
useState(false),
|
|
48
|
+
|
|
49
|
+
setControllerRef: React.RefCallback<ControllerRef> =
|
|
50
|
+
useCallback(ref => {
|
|
51
|
+
controllerRef.current = ref
|
|
52
|
+
|
|
53
|
+
if(controllerRef.current && dialogDataQueue.current) {
|
|
54
|
+
controllerRef.current.show({ ...dialogDataQueue.current })
|
|
55
|
+
dialogDataQueue.current = null
|
|
56
|
+
}
|
|
57
|
+
}, []),
|
|
58
|
+
|
|
59
|
+
show: DialogContext["show"] =
|
|
60
|
+
useCallback(data => {
|
|
61
|
+
if(!controllerRef.current) {
|
|
62
|
+
dialogDataQueue.current = { ...data }
|
|
63
|
+
setMountController(true)
|
|
64
|
+
} else {
|
|
65
|
+
controllerRef.current?.show(data)
|
|
66
|
+
}
|
|
67
|
+
}, []),
|
|
68
|
+
|
|
69
|
+
dismiss: DialogContext["dismiss"] =
|
|
70
|
+
useCallback(async () => {
|
|
71
|
+
return controllerRef.current?.dismiss()
|
|
72
|
+
}, []),
|
|
73
|
+
|
|
74
|
+
dismissAll: DialogContext["dismissAll"] =
|
|
75
|
+
useCallback(async () => {
|
|
76
|
+
return controllerRef.current?.dismissAll()
|
|
77
|
+
}, []),
|
|
78
|
+
|
|
79
|
+
onEmpty =
|
|
80
|
+
useCallback(() => {
|
|
81
|
+
if(!dialogDataQueue.current) {
|
|
82
|
+
setMountController(false)
|
|
83
|
+
}
|
|
84
|
+
}, [])
|
|
85
|
+
|
|
86
|
+
useImperativeHandle(ref, () => {
|
|
87
|
+
return {
|
|
88
|
+
show,
|
|
89
|
+
dismiss,
|
|
90
|
+
dismissAll,
|
|
91
|
+
}
|
|
92
|
+
}, [
|
|
93
|
+
show,
|
|
94
|
+
dismiss,
|
|
95
|
+
dismissAll,
|
|
96
|
+
])
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<DialogContext.Provider
|
|
100
|
+
value={{
|
|
101
|
+
show,
|
|
102
|
+
dismiss,
|
|
103
|
+
dismissAll,
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
{ children }
|
|
107
|
+
|
|
108
|
+
{ mountController && (
|
|
109
|
+
<Controller
|
|
110
|
+
ref={ setControllerRef }
|
|
111
|
+
animationConfig={ animationConfig }
|
|
112
|
+
modalProps={ modalProps }
|
|
113
|
+
overlayProps={ overlayProps }
|
|
114
|
+
overlayTouchDismiss={ overlayTouchDismiss }
|
|
115
|
+
onEmpty={ onEmpty }
|
|
116
|
+
/>
|
|
117
|
+
) }
|
|
118
|
+
</DialogContext.Provider>
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
},
|
|
122
|
+
)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Animated,
|
|
3
|
+
EasingFunction,
|
|
4
|
+
ViewStyle,
|
|
5
|
+
} from "react-native"
|
|
6
|
+
|
|
7
|
+
export interface DialogProviderAnimationConfig {
|
|
8
|
+
/**
|
|
9
|
+
* You can pass a single duration or consists of three durations of array
|
|
10
|
+
*
|
|
11
|
+
* Indexes:
|
|
12
|
+
* - `0` -> Unmounted easing
|
|
13
|
+
* - `1` -> Mounted easing
|
|
14
|
+
* - `2` -> Unmounted easing for being stacked behind of the next dialog
|
|
15
|
+
*
|
|
16
|
+
* Value in milliseconds
|
|
17
|
+
* @default DialogAnimationConfigs.CarbonReact.duration
|
|
18
|
+
*/
|
|
19
|
+
readonly duration?: number | [number, number, number],
|
|
20
|
+
/**
|
|
21
|
+
* Input range interpolation:
|
|
22
|
+
* - `0` -> Unmounted style
|
|
23
|
+
* - `1` -> Mounted style
|
|
24
|
+
* - `2` -> Hidden behind of the next dialog
|
|
25
|
+
*
|
|
26
|
+
* @default DialogAnimationConfigs.CarbonReact.modalStyleFactory
|
|
27
|
+
*/
|
|
28
|
+
readonly modalStyleFactory: (
|
|
29
|
+
animatedValue: Animated.Value,
|
|
30
|
+
/**
|
|
31
|
+
* @example [0, 1, 2]
|
|
32
|
+
*/
|
|
33
|
+
interpolationInputRange: number[],
|
|
34
|
+
) => ViewStyle,
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* You can pass a single easing or consists of three easings of array
|
|
38
|
+
*
|
|
39
|
+
* Indexes:
|
|
40
|
+
* - `0` -> Unmounted easing
|
|
41
|
+
* - `1` -> Mounted easing
|
|
42
|
+
* - `2` -> Unmounted easing for being stacked behind of the next dialog
|
|
43
|
+
*
|
|
44
|
+
* @default DialogAnimationConfigs.CarbonReact.modalEasing
|
|
45
|
+
*/
|
|
46
|
+
readonly modalEasing?:
|
|
47
|
+
| EasingFunction
|
|
48
|
+
| [EasingFunction, EasingFunction, EasingFunction],
|
|
49
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
DialogProviderAnimationConfig,
|
|
3
|
+
} from "./DialogProviderAnimationConfig"
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
ModalProps,
|
|
7
|
+
} from "./_controller/_modal/ModalProps"
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
OverlayProps,
|
|
11
|
+
} from "./_controller/_overlay/OverlayProps"
|
|
12
|
+
|
|
13
|
+
export interface DialogProviderProps {
|
|
14
|
+
overlayProps?: Omit<OverlayProps, "animationConfig">,
|
|
15
|
+
/**
|
|
16
|
+
* @default DialogAnimationConfigs.CarbonReact
|
|
17
|
+
*/
|
|
18
|
+
animationConfig?: DialogProviderAnimationConfig,
|
|
19
|
+
modalProps?: Omit<ModalProps, "animationConfig">,
|
|
20
|
+
children?: React.ReactNode,
|
|
21
|
+
/**
|
|
22
|
+
* User can touch/click any area in the overlay to dismiss the dialog
|
|
23
|
+
*
|
|
24
|
+
* `overlayTouchDismiss` boolean value in the `.show` method parameter will takes precedence
|
|
25
|
+
* @default 'false'
|
|
26
|
+
*/
|
|
27
|
+
overlayTouchDismiss?: boolean,
|
|
28
|
+
}
|