@inglorious/ui 0.1.0 → 1.0.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.
- package/README.md +45 -0
- package/package.json +191 -16
- package/src/all.css +7 -0
- package/src/controls/button/button.stories.js +35 -15
- package/src/controls/button/index.js +1 -3
- package/src/controls/button/style.css +80 -37
- package/src/controls/button/template.js +23 -26
- package/src/controls/button-group/button-group.stories.js +19 -15
- package/src/controls/button-group/index.js +1 -2
- package/src/controls/button-group/style.css +0 -7
- package/src/controls/button-group/template.js +46 -56
- package/src/controls/checkbox/checkbox.stories.js +16 -13
- package/src/controls/checkbox/index.js +1 -2
- package/src/controls/checkbox/style.css +23 -2
- package/src/controls/checkbox/template.js +20 -18
- package/src/controls/combobox/combobox.stories.js +92 -0
- package/src/controls/{select → combobox}/handlers.js +8 -5
- package/src/controls/combobox/helpers.js +91 -0
- package/src/controls/combobox/index.js +43 -0
- package/src/controls/combobox/style.css +203 -0
- package/src/controls/combobox/template.js +340 -0
- package/src/controls/controls.css +12 -0
- package/src/controls/fab/fab.stories.js +11 -11
- package/src/controls/fab/index.js +1 -2
- package/src/controls/fab/template.js +21 -19
- package/src/controls/icon-button/icon-button.stories.js +8 -10
- package/src/controls/icon-button/index.js +1 -2
- package/src/controls/icon-button/template.js +13 -19
- package/src/controls/input/index.js +1 -2
- package/src/controls/input/input.stories.js +24 -23
- package/src/controls/input/style.css +9 -7
- package/src/controls/input/template.js +28 -31
- package/src/controls/radio-group/index.js +1 -2
- package/src/controls/radio-group/radio-group.stories.js +11 -8
- package/src/controls/radio-group/style.css +22 -1
- package/src/controls/radio-group/template.js +20 -15
- package/src/controls/rating/index.js +1 -2
- package/src/controls/rating/rating.stories.js +7 -10
- package/src/controls/rating/style.css +1 -2
- package/src/controls/rating/template.js +20 -17
- package/src/controls/select/helpers.js +2 -21
- package/src/controls/select/index.js +1 -13
- package/src/controls/select/select.stories.js +68 -64
- package/src/controls/select/style.css +66 -189
- package/src/controls/select/template.js +77 -406
- package/src/controls/slider/index.js +1 -2
- package/src/controls/slider/slider.stories.js +15 -12
- package/src/controls/slider/style.css +24 -3
- package/src/controls/slider/template.js +30 -23
- package/src/controls/switch/index.js +1 -2
- package/src/controls/switch/style.css +23 -2
- package/src/controls/switch/switch.stories.js +14 -11
- package/src/controls/switch/template.js +18 -16
- package/src/data-display/avatar/avatar.stories.js +106 -0
- package/src/data-display/avatar/index.js +3 -0
- package/src/data-display/avatar/style.css +64 -0
- package/src/data-display/avatar/template.js +81 -0
- package/src/data-display/badge/badge.stories.js +64 -0
- package/src/data-display/badge/index.js +3 -0
- package/src/data-display/badge/style.css +84 -0
- package/src/data-display/badge/template.js +46 -0
- package/src/data-display/chip/chip.stories.js +57 -0
- package/src/data-display/chip/index.js +3 -0
- package/src/data-display/chip/style.css +84 -0
- package/src/data-display/chip/template.js +32 -0
- package/src/data-display/data-display.css +11 -0
- package/src/data-display/data-grid/base.css +58 -0
- package/src/data-display/data-grid/data-grid.stories.js +158 -0
- package/src/data-display/data-grid/filters/helpers.js +8 -0
- package/src/data-display/data-grid/filters/index.js +21 -0
- package/src/data-display/data-grid/filters/input.js +24 -0
- package/src/data-display/data-grid/filters/range.js +48 -0
- package/src/data-display/data-grid/filters/select.js +17 -0
- package/src/data-display/data-grid/handlers.js +523 -0
- package/src/data-display/data-grid/helpers.js +248 -0
- package/src/data-display/data-grid/index.js +64 -0
- package/src/data-display/data-grid/style.css +14 -0
- package/src/data-display/data-grid/template.js +458 -0
- package/src/data-display/data-grid/theme.css +148 -0
- package/src/data-display/divider/divider.stories.js +48 -0
- package/src/data-display/divider/index.js +3 -0
- package/src/data-display/divider/style.css +18 -0
- package/src/data-display/divider/template.js +17 -0
- package/src/data-display/icon/icon-implementations.mdx +160 -0
- package/src/data-display/icon/icon-utf8.stories.js +156 -0
- package/src/data-display/icon/icon.stories.js +38 -0
- package/src/data-display/icon/index.js +3 -0
- package/src/data-display/icon/style.css +17 -0
- package/src/data-display/icon/template.js +19 -0
- package/src/data-display/list/handlers.js +25 -0
- package/src/data-display/list/index.js +4 -0
- package/src/data-display/list/list.stories.js +187 -0
- package/src/data-display/list/style.css +119 -0
- package/src/data-display/list/template.js +302 -0
- package/src/data-display/material-icon/index.js +3 -0
- package/src/data-display/material-icon/material-icon.stories.js +99 -0
- package/src/data-display/material-icon/style.css +27 -0
- package/src/data-display/material-icon/template.js +21 -0
- package/src/data-display/table/index.js +1 -0
- package/src/data-display/table/style.css +42 -0
- package/src/data-display/table/table.stories.js +40 -0
- package/src/data-display/table/template.js +114 -0
- package/src/data-display/tooltip/index.js +3 -0
- package/src/data-display/tooltip/style.css +57 -0
- package/src/data-display/tooltip/template.js +58 -0
- package/src/data-display/tooltip/tooltip.stories.js +44 -0
- package/src/data-display/typography/index.js +3 -0
- package/src/data-display/typography/style.css +49 -0
- package/src/data-display/typography/template.js +110 -0
- package/src/data-display/typography/typography.stories.js +48 -0
- package/src/data-display/virtual-list/handlers.js +68 -0
- package/src/data-display/virtual-list/index.js +4 -0
- package/src/data-display/virtual-list/template.js +101 -0
- package/src/examples/dashboard/app-drawer.js +255 -0
- package/src/examples/dashboard/app-header.js +149 -0
- package/src/examples/dashboard/dashboard.js +85 -0
- package/src/examples/dashboard/dashboard.stories.js +47 -0
- package/src/examples/dashboard/data.js +205 -0
- package/src/examples/dashboard/mode.js +27 -0
- package/src/examples/dashboard/primitive-content.js +1325 -0
- package/src/examples/dashboard/primitive-section.js +158 -0
- package/src/examples/dashboard/router.js +13 -0
- package/src/examples/dashboard/social-card.js +73 -0
- package/src/examples/dashboard/stat-card.js +84 -0
- package/src/examples/dashboard/style.css +339 -0
- package/src/examples/dashboard/theme-utils.js +95 -0
- package/src/examples/dashboard/theme.js +27 -0
- package/src/examples/dashboard/traffic-card.js +108 -0
- package/src/examples/dashboard/traffic-sales-card.js +267 -0
- package/src/feedback/alert/alert.stories.js +70 -0
- package/src/feedback/alert/index.js +3 -0
- package/src/feedback/alert/style.css +98 -0
- package/src/feedback/alert/template.js +74 -0
- package/src/feedback/backdrop/backdrop.stories.js +21 -0
- package/src/feedback/backdrop/index.js +3 -0
- package/src/feedback/backdrop/style.css +25 -0
- package/src/feedback/backdrop/template.js +31 -0
- package/src/feedback/dialog/dialog.stories.js +27 -0
- package/src/feedback/dialog/index.js +3 -0
- package/src/feedback/dialog/style.css +68 -0
- package/src/feedback/dialog/template.js +64 -0
- package/src/feedback/feedback.css +6 -0
- package/src/feedback/progress/index.js +3 -0
- package/src/feedback/progress/progress.stories.js +54 -0
- package/src/feedback/progress/style.css +95 -0
- package/src/feedback/progress/template.js +88 -0
- package/src/feedback/skeleton/index.js +3 -0
- package/src/feedback/skeleton/skeleton.stories.js +44 -0
- package/src/feedback/skeleton/style.css +41 -0
- package/src/feedback/skeleton/template.js +48 -0
- package/src/feedback/snackbar/index.js +3 -0
- package/src/feedback/snackbar/snackbar.stories.js +25 -0
- package/src/feedback/snackbar/style.css +64 -0
- package/src/feedback/snackbar/template.js +55 -0
- package/src/index.js +32 -1
- package/src/layout/container/container.stories.js +105 -0
- package/src/layout/container/index.js +3 -0
- package/src/layout/container/style.css +34 -0
- package/src/layout/container/template.js +119 -0
- package/src/layout/flex/flex.stories.js +28 -10
- package/src/layout/flex/index.js +1 -2
- package/src/layout/flex/style.css +20 -0
- package/src/layout/flex/template.js +40 -13
- package/src/layout/grid/grid.stories.js +46 -30
- package/src/layout/grid/index.js +1 -2
- package/src/layout/grid/style.css +20 -0
- package/src/layout/grid/template.js +100 -20
- package/src/layout/layout.css +3 -0
- package/src/navigation/bottom-navigation/bottom-navigation.stories.js +33 -0
- package/src/navigation/bottom-navigation/index.js +1 -0
- package/src/navigation/bottom-navigation/style.css +32 -0
- package/src/navigation/bottom-navigation/template.js +74 -0
- package/src/navigation/breadcrumbs/breadcrumbs.stories.js +33 -0
- package/src/navigation/breadcrumbs/index.js +1 -0
- package/src/navigation/breadcrumbs/style.css +27 -0
- package/src/navigation/breadcrumbs/template.js +79 -0
- package/src/navigation/drawer/drawer.stories.js +60 -0
- package/src/navigation/drawer/index.js +3 -0
- package/src/navigation/drawer/style.css +125 -0
- package/src/navigation/drawer/template.js +131 -0
- package/src/navigation/link/index.js +3 -0
- package/src/navigation/link/link.stories.js +53 -0
- package/src/navigation/link/style.css +40 -0
- package/src/navigation/link/template.js +53 -0
- package/src/navigation/menu/index.js +1 -0
- package/src/navigation/menu/menu.stories.js +36 -0
- package/src/navigation/menu/style.css +44 -0
- package/src/navigation/menu/template.js +81 -0
- package/src/navigation/navigation.css +9 -0
- package/src/navigation/pagination/index.js +1 -0
- package/src/navigation/pagination/pagination.stories.js +61 -0
- package/src/navigation/pagination/style.css +29 -0
- package/src/navigation/pagination/template.js +140 -0
- package/src/navigation/speed-dial/index.js +1 -0
- package/src/navigation/speed-dial/speed-dial.stories.js +40 -0
- package/src/navigation/speed-dial/style.css +38 -0
- package/src/navigation/speed-dial/template.js +68 -0
- package/src/navigation/stepper/index.js +1 -0
- package/src/navigation/stepper/stepper.stories.js +35 -0
- package/src/navigation/stepper/style.css +49 -0
- package/src/navigation/stepper/template.js +61 -0
- package/src/navigation/tabs/index.js +1 -0
- package/src/navigation/tabs/style.css +35 -0
- package/src/navigation/tabs/tabs.stories.js +40 -0
- package/src/navigation/tabs/template.js +79 -0
- package/src/overview.mdx +39 -0
- package/src/stories/notifyStory.js +22 -25
- package/src/styles/base.css +2 -0
- package/src/styles/reset.css +15 -0
- package/src/{themes → styles/themes}/bootstrap.css +2 -0
- package/src/{themes → styles/themes}/inglorious.css +9 -1
- package/src/{themes → styles/themes}/material.css +2 -0
- package/src/{tokens/index.css → styles/tokens.css} +9 -0
- package/src/surfaces/accordion/accordion.stories.js +60 -0
- package/src/surfaces/accordion/index.js +1 -0
- package/src/surfaces/accordion/style.css +64 -0
- package/src/surfaces/accordion/template.js +85 -0
- package/src/surfaces/app-bar/app-bar.stories.js +109 -0
- package/src/surfaces/app-bar/index.js +3 -0
- package/src/surfaces/app-bar/style.css +109 -0
- package/src/surfaces/app-bar/template.js +78 -0
- package/src/surfaces/card/card.stories.js +108 -0
- package/src/surfaces/card/index.js +1 -0
- package/src/surfaces/card/style.css +107 -0
- package/src/surfaces/card/template.js +163 -0
- package/src/surfaces/paper/index.js +3 -0
- package/src/surfaces/paper/paper.stories.js +97 -0
- package/src/surfaces/paper/style.css +73 -0
- package/src/surfaces/paper/template.js +76 -0
- package/src/surfaces/surfaces.css +4 -0
- package/types/controls/button-group.d.ts +8 -7
- package/types/controls/button.d.ts +10 -7
- package/types/controls/checkbox.d.ts +8 -6
- package/types/controls/combobox.d.ts +66 -0
- package/types/controls/fab.d.ts +6 -5
- package/types/controls/icon-button.d.ts +8 -7
- package/types/controls/input.d.ts +18 -11
- package/types/controls/radio-group.d.ts +7 -5
- package/types/controls/rating.d.ts +6 -5
- package/types/controls/select.d.ts +11 -34
- package/types/controls/slider.d.ts +8 -6
- package/types/controls/switch.d.ts +7 -5
- package/types/data-display/avatar.d.ts +30 -0
- package/types/data-display/badge.d.ts +20 -0
- package/types/data-display/chip.d.ts +25 -0
- package/types/data-display/data-grid.d.ts +151 -0
- package/types/data-display/divider.d.ts +14 -0
- package/types/data-display/icon.d.ts +16 -0
- package/types/data-display/list.d.ts +66 -0
- package/types/data-display/material-icon.d.ts +15 -0
- package/types/data-display/table.d.ts +45 -0
- package/types/data-display/tooltip.d.ts +20 -0
- package/types/data-display/typography.d.ts +28 -0
- package/types/data-display/virtual-list.d.ts +94 -0
- package/types/feedback/alert.d.ts +22 -0
- package/types/feedback/backdrop.d.ts +17 -0
- package/types/feedback/dialog.d.ts +21 -0
- package/types/feedback/progress.d.ts +18 -0
- package/types/feedback/skeleton.d.ts +18 -0
- package/types/feedback/snackbar.d.ts +19 -0
- package/types/index.d.ts +92 -14
- package/types/layout/container.d.ts +28 -0
- package/types/layout/flex.d.ts +16 -5
- package/types/layout/grid.d.ts +15 -4
- package/types/navigation/bottom-navigation.d.ts +33 -0
- package/types/navigation/breadcrumbs.d.ts +29 -0
- package/types/navigation/drawer.d.ts +23 -0
- package/types/navigation/link.d.ts +22 -0
- package/types/navigation/menu.d.ts +32 -0
- package/types/navigation/pagination.d.ts +50 -0
- package/types/navigation/speed-dial.d.ts +35 -0
- package/types/navigation/stepper.d.ts +26 -0
- package/types/navigation/tabs.d.ts +31 -0
- package/types/surfaces/accordion.d.ts +32 -0
- package/types/surfaces/app-bar.d.ts +25 -0
- package/types/surfaces/card.d.ts +39 -0
- package/types/surfaces/paper.d.ts +28 -0
- package/src/shared/withRenderValidation.js +0 -19
- package/src/widgets/card/card.stories.js +0 -135
- package/src/widgets/card/index.js +0 -4
- package/src/widgets/card/style.css +0 -53
- package/src/widgets/card/template.js +0 -97
- package/types/widgets/card.d.ts +0 -21
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
.iw-drawer {
|
|
2
|
+
width: 16rem;
|
|
3
|
+
background: var(--iw-color-surface);
|
|
4
|
+
color: var(--iw-color-text);
|
|
5
|
+
transition:
|
|
6
|
+
margin var(--iw-transition-fast),
|
|
7
|
+
transform var(--iw-transition-fast),
|
|
8
|
+
width var(--iw-transition-fast),
|
|
9
|
+
min-width var(--iw-transition-fast),
|
|
10
|
+
max-width var(--iw-transition-fast);
|
|
11
|
+
|
|
12
|
+
position: fixed;
|
|
13
|
+
top: 0;
|
|
14
|
+
bottom: 0;
|
|
15
|
+
z-index: var(--iw-z-modal, 1050);
|
|
16
|
+
|
|
17
|
+
.iw-drawer-header {
|
|
18
|
+
border-bottom: 1px solid var(--iw-color-border);
|
|
19
|
+
flex-shrink: 0;
|
|
20
|
+
|
|
21
|
+
.iw-drawer-title {
|
|
22
|
+
font-weight: var(--iw-font-weight-semibold);
|
|
23
|
+
white-space: nowrap;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.iw-drawer-body {
|
|
28
|
+
overflow-x: hidden;
|
|
29
|
+
overflow-y: auto;
|
|
30
|
+
flex: 1 1 auto;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.iw-drawer-footer {
|
|
34
|
+
border-top: 1px solid var(--iw-color-border);
|
|
35
|
+
flex-shrink: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.iw-drawer-toggler > span {
|
|
39
|
+
transition: transform var(--iw-transition-fast);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.iw-list-item-inset,
|
|
43
|
+
.iw-list-item-content,
|
|
44
|
+
.iw-list-item-trailing,
|
|
45
|
+
.iw-list-nested,
|
|
46
|
+
.iw-list-title {
|
|
47
|
+
transition:
|
|
48
|
+
height var(--iw-transition-fast),
|
|
49
|
+
padding var(--iw-transition-fast),
|
|
50
|
+
opacity var(--iw-transition-fast);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.iw-drawer-collapsed {
|
|
54
|
+
width: 4rem;
|
|
55
|
+
min-width: 4rem;
|
|
56
|
+
max-width: 4rem;
|
|
57
|
+
|
|
58
|
+
.iw-list-item-inset,
|
|
59
|
+
.iw-list-item-content,
|
|
60
|
+
.iw-list-item-trailing,
|
|
61
|
+
.iw-list-nested,
|
|
62
|
+
.iw-list-title {
|
|
63
|
+
height: 0;
|
|
64
|
+
padding: 0;
|
|
65
|
+
opacity: 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.iw-drawer-toggler > span {
|
|
69
|
+
transform: rotate(180deg);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.iw-drawer-left {
|
|
75
|
+
left: 0;
|
|
76
|
+
border-right: 1px solid var(--iw-color-border);
|
|
77
|
+
transform: translateX(-100%);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.iw-drawer-right {
|
|
81
|
+
right: 0;
|
|
82
|
+
border-left: 1px solid var(--iw-color-border);
|
|
83
|
+
transform: translateX(100%);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@media (min-width: 0rem) {
|
|
87
|
+
.iw-drawer {
|
|
88
|
+
box-shadow: var(--iw-shadow-lg);
|
|
89
|
+
|
|
90
|
+
&.iw-drawer-open {
|
|
91
|
+
transform: translateX(0);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.iw-drawer-footer {
|
|
95
|
+
display: none;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@media (min-width: 64rem) {
|
|
101
|
+
.iw-drawer {
|
|
102
|
+
transform: none;
|
|
103
|
+
box-shadow: none;
|
|
104
|
+
|
|
105
|
+
&.iw-drawer-left.iw-drawer-hidden {
|
|
106
|
+
transform: translateX(-100%);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&.iw-drawer-right.iw-drawer-hidden {
|
|
110
|
+
transform: translateX(100%);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
& ~ .iw-drawer-backdrop {
|
|
114
|
+
display: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.iw-drawer-close {
|
|
118
|
+
display: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.iw-drawer-footer {
|
|
122
|
+
display: flex;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../../../types/navigation/drawer').DrawerProps} DrawerProps
|
|
3
|
+
* @typedef {import('@inglorious/web').TemplateResult} TemplateResult
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { html, when } from "@inglorious/web"
|
|
7
|
+
|
|
8
|
+
import { button } from "../../controls/button"
|
|
9
|
+
import { materialIcon } from "../../data-display/material-icon"
|
|
10
|
+
import { backdrop } from "../../feedback/backdrop"
|
|
11
|
+
import { flex } from "../../layout/flex"
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @param {DrawerProps} props
|
|
15
|
+
* @returns {TemplateResult}
|
|
16
|
+
*/
|
|
17
|
+
export function render(props) {
|
|
18
|
+
const {
|
|
19
|
+
type, // eslint-disable-line no-unused-vars
|
|
20
|
+
items, // eslint-disable-line no-unused-vars
|
|
21
|
+
isOpen = false,
|
|
22
|
+
isHidden = false,
|
|
23
|
+
anchor = "left",
|
|
24
|
+
isCollapsed = false,
|
|
25
|
+
hasBackdrop = true,
|
|
26
|
+
title,
|
|
27
|
+
children,
|
|
28
|
+
className = "",
|
|
29
|
+
onClose,
|
|
30
|
+
onCollapseToggle,
|
|
31
|
+
...rest
|
|
32
|
+
} = props
|
|
33
|
+
|
|
34
|
+
const extraClasses = Object.fromEntries(
|
|
35
|
+
className
|
|
36
|
+
.split(/\s+/)
|
|
37
|
+
.filter(Boolean)
|
|
38
|
+
.map((name) => [name, true]),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
const drawerClassName = [
|
|
42
|
+
"iw-drawer",
|
|
43
|
+
`iw-drawer-${anchor}`,
|
|
44
|
+
isOpen && "iw-drawer-open",
|
|
45
|
+
isHidden && "iw-drawer-hidden",
|
|
46
|
+
isCollapsed && "iw-drawer-collapsed",
|
|
47
|
+
...Object.keys(extraClasses),
|
|
48
|
+
]
|
|
49
|
+
.filter(Boolean)
|
|
50
|
+
.join(" ")
|
|
51
|
+
|
|
52
|
+
return html`
|
|
53
|
+
${flex.render({
|
|
54
|
+
element: "aside",
|
|
55
|
+
direction: "column",
|
|
56
|
+
className: drawerClassName,
|
|
57
|
+
children: [
|
|
58
|
+
when(
|
|
59
|
+
title || onClose,
|
|
60
|
+
() => html`
|
|
61
|
+
${flex.render({
|
|
62
|
+
align: "center",
|
|
63
|
+
justify: "between",
|
|
64
|
+
gap: "sm",
|
|
65
|
+
className: "iw-drawer-header",
|
|
66
|
+
children: [
|
|
67
|
+
when(
|
|
68
|
+
title,
|
|
69
|
+
() => html`<div class="iw-drawer-title">${title}</div>`,
|
|
70
|
+
),
|
|
71
|
+
when(onClose, () =>
|
|
72
|
+
button.render({
|
|
73
|
+
color: "secondary",
|
|
74
|
+
variant: "ghost",
|
|
75
|
+
shape: "square",
|
|
76
|
+
className: "iw-drawer-close",
|
|
77
|
+
"aria-label": "Close",
|
|
78
|
+
onClick: onClose,
|
|
79
|
+
children: materialIcon.render({
|
|
80
|
+
name: "close",
|
|
81
|
+
size: "lg",
|
|
82
|
+
}),
|
|
83
|
+
}),
|
|
84
|
+
),
|
|
85
|
+
],
|
|
86
|
+
})}
|
|
87
|
+
`,
|
|
88
|
+
),
|
|
89
|
+
|
|
90
|
+
flex.render({
|
|
91
|
+
direction: "column",
|
|
92
|
+
className: "iw-drawer-body",
|
|
93
|
+
children,
|
|
94
|
+
}),
|
|
95
|
+
|
|
96
|
+
when(
|
|
97
|
+
onCollapseToggle,
|
|
98
|
+
() => html`
|
|
99
|
+
${flex.render({
|
|
100
|
+
justify: "end",
|
|
101
|
+
padding: "sm",
|
|
102
|
+
className: "iw-drawer-footer",
|
|
103
|
+
children: button.render({
|
|
104
|
+
color: "secondary",
|
|
105
|
+
variant: "ghost",
|
|
106
|
+
shape: "square",
|
|
107
|
+
className: "iw-drawer-toggler",
|
|
108
|
+
"aria-label": isCollapsed
|
|
109
|
+
? "Expand sidebar"
|
|
110
|
+
: "Collapse sidebar",
|
|
111
|
+
onClick: onCollapseToggle,
|
|
112
|
+
children: materialIcon.render({
|
|
113
|
+
name: "left_panel_close",
|
|
114
|
+
size: "lg",
|
|
115
|
+
}),
|
|
116
|
+
}),
|
|
117
|
+
})}
|
|
118
|
+
`,
|
|
119
|
+
),
|
|
120
|
+
],
|
|
121
|
+
...rest,
|
|
122
|
+
})}
|
|
123
|
+
${when(isOpen && hasBackdrop, () =>
|
|
124
|
+
backdrop.render({
|
|
125
|
+
isOpen: true,
|
|
126
|
+
className: "iw-drawer-backdrop",
|
|
127
|
+
onClick: onClose,
|
|
128
|
+
}),
|
|
129
|
+
)}
|
|
130
|
+
`
|
|
131
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createRender } from "../../stories/notifyStory.js"
|
|
2
|
+
import { link } from "."
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Navigation/Link",
|
|
6
|
+
tags: ["autodocs"],
|
|
7
|
+
render: createRender(link),
|
|
8
|
+
argTypes: {
|
|
9
|
+
href: { control: "text", description: "Destination URL." },
|
|
10
|
+
label: { control: "text", description: "Fallback text content." },
|
|
11
|
+
underline: {
|
|
12
|
+
control: "select",
|
|
13
|
+
options: ["always", "hover", "none"],
|
|
14
|
+
description: "Underline behavior.",
|
|
15
|
+
},
|
|
16
|
+
color: {
|
|
17
|
+
control: "select",
|
|
18
|
+
options: ["primary", "secondary", "inherit"],
|
|
19
|
+
description: "Color intent.",
|
|
20
|
+
},
|
|
21
|
+
isMuted: { control: "boolean", description: "Use muted text color." },
|
|
22
|
+
isExternal: {
|
|
23
|
+
control: "boolean",
|
|
24
|
+
description: "Opens in a new tab and adds safe rel attributes.",
|
|
25
|
+
},
|
|
26
|
+
onClick: { action: "onClick" },
|
|
27
|
+
},
|
|
28
|
+
parameters: {
|
|
29
|
+
docs: {
|
|
30
|
+
description: {
|
|
31
|
+
component: "Text navigation primitive for inline links and actions.",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const Default = {
|
|
38
|
+
args: {
|
|
39
|
+
href: "#docs",
|
|
40
|
+
label: "Read the docs",
|
|
41
|
+
underline: "hover",
|
|
42
|
+
color: "primary",
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const External = {
|
|
47
|
+
args: {
|
|
48
|
+
href: "https://example.com",
|
|
49
|
+
label: "External link",
|
|
50
|
+
isExternal: true,
|
|
51
|
+
underline: "always",
|
|
52
|
+
},
|
|
53
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
.iw-link {
|
|
2
|
+
color: var(--iw-color-primary);
|
|
3
|
+
text-decoration: none;
|
|
4
|
+
text-underline-offset: 0.15em;
|
|
5
|
+
transition:
|
|
6
|
+
color var(--iw-transition-fast),
|
|
7
|
+
text-decoration-color var(--iw-transition-fast);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.iw-link:hover {
|
|
11
|
+
color: var(--iw-color-primary-hover, var(--iw-color-primary));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.iw-link-underline-always {
|
|
15
|
+
text-decoration: underline;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.iw-link-underline-hover:hover {
|
|
19
|
+
text-decoration: underline;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.iw-link-underline-none {
|
|
23
|
+
text-decoration: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.iw-link-color-primary {
|
|
27
|
+
color: var(--iw-color-primary);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.iw-link-color-secondary {
|
|
31
|
+
color: var(--iw-color-text-secondary, var(--iw-color-text));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.iw-link-color-inherit {
|
|
35
|
+
color: inherit;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.iw-link-muted {
|
|
39
|
+
color: var(--iw-color-text-muted, var(--iw-color-text));
|
|
40
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../../../types/navigation/link').LinkProps} LinkProps
|
|
3
|
+
* @typedef {import('@inglorious/web').TemplateResult} TemplateResult
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { classMap, html, ref } from "@inglorious/web"
|
|
7
|
+
|
|
8
|
+
import { applyElementProps } from "../../shared/applyElementProps.js"
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @param {LinkProps} props
|
|
12
|
+
* @returns {TemplateResult}
|
|
13
|
+
*/
|
|
14
|
+
export function render(props) {
|
|
15
|
+
const {
|
|
16
|
+
type, // eslint-disable-line no-unused-vars
|
|
17
|
+
href,
|
|
18
|
+
children,
|
|
19
|
+
label,
|
|
20
|
+
underline = "hover",
|
|
21
|
+
color = "primary",
|
|
22
|
+
isMuted = false,
|
|
23
|
+
isExternal = false,
|
|
24
|
+
className = "",
|
|
25
|
+
onClick,
|
|
26
|
+
...rest
|
|
27
|
+
} = props
|
|
28
|
+
|
|
29
|
+
const extraClasses = Object.fromEntries(
|
|
30
|
+
className
|
|
31
|
+
.split(/\s+/)
|
|
32
|
+
.filter(Boolean)
|
|
33
|
+
.map((name) => [name, true]),
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
return html`<a
|
|
37
|
+
href=${href ?? "#"}
|
|
38
|
+
class=${classMap({
|
|
39
|
+
"iw-link": true,
|
|
40
|
+
[`iw-link-underline-${underline}`]: true,
|
|
41
|
+
[`iw-link-color-${color}`]: !isMuted,
|
|
42
|
+
"iw-link-muted": isMuted,
|
|
43
|
+
"iw-link-external": isExternal,
|
|
44
|
+
...extraClasses,
|
|
45
|
+
})}
|
|
46
|
+
target=${isExternal ? "_blank" : null}
|
|
47
|
+
rel=${isExternal ? "noreferrer noopener" : null}
|
|
48
|
+
@click=${onClick}
|
|
49
|
+
${ref((el) => applyElementProps(el, rest))}
|
|
50
|
+
>
|
|
51
|
+
${children ?? label}
|
|
52
|
+
</a>`
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { menu } from "./template.js"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createRender } from "../../stories/notifyStory.js"
|
|
2
|
+
import { menu } from "."
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Navigation/Menu",
|
|
6
|
+
tags: ["autodocs"],
|
|
7
|
+
render: createRender(menu),
|
|
8
|
+
argTypes: {
|
|
9
|
+
isOpen: {
|
|
10
|
+
control: "boolean",
|
|
11
|
+
description: "Whether the menu is visible.",
|
|
12
|
+
},
|
|
13
|
+
items: { control: "object", description: "Menu items and separators." },
|
|
14
|
+
isDense: { control: "boolean", description: "Compact item spacing." },
|
|
15
|
+
onItemClick: { action: "onItemClick" },
|
|
16
|
+
},
|
|
17
|
+
parameters: {
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component: "Floating action list with overridable `renderItem`.",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const Default = {
|
|
27
|
+
args: {
|
|
28
|
+
isOpen: true,
|
|
29
|
+
items: [
|
|
30
|
+
{ label: "Profile", icon: "👤" },
|
|
31
|
+
{ label: "Settings", icon: "⚙" },
|
|
32
|
+
{ hasDivider: true },
|
|
33
|
+
{ label: "Logout", trailing: "⌘Q" },
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
.iw-menu {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
min-width: 12rem;
|
|
5
|
+
padding: var(--iw-space-2);
|
|
6
|
+
background: var(--iw-color-surface);
|
|
7
|
+
border: 1px solid var(--iw-color-border);
|
|
8
|
+
border-radius: var(--iw-radius-md);
|
|
9
|
+
box-shadow: var(--iw-shadow-lg);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.iw-menu-item {
|
|
13
|
+
border: 0 none;
|
|
14
|
+
background: transparent;
|
|
15
|
+
color: var(--iw-color-text);
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
gap: var(--iw-space-2);
|
|
19
|
+
width: 100%;
|
|
20
|
+
padding: var(--iw-space-2) var(--iw-space-3);
|
|
21
|
+
border-radius: var(--iw-radius-sm);
|
|
22
|
+
text-align: left;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.iw-menu-item:hover:enabled,
|
|
27
|
+
.iw-menu-item-selected {
|
|
28
|
+
background: color-mix(in srgb, var(--iw-color-primary) 12%, transparent);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.iw-menu-item-trailing {
|
|
32
|
+
margin-left: auto;
|
|
33
|
+
color: var(--iw-color-text-muted, var(--iw-color-text));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.iw-menu-divider {
|
|
37
|
+
height: 1px;
|
|
38
|
+
margin: var(--iw-space-2) 0;
|
|
39
|
+
background: var(--iw-color-border);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.iw-menu-dense .iw-menu-item {
|
|
43
|
+
padding-block: var(--iw-space-1);
|
|
44
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../../../types/navigation/menu').MenuProps} MenuProps
|
|
3
|
+
* @typedef {import('../../../types/navigation/menu').MenuItem} MenuItem
|
|
4
|
+
* @typedef {import('@inglorious/web').TemplateResult} TemplateResult
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { classMap, html, ref } from "@inglorious/web"
|
|
8
|
+
|
|
9
|
+
import { applyElementProps } from "../../shared/applyElementProps.js"
|
|
10
|
+
|
|
11
|
+
export const menu = {
|
|
12
|
+
/**
|
|
13
|
+
* @param {MenuProps} props
|
|
14
|
+
* @returns {TemplateResult | null}
|
|
15
|
+
*/
|
|
16
|
+
render(props) {
|
|
17
|
+
const {
|
|
18
|
+
type, // eslint-disable-line no-unused-vars
|
|
19
|
+
isOpen = false,
|
|
20
|
+
items = [],
|
|
21
|
+
isDense = false,
|
|
22
|
+
className = "",
|
|
23
|
+
...rest
|
|
24
|
+
} = props
|
|
25
|
+
|
|
26
|
+
if (!isOpen) return null
|
|
27
|
+
|
|
28
|
+
const extraClasses = Object.fromEntries(
|
|
29
|
+
className
|
|
30
|
+
.split(/\s+/)
|
|
31
|
+
.filter(Boolean)
|
|
32
|
+
.map((name) => [name, true]),
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
return html`<div
|
|
36
|
+
class=${classMap({
|
|
37
|
+
"iw-menu": true,
|
|
38
|
+
"iw-menu-dense": isDense,
|
|
39
|
+
...extraClasses,
|
|
40
|
+
})}
|
|
41
|
+
role="menu"
|
|
42
|
+
${ref((el) => applyElementProps(el, rest))}
|
|
43
|
+
>
|
|
44
|
+
${items.map((item, index) => this.renderItem(item, index, props))}
|
|
45
|
+
</div>`
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @param {MenuItem} item
|
|
50
|
+
* @param {number} index
|
|
51
|
+
* @param {MenuProps} props
|
|
52
|
+
* @returns {TemplateResult}
|
|
53
|
+
*/
|
|
54
|
+
renderItem(item, index, props) {
|
|
55
|
+
if (item.hasDivider) {
|
|
56
|
+
return html`<div class="iw-menu-divider" role="separator"></div>`
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return html`<button
|
|
60
|
+
type="button"
|
|
61
|
+
class=${classMap({
|
|
62
|
+
"iw-menu-item": true,
|
|
63
|
+
"iw-menu-item-selected": item.isSelected,
|
|
64
|
+
})}
|
|
65
|
+
role="menuitem"
|
|
66
|
+
?disabled=${item.isDisabled}
|
|
67
|
+
@click=${() => {
|
|
68
|
+
item.onClick?.(item.value ?? index)
|
|
69
|
+
props.onItemClick?.(item.value ?? index, item)
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
72
|
+
${item.icon
|
|
73
|
+
? html`<span class="iw-menu-item-icon">${item.icon}</span>`
|
|
74
|
+
: null}
|
|
75
|
+
<span class="iw-menu-item-label">${item.label}</span>
|
|
76
|
+
${item.trailing
|
|
77
|
+
? html`<span class="iw-menu-item-trailing">${item.trailing}</span>`
|
|
78
|
+
: null}
|
|
79
|
+
</button>`
|
|
80
|
+
},
|
|
81
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
@import "./bottom-navigation/style.css";
|
|
2
|
+
@import "./breadcrumbs/style.css";
|
|
3
|
+
@import "./drawer/style.css";
|
|
4
|
+
@import "./link/style.css";
|
|
5
|
+
@import "./menu/style.css";
|
|
6
|
+
@import "./pagination/style.css";
|
|
7
|
+
@import "./speed-dial/style.css";
|
|
8
|
+
@import "./stepper/style.css";
|
|
9
|
+
@import "./tabs/style.css";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { pagination } from "./template.js"
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createRender } from "../../stories/notifyStory.js"
|
|
2
|
+
import { pagination } from "."
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Navigation/Pagination",
|
|
6
|
+
tags: ["autodocs"],
|
|
7
|
+
render: createRender(pagination),
|
|
8
|
+
argTypes: {
|
|
9
|
+
page: { control: "number", description: "Current page (1-based)." },
|
|
10
|
+
count: { control: "number", description: "Total number of pages." },
|
|
11
|
+
siblingCount: {
|
|
12
|
+
control: "number",
|
|
13
|
+
description: "Pages shown beside the current page.",
|
|
14
|
+
},
|
|
15
|
+
isFirstButtonVisible: {
|
|
16
|
+
control: "boolean",
|
|
17
|
+
description: "Show first page control.",
|
|
18
|
+
},
|
|
19
|
+
isLastButtonVisible: {
|
|
20
|
+
control: "boolean",
|
|
21
|
+
description: "Show last page control.",
|
|
22
|
+
},
|
|
23
|
+
isDisabled: { control: "boolean", description: "Disable all controls." },
|
|
24
|
+
buttonVariant: {
|
|
25
|
+
control: "select",
|
|
26
|
+
options: ["default", "outline", "ghost"],
|
|
27
|
+
description: "Button primitive variant used for pagination controls.",
|
|
28
|
+
},
|
|
29
|
+
buttonColor: {
|
|
30
|
+
control: "select",
|
|
31
|
+
options: ["primary", "secondary", "success", "warning", "error", "info"],
|
|
32
|
+
description: "Button primitive color used for non-current controls.",
|
|
33
|
+
},
|
|
34
|
+
buttonSize: {
|
|
35
|
+
control: "select",
|
|
36
|
+
options: ["sm", "md", "lg"],
|
|
37
|
+
description: "Button primitive size used for controls.",
|
|
38
|
+
},
|
|
39
|
+
onChange: { action: "onChange" },
|
|
40
|
+
},
|
|
41
|
+
parameters: {
|
|
42
|
+
docs: {
|
|
43
|
+
description: {
|
|
44
|
+
component: "Paged navigation with overridable page item rendering.",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const Default = {
|
|
51
|
+
args: {
|
|
52
|
+
page: 4,
|
|
53
|
+
count: 10,
|
|
54
|
+
siblingCount: 1,
|
|
55
|
+
isFirstButtonVisible: true,
|
|
56
|
+
isLastButtonVisible: true,
|
|
57
|
+
buttonVariant: "ghost",
|
|
58
|
+
buttonColor: "secondary",
|
|
59
|
+
buttonSize: "sm",
|
|
60
|
+
},
|
|
61
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.iw-pagination {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: var(--iw-space-2);
|
|
5
|
+
flex-wrap: wrap;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.iw-pagination-item,
|
|
9
|
+
.iw-pagination-ellipsis {
|
|
10
|
+
min-width: 2rem;
|
|
11
|
+
height: 2rem;
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
border-radius: var(--iw-radius-sm);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.iw-pagination-item {
|
|
19
|
+
border: 1px solid var(--iw-color-border);
|
|
20
|
+
background: var(--iw-color-surface);
|
|
21
|
+
color: var(--iw-color-text);
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.iw-pagination-item-current {
|
|
26
|
+
background: var(--iw-color-primary);
|
|
27
|
+
color: var(--iw-color-primary-text, var(--iw-color-white));
|
|
28
|
+
border-color: var(--iw-color-primary);
|
|
29
|
+
}
|