@atom-learning/components 2.1.0 → 2.3.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.
Files changed (117) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/dist/components/accordion/AccordionContent.js +1 -1
  3. package/dist/components/accordion/AccordionItem.js +1 -1
  4. package/dist/components/alert-dialog/AlertDialogContent.js +1 -1
  5. package/dist/components/badge/Badge.js +1 -1
  6. package/dist/components/button/Button.js +1 -1
  7. package/dist/components/calendar/Calendar.js +1 -1
  8. package/dist/components/carousel/CarouselArrows.js +1 -1
  9. package/dist/components/checkbox/Checkbox.js +1 -1
  10. package/dist/components/chip/Chip.d.ts +1898 -0
  11. package/dist/components/chip/Chip.js +1 -0
  12. package/dist/components/chip/ChipGroup.d.ts +7 -0
  13. package/dist/components/chip/ChipGroup.js +1 -0
  14. package/dist/components/chip/index.d.ts +2 -0
  15. package/dist/components/chip-dismissible-group/ChipDismissibleGroupItem.d.ts +553 -0
  16. package/dist/components/chip-dismissible-group/ChipDismissibleGroupItem.js +1 -0
  17. package/dist/components/chip-dismissible-group/ChipDismissibleGroupRoot.d.ts +6 -0
  18. package/dist/components/chip-dismissible-group/ChipDismissibleGroupRoot.js +1 -0
  19. package/dist/components/chip-dismissible-group/index.d.ts +7 -0
  20. package/dist/components/chip-dismissible-group/index.js +1 -0
  21. package/dist/components/chip-toggle-group/ChipToggleGroupItem.d.ts +551 -0
  22. package/dist/components/chip-toggle-group/ChipToggleGroupItem.js +1 -0
  23. package/dist/components/chip-toggle-group/ChipToggleGroupRoot.d.ts +563 -0
  24. package/dist/components/chip-toggle-group/ChipToggleGroupRoot.js +1 -0
  25. package/dist/components/chip-toggle-group/index.d.ts +7 -0
  26. package/dist/components/chip-toggle-group/index.js +1 -0
  27. package/dist/components/combobox/Combobox.js +1 -1
  28. package/dist/components/dialog/DialogContent.js +1 -1
  29. package/dist/components/dismissible/DismissibleRoot.d.ts +17 -0
  30. package/dist/components/dismissible/DismissibleRoot.js +1 -0
  31. package/dist/components/dismissible/DismissibleTrigger.d.ts +5 -0
  32. package/dist/components/dismissible/DismissibleTrigger.js +1 -0
  33. package/dist/components/dismissible/index.d.ts +7 -0
  34. package/dist/components/dismissible/index.js +1 -0
  35. package/dist/components/dismissible-group/DismissibleGroupItem.d.ts +6 -0
  36. package/dist/components/dismissible-group/DismissibleGroupItem.js +1 -0
  37. package/dist/components/dismissible-group/DismissibleGroupRoot.d.ts +15 -0
  38. package/dist/components/dismissible-group/DismissibleGroupRoot.js +1 -0
  39. package/dist/components/dismissible-group/index.d.ts +9 -0
  40. package/dist/components/dismissible-group/index.js +1 -0
  41. package/dist/components/divider/Divider.js +1 -1
  42. package/dist/components/dropdown-menu/DropdownMenuLinkItem.js +1 -1
  43. package/dist/components/field-wrapper/FieldDescription.js +1 -1
  44. package/dist/components/field-wrapper/FieldWrapper.js +1 -1
  45. package/dist/components/field-wrapper/InlineFieldWrapper.js +1 -1
  46. package/dist/components/file-input/FileInput.js +1 -1
  47. package/dist/components/grid/Grid.js +1 -1
  48. package/dist/components/heading/Heading.js +1 -1
  49. package/dist/components/index.d.ts +7 -0
  50. package/dist/components/inline-message/InlineMessage.js +1 -1
  51. package/dist/components/label/Label.js +1 -1
  52. package/dist/components/link/Link.js +1 -1
  53. package/dist/components/markdown-content/MarkdownContent.js +1 -1
  54. package/dist/components/markdown-content/components/MarkdownCode.js +1 -1
  55. package/dist/components/markdown-content/components/MarkdownEmphasis.js +1 -1
  56. package/dist/components/markdown-content/components/MarkdownHeading.js +1 -1
  57. package/dist/components/markdown-content/components/MarkdownImage.js +1 -1
  58. package/dist/components/markdown-content/components/MarkdownLink.js +1 -1
  59. package/dist/components/markdown-content/components/MarkdownListItem.js +1 -1
  60. package/dist/components/markdown-content/components/MarkdownParagraph.js +1 -1
  61. package/dist/components/markdown-content/components/MarkdownStrong.js +1 -1
  62. package/dist/components/markdown-content/components/MarkdownThematicBreak.js +1 -1
  63. package/dist/components/navigation/NavigationMenu.d.ts +15 -0
  64. package/dist/components/navigation/NavigationMenu.js +1 -0
  65. package/dist/components/navigation/NavigationMenuContext.d.ts +7 -0
  66. package/dist/components/navigation/NavigationMenuContext.js +1 -0
  67. package/dist/components/navigation/NavigationMenuDropdown.d.ts +7 -0
  68. package/dist/components/navigation/NavigationMenuDropdown.js +1 -0
  69. package/dist/components/navigation/NavigationMenuItem.d.ts +287 -0
  70. package/dist/components/navigation/NavigationMenuItem.js +1 -0
  71. package/dist/components/navigation/index.d.ts +1 -0
  72. package/dist/components/notification-badge/NotificationBadge.js +1 -1
  73. package/dist/components/radio-button-field/RadioButtonField.js +1 -1
  74. package/dist/components/radio-card/RadioCardGroup.js +1 -1
  75. package/dist/components/search-input/SearchInput.js +1 -1
  76. package/dist/components/slider-field/SliderField.js +1 -1
  77. package/dist/components/stack/Stack.d.ts +2 -1
  78. package/dist/components/stack/Stack.js +1 -1
  79. package/dist/components/stack-content/StackContent.js +1 -1
  80. package/dist/components/stepper/StepperStepForward.js +1 -1
  81. package/dist/components/stepper/StepperSteps.js +1 -1
  82. package/dist/components/switch/Switch.js +1 -1
  83. package/dist/components/table/TableBody.js +1 -1
  84. package/dist/components/table/TableHeader.js +1 -1
  85. package/dist/components/tabs/TabTrigger.js +1 -1
  86. package/dist/components/tabs/Tabs.js +1 -1
  87. package/dist/components/tabs/utils.js +1 -1
  88. package/dist/components/toast/Toast.js +1 -1
  89. package/dist/components/toast/ToastProvider.js +1 -1
  90. package/dist/components/toggle-group/ToggleGroupButton.js +1 -1
  91. package/dist/components/top-bar/TopBar.d.ts +17 -0
  92. package/dist/components/top-bar/TopBar.js +1 -0
  93. package/dist/components/top-bar/TopBarActionIcon.d.ts +8 -0
  94. package/dist/components/top-bar/TopBarActionIcon.js +1 -0
  95. package/dist/components/top-bar/TopBarBrand.d.ts +814 -0
  96. package/dist/components/top-bar/TopBarBrand.js +1 -0
  97. package/dist/components/top-bar/index.d.ts +1 -0
  98. package/dist/constants/zIndices.d.ts +3 -0
  99. package/dist/constants/zIndices.js +1 -0
  100. package/dist/docgen.json +1 -1
  101. package/dist/docs/Chip.mdx +118 -0
  102. package/dist/docs/ChipDismissibleGroup.mdx +33 -0
  103. package/dist/docs/ChipToggleGroup.mdx +27 -0
  104. package/dist/docs/Dismissible.mdx +48 -0
  105. package/dist/docs/DismissibleGroup.mdx +29 -0
  106. package/dist/docs/NavigationMenu.mdx +113 -0
  107. package/dist/docs/TopBar.mdx +59 -0
  108. package/dist/index.cjs.js +1 -1
  109. package/dist/index.js +1 -1
  110. package/dist/utilities/hooks/useCallbackRef.js +1 -1
  111. package/dist/utilities/hooks/useScrollPosition.d.ts +4 -0
  112. package/dist/utilities/hooks/useScrollPosition.js +1 -0
  113. package/dist/utilities/override-stitches-variant-value/overrideStitchesVariantValue.d.ts +1 -0
  114. package/dist/utilities/override-stitches-variant-value/overrideStitchesVariantValue.js +1 -0
  115. package/package.json +3 -1
  116. package/dist/constants/dialog.d.ts +0 -1
  117. package/dist/constants/dialog.js +0 -1
