@pnx-mixtape/mxds 0.0.2 → 0.0.4

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 (265) hide show
  1. package/README.md +13 -13
  2. package/package.json +5 -4
  3. package/src/Atom/Background/__snapshots__/Backgrounds.stories.ts.snap +3 -3
  4. package/src/Atom/Background/_background.css +1 -22
  5. package/src/Atom/Blockquote/_blockquote.css +1 -1
  6. package/src/Atom/Button/Button.stories.ts +4 -6
  7. package/src/Atom/Button/README.md +3 -3
  8. package/src/Atom/Button/__snapshots__/Button.stories.ts.snap +23 -11
  9. package/src/Atom/Button/__snapshots__/Button.stories.tsx.snap +2 -2
  10. package/src/Atom/Button/_buttons-styles.css +1 -1
  11. package/src/Atom/Button/_buttons.css +5 -1
  12. package/src/Atom/Button/button.twig +6 -4
  13. package/src/Atom/Button/twig/story-button.twig +11 -0
  14. package/src/Atom/DefinitionList/__snapshots__/DefinitionList.stories.tsx.snap +1 -1
  15. package/src/Atom/Heading/__snapshots__/Heading.stories.ts.snap +2 -2
  16. package/src/Atom/Heading/__snapshots__/Heading.stories.tsx.snap +1 -1
  17. package/src/Atom/Heading/_headings.css +1 -1
  18. package/src/Atom/Heading/heading.twig +19 -1
  19. package/src/Atom/Icon/README.md +1 -1
  20. package/src/Atom/Icon/__snapshots__/Icon.stories.ts.snap +3 -3
  21. package/src/Atom/Icon/__snapshots__/Icon.stories.tsx.snap +3 -3
  22. package/src/Atom/Icon/_extended-set.css +1 -1
  23. package/src/Atom/Icon/_icon.css +5 -5
  24. package/src/Atom/Image/__snapshots__/Image.stories.ts.snap +1 -1
  25. package/src/Atom/Image/_image.css +1 -1
  26. package/src/Atom/Link/Link.stories.ts +31 -7
  27. package/src/Atom/Link/__snapshots__/Link.stories.ts.snap +46 -6
  28. package/src/Atom/Link/__snapshots__/Link.stories.tsx.snap +3 -3
  29. package/src/Atom/Link/_links.css +24 -2
  30. package/src/Atom/Link/link.twig +8 -6
  31. package/src/Atom/Link/twig/story-link.twig +11 -0
  32. package/src/Atom/Media/Media.stories.ts +17 -1
  33. package/src/Atom/Media/__snapshots__/Media.stories.ts.snap +17 -2
  34. package/src/Atom/Media/__snapshots__/Media.stories.tsx.snap +2 -2
  35. package/src/Atom/Media/_media.css +1 -1
  36. package/src/Atom/Media/media.twig +1 -5
  37. package/src/Atom/Media/twig/story-media.twig +11 -0
  38. package/src/Atom/NavList/__snapshots__/NavList.stories.ts.snap +1 -1
  39. package/src/Atom/NavList/nav-list.css +1 -1
  40. package/src/Atom/README.md +1 -1
  41. package/src/Atom/Spacing/__snapshots__/Spacing.stories.ts.snap +1 -1
  42. package/src/Atom/Spacing/_spacing.css +1 -1
  43. package/src/Atom/Table/__snapshots__/Table.stories.ts.snap +4 -4
  44. package/src/Atom/Table/__snapshots__/TableResponsive.stories.ts.snap +1 -1
  45. package/src/Atom/Table/_table.css +1 -1
  46. package/src/Atom/Text/__snapshots__/Text.stories.tsx.snap +1 -1
  47. package/src/Atom/Text/__snapshots__/TextSizes.stories.ts.snap +2 -2
  48. package/src/Atom/Text/_text-align.css +1 -1
  49. package/src/Atom/Text/_text-sizes.css +1 -1
  50. package/src/Atom/Video/Video.stories.ts +5 -3
  51. package/src/Atom/Video/__snapshots__/Video.stories.ts.snap +3 -13
  52. package/src/Atom/Video/_video.css +6 -1
  53. package/src/Atom/Video/video.twig +10 -4
  54. package/src/Atom/_animated.css +1 -1
  55. package/src/Atom/_flow-legacy.css +1 -1
  56. package/src/Atom/_flow.css +1 -1
  57. package/src/Atom/_generic.css +1 -1
  58. package/src/Atom/_hr.css +1 -1
  59. package/src/Atom/base.css +2 -2
  60. package/src/Component/Accordion/README.md +7 -17
  61. package/src/Component/Accordion/__snapshots__/Accordion.stories.ts.snap +4 -4
  62. package/src/Component/Accordion/__snapshots__/Accordion.stories.tsx.snap +1 -1
  63. package/src/Component/Accordion/accordion.css +2 -2
  64. package/src/Component/Accordion/accordion.entry.js +2 -0
  65. package/src/Component/Breadcrumb/__snapshots__/Breadcrumb.stories.ts.snap +1 -1
  66. package/src/Component/Breadcrumb/__snapshots__/Breadcrumb.stories.tsx.snap +2 -2
  67. package/src/Component/Breadcrumb/breadcrumb.css +1 -1
  68. package/src/Component/Callout/__snapshots__/Callout.stories.ts.snap +12 -0
  69. package/src/Component/Callout/callout.css +1 -1
  70. package/src/Component/Card/README.md +7 -13
  71. package/src/Component/Card/__snapshots__/Card.stories.ts.snap +34 -24
  72. package/src/Component/Card/__snapshots__/Card.stories.tsx.snap +3 -3
  73. package/src/Component/Card/card.css +3 -3
  74. package/src/Component/ContentBlock/README.md +7 -13
  75. package/src/Component/ContentBlock/__snapshots__/ContentBlock.stories.ts.snap +6 -23
  76. package/src/Component/ContentBlock/__snapshots__/ContentBlock.stories.tsx.snap +1 -1
  77. package/src/Component/ContentBlock/content-block.css +2 -2
  78. package/src/Component/Dialog/README.md +15 -49
  79. package/src/Component/Dialog/__snapshots__/Dialog.stories.ts.snap +2 -2
  80. package/src/Component/Dialog/__snapshots__/Dialog.stories.tsx.snap +1 -1
  81. package/src/Component/Dialog/dialog.css +3 -3
  82. package/src/Component/Dialog/dialog.entry.js +1 -0
  83. package/src/Component/DropMenu/README.md +19 -4
  84. package/src/Component/DropMenu/__snapshots__/DropMenu.stories.ts.snap +1 -1
  85. package/src/Component/DropMenu/__snapshots__/DropMenu.stories.tsx.snap +1 -1
  86. package/src/Component/DropMenu/drop-menu.css +1 -1
  87. package/src/Component/DropMenu/drop-menu.entry.js +1 -0
  88. package/src/Component/{InPageAlert/Elements/InPageAlert.ts → GlobalAlert/Elements/ClosableAlert.ts} +21 -10
  89. package/src/Component/GlobalAlert/GlobalAlert.stories.ts +49 -0
  90. package/src/Component/GlobalAlert/GlobalAlert.stories.tsx +33 -0
  91. package/src/Component/GlobalAlert/GlobalAlert.tsx +50 -0
  92. package/src/Component/GlobalAlert/README.md +27 -0
  93. package/src/Component/GlobalAlert/__snapshots__/GlobalAlert.stories.ts.snap +43 -0
  94. package/src/Component/GlobalAlert/__snapshots__/GlobalAlert.stories.tsx.snap +48 -0
  95. package/src/Component/GlobalAlert/global-alert.css +55 -0
  96. package/src/Component/GlobalAlert/global-alert.entry.js +1 -0
  97. package/src/Component/GlobalAlert/global-alert.twig +30 -0
  98. package/src/Component/GlobalAlert/twig/story-global-alert.twig +14 -0
  99. package/src/Component/HeroBanner/__snapshots__/HeroBanner.stories.ts.snap +74 -0
  100. package/src/Component/HeroBanner/__snapshots__/{PageTitle.stories.tsx.snap → HeroBanner.stories.tsx.snap} +4 -4
  101. package/src/Component/HeroBanner/hero-banner.css +1 -1
  102. package/src/Component/HeroBanner/hero-banner.twig +1 -0
  103. package/src/Component/InPageAlert/InPageAlert.stories.ts +20 -22
  104. package/src/Component/InPageAlert/InPageAlert.stories.tsx +5 -5
  105. package/src/Component/InPageAlert/InPageAlert.tsx +15 -41
  106. package/src/Component/InPageAlert/README.md +4 -4
  107. package/src/Component/InPageAlert/__snapshots__/InPageAlert.stories.ts.snap +9 -36
  108. package/src/Component/InPageAlert/__snapshots__/InPageAlert.stories.tsx.snap +56 -56
  109. package/src/Component/InPageAlert/in-page-alert.css +2 -2
  110. package/src/Component/InPageAlert/in-page-alert.twig +13 -16
  111. package/src/Component/InPageAlert/twig/story-in-page-alert.twig +11 -0
  112. package/src/Component/InPageNavigation/README.md +10 -15
  113. package/src/Component/InPageNavigation/__snapshots__/InPageNavigation.stories.ts.snap +6 -70
  114. package/src/Component/InPageNavigation/__snapshots__/InPageNavigation.stories.tsx.snap +1 -1
  115. package/src/Component/InPageNavigation/in-page-navigation.css +2 -2
  116. package/src/Component/InPageNavigation/in-page-navigation.entry.js +1 -0
  117. package/src/Component/LinkList/README.md +3 -3
  118. package/src/Component/LinkList/__snapshots__/LinkList.stories.ts.snap +24 -55
  119. package/src/Component/LinkList/link-list.css +1 -1
  120. package/src/Component/Navigation/README.md +16 -7
  121. package/src/Component/Navigation/__snapshots__/Collapsible.stories.ts.snap +1 -1
  122. package/src/Component/Navigation/__snapshots__/Dropdown.stories.ts.snap +1 -1
  123. package/src/Component/Navigation/__snapshots__/Dropdown.stories.tsx.snap +1 -1
  124. package/src/Component/Navigation/__snapshots__/Navigation.stories.ts.snap +1 -1
  125. package/src/Component/Navigation/__snapshots__/Navigation.stories.tsx.snap +2 -2
  126. package/src/Component/Navigation/_navigation-collapsible.css +1 -1
  127. package/src/Component/Navigation/_navigation-dropdown.css +1 -1
  128. package/src/Component/Navigation/_navigation-mega.css +1 -1
  129. package/src/Component/Navigation/_navigation.css +1 -1
  130. package/src/Component/Navigation/navigation.entry.js +1 -0
  131. package/src/Component/Pagination/README.md +3 -3
  132. package/src/Component/Pagination/__snapshots__/Pagination.stories.ts.snap +1 -1
  133. package/src/Component/Pagination/__snapshots__/Pagination.stories.tsx.snap +1 -1
  134. package/src/Component/Pagination/pagination.css +1 -1
  135. package/src/Component/Sticky/README.md +12 -5
  136. package/src/Component/Sticky/__snapshots__/Sticky.stories.ts.snap +9 -82
  137. package/src/Component/Sticky/__snapshots__/Sticky.stories.tsx.snap +1 -1
  138. package/src/Component/Sticky/sticky.css +2 -2
  139. package/src/Component/Sticky/sticky.entry.js +1 -0
  140. package/src/Component/Tabs/README.md +11 -4
  141. package/src/Component/Tabs/__snapshots__/Tabs.stories.ts.snap +1 -1
  142. package/src/Component/Tabs/__snapshots__/Tabs.stories.tsx.snap +1 -1
  143. package/src/Component/Tabs/tabs.css +2 -2
  144. package/src/Component/Tabs/tabs.entry.js +1 -0
  145. package/src/Component/Tag/README.md +2 -2
  146. package/src/Component/Tag/__snapshots__/Tag.stories.ts.snap +3 -3
  147. package/src/Component/Tag/__snapshots__/Tag.stories.tsx.snap +1 -1
  148. package/src/Component/Tag/tag.css +1 -1
  149. package/src/Component/Tile/__snapshots__/Tile.stories.ts.snap +1 -1
  150. package/src/Component/Tile/__snapshots__/Tile.stories.tsx.snap +2 -2
  151. package/src/Component/Tile/tiles.css +1 -1
  152. package/src/Form/README.md +2 -2
  153. package/src/Form/form.css +12 -12
  154. package/src/Layout/Footer/FooterMenu/__snapshots__/FooterMenu.stories.ts.snap +1 -1
  155. package/src/Layout/Footer/FooterMenu/footer-menu.css +1 -1
  156. package/src/Layout/Footer/footer.css +1 -1
  157. package/src/Layout/Grid/__snapshots__/Grid.stories.ts.snap +33 -90
  158. package/src/Layout/Grid/container-grid.css +2 -2
  159. package/src/Layout/Grid/grid.css +2 -2
  160. package/src/Layout/Header/_header.css +1 -1
  161. package/src/Layout/Header/_toggles.css +1 -1
  162. package/src/Layout/Header/header.entry.js +1 -0
  163. package/src/Layout/Masthead/__snapshots__/Masthead.stories.ts.snap +2 -2
  164. package/src/Layout/Masthead/masthead.css +5 -5
  165. package/src/Layout/Masthead/masthead.twig +2 -2
  166. package/src/Layout/Page/README.md +2 -2
  167. package/src/Layout/Page/__snapshots__/Page.stories.tsx.snap +1 -1
  168. package/src/Layout/Page/page.css +2 -2
  169. package/src/Layout/README.md +3 -2
  170. package/src/Layout/Section/Section.stories.ts +1 -2
  171. package/src/Layout/Section/__snapshots__/Background.stories.ts.snap +59 -0
  172. package/src/Layout/Section/__snapshots__/Breakouts.stories.ts.snap +80 -0
  173. package/src/Layout/Section/__snapshots__/Flow.stories.ts.snap +91 -0
  174. package/src/Layout/Section/__snapshots__/Section.stories.ts.snap +22 -14
  175. package/src/Layout/Section/section.css +4 -4
  176. package/src/Layout/Section/twig/section-story.twig +1 -1
  177. package/src/Layout/Sidebar/sidebar.css +1 -1
  178. package/src/Utility/Drupal/README.md +1 -1
  179. package/src/Utility/README.md +1 -1
  180. package/src/Utility/_layout-utils.css +1 -1
  181. package/src/Utility/utilities.css +3 -3
  182. package/src/elements.ts +1 -1
  183. package/dist/build/Accordion.js +0 -61
  184. package/dist/build/Accordion.js.map +0 -1
  185. package/dist/build/AccordionDiv.js +0 -62
  186. package/dist/build/AccordionDiv.js.map +0 -1
  187. package/dist/build/AccordionGroup.js +0 -85
  188. package/dist/build/AccordionGroup.js.map +0 -1
  189. package/dist/build/AccordionMobile.js +0 -31
  190. package/dist/build/AccordionMobile.js.map +0 -1
  191. package/dist/build/Dialog.js +0 -116
  192. package/dist/build/Dialog.js.map +0 -1
  193. package/dist/build/DropMenu.js +0 -132
  194. package/dist/build/DropMenu.js.map +0 -1
  195. package/dist/build/GlobalToggle.js +0 -103
  196. package/dist/build/GlobalToggle.js.map +0 -1
  197. package/dist/build/InPageAlert.js +0 -61
  198. package/dist/build/InPageAlert.js.map +0 -1
  199. package/dist/build/InPageNavigation.js +0 -92
  200. package/dist/build/InPageNavigation.js.map +0 -1
  201. package/dist/build/Navigation.js +0 -126
  202. package/dist/build/Navigation.js.map +0 -1
  203. package/dist/build/Sticky.js +0 -63
  204. package/dist/build/Sticky.js.map +0 -1
  205. package/dist/build/Tabs.js +0 -164
  206. package/dist/build/Tabs.js.map +0 -1
  207. package/dist/build/accordion.css +0 -108
  208. package/dist/build/base.css +0 -1000
  209. package/dist/build/breadcrumb.css +0 -47
  210. package/dist/build/breakpoint-loader.js +0 -52
  211. package/dist/build/breakpoint-loader.js.map +0 -1
  212. package/dist/build/button.css +0 -126
  213. package/dist/build/callout.css +0 -11
  214. package/dist/build/card.css +0 -135
  215. package/dist/build/chunks/js.cookie-CiMiGxWx.js +0 -101
  216. package/dist/build/chunks/js.cookie-CiMiGxWx.js.map +0 -1
  217. package/dist/build/chunks/polyfills-CJ5uTmUJ.js +0 -749
  218. package/dist/build/chunks/polyfills-CJ5uTmUJ.js.map +0 -1
  219. package/dist/build/chunks/popover-wbPSyFRj.js +0 -654
  220. package/dist/build/chunks/popover-wbPSyFRj.js.map +0 -1
  221. package/dist/build/chunks/utilities-BIk0P2KX.js +0 -61
  222. package/dist/build/chunks/utilities-BIk0P2KX.js.map +0 -1
  223. package/dist/build/constants.css +0 -120
  224. package/dist/build/container-grid.css +0 -207
  225. package/dist/build/content-block.css +0 -23
  226. package/dist/build/cookie-compliance.js +0 -122
  227. package/dist/build/cookie-compliance.js.map +0 -1
  228. package/dist/build/dialog.css +0 -98
  229. package/dist/build/disclosure-widget.js +0 -124
  230. package/dist/build/disclosure-widget.js.map +0 -1
  231. package/dist/build/drop-menu.css +0 -78
  232. package/dist/build/drupal.css +0 -74
  233. package/dist/build/footer-menu.css +0 -32
  234. package/dist/build/footer.css +0 -61
  235. package/dist/build/form.css +0 -589
  236. package/dist/build/grid.css +0 -200
  237. package/dist/build/header.css +0 -131
  238. package/dist/build/hero-banner.css +0 -62
  239. package/dist/build/icon.css +0 -399
  240. package/dist/build/in-page-alert.css +0 -94
  241. package/dist/build/in-page-navigation.css +0 -17
  242. package/dist/build/index.css +0 -4980
  243. package/dist/build/io-loader.js +0 -44
  244. package/dist/build/io-loader.js.map +0 -1
  245. package/dist/build/keyboard.js +0 -101
  246. package/dist/build/keyboard.js.map +0 -1
  247. package/dist/build/link-list.css +0 -72
  248. package/dist/build/masthead.css +0 -39
  249. package/dist/build/nav-list.css +0 -29
  250. package/dist/build/navigation.css +0 -371
  251. package/dist/build/page.css +0 -184
  252. package/dist/build/pagination.css +0 -123
  253. package/dist/build/section.css +0 -160
  254. package/dist/build/sidebar.css +0 -105
  255. package/dist/build/sticky.css +0 -47
  256. package/dist/build/tabs.css +0 -106
  257. package/dist/build/tag.css +0 -67
  258. package/dist/build/tiles.css +0 -61
  259. package/dist/build/utilities.css +0 -175
  260. package/src/Component/Card/__snapshots__/CardGrid.stories.ts.snap +0 -89
  261. package/src/Component/HeroBanner/__snapshots__/PageTitle.stories.ts.snap +0 -31
  262. package/src/Layout/Section/__snapshots__/SectionBackground.stories.ts.snap +0 -55
  263. package/src/Layout/Section/__snapshots__/SectionsBreakouts.stories.ts.snap +0 -78
  264. package/src/Layout/Section/__snapshots__/SectionsFlowsGroups.stories.ts.snap +0 -89
  265. package/src/index.css +0 -27
