@statistikzh/leu 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/.storybook/preview.js +1 -2
  2. package/CHANGELOG.md +24 -0
  3. package/custom-elements-manifest.config.js +46 -0
  4. package/dist/Accordion.d.ts +31 -0
  5. package/dist/Accordion.d.ts.map +1 -0
  6. package/dist/Accordion.js +257 -0
  7. package/dist/Breadcrumb.d.ts +69 -0
  8. package/dist/Breadcrumb.d.ts.map +1 -0
  9. package/dist/Breadcrumb.js +392 -0
  10. package/dist/Button-da11d064.d.ts +84 -0
  11. package/dist/Button-da11d064.d.ts.map +1 -0
  12. package/dist/Button-da11d064.js +542 -0
  13. package/dist/Button.d.ts +2 -0
  14. package/dist/Button.d.ts.map +1 -0
  15. package/dist/Button.js +6 -420
  16. package/dist/ButtonGroup.d.ts +24 -0
  17. package/dist/ButtonGroup.d.ts.map +1 -0
  18. package/dist/ButtonGroup.js +70 -39
  19. package/dist/Checkbox.d.ts +13 -0
  20. package/dist/Checkbox.d.ts.map +1 -0
  21. package/dist/Checkbox.js +2 -2
  22. package/dist/CheckboxGroup.d.ts +13 -0
  23. package/dist/CheckboxGroup.d.ts.map +1 -0
  24. package/dist/CheckboxGroup.js +3 -3
  25. package/dist/Chip.d.ts +5 -0
  26. package/dist/Chip.d.ts.map +1 -0
  27. package/dist/{Chip-dac7337d.js → Chip.js} +16 -5
  28. package/dist/ChipGroup.d.ts +28 -0
  29. package/dist/ChipGroup.d.ts.map +1 -0
  30. package/dist/ChipGroup.js +62 -5
  31. package/dist/ChipLink.d.ts +15 -0
  32. package/dist/ChipLink.d.ts.map +1 -0
  33. package/dist/ChipLink.js +1 -1
  34. package/dist/ChipRemovable.d.ts +13 -0
  35. package/dist/ChipRemovable.d.ts.map +1 -0
  36. package/dist/ChipRemovable.js +2 -2
  37. package/dist/ChipSelectable.d.ts +22 -0
  38. package/dist/ChipSelectable.d.ts.map +1 -0
  39. package/dist/ChipSelectable.js +5 -5
  40. package/dist/Dropdown.d.ts +15 -0
  41. package/dist/Dropdown.d.ts.map +1 -0
  42. package/dist/Dropdown.js +25 -7
  43. package/dist/Input.d.ts +154 -0
  44. package/dist/Input.d.ts.map +1 -0
  45. package/dist/Input.js +13 -7
  46. package/dist/Menu.d.ts +8 -0
  47. package/dist/Menu.d.ts.map +1 -0
  48. package/dist/MenuItem.d.ts +21 -0
  49. package/dist/MenuItem.d.ts.map +1 -0
  50. package/dist/MenuItem.js +3 -3
  51. package/dist/Pagination.d.ts +27 -0
  52. package/dist/Pagination.d.ts.map +1 -0
  53. package/dist/Pagination.js +93 -61
  54. package/dist/Popup.d.ts +18 -0
  55. package/dist/Popup.d.ts.map +1 -0
  56. package/dist/{leu-popup-4bf6f1f4.js → Popup.js} +4 -5
  57. package/dist/Radio.d.ts +12 -0
  58. package/dist/Radio.d.ts.map +1 -0
  59. package/dist/Radio.js +2 -2
  60. package/dist/RadioGroup.d.ts +20 -0
  61. package/dist/RadioGroup.d.ts.map +1 -0
  62. package/dist/RadioGroup.js +3 -3
  63. package/dist/ScrollTop.d.ts +19 -0
  64. package/dist/ScrollTop.d.ts.map +1 -0
  65. package/dist/ScrollTop.js +122 -0
  66. package/dist/Select.d.ts +98 -0
  67. package/dist/Select.d.ts.map +1 -0
  68. package/dist/Select.js +27 -82
  69. package/dist/Table.d.ts +48 -0
  70. package/dist/Table.d.ts.map +1 -0
  71. package/dist/Table.js +7 -4
  72. package/dist/VisuallyHidden.d.ts +8 -0
  73. package/dist/VisuallyHidden.d.ts.map +1 -0
  74. package/dist/VisuallyHidden.js +28 -0
  75. package/dist/_rollupPluginBabelHelpers-20f659f4.d.ts +3 -0
  76. package/dist/_rollupPluginBabelHelpers-20f659f4.d.ts.map +1 -0
  77. package/dist/defineElement-40372b4b.d.ts +9 -0
  78. package/dist/defineElement-40372b4b.d.ts.map +1 -0
  79. package/dist/{defineElement-47d4f665.js → defineElement-40372b4b.js} +1 -1
  80. package/dist/icon-03e86700.d.ts +11 -0
  81. package/dist/icon-03e86700.d.ts.map +1 -0
  82. package/dist/index.js.d.ts +21 -0
  83. package/dist/index.js.d.ts.map +1 -0
  84. package/dist/{index.js → index.js.js} +14 -8
  85. package/dist/leu-accordion.d.ts +3 -0
  86. package/dist/leu-accordion.d.ts.map +1 -0
  87. package/dist/leu-accordion.js +9 -0
  88. package/dist/leu-breadcrumb.d.ts +3 -0
  89. package/dist/leu-breadcrumb.d.ts.map +1 -0
  90. package/dist/leu-breadcrumb.js +23 -0
  91. package/dist/leu-button-group.d.ts +3 -0
  92. package/dist/leu-button-group.d.ts.map +1 -0
  93. package/dist/leu-button-group.js +1 -5
  94. package/dist/leu-button.d.ts +3 -0
  95. package/dist/leu-button.d.ts.map +1 -0
  96. package/dist/leu-button.js +3 -2
  97. package/dist/leu-checkbox-group.d.ts +3 -0
  98. package/dist/leu-checkbox-group.d.ts.map +1 -0
  99. package/dist/leu-checkbox-group.js +1 -1
  100. package/dist/leu-checkbox.d.ts +3 -0
  101. package/dist/leu-checkbox.d.ts.map +1 -0
  102. package/dist/leu-checkbox.js +1 -1
  103. package/dist/leu-chip-group.d.ts +3 -0
  104. package/dist/leu-chip-group.d.ts.map +1 -0
  105. package/dist/leu-chip-group.js +2 -1
  106. package/dist/leu-chip-link.d.ts +3 -0
  107. package/dist/leu-chip-link.d.ts.map +1 -0
  108. package/dist/leu-chip-link.js +2 -2
  109. package/dist/leu-chip-removable.d.ts +3 -0
  110. package/dist/leu-chip-removable.d.ts.map +1 -0
  111. package/dist/leu-chip-removable.js +2 -2
  112. package/dist/leu-chip-selectable.d.ts +3 -0
  113. package/dist/leu-chip-selectable.d.ts.map +1 -0
  114. package/dist/leu-chip-selectable.js +2 -2
  115. package/dist/leu-dropdown.d.ts +3 -0
  116. package/dist/leu-dropdown.d.ts.map +1 -0
  117. package/dist/leu-dropdown.js +5 -4
  118. package/dist/leu-input.d.ts +3 -0
  119. package/dist/leu-input.d.ts.map +1 -0
  120. package/dist/leu-input.js +1 -1
  121. package/dist/leu-menu-item.d.ts +3 -0
  122. package/dist/leu-menu-item.d.ts.map +1 -0
  123. package/dist/leu-menu-item.js +1 -1
  124. package/dist/leu-menu.d.ts +3 -0
  125. package/dist/leu-menu.d.ts.map +1 -0
  126. package/dist/leu-menu.js +1 -1
  127. package/dist/leu-pagination.d.ts +3 -0
  128. package/dist/leu-pagination.d.ts.map +1 -0
  129. package/dist/leu-pagination.js +5 -2
  130. package/dist/leu-popup.d.ts +3 -0
  131. package/dist/leu-popup.d.ts.map +1 -0
  132. package/dist/leu-popup.js +9 -0
  133. package/dist/leu-radio-group.d.ts +3 -0
  134. package/dist/leu-radio-group.d.ts.map +1 -0
  135. package/dist/leu-radio-group.js +1 -1
  136. package/dist/leu-radio.d.ts +3 -0
  137. package/dist/leu-radio.d.ts.map +1 -0
  138. package/dist/leu-radio.js +1 -1
  139. package/dist/leu-scroll-top.d.ts +3 -0
  140. package/dist/leu-scroll-top.d.ts.map +1 -0
  141. package/dist/leu-scroll-top.js +14 -0
  142. package/dist/leu-select.d.ts +3 -0
  143. package/dist/leu-select.d.ts.map +1 -0
  144. package/dist/leu-select.js +4 -3
  145. package/dist/leu-table.d.ts +3 -0
  146. package/dist/leu-table.d.ts.map +1 -0
  147. package/dist/leu-table.js +5 -2
  148. package/dist/leu-visually-hidden.d.ts +3 -0
  149. package/dist/leu-visually-hidden.d.ts.map +1 -0
  150. package/dist/leu-visually-hidden.js +8 -0
  151. package/dist/theme.css +386 -2
  152. package/dist/utils-65469421.d.ts +16 -0
  153. package/dist/utils-65469421.d.ts.map +1 -0
  154. package/dist/utils-65469421.js +35 -0
  155. package/index.js +3 -0
  156. package/package.json +30 -12
  157. package/postcss.config.cjs +2 -0
  158. package/rollup.config.js +21 -40
  159. package/scripts/generate-component/templates/[name].css +2 -2
  160. package/scripts/postcss-leu-font-styles.cjs +160 -0
  161. package/src/components/accordion/accordion.css +2 -2
  162. package/src/components/accordion/stories/accordion.stories.js +2 -1
  163. package/src/components/accordion/test/accordion.test.js +4 -2
  164. package/src/components/breadcrumb/Breadcrumb.js +2 -1
  165. package/src/components/breadcrumb/breadcrumb.css +2 -13
  166. package/src/components/button/Button.js +69 -8
  167. package/src/components/button/button.css +10 -2
  168. package/src/components/button/stories/button.stories.js +43 -90
  169. package/src/components/button/test/button.test.js +90 -19
  170. package/src/components/button-group/ButtonGroup.js +76 -34
  171. package/src/components/button-group/stories/button-group.stories.js +13 -6
  172. package/src/components/button-group/test/button-group.test.js +38 -31
  173. package/src/components/checkbox/checkbox-group.css +2 -2
  174. package/src/components/checkbox/checkbox.css +1 -1
  175. package/src/components/chip/ChipGroup.js +42 -2
  176. package/src/components/chip/ChipRemovable.js +1 -1
  177. package/src/components/chip/ChipSelectable.js +4 -4
  178. package/src/components/chip/chip-group.css +12 -2
  179. package/src/components/chip/chip.css +14 -3
  180. package/src/components/chip/stories/chip-group.stories.js +100 -46
  181. package/src/components/chip/test/chip-removable.test.js +3 -3
  182. package/src/components/dropdown/Dropdown.js +23 -3
  183. package/src/components/input/Input.js +7 -4
  184. package/src/components/input/input.css +2 -2
  185. package/src/components/input/stories/input.stories.js +13 -0
  186. package/src/components/input/test/input.test.js +1 -0
  187. package/src/components/menu/menu-item.css +3 -3
  188. package/src/components/pagination/Pagination.js +91 -60
  189. package/src/components/pagination/pagination.css +6 -1
  190. package/src/components/pagination/stories/pagination.stories.js +15 -2
  191. package/src/components/pagination/test/pagination.test.js +15 -15
  192. package/src/components/popup/popup.css +2 -2
  193. package/src/components/popup/stories/popup.stories.js +1 -1
  194. package/src/components/radio/radio-group.css +2 -2
  195. package/src/components/radio/radio.css +1 -1
  196. package/src/components/scroll-top/ScrollTop.js +87 -0
  197. package/src/components/scroll-top/leu-scroll-top.js +6 -0
  198. package/src/components/scroll-top/scroll-top.css +34 -0
  199. package/src/components/scroll-top/stories/scroll-top.stories.js +217 -0
  200. package/src/components/scroll-top/test/scroll-top.test.js +22 -0
  201. package/src/components/select/Select.js +24 -6
  202. package/src/components/select/select.css +2 -2
  203. package/src/components/table/table.css +2 -2
  204. package/src/components/visually-hidden/VisuallyHidden.js +13 -0
  205. package/src/components/visually-hidden/leu-visually-hidden.js +6 -0
  206. package/src/components/visually-hidden/stories/visually-hidden.stories.js +22 -0
  207. package/src/components/visually-hidden/test/visually-hidden.test.js +36 -0
  208. package/src/components/visually-hidden/visually-hidden.css +10 -0
  209. package/src/lib/defineElement.js +1 -1
  210. package/src/lib/hasSlotController.js +5 -3
  211. package/src/lib/utils.js +21 -3
  212. package/src/styles/custom-properties.css +6 -2
  213. package/src/styles/font-definitions.json +202 -0
  214. package/stylelint.config.mjs +2 -0
  215. package/tsconfig.build.json +21 -0
  216. package/tsconfig.json +16 -0
