@pnx-mixtape/mxds 0.0.19 → 0.0.20
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/dist/build/accordion.entry.js +2 -2
- package/dist/build/accordion.entry.js.map +1 -1
- package/dist/build/base.css +2 -1
- package/dist/build/button.css +4 -4
- package/dist/build/card.css +6 -5
- package/dist/build/chunks/{Accordion-deu4CCT-.js → Accordion-O-huO4At.js} +2 -2
- package/dist/build/chunks/{Accordion-deu4CCT-.js.map → Accordion-O-huO4At.js.map} +1 -1
- package/dist/build/chunks/{disclosure-widget-WwE5XplD.js → disclosure-widget-DVpnRsTI.js} +2 -2
- package/dist/build/chunks/{disclosure-widget-WwE5XplD.js.map → disclosure-widget-DVpnRsTI.js.map} +1 -1
- package/dist/build/chunks/{drop-menu.entry-e1iZ4ERw.js → drop-menu.entry-B4TtnC50.js} +2 -2
- package/dist/build/chunks/{drop-menu.entry-e1iZ4ERw.js.map → drop-menu.entry-B4TtnC50.js.map} +1 -1
- package/dist/build/chunks/{utilities-BeWkujCZ.js → utilities-DXELy_An.js} +91 -1
- package/dist/build/chunks/utilities-DXELy_An.js.map +1 -0
- package/dist/build/constants.css +6 -4
- package/dist/build/dialog.css +1 -9
- package/dist/build/dialog.entry.js +1 -1
- package/dist/build/drop-menu.entry.js +1 -1
- package/dist/build/filters.entry.js +1 -1
- package/dist/build/global-alert.entry.js +1 -1
- package/dist/build/header.css +49 -63
- package/dist/build/header.entry.js +1107 -21
- package/dist/build/header.entry.js.map +1 -1
- package/dist/build/hero-banner.css +12 -6
- package/dist/build/in-page-navigation.entry.js +1 -1
- package/dist/build/navigation.entry.js +2 -2
- package/dist/build/page.css +2 -2
- package/dist/build/pagination.css +15 -21
- package/dist/build/steps.css +11 -11
- package/dist/build/sticky.entry.js +1 -1
- package/dist/build/tabs.entry.js +2 -2
- package/dist/build/utilities.css +9 -1
- package/package.json +14 -14
- package/src/Atom/Button/_buttons-styles.css +3 -3
- package/src/Atom/Heading/Heading.tsx +1 -1
- package/src/Atom/Link/Link.stories.tsx +2 -6
- package/src/Atom/Link/Link.tsx +9 -4
- package/src/Atom/Link/_links.css +1 -0
- package/src/Component/Accordion/Accordion.stories.tsx +39 -9
- package/src/Component/Accordion/Accordion.tsx +28 -50
- package/src/Component/Accordion/Components/AccordionContent.tsx +24 -0
- package/src/Component/Accordion/Components/AccordionTitle.tsx +34 -0
- package/src/Component/Accordion/Components/AccordionTitleIcon.tsx +22 -0
- package/src/Component/Accordion/__snapshots__/Accordion.stories.tsx.snap +26 -0
- package/src/Component/Breadcrumb/Breadcrumb.tsx +8 -2
- package/src/Component/Breadcrumb/__snapshots__/Breadcrumb.stories.tsx.snap +7 -3
- package/src/Component/Card/Card.stories.tsx +22 -19
- package/src/Component/Card/Card.tsx +6 -28
- package/src/Component/Card/Components/CardContent.tsx +12 -0
- package/src/Component/Card/Components/CardMedia.tsx +17 -0
- package/src/Component/Card/__snapshots__/Card.stories.tsx.snap +9 -9
- package/src/Component/Card/card.css +3 -2
- package/src/Component/ContentBlock/Components/ContentBlockContent.tsx +14 -0
- package/src/Component/ContentBlock/Components/ContentBlockMedia.tsx +20 -0
- package/src/Component/ContentBlock/ContentBlock.stories.tsx +16 -13
- package/src/Component/ContentBlock/ContentBlock.tsx +5 -28
- package/src/Component/ContentBlock/__snapshots__/ContentBlock.stories.tsx.snap +0 -2
- package/src/Component/Dialog/Components/DialogCloseButton.tsx +18 -0
- package/src/Component/Dialog/Components/DialogContent.tsx +7 -0
- package/src/Component/Dialog/Dialog.stories.tsx +19 -24
- package/src/Component/Dialog/Dialog.tsx +31 -25
- package/src/Component/Dialog/__snapshots__/Dialog.stories.tsx.snap +14 -21
- package/src/Component/Dialog/dialog.css +0 -8
- package/src/Component/HeroBanner/HeroBanner.stories.ts +23 -12
- package/src/Component/HeroBanner/HeroBanner.stories.tsx +26 -7
- package/src/Component/HeroBanner/HeroBanner.tsx +2 -20
- package/src/Component/HeroBanner/__snapshots__/HeroBanner.stories.ts.snap +51 -3
- package/src/Component/HeroBanner/hero-banner.css +8 -4
- package/src/Component/HeroBanner/hero-banner.twig +2 -2
- package/src/Component/HeroSearch/HeroSearch.stories.ts +105 -0
- package/src/Component/HeroSearch/HeroSearch.stories.tsx +48 -0
- package/src/Component/HeroSearch/HeroSearch.tsx +32 -0
- package/src/Component/HeroSearch/__snapshots__/HeroSearch.stories.ts.snap +176 -0
- package/src/Component/HeroSearch/__snapshots__/HeroSearch.stories.tsx.snap +36 -0
- package/src/Component/HeroSearch/hero-search.twig +43 -0
- package/src/Component/InPageNavigation/InPageNavigation.stories.tsx +1 -1
- package/src/Component/InPageNavigation/InPageNavigation.tsx +1 -0
- package/src/Component/InPageNavigation/__snapshots__/InPageNavigation.stories.tsx.snap +1 -1
- package/src/Component/LinkList/LinkList.stories.ts +12 -0
- package/src/Component/LinkList/LinkList.stories.tsx +0 -6
- package/src/Component/LinkList/LinkList.tsx +5 -16
- package/src/Component/LinkList/__snapshots__/LinkList.stories.ts.snap +37 -0
- package/src/Component/LinkList/__snapshots__/LinkList.stories.tsx.snap +9 -29
- package/src/Component/LinkList/link-list.twig +1 -0
- package/src/Component/ListItem/Components/ListItemContent.tsx +12 -0
- package/src/Component/ListItem/Components/ListItemMedia.tsx +20 -0
- package/src/Component/ListItem/ListItem.stories.tsx +22 -19
- package/src/Component/ListItem/ListItem.tsx +3 -32
- package/src/Component/ListItem/__snapshots__/ListItem.stories.tsx.snap +3 -0
- package/src/Component/Pagination/Components/PaginationContext.tsx +10 -4
- package/src/Component/Pagination/Components/PaginationItem.tsx +10 -10
- package/src/Component/Pagination/__snapshots__/Pagination.stories.tsx.snap +10 -4
- package/src/Component/Pagination/pagination.css +13 -18
- package/src/Component/Steps/steps.css +1 -2
- package/src/Component/Tabs/Components/TabPanel.tsx +1 -1
- package/src/Component/Tabs/__snapshots__/Tabs.stories.tsx.snap +2 -0
- package/src/Component/Tile/Tile.stories.tsx +20 -15
- package/src/Component/Tile/__snapshots__/Tile.stories.tsx.snap +18 -23
- package/src/Layout/Header/Elements/GlobalToggle.ts +55 -21
- package/src/Layout/Header/__snapshots__/Header.stories.ts.snap +14 -14
- package/src/Layout/Header/_header.css +2 -47
- package/src/Layout/Header/_toggles.css +37 -1
- package/src/Layout/Header/header.twig +5 -5
- package/src/Layout/Page/Page.stories.tsx +13 -4
- package/src/Layout/Page/page.css +1 -1
- package/src/Layout/Section/__snapshots__/Section.stories.tsx.snap +3 -3
- package/src/Layout/Section/__snapshots__/SectionGrid.stories.tsx.snap +2 -2
- package/src/Layout/Sidebar/__snapshots__/Sidebar.stories.tsx.snap +3 -3
- package/src/Utility/utilities.css +8 -0
- package/src/constants.css +5 -3
- package/src/react.ts +30 -7
- package/src/tokens.js +3 -1
- package/dist/build/chunks/utilities-BeWkujCZ.js.map +0 -1
- package/src/Component/Tile/Tile.tsx +0 -53
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnx-mixtape/mxds",
|
|
3
3
|
"description": "The Mixtape Design System",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.20",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@floating-ui/dom": "^1.7.3",
|
|
7
7
|
"@oddbird/popover-polyfill": "^0.6.1",
|
|
8
|
-
"@pnx-mixtape/ids-shape": "^0.0.
|
|
8
|
+
"@pnx-mixtape/ids-shape": "^0.0.22",
|
|
9
9
|
"@types/react": "^19.1.10",
|
|
10
10
|
"@types/react-dom": "^19.1.7",
|
|
11
11
|
"classnames": "^2.5.1",
|
|
12
|
+
"focus-trap": "^7.6.5",
|
|
12
13
|
"js-cookie": "^3.0.5",
|
|
13
14
|
"react": "^19.1.1",
|
|
14
15
|
"react-aria": "^3.42.0",
|
|
15
16
|
"react-dom": "^19.1.1",
|
|
16
|
-
"react-stately": "^3.40.0"
|
|
17
|
-
"tabbable": "^6.2.0"
|
|
17
|
+
"react-stately": "^3.40.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@csstools/postcss-global-data": "^3.0.0",
|
|
@@ -105,27 +105,27 @@
|
|
|
105
105
|
"./src/*": "./src/*"
|
|
106
106
|
},
|
|
107
107
|
"scripts": {
|
|
108
|
-
"dev": "concurrently -k -n \"VITE,STORYBOOK\" -c \"#636cff,#ff4785\" \"pnpm
|
|
109
|
-
"build": "concurrently -n \"VITE,STORYBOOK\" -c \"#636cff,#ff4785\" \"pnpm
|
|
108
|
+
"dev": "concurrently -k -n \"VITE,STORYBOOK\" -c \"#636cff,#ff4785\" \"pnpm dev-vite\" \"pnpm dev-storybook\"",
|
|
109
|
+
"build": "concurrently -n \"VITE,STORYBOOK\" -c \"#636cff,#ff4785\" \"pnpm build-vite\" \"pnpm build-storybook\"",
|
|
110
110
|
"dev-storybook-html": "storybook dev -p 6006",
|
|
111
111
|
"dev-storybook-react": "storybook dev -p 6008 -c .storybook-react",
|
|
112
112
|
"dev-storybook": "concurrently \"npm:dev-storybook-*\"",
|
|
113
|
-
"build-storybook": "pnpm
|
|
113
|
+
"build-storybook": "pnpm build-storybook-html && pnpm build-storybook-react",
|
|
114
114
|
"build-storybook-html": "storybook build -o dist/storybook",
|
|
115
115
|
"build-storybook-react": "storybook build -o dist/storybook/react -c .storybook-react",
|
|
116
116
|
"dev-vite": "vite build -w -m development",
|
|
117
117
|
"build-vite": "vite build",
|
|
118
|
-
"format": "prettier --write \"**/*.{css,ts,tsx,js,jsx,json,md,mdx}\" && pnpm
|
|
119
|
-
"lint": "pnpm
|
|
118
|
+
"format": "prettier --write \"**/*.{css,ts,tsx,js,jsx,json,md,mdx}\" && pnpm fix-css && pnpm fix-js",
|
|
119
|
+
"lint": "pnpm lint-prettier && pnpm lint-css && pnpm lint-ts && pnpm lint-js",
|
|
120
120
|
"lint-prettier": "prettier --check \"**/*.{css,ts,tsx,js,jsx,json,md,mdx}\"",
|
|
121
121
|
"lint-css": "stylelint \"./**/*.css\"",
|
|
122
122
|
"lint-css-ci": "stylelint \"./**/*.css\" --custom-formatter @csstools/stylelint-formatter-github",
|
|
123
|
-
"fix-css": "pnpm
|
|
123
|
+
"fix-css": "pnpm lint-css --fix",
|
|
124
124
|
"lint-js": "eslint \"./**/*.{ts,tsx}\"",
|
|
125
125
|
"lint-js-ci": "eslint \"./**/*.{ts,tsx}\" --format gha",
|
|
126
|
-
"fix-js": "pnpm
|
|
126
|
+
"fix-js": "pnpm lint-js --fix",
|
|
127
127
|
"lint-ts": "tsc",
|
|
128
|
-
"test": "pnpm
|
|
128
|
+
"test": "pnpm test-storybook",
|
|
129
129
|
"test-vitest": "vitest --run",
|
|
130
130
|
"test-storybook": "concurrently \"npm:test-storybook-*\"",
|
|
131
131
|
"test-storybook-html": "test-storybook --maxWorkers=2",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"clean": "rm -rf ./dist",
|
|
134
134
|
"commit": "git-cz",
|
|
135
135
|
"http-server": "http-server ./dist/storybook -i -p 3001 --silent",
|
|
136
|
-
"build-ci": "pnpm
|
|
137
|
-
"lint-ci": "pnpm
|
|
136
|
+
"build-ci": "pnpm build",
|
|
137
|
+
"lint-ci": "pnpm lint-prettier && pnpm lint-css-ci && pnpm lint-ts && pnpm lint-js-ci"
|
|
138
138
|
}
|
|
139
139
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
--background: var(--colour-link);
|
|
9
9
|
--foreground: var(--colour-foreground-reverse);
|
|
10
10
|
|
|
11
|
-
&.button--outline {
|
|
11
|
+
&.mx-button--outline {
|
|
12
12
|
--background: transparent;
|
|
13
13
|
--foreground: var(--colour-primary);
|
|
14
14
|
}
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
--background: var(--colour-error);
|
|
30
30
|
--foreground: var(--colour-foreground-reverse);
|
|
31
31
|
|
|
32
|
-
&.button--outline {
|
|
32
|
+
&.mx-button--outline {
|
|
33
33
|
--background: transparent;
|
|
34
34
|
--foreground: var(--colour-error);
|
|
35
35
|
}
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
--background: var(--colour-foreground-reverse);
|
|
41
41
|
--foreground: var(--colour-foreground);
|
|
42
42
|
|
|
43
|
-
&.button--outline {
|
|
43
|
+
&.mx-button--outline {
|
|
44
44
|
--background: transparent;
|
|
45
45
|
--foreground: var(--colour-foreground-reverse);
|
|
46
46
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react-vite"
|
|
2
2
|
import Component from "./Link"
|
|
3
|
-
import { LinkStyles } from "../../enums"
|
|
4
3
|
|
|
5
4
|
const meta: Meta<typeof Component> = {
|
|
6
5
|
title: "Atom/Link",
|
|
@@ -10,9 +9,6 @@ const meta: Meta<typeof Component> = {
|
|
|
10
9
|
children: "Link",
|
|
11
10
|
to: "http://example.com",
|
|
12
11
|
},
|
|
13
|
-
argTypes: {
|
|
14
|
-
modifier: { options: Object.values(LinkStyles), control: "radio" },
|
|
15
|
-
},
|
|
16
12
|
}
|
|
17
13
|
export default meta
|
|
18
14
|
type Story = StoryObj<typeof meta>
|
|
@@ -20,11 +16,11 @@ type Story = StoryObj<typeof meta>
|
|
|
20
16
|
export const Link: Story = {}
|
|
21
17
|
export const External: Story = {
|
|
22
18
|
args: {
|
|
23
|
-
|
|
19
|
+
external: true,
|
|
24
20
|
},
|
|
25
21
|
}
|
|
26
22
|
export const More: Story = {
|
|
27
23
|
args: {
|
|
28
|
-
|
|
24
|
+
more: true,
|
|
29
25
|
},
|
|
30
26
|
}
|
package/src/Atom/Link/Link.tsx
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { JSX, ComponentPropsWithoutRef, PropsWithChildren } from "react"
|
|
2
2
|
import classNames from "classnames"
|
|
3
3
|
import { useLinkComponent } from "../../react"
|
|
4
|
-
import { LinkStyles } from "../../enums"
|
|
5
4
|
|
|
6
5
|
type LinkProps = ComponentPropsWithoutRef<"a"> &
|
|
7
6
|
PropsWithChildren & {
|
|
8
7
|
to: string
|
|
9
|
-
|
|
8
|
+
more?: boolean
|
|
9
|
+
external?: boolean
|
|
10
|
+
download?: boolean
|
|
10
11
|
className?: string
|
|
11
12
|
allyText?: string
|
|
12
13
|
}
|
|
@@ -15,7 +16,9 @@ const Link = ({
|
|
|
15
16
|
to,
|
|
16
17
|
children,
|
|
17
18
|
allyText,
|
|
18
|
-
|
|
19
|
+
more,
|
|
20
|
+
external,
|
|
21
|
+
download,
|
|
19
22
|
className = "mx-link",
|
|
20
23
|
...props
|
|
21
24
|
}: LinkProps): JSX.Element => {
|
|
@@ -25,7 +28,9 @@ const Link = ({
|
|
|
25
28
|
<LinkComponent
|
|
26
29
|
to={to}
|
|
27
30
|
className={classNames(className, {
|
|
28
|
-
|
|
31
|
+
"mx-link--more": more,
|
|
32
|
+
"mx-link--external": external,
|
|
33
|
+
"mx-link--download": download,
|
|
29
34
|
})}
|
|
30
35
|
{...props}
|
|
31
36
|
>
|
package/src/Atom/Link/_links.css
CHANGED
|
@@ -1,21 +1,51 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react-vite"
|
|
2
|
-
import { AccordionStyles, HeadingLevels } from "../../enums"
|
|
3
2
|
import Component from "./Accordion"
|
|
3
|
+
import AccordionTitle from "./Components/AccordionTitle"
|
|
4
|
+
import AccordionContent from "./Components/AccordionContent"
|
|
5
|
+
import AccordionTitleIcon from "./Components/AccordionTitleIcon"
|
|
4
6
|
import "./accordion.css"
|
|
7
|
+
import { HeadingTypes } from "@pnx-mixtape/ids-shape"
|
|
5
8
|
|
|
6
9
|
const meta: Meta<typeof Component> = {
|
|
7
10
|
component: Component,
|
|
8
11
|
tags: ["autodocs"],
|
|
9
12
|
args: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
children: (
|
|
14
|
+
<>
|
|
15
|
+
<AccordionTitle>
|
|
16
|
+
Open me!
|
|
17
|
+
<AccordionTitleIcon />
|
|
18
|
+
</AccordionTitle>
|
|
19
|
+
<AccordionContent>
|
|
20
|
+
I'm baby air plant hashtag letterpress blue bottle. Cloud bread
|
|
21
|
+
dreamcatcher everyday carry lumbersexual, iceland cardigan swag
|
|
22
|
+
chicharrones lo-fi fanny pack affogato freegan XOXO shaman. Shoreditch
|
|
23
|
+
cloud bread waistcoat tbh XOXO. Chillwave pour-over umami pug glossier
|
|
24
|
+
health goth.
|
|
25
|
+
</AccordionContent>
|
|
26
|
+
</>
|
|
27
|
+
),
|
|
18
28
|
},
|
|
19
29
|
}
|
|
20
30
|
export default meta
|
|
21
31
|
export const Accordion: StoryObj<typeof meta> = {}
|
|
32
|
+
|
|
33
|
+
export const HeadingLevel: StoryObj<typeof meta> = {
|
|
34
|
+
args: {
|
|
35
|
+
children: (
|
|
36
|
+
<>
|
|
37
|
+
<AccordionTitle headingLevel={HeadingTypes.TWO}>
|
|
38
|
+
Open me!
|
|
39
|
+
<AccordionTitleIcon />
|
|
40
|
+
</AccordionTitle>
|
|
41
|
+
<AccordionContent>
|
|
42
|
+
I'm baby air plant hashtag letterpress blue bottle. Cloud bread
|
|
43
|
+
dreamcatcher everyday carry lumbersexual, iceland cardigan swag
|
|
44
|
+
chicharrones lo-fi fanny pack affogato freegan XOXO shaman. Shoreditch
|
|
45
|
+
cloud bread waistcoat tbh XOXO. Chillwave pour-over umami pug glossier
|
|
46
|
+
health goth.
|
|
47
|
+
</AccordionContent>
|
|
48
|
+
</>
|
|
49
|
+
),
|
|
50
|
+
},
|
|
51
|
+
}
|
|
@@ -1,28 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
JSX,
|
|
3
|
+
PropsWithChildren,
|
|
4
|
+
useEffect,
|
|
5
|
+
useId,
|
|
6
|
+
createContext,
|
|
7
|
+
use,
|
|
8
|
+
useMemo,
|
|
9
|
+
} from "react"
|
|
2
10
|
import classNames from "classnames"
|
|
3
|
-
import { AccordionStyles, HeadingLevels } from "../../enums"
|
|
4
11
|
import useToggle from "../../Utility/Hooks/useToggle"
|
|
5
12
|
|
|
13
|
+
type AccordionContextValues = {
|
|
14
|
+
toggle: (value?: boolean) => void
|
|
15
|
+
on: boolean
|
|
16
|
+
id: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const AccordionContext = createContext<AccordionContextValues>(null)
|
|
20
|
+
export const useAccordion = () => use(AccordionContext)
|
|
21
|
+
|
|
6
22
|
type AccordionProps = PropsWithChildren & {
|
|
7
|
-
title: string
|
|
8
23
|
active?: boolean
|
|
9
24
|
id?: string
|
|
10
|
-
headingLevel?: HeadingLevels
|
|
11
|
-
modifier?: AccordionStyles
|
|
12
25
|
}
|
|
13
26
|
|
|
14
27
|
const Accordion = ({
|
|
15
|
-
title,
|
|
16
28
|
children,
|
|
17
29
|
active = false,
|
|
18
30
|
id = null,
|
|
19
|
-
modifier = null,
|
|
20
|
-
headingLevel = null,
|
|
21
31
|
...props
|
|
22
32
|
}: AccordionProps): JSX.Element => {
|
|
23
33
|
const [on, toggle] = useToggle(active)
|
|
24
34
|
const accordionId: string = id || useId()
|
|
25
|
-
const Heading = headingLevel ? headingLevel : Fragment
|
|
26
35
|
|
|
27
36
|
useEffect(() => {
|
|
28
37
|
if (typeof window === "undefined") return
|
|
@@ -31,52 +40,21 @@ const Accordion = ({
|
|
|
31
40
|
}
|
|
32
41
|
}, [accordionId])
|
|
33
42
|
|
|
43
|
+
const values = useMemo(
|
|
44
|
+
() => ({ on, toggle, id: accordionId }),
|
|
45
|
+
[on, toggle, accordionId],
|
|
46
|
+
)
|
|
47
|
+
|
|
34
48
|
return (
|
|
35
|
-
<
|
|
36
|
-
className={classNames("mx-accordion", {
|
|
37
|
-
[`mx-accordion--${modifier}`]: modifier,
|
|
38
|
-
})}
|
|
39
|
-
data-open={on}
|
|
40
|
-
{...props}
|
|
41
|
-
>
|
|
42
|
-
<Heading>
|
|
43
|
-
<button
|
|
44
|
-
type="button"
|
|
45
|
-
className="mx-accordion__toggle"
|
|
46
|
-
id={accordionId}
|
|
47
|
-
aria-expanded={on}
|
|
48
|
-
onClick={() => toggle()}
|
|
49
|
-
onKeyDown={({ key }) => {
|
|
50
|
-
if (key === "Enter") toggle()
|
|
51
|
-
}}
|
|
52
|
-
>
|
|
53
|
-
{title}
|
|
54
|
-
<span
|
|
55
|
-
className={classNames(
|
|
56
|
-
"mx-button",
|
|
57
|
-
"mx-button--small",
|
|
58
|
-
"mx-icon",
|
|
59
|
-
"mx-button--icon-only",
|
|
60
|
-
"mx-icon--chevron-down",
|
|
61
|
-
)}
|
|
62
|
-
aria-hidden="true"
|
|
63
|
-
/>
|
|
64
|
-
</button>
|
|
65
|
-
</Heading>
|
|
49
|
+
<AccordionContext value={values}>
|
|
66
50
|
<div
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"mx-accordion__content",
|
|
71
|
-
"mx-rich-text",
|
|
72
|
-
"mx-vertical-flow",
|
|
73
|
-
)}
|
|
74
|
-
// @ts-expect-error inert is allowed.
|
|
75
|
-
inert={!on ? "" : null}
|
|
51
|
+
className={classNames("mx-accordion", "mx-accordion--divided")}
|
|
52
|
+
data-open={on}
|
|
53
|
+
{...props}
|
|
76
54
|
>
|
|
77
55
|
{children}
|
|
78
56
|
</div>
|
|
79
|
-
</
|
|
57
|
+
</AccordionContext>
|
|
80
58
|
)
|
|
81
59
|
}
|
|
82
60
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { JSX, PropsWithChildren } from "react"
|
|
2
|
+
import classNames from "classnames"
|
|
3
|
+
import { useAccordion } from "../Accordion"
|
|
4
|
+
|
|
5
|
+
const AccordionContent = ({ children }: PropsWithChildren): JSX.Element => {
|
|
6
|
+
const { id, on } = useAccordion()
|
|
7
|
+
return (
|
|
8
|
+
<div
|
|
9
|
+
role="region"
|
|
10
|
+
aria-labelledby={id}
|
|
11
|
+
className={classNames(
|
|
12
|
+
"mx-accordion__content",
|
|
13
|
+
"mx-rich-text",
|
|
14
|
+
"mx-vertical-flow",
|
|
15
|
+
)}
|
|
16
|
+
// @ts-expect-error inert is allowed.
|
|
17
|
+
inert={!on ? "" : null}
|
|
18
|
+
>
|
|
19
|
+
{children}
|
|
20
|
+
</div>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default AccordionContent
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { JSX, PropsWithChildren, Fragment } from "react"
|
|
2
|
+
import { HeadingTypes } from "@pnx-mixtape/ids-shape"
|
|
3
|
+
import { useAccordion } from "../Accordion"
|
|
4
|
+
|
|
5
|
+
type AccordionTitleProps = PropsWithChildren & {
|
|
6
|
+
headingLevel?: HeadingTypes
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const AccordionTitle = ({
|
|
10
|
+
children,
|
|
11
|
+
headingLevel = null,
|
|
12
|
+
}: AccordionTitleProps): JSX.Element => {
|
|
13
|
+
const { id, on, toggle } = useAccordion()
|
|
14
|
+
const Heading = headingLevel ? headingLevel : Fragment
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Heading>
|
|
18
|
+
<button
|
|
19
|
+
type="button"
|
|
20
|
+
className="mx-accordion__toggle"
|
|
21
|
+
id={id}
|
|
22
|
+
aria-expanded={on}
|
|
23
|
+
onClick={() => toggle()}
|
|
24
|
+
onKeyDown={({ key }) => {
|
|
25
|
+
if (key === "Enter") toggle()
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
{children}
|
|
29
|
+
</button>
|
|
30
|
+
</Heading>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default AccordionTitle
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { JSX } from "react"
|
|
2
|
+
import classNames from "classnames"
|
|
3
|
+
|
|
4
|
+
type AccordionTitleIconProps = {
|
|
5
|
+
className?: string | string[]
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const defaultClassNames = [
|
|
9
|
+
"mx-button",
|
|
10
|
+
"mx-button--small",
|
|
11
|
+
"mx-icon",
|
|
12
|
+
"mx-button--icon-only",
|
|
13
|
+
"mx-icon--chevron-down",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
const AccordionTitleIcon = ({
|
|
17
|
+
className = defaultClassNames,
|
|
18
|
+
}: AccordionTitleIconProps): JSX.Element => {
|
|
19
|
+
return <span className={classNames(className)} aria-hidden="true" />
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default AccordionTitleIcon
|
|
@@ -23,3 +23,29 @@ exports[`Component/Accordion Accordion smoke-test 1`] = `
|
|
|
23
23
|
</div>
|
|
24
24
|
</div>
|
|
25
25
|
`;
|
|
26
|
+
|
|
27
|
+
exports[`Component/Accordion HeadingLevel smoke-test 1`] = `
|
|
28
|
+
<div class="mx-accordion mx-accordion--divided"
|
|
29
|
+
data-open="false"
|
|
30
|
+
>
|
|
31
|
+
<h2>
|
|
32
|
+
<button type="button"
|
|
33
|
+
class="mx-accordion__toggle"
|
|
34
|
+
id="unique-0"
|
|
35
|
+
aria-expanded="false"
|
|
36
|
+
>
|
|
37
|
+
Open me!
|
|
38
|
+
<span class="mx-button mx-button--small mx-icon mx-button--icon-only mx-icon--chevron-down"
|
|
39
|
+
aria-hidden="true"
|
|
40
|
+
>
|
|
41
|
+
</span>
|
|
42
|
+
</button>
|
|
43
|
+
</h2>
|
|
44
|
+
<div role="region"
|
|
45
|
+
aria-labelledby="unique-0"
|
|
46
|
+
class="mx-accordion__content mx-rich-text mx-vertical-flow"
|
|
47
|
+
>
|
|
48
|
+
I'm baby air plant hashtag letterpress blue bottle. Cloud bread dreamcatcher everyday carry lumbersexual, iceland cardigan swag chicharrones lo-fi fanny pack affogato freegan XOXO shaman. Shoreditch cloud bread waistcoat tbh XOXO. Chillwave pour-over umami pug glossier health goth.
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
`;
|
|
@@ -16,7 +16,13 @@ const Breadcrumb = ({
|
|
|
16
16
|
...props
|
|
17
17
|
}: BreadcrumbProps): JSX.Element => (
|
|
18
18
|
<nav
|
|
19
|
-
className={classNames(
|
|
19
|
+
className={classNames(
|
|
20
|
+
"mx-nav",
|
|
21
|
+
"mx-nav--breadcrumb",
|
|
22
|
+
"mx-nav--inline",
|
|
23
|
+
className,
|
|
24
|
+
)}
|
|
25
|
+
aria-label="You are here"
|
|
20
26
|
{...props}
|
|
21
27
|
>
|
|
22
28
|
<ul>
|
|
@@ -26,7 +32,7 @@ const Breadcrumb = ({
|
|
|
26
32
|
<Link to={item.to}>{item.title}</Link>
|
|
27
33
|
</li>
|
|
28
34
|
))}
|
|
29
|
-
{title && <li
|
|
35
|
+
{title && <li>{title}</li>}
|
|
30
36
|
</ul>
|
|
31
37
|
</nav>
|
|
32
38
|
)
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`Component/Breadcrumb Breadcrumb smoke-test 1`] = `
|
|
4
|
-
<nav class="nav nav--breadcrumb nav--inline"
|
|
4
|
+
<nav class="mx-nav mx-nav--breadcrumb mx-nav--inline"
|
|
5
|
+
aria-label="You are here"
|
|
6
|
+
>
|
|
5
7
|
<ul>
|
|
6
8
|
<li>
|
|
7
9
|
<a href="#"
|
|
@@ -24,7 +26,7 @@ exports[`Component/Breadcrumb Breadcrumb smoke-test 1`] = `
|
|
|
24
26
|
Contact
|
|
25
27
|
</a>
|
|
26
28
|
</li>
|
|
27
|
-
<li
|
|
29
|
+
<li>
|
|
28
30
|
Current page title
|
|
29
31
|
</li>
|
|
30
32
|
</ul>
|
|
@@ -32,7 +34,9 @@ exports[`Component/Breadcrumb Breadcrumb smoke-test 1`] = `
|
|
|
32
34
|
`;
|
|
33
35
|
|
|
34
36
|
exports[`Component/Breadcrumb NoCurrentPage smoke-test 1`] = `
|
|
35
|
-
<nav class="nav nav--breadcrumb nav--inline"
|
|
37
|
+
<nav class="mx-nav mx-nav--breadcrumb mx-nav--inline"
|
|
38
|
+
aria-label="You are here"
|
|
39
|
+
>
|
|
36
40
|
<ul>
|
|
37
41
|
<li>
|
|
38
42
|
<a href="#"
|
|
@@ -1,36 +1,39 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react-vite"
|
|
2
2
|
import Component from "./Card"
|
|
3
|
+
import CardContent from "./Components/CardContent"
|
|
4
|
+
import CardMedia from "./Components/CardMedia"
|
|
5
|
+
import Heading from "../../Atom/Heading/Heading"
|
|
3
6
|
import Link from "../../Atom/Link/Link"
|
|
4
7
|
import Text from "../../Atom/Text/Text"
|
|
5
8
|
import Media from "../../Atom/Media/Media"
|
|
6
9
|
import "./card.css"
|
|
7
|
-
import {
|
|
8
|
-
import { AsTypes, HeadingTypes } from "@pnx-mixtape/ids-shape"
|
|
10
|
+
import { AsTypes } from "@pnx-mixtape/ids-shape"
|
|
9
11
|
|
|
10
12
|
const meta: Meta<typeof Component> = {
|
|
11
13
|
tags: ["autodocs"],
|
|
12
14
|
component: Component,
|
|
13
15
|
argTypes: {
|
|
14
16
|
children: { table: { disable: true } },
|
|
15
|
-
image: { table: { disable: true } },
|
|
16
|
-
headingLevel: { options: Object.values(HeadingTypes) },
|
|
17
|
-
headingModifier: { options: Object.values(HeadingStyles) },
|
|
18
17
|
as: { options: Object.values(AsTypes) },
|
|
19
18
|
},
|
|
20
19
|
args: {
|
|
21
|
-
title: "Key feature or Section Name",
|
|
22
20
|
children: (
|
|
23
21
|
<>
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
<CardMedia skeleton>
|
|
23
|
+
<Media src="https://picsum.photos/id/56/558/418?grayscale" alt="" />
|
|
24
|
+
</CardMedia>
|
|
25
|
+
<CardContent>
|
|
26
|
+
<Heading>Key feature or Section Name</Heading>
|
|
27
|
+
<Text>
|
|
28
|
+
A short description to help explain enough about the subject matter
|
|
29
|
+
to encourage visitors to learn more.
|
|
30
|
+
</Text>
|
|
31
|
+
<Link more to="http://example.com">
|
|
32
|
+
Learn More
|
|
33
|
+
</Link>
|
|
34
|
+
</CardContent>
|
|
31
35
|
</>
|
|
32
36
|
),
|
|
33
|
-
image: <Media src="https://picsum.photos/id/56/558/418?grayscale" alt="" />,
|
|
34
37
|
},
|
|
35
38
|
}
|
|
36
39
|
|
|
@@ -38,14 +41,14 @@ export default meta
|
|
|
38
41
|
type Story = StoryObj<typeof Component>
|
|
39
42
|
|
|
40
43
|
export const Card: Story = {}
|
|
41
|
-
|
|
44
|
+
|
|
45
|
+
export const Reverse: Story = {
|
|
42
46
|
args: {
|
|
43
|
-
|
|
47
|
+
reversed: true,
|
|
44
48
|
},
|
|
45
49
|
}
|
|
46
|
-
export const
|
|
50
|
+
export const BlockLink: Story = {
|
|
47
51
|
args: {
|
|
48
|
-
|
|
49
|
-
headingLevel: HeadingTypes.TWO,
|
|
52
|
+
block: true,
|
|
50
53
|
},
|
|
51
54
|
}
|
|
@@ -1,31 +1,20 @@
|
|
|
1
|
-
import { JSX,
|
|
1
|
+
import { JSX, PropsWithChildren } from "react"
|
|
2
2
|
import classNames from "classnames"
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { HeadingTypes, AsTypes } from "@pnx-mixtape/ids-shape"
|
|
3
|
+
import { BackgroundStyles } from "../../enums"
|
|
4
|
+
import { AsTypes } from "@pnx-mixtape/ids-shape"
|
|
6
5
|
|
|
7
6
|
type CardProps = PropsWithChildren & {
|
|
8
|
-
title: string
|
|
9
|
-
image?: ReactNode
|
|
10
|
-
intro?: ReactNode
|
|
11
7
|
reversed?: boolean
|
|
12
8
|
block?: boolean
|
|
13
|
-
headingLevel?: HeadingTypes
|
|
14
|
-
headingModifier?: HeadingStyles
|
|
15
9
|
as?: AsTypes
|
|
16
10
|
background?: BackgroundStyles
|
|
17
11
|
className?: string
|
|
18
12
|
}
|
|
19
13
|
|
|
20
14
|
const Card = ({
|
|
21
|
-
title,
|
|
22
15
|
children,
|
|
23
16
|
reversed = null,
|
|
24
17
|
block = false,
|
|
25
|
-
image = null,
|
|
26
|
-
intro = null,
|
|
27
|
-
headingLevel = HeadingTypes.THREE,
|
|
28
|
-
headingModifier = null,
|
|
29
18
|
as = AsTypes.DIV,
|
|
30
19
|
background = null,
|
|
31
20
|
className = null,
|
|
@@ -34,24 +23,13 @@ const Card = ({
|
|
|
34
23
|
return (
|
|
35
24
|
<Tag className="mx-container">
|
|
36
25
|
<article
|
|
37
|
-
className={classNames("mx-card",
|
|
26
|
+
className={classNames("mx-card", className, {
|
|
38
27
|
"mx-card--reversed": reversed,
|
|
39
28
|
"mx-card--block": block,
|
|
29
|
+
[`mx-background--${background}`]: background,
|
|
40
30
|
})}
|
|
41
31
|
>
|
|
42
|
-
{
|
|
43
|
-
<figure className={classNames("mx-card__media", "stack")}>
|
|
44
|
-
<div className="mx-skeleton mx-skeleton--bg"></div>
|
|
45
|
-
{image}
|
|
46
|
-
</figure>
|
|
47
|
-
)}
|
|
48
|
-
<div className={classNames("mx-card__content", "mx-vertical-flow")}>
|
|
49
|
-
{intro}
|
|
50
|
-
<Heading as={headingLevel} modifier={headingModifier}>
|
|
51
|
-
{title}
|
|
52
|
-
</Heading>
|
|
53
|
-
{children}
|
|
54
|
-
</div>
|
|
32
|
+
{children}
|
|
55
33
|
</article>
|
|
56
34
|
</Tag>
|
|
57
35
|
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { JSX, PropsWithChildren } from "react"
|
|
2
|
+
import classNames from "classnames"
|
|
3
|
+
|
|
4
|
+
const CardContent = ({ children }: PropsWithChildren): JSX.Element => {
|
|
5
|
+
return (
|
|
6
|
+
<div className={classNames("mx-card__content", "mx-vertical-flow")}>
|
|
7
|
+
{children}
|
|
8
|
+
</div>
|
|
9
|
+
)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default CardContent
|