@@ -0,0 +1,49 @@
1
+ import { Meta, StoryObj } from "@storybook/html"
2
+ import Component from "./twig/story-global-alert.twig"
3
+ import "./global-alert.css"
4
+ import "./Elements/ClosableAlert"
5
+ import {
6
+ GlobalAlert as GlobalAlertType,
7
+ GlobalAlertTypes,
8
+ HeadingTypes,
9
+ } from "@pnx-mixtape/ids-shape"
10
+
11
+ const meta: Meta<GlobalAlertType> = {
12
+ tags: ["autodocs"],
13
+ component: Component,
14
+ argTypes: {
15
+ type: { options: Object.values(GlobalAlertTypes), control: "radio" },
16
+ id: {
17
+ control: "text",
18
+ description: "Set an id to get stable localStorage entry.",
19
+ },
20
+ dismissible: { control: "boolean" },
21
+ // @ts-expect-error The controls follow the shape
22
+ "title.title": { control: "text" },
23
+ "title.as": { options: Object.values(HeadingTypes), control: "select" },
24
+ "link.href": { control: "text" },
25
+ "link.title": { control: "text" },
26
+ },
27
+ args: {
28
+ title: {
29
+ title: "In page alert",
30
+ as: HeadingTypes.TWO,
31
+ modifiers: [HeadingTypes.FOUR],
32
+ },
33
+ content: "Something happened that requires your attention",
34
+ type: GlobalAlertTypes.LIGHT,
35
+ dismissible: true,
36
+ },
37
+ }
38
+
39
+ export default meta
40
+ type Story = StoryObj<GlobalAlertType>
41
+
42
+ export const GlobalAlert: Story = {}
43
+
44
+ export const Critical: Story = {
45
+ args: {
46
+ dismissible: false,
47
+ type: GlobalAlertTypes.CRITICAL,
48
+ },
49
+ }
@@ -0,0 +1,33 @@
1
+ import { Meta, StoryObj } from "@storybook/react"
2
+ import Component from "./GlobalAlert"
3
+ import "./global-alert.css"
4
+ import { GlobalAlertTypes } from "@pnx-mixtape/ids-shape"
5
+
6
+ const meta: Meta<typeof Component> = {
7
+ tags: ["autodocs"],
8
+ component: Component,
9
+ args: {
10
+ children: (
11
+ <p>
12
+ <b>Something happened.</b> And if you&apos;d like to know what,{" "}
13
+ <a href="#">Click here</a>.
14
+ </p>
15
+ ),
16
+ dismissible: true,
17
+ },
18
+ argTypes: {
19
+ type: { options: Object.values(GlobalAlertTypes), control: "radio" },
20
+ },
21
+ }
22
+
23
+ export default meta
24
+ type Story = StoryObj<typeof meta>
25
+
26
+ export const GlobalAlert: Story = {}
27
+
28
+ export const Critical: Story = {
29
+ args: {
30
+ type: GlobalAlertTypes.CRITICAL,
31
+ dismissible: false,
32
+ },
33
+ }
@@ -0,0 +1,50 @@
1
+ import { JSX, PropsWithChildren, useId } from "react"
2
+ import classNames from "classnames"
3
+ import useLocalStorage from "../../Utility/Hooks/useLocalStorage"
4
+ import { GlobalAlertTypes } from "@pnx-mixtape/ids-shape"
5
+
6
+ type GlobalAlertProps = PropsWithChildren & {
7
+ type?: GlobalAlertTypes
8
+ id?: string
9
+ dismissible?: boolean
10
+ }
11
+
12
+ const GlobalAlert = ({
13
+ children,
14
+ id,
15
+ type = GlobalAlertTypes.LIGHT,
16
+ dismissible,
17
+ }: GlobalAlertProps): JSX.Element => {
18
+ const uniqueId: string = id || useId()
19
+ const [messageVisible, setMessageVisible] = useLocalStorage({
20
+ key: uniqueId,
21
+ initialValue: true,
22
+ })
23
+
24
+ return (
25
+ <>
26
+ {messageVisible && (
27
+ <div
28
+ id={uniqueId}
29
+ className={classNames("global-alert", {
30
+ [`global-alert--${type}`]: type,
31
+ })}
32
+ >
33
+ <div className="global-alert__inner">
34
+ <div className="global-alert__content">{children}</div>
35
+ {dismissible && (
36
+ <button
37
+ className={classNames("icon", "icon--close")}
38
+ onClick={() => setMessageVisible(false)}
39
+ aria-label={`Close ${type} message`}
40
+ type="button"
41
+ ></button>
42
+ )}
43
+ </div>
44
+ </div>
45
+ )}
46
+ </>
47
+ )
48
+ }
49
+
50
+ export default GlobalAlert
@@ -0,0 +1,27 @@
1
+ # Global Alert
2
+
3
+ ### How to use
4
+
5
+ **CSS**
6
+
7
+ `@import '@pnx-mixtape/mxds/src/Component/GlobalAlert/global-alert.css';`
8
+
9
+ **Twig**
10
+
11
+ You can setup a twig namespace in your project if you wish to use the twig files directly.
12
+
13
+ - Eg: `{% extends '@mixtape/Component/GlobalAlert/global-alert.twig' %}`
14
+
15
+ Alternatively copy/paste the file for more control.
16
+
17
+ **JSX Components**
18
+
19
+ JSX components are available for use with React.
20
+
21
+ - JSX import: `import { GlobalAlert } from '@pnx-mixtape/mxds/react';`
22
+
23
+ **Custom Element**
24
+
25
+ This javascript just adds the ability to close/dismiss a message, which is recorded in localStorage.
26
+
27
+ - ES6 import: `import '@pnx-mixtape/mxds/src/Component/GlobalAlert/Elements/ClosableAlert';`
@@ -0,0 +1,43 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Component/GlobalAlert Critical smoke-test 1`] = `
4
+ <div class="global-alert page global-alert--critical">
5
+ <div class="global-alert__inner"
6
+ data-container
7
+ >
8
+ <div class="global-alert__content">
9
+ <h2 class=" heading--m">
10
+ In page alert
11
+ </h2>
12
+ <p>
13
+ Something happened that requires your attention
14
+ </p>
15
+ </div>
16
+ </div>
17
+ </div>
18
+ `;
19
+
20
+ exports[`Component/GlobalAlert GlobalAlert smoke-test 1`] = `
21
+ <mx-closable-alert class="global-alert page global-alert--light"
22
+ id="unique-0"
23
+ >
24
+ <div class="global-alert__inner"
25
+ data-container
26
+ >
27
+ <div class="global-alert__content">
28
+ <h2 class=" heading--m">
29
+ In page alert
30
+ </h2>
31
+ <p>
32
+ Something happened that requires your attention
33
+ </p>
34
+ </div>
35
+ <button class="icon icon--close"
36
+ aria-controls="unique-0"
37
+ aria-label="Close GlobalAlert"
38
+ type="button"
39
+ >
40
+ </button>
41
+ </div>
42
+ </mx-closable-alert>
43
+ `;
@@ -0,0 +1,48 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Component/GlobalAlert Critical smoke-test 1`] = `
4
+ <div id=":r1:"
5
+ class="global-alert global-alert--critical"
6
+ >
7
+ <div class="global-alert__inner">
8
+ <div class="global-alert__content">
9
+ <p>
10
+ <b>
11
+ Something happened.
12
+ </b>
13
+ And if you'd like to know what,
14
+ <a href="#">
15
+ Click here
16
+ </a>
17
+ .
18
+ </p>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ `;
23
+
24
+ exports[`Component/GlobalAlert GlobalAlert smoke-test 1`] = `
25
+ <div id=":r0:"
26
+ class="global-alert global-alert--light"
27
+ >
28
+ <div class="global-alert__inner">
29
+ <div class="global-alert__content">
30
+ <p>
31
+ <b>
32
+ Something happened.
33
+ </b>
34
+ And if you'd like to know what,
35
+ <a href="#">
36
+ Click here
37
+ </a>
38
+ .
39
+ </p>
40
+ </div>
41
+ <button class="icon icon--close"
42
+ aria-label="Close light message"
43
+ type="button"
44
+ >
45
+ </button>
46
+ </div>
47
+ </div>
48
+ `;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Messages
3
+ */
4
+
5
+ @layer design-system.defaults {
6
+ mx-closable-alert {
7
+ display: block;
8
+ }
9
+ }
10
+
11
+ @layer design-system.components {
12
+ .global-alert {
13
+ background-color: var(--background, var(--colour-primary-light));
14
+ color: var(--foreground, var(--colour-foreground));
15
+
16
+ & .global-alert__inner {
17
+ display: grid;
18
+ gap: var(--gap-s);
19
+ padding-block: var(--spacing-xxs);
20
+ padding-inline: var(--spacing-s);
21
+
22
+ &:has(.icon--close) {
23
+ grid-template-columns: auto min-content;
24
+ grid-template-areas: "content close";
25
+
26
+ & .message__content {
27
+ grid-area: content;
28
+ }
29
+ }
30
+ }
31
+
32
+ & a {
33
+ color: inherit;
34
+ }
35
+
36
+ &.global-alert--critical {
37
+ --foreground: var(--colour-error-foreground);
38
+ --background: var(--colour-error-background);
39
+ }
40
+
41
+ & .icon--close {
42
+ --icon-size: 1rem;
43
+
44
+ grid-area: close;
45
+ appearance: none;
46
+ inline-size: var(--spacing-l);
47
+ block-size: var(--spacing-l);
48
+ padding: 0;
49
+ border: 0;
50
+ background-color: transparent;
51
+ justify-content: end;
52
+ color: inherit;
53
+ }
54
+ }
55
+ }
@@ -0,0 +1 @@
1
+ import "./Elements/GlobalAlert"
@@ -0,0 +1,30 @@
1
+ {% set baseClass = 'global-alert' %}
2
+ {% set classes = [
3
+ baseClass,
4
+ 'page',
5
+ type ? baseClass~'--'~type : null,
6
+ ] %}
7
+ {% set attributes = (attributes|default(create_attribute())).addClass(classes) %}
8
+
9
+ {% if dismissible %}
10
+ <mx-closable-alert {{ attributes}}{% if id %} id="{{ id ~ type }}"{% endif %}>
11
+ <div class="global-alert__inner" data-container>
12
+ <div class="global-alert__content">
13
+ {{ title }}
14
+ {{ content }}
15
+ {{ link }}
16
+ </div>
17
+ </div>
18
+ </mx-closable-alert>
19
+ {% else %}
20
+ <div {{ attributes}}{% if id %} id="{{ id ~ type }}"{% endif %}>
21
+ <div class="global-alert__inner" data-container>
22
+ <div class="global-alert__content">
23
+ {{ title }}
24
+ {{ content }}
25
+ {{ link }}
26
+ </div>
27
+ </div>
28
+ </div>
29
+ {% endif %}
30
+
@@ -0,0 +1,14 @@
1
+ {% extends "../global-alert.twig" %}
2
+ {% if title %}
3
+ {% set title %}
4
+ {% include '@mixtape/Atom/Heading/heading.twig' with { title: title.title, as: title.as, modifiers: title.modifiers } only %}
5
+ {% endset %}
6
+ {% endif %}
7
+ {% if link %}
8
+ {% set link %}
9
+ {% include '@mixtape/Atom/Link/link.twig' with { href: link.href, title: link.title } only %}
10
+ {% endset %}
11
+ {% endif %}
12
+ {% if content %}
13
+ {% set content %}<p>{{ content }}</p>{% endset %}
14
+ {% endif %}
@@ -0,0 +1,74 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Component/HeroBanner HeroBanner smoke-test 1`] = `
4
+ <div class="page">
5
+ <div class="hero-banner page ">
6
+ <div class="hero-banner__inner">
7
+ <div class="hero-banner__content vertical-flow section--xl">
8
+ <h1 class>
9
+ Hero banner title
10
+ </h1>
11
+ <div class="text--lede">
12
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
13
+ </div>
14
+ <a class="link link--more "
15
+ href="#"
16
+ >
17
+ <span>
18
+ Find out more
19
+ </span>
20
+ </a>
21
+ </div>
22
+ <div class="hero-banner__aside hero-banner__aside-image">
23
+ <picture>
24
+ <img src="https://picsum.photos/id/56/558/418?grayscale"
25
+ alt
26
+ >
27
+ </picture>
28
+ </div>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ `;
33
+
34
+ exports[`Component/HeroBanner LinkList smoke-test 1`] = `
35
+ <div class="page">
36
+ <div class="hero-banner page ">
37
+ <div class="hero-banner__inner">
38
+ <div class="hero-banner__content vertical-flow section--xl">
39
+ <h1 class>
40
+ Hero banner title
41
+ </h1>
42
+ <div class="text--lede">
43
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
44
+ </div>
45
+ </div>
46
+ <div class="hero-banner__aside">
47
+ <ul class="link-list">
48
+ <li>
49
+ <a href="#"
50
+ class="icon icon--chevron-right"
51
+ >
52
+ Link one
53
+ </a>
54
+ </li>
55
+ <li>
56
+ <a href="#"
57
+ class="icon icon--chevron-right"
58
+ >
59
+ Link two
60
+ </a>
61
+ </li>
62
+ <li>
63
+ <a href="#"
64
+ class="icon icon--chevron-right"
65
+ >
66
+ Link three
67
+ </a>
68
+ </li>
69
+ </ul>
70
+ </div>
71
+ </div>
72
+ </div>
73
+ </div>
74
+ `;
@@ -1,8 +1,8 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Components/HeroBanner/HeroBanner Hero smoke-test 1`] = `
3
+ exports[`Component/HeroBanner Hero smoke-test 1`] = `
4
4
  <div class="page section--xl">
