@metamask-previews/design-system-react-native 0.26.0-preview.620b9f3 → 0.27.0-preview.a0fe3894
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -1
- package/dist/components/BottomSheetHeader/BottomSheetHeader.cjs +2 -6
- package/dist/components/BottomSheetHeader/BottomSheetHeader.cjs.map +1 -1
- package/dist/components/BottomSheetHeader/BottomSheetHeader.d.cts.map +1 -1
- package/dist/components/BottomSheetHeader/BottomSheetHeader.d.mts.map +1 -1
- package/dist/components/BottomSheetHeader/BottomSheetHeader.mjs +2 -6
- package/dist/components/BottomSheetHeader/BottomSheetHeader.mjs.map +1 -1
- package/dist/components/BottomSheetHeader/BottomSheetHeader.types.cjs +0 -11
- package/dist/components/BottomSheetHeader/BottomSheetHeader.types.cjs.map +1 -1
- package/dist/components/BottomSheetHeader/BottomSheetHeader.types.d.cts +6 -20
- package/dist/components/BottomSheetHeader/BottomSheetHeader.types.d.cts.map +1 -1
- package/dist/components/BottomSheetHeader/BottomSheetHeader.types.d.mts +6 -20
- package/dist/components/BottomSheetHeader/BottomSheetHeader.types.d.mts.map +1 -1
- package/dist/components/BottomSheetHeader/BottomSheetHeader.types.mjs +1 -10
- package/dist/components/BottomSheetHeader/BottomSheetHeader.types.mjs.map +1 -1
- package/dist/components/BottomSheetHeader/index.cjs +1 -3
- package/dist/components/BottomSheetHeader/index.cjs.map +1 -1
- package/dist/components/BottomSheetHeader/index.d.cts +0 -1
- package/dist/components/BottomSheetHeader/index.d.cts.map +1 -1
- package/dist/components/BottomSheetHeader/index.d.mts +0 -1
- package/dist/components/BottomSheetHeader/index.d.mts.map +1 -1
- package/dist/components/BottomSheetHeader/index.mjs +0 -1
- package/dist/components/BottomSheetHeader/index.mjs.map +1 -1
- package/dist/components/Content/Content.cjs +71 -0
- package/dist/components/Content/Content.cjs.map +1 -0
- package/dist/components/Content/Content.constants.cjs +9 -0
- package/dist/components/Content/Content.constants.cjs.map +1 -0
- package/dist/components/Content/Content.constants.d.cts +3 -0
- package/dist/components/Content/Content.constants.d.cts.map +1 -0
- package/dist/components/Content/Content.constants.d.mts +3 -0
- package/dist/components/Content/Content.constants.d.mts.map +1 -0
- package/dist/components/Content/Content.constants.mjs +6 -0
- package/dist/components/Content/Content.constants.mjs.map +1 -0
- package/dist/components/Content/Content.d.cts +4 -0
- package/dist/components/Content/Content.d.cts.map +1 -0
- package/dist/components/Content/Content.d.mts +4 -0
- package/dist/components/Content/Content.d.mts.map +1 -0
- package/dist/components/Content/Content.mjs +71 -0
- package/dist/components/Content/Content.mjs.map +1 -0
- package/dist/components/Content/Content.types.cjs +3 -0
- package/dist/components/Content/Content.types.cjs.map +1 -0
- package/dist/components/Content/Content.types.d.cts +31 -0
- package/dist/components/Content/Content.types.d.cts.map +1 -0
- package/dist/components/Content/Content.types.d.mts +31 -0
- package/dist/components/Content/Content.types.d.mts.map +1 -0
- package/dist/components/Content/Content.types.mjs +2 -0
- package/dist/components/Content/Content.types.mjs.map +1 -0
- package/dist/components/Content/index.cjs +8 -0
- package/dist/components/Content/index.cjs.map +1 -0
- package/dist/components/Content/index.d.cts +4 -0
- package/dist/components/Content/index.d.cts.map +1 -0
- package/dist/components/Content/index.d.mts +4 -0
- package/dist/components/Content/index.d.mts.map +1 -0
- package/dist/components/Content/index.mjs +3 -0
- package/dist/components/Content/index.mjs.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.cjs +93 -72
- package/dist/components/HeaderBase/HeaderBase.cjs.map +1 -1
- package/dist/components/HeaderBase/HeaderBase.d.cts.map +1 -1
- package/dist/components/HeaderBase/HeaderBase.d.mts.map +1 -1
- package/dist/components/HeaderBase/HeaderBase.mjs +93 -72
- package/dist/components/HeaderBase/HeaderBase.mjs.map +1 -1
- package/dist/components/HeaderBase/HeaderBase.types.cjs +0 -12
- package/dist/components/HeaderBase/HeaderBase.types.cjs.map +1 -1
- package/dist/components/HeaderBase/HeaderBase.types.d.cts +11 -19
- package/dist/components/HeaderBase/HeaderBase.types.d.cts.map +1 -1
- package/dist/components/HeaderBase/HeaderBase.types.d.mts +11 -19
- package/dist/components/HeaderBase/HeaderBase.types.d.mts.map +1 -1
- package/dist/components/HeaderBase/HeaderBase.types.mjs +1 -11
- package/dist/components/HeaderBase/HeaderBase.types.mjs.map +1 -1
- package/dist/components/HeaderBase/index.cjs +1 -3
- package/dist/components/HeaderBase/index.cjs.map +1 -1
- package/dist/components/HeaderBase/index.d.cts +0 -1
- package/dist/components/HeaderBase/index.d.cts.map +1 -1
- package/dist/components/HeaderBase/index.d.mts +0 -1
- package/dist/components/HeaderBase/index.d.mts.map +1 -1
- package/dist/components/HeaderBase/index.mjs +0 -1
- package/dist/components/HeaderBase/index.mjs.map +1 -1
- package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.cjs +4 -12
- package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.cjs.map +1 -1
- package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.d.cts +0 -8
- package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.d.cts.map +1 -1
- package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.d.mts +0 -8
- package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.d.mts.map +1 -1
- package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.mjs +3 -10
- package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.mjs.map +1 -1
- package/dist/components/Icon/Icon.assets.cjs +2 -0
- package/dist/components/Icon/Icon.assets.cjs.map +1 -1
- package/dist/components/Icon/Icon.assets.d.cts.map +1 -1
- package/dist/components/Icon/Icon.assets.d.mts.map +1 -1
- package/dist/components/Icon/Icon.assets.mjs +2 -0
- package/dist/components/Icon/Icon.assets.mjs.map +1 -1
- package/dist/components/Icon/assets/flash-filled.svg +1 -0
- package/dist/components/SegmentGroup/SegmentGroup.cjs +4 -6
- package/dist/components/SegmentGroup/SegmentGroup.cjs.map +1 -1
- package/dist/components/SegmentGroup/SegmentGroup.d.cts.map +1 -1
- package/dist/components/SegmentGroup/SegmentGroup.d.mts.map +1 -1
- package/dist/components/SegmentGroup/SegmentGroup.mjs +5 -7
- package/dist/components/SegmentGroup/SegmentGroup.mjs.map +1 -1
- package/dist/components/Toast/Toast.constants.cjs +4 -7
- package/dist/components/Toast/Toast.constants.cjs.map +1 -1
- package/dist/components/Toast/Toast.constants.d.cts +1 -6
- package/dist/components/Toast/Toast.constants.d.cts.map +1 -1
- package/dist/components/Toast/Toast.constants.d.mts +1 -6
- package/dist/components/Toast/Toast.constants.d.mts.map +1 -1
- package/dist/components/Toast/Toast.constants.mjs +1 -6
- package/dist/components/Toast/Toast.constants.mjs.map +1 -1
- package/dist/components/Toast/Toast.types.cjs +2 -10
- package/dist/components/Toast/Toast.types.cjs.map +1 -1
- package/dist/components/Toast/Toast.types.d.cts +4 -11
- package/dist/components/Toast/Toast.types.d.cts.map +1 -1
- package/dist/components/Toast/Toast.types.d.mts +4 -11
- package/dist/components/Toast/Toast.types.d.mts.map +1 -1
- package/dist/components/Toast/Toast.types.mjs +2 -10
- package/dist/components/Toast/Toast.types.mjs.map +1 -1
- package/dist/components/Toast/index.cjs +3 -5
- package/dist/components/Toast/index.cjs.map +1 -1
- package/dist/components/Toast/index.d.cts +2 -2
- package/dist/components/Toast/index.d.cts.map +1 -1
- package/dist/components/Toast/index.d.mts +2 -2
- package/dist/components/Toast/index.d.mts.map +1 -1
- package/dist/components/Toast/index.mjs +2 -2
- package/dist/components/Toast/index.mjs.map +1 -1
- package/dist/components/index.cjs +5 -4
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +4 -2
- package/dist/components/index.d.cts.map +1 -1
- package/dist/components/index.d.mts +4 -2
- package/dist/components/index.d.mts.map +1 -1
- package/dist/components/index.mjs +3 -2
- package/dist/components/index.mjs.map +1 -1
- package/package.json +4 -4
- package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.cjs +0 -15
- package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.cjs.map +0 -1
- package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.d.cts +0 -7
- package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.d.cts.map +0 -1
- package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.d.mts +0 -7
- package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.d.mts.map +0 -1
- package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.mjs +0 -12
- package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.mjs.map +0 -1
- package/dist/components/HeaderBase/HeaderBase.constants.cjs +0 -15
- package/dist/components/HeaderBase/HeaderBase.constants.cjs.map +0 -1
- package/dist/components/HeaderBase/HeaderBase.constants.d.cts +0 -7
- package/dist/components/HeaderBase/HeaderBase.constants.d.cts.map +0 -1
- package/dist/components/HeaderBase/HeaderBase.constants.d.mts +0 -7
- package/dist/components/HeaderBase/HeaderBase.constants.d.mts.map +0 -1
- package/dist/components/HeaderBase/HeaderBase.constants.mjs +0 -12
- package/dist/components/HeaderBase/HeaderBase.constants.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderBase.mjs","sourceRoot":"","sources":["../../../src/components/HeaderBase/HeaderBase.tsx"],"names":[],"mappings":";;;;;;AAAA,4BAA4B;AAC5B,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,QAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc;;AAErD,OAAO,EAAE,IAAI,EAAE,qBAAqB;AACpC,OAAO,EAAE,iBAAiB,EAAE,uCAAuC;AAEnE,yBAAyB;AACzB,OAAO,EAAE,GAAG,EAAE,yBAAe;AAC7B,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,gCAAsB;AAC3D,OAAO,EAAE,IAAI,EAAE,0BAAgB;AAE/B,yBAAyB;AACzB,OAAO,EAAE,gCAAgC,EAAE,mCAA+B;AAE1E,OAAO,EAAE,iBAAiB,EAAE,+BAA2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AC,CAAC,gCAAgC,CAAC,OAAO,CAAC,CAAC,CACnD,MAAM,CAAC,CAAC,WAAW,CAAC,CACpB,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAEvD;YAAA,CAAC,QAAQ,CACX;UAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,CACH;MAAA,EAAE,GAAG,CAEL;;MAAA,CAAC,mBAAmB,CACpB;MAAA,CAAC,sBAAsB,IAAI,CACzB,CAAC,IAAI,CACH,KAAK,CAAC,CACJ,qBAAqB;gBACnB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC;gBACzD,CAAC,CAAC,SAAS,CACd,CACD,IAAI,wBAAwB,CAAC,CAE7B;UAAA,CAAC,IAAI,CACH,QAAQ,CAAC,CAAC,wBAAwB,CAAC,CACnC,KAAK,CAAC,CACJ,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS,CAC/D,CAED;YAAA,CAAC,gBAAgB,EAAE,CACrB;UAAA,EAAE,IAAI,CACR;QAAA,EAAE,IAAI,CAAC,CACR,CACH;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Third party dependencies.\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, { useCallback, useState } from 'react';\nimport type { LayoutChangeEvent } from 'react-native';\nimport { View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\n// External dependencies.\nimport { Box } from '../Box';\nimport { ButtonIcon, ButtonIconSize } from '../ButtonIcon';\nimport { Text } from '../Text';\n\n// Internal dependencies.\nimport { HEADERBASE_VARIANT_TEXT_VARIANTS } from './HeaderBase.constants';\nimport type { HeaderBaseProps } from './HeaderBase.types';\nimport { HeaderBaseVariant } from './HeaderBase.types';\n\nexport const HeaderBase: React.FC<HeaderBaseProps> = ({\n children,\n style,\n variant = HeaderBaseVariant.Compact,\n startAccessory,\n endAccessory,\n startButtonIconProps,\n endButtonIconProps,\n includesTopInset = false,\n startAccessoryWrapperProps,\n endAccessoryWrapperProps,\n titleTestID,\n twClassName,\n ...props\n}) => {\n const tw = useTailwind();\n const insets = useSafeAreaInsets();\n\n const [startAccessoryWidth, setStartAccessoryWidth] = useState(0);\n const [endAccessoryWidth, setEndAccessoryWidth] = useState(0);\n\n const handleStartAccessoryLayout = useCallback((e: LayoutChangeEvent) => {\n setStartAccessoryWidth(e.nativeEvent.layout.width);\n }, []);\n\n const handleEndAccessoryLayout = useCallback((e: LayoutChangeEvent) => {\n setEndAccessoryWidth(e.nativeEvent.layout.width);\n }, []);\n\n // Determine what to render for start/end\n const hasStartContent = startAccessory || startButtonIconProps;\n const hasEndContent =\n endAccessory || (endButtonIconProps && endButtonIconProps.length > 0);\n const hasAnyAccessory = hasStartContent || hasEndContent;\n\n const isCompact = variant === HeaderBaseVariant.Compact;\n\n // For Compact variant, render both wrappers if any accessory exists (for centering)\n // For Display variant, only render wrappers when they have content\n const shouldRenderStartWrapper = isCompact\n ? Boolean(hasAnyAccessory)\n : Boolean(hasStartContent);\n const shouldRenderEndWrapper = isCompact\n ? Boolean(hasAnyAccessory)\n : Boolean(hasEndContent);\n\n // Calculate equal width for both accessory wrappers to ensure title stays centered (Compact only)\n const accessoryWrapperWidth =\n isCompact && hasAnyAccessory && (startAccessoryWidth || endAccessoryWidth)\n ? Math.max(startAccessoryWidth, endAccessoryWidth)\n : undefined;\n\n const renderStartContent = () => {\n if (startAccessory) {\n return startAccessory;\n }\n if (startButtonIconProps) {\n return <ButtonIcon size={ButtonIconSize.Md} {...startButtonIconProps} />;\n }\n return null;\n };\n\n const renderEndContent = () => {\n if (endAccessory) {\n return endAccessory;\n }\n if (endButtonIconProps && endButtonIconProps.length > 0) {\n // Reverse the array so first item appears rightmost\n // Use original index (before reversal) for stable React keys\n const reversedProps = endButtonIconProps\n .map((iconProps, originalIndex) => ({\n iconProps,\n originalIndex,\n }))\n .reverse();\n return reversedProps.map(({ iconProps, originalIndex }) => (\n <ButtonIcon\n key={`end-button-icon-${originalIndex}`}\n size={ButtonIconSize.Md}\n {...iconProps}\n />\n ));\n }\n return null;\n };\n\n // Check if we have multiple end buttons for layout styling\n const hasMultipleEndButtons =\n !endAccessory && endButtonIconProps && endButtonIconProps.length > 1;\n\n // Merge default styles with passed-in twClassName\n const baseStyles = 'flex-row items-center gap-4 h-14';\n const resolvedTwClassName = twClassName\n ? `${baseStyles} ${twClassName}`\n : baseStyles;\n\n return (\n <View\n style={[\n tw.style(resolvedTwClassName),\n includesTopInset && { marginTop: insets.top },\n style,\n ]}\n {...props}\n >\n {/* Start accessory */}\n {shouldRenderStartWrapper && (\n <View\n style={\n accessoryWrapperWidth\n ? tw.style('items-start', { width: accessoryWrapperWidth })\n : undefined\n }\n {...startAccessoryWrapperProps}\n >\n <View onLayout={handleStartAccessoryLayout}>\n {renderStartContent()}\n </View>\n </View>\n )}\n\n {/* Title */}\n <Box twClassName={isCompact ? 'flex-1 items-center' : 'flex-1'}>\n {typeof children === 'string' ? (\n <Text\n variant={HEADERBASE_VARIANT_TEXT_VARIANTS[variant]}\n testID={titleTestID}\n style={isCompact ? tw.style('text-center') : undefined}\n >\n {children}\n </Text>\n ) : (\n children\n )}\n </Box>\n\n {/* End accessory */}\n {shouldRenderEndWrapper && (\n <View\n style={\n accessoryWrapperWidth\n ? tw.style('items-end', { width: accessoryWrapperWidth })\n : undefined\n }\n {...endAccessoryWrapperProps}\n >\n <View\n onLayout={handleEndAccessoryLayout}\n style={\n hasMultipleEndButtons ? tw.style('flex-row gap-2') : undefined\n }\n >\n {renderEndContent()}\n </View>\n </View>\n )}\n </View>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"HeaderBase.mjs","sourceRoot":"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extVariant } from '@metamask-previews/design-system-shared';\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, { useCallback, useState } from 'react';\nimport type { LayoutChangeEvent } from 'react-native';\nimport { View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\n// External dependencies.\nimport { ButtonIcon, ButtonIconSize } from '../ButtonIcon';\nimport type { ButtonIconProps } from '../ButtonIcon';\nimport { TextOrChildren } from '../temp-components/TextOrChildren';\n\nimport type { HeaderBaseProps } from './HeaderBase.types';\n\n// `startAccessory` is the primary escape hatch. `startButtonIconProps`\n// remains as a convenience path for the common single-back-button case.\nconst resolveStartAccessory = ({\n startAccessory,\n startButtonIconProps,\n}: Pick<HeaderBaseProps, 'startAccessory' | 'startButtonIconProps'>) => {\n if (startAccessory) {\n return startAccessory;\n }\n\n if (startButtonIconProps) {\n return <ButtonIcon size={ButtonIconSize.Md} {...startButtonIconProps} />;\n }\n\n return null;\n};\n\n// Only the end side supports built-in multiple buttons. More complex\n// start-side layouts should be composed explicitly with `startAccessory`.\nconst renderEndButtonIcons = (endButtonIconProps: ButtonIconProps[]) =>\n endButtonIconProps\n .map((iconProps, originalIndex) => ({\n iconProps,\n originalIndex,\n }))\n .reverse()\n .map(({ iconProps, originalIndex }) => (\n <ButtonIcon\n key={`end-button-icon-${originalIndex}`}\n size={ButtonIconSize.Md}\n {...iconProps}\n />\n ));\n\n// `endAccessory` takes precedence over the shorthand icon-props array.\nconst resolveEndAccessory = ({\n endAccessory,\n endButtonIconProps,\n}: Pick<HeaderBaseProps, 'endAccessory' | 'endButtonIconProps'>) => {\n if (endAccessory) {\n return {\n resolvedEndAccessory: endAccessory,\n hasMultipleEndButtons: false,\n };\n }\n\n if (endButtonIconProps && endButtonIconProps.length > 0) {\n return {\n resolvedEndAccessory: renderEndButtonIcons(endButtonIconProps),\n hasMultipleEndButtons: endButtonIconProps.length > 1,\n };\n }\n\n return {\n resolvedEndAccessory: null,\n hasMultipleEndButtons: false,\n };\n};\n\nexport const HeaderBase: React.FC<HeaderBaseProps> = ({\n children,\n style,\n startAccessory,\n endAccessory,\n startButtonIconProps,\n endButtonIconProps,\n includesTopInset = false,\n startAccessoryWrapperProps,\n endAccessoryWrapperProps,\n childrenWrapperProps,\n textProps,\n twClassName,\n ...props\n}) => {\n const tw = useTailwind();\n const insets = useSafeAreaInsets();\n\n const [startAccessoryWidth, setStartAccessoryWidth] = useState(0);\n const [endAccessoryWidth, setEndAccessoryWidth] = useState(0);\n\n const handleStartAccessoryLayout = useCallback((e: LayoutChangeEvent) => {\n setStartAccessoryWidth(e.nativeEvent.layout.width);\n }, []);\n\n const handleEndAccessoryLayout = useCallback((e: LayoutChangeEvent) => {\n setEndAccessoryWidth(e.nativeEvent.layout.width);\n }, []);\n\n // Normalize the public API into resolved slots so the render path only deals\n // with layout and title rendering.\n const resolvedStartAccessory = resolveStartAccessory({\n startAccessory,\n startButtonIconProps,\n });\n const { resolvedEndAccessory, hasMultipleEndButtons } = resolveEndAccessory({\n endAccessory,\n endButtonIconProps,\n });\n\n const hasStartAccessory = Boolean(resolvedStartAccessory);\n const hasEndAccessory = Boolean(resolvedEndAccessory);\n const hasAnyAccessory = hasStartAccessory || hasEndAccessory;\n\n // Calculate equal width for both accessory wrappers to ensure title stays centered.\n const accessoryWrapperWidth =\n hasAnyAccessory && (startAccessoryWidth || endAccessoryWidth)\n ? Math.max(startAccessoryWidth, endAccessoryWidth)\n : undefined;\n\n const renderAccessoryWrapper = ({\n wrapperProps,\n alignment,\n onLayout,\n content,\n measuredContentStyle,\n }: {\n wrapperProps?: HeaderBaseProps['startAccessoryWrapperProps'];\n alignment: 'items-start' | 'items-end';\n onLayout: (e: LayoutChangeEvent) => void;\n content: React.ReactNode;\n measuredContentStyle?: ReturnType<typeof tw.style>;\n }) => {\n if (!hasAnyAccessory) {\n return null;\n }\n\n return (\n <View\n style={\n accessoryWrapperWidth\n ? tw.style(alignment, { width: accessoryWrapperWidth })\n : undefined\n }\n {...wrapperProps}\n >\n <View onLayout={onLayout} style={measuredContentStyle}>\n {content}\n </View>\n </View>\n );\n };\n\n return (\n <View\n style={[\n tw.style('flex-row items-center gap-4 h-14', twClassName),\n includesTopInset && { marginTop: insets.top },\n style,\n ]}\n {...props}\n >\n {/* Start accessory */}\n {renderAccessoryWrapper({\n wrapperProps: startAccessoryWrapperProps,\n alignment: 'items-start',\n onLayout: handleStartAccessoryLayout,\n content: resolvedStartAccessory,\n })}\n\n {/* Title */}\n <View style={tw.style('flex-1 items-center')} {...childrenWrapperProps}>\n <TextOrChildren\n textProps={{\n variant: TextVariant.HeadingSm,\n ...textProps,\n style: [tw.style('text-center'), textProps?.style],\n }}\n >\n {children}\n </TextOrChildren>\n </View>\n\n {/* End accessory */}\n {renderAccessoryWrapper({\n wrapperProps: endAccessoryWrapperProps,\n alignment: 'items-end',\n onLayout: handleEndAccessoryLayout,\n content: resolvedEndAccessory,\n measuredContentStyle: hasMultipleEndButtons\n ? tw.style('flex-row gap-2')\n : undefined,\n })}\n </View>\n );\n};\n\nHeaderBase.displayName = 'HeaderBase';\n"]}
|
|
@@ -1,15 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HeaderBaseVariant = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Variant options for HeaderBase component.
|
|
6
|
-
* Controls title text size and alignment.
|
|
7
|
-
*/
|
|
8
|
-
var HeaderBaseVariant;
|
|
9
|
-
(function (HeaderBaseVariant) {
|
|
10
|
-
/** Center-aligned title with HeadingSm text */
|
|
11
|
-
HeaderBaseVariant["Compact"] = "compact";
|
|
12
|
-
/** Left-aligned title with HeadingLg text */
|
|
13
|
-
HeaderBaseVariant["Display"] = "display";
|
|
14
|
-
})(HeaderBaseVariant || (exports.HeaderBaseVariant = HeaderBaseVariant = {}));
|
|
15
3
|
//# sourceMappingURL=HeaderBase.types.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderBase.types.cjs","sourceRoot":"","sources":["../../../src/components/HeaderBase/HeaderBase.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HeaderBase.types.cjs","sourceRoot":"","sources":["../../../src/components/HeaderBase/HeaderBase.types.ts"],"names":[],"mappings":"","sourcesContent":["// Third party dependencies.\nimport type { ReactNode } from 'react';\nimport type { ViewProps, StyleProp, ViewStyle } from 'react-native';\n\n// External dependencies.\nimport type { ButtonIconProps } from '../ButtonIcon';\nimport type { TextProps } from '../Text';\n\n/**\n * HeaderBase component props.\n *\n * Extends React Native's ViewProps to inherit standard props such as\n * `testID`, `accessibilityLabel`, and other View props.\n */\nexport type HeaderBaseProps = ViewProps & {\n /**\n * Title of the HeaderBase. Pass a string for automatic Text rendering,\n * or a ReactNode for custom content.\n */\n children?: ReactNode | string;\n /**\n * Optional style for the header container.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * Optional prop to include content to be displayed before the title.\n * Takes priority over startButtonIconProps if both are provided.\n */\n startAccessory?: ReactNode;\n /**\n * Optional prop to include content to be displayed after the title.\n * Takes priority over endButtonIconProps if both are provided.\n */\n endAccessory?: ReactNode;\n /**\n * Optional ButtonIcon props to render a ButtonIcon as the start accessory.\n * Only used if startAccessory is not provided.\n * For multiple start-side actions, compose them explicitly with `startAccessory`.\n *\n * @default size: ButtonIconSize.Md\n */\n startButtonIconProps?: ButtonIconProps;\n /**\n * Optional array of ButtonIcon props to render multiple ButtonIcons as end accessories.\n * Rendered in reverse order (first item appears rightmost).\n * Only used if endAccessory is not provided.\n * This is the built-in multiple-action path for HeaderBase; for custom layouts,\n * use `endAccessory`.\n *\n * @default size: ButtonIconSize.Md for each\n */\n endButtonIconProps?: ButtonIconProps[];\n /**\n * Optional prop to include the top inset to make sure the header is visible\n * below device's notch.\n *\n * @default false\n */\n includesTopInset?: boolean;\n /**\n * Optional props to pass to the start accessory wrapper View.\n */\n startAccessoryWrapperProps?: ViewProps;\n /**\n * Optional props to pass to the end accessory wrapper View.\n */\n endAccessoryWrapperProps?: ViewProps;\n /**\n * Optional props to pass to the title wrapper View.\n */\n childrenWrapperProps?: ViewProps;\n /**\n * Optional props passed to the Text component when children is a string.\n * Props are spread onto TextOrChildren `textProps` and can override default values.\n */\n textProps?: Omit<Partial<TextProps>, 'children'>;\n /**\n * Optional Tailwind class names for the header container.\n * Merged with default styles using tw.style().\n */\n twClassName?: string;\n};\n"]}
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { ViewProps, StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
import type { ButtonIconProps } from "../ButtonIcon/index.cjs";
|
|
4
|
-
|
|
5
|
-
* Variant options for HeaderBase component.
|
|
6
|
-
* Controls title text size and alignment.
|
|
7
|
-
*/
|
|
8
|
-
export declare enum HeaderBaseVariant {
|
|
9
|
-
/** Center-aligned title with HeadingSm text */
|
|
10
|
-
Compact = "compact",
|
|
11
|
-
/** Left-aligned title with HeadingLg text */
|
|
12
|
-
Display = "display"
|
|
13
|
-
}
|
|
4
|
+
import type { TextProps } from "../Text/index.cjs";
|
|
14
5
|
/**
|
|
15
6
|
* HeaderBase component props.
|
|
16
7
|
*
|
|
@@ -18,12 +9,6 @@ export declare enum HeaderBaseVariant {
|
|
|
18
9
|
* `testID`, `accessibilityLabel`, and other View props.
|
|
19
10
|
*/
|
|
20
11
|
export type HeaderBaseProps = ViewProps & {
|
|
21
|
-
/**
|
|
22
|
-
* Variant controlling header text size.
|
|
23
|
-
*
|
|
24
|
-
* @default HeaderBaseVariant.Compact
|
|
25
|
-
*/
|
|
26
|
-
variant?: HeaderBaseVariant;
|
|
27
12
|
/**
|
|
28
13
|
* Title of the HeaderBase. Pass a string for automatic Text rendering,
|
|
29
14
|
* or a ReactNode for custom content.
|
|
@@ -46,6 +31,7 @@ export type HeaderBaseProps = ViewProps & {
|
|
|
46
31
|
/**
|
|
47
32
|
* Optional ButtonIcon props to render a ButtonIcon as the start accessory.
|
|
48
33
|
* Only used if startAccessory is not provided.
|
|
34
|
+
* For multiple start-side actions, compose them explicitly with `startAccessory`.
|
|
49
35
|
*
|
|
50
36
|
* @default size: ButtonIconSize.Md
|
|
51
37
|
*/
|
|
@@ -54,6 +40,8 @@ export type HeaderBaseProps = ViewProps & {
|
|
|
54
40
|
* Optional array of ButtonIcon props to render multiple ButtonIcons as end accessories.
|
|
55
41
|
* Rendered in reverse order (first item appears rightmost).
|
|
56
42
|
* Only used if endAccessory is not provided.
|
|
43
|
+
* This is the built-in multiple-action path for HeaderBase; for custom layouts,
|
|
44
|
+
* use `endAccessory`.
|
|
57
45
|
*
|
|
58
46
|
* @default size: ButtonIconSize.Md for each
|
|
59
47
|
*/
|
|
@@ -74,10 +62,14 @@ export type HeaderBaseProps = ViewProps & {
|
|
|
74
62
|
*/
|
|
75
63
|
endAccessoryWrapperProps?: ViewProps;
|
|
76
64
|
/**
|
|
77
|
-
* Optional
|
|
78
|
-
|
|
65
|
+
* Optional props to pass to the title wrapper View.
|
|
66
|
+
*/
|
|
67
|
+
childrenWrapperProps?: ViewProps;
|
|
68
|
+
/**
|
|
69
|
+
* Optional props passed to the Text component when children is a string.
|
|
70
|
+
* Props are spread onto TextOrChildren `textProps` and can override default values.
|
|
79
71
|
*/
|
|
80
|
-
|
|
72
|
+
textProps?: Omit<Partial<TextProps>, 'children'>;
|
|
81
73
|
/**
|
|
82
74
|
* Optional Tailwind class names for the header container.
|
|
83
75
|
* Merged with default styles using tw.style().
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderBase.types.d.cts","sourceRoot":"","sources":["../../../src/components/HeaderBase/HeaderBase.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,qBAAqB;AAGpE,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;
|
|
1
|
+
{"version":3,"file":"HeaderBase.types.d.cts","sourceRoot":"","sources":["../../../src/components/HeaderBase/HeaderBase.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,qBAAqB;AAGpE,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,0BAAgB;AAEzC;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;;OAGG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;;;;;OAMG;IACH,oBAAoB,CAAC,EAAE,eAAe,CAAC;IACvC;;;;;;;;OAQG;IACH,kBAAkB,CAAC,EAAE,eAAe,EAAE,CAAC;IACvC;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,0BAA0B,CAAC,EAAE,SAAS,CAAC;IACvC;;OAEG;IACH,wBAAwB,CAAC,EAAE,SAAS,CAAC;IACrC;;OAEG;IACH,oBAAoB,CAAC,EAAE,SAAS,CAAC;IACjC;;;OAGG;IACH,SAAS,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC,CAAC;IACjD;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { ViewProps, StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
import type { ButtonIconProps } from "../ButtonIcon/index.mjs";
|
|
4
|
-
|
|
5
|
-
* Variant options for HeaderBase component.
|
|
6
|
-
* Controls title text size and alignment.
|
|
7
|
-
*/
|
|
8
|
-
export declare enum HeaderBaseVariant {
|
|
9
|
-
/** Center-aligned title with HeadingSm text */
|
|
10
|
-
Compact = "compact",
|
|
11
|
-
/** Left-aligned title with HeadingLg text */
|
|
12
|
-
Display = "display"
|
|
13
|
-
}
|
|
4
|
+
import type { TextProps } from "../Text/index.mjs";
|
|
14
5
|
/**
|
|
15
6
|
* HeaderBase component props.
|
|
16
7
|
*
|
|
@@ -18,12 +9,6 @@ export declare enum HeaderBaseVariant {
|
|
|
18
9
|
* `testID`, `accessibilityLabel`, and other View props.
|
|
19
10
|
*/
|
|
20
11
|
export type HeaderBaseProps = ViewProps & {
|
|
21
|
-
/**
|
|
22
|
-
* Variant controlling header text size.
|
|
23
|
-
*
|
|
24
|
-
* @default HeaderBaseVariant.Compact
|
|
25
|
-
*/
|
|
26
|
-
variant?: HeaderBaseVariant;
|
|
27
12
|
/**
|
|
28
13
|
* Title of the HeaderBase. Pass a string for automatic Text rendering,
|
|
29
14
|
* or a ReactNode for custom content.
|
|
@@ -46,6 +31,7 @@ export type HeaderBaseProps = ViewProps & {
|
|
|
46
31
|
/**
|
|
47
32
|
* Optional ButtonIcon props to render a ButtonIcon as the start accessory.
|
|
48
33
|
* Only used if startAccessory is not provided.
|
|
34
|
+
* For multiple start-side actions, compose them explicitly with `startAccessory`.
|
|
49
35
|
*
|
|
50
36
|
* @default size: ButtonIconSize.Md
|
|
51
37
|
*/
|
|
@@ -54,6 +40,8 @@ export type HeaderBaseProps = ViewProps & {
|
|
|
54
40
|
* Optional array of ButtonIcon props to render multiple ButtonIcons as end accessories.
|
|
55
41
|
* Rendered in reverse order (first item appears rightmost).
|
|
56
42
|
* Only used if endAccessory is not provided.
|
|
43
|
+
* This is the built-in multiple-action path for HeaderBase; for custom layouts,
|
|
44
|
+
* use `endAccessory`.
|
|
57
45
|
*
|
|
58
46
|
* @default size: ButtonIconSize.Md for each
|
|
59
47
|
*/
|
|
@@ -74,10 +62,14 @@ export type HeaderBaseProps = ViewProps & {
|
|
|
74
62
|
*/
|
|
75
63
|
endAccessoryWrapperProps?: ViewProps;
|
|
76
64
|
/**
|
|
77
|
-
* Optional
|
|
78
|
-
|
|
65
|
+
* Optional props to pass to the title wrapper View.
|
|
66
|
+
*/
|
|
67
|
+
childrenWrapperProps?: ViewProps;
|
|
68
|
+
/**
|
|
69
|
+
* Optional props passed to the Text component when children is a string.
|
|
70
|
+
* Props are spread onto TextOrChildren `textProps` and can override default values.
|
|
79
71
|
*/
|
|
80
|
-
|
|
72
|
+
textProps?: Omit<Partial<TextProps>, 'children'>;
|
|
81
73
|
/**
|
|
82
74
|
* Optional Tailwind class names for the header container.
|
|
83
75
|
* Merged with default styles using tw.style().
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderBase.types.d.mts","sourceRoot":"","sources":["../../../src/components/HeaderBase/HeaderBase.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,qBAAqB;AAGpE,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;
|
|
1
|
+
{"version":3,"file":"HeaderBase.types.d.mts","sourceRoot":"","sources":["../../../src/components/HeaderBase/HeaderBase.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,qBAAqB;AAGpE,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,0BAAgB;AAEzC;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;;OAGG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;;;;;OAMG;IACH,oBAAoB,CAAC,EAAE,eAAe,CAAC;IACvC;;;;;;;;OAQG;IACH,kBAAkB,CAAC,EAAE,eAAe,EAAE,CAAC;IACvC;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,0BAA0B,CAAC,EAAE,SAAS,CAAC;IACvC;;OAEG;IACH,wBAAwB,CAAC,EAAE,SAAS,CAAC;IACrC;;OAEG;IACH,oBAAoB,CAAC,EAAE,SAAS,CAAC;IACjC;;;OAGG;IACH,SAAS,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC,CAAC;IACjD;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Variant options for HeaderBase component.
|
|
3
|
-
* Controls title text size and alignment.
|
|
4
|
-
*/
|
|
5
|
-
export var HeaderBaseVariant;
|
|
6
|
-
(function (HeaderBaseVariant) {
|
|
7
|
-
/** Center-aligned title with HeadingSm text */
|
|
8
|
-
HeaderBaseVariant["Compact"] = "compact";
|
|
9
|
-
/** Left-aligned title with HeadingLg text */
|
|
10
|
-
HeaderBaseVariant["Display"] = "display";
|
|
11
|
-
})(HeaderBaseVariant || (HeaderBaseVariant = {}));
|
|
1
|
+
export {};
|
|
12
2
|
//# sourceMappingURL=HeaderBase.types.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderBase.types.mjs","sourceRoot":"","sources":["../../../src/components/HeaderBase/HeaderBase.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HeaderBase.types.mjs","sourceRoot":"","sources":["../../../src/components/HeaderBase/HeaderBase.types.ts"],"names":[],"mappings":"","sourcesContent":["// Third party dependencies.\nimport type { ReactNode } from 'react';\nimport type { ViewProps, StyleProp, ViewStyle } from 'react-native';\n\n// External dependencies.\nimport type { ButtonIconProps } from '../ButtonIcon';\nimport type { TextProps } from '../Text';\n\n/**\n * HeaderBase component props.\n *\n * Extends React Native's ViewProps to inherit standard props such as\n * `testID`, `accessibilityLabel`, and other View props.\n */\nexport type HeaderBaseProps = ViewProps & {\n /**\n * Title of the HeaderBase. Pass a string for automatic Text rendering,\n * or a ReactNode for custom content.\n */\n children?: ReactNode | string;\n /**\n * Optional style for the header container.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * Optional prop to include content to be displayed before the title.\n * Takes priority over startButtonIconProps if both are provided.\n */\n startAccessory?: ReactNode;\n /**\n * Optional prop to include content to be displayed after the title.\n * Takes priority over endButtonIconProps if both are provided.\n */\n endAccessory?: ReactNode;\n /**\n * Optional ButtonIcon props to render a ButtonIcon as the start accessory.\n * Only used if startAccessory is not provided.\n * For multiple start-side actions, compose them explicitly with `startAccessory`.\n *\n * @default size: ButtonIconSize.Md\n */\n startButtonIconProps?: ButtonIconProps;\n /**\n * Optional array of ButtonIcon props to render multiple ButtonIcons as end accessories.\n * Rendered in reverse order (first item appears rightmost).\n * Only used if endAccessory is not provided.\n * This is the built-in multiple-action path for HeaderBase; for custom layouts,\n * use `endAccessory`.\n *\n * @default size: ButtonIconSize.Md for each\n */\n endButtonIconProps?: ButtonIconProps[];\n /**\n * Optional prop to include the top inset to make sure the header is visible\n * below device's notch.\n *\n * @default false\n */\n includesTopInset?: boolean;\n /**\n * Optional props to pass to the start accessory wrapper View.\n */\n startAccessoryWrapperProps?: ViewProps;\n /**\n * Optional props to pass to the end accessory wrapper View.\n */\n endAccessoryWrapperProps?: ViewProps;\n /**\n * Optional props to pass to the title wrapper View.\n */\n childrenWrapperProps?: ViewProps;\n /**\n * Optional props passed to the Text component when children is a string.\n * Props are spread onto TextOrChildren `textProps` and can override default values.\n */\n textProps?: Omit<Partial<TextProps>, 'children'>;\n /**\n * Optional Tailwind class names for the header container.\n * Merged with default styles using tw.style().\n */\n twClassName?: string;\n};\n"]}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.HeaderBase = void 0;
|
|
4
4
|
var HeaderBase_1 = require("./HeaderBase.cjs");
|
|
5
5
|
Object.defineProperty(exports, "HeaderBase", { enumerable: true, get: function () { return HeaderBase_1.HeaderBase; } });
|
|
6
|
-
var HeaderBase_types_1 = require("./HeaderBase.types.cjs");
|
|
7
|
-
Object.defineProperty(exports, "HeaderBaseVariant", { enumerable: true, get: function () { return HeaderBase_types_1.HeaderBaseVariant; } });
|
|
8
6
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/components/HeaderBase/index.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAAjC,wGAAA,UAAU,OAAA
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/components/HeaderBase/index.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAAjC,wGAAA,UAAU,OAAA","sourcesContent":["export { HeaderBase } from './HeaderBase';\nexport type { HeaderBaseProps } from './HeaderBase.types';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/HeaderBase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,yBAAqB;AAC1C,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/HeaderBase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,yBAAqB;AAC1C,YAAY,EAAE,eAAe,EAAE,+BAA2B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/components/HeaderBase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,yBAAqB;AAC1C,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/components/HeaderBase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,yBAAqB;AAC1C,YAAY,EAAE,eAAe,EAAE,+BAA2B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/components/HeaderBase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,yBAAqB
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/components/HeaderBase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,yBAAqB","sourcesContent":["export { HeaderBase } from './HeaderBase';\nexport type { HeaderBaseProps } from './HeaderBase.types';\n"]}
|
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useHeaderStandardAnimated =
|
|
3
|
+
exports.useHeaderStandardAnimated = void 0;
|
|
4
4
|
// Third party dependencies.
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const react_native_reanimated_1 = require("react-native-reanimated");
|
|
7
|
-
/**
|
|
8
|
-
* Writes a vertical content offset into the scroll shared value.
|
|
9
|
-
*
|
|
10
|
-
* @param scrollYValue - Shared value for vertical scroll offset.
|
|
11
|
-
* @param contentOffsetY - `contentOffset.y` from the scroll event.
|
|
12
|
-
*/
|
|
13
|
-
function updateScrollYFromEvent(scrollYValue, contentOffsetY) {
|
|
14
|
-
scrollYValue.value = contentOffsetY;
|
|
15
|
-
}
|
|
16
|
-
exports.updateScrollYFromEvent = updateScrollYFromEvent;
|
|
17
7
|
/**
|
|
18
8
|
* Hook for managing HeaderStandardAnimated scroll-linked animations.
|
|
19
9
|
* Use with HeaderStandardAnimated placed outside the ScrollView as a sibling.
|
|
@@ -49,7 +39,9 @@ function useHeaderStandardAnimated() {
|
|
|
49
39
|
titleSectionHeightSv.value = height;
|
|
50
40
|
}, [titleSectionHeightSv]);
|
|
51
41
|
const onScroll = (0, react_native_reanimated_1.useAnimatedScrollHandler)({
|
|
52
|
-
onScroll: (scrollEvent) =>
|
|
42
|
+
onScroll: (scrollEvent) => {
|
|
43
|
+
scrollYValue.value = scrollEvent.contentOffset.y;
|
|
44
|
+
},
|
|
53
45
|
});
|
|
54
46
|
return {
|
|
55
47
|
scrollY: scrollYValue,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHeaderStandardAnimated.cjs","sourceRoot":"","sources":["../../../src/components/HeaderStandardAnimated/useHeaderStandardAnimated.ts"],"names":[],"mappings":";;;AAAA,4BAA4B;AAC5B,iCAAoC;
|
|
1
|
+
{"version":3,"file":"useHeaderStandardAnimated.cjs","sourceRoot":"","sources":["../../../src/components/HeaderStandardAnimated/useHeaderStandardAnimated.ts"],"names":[],"mappings":";;;AAAA,4BAA4B;AAC5B,iCAAoC;AACpC,qEAGiC;AAKjC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,yBAAyB;IACvC,MAAM,YAAY,GAAG,IAAA,wCAAc,EAAC,CAAC,CAAC,CAAC;IACvC,MAAM,oBAAoB,GAAG,IAAA,wCAAc,EAAC,CAAC,CAAC,CAAC;IAE/C,MAAM,qBAAqB,GAAG,IAAA,mBAAW,EACvC,CAAC,MAAc,EAAE,EAAE;QACjB,oBAAoB,CAAC,KAAK,GAAG,MAAM,CAAC;IACtC,CAAC,EACD,CAAC,oBAAoB,CAAC,CACvB,CAAC;IAEF,MAAM,QAAQ,GAAG,IAAA,kDAAwB,EAAC;QACxC,QAAQ,EAAE,CAAC,WAAW,EAAE,EAAE;YACxB,YAAY,CAAC,KAAK,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;QACnD,CAAC;KACF,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,YAAY;QACrB,oBAAoB;QACpB,qBAAqB;QACrB,QAAQ;KACT,CAAC;AACJ,CAAC;AAvBD,8DAuBC","sourcesContent":["// Third party dependencies.\nimport { useCallback } from 'react';\nimport {\n useSharedValue,\n useAnimatedScrollHandler,\n} from 'react-native-reanimated';\n\n// Internal dependencies.\nimport type { UseHeaderStandardAnimatedReturn } from './HeaderStandardAnimated.types';\n\n/**\n * Hook for managing HeaderStandardAnimated scroll-linked animations.\n * Use with HeaderStandardAnimated placed outside the ScrollView as a sibling.\n * Use the returned onScroll with Animated.ScrollView for UI-thread scroll updates (zero lag).\n *\n * @returns Object containing scrollY, titleSectionHeightSv, setTitleSectionHeight, and onScroll.\n *\n * @example\n * ```tsx\n * const { scrollY, onScroll, setTitleSectionHeight, titleSectionHeightSv } =\n * useHeaderStandardAnimated();\n *\n * <Box twClassName=\"flex-1\">\n * <HeaderStandardAnimated\n * scrollY={scrollY}\n * titleSectionHeight={titleSectionHeightSv}\n * title=\"Market\"\n * onBack={handleBack}\n * />\n * <Animated.ScrollView onScroll={onScroll} scrollEventThrottle={16}>\n * <Box onLayout={(e) => setTitleSectionHeight(e.nativeEvent.layout.height)}>\n * ...first scroll section (layout height drives compact title timing)\n * </Box>\n * {/* page body *\\/}\n * </Animated.ScrollView>\n * </Box>\n * ```\n */\nexport function useHeaderStandardAnimated(): UseHeaderStandardAnimatedReturn {\n const scrollYValue = useSharedValue(0);\n const titleSectionHeightSv = useSharedValue(0);\n\n const setTitleSectionHeight = useCallback(\n (height: number) => {\n titleSectionHeightSv.value = height;\n },\n [titleSectionHeightSv],\n );\n\n const onScroll = useAnimatedScrollHandler({\n onScroll: (scrollEvent) => {\n scrollYValue.value = scrollEvent.contentOffset.y;\n },\n });\n\n return {\n scrollY: scrollYValue,\n titleSectionHeightSv,\n setTitleSectionHeight,\n onScroll,\n };\n}\n"]}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import type { SharedValue } from "react-native-reanimated";
|
|
2
1
|
import type { UseHeaderStandardAnimatedReturn } from "./HeaderStandardAnimated.types.cjs";
|
|
3
|
-
/**
|
|
4
|
-
* Writes a vertical content offset into the scroll shared value.
|
|
5
|
-
*
|
|
6
|
-
* @param scrollYValue - Shared value for vertical scroll offset.
|
|
7
|
-
* @param contentOffsetY - `contentOffset.y` from the scroll event.
|
|
8
|
-
*/
|
|
9
|
-
export declare function updateScrollYFromEvent(scrollYValue: SharedValue<number>, contentOffsetY: number): void;
|
|
10
2
|
/**
|
|
11
3
|
* Hook for managing HeaderStandardAnimated scroll-linked animations.
|
|
12
4
|
* Use with HeaderStandardAnimated placed outside the ScrollView as a sibling.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHeaderStandardAnimated.d.cts","sourceRoot":"","sources":["../../../src/components/HeaderStandardAnimated/useHeaderStandardAnimated.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useHeaderStandardAnimated.d.cts","sourceRoot":"","sources":["../../../src/components/HeaderStandardAnimated/useHeaderStandardAnimated.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,+BAA+B,EAAE,2CAAuC;AAEtF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,yBAAyB,IAAI,+BAA+B,CAuB3E"}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import type { SharedValue } from "react-native-reanimated";
|
|
2
1
|
import type { UseHeaderStandardAnimatedReturn } from "./HeaderStandardAnimated.types.mjs";
|
|
3
|
-
/**
|
|
4
|
-
* Writes a vertical content offset into the scroll shared value.
|
|
5
|
-
*
|
|
6
|
-
* @param scrollYValue - Shared value for vertical scroll offset.
|
|
7
|
-
* @param contentOffsetY - `contentOffset.y` from the scroll event.
|
|
8
|
-
*/
|
|
9
|
-
export declare function updateScrollYFromEvent(scrollYValue: SharedValue<number>, contentOffsetY: number): void;
|
|
10
2
|
/**
|
|
11
3
|
* Hook for managing HeaderStandardAnimated scroll-linked animations.
|
|
12
4
|
* Use with HeaderStandardAnimated placed outside the ScrollView as a sibling.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHeaderStandardAnimated.d.mts","sourceRoot":"","sources":["../../../src/components/HeaderStandardAnimated/useHeaderStandardAnimated.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useHeaderStandardAnimated.d.mts","sourceRoot":"","sources":["../../../src/components/HeaderStandardAnimated/useHeaderStandardAnimated.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,+BAA+B,EAAE,2CAAuC;AAEtF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,yBAAyB,IAAI,+BAA+B,CAuB3E"}
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
// Third party dependencies.
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { useSharedValue, useAnimatedScrollHandler } from "react-native-reanimated";
|
|
4
|
-
/**
|
|
5
|
-
* Writes a vertical content offset into the scroll shared value.
|
|
6
|
-
*
|
|
7
|
-
* @param scrollYValue - Shared value for vertical scroll offset.
|
|
8
|
-
* @param contentOffsetY - `contentOffset.y` from the scroll event.
|
|
9
|
-
*/
|
|
10
|
-
export function updateScrollYFromEvent(scrollYValue, contentOffsetY) {
|
|
11
|
-
scrollYValue.value = contentOffsetY;
|
|
12
|
-
}
|
|
13
4
|
/**
|
|
14
5
|
* Hook for managing HeaderStandardAnimated scroll-linked animations.
|
|
15
6
|
* Use with HeaderStandardAnimated placed outside the ScrollView as a sibling.
|
|
@@ -45,7 +36,9 @@ export function useHeaderStandardAnimated() {
|
|
|
45
36
|
titleSectionHeightSv.value = height;
|
|
46
37
|
}, [titleSectionHeightSv]);
|
|
47
38
|
const onScroll = useAnimatedScrollHandler({
|
|
48
|
-
onScroll: (scrollEvent) =>
|
|
39
|
+
onScroll: (scrollEvent) => {
|
|
40
|
+
scrollYValue.value = scrollEvent.contentOffset.y;
|
|
41
|
+
},
|
|
49
42
|
});
|
|
50
43
|
return {
|
|
51
44
|
scrollY: scrollYValue,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHeaderStandardAnimated.mjs","sourceRoot":"","sources":["../../../src/components/HeaderStandardAnimated/useHeaderStandardAnimated.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,OAAO,EAAE,WAAW,EAAE,cAAc;
|
|
1
|
+
{"version":3,"file":"useHeaderStandardAnimated.mjs","sourceRoot":"","sources":["../../../src/components/HeaderStandardAnimated/useHeaderStandardAnimated.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,OAAO,EAAE,WAAW,EAAE,cAAc;AACpC,OAAO,EACL,cAAc,EACd,wBAAwB,EACzB,gCAAgC;AAKjC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,yBAAyB;IACvC,MAAM,YAAY,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;IACvC,MAAM,oBAAoB,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;IAE/C,MAAM,qBAAqB,GAAG,WAAW,CACvC,CAAC,MAAc,EAAE,EAAE;QACjB,oBAAoB,CAAC,KAAK,GAAG,MAAM,CAAC;IACtC,CAAC,EACD,CAAC,oBAAoB,CAAC,CACvB,CAAC;IAEF,MAAM,QAAQ,GAAG,wBAAwB,CAAC;QACxC,QAAQ,EAAE,CAAC,WAAW,EAAE,EAAE;YACxB,YAAY,CAAC,KAAK,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;QACnD,CAAC;KACF,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,YAAY;QACrB,oBAAoB;QACpB,qBAAqB;QACrB,QAAQ;KACT,CAAC;AACJ,CAAC","sourcesContent":["// Third party dependencies.\nimport { useCallback } from 'react';\nimport {\n useSharedValue,\n useAnimatedScrollHandler,\n} from 'react-native-reanimated';\n\n// Internal dependencies.\nimport type { UseHeaderStandardAnimatedReturn } from './HeaderStandardAnimated.types';\n\n/**\n * Hook for managing HeaderStandardAnimated scroll-linked animations.\n * Use with HeaderStandardAnimated placed outside the ScrollView as a sibling.\n * Use the returned onScroll with Animated.ScrollView for UI-thread scroll updates (zero lag).\n *\n * @returns Object containing scrollY, titleSectionHeightSv, setTitleSectionHeight, and onScroll.\n *\n * @example\n * ```tsx\n * const { scrollY, onScroll, setTitleSectionHeight, titleSectionHeightSv } =\n * useHeaderStandardAnimated();\n *\n * <Box twClassName=\"flex-1\">\n * <HeaderStandardAnimated\n * scrollY={scrollY}\n * titleSectionHeight={titleSectionHeightSv}\n * title=\"Market\"\n * onBack={handleBack}\n * />\n * <Animated.ScrollView onScroll={onScroll} scrollEventThrottle={16}>\n * <Box onLayout={(e) => setTitleSectionHeight(e.nativeEvent.layout.height)}>\n * ...first scroll section (layout height drives compact title timing)\n * </Box>\n * {/* page body *\\/}\n * </Animated.ScrollView>\n * </Box>\n * ```\n */\nexport function useHeaderStandardAnimated(): UseHeaderStandardAnimatedReturn {\n const scrollYValue = useSharedValue(0);\n const titleSectionHeightSv = useSharedValue(0);\n\n const setTitleSectionHeight = useCallback(\n (height: number) => {\n titleSectionHeightSv.value = height;\n },\n [titleSectionHeightSv],\n );\n\n const onScroll = useAnimatedScrollHandler({\n onScroll: (scrollEvent) => {\n scrollYValue.value = scrollEvent.contentOffset.y;\n },\n });\n\n return {\n scrollY: scrollYValue,\n titleSectionHeightSv,\n setTitleSectionHeight,\n onScroll,\n };\n}\n"]}
|
|
@@ -117,6 +117,7 @@ const fingerprint_svg_1 = __importDefault(require("./assets/fingerprint.svg"));
|
|
|
117
117
|
const fire_svg_1 = __importDefault(require("./assets/fire.svg"));
|
|
118
118
|
const first_page_svg_1 = __importDefault(require("./assets/first-page.svg"));
|
|
119
119
|
const flag_svg_1 = __importDefault(require("./assets/flag.svg"));
|
|
120
|
+
const flash_filled_svg_1 = __importDefault(require("./assets/flash-filled.svg"));
|
|
120
121
|
const flash_slash_svg_1 = __importDefault(require("./assets/flash-slash.svg"));
|
|
121
122
|
const flash_svg_1 = __importDefault(require("./assets/flash.svg"));
|
|
122
123
|
const flask_svg_1 = __importDefault(require("./assets/flask.svg"));
|
|
@@ -410,6 +411,7 @@ exports.assetByIconName = {
|
|
|
410
411
|
Fire: fire_svg_1.default,
|
|
411
412
|
FirstPage: first_page_svg_1.default,
|
|
412
413
|
Flag: flag_svg_1.default,
|
|
414
|
+
FlashFilled: flash_filled_svg_1.default,
|
|
413
415
|
FlashSlash: flash_slash_svg_1.default,
|
|
414
416
|
Flash: flash_svg_1.default,
|
|
415
417
|
Flask: flask_svg_1.default,
|