@pnx-mixtape/mxds 0.0.12 → 0.0.13

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.
@@ -15,13 +15,23 @@ class InPageNavigation extends HTMLElement {
15
15
  }
16
16
  connectedCallback() {
17
17
  if (!this.menu || !this.headings) return;
18
- this.headings.forEach((heading) => {
19
- const listItem = this.generateListItem(heading);
20
- const link = this.generateAnchor(heading);
21
- this.items.push({ link, heading });
22
- listItem.appendChild(link);
23
- this.menu?.appendChild(listItem);
24
- });
18
+ if (!this.links.length) {
19
+ this.headings.forEach((heading) => {
20
+ const listItem = this.generateListItem(heading);
21
+ const link = this.generateAnchor(heading);
22
+ this.items.push({ link, heading });
23
+ listItem.appendChild(link);
24
+ this.menu?.appendChild(listItem);
25
+ });
26
+ } else {
27
+ this.links.forEach((link) => {
28
+ const heading = this.container.querySelector(
29
+ link.href
30
+ );
31
+ if (!heading) return;
32
+ this.items.push({ link, heading });
33
+ });
34
+ }
25
35
  const { signal } = this.controller;
26
36
  this.menu.addEventListener(
27
37
  "click",
@@ -73,7 +83,7 @@ class InPageNavigation extends HTMLElement {
73
83
  const targetID = id || this.generatedId(heading);
74
84
  if (!id) heading.id = targetID;
75
85
  const item = createElement(
76
- `<a href="#${targetID}" class="mx-icon mx-icon--chevron-right">${linkText}</a>`
86
+ `<a href="#${targetID}"><span class="mx-icon mx-icon--chevron-right"></span><span>${linkText}</span></a>`
77
87
  );
78
88
  return item;
79
89
  }
@@ -1 +1 @@
1
- {"version":3,"file":"in-page-navigation.entry.js","sources":["../../src/Component/InPageNavigation/Elements/InPageNavigation.ts"],"sourcesContent":["/**\n * DialogBase\n * @file Support opening/closing, and adding a scroll lock to the body.\n */\n\nimport { makeAnchor, createElement } from \"../../../Utility/utilities\"\n\nexport default class InPageNavigation extends HTMLElement {\n internals_: ElementInternals\n controller: AbortController\n headingLevels: string\n items: { link: HTMLAnchorElement; heading: HTMLHeadingElement }[]\n active: { link: HTMLAnchorElement; heading: HTMLHeadingElement } | undefined\n\n constructor() {\n super()\n this.internals_ = this.attachInternals()\n this.controller = new AbortController()\n this.headingLevels = this.dataset?.headings || \"h2\"\n this.items = []\n }\n\n connectedCallback(): void {\n if (!this.menu || !this.headings) return\n\n this.headings.forEach((heading: HTMLHeadingElement) => {\n const listItem: HTMLLIElement = this.generateListItem(heading)\n const link: HTMLAnchorElement = this.generateAnchor(heading)\n this.items.push({ link, heading })\n listItem.appendChild(link)\n this.menu?.appendChild(listItem)\n })\n\n const { signal }: AbortController = this.controller\n\n // Open on toggle click.\n this.menu.addEventListener(\n \"click\",\n (e: MouseEvent): void => {\n const { target } = e\n if (!(target instanceof HTMLAnchorElement)) return\n this.handleClick(target)\n },\n {\n signal,\n },\n )\n }\n\n disconnectedCallback(): void {\n if (!this.menu || !this.headings) return\n this.menu.textContent = \"\"\n this.items = []\n this.controller.abort()\n }\n\n handleClick = (target: EventTarget | null): void => {\n this.active = this.items.find(item => item.link === target)\n if (!this.links || !this.active) return\n this.links.forEach(link => link.classList.remove(\"is-active\"))\n this.active.link.classList.add(\"is-active\")\n }\n\n get menu(): HTMLUListElement | HTMLOListElement | null {\n const menu: HTMLUListElement | HTMLOListElement | null =\n this.querySelector(\"ul, ol\")\n if (!menu) {\n throw new Error(`${this.localName} must contain a <ul> or <ol> element.`)\n }\n return menu\n }\n\n get container(): HTMLElement | null {\n const selector: string | null = this.getAttribute(\"data-content\")\n if (!selector) {\n throw new Error(\n `${this.localName} must have a [data-content] attribute that contains the content selector.`,\n )\n }\n return this.closest(selector) || this.parentElement.querySelector(selector)\n }\n\n get headings(): NodeListOf<HTMLHeadingElement> | undefined {\n return this.container?.querySelectorAll(this.headingLevels)\n }\n\n get links(): NodeListOf<HTMLAnchorElement> | undefined {\n return this.menu?.querySelectorAll(\"a\")\n }\n\n generatedId(heading: HTMLHeadingElement): string {\n const string: string | undefined = heading?.textContent?.trim()\n return !string ? \"\" : makeAnchor(string)\n }\n\n generateAnchor(heading: HTMLHeadingElement): HTMLAnchorElement {\n const { textContent, id } = heading\n const linkText: string | null =\n heading.getAttribute(\"data-in-page-navigation-title\") || textContent\n const targetID: string = id || this.generatedId(heading)\n if (!id) heading.id = targetID\n const item: Element = createElement(\n `<a href=\"#${targetID}\" class=\"mx-icon mx-icon--chevron-right\">${linkText}</a>`,\n )\n\n return item as HTMLAnchorElement\n }\n\n generateListItem(heading: HTMLHeadingElement): HTMLLIElement {\n const { tagName } = heading\n const item: Element = createElement(\n `<li class=\"mx-in-page-navigation__level--${tagName.toLowerCase()}\"></li>`,\n )\n\n return item as HTMLLIElement\n }\n}\n\ncustomElements.define(\"mx-in-page-navigation\", InPageNavigation)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"mx-in-page-navigation\": InPageNavigation\n }\n}\n"],"names":[],"mappings":";AAOA,MAAqB,yBAAyB,YAAY;AAAA,EAOxD,cAAc;AACN;AAyCR,SAAA,cAAc,CAAC,WAAqC;AAClD,WAAK,SAAS,KAAK,MAAM,KAAK,CAAQ,SAAA,KAAK,SAAS,MAAM;AAC1D,UAAI,CAAC,KAAK,SAAS,CAAC,KAAK,OAAQ;AACjC,WAAK,MAAM,QAAQ,CAAA,SAAQ,KAAK,UAAU,OAAO,WAAW,CAAC;AAC7D,WAAK,OAAO,KAAK,UAAU,IAAI,WAAW;AAAA,IAAA;AA5CrC,SAAA,aAAa,KAAK;AAClB,SAAA,aAAa,IAAI;AACjB,SAAA,gBAAgB,KAAK,SAAS,YAAY;AAC/C,SAAK,QAAQ;EACf;AAAA,EAEA,oBAA0B;AACxB,QAAI,CAAC,KAAK,QAAQ,CAAC,KAAK,SAAU;AAE7B,SAAA,SAAS,QAAQ,CAAC,YAAgC;AAC/C,YAAA,WAA0B,KAAK,iBAAiB,OAAO;AACvD,YAAA,OAA0B,KAAK,eAAe,OAAO;AAC3D,WAAK,MAAM,KAAK,EAAE,MAAM,QAAS,CAAA;AACjC,eAAS,YAAY,IAAI;AACpB,WAAA,MAAM,Y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AM,KAAK,YAAY,OAAO;AACnD,QAAA,CAAC,GAAI,SAAQ,KAAK;AACtB,UAAM,OAAgB;AAAA,MACpB,aAAa,QAAQ,4CAA4C,QAAQ;AAAA,IAAA;AAGpE,WAAA;AAAA,EACT;AAAA,EAEA,iBAAiB,SAA4C;AACrD,UAAA,EAAE,QAAY,IAAA;AACpB,UAAM,OAAgB;AAAA,MACpB,4CAA4C,QAAQ,YAAA,CAAa;AAAA,IAAA;AAG5D,WAAA;AAAA,EACT;AACF;AAEA,eAAe,OAAO,yBAAyB,gBAAgB;"}
1
+ {"version":3,"file":"in-page-navigation.entry.js","sources":["../../src/Component/InPageNavigation/Elements/InPageNavigation.ts"],"sourcesContent":["/**\n * DialogBase\n * @file Support opening/closing, and adding a scroll lock to the body.\n */\n\nimport { makeAnchor, createElement } from \"../../../Utility/utilities\"\n\nexport default class InPageNavigation extends HTMLElement {\n internals_: ElementInternals\n controller: AbortController\n headingLevels: string\n items: { link: HTMLAnchorElement; heading: HTMLHeadingElement }[]\n active: { link: HTMLAnchorElement; heading: HTMLHeadingElement } | undefined\n\n constructor() {\n super()\n this.internals_ = this.attachInternals()\n this.controller = new AbortController()\n this.headingLevels = this.dataset?.headings || \"h2\"\n this.items = []\n }\n\n connectedCallback(): void {\n if (!this.menu || !this.headings) return\n if (!this.links.length) {\n // Build links if not provided.\n this.headings.forEach((heading: HTMLHeadingElement) => {\n const listItem: HTMLLIElement = this.generateListItem(heading)\n const link: HTMLAnchorElement = this.generateAnchor(heading)\n this.items.push({ link, heading })\n listItem.appendChild(link)\n this.menu?.appendChild(listItem)\n })\n } else {\n this.links.forEach((link: HTMLAnchorElement) => {\n const heading: HTMLHeadingElement = this.container.querySelector(\n link.href,\n )\n if (!heading) return\n this.items.push({ link, heading })\n })\n }\n\n const { signal }: AbortController = this.controller\n\n // Open on toggle click.\n this.menu.addEventListener(\n \"click\",\n (e: MouseEvent): void => {\n const { target } = e\n if (!(target instanceof HTMLAnchorElement)) return\n this.handleClick(target)\n },\n {\n signal,\n },\n )\n }\n\n disconnectedCallback(): void {\n if (!this.menu || !this.headings) return\n this.menu.textContent = \"\"\n this.items = []\n this.controller.abort()\n }\n\n handleClick = (target: EventTarget | null): void => {\n this.active = this.items.find(item => item.link === target)\n if (!this.links || !this.active) return\n this.links.forEach(link => link.classList.remove(\"is-active\"))\n this.active.link.classList.add(\"is-active\")\n }\n\n get menu(): HTMLUListElement | HTMLOListElement | null {\n const menu: HTMLUListElement | HTMLOListElement | null =\n this.querySelector(\"ul, ol\")\n if (!menu) {\n throw new Error(`${this.localName} must contain a <ul> or <ol> element.`)\n }\n return menu\n }\n\n get container(): HTMLElement | null {\n const selector: string | null = this.getAttribute(\"data-content\")\n if (!selector) {\n throw new Error(\n `${this.localName} must have a [data-content] attribute that contains the content selector.`,\n )\n }\n return this.closest(selector) || this.parentElement.querySelector(selector)\n }\n\n get headings(): NodeListOf<HTMLHeadingElement> | undefined {\n return this.container?.querySelectorAll(this.headingLevels)\n }\n\n get links(): NodeListOf<HTMLAnchorElement> | undefined {\n return this.menu?.querySelectorAll(\"a\")\n }\n\n generatedId(heading: HTMLHeadingElement): string {\n const string: string | undefined = heading?.textContent?.trim()\n return !string ? \"\" : makeAnchor(string)\n }\n\n generateAnchor(heading: HTMLHeadingElement): HTMLAnchorElement {\n const { textContent, id } = heading\n const linkText: string | null =\n heading.getAttribute(\"data-in-page-navigation-title\") || textContent\n const targetID: string = id || this.generatedId(heading)\n if (!id) heading.id = targetID\n const item: Element = createElement(\n `<a href=\"#${targetID}\"><span class=\"mx-icon mx-icon--chevron-right\"></span><span>${linkText}</span></a>`,\n )\n\n return item as HTMLAnchorElement\n }\n\n generateListItem(heading: HTMLHeadingElement): HTMLLIElement {\n const { tagName } = heading\n const item: Element = createElement(\n `<li class=\"mx-in-page-navigation__level--${tagName.toLowerCase()}\"></li>`,\n )\n\n return item as HTMLLIElement\n }\n}\n\ncustomElements.define(\"mx-in-page-navigation\", InPageNavigation)\n\ndeclare global {\n interface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,UAAA,EAAE,QAAY,IAAA;AACpB,UAAM,OAAgB;AAAA,MACpB,4CAA4C,QAAQ,YAAA,CAAa;AAAA,IAAA;AAG5D,WAAA;AAAA,EACT;AACF;AAEA,eAAe,OAAO,yBAAyB,gBAAgB;"}
@@ -6,62 +6,28 @@
6
6
  .mx-grid--sidebar:where(:not(:has(> aside))) {
7
7
  grid-column: narrow;
8
8
  }
9
- @media (min-width: 720px) {
10
9
 
11
10
  .mx-grid--sidebar:where(:has(> aside)) {
12
- display: grid;
13
- grid-template-columns: 76ch auto;
14
- grid-template-columns: var(--container-max-width, 76ch) auto;
15
- grid-gap: var(--sidebar-gap, var(--gap));
16
- gap: var(--sidebar-gap, var(--gap));
11
+ display: flex;
12
+ flex-wrap: wrap;
13
+ gap: var(--sidebar-gap, var(--gap));
14
+ justify-content: space-between;
17
15
  }
18
- }
19
-
20
- @media (min-width: 720px) {
21
-
22
- @media (min-width: 946px) {
23
-
24
- @media (max-color:2147477350) and (max-color:2147477350) {
25
-
26
- .mx-grid--sidebar:where(:has(> aside)) {
27
- --sidebar-gap: 18ch;
28
- }
29
- }
30
- }
31
-
32
- @media not all and (min-width: 946px) {
33
-
34
- @media (max-color:2147477350) and (color:2147477350) {
35
-
36
- .mx-grid--sidebar:where(:has(> aside)) {
37
- --sidebar-gap: 18ch;
38
- }
39
- }
40
- }
41
- }
42
-
43
- @media not all and (min-width: 720px) {
44
-
45
- @media (min-width: 946px) {
46
16
 
47
- @media (color:2147477350) and (max-color:2147477350) {
48
-
49
- .mx-grid--sidebar:where(:has(> aside)) {
50
- --sidebar-gap: 18ch;
51
- }
52
- }
53
- }
54
-
55
- @media not all and (min-width: 946px) {
56
-
57
- @media (color:2147477350) and (color:2147477350) {
17
+ .mx-grid--sidebar:where(:has(> aside)) > aside {
18
+ flex-grow: 1;
19
+ max-inline-size: 24ch;
20
+ max-inline-size: var(--sidebar-width, 24ch);
21
+ }
58
22
 
59
- .mx-grid--sidebar:where(:has(> aside)) {
60
- --sidebar-gap: 18ch;
61
- }
62
- }
63
- }
64
- }
23
+ .mx-grid--sidebar:where(:has(> aside)) > section {
24
+ flex-basis: 0;
25
+ flex-grow: 999;
26
+ min-inline-size: 50%;
27
+ min-inline-size: var(--content-min, 50%);
28
+ max-inline-size: 76ch;
29
+ max-inline-size: var(--container-max-width, 76ch);
30
+ }
65
31
  .mx-grid--sidebar.mx-grid--sidebar-rev:where(:has(> aside)) > :is(section, aside):first-child {
66
32
  order: 2;
67
33
  }
@@ -78,18 +44,6 @@
78
44
  order: 1;
79
45
  }
80
46
  }
81
- @media (min-width: 946px) {
82
-
83
- .mx-grid--sidebar:where(:has(> aside)):is(.mx-grid--sidebar-rev, .mx-grid--sidebar-rev-lg) {
84
- grid-template-columns: auto 76ch;
85
- grid-template-columns: auto var(--container-max-width, 76ch);
86
- }
87
- }
88
-
89
- .mx-grid--sidebar:where(:has(> aside:first-child)) {
90
- grid-template-columns: auto 76ch;
91
- grid-template-columns: auto var(--container-max-width, 76ch);
92
- }
93
47
  }