5
- <div class="page-title vertical-flow page-title--hero">
5
+ <div class="hero-banner vertical-flow hero-banner--hero">
6
6
  <h1 class="headline"
7
7
  id="always-put-your-best-"
8
8
  >
@@ -20,9 +20,9 @@ exports[`Components/HeroBanner/HeroBanner Hero smoke-test 1`] = `
20
20
  </div>
21
21
  `;
22
22
 
23
- exports[`Components/HeroBanner/HeroBanner HeroBanner smoke-test 1`] = `
23
+ exports[`Component/HeroBanner HeroBanner smoke-test 1`] = `
24
24
  <div class="page section--xl">
25
- <div class="page-title vertical-flow">
25
+ <div class="hero-banner vertical-flow">
26
26
  <h1 class="headline"
27
27
  id="always-put-your-best-"
28
28
  >
@@ -2,7 +2,7 @@
2
2
  * Page Title
3
3
  */
4
4
 
5
- @layer components {
5
+ @layer design-system.components {
6
6
  .hero-banner {
7
7
  position: relative;
8
8
  z-index: 1;
@@ -26,6 +26,7 @@
26
26
  {% if subtitle %}
27
27
  <div class="text--lede">{{ subtitle }}</div>
28
28
  {% endif %}
29
+ {{ content }}
29
30
  {{ link }}
30
31
  </div>
31
32
  {% if linkList %}
@@ -1,35 +1,33 @@
1
1
  import { Meta, StoryObj } from "@storybook/html"
2
- import Component from "./in-page-alert.twig"
2
+ import Component from "./twig/story-in-page-alert.twig"
3
3
  import "./in-page-alert.css"
4
- import "./Elements/InPageAlert"
5
- import { MessageTypes } from "../../enums"
4
+ import {
5
+ HeadingTypes,
6
+ InPageAlert as InPageAlertType,
7
+ InPageAlertTypes,
8
+ } from "@pnx-mixtape/ids-shape"
6
9
 
7
- type InPageAlertArgs = {
8
- type?: MessageTypes
9
- id?: string
10
- closable?: boolean
11
- }
12
-
13
- const meta: Meta<InPageAlertArgs> = {
10
+ const meta: Meta<InPageAlertType> = {
14
11
  tags: ["autodocs"],
15
12
  component: Component,
16
13
  argTypes: {
17
- type: { options: Object.values(MessageTypes), control: "radio" },
18
- id: {
19
- control: "text",
20
- description: "Set an id to get stable localStorage entry.",
14
+ type: { options: Object.values(InPageAlertTypes), control: "radio" },
15
+ // @ts-expect-error The controls follow the shape
16
+ "title.title": { control: "text" },
17
+ "title.as": { options: Object.values(HeadingTypes), control: "select" },
18
+ "link.href": { control: "text" },
19
+ "link.title": { control: "text" },
20
+ },
21
+ args: {
22
+ content: "Something happened that requires your attention",
23
+ link: {
24
+ title: "Click here",
25
+ href: "#",
21
26
  },
22
- closable: { control: "boolean" },
23
27
  },
24
28
  }
25
29
 
26
30
  export default meta
27
- type Story = StoryObj<InPageAlertArgs>
31
+ type Story = StoryObj<InPageAlertType>
28
32
 
29
33
  export const InPageAlert: Story = {}
30
-
31
- export const Closable: Story = {
32
- args: {
33
- closable: true,
34
- },
35
- }
@@ -1,7 +1,7 @@
1
1
  import { Meta, StoryObj } from "@storybook/react"
2
2
  import Component from "./InPageAlert"
3
3
  import "./in-page-alert.css"
4
- import { MessageTypes } from "../../enums"
4
+ import { InPageAlertTypes } from "@pnx-mixtape/ids-shape"
5
5
 
6
6
  const meta: Meta<typeof Component> = {
7
7
  tags: ["autodocs"],
@@ -15,7 +15,7 @@ const meta: Meta<typeof Component> = {
15
15
  ),
16
16
  },
17
17
  argTypes: {
18
- type: { options: Object.values(MessageTypes), control: "radio" },
18
+ type: { options: Object.values(InPageAlertTypes), control: "radio" },
19
19
  },
20
20
  }
21
21
 
@@ -26,18 +26,18 @@ export const InPageAlert: Story = {}
26
26
 
27
27
  export const Warning: Story = {
28
28
  args: {
29
- type: MessageTypes.WARNING,
29
+ type: InPageAlertTypes.WARNING,
30
30
  },
31
31
  }
32
32
 
33
33
  export const Error: Story = {
34
34
  args: {
35
- type: MessageTypes.ERROR,
35
+ type: InPageAlertTypes.ERROR,
36
36
  },
37
37
  }
38
38
 
39
39
  export const Success: Story = {
40
40
  args: {
41
- type: MessageTypes.SUCCESS,
41
+ type: InPageAlertTypes.SUCCESS,
42
42
  },
43
43
  }
@@ -1,50 +1,24 @@
1
- import { JSX, PropsWithChildren, useId } from "react"
1
+ import { JSX, PropsWithChildren } from "react"
2
2
  import classNames from "classnames"
3
- import useLocalStorage from "../../Utility/Hooks/useLocalStorage"
4
- import { MessageTypes } from "../../enums"
3
+ import { InPageAlertTypes } from "@pnx-mixtape/ids-shape"
5
4
 
6
5
  type InPageAlertProps = PropsWithChildren & {
7
- type?: MessageTypes
8
- id?: string
9
- closable?: boolean
6
+ type?: InPageAlertTypes
10
7
  }
11
8
 
12
9
  const InPageAlert = ({
13
10
  children,
14
- id,
15
- type = MessageTypes.INFO,
16
- closable,
17
- }: InPageAlertProps): JSX.Element => {
18
- const uniqueId: string = id || useId()
19
- const [messageVisible, setMessageVisible] = useLocalStorage({
20
- key: uniqueId,
21
- initialValue: true,
22
- })
23
-
24
- return (
25
- <>
26
- {messageVisible && (
27
- <div
28
- id={uniqueId}
29
- className={classNames("message", {
30
- [`message--${type}`]: type,
31
- icon: type,
32
- [`icon--${type}`]: type,
33
- })}
34
- >
35
- {children}
36
- {closable && (
37
- <button
38
- className={classNames("icon", "icon--close")}
39
- onClick={() => setMessageVisible(false)}
40
- aria-label={`Close ${type} message`}
41
- type="button"
42
- ></button>
43
- )}
44
- </div>
45
- )}
46
- </>
47
- )
48
- }
11
+ type = InPageAlertTypes.INFO,
12
+ }: InPageAlertProps): JSX.Element => (
13
+ <div
14
+ className={classNames("message", {
15
+ [`message--${type}`]: type,
16
+ icon: type,
17
+ [`icon--${type}`]: type,
18
+ })}
19
+ >
20
+ <div className="message__content">{children}</div>
21
+ </div>
22
+ )
49
23
 
50
24
  export default InPageAlert
@@ -4,13 +4,13 @@
4
4
 
5
5
  **CSS**
6
6
 
7
- `@import '@pnx-mixtape/mxds/in-page-alert.css';`
7
+ `@import '@pnx-mixtape/mxds/src/Component/InPageAlert/in-page-alert.css';`
8
8
 
9
9
  **Twig**
10
10
 
11
11
  You can setup a twig namespace in your project if you wish to use the twig files directly.
12
12
 
13
- - Eg: `{% extends '@mixtape/Components/InPageAlert/in-page-alert.twig' %}`
13
+ - Eg: `{% extends '@mixtape/Component/InPageAlert/in-page-alert.twig' %}`
14
14
 
15
15
  Alternatively copy/paste the file for more control.
16
16
 
@@ -18,10 +18,10 @@ Alternatively copy/paste the file for more control.
18
18
 
19
19
  JSX components are available for use with React.
20
20
 
21
- - JSX import: `import { InPageAlert } from 'pnx-mixtape/InPageAlert';`
21
+ - JSX import: `import { InPageAlert } from '@pnx-mixtape/mxds/react';`
22
22
 
23
23
  **Custom Element**
24
24
 
25
25
  This javascript just adds the ability to close/dismiss a message, which is recorded in localStorage.
26
26
 
27
- - ES6 import: `import '@pnx-mixtape/mxds/InPageAlert/Elements/InPageAlert';`
27
+ - ES6 import: `import '@pnx-mixtape/mxds/src/Component/InPageAlert/Elements/InPageAlert';`