@@ -0,0 +1,118 @@
1
+ ---
2
+ title: Chip
3
+ component: Chip, ChipGroup
4
+ description: A component in the shape of a pill providing visual cues to prompt users to enter information or filter content.
5
+ category: Feedback
6
+ ---
7
+
8
+ `Chip` itself is a primitive. It has no functional logic in itself, however, it is used to provide common styles for all the `Chip`-based components.
9
+
10
+ ```tsx preview
11
+ <Chip>
12
+ <Chip.Content>Not the tasty kind</Chip.Content>
13
+ </Chip>
14
+ ```
15
+
16
+ ## Gap
17
+
18
+ `gap={ 1 | 2 | 3}`
19
+
20
+ We provide three options for gap space between chips. `1` will be typically used within Input fields (multiselect) or when space is limited. `2` is the default option that provides a comfortable distance for the set.
21
+
22
+ ```tsx preview
23
+ <ChipGroup gap={1}>
24
+ <Chip>
25
+ <Chip.Content>A</Chip.Content>
26
+ </Chip>
27
+ <Chip>
28
+ <Chip.Content>B</Chip.Content>
29
+ </Chip>
30
+ <Chip>
31
+ <Chip.Content>C</Chip.Content>
32
+ </Chip>
33
+ </ChipGroup>
34
+ ```
35
+
36
+ ## Size
37
+
38
+ `size="sm | md | lg"`
39
+
40
+ ```tsx preview
41
+ <ChipGroup align="center">
42
+ <Chip size="sm">
43
+ <Chip.Content>
44
+ <Icon is={Upload} />A
45
+ </Chip.Content>
46
+ </Chip>
47
+ <Chip size="md">
48
+ <Chip.Content>
49
+ <Icon is={Upload} />B
50
+ </Chip.Content>
51
+ </Chip>
52
+ <Chip size="lg">
53
+ <Chip.Content>
54
+ <Icon is={Upload} />C
55
+ </Chip.Content>
56
+ </Chip>
57
+ <Chip
58
+ size={{
59
+ '@initial': 'lg',
60
+ '@md': 'md',
61
+ '@lg': 'sm'
62
+ }}
63
+ >
64
+ <Chip.Content>
65
+ <Icon is={Upload} />C
66
+ </Chip.Content>
67
+ </Chip>
68
+ </ChipGroup>
69
+ ```
70
+
71
+ ## Icon
72
+
73
+ When an `<Icon />` is used as an immediate child of `<Chip.Content />` we automatically transform it to
74
+ a `<Chip.Icon />` which applies the correct styles and sizing to it.
75
+
76
+ ```tsx preview
77
+ <ChipGroup>
78
+ <Chip>
79
+ <Chip.Content>
80
+ <Icon is={Upload} /> Icon
81
+ </Chip.Content>
82
+ </Chip>
83
+ <Chip>
84
+ <Chip.Content>
85
+ <Chip.Icon is={Upload} /> Chip.Icon
86
+ </Chip.Content>
87
+ </Chip>
88
+ </ChipGroup>
89
+ ```
90
+
91
+ If additional nesting is needed; you can use the `<Chip.Icon />` component directly.
92
+
93
+ ```tsx preview
94
+ <ChipGroup>
95
+ <Chip>
96
+ <Chip.Content>
97
+ <div>
98
+ <Icon is={Upload} /> Icon (wrong sizing)
99
+ </div>
100
+ </Chip.Content>
101
+ </Chip>
102
+ <Chip>
103
+ <Chip.Content>
104
+ <div>
105
+ <Chip.Icon is={Upload} /> Chip.Icon
106
+ </div>
107
+ </Chip.Content>
108
+ </Chip>
109
+ </ChipGroup>
110
+ ```
111
+
112
+ ## Disabled
113
+
114
+ ```tsx preview
115
+ <Chip data-disabled>
116
+ <Chip.Content>Not the tasty kind</Chip.Content>
117
+ </Chip>
118
+ ```
@@ -0,0 +1,33 @@
1
+ ---
2
+ title: Chip Dismissible Group
3
+ component: ChipDismissibleGroup
4
+ description: Combines the DismissibleGroup logic together with the Chip primitive styling
5
+ category: Feedback
6
+ ---
7
+
8
+ Used to visualise groups of dismissible information, in fields such as an entity or different attributes. Can also be used to represent removable filtering criteria.
9
+
10
+ ```tsx preview
11
+ <ChipDismissibleGroup
12
+ onDismiss={(value) => {
13
+ alert(`dismiss ${value}`)
14
+ }}
15
+ >
16
+ <ChipDismissibleGroup.Item value="a" dismissActionLabel="Dismiss 'A'">
17
+ <Icon is={Person} />
18
+ Dismissible
19
+ </ChipDismissibleGroup.Item>
20
+ <ChipDismissibleGroup.Item value="b" dismissActionLabel="Dismiss 'B'">
21
+ <Icon is={Person} />
22
+ Dismissible
23
+ </ChipDismissibleGroup.Item>
24
+ <ChipDismissibleGroup.Item
25
+ value="c"
26
+ dismissActionLabel="Dismiss 'C'"
27
+ disabled
28
+ >
29
+ <Icon is={Person} />
30
+ Dismissible
31
+ </ChipDismissibleGroup.Item>
32
+ </ChipDismissibleGroup>
33
+ ```
@@ -0,0 +1,27 @@
1
+ ---
2
+ title: Chip Toggle Group
3
+ component: ChipToggleGroup
4
+ description: Combines the Toggle Group radix component with the Chip primitive styling
5
+ category: Feedback
6
+ ---
7
+
8
+ Used as a method for filtering a collection of data. Acts like multiple or single selection. Each chip toggles between selected and unselected. When selected, a checkmark appears as the leading icon.
9
+
10
+ ```tsx preview
11
+ <ChipToggleGroup
12
+ type="multiple"
13
+ defaultValue={['a', 'b']}
14
+ onValueChange={(value) => {
15
+ console.log(value)
16
+ }}
17
+ >
18
+ <ChipToggleGroup.Item value="a">A</ChipToggleGroup.Item>
19
+ <ChipToggleGroup.Item value="b" disabled>
20
+ B
21
+ </ChipToggleGroup.Item>
22
+ <ChipToggleGroup.Item value="c">C</ChipToggleGroup.Item>
23
+ <ChipToggleGroup.Item value="d" disabled>
24
+ D
25
+ </ChipToggleGroup.Item>
26
+ </ChipToggleGroup>
27
+ ```
@@ -0,0 +1,48 @@
1
+ ---
2
+ title: Dismissible
3
+ component: Dismissible
4
+ description: An element with a dismiss button which removes it from the view
5
+ category: Primitives
6
+ ---
7
+
8
+ `Dismissible` itself is a primitive. It has not been designed so it should not be used out-of-the-box as a user facing component.
9
+ Test the component is accessible depending on each implementation use case.
10
+
11
+ ```tsx preview
12
+ <Dismissible
13
+ value="a"
14
+ onDismiss={(value) => {
15
+ alert(`dismiss ${value}`)
16
+ }}
17
+ >
18
+ Press the trigger to dismiss this ->
19
+ <Dismissible.Trigger aria-label="Dismiss 'a'" />
20
+ </Dismissible>
21
+ ```
22
+
23
+ ```tsx preview
24
+ <Dismissible
25
+ value="custom"
26
+ onDismiss={(value) => {
27
+ alert(`dismiss ${value}`)
28
+ }}
29
+ asChild
30
+ >
31
+ <Box
32
+ css={{
33
+ width: '100%',
34
+ fontFamily: 'system-ui',
35
+ border: '1px solid',
36
+ borderRadius: 4,
37
+ display: 'flex',
38
+ justifyContent: 'space-between',
39
+ padding: 8
40
+ }}
41
+ >
42
+ Basic custom implementation example
43
+ <Dismissible.Trigger asChild>
44
+ <button type="button">Custom Dismiss Trigger</button>
45
+ </Dismissible.Trigger>
46
+ </Box>
47
+ </Dismissible>
48
+ ```
@@ -0,0 +1,29 @@
1
+ ---
2
+ title: Dismissible Group
3
+ component: DismissibleGroup
4
+ description: A set of dismissible elements.
5
+ category: Primitives
6
+ ---
7
+
8
+ `DismissibleGroup` itself is a primitive. It has not been designed so it should not be used out-of-the-box as a user facing component.
9
+ Test the component is accessible depending on each implementation use case.
10
+
11
+ ```tsx preview
12
+ <DismissibleGroup
13
+ onDismiss={(value) => {
14
+ alert(`dismiss ${value}`)
15
+ }}
16
+ >
17
+ <DismissibleGroup.Item value="a">
18
+ A
19
+ <DismissibleGroup.Trigger aria-label="Dismiss A" />
20
+ </DismissibleGroup.Item>
21
+ <DismissibleGroup.Item value="b" disabled>
22
+ B
23
+ <DismissibleGroup.Trigger />
24
+ </DismissibleGroup.Item>
25
+ <DismissibleGroup.Item value="c" disabled>
26
+ C
27
+ </DismissibleGroup.Item>
28
+ </DismissibleGroup>
29
+ ```
@@ -0,0 +1,113 @@
1
+ ---
2
+ title: NavigationMenu
3
+ component: NavigationMenu,NavigationMenu.Link,NavigationMenu.Dropdown,NavigationMenu.DropdownContent,NavigationMenu.DropdownItem
4
+ description: A collection of links for navigating apps.
5
+ category: Navigation
6
+ ---
7
+
8
+ `NavigationMenu` exports many components that combine to form a navigation menu.
9
+
10
+ ```tsx preview
11
+ <NavigationMenu>
12
+ <NavigationMenu.Link href="/overview/introduction">
13
+ Introduction
14
+ </NavigationMenu.Link>
15
+ <NavigationMenu.Dropdown title="Theme">
16
+ <NavigationMenu.DropdownContent>
17
+ <NavigationMenu.DropdownItem href="/theme/colours">
18
+ Colours
19
+ </NavigationMenu.DropdownItem>
20
+ <NavigationMenu.DropdownItem href="/theme/effects">
21
+ Effects
22
+ </NavigationMenu.DropdownItem>
23
+ <NavigationMenu.DropdownItem href="/theme/icons">
24
+ Icons
25
+ </NavigationMenu.DropdownItem>
26
+ </NavigationMenu.DropdownContent>
27
+ </NavigationMenu.Dropdown>
28
+ </NavigationMenu>
29
+ ```
30
+
31
+ ## With client side routing
32
+
33
+ `NavigationMenu.Dropdown`, `NavigationMenu.DropdownItem` and `NavigationMenu.Link` can be passed an `active` prop for instances when you want to highlight the currently active route. See below for examples using client side routing with the `NavigationMenu.Link` component. The same method can be applied to `NavigationMenu.Dropdown` and `NavigationMenu.DropdownItem`.
34
+
35
+ #### Example using React Router
36
+
37
+ ```tsx
38
+ const Link = ({ href, ...props }) => {
39
+ const { pathname } = useLocation()
40
+ const isActive = path === href
41
+
42
+ return (
43
+ <NavigationMenu.Link active={isActive} {...props}>
44
+ Introduction
45
+ </NavigationMenu.Link>
46
+ )
47
+ }
48
+ ```
49
+
50
+ #### Example using Next JS
51
+
52
+ ```tsx
53
+ const Link = ({ href, ...props }) => {
54
+ const router = useRouter()
55
+ const isActive = router.asPath === href
56
+
57
+ return (
58
+ <NavigationMenu.Link active={isActive} {...props}>
59
+ Introduction
60
+ </NavigationMenu.Link>
61
+ )
62
+ }
63
+ ```
64
+
65
+ ## Changing the layout of the dropdown content
66
+
67
+ By default, dropdown items inside of `NavigationMenu.DropdownContent` will stack.
68
+
69
+ If you want to change the way items are displayed, you can add custom styling to `NavigationMenu.DropdownContent`.
70
+
71
+ In the below example the styling of `NavigationMenu.DropdownContent` has been changed to allow a grid layout.
72
+
73
+ ```tsx preview
74
+ <NavigationMenu>
75
+ <NavigationMenu.Link href="/overview/introduction">
76
+ Introduction
77
+ </NavigationMenu.Link>
78
+ <NavigationMenu.Dropdown title="Theme">
79
+ <NavigationMenu.DropdownContent
80
+ css={{
81
+ display: 'grid',
82
+ gap: '$1',
83
+ gridAutoFlow: 'column',
84
+ width: 500,
85
+ gridTemplateRows: 'repeat(2, 1fr)'
86
+ }}
87
+ >
88
+ {['colours', 'icons', 'effects', 'typography'].map((item) => (
89
+ <NavigationMenu.DropdownItem href={`/theme/${item}`}>
90
+ <Text
91
+ css={{
92
+ mb: '0.75rem',
93
+ textTransform: 'capitalize'
94
+ }}
95
+ >
96
+ {item}
97
+ </Text>
98
+ <Text
99
+ css={{
100
+ color: 'inherit',
101
+ lineHeight: 1.5,
102
+ fontWeight: 400,
103
+ fontSize: 14
104
+ }}
105
+ >
106
+ This is some example text about {item}
107
+ </Text>
108
+ </NavigationMenu.DropdownItem>
109
+ ))}
110
+ </NavigationMenu.DropdownContent>
111
+ </NavigationMenu.Dropdown>
112
+ </NavigationMenu>
113
+ ```
@@ -0,0 +1,59 @@
1
+ ---
2
+ title: TopBar
3
+ component: TopBar,TopBar.Brand,TopBar.BrandLogo,TopBar.BrandText,TopBar.ActionIcon
4
+ description: The top bar provides content and actions related to the current screen. It is used for branding, screen titles, navigation, and actions.
5
+ category: Surfaces
6
+ ---
7
+
8
+ `TopBar` exports components that combine to form the elements that you would expect to commonly see in a TopBar. However, the `TopBar` is not limited to these components, as any components may sit within the `TopBar` to create a flexible and custom UI.
9
+
10
+ By default, `TopBar` uses a flex layout with flex items placed immediately after each other. To align flex items, an optional css prop with `justifyContent` can be passed.
11
+
12
+ Alternatively, if you want to avoid wrapping groups of items with a `div` purely for alignment purposes, you could use a spacer. In this example, the styling of the `Flex` component has been extended so that it stretches to fill the available space.
13
+
14
+ ```tsx preview
15
+ <TopBar>
16
+ <TopBar.Brand href="atomlearning.co.uk">
17
+ <TopBar.BrandName>Admin Panel</TopBar.BrandName>
18
+ </TopBar.Brand>
19
+ <Flex css={{ flex: 1, justifySelf: 'stretch', alignSelf: 'stretch' }} />
20
+ <Stack gap="2" direction="row">
21
+ <TopBar.ActionIcon icon={Search} label="Search" />
22
+ <TopBar.Divider />
23
+ <TopBar.ActionIcon icon={SwitchOff} label="Light/Dark mode" />
24
+ </Stack>
25
+ </TopBar>
26
+ ```
27
+
28
+ ## TopBar.Brand
29
+
30
+ `TopBar.Brand` renders a styled link.
31
+
32
+ ```tsx
33
+ import logo from '@atom-learning/theme/lib/assets/logo.svg'
34
+
35
+ const App = () => {
36
+ return (
37
+ <TopBar>
38
+ <TopBar.Brand href="atomlearning.co.uk">
39
+ <TopBar.BrandLogo src={logo} />
40
+ <TopBar.BrandName>Admin Panel</TopBar.BrandName>
41
+ </TopBar.Brand>
42
+ </TopBar>
43
+ )
44
+ }
45
+ ```
46
+
47
+ ## TopBar.BrandLogo
48
+
49
+ `TopBar.BrandLogo` renders an image with set styles and is primarily intended for the Atom logo.
50
+
51
+ ## TopBar.BrandName
52
+
53
+ `TopBar.BrandName` renders a `Text` component with set styles and is primarily intended to display the name of the current app.
54
+
55
+ ## TopBar.ActionIcon
56
+
57
+ `TopBar.ActionIcon` extends the base `ActionIcon` component with set props.
58
+
59
+ Note that instead of needing to include a seperate `Icon` component as children, an icon can be passed directly to this component as a prop.