@ankhorage/surface 2.0.0 → 2.0.2

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/components/action-sheet/ActionSheet.d.ts +4 -0
  3. package/dist/components/action-sheet/ActionSheet.d.ts.map +1 -0
  4. package/dist/components/action-sheet/ActionSheet.js +71 -0
  5. package/dist/components/action-sheet/ActionSheet.js.map +1 -0
  6. package/dist/components/action-sheet/ActionSheetItem.d.ts +4 -0
  7. package/dist/components/action-sheet/ActionSheetItem.d.ts.map +1 -0
  8. package/dist/components/action-sheet/ActionSheetItem.js +27 -0
  9. package/dist/components/action-sheet/ActionSheetItem.js.map +1 -0
  10. package/dist/components/action-sheet/index.d.ts +4 -0
  11. package/dist/components/action-sheet/index.d.ts.map +1 -0
  12. package/dist/components/action-sheet/index.js +3 -0
  13. package/dist/components/action-sheet/index.js.map +1 -0
  14. package/dist/components/action-sheet/types.d.ts +24 -0
  15. package/dist/components/action-sheet/types.d.ts.map +1 -0
  16. package/dist/components/action-sheet/types.js +2 -0
  17. package/dist/components/action-sheet/types.js.map +1 -0
  18. package/dist/components/menu/Menu.d.ts +1 -1
  19. package/dist/components/menu/Menu.d.ts.map +1 -1
  20. package/dist/components/menu/Menu.js +50 -32
  21. package/dist/components/menu/Menu.js.map +1 -1
  22. package/dist/components/menu/index.d.ts +1 -1
  23. package/dist/components/menu/index.d.ts.map +1 -1
  24. package/dist/components/menu/index.js.map +1 -1
  25. package/dist/components/menu/navigation.d.ts +1 -1
  26. package/dist/components/menu/navigation.d.ts.map +1 -1
  27. package/dist/components/menu/navigation.js.map +1 -1
  28. package/dist/components/menu/types.d.ts +11 -5
  29. package/dist/components/menu/types.d.ts.map +1 -1
  30. package/dist/components/menu/types.js.map +1 -1
  31. package/dist/examples/DocsExamples.d.ts +3 -2
  32. package/dist/examples/DocsExamples.d.ts.map +1 -1
  33. package/dist/examples/DocsExamples.js +61 -37
  34. package/dist/examples/DocsExamples.js.map +1 -1
  35. package/dist/index.d.ts +3 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +1 -0
  38. package/dist/index.js.map +1 -1
  39. package/package.json +2 -2
  40. package/src/components/action-sheet/ActionSheet.tsx +121 -0
  41. package/src/components/action-sheet/ActionSheetItem.tsx +57 -0
  42. package/src/components/action-sheet/index.ts +3 -0
  43. package/src/components/action-sheet/types.ts +26 -0
  44. package/src/components/menu/Menu.tsx +71 -36
  45. package/src/components/menu/index.ts +1 -1
  46. package/src/components/menu/navigation.ts +1 -1
  47. package/src/components/menu/types.ts +12 -5
  48. package/src/examples/DocsExamples.tsx +74 -60
  49. package/src/index.ts +3 -1
@@ -1,48 +1,72 @@
1
1
  import React from 'react';
2
- import { Badge, Box, Button, Checkbox, Drawer, Field, HelperText, Label, Menu, Modal, Radio, Stack, Switch, Tab, TabList, TabPanel, Tabs, Text, Textarea, TextInput, ThemeProvider, } from '../index';
2
+ import { Button } from '../components/button';
3
+ import { Card } from '../components/card';
4
+ import { Checkbox } from '../components/checkbox';
5
+ import { Drawer } from '../components/drawer';
6
+ import { Field } from '../components/field';
7
+ import { HelperText } from '../components/helper-text';
8
+ import { Menu } from '../components/menu';
9
+ import { Modal } from '../components/modal';
10
+ import { Tab, TabList, TabPanel, Tabs } from '../components/tabs';
11
+ import { TextInput } from '../components/text-input';
12
+ import { ToastProvider, useToast } from '../components/toast';
13
+ import { Tooltip } from '../components/tooltip';
14
+ import { Box, Stack } from '../layout';
15
+ import { Text } from '../primitives/text';
16
+ import { ThemeProvider } from '../theme';
3
17
  const docsThemeConfig = {
4
- id: 'docs-example',
5
- name: 'Docs Example',
6
- light: {
7
- harmony: 'monochromatic',
8
- primaryColor: '#2563eb',
9
- },
10
- dark: {
11
- harmony: 'monochromatic',
12
- primaryColor: '#2563eb',
13
- },
18
+ id: 'docs',
19
+ name: 'Docs',
20
+ light: { primaryColor: '#2563EB', harmony: 'analogous' },
21
+ dark: { primaryColor: '#60A5FA', harmony: 'analogous' },
14
22
  };
