@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,397 @@
|
|
|
1
|
+
import {
|
|
2
|
+
forwardRef,
|
|
3
|
+
useContext,
|
|
4
|
+
useMemo,
|
|
5
|
+
} from "react"
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
StyleSheet,
|
|
9
|
+
View,
|
|
10
|
+
type ViewStyle,
|
|
11
|
+
} from "react-native"
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
Spacing,
|
|
15
|
+
type BreakpointToken,
|
|
16
|
+
type ColorLayerLevel,
|
|
17
|
+
} from "@audira/carbon-react-native-elements"
|
|
18
|
+
|
|
19
|
+
import IconClose from "@carbon/icons/svg/32/close.svg"
|
|
20
|
+
|
|
21
|
+
import {
|
|
22
|
+
GlobalConfigContext,
|
|
23
|
+
ModalContext,
|
|
24
|
+
} from "../../_internal/contexts"
|
|
25
|
+
|
|
26
|
+
import {
|
|
27
|
+
CommonStyleSheet,
|
|
28
|
+
} from "../../_internal/style-sheets"
|
|
29
|
+
|
|
30
|
+
import {
|
|
31
|
+
CarbonStyleSheet,
|
|
32
|
+
} from "../../carbon-style-sheet"
|
|
33
|
+
|
|
34
|
+
import {
|
|
35
|
+
BreakpointContext,
|
|
36
|
+
} from "../../contexts"
|
|
37
|
+
|
|
38
|
+
import {
|
|
39
|
+
GhostIcon as ButtonGhostIcon,
|
|
40
|
+
} from "../button/ghost-icon"
|
|
41
|
+
|
|
42
|
+
import {
|
|
43
|
+
LayerContext,
|
|
44
|
+
} from "../layer/LayerContext"
|
|
45
|
+
|
|
46
|
+
import {
|
|
47
|
+
Text,
|
|
48
|
+
} from "../text"
|
|
49
|
+
|
|
50
|
+
import type {
|
|
51
|
+
ModalProps,
|
|
52
|
+
} from "./ModalProps"
|
|
53
|
+
|
|
54
|
+
import type {
|
|
55
|
+
ModalRef,
|
|
56
|
+
} from "./ModalRef"
|
|
57
|
+
|
|
58
|
+
import type {
|
|
59
|
+
ModalSize,
|
|
60
|
+
} from "./ModalSize"
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* This is a pure component of Carbon Modal. It's not including with the dialog or any alert utility.
|
|
64
|
+
* You can use `DialogContext`, call the `show` method, and then give this component to the method argument.
|
|
65
|
+
*
|
|
66
|
+
* You can also use this component with other libraries like `@gorhom/bottom-sheet`, `@lodev09/react-native-true-sheet`, and other libraries, even with the core `Modal` component of React Native
|
|
67
|
+
*/
|
|
68
|
+
export const Modal = forwardRef<ModalRef, ModalProps>(
|
|
69
|
+
function Modal(
|
|
70
|
+
{
|
|
71
|
+
size = "medium",
|
|
72
|
+
label: labelProp,
|
|
73
|
+
title,
|
|
74
|
+
children,
|
|
75
|
+
buttonCloseProps,
|
|
76
|
+
"aria-label": ariaLabel,
|
|
77
|
+
"aria-labelledby": ariaLabelledBy,
|
|
78
|
+
style,
|
|
79
|
+
dir,
|
|
80
|
+
...props
|
|
81
|
+
},
|
|
82
|
+
ref,
|
|
83
|
+
) {
|
|
84
|
+
|
|
85
|
+
const
|
|
86
|
+
breakpoint =
|
|
87
|
+
useContext(BreakpointContext),
|
|
88
|
+
|
|
89
|
+
globalConfigContext =
|
|
90
|
+
useContext(GlobalConfigContext),
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Based on carbon modal spec, the background color is based on the current layer level.
|
|
94
|
+
* Should i follow this spec?
|
|
95
|
+
*/
|
|
96
|
+
layerContextLevel =
|
|
97
|
+
useContext(LayerContext),
|
|
98
|
+
|
|
99
|
+
label =
|
|
100
|
+
labelProp ?? ariaLabel ?? ariaLabelledBy,
|
|
101
|
+
|
|
102
|
+
styleSheetBySizeAndBreakpoint =
|
|
103
|
+
useMemo(() => {
|
|
104
|
+
return mapStyleSheetBySizeAndBreakpoint[size][breakpoint]
|
|
105
|
+
}, [
|
|
106
|
+
size,
|
|
107
|
+
breakpoint,
|
|
108
|
+
])
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<ModalContext.Provider
|
|
112
|
+
value={{
|
|
113
|
+
size,
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
<View
|
|
117
|
+
ref={ ref }
|
|
118
|
+
{ ...props }
|
|
119
|
+
aria-label={ ariaLabel ?? label }
|
|
120
|
+
aria-labelledBy={ ariaLabelledBy ?? label }
|
|
121
|
+
dir={ dir ?? globalConfigContext.rtl ? "rtl" : undefined }
|
|
122
|
+
style={ [
|
|
123
|
+
bgLayerStyleSheet[`bg_${layerContextLevel}`],
|
|
124
|
+
styleSheetBySizeAndBreakpoint.modal,
|
|
125
|
+
globalConfigContext.rtl ? CommonStyleSheet.rtl : undefined,
|
|
126
|
+
style,
|
|
127
|
+
] }
|
|
128
|
+
>
|
|
129
|
+
<LayerContext.Provider
|
|
130
|
+
// children of modal are in layer 2
|
|
131
|
+
value={ 2 }
|
|
132
|
+
>
|
|
133
|
+
<View
|
|
134
|
+
style={ [
|
|
135
|
+
styleSheet.headerText,
|
|
136
|
+
styleSheetBySizeAndBreakpoint.headerTextContainer,
|
|
137
|
+
] }
|
|
138
|
+
>
|
|
139
|
+
{ !!label && (
|
|
140
|
+
<Text
|
|
141
|
+
type="label_01"
|
|
142
|
+
>
|
|
143
|
+
{ label }
|
|
144
|
+
</Text>
|
|
145
|
+
) }
|
|
146
|
+
<Text
|
|
147
|
+
type="heading_03"
|
|
148
|
+
>
|
|
149
|
+
{ title }
|
|
150
|
+
</Text>
|
|
151
|
+
</View>
|
|
152
|
+
|
|
153
|
+
<ButtonGhostIcon
|
|
154
|
+
{ ...buttonCloseProps }
|
|
155
|
+
Icon={ IconClose }
|
|
156
|
+
style={ [
|
|
157
|
+
CommonStyleSheet.absolute,
|
|
158
|
+
styleSheet.iconClose,
|
|
159
|
+
globalConfigContext.rtl ? styleSheet.iconCloseRtl : styleSheet.iconCloseLtr,
|
|
160
|
+
buttonCloseProps?.style,
|
|
161
|
+
] }
|
|
162
|
+
/>
|
|
163
|
+
|
|
164
|
+
{ children }
|
|
165
|
+
</LayerContext.Provider>
|
|
166
|
+
</View>
|
|
167
|
+
</ModalContext.Provider>
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
},
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
const
|
|
174
|
+
styleSheet =
|
|
175
|
+
StyleSheet.create({
|
|
176
|
+
headerText: {
|
|
177
|
+
paddingTop: Spacing.spacing_05,
|
|
178
|
+
marginBottom: Spacing.spacing_05,
|
|
179
|
+
rowGap: Spacing.spacing_02,
|
|
180
|
+
},
|
|
181
|
+
iconClose: {
|
|
182
|
+
top: 0,
|
|
183
|
+
backgroundColor: "transparent",
|
|
184
|
+
},
|
|
185
|
+
iconCloseLtr: {
|
|
186
|
+
right: 0,
|
|
187
|
+
},
|
|
188
|
+
iconCloseRtl: {
|
|
189
|
+
left: 0,
|
|
190
|
+
},
|
|
191
|
+
}),
|
|
192
|
+
|
|
193
|
+
mapStyleSheetBySizeAndBreakpoint: {
|
|
194
|
+
[Size in ModalSize]: {
|
|
195
|
+
[Token in BreakpointToken]: {
|
|
196
|
+
modal: ViewStyle,
|
|
197
|
+
headerTextContainer: ViewStyle,
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
} =
|
|
201
|
+
{
|
|
202
|
+
extra_small: {
|
|
203
|
+
small: StyleSheet.create({
|
|
204
|
+
modal: {
|
|
205
|
+
width: "100%",
|
|
206
|
+
height: "100%",
|
|
207
|
+
},
|
|
208
|
+
headerTextContainer: {
|
|
209
|
+
paddingHorizontal: Spacing.spacing_05,
|
|
210
|
+
},
|
|
211
|
+
}),
|
|
212
|
+
medium: StyleSheet.create({
|
|
213
|
+
modal: {
|
|
214
|
+
width: "48%",
|
|
215
|
+
},
|
|
216
|
+
headerTextContainer: {
|
|
217
|
+
paddingHorizontal: Spacing.spacing_05,
|
|
218
|
+
},
|
|
219
|
+
}),
|
|
220
|
+
large: StyleSheet.create({
|
|
221
|
+
modal: {
|
|
222
|
+
width: "32%",
|
|
223
|
+
},
|
|
224
|
+
headerTextContainer: {
|
|
225
|
+
paddingHorizontal: Spacing.spacing_05,
|
|
226
|
+
},
|
|
227
|
+
}),
|
|
228
|
+
x_large: StyleSheet.create({
|
|
229
|
+
modal: {
|
|
230
|
+
width: "24%",
|
|
231
|
+
},
|
|
232
|
+
headerTextContainer: {
|
|
233
|
+
paddingHorizontal: Spacing.spacing_05,
|
|
234
|
+
},
|
|
235
|
+
}),
|
|
236
|
+
max: StyleSheet.create({
|
|
237
|
+
modal: {
|
|
238
|
+
width: "24%",
|
|
239
|
+
},
|
|
240
|
+
headerTextContainer: {
|
|
241
|
+
paddingHorizontal: Spacing.spacing_05,
|
|
242
|
+
},
|
|
243
|
+
}),
|
|
244
|
+
},
|
|
245
|
+
small: {
|
|
246
|
+
small: StyleSheet.create({
|
|
247
|
+
modal: {
|
|
248
|
+
width: "100%",
|
|
249
|
+
height: "100%",
|
|
250
|
+
},
|
|
251
|
+
headerTextContainer: {
|
|
252
|
+
paddingHorizontal: Spacing.spacing_05,
|
|
253
|
+
},
|
|
254
|
+
}),
|
|
255
|
+
medium: StyleSheet.create({
|
|
256
|
+
modal: {
|
|
257
|
+
width: "60%",
|
|
258
|
+
},
|
|
259
|
+
headerTextContainer: {
|
|
260
|
+
paddingHorizontal: Spacing.spacing_05,
|
|
261
|
+
},
|
|
262
|
+
}),
|
|
263
|
+
large: StyleSheet.create({
|
|
264
|
+
modal: {
|
|
265
|
+
width: "42%",
|
|
266
|
+
},
|
|
267
|
+
headerTextContainer: {
|
|
268
|
+
paddingHorizontal: Spacing.spacing_05,
|
|
269
|
+
},
|
|
270
|
+
}),
|
|
271
|
+
x_large: StyleSheet.create({
|
|
272
|
+
modal: {
|
|
273
|
+
width: "36%",
|
|
274
|
+
},
|
|
275
|
+
headerTextContainer: {
|
|
276
|
+
paddingStart: Spacing.spacing_05,
|
|
277
|
+
paddingEnd: "20%",
|
|
278
|
+
},
|
|
279
|
+
}),
|
|
280
|
+
max: StyleSheet.create({
|
|
281
|
+
modal: {
|
|
282
|
+
width: "36%",
|
|
283
|
+
},
|
|
284
|
+
headerTextContainer: {
|
|
285
|
+
paddingStart: Spacing.spacing_05,
|
|
286
|
+
paddingEnd: "20%",
|
|
287
|
+
},
|
|
288
|
+
}),
|
|
289
|
+
},
|
|
290
|
+
medium: {
|
|
291
|
+
small: StyleSheet.create({
|
|
292
|
+
modal: {
|
|
293
|
+
width: "100%",
|
|
294
|
+
height: "100%",
|
|
295
|
+
},
|
|
296
|
+
headerTextContainer: {
|
|
297
|
+
paddingHorizontal: Spacing.spacing_05,
|
|
298
|
+
},
|
|
299
|
+
}),
|
|
300
|
+
medium: StyleSheet.create({
|
|
301
|
+
modal: {
|
|
302
|
+
width: "84%",
|
|
303
|
+
},
|
|
304
|
+
headerTextContainer: {
|
|
305
|
+
paddingStart: Spacing.spacing_05,
|
|
306
|
+
paddingEnd: "20%",
|
|
307
|
+
},
|
|
308
|
+
}),
|
|
309
|
+
large: StyleSheet.create({
|
|
310
|
+
modal: {
|
|
311
|
+
width: "60%",
|
|
312
|
+
},
|
|
313
|
+
headerTextContainer: {
|
|
314
|
+
paddingStart: Spacing.spacing_05,
|
|
315
|
+
paddingEnd: "20%",
|
|
316
|
+
},
|
|
317
|
+
}),
|
|
318
|
+
x_large: StyleSheet.create({
|
|
319
|
+
modal: {
|
|
320
|
+
width: "48%",
|
|
321
|
+
},
|
|
322
|
+
headerTextContainer: {
|
|
323
|
+
paddingStart: Spacing.spacing_05,
|
|
324
|
+
paddingEnd: "20%",
|
|
325
|
+
},
|
|
326
|
+
}),
|
|
327
|
+
max: StyleSheet.create({
|
|
328
|
+
modal: {
|
|
329
|
+
width: "48%",
|
|
330
|
+
},
|
|
331
|
+
headerTextContainer: {
|
|
332
|
+
paddingStart: Spacing.spacing_05,
|
|
333
|
+
paddingEnd: "20%",
|
|
334
|
+
},
|
|
335
|
+
}),
|
|
336
|
+
},
|
|
337
|
+
large: {
|
|
338
|
+
small: StyleSheet.create({
|
|
339
|
+
modal: {
|
|
340
|
+
width: "100%",
|
|
341
|
+
height: "100%",
|
|
342
|
+
},
|
|
343
|
+
headerTextContainer: {
|
|
344
|
+
paddingHorizontal: Spacing.spacing_05,
|
|
345
|
+
},
|
|
346
|
+
}),
|
|
347
|
+
medium: StyleSheet.create({
|
|
348
|
+
modal: {
|
|
349
|
+
width: "96%",
|
|
350
|
+
},
|
|
351
|
+
headerTextContainer: {
|
|
352
|
+
paddingStart: Spacing.spacing_05,
|
|
353
|
+
paddingEnd: "20%",
|
|
354
|
+
},
|
|
355
|
+
}),
|
|
356
|
+
large: StyleSheet.create({
|
|
357
|
+
modal: {
|
|
358
|
+
width: "84%",
|
|
359
|
+
},
|
|
360
|
+
headerTextContainer: {
|
|
361
|
+
paddingStart: Spacing.spacing_05,
|
|
362
|
+
paddingEnd: "20%",
|
|
363
|
+
},
|
|
364
|
+
}),
|
|
365
|
+
x_large: StyleSheet.create({
|
|
366
|
+
modal: {
|
|
367
|
+
width: "72%",
|
|
368
|
+
},
|
|
369
|
+
headerTextContainer: {
|
|
370
|
+
paddingStart: Spacing.spacing_05,
|
|
371
|
+
paddingEnd: "20%",
|
|
372
|
+
},
|
|
373
|
+
}),
|
|
374
|
+
max: StyleSheet.create({
|
|
375
|
+
modal: {
|
|
376
|
+
width: "72%",
|
|
377
|
+
},
|
|
378
|
+
headerTextContainer: {
|
|
379
|
+
paddingStart: Spacing.spacing_05,
|
|
380
|
+
paddingEnd: "20%",
|
|
381
|
+
},
|
|
382
|
+
}),
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
|
|
386
|
+
bgLayerStyleSheet =
|
|
387
|
+
CarbonStyleSheet.create<Record<`bg_${ColorLayerLevel}`, ViewStyle>>({
|
|
388
|
+
bg_1: {
|
|
389
|
+
backgroundColor: CarbonStyleSheet.color.layer_01,
|
|
390
|
+
},
|
|
391
|
+
bg_2: {
|
|
392
|
+
backgroundColor: CarbonStyleSheet.color.layer_02,
|
|
393
|
+
},
|
|
394
|
+
bg_3: {
|
|
395
|
+
backgroundColor: CarbonStyleSheet.color.layer_03,
|
|
396
|
+
},
|
|
397
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ViewProps,
|
|
3
|
+
} from "react-native"
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
GhostIconProps,
|
|
7
|
+
} from "../button/ghost-icon/GhostIconProps"
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
ModalSize,
|
|
11
|
+
} from "./ModalSize"
|
|
12
|
+
|
|
13
|
+
export interface ModalProps extends ViewProps {
|
|
14
|
+
label?: string,
|
|
15
|
+
title: string,
|
|
16
|
+
/**
|
|
17
|
+
* @default 'medium'
|
|
18
|
+
*/
|
|
19
|
+
size?: ModalSize,
|
|
20
|
+
buttonCloseProps?: Omit<
|
|
21
|
+
GhostIconProps,
|
|
22
|
+
| "icon"
|
|
23
|
+
>,
|
|
24
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import {
|
|
2
|
+
forwardRef,
|
|
3
|
+
useContext,
|
|
4
|
+
} from "react"
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
StyleSheet,
|
|
8
|
+
View,
|
|
9
|
+
type ViewStyle,
|
|
10
|
+
} from "react-native"
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
Spacing,
|
|
14
|
+
type BreakpointToken,
|
|
15
|
+
} from "@audira/carbon-react-native-elements"
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
GlobalConfigContext,
|
|
19
|
+
ModalContext,
|
|
20
|
+
} from "../../_internal/contexts"
|
|
21
|
+
|
|
22
|
+
import {
|
|
23
|
+
CommonStyleSheet,
|
|
24
|
+
} from "../../_internal/style-sheets"
|
|
25
|
+
|
|
26
|
+
import {
|
|
27
|
+
BreakpointContext,
|
|
28
|
+
} from "../../contexts"
|
|
29
|
+
|
|
30
|
+
import type {
|
|
31
|
+
ModalContentProps,
|
|
32
|
+
} from "./ModalContentProps"
|
|
33
|
+
|
|
34
|
+
import type {
|
|
35
|
+
ModalContentRef,
|
|
36
|
+
} from "./ModalContentRef"
|
|
37
|
+
|
|
38
|
+
export const ModalContent = forwardRef<ModalContentRef, ModalContentProps>(
|
|
39
|
+
function ModalContent(
|
|
40
|
+
{
|
|
41
|
+
fullWidth,
|
|
42
|
+
style,
|
|
43
|
+
dir,
|
|
44
|
+
...props
|
|
45
|
+
},
|
|
46
|
+
ref,
|
|
47
|
+
) {
|
|
48
|
+
|
|
49
|
+
const
|
|
50
|
+
breakpoint =
|
|
51
|
+
useContext(BreakpointContext),
|
|
52
|
+
|
|
53
|
+
modalContext =
|
|
54
|
+
useContext(ModalContext),
|
|
55
|
+
|
|
56
|
+
globalConfigContext =
|
|
57
|
+
useContext(GlobalConfigContext)
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<View
|
|
61
|
+
ref={ ref }
|
|
62
|
+
{ ...props }
|
|
63
|
+
dir={ dir ?? globalConfigContext.rtl ? "rtl" : undefined }
|
|
64
|
+
style={ [
|
|
65
|
+
styleSheet.modalContent,
|
|
66
|
+
mapStyleSheetBySizeAndBreakpoint[modalContext.size][breakpoint],
|
|
67
|
+
fullWidth ? styleSheet.fullWidth : undefined,
|
|
68
|
+
globalConfigContext.rtl ? CommonStyleSheet.rtl : undefined,
|
|
69
|
+
style,
|
|
70
|
+
] }
|
|
71
|
+
/>
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
},
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
const
|
|
78
|
+
styleSheet =
|
|
79
|
+
StyleSheet.create({
|
|
80
|
+
modalContent: {
|
|
81
|
+
marginBottom: Spacing.spacing_09,
|
|
82
|
+
},
|
|
83
|
+
fullWidth: {
|
|
84
|
+
paddingEnd: Spacing.spacing_05,
|
|
85
|
+
},
|
|
86
|
+
}),
|
|
87
|
+
|
|
88
|
+
mapStyleSheetBySizeAndBreakpoint: {
|
|
89
|
+
[Size in ModalContext["size"]]: {
|
|
90
|
+
[Breakpoint in BreakpointToken]: ViewStyle
|
|
91
|
+
}
|
|
92
|
+
} =
|
|
93
|
+
{
|
|
94
|
+
extra_small: StyleSheet.create({
|
|
95
|
+
small: {
|
|
96
|
+
paddingStart: Spacing.spacing_05,
|
|
97
|
+
paddingEnd: Spacing.spacing_05,
|
|
98
|
+
},
|
|
99
|
+
medium: {
|
|
100
|
+
paddingStart: Spacing.spacing_05,
|
|
101
|
+
paddingEnd: Spacing.spacing_05,
|
|
102
|
+
},
|
|
103
|
+
large: {
|
|
104
|
+
paddingStart: Spacing.spacing_05,
|
|
105
|
+
paddingEnd: Spacing.spacing_05,
|
|
106
|
+
},
|
|
107
|
+
x_large: {
|
|
108
|
+
paddingStart: Spacing.spacing_05,
|
|
109
|
+
paddingEnd: Spacing.spacing_05,
|
|
110
|
+
},
|
|
111
|
+
max: {
|
|
112
|
+
paddingStart: Spacing.spacing_05,
|
|
113
|
+
paddingEnd: Spacing.spacing_05,
|
|
114
|
+
},
|
|
115
|
+
}),
|
|
116
|
+
small: {
|
|
117
|
+
small: {
|
|
118
|
+
paddingStart: Spacing.spacing_05,
|
|
119
|
+
paddingEnd: Spacing.spacing_05,
|
|
120
|
+
},
|
|
121
|
+
medium: {
|
|
122
|
+
paddingStart: Spacing.spacing_05,
|
|
123
|
+
paddingEnd: Spacing.spacing_05,
|
|
124
|
+
},
|
|
125
|
+
large: {
|
|
126
|
+
paddingStart: Spacing.spacing_05,
|
|
127
|
+
paddingEnd: Spacing.spacing_05,
|
|
128
|
+
},
|
|
129
|
+
x_large: {
|
|
130
|
+
paddingStart: Spacing.spacing_05,
|
|
131
|
+
paddingEnd: "20%",
|
|
132
|
+
},
|
|
133
|
+
max: {
|
|
134
|
+
paddingStart: Spacing.spacing_05,
|
|
135
|
+
paddingEnd: "20%",
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
medium: {
|
|
139
|
+
small: {
|
|
140
|
+
paddingStart: Spacing.spacing_05,
|
|
141
|
+
paddingEnd: Spacing.spacing_05,
|
|
142
|
+
},
|
|
143
|
+
medium: {
|
|
144
|
+
paddingStart: Spacing.spacing_05,
|
|
145
|
+
paddingEnd: "20%",
|
|
146
|
+
},
|
|
147
|
+
large: {
|
|
148
|
+
paddingStart: Spacing.spacing_05,
|
|
149
|
+
paddingEnd: "20%",
|
|
150
|
+
},
|
|
151
|
+
x_large: {
|
|
152
|
+
paddingStart: Spacing.spacing_05,
|
|
153
|
+
paddingEnd: "20%",
|
|
154
|
+
},
|
|
155
|
+
max: {
|
|
156
|
+
paddingStart: Spacing.spacing_05,
|
|
157
|
+
paddingEnd: "20%",
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
large: {
|
|
161
|
+
small: {
|
|
162
|
+
paddingStart: Spacing.spacing_05,
|
|
163
|
+
paddingEnd: Spacing.spacing_05,
|
|
164
|
+
},
|
|
165
|
+
medium: {
|
|
166
|
+
paddingStart: Spacing.spacing_05,
|
|
167
|
+
paddingEnd: "20%",
|
|
168
|
+
},
|
|
169
|
+
large: {
|
|
170
|
+
paddingStart: Spacing.spacing_05,
|
|
171
|
+
paddingEnd: "20%",
|
|
172
|
+
},
|
|
173
|
+
x_large: {
|
|
174
|
+
paddingStart: Spacing.spacing_05,
|
|
175
|
+
paddingEnd: "20%",
|
|
176
|
+
},
|
|
177
|
+
max: {
|
|
178
|
+
paddingStart: Spacing.spacing_05,
|
|
179
|
+
paddingEnd: "20%",
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useContext,
|
|
3
|
+
} from "react"
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
GlobalConfigContext,
|
|
7
|
+
} from "../../_internal/contexts"
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
NotificationColor,
|
|
11
|
+
} from "./NotificationColor"
|
|
12
|
+
import {
|
|
13
|
+
VariantContext,
|
|
14
|
+
} from "./_variant-context"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export function VariantContextProvider({
|
|
18
|
+
color,
|
|
19
|
+
children,
|
|
20
|
+
}: {
|
|
21
|
+
color?: NotificationColor,
|
|
22
|
+
children?: React.ReactNode,
|
|
23
|
+
}) {
|
|
24
|
+
|
|
25
|
+
const
|
|
26
|
+
globalConfigContext =
|
|
27
|
+
useContext(GlobalConfigContext)
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<VariantContext.Provider
|
|
31
|
+
value={{
|
|
32
|
+
color: color ?? globalConfigContext.notificationColor,
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
{ children }
|
|
36
|
+
</VariantContext.Provider>
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
BaseProps,
|
|
3
|
+
} from "../../base/BaseProps"
|
|
4
|
+
|
|
5
|
+
export interface UseBaseData {
|
|
6
|
+
iconProps: BaseProps["iconProps"],
|
|
7
|
+
iconCloseProps: BaseProps["iconCloseProps"],
|
|
8
|
+
titleStyle: BaseProps["titleStyle"],
|
|
9
|
+
leftBarStyle: BaseProps["leftBarStyle"],
|
|
10
|
+
style: BaseProps["style"],
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
NotificationColor,
|
|
3
|
+
} from "../../NotificationColor"
|
|
4
|
+
|
|
5
|
+
export interface UseBaseProps {
|
|
6
|
+
color?: NotificationColor,
|
|
7
|
+
style: Record<NotificationColor, Record<"backgroundColor" | "borderTopColor" | "borderRightColor" | "borderBottomColor", string>>,
|
|
8
|
+
leftBarStyle: Record<NotificationColor, {
|
|
9
|
+
backgroundColor: string
|
|
10
|
+
}>,
|
|
11
|
+
titleStyle: Record<NotificationColor, {
|
|
12
|
+
color: string
|
|
13
|
+
}>,
|
|
14
|
+
iconColor: Record<NotificationColor, string>,
|
|
15
|
+
iconCloseColor: Record<NotificationColor, string>,
|
|
16
|
+
/**
|
|
17
|
+
* true to use background color for top-right-bottom border.
|
|
18
|
+
* Currently for actionable variant
|
|
19
|
+
*/
|
|
20
|
+
transparentBorderColor?: boolean,
|
|
21
|
+
}
|