@ankhorage/surface 9.1.112 → 9.1.113
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 -1
- package/dist/features/button/adapters/inbound/Button.d.ts.map +1 -1
- package/dist/features/button/adapters/inbound/Button.js.map +1 -1
- package/dist/features/form/checkbox/adapters/inbound/Checkbox.d.ts.map +1 -1
- package/dist/features/form/checkbox/adapters/inbound/Checkbox.js.map +1 -1
- package/dist/features/form/radio/adapters/inbound/Radio.js.map +1 -1
- package/dist/features/form/switch/adapters/inbound/Switch.js.map +1 -1
- package/dist/features/pressable/adapters/inbound/Pressable.d.ts.map +1 -1
- package/dist/features/pressable/adapters/inbound/Pressable.js +1 -1
- package/dist/features/pressable/adapters/inbound/Pressable.js.map +1 -1
- package/dist/internal/resolvers/resolveControlSize.d.ts +1 -1
- package/dist/internal/resolvers/resolveControlSize.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveControlSize.js.map +1 -1
- package/dist/internal/resolvers/resolveIconSize.d.ts +1 -1
- package/dist/internal/resolvers/resolveIconSize.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveIconSize.js.map +1 -1
- package/dist/internal/resolvers/resolveIndicatorSize.d.ts +1 -1
- package/dist/internal/resolvers/resolveIndicatorSize.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveIndicatorSize.js.map +1 -1
- package/dist/internal/resolvers/resolveInteractiveColors.d.ts +2 -2
- package/dist/internal/resolvers/resolveInteractiveColors.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveInteractiveColors.js.map +1 -1
- package/dist/internal/resolvers/resolveInteractiveState.d.ts +1 -6
- package/dist/internal/resolvers/resolveInteractiveState.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveInteractiveState.js.map +1 -1
- package/dist/internal/resolvers/resolveTextStyles.d.ts +2 -3
- package/dist/internal/resolvers/resolveTextStyles.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveTextStyles.js.map +1 -1
- package/dist/types/badge.d.ts +2 -2
- package/dist/types/badge.d.ts.map +1 -1
- package/dist/types/badge.js.map +1 -1
- package/dist/types/button.d.ts +2 -2
- package/dist/types/button.d.ts.map +1 -1
- package/dist/types/button.js.map +1 -1
- package/dist/types/checkbox.d.ts +1 -1
- package/dist/types/checkbox.d.ts.map +1 -1
- package/dist/types/checkbox.js.map +1 -1
- package/dist/types/control.d.ts +2 -0
- package/dist/types/control.d.ts.map +1 -0
- package/dist/types/control.js +2 -0
- package/dist/types/control.js.map +1 -0
- package/dist/types/pressable.d.ts +6 -1
- package/dist/types/pressable.d.ts.map +1 -1
- package/dist/types/pressable.js.map +1 -1
- package/dist/types/radio.d.ts +1 -1
- package/dist/types/radio.d.ts.map +1 -1
- package/dist/types/radio.js.map +1 -1
- package/dist/types/switch.d.ts +1 -1
- package/dist/types/switch.d.ts.map +1 -1
- package/dist/types/switch.js.map +1 -1
- package/dist/types/text-input.d.ts +1 -1
- package/dist/types/text-input.d.ts.map +1 -1
- package/dist/types/text-input.js.map +1 -1
- package/dist/types/typography.d.ts +3 -1
- package/dist/types/typography.d.ts.map +1 -1
- package/dist/types/typography.js.map +1 -1
- package/package.json +1 -1
- package/src/features/button/adapters/inbound/Button.tsx +1 -1
- package/src/features/form/checkbox/adapters/inbound/Checkbox.tsx +1 -1
- package/src/features/form/radio/adapters/inbound/Radio.tsx +1 -1
- package/src/features/form/switch/adapters/inbound/Switch.tsx +1 -1
- package/src/features/pressable/adapters/inbound/Pressable.tsx +2 -6
- package/src/internal/resolvers/resolveControlSize.ts +1 -2
- package/src/internal/resolvers/resolveIconSize.ts +2 -1
- package/src/internal/resolvers/resolveIndicatorSize.ts +1 -1
- package/src/internal/resolvers/resolveInteractiveColors.ts +2 -3
- package/src/internal/resolvers/resolveInteractiveState.ts +1 -6
- package/src/internal/resolvers/resolveTextStyles.ts +1 -3
- package/src/types/badge.ts +2 -2
- package/src/types/button.ts +2 -2
- package/src/types/checkbox.ts +1 -1
- package/src/types/control.ts +1 -0
- package/src/types/pressable.ts +7 -1
- package/src/types/radio.ts +1 -1
- package/src/types/switch.ts +1 -1
- package/src/types/text-input.ts +1 -1
- package/src/types/typography.ts +4 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# @ankhorage/surface
|
|
5
5
|
|
|
6
|
-
         