15
- export function ProviderExample() {
23
+ export function FormExample() {
16
24
  return (<ThemeProvider initialConfig={docsThemeConfig}>
17
25
  <Stack gap="m" p="l">
18
- <Text variant="body">Surface starter</Text>
19
- <Badge color="success" content="Foundation"/>
20
- <Button color="warning" variant="soft">
21
- Continue
22
- </Button>
26
+ <Field helperText="Use your work email." label="Email" required>
27
+ <TextInput placeholder="you@example.com"/>
28
+ </Field>
29
+ <Checkbox checked>Accept terms</Checkbox>
30
+ <HelperText emphasis="muted">Looks good.</HelperText>
23
31
  </Stack>
24
32
  </ThemeProvider>);
25
33
  }
26
- export function FormAndOverlayExample() {
34
+ function ToastButton() {
35
+ const { showToast } = useToast();
36
+ return (<Button onPress={() => showToast({ description: 'Your changes were saved.', status: 'success', title: 'Saved' })}>
37
+ Show toast
38
+ </Button>);
39
+ }
40
+ export function FeedbackExample() {
27
41
  return (<ThemeProvider initialConfig={docsThemeConfig}>
28
- <Stack gap="m" p="l">
29
- <Field helperText="We only use this for sign-in." label="Email">
30
- <TextInput placeholder="name@example.com"/>
31
- </Field>
32
- <Field errorText="Bio is required." invalid label="Bio">
33
- <Textarea placeholder="Tell us a little about yourself"/>
34
- </Field>
35
- <Stack gap="s">
36
- <Label required>Preferences</Label>
37
- <Checkbox defaultChecked>Weekly updates</Checkbox>
38
- <Radio>Product announcements</Radio>
39
- <Switch readOnly>Read-only setting</Switch>
40
- <HelperText color="error">Invalid fields should reuse the same error color.</HelperText>
42
+ <ToastProvider>
43
+ <Stack gap="m" p="l">
44
+ <Tooltip content="Helpful contextual information">
45
+ <Text>Hover for tooltip</Text>
46
+ </Tooltip>
47
+ <ToastButton />
41
48
  </Stack>
42
- <Modal visible={false}>
43
- <Text>Modal content</Text>
49
+ </ToastProvider>
50
+ </ThemeProvider>);
51
+ }
52
+ export function OverlayExample() {
53
+ const [modalVisible, setModalVisible] = React.useState(false);
54
+ const [drawerVisible, setDrawerVisible] = React.useState(false);
55
+ return (<ThemeProvider initialConfig={docsThemeConfig}>
56
+ <Stack gap="m" p="l">
57
+ <Button onPress={() => setModalVisible(true)}>Open modal</Button>
58
+ <Button onPress={() => setDrawerVisible(true)}>Open drawer</Button>
59
+ <Modal onDismiss={() => setModalVisible(false)} visible={modalVisible}>
60
+ <Card>
61
+ <Stack gap="s">
62
+ <Text variant="label" weight="semiBold">
63
+ Modal title
64
+ </Text>
65
+ <Text>Modal content</Text>
66
+ </Stack>
67
+ </Card>
44
68
  </Modal>
45
- <Drawer visible={false}>
69
+ <Drawer onDismiss={() => setDrawerVisible(false)} visible={drawerVisible}>
46
70
  <Text>Drawer content</Text>
47
71
  </Drawer>
48
72
  </Stack>
@@ -66,9 +90,9 @@ export function NavigationExample() {
66
90
  <Text>Billing settings</Text>
67
91
  </TabPanel>
68
92
  </Tabs>
69
- <Menu items={[
70
- { id: 'edit', label: 'Edit' },
71
- { disabled: true, id: 'archive', label: 'Archive' },
93
+ <Menu actions={[
94
+ { id: 'edit', title: 'Edit' },
95
+ { disabled: true, id: 'archive', title: 'Archive' },
72
96
  ]} trigger={<Text>Open menu</Text>}/>
73
97
  <Box>
74
98
  <Text color="success">Theme overrides can stay semantic.</Text>
@@ -1 +1 @@
1
- {"version":3,"file":"DocsExamples.js","sourceRoot":"","sources":["../../src/examples/DocsExamples.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,KAAK,EACL,GAAG,EACH,MAAM,EACN,QAAQ,EACR,MAAM,EACN,KAAK,EACL,UAAU,EACV,KAAK,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,MAAM,EACN,GAAG,EACH,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,aAAa,GACd,MAAM,UAAU,CAAC;AAElB,MAAM,eAAe,GAAG;IACtB,EAAE,EAAE,cAAc;IAClB,IAAI,EAAE,cAAc;IACp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AAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CACvB;YAAA,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAC9B;UAAA,EAAE,QAAQ,CACZ;QAAA,EAAE,IAAI,CACN;QAAA,CAAC,IAAI,CACH,KAAK,CAAC,CAAC;YACL,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;YAC7B,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;SACpD,CAAC,CACF,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,EAElC;QAAA,CAAC,GAAG,CACF;UAAA,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,kCAAkC,EAAE,IAAI,CAChE;QAAA,EAAE,GAAG,CACP;MAAA,EAAE,KAAK,CACT;IAAA,EAAE,aAAa,CAAC,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport {\n Badge,\n Box,\n Button,\n Checkbox,\n Drawer,\n Field,\n HelperText,\n Label,\n Menu,\n Modal,\n Radio,\n Stack,\n Switch,\n Tab,\n TabList,\n TabPanel,\n Tabs,\n Text,\n Textarea,\n TextInput,\n ThemeProvider,\n} from '../index';\n\nconst docsThemeConfig = {\n id: 'docs-example',\n name: 'Docs Example',\n light: {\n harmony: 'monochromatic' as const,\n primaryColor: '#2563eb',\n },\n dark: {\n harmony: 'monochromatic' as const,\n primaryColor: '#2563eb',\n },\n};\n\nexport function ProviderExample() {\n return (\n <ThemeProvider initialConfig={docsThemeConfig}>\n <Stack gap=\"m\" p=\"l\">\n <Text variant=\"body\">Surface starter</Text>\n <Badge color=\"success\" content=\"Foundation\" />\n <Button color=\"warning\" variant=\"soft\">\n Continue\n </Button>\n </Stack>\n </ThemeProvider>\n );\n}\n\nexport function FormAndOverlayExample() {\n return (\n <ThemeProvider initialConfig={docsThemeConfig}>\n <Stack gap=\"m\" p=\"l\">\n <Field helperText=\"We only use this for sign-in.\" label=\"Email\">\n <TextInput placeholder=\"name@example.com\" />\n </Field>\n <Field errorText=\"Bio is required.\" invalid label=\"Bio\">\n <Textarea placeholder=\"Tell us a little about yourself\" />\n </Field>\n <Stack gap=\"s\">\n <Label required>Preferences</Label>\n <Checkbox defaultChecked>Weekly updates</Checkbox>\n <Radio>Product announcements</Radio>\n <Switch readOnly>Read-only setting</Switch>\n <HelperText color=\"error\">Invalid fields should reuse the same error color.</HelperText>\n </Stack>\n <Modal visible={false}>\n <Text>Modal content</Text>\n </Modal>\n <Drawer visible={false}>\n <Text>Drawer content</Text>\n </Drawer>\n </Stack>\n </ThemeProvider>\n );\n}\n\nexport function NavigationExample() {\n return (\n <ThemeProvider initialConfig={docsThemeConfig}>\n <Stack gap=\"m\" p=\"l\">\n <Tabs defaultValue=\"account\">\n <TabList>\n <Tab value=\"account\">Account</Tab>\n <Tab disabled value=\"security\">\n Security\n </Tab>\n <Tab value=\"billing\">Billing</Tab>\n </TabList>\n <TabPanel value=\"account\">\n <Text>Account settings</Text>\n </TabPanel>\n <TabPanel value=\"billing\">\n <Text>Billing settings</Text>\n </TabPanel>\n </Tabs>\n <Menu\n items={[\n { id: 'edit', label: 'Edit' },\n { disabled: true, id: 'archive', label: 'Archive' },\n ]}\n trigger={<Text>Open menu</Text>}\n />\n <Box>\n <Text color=\"success\">Theme overrides can stay semantic.</Text>\n </Box>\n </Stack>\n </ThemeProvider>\n );\n}\n"]}
1
+ {"version":3,"file":"DocsExamples.js","sourceRoot":"","sources":["../../src/examples/DocsExamples.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,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AAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,CACjC;YAAA,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAC5B;;YACF,EAAE,GAAG,CACL;YAAA,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,CACnC;UAAA,EAAE,OAAO,CACT;UAAA,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CACvB;YAAA,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAC9B;UAAA,EAAE,QAAQ,CACV;UAAA,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CACvB;YAAA,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAC9B;UAAA,EAAE,QAAQ,CACZ;QAAA,EAAE,IAAI,CACN;QAAA,CAAC,IAAI,CACH,OAAO,CAAC,CAAC;YACP,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;YAC7B,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;SACpD,CAAC,CACF,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,EAElC;QAAA,CAAC,GAAG,CACF;UAAA,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,kCAAkC,EAAE,IAAI,CAChE;QAAA,EAAE,GAAG,CACP;MAAA,EAAE,KAAK,CACT;IAAA,EAAE,aAAa,CAAC,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport { Button } from '../components/button';\nimport { Card } from '../components/card';\nimport { Checkbox } from '../components/checkbox';\nimport { Drawer } from '../components/drawer';\nimport { Field } from '../components/field';\nimport { HelperText } from '../components/helper-text';\nimport { Menu } from '../components/menu';\nimport { Modal } from '../components/modal';\nimport { Tab, TabList, TabPanel, Tabs } from '../components/tabs';\nimport { TextInput } from '../components/text-input';\nimport { ToastProvider, useToast } from '../components/toast';\nimport { Tooltip } from '../components/tooltip';\nimport { Box, Stack } from '../layout';\nimport { Text } from '../primitives/text';\nimport { ThemeProvider } from '../theme';\nimport type { ThemeConfig } from '../theme/types';\n\nconst docsThemeConfig: ThemeConfig = {\n id: 'docs',\n name: 'Docs',\n light: { primaryColor: '#2563EB', harmony: 'analogous' },\n dark: { primaryColor: '#60A5FA', harmony: 'analogous' },\n};\n\nexport function FormExample() {\n return (\n <ThemeProvider initialConfig={docsThemeConfig}>\n <Stack gap=\"m\" p=\"l\">\n <Field helperText=\"Use your work email.\" label=\"Email\" required>\n <TextInput placeholder=\"you@example.com\" />\n </Field>\n <Checkbox checked>Accept terms</Checkbox>\n <HelperText emphasis=\"muted\">Looks good.</HelperText>\n </Stack>\n </ThemeProvider>\n );\n}\n\nfunction ToastButton() {\n const { showToast } = useToast();\n return (\n <Button\n onPress={() =>\n showToast({ description: 'Your changes were saved.', status: 'success', title: 'Saved' })\n }\n >\n Show toast\n </Button>\n );\n}\n\nexport function FeedbackExample() {\n return (\n <ThemeProvider initialConfig={docsThemeConfig}>\n <ToastProvider>\n <Stack gap=\"m\" p=\"l\">\n <Tooltip content=\"Helpful contextual information\">\n <Text>Hover for tooltip</Text>\n </Tooltip>\n <ToastButton />\n </Stack>\n </ToastProvider>\n </ThemeProvider>\n );\n}\n\nexport function OverlayExample() {\n const [modalVisible, setModalVisible] = React.useState(false);\n const [drawerVisible, setDrawerVisible] = React.useState(false);\n\n return (\n <ThemeProvider initialConfig={docsThemeConfig}>\n <Stack gap=\"m\" p=\"l\">\n <Button onPress={() => setModalVisible(true)}>Open modal</Button>\n <Button onPress={() => setDrawerVisible(true)}>Open drawer</Button>\n <Modal onDismiss={() => setModalVisible(false)} visible={modalVisible}>\n <Card>\n <Stack gap=\"s\">\n <Text variant=\"label\" weight=\"semiBold\">\n Modal title\n </Text>\n <Text>Modal content</Text>\n </Stack>\n </Card>\n </Modal>\n <Drawer onDismiss={() => setDrawerVisible(false)} visible={drawerVisible}>\n <Text>Drawer content</Text>\n </Drawer>\n </Stack>\n </ThemeProvider>\n );\n}\n\nexport function NavigationExample() {\n return (\n <ThemeProvider initialConfig={docsThemeConfig}>\n <Stack gap=\"m\" p=\"l\">\n <Tabs defaultValue=\"account\">\n <TabList>\n <Tab value=\"account\">Account</Tab>\n <Tab disabled value=\"security\">\n Security\n </Tab>\n <Tab value=\"billing\">Billing</Tab>\n </TabList>\n <TabPanel value=\"account\">\n <Text>Account settings</Text>\n </TabPanel>\n <TabPanel value=\"billing\">\n <Text>Billing settings</Text>\n </TabPanel>\n </Tabs>\n <Menu\n actions={[\n { id: 'edit', title: 'Edit' },\n { disabled: true, id: 'archive', title: 'Archive' },\n ]}\n trigger={<Text>Open menu</Text>}\n />\n <Box>\n <Text color=\"success\">Theme overrides can stay semantic.</Text>\n </Box>\n </Stack>\n </ThemeProvider>\n );\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export type { ActionSheetItemProps, ActionSheetProps } from './components/action-sheet';
2
+ export { ActionSheet, ActionSheetItem } from './components/action-sheet';
1
3
  export type { BadgeProps } from './components/badge';
2
4
  export { Badge } from './components/badge';
3
5
  export type { ButtonIconSpec, ButtonProps } from './components/button';
@@ -18,7 +20,7 @@ export type { LabelProps } from './components/label';
18
20
  export { Label } from './components/label';
19
21
  export type { ListItemProps } from './components/list-item';
20
22
  export { ListItem } from './components/list-item';
21
- export type { MenuItem, MenuProps } from './components/menu';
23
+ export type { MenuAction, MenuActionIntent, MenuItem, MenuProps } from './components/menu';
22
24
  export { Menu } from './components/menu';
23
25
  export type { ModalProps } from './components/modal';
24
26
  export { Modal } from './components/modal';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAA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AE,MAAM,8BAA8B,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,YAAY,EACV,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export { ActionSheet, ActionSheetItem } from './components/action-sheet';
1
2
  export { Badge } from './components/badge';
2
3
  export { Button } from './components/button';
3
4
  export { Card } from './components/card';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"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AAErE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAOzC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export type { BadgeProps } from './components/badge';\nexport { Badge } from './components/badge';\nexport type { ButtonIconSpec, ButtonProps } from './components/button';\nexport { Button } from './components/button';\nexport type { CardProps } from './components/card';\nexport { Card } from './components/card';\nexport type { CheckboxProps } from './components/checkbox';\nexport { Checkbox } from './components/checkbox';\nexport type { DrawerProps } from './components/drawer';\nexport { Drawer } from './components/drawer';\nexport type { FieldProps } from './components/field';\nexport { Field } from './components/field';\nexport type { HelperTextProps } from './components/helper-text';\nexport { HelperText } from './components/helper-text';\nexport type { IconButtonProps } from './components/icon-button';\nexport { IconButton } from './components/icon-button';\nexport type { LabelProps } from './components/label';\nexport { Label } from './components/label';\nexport type { ListItemProps } from './components/list-item';\nexport { ListItem } from './components/list-item';\nexport type { MenuItem, MenuProps } from './components/menu';\nexport { Menu } from './components/menu';\nexport type { ModalProps } from './components/modal';\nexport { Modal } from './components/modal';\nexport type {\n DrawerNavigationItemProps,\n DrawerNavigationProps,\n NavigationItemIcon,\n NavigationItemProps,\n NavigationItemSpec,\n NavigationListProps,\n TabBarItemProps,\n TabBarProps,\n} from './components/navigation';\nexport {\n DrawerNavigation,\n DrawerNavigationItem,\n NavigationItem,\n NavigationList,\n TabBar,\n TabBarItem,\n} from './components/navigation';\nexport type { RadioProps } from './components/radio';\nexport { Radio } from './components/radio';\nexport type { SwitchProps } from './components/switch';\nexport { Switch } from './components/switch';\nexport type { TabListProps, TabPanelProps, TabProps, TabsProps } from './components/tabs';\nexport { Tab, TabList, TabPanel, Tabs } from './components/tabs';\nexport type { TextInputProps } from './components/text-input';\nexport { TextInput } from './components/text-input';\nexport type { TextareaProps } from './components/textarea';\nexport { Textarea } from './components/textarea';\nexport type { ToastOptions, ToastProps, ToastStatus } from './components/toast';\nexport { Toast, ToastProvider, useToast } from './components/toast';\nexport type { TooltipProps } from './components/tooltip';\nexport { Tooltip } from './components/tooltip';\nexport type { FontRuntime } from './context/FontContext';\nexport { FontProvider, useFontContext } from './context/FontContext';\nexport type { I18nInstance, TranslationRuntime, Translator } from './context/TranslationContext';\nexport { TranslationProvider, useTranslationContext } from './context/TranslationContext';\nexport * from './core/responsive';\nexport * from './layout';\nexport type { ButtonBaseProps } from './primitives/button-base';\nexport { ButtonBase } from './primitives/button-base';\nexport type { HeadingLevel, HeadingProps } from './primitives/heading';\nexport { Heading } from './primitives/heading';\nexport type { IconProps, IconProvider } from './primitives/icon';\nexport { Icon } from './primitives/icon';\nexport type { ImageFit, ImageProps, SurfaceImageSource } from './primitives/image';\nexport { Image } from './primitives/image';\nexport type { TextProps } from './primitives/text';\nexport { Text } from './primitives/text';\nexport type {\n SurfaceColor,\n SurfaceEmphasis,\n SurfacePaletteColor,\n SurfaceStatusColor,\n} from './surfaceColor';\nexport {\n SURFACE_COLORS,\n SURFACE_EMPHASES,\n SURFACE_PALETTE_COLORS,\n SURFACE_STATUS_COLORS,\n} from './surfaceColor';\nexport * from './theme';\nexport { isDeepEqual } from './utils/deepEqual';\nexport { deepMerge } from './utils/deepMerge';\n"]}
1
+ {"version":3,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AAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAOzC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export type { ActionSheetItemProps, ActionSheetProps } from './components/action-sheet';\nexport { ActionSheet, ActionSheetItem } from './components/action-sheet';\nexport type { BadgeProps } from './components/badge';\nexport { Badge } from './components/badge';\nexport type { ButtonIconSpec, ButtonProps } from './components/button';\nexport { Button } from './components/button';\nexport type { CardProps } from './components/card';\nexport { Card } from './components/card';\nexport type { CheckboxProps } from './components/checkbox';\nexport { Checkbox } from './components/checkbox';\nexport type { DrawerProps } from './components/drawer';\nexport { Drawer } from './components/drawer';\nexport type { FieldProps } from './components/field';\nexport { Field } from './components/field';\nexport type { HelperTextProps } from './components/helper-text';\nexport { HelperText } from './components/helper-text';\nexport type { IconButtonProps } from './components/icon-button';\nexport { IconButton } from './components/icon-button';\nexport type { LabelProps } from './components/label';\nexport { Label } from './components/label';\nexport type { ListItemProps } from './components/list-item';\nexport { ListItem } from './components/list-item';\nexport type { MenuAction, MenuActionIntent, MenuItem, MenuProps } from './components/menu';\nexport { Menu } from './components/menu';\nexport type { ModalProps } from './components/modal';\nexport { Modal } from './components/modal';\nexport type {\n DrawerNavigationItemProps,\n DrawerNavigationProps,\n NavigationItemIcon,\n NavigationItemProps,\n NavigationItemSpec,\n NavigationListProps,\n TabBarItemProps,\n TabBarProps,\n} from './components/navigation';\nexport {\n DrawerNavigation,\n DrawerNavigationItem,\n NavigationItem,\n NavigationList,\n TabBar,\n TabBarItem,\n} from './components/navigation';\nexport type { RadioProps } from './components/radio';\nexport { Radio } from './components/radio';\nexport type { SwitchProps } from './components/switch';\nexport { Switch } from './components/switch';\nexport type { TabListProps, TabPanelProps, TabProps, TabsProps } from './components/tabs';\nexport { Tab, TabList, TabPanel, Tabs } from './components/tabs';\nexport type { TextInputProps } from './components/text-input';\nexport { TextInput } from './components/text-input';\nexport type { TextareaProps } from './components/textarea';\nexport { Textarea } from './components/textarea';\nexport type { ToastOptions, ToastProps, ToastStatus } from './components/toast';\nexport { Toast, ToastProvider, useToast } from './components/toast';\nexport type { TooltipProps } from './components/tooltip';\nexport { Tooltip } from './components/tooltip';\nexport type { FontRuntime } from './context/FontContext';\nexport { FontProvider, useFontContext } from './context/FontContext';\nexport type { I18nInstance, TranslationRuntime, Translator } from './context/TranslationContext';\nexport { TranslationProvider, useTranslationContext } from './context/TranslationContext';\nexport * from './core/responsive';\nexport * from './layout';\nexport type { ButtonBaseProps } from './primitives/button-base';\nexport { ButtonBase } from './primitives/button-base';\nexport type { HeadingLevel, HeadingProps } from './primitives/heading';\nexport { Heading } from './primitives/heading';\nexport type { IconProps, IconProvider } from './primitives/icon';\nexport { Icon } from './primitives/icon';\nexport type { ImageFit, ImageProps, SurfaceImageSource } from './primitives/image';\nexport { Image } from './primitives/image';\nexport type { TextProps } from './primitives/text';\nexport { Text } from './primitives/text';\nexport type {\n SurfaceColor,\n SurfaceEmphasis,\n SurfacePaletteColor,\n SurfaceStatusColor,\n} from './surfaceColor';\nexport {\n SURFACE_COLORS,\n SURFACE_EMPHASES,\n SURFACE_PALETTE_COLORS,\n SURFACE_STATUS_COLORS,\n} from './surfaceColor';\nexport * from './theme';\nexport { isDeepEqual } from './utils/deepEqual';\nexport { deepMerge } from './utils/deepMerge';\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/surface",
3
3
  "type": "module",
4
- "version": "2.0.0",
4
+ "version": "2.0.2",
5
5
  "description": "Stable UI foundation for React Native and React Native Web.",
6
6
  "homepage": "https://github.com/ankhorage/surface#readme",
7
7
  "bugs": {
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@ankhorage/color-theory": "^0.0.7",
46
- "@ankhorage/contracts": "^1.3.1"
46
+ "@ankhorage/contracts": "^1.7.0"
47
47
  },
48
48
  "files": [
49
49
  "dist",
@@ -0,0 +1,121 @@
1
+ import React from 'react';
2
+ import { Pressable, View } from 'react-native';
3
+
4
+ import { FocusScope } from '../../internal/focus/FocusScope';
5
+ import { Portal } from '../../internal/overlay/Portal';
6
+ import { resolveOverlayAnimation } from '../../internal/resolvers';
7
+ import { Box, Stack, Surface } from '../../layout';
8
+ import { Text } from '../../primitives/text';
9
+ import { useTheme } from '../../theme/ThemeContext';
10
+ import { ActionSheetItem } from './ActionSheetItem';
11
+ import type { ActionSheetProps } from './types';
12
+
13
+ export function ActionSheet({
14
+ visible,
15
+ onDismiss,
16
+ title,
17
+ description,
18
+ children,
19
+ cancelLabel = 'Cancel',
20
+ closeOnBackdrop = true,
21
+ testID,
22
+ }: ActionSheetProps) {
23
+ const { theme } = useTheme();
24
+ const animation = resolveOverlayAnimation('modal');
25
+
26
+ if (!visible) {
27
+ return null;
28
+ }
29
+
30
+ return (
31
+ <Portal layer="modal" visible={visible}>
32
+ <View
33
+ pointerEvents="box-none"
34
+ style={{
35
+ bottom: 0,
36
+ left: 0,
37
+ position: 'absolute',
38
+ right: 0,
39
+ top: 0,
40
+ }}
41
+ >
42
+ <Pressable
43
+ onPress={closeOnBackdrop ? onDismiss : undefined}
44
+ style={{
45
+ backgroundColor: theme.semantics.neutral.text,
46
+ bottom: 0,
47
+ left: 0,
48
+ opacity: animation.backdropOpacity,
49
+ position: 'absolute',
50
+ right: 0,
51
+ top: 0,
52
+ }}
53
+ testID={testID ? `${testID}-backdrop` : undefined}
54
+ />
55
+ <FocusScope
56
+ active={visible}
57
+ onEscape={onDismiss}
58
+ testID={testID ? `${testID}-focus` : undefined}
59
+ >
60
+ <Box
61
+ pointerEvents="box-none"
62
+ style={{
63
+ flex: 1,
64
+ justifyContent: 'flex-end',
65
+ }}
66
+ >
67
+ <View
68
+ accessible
69
+ accessibilityViewIsModal
70
+ style={{
71
+ alignSelf: 'center',
72
+ maxWidth: 560,
73
+ padding: 16,
74
+ width: '100%',
75
+ }}
76
+ >
77
+ <Surface
78
+ p="m"
79
+ style={{
80
+ borderRadius: 24,
81
+ shadowOpacity: 0.16,
82
+ shadowRadius: 18,
83
+ shadowOffset: { width: 0, height: -8 },
84
+ }}
85
+ testID={testID}
86
+ variant="raised"
87
+ >
88
+ <Stack gap="s">
89
+ {title || description ? (
90
+ <Box px="m" py="s">
91
+ <Stack gap="xxs">
92
+ {title ? (
93
+ <Text align="center" variant="label" weight="semiBold">
94
+ {title}
95
+ </Text>
96
+ ) : null}
97
+ {description ? (
98
+ <Text align="center" emphasis="muted" variant="bodySmall">
99
+ {description}
100
+ </Text>
101
+ ) : null}
102
+ </Stack>
103
+ </Box>
104
+ ) : null}
105
+ <Stack gap="xxs">{children}</Stack>
106
+ {onDismiss ? (
107
+ <ActionSheetItem
108
+ label={cancelLabel}
109
+ onPress={onDismiss}
110
+ testID={testID ? `${testID}-cancel` : undefined}
111
+ />
112
+ ) : null}
113
+ </Stack>
114
+ </Surface>
115
+ </View>
116
+ </Box>
117
+ </FocusScope>
118
+ </View>
119
+ </Portal>
120
+ );
121
+ }
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+
3
+ import { Box, Inline, Stack } from '../../layout';
4
+ import { ButtonBase } from '../../primitives/button-base';
5
+ import { Text } from '../../primitives/text';
6
+ import type { ActionSheetItemProps } from './types';
7
+
8
+ export function ActionSheetItem({
9
+ label,
10
+ description,
11
+ leading,
12
+ trailing,
13
+ color,
14
+ disabled = false,
15
+ selected = false,
16
+ onPress,
17
+ testID,
18
+ }: ActionSheetItemProps) {
19
+ return (
20
+ <ButtonBase
21
+ accessibilityRole="button"
22
+ accessibilityState={{ disabled, selected }}
23
+ disabled={disabled}
24
+ onPress={onPress}
25
+ radius="m"
26
+ testID={testID}
27
+ >
28
+ {(state) => (
29
+ <Box
30
+ px="m"
31
+ py="m"
32
+ radius="m"
33
+ style={{
34
+ opacity: state.disabled ? 0.56 : 1,
35
+ }}
36
+ >
37
+ <Inline align="center" gap="m" justify="space-between" wrap="nowrap">
38
+ {leading ? <Box>{leading}</Box> : null}
39
+ <Box flex={1}>
40
+ <Stack gap="xxs">
41
+ <Text color={color} variant="body" weight={selected ? 'semiBold' : 'medium'}>
42
+ {label}
43
+ </Text>
44
+ {description ? (
45
+ <Text emphasis="muted" variant="bodySmall">
46
+ {description}
47
+ </Text>
48
+ ) : null}
49
+ </Stack>
50
+ </Box>
51
+ {trailing ? <Box>{trailing}</Box> : null}
52
+ </Inline>
53
+ </Box>
54
+ )}
55
+ </ButtonBase>
56
+ );
57
+ }
@@ -0,0 +1,3 @@
1
+ export { ActionSheet } from './ActionSheet';
2
+ export { ActionSheetItem } from './ActionSheetItem';
3
+ export type { ActionSheetItemProps, ActionSheetProps } from './types';
@@ -0,0 +1,26 @@
1
+ import type React from 'react';
2
+
3
+ import type { SurfaceColor } from '../../surfaceColor';
4
+
5
+ export interface ActionSheetProps {
6
+ visible: boolean;
7
+ onDismiss?: (() => void) | undefined;
8
+ title?: React.ReactNode;
9
+ description?: React.ReactNode;
10
+ children?: React.ReactNode;
11
+ cancelLabel?: React.ReactNode;
12
+ closeOnBackdrop?: boolean;
13
+ testID?: string;
14
+ }
15
+
16
+ export interface ActionSheetItemProps {
17
+ label: React.ReactNode;
18
+ description?: React.ReactNode;
19
+ leading?: React.ReactNode;
20
+ trailing?: React.ReactNode;
21
+ color?: SurfaceColor;
22
+ disabled?: boolean;
23
+ selected?: boolean;
24
+ onPress?: (() => void) | undefined;
25
+ testID?: string;
26
+ }