@statistikzh/leu 0.28.1 → 0.28.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Accordion-CwkI7sfx.js → Accordion-EwJ1WHFd.js} +1 -1
- package/dist/Accordion.js +2 -2
- package/dist/{Button-DcuvEVkC.d.ts → Button-BywuwtT2.d.ts} +0 -1
- package/dist/{Button-D1aYnunQ.js → Button-q4GeKj_3.js} +3 -4
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +4 -4
- package/dist/{ButtonGroup-CqThYjzX.js → ButtonGroup-BeU3Prei.js} +2 -2
- package/dist/ButtonGroup.js +5 -5
- package/dist/{ChartWrapper-BjVT4x-H.js → ChartWrapper-Bdb0_n2z.js} +2 -2
- package/dist/ChartWrapper.js +3 -3
- package/dist/{Checkbox-HxYqp2w4.js → Checkbox-BC0gAuaH.js} +2 -2
- package/dist/Checkbox.js +3 -3
- package/dist/{CheckboxGroup-DYws2rwt.js → CheckboxGroup-CiOgcwmo.js} +2 -2
- package/dist/CheckboxGroup.js +4 -4
- package/dist/{Chip-gKxD6IaZ.js → Chip-CYlPzmTG.js} +1 -1
- package/dist/Chip.js +2 -2
- package/dist/{ChipGroup-ZvBzX_wd.js → ChipGroup-3IMW_Mp7.js} +1 -1
- package/dist/ChipGroup.js +3 -3
- package/dist/ChipLink.js +2 -2
- package/dist/ChipRemovable.js +3 -3
- package/dist/ChipSelectable.js +2 -2
- package/dist/{Dialog-BYpzTprV.js → Dialog-DCl5qSXY.js} +3 -4
- package/dist/Dialog.js +3 -3
- package/dist/{Dropdown-C4CgE4E-.js → Dropdown-COmpmOev.js} +5 -5
- package/dist/Dropdown.d.ts +1 -1
- package/dist/Dropdown.js +8 -8
- package/dist/{FileInput-nsnSQCaU.js → FileInput-DXjoqKB4.js} +4 -4
- package/dist/FileInput.d.ts +1 -1
- package/dist/FileInput.js +6 -6
- package/dist/{Icon-D8HTPEFH.js → Icon-Bmk7lLWY.js} +1 -1
- package/dist/Icon.js +2 -2
- package/dist/{Input-OrILqlax.js → Input-B9FwAPKO.js} +2 -2
- package/dist/Input.js +3 -3
- package/dist/{LeuElement-C_lcHzQI.js → LeuElement-CQJQi8TB.js} +1 -1
- package/dist/{Menu-CFLCnI34.js → Menu-bWCAn0rT.js} +2 -2
- package/dist/Menu.js +4 -4
- package/dist/{MenuItem-ICjLCGim.js → MenuItem-CzCFZi8o.js} +2 -2
- package/dist/MenuItem.js +3 -3
- package/dist/{Message-Dw5D_0i1.js → Message-DMaM9ukF.js} +2 -2
- package/dist/Message.js +3 -3
- package/dist/{Pagination-D1tP5FrM.js → Pagination-870u3UgQ.js} +4 -4
- package/dist/{Pagination-9eZ8WMvR.d.ts → Pagination-B-mTHZiw.d.ts} +1 -1
- package/dist/Pagination.d.ts +1 -1
- package/dist/Pagination.js +6 -6
- package/dist/{Placeholder-CnGzCZ5-.js → Placeholder-DvvzGB1p.js} +1 -1
- package/dist/Placeholder.js +2 -2
- package/dist/{Popup-BiN_tZDN.js → Popup-BpG_7twr.js} +1 -1
- package/dist/Popup.js +2 -2
- package/dist/{ProgressBar-BfJo_KyU.js → ProgressBar-BkskTLWK.js} +1 -1
- package/dist/ProgressBar.js +2 -2
- package/dist/{Radio-CV7vuQUj.js → Radio-BS7UUhR3.js} +1 -1
- package/dist/Radio.js +2 -2
- package/dist/{RadioGroup-C3XWSScc.js → RadioGroup-Cpo9kAjB.js} +2 -2
- package/dist/RadioGroup.js +3 -3
- package/dist/{Range-C8RVrIM9.js → Range-Dh0p5UWA.js} +1 -1
- package/dist/Range.js +2 -2
- package/dist/{ScrollTop-B_TJ_k4m.js → ScrollTop-CtPidICZ.js} +3 -3
- package/dist/ScrollTop.d.ts +1 -1
- package/dist/ScrollTop.js +5 -5
- package/dist/{Select-CbPTrL3G.js → Select-W1KqDOgx.js} +7 -7
- package/dist/Select.d.ts +1 -1
- package/dist/Select.js +9 -9
- package/dist/{Spinner-ChKJQJTN.js → Spinner-CmAYIFws.js} +1 -1
- package/dist/Spinner.js +2 -2
- package/dist/{Tab-BJbzY1xd.js → Tab-7Cww5fSx.js} +1 -1
- package/dist/Tab.js +2 -2
- package/dist/{TabGroup-BIaCHrKR.js → TabGroup-tURfCrlw.js} +3 -3
- package/dist/TabGroup.js +4 -4
- package/dist/{TabPanel-CTyw410b.js → TabPanel-DIZcmcMV.js} +1 -1
- package/dist/TabPanel.js +2 -2
- package/dist/{Table-D3QmePJd.js → Table-BVYjYXP9.js} +3 -3
- package/dist/Table.d.ts +1 -1
- package/dist/Table.js +7 -7
- package/dist/{Tag-nUnWtHYy.js → Tag-x0KmEDEa.js} +1 -1
- package/dist/Tag.js +2 -2
- package/dist/{VisuallyHidden-DF2q9pTa.js → VisuallyHidden-CXRfGsaZ.js} +1 -1
- package/dist/VisuallyHidden.js +2 -2
- package/dist/custom-elements.json +6445 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +30 -30
- package/dist/leu-accordion.js +2 -2
- package/dist/leu-button-group.js +5 -5
- package/dist/leu-button.d.ts +1 -1
- package/dist/leu-button.js +4 -4
- package/dist/leu-chart-wrapper.js +3 -3
- package/dist/leu-checkbox-group.js +4 -4
- package/dist/leu-checkbox.js +3 -3
- package/dist/leu-chip-group.js +3 -3
- package/dist/leu-chip-link.js +2 -2
- package/dist/leu-chip-removable.js +3 -3
- package/dist/leu-chip-selectable.js +2 -2
- package/dist/leu-dialog.js +3 -3
- package/dist/leu-dropdown.js +8 -8
- package/dist/leu-file-input.js +6 -6
- package/dist/leu-icon.js +2 -2
- package/dist/leu-input.js +3 -3
- package/dist/leu-menu-item.js +3 -3
- package/dist/leu-menu.js +4 -4
- package/dist/leu-message.js +3 -3
- package/dist/leu-pagination.d.ts +1 -1
- package/dist/leu-pagination.js +6 -6
- package/dist/leu-placeholder.js +2 -2
- package/dist/leu-popup.js +2 -2
- package/dist/leu-progress-bar.js +2 -2
- package/dist/leu-radio-group.js +3 -3
- package/dist/leu-radio.js +2 -2
- package/dist/leu-range.js +2 -2
- package/dist/leu-scroll-top.js +5 -5
- package/dist/leu-select.js +9 -9
- package/dist/leu-spinner.js +2 -2
- package/dist/leu-tab-group.js +4 -4
- package/dist/leu-tab-panel.js +2 -2
- package/dist/leu-tab.js +2 -2
- package/dist/leu-table.js +7 -7
- package/dist/leu-tag.js +2 -2
- package/dist/leu-visually-hidden.js +2 -2
- package/dist/vscode.html-custom-data.json +11 -11
- package/dist/vue/index.d.ts +20 -20
- package/dist/web-types.json +28 -28
- package/package.json +4 -1
- package/.editorconfig +0 -29
- package/.github/workflows/ci.yml +0 -81
- package/.github/workflows/deploy-github-pages.yaml +0 -34
- package/.github/workflows/publish.yml +0 -28
- package/.github/workflows/release-please.yml +0 -19
- package/.husky/commit-msg +0 -1
- package/.husky/pre-commit +0 -1
- package/.nvmrc +0 -1
- package/.prettierignore +0 -2
- package/.release-please-manifest.json +0 -3
- package/.storybook/main.ts +0 -34
- package/.storybook/manager-head.html +0 -1
- package/.storybook/manager.ts +0 -6
- package/.storybook/preview.ts +0 -96
- package/.storybook/static/fonts/Inter-Black.woff2 +0 -0
- package/.storybook/static/fonts/Inter-Regular.woff2 +0 -0
- package/.storybook/static/fonts.css +0 -11
- package/.storybook/static/global.css +0 -5
- package/.storybook/static/logo.svg +0 -19
- package/.storybook/theme.ts +0 -8
- package/AGENTS.md +0 -162
- package/CHANGELOG.md +0 -601
- package/CODE_OF_CONDUCT.md +0 -128
- package/CONTRIBUTING.md +0 -42
- package/commitlint.config.cjs +0 -1
- package/custom-elements-manifest.config.js +0 -46
- package/eslint.config.mjs +0 -79
- package/postcss.config.cjs +0 -16
- package/release-please-config.json +0 -9
- package/scripts/generate-component/generate.js +0 -167
- package/scripts/generate-component/templates/[Name].ts +0 -31
- package/scripts/generate-component/templates/[name].css +0 -6
- package/scripts/generate-component/templates/[namespace]-[name].ts +0 -11
- package/scripts/generate-component/templates/stories/[name].stories.ts +0 -26
- package/scripts/generate-component/templates/test/[name].test.ts +0 -23
- package/scripts/postcss-leu-font-styles.cjs +0 -154
- package/src/components/accordion/Accordion.ts +0 -108
- package/src/components/accordion/accordion.css +0 -150
- package/src/components/accordion/leu-accordion.ts +0 -11
- package/src/components/accordion/stories/accordion.stories.ts +0 -62
- package/src/components/accordion/test/accordion.test.ts +0 -118
- package/src/components/button/Button.ts +0 -286
- package/src/components/button/button.css +0 -317
- package/src/components/button/leu-button.ts +0 -11
- package/src/components/button/stories/button.stories.ts +0 -366
- package/src/components/button/test/button.test.ts +0 -417
- package/src/components/button-group/ButtonGroup.ts +0 -97
- package/src/components/button-group/button-group.css +0 -5
- package/src/components/button-group/leu-button-group.ts +0 -11
- package/src/components/button-group/stories/button-group.stories.ts +0 -54
- package/src/components/button-group/test/button-group.test.ts +0 -105
- package/src/components/chart-wrapper/ChartWrapper.ts +0 -78
- package/src/components/chart-wrapper/chart-wrapper.css +0 -87
- package/src/components/chart-wrapper/leu-chart-wrapper.ts +0 -11
- package/src/components/chart-wrapper/stories/chart-wrapper.stories.ts +0 -58
- package/src/components/chart-wrapper/test/chart-wrapper.test.ts +0 -77
- package/src/components/checkbox/Checkbox.ts +0 -129
- package/src/components/checkbox/CheckboxGroup.ts +0 -57
- package/src/components/checkbox/checkbox-group.css +0 -29
- package/src/components/checkbox/checkbox.css +0 -81
- package/src/components/checkbox/leu-checkbox-group.ts +0 -11
- package/src/components/checkbox/leu-checkbox.ts +0 -11
- package/src/components/checkbox/stories/checkbox-group.stories.ts +0 -59
- package/src/components/checkbox/stories/checkbox.stories.ts +0 -72
- package/src/components/checkbox/test/checkbox-group.test.ts +0 -109
- package/src/components/checkbox/test/checkbox.test.ts +0 -247
- package/src/components/chip/Chip.ts +0 -19
- package/src/components/chip/ChipGroup.ts +0 -122
- package/src/components/chip/ChipLink.ts +0 -24
- package/src/components/chip/ChipRemovable.ts +0 -45
- package/src/components/chip/ChipSelectable.ts +0 -80
- package/src/components/chip/chip-group.css +0 -15
- package/src/components/chip/chip.css +0 -139
- package/src/components/chip/exports.ts +0 -4
- package/src/components/chip/leu-chip-group.ts +0 -11
- package/src/components/chip/leu-chip-link.ts +0 -11
- package/src/components/chip/leu-chip-removable.ts +0 -11
- package/src/components/chip/leu-chip-selectable.ts +0 -11
- package/src/components/chip/stories/chip-group.stories.ts +0 -159
- package/src/components/chip/stories/chip-link.stories.ts +0 -45
- package/src/components/chip/stories/chip-removable.stories.ts +0 -42
- package/src/components/chip/stories/chip-selectable.stories.ts +0 -54
- package/src/components/chip/test/chip-group.test.ts +0 -171
- package/src/components/chip/test/chip-link.test.ts +0 -54
- package/src/components/chip/test/chip-removable.test.ts +0 -105
- package/src/components/chip/test/chip-selectable.test.ts +0 -101
- package/src/components/chip/test/chip.test.ts +0 -22
- package/src/components/dialog/Dialog.ts +0 -86
- package/src/components/dialog/dialog.css +0 -157
- package/src/components/dialog/leu-dialog.ts +0 -11
- package/src/components/dialog/stories/dialog.stories.ts +0 -142
- package/src/components/dialog/test/dialog.test.ts +0 -85
- package/src/components/dropdown/Dropdown.ts +0 -152
- package/src/components/dropdown/dropdown.css +0 -16
- package/src/components/dropdown/leu-dropdown.ts +0 -11
- package/src/components/dropdown/stories/dropdown.stories.ts +0 -58
- package/src/components/dropdown/test/dropdown.test.ts +0 -59
- package/src/components/file-input/FileInput.ts +0 -324
- package/src/components/file-input/file-input.css +0 -118
- package/src/components/file-input/leu-file-input.ts +0 -11
- package/src/components/file-input/stories/file-input.stories.ts +0 -45
- package/src/components/file-input/test/file-input.test.ts +0 -62
- package/src/components/icon/Icon.ts +0 -47
- package/src/components/icon/icon.css +0 -10
- package/src/components/icon/leu-icon.ts +0 -11
- package/src/components/icon/paths.ts +0 -219
- package/src/components/icon/stories/icon.stories.ts +0 -79
- package/src/components/icon/test/icon.test.ts +0 -50
- package/src/components/input/Input.ts +0 -469
- package/src/components/input/input.css +0 -238
- package/src/components/input/leu-input.ts +0 -11
- package/src/components/input/stories/input.stories.ts +0 -204
- package/src/components/input/test/input.test.ts +0 -603
- package/src/components/menu/Menu.ts +0 -149
- package/src/components/menu/MenuItem.ts +0 -168
- package/src/components/menu/leu-menu-item.ts +0 -11
- package/src/components/menu/leu-menu.ts +0 -11
- package/src/components/menu/menu-item.css +0 -77
- package/src/components/menu/menu.css +0 -19
- package/src/components/menu/stories/menu-item.stories.ts +0 -81
- package/src/components/menu/stories/menu.stories.ts +0 -54
- package/src/components/menu/test/menu-item.test.ts +0 -210
- package/src/components/menu/test/menu.test.ts +0 -125
- package/src/components/message/Message.ts +0 -118
- package/src/components/message/leu-message.ts +0 -11
- package/src/components/message/message.css +0 -163
- package/src/components/message/stories/message.mdx +0 -76
- package/src/components/message/stories/message.stories.ts +0 -149
- package/src/components/message/test/message.test.ts +0 -96
- package/src/components/pagination/Pagination.ts +0 -192
- package/src/components/pagination/leu-pagination.ts +0 -11
- package/src/components/pagination/pagination.css +0 -54
- package/src/components/pagination/stories/pagination.stories.ts +0 -115
- package/src/components/pagination/test/pagination.test.ts +0 -210
- package/src/components/placeholder/Placeholder.ts +0 -33
- package/src/components/placeholder/leu-placeholder.ts +0 -11
- package/src/components/placeholder/placeholder.css +0 -59
- package/src/components/placeholder/stories/placeholder.stories.ts +0 -34
- package/src/components/placeholder/test/placeholder.test.ts +0 -31
- package/src/components/popup/Popup.ts +0 -264
- package/src/components/popup/leu-popup.ts +0 -11
- package/src/components/popup/popup.css +0 -24
- package/src/components/popup/stories/popup.stories.ts +0 -117
- package/src/components/popup/test/popup.test.ts +0 -90
- package/src/components/progress-bar/ProgressBar.ts +0 -52
- package/src/components/progress-bar/leu-progress-bar.ts +0 -11
- package/src/components/progress-bar/progress-bar.css +0 -97
- package/src/components/progress-bar/stories/progress-bar.stories.ts +0 -39
- package/src/components/progress-bar/test/progress-bar.test.ts +0 -61
- package/src/components/radio/Radio.ts +0 -59
- package/src/components/radio/RadioGroup.ts +0 -181
- package/src/components/radio/leu-radio-group.ts +0 -11
- package/src/components/radio/leu-radio.ts +0 -11
- package/src/components/radio/radio-group.css +0 -29
- package/src/components/radio/radio.css +0 -76
- package/src/components/radio/stories/radio-group.stories.ts +0 -54
- package/src/components/radio/stories/radio.stories.ts +0 -55
- package/src/components/radio/test/radio-group.test.ts +0 -83
- package/src/components/radio/test/radio.test.ts +0 -119
- package/src/components/range/Range.ts +0 -400
- package/src/components/range/leu-range.ts +0 -11
- package/src/components/range/range.css +0 -227
- package/src/components/range/stories/range.stories.ts +0 -185
- package/src/components/range/test/range.test.ts +0 -228
- package/src/components/scroll-top/ScrollTop.ts +0 -91
- package/src/components/scroll-top/leu-scroll-top.ts +0 -11
- package/src/components/scroll-top/scroll-top.css +0 -50
- package/src/components/scroll-top/stories/scroll-top.stories.ts +0 -217
- package/src/components/scroll-top/test/scroll-top.test.ts +0 -22
- package/src/components/select/Select.ts +0 -570
- package/src/components/select/leu-select.ts +0 -11
- package/src/components/select/select.css +0 -222
- package/src/components/select/stories/select.stories.ts +0 -173
- package/src/components/select/test/fixtures.ts +0 -162
- package/src/components/select/test/select.test.ts +0 -937
- package/src/components/spinner/Spinner.ts +0 -31
- package/src/components/spinner/leu-spinner.ts +0 -11
- package/src/components/spinner/spinner.css +0 -20
- package/src/components/spinner/stories/spinner.stories.ts +0 -29
- package/src/components/spinner/test/spinner.test.ts +0 -30
- package/src/components/tab/Tab.ts +0 -72
- package/src/components/tab/TabGroup.ts +0 -267
- package/src/components/tab/TabPanel.ts +0 -59
- package/src/components/tab/leu-tab-group.ts +0 -11
- package/src/components/tab/leu-tab-panel.ts +0 -11
- package/src/components/tab/leu-tab.ts +0 -11
- package/src/components/tab/stories/tab.stories.ts +0 -97
- package/src/components/tab/tab-group.css +0 -63
- package/src/components/tab/tab-panel.css +0 -10
- package/src/components/tab/tab.css +0 -54
- package/src/components/tab/test/tab-group.test.ts +0 -426
- package/src/components/tab/test/tab-panel.test.ts +0 -102
- package/src/components/tab/test/tab.test.ts +0 -139
- package/src/components/table/Table.ts +0 -253
- package/src/components/table/leu-table.ts +0 -11
- package/src/components/table/stories/table.stories.ts +0 -131
- package/src/components/table/table.css +0 -112
- package/src/components/table/test/table.test.ts +0 -37
- package/src/components/tag/Tag.ts +0 -28
- package/src/components/tag/leu-tag.ts +0 -11
- package/src/components/tag/stories/tag.stories.ts +0 -107
- package/src/components/tag/tag.css +0 -42
- package/src/components/tag/test/tag.test.ts +0 -28
- package/src/components/visually-hidden/VisuallyHidden.ts +0 -16
- package/src/components/visually-hidden/leu-visually-hidden.ts +0 -11
- package/src/components/visually-hidden/stories/visually-hidden.stories.ts +0 -22
- package/src/components/visually-hidden/test/visually-hidden.test.ts +0 -34
- package/src/components/visually-hidden/visually-hidden.css +0 -10
- package/src/docs/contributing.mdx +0 -154
- package/src/docs/installation.mdx +0 -35
- package/src/docs/theme.mdx +0 -400
- package/src/docs/usage.mdx +0 -73
- package/src/global.d.ts +0 -11
- package/src/index.ts +0 -29
- package/src/lib/LeuElement.ts +0 -43
- package/src/lib/a11y.ts +0 -26
- package/src/lib/hasSlotController.ts +0 -74
- package/src/lib/mixins/FormAssociatedMixin.ts +0 -115
- package/src/lib/styleMap.ts +0 -139
- package/src/lib/utils.ts +0 -45
- package/src/styles/common-styles.css +0 -14
- package/src/styles/custom-media.css +0 -6
- package/src/styles/font-definitions.json +0 -210
- package/src/styles/style.stories.ts +0 -64
- package/src/styles/theme.css +0 -90
- package/stat_zh.png +0 -0
- package/stylelint.config.mjs +0 -23
- package/tsconfig.build.json +0 -24
- package/tsconfig.json +0 -14
- package/tsdown.config.ts +0 -35
- package/web-test-runner.config.mjs +0 -102
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { html } from "lit"
|
|
2
|
-
import { fixture, expect, oneEvent } from "@open-wc/testing"
|
|
3
|
-
|
|
4
|
-
import "../leu-tab.js"
|
|
5
|
-
import type { LeuTab } from "../Tab.js"
|
|
6
|
-
|
|
7
|
-
async function defaultFixture() {
|
|
8
|
-
return fixture<LeuTab>(html`<leu-tab name="test">Test</leu-tab>`)
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
async function activeFixture() {
|
|
12
|
-
return fixture<LeuTab>(html`<leu-tab name="test" active>Test</leu-tab>`)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
describe("LeuTab", () => {
|
|
16
|
-
it("is a defined element", () => {
|
|
17
|
-
expect(customElements.get("leu-tab")).not.to.be.undefined
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
it("passes the a11y audit inside a tablist", async () => {
|
|
21
|
-
const wrapper = await fixture(html`
|
|
22
|
-
<div role="tablist">
|
|
23
|
-
<leu-tab name="test" active>Test</leu-tab>
|
|
24
|
-
</div>
|
|
25
|
-
`)
|
|
26
|
-
await expect(wrapper).to.be.accessible()
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
it("sets role=tab on the host element", async () => {
|
|
30
|
-
const el = await defaultFixture()
|
|
31
|
-
expect(el.getAttribute("role")).to.equal("tab")
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it("auto-generates an id when none is provided", async () => {
|
|
35
|
-
const el = await defaultFixture()
|
|
36
|
-
expect(el.id).to.match(/^leu-tab-\d+$/)
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
it("keeps a user-provided id", async () => {
|
|
40
|
-
const el = await fixture<LeuTab>(
|
|
41
|
-
html`<leu-tab id="my-custom-tab" name="test">Test</leu-tab>`,
|
|
42
|
-
)
|
|
43
|
-
expect(el.id).to.equal("my-custom-tab")
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
it("generates distinct ids for separate instances", async () => {
|
|
47
|
-
const el1 = await fixture<LeuTab>(html`<leu-tab name="a">A</leu-tab>`)
|
|
48
|
-
const el2 = await fixture<LeuTab>(html`<leu-tab name="b">B</leu-tab>`)
|
|
49
|
-
expect(el1.id).not.to.equal(el2.id)
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
it("has ariaSelected=false and tabIndex=-1 when inactive", async () => {
|
|
53
|
-
const el = await defaultFixture()
|
|
54
|
-
expect(el.ariaSelected).to.equal("false")
|
|
55
|
-
expect(el.tabIndex).to.equal(-1)
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
it("has ariaSelected=true and tabIndex=0 when active", async () => {
|
|
59
|
-
const el = await activeFixture()
|
|
60
|
-
expect(el.ariaSelected).to.equal("true")
|
|
61
|
-
expect(el.tabIndex).to.equal(0)
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
it("updates ariaSelected and tabIndex reactively when active changes", async () => {
|
|
65
|
-
const el = await defaultFixture()
|
|
66
|
-
|
|
67
|
-
el.active = true
|
|
68
|
-
await el.updateComplete
|
|
69
|
-
expect(el.ariaSelected).to.equal("true")
|
|
70
|
-
expect(el.tabIndex).to.equal(0)
|
|
71
|
-
|
|
72
|
-
el.active = false
|
|
73
|
-
await el.updateComplete
|
|
74
|
-
expect(el.ariaSelected).to.equal("false")
|
|
75
|
-
expect(el.tabIndex).to.equal(-1)
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
it("reflects the active property as a boolean attribute", async () => {
|
|
79
|
-
const el = await defaultFixture()
|
|
80
|
-
expect(el.hasAttribute("active")).to.be.false
|
|
81
|
-
|
|
82
|
-
el.active = true
|
|
83
|
-
await el.updateComplete
|
|
84
|
-
expect(el.hasAttribute("active")).to.be.true
|
|
85
|
-
|
|
86
|
-
el.active = false
|
|
87
|
-
await el.updateComplete
|
|
88
|
-
expect(el.hasAttribute("active")).to.be.false
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
it("reflects the name property as an attribute", async () => {
|
|
92
|
-
const el = await defaultFixture()
|
|
93
|
-
expect(el.getAttribute("name")).to.equal("test")
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
it("sets active=true when clicked", async () => {
|
|
97
|
-
const el = await defaultFixture()
|
|
98
|
-
expect(el.active).to.be.false
|
|
99
|
-
el.click()
|
|
100
|
-
expect(el.active).to.be.true
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
it("dispatches leu:tab-select with the tab name when clicked", async () => {
|
|
104
|
-
const el = await fixture<LeuTab>(
|
|
105
|
-
html`<leu-tab name="my-tab">Test</leu-tab>`,
|
|
106
|
-
)
|
|
107
|
-
setTimeout(() => el.click())
|
|
108
|
-
const event = (await oneEvent(el, "leu:tab-select")) as CustomEvent
|
|
109
|
-
expect(event.detail.name).to.equal("my-tab")
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
it("dispatches leu:tab-select as a bubbling composed event", async () => {
|
|
113
|
-
const el = await fixture<LeuTab>(
|
|
114
|
-
html`<leu-tab name="bubble-test">Test</leu-tab>`,
|
|
115
|
-
)
|
|
116
|
-
// Listen on document to verify the event crosses shadow boundaries
|
|
117
|
-
setTimeout(() => el.click())
|
|
118
|
-
const event = (await oneEvent(document, "leu:tab-select")) as CustomEvent
|
|
119
|
-
expect(event.bubbles).to.be.true
|
|
120
|
-
expect(event.composed).to.be.true
|
|
121
|
-
expect(event.detail.name).to.equal("bubble-test")
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
it("does not dispatch leu:tab-select when already active", async () => {
|
|
125
|
-
const el = await activeFixture()
|
|
126
|
-
let fired = false
|
|
127
|
-
el.addEventListener("leu:tab-select", () => {
|
|
128
|
-
fired = true
|
|
129
|
-
})
|
|
130
|
-
el.click()
|
|
131
|
-
expect(fired).to.be.false
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
it("does not toggle off when clicking an already-active tab", async () => {
|
|
135
|
-
const el = await activeFixture()
|
|
136
|
-
el.click()
|
|
137
|
-
expect(el.active).to.be.true
|
|
138
|
-
})
|
|
139
|
-
})
|
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
import { html, nothing } from "lit"
|
|
2
|
-
import { classMap } from "lit/directives/class-map.js"
|
|
3
|
-
import { createRef, ref } from "lit/directives/ref.js"
|
|
4
|
-
|
|
5
|
-
import { LeuElement } from "../../lib/LeuElement.js"
|
|
6
|
-
import { styleMap } from "../../lib/styleMap.js"
|
|
7
|
-
import { LeuIcon } from "../icon/Icon.js"
|
|
8
|
-
import { LeuPagination } from "../pagination/Pagination.js"
|
|
9
|
-
|
|
10
|
-
import styles from "./table.css?inline"
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @tagname leu-table
|
|
14
|
-
*/
|
|
15
|
-
export class LeuTable extends LeuElement {
|
|
16
|
-
static dependencies = {
|
|
17
|
-
"leu-icon": LeuIcon,
|
|
18
|
-
"leu-pagination": LeuPagination,
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
static styles = [LeuElement.styles, styles]
|
|
22
|
-
|
|
23
|
-
static properties = {
|
|
24
|
-
columns: { type: Array },
|
|
25
|
-
data: { type: Array },
|
|
26
|
-
firstColumnSticky: { type: Boolean, reflect: true },
|
|
27
|
-
itemsPerPage: { type: Number, reflect: true },
|
|
28
|
-
sortIndex: { type: Number, reflect: true },
|
|
29
|
-
sortOrderAsc: { type: Boolean, reflect: true },
|
|
30
|
-
width: { type: Number, reflect: true },
|
|
31
|
-
|
|
32
|
-
_shadowLeft: { state: true },
|
|
33
|
-
_shadowRight: { state: true },
|
|
34
|
-
_page: { state: true },
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
constructor() {
|
|
38
|
-
super()
|
|
39
|
-
/** @type {array} */
|
|
40
|
-
this.columns = []
|
|
41
|
-
/** @type {array} */
|
|
42
|
-
this.data = []
|
|
43
|
-
/** @type {boolean} */
|
|
44
|
-
this.firstColumnSticky = false
|
|
45
|
-
/** @type {number} */
|
|
46
|
-
this.itemsPerPage = null
|
|
47
|
-
/** @type {number} */
|
|
48
|
-
this.sortIndex = null
|
|
49
|
-
/** @type {boolean} */
|
|
50
|
-
this.sortOrderAsc = false
|
|
51
|
-
/** @type {number} */
|
|
52
|
-
this.width = null
|
|
53
|
-
|
|
54
|
-
/** @internal */
|
|
55
|
-
this._shadowLeft = false
|
|
56
|
-
/** @internal */
|
|
57
|
-
this._shadowRight = false
|
|
58
|
-
/** @internal */
|
|
59
|
-
this._scrollRef = createRef()
|
|
60
|
-
|
|
61
|
-
/** @internal */
|
|
62
|
-
this._page = 1
|
|
63
|
-
|
|
64
|
-
this._resizeObserver = new ResizeObserver(() => {
|
|
65
|
-
this.shadowToggle(this._scrollRef.value)
|
|
66
|
-
})
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
disconnectedCallback() {
|
|
70
|
-
this._resizeObserver.disconnect()
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
attributeChangedCallback(name, oldVal, newVal) {
|
|
74
|
-
super.attributeChangedCallback(name, oldVal, newVal)
|
|
75
|
-
|
|
76
|
-
if (name === "itemsperpage" || name === "data") {
|
|
77
|
-
this._page = 1
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
firstUpdated() {
|
|
82
|
-
this.shadowToggle(this._scrollRef.value)
|
|
83
|
-
|
|
84
|
-
this._resizeObserver.observe(this._scrollRef.value)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
shadowToggle(target) {
|
|
88
|
-
this._shadowLeft = target.scrollLeftMax > 0 && target.scrollLeft > 0
|
|
89
|
-
this._shadowRight =
|
|
90
|
-
target.scrollLeftMax > 0 && target.scrollLeft < target.scrollLeftMax
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
scrollEvent(event) {
|
|
94
|
-
this.shadowToggle(event.target)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
isOnePropNotValid() {
|
|
98
|
-
if (!this._columns) {
|
|
99
|
-
return "Der Parameter 'columns' ist erforderlich !"
|
|
100
|
-
}
|
|
101
|
-
if (!this._sortedData) {
|
|
102
|
-
return "Der Parameter 'data' ist erforderlich !"
|
|
103
|
-
}
|
|
104
|
-
return null
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
isSorted(col) {
|
|
108
|
-
return this.sortIndex === this._columns.indexOf(col)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
sortClick(col) {
|
|
112
|
-
const index = this._columns.indexOf(col)
|
|
113
|
-
if (this.sortIndex === index) {
|
|
114
|
-
this.sortOrderAsc = !this.sortOrderAsc
|
|
115
|
-
} else {
|
|
116
|
-
this.sortIndex = index
|
|
117
|
-
this.sortOrderAsc = false
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
sortArrowIcon() {
|
|
122
|
-
return html`<leu-icon
|
|
123
|
-
name=${this.sortOrderAsc ? "arrowDown" : "arrowUp"}
|
|
124
|
-
></leu-icon>`
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
get _columns() {
|
|
128
|
-
return this.columns
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
get _sortedData() {
|
|
132
|
-
if (this.sortIndex === null || this.sortIndex === undefined) {
|
|
133
|
-
return this.data
|
|
134
|
-
}
|
|
135
|
-
const col = this._columns[this.sortIndex]
|
|
136
|
-
return this.data.sort(this.sortOrderAsc ? col.sort.asc : col.sort.desc)
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
get _data() {
|
|
140
|
-
return this.itemsPerPage && this.itemsPerPage > 0
|
|
141
|
-
? this._sortedData.slice(
|
|
142
|
-
(this._page - 1) * this.itemsPerPage,
|
|
143
|
-
this._page * this.itemsPerPage,
|
|
144
|
-
)
|
|
145
|
-
: this._sortedData
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
render() {
|
|
149
|
-
const scrollClasses = {
|
|
150
|
-
scroll: true,
|
|
151
|
-
"shadow-left": this.firstColumnSticky && this._shadowLeft,
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const shadowClassesLeft = {
|
|
155
|
-
shadow: true,
|
|
156
|
-
"shadow-left": !this.firstColumnSticky && this._shadowLeft,
|
|
157
|
-
pagination: this.itemsPerPage > 0,
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const shadowClassesRight = {
|
|
161
|
-
shadow: true,
|
|
162
|
-
"shadow-right": this._shadowRight,
|
|
163
|
-
pagination: this.itemsPerPage > 0,
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
const stickyClass = {
|
|
167
|
-
sticky: this.firstColumnSticky,
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function headerStyle(col) {
|
|
171
|
-
if (col.headerStyle) {
|
|
172
|
-
return styleMap({
|
|
173
|
-
...col.headerStyle(),
|
|
174
|
-
textAlign: col.align === "right" ? "right" : undefined,
|
|
175
|
-
})
|
|
176
|
-
}
|
|
177
|
-
return col.align === "right" ? styleMap({ textAlign: "right" }) : nothing
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function bodyStyle(col, row) {
|
|
181
|
-
if (col.style) {
|
|
182
|
-
return styleMap({
|
|
183
|
-
...col.style(row),
|
|
184
|
-
textAlign: col.align === "right" ? "right" : undefined,
|
|
185
|
-
})
|
|
186
|
-
}
|
|
187
|
-
return col.align === "right" ? styleMap({ textAlign: "right" }) : nothing
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return html`
|
|
191
|
-
<div
|
|
192
|
-
class=${classMap(scrollClasses)}
|
|
193
|
-
@scroll="${this.scrollEvent}"
|
|
194
|
-
ref=${ref(this._scrollRef)}
|
|
195
|
-
>
|
|
196
|
-
<table class=${classMap(stickyClass)}>
|
|
197
|
-
<thead>
|
|
198
|
-
<tr>
|
|
199
|
-
${this._columns.map(
|
|
200
|
-
(col) =>
|
|
201
|
-
html`<th style=${headerStyle(col)}>
|
|
202
|
-
${col.sort
|
|
203
|
-
? html`<button
|
|
204
|
-
@click=${(_) => this.sortClick(col)}
|
|
205
|
-
class=${this.isSorted(col) ? "active" : nothing}
|
|
206
|
-
>
|
|
207
|
-
${col.align === "right"
|
|
208
|
-
? this.sortArrowIcon()
|
|
209
|
-
: nothing}
|
|
210
|
-
<span>${col.name}</span>
|
|
211
|
-
${col.align !== "right"
|
|
212
|
-
? this.sortArrowIcon()
|
|
213
|
-
: nothing}
|
|
214
|
-
</button>`
|
|
215
|
-
: col.name}
|
|
216
|
-
</th>`,
|
|
217
|
-
)}
|
|
218
|
-
</tr>
|
|
219
|
-
</thead>
|
|
220
|
-
<tbody>
|
|
221
|
-
${this._data.map(
|
|
222
|
-
(row) =>
|
|
223
|
-
html`<tr>
|
|
224
|
-
${this._columns.map(
|
|
225
|
-
(col) =>
|
|
226
|
-
html`<td style=${bodyStyle(col, row)}>
|
|
227
|
-
${col.value(row)}
|
|
228
|
-
</td>`,
|
|
229
|
-
)}
|
|
230
|
-
</tr>`,
|
|
231
|
-
)}
|
|
232
|
-
</tbody>
|
|
233
|
-
</table>
|
|
234
|
-
<div class=${classMap(shadowClassesLeft)}></div>
|
|
235
|
-
<div class=${classMap(shadowClassesRight)}></div>
|
|
236
|
-
</div>
|
|
237
|
-
|
|
238
|
-
${this.itemsPerPage > 0
|
|
239
|
-
? html`
|
|
240
|
-
<leu-pagination
|
|
241
|
-
.numOfItems=${this._sortedData.length}
|
|
242
|
-
.itemsPerPage=${this.itemsPerPage}
|
|
243
|
-
page=${this._page}
|
|
244
|
-
@leu:pagechange=${(e) => {
|
|
245
|
-
this._page = e.detail.page
|
|
246
|
-
}}
|
|
247
|
-
>
|
|
248
|
-
</leu-pagination>
|
|
249
|
-
`
|
|
250
|
-
: nothing}
|
|
251
|
-
`
|
|
252
|
-
}
|
|
253
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { html } from "lit"
|
|
2
|
-
import "../leu-table.js"
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Table",
|
|
6
|
-
component: "leu-table",
|
|
7
|
-
parameters: {
|
|
8
|
-
design: {
|
|
9
|
-
type: "figma",
|
|
10
|
-
url: "https://www.figma.com/file/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?type=design&node-id=316-2445&mode=design&t=lzVrtq8lxYVJU5TB-11",
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function Template({ itemsPerPage }) {
|
|
16
|
-
return html`
|
|
17
|
-
<leu-table id="table" itemsPerPage=${itemsPerPage}></leu-table>
|
|
18
|
-
<script>
|
|
19
|
-
{
|
|
20
|
-
const table = document.querySelector("leu-table[id=table]")
|
|
21
|
-
table.columns = [
|
|
22
|
-
{
|
|
23
|
-
name: "Id",
|
|
24
|
-
value: (row) => row.id,
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: "Name",
|
|
28
|
-
value: (row) => row.name,
|
|
29
|
-
headerStyle: () => {
|
|
30
|
-
return {
|
|
31
|
-
color: "#0076bd",
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
style: (row) => {
|
|
35
|
-
return {
|
|
36
|
-
minWidth: "400px",
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
sort: {
|
|
40
|
-
asc: (rowA, rowB) => rowA.name.localeCompare(rowB.name),
|
|
41
|
-
desc: (rowA, rowB) => rowB.name.localeCompare(rowA.name),
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: "Menge",
|
|
46
|
-
value: (row) => row.menge + "%",
|
|
47
|
-
style: (row) => {
|
|
48
|
-
return {
|
|
49
|
-
color:
|
|
50
|
-
row.menge > 10
|
|
51
|
-
? "var(--leu-color-func-green)"
|
|
52
|
-
: "var(--leu-color-func-red)",
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
sort: {
|
|
56
|
-
asc: (rowA, rowB) => rowA.menge - rowB.menge,
|
|
57
|
-
desc: (rowA, rowB) => rowB.menge - rowA.menge,
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
]
|
|
61
|
-
table.data = [
|
|
62
|
-
{ id: 1, name: "Ananas", menge: 7 },
|
|
63
|
-
{ id: 2, name: "Apfel", menge: 12 },
|
|
64
|
-
{ id: 3, name: "Aprikose", menge: 3 },
|
|
65
|
-
{ id: 4, name: "Banare", menge: 11 },
|
|
66
|
-
{ id: 5, name: "Birne", menge: 10 },
|
|
67
|
-
{ id: 6, name: "Brombeere", menge: 5 },
|
|
68
|
-
{ id: 7, name: "Cranberries", menge: 3 },
|
|
69
|
-
{ id: 8, name: "Datteln", menge: 2 },
|
|
70
|
-
{ id: 9, name: "Erdbeere", menge: 0 },
|
|
71
|
-
{ id: 10, name: "Feige", menge: 11 },
|
|
72
|
-
{ id: 11, name: "Granatapfel", menge: 14 },
|
|
73
|
-
{ id: 12, name: "Grapefruit", menge: 7 },
|
|
74
|
-
{ id: 13, name: "Heidelbeere", menge: 12 },
|
|
75
|
-
{ id: 14, name: "Himbeere", menge: 3 },
|
|
76
|
-
{ id: 15, name: "Johannisbeere", menge: 11 },
|
|
77
|
-
{ id: 16, name: "Kirsche", menge: 10 },
|
|
78
|
-
{ id: 17, name: "Kiwi", menge: 5 },
|
|
79
|
-
{ id: 18, name: "Limette", menge: 3 },
|
|
80
|
-
{ id: 19, name: "Litschi", menge: 2 },
|
|
81
|
-
{ id: 20, name: "Mandarine", menge: 0 },
|
|
82
|
-
{ id: 21, name: "Mango", menge: 11 },
|
|
83
|
-
{ id: 22, name: "Melone", menge: 14 },
|
|
84
|
-
{ id: 23, name: "Mirabelle", menge: 14 },
|
|
85
|
-
{ id: 24, name: "Nashi", menge: 12 },
|
|
86
|
-
{ id: 25, name: "Orange", menge: 3 },
|
|
87
|
-
{ id: 26, name: "Papaya", menge: 6 },
|
|
88
|
-
{ id: 27, name: "Pfirsich", menge: 5 },
|
|
89
|
-
{ id: 28, name: "Pflaume", menge: 17 },
|
|
90
|
-
{ id: 29, name: "Physalis", menge: 1 },
|
|
91
|
-
{ id: 30, name: "Preiselbeere", menge: 19 },
|
|
92
|
-
{ id: 31, name: "Pomelo", menge: 12 },
|
|
93
|
-
{ id: 32, name: "Quitte", menge: 0 },
|
|
94
|
-
{ id: 33, name: "Rhabarber", menge: 1 },
|
|
95
|
-
{ id: 34, name: "Sanddorn", menge: 2 },
|
|
96
|
-
{ id: 35, name: "Stachelbeere", menge: 19 },
|
|
97
|
-
{ id: 36, name: "Ugli", menge: 9 },
|
|
98
|
-
{ id: 37, name: "Weintraube", menge: 11 },
|
|
99
|
-
{ id: 38, name: "Zitrone", menge: 4 },
|
|
100
|
-
{ id: 39, name: "Zwetschge", menge: 20 },
|
|
101
|
-
]
|
|
102
|
-
}
|
|
103
|
-
</script>
|
|
104
|
-
`
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export const Regular = Template.bind({})
|
|
108
|
-
Regular.argTypes = {
|
|
109
|
-
itemsPerPage: { type: "number" },
|
|
110
|
-
columns: { table: { disable: true } },
|
|
111
|
-
data: { table: { disable: true } },
|
|
112
|
-
_columns: { table: { disable: true } },
|
|
113
|
-
_data: { table: { disable: true } },
|
|
114
|
-
_min: { table: { disable: true } },
|
|
115
|
-
_max: { table: { disable: true } },
|
|
116
|
-
_shadowLeft: { table: { disable: true } },
|
|
117
|
-
_shadowRight: { table: { disable: true } },
|
|
118
|
-
_sortArrowDown: { table: { disable: true } },
|
|
119
|
-
_sortArrowUp: { table: { disable: true } },
|
|
120
|
-
_scrollRef: { table: { disable: true } },
|
|
121
|
-
_itemsPerPage: { table: { disable: true } },
|
|
122
|
-
_sortedData: { table: { disable: true } },
|
|
123
|
-
}
|
|
124
|
-
Regular.args = {
|
|
125
|
-
itemsPerPage: null,
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export const Pagination = Template.bind({})
|
|
129
|
-
Pagination.args = {
|
|
130
|
-
itemsPerPage: 10,
|
|
131
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
position: relative;
|
|
3
|
-
display: block;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
div.scroll {
|
|
7
|
-
display: inline-block;
|
|
8
|
-
width: 100%;
|
|
9
|
-
overflow: auto;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
div.shadow {
|
|
13
|
-
position: absolute;
|
|
14
|
-
left: 0;
|
|
15
|
-
top: 0;
|
|
16
|
-
width: 100%;
|
|
17
|
-
height: 100%;
|
|
18
|
-
pointer-events: none;
|
|
19
|
-
z-index: 1;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
div.pagination {
|
|
23
|
-
height: calc(100% - 66px);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
table {
|
|
27
|
-
width: 100%;
|
|
28
|
-
border-spacing: 0;
|
|
29
|
-
color: rgb(0 0 0 / 60%);
|
|
30
|
-
font-size: 16px;
|
|
31
|
-
font-family: var(--leu-font-family-regular);
|
|
32
|
-
line-height: 1.5;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
td {
|
|
36
|
-
padding: 12px;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
th {
|
|
40
|
-
padding: 16px 16px 8px;
|
|
41
|
-
text-align: left;
|
|
42
|
-
font-size: 12px;
|
|
43
|
-
font-weight: normal;
|
|
44
|
-
font-family: var(--leu-font-family-black);
|
|
45
|
-
background: var(--table-even-row-bg);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
td:first-child,
|
|
49
|
-
th:first-child {
|
|
50
|
-
left: 0;
|
|
51
|
-
background: inherit;
|
|
52
|
-
z-index: 1;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
tr {
|
|
56
|
-
background: #fff;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
tbody tr:nth-child(odd) {
|
|
60
|
-
background: var(--leu-color-black-5);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
button {
|
|
64
|
-
background: none;
|
|
65
|
-
cursor: pointer;
|
|
66
|
-
line-height: 1.5;
|
|
67
|
-
padding: 0;
|
|
68
|
-
border: 0;
|
|
69
|
-
font-size: inherit;
|
|
70
|
-
font-family: inherit;
|
|
71
|
-
color: inherit;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
button span {
|
|
75
|
-
vertical-align: bottom;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
button leu-icon {
|
|
79
|
-
--leu-icon-size: 1.25rem;
|
|
80
|
-
display: inline-block;
|
|
81
|
-
padding: 0;
|
|
82
|
-
opacity: 0;
|
|
83
|
-
vertical-align: bottom;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
button:hover leu-icon {
|
|
87
|
-
opacity: 1;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
button.active leu-icon {
|
|
91
|
-
color: var(--leu-color-accent-blue);
|
|
92
|
-
opacity: 1;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
table.sticky td:first-child,
|
|
96
|
-
table.sticky th:first-child {
|
|
97
|
-
position: sticky;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
div.shadow-left table.sticky td:first-child,
|
|
101
|
-
div.shadow-left table.sticky th:first-child {
|
|
102
|
-
box-shadow: 0 0 5px rgb(0 0 0 / 50%);
|
|
103
|
-
clip-path: inset(0 -15px 0 0);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
div.shadow-left {
|
|
107
|
-
box-shadow: inset 5px 0 5px -5px rgb(0 0 0 / 50%);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
div.shadow-right {
|
|
111
|
-
box-shadow: inset -5px 0 5px -5px rgb(0 0 0 / 50%);
|
|
112
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { html } from "lit"
|
|
2
|
-
import { fixture, expect } from "@open-wc/testing"
|
|
3
|
-
|
|
4
|
-
import "../leu-table.js"
|
|
5
|
-
|
|
6
|
-
const columns = [
|
|
7
|
-
{ name: "Id", value: (row) => row.id },
|
|
8
|
-
{ name: "Name", value: (row) => row.name },
|
|
9
|
-
{ name: "Menge", value: (row) => row.menge },
|
|
10
|
-
]
|
|
11
|
-
|
|
12
|
-
const data = [
|
|
13
|
-
{ id: 1, name: "Apfel", menge: 4 },
|
|
14
|
-
{ id: 2, name: "Birne", menge: 2 },
|
|
15
|
-
{ id: 3, name: "Banane", menge: 3 },
|
|
16
|
-
{ id: 4, name: "Orange", menge: 7 },
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
async function defaultFixture() {
|
|
20
|
-
return fixture(
|
|
21
|
-
html`<leu-table .columns=${columns} .data=${data}> </leu-table>`,
|
|
22
|
-
)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
describe("LeuTable", () => {
|
|
26
|
-
it("is a defined element", async () => {
|
|
27
|
-
const el = customElements.get("leu-table")
|
|
28
|
-
|
|
29
|
-
await expect(el).not.to.be.undefined
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
it("passes the a11y audit", async () => {
|
|
33
|
-
const el = await defaultFixture()
|
|
34
|
-
|
|
35
|
-
await expect(el).shadowDom.to.be.accessible()
|
|
36
|
-
})
|
|
37
|
-
})
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { html } from "lit"
|
|
2
|
-
import { property } from "lit/decorators.js"
|
|
3
|
-
|
|
4
|
-
import { LeuElement } from "../../lib/LeuElement.js"
|
|
5
|
-
|
|
6
|
-
import styles from "./tag.css?inline"
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @tagname leu-tag
|
|
10
|
-
* @cssprop --leu-tag-accent-color - The color of the tag
|
|
11
|
-
* @slot default - The label of the tag
|
|
12
|
-
* @slot icon - An icon to display in the tag
|
|
13
|
-
*/
|
|
14
|
-
export class LeuTag extends LeuElement {
|
|
15
|
-
static styles = [LeuElement.styles, styles]
|
|
16
|
-
|
|
17
|
-
@property({ type: String })
|
|
18
|
-
variant: "solid" | "outline" | "ghost" = "solid"
|
|
19
|
-
|
|
20
|
-
render() {
|
|
21
|
-
return html`
|
|
22
|
-
<div class="tag tag--${this.variant}">
|
|
23
|
-
<slot class="tag__icon" name="icon"></slot>
|
|
24
|
-
<slot class="tag__label"></slot>
|
|
25
|
-
</div>
|
|
26
|
-
`
|
|
27
|
-
}
|
|
28
|
-
}
|