|
|
7
7
|
|
|
8
8
|
Cross-platform UI foundation for React Native and React Native Web. Provides theming, layout primitives, and core building blocks for modern apps.
|
|
9
9
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../../src/features/button/adapters/inbound/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../../src/features/button/adapters/inbound/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAS5D,+EAA+E;AAC/E,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,OAAiB,EACjB,KAAiB,EACjB,IAAU,EACV,QAAgB,EAChB,OAAe,EACf,WAAW,EACX,YAAY,EACZ,SAAiB,EACjB,OAAO,EACP,MAAM,EACN,GAAG,KAAK,EACT,EAAE,WAAW,qBA8Bb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../../src/features/button/adapters/inbound/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,IAAI,IAAI,eAAe,EAAkB,MAAM,cAAc,CAAC;AAE1F,OAAO,
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../../src/features/button/adapters/in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AC/C,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;AAC7D,CAAC;AAED,2DAA2D;AAC3D,SAAS,yBAAyB,CAChC,WAAkD,EAClD,MAA8C,EAC9C,SAAkB,EAClB,OAA4C;IAE5C,OAAO;QACL,UAAU,EAAE,QAAQ;QACpB,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,WAAW,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxC,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,QAAQ;QACxB,SAAS,EAAE,WAAW,CAAC,SAAS;QAChC,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;KACtC,CAAC;AACJ,CAAC;AAED,kEAAkE;AAClE,SAAS,qBAAqB,CAAC,OAAe,EAAE,QAAgC;IAC9E,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;AACrF,CAAC","sourcesContent":["import React from 'react';\nimport { ActivityIndicator, View as ReactNativeView, type ViewStyle } from 'react-native';\n\nimport {\n resolveButtonColors,\n resolveControlSize,\n resolveIconSize,\n} from '../../../../internal/resolvers';\nimport type { ButtonProps } from '../../../../types/button';\nimport type { InteractionState } from '../../../../types/pressable';\nimport type { SurfaceTheme } from '../../../../types/theme';\nimport { Icon } from '../../../icon/public';\nimport { View } from '../../../layout/public';\nimport { Pressable } from '../../../pressable/public';\nimport { useTheme } from '../../../theme/runtime';\nimport { Text } from '../../../typography/public';\n\n/*** Renders the primary Surface action control with semantic visual states. */\nexport function Button({\n children,\n variant = 'solid',\n color = 'primary',\n size = 'm',\n disabled = false,\n loading = false,\n leadingIcon,\n trailingIcon,\n fullWidth = false,\n onPress,\n testID,\n ...props\n}: ButtonProps) {\n const { theme } = useTheme();\n const controlSize = resolveControlSize(theme, size);\n\n return (\n <Pressable\n {...props}\n disabled={disabled || loading}\n onPress={onPress}\n style={resolvePressableStyle(fullWidth)}\n testID={testID}\n >\n {(state) => (\n <ButtonContent\n color={color}\n controlSize={controlSize}\n fullWidth={fullWidth}\n leadingIcon={leadingIcon}\n loading={loading}\n size={size}\n state={state}\n theme={theme}\n trailingIcon={trailingIcon}\n variant={variant}\n >\n {children}\n </ButtonContent>\n )}\n </Pressable>\n );\n}\n\n/*** Renders Button content after interaction colors have been resolved. */\nfunction ButtonContent({\n children,\n color,\n controlSize,\n fullWidth,\n leadingIcon,\n loading,\n size,\n state,\n theme,\n trailingIcon,\n variant,\n}: ButtonContentProps) {\n const colors = resolveButtonColors(theme, { variant, color, state });\n const muted = colors.contentColor === theme.semantics.content.muted;\n const iconSize = resolveIconSize(theme, size);\n\n return (\n <View\n px={controlSize.paddingHorizontal}\n py={controlSize.paddingVertical}\n radius={controlSize.borderRadius}\n style={resolveButtonContentStyle(controlSize, colors, fullWidth, variant)}\n >\n {loading ? (\n <ActivityIndicator color={colors.contentColor} size=\"small\" />\n ) : (\n <>\n {leadingIcon ? (\n <ReactNativeView style={resolveAccessoryStyle(theme.spacing.s, 'leading')}>\n <Icon {...leadingIcon} color={colors.contentColor} size={iconSize} />\n </ReactNativeView>\n ) : null}\n <Text\n color={muted ? undefined : color}\n emphasis={muted ? 'muted' : variant === 'solid' ? 'inverse' : 'default'}\n variant={controlSize.textVariant}\n weight=\"semiBold\"\n >\n {children}\n </Text>\n {trailingIcon ? (\n <ReactNativeView style={resolveAccessoryStyle(theme.spacing.s, 'trailing')}>\n <Icon {...trailingIcon} color={colors.contentColor} size={iconSize} />\n </ReactNativeView>\n ) : null}\n </>\n )}\n </View>\n );\n}\n\n/*** Resolves the outer Pressable layout style. */\nfunction resolvePressableStyle(fullWidth: boolean): ViewStyle {\n return { alignSelf: fullWidth ? 'stretch' : 'flex-start' };\n}\n\n/*** Resolves the themed Button content container style. */\nfunction resolveButtonContentStyle(\n controlSize: ReturnType<typeof resolveControlSize>,\n colors: ReturnType<typeof resolveButtonColors>,\n fullWidth: boolean,\n variant: NonNullable<ButtonProps['variant']>,\n): ViewStyle {\n return {\n alignItems: 'center',\n backgroundColor: colors.backgroundColor,\n borderColor: colors.borderColor,\n borderWidth: variant === 'solid' ? 0 : 1,\n flexDirection: 'row',\n justifyContent: 'center',\n minHeight: controlSize.minHeight,\n opacity: colors.opacity,\n width: fullWidth ? '100%' : undefined,\n };\n}\n\n/*** Resolves spacing around a leading or trailing Button icon. */\nfunction resolveAccessoryStyle(spacing: number, position: 'leading' | 'trailing'): ViewStyle {\n return position === 'leading' ? { marginRight: spacing } : { marginLeft: spacing };\n}\n\ninterface ButtonContentProps {\n children: ButtonProps['children'];\n color: NonNullable<ButtonProps['color']>;\n controlSize: ReturnType<typeof resolveControlSize>;\n fullWidth: boolean;\n leadingIcon: ButtonProps['leadingIcon'];\n loading: boolean;\n size: NonNullable<ButtonProps['size']>;\n state: InteractionState;\n theme: SurfaceTheme;\n trailingIcon: ButtonProps['trailingIcon'];\n variant: NonNullable<ButtonProps['variant']>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../../../src/features/form/checkbox/adapters/inbound/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../../../src/features/form/checkbox/adapters/inbound/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AASnE,iEAAiE;AACjE,wBAAgB,QAAQ,CAAC,EACvB,kBAAkB,EAClB,OAAO,EACP,QAAQ,EACR,KAAiB,EACjB,cAAsB,EACtB,QAAgB,EAChB,OAAe,EACf,eAAe,EACf,QAAgB,EAChB,IAAU,EACV,MAAM,EACN,GAAG,WAAW,EACf,EAAE,aAAa,qBAyBf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../../../../src/features/form/checkbox/adapters/inbound/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../../../../src/features/form/checkbox/adapters/inbound/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,6BAA6B,EAC7B,kCAAkC,GACnC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AAIpF,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,iEAAiE;AACjE,MAAM,UAAU,QAAQ,CAAC,EACvB,kBAAkB,EAClB,OAAO,EACP,QAAQ,EACR,KAAK,GAAG,SAAS,EACjB,cAAc,GAAG,KAAK,EACtB,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK,EACf,eAAe,EACf,QAAQ,GAAG,KAAK,EAChB,IAAI,GAAG,GAAG,EACV,MAAM,EACN,GAAG,WAAW,EACA;IACd,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,oBAAo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B,MAAM,EAAE,IAAI;QACZ,cAAc,EAAE,QAAQ;QACxB,KAAK,EAAE,IAAI;KACZ,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport type { ViewStyle } from 'react-native';\n\nimport {\n resolveFieldState,\n resolveIndicatorSize,\n resolveSelectionControlColors,\n resolveSelectionControlNextChecked,\n} from '../../../../../internal/resolvers';\nimport { useControllableState } from '../../../../../internal/useControllableState';\nimport type { CheckboxProps } from '../../../../../types/checkbox';\nimport type { InteractionState } from '../../../../../types/pressable';\nimport type { SurfaceTheme } from '../../../../../types/theme';\nimport { View } from '../../../../layout/public';\nimport type { PressableProps } from '../../../../pressable/public';\nimport { Pressable } from '../../../../pressable/public';\nimport { useTheme } from '../../../../theme/runtime';\nimport { Text } from '../../../../typography/public';\n\n/*** Renders a controlled or uncontrolled accessible checkbox. */\nexport function Checkbox({\n accessibilityLabel,\n checked,\n children,\n color = 'primary',\n defaultChecked = false,\n disabled = false,\n invalid = false,\n onCheckedChange,\n readOnly = false,\n size = 'm',\n testID,\n ...buttonProps\n}: CheckboxProps) {\n const { theme } = useTheme();\n const [isChecked, setChecked] = useControllableState<boolean>({\n value: checked,\n defaultValue: defaultChecked,\n onChange: onCheckedChange,\n });\n\n return (\n <CheckboxControl\n accessibilityLabel={accessibilityLabel}\n buttonProps={buttonProps}\n color={color}\n disabled={disabled}\n invalid={invalid}\n isChecked={isChecked}\n readOnly={readOnly}\n setChecked={setChecked}\n size={size}\n testID={testID}\n theme={theme}\n >\n {children}\n </CheckboxControl>\n );\n}\n\n/*** Owns the checkbox interaction boundary around resolved selection content. */\nfunction CheckboxControl({\n accessibilityLabel,\n buttonProps,\n children,\n color,\n disabled,\n invalid,\n isChecked,\n readOnly,\n setChecked,\n size,\n testID,\n theme,\n}: CheckboxControlProps) {\n const nextChecked = resolveSelectionControlNextChecked({\n checked: isChecked,\n disabled,\n kind: 'checkbox',\n readOnly,\n });\n\n return (\n <Pressable\n {...buttonProps}\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"checkbox\"\n accessibilityState={{ checked: isChecked }}\n disabled={disabled}\n onPress={nextChecked === null ? undefined : () => setChecked(nextChecked)}\n testID={testID}\n >\n {(interactionState) =>\n renderCheckboxContent({\n children,\n color,\n disabled,\n interactionState,\n invalid,\n isChecked,\n readOnly,\n size,\n theme,\n })\n }\n </Pressable>\n );\n}\n\n/*** Renders the checkbox indicator and optional label for one interaction state. */\nfunction renderCheckboxContent(input: CheckboxContentInput) {\n const { interactionState, theme } = input;\n const fieldState = resolveFieldState({\n disabled: input.disabled,\n focused: interactionState.focused,\n invalid: input.invalid,\n readOnly: input.readOnly,\n });\n const colors = resolveSelectionControlColors(theme, {\n checked: input.isChecked,\n fieldState,\n hovered: interactionState.hovered,\n pressed: interactionState.pressed,\n color: input.color,\n });\n const indicatorSize = resolveIndicatorSize(input.size);\n const labelEmphasis = colors.labelColor === theme.semantics.content.muted ? 'muted' : 'default';\n const indicatorColor = fieldState.invalid ? 'error' : input.color;\n\n return (\n <View style={resolveSelectionRowStyle(colors.opacity)}>\n <View\n radius=\"s\"\n style={resolveCheckboxIndicatorStyle(\n colors.backgroundColor,\n colors.borderColor,\n indicatorSize.checkbox,\n )}\n >\n {input.isChecked ? (\n <Text\n color={input.disabled ? undefined : indicatorColor}\n emphasis={input.disabled ? 'muted' : 'inverse'}\n variant=\"caption\"\n weight=\"bold\"\n >\n ✓\n </Text>\n ) : null}\n </View>\n {input.children ? (\n <View ml=\"s\">\n <Text emphasis={labelEmphasis}>{input.children}</Text>\n </View>\n ) : null}\n </View>\n );\n}\n\n/*** Resolves the horizontal selection-control row style. */\nfunction resolveSelectionRowStyle(opacity: number | undefined): ViewStyle {\n return { alignItems: 'center', flexDirection: 'row', opacity };\n}\n\n/*** Resolves checkbox indicator dimensions and interaction colors. */\nfunction resolveCheckboxIndicatorStyle(\n backgroundColor: string,\n borderColor: string,\n size: number,\n): ViewStyle {\n return {\n alignItems: 'center',\n backgroundColor,\n borderColor,\n borderWidth: 1.5,\n height: size,\n justifyContent: 'center',\n width: size,\n };\n}\n\ninterface CheckboxControlProps {\n accessibilityLabel: CheckboxProps['accessibilityLabel'];\n buttonProps: PressableProps;\n children: CheckboxProps['children'];\n color: NonNullable<CheckboxProps['color']>;\n disabled: boolean;\n invalid: boolean;\n isChecked: boolean;\n readOnly: boolean;\n setChecked: (checked: boolean) => void;\n size: NonNullable<CheckboxProps['size']>;\n testID: CheckboxProps['testID'];\n theme: SurfaceTheme;\n}\n\ninterface CheckboxContentInput {\n children: CheckboxProps['children'];\n color: NonNullable<CheckboxProps['color']>;\n disabled: boolean;\n interactionState: InteractionState;\n invalid: boolean;\n isChecked: boolean;\n readOnly: boolean;\n size: NonNullable<CheckboxProps['size']>;\n theme: SurfaceTheme;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","sourceRoot":"","sources":["../../../../../../src/features/form/radio/adapters/inbound/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAEL,iBAAiB,EACjB,oBAAoB,EACpB,6BAA6B,EAC7B,kCAAkC,GACnC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AAGpF,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,mFAAmF;AACnF,MAAM,UAAU,KAAK,CAAC,EACpB,kBAAkB,EAClB,OAAO,EACP,QAAQ,EACR,KAAK,GAAG,SAAS,EACjB,cAAc,GAAG,KAAK,EACtB,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAA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E,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AACjE,CAAC;AAED,mEAAmE;AACnE,SAAS,0BAA0B,CACjC,eAAuB,EACvB,WAAmB,EACnB,IAAY;IAEZ,OAAO;QACL,UAAU,EAAE,QAAQ;QACpB,eAAe;QACf,WAAW;QACX,WAAW,EAAE,GAAG;QAChB,MAAM,EAAE,IAAI;QACZ,cAAc,EAAE,QAAQ;QACxB,KAAK,EAAE,IAAI;KACZ,CAAC;AACJ,CAAC;AAED,6CAA6C;AAC7C,SAAS,oBAAoB,CAAC,eAAuB,EAAE,IAAY;IACjE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACxD,CAAC","sourcesContent":["import React from 'react';\nimport type { ViewStyle } from 'react-native';\n\nimport {\n type InteractionState,\n resolveFieldState,\n resolveIndicatorSize,\n resolveSelectionControlColors,\n resolveSelectionControlNextChecked,\n} from '../../../../../internal/resolvers';\nimport { useControllableState } from '../../../../../internal/useControllableState';\nimport type { RadioProps } from '../../../../../types/radio';\nimport type { SurfaceTheme } from '../../../../../types/theme';\nimport { View } from '../../../../layout/public';\nimport type { PressableProps } from '../../../../pressable/public';\nimport { Pressable } from '../../../../pressable/public';\nimport { useTheme } from '../../../../theme/runtime';\nimport { Text } from '../../../../typography/public';\nimport { isRadioTextContent } from '../../utils/isRadioTextContent';\n\n/*** Renders one accessible radio control with text or structured label content. */\nexport function Radio({\n accessibilityLabel,\n checked,\n children,\n color = 'primary',\n defaultChecked = false,\n disabled = false,\n invalid = false,\n onCheckedChange,\n readOnly = false,\n size = 'm',\n testID,\n ...buttonProps\n}: RadioProps) {\n const { theme } = useTheme();\n const [isChecked, setChecked] = useControllableState<boolean>({\n value: checked,\n defaultValue: defaultChecked,\n onChange: onCheckedChange,\n });\n\n return (\n <RadioControl\n accessibilityLabel={accessibilityLabel}\n buttonProps={buttonProps}\n color={color}\n disabled={disabled}\n invalid={invalid}\n isChecked={isChecked}\n readOnly={readOnly}\n setChecked={setChecked}\n size={size}\n testID={testID}\n theme={theme}\n >\n {children}\n </RadioControl>\n );\n}\n\n/*** Owns the radio interaction boundary around resolved selection content. */\nfunction RadioControl({\n accessibilityLabel,\n buttonProps,\n children,\n color,\n disabled,\n invalid,\n isChecked,\n readOnly,\n setChecked,\n size,\n testID,\n theme,\n}: RadioControlProps) {\n const nextChecked = resolveSelectionControlNextChecked({\n checked: isChecked,\n disabled,\n kind: 'radio',\n readOnly,\n });\n\n return (\n <Pressable\n {...buttonProps}\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"radio\"\n accessibilityState={{ checked: isChecked }}\n disabled={disabled}\n onPress={nextChecked === null ? undefined : () => setChecked(nextChecked)}\n testID={testID}\n >\n {(interactionState) =>\n renderRadioContent({\n children,\n color,\n disabled,\n interactionState,\n invalid,\n isChecked,\n readOnly,\n size,\n theme,\n })\n }\n </Pressable>\n );\n}\n\n/*** Renders the radio indicator and optional content for one interaction state. */\nfunction renderRadioContent(input: RadioContentInput) {\n const { interactionState, theme } = input;\n const fieldState = resolveFieldState({\n disabled: input.disabled,\n focused: interactionState.focused,\n invalid: input.invalid,\n readOnly: input.readOnly,\n });\n const colors = resolveSelectionControlColors(theme, {\n checked: input.isChecked,\n fieldState,\n hovered: interactionState.hovered,\n pressed: interactionState.pressed,\n color: input.color,\n });\n const indicatorSize = resolveIndicatorSize(input.size);\n const labelEmphasis = colors.labelColor === theme.semantics.content.muted ? 'muted' : 'default';\n const hasContent =\n input.children !== undefined && input.children !== null && input.children !== false;\n\n return (\n <View style={resolveSelectionRowStyle(colors.opacity)}>\n <View\n radius=\"full\"\n style={resolveRadioIndicatorStyle(\n colors.backgroundColor,\n colors.borderColor,\n indicatorSize.radio,\n )}\n >\n {input.isChecked ? (\n <View\n radius=\"full\"\n style={resolveRadioDotStyle(colors.indicatorColor, indicatorSize.radioDot)}\n />\n ) : null}\n </View>\n {hasContent ? (\n <View flex={1} ml=\"s\">\n {isRadioTextContent(input.children) ? (\n <Text emphasis={labelEmphasis}>{input.children}</Text>\n ) : (\n input.children\n )}\n </View>\n ) : null}\n </View>\n );\n}\n\n/*** Resolves the horizontal selection-control row style. */\nfunction resolveSelectionRowStyle(opacity: number | undefined): ViewStyle {\n return { alignItems: 'center', flexDirection: 'row', opacity };\n}\n\n/*** Resolves radio indicator dimensions and interaction colors. */\nfunction resolveRadioIndicatorStyle(\n backgroundColor: string,\n borderColor: string,\n size: number,\n): ViewStyle {\n return {\n alignItems: 'center',\n backgroundColor,\n borderColor,\n borderWidth: 1.5,\n height: size,\n justifyContent: 'center',\n width: size,\n };\n}\n\n/*** Resolves the checked radio dot style. */\nfunction resolveRadioDotStyle(backgroundColor: string, size: number): ViewStyle {\n return { backgroundColor, height: size, width: size };\n}\n\ninterface RadioControlProps {\n accessibilityLabel: RadioProps['accessibilityLabel'];\n buttonProps: PressableProps;\n children: RadioProps['children'];\n color: NonNullable<RadioProps['color']>;\n disabled: boolean;\n invalid: boolean;\n isChecked: boolean;\n readOnly: boolean;\n setChecked: (checked: boolean) => void;\n size: NonNullable<RadioProps['size']>;\n testID: RadioProps['testID'];\n theme: SurfaceTheme;\n}\n\ninterface RadioContentInput {\n children: RadioProps['children'];\n color: NonNullable<RadioProps['color']>;\n disabled: boolean;\n interactionState: InteractionState;\n invalid: boolean;\n isChecked: boolean;\n readOnly: boolean;\n size: NonNullable<RadioProps['size']>;\n theme: SurfaceTheme;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Radio.js","sourceRoot":"","sources":["../../../../../../src/features/form/radio/adapters/inbound/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,6BAA6B,EAC7B,kCAAkC,GACnC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AAIpF,OAAO,EAAE,IAAI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AAC,kBAAkB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CACpC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CACvD,CAAC,CAAC,CAAC,CACF,KAAK,CAAC,QAAQ,CACf,CACH;QAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,IAAI,CACV;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC;AAED,4DAA4D;AAC5D,SAAS,wBAAwB,CAAC,OAA2B;IAC3D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AACjE,CAAC;AAED,mEAAmE;AACnE,SAAS,0BAA0B,CACjC,eAAuB,EACvB,WAAmB,EACnB,IAAY;IAEZ,OAAO;QACL,UAAU,EAAE,QAAQ;QACpB,eAAe;QACf,WAAW;QACX,WAAW,EAAE,GAAG;QAChB,MAAM,EAAE,IAAI;QACZ,cAAc,EAAE,QAAQ;QACxB,KAAK,EAAE,IAAI;KACZ,CAAC;AACJ,CAAC;AAED,6CAA6C;AAC7C,SAAS,oBAAoB,CAAC,eAAuB,EAAE,IAAY;IACjE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACxD,CAAC","sourcesContent":["import React from 'react';\nimport type { ViewStyle } from 'react-native';\n\nimport {\n resolveFieldState,\n resolveIndicatorSize,\n resolveSelectionControlColors,\n resolveSelectionControlNextChecked,\n} from '../../../../../internal/resolvers';\nimport { useControllableState } from '../../../../../internal/useControllableState';\nimport type { InteractionState } from '../../../../../types/pressable';\nimport type { RadioProps } from '../../../../../types/radio';\nimport type { SurfaceTheme } from '../../../../../types/theme';\nimport { View } from '../../../../layout/public';\nimport type { PressableProps } from '../../../../pressable/public';\nimport { Pressable } from '../../../../pressable/public';\nimport { useTheme } from '../../../../theme/runtime';\nimport { Text } from '../../../../typography/public';\nimport { isRadioTextContent } from '../../utils/isRadioTextContent';\n\n/*** Renders one accessible radio control with text or structured label content. */\nexport function Radio({\n accessibilityLabel,\n checked,\n children,\n color = 'primary',\n defaultChecked = false,\n disabled = false,\n invalid = false,\n onCheckedChange,\n readOnly = false,\n size = 'm',\n testID,\n ...buttonProps\n}: RadioProps) {\n const { theme } = useTheme();\n const [isChecked, setChecked] = useControllableState<boolean>({\n value: checked,\n defaultValue: defaultChecked,\n onChange: onCheckedChange,\n });\n\n return (\n <RadioControl\n accessibilityLabel={accessibilityLabel}\n buttonProps={buttonProps}\n color={color}\n disabled={disabled}\n invalid={invalid}\n isChecked={isChecked}\n readOnly={readOnly}\n setChecked={setChecked}\n size={size}\n testID={testID}\n theme={theme}\n >\n {children}\n </RadioControl>\n );\n}\n\n/*** Owns the radio interaction boundary around resolved selection content. */\nfunction RadioControl({\n accessibilityLabel,\n buttonProps,\n children,\n color,\n disabled,\n invalid,\n isChecked,\n readOnly,\n setChecked,\n size,\n testID,\n theme,\n}: RadioControlProps) {\n const nextChecked = resolveSelectionControlNextChecked({\n checked: isChecked,\n disabled,\n kind: 'radio',\n readOnly,\n });\n\n return (\n <Pressable\n {...buttonProps}\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"radio\"\n accessibilityState={{ checked: isChecked }}\n disabled={disabled}\n onPress={nextChecked === null ? undefined : () => setChecked(nextChecked)}\n testID={testID}\n >\n {(interactionState) =>\n renderRadioContent({\n children,\n color,\n disabled,\n interactionState,\n invalid,\n isChecked,\n readOnly,\n size,\n theme,\n })\n }\n </Pressable>\n );\n}\n\n/*** Renders the radio indicator and optional content for one interaction state. */\nfunction renderRadioContent(input: RadioContentInput) {\n const { interactionState, theme } = input;\n const fieldState = resolveFieldState({\n disabled: input.disabled,\n focused: interactionState.focused,\n invalid: input.invalid,\n readOnly: input.readOnly,\n });\n const colors = resolveSelectionControlColors(theme, {\n checked: input.isChecked,\n fieldState,\n hovered: interactionState.hovered,\n pressed: interactionState.pressed,\n color: input.color,\n });\n const indicatorSize = resolveIndicatorSize(input.size);\n const labelEmphasis = colors.labelColor === theme.semantics.content.muted ? 'muted' : 'default';\n const hasContent =\n input.children !== undefined && input.children !== null && input.children !== false;\n\n return (\n <View style={resolveSelectionRowStyle(colors.opacity)}>\n <View\n radius=\"full\"\n style={resolveRadioIndicatorStyle(\n colors.backgroundColor,\n colors.borderColor,\n indicatorSize.radio,\n )}\n >\n {input.isChecked ? (\n <View\n radius=\"full\"\n style={resolveRadioDotStyle(colors.indicatorColor, indicatorSize.radioDot)}\n />\n ) : null}\n </View>\n {hasContent ? (\n <View flex={1} ml=\"s\">\n {isRadioTextContent(input.children) ? (\n <Text emphasis={labelEmphasis}>{input.children}</Text>\n ) : (\n input.children\n )}\n </View>\n ) : null}\n </View>\n );\n}\n\n/*** Resolves the horizontal selection-control row style. */\nfunction resolveSelectionRowStyle(opacity: number | undefined): ViewStyle {\n return { alignItems: 'center', flexDirection: 'row', opacity };\n}\n\n/*** Resolves radio indicator dimensions and interaction colors. */\nfunction resolveRadioIndicatorStyle(\n backgroundColor: string,\n borderColor: string,\n size: number,\n): ViewStyle {\n return {\n alignItems: 'center',\n backgroundColor,\n borderColor,\n borderWidth: 1.5,\n height: size,\n justifyContent: 'center',\n width: size,\n };\n}\n\n/*** Resolves the checked radio dot style. */\nfunction resolveRadioDotStyle(backgroundColor: string, size: number): ViewStyle {\n return { backgroundColor, height: size, width: size };\n}\n\ninterface RadioControlProps {\n accessibilityLabel: RadioProps['accessibilityLabel'];\n buttonProps: PressableProps;\n children: RadioProps['children'];\n color: NonNullable<RadioProps['color']>;\n disabled: boolean;\n invalid: boolean;\n isChecked: boolean;\n readOnly: boolean;\n setChecked: (checked: boolean) => void;\n size: NonNullable<RadioProps['size']>;\n testID: RadioProps['testID'];\n theme: SurfaceTheme;\n}\n\ninterface RadioContentInput {\n children: RadioProps['children'];\n color: NonNullable<RadioProps['color']>;\n disabled: boolean;\n interactionState: InteractionState;\n invalid: boolean;\n isChecked: boolean;\n readOnly: boolean;\n size: NonNullable<RadioProps['size']>;\n theme: SurfaceTheme;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.js","sourceRoot":"","sources":["../../../../../../src/features/form/switch/adapters/inbound/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,
|
|
1
|
+
{"version":3,"file":"Switch.js","sourceRoot":"","sources":["../../../../../../src/features/form/switch/adapters/inbound/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,6BAA6B,EAC7B,kCAAkC,GACnC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AAGpF,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,+DAA+D;AAC/D,MAAM,UAAU,MAAM,CAAC,EACrB,QAAQ,EACR,OAAO,EACP,cAAc,GAAG,KAAK,EACtB,eAAe,EACf,KAAK,GAAG,SAAS,EACjB,IAAI,GAAG,GAAG,EACV,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,kBAAkB,EAClB,MAAM,EACN,GAAG,KAAK,EACI;IACZ,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,oBAAoB,CAAU;QAC5D,KAAK,EAAE,OAAO;QACd,YAAY,EAAE,cAAc;QAC5B,QA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CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,IAAI,CACvD;QAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,IAAI,CACV;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport {\n resolveFieldState,\n resolveIndicatorSize,\n resolveSelectionControlColors,\n resolveSelectionControlNextChecked,\n} from '../../../../../internal/resolvers';\nimport { useControllableState } from '../../../../../internal/useControllableState';\nimport type { InteractionState } from '../../../../../types/pressable';\nimport type { SwitchProps } from '../../../../../types/switch';\nimport { View } from '../../../../layout/public';\nimport { Pressable } from '../../../../pressable/public';\nimport { useTheme } from '../../../../theme/runtime';\nimport { Text } from '../../../../typography/public';\n\n/*** Renders a controlled or uncontrolled accessible switch. */\nexport function Switch({\n children,\n checked,\n defaultChecked = false,\n onCheckedChange,\n color = 'primary',\n size = 'm',\n disabled = false,\n invalid = false,\n readOnly = false,\n accessibilityLabel,\n testID,\n ...props\n}: SwitchProps) {\n const { theme } = useTheme();\n const [isChecked, setChecked] = useControllableState<boolean>({\n value: checked,\n defaultValue: defaultChecked,\n onChange: onCheckedChange,\n });\n const nextChecked = resolveSelectionControlNextChecked({\n checked: isChecked,\n disabled,\n kind: 'switch',\n readOnly,\n });\n\n return (\n <Pressable\n {...props}\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"switch\"\n accessibilityState={{ checked: isChecked }}\n disabled={disabled}\n onPress={nextChecked === null ? undefined : () => setChecked(nextChecked)}\n testID={testID}\n >\n {(interactionState) =>\n renderSwitchContent(\n { children, color, disabled, invalid, isChecked, readOnly, size, theme },\n interactionState,\n )\n }\n </Pressable>\n );\n}\n\ninterface SwitchContentInput {\n children: React.ReactNode;\n color: NonNullable<SwitchProps['color']>;\n disabled: boolean;\n invalid: boolean;\n isChecked: boolean;\n readOnly: boolean;\n size: NonNullable<SwitchProps['size']>;\n theme: ReturnType<typeof useTheme>['theme'];\n}\n\n/*** Resolves switch presentation for one interaction state and renders the visual control. */\nfunction renderSwitchContent(input: SwitchContentInput, interactionState: InteractionState) {\n const fieldState = resolveFieldState({\n disabled: input.disabled,\n focused: interactionState.focused,\n invalid: input.invalid,\n readOnly: input.readOnly,\n });\n const colors = resolveSelectionControlColors(input.theme, {\n checked: input.isChecked,\n fieldState,\n hovered: interactionState.hovered,\n pressed: interactionState.pressed,\n color: input.color,\n });\n const indicatorSize = resolveIndicatorSize(input.size);\n const labelEmphasis =\n colors.labelColor === input.theme.semantics.content.muted ? 'muted' : 'default';\n\n return (\n <View align=\"center\" direction=\"row\" opacity={colors.opacity}>\n <View\n bg={colors.trackColor}\n borderColor={colors.borderColor}\n borderWidth={1}\n height={indicatorSize.switchHeight}\n justify=\"center\"\n minWidth={indicatorSize.switchWidth}\n px={2}\n radius=\"full\"\n width={indicatorSize.switchWidth}\n >\n <View\n alignSelf={input.isChecked ? 'flex-end' : 'flex-start'}\n bg={colors.thumbColor}\n height={indicatorSize.switchThumb}\n radius=\"full\"\n width={indicatorSize.switchThumb}\n />\n </View>\n {input.children ? (\n <View ml=\"s\">\n <Text emphasis={labelEmphasis}>{input.children}</Text>\n </View>\n ) : null}\n </View>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pressable.d.ts","sourceRoot":"","sources":["../../../../../src/features/pressable/adapters/inbound/Pressable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Pressable.d.ts","sourceRoot":"","sources":["../../../../../src/features/pressable/adapters/inbound/Pressable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAAoB,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAIpF,2EAA2E;AAC3E,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,QAAgB,EAChB,iBAA6B,EAC7B,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,iBAA4B,EAC5B,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,GAAG,KAAK,EACT,EAAE,cAAc,qBAsChB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Platform, Pressable as ReactNativePressable, } from 'react-native';
|
|
3
3
|
import { useResponsiveRuntime } from '../../../../core/responsive';
|
|
4
|
-
import { resolveFocusRingStyles, resolveInteractiveState
|
|
4
|
+
import { resolveFocusRingStyles, resolveInteractiveState } from '../../../../internal/resolvers';
|
|
5
5
|
import { resolveViewStyles } from '../../../../utils/resolveViewStyles';
|
|
6
6
|
import { useTheme } from '../../../theme/runtime';
|
|
7
7
|
/*** Renders the token-aware Surface adapter for React Native Pressable. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pressable.js","sourceRoot":"","sources":["../../../../../src/features/pressable/adapters/inbound/Pressable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,QAAQ,EACR,SAAS,IAAI,oBAAoB,GAElC,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,
|
|
1
|
+
{"version":3,"file":"Pressable.js","sourceRoot":"","sources":["../../../../../src/features/pressable/adapters/inbound/Pressable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,QAAQ,EACR,SAAS,IAAI,oBAAoB,GAElC,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM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,uBAAuB,CAAC;QAC7B,OAAO,EAAE,cAAc,CAAC,OAAO;QAC/B,OAAO;QACP,OAAO;QACP,QAAQ;KACT,CAAC,CAAC;AACL,CAAC","sourcesContent":["import React from 'react';\nimport {\n Platform,\n Pressable as ReactNativePressable,\n type PressableStateCallbackType,\n} from 'react-native';\n\nimport { useResponsiveRuntime } from '../../../../core/responsive';\nimport { resolveFocusRingStyles, resolveInteractiveState } from '../../../../internal/resolvers';\nimport type { InteractionState, PressableProps } from '../../../../types/pressable';\nimport { resolveViewStyles } from '../../../../utils/resolveViewStyles';\nimport { useTheme } from '../../../theme/runtime';\n\n/*** Renders the token-aware Surface adapter for React Native Pressable. */\nexport function Pressable({\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}: PressableProps) {\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 pressHandlers = resolvePressHandlers(interactionPolicy, onPress, onLongPress);\n\n return (\n <ReactNativePressable\n {...pressHandlers}\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 style={(pressableState) => {\n const state = resolveInteractionState(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 = resolveInteractionState(pressableState, hovered, focused, disabled);\n return typeof children === 'function' ? children(state) : children;\n }}\n </ReactNativePressable>\n );\n}\n\n/*** Resolves press handlers according to the shared interaction policy. */\nfunction resolvePressHandlers(\n interactionPolicy: PressableProps['interactionPolicy'],\n onPress: PressableProps['onPress'],\n onLongPress: PressableProps['onLongPress'],\n) {\n return interactionPolicy === 'passive'\n ? { onLongPress: undefined, onPress: undefined }\n : { onLongPress, onPress };\n}\n\n/*** Resolves one native Pressable state into the canonical Surface interaction state. */\nfunction resolveInteractionState(\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveControlSize.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveControlSize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"resolveControlSize.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveControlSize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,WAAW,GAAG,MAAM,CAAC;IAClC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,EACnB,IAAI,GAAE,WAAiB,GACtB,mBAAmB,CA+BrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveControlSize.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveControlSize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolveControlSize.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveControlSize.ts"],"names":[],"mappings":"AAYA,MAAM,UAAU,kBAAkB,CAChC,KAAmB,EACnB,OAAoB,GAAG;IAEvB,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,GAAG;YACN,OAAO;gBACL,SAAS,EAAE,EAAE;gBACb,iBAAiB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;gBAClC,eAAe,EAAE,CAAC;gBAClB,YAAY,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;gBAC3B,WAAW,EAAE,WAAW;gBACxB,QAAQ,EAAE,EAAE;aACb,CAAC;QACJ,KAAK,GAAG;YACN,OAAO;gBACL,SAAS,EAAE,EAAE;gBACb,iBAAiB,EAAE,EAAE;gBACrB,eAAe,EAAE,EAAE;gBACnB,YAAY,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;gBAC3B,WAAW,EAAE,MAAM;gBACnB,QAAQ,EAAE,EAAE;aACb,CAAC;QACJ,KAAK,GAAG,CAAC;QACT;YACE,OAAO;gBACL,SAAS,EAAE,EAAE;gBACb,iBAAiB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;gBAClC,eAAe,EAAE,CAAC;gBAClB,YAAY,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;gBAC3B,WAAW,EAAE,MAAM;gBACnB,QAAQ,EAAE,EAAE;aACb,CAAC;IACN,CAAC;AACH,CAAC","sourcesContent":["import type { ControlSize } from '../../types/control';\nimport type { SurfaceTheme } from '../../types/theme';\n\nexport interface ResolvedControlSize {\n minHeight: number;\n paddingHorizontal: number;\n paddingVertical: number;\n borderRadius: number;\n textVariant: 'bodySmall' | 'body';\n iconSize: number;\n}\n\nexport function resolveControlSize(\n theme: SurfaceTheme,\n size: ControlSize = 'm',\n): ResolvedControlSize {\n switch (size) {\n case 's':\n return {\n minHeight: 32,\n paddingHorizontal: theme.spacing.s,\n paddingVertical: 6,\n borderRadius: theme.radii.m,\n textVariant: 'bodySmall',\n iconSize: 16,\n };\n case 'l':\n return {\n minHeight: 48,\n paddingHorizontal: 20,\n paddingVertical: 10,\n borderRadius: theme.radii.l,\n textVariant: 'body',\n iconSize: 20,\n };\n case 'm':\n default:\n return {\n minHeight: 40,\n paddingHorizontal: theme.spacing.m,\n paddingVertical: 8,\n borderRadius: theme.radii.m,\n textVariant: 'body',\n iconSize: 18,\n };\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import type { ControlSize } from '../../types/control';
|
|
1
2
|
import type { SurfaceTheme } from '../../types/theme';
|
|
2
|
-
import { type ControlSize } from './resolveControlSize';
|
|
3
3
|
export declare function resolveIconSize(theme: SurfaceTheme, size?: ControlSize): number;
|
|
4
4
|
//# sourceMappingURL=resolveIconSize.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveIconSize.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveIconSize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"resolveIconSize.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveIconSize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,GAAE,WAAiB,GAAG,MAAM,CAEpF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveIconSize.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveIconSize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolveIconSize.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveIconSize.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,UAAU,eAAe,CAAC,KAAmB,EAAE,OAAoB,GAAG;IAC1E,OAAO,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC;AAClD,CAAC","sourcesContent":["import type { ControlSize } from '../../types/control';\nimport type { SurfaceTheme } from '../../types/theme';\nimport { resolveControlSize } from './resolveControlSize';\n\nexport function resolveIconSize(theme: SurfaceTheme, size: ControlSize = 'm'): number {\n return resolveControlSize(theme, size).iconSize;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveIndicatorSize.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveIndicatorSize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"resolveIndicatorSize.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveIndicatorSize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,WAAiB,GAAG,qBAAqB,CAkCnF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveIndicatorSize.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveIndicatorSize.ts"],"names":[],"mappings":"AAYA,MAAM,UAAU,oBAAoB,CAAC,OAAoB,GAAG;IAC1D,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,GAAG;YACN,OAAO;gBACL,QAAQ,EAAE,EAAE;gBACZ,iBAAiB,EAAE,EAAE;gBACrB,KAAK,EAAE,EAAE;gBACT,QAAQ,EAAE,CAAC;gBACX,WAAW,EAAE,EAAE;gBACf,YAAY,EAAE,EAAE;gBAChB,WAAW,EAAE,EAAE;aAChB,CAAC;QACJ,KAAK,GAAG;YACN,OAAO;gBACL,QAAQ,EAAE,EAAE;gBACZ,iBAAiB,EAAE,EAAE;gBACrB,KAAK,EAAE,EAAE;gBACT,QAAQ,EAAE,EAAE;gBACZ,WAAW,EAAE,EAAE;gBACf,YAAY,EAAE,EAAE;gBAChB,WAAW,EAAE,EAAE;aAChB,CAAC;QACJ,KAAK,GAAG,CAAC;QACT;YACE,OAAO;gBACL,QAAQ,EAAE,EAAE;gBACZ,iBAAiB,EAAE,EAAE;gBACrB,KAAK,EAAE,EAAE;gBACT,QAAQ,EAAE,CAAC;gBACX,WAAW,EAAE,EAAE;gBACf,YAAY,EAAE,EAAE;gBAChB,WAAW,EAAE,EAAE;aAChB,CAAC;IACN,CAAC;AACH,CAAC","sourcesContent":["import type { ControlSize } from '
|
|
1
|
+
{"version":3,"file":"resolveIndicatorSize.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveIndicatorSize.ts"],"names":[],"mappings":"AAYA,MAAM,UAAU,oBAAoB,CAAC,OAAoB,GAAG;IAC1D,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,GAAG;YACN,OAAO;gBACL,QAAQ,EAAE,EAAE;gBACZ,iBAAiB,EAAE,EAAE;gBACrB,KAAK,EAAE,EAAE;gBACT,QAAQ,EAAE,CAAC;gBACX,WAAW,EAAE,EAAE;gBACf,YAAY,EAAE,EAAE;gBAChB,WAAW,EAAE,EAAE;aAChB,CAAC;QACJ,KAAK,GAAG;YACN,OAAO;gBACL,QAAQ,EAAE,EAAE;gBACZ,iBAAiB,EAAE,EAAE;gBACrB,KAAK,EAAE,EAAE;gBACT,QAAQ,EAAE,EAAE;gBACZ,WAAW,EAAE,EAAE;gBACf,YAAY,EAAE,EAAE;gBAChB,WAAW,EAAE,EAAE;aAChB,CAAC;QACJ,KAAK,GAAG,CAAC;QACT;YACE,OAAO;gBACL,QAAQ,EAAE,EAAE;gBACZ,iBAAiB,EAAE,EAAE;gBACrB,KAAK,EAAE,EAAE;gBACT,QAAQ,EAAE,CAAC;gBACX,WAAW,EAAE,EAAE;gBACf,YAAY,EAAE,EAAE;gBAChB,WAAW,EAAE,EAAE;aAChB,CAAC;IACN,CAAC;AACH,CAAC","sourcesContent":["import type { ControlSize } from '../../types/control';\n\nexport interface ResolvedIndicatorSize {\n checkbox: number;\n checkboxIndicator: number;\n radio: number;\n radioDot: number;\n switchWidth: number;\n switchHeight: number;\n switchThumb: number;\n}\n\nexport function resolveIndicatorSize(size: ControlSize = 'm'): ResolvedIndicatorSize {\n switch (size) {\n case 's':\n return {\n checkbox: 16,\n checkboxIndicator: 10,\n radio: 16,\n radioDot: 8,\n switchWidth: 30,\n switchHeight: 18,\n switchThumb: 12,\n };\n case 'l':\n return {\n checkbox: 22,\n checkboxIndicator: 14,\n radio: 22,\n radioDot: 10,\n switchWidth: 42,\n switchHeight: 26,\n switchThumb: 18,\n };\n case 'm':\n default:\n return {\n checkbox: 18,\n checkboxIndicator: 12,\n radio: 18,\n radioDot: 8,\n switchWidth: 34,\n switchHeight: 22,\n switchThumb: 14,\n };\n }\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { ButtonVariant } from '../../types/button';
|
|
2
|
+
import type { InteractionState } from '../../types/pressable';
|
|
1
3
|
import type { SurfaceColor } from '../../types/surfaceColor';
|
|
2
4
|
import type { SurfaceTheme } from '../../types/theme';
|
|
3
5
|
import type { FieldState } from './resolveFieldState';
|
|
4
|
-
import type { InteractionState } from './resolveInteractiveState';
|
|
5
|
-
export type ButtonVariant = 'solid' | 'outline' | 'ghost' | 'soft';
|
|
6
6
|
export interface ResolvedInteractiveColors {
|
|
7
7
|
backgroundColor: string;
|
|
8
8
|
borderColor: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveInteractiveColors.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveInteractiveColors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"resolveInteractiveColors.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveInteractiveColors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,MAAM,WAAW,yBAAyB;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,YAAY,EACnB,EACE,OAAO,EACP,KAAK,EACL,KAAK,GACN,EAAE;IACD,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,gBAAgB,CAAC;CACzB,GACA,yBAAyB,CA8D3B;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,UAAU,GACrB,yBAAyB,GAAG;IAAE,gBAAgB,EAAE,MAAM,CAAA;CAAE,CA6C1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveInteractiveColors.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveInteractiveColors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolveInteractiveColors.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveInteractiveColors.ts"],"names":[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,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO;QAC7C,gBAAgB,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK;KAChD,CAAC;AACJ,CAAC","sourcesContent":["import type { ButtonVariant } from '../../types/button';\nimport type { InteractionState } from '../../types/pressable';\nimport type { SurfaceColor } from '../../types/surfaceColor';\nimport type { SurfaceTheme } from '../../types/theme';\nimport type { FieldState } from './resolveFieldState';\nimport { resolveSurfaceColor } from './resolveSurfaceColor';\n\nexport interface ResolvedInteractiveColors {\n backgroundColor: string;\n borderColor: string;\n contentColor: string;\n opacity?: number;\n}\n\nexport function resolveButtonColors(\n theme: SurfaceTheme,\n {\n variant,\n color,\n state,\n }: {\n variant: ButtonVariant;\n color: SurfaceColor;\n state: InteractionState;\n },\n): ResolvedInteractiveColors {\n if (state.disabled) {\n return {\n backgroundColor: theme.semantics.surface.disabled,\n borderColor: theme.semantics.border.subtle,\n contentColor: theme.semantics.content.disabled,\n };\n }\n\n const semanticTone = resolveSurfaceColor(theme, color);\n\n switch (variant) {\n case 'outline':\n return {\n backgroundColor: state.pressed\n ? semanticTone.softActive\n : state.hovered\n ? semanticTone.softHover\n : 'transparent',\n borderColor: semanticTone.outline,\n contentColor: semanticTone.onSurfaceText,\n };\n case 'ghost':\n return {\n backgroundColor: state.pressed\n ? semanticTone.softActive\n : state.hovered\n ? semanticTone.softHover\n : 'transparent',\n borderColor: 'transparent',\n contentColor: semanticTone.onSurfaceText,\n };\n case 'soft':\n return {\n backgroundColor: state.pressed\n ? semanticTone.softActive\n : state.hovered\n ? semanticTone.softHover\n : semanticTone.softBg,\n borderColor: 'transparent',\n contentColor: state.pressed\n ? semanticTone.onSoftActiveText\n : state.hovered\n ? semanticTone.onSoftHoverText\n : semanticTone.onSoftText,\n };\n case 'solid':\n default:\n return {\n backgroundColor: state.pressed\n ? semanticTone.strong\n : state.hovered\n ? semanticTone.hover\n : semanticTone.base,\n borderColor: semanticTone.base,\n contentColor: state.pressed\n ? semanticTone.onStrongText\n : state.hovered\n ? semanticTone.onHoverText\n : semanticTone.onSolidText,\n };\n }\n}\n\nexport function resolveInputColors(\n theme: SurfaceTheme,\n fieldState: FieldState,\n): ResolvedInteractiveColors & { placeholderColor: string } {\n if (fieldState.disabled) {\n return {\n backgroundColor: theme.semantics.surface.disabled,\n borderColor: theme.semantics.border.subtle,\n contentColor: theme.semantics.content.disabled,\n placeholderColor: theme.semantics.content.disabled,\n };\n }\n\n if (fieldState.invalid) {\n return {\n backgroundColor: fieldState.readOnly\n ? theme.semantics.surface.subtle\n : theme.semantics.surface.default,\n borderColor: fieldState.focused ? theme.semantics.error.base : theme.semantics.error.outline,\n contentColor: theme.semantics.content.default,\n placeholderColor: theme.semantics.content.muted,\n };\n }\n\n if (fieldState.focused) {\n return {\n backgroundColor: theme.semantics.surface.default,\n borderColor: theme.semantics.border.focus,\n contentColor: theme.semantics.content.default,\n placeholderColor: theme.semantics.content.muted,\n };\n }\n\n if (fieldState.readOnly) {\n return {\n backgroundColor: theme.semantics.surface.subtle,\n borderColor: theme.semantics.border.default,\n contentColor: theme.semantics.content.default,\n placeholderColor: theme.semantics.content.muted,\n };\n }\n\n return {\n backgroundColor: theme.semantics.surface.default,\n borderColor: theme.semantics.border.default,\n contentColor: theme.semantics.content.default,\n placeholderColor: theme.semantics.content.muted,\n };\n}\n"]}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
pressed: boolean;
|
|
3
|
-
hovered: boolean;
|
|
4
|
-
focused: boolean;
|
|
5
|
-
disabled: boolean;
|
|
6
|
-
}
|
|
1
|
+
import type { InteractionState } from '../../types/pressable';
|
|
7
2
|
export declare function resolveInteractiveState(input: Partial<InteractionState>): InteractionState;
|
|
8
3
|
//# sourceMappingURL=resolveInteractiveState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveInteractiveState.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveInteractiveState.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"resolveInteractiveState.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveInteractiveState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,CAO1F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveInteractiveState.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveInteractiveState.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolveInteractiveState.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveInteractiveState.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,uBAAuB,CAAC,KAAgC;IACtE,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;QAC/B,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;QAC/B,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;QAC/B,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC;KAClC,CAAC;AACJ,CAAC","sourcesContent":["import type { InteractionState } from '../../types/pressable';\n\nexport function resolveInteractiveState(input: Partial<InteractionState>): InteractionState {\n return {\n pressed: Boolean(input.pressed),\n hovered: Boolean(input.hovered),\n focused: Boolean(input.focused),\n disabled: Boolean(input.disabled),\n };\n}\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { TextStyle } from 'react-native';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export type TextWeight = keyof SurfaceTheme['typography']['weights'] | FontWeight;
|
|
2
|
+
import type { SurfaceTheme } from '../../types/theme';
|
|
3
|
+
import type { TextVariant, TextWeight } from '../../types/typography';
|
|
5
4
|
export interface ResolveTextStyleOptions {
|
|
6
5
|
variant?: TextVariant;
|
|
7
6
|
align?: TextStyle['textAlign'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveTextStyles.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveTextStyles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"resolveTextStyles.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveTextStyles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAc,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAQtE,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,KAAK,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CAC/B;AA8CD,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,YAAY,EACnB,OAAO,GAAE,uBAA4B,GACpC,SAAS,CA0BX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveTextStyles.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveTextStyles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolveTextStyles.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveTextStyles.ts"],"names":[],"mappings":"AAmBA,SAAS,aAAa,CAAC,KAAmB,EAAE,KAA6B;IACvE,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC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GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAC3E,MAAM,iBAAiB,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1E,MAAM,YAAY,GAAG,iBAAiB;QACpC,CAAC,CAAC;YACE,QAAQ,EAAE,iBAAiB,CAAC,IAAI;YAChC,UAAU,EAAE,iBAAiB,CAAC,UAAU;YACxC,MAAM,EAAE,iBAAiB,CAAC,MAAM;SACjC;QACH,CAAC,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAEpC,MAAM,cAAc,GAAG,aAAa,CAAC,KAAK,EAAE,MAAM,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;IAC3E,MAAM,MAAM,GAAG,CAAC,KAAK,IAAI,OAAO,KAAK,MAAM,CAAC;IAC5C,MAAM,UAAU,GAAG,MAAM;QACvB,CAAC,CAAC,WAAW;QACb,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,CAAC;IAEzE,OAAO;QACL,QAAQ,EAAE,YAAY,CAAC,QAAQ;QAC/B,UAAU,EAAE,YAAY,CAAC,UAAU;QACnC,UAAU,EAAE,cAAc;QAC1B,UAAU;QACV,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;QACvC,SAAS,EAAE,KAAK;QAChB,SAAS,EAAE,CAAC;KACb,CAAC;AACJ,CAAC","sourcesContent":["import type { TextStyle } from 'react-native';\n\nimport type { FontWeight, SurfaceTheme } from '../../types/theme';\nimport type { TextVariant, TextWeight } from '../../types/typography';\n\ninterface VariantStyle {\n fontSize: number;\n lineHeight: number;\n weight: TextWeight;\n}\n\nexport interface ResolveTextStyleOptions {\n variant?: TextVariant;\n align?: TextStyle['textAlign'];\n weight?: TextWeight;\n italic?: boolean;\n level?: 1 | 2 | 3 | 4 | 5 | 6;\n}\n\nfunction resolveWeight(theme: SurfaceTheme, value: TextWeight | undefined): FontWeight {\n if (!value) return theme.typography.weights.regular;\n if (value in theme.typography.weights) {\n return theme.typography.weights[value as keyof SurfaceTheme['typography']['weights']];\n }\n return value as FontWeight;\n}\n\nfunction getVariantStyle(theme: SurfaceTheme, variant: TextVariant): VariantStyle {\n switch (variant) {\n case 'bodySmall':\n return {\n fontSize: theme.typography.sizes.s,\n lineHeight: 20,\n weight: 'regular',\n };\n case 'caption':\n return {\n fontSize: theme.typography.sizes.xs,\n lineHeight: 16,\n weight: 'regular',\n };\n case 'label':\n return {\n fontSize: theme.typography.sizes.s,\n lineHeight: 18,\n weight: 'medium',\n };\n case 'mono':\n return {\n fontSize: theme.typography.sizes.s,\n lineHeight: 20,\n weight: 'regular',\n };\n case 'body':\n default:\n return {\n fontSize: theme.typography.sizes.m,\n lineHeight: 24,\n weight: 'regular',\n };\n }\n}\n\nexport function resolveTextStyles(\n theme: SurfaceTheme,\n options: ResolveTextStyleOptions = {},\n): TextStyle {\n const { level, variant = 'body', align, weight, italic = false } = options;\n const headingTypography = level ? theme.typography.headings[level] : null;\n const variantStyle = headingTypography\n ? {\n fontSize: headingTypography.size,\n lineHeight: headingTypography.lineHeight,\n weight: headingTypography.weight,\n }\n : getVariantStyle(theme, variant);\n\n const resolvedWeight = resolveWeight(theme, weight ?? variantStyle.weight);\n const isMono = !level && variant === 'mono';\n const fontFamily = isMono\n ? 'monospace'\n : theme.typography.fonts[italic ? 'italic' : 'normal'][resolvedWeight];\n\n return {\n fontSize: variantStyle.fontSize,\n lineHeight: variantStyle.lineHeight,\n fontWeight: resolvedWeight,\n fontFamily,\n fontStyle: italic ? 'italic' : 'normal',\n textAlign: align,\n elevation: 0,\n };\n}\n"]}
|
package/dist/types/badge.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
2
|
+
import type { ButtonVariant } from './button';
|
|
3
|
+
import type { ControlSize } from './control';
|
|
4
4
|
import type { SurfaceColor } from './surfaceColor';
|
|
5
5
|
export interface BadgeProps {
|
|
6
6
|
content?: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../src/types/badge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../src/types/badge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;IAC/D,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
package/dist/types/badge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.js","sourceRoot":"","sources":["../../src/types/badge.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type {
|
|
1
|
+
{"version":3,"file":"badge.js","sourceRoot":"","sources":["../../src/types/badge.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { ButtonVariant } from './button';\nimport type { ControlSize } from './control';\nimport type { SurfaceColor } from './surfaceColor';\n\nexport interface BadgeProps {\n content?: React.ReactNode;\n variant?: Extract<ButtonVariant, 'solid' | 'soft' | 'outline'>;\n color?: SurfaceColor;\n size?: ControlSize;\n testID?: string;\n}\n"]}
|
package/dist/types/button.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { ControlSize } from '
|
|
3
|
-
import type { ButtonVariant } from '../internal/resolvers/resolveInteractiveColors';
|
|
2
|
+
import type { ControlSize } from './control';
|
|
4
3
|
import type { IconSource } from './icon';
|
|
5
4
|
import type { PressableProps } from './pressable';
|
|
6
5
|
import type { SurfaceColor } from './surfaceColor';
|
|
7
6
|
export type ButtonIconSpec = IconSource;
|
|
7
|
+
export type ButtonVariant = 'solid' | 'outline' | 'ghost' | 'soft';
|
|
8
8
|
export interface ButtonProps extends Omit<PressableProps, 'accessibilityLabel' | 'children' | 'style'> {
|
|
9
9
|
children?: React.ReactNode;
|
|
10
10
|
variant?: ButtonVariant;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/types/button.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/types/button.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC;AACxC,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAEnE,MAAM,WAAW,WAAY,SAAQ,IAAI,CACvC,cAAc,EACd,oBAAoB,GAAG,UAAU,GAAG,OAAO,CAC5C;IACC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAC3C,cAAc,EACd,UAAU,GAAG,OAAO,GAAG,oBAAoB,CAC5C;IACC,IAAI,EAAE,UAAU,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB"}
|
package/dist/types/button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/types/button.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { ControlSize } from '
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/types/button.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { ControlSize } from './control';\nimport type { IconSource } from './icon';\nimport type { PressableProps } from './pressable';\nimport type { SurfaceColor } from './surfaceColor';\n\nexport type ButtonIconSpec = IconSource;\nexport type ButtonVariant = 'solid' | 'outline' | 'ghost' | 'soft';\n\nexport interface ButtonProps extends Omit<\n PressableProps,\n 'accessibilityLabel' | 'children' | 'style'\n> {\n children?: React.ReactNode;\n variant?: ButtonVariant;\n color?: SurfaceColor;\n size?: ControlSize;\n loading?: boolean;\n leadingIcon?: ButtonIconSpec;\n trailingIcon?: ButtonIconSpec;\n fullWidth?: boolean;\n}\n\nexport interface IconButtonProps extends Omit<\n PressableProps,\n 'children' | 'style' | 'accessibilityLabel'\n> {\n icon: IconSource;\n accessibilityLabel: string;\n variant?: ButtonVariant;\n color?: SurfaceColor;\n size?: ControlSize;\n}\n"]}
|
package/dist/types/checkbox.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { ControlSize } from '
|
|
2
|
+
import type { ControlSize } from './control';
|
|
3
3
|
import type { PressableProps } from './pressable';
|
|
4
4
|
import type { SurfaceColor } from './surfaceColor';
|
|
5
5
|
export interface CheckboxProps extends Omit<PressableProps, 'accessibilityRole' | 'accessibilityState' | 'children' | 'onPress' | 'style'> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../src/types/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../src/types/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,WAAW,aAAc,SAAQ,IAAI,CACzC,cAAc,EACd,mBAAmB,GAAG,oBAAoB,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,CAC9E;IACC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC3D,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../src/types/checkbox.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { ControlSize } from '
|
|
1
|
+
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../src/types/checkbox.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { ControlSize } from './control';\nimport type { PressableProps } from './pressable';\nimport type { SurfaceColor } from './surfaceColor';\n\nexport interface CheckboxProps extends Omit<\n PressableProps,\n 'accessibilityRole' | 'accessibilityState' | 'children' | 'onPress' | 'style'\n> {\n children?: React.ReactNode;\n checked?: boolean;\n defaultChecked?: boolean;\n onCheckedChange?: ((checked: boolean) => void) | undefined;\n color?: SurfaceColor;\n size?: ControlSize;\n invalid?: boolean;\n readOnly?: boolean;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../src/types/control.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.js","sourceRoot":"","sources":["../../src/types/control.ts"],"names":[],"mappings":"","sourcesContent":["export type ControlSize = 's' | 'm' | 'l';\n"]}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { AccessibilityRole, AccessibilityState, GestureResponderEvent } from 'react-native';
|
|
3
|
-
import type { InteractionState } from '../internal/resolvers/resolveInteractiveState';
|
|
4
3
|
import type { InteractionPolicyProps } from './interactionPolicy';
|
|
5
4
|
import type { ViewProps } from './layout';
|
|
5
|
+
export interface InteractionState {
|
|
6
|
+
pressed: boolean;
|
|
7
|
+
hovered: boolean;
|
|
8
|
+
focused: boolean;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
}
|
|
6
11
|
export interface PressableProps extends Omit<ViewProps, 'children' | 'pointerEvents'>, InteractionPolicyProps {
|
|
7
12
|
children?: React.ReactNode | ((state: InteractionState) => React.ReactNode);
|
|
8
13
|
disabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pressable.d.ts","sourceRoot":"","sources":["../../src/types/pressable.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,
|
|
1
|
+
{"version":3,"file":"pressable.d.ts","sourceRoot":"","sources":["../../src/types/pressable.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,qBAAqB,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,cACf,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":"pressable.js","sourceRoot":"","sources":["../../src/types/pressable.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { AccessibilityRole, AccessibilityState, GestureResponderEvent } from 'react-native';\n\nimport type {
|
|
1
|
+
{"version":3,"file":"pressable.js","sourceRoot":"","sources":["../../src/types/pressable.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 { ViewProps } from './layout';\n\nexport interface InteractionState {\n pressed: boolean;\n hovered: boolean;\n focused: boolean;\n disabled: boolean;\n}\n\nexport interface PressableProps\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"]}
|
package/dist/types/radio.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { ControlSize } from '
|
|
2
|
+
import type { ControlSize } from './control';
|
|
3
3
|
import type { PressableProps } from './pressable';
|
|
4
4
|
import type { SurfaceColor } from './surfaceColor';
|
|
5
5
|
export interface RadioProps extends Omit<PressableProps, 'accessibilityRole' | 'accessibilityState' | 'children' | 'onPress' | 'style'> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["../../src/types/radio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["../../src/types/radio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,WAAW,UAAW,SAAQ,IAAI,CACtC,cAAc,EACd,mBAAmB,GAAG,oBAAoB,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,CAC9E;IACC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC3D,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
package/dist/types/radio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.js","sourceRoot":"","sources":["../../src/types/radio.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { ControlSize } from '
|
|
1
|
+
{"version":3,"file":"radio.js","sourceRoot":"","sources":["../../src/types/radio.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { ControlSize } from './control';\nimport type { PressableProps } from './pressable';\nimport type { SurfaceColor } from './surfaceColor';\n\nexport interface RadioProps extends Omit<\n PressableProps,\n 'accessibilityRole' | 'accessibilityState' | 'children' | 'onPress' | 'style'\n> {\n children?: React.ReactNode;\n checked?: boolean;\n defaultChecked?: boolean;\n onCheckedChange?: ((checked: boolean) => void) | undefined;\n color?: SurfaceColor;\n size?: ControlSize;\n invalid?: boolean;\n readOnly?: boolean;\n}\n"]}
|
package/dist/types/switch.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { ControlSize } from '
|
|
2
|
+
import type { ControlSize } from './control';
|
|
3
3
|
import type { PressableProps } from './pressable';
|
|
4
4
|
import type { SurfaceColor } from './surfaceColor';
|
|
5
5
|
export interface SwitchProps extends Omit<PressableProps, 'accessibilityRole' | 'accessibilityState' | 'children' | 'onPress' | 'style'> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/types/switch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/types/switch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,WAAW,WAAY,SAAQ,IAAI,CACvC,cAAc,EACd,mBAAmB,GAAG,oBAAoB,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,CAC9E;IACC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC3D,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
package/dist/types/switch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../src/types/switch.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { ControlSize } from '
|
|
1
|
+
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../src/types/switch.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { ControlSize } from './control';\nimport type { PressableProps } from './pressable';\nimport type { SurfaceColor } from './surfaceColor';\n\nexport interface SwitchProps extends Omit<\n PressableProps,\n 'accessibilityRole' | 'accessibilityState' | 'children' | 'onPress' | 'style'\n> {\n children?: React.ReactNode;\n checked?: boolean;\n defaultChecked?: boolean;\n onCheckedChange?: ((checked: boolean) => void) | undefined;\n color?: SurfaceColor;\n size?: ControlSize;\n invalid?: boolean;\n readOnly?: boolean;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { StyleProp, TextInputProps as ReactNativeTextInputProps, TextStyle } from 'react-native';
|
|
3
|
-
import type { ControlSize } from '
|
|
3
|
+
import type { ControlSize } from './control';
|
|
4
4
|
import type { InteractionPolicy } from './interactionPolicy';
|
|
5
5
|
export interface TextInputProps extends Omit<ReactNativeTextInputProps, 'defaultValue' | 'editable' | 'onChangeText' | 'placeholderTextColor' | 'style' | 'testID' | 'value'> {
|
|
6
6
|
value?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-input.d.ts","sourceRoot":"","sources":["../../src/types/text-input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EACV,SAAS,EACT,cAAc,IAAI,yBAAyB,EAC3C,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"text-input.d.ts","sourceRoot":"","sources":["../../src/types/text-input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EACV,SAAS,EACT,cAAc,IAAI,yBAAyB,EAC3C,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,WAAW,cAAe,SAAQ,IAAI,CAC1C,yBAAyB,EACvB,cAAc,GACd,UAAU,GACV,cAAc,GACd,sBAAsB,GACtB,OAAO,GACP,QAAQ,GACR,OAAO,CACV;IACC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACpC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-input.js","sourceRoot":"","sources":["../../src/types/text-input.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type {\n StyleProp,\n TextInputProps as ReactNativeTextInputProps,\n TextStyle,\n} from 'react-native';\n\nimport type { ControlSize } from '
|
|
1
|
+
{"version":3,"file":"text-input.js","sourceRoot":"","sources":["../../src/types/text-input.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type {\n StyleProp,\n TextInputProps as ReactNativeTextInputProps,\n TextStyle,\n} from 'react-native';\n\nimport type { ControlSize } from './control';\nimport type { InteractionPolicy } from './interactionPolicy';\n\nexport interface TextInputProps extends Omit<\n ReactNativeTextInputProps,\n | 'defaultValue'\n | 'editable'\n | 'onChangeText'\n | 'placeholderTextColor'\n | 'style'\n | 'testID'\n | 'value'\n> {\n value?: string;\n defaultValue?: string;\n onChangeText?: ((text: string) => void) | undefined;\n placeholder?: string;\n size?: ControlSize;\n disabled?: boolean;\n readOnly?: boolean;\n invalid?: boolean;\n leadingAccessory?: React.ReactNode;\n trailingAccessory?: React.ReactNode;\n interactionPolicy?: InteractionPolicy;\n style?: StyleProp<TextStyle>;\n testID?: string;\n}\n"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { TextStyle } from 'react-native';
|
|
3
|
-
import type { TextVariant, TextWeight } from '../internal/resolvers/resolveTextStyles';
|
|
4
3
|
import type { SurfaceColor, SurfaceEmphasis } from './surfaceColor';
|
|
4
|
+
import type { FontWeight, SurfaceTheme } from './theme';
|
|
5
|
+
export type TextVariant = 'body' | 'bodySmall' | 'caption' | 'label' | 'mono';
|
|
6
|
+
export type TextWeight = keyof SurfaceTheme['typography']['weights'] | FontWeight;
|
|
5
7
|
export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
6
8
|
export interface HeadingProps {
|
|
7
9
|
text?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../src/types/typography.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../src/types/typography.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAExD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAC9E,MAAM,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC;AAElF,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;IACzD,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typography.js","sourceRoot":"","sources":["../../src/types/typography.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { TextStyle } from 'react-native';\n\nimport type {
|
|
1
|
+
{"version":3,"file":"typography.js","sourceRoot":"","sources":["../../src/types/typography.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { TextStyle } from 'react-native';\n\nimport type { SurfaceColor, SurfaceEmphasis } from './surfaceColor';\nimport type { FontWeight, SurfaceTheme } from './theme';\n\nexport type TextVariant = 'body' | 'bodySmall' | 'caption' | 'label' | 'mono';\nexport type TextWeight = keyof SurfaceTheme['typography']['weights'] | FontWeight;\n\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\nexport interface HeadingProps {\n text?: string;\n children?: React.ReactNode;\n level?: HeadingLevel;\n align?: 'auto' | 'left' | 'right' | 'center' | 'justify';\n color?: SurfaceColor;\n emphasis?: SurfaceEmphasis;\n numberOfLines?: number;\n i18nKey?: string;\n testID?: string;\n}\n\nexport interface TextProps {\n children?: React.ReactNode;\n i18nKey?: string;\n variant?: TextVariant;\n emphasis?: SurfaceEmphasis;\n color?: SurfaceColor;\n align?: TextStyle['textAlign'];\n weight?: TextWeight;\n italic?: boolean;\n numberOfLines?: number;\n testID?: string;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -2,12 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import { ActivityIndicator, View as ReactNativeView, type ViewStyle } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
type InteractionState,
|
|
6
5
|
resolveButtonColors,
|
|
7
6
|
resolveControlSize,
|
|
8
7
|
resolveIconSize,
|
|
9
8
|
} from '../../../../internal/resolvers';
|
|
10
9
|
import type { ButtonProps } from '../../../../types/button';
|
|
10
|
+
import type { InteractionState } from '../../../../types/pressable';
|
|
11
11
|
import type { SurfaceTheme } from '../../../../types/theme';
|
|
12
12
|
import { Icon } from '../../../icon/public';
|
|
13
13
|
import { View } from '../../../layout/public';
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import type { ViewStyle } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
type InteractionState,
|
|
6
5
|
resolveFieldState,
|
|
7
6
|
resolveIndicatorSize,
|
|
8
7
|
resolveSelectionControlColors,
|
|
@@ -10,6 +9,7 @@ import {
|
|
|
10
9
|
} from '../../../../../internal/resolvers';
|
|
11
10
|
import { useControllableState } from '../../../../../internal/useControllableState';
|
|
12
11
|
import type { CheckboxProps } from '../../../../../types/checkbox';
|
|
12
|
+
import type { InteractionState } from '../../../../../types/pressable';
|
|
13
13
|
import type { SurfaceTheme } from '../../../../../types/theme';
|
|
14
14
|
import { View } from '../../../../layout/public';
|
|
15
15
|
import type { PressableProps } from '../../../../pressable/public';
|
|
@@ -2,13 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import type { ViewStyle } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
type InteractionState,
|
|
6
5
|
resolveFieldState,
|
|
7
6
|
resolveIndicatorSize,
|
|
8
7
|
resolveSelectionControlColors,
|
|
9
8
|
resolveSelectionControlNextChecked,
|
|
10
9
|
} from '../../../../../internal/resolvers';
|
|
11
10
|
import { useControllableState } from '../../../../../internal/useControllableState';
|
|
11
|
+
import type { InteractionState } from '../../../../../types/pressable';
|
|
12
12
|
import type { RadioProps } from '../../../../../types/radio';
|
|
13
13
|
import type { SurfaceTheme } from '../../../../../types/theme';
|
|
14
14
|
import { View } from '../../../../layout/public';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
type InteractionState,
|
|
5
4
|
resolveFieldState,
|
|
6
5
|
resolveIndicatorSize,
|
|
7
6
|
resolveSelectionControlColors,
|
|
8
7
|
resolveSelectionControlNextChecked,
|
|
9
8
|
} from '../../../../../internal/resolvers';
|
|
10
9
|
import { useControllableState } from '../../../../../internal/useControllableState';
|
|
10
|
+
import type { InteractionState } from '../../../../../types/pressable';
|
|
11
11
|
import type { SwitchProps } from '../../../../../types/switch';
|
|
12
12
|
import { View } from '../../../../layout/public';
|
|
13
13
|
import { Pressable } from '../../../../pressable/public';
|
|
@@ -6,12 +6,8 @@ import {
|
|
|
6
6
|
} from 'react-native';
|
|
7
7
|
|
|
8
8
|
import { useResponsiveRuntime } from '../../../../core/responsive';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
resolveFocusRingStyles,
|
|
12
|
-
resolveInteractiveState,
|
|
13
|
-
} from '../../../../internal/resolvers';
|
|
14
|
-
import type { PressableProps } from '../../../../types/pressable';
|
|
9
|
+
import { resolveFocusRingStyles, resolveInteractiveState } from '../../../../internal/resolvers';
|
|
10
|
+
import type { InteractionState, PressableProps } from '../../../../types/pressable';
|
|
15
11
|
import { resolveViewStyles } from '../../../../utils/resolveViewStyles';
|
|
16
12
|
import { useTheme } from '../../../theme/runtime';
|
|
17
13
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { ControlSize } from '../../types/control';
|
|
1
2
|
import type { SurfaceTheme } from '../../types/theme';
|
|
2
|
-
import {
|
|
3
|
+
import { resolveControlSize } from './resolveControlSize';
|
|
3
4
|
|
|
4
5
|
export function resolveIconSize(theme: SurfaceTheme, size: ControlSize = 'm'): number {
|
|
5
6
|
return resolveControlSize(theme, size).iconSize;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import type { ButtonVariant } from '../../types/button';
|
|
2
|
+
import type { InteractionState } from '../../types/pressable';
|
|
1
3
|
import type { SurfaceColor } from '../../types/surfaceColor';
|
|
2
4
|
import type { SurfaceTheme } from '../../types/theme';
|
|
3
5
|
import type { FieldState } from './resolveFieldState';
|
|
4
|
-
import type { InteractionState } from './resolveInteractiveState';
|
|
5
6
|
import { resolveSurfaceColor } from './resolveSurfaceColor';
|
|
6
7
|
|
|
7
|
-
export type ButtonVariant = 'solid' | 'outline' | 'ghost' | 'soft';
|
|
8
|
-
|
|
9
8
|
export interface ResolvedInteractiveColors {
|
|
10
9
|
backgroundColor: string;
|
|
11
10
|
borderColor: string;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
pressed: boolean;
|
|
3
|
-
hovered: boolean;
|
|
4
|
-
focused: boolean;
|
|
5
|
-
disabled: boolean;
|
|
6
|
-
}
|
|
1
|
+
import type { InteractionState } from '../../types/pressable';
|
|
7
2
|
|
|
8
3
|
export function resolveInteractiveState(input: Partial<InteractionState>): InteractionState {
|
|
9
4
|
return {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { TextStyle } from 'react-native';
|
|
2
2
|
|
|
3
3
|
import type { FontWeight, SurfaceTheme } from '../../types/theme';
|
|
4
|
-
|
|
5
|
-
export type TextVariant = 'body' | 'bodySmall' | 'caption' | 'label' | 'mono';
|
|
6
|
-
export type TextWeight = keyof SurfaceTheme['typography']['weights'] | FontWeight;
|
|
4
|
+
import type { TextVariant, TextWeight } from '../../types/typography';
|
|
7
5
|
|
|
8
6
|
interface VariantStyle {
|
|
9
7
|
fontSize: number;
|
package/src/types/badge.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { ButtonVariant } from './button';
|
|
4
|
+
import type { ControlSize } from './control';
|
|
5
5
|
import type { SurfaceColor } from './surfaceColor';
|
|
6
6
|
|
|
7
7
|
export interface BadgeProps {
|
package/src/types/button.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
|
|
3
|
-
import type { ControlSize } from '
|
|
4
|
-
import type { ButtonVariant } from '../internal/resolvers/resolveInteractiveColors';
|
|
3
|
+
import type { ControlSize } from './control';
|
|
5
4
|
import type { IconSource } from './icon';
|
|
6
5
|
import type { PressableProps } from './pressable';
|
|
7
6
|
import type { SurfaceColor } from './surfaceColor';
|
|
8
7
|
|
|
9
8
|
export type ButtonIconSpec = IconSource;
|
|
9
|
+
export type ButtonVariant = 'solid' | 'outline' | 'ghost' | 'soft';
|
|
10
10
|
|
|
11
11
|
export interface ButtonProps extends Omit<
|
|
12
12
|
PressableProps,
|
package/src/types/checkbox.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
|
|
3
|
-
import type { ControlSize } from '
|
|
3
|
+
import type { ControlSize } from './control';
|
|
4
4
|
import type { PressableProps } from './pressable';
|
|
5
5
|
import type { SurfaceColor } from './surfaceColor';
|
|
6
6
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ControlSize = 's' | 'm' | 'l';
|
package/src/types/pressable.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { AccessibilityRole, AccessibilityState, GestureResponderEvent } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import type { InteractionState } from '../internal/resolvers/resolveInteractiveState';
|
|
5
4
|
import type { InteractionPolicyProps } from './interactionPolicy';
|
|
6
5
|
import type { ViewProps } from './layout';
|
|
7
6
|
|
|
7
|
+
export interface InteractionState {
|
|
8
|
+
pressed: boolean;
|
|
9
|
+
hovered: boolean;
|
|
10
|
+
focused: boolean;
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
8
14
|
export interface PressableProps
|
|
9
15
|
extends Omit<ViewProps, 'children' | 'pointerEvents'>, InteractionPolicyProps {
|
|
10
16
|
children?: React.ReactNode | ((state: InteractionState) => React.ReactNode);
|
package/src/types/radio.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
|
|
3
|
-
import type { ControlSize } from '
|
|
3
|
+
import type { ControlSize } from './control';
|
|
4
4
|
import type { PressableProps } from './pressable';
|
|
5
5
|
import type { SurfaceColor } from './surfaceColor';
|
|
6
6
|
|
package/src/types/switch.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
|
|
3
|
-
import type { ControlSize } from '
|
|
3
|
+
import type { ControlSize } from './control';
|
|
4
4
|
import type { PressableProps } from './pressable';
|
|
5
5
|
import type { SurfaceColor } from './surfaceColor';
|
|
6
6
|
|
package/src/types/text-input.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
TextStyle,
|
|
6
6
|
} from 'react-native';
|
|
7
7
|
|
|
8
|
-
import type { ControlSize } from '
|
|
8
|
+
import type { ControlSize } from './control';
|
|
9
9
|
import type { InteractionPolicy } from './interactionPolicy';
|
|
10
10
|
|
|
11
11
|
export interface TextInputProps extends Omit<
|
package/src/types/typography.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { TextStyle } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import type { TextVariant, TextWeight } from '../internal/resolvers/resolveTextStyles';
|
|
5
4
|
import type { SurfaceColor, SurfaceEmphasis } from './surfaceColor';
|
|
5
|
+
import type { FontWeight, SurfaceTheme } from './theme';
|
|
6
|
+
|
|
7
|
+
export type TextVariant = 'body' | 'bodySmall' | 'caption' | 'label' | 'mono';
|
|
8
|
+
export type TextWeight = keyof SurfaceTheme['typography']['weights'] | FontWeight;
|
|
6
9
|
|
|
7
10
|
export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
8
11
|
|