@statistikzh/leu 0.0.2

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 (141) hide show
  1. package/.editorconfig +29 -0
  2. package/.eslintrc.json +27 -0
  3. package/.github/workflows/publish.yml +19 -0
  4. package/.github/workflows/release-please.yml +19 -0
  5. package/.github/workflows/test.yml +38 -0
  6. package/.husky/commit-msg +4 -0
  7. package/.husky/pre-commit +4 -0
  8. package/.prettierignore +1 -0
  9. package/.storybook/main.js +11 -0
  10. package/.storybook/preview-head.html +5 -0
  11. package/.storybook/preview.js +23 -0
  12. package/CHANGELOG.md +63 -0
  13. package/CODE_OF_CONDUCT.md +128 -0
  14. package/CONTRIBUTING.md +31 -0
  15. package/LICENSE +21 -0
  16. package/README.md +170 -0
  17. package/commitlint.config.cjs +1 -0
  18. package/dist/Button-83c6df93.js +403 -0
  19. package/dist/Checkbox.js +144 -0
  20. package/dist/CheckboxGroup.js +82 -0
  21. package/dist/Chip-60af1402.js +162 -0
  22. package/dist/ChipGroup.js +79 -0
  23. package/dist/ChipLink.js +46 -0
  24. package/dist/ChipRemovable.js +43 -0
  25. package/dist/ChipSelectable.js +92 -0
  26. package/dist/Input.js +686 -0
  27. package/dist/Radio.js +156 -0
  28. package/dist/RadioGroup.js +194 -0
  29. package/dist/Select.js +859 -0
  30. package/dist/Table-72d305d7.js +506 -0
  31. package/dist/Table.js +8 -0
  32. package/dist/defineElement-47d4f665.js +15 -0
  33. package/dist/icon-b68c7e1e.js +202 -0
  34. package/dist/index.js +21 -0
  35. package/dist/leu-checkbox-group.js +6 -0
  36. package/dist/leu-checkbox.js +6 -0
  37. package/dist/leu-chip-group.js +5 -0
  38. package/dist/leu-chip-link.js +6 -0
  39. package/dist/leu-chip-removable.js +7 -0
  40. package/dist/leu-chip-selectable.js +6 -0
  41. package/dist/leu-input.js +9 -0
  42. package/dist/leu-radio-group.js +6 -0
  43. package/dist/leu-radio.js +5 -0
  44. package/dist/leu-select.js +12 -0
  45. package/dist/leu-table.js +10 -0
  46. package/dist/theme.css +51 -0
  47. package/index.js +10 -0
  48. package/package.json +85 -0
  49. package/postcss.config.cjs +14 -0
  50. package/rollup.config.js +54 -0
  51. package/scripts/generate-component/generate.js +167 -0
  52. package/scripts/generate-component/templates/[Name].js +33 -0
  53. package/scripts/generate-component/templates/[name].css +11 -0
  54. package/scripts/generate-component/templates/[namespace]-[name].js +3 -0
  55. package/scripts/generate-component/templates/stories/[name].stories.js +13 -0
  56. package/scripts/generate-component/templates/test/[name].test.js +22 -0
  57. package/src/components/button/Button.js +150 -0
  58. package/src/components/button/button.css +232 -0
  59. package/src/components/button/leu-button.js +3 -0
  60. package/src/components/button/stories/button.stories.js +333 -0
  61. package/src/components/button/test/button.test.js +22 -0
  62. package/src/components/button-group/ButtonGroup.js +63 -0
  63. package/src/components/button-group/button-group.css +10 -0
  64. package/src/components/button-group/leu-button-group.js +3 -0
  65. package/src/components/button-group/stories/button-group.stories.js +41 -0
  66. package/src/components/button-group/test/button-group.test.js +22 -0
  67. package/src/components/checkbox/Checkbox.js +142 -0
  68. package/src/components/checkbox/CheckboxGroup.js +80 -0
  69. package/src/components/checkbox/leu-checkbox-group.js +3 -0
  70. package/src/components/checkbox/leu-checkbox.js +3 -0
  71. package/src/components/checkbox/stories/checkbox-group.stories.js +52 -0
  72. package/src/components/checkbox/stories/checkbox.stories.js +43 -0
  73. package/src/components/checkbox/test/checkbox.test.js +101 -0
  74. package/src/components/chip/Chip.js +24 -0
  75. package/src/components/chip/ChipGroup.js +71 -0
  76. package/src/components/chip/ChipLink.js +45 -0
  77. package/src/components/chip/ChipRemovable.js +42 -0
  78. package/src/components/chip/ChipSelectable.js +91 -0
  79. package/src/components/chip/chip-group.css +5 -0
  80. package/src/components/chip/chip.css +130 -0
  81. package/src/components/chip/exports.js +10 -0
  82. package/src/components/chip/leu-chip-group.js +3 -0
  83. package/src/components/chip/leu-chip-link.js +3 -0
  84. package/src/components/chip/leu-chip-removable.js +3 -0
  85. package/src/components/chip/leu-chip-selectable.js +3 -0
  86. package/src/components/chip/stories/chip-group.stories.js +99 -0
  87. package/src/components/chip/stories/chip-link.stories.js +37 -0
  88. package/src/components/chip/stories/chip-removable.stories.js +28 -0
  89. package/src/components/chip/stories/chip-selectable.stories.js +46 -0
  90. package/src/components/chip/test/chip.test.js +22 -0
  91. package/src/components/dropdown/Dropdown.js +55 -0
  92. package/src/components/dropdown/dropdown.css +17 -0
  93. package/src/components/dropdown/leu-dropdown.js +3 -0
  94. package/src/components/dropdown/stories/dropdown.stories.js +25 -0
  95. package/src/components/dropdown/test/dropdown.test.js +31 -0
  96. package/src/components/icon/icon.js +201 -0
  97. package/src/components/input/Input.js +421 -0
  98. package/src/components/input/input.css +231 -0
  99. package/src/components/input/leu-input.js +3 -0
  100. package/src/components/input/stories/input.stories.js +185 -0
  101. package/src/components/input/test/input.test.js +22 -0
  102. package/src/components/menu/Menu.js +18 -0
  103. package/src/components/menu/MenuItem.js +95 -0
  104. package/src/components/menu/leu-menu-item.js +3 -0
  105. package/src/components/menu/leu-menu.js +3 -0
  106. package/src/components/menu/menu-item.css +72 -0
  107. package/src/components/menu/menu.css +14 -0
  108. package/src/components/menu/stories/menu-item.stories.js +51 -0
  109. package/src/components/menu/stories/menu.stories.js +21 -0
  110. package/src/components/menu/test/menu.test.js +22 -0
  111. package/src/components/pagination/Pagination.js +152 -0
  112. package/src/components/pagination/leu-pagination.js +3 -0
  113. package/src/components/pagination/pagination.css +49 -0
  114. package/src/components/pagination/stories/pagination.stories.js +82 -0
  115. package/src/components/pagination/test/pagination.test.js +22 -0
  116. package/src/components/radio/Radio.js +62 -0
  117. package/src/components/radio/RadioGroup.js +193 -0
  118. package/src/components/radio/leu-radio-group.js +3 -0
  119. package/src/components/radio/leu-radio.js +3 -0
  120. package/src/components/radio/radio.css +76 -0
  121. package/src/components/radio/stories/radio-group.stories.js +49 -0
  122. package/src/components/radio/stories/radio.stories.js +48 -0
  123. package/src/components/radio/test/radio.test.js +38 -0
  124. package/src/components/select/Select.js +350 -0
  125. package/src/components/select/leu-select.js +3 -0
  126. package/src/components/select/select.css +215 -0
  127. package/src/components/select/stories/select.stories.js +302 -0
  128. package/src/components/select/test/select.test.js +29 -0
  129. package/src/components/table/Table.js +301 -0
  130. package/src/components/table/leu-table.js +3 -0
  131. package/src/components/table/stories/table.stories.js +116 -0
  132. package/src/components/table/test/table.test.js +36 -0
  133. package/src/lib/defineElement.js +13 -0
  134. package/src/lib/hasSlotController.js +85 -0
  135. package/src/styles/custom-media.css +5 -0
  136. package/src/styles/custom-properties.css +51 -0
  137. package/src/styles/theme.css +1 -0
  138. package/stat_zh.png +0 -0
  139. package/stylelint.config.mjs +21 -0
  140. package/web-dev-server-storybook.config.mjs +19 -0
  141. package/web-test-runner.config.mjs +49 -0
