@ankhorage/surface 5.0.1 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +1 -2
- package/dist/components/field/Field.d.ts +1 -0
- package/dist/components/field/Field.d.ts.map +1 -1
- package/dist/components/field/Field.js +5 -4
- package/dist/components/field/Field.js.map +1 -1
- package/dist/components/list-item/ListItem.d.ts +1 -0
- package/dist/components/list-item/ListItem.d.ts.map +1 -1
- package/dist/components/list-item/ListItem.js +13 -12
- package/dist/components/list-item/ListItem.js.map +1 -1
- package/dist/components/switch/Switch.d.ts +1 -0
- package/dist/components/switch/Switch.d.ts.map +1 -1
- package/dist/components/switch/Switch.js +10 -13
- package/dist/components/switch/Switch.js.map +1 -1
- package/dist/{layout → core/responsive}/Show.d.ts +2 -1
- package/dist/core/responsive/Show.d.ts.map +1 -0
- package/dist/{layout → core/responsive}/Show.js +3 -1
- package/dist/core/responsive/Show.js.map +1 -0
- package/dist/core/responsive/index.d.ts +1 -0
- package/dist/core/responsive/index.d.ts.map +1 -1
- package/dist/core/responsive/index.js +1 -0
- package/dist/core/responsive/index.js.map +1 -1
- package/dist/features/app-bar/adapters/inbound/AppBar.d.ts +5 -0
- package/dist/features/app-bar/adapters/inbound/AppBar.d.ts.map +1 -0
- package/dist/features/app-bar/adapters/inbound/AppBar.js +40 -0
- package/dist/features/app-bar/adapters/inbound/AppBar.js.map +1 -0
- package/dist/features/app-bar/public.d.ts +3 -0
- package/dist/features/app-bar/public.d.ts.map +1 -0
- package/dist/features/app-bar/public.js +2 -0
- package/dist/features/app-bar/public.js.map +1 -0
- package/dist/features/badge/adapters/inbound/Badge.js +3 -3
- package/dist/features/badge/adapters/inbound/Badge.js.map +1 -1
- package/dist/features/button/adapters/inbound/Button.js +8 -8
- package/dist/features/button/adapters/inbound/Button.js.map +1 -1
- package/dist/features/button/adapters/inbound/IconButton.js +3 -3
- package/dist/features/button/adapters/inbound/IconButton.js.map +1 -1
- package/dist/features/form/checkbox/adapters/inbound/Checkbox.js +7 -7
- package/dist/features/form/checkbox/adapters/inbound/Checkbox.js.map +1 -1
- package/dist/features/form/radio/adapters/inbound/Radio.js +8 -8
- package/dist/features/form/radio/adapters/inbound/Radio.js.map +1 -1
- package/dist/features/layout/adapters/inbound/Divider.js +2 -2
- package/dist/features/layout/adapters/inbound/Divider.js.map +1 -1
- package/dist/features/layout/adapters/inbound/Grid.d.ts.map +1 -1
- package/dist/features/layout/adapters/inbound/Grid.js +7 -9
- package/dist/features/layout/adapters/inbound/Grid.js.map +1 -1
- package/dist/features/layout/adapters/inbound/ScrollView.d.ts +5 -0
- package/dist/features/layout/adapters/inbound/ScrollView.d.ts.map +1 -0
- package/dist/features/layout/adapters/inbound/ScrollView.js +69 -0
- package/dist/features/layout/adapters/inbound/ScrollView.js.map +1 -0
- package/dist/features/layout/adapters/inbound/View.d.ts +5 -0
- package/dist/features/layout/adapters/inbound/View.d.ts.map +1 -0
- package/dist/features/layout/adapters/inbound/View.js +17 -0
- package/dist/features/layout/adapters/inbound/View.js.map +1 -0
- package/dist/features/layout/public.d.ts +3 -4
- package/dist/features/layout/public.d.ts.map +1 -1
- package/dist/features/layout/public.js +2 -3
- package/dist/features/layout/public.js.map +1 -1
- package/dist/features/modal/adapters/inbound/Modal.d.ts.map +1 -1
- package/dist/features/modal/adapters/inbound/Modal.js +8 -8
- package/dist/features/modal/adapters/inbound/Modal.js.map +1 -1
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.d.ts.map +1 -1
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js +11 -12
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js.map +1 -1
- package/dist/features/surface/adapters/inbound/Surface.d.ts +1 -1
- package/dist/features/surface/adapters/inbound/Surface.d.ts.map +1 -1
- package/dist/features/surface/adapters/inbound/Surface.js +3 -3
- package/dist/features/surface/adapters/inbound/Surface.js.map +1 -1
- package/dist/features/tabs/adapters/inbound/Tab.js +3 -3
- package/dist/features/tabs/adapters/inbound/Tab.js.map +1 -1
- package/dist/features/tabs/adapters/inbound/TabList.d.ts.map +1 -1
- package/dist/features/tabs/adapters/inbound/TabList.js +3 -5
- package/dist/features/tabs/adapters/inbound/TabList.js.map +1 -1
- package/dist/features/tabs/adapters/inbound/Tabs.js +2 -2
- package/dist/features/tabs/adapters/inbound/Tabs.js.map +1 -1
- package/dist/features/toast/adapters/inbound/Toast.js +5 -5
- package/dist/features/toast/adapters/inbound/Toast.js.map +1 -1
- package/dist/features/toast/adapters/inbound/ToastProvider.js +3 -3
- package/dist/features/toast/adapters/inbound/ToastProvider.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/primitives/button-base/ButtonBase.d.ts +1 -0
- package/dist/primitives/button-base/ButtonBase.d.ts.map +1 -1
- package/dist/primitives/button-base/ButtonBase.js +6 -5
- package/dist/primitives/button-base/ButtonBase.js.map +1 -1
- package/dist/primitives/button-base/types.d.ts +2 -2
- package/dist/primitives/button-base/types.d.ts.map +1 -1
- package/dist/primitives/button-base/types.js.map +1 -1
- package/dist/types/app-bar.d.ts +12 -0
- package/dist/types/app-bar.d.ts.map +1 -0
- package/dist/types/app-bar.js +2 -0
- package/dist/types/app-bar.js.map +1 -0
- package/dist/types/layout.d.ts +15 -17
- package/dist/types/layout.d.ts.map +1 -1
- package/dist/types/layout.js.map +1 -1
- package/dist/types/surface.d.ts +2 -2
- package/dist/types/surface.d.ts.map +1 -1
- package/dist/types/surface.js.map +1 -1
- package/dist/utils/resolveViewStyles.d.ts +7 -0
- package/dist/utils/resolveViewStyles.d.ts.map +1 -0
- package/dist/utils/{resolveBoxStyles.js → resolveViewStyles.js} +11 -4
- package/dist/utils/resolveViewStyles.js.map +1 -0
- package/package.json +1 -1
- package/src/components/field/Field.tsx +5 -4
- package/src/components/list-item/ListItem.tsx +17 -13
- package/src/components/switch/Switch.tsx +10 -15
- package/src/{layout → core/responsive}/Show.tsx +4 -1
- package/src/core/responsive/index.ts +1 -0
- package/src/features/app-bar/adapters/inbound/AppBar.tsx +69 -0
- package/src/features/app-bar/public.ts +2 -0
- package/src/features/badge/adapters/inbound/Badge.tsx +3 -3
- package/src/features/button/adapters/inbound/Button.tsx +8 -8
- package/src/features/button/adapters/inbound/IconButton.tsx +3 -3
- package/src/features/form/checkbox/adapters/inbound/Checkbox.tsx +7 -7
- package/src/features/form/radio/adapters/inbound/Radio.tsx +8 -8
- package/src/features/layout/adapters/inbound/Divider.tsx +2 -2
- package/src/features/layout/adapters/inbound/Grid.tsx +12 -14
- package/src/features/layout/adapters/inbound/ScrollView.tsx +102 -0
- package/src/features/layout/adapters/inbound/{Box.tsx → View.tsx} +9 -9
- package/src/features/layout/public.ts +3 -10
- package/src/features/modal/adapters/inbound/Modal.tsx +11 -8
- package/src/features/popover-menu/adapters/inbound/PopoverMenu.tsx +11 -14
- package/src/features/surface/adapters/inbound/Surface.tsx +3 -3
- package/src/features/tabs/adapters/inbound/Tab.tsx +3 -3
- package/src/features/tabs/adapters/inbound/TabList.tsx +3 -6
- package/src/features/tabs/adapters/inbound/Tabs.tsx +2 -2
- package/src/features/toast/adapters/inbound/Toast.tsx +5 -5
- package/src/features/toast/adapters/inbound/ToastProvider.tsx +3 -3
- package/src/index.test.ts +12 -38
- package/src/index.ts +4 -9
- package/src/primitives/button-base/ButtonBase.tsx +6 -8
- package/src/primitives/button-base/types.ts +2 -2
- package/src/types/app-bar.ts +13 -0
- package/src/types/layout.ts +25 -20
- package/src/types/surface.ts +2 -2
- package/src/utils/resolveViewStyles.test.ts +71 -0
- package/src/utils/{resolveBoxStyles.ts → resolveViewStyles.ts} +16 -9
- package/src/webAcceptance.test.tsx +8 -9
- package/dist/features/layout/adapters/inbound/Box.d.ts +0 -5
- package/dist/features/layout/adapters/inbound/Box.d.ts.map +0 -1
- package/dist/features/layout/adapters/inbound/Box.js +0 -17
- package/dist/features/layout/adapters/inbound/Box.js.map +0 -1
- package/dist/features/layout/adapters/inbound/Container.d.ts +0 -5
- package/dist/features/layout/adapters/inbound/Container.d.ts.map +0 -1
- package/dist/features/layout/adapters/inbound/Container.js +0 -28
- package/dist/features/layout/adapters/inbound/Container.js.map +0 -1
- package/dist/features/layout/adapters/inbound/Stack.d.ts +0 -5
- package/dist/features/layout/adapters/inbound/Stack.d.ts.map +0 -1
- package/dist/features/layout/adapters/inbound/Stack.js +0 -27
- package/dist/features/layout/adapters/inbound/Stack.js.map +0 -1
- package/dist/layout/AppBar.d.ts +0 -13
- package/dist/layout/AppBar.d.ts.map +0 -1
- package/dist/layout/AppBar.js +0 -30
- package/dist/layout/AppBar.js.map +0 -1
- package/dist/layout/Center.d.ts +0 -7
- package/dist/layout/Center.d.ts.map +0 -1
- package/dist/layout/Center.js +0 -12
- package/dist/layout/Center.js.map +0 -1
- package/dist/layout/Inline.d.ts +0 -5
- package/dist/layout/Inline.d.ts.map +0 -1
- package/dist/layout/Inline.js +0 -6
- package/dist/layout/Inline.js.map +0 -1
- package/dist/layout/ScrollArea.d.ts +0 -9
- package/dist/layout/ScrollArea.d.ts.map +0 -1
- package/dist/layout/ScrollArea.js +0 -52
- package/dist/layout/ScrollArea.js.map +0 -1
- package/dist/layout/Show.d.ts.map +0 -1
- package/dist/layout/Show.js.map +0 -1
- package/dist/layout/Spacer.d.ts +0 -9
- package/dist/layout/Spacer.d.ts.map +0 -1
- package/dist/layout/Spacer.js +0 -12
- package/dist/layout/Spacer.js.map +0 -1
- package/dist/layout/Template.d.ts +0 -18
- package/dist/layout/Template.d.ts.map +0 -1
- package/dist/layout/Template.js +0 -36
- package/dist/layout/Template.js.map +0 -1
- package/dist/layout/index.d.ts +0 -15
- package/dist/layout/index.d.ts.map +0 -1
- package/dist/layout/index.js +0 -8
- package/dist/layout/index.js.map +0 -1
- package/dist/utils/resolveBoxStyles.d.ts +0 -7
- package/dist/utils/resolveBoxStyles.d.ts.map +0 -1
- package/dist/utils/resolveBoxStyles.js.map +0 -1
- package/src/features/layout/adapters/inbound/Container.tsx +0 -43
- package/src/features/layout/adapters/inbound/Stack.test.ts +0 -13
- package/src/features/layout/adapters/inbound/Stack.tsx +0 -44
- package/src/layout/AppBar.tsx +0 -60
- package/src/layout/Center.tsx +0 -22
- package/src/layout/Inline.tsx +0 -9
- package/src/layout/ScrollArea.tsx +0 -116
- package/src/layout/Spacer.tsx +0 -22
- package/src/layout/Template.tsx +0 -86
- package/src/layout/index.ts +0 -14
- package/src/utils/resolveBoxStyles.test.ts +0 -54
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.js","sourceRoot":"","sources":["../../../src/primitives/button-base/ButtonBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAmC,MAAM,cAAc,CAAC;AAEpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAEL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ButtonBase.js","sourceRoot":"","sources":["../../../src/primitives/button-base/ButtonBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAmC,MAAM,cAAc,CAAC;AAEpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAEL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGlE,kFAAkF;AAClF,SAAS,mBAAmB,CAC1B,cAA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,IAAI,KAAK;gBAAE,UAAU,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC,CAAC,CACF,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CACtD,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CACxD,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAC/C,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CACvC,KAAK,CAAC,CAAC,CAAC,cAAc,EAAE,EAAE;YACxB,MAAM,KAAK,GAAG,mBAAmB,CAAC,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;YAC9E,OAAO;gBACL,kBAAkB;gBAClB,sBAAsB,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC;gBAC1E,KAAK;aACN,CAAC;QACJ,CAAC,CAAC,CACF,MAAM,CAAC,CAAC,MAAM,CAAC,CAEf;MAAA,CAAC,CAAC,cAAc,EAAE,EAAE;YAClB,MAAM,KAAK,GAAG,mBAAmB,CAAC,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;YAC9E,OAAO,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QACrE,CAAC,CACH;IAAA,EAAE,SAAS,CAAC,CACb,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { Platform, Pressable, type PressableStateCallbackType } from 'react-native';\n\nimport { useResponsiveRuntime } from '../../core/responsive';\nimport {\n type InteractionState,\n resolveFocusRingStyles,\n resolveInteractiveState,\n} from '../../internal/resolvers';\nimport { useTheme } from '../../theme/ThemeContext';\nimport { resolveViewStyles } from '../../utils/resolveViewStyles';\nimport type { ButtonBaseProps } from './types';\n\n/*** Resolves one Pressable state into the canonical Surface interaction state. */\nfunction getInteractionState(\n pressableState: PressableStateCallbackType,\n hovered: boolean,\n focused: boolean,\n disabled: boolean,\n): InteractionState {\n return resolveInteractiveState({\n pressed: pressableState.pressed,\n hovered,\n focused,\n disabled,\n });\n}\n\n/*** Renders the low-level token-aware Pressable boundary shared by Surface controls. */\nexport function ButtonBase({\n children,\n disabled = false,\n interactionPolicy = 'enabled',\n onPress,\n onLongPress,\n accessibilityLabel,\n accessibilityRole = 'button',\n accessibilityState,\n style,\n testID,\n ...props\n}: ButtonBaseProps) {\n const { theme } = useTheme();\n const { breakpoint } = useResponsiveRuntime();\n const [hovered, setHovered] = React.useState(false);\n const [focused, setFocused] = React.useState(false);\n const isWeb = Platform.OS === 'web';\n const resolvedViewStyles = resolveViewStyles(theme, breakpoint, props);\n const passive = interactionPolicy === 'passive';\n\n return (\n <Pressable\n accessibilityLabel={accessibilityLabel}\n accessibilityRole={accessibilityRole}\n accessibilityState={{ ...accessibilityState, disabled }}\n disabled={disabled}\n onBlur={() => setFocused(false)}\n onFocus={() => {\n if (isWeb) setFocused(true);\n }}\n onHoverIn={isWeb ? () => setHovered(true) : undefined}\n onHoverOut={isWeb ? () => setHovered(false) : undefined}\n onLongPress={passive ? undefined : onLongPress}\n onPress={passive ? undefined : onPress}\n style={(pressableState) => {\n const state = getInteractionState(pressableState, hovered, focused, disabled);\n return [\n resolvedViewStyles,\n resolveFocusRingStyles(theme.semantics.border.focus, state.focused, isWeb),\n style,\n ];\n }}\n testID={testID}\n >\n {(pressableState) => {\n const state = getInteractionState(pressableState, hovered, focused, disabled);\n return typeof children === 'function' ? children(state) : children;\n }}\n </Pressable>\n );\n}\n"]}
|
|
@@ -2,8 +2,8 @@ import type React from 'react';
|
|
|
2
2
|
import type { AccessibilityRole, AccessibilityState, GestureResponderEvent } from 'react-native';
|
|
3
3
|
import type { InteractionPolicyProps } from '../../interactionPolicy';
|
|
4
4
|
import type { InteractionState } from '../../internal/resolvers/resolveInteractiveState';
|
|
5
|
-
import type {
|
|
6
|
-
export interface ButtonBaseProps extends Omit<
|
|
5
|
+
import type { ViewProps } from '../../types/layout';
|
|
6
|
+
export interface ButtonBaseProps extends Omit<ViewProps, 'children' | 'pointerEvents'>, InteractionPolicyProps {
|
|
7
7
|
children?: React.ReactNode | ((state: InteractionState) => React.ReactNode);
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
onPress?: ((event: GestureResponderEvent) => void) | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/primitives/button-base/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAEjG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AACzF,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/primitives/button-base/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAEjG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AACzF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,eAAe,CAAC,EAAE,sBAAsB;IAC7E,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC/D,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACnE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/primitives/button-base/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { AccessibilityRole, AccessibilityState, GestureResponderEvent } from 'react-native';\n\nimport type { InteractionPolicyProps } from '../../interactionPolicy';\nimport type { InteractionState } from '../../internal/resolvers/resolveInteractiveState';\nimport type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/primitives/button-base/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { AccessibilityRole, AccessibilityState, GestureResponderEvent } from 'react-native';\n\nimport type { InteractionPolicyProps } from '../../interactionPolicy';\nimport type { InteractionState } from '../../internal/resolvers/resolveInteractiveState';\nimport type { ViewProps } from '../../types/layout';\n\nexport interface ButtonBaseProps\n extends Omit<ViewProps, 'children' | 'pointerEvents'>, InteractionPolicyProps {\n children?: React.ReactNode | ((state: InteractionState) => React.ReactNode);\n disabled?: boolean;\n onPress?: ((event: GestureResponderEvent) => void) | undefined;\n onLongPress?: ((event: GestureResponderEvent) => void) | undefined;\n accessibilityLabel?: string;\n accessibilityRole?: AccessibilityRole;\n accessibilityState?: AccessibilityState;\n testID?: string;\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import type { ViewProps } from './layout';
|
|
4
|
+
export interface AppBarProps extends Omit<ViewProps, 'children'> {
|
|
5
|
+
leading?: React.ReactNode;
|
|
6
|
+
trailing?: React.ReactNode;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
safeAreaTop?: boolean;
|
|
9
|
+
divider?: boolean;
|
|
10
|
+
contentStyle?: StyleProp<ViewStyle>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=app-bar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-bar.d.ts","sourceRoot":"","sources":["../../src/types/app-bar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAC9D,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-bar.js","sourceRoot":"","sources":["../../src/types/app-bar.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { StyleProp, ViewStyle } from 'react-native';\n\nimport type { ViewProps } from './layout';\n\nexport interface AppBarProps extends Omit<ViewProps, 'children'> {\n leading?: React.ReactNode;\n trailing?: React.ReactNode;\n children?: React.ReactNode;\n safeAreaTop?: boolean;\n divider?: boolean;\n contentStyle?: StyleProp<ViewStyle>;\n}\n"]}
|
package/dist/types/layout.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { StyleProp, ViewProps as ReactNativeViewProps, ViewStyle } from 'react-native';
|
|
2
|
+
import type { ScrollViewProps as ReactNativeScrollViewProps, StyleProp, ViewProps as ReactNativeViewProps, ViewStyle } from 'react-native';
|
|
3
3
|
import type { Responsive } from '../core/responsive';
|
|
4
4
|
import type { SurfaceTheme } from '../theme/types';
|
|
5
5
|
type SpaceToken = keyof SurfaceTheme['spacing'];
|
|
@@ -8,7 +8,7 @@ type ColorToken = keyof SurfaceTheme['colors'];
|
|
|
8
8
|
type RadiusValue = number | RadiusToken;
|
|
9
9
|
export type SpaceValue = number | SpaceToken;
|
|
10
10
|
export type ColorValue = string | ColorToken;
|
|
11
|
-
export interface
|
|
11
|
+
export interface ViewStyleProps {
|
|
12
12
|
p?: Responsive<SpaceValue>;
|
|
13
13
|
px?: Responsive<SpaceValue>;
|
|
14
14
|
py?: Responsive<SpaceValue>;
|
|
@@ -23,6 +23,9 @@ export interface BoxStyleProps {
|
|
|
23
23
|
mb?: Responsive<SpaceValue>;
|
|
24
24
|
ml?: Responsive<SpaceValue>;
|
|
25
25
|
mr?: Responsive<SpaceValue>;
|
|
26
|
+
gap?: Responsive<SpaceValue>;
|
|
27
|
+
rowGap?: Responsive<SpaceValue>;
|
|
28
|
+
columnGap?: Responsive<SpaceValue>;
|
|
26
29
|
bg?: Responsive<ColorValue>;
|
|
27
30
|
radius?: Responsive<RadiusValue>;
|
|
28
31
|
borderWidth?: Responsive<number>;
|
|
@@ -37,6 +40,10 @@ export interface BoxStyleProps {
|
|
|
37
40
|
flexGrow?: Responsive<number>;
|
|
38
41
|
flexShrink?: Responsive<number>;
|
|
39
42
|
flexBasis?: Responsive<number | string>;
|
|
43
|
+
direction?: Responsive<'row' | 'column'>;
|
|
44
|
+
align?: Responsive<'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline'>;
|
|
45
|
+
justify?: Responsive<'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly'>;
|
|
46
|
+
wrap?: Responsive<'nowrap' | 'wrap'>;
|
|
40
47
|
alignSelf?: Responsive<ViewStyle['alignSelf']>;
|
|
41
48
|
position?: Responsive<ViewStyle['position']>;
|
|
42
49
|
top?: Responsive<number>;
|
|
@@ -48,7 +55,7 @@ export interface BoxStyleProps {
|
|
|
48
55
|
opacity?: Responsive<number>;
|
|
49
56
|
style?: StyleProp<ViewStyle>;
|
|
50
57
|
}
|
|
51
|
-
export interface
|
|
58
|
+
export interface ViewProps extends ViewStyleProps {
|
|
52
59
|
accessibilityLabel?: ReactNativeViewProps['accessibilityLabel'];
|
|
53
60
|
accessibilityRole?: ReactNativeViewProps['accessibilityRole'];
|
|
54
61
|
accessibilityState?: ReactNativeViewProps['accessibilityState'];
|
|
@@ -57,31 +64,22 @@ export interface BoxProps extends BoxStyleProps {
|
|
|
57
64
|
pointerEvents?: ReactNativeViewProps['pointerEvents'];
|
|
58
65
|
testID?: string;
|
|
59
66
|
}
|
|
60
|
-
export interface
|
|
61
|
-
children?: React.ReactNode;
|
|
62
|
-
maxWidth?: Responsive<number>;
|
|
63
|
-
px?: Responsive<number | keyof SurfaceTheme['spacing']>;
|
|
64
|
-
}
|
|
65
|
-
export interface DividerProps extends Omit<BoxProps, 'bg' | 'height' | 'width'> {
|
|
67
|
+
export interface DividerProps extends Omit<ViewProps, 'bg' | 'height' | 'width'> {
|
|
66
68
|
orientation?: 'horizontal' | 'vertical';
|
|
67
69
|
color?: ColorValue;
|
|
68
70
|
thickness?: number;
|
|
69
71
|
}
|
|
70
|
-
export interface GridProps extends Omit<
|
|
72
|
+
export interface GridProps extends Omit<ViewProps, 'children'> {
|
|
71
73
|
children?: React.ReactNode;
|
|
72
|
-
cols
|
|
74
|
+
cols?: Responsive<number>;
|
|
73
75
|
gap?: Responsive<SpaceValue>;
|
|
74
76
|
rowGap?: Responsive<SpaceValue>;
|
|
75
77
|
colGap?: Responsive<SpaceValue>;
|
|
76
78
|
minItemWidth?: Responsive<number>;
|
|
77
79
|
}
|
|
78
|
-
export interface
|
|
80
|
+
export interface ScrollViewProps extends ViewStyleProps, Omit<ReactNativeScrollViewProps, 'children' | 'contentContainerStyle' | 'style'> {
|
|
79
81
|
children?: React.ReactNode;
|
|
80
|
-
|
|
81
|
-
gap?: Responsive<SpaceValue>;
|
|
82
|
-
align?: Responsive<'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline'>;
|
|
83
|
-
justify?: Responsive<'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly'>;
|
|
84
|
-
wrap?: Responsive<'nowrap' | 'wrap'>;
|
|
82
|
+
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
85
83
|
}
|
|
86
84
|
export {};
|
|
87
85
|
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/types/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/types/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EACV,eAAe,IAAI,0BAA0B,EAC7C,SAAS,EACT,SAAS,IAAI,oBAAoB,EACjC,SAAS,EACV,MAAM,cAAc,CAAC;AAEt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I,CAAC,SAAS,EAAE,IAAI,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC9E,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAC5D,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAC1B,GAAG,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,eACf,SACE,cAAc,EACd,IAAI,CAAC,0BAA0B,EAAE,UAAU,GAAG,uBAAuB,GAAG,OAAO,CAAC;IAClF,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,qBAAqB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9C"}
|
package/dist/types/layout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/types/layout.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { StyleProp
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/types/layout.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type {\n ScrollViewProps as ReactNativeScrollViewProps,\n StyleProp,\n ViewProps as ReactNativeViewProps,\n ViewStyle,\n} from 'react-native';\n\nimport type { Responsive } from '../core/responsive';\nimport type { SurfaceTheme } from '../theme/types';\n\ntype SpaceToken = keyof SurfaceTheme['spacing'];\ntype RadiusToken = keyof SurfaceTheme['radii'];\ntype ColorToken = keyof SurfaceTheme['colors'];\ntype RadiusValue = number | RadiusToken;\n\nexport type SpaceValue = number | SpaceToken;\nexport type ColorValue = string | ColorToken;\n\nexport interface ViewStyleProps {\n p?: Responsive<SpaceValue>;\n px?: Responsive<SpaceValue>;\n py?: Responsive<SpaceValue>;\n pt?: Responsive<SpaceValue>;\n pb?: Responsive<SpaceValue>;\n pl?: Responsive<SpaceValue>;\n pr?: Responsive<SpaceValue>;\n m?: Responsive<SpaceValue>;\n mx?: Responsive<SpaceValue>;\n my?: Responsive<SpaceValue>;\n mt?: Responsive<SpaceValue>;\n mb?: Responsive<SpaceValue>;\n ml?: Responsive<SpaceValue>;\n mr?: Responsive<SpaceValue>;\n gap?: Responsive<SpaceValue>;\n rowGap?: Responsive<SpaceValue>;\n columnGap?: Responsive<SpaceValue>;\n bg?: Responsive<ColorValue>;\n radius?: Responsive<RadiusValue>;\n borderWidth?: Responsive<number>;\n borderColor?: Responsive<ColorValue>;\n width?: Responsive<number | string>;\n height?: Responsive<number | string>;\n minWidth?: Responsive<number | string>;\n maxWidth?: Responsive<number | string>;\n minHeight?: Responsive<number | string>;\n maxHeight?: Responsive<number | string>;\n flex?: Responsive<number>;\n flexGrow?: Responsive<number>;\n flexShrink?: Responsive<number>;\n flexBasis?: Responsive<number | string>;\n direction?: Responsive<'row' | 'column'>;\n align?: Responsive<'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline'>;\n justify?: Responsive<\n 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly'\n >;\n wrap?: Responsive<'nowrap' | 'wrap'>;\n alignSelf?: Responsive<ViewStyle['alignSelf']>;\n position?: Responsive<ViewStyle['position']>;\n top?: Responsive<number>;\n bottom?: Responsive<number>;\n left?: Responsive<number>;\n right?: Responsive<number>;\n overflow?: Responsive<ViewStyle['overflow']>;\n zIndex?: Responsive<number>;\n opacity?: Responsive<number>;\n style?: StyleProp<ViewStyle>;\n}\n\nexport interface ViewProps extends ViewStyleProps {\n accessibilityLabel?: ReactNativeViewProps['accessibilityLabel'];\n accessibilityRole?: ReactNativeViewProps['accessibilityRole'];\n accessibilityState?: ReactNativeViewProps['accessibilityState'];\n accessible?: ReactNativeViewProps['accessible'];\n children?: React.ReactNode;\n pointerEvents?: ReactNativeViewProps['pointerEvents'];\n testID?: string;\n}\n\nexport interface DividerProps extends Omit<ViewProps, 'bg' | 'height' | 'width'> {\n orientation?: 'horizontal' | 'vertical';\n color?: ColorValue;\n thickness?: number;\n}\n\nexport interface GridProps extends Omit<ViewProps, 'children'> {\n children?: React.ReactNode;\n cols?: Responsive<number>;\n gap?: Responsive<SpaceValue>;\n rowGap?: Responsive<SpaceValue>;\n colGap?: Responsive<SpaceValue>;\n minItemWidth?: Responsive<number>;\n}\n\nexport interface ScrollViewProps\n extends\n ViewStyleProps,\n Omit<ReactNativeScrollViewProps, 'children' | 'contentContainerStyle' | 'style'> {\n children?: React.ReactNode;\n contentContainerStyle?: StyleProp<ViewStyle>;\n}\n"]}
|
package/dist/types/surface.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ViewProps } from './layout';
|
|
2
2
|
export type SurfaceVariant = 'default' | 'subtle' | 'raised' | 'outline';
|
|
3
|
-
export interface SurfaceProps extends Omit<
|
|
3
|
+
export interface SurfaceProps extends Omit<ViewProps, 'bg' | 'borderColor' | 'borderWidth'> {
|
|
4
4
|
variant?: SurfaceVariant;
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=surface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../../src/types/surface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../../src/types/surface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEzE,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,SAAS,EAAE,IAAI,GAAG,aAAa,GAAG,aAAa,CAAC;IACzF,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface.js","sourceRoot":"","sources":["../../src/types/surface.ts"],"names":[],"mappings":"","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"surface.js","sourceRoot":"","sources":["../../src/types/surface.ts"],"names":[],"mappings":"","sourcesContent":["import type { ViewProps } from './layout';\n\nexport type SurfaceVariant = 'default' | 'subtle' | 'raised' | 'outline';\n\nexport interface SurfaceProps extends Omit<ViewProps, 'bg' | 'borderColor' | 'borderWidth'> {\n variant?: SurfaceVariant;\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ViewStyle } from 'react-native';
|
|
2
|
+
import type { Breakpoint } from '../core/responsive/types';
|
|
3
|
+
import type { SurfaceTheme } from '../theme/types';
|
|
4
|
+
import type { ViewStyleProps } from '../types/layout';
|
|
5
|
+
/*** Resolves responsive Surface View style props into one React Native view style. */
|
|
6
|
+
export declare function resolveViewStyles(theme: SurfaceTheme, breakpoint: Breakpoint, props: ViewStyleProps): ViewStyle;
|
|
7
|
+
//# sourceMappingURL=resolveViewStyles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveViewStyles.d.ts","sourceRoot":"","sources":["../../src/utils/resolveViewStyles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGlE,sFAAsF;AACtF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,cAAc,GACpB,SAAS,CAQX"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { resolveResponsive } from '../core/responsive/resolve';
|
|
2
2
|
import { resolveToken } from '../theme/resolveToken';
|
|
3
3
|
import { resolveSpacing } from './resolveSpacing';
|
|
4
|
-
/*** Resolves responsive
|
|
5
|
-
export function
|
|
4
|
+
/*** Resolves responsive Surface View style props into one React Native view style. */
|
|
5
|
+
export function resolveViewStyles(theme, breakpoint, props) {
|
|
6
6
|
return {
|
|
7
7
|
elevation: 0,
|
|
8
8
|
...resolveSpacingStyles(theme, breakpoint, props),
|
|
@@ -11,7 +11,7 @@ export function resolveBoxStyles(theme, breakpoint, props) {
|
|
|
11
11
|
...resolveLayoutStyles(breakpoint, props),
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
/*** Resolves padding and
|
|
14
|
+
/*** Resolves padding, margin, and gap styles from responsive spacing props. */
|
|
15
15
|
function resolveSpacingStyles(theme, breakpoint, props) {
|
|
16
16
|
return {
|
|
17
17
|
padding: resolveSpacing(theme, resolveResponsive(props.p, breakpoint)),
|
|
@@ -28,6 +28,9 @@ function resolveSpacingStyles(theme, breakpoint, props) {
|
|
|
28
28
|
marginBottom: resolveSpacing(theme, resolveResponsive(props.mb, breakpoint)),
|
|
29
29
|
marginLeft: resolveSpacing(theme, resolveResponsive(props.ml, breakpoint)),
|
|
30
30
|
marginRight: resolveSpacing(theme, resolveResponsive(props.mr, breakpoint)),
|
|
31
|
+
gap: resolveSpacing(theme, resolveResponsive(props.gap, breakpoint)),
|
|
32
|
+
rowGap: resolveSpacing(theme, resolveResponsive(props.rowGap, breakpoint)),
|
|
33
|
+
columnGap: resolveSpacing(theme, resolveResponsive(props.columnGap, breakpoint)),
|
|
31
34
|
};
|
|
32
35
|
}
|
|
33
36
|
/*** Resolves background, radius, and border styles. */
|
|
@@ -57,6 +60,10 @@ function resolveLayoutStyles(breakpoint, props) {
|
|
|
57
60
|
flexGrow: resolveResponsive(props.flexGrow, breakpoint),
|
|
58
61
|
flexShrink: resolveResponsive(props.flexShrink, breakpoint),
|
|
59
62
|
flexBasis: resolveResponsive(props.flexBasis, breakpoint),
|
|
63
|
+
flexDirection: resolveResponsive(props.direction, breakpoint),
|
|
64
|
+
alignItems: resolveResponsive(props.align, breakpoint),
|
|
65
|
+
justifyContent: resolveResponsive(props.justify, breakpoint),
|
|
66
|
+
flexWrap: resolveResponsive(props.wrap, breakpoint),
|
|
60
67
|
alignSelf: resolveResponsive(props.alignSelf, breakpoint),
|
|
61
68
|
position: resolveResponsive(props.position, breakpoint),
|
|
62
69
|
top: resolveResponsive(props.top, breakpoint),
|
|
@@ -80,4 +87,4 @@ function resolveColor(theme, value) {
|
|
|
80
87
|
function resolveDimension(theme, value) {
|
|
81
88
|
return resolveToken(theme.spacing, value);
|
|
82
89
|
}
|
|
83
|
-
//# sourceMappingURL=
|
|
90
|
+
//# sourceMappingURL=resolveViewStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveViewStyles.js","sourceRoot":"","sources":["../../src/utils/resolveViewStyles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,sFAAsF;AACtF,MAAM,UAAU,iBAAiB,CAC/B,KAAmB,EACnB,UAAsB,EACtB,KAAqB;IAErB,OAAO;QACL,SAAS,EAAE,CAAC;QACZ,GAAG,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC;QACjD,GAAG,mBAAmB,CAAC,KAAK,EAAE,UAAU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O,EAAE,UAAU,CAAC;QAC5D,QAAQ,EAAE,iBAAiB,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC;QACnD,SAAS,EAAE,iBAAiB,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC;QACzD,QAAQ,EAAE,iBAAiB,CAAC,KAAK,CAAC,QAAQ,EAAE,UAAU,CAAC;QACvD,GAAG,EAAE,iBAAiB,CAAC,KAAK,CAAC,GAAG,EAAE,UAAU,CAAC;QAC7C,MAAM,EAAE,iBAAiB,CAAC,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC;QACnD,IAAI,EAAE,iBAAiB,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC;QAC/C,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC;QACjD,QAAQ,EAAE,iBAAiB,CAAC,KAAK,CAAC,QAAQ,EAAE,UAAU,CAAC;QACvD,MAAM,EAAE,iBAAiB,CAAC,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC;QACnD,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC;KACtD,CAAC;AACJ,CAAC;AAED,sDAAsD;AACtD,SAAS,aAAa,CACpB,KAAmB,EACnB,KAAuD;IAEvD,OAAO,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC1C,CAAC;AAED,gFAAgF;AAChF,SAAS,YAAY,CAAC,KAAmB,EAAE,KAA6B;IACtE,OAAO,YAAY,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC;AAED,iFAAiF;AACjF,SAAS,gBAAgB,CACvB,KAAmB,EACnB,KAAkC;IAElC,OAAO,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["import type { ViewStyle } from 'react-native';\n\nimport { resolveResponsive } from '../core/responsive/resolve';\nimport type { Breakpoint } from '../core/responsive/types';\nimport { resolveToken } from '../theme/resolveToken';\nimport type { SurfaceTheme } from '../theme/types';\nimport type { ColorValue, ViewStyleProps } from '../types/layout';\nimport { resolveSpacing } from './resolveSpacing';\n\n/*** Resolves responsive Surface View style props into one React Native view style. */\nexport function resolveViewStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: ViewStyleProps,\n): ViewStyle {\n return {\n elevation: 0,\n ...resolveSpacingStyles(theme, breakpoint, props),\n ...resolveVisualStyles(theme, breakpoint, props),\n ...resolveDimensionStyles(theme, breakpoint, props),\n ...resolveLayoutStyles(breakpoint, props),\n };\n}\n\n/*** Resolves padding, margin, and gap styles from responsive spacing props. */\nfunction resolveSpacingStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: ViewStyleProps,\n): ViewStyle {\n return {\n padding: resolveSpacing(theme, resolveResponsive(props.p, breakpoint)),\n paddingHorizontal: resolveSpacing(theme, resolveResponsive(props.px, breakpoint)),\n paddingVertical: resolveSpacing(theme, resolveResponsive(props.py, breakpoint)),\n paddingTop: resolveSpacing(theme, resolveResponsive(props.pt, breakpoint)),\n paddingBottom: resolveSpacing(theme, resolveResponsive(props.pb, breakpoint)),\n paddingLeft: resolveSpacing(theme, resolveResponsive(props.pl, breakpoint)),\n paddingRight: resolveSpacing(theme, resolveResponsive(props.pr, breakpoint)),\n margin: resolveSpacing(theme, resolveResponsive(props.m, breakpoint)),\n marginHorizontal: resolveSpacing(theme, resolveResponsive(props.mx, breakpoint)),\n marginVertical: resolveSpacing(theme, resolveResponsive(props.my, breakpoint)),\n marginTop: resolveSpacing(theme, resolveResponsive(props.mt, breakpoint)),\n marginBottom: resolveSpacing(theme, resolveResponsive(props.mb, breakpoint)),\n marginLeft: resolveSpacing(theme, resolveResponsive(props.ml, breakpoint)),\n marginRight: resolveSpacing(theme, resolveResponsive(props.mr, breakpoint)),\n gap: resolveSpacing(theme, resolveResponsive(props.gap, breakpoint)),\n rowGap: resolveSpacing(theme, resolveResponsive(props.rowGap, breakpoint)),\n columnGap: resolveSpacing(theme, resolveResponsive(props.columnGap, breakpoint)),\n };\n}\n\n/*** Resolves background, radius, and border styles. */\nfunction resolveVisualStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: ViewStyleProps,\n): ViewStyle {\n return {\n backgroundColor: resolveColor(theme, resolveResponsive(props.bg, breakpoint)),\n borderRadius: resolveRadius(theme, resolveResponsive(props.radius, breakpoint)),\n borderWidth: resolveResponsive(props.borderWidth, breakpoint),\n borderColor: resolveColor(theme, resolveResponsive(props.borderColor, breakpoint)),\n };\n}\n\n/*** Resolves responsive dimension props through spacing tokens. */\nfunction resolveDimensionStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: ViewStyleProps,\n): ViewStyle {\n return {\n width: resolveDimension(\n theme,\n resolveResponsive(props.width, breakpoint),\n ) as ViewStyle['width'],\n height: resolveDimension(\n theme,\n resolveResponsive(props.height, breakpoint),\n ) as ViewStyle['height'],\n minWidth: resolveDimension(\n theme,\n resolveResponsive(props.minWidth, breakpoint),\n ) as ViewStyle['minWidth'],\n maxWidth: resolveDimension(\n theme,\n resolveResponsive(props.maxWidth, breakpoint),\n ) as ViewStyle['maxWidth'],\n minHeight: resolveDimension(\n theme,\n resolveResponsive(props.minHeight, breakpoint),\n ) as ViewStyle['minHeight'],\n maxHeight: resolveDimension(\n theme,\n resolveResponsive(props.maxHeight, breakpoint),\n ) as ViewStyle['maxHeight'],\n };\n}\n\n/*** Resolves responsive flex, positioning, and visibility styles. */\nfunction resolveLayoutStyles(breakpoint: Breakpoint, props: ViewStyleProps): ViewStyle {\n return {\n flex: resolveResponsive(props.flex, breakpoint),\n flexGrow: resolveResponsive(props.flexGrow, breakpoint),\n flexShrink: resolveResponsive(props.flexShrink, breakpoint),\n flexBasis: resolveResponsive(props.flexBasis, breakpoint) as ViewStyle['flexBasis'],\n flexDirection: resolveResponsive(props.direction, breakpoint),\n alignItems: resolveResponsive(props.align, breakpoint),\n justifyContent: resolveResponsive(props.justify, breakpoint),\n flexWrap: resolveResponsive(props.wrap, breakpoint),\n alignSelf: resolveResponsive(props.alignSelf, breakpoint),\n position: resolveResponsive(props.position, breakpoint),\n top: resolveResponsive(props.top, breakpoint),\n bottom: resolveResponsive(props.bottom, breakpoint),\n left: resolveResponsive(props.left, breakpoint),\n right: resolveResponsive(props.right, breakpoint),\n overflow: resolveResponsive(props.overflow, breakpoint),\n zIndex: resolveResponsive(props.zIndex, breakpoint),\n opacity: resolveResponsive(props.opacity, breakpoint),\n };\n}\n\n/*** Resolves a Surface radius token or raw number. */\nfunction resolveRadius(\n theme: SurfaceTheme,\n value: number | keyof SurfaceTheme['radii'] | undefined,\n): number | undefined {\n return resolveToken(theme.radii, value);\n}\n\n/*** Resolves a Surface color token while preserving arbitrary color strings. */\nfunction resolveColor(theme: SurfaceTheme, value: ColorValue | undefined): string | undefined {\n return resolveToken(theme.colors, value);\n}\n\n/*** Resolves spacing-token dimensions while preserving raw dimension strings. */\nfunction resolveDimension(\n theme: SurfaceTheme,\n value: number | string | undefined,\n): number | string | undefined {\n return resolveToken(theme.spacing, value);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { View } from '../../features/layout/public';
|
|
4
4
|
import { resolveFieldPresentation, resolveFieldState } from '../../internal/resolvers';
|
|
5
5
|
import { HelperText } from '../helper-text';
|
|
6
6
|
import { Label } from '../label';
|
|
7
7
|
import type { FieldProps } from './types';
|
|
8
8
|
|
|
9
|
+
/*** Composes a label, control, and helper or error message into one field. */
|
|
9
10
|
export function Field({
|
|
10
11
|
children,
|
|
11
12
|
label,
|
|
@@ -26,7 +27,7 @@ export function Field({
|
|
|
26
27
|
const presentation = resolveFieldPresentation(fieldState);
|
|
27
28
|
|
|
28
29
|
return (
|
|
29
|
-
<
|
|
30
|
+
<View gap="xs" testID={testID}>
|
|
30
31
|
{label ? (
|
|
31
32
|
<Label
|
|
32
33
|
color={presentation.labelColor}
|
|
@@ -36,7 +37,7 @@ export function Field({
|
|
|
36
37
|
{label}
|
|
37
38
|
</Label>
|
|
38
39
|
) : null}
|
|
39
|
-
<
|
|
40
|
+
<View>{children}</View>
|
|
40
41
|
{hasErrorText ? (
|
|
41
42
|
<HelperText color={presentation.helperColor} emphasis={presentation.helperEmphasis}>
|
|
42
43
|
{errorText}
|
|
@@ -46,6 +47,6 @@ export function Field({
|
|
|
46
47
|
{helperText}
|
|
47
48
|
</HelperText>
|
|
48
49
|
) : null}
|
|
49
|
-
</
|
|
50
|
+
</View>
|
|
50
51
|
);
|
|
51
52
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
2
|
+
import { View as ReactNativeView } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { View } from '../../features/layout/public';
|
|
5
5
|
import { Text } from '../../features/typography/public';
|
|
6
6
|
import { ButtonBase } from '../../primitives/button-base';
|
|
7
7
|
import { useTheme } from '../../theme/ThemeContext';
|
|
8
8
|
import type { ListItemProps } from './types';
|
|
9
9
|
|
|
10
|
+
/*** Renders the content row shared by static and interactive ListItem variants. */
|
|
10
11
|
function ListItemContent({
|
|
11
12
|
title,
|
|
12
13
|
description,
|
|
@@ -17,7 +18,7 @@ function ListItemContent({
|
|
|
17
18
|
const { theme } = useTheme();
|
|
18
19
|
|
|
19
20
|
return (
|
|
20
|
-
<
|
|
21
|
+
<View
|
|
21
22
|
px="m"
|
|
22
23
|
py="m"
|
|
23
24
|
testID={testID}
|
|
@@ -26,8 +27,10 @@ function ListItemContent({
|
|
|
26
27
|
alignItems: 'center',
|
|
27
28
|
}}
|
|
28
29
|
>
|
|
29
|
-
{leading ?
|
|
30
|
-
|
|
30
|
+
{leading ? (
|
|
31
|
+
<ReactNativeView style={{ marginRight: theme.spacing.m }}>{leading}</ReactNativeView>
|
|
32
|
+
) : null}
|
|
33
|
+
<View flex={1}>
|
|
31
34
|
{title ? (
|
|
32
35
|
<Text numberOfLines={1} variant="body" weight="medium">
|
|
33
36
|
{title}
|
|
@@ -38,23 +41,24 @@ function ListItemContent({
|
|
|
38
41
|
{description}
|
|
39
42
|
</Text>
|
|
40
43
|
) : null}
|
|
41
|
-
</
|
|
42
|
-
{trailing ?
|
|
43
|
-
|
|
44
|
+
</View>
|
|
45
|
+
{trailing ? (
|
|
46
|
+
<ReactNativeView style={{ marginLeft: theme.spacing.m }}>{trailing}</ReactNativeView>
|
|
47
|
+
) : null}
|
|
48
|
+
</View>
|
|
44
49
|
);
|
|
45
50
|
}
|
|
46
51
|
|
|
52
|
+
/*** Renders a static or pressable list item. */
|
|
47
53
|
export function ListItem({ onPress, disabled = false, testID, ...content }: ListItemProps) {
|
|
48
54
|
const { theme } = useTheme();
|
|
49
55
|
|
|
50
|
-
if (!onPress) {
|
|
51
|
-
return <ListItemContent {...content} testID={testID} />;
|
|
52
|
-
}
|
|
56
|
+
if (!onPress) return <ListItemContent {...content} testID={testID} />;
|
|
53
57
|
|
|
54
58
|
return (
|
|
55
59
|
<ButtonBase accessibilityRole="button" disabled={disabled} onPress={onPress} testID={testID}>
|
|
56
60
|
{(state) => (
|
|
57
|
-
<
|
|
61
|
+
<View
|
|
58
62
|
style={{
|
|
59
63
|
backgroundColor: state.pressed
|
|
60
64
|
? theme.semantics.neutral.surfaceActive
|
|
@@ -65,7 +69,7 @@ export function ListItem({ onPress, disabled = false, testID, ...content }: List
|
|
|
65
69
|
}}
|
|
66
70
|
>
|
|
67
71
|
<ListItemContent {...content} />
|
|
68
|
-
</
|
|
72
|
+
</View>
|
|
69
73
|
)}
|
|
70
74
|
</ButtonBase>
|
|
71
75
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { View } from '../../features/layout/public';
|
|
4
4
|
import { Text } from '../../features/typography/public';
|
|
5
5
|
import {
|
|
6
6
|
resolveFieldState,
|
|
@@ -13,6 +13,7 @@ import { ButtonBase } from '../../primitives/button-base';
|
|
|
13
13
|
import { useTheme } from '../../theme/ThemeContext';
|
|
14
14
|
import type { SwitchProps } from './types';
|
|
15
15
|
|
|
16
|
+
/*** Renders a controlled or uncontrolled accessible switch. */
|
|
16
17
|
export function Switch({
|
|
17
18
|
children,
|
|
18
19
|
checked,
|
|
@@ -48,13 +49,7 @@ export function Switch({
|
|
|
48
49
|
accessibilityRole="switch"
|
|
49
50
|
accessibilityState={{ checked: isChecked }}
|
|
50
51
|
disabled={disabled}
|
|
51
|
-
onPress={
|
|
52
|
-
nextChecked === null
|
|
53
|
-
? undefined
|
|
54
|
-
: () => {
|
|
55
|
-
setChecked(nextChecked);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
52
|
+
onPress={nextChecked === null ? undefined : () => setChecked(nextChecked)}
|
|
58
53
|
testID={testID}
|
|
59
54
|
>
|
|
60
55
|
{(interactionState) => {
|
|
@@ -75,14 +70,14 @@ export function Switch({
|
|
|
75
70
|
colors.labelColor === theme.semantics.content.muted ? 'muted' : 'default';
|
|
76
71
|
|
|
77
72
|
return (
|
|
78
|
-
<
|
|
73
|
+
<View
|
|
79
74
|
style={{
|
|
80
75
|
alignItems: 'center',
|
|
81
76
|
flexDirection: 'row',
|
|
82
77
|
opacity: colors.opacity,
|
|
83
78
|
}}
|
|
84
79
|
>
|
|
85
|
-
<
|
|
80
|
+
<View
|
|
86
81
|
radius="full"
|
|
87
82
|
style={{
|
|
88
83
|
backgroundColor: colors.trackColor,
|
|
@@ -95,7 +90,7 @@ export function Switch({
|
|
|
95
90
|
height: indicatorSize.switchHeight,
|
|
96
91
|
}}
|
|
97
92
|
>
|
|
98
|
-
<
|
|
93
|
+
<View
|
|
99
94
|
radius="full"
|
|
100
95
|
style={{
|
|
101
96
|
alignSelf: isChecked ? 'flex-end' : 'flex-start',
|
|
@@ -104,13 +99,13 @@ export function Switch({
|
|
|
104
99
|
width: indicatorSize.switchThumb,
|
|
105
100
|
}}
|
|
106
101
|
/>
|
|
107
|
-
</
|
|
102
|
+
</View>
|
|
108
103
|
{children ? (
|
|
109
|
-
<
|
|
104
|
+
<View ml="s">
|
|
110
105
|
<Text emphasis={labelEmphasis}>{children}</Text>
|
|
111
|
-
</
|
|
106
|
+
</View>
|
|
112
107
|
) : null}
|
|
113
|
-
</
|
|
108
|
+
</View>
|
|
114
109
|
);
|
|
115
110
|
}}
|
|
116
111
|
</ButtonBase>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { resolveResponsive
|
|
3
|
+
import { resolveResponsive } from './resolve';
|
|
4
|
+
import { useResponsiveRuntime } from './ResponsiveProvider';
|
|
5
|
+
import type { Responsive } from './types';
|
|
4
6
|
|
|
5
7
|
export interface ShowProps {
|
|
6
8
|
when: Responsive<boolean>;
|
|
@@ -8,6 +10,7 @@ export interface ShowProps {
|
|
|
8
10
|
fallback?: React.ReactNode;
|
|
9
11
|
}
|
|
10
12
|
|
|
13
|
+
/*** Conditionally renders one responsive subtree or its fallback. */
|
|
11
14
|
export function Show({ when, children, fallback = null }: ShowProps) {
|
|
12
15
|
const { breakpoint } = useResponsiveRuntime();
|
|
13
16
|
const visible = resolveResponsive(when, breakpoint) ?? false;
|
|
@@ -2,5 +2,6 @@ export { BREAKPOINT_ORDER, BREAKPOINTS } from './breakpoints';
|
|
|
2
2
|
export { getBreakpointFromWidth } from './getBreakpointFromWidth';
|
|
3
3
|
export { resolveResponsive } from './resolve';
|
|
4
4
|
export { ResponsiveProvider, useResponsiveRuntime } from './ResponsiveProvider';
|
|
5
|
+
export { Show, type ShowProps } from './Show';
|
|
5
6
|
export type { Breakpoint, Responsive, ResponsiveRuntime } from './types';
|
|
6
7
|
export { useBreakpoint } from './useBreakpoint';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, View as ReactNativeView, type ViewStyle } from 'react-native';
|
|
3
|
+
import { SafeAreaInsetsContext } from 'react-native-safe-area-context';
|
|
4
|
+
|
|
5
|
+
import { useTheme } from '../../../../theme/ThemeContext';
|
|
6
|
+
import type { AppBarProps } from '../../../../types/app-bar';
|
|
7
|
+
import { Divider, View } from '../../../layout/public';
|
|
8
|
+
|
|
9
|
+
/*** Renders application chrome with optional safe-area padding and leading/trailing slots. */
|
|
10
|
+
export function AppBar({
|
|
11
|
+
leading,
|
|
12
|
+
trailing,
|
|
13
|
+
children,
|
|
14
|
+
safeAreaTop = true,
|
|
15
|
+
divider = false,
|
|
16
|
+
contentStyle,
|
|
17
|
+
bg,
|
|
18
|
+
style,
|
|
19
|
+
...props
|
|
20
|
+
}: AppBarProps) {
|
|
21
|
+
const { theme } = useTheme();
|
|
22
|
+
const insets = React.use(SafeAreaInsetsContext);
|
|
23
|
+
const topInset = safeAreaTop ? (insets?.top ?? 0) : 0;
|
|
24
|
+
const safeAreaStyle: ViewStyle | undefined =
|
|
25
|
+
topInset === 0 ? undefined : { paddingTop: topInset };
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<View {...props} bg={bg ?? theme.semantics.surface.default} style={style}>
|
|
29
|
+
<ReactNativeView style={safeAreaStyle}>
|
|
30
|
+
<ReactNativeView
|
|
31
|
+
style={[styles.content, resolveHorizontalPadding(theme.spacing.m), contentStyle]}
|
|
32
|
+
>
|
|
33
|
+
{leading ? (
|
|
34
|
+
<ReactNativeView
|
|
35
|
+
style={[styles.accessory, resolveAccessoryMargin(theme.spacing.s, 'leading')]}
|
|
36
|
+
>
|
|
37
|
+
{leading}
|
|
38
|
+
</ReactNativeView>
|
|
39
|
+
) : null}
|
|
40
|
+
<ReactNativeView style={styles.center}>{children}</ReactNativeView>
|
|
41
|
+
{trailing ? (
|
|
42
|
+
<ReactNativeView
|
|
43
|
+
style={[styles.accessory, resolveAccessoryMargin(theme.spacing.s, 'trailing')]}
|
|
44
|
+
>
|
|
45
|
+
{trailing}
|
|
46
|
+
</ReactNativeView>
|
|
47
|
+
) : null}
|
|
48
|
+
</ReactNativeView>
|
|
49
|
+
{divider ? <Divider color={theme.semantics.neutral.divider} thickness={1} /> : null}
|
|
50
|
+
</ReactNativeView>
|
|
51
|
+
</View>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/*** Resolves dynamic horizontal padding for the AppBar content row. */
|
|
56
|
+
function resolveHorizontalPadding(paddingHorizontal: number): ViewStyle {
|
|
57
|
+
return { paddingHorizontal };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/*** Resolves directional spacing for one AppBar accessory. */
|
|
61
|
+
function resolveAccessoryMargin(spacing: number, position: 'leading' | 'trailing'): ViewStyle {
|
|
62
|
+
return position === 'leading' ? { marginRight: spacing } : { marginLeft: spacing };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const styles = StyleSheet.create({
|
|
66
|
+
accessory: { flexShrink: 0 },
|
|
67
|
+
center: { flex: 1, minWidth: 0 },
|
|
68
|
+
content: { alignItems: 'center', flexDirection: 'row', minHeight: 56 },
|
|
69
|
+
});
|