94
48
 
95
49
  /**
@@ -102,4 +56,4 @@
102
56
  }
103
57
  }
104
58
 
105
- /*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNpZGViYXIuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztFQUVFOztBQUVGO0lBRUk7TUFDRSxtQkFBbUI7SUFDckI7TUFHRTs7SUFERjtRQUVJLGFBQWE7UUFDYixnQ0FBNEQ7UUFBNUQsNERBQTREO1FBQzVELHdDQUFtQztRQUFuQyxtQ0FBbUM7SUFzQ3ZDO01BakNFOztRQUhFOztRQUFBOztRQUFBOztJQU5KO1VBT00sbUJBQW1CO0lBbUN6QjtRQWxDSTtRQUFBOztRQUZBOztRQUFBOztJQU5KO1VBT00sbUJBQW1CO0lBbUN6QjtRQWxDSTtRQUFBO1FBQUE7O1FBRkE7O1FBQUE7O1FBQUE7O0lBTko7VUFPTSxtQkFBbUI7SUF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gICAgICYgPiA6aXMoc2VjdGlvbiwgYXNpZGUpIHtcbiAgICAgICAgICAmOmZpcnN0LWNoaWxkIHtcbiAgICAgICAgICAgIG9yZGVyOiAyO1xuICAgICAgICAgIH1cblxuICAgICAgICAgICY6bGFzdC1jaGlsZCB7XG4gICAgICAgICAgICBvcmRlcjogMTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgJi5teC1ncmlkLS1zaWRlYmFyLXJldi1sZyB7XG4gICAgICAgIEBtZWRpYSAoLS1tZWRpdW0tdXApIHtcbiAgICAgICAgICAmID4gOmlzKHNlY3Rpb24sIGFzaWRlKSB7XG4gICAgICAgICAgICAmOmZpcnN0LWNoaWxkIHtcbiAgICAgICAgICAgICAgb3JkZXI6IDI7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICY6bGFzdC1jaGlsZCB7XG4gICAgICAgICAgICAgIG9yZGVyOiAxO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICAmOmlzKC5teC1ncmlkLS1zaWRlYmFyLXJldiwgLm14LWdyaWQtLXNpZGViYXItcmV2LWxnKSB7XG4gICAgICAgIEBtZWRpYSAoLS1sYXJnZS11cCkge1xuICAgICAgICAgIGdyaWQtdGVtcGxhdGUtY29sdW1uczogYXV0byB2YXIoLS1jb250YWluZXItbWF4LXdpZHRoLCA3NmNoKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cblxuICAgICY6d2hlcmUoOmhhcyg+IGFzaWRlOmZpcnN0LWNoaWxkKSkge1xuICAgICAgZ3JpZC10ZW1wbGF0ZS1jb2x1bW5zOiBhdXRvIHZhcigtLWNvbnRhaW5lci1tYXgtd2lkdGgsIDc2Y2gpO1xuICAgIH1cbiAgfVxufVxuXG4vKipcbiAqIFByaW50IHN0eWxlc2hlZXRcbiAqL1xuXG5AbWVkaWEgcHJpbnQge1xuICAubXgtcGFnZV9fc2lkZWJhci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2FwLCB2YXIoLS1nYXApKTtcbiAgICAgIGp1c3RpZnktY29udGVudDogc3BhY2UtYmV0d2VlbjtcblxuICAgICAgJiA+IGFzaWRlIHtcbiAgICAgICAgZmxleC1ncm93OiAxO1xuICAgICAgICBtYXgtaW5saW5lLXNpemU6IHZhcigtLXNpZGViYXItd2lkdGgsIDI0Y2gpO1xuICAgICAgfVxuXG4gICAgICAmID4gc2VjdGlvbiB7XG4gICAgICAgIGZsZXgtYmFzaXM6IDA7XG4gICAgICAgIGZsZXgtZ3JvdzogOTk5O1xuICAgICAgICBtaW4taW5saW5lLXNpemU6IHZhcigtLWNvbnRlbnQtbWluLCA1MCUpO1xuICAgICAgICBtYXgtaW5saW5lLXNpemU6IHZhcigtLWNvbnRhaW5lci1tYXgtd2lkdGgsIDc2Y2gpO1xuICAgICAgfVxuXG4gICAgICAmLm14LWdyaWQtLXNpZGViYXItcmV2IHtcbiAgICAgICAgJiA+IDppcyhzZWN0aW9uLCBhc2lkZSkge1xuICAgICAgICAgICY6Zmlyc3QtY2hpbGQge1xuICAgICAgICAgICAgb3JkZXI6IDI7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgJjpsYXN0LWNoaWxkIHtcbiAgICAgICAgICAgIG9yZGVyOiAxO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICAmLm14LWdyaWQtLXNpZGViYXItcmV2LWxnIHtcbiAgICAgICAgQG1lZGlhICgtLW1lZGl1bS11cCkge1xuICAgICAgICAgICYgPiA6aXMoc2VjdGlvbiwgYXNpZGUpIHtcbiAgICAgICAgICAgICY6Zmlyc3QtY2hpbGQge1xuICAgICAgICAgICAgICBvcmRlcjogMjtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgJjpsYXN0LWNoaWxkIHtcbiAgICAgICAgICAgICAgb3JkZXI6IDE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuICB9XG59XG5cbi8qKlxuICogUHJpbnQgc3R5bGVzaGVldFxuICovXG5cbkBtZWRpYSBwcmludCB7XG4gIC5teC1wYWdlX19zaWRlYmFyIHtcbiAgICBkaXNwbGF5OiBub25lO1xuICB9XG59XG4iXX0= */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pnx-mixtape/mxds",
3
3
  "description": "The Mixtape Design System",
