@pnx-mixtape/mxds 0.0.14 → 0.0.15
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/README.md +37 -23
- package/dist/build/accordion.css +1 -98
- package/dist/build/accordion.entry.js +1 -83
- package/dist/build/base.css +1 -996
- package/dist/build/breadcrumb.css +1 -51
- package/dist/build/button.css +1 -132
- package/dist/build/callout.css +1 -11
- package/dist/build/card.css +1 -149
- package/dist/build/carousel.css +1 -0
- package/dist/build/chunks/Accordion-RtUfbsTy.js +1 -0
- package/dist/build/chunks/disclosure-widget-CPdkUWkq.js +1 -0
- package/dist/build/chunks/drop-menu.entry-BqBzLfVC.js +1 -0
- package/dist/build/chunks/keyboard-Cs0cduxq.js +1 -0
- package/dist/build/chunks/polyfills-5KNOJw2W.js +1 -0
- package/dist/build/chunks/popover-CiVl-0jk.js +1 -0
- package/dist/build/chunks/utilities-CE6xwgqF.js +2 -0
- package/dist/build/constants.css +1 -120
- package/dist/build/container-grid.css +1 -208
- package/dist/build/content-block.css +1 -36
- package/dist/build/dialog.css +1 -98
- package/dist/build/dialog.entry.js +1 -113
- package/dist/build/drop-menu.css +1 -78
- package/dist/build/drop-menu.entry.js +1 -2
- package/dist/build/drupal.css +1 -74
- package/dist/build/filters.css +1 -105
- package/dist/build/filters.entry.js +1 -137
- package/dist/build/footer.css +1 -151
- package/dist/build/form.css +1 -517
- package/dist/build/global-alert.css +1 -60
- package/dist/build/global-alert.entry.js +1 -68
- package/dist/build/grid.css +1 -200
- package/dist/build/header.css +1 -153
- package/dist/build/header.entry.js +1 -103
- package/dist/build/hero-banner.css +1 -62
- package/dist/build/icon.css +1 -399
- package/dist/build/in-page-alert.css +1 -94
- package/dist/build/in-page-navigation.css +1 -17
- package/dist/build/in-page-navigation.entry.js +1 -99
- package/dist/build/link-list.css +1 -45
- package/dist/build/list-item.css +1 -114
- package/dist/build/masthead.css +1 -53
- package/dist/build/navigation.css +1 -396
- package/dist/build/navigation.entry.js +1 -124
- package/dist/build/page.css +1 -80
- package/dist/build/pagination.css +1 -130
- package/dist/build/results-bar.css +1 -0
- package/dist/build/section.css +1 -163
- package/dist/build/side-navigation.css +1 -88
- package/dist/build/sidebar.css +1 -59
- package/dist/build/social-links.css +1 -20
- package/dist/build/steps.css +1 -118
- package/dist/build/sticky.css +1 -47
- package/dist/build/sticky.entry.js +1 -60
- package/dist/build/tabs.css +1 -109
- package/dist/build/tabs.entry.js +1 -202
- package/dist/build/tag.css +1 -71
- package/dist/build/utilities.css +1 -178
- package/package.json +54 -53
- package/src/Atom/Heading/_headings.css +24 -24
- package/src/Atom/Media/Media.stories.ts +1 -0
- package/src/Atom/Media/__snapshots__/Media.stories.ts.snap +0 -17
- package/src/Atom/Media/_media.css +8 -8
- package/src/Atom/Text/_text-sizes.css +17 -17
- package/src/Atom/_generic.css +3 -2
- package/src/Component/Accordion/Accordion.stories.tsx +0 -1
- package/src/Component/Accordion/__snapshots__/Accordion.stories.tsx.snap +0 -1
- package/src/Component/Dialog/Dialog.stories.ts +2 -3
- package/src/Component/Dialog/dialog.css +1 -1
- package/src/Component/DropMenu/Components/DropMenuContext.tsx +7 -9
- package/src/Component/DropMenu/Components/DropMenuItem.tsx +1 -1
- package/src/Component/DropMenu/Elements/DropMenu.ts +1 -1
- package/src/Component/DropMenu/drop-menu.css +1 -1
- package/src/Component/GlobalAlert/__snapshots__/GlobalAlert.stories.tsx.snap +2 -2
- package/src/Component/HeroBanner/hero-banner.css +1 -1
- package/src/Component/Pagination/Components/PaginationContext.tsx +4 -8
- package/src/Component/Tabs/Tabs.tsx +4 -4
- package/src/Component/Tabs/__snapshots__/Tabs.stories.tsx.snap +0 -2
- package/src/Component/Tile/__snapshots__/Tile.stories.tsx.snap +6 -16
- package/src/Form/Checkbox/FormCheckbox.tsx +5 -7
- package/src/Form/FormItem/__snapshots__/FormItem.stories.tsx.snap +4 -4
- package/src/Form/Radio/FormRadio.tsx +4 -4
- package/src/Form/TextInput/__snapshots__/FormText.stories.tsx.snap +1 -1
- package/src/Form/Textarea/__snapshots__/FormTextarea.stories.tsx.snap +1 -1
- package/src/Introduction.mdx +40 -0
- package/src/Layout/Grid/Grid.stories.tsx +1 -1
- package/src/Layout/Grid/container-grid.css +9 -9
- package/src/Layout/Grid/grid.css +2 -2
- package/src/Layout/Header/__snapshots__/Header.stories.tsx.snap +3 -3
- package/src/Layout/Page/__snapshots__/Page.stories.tsx.snap +3 -3
- package/src/Layout/Section/section.css +13 -13
- package/src/Utility/Context/ImageComponent.tsx +3 -6
- package/src/Utility/Context/LinkComponent.tsx +3 -6
- package/src/Utility/Elements/breakpoint-loader.ts +0 -1
- package/src/Utility/Elements/cookie-compliance.ts +0 -1
- package/src/Utility/Elements/io-loader.ts +0 -1
- package/src/Utility/Hooks/useLocalStorage.ts +0 -1
- package/src/Utility/Hooks/useMediaQuery.ts +0 -1
- package/src/Utility/Hooks/useToggle.ts +0 -1
- package/src/Utility/global.d.ts +0 -1
- package/src/Utility/utilities.ts +0 -1
- package/src/enums.ts +0 -2
- package/dist/build/accordion.entry.js.map +0 -1
- package/dist/build/chunks/Accordion-Bjaw7SdG.js +0 -61
- package/dist/build/chunks/Accordion-Bjaw7SdG.js.map +0 -1
- package/dist/build/chunks/disclosure-widget-DwuxsaOS.js +0 -124
- package/dist/build/chunks/disclosure-widget-DwuxsaOS.js.map +0 -1
- package/dist/build/chunks/drop-menu.entry-Cxpti_QG.js +0 -132
- package/dist/build/chunks/drop-menu.entry-Cxpti_QG.js.map +0 -1
- package/dist/build/chunks/keyboard-C73DHu0c.js +0 -101
- package/dist/build/chunks/keyboard-C73DHu0c.js.map +0 -1
- package/dist/build/chunks/polyfills-CJ5uTmUJ.js +0 -749
- package/dist/build/chunks/polyfills-CJ5uTmUJ.js.map +0 -1
- package/dist/build/chunks/popover-wbPSyFRj.js +0 -654
- package/dist/build/chunks/popover-wbPSyFRj.js.map +0 -1
- package/dist/build/chunks/utilities-DZ_l-he4.js +0 -195
- package/dist/build/chunks/utilities-DZ_l-he4.js.map +0 -1
- package/dist/build/dialog.entry.js.map +0 -1
- package/dist/build/drop-menu.entry.js.map +0 -1
- package/dist/build/filters.entry.js.map +0 -1
- package/dist/build/global-alert.entry.js.map +0 -1
- package/dist/build/header.entry.js.map +0 -1
- package/dist/build/in-page-navigation.entry.js.map +0 -1
- package/dist/build/navigation.entry.js.map +0 -1
- package/dist/build/sticky.entry.js.map +0 -1
- package/dist/build/tabs.entry.js.map +0 -1
- package/dist/build/tiles.css +0 -61
package/README.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
[](http://commitizen.github.io/cz-cli/)
|
|
4
4
|
|
|
5
|
+
> [!NOTE]
|
|
6
|
+
> This is taken from the 3.x branch of [mixtape (monorepo)](https://github.com/previousnext/mixtape).
|
|
7
|
+
> Refer to that repo if you need to make changes the original packages. This repo is dedicated to
|
|
8
|
+
> the `@pnx-mixtape/mxds` package.
|
|
9
|
+
|
|
5
10
|
### The PreviousNext Design System: [mixtape.pnx.io](https://mixtape.pnx.io/)
|
|
6
11
|
|
|
7
12
|
A design system helps align teams around how products are designed and built.
|
|
@@ -32,7 +37,7 @@ Dependencies:
|
|
|
32
37
|
|
|
33
38
|
- [postcss-design-tokens](https://www.npmjs.com/package/postcss-design-tokens)
|
|
34
39
|
|
|
35
|
-
Add the [tokens](https://github.com/previousnext/
|
|
40
|
+
Add the [tokens](https://github.com/previousnext/mxds/blob/main/src/tokens.js)
|
|
36
41
|
and override the values or just copy/paste from Mixtape and update;
|
|
37
42
|
|
|
38
43
|
_eg. project-tokens.mjs_
|
|
@@ -49,7 +54,7 @@ tokens.newThing = "somethingNew"
|
|
|
49
54
|
export default tokens
|
|
50
55
|
```
|
|
51
56
|
|
|
52
|
-
The [custom properties](https://github.com/previousnext/
|
|
57
|
+
The [custom properties](https://github.com/previousnext/mxds/blob/main/src/constants.css)
|
|
53
58
|
can also be included via @import or just copy/paste if you only need a limited set.
|
|
54
59
|
|
|
55
60
|
This file should be included in the browser.
|
|
@@ -65,7 +70,7 @@ _eg. project-constants.css_
|
|
|
65
70
|
}
|
|
66
71
|
```
|
|
67
72
|
|
|
68
|
-
The [custom media](https://github.com/previousnext/
|
|
73
|
+
The [custom media](https://github.com/previousnext/mxds/blob/main/src/_custom-media.css)
|
|
69
74
|
should also be included, and is required in EVERY css file that uses them. PostCSS replaces this,
|
|
70
75
|
so there is no need to worry about duplication.
|
|
71
76
|
|
|
@@ -140,6 +145,8 @@ similar result.
|
|
|
140
145
|
|
|
141
146
|
### Importing React components
|
|
142
147
|
|
|
148
|
+
TODO
|
|
149
|
+
|
|
143
150
|
### Importing and extending javascript Elements
|
|
144
151
|
|
|
145
152
|
Some packages also provide vanilla javascript to manage simple user interactions. You can include
|
|
@@ -216,24 +223,39 @@ This project uses Docker to manage node versions and build tasks.
|
|
|
216
223
|
First clone this repository;
|
|
217
224
|
|
|
218
225
|
```
|
|
219
|
-
git clone git@github.com:previousnext/
|
|
220
|
-
cd
|
|
226
|
+
git clone git@github.com:previousnext/mxds.git
|
|
227
|
+
cd mxds
|
|
221
228
|
```
|
|
222
229
|
|
|
223
230
|
Install project dependcencies:
|
|
224
231
|
|
|
225
232
|
```
|
|
226
|
-
|
|
233
|
+
nvm install
|
|
234
|
+
npm install
|
|
227
235
|
```
|
|
228
236
|
|
|
229
|
-
Then you can
|
|
237
|
+
Then you can start watching for changes with;
|
|
230
238
|
|
|
231
239
|
```
|
|
232
|
-
|
|
240
|
+
npm run dev
|
|
233
241
|
```
|
|
234
242
|
|
|
235
243
|
From here you can access the Storybook instance and get started.
|
|
236
244
|
|
|
245
|
+
### Linting and Test coverage
|
|
246
|
+
|
|
247
|
+
Before pushing a PR make sure your changes are linted and pass the test coverage.
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
npm run format
|
|
251
|
+
npm run lint
|
|
252
|
+
npm run test-storybook
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
These will all run by Github Actions on the PR but it's better to catch issues first.
|
|
256
|
+
|
|
257
|
+
Integration testing with Vitest will be added in a future release.
|
|
258
|
+
|
|
237
259
|
### Publishing changes
|
|
238
260
|
|
|
239
261
|
When you are ready to publish your change, commit your work and
|
|
@@ -248,27 +270,19 @@ commit messages and versioning. You will be walked through an interactive
|
|
|
248
270
|
questionnaire.
|
|
249
271
|
|
|
250
272
|
Select the type of change from Feat (Feature), Fix, Docs, Style, Refactor,
|
|
251
|
-
Perf, Test, and Chore. This will be used in the commitizen changelog
|
|
252
|
-
to determine the version when publishing to npm.
|
|
273
|
+
Perf, Test, and Chore. This will be used in the commitizen changelog.
|
|
253
274
|
|
|
254
275
|
Then create a pull request, wait for builds to pass, and get the code reviewed.
|
|
255
276
|
|
|
256
277
|
Once approved, merge the PR.
|
|
257
278
|
|
|
258
|
-
|
|
259
|
-
It will change the version number in package.json, commit the change to git and publish to NPM.
|
|
260
|
-
|
|
261
|
-
When you are ready for a full release, merge the `master` branch into `releases`.
|
|
262
|
-
This will trigger a deploy in CircleCI to update [mixtape.pnx.io](https://mixtape.pnx.io/).
|
|
263
|
-
Approval is then required to publish to the [NPM registry](https://www.npmjs.com/org/pnx-mixtape).
|
|
264
|
-
|
|
265
|
-
### Test coverage
|
|
266
|
-
|
|
267
|
-
Jest tests cover basic functionality and accessibility. They are run on
|
|
268
|
-
all Pull Requests and Master/Releases merges. You can run locally with;
|
|
279
|
+
When you are ready for a full release, from `main`, run;
|
|
269
280
|
|
|
270
281
|
```
|
|
271
|
-
|
|
282
|
+
npm version patch -m 'chore: tag %s'
|
|
272
283
|
```
|
|
273
284
|
|
|
274
|
-
|
|
285
|
+
To bump the version number in `package.json`, then tag the commit and push to `origin`.
|
|
286
|
+
|
|
287
|
+
This will trigger a deploy in CircleCI to update [mixtape.pnx.io](https://mixtape.pnx.io/).
|
|
288
|
+
Approval is then required to publish to the [NPM registry](https://www.npmjs.com/package/@pnx-mixtape/mxds).
|
package/dist/build/accordion.css
CHANGED
|
@@ -1,98 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Accordion
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
@layer design-system.defaults {
|
|
6
|
-
details summary {
|
|
7
|
-
list-style-type: none;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
details summary:is(::-webkit-details-marker, ::marker) {
|
|
11
|
-
display: none;
|
|
12
|
-
content: "";
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
:is(mx-accordion, mx-accordiondiv, mx-accordionmobile) {
|
|
16
|
-
display: block;
|
|
17
|
-
}
|
|
18
|
-
:where(:is(div.mx-accordion, mx-accordiondiv)) .mx-accordion__toggle {
|
|
19
|
-
-webkit-appearance: none;
|
|
20
|
-
-moz-appearance: none;
|
|
21
|
-
appearance: none;
|
|
22
|
-
color: inherit;
|
|
23
|
-
font-size: inherit;
|
|
24
|
-
background: transparent none repeat 0 0 / auto auto padding-box border-box scroll;
|
|
25
|
-
background: initial;
|
|
26
|
-
border: medium none currentcolor;
|
|
27
|
-
border: initial;
|
|
28
|
-
padding: 0;
|
|
29
|
-
padding: initial;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
:where(:is(div.mx-accordion, mx-accordiondiv)) .mx-accordion__content[inert] {
|
|
33
|
-
display: none;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@layer design-system.components {
|
|
38
|
-
.mx-accordion__title {
|
|
39
|
-
margin-block-end: var(--spacing-m);
|
|
40
|
-
display: flex;
|
|
41
|
-
flex-flow: row wrap;
|
|
42
|
-
gap: var(--spacing-s);
|
|
43
|
-
align-items: center;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.mx-accordions__toggle-all {
|
|
47
|
-
margin-inline-start: auto;
|
|
48
|
-
}
|
|
49
|
-
.mx-accordion .mx-accordion__toggle {
|
|
50
|
-
cursor: pointer;
|
|
51
|
-
inline-size: 100%;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.mx-accordion:is(> h2, > h3, > h4, > h5, > h6) {
|
|
55
|
-
all: unset;
|
|
56
|
-
}
|
|
57
|
-
.mx-accordion:is([open], [data-open="true"]) > .mx-accordion__toggle .mx-icon--chevron-down {
|
|
58
|
-
transform: rotate(180deg);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.mx-accordion--divided {
|
|
62
|
-
border-block-end: 1px solid
|
|
63
|
-
var(--line-colour, var(--colour-border));
|
|
64
|
-
border-block-end: var(--line-width, 1px) solid
|
|
65
|
-
var(--line-colour, var(--colour-border));
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.mx-accordion--divided .mx-accordion__toggle {
|
|
69
|
-
padding-block: var(--vertical-padding, var(--spacing-xxs));
|
|
70
|
-
padding-inline: 0;
|
|
71
|
-
padding-inline: var(--horizontal-padding, 0);
|
|
72
|
-
display: flex;
|
|
73
|
-
justify-content: space-between;
|
|
74
|
-
align-items: center;
|
|
75
|
-
gap: var(--spacing-xxs);
|
|
76
|
-
}
|
|
77
|
-
.mx-accordion--divided:is([open], [data-open="true"]) > .mx-accordion__content {
|
|
78
|
-
border-block-start: 1px solid
|
|
79
|
-
var(--line-colour, var(--colour-border));
|
|
80
|
-
border-block-start: var(--line-width, 1px) solid
|
|
81
|
-
var(--line-colour, var(--colour-border));
|
|
82
|
-
padding-block: var(--vertical-padding, var(--spacing-xxs));
|
|
83
|
-
padding-inline: 0;
|
|
84
|
-
padding-inline: var(--horizontal-padding, 0);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Print stylesheet
|
|
90
|
-
*/
|
|
91
|
-
|
|
92
|
-
@media print {
|
|
93
|
-
.mx-accordion .mx-accordion__content {
|
|
94
|
-
display: block !important;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFjY29yZGlvbi5jc3MiXSwibmFtZXMiO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XG4gIH1cblxuICAubXgtYWNjb3JkaW9uc19fdG9nZ2xlLWFsbCB7XG4gICAgbWFyZ2luLWlubGluZS1zdGFydDogYXV0bztcbiAgfVxuXG4gIC5teC1hY2NvcmRpb24ge1xuICAgICYgLm14LWFjY29yZGlvbl9fdG9nZ2xlIHtcbiAgICAgIGN1cnNvcjogcG9pbnRlcjtcbiAgICAgIGlubGluZS1zaXplOiAxMDAlO1xuICAgIH1cblxuICAgICY6aXMoPiBoMiwgPiBoMywgPiBoNCwgPiBoNSwgPiBoNikge1xuICAgICAgYWxsOiB1bnNldDtcbiAgICB9XG5cbiAgICAmOmlzKFtvcGVuXSwgW2RhdGEtb3Blbj1cInRydWVcIl0pIHtcbiAgICAgICYgPiAubXgtYWNjb3JkaW9uX190b2dnbGUge1xuICAgICAgICAmIC5teC1pY29uLS1jaGV2cm9uLWRvd24ge1xuICAgICAgICAgIHRyYW5zZm9ybTogcm90YXRlKDE4MGRlZyk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9XG4gIH1cblxuICAubXgtYWNjb3JkaW9uLS1kaXZpZGVkIHtcbiAgICBib3JkZXItYmxvY2stZW5kOiB2YXIoLS1saW5lLXdpZHRoLCAxcHgpIHNvbGlkXG4gICAgICB2YXIoLS1saW5lLWNvbG91ciwgdmFyKC0tY29sb3VyLWJvcmRlcikpO1xuXG4gICAgJiAubXgtYWNjb3JkaW9uX190b2dnbGUge1xuICAgICAgcGFkZGluZy1ibG9jazogdmFyKC0tdmVydGljYWwtcGFkZGluZywgdmFyKC0tc3BhY2luZy14eHMpKTtcbiAgICAgIHBhZGRpbmctaW5saW5lOiB2YXIoLS1ob3Jpem9udGFsLXBhZGRpbmcsIDApO1xuICAgICAgZGlzcGxheTogZmxleDtcbiAgICAgIGp1c3RpZnktY29udGVudDogc3BhY2UtYmV0d2VlbjtcbiAgICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gICAgICBnYXA6IHZhcigtLXNwYWNpbmcteHhzKTtcbiAgICB9XG5cbiAgICAmOmlzKFtvcGVuXSwgW2RhdGEtb3Blbj1cInRydWVcIl0pIHtcbiAgICAgICYgPiAubXgtYWNjb3JkaW9uX19jb250ZW50IHtcbiAgICAgICAgYm9yZGVyLWJsb2NrLXN0YXJ0OiB2YXIoLS1saW5lLXdpZHRoLCAxcHgpIHNvbGlkXG4gICAgICAgICAgdmFyKC0tbGluZS1jb2xvdXIsIHZhcigtLWNvbG91ci1ib3JkZXIpKTtcbiAgICAgICAgcGFkZGluZy1ibG9jazogdmFyKC0tdmVydGljYWwtcGFkZGluZywgdmFyKC0tc3BhY2luZy14eHMpKTtcbiAgICAgICAgcGFkZGluZy1pbmxpbmU6IHZhcigtLWhvcml6b250YWwtcGFkZGluZywgMCk7XG4gICAgICB9XG4gICAgfVxuICB9XG59XG5cbi8qKlxuICogUHJpbnQgc3R5bGVzaGVldFxuICovXG5cbkBtZWRpYSBwcmludCB7XG4gIC5teC1hY2NvcmRpb24ge1xuICAgICYgLm14LWFjY29yZGlvbl9fY29udGVudCB7XG4gICAgICBkaXNwbGF5OiBibG9jayAhaW1wb3J0YW50O1xuICAgIH1cbiAgfVxufVxuIl19 */
|
|
1
|
+
@layer design-system.defaults{details summary{list-style-type:none}:is(details summary):is(::-webkit-details-marker,::marker){display:none;content:""}:is(mx-accordion,mx-accordiondiv,mx-accordionmobile){display:block}:where(:is(div.mx-accordion,mx-accordiondiv)) .mx-accordion__toggle{-webkit-appearance:none;-moz-appearance:none;appearance:none;color:inherit;font-size:inherit;background:transparent none repeat 0 0 / auto auto padding-box border-box scroll;background:initial;border:medium none currentcolor;border:initial;padding:0;padding:initial}}@layer design-system.components{.mx-accordion__title{margin-block-end:var(--spacing-m);display:flex;flex-flow:row wrap;gap:var(--spacing-s);align-items:center}.mx-accordions__toggle-all{margin-inline-start:auto}.mx-accordion .mx-accordion__toggle{cursor:pointer;inline-size:100%}.mx-accordion:is(>h2,>h3,>h4,>h5,>h6){all:unset}.mx-accordion>.mx-accordion__content{display:none;opacity:0;overflow:hidden}:is(.mx-accordion:is([open],[data-open=true])>.mx-accordion__toggle) .mx-icon--chevron-down{transform:rotate(180deg)}.mx-accordion:is([open],[data-open=true])>.mx-accordion__content{opacity:1;display:block}@starting-style{.mx-accordion:is([open],[data-open=true])>.mx-accordion__content{opacity:0;display:block}}.mx-accordion--divided{border-block-end:1px solid var(--line-colour, var(--colour-border));border-block-end:var(--line-width, 1px) solid var(--line-colour, var(--colour-border))}.mx-accordion--divided .mx-accordion__toggle{padding-block:var(--vertical-padding, var(--spacing-xxs));padding-inline:0;padding-inline:var(--horizontal-padding, 0);display:flex;justify-content:space-between;align-items:center;gap:var(--spacing-xxs)}.mx-accordion--divided:is([open],[data-open=true])>.mx-accordion__content{border-block-start:1px solid var(--line-colour, var(--colour-border));border-block-start:var(--line-width, 1px) solid var(--line-colour, var(--colour-border));padding-block:var(--vertical-padding, var(--spacing-xxs));padding-inline:0;padding-inline:var(--horizontal-padding, 0)}}@media print{.mx-accordion .mx-accordion__content{display:block!important}}
|
|
@@ -1,83 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
class AccordionGroup extends HTMLElement {
|
|
3
|
-
constructor() {
|
|
4
|
-
super();
|
|
5
|
-
this.handleClick = ({ target }) => {
|
|
6
|
-
if (target === this.expandTrigger) {
|
|
7
|
-
this.handleExpand();
|
|
8
|
-
}
|
|
9
|
-
if (target === this.collapseTrigger) {
|
|
10
|
-
this.handleCollapse();
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
this.handleExpand = () => {
|
|
14
|
-
this.accordions.forEach((detail) => detail.open = true);
|
|
15
|
-
this.expandTrigger.disabled = true;
|
|
16
|
-
this.collapseTrigger.disabled = false;
|
|
17
|
-
};
|
|
18
|
-
this.handleCollapse = () => {
|
|
19
|
-
this.accordions.forEach((detail) => detail.open = false);
|
|
20
|
-
this.expandTrigger.disabled = false;
|
|
21
|
-
this.collapseTrigger.disabled = true;
|
|
22
|
-
};
|
|
23
|
-
this.handleToggle = () => {
|
|
24
|
-
this.expandTrigger.disabled = [...this.accordions].every(
|
|
25
|
-
(details) => details.open === true
|
|
26
|
-
);
|
|
27
|
-
this.collapseTrigger.disabled = [...this.accordions].every(
|
|
28
|
-
(details) => details.open !== true
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
this.internals_ = this.attachInternals();
|
|
32
|
-
this.controller = new AbortController();
|
|
33
|
-
}
|
|
34
|
-
connectedCallback() {
|
|
35
|
-
if (!this.accordions || !this.expandTrigger || !this.collapseTrigger) return;
|
|
36
|
-
this.collapseTrigger.disabled = true;
|
|
37
|
-
const { signal } = this.controller;
|
|
38
|
-
this.addEventListener("click", this.handleClick, {
|
|
39
|
-
signal
|
|
40
|
-
});
|
|
41
|
-
this.accordions.forEach(
|
|
42
|
-
(details) => details.addEventListener("toggle", this.handleToggle, {
|
|
43
|
-
signal
|
|
44
|
-
})
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
disconnectedCallback() {
|
|
48
|
-
this.controller.abort();
|
|
49
|
-
}
|
|
50
|
-
get accordions() {
|
|
51
|
-
const accordions = this.querySelectorAll("details");
|
|
52
|
-
if (!accordions.length) {
|
|
53
|
-
throw new Error(
|
|
54
|
-
`${this.localName} must contain at least one <details> element.`
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
return accordions;
|
|
58
|
-
}
|
|
59
|
-
get expandTrigger() {
|
|
60
|
-
const trigger = this.querySelector(
|
|
61
|
-
"button[data-expand]"
|
|
62
|
-
);
|
|
63
|
-
if (!trigger) {
|
|
64
|
-
throw new Error(
|
|
65
|
-
`${this.localName} must contain a <button data-expand> element.`
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
return trigger;
|
|
69
|
-
}
|
|
70
|
-
get collapseTrigger() {
|
|
71
|
-
const trigger = this.querySelector(
|
|
72
|
-
"button[data-collapse]"
|
|
73
|
-
);
|
|
74
|
-
if (!trigger) {
|
|
75
|
-
throw new Error(
|
|
76
|
-
`${this.localName} must contain a <button data-collapse> element.`
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
return trigger;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
customElements.define("mx-accordion-group", AccordionGroup);
|
|
83
|
-
//# sourceMappingURL=accordion.entry.js.map
|
|
1
|
+
import"./chunks/Accordion-RtUfbsTy.js";class e extends HTMLElement{constructor(){super(),this.handleClick=({target:e})=>{e===this.expandTrigger&&this.handleExpand(),e===this.collapseTrigger&&this.handleCollapse()},this.handleExpand=()=>{this.accordions.forEach((e=>e.open=!0)),this.expandTrigger.disabled=!0,this.collapseTrigger.disabled=!1},this.handleCollapse=()=>{this.accordions.forEach((e=>e.open=!1)),this.expandTrigger.disabled=!1,this.collapseTrigger.disabled=!0},this.handleToggle=()=>{this.expandTrigger.disabled=[...this.accordions].every((e=>!0===e.open)),this.collapseTrigger.disabled=[...this.accordions].every((e=>!0!==e.open))},this.internals_=this.attachInternals(),this.controller=new AbortController}connectedCallback(){if(!this.accordions||!this.expandTrigger||!this.collapseTrigger)return;this.collapseTrigger.disabled=!0;const{signal:e}=this.controller;this.addEventListener("click",this.handleClick,{signal:e}),this.accordions.forEach((t=>t.addEventListener("toggle",this.handleToggle,{signal:e})))}disconnectedCallback(){this.controller.abort()}get accordions(){const e=this.querySelectorAll("details");if(!e.length)throw new Error(`${this.localName} must contain at least one <details> element.`);return e}get expandTrigger(){const e=this.querySelector("button[data-expand]");if(!e)throw new Error(`${this.localName} must contain a <button data-expand> element.`);return e}get collapseTrigger(){const e=this.querySelector("button[data-collapse]");if(!e)throw new Error(`${this.localName} must contain a <button data-collapse> element.`);return e}}customElements.define("mx-accordion-group",e);
|