@@ -0,0 +1,167 @@
1
+ #!/usr/bin/env node
2
+ /* eslint-disable no-use-before-define */
3
+
4
+ import arg from "arg"
5
+ import fs from "fs"
6
+ import path from "path"
7
+ import { fileURLToPath } from "url"
8
+
9
+ const fsPromises = fs.promises
10
+ const __filename = fileURLToPath(import.meta.url)
11
+ const __dirname = path.dirname(__filename)
12
+
13
+ const namespace = "leu"
14
+ const Namespace = "Leu"
15
+
16
+ const printHelp = () => {
17
+ console.log(`
18
+ Usage: ./scripts/generate-component/generate.js [options]
19
+
20
+ Options:
21
+ -n, --name Name of the component directory, camel-case (required)
22
+ -c, --components List of components to generate, camel-case (optional, defaults to name)
23
+ -h, --help Print this help message
24
+
25
+ Example:
26
+ ./scripts/generate-component/generate.js --name radio --components radio,radio-button
27
+ ./scripts/generate-component/generate.js -n select
28
+ `)
29
+ }
30
+
31
+ const upperCamelCase = (str) =>
32
+ str
33
+ .split("-")
34
+ .map((chunk) => `${chunk.charAt(0).toUpperCase()}${chunk.slice(1)}`)
35
+ .join("")
36
+
37
+ const makeFolder = async (dir) => {
38
+ if (dir !== "." && !fs.existsSync(dir)) {
39
+ await fsPromises.mkdir(dir)
40
+ }
41
+ }
42
+
43
+ const formatTemplateFileContents = (replacements, content) => {
44
+ // replace all instances of [name], [Name], [namespace] and [Namespace] accordingly
45
+ let result = content
46
+ for (let i = 0; i < replacements.length; i += 1) {
47
+ const { regex, value } = replacements[i]
48
+ result = result.replace(regex, value)
49
+ }
50
+ return result
51
+ }
52
+
53
+ const getReplacements = async ({ name }) => {
54
+ // name to lower-kebab-case (e.g. Text Input -> text-input)
55
+ // const lowerKebabCaseName = lowerKebabCase(name)
56
+ // name to UpperCamelCase (e.g. text-input -> TextInput)
57
+ const upperCamelCaseName = upperCamelCase(name)
58
+
59
+ return [
60
+ { regex: /\[name\]/g, value: name },
61
+ { regex: /\[namespace\]/g, value: namespace },
62
+ { regex: /\[Namespace\]/g, value: Namespace },
63
+ { regex: /\[Name\]/g, value: upperCamelCaseName },
64
+ ]
65
+ }
66
+
67
+ const copyFile = async (sourcePath, targetPath, params, replacements) => {
68
+ const stats = await fsPromises.stat(sourcePath)
69
+ if (stats.isDirectory()) {
70
+ await makeFolder(targetPath)
71
+ await copyAllFiles(sourcePath, targetPath, params)
72
+ } else if (stats.isFile()) {
73
+ const templateFileContents = await fsPromises.readFile(sourcePath, {
74
+ encoding: "utf8",
75
+ })
76
+ const formattedTemplateFileContents = formatTemplateFileContents(
77
+ replacements,
78
+ templateFileContents
79
+ )
80
+ await fsPromises.writeFile(targetPath, formattedTemplateFileContents, {
81
+ encoding: "utf8",
82
+ })
83
+
84
+ if (params.verbose) {
85
+ console.log(`Copied: ${sourcePath} -> ${targetPath}`)
86
+ }
87
+ }
88
+ }
89
+
90
+ const copyAllFiles = async (sourcePath, targetPath, params) => {
91
+ const fileNames = await fsPromises.readdir(sourcePath)
92
+ const fileCopyPromises = []
93
+ const replacements = await getReplacements(params)
94
+ fileNames.forEach((fileName) => {
95
+ const newFileName = formatTemplateFileContents(replacements, fileName)
96
+
97
+ console.log(`Creating: ${targetPath}/${newFileName}`)
98
+
99
+ fileCopyPromises.push(
100
+ copyFile(
101
+ `${sourcePath}/${fileName}`,
102
+ `${targetPath}/${newFileName}`,
103
+ params,
104
+ replacements
105
+ )
106
+ )
107
+ })
108
+ await Promise.all(fileCopyPromises)
109
+ }
110
+
111
+ const generate = async () => {
112
+ const args = arg({
113
+ "--help": Boolean,
114
+ "--name": String,
115
+ "--components": String,
116
+ "-n": "--name",
117
+ "-c": "--components",
118
+ })
119
+
120
+ if (args["--help"]) {
121
+ printHelp()
122
+ process.exit(0)
123
+ }
124
+
125
+ if (!args["--name"]) {
126
+ console.log("Please provide a name for your component.")
127
+ process.exit(1)
128
+ }
129
+
130
+ const name = args["--name"]
131
+ const components = args["--components"]
132
+ ? args["--components"].split(",").map((component) => component.trim())
133
+ : [name]
134
+
135
+ const kebabCaseRegex = /^[a-z]+(-[a-z]+)*$/
136
+
137
+ if (![name].concat(components).every((c) => kebabCaseRegex.test(c))) {
138
+ console.log(
139
+ "The name and the components have to be in camel case and can only contain [a-z] letters."
140
+ )
141
+ console.log("Example: radio-group")
142
+ process.exit(1)
143
+ }
144
+
145
+ const destinationPath = path.join(process.cwd(), `src/components/${name}`)
146
+ const templatesPath = path.join(__dirname, "templates")
147
+
148
+ if (fs.existsSync(destinationPath)) {
149
+ console.log(`The component ${name} already exists.`)
150
+ process.exit(1)
151
+ }
152
+
153
+ await makeFolder(destinationPath)
154
+
155
+ const copyPromises = components.map(async (component) =>
156
+ copyAllFiles(templatesPath, destinationPath, {
157
+ name: component,
158
+ Name: upperCamelCase(component),
159
+ namespace,
160
+ Namespace,
161
+ })
162
+ )
163
+
164
+ await Promise.all(copyPromises)
165
+ }
166
+
167
+ await generate()
@@ -0,0 +1,33 @@
1
+ import { html, LitElement } from "lit"
2
+ import { defineElement } from "../../lib/defineElement.js"
3
+ import styles from "./[name].css"
4
+
5
+ /**
6
+ * @tagname [namespace]-[name]
7
+ */
8
+ export class Leu[Name] extends LitElement {
9
+ static styles = styles
10
+
11
+ static shadowRootOptions = {
12
+ ...LitElement.shadowRootOptions,
13
+ delegatesFocus: true,
14
+ }
15
+
16
+ static properties = {
17
+ value: { type: String },
18
+ }
19
+
20
+ constructor() {
21
+ super()
22
+ }
23
+
24
+ render() {
25
+ return html`
26
+ <p>Hello ${this.tagName}</p>
27
+ `
28
+ }
29
+ }
30
+
31
+ export function define[Name]Elements() {
32
+ defineElement("[name]", [Namespace][Name])
33
+ }
@@ -0,0 +1,11 @@
1
+ :host,
2
+ :host * {
3
+ box-sizing: border-box;
4
+ }
5
+
6
+ :host {
7
+ --[name]-font-regular: var(--leu-font-regular);
8
+ --[name]-font-black: var(--leu-font-black);
9
+
10
+ font-family: var(--chip-font-regular);
11
+ }
@@ -0,0 +1,3 @@
1
+ import { define[Name]Elements } from "./[Name].js"
2
+
3
+ define[Name]Elements()
@@ -0,0 +1,13 @@
1
+ import { html } from "lit"
2
+ import "../[namespace]-[name].js"
3
+
4
+ export default {
5
+ title: "[Name]",
6
+ component: "[namespace]-[name]",
7
+ }
8
+
9
+ function Template({}) {
10
+ return html` <[namespace]-[name] /> `
11
+ }
12
+
13
+ export const Regular = Template.bind({})
@@ -0,0 +1,22 @@
1
+ import { html } from "lit"
2
+ import { fixture, expect } from "@open-wc/testing"
3
+
4
+ import "../[namespace]-[name].js"
5
+
6
+ async function defaultFixture() {
7
+ return fixture(html` <[namespace]-[name] /> `)
8
+ }
9
+
10
+ describe("[Namespace][Name]", () => {
11
+ it("is a defined element", async () => {
12
+ const el = await customElements.get("[namespace]-[name]")
13
+
14
+ await expect(el).not.to.be.undefined
15
+ })
16
+
17
+ it("passes the a11y audit", async () => {
18
+ const el = await defaultFixture()
19
+
20
+ await expect(el).shadowDom.to.be.accessible()
21
+ })
22
+ })
@@ -0,0 +1,150 @@
1
+ import { html, nothing, LitElement } from "lit"
2
+ import { classMap } from "lit/directives/class-map.js"
3
+ import { Icon } from "../icon/icon.js"
4
+ import { defineElement } from "../../lib/defineElement.js"
5
+
6
+ import styles from "./button.css"
7
+
8
+ /*
9
+ Design: https://www.figma.com/file/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?type=design&node-id=4-1444&mode=design&t=xu5Vii8jXKKCKDez-0
10
+ Live Demo: zh.ch
11
+ */
12
+
13
+ const BUTTON_VARIANTS = ["primary", "secondary", "ghost"]
14
+ Object.freeze(BUTTON_VARIANTS)
15
+ export { BUTTON_VARIANTS }
16
+
17
+ const BUTTON_SIZES = ["normal", "small"]
18
+ Object.freeze(BUTTON_SIZES)
19
+ export { BUTTON_SIZES }
20
+
21
+ const BUTTON_TYPES = ["button", "submit", "reset"]
22
+ Object.freeze(BUTTON_TYPES)
23
+ export { BUTTON_TYPES }
24
+
25
+ export const BUTTON_EXPANDED_OPTIONS = ["open", "closed"]
26
+ Object.freeze(BUTTON_EXPANDED_OPTIONS)
27
+
28
+ /**
29
+ * @tagname leu-button
30
+ */
31
+ export class LeuButton extends LitElement {
32
+ static styles = styles
33
+
34
+ /**
35
+ * @internal
36
+ */
37
+ static shadowRootOptions = {
38
+ ...LitElement.shadowRootOptions,
39
+ delegatesFocus: true,
40
+ }
41
+
42
+ static properties = {
43
+ label: { type: String },
44
+ icon: { type: String },
45
+ iconAfter: { type: String },
46
+ size: { type: String },
47
+ variant: { type: String },
48
+ type: { type: String },
49
+
50
+ disabled: { type: Boolean },
51
+ round: { type: Boolean },
52
+ active: { type: Boolean },
53
+ inverted: { type: Boolean },
54
+ expanded: { type: String },
55
+ fluid: { type: Boolean },
56
+ }
57
+
58
+ constructor() {
59
+ super()
60
+ /** @type {string} */
61
+ this.label = null
62
+ /** @type {string} */
63
+ this.icon = null
64
+ /** @type {string} - Only taken into account if Label and no Icon is set */
65
+ this.iconAfter = null
66
+ /** @type {string} */
67
+ this.size = "normal"
68
+ /** @type {string} */
69
+ this.variant = "primary"
70
+ /** @type {string} */
71
+ this.type = "button"
72
+
73
+ /** @type {boolean} */
74
+ this.disabled = false
75
+ /** @type {boolean} - Only taken into account if no Label and an Icon is set */
76
+ this.round = false
77
+ /** @type {boolean} */
78
+ this.active = false
79
+ /** @type {boolean} - will be used on dark Background */
80
+ this.inverted = false
81
+
82
+ /** @type {boolean} - Alters the shape of the button to be full width of its parent container */
83
+ this.fluid = false
84
+
85
+ /**
86
+ * Only taken into account if variant is "ghost"
87
+ * @type {("open" | "closed" | undefined)}
88
+ */
89
+ this.expanded = undefined
90
+ }
91
+
92
+ getIconSize() {
93
+ return this.size === "small" || this.variant === "ghost" ? 16 : 24
94
+ }
95
+
96
+ renderIconBefore() {
97
+ if (this.icon) {
98
+ return html`<div class="icon-wrapper icon-wrapper--before">
99
+ ${Icon(this.icon, this.getIconSize())}
100
+ </div>`
101
+ }
102
+
103
+ return nothing
104
+ }
105
+
106
+ renderIconAfter() {
107
+ if (this.iconAfter && this.label && !this.icon) {
108
+ return html`<div class="icon-wrapper icon-wrapper--after">
109
+ ${Icon(this.iconAfter, this.getIconSize())}
110
+ </div>`
111
+ }
112
+
113
+ return nothing
114
+ }
115
+
116
+ renderExpandingIcon() {
117
+ if (typeof this.expanded !== "undefined" && this.variant === "ghost") {
118
+ return html`<div class="icon-wrapper icon-wrapper--expanded">
119
+ ${Icon("angleDropDown", 24)}
120
+ </div>`
121
+ }
122
+
123
+ return nothing
124
+ }
125
+
126
+ render() {
127
+ const cssClasses = {
128
+ icon: !this.label && this.icon && !this.iconAfter,
129
+ round: !this.label && this.icon && !this.iconAfter && this.round,
130
+ active: this.active,
131
+ inverted: this.inverted,
132
+ [this.variant]: true,
133
+ [this.size]: true,
134
+ }
135
+ return html`
136
+ <button
137
+ class=${classMap(cssClasses)}
138
+ ?disabled=${this.disabled}
139
+ type=${this.type}
140
+ >
141
+ ${this.renderIconBefore()} ${this.label} ${this.renderIconAfter()}
142
+ ${this.renderExpandingIcon()}
143
+ </button>
144
+ `
145
+ }
146
+ }
147
+
148
+ export function defineButtonElements() {
149
+ defineElement("button", LeuButton)
150
+ }
@@ -0,0 +1,232 @@
1
+ :host {
2
+ display: inline-block;
3
+ }
4
+
5
+ button {
6
+ font-family: var(--leu-font-black);
7
+ text-align: center;
8
+ appearance: none;
9
+ transition: background 0.1s ease;
10
+ cursor: pointer;
11
+ border: 1px solid transparent;
12
+ border-radius: 2px;
13
+ display: flex;
14
+ align-items: center;
15
+ column-gap: 8px;
16
+ }
17
+
18
+ button.round {
19
+ border-radius: 50%;
20
+ }
21
+
22
+ button:disabled {
23
+ cursor: not-allowed;
24
+ }
25
+
26
+ button:focus-visible {
27
+ border: 1px solid var(--leu-color-black-0);
28
+ outline: 2px solid var(--leu-color-func-cyan);
29
+ }
30
+
31
+ button.inverted:focus-visible {
32
+ border: 1px solid var(--leu-color-black-100);
33
+ outline: 2px solid var(--leu-color-black-0);
34
+ }
35
+
36
+ :host([fluid]) button {
37
+ width: 100%;
38
+ justify-content: center;
39
+ }
40
+
41
+ /* size - normal */
42
+ button.normal {
43
+ padding: 12px 24px;
44
+ font-size: 16px;
45
+ line-height: 24px;
46
+ }
47
+
48
+ button.normal.icon {
49
+ padding: 12px;
50
+ }
51
+
52
+ /* size - small */
53
+ button.small {
54
+ padding: 6px 24px;
55
+ font-size: 14px;
56
+ line-height: 20px;
57
+ }
58
+
59
+ button.small.icon {
60
+ padding: 8px;
61
+ }
62
+
63
+ /* primary */
64
+ button.primary {
65
+ color: var(--leu-color-black-0);
66
+ background: var(--leu-color-black-100);
67
+ }
68
+
69
+ button.primary:hover {
70
+ color: var(--leu-color-black-0);
71
+ background: var(--leu-color-black-transp-80);
72
+ }
73
+
74
+ button.primary.active {
75
+ color: var(--leu-color-black-0);
76
+ background: var(--leu-color-black-100);
77
+ }
78
+
79
+ button.primary:disabled {
80
+ color: var(--leu-color-black-0);
81
+ background: var(--leu-color-black-transp-20);
82
+ }
83
+
84
+ /* secondary */
85
+ button.secondary {
86
+ color: var(--leu-color-black-transp-60);
87
+ background: var(--leu-color-black-transp-10);
88
+ }
89
+
90
+ button.secondary:hover {
91
+ color: var(--leu-color-black-100);
92
+ background: var(--leu-color-black-transp-20);
93
+ }
94
+
95
+ button.secondary.active {
96
+ color: var(--leu-color-black-0);
97
+ background: var(--leu-color-black-100);
98
+ }
99
+
100
+ button.secondary:disabled {
101
+ color: var(--leu-color-black-transp-20);
102
+ background: var(--leu-color-black-transp-5);
103
+ }
104
+
105
+ /* ghost */
106
+ button.ghost {
107
+ background: transparent;
108
+ padding: 0 0.5rem;
109
+ color: var(--leu-color-black-60);
110
+ font-family: var(--leu-font-regular);
111
+ }
112
+
113
+ button.ghost:hover {
114
+ color: var(--leu-color-black-100);
115
+ }
116
+
117
+ button.ghost.active {
118
+ color: var(--leu-color-black-100);
119
+ }
120
+
121
+ button.ghost:disabled {
122
+ color: var(--leu-color-black-20);
123
+ }
124
+
125
+ /* primary + inverted */
126
+ button.primary.inverted {
127
+ color: var(--leu-color-black-100);
128
+ background: var(--leu-color-black-0);
129
+ }
130
+
131
+ button.primary.inverted:hover {
132
+ color: var(--leu-color-black-100);
133
+ background: var(--leu-color-white-transp-70);
134
+ }
135
+
136
+ button.primary.inverted.active {
137
+ color: var(--leu-color-black-0);
138
+ background: var(--leu-color-black-100);
139
+ }
140
+
141
+ button.primary.inverted:disabled {
142
+ color: var(--leu-color-black-40);
143
+ background: var(--leu-color-white-transp-70);
144
+ }
145
+
146
+ /* secondary + inverted */
147
+ button.secondary.inverted {
148
+ color: var(--leu-color-black-0);
149
+ background: var(--leu-color-black-transp-20);
150
+ }
151
+
152
+ button.secondary.inverted:hover {
153
+ color: var(--leu-color-black-0);
154
+ background: var(--leu-color-black-transp-40);
155
+ }
156
+
157
+ button.secondary.inverted.active {
158
+ color: var(--leu-color-black-100);
159
+ background: var(--leu-color-black-0);
160
+ }
161
+
162
+ button.secondary.inverted:disabled {
163
+ color: var(--leu-color-white-transp-70);
164
+ background: var(--leu-color-black-transp-10);
165
+ }
166
+
167
+ /* ghost + inverted */
168
+ button.ghost.inverted {
169
+ color: var(--leu-color-black-0);
170
+ }
171
+
172
+ button.ghost.inverted:hover {
173
+ color: var(--leu-color-white-transp-70);
174
+ }
175
+
176
+ button.ghost.inverted.active {
177
+ color: var(--leu-color-black-0);
178
+ }
179
+
180
+ button.ghost.inverted:disabled {
181
+ color: var(--leu-color-black-20);
182
+ }
183
+
184
+ /* icon-wrapper */
185
+ .icon-wrapper svg {
186
+ display: block;
187
+ }
188
+
189
+ .ghost :is(.icon-wrapper--before, .icon-wrapper--after) {
190
+ padding: 0.5rem;
191
+ border-radius: 50%;
192
+ background: var(--leu-color-black-transp-10);
193
+ }
194
+
195
+ .ghost.active :is(.icon-wrapper--before, .icon-wrapper--after) {
196
+ background: var(--leu-color-black-100);
197
+ color: var(--leu-color-black-0);
198
+ }
199
+
200
+ .ghost:disabled :is(.icon-wrapper--before, .icon-wrapper--after) {
201
+ background: var(--leu-color-black-transp-5);
202
+ }
203
+
204
+ /* inverted */
205
+
206
+ .ghost.inverted :is(.icon-wrapper--before, .icon-wrapper--after) {
207
+ background: var(--leu-color-black-transp-20);
208
+ }
209
+
210
+ .ghost.inverted:hover :is(.icon-wrapper--before, .icon-wrapper--after) {
211
+ background: var(--leu-color-black-transp-40);
212
+ color: var(--leu-color-black-0);
213
+ }
214
+
215
+ .ghost.inverted:disabled :is(.icon-wrapper--before, .icon-wrapper--after) {
216
+ background: var(--leu-color-black-transp-20);
217
+ color: var(--leu-color-white-transp-70);
218
+ }
219
+
220
+ .ghost.active.inverted :is(.icon-wrapper--before, .icon-wrapper--after) {
221
+ background: var(--leu-color-black-0);
222
+ color: var(--leu-color-black-100);
223
+ }
224
+
225
+ /* Expanded icon */
226
+ .icon-wrapper--expanded {
227
+ transition: transform 0.1s ease;
228
+ }
229
+
230
+ :host([expanded="open"]) .icon-wrapper--expanded {
231
+ transform: rotate(180deg);
232
+ }
@@ -0,0 +1,3 @@
1
+ import { defineButtonElements } from "./Button.js"
2
+
3
+ defineButtonElements()