@ankhorage/surface 6.0.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -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 +5 -5
- package/dist/features/button/adapters/inbound/Button.js.map +1 -1
- package/dist/features/button/adapters/inbound/IconButton.d.ts.map +1 -1
- package/dist/features/button/adapters/inbound/IconButton.js +3 -3
- package/dist/features/button/adapters/inbound/IconButton.js.map +1 -1
- package/dist/features/card/adapters/inbound/Card.d.ts.map +1 -1
- package/dist/features/card/adapters/inbound/Card.js +3 -3
- package/dist/features/card/adapters/inbound/Card.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 +3 -3
- package/dist/features/form/checkbox/adapters/inbound/Checkbox.js.map +1 -1
- package/dist/{components/field → features/form/field/adapters/inbound}/Field.d.ts +2 -2
- package/dist/features/form/field/adapters/inbound/Field.d.ts.map +1 -0
- package/dist/features/form/field/adapters/inbound/Field.js +40 -0
- package/dist/features/form/field/adapters/inbound/Field.js.map +1 -0
- package/dist/features/form/field/public.d.ts +3 -0
- package/dist/features/form/field/public.d.ts.map +1 -0
- package/dist/features/form/field/public.js +2 -0
- package/dist/features/form/field/public.js.map +1 -0
- package/dist/features/form/radio/adapters/inbound/Radio.d.ts.map +1 -1
- package/dist/features/form/radio/adapters/inbound/Radio.js +3 -3
- package/dist/features/form/radio/adapters/inbound/Radio.js.map +1 -1
- package/dist/{components/switch → features/form/switch/adapters/inbound}/Switch.d.ts +1 -1
- package/dist/features/form/switch/adapters/inbound/Switch.d.ts.map +1 -0
- package/dist/features/form/switch/adapters/inbound/Switch.js +52 -0
- package/dist/features/form/switch/adapters/inbound/Switch.js.map +1 -0
- package/dist/features/form/switch/public.d.ts +3 -0
- package/dist/features/form/switch/public.d.ts.map +1 -0
- package/dist/features/form/switch/public.js +2 -0
- package/dist/features/form/switch/public.js.map +1 -0
- package/dist/features/form/text-input/adapters/inbound/TextInput.d.ts.map +1 -1
- package/dist/features/form/text-input/adapters/inbound/TextInput.js +8 -4
- package/dist/features/form/text-input/adapters/inbound/TextInput.js.map +1 -1
- package/dist/features/list/adapters/inbound/List.d.ts +5 -0
- package/dist/features/list/adapters/inbound/List.d.ts.map +1 -0
- package/dist/features/list/adapters/inbound/List.js +7 -0
- package/dist/features/list/adapters/inbound/List.js.map +1 -0
- package/dist/features/list/adapters/inbound/ListItem.d.ts +5 -0
- package/dist/features/list/adapters/inbound/ListItem.d.ts.map +1 -0
- package/dist/features/list/adapters/inbound/ListItem.js +59 -0
- package/dist/features/list/adapters/inbound/ListItem.js.map +1 -0
- package/dist/features/list/public.d.ts +4 -0
- package/dist/features/list/public.d.ts.map +1 -0
- package/dist/features/list/public.js +3 -0
- package/dist/features/list/public.js.map +1 -0
- package/dist/features/pressable/adapters/inbound/Pressable.d.ts +5 -0
- package/dist/features/pressable/adapters/inbound/Pressable.d.ts.map +1 -0
- package/dist/features/pressable/adapters/inbound/Pressable.js +48 -0
- package/dist/features/pressable/adapters/inbound/Pressable.js.map +1 -0
- package/dist/features/pressable/public.d.ts +3 -0
- package/dist/features/pressable/public.d.ts.map +1 -0
- package/dist/features/pressable/public.js +2 -0
- package/dist/features/pressable/public.js.map +1 -0
- package/dist/index.d.ts +8 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -7
- package/dist/index.js.map +1 -1
- package/dist/types/button.d.ts +3 -3
- package/dist/types/button.d.ts.map +1 -1
- package/dist/types/button.js.map +1 -1
- package/dist/types/checkbox.d.ts +2 -2
- package/dist/types/checkbox.d.ts.map +1 -1
- package/dist/types/checkbox.js.map +1 -1
- package/dist/{components/field/types.d.ts → types/field.d.ts} +1 -1
- package/dist/types/field.d.ts.map +1 -0
- package/dist/types/field.js +2 -0
- package/dist/types/field.js.map +1 -0
- package/dist/types/list.d.ts +20 -0
- package/dist/types/list.d.ts.map +1 -0
- package/dist/types/list.js +2 -0
- package/dist/types/list.js.map +1 -0
- package/dist/{primitives/button-base/types.d.ts → types/pressable.d.ts} +5 -5
- package/dist/types/pressable.d.ts.map +1 -0
- package/dist/types/pressable.js +2 -0
- package/dist/types/pressable.js.map +1 -0
- package/dist/types/radio.d.ts +2 -2
- package/dist/types/radio.d.ts.map +1 -1
- package/dist/types/radio.js.map +1 -1
- package/dist/types/switch.d.ts +15 -0
- package/dist/types/switch.d.ts.map +1 -0
- package/dist/types/switch.js +2 -0
- package/dist/types/switch.js.map +1 -0
- package/package.json +1 -1
- package/src/features/button/adapters/inbound/Button.tsx +6 -6
- package/src/features/button/adapters/inbound/IconButton.tsx +3 -3
- package/src/features/card/adapters/inbound/Card.tsx +3 -3
- package/src/features/form/checkbox/adapters/inbound/Checkbox.tsx +5 -5
- package/src/features/form/field/adapters/inbound/Field.tsx +82 -0
- package/src/features/form/field/public.ts +2 -0
- package/src/features/form/radio/adapters/inbound/Radio.tsx +5 -5
- package/src/features/form/switch/adapters/inbound/Switch.tsx +123 -0
- package/src/features/form/switch/public.ts +2 -0
- package/src/features/form/text-input/adapters/inbound/TextInput.tsx +21 -5
- package/src/features/list/adapters/inbound/List.tsx +9 -0
- package/src/features/list/adapters/inbound/ListItem.tsx +128 -0
- package/src/features/list/public.test.ts +13 -0
- package/src/features/list/public.ts +3 -0
- package/src/{primitives/button-base/ButtonBase.tsx → features/pressable/adapters/inbound/Pressable.tsx} +45 -31
- package/src/features/pressable/public.ts +2 -0
- package/src/index.test.ts +17 -11
- package/src/index.ts +8 -14
- package/src/interactionPolicy.test.ts +4 -4
- package/src/types/button.ts +3 -3
- package/src/types/checkbox.ts +2 -2
- package/src/types/list.ts +22 -0
- package/src/{primitives/button-base/types.ts → types/pressable.ts} +4 -4
- package/src/types/radio.ts +2 -2
- package/src/{components/switch/types.ts → types/switch.ts} +4 -4
- package/dist/components/field/Field.d.ts.map +0 -1
- package/dist/components/field/Field.js +0 -27
- package/dist/components/field/Field.js.map +0 -1
- package/dist/components/field/index.d.ts +0 -3
- package/dist/components/field/index.d.ts.map +0 -1
- package/dist/components/field/index.js +0 -2
- package/dist/components/field/index.js.map +0 -1
- package/dist/components/field/types.d.ts.map +0 -1
- package/dist/components/field/types.js +0 -2
- package/dist/components/field/types.js.map +0 -1
- package/dist/components/helper-text/HelperText.d.ts +0 -4
- package/dist/components/helper-text/HelperText.d.ts.map +0 -1
- package/dist/components/helper-text/HelperText.js +0 -8
- package/dist/components/helper-text/HelperText.js.map +0 -1
- package/dist/components/helper-text/index.d.ts +0 -3
- package/dist/components/helper-text/index.d.ts.map +0 -1
- package/dist/components/helper-text/index.js +0 -2
- package/dist/components/helper-text/index.js.map +0 -1
- package/dist/components/helper-text/types.d.ts +0 -9
- package/dist/components/helper-text/types.d.ts.map +0 -1
- package/dist/components/helper-text/types.js +0 -2
- package/dist/components/helper-text/types.js.map +0 -1
- package/dist/components/label/Label.d.ts +0 -4
- package/dist/components/label/Label.d.ts.map +0 -1
- package/dist/components/label/Label.js +0 -11
- package/dist/components/label/Label.js.map +0 -1
- package/dist/components/label/index.d.ts +0 -3
- package/dist/components/label/index.d.ts.map +0 -1
- package/dist/components/label/index.js +0 -2
- package/dist/components/label/index.js.map +0 -1
- package/dist/components/label/types.d.ts +0 -10
- package/dist/components/label/types.d.ts.map +0 -1
- package/dist/components/label/types.js +0 -2
- package/dist/components/label/types.js.map +0 -1
- package/dist/components/list-item/ListItem.d.ts +0 -5
- package/dist/components/list-item/ListItem.d.ts.map +0 -1
- package/dist/components/list-item/ListItem.js +0 -44
- package/dist/components/list-item/ListItem.js.map +0 -1
- package/dist/components/list-item/index.d.ts +0 -3
- package/dist/components/list-item/index.d.ts.map +0 -1
- package/dist/components/list-item/index.js +0 -2
- package/dist/components/list-item/index.js.map +0 -1
- package/dist/components/list-item/types.d.ts +0 -11
- package/dist/components/list-item/types.d.ts.map +0 -1
- package/dist/components/list-item/types.js +0 -2
- package/dist/components/list-item/types.js.map +0 -1
- package/dist/components/switch/Switch.d.ts.map +0 -1
- package/dist/components/switch/Switch.js +0 -68
- package/dist/components/switch/Switch.js.map +0 -1
- package/dist/components/switch/index.d.ts +0 -3
- package/dist/components/switch/index.d.ts.map +0 -1
- package/dist/components/switch/index.js +0 -2
- package/dist/components/switch/index.js.map +0 -1
- package/dist/components/switch/types.d.ts +0 -15
- package/dist/components/switch/types.d.ts.map +0 -1
- package/dist/components/switch/types.js +0 -2
- package/dist/components/switch/types.js.map +0 -1
- package/dist/components/textarea/Textarea.d.ts +0 -4
- package/dist/components/textarea/Textarea.d.ts.map +0 -1
- package/dist/components/textarea/Textarea.js +0 -6
- package/dist/components/textarea/Textarea.js.map +0 -1
- package/dist/components/textarea/index.d.ts +0 -3
- package/dist/components/textarea/index.d.ts.map +0 -1
- package/dist/components/textarea/index.js +0 -2
- package/dist/components/textarea/index.js.map +0 -1
- package/dist/components/textarea/types.d.ts +0 -5
- package/dist/components/textarea/types.d.ts.map +0 -1
- package/dist/components/textarea/types.js +0 -2
- package/dist/components/textarea/types.js.map +0 -1
- package/dist/primitives/button-base/ButtonBase.d.ts +0 -5
- package/dist/primitives/button-base/ButtonBase.d.ts.map +0 -1
- package/dist/primitives/button-base/ButtonBase.js +0 -42
- package/dist/primitives/button-base/ButtonBase.js.map +0 -1
- package/dist/primitives/button-base/index.d.ts +0 -3
- package/dist/primitives/button-base/index.d.ts.map +0 -1
- package/dist/primitives/button-base/index.js +0 -2
- package/dist/primitives/button-base/index.js.map +0 -1
- package/dist/primitives/button-base/types.d.ts.map +0 -1
- package/dist/primitives/button-base/types.js +0 -2
- package/dist/primitives/button-base/types.js.map +0 -1
- package/src/components/field/Field.tsx +0 -52
- package/src/components/field/index.ts +0 -2
- package/src/components/helper-text/HelperText.tsx +0 -12
- package/src/components/helper-text/index.ts +0 -2
- package/src/components/helper-text/types.ts +0 -10
- package/src/components/label/Label.tsx +0 -23
- package/src/components/label/index.ts +0 -2
- package/src/components/label/types.ts +0 -11
- package/src/components/list-item/ListItem.tsx +0 -76
- package/src/components/list-item/index.ts +0 -2
- package/src/components/list-item/types.ts +0 -11
- package/src/components/switch/Switch.tsx +0 -113
- package/src/components/switch/index.ts +0 -2
- package/src/components/textarea/Textarea.tsx +0 -15
- package/src/components/textarea/index.ts +0 -2
- package/src/components/textarea/types.ts +0 -5
- package/src/primitives/button-base/index.ts +0 -2
- /package/src/{components/field/types.ts → types/field.ts} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/helper-text/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export { HelperText } from './HelperText';\nexport type { HelperTextProps } from './types';\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';
|
|
3
|
-
export interface HelperTextProps {
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
emphasis?: Extract<SurfaceEmphasis, 'default' | 'muted'>;
|
|
6
|
-
color?: Extract<SurfaceColor, 'error'>;
|
|
7
|
-
testID?: string;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/helper-text/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAExE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC,eAAe,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC;IACzD,KAAK,CAAC,EAAE,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/helper-text/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';\n\nexport interface HelperTextProps {\n children?: React.ReactNode;\n emphasis?: Extract<SurfaceEmphasis, 'default' | 'muted'>;\n color?: Extract<SurfaceColor, 'error'>;\n testID?: string;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../src/components/label/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,KAAK,CAAC,EACpB,QAAQ,EACR,QAAgB,EAChB,QAAoB,EACpB,KAAK,EACL,MAAM,GACP,EAAE,UAAU,qBAWZ"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Text } from '../../features/typography/public';
|
|
3
|
-
export function Label({ children, required = false, emphasis = 'default', color, testID, }) {
|
|
4
|
-
return (<Text color={color} emphasis={emphasis} testID={testID} variant="label" weight="medium">
|
|
5
|
-
{children}
|
|
6
|
-
{required ? (<Text color="error" variant="label" weight="medium">
|
|
7
|
-
{' *'}
|
|
8
|
-
</Text>) : null}
|
|
9
|
-
</Text>);
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=Label.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Label.js","sourceRoot":"","sources":["../../../src/components/label/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAGxD,MAAM,UAAU,KAAK,CAAC,EACpB,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,SAAS,EACpB,KAAK,EACL,MAAM,GACK;IACX,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CACrF;MAAA,CAAC,QAAQ,CACT;MAAA,CAAC,QAAQ,CAAC,CAAC,CAAC,CACV,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CACjD;UAAA,CAAC,IAAI,CACP;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 { Text } from '../../features/typography/public';\nimport type { LabelProps } from './types';\n\nexport function Label({\n children,\n required = false,\n emphasis = 'default',\n color,\n testID,\n}: LabelProps) {\n return (\n <Text color={color} emphasis={emphasis} testID={testID} variant=\"label\" weight=\"medium\">\n {children}\n {required ? (\n <Text color=\"error\" variant=\"label\" weight=\"medium\">\n {' *'}\n </Text>\n ) : null}\n </Text>\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/label/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/label/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC","sourcesContent":["export { Label } from './Label';\nexport type { LabelProps } from './types';\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';
|
|
3
|
-
export interface LabelProps {
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
required?: boolean;
|
|
6
|
-
emphasis?: Extract<SurfaceEmphasis, 'default' | 'muted'>;
|
|
7
|
-
color?: Extract<SurfaceColor, 'error'>;
|
|
8
|
-
testID?: string;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/label/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAExE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC,eAAe,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC;IACzD,KAAK,CAAC,EAAE,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/label/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';\n\nexport interface LabelProps {\n children?: React.ReactNode;\n required?: boolean;\n emphasis?: Extract<SurfaceEmphasis, 'default' | 'muted'>;\n color?: Extract<SurfaceColor, 'error'>;\n testID?: string;\n}\n"]}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ListItemProps } from './types';
|
|
3
|
-
/*** Renders a static or pressable list item. */
|
|
4
|
-
export declare function ListItem({ onPress, disabled, testID, ...content }: ListItemProps): React.JSX.Element;
|
|
5
|
-
//# sourceMappingURL=ListItem.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../../../src/components/list-item/ListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AA4C7C,gDAAgD;AAChD,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAgB,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,EAAE,aAAa,qBAuBxF"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View as ReactNativeView } from 'react-native';
|
|
3
|
-
import { View } from '../../features/layout/public';
|
|
4
|
-
import { Text } from '../../features/typography/public';
|
|
5
|
-
import { ButtonBase } from '../../primitives/button-base';
|
|
6
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
7
|
-
/*** Renders the content row shared by static and interactive ListItem variants. */
|
|
8
|
-
function ListItemContent({ title, description, leading, trailing, testID, }) {
|
|
9
|
-
const { theme } = useTheme();
|
|
10
|
-
return (<View px="m" py="m" testID={testID} style={{
|
|
11
|
-
flexDirection: 'row',
|
|
12
|
-
alignItems: 'center',
|
|
13
|
-
}}>
|
|
14
|
-
{leading ? (<ReactNativeView style={{ marginRight: theme.spacing.m }}>{leading}</ReactNativeView>) : null}
|
|
15
|
-
<View flex={1}>
|
|
16
|
-
{title ? (<Text numberOfLines={1} variant="body" weight="medium">
|
|
17
|
-
{title}
|
|
18
|
-
</Text>) : null}
|
|
19
|
-
{description ? (<Text emphasis="muted" numberOfLines={2} variant="bodySmall">
|
|
20
|
-
{description}
|
|
21
|
-
</Text>) : null}
|
|
22
|
-
</View>
|
|
23
|
-
{trailing ? (<ReactNativeView style={{ marginLeft: theme.spacing.m }}>{trailing}</ReactNativeView>) : null}
|
|
24
|
-
</View>);
|
|
25
|
-
}
|
|
26
|
-
/*** Renders a static or pressable list item. */
|
|
27
|
-
export function ListItem({ onPress, disabled = false, testID, ...content }) {
|
|
28
|
-
const { theme } = useTheme();
|
|
29
|
-
if (!onPress)
|
|
30
|
-
return <ListItemContent {...content} testID={testID}/>;
|
|
31
|
-
return (<ButtonBase accessibilityRole="button" disabled={disabled} onPress={onPress} testID={testID}>
|
|
32
|
-
{(state) => (<View style={{
|
|
33
|
-
backgroundColor: state.pressed
|
|
34
|
-
? theme.semantics.neutral.surfaceActive
|
|
35
|
-
: state.hovered
|
|
36
|
-
? theme.semantics.neutral.surfaceHover
|
|
37
|
-
: 'transparent',
|
|
38
|
-
opacity: state.disabled ? 0.72 : 1,
|
|
39
|
-
}}>
|
|
40
|
-
<ListItemContent {...content}/>
|
|
41
|
-
</View>)}
|
|
42
|
-
</ButtonBase>);
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=ListItem.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.js","sourceRoot":"","sources":["../../../src/components/list-item/ListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,mFAAmF;AACnF,SAAS,eAAe,CAAC,EACvB,KAAK,EACL,WAAW,EACX,OAAO,EACP,QAAQ,EACR,MAAM,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,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC;AAED,gDAAgD;AAChD,MAAM,UAAU,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,EAAiB;IACvF,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAE7B,IAAI,CAAC,OAAO;QAAE,OAAO,CAAC,eAAe,CAAC,IAAI,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,EAAG,CAAC;IAEtE,OAAO,CACL,CAAC,UAAU,CAAC,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAC1F;MAAA,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACV,CAAC,IAAI,CACH,KAAK,CAAC,CAAC;gBACL,eAAe,EAAE,KAAK,CAAC,OAAO;oBAC5B,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,aAAa;oBACvC,CAAC,CAAC,KAAK,CAAC,OAAO;wBACb,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY;wBACtC,CAAC,CAAC,aAAa;gBACnB,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACnC,CAAC,CAEF;UAAA,CAAC,eAAe,CAAC,IAAI,OAAO,CAAC,EAC/B;QAAA,EAAE,IAAI,CAAC,CACR,CACH;IAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { View as ReactNativeView } from 'react-native';\n\nimport { View } from '../../features/layout/public';\nimport { Text } from '../../features/typography/public';\nimport { ButtonBase } from '../../primitives/button-base';\nimport { useTheme } from '../../theme/ThemeContext';\nimport type { ListItemProps } from './types';\n\n/*** Renders the content row shared by static and interactive ListItem variants. */\nfunction ListItemContent({\n title,\n description,\n leading,\n trailing,\n testID,\n}: Omit<ListItemProps, 'disabled' | 'onPress'>) {\n const { theme } = useTheme();\n\n return (\n <View\n px=\"m\"\n py=\"m\"\n testID={testID}\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n }}\n >\n {leading ? (\n <ReactNativeView style={{ marginRight: theme.spacing.m }}>{leading}</ReactNativeView>\n ) : null}\n <View flex={1}>\n {title ? (\n <Text numberOfLines={1} variant=\"body\" weight=\"medium\">\n {title}\n </Text>\n ) : null}\n {description ? (\n <Text emphasis=\"muted\" numberOfLines={2} variant=\"bodySmall\">\n {description}\n </Text>\n ) : null}\n </View>\n {trailing ? (\n <ReactNativeView style={{ marginLeft: theme.spacing.m }}>{trailing}</ReactNativeView>\n ) : null}\n </View>\n );\n}\n\n/*** Renders a static or pressable list item. */\nexport function ListItem({ onPress, disabled = false, testID, ...content }: ListItemProps) {\n const { theme } = useTheme();\n\n if (!onPress) return <ListItemContent {...content} testID={testID} />;\n\n return (\n <ButtonBase accessibilityRole=\"button\" disabled={disabled} onPress={onPress} testID={testID}>\n {(state) => (\n <View\n style={{\n backgroundColor: state.pressed\n ? theme.semantics.neutral.surfaceActive\n : state.hovered\n ? theme.semantics.neutral.surfaceHover\n : 'transparent',\n opacity: state.disabled ? 0.72 : 1,\n }}\n >\n <ListItemContent {...content} />\n </View>\n )}\n </ButtonBase>\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/list-item/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/list-item/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export { ListItem } from './ListItem';\nexport type { ListItemProps } from './types';\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
export interface ListItemProps {
|
|
3
|
-
title?: React.ReactNode;
|
|
4
|
-
description?: React.ReactNode;
|
|
5
|
-
leading?: React.ReactNode;
|
|
6
|
-
trailing?: React.ReactNode;
|
|
7
|
-
onPress?: (() => void) | undefined;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
testID?: string;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/list-item/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/list-item/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nexport interface ListItemProps {\n title?: React.ReactNode;\n description?: React.ReactNode;\n leading?: React.ReactNode;\n trailing?: React.ReactNode;\n onPress?: (() => void) | undefined;\n disabled?: boolean;\n testID?: string;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/components/switch/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,+DAA+D;AAC/D,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,OAAO,EACP,cAAsB,EACtB,eAAe,EACf,KAAiB,EACjB,IAAU,EACV,QAAgB,EAChB,OAAe,EACf,QAAgB,EAChB,kBAAkB,EAClB,MAAM,EACN,GAAG,KAAK,EACT,EAAE,WAAW,qBAmFb"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View } from '../../features/layout/public';
|
|
3
|
-
import { Text } from '../../features/typography/public';
|
|
4
|
-
import { resolveFieldState, resolveIndicatorSize, resolveSelectionControlColors, resolveSelectionControlNextChecked, } from '../../internal/resolvers';
|
|
5
|
-
import { useControllableState } from '../../internal/useControllableState';
|
|
6
|
-
import { ButtonBase } from '../../primitives/button-base';
|
|
7
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
8
|
-
/*** Renders a controlled or uncontrolled accessible switch. */
|
|
9
|
-
export function Switch({ children, checked, defaultChecked = false, onCheckedChange, color = 'primary', size = 'm', disabled = false, invalid = false, readOnly = false, accessibilityLabel, testID, ...props }) {
|
|
10
|
-
const { theme } = useTheme();
|
|
11
|
-
const [isChecked, setChecked] = useControllableState({
|
|
12
|
-
value: checked,
|
|
13
|
-
defaultValue: defaultChecked,
|
|
14
|
-
onChange: onCheckedChange,
|
|
15
|
-
});
|
|
16
|
-
const indicatorSize = resolveIndicatorSize(size);
|
|
17
|
-
const nextChecked = resolveSelectionControlNextChecked({
|
|
18
|
-
checked: isChecked,
|
|
19
|
-
disabled,
|
|
20
|
-
kind: 'switch',
|
|
21
|
-
readOnly,
|
|
22
|
-
});
|
|
23
|
-
return (<ButtonBase {...props} accessibilityLabel={accessibilityLabel} accessibilityRole="switch" accessibilityState={{ checked: isChecked }} disabled={disabled} onPress={nextChecked === null ? undefined : () => setChecked(nextChecked)} testID={testID}>
|
|
24
|
-
{(interactionState) => {
|
|
25
|
-
const fieldState = resolveFieldState({
|
|
26
|
-
disabled,
|
|
27
|
-
focused: interactionState.focused,
|
|
28
|
-
invalid,
|
|
29
|
-
readOnly,
|
|
30
|
-
});
|
|
31
|
-
const colors = resolveSelectionControlColors(theme, {
|
|
32
|
-
checked: isChecked,
|
|
33
|
-
fieldState,
|
|
34
|
-
hovered: interactionState.hovered,
|
|
35
|
-
pressed: interactionState.pressed,
|
|
36
|
-
color,
|
|
37
|
-
});
|
|
38
|
-
const labelEmphasis = colors.labelColor === theme.semantics.content.muted ? 'muted' : 'default';
|
|
39
|
-
return (<View style={{
|
|
40
|
-
alignItems: 'center',
|
|
41
|
-
flexDirection: 'row',
|
|
42
|
-
opacity: colors.opacity,
|
|
43
|
-
}}>
|
|
44
|
-
<View radius="full" style={{
|
|
45
|
-
backgroundColor: colors.trackColor,
|
|
46
|
-
borderColor: colors.borderColor,
|
|
47
|
-
borderWidth: 1,
|
|
48
|
-
justifyContent: 'center',
|
|
49
|
-
minWidth: indicatorSize.switchWidth,
|
|
50
|
-
paddingHorizontal: 2,
|
|
51
|
-
width: indicatorSize.switchWidth,
|
|
52
|
-
height: indicatorSize.switchHeight,
|
|
53
|
-
}}>
|
|
54
|
-
<View radius="full" style={{
|
|
55
|
-
alignSelf: isChecked ? 'flex-end' : 'flex-start',
|
|
56
|
-
backgroundColor: colors.thumbColor,
|
|
57
|
-
height: indicatorSize.switchThumb,
|
|
58
|
-
width: indicatorSize.switchThumb,
|
|
59
|
-
}}/>
|
|
60
|
-
</View>
|
|
61
|
-
{children ? (<View ml="s">
|
|
62
|
-
<Text emphasis={labelEmphasis}>{children}</Text>
|
|
63
|
-
</View>) : null}
|
|
64
|
-
</View>);
|
|
65
|
-
}}
|
|
66
|
-
</ButtonBase>);
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=Switch.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C,WAAW;oBACnC,iBAAiB,EAAE,CAAC;oBACpB,KAAK,EAAE,aAAa,CAAC,WAAW;oBAChC,MAAM,EAAE,aAAa,CAAC,YAAY;iBACnC,CAAC,CAEF;cAAA,CAAC,IAAI,CACH,MAAM,CAAC,MAAM,CACb,KAAK,CAAC,CAAC;oBACL,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;oBAChD,eAAe,EAAE,MAAM,CAAC,UAAU;oBAClC,MAAM,EAAE,aAAa,CAAC,WAAW;oBACjC,KAAK,EAAE,aAAa,CAAC,WAAW;iBACjC,CAAC,EAEN;YAAA,EAAE,IAAI,CACN;YAAA,CAAC,QAAQ,CAAC,CAAC,CAAC,CACV,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CACV;gBAAA,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,CACjD;cAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,IAAI,CACV;UAAA,EAAE,IAAI,CAAC,CACR,CAAC;QACJ,CAAC,CACH;IAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport { View } from '../../features/layout/public';\nimport { Text } from '../../features/typography/public';\nimport {\n resolveFieldState,\n resolveIndicatorSize,\n resolveSelectionControlColors,\n resolveSelectionControlNextChecked,\n} from '../../internal/resolvers';\nimport { useControllableState } from '../../internal/useControllableState';\nimport { ButtonBase } from '../../primitives/button-base';\nimport { useTheme } from '../../theme/ThemeContext';\nimport type { SwitchProps } from './types';\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 indicatorSize = resolveIndicatorSize(size);\n const nextChecked = resolveSelectionControlNextChecked({\n checked: isChecked,\n disabled,\n kind: 'switch',\n readOnly,\n });\n\n return (\n <ButtonBase\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 const fieldState = resolveFieldState({\n disabled,\n focused: interactionState.focused,\n invalid,\n readOnly,\n });\n const colors = resolveSelectionControlColors(theme, {\n checked: isChecked,\n fieldState,\n hovered: interactionState.hovered,\n pressed: interactionState.pressed,\n color,\n });\n const labelEmphasis =\n colors.labelColor === theme.semantics.content.muted ? 'muted' : 'default';\n\n return (\n <View\n style={{\n alignItems: 'center',\n flexDirection: 'row',\n opacity: colors.opacity,\n }}\n >\n <View\n radius=\"full\"\n style={{\n backgroundColor: colors.trackColor,\n borderColor: colors.borderColor,\n borderWidth: 1,\n justifyContent: 'center',\n minWidth: indicatorSize.switchWidth,\n paddingHorizontal: 2,\n width: indicatorSize.switchWidth,\n height: indicatorSize.switchHeight,\n }}\n >\n <View\n radius=\"full\"\n style={{\n alignSelf: isChecked ? 'flex-end' : 'flex-start',\n backgroundColor: colors.thumbColor,\n height: indicatorSize.switchThumb,\n width: indicatorSize.switchThumb,\n }}\n />\n </View>\n {children ? (\n <View ml=\"s\">\n <Text emphasis={labelEmphasis}>{children}</Text>\n </View>\n ) : null}\n </View>\n );\n }}\n </ButtonBase>\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/switch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/switch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export { Switch } from './Switch';\nexport type { SwitchProps } from './types';\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { ControlSize } from '../../internal/resolvers/resolveControlSize';
|
|
3
|
-
import type { ButtonBaseProps } from '../../primitives/button-base';
|
|
4
|
-
import type { SurfaceColor } from '../../surfaceColor';
|
|
5
|
-
export interface SwitchProps extends Omit<ButtonBaseProps, 'accessibilityRole' | 'accessibilityState' | 'children' | 'onPress' | 'style'> {
|
|
6
|
-
children?: React.ReactNode;
|
|
7
|
-
checked?: boolean;
|
|
8
|
-
defaultChecked?: boolean;
|
|
9
|
-
onCheckedChange?: ((checked: boolean) => void) | undefined;
|
|
10
|
-
color?: SurfaceColor;
|
|
11
|
-
size?: ControlSize;
|
|
12
|
-
invalid?: boolean;
|
|
13
|
-
readOnly?: boolean;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/switch/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,WAAY,SAAQ,IAAI,CACvC,eAAe,EACf,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/switch/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { ControlSize } from '../../internal/resolvers/resolveControlSize';\nimport type { ButtonBaseProps } from '../../primitives/button-base';\nimport type { SurfaceColor } from '../../surfaceColor';\n\nexport interface SwitchProps extends Omit<\n ButtonBaseProps,\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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../../src/components/textarea/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,wBAAgB,QAAQ,CAAC,EAAE,IAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,qBASnF"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { TextInput } from '../../features/form/text-input/public';
|
|
3
|
-
export function Textarea({ rows = 4, numberOfLines, style, ...props }) {
|
|
4
|
-
return (<TextInput {...props} multiline numberOfLines={numberOfLines ?? rows} style={[{ textAlignVertical: 'top' }, style]}/>);
|
|
5
|
-
}
|
|
6
|
-
//# sourceMappingURL=Textarea.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../../src/components/textarea/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAGlE,MAAM,UAAU,QAAQ,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,KAAK,EAAiB;IAClF,OAAO,CACL,CAAC,SAAS,CACR,IAAI,KAAK,CAAC,CACV,SAAS,CACT,aAAa,CAAC,CAAC,aAAa,IAAI,IAAI,CAAC,CACrC,KAAK,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC,EAC7C,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport { TextInput } from '../../features/form/text-input/public';\nimport type { TextareaProps } from './types';\n\nexport function Textarea({ rows = 4, numberOfLines, style, ...props }: TextareaProps) {\n return (\n <TextInput\n {...props}\n multiline\n numberOfLines={numberOfLines ?? rows}\n style={[{ textAlignVertical: 'top' }, style]}\n />\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/textarea/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/textarea/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export { Textarea } from './Textarea';\nexport type { TextareaProps } from './types';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/textarea/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/textarea/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TextInputProps } from '../../types/text-input';\n\nexport interface TextareaProps extends Omit<TextInputProps, 'multiline'> {\n rows?: number;\n}\n"]}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ButtonBaseProps } from './types';
|
|
3
|
-
/*** Renders the low-level token-aware Pressable boundary shared by Surface controls. */
|
|
4
|
-
export declare function ButtonBase({ children, disabled, interactionPolicy, onPress, onLongPress, accessibilityLabel, accessibilityRole, accessibilityState, style, testID, ...props }: ButtonBaseProps): React.JSX.Element;
|
|
5
|
-
//# sourceMappingURL=ButtonBase.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.d.ts","sourceRoot":"","sources":["../../../src/primitives/button-base/ButtonBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAiB/C,wFAAwF;AACxF,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,QAAgB,EAChB,iBAA6B,EAC7B,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,iBAA4B,EAC5B,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,GAAG,KAAK,EACT,EAAE,eAAe,qBAuCjB"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Platform, Pressable } from 'react-native';
|
|
3
|
-
import { useResponsiveRuntime } from '../../core/responsive';
|
|
4
|
-
import { resolveFocusRingStyles, resolveInteractiveState, } from '../../internal/resolvers';
|
|
5
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
6
|
-
import { resolveViewStyles } from '../../utils/resolveViewStyles';
|
|
7
|
-
/*** Resolves one Pressable state into the canonical Surface interaction state. */
|
|
8
|
-
function getInteractionState(pressableState, hovered, focused, disabled) {
|
|
9
|
-
return resolveInteractiveState({
|
|
10
|
-
pressed: pressableState.pressed,
|
|
11
|
-
hovered,
|
|
12
|
-
focused,
|
|
13
|
-
disabled,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
/*** Renders the low-level token-aware Pressable boundary shared by Surface controls. */
|
|
17
|
-
export function ButtonBase({ children, disabled = false, interactionPolicy = 'enabled', onPress, onLongPress, accessibilityLabel, accessibilityRole = 'button', accessibilityState, style, testID, ...props }) {
|
|
18
|
-
const { theme } = useTheme();
|
|
19
|
-
const { breakpoint } = useResponsiveRuntime();
|
|
20
|
-
const [hovered, setHovered] = React.useState(false);
|
|
21
|
-
const [focused, setFocused] = React.useState(false);
|
|
22
|
-
const isWeb = Platform.OS === 'web';
|
|
23
|
-
const resolvedViewStyles = resolveViewStyles(theme, breakpoint, props);
|
|
24
|
-
const passive = interactionPolicy === 'passive';
|
|
25
|
-
return (<Pressable accessibilityLabel={accessibilityLabel} accessibilityRole={accessibilityRole} accessibilityState={{ ...accessibilityState, disabled }} disabled={disabled} onBlur={() => setFocused(false)} onFocus={() => {
|
|
26
|
-
if (isWeb)
|
|
27
|
-
setFocused(true);
|
|
28
|
-
}} onHoverIn={isWeb ? () => setHovered(true) : undefined} onHoverOut={isWeb ? () => setHovered(false) : undefined} onLongPress={passive ? undefined : onLongPress} onPress={passive ? undefined : onPress} style={(pressableState) => {
|
|
29
|
-
const state = getInteractionState(pressableState, hovered, focused, disabled);
|
|
30
|
-
return [
|
|
31
|
-
resolvedViewStyles,
|
|
32
|
-
resolveFocusRingStyles(theme.semantics.border.focus, state.focused, isWeb),
|
|
33
|
-
style,
|
|
34
|
-
];
|
|
35
|
-
}} testID={testID}>
|
|
36
|
-
{(pressableState) => {
|
|
37
|
-
const state = getInteractionState(pressableState, hovered, focused, disabled);
|
|
38
|
-
return typeof children === 'function' ? children(state) : children;
|
|
39
|
-
}}
|
|
40
|
-
</Pressable>);
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=ButtonBase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.js","sourceRoot":"","sources":["../../../src/primitives/button-base/ButtonBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAmC,MAAM,cAAc,CAAC;AAEpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAEL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGlE,kFAAkF;AAClF,SAAS,mBAAmB,CAC1B,cAA0C,EAC1C,OAAgB,EAChB,OAAgB,EAChB,QAAiB;IAEjB,OAAO,uBAAuB,CAAC;QAC7B,OAAO,EAAE,cAAc,CAAC,OAAO;QAC/B,OAAO;QACP,OAAO;QACP,QAAQ;KACT,CAAC,CAAC;AACL,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,UAAU,CAAC,EACzB,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,iBAAiB,GAAG,SAAS,EAC7B,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,iBAAiB,GAAG,QAAQ,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,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAC/C,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CACvC,KAAK,CAAC,CAAC,CAAC,cAAc,EAAE,EAAE;YACxB,MAAM,KAAK,GAAG,mBAAmB,CAAC,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;YAC9E,OAAO;gBACL,kBAAkB;gBAClB,sBAAsB,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC;gBAC1E,KAAK;aACN,CAAC;QACJ,CAAC,CAAC,CACF,MAAM,CAAC,CAAC,MAAM,CAAC,CAEf;MAAA,CAAC,CAAC,cAAc,EAAE,EAAE;YAClB,MAAM,KAAK,GAAG,mBAAmB,CAAC,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;YAC9E,OAAO,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QACrE,CAAC,CACH;IAAA,EAAE,SAAS,CAAC,CACb,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { Platform, Pressable, type PressableStateCallbackType } from 'react-native';\n\nimport { useResponsiveRuntime } from '../../core/responsive';\nimport {\n type InteractionState,\n resolveFocusRingStyles,\n resolveInteractiveState,\n} from '../../internal/resolvers';\nimport { useTheme } from '../../theme/ThemeContext';\nimport { resolveViewStyles } from '../../utils/resolveViewStyles';\nimport type { ButtonBaseProps } from './types';\n\n/*** Resolves one Pressable state into the canonical Surface interaction state. */\nfunction getInteractionState(\n pressableState: PressableStateCallbackType,\n hovered: boolean,\n focused: boolean,\n disabled: boolean,\n): InteractionState {\n return resolveInteractiveState({\n pressed: pressableState.pressed,\n hovered,\n focused,\n disabled,\n });\n}\n\n/*** Renders the low-level token-aware Pressable boundary shared by Surface controls. */\nexport function ButtonBase({\n children,\n disabled = false,\n interactionPolicy = 'enabled',\n onPress,\n onLongPress,\n accessibilityLabel,\n accessibilityRole = 'button',\n accessibilityState,\n style,\n testID,\n ...props\n}: ButtonBaseProps) {\n const { theme } = useTheme();\n const { breakpoint } = useResponsiveRuntime();\n const [hovered, setHovered] = React.useState(false);\n const [focused, setFocused] = React.useState(false);\n const isWeb = Platform.OS === 'web';\n const resolvedViewStyles = resolveViewStyles(theme, breakpoint, props);\n const passive = interactionPolicy === 'passive';\n\n return (\n <Pressable\n accessibilityLabel={accessibilityLabel}\n accessibilityRole={accessibilityRole}\n accessibilityState={{ ...accessibilityState, disabled }}\n disabled={disabled}\n onBlur={() => setFocused(false)}\n onFocus={() => {\n if (isWeb) setFocused(true);\n }}\n onHoverIn={isWeb ? () => setHovered(true) : undefined}\n onHoverOut={isWeb ? () => setHovered(false) : undefined}\n onLongPress={passive ? undefined : onLongPress}\n onPress={passive ? undefined : onPress}\n style={(pressableState) => {\n const state = getInteractionState(pressableState, hovered, focused, disabled);\n return [\n resolvedViewStyles,\n resolveFocusRingStyles(theme.semantics.border.focus, state.focused, isWeb),\n style,\n ];\n }}\n testID={testID}\n >\n {(pressableState) => {\n const state = getInteractionState(pressableState, hovered, focused, disabled);\n return typeof children === 'function' ? children(state) : children;\n }}\n </Pressable>\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/button-base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/primitives/button-base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export { ButtonBase } from './ButtonBase';\nexport type { ButtonBaseProps } from './types';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/primitives/button-base/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAEjG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AACzF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,eAAe,CAAC,EAAE,sBAAsB;IAC7E,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC/D,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACnE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/primitives/button-base/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { AccessibilityRole, AccessibilityState, GestureResponderEvent } from 'react-native';\n\nimport type { InteractionPolicyProps } from '../../interactionPolicy';\nimport type { InteractionState } from '../../internal/resolvers/resolveInteractiveState';\nimport type { ViewProps } from '../../types/layout';\n\nexport interface ButtonBaseProps\n extends Omit<ViewProps, 'children' | 'pointerEvents'>, InteractionPolicyProps {\n children?: React.ReactNode | ((state: InteractionState) => React.ReactNode);\n disabled?: boolean;\n onPress?: ((event: GestureResponderEvent) => void) | undefined;\n onLongPress?: ((event: GestureResponderEvent) => void) | undefined;\n accessibilityLabel?: string;\n accessibilityRole?: AccessibilityRole;\n accessibilityState?: AccessibilityState;\n testID?: string;\n}\n"]}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { View } from '../../features/layout/public';
|
|
4
|
-
import { resolveFieldPresentation, resolveFieldState } from '../../internal/resolvers';
|
|
5
|
-
import { HelperText } from '../helper-text';
|
|
6
|
-
import { Label } from '../label';
|
|
7
|
-
import type { FieldProps } from './types';
|
|
8
|
-
|
|
9
|
-
/*** Composes a label, control, and helper or error message into one field. */
|
|
10
|
-
export function Field({
|
|
11
|
-
children,
|
|
12
|
-
label,
|
|
13
|
-
helperText,
|
|
14
|
-
errorText,
|
|
15
|
-
required = false,
|
|
16
|
-
disabled = false,
|
|
17
|
-
invalid = false,
|
|
18
|
-
readOnly = false,
|
|
19
|
-
testID,
|
|
20
|
-
}: FieldProps) {
|
|
21
|
-
const hasErrorText = Boolean(errorText);
|
|
22
|
-
const fieldState = resolveFieldState({
|
|
23
|
-
disabled,
|
|
24
|
-
invalid: invalid || hasErrorText,
|
|
25
|
-
readOnly,
|
|
26
|
-
});
|
|
27
|
-
const presentation = resolveFieldPresentation(fieldState);
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<View gap="xs" testID={testID}>
|
|
31
|
-
{label ? (
|
|
32
|
-
<Label
|
|
33
|
-
color={presentation.labelColor}
|
|
34
|
-
emphasis={presentation.labelEmphasis}
|
|
35
|
-
required={required}
|
|
36
|
-
>
|
|
37
|
-
{label}
|
|
38
|
-
</Label>
|
|
39
|
-
) : null}
|
|
40
|
-
<View>{children}</View>
|
|
41
|
-
{hasErrorText ? (
|
|
42
|
-
<HelperText color={presentation.helperColor} emphasis={presentation.helperEmphasis}>
|
|
43
|
-
{errorText}
|
|
44
|
-
</HelperText>
|
|
45
|
-
) : helperText ? (
|
|
46
|
-
<HelperText color={presentation.helperColor} emphasis={presentation.helperEmphasis}>
|
|
47
|
-
{helperText}
|
|
48
|
-
</HelperText>
|
|
49
|
-
) : null}
|
|
50
|
-
</View>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { Text } from '../../features/typography/public';
|
|
4
|
-
import type { HelperTextProps } from './types';
|
|
5
|
-
|
|
6
|
-
export function HelperText({ children, emphasis = 'muted', color, testID }: HelperTextProps) {
|
|
7
|
-
return (
|
|
8
|
-
<Text color={color} emphasis={emphasis} testID={testID} variant="caption">
|
|
9
|
-
{children}
|
|
10
|
-
</Text>
|
|
11
|
-
);
|
|
12
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
|
|
3
|
-
import type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';
|
|
4
|
-
|
|
5
|
-
export interface HelperTextProps {
|
|
6
|
-
children?: React.ReactNode;
|
|
7
|
-
emphasis?: Extract<SurfaceEmphasis, 'default' | 'muted'>;
|
|
8
|
-
color?: Extract<SurfaceColor, 'error'>;
|
|
9
|
-
testID?: string;
|
|
10
|
-
}
|