4
- "version": "0.0.12",
4
+ "version": "0.0.13",
5
5
  "scripts": {
6
6
  "dev": "concurrently -k -n \"VITE,STORYBOOK\" -c \"#636cff,#ff4785\" \"npm run dev-vite\" \"npm run dev-storybook\"",
7
7
  "build": "concurrently -n \"VITE,STORYBOOK\" -c \"#636cff,#ff4785\" \"npm run build-vite\" \"npm run build-storybook\"",
@@ -22,14 +22,24 @@ export default class InPageNavigation extends HTMLElement {
22
22
 
23
23
  connectedCallback(): void {
24
24
  if (!this.menu || !this.headings) return
25
-
26
- this.headings.forEach((heading: HTMLHeadingElement) => {
27
- const listItem: HTMLLIElement = this.generateListItem(heading)
28
- const link: HTMLAnchorElement = this.generateAnchor(heading)
29
- this.items.push({ link, heading })
30
- listItem.appendChild(link)
31
- this.menu?.appendChild(listItem)
32
- })
25
+ if (!this.links.length) {
26
+ // Build links if not provided.
27
+ this.headings.forEach((heading: HTMLHeadingElement) => {
28
+ const listItem: HTMLLIElement = this.generateListItem(heading)
29
+ const link: HTMLAnchorElement = this.generateAnchor(heading)
30
+ this.items.push({ link, heading })
31
+ listItem.appendChild(link)
32
+ this.menu?.appendChild(listItem)
33
+ })
34
+ } else {
35
+ this.links.forEach((link: HTMLAnchorElement) => {
36
+ const heading: HTMLHeadingElement = this.container.querySelector(
37
+ link.href,
38
+ )
39
+ if (!heading) return
40
+ this.items.push({ link, heading })
41
+ })
42
+ }
33
43
 
34
44
  const { signal }: AbortController = this.controller
35
45
 
@@ -100,7 +110,7 @@ export default class InPageNavigation extends HTMLElement {
100
110
  const targetID: string = id || this.generatedId(heading)
101
111
  if (!id) heading.id = targetID
102
112
  const item: Element = createElement(
103
- `<a href="#${targetID}" class="mx-icon mx-icon--chevron-right">${linkText}</a>`,
113
+ `<a href="#${targetID}"><span class="mx-icon mx-icon--chevron-right"></span><span>${linkText}</span></a>`,
104
114
  )
105
115
 
106
116
  return item as HTMLAnchorElement
@@ -1,6 +1,5 @@
1
1
  import { Meta, StoryObj } from "@storybook/html"
2
2
  import Component from "./twig/in-page-navigation-story.twig"
3
- import Heading from "../../Atom/Heading/heading.twig"
4
3
  import "./in-page-navigation.css"
5
4
  import "./Elements/InPageNavigation"
6
5
  import {
@@ -8,6 +7,12 @@ import {
8
7
  InPageNavigation as InPageNavigationType,
9
8
  } from "@pnx-mixtape/ids-shape"
10
9
 
10
+ // Deps.
11
+ import Heading from "../../Atom/Heading/heading.twig"
12
+ import Link from "../../Atom/Link/link.twig"
13
+ import Icon from "../../Atom/Icon/icon.twig"
14
+ import { Icons } from "../../enums"
15
+
11
16
  const meta: Meta<InPageNavigationType> = {
12
17
  tags: ["autodocs", "ids-mvp"],
13
18
  component: Component,
@@ -17,6 +22,29 @@ const meta: Meta<InPageNavigationType> = {
17
22
  as: HeadingTypes.TWO,
18
23
  modifiers: [HeadingTypes.FOUR],
19
24
  }),
25
+ items: [
26
+ Link({
27
+ href: "#section-1",
28
+ title: "Section 1",
29
+ iconStart: Icon({
30
+ icon: Icons.CHEVRON_RIGHT,
31
+ }),
32
+ }),
33
+ Link({
34
+ href: "#section-2",
35
+ title: "Section 2",
36
+ iconStart: Icon({
37
+ icon: Icons.CHEVRON_RIGHT,
38
+ }),
39
+ }),
40
+ Link({
41
+ href: "#section-3",
42
+ title: "Section 3",
43
+ iconStart: Icon({
44
+ icon: Icons.CHEVRON_RIGHT,
45
+ }),
46
+ }),
47
+ ],
20
48
  },
21
49
  parameters: {
22
50
  deepControls: { enabled: true },
@@ -9,46 +9,31 @@ exports[`Component/InPageNavigation InPageNavigation smoke-test 1`] = `
9
9
  On this page
10
10
  </h2>
11
11
  <ul>
12
- <li class="mx-in-page-navigation__level--h2">
13
- <a href="#section-1"
14
- class="mx-icon mx-icon--chevron-right"
15
- >
16
- Section 1
12
+ <li>
13
+ <a href="#section-1">
14
+ <span class="mx-icon mx-icon--chevron-right ">
15
+ </span>
16
+ <span>
17
+ Section 1
18
+ </span>
17
19
  </a>
18
20
  </li>
19
- <li class="mx-in-page-navigation__level--h2">
20
- <a href="#anchor-test"
21
- class="mx-icon mx-icon--chevron-right"
22
- >
23
- Section 2
21
+ <li>
22
+ <a href="#section-2">
23
+ <span class="mx-icon mx-icon--chevron-right ">
24
+ </span>
25
+ <span>
26
+ Section 2
27
+ </span>
24
28
  </a>
25
29
  </li>
26
- <li class="mx-in-page-navigation__level--h2">
27
- <a href="#section-3"
28
- class="mx-icon mx-icon--chevron-right"
29
- >
30
- Section 3
31
- </a>
32
- </li>
33
- <li class="mx-in-page-navigation__level--h2">
34
- <a href="#section-4"
35
- class="mx-icon mx-icon--chevron-right"
36
- >
37
- Section 4
38
- </a>
39
- </li>
40
- <li class="mx-in-page-navigation__level--h2">
41
- <a href="#section-5"
42
- class="mx-icon mx-icon--chevron-right"
43
- >
44
- Section 5
45
- </a>
46
- </li>
47
- <li class="mx-in-page-navigation__level--h2">
48
- <a href="#section-7"
49
- class="mx-icon mx-icon--chevron-right"
50
- >
51
- Section 7
30
+ <li>
31
+ <a href="#section-3">
32
+ <span class="mx-icon mx-icon--chevron-right ">
33
+ </span>
34
+ <span>
35
+ Section 3
36
+ </span>
52
37
  </a>
53
38
  </li>
54
39
  </ul>
@@ -61,13 +46,13 @@ exports[`Component/InPageNavigation InPageNavigation smoke-test 1`] = `
61
46
  <p>
62
47
  In publishing and graphic design, lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document without relying on meaningful content. Replacing the actual content with placeholder text allows designers to design the form of the content before the content itself has been produced.
63
48
  </p>
64
- <h2 id="anchor-test">
49
+ <h2 id="section-2">
65
50
  Section 2
66
51
  </h2>
67
52
  <p>
68
53
  In publishing and graphic design, lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document without relying on meaningful content. Replacing the actual content with placeholder text allows designers to design the form of the content before the content itself has been produced.
69
54
  </p>
70
- <h3>
55
+ <h3 id="test-level-3">
71
56
  Test level 3
72
57
  </h3>
73
58
  <p>
@@ -79,29 +64,5 @@ exports[`Component/InPageNavigation InPageNavigation smoke-test 1`] = `
79
64
  <p>
80
65
  In publishing and graphic design, lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document without relying on meaningful content. Replacing the actual content with placeholder text allows designers to design the form of the content before the content itself has been produced.
81
66
  </p>
82
- <h2 id="section-4">
83
- Section 4
84
- </h2>
85
- <p>
86
- In publishing and graphic design, lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document without relying on meaningful content. Replacing the actual content with placeholder text allows designers to design the form of the content before the content itself has been produced.
87
- </p>
88
- <h2 id="section-5">
89
- Section 5
90
- </h2>
91
- <p>
92
- In publishing and graphic design, lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document without relying on meaningful content. Replacing the actual content with placeholder text allows designers to design the form of the content before the content itself has been produced.
93
- </p>
94
- <h3>
95
- Test level 6
96
- </h3>
97
- <p>
98
- In publishing and graphic design, lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document without relying on meaningful content. Replacing the actual content with placeholder text allows designers to design the form of the content before the content itself has been produced.
99
- </p>
100
- <h2 id="section-7">
101
- Section 7
102
- </h2>
103
- <p>
104
- In publishing and graphic design, lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document without relying on meaningful content. Replacing the actual content with placeholder text allows designers to design the form of the content before the content itself has been produced.
105
- </p>
106
67
  </div>
107
68
  `;
@@ -8,6 +8,10 @@
8
8
  <mx-in-page-navigation data-content=".js-content" data-headings="{{ levels|join(",") }}">
9
9
  <nav{{ attributes }}>
10
10
  {{ title }}
11
- <ul></ul>
11
+ <ul>
12
+ {% for item in items %}
13
+ <li>{{ item }}</li>
14
+ {% endfor %}
15
+ </ul>
12
16
  </nav>
13
17
  </mx-in-page-navigation>
@@ -1,18 +1,10 @@
1
1
  <div class="js-content mx-rich-text mx-vertical-flow mx-section--l">
2
- <h2>Section 1</h2>
2
+ <h2 id="section-1">Section 1</h2>
3
3
  <p>In publishing and graphic design, lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document without relying on meaningful content. Replacing the actual content with placeholder text allows designers to design the form of the content before the content itself has been produced.</p>
4
- <h2 id="anchor-test">Section 2</h2>
4
+ <h2 id="section-2">Section 2</h2>
5
5
  <p>In publishing and graphic design, lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document without relying on meaningful content. Replacing the actual content with placeholder text allows designers to design the form of the content before the content itself has been produced.</p>
6
- <h3>Test level 3</h3>
6
+ <h3 id="test-level-3">Test level 3</h3>
7
7
  <p>In publishing and graphic design, lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document without relying on meaningful content. Replacing the actual content with placeholder text allows designers to design the form of the content before the content itself has been produced.</p>
8
- <h2>Section 3</h2>
9
- <p>In publishing and graphic design, lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document without relying on meaningful content. Replacing the actual content with placeholder text allows designers to design the form of the content before the content itself has been produced.</p>
10
- <h2>Section 4</h2>
11
- <p>In publishing and graphic design, lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document without relying on meaningful content. Replacing the actual content with placeholder text allows designers to design the form of the content before the content itself has been produced.</p>
12
- <h2>Section 5</h2>
13
- <p>In publishing and graphic design, lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document without relying on meaningful content. Replacing the actual content with placeholder text allows designers to design the form of the content before the content itself has been produced.</p>
14
- <h3>Test level 6</h3>
15
- <p>In publishing and graphic design, lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document without relying on meaningful content. Replacing the actual content with placeholder text allows designers to design the form of the content before the content itself has been produced.</p>
16
- <h2>Section 7</h2>
8
+ <h2 id="section-3">Section 3</h2>
17
9
  <p>In publishing and graphic design, lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document without relying on meaningful content. Replacing the actual content with placeholder text allows designers to design the form of the content before the content itself has been produced.</p>
18
10
  </div>
@@ -10,7 +10,7 @@ const meta: Meta<NavigationType> = {
10
10
  component: Component,
11
11
  args: {
12
12
  id: "sidenav-story",
13
- title: "Primary mega nav",
13
+ title: "Sidebar nav",
14
14
  parent: Link({
15
15
  title: "About",
16
16
  href: "#",
@@ -2,10 +2,11 @@
2
2
 
3
3
  exports[`Component/SideNavigation SideNavigation smoke-test 1`] = `
4
4
  <nav class="mx-nav mx-side-nav"
5
- aria-labelledby="unique-0"
5
+ aria-label="Sidebar nav"
6
+ "
6
7
  >
7
8
  <div class="mx-side-nav__parent"
8
- id="unique-0"
9
+ id="sidenav-story"
9
10
  >
10
11
  <a href="#">
11
12
  <span>
@@ -27,7 +27,7 @@
27
27
  </ul>
28
28
  {% endmacro %}
29
29
 
30
- <nav{{ attributes }} aria-labelledby="{{ id }}">
30
+ <nav{{ attributes }}{% if title is not empty %} aria-label="{{ title }}"{% else %} aria-labelledby="{{ id }}{% endif %}">
31
31
  <div class="mx-side-nav__parent" id="{{ id }}">
32
32
  {{ parent }}
33
33
  </div>
@@ -1,21 +1,10 @@
1
1
  import { Meta, StoryObj } from "@storybook/html"
2
2
  import Component from "./search-form.twig"
3
- import InputText from "../TextInput/input-text.twig"
4
- import Button from "../../Atom/Button/button.twig"
5
- import Icon from "../../Atom/Icon/icon.twig"
6
3
  import "../form.css"
7
- import {
8
- Button as ButtonType,
9
- ButtonTypes,
10
- FormInput as FormInputType,
11
- InputTypeTypes,
12
- } from "@pnx-mixtape/ids-shape"
13
- import { Icons } from "../../enums"
14
4
 
15
5
  export type SearchFormType = {
16
6
  action: string
17
- input: FormInputType
18
- button: ButtonType
7
+ id: string
19
8
  }
20
9
 
21
10
  const meta: Meta<SearchFormType> = {
@@ -23,21 +12,7 @@ const meta: Meta<SearchFormType> = {
23
12
  component: Component,
24
13
  args: {
25
14
  action: "#search",
26
- input: InputText({
27
- id: "search-keyword",
28
- type: InputTypeTypes.SEARCH,
29
- name: "search-form",
30
- placeholder: "Keywords...",
31
- label: "Search by keywords",
32
- }),
33
- button: Button({
34
- title: "Search",
35
- iconOnly: true,
36
- iconStart: Icon({
37
- icon: Icons.SEARCH,
38
- }),
39
- as: ButtonTypes.SUBMIT,
40
- }),
15
+ id: "search-keyword",
41
16
  },
42
17
  parameters: {
43
18
  deepControls: { enabled: true },
@@ -16,7 +16,7 @@ exports[`Form/Search Search smoke-test 1`] = `
16
16
  <button class="mx-button mx-button--icon-only"
17
17
  type="submit"
18
18
  >
19
- <span class="mx-icon mx-icon--search ">
19
+ <span class="mx-icon mx-icon--search">
20
20
  </span>
21
21
  <span class="sr-only">
22
22
  Search
@@ -6,6 +6,9 @@
6
6
  {% set attributes = (attributes ?? create_attribute()).addClass(classes) %}
7
7
 
8
8
  <form{{ attributes }} role="search" action="{{ action }}">
9
- {{ input }}
10
- {{ button }}
9
+ <input class="mx-input__text " id="{{ id }}" name="search-form" type="search" value="" aria-label="Search by keywords" placeholder="Keywords..." />
10
+ <button class="mx-button mx-button--icon-only" type="submit">
11
+ <span class="mx-icon mx-icon--search"></span>
12
+ <span class="sr-only">Search</span>
13
+ </button>
11
14
  </form>
@@ -12,6 +12,7 @@ import Icon from "../../Atom/Icon/icon.twig"
12
12
  import Logo from "../Header/twig/logo.twig"
13
13
  import Button from "../../Atom/Button/button.twig"
14
14
  import Navigation from "../../Component/Navigation/navigation.twig"
15
+ import SearchForm from "../../Form/Search/search-form.twig"
15
16
  // js.
16
17
  import "../../Component/Navigation/Elements/Navigation"
17
18
  // css.
@@ -91,7 +92,10 @@ export const WithTitle: Story = {
91
92
 
92
93
  export const Search: Story = {
93
94
  args: {
94
- search: "#search",
95
+ search: SearchForm({
96
+ action: "#search",
97
+ id: "search-keyword",
98
+ }),
95
99
  },
96
100
  }
97
101
 
@@ -112,7 +116,10 @@ export const Controls: Story = {
112
116
  export const Stacked: Story = {
113
117
  args: {
114
118
  stacked: true,
115
- search: "#search",
119
+ search: SearchForm({
120
+ action: "#search",
121
+ id: "search-keyword",
122
+ }),
116
123
  controls: [
117
124
  Button({
118
125
  as: ButtonTypes.BUTTON,
@@ -37,13 +37,7 @@
37
37
  {% endif %}
38
38
  {% if search is not empty %}
39
39
  <div id="primary-search" class="mx-header__search global-nav-up-only" aria-label="Search">
40
- <form class="mx-form mx-form--inline-button" role="search" action="{{ search }}">
41
- <input class="mx-input__text " id="search-keyword" name="search-form" type="search" value="" aria-label="Search by keywords" placeholder="Keywords..." />
42
- <button class="mx-button mx-button--icon-only" type="submit">
43
- <span class="mx-icon mx-icon--search"></span>
44
- <span class="sr-only">Search</span>
45
- </button>
46
- </form>
40
+ {{ search }}
47
41
  </div>
48
42
  {% endif %}
49
43
  {% if not stacked %}
@@ -6,11 +6,9 @@ import { Page } from "../../../.storybook/decorators"
6
6
 
7
7
  type SidebarArgs = {
8
8
  content?: string | HTMLElement
9
- contentClass?: string
10
9
  order?: SidebarOrder
11
10
  before?: boolean
12
11
  sidebarContent?: string | HTMLElement
13
- sidebarClass?: string
14
12
  }
15
13
 
16
14
  const meta: Meta<SidebarArgs> = {
@@ -9,14 +9,21 @@
9
9
  }
10
10
 
11
11
  &:where(:has(> aside)) {
12
- @media (--medium-up) {
13
- display: grid;
14
- grid-template-columns: var(--container-max-width, 76ch) auto;
15
- gap: var(--sidebar-gap, var(--gap));
12
+ display: flex;
13
+ flex-wrap: wrap;
14
+ gap: var(--sidebar-gap, var(--gap));
15
+ justify-content: space-between;
16
16
 
17
- @media (--large-up) {
18
- --sidebar-gap: 18ch;
19
- }
17
+ & > aside {
18
+ flex-grow: 1;
19
+ max-inline-size: var(--sidebar-width, 24ch);
20
+ }
21
+
22
+ & > section {
23
+ flex-basis: 0;
24
+ flex-grow: 999;
25
+ min-inline-size: var(--content-min, 50%);
26
+ max-inline-size: var(--container-max-width, 76ch);
20
27
  }
21
28
 
22
29
  &.mx-grid--sidebar-rev {
@@ -44,16 +51,6 @@
44
51
  }
45
52
  }
46
53
  }
47
-
48
- &:is(.mx-grid--sidebar-rev, .mx-grid--sidebar-rev-lg) {
49
- @media (--large-up) {
50
- grid-template-columns: auto var(--container-max-width, 76ch);
51
- }
52
- }
53
- }
54
-
55
- &:where(:has(> aside:first-child)) {
56
- grid-template-columns: auto var(--container-max-width, 76ch);
57
54
  }
58
55
  }
59
56
  }
@@ -4,10 +4,12 @@
4
4
  order ? "mx-grid--"~order : null,
5
5
  ] %}
6
6
  {% set attributes = (attributes ?? create_attribute()).addClass(classes) %}
7
+ {% set sidebarAttributes = (sidebarAttributes ?? create_attribute()) %}
8
+ {% set contentAttributes = (contentAttributes ?? create_attribute()) %}
7
9
 
8
10
  {% if sidebarContent is not empty %}
9
11
  {% set sidebar %}
10
- <aside{% if sidebarClass is not empty %} class="{{ sidebarClass }}"{% endif %}>
12
+ <aside{{ sidebarAttributes }}>
11
13
  {{ sidebarContent }}
12
14
  </aside>
13
15
  {% endset %}
@@ -17,7 +19,7 @@
17
19
  {% if sidebar is not empty and before %}
18
20
  {{ sidebar }}
19
21
  {% endif %}
20
- <section{% if contentClass is not empty %} class="{{ contentClass }}"{% endif %}>
22
+ <section{{ contentAttributes }}>
21
23
  {{ content }}
22
24
  </section>
23
25
  {% if sidebar is not empty and not before %}
Binary file