@@ -1,7 +1,7 @@
1
1
  /** @type { import('@storybook/web-components').Preview } */
2
2
 
3
3
  import { setCustomElementsManifest } from "@storybook/web-components"
4
- import customElemenents from "../custom-elements.json"
4
+ import customElemenents from "../dist/custom-elements.json"
5
5
 
6
6
  setCustomElementsManifest(customElemenents)
7
7
 
@@ -11,7 +11,6 @@ const preview = {
11
11
  controls: {
12
12
  matchers: {
13
13
  color: /(background|color)$/i,
14
- date: /Date$/i,
15
14
  },
16
15
  },
17
16
  viewport: {
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.0](https://github.com/statistikZH/leu/compare/v0.4.0...v0.5.0) (2024-05-02)
4
+
5
+
6
+ ### Features
7
+
8
+ * **button:** reflect aria-checked, aria-selected and role ([8e11d3e](https://github.com/statistikZH/leu/commit/8e11d3ea9c77dc27582dfca3b7f240e184b91316))
9
+ * **chip-group:** add optional label to the chip group ([03cc159](https://github.com/statistikZH/leu/commit/03cc159a9edfb0b710572f4b88aa3b3b52000e80))
10
+ * **dropdown:** close dropdown with a click outside the element or with pressing escape ([#146](https://github.com/statistikZH/leu/issues/146)) ([8b07146](https://github.com/statistikZH/leu/commit/8b071467b76c3e4b502e7daf28d432f722736ad9))
11
+ * export type declaration files and add type checking ([#155](https://github.com/statistikZH/leu/issues/155)) ([781ff9a](https://github.com/statistikZH/leu/commit/781ff9a865e52d8076df12e198d9a173202b352d))
12
+ * **input:** add step attribute that will be reflected to the native input element ([59aa303](https://github.com/statistikZH/leu/commit/59aa30352b77d0f46c9e1f3b688bbf556c9b592b))
13
+ * **scroll-top:** implement scroll-top component ([07c670c](https://github.com/statistikZH/leu/commit/07c670c173719398d1e0a04345a1c2a6d4f3a5e4))
14
+ * **theme:** define custom properties for all font styles and curves ([#142](https://github.com/statistikZH/leu/issues/142)) ([fadafde](https://github.com/statistikZH/leu/commit/fadafde3e2c4a8f0607ad08624515c907920ce9d))
15
+ * **visually-hidden:** implement a utility component to visually hide content ([98143c6](https://github.com/statistikZH/leu/commit/98143c69523d17164cbb5b2d71879193cf442219))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **chip:** prefix custom event according to the event naming guidelines ([4d3709c](https://github.com/statistikZH/leu/commit/4d3709c6b0a06c5be0daf2f6df54feed5f7e6ce4))
21
+ * **chip:** truncate text instead of wrapping inside the chip ([03cc159](https://github.com/statistikZH/leu/commit/03cc159a9edfb0b710572f4b88aa3b3b52000e80))
22
+ * **chip:** use correct aria attribute to represent the state of the chip ([4d3709c](https://github.com/statistikZH/leu/commit/4d3709c6b0a06c5be0daf2f6df54feed5f7e6ce4))
23
+ * **input:** avoid empty strings to be converted to the value zero ([59aa303](https://github.com/statistikZH/leu/commit/59aa30352b77d0f46c9e1f3b688bbf556c9b592b))
24
+ * **pagination:** add a visually hidden label for the page input field ([98143c6](https://github.com/statistikZH/leu/commit/98143c69523d17164cbb5b2d71879193cf442219))
25
+ * **pagination:** define visually hidden labels for the buttons ([201464b](https://github.com/statistikZH/leu/commit/201464b24f997657029275a763b61ef07c8e26d1))
26
+
3
27
  ## [0.4.0](https://github.com/statistikZH/leu/compare/v0.3.0...v0.4.0) (2024-02-21)
4
28
 
5
29
 
@@ -0,0 +1,46 @@
1
+ import { customElementJetBrainsPlugin } from "custom-element-jet-brains-integration"
2
+ import { customElementVsCodePlugin } from "custom-element-vs-code-integration"
3
+ import { customElementVuejsPlugin } from "custom-element-vuejs-integration"
4
+
5
+ export default {
6
+ globs: ["src/components/*/*.js"],
7
+ exclude: ["src/**/test/**/*.js", "src/**/stories/**/*.js"],
8
+ outdir: "./dist",
9
+ /** Enable special handling for litelement */
10
+ litelement: true,
11
+ plugins: [
12
+ // Generate custom VS Code data
13
+ customElementVsCodePlugin({
14
+ outdir: "./dist",
15
+ cssFileName: null,
16
+ referencesTemplate: (_, tag) => [
17
+ {
18
+ name: "Documentation",
19
+ url: `https://statistikzh.github.io/leu/?path=/story/${tag.replace(
20
+ "leu-",
21
+ ""
22
+ )}`,
23
+ },
24
+ ],
25
+ }),
26
+
27
+ customElementJetBrainsPlugin({
28
+ outdir: "./dist",
29
+ excludeCss: true,
30
+ packageJson: false,
31
+ referencesTemplate: (_, tag) => ({
32
+ name: "Documentation",
33
+ url: `https://statistikzh.github.io/leu/?path=/story/${tag.replace(
34
+ "leu-",
35
+ ""
36
+ )}`,
37
+ }),
38
+ }),
39
+
40
+ customElementVuejsPlugin({
41
+ outdir: "./dist/vue",
42
+ fileName: "index.d.ts",
43
+ componentTypePath: (name) => `../${name.replace("Leu", "")}.js`,
44
+ }),
45
+ ],
46
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @tagname leu-accordion
3
+ * @slot content - The content of the accordion. No styles will be applied to the content.
4
+ * @prop {Number} headingLevel - The heading level of the accordion title. Must be between 1 and 6.
5
+ * @prop {Boolean} open - The expanded state of the accordion.
6
+ * @prop {String} label - The label (title) of the accordion.
7
+ * @prop {String} labelPrefix - The prefix of the accordion label. e.g. "01"
8
+ * @attr {Number} heading-level - The heading level of the accordion title. Must be between 1 and 6.
9
+ * @attr {String} label-prefix - The prefix of the accordion label. e.g. "01"
10
+ */
11
+ export class LeuAccordion extends LitElement {
12
+ headingLevel: number;
13
+ open: boolean;
14
+ label: string;
15
+ /**
16
+ * Determines the heading tag of the accordion toggle.
17
+ * The headingLevel shouldn't be used directly to render the heading tag
18
+ * in order to avoid XSS issues.
19
+ * @returns {String} The heading tag of the accordion toggle.
20
+ * @internal
21
+ */
22
+ _getHeadingTag(): string;
23
+ /**
24
+ * Toggles the accordion open state.
25
+ * @internal
26
+ */
27
+ _handleToggleClick(): void;
28
+ render(): import("lit-html").TemplateResult;
29
+ }
30
+ import { LitElement } from 'lit';
31
+ //# sourceMappingURL=Accordion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["Accordion.js"],"names":[],"mappings":"AA+JA;;;;;;;;;GASG;AACH;IAGI,qBAAqB;IACrB,cAAiB;IACjB,cAAe;IAGjB;;;;;;OAMG;IACH,yBAMC;IAED;;;OAGG;IACH,2BAEC;IACD,4CA2BC;CAEF;2BAnOwC,KAAK"}
@@ -0,0 +1,257 @@
1
+ import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
+ import { css, LitElement, nothing } from 'lit';
3
+ import { html, unsafeStatic } from 'lit/static-html.js';
4
+
5
+ var css_248z = css`:host,
6
+ :host * {
7
+ box-sizing: border-box;
8
+ }
9
+ :host {
10
+ --accordion-font-regular: var(--leu-font-family-regular);
11
+ --accordion-font-black: var(--leu-font-family-black);
12
+
13
+ --accordion-toggle-font: var(--accordion-font-black);
14
+
15
+ --label-color: var(--leu-color-black-60);
16
+ --label-color-active: var(--leu-color-black-100);
17
+
18
+ --divider-color: var(--leu-color-black-20);
19
+ --divider-color-active: var(--leu-color-black-100);
20
+
21
+ --transition: 0.1s ease;
22
+
23
+ font-family: var(--chip-font-regular);
24
+
25
+ position: relative;
26
+ display: grid;
27
+ grid-template-rows: auto 0fr;
28
+
29
+ transition: grid-template-rows 0.1s ease;
30
+
31
+ transition: grid-template-rows var(--transition);
32
+ }
33
+ :host([open]) {
34
+ grid-template-rows: auto 1fr;
35
+ }
36
+ .heading {
37
+ margin: 0;
38
+ }
39
+ .button {
40
+ width: 100%;
41
+ background: none;
42
+ padding: 1rem 0;
43
+ margin: none;
44
+ cursor: pointer;
45
+
46
+ border: none;
47
+
48
+ color: var(--label-color);
49
+ font-family: var(--accordion-toggle-font);
50
+ font-size: 1rem;
51
+ line-height: 1.5rem;
52
+ text-align: left;
53
+
54
+ display: flex;
55
+ gap: 0.25rem;
56
+
57
+ transition: color var(--transition);
58
+ }
59
+ @media (min-width: 600px) {
60
+ .button {
61
+ font-size: 1.125rem;
62
+ gap: 0.8rem;
63
+ }
64
+ }
65
+ @media (min-width: 1280px) {
66
+ .button {
67
+ font-size: 1.25rem;
68
+ line-height: 1.625rem;
69
+ }
70
+ }
71
+ .button:focus-visible {
72
+ outline: 2px solid var(--leu-color-func-cyan);
73
+ outline-offset: 4px;
74
+ }
75
+ .button:hover,
76
+ .button:focus-visible,
77
+ :host([open]) .button {
78
+ color: var(--label-color-active);
79
+ }
80
+ .plus {
81
+ position: relative;
82
+ flex: 0 0 1rem;
83
+ aspect-ratio: 1;
84
+ align-self: center;
85
+ margin-left: 0.5rem;
86
+ margin-right: 0.5rem;
87
+ }
88
+ .plus::before,
89
+ .plus::after {
90
+ content: "";
91
+
92
+ position: absolute;
93
+ top: calc(50% - 0.0625rem);
94
+ left: 0;
95
+
96
+ display: block;
97
+ width: 1rem;
98
+ height: 0.125rem;
99
+ aspect-ratio: 1 / 0.125;
100
+ background-color: currentcolor;
101
+ transition: transform var(--transition);
102
+ }
103
+ .plus::before {
104
+ transform: rotate(90deg);
105
+ }
106
+ :host([open]) .plus::before {
107
+ transform: rotate(180deg);
108
+ }
109
+ .label {
110
+ display: block;
111
+ flex-grow: 1;
112
+ }
113
+ .content {
114
+ overflow: hidden;
115
+ transition: visibility var(--transition), opacity var(--transition);
116
+ }
117
+ .content[hidden] {
118
+ display: block;
119
+ visibility: hidden;
120
+ opacity: 0;
121
+ }
122
+ slot[name="content"] {
123
+ display: block;
124
+ padding: 0.5rem 0 1.5rem;
125
+ }
126
+ @media (min-width: 840px) {
127
+ slot[name="content"] {
128
+ padding: 0.75rem 0 1.5rem;
129
+ }
130
+ }
131
+ @media (min-width: 1280px) {
132
+ slot[name="content"] {
133
+ padding: 1rem 0 2.5rem;
134
+ }
135
+ }
136
+ .divider {
137
+ position: absolute;
138
+ top: 100%;
139
+ left: 0;
140
+
141
+ width: 100%;
142
+ height: 1px;
143
+ margin: 0;
144
+
145
+ border: none;
146
+ background-color: var(--divider-color);
147
+
148
+ transition: transform var(--transition), background-color var(--transition);
149
+ }
150
+ :host(:not([open])) .heading:hover ~ .divider {
151
+ background-color: var(--divider-color-active);
152
+ transform: scaleY(3);
153
+ }
154
+ :host(:not([open])) .heading:focus-visible ~ .divider {
155
+ background-color: var(--divider-color-active);
156
+ transform: scaleY(3);
157
+ }
158
+ `;
159
+
160
+ /**
161
+ * @tagname leu-accordion
162
+ * @slot content - The content of the accordion. No styles will be applied to the content.
163
+ * @prop {Number} headingLevel - The heading level of the accordion title. Must be between 1 and 6.
164
+ * @prop {Boolean} open - The expanded state of the accordion.
165
+ * @prop {String} label - The label (title) of the accordion.
166
+ * @prop {String} labelPrefix - The prefix of the accordion label. e.g. "01"
167
+ * @attr {Number} heading-level - The heading level of the accordion title. Must be between 1 and 6.
168
+ * @attr {String} label-prefix - The prefix of the accordion label. e.g. "01"
169
+ */
170
+ class LeuAccordion extends LitElement {
171
+ constructor() {
172
+ super();
173
+ this.headingLevel = 2;
174
+ this.open = false;
175
+ this.label = "";
176
+ }
177
+
178
+ /**
179
+ * Determines the heading tag of the accordion toggle.
180
+ * The headingLevel shouldn't be used directly to render the heading tag
181
+ * in order to avoid XSS issues.
182
+ * @returns {String} The heading tag of the accordion toggle.
183
+ * @internal
184
+ */
185
+ _getHeadingTag() {
186
+ let level = 2;
187
+ if (this.headingLevel > 0 && this.headingLevel < 7) {
188
+ level = this.headingLevel;
189
+ }
190
+ return `h${level}`;
191
+ }
192
+
193
+ /**
194
+ * Toggles the accordion open state.
195
+ * @internal
196
+ */
197
+ _handleToggleClick() {
198
+ this.open = !this.open;
199
+ }
200
+ render() {
201
+ const hTag = this._getHeadingTag();
202
+
203
+ /* The eslint rules don't recognize html import from lit/static-html.js */
204
+ /* eslint-disable lit/binding-positions, lit/no-invalid-html */
205
+ return html`<${unsafeStatic(hTag)} class="heading"><button
206
+ id="toggle"
207
+ type="button"
208
+ class="button"
209
+ aria-controls="content"
210
+ aria-expanded="${this.open}"
211
+ @click=${this._handleToggleClick}
212
+ >
213
+ ${this.labelPrefix ? html`<span class="label-prefix">${this.labelPrefix}</span>` : nothing}
214
+ <span class="label">${this.label}</span>
215
+ <div class="plus"></div>
216
+ </button></${unsafeStatic(hTag)}>
217
+ <div
218
+ id="content"
219
+ class="content"
220
+ aria-labelledby="toggle"
221
+ role="region"
222
+ ?hidden=${!this.open}
223
+ >
224
+ <slot name="content"></slot>
225
+ </div>
226
+ <hr class="divider" />`;
227
+ }
228
+ /* eslint-enable lit/binding-positions, lit/no-invalid-html */
229
+ }
230
+ _defineProperty(LeuAccordion, "styles", css_248z);
231
+ /** @internal */
232
+ _defineProperty(LeuAccordion, "shadowRootOptions", {
233
+ ...LitElement.shadowRootOptions,
234
+ delegatesFocus: true
235
+ });
236
+ _defineProperty(LeuAccordion, "properties", {
237
+ headingLevel: {
238
+ type: Number,
239
+ attribute: "heading-level",
240
+ reflect: true
241
+ },
242
+ open: {
243
+ type: Boolean,
244
+ reflect: true
245
+ },
246
+ label: {
247
+ type: String,
248
+ reflect: true
249
+ },
250
+ labelPrefix: {
251
+ type: String,
252
+ attribute: "label-prefix",
253
+ reflect: true
254
+ }
255
+ });
256
+
257
+ export { LeuAccordion };
@@ -0,0 +1,69 @@
1
+ /**
2
+ * A Breadcrumb Navigation.
3
+ *
4
+ * The breadcrumbs can be displayed in two different layouts.
5
+ * Only the back link (the last item / parent of the current page)
6
+ * is displayed when…
7
+ * - … the width of the container is smaller
8
+ * than the BACK_ONLY_BREAKPOINT.
9
+ * - … less then two breadcrumb items could be displayed
10
+ * without overflowing the container.
11
+ *
12
+ * Otherwise as many items as possible are displayed in an inline list
13
+ * without overflowing the container. The remaining items are displayed
14
+ * in a dropdown menu.
15
+ *
16
+ * In order to determine the exact numbers of items that have to be
17
+ * hidden inside the dropdown, all of them have to be rendered first.
18
+ * 1. Render all items
19
+ * 2. Calculate (measure) the number of items that can be displayed
20
+ * without overflowing the container.
21
+ * 3. Updating the state (_hiddeItems) which will trigger a rerender
22
+ * 4. Render the items again with the new state.
23
+ *
24
+ * This results in multiple updates scheduled one after another. Lit
25
+ * will also print a waring in the console beacause of that.
26
+ * It's no a nice behaviour but the only one that works without
27
+ * having duplicate and hidden markup to derive the sizes from that.
28
+ *
29
+ *
30
+ * @prop {Array} items - Object array with { label, href }
31
+ * @prop {Boolean} inverted - invert color on dark background
32
+ *
33
+ * @tagname leu-breadcrumb
34
+ */
35
+ export class LeuBreadcrumb extends LitElement {
36
+ _lastContainerWidth: any;
37
+ _showBackOnly: boolean;
38
+ _isRecalculating: boolean;
39
+ _hiddenItems: number;
40
+ _isDropdownOpen: boolean;
41
+ items: any[];
42
+ /** @type {Boolean} - will be used on dark Background */
43
+ inverted: boolean;
44
+ /** @internal */
45
+ _containerRef: import("lit-html/directives/ref.js").Ref<Element>;
46
+ resizeObserver: ResizeObserver;
47
+ firstUpdated(): void;
48
+ updated(changedProperties: any): Promise<void>;
49
+ /** @internal */
50
+ get _listItems(): any;
51
+ /** @internal */
52
+ get _dropdownItems(): any[];
53
+ /**
54
+ * Calculate the number of items that can be displayed
55
+ * without overflowing the container.
56
+ * @internal
57
+ * @returns {void}
58
+ */
59
+ _checkWidth(): void;
60
+ /**
61
+ * Render the dropdown menu
62
+ * @returns
63
+ */
64
+ renderDropdown(): import("lit-html").TemplateResult<1> | typeof nothing;
65
+ render(): import("lit-html").TemplateResult<1> | typeof nothing;
66
+ }
67
+ import { LitElement } from 'lit';
68
+ import { nothing } from 'lit';
69
+ //# sourceMappingURL=Breadcrumb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Breadcrumb.d.ts","sourceRoot":"","sources":["Breadcrumb.js"],"names":[],"mappings":"AA+HA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH;IAOM,yBAA+C;IAO7C,uBAAyB;IACzB,0BAA6B;IAY7B,qBAAqB;IASvB,yBAA4C;IAW9C,aAAe;IACf,wDAAwD;IACxD,kBAAqB;IAErB,gBAAgB;IAChB,iEAAgC;IAehC,+BAEQ;IAEV,qBAEC;IACD,+CAOC;IAOD,gBAAgB;IAChB,sBAEC;IAED,gBAAgB;IAChB,4BAEC;IACD;;;;;OAKG;IACH,eAFa,IAAI,CA4BhB;IACD;;;OAGG;IACH,wEAoCC;IACD,gEAiCC;CACF;2BA7W8C,KAAK;wBAAL,KAAK"}