@inglorious/ui 0.1.0 → 1.0.1
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 +190 -15
- 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,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../../../types/feedback/skeleton').SkeletonProps} SkeletonProps
|
|
3
|
+
* @typedef {import('@inglorious/web').TemplateResult} TemplateResult
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { classMap, html } from "@inglorious/web"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {SkeletonProps} props
|
|
10
|
+
* @returns {TemplateResult}
|
|
11
|
+
*/
|
|
12
|
+
export function render(props) {
|
|
13
|
+
const { variant = "text", width, height, lines = 1, className = "" } = props
|
|
14
|
+
|
|
15
|
+
const extraClasses = Object.fromEntries(
|
|
16
|
+
className
|
|
17
|
+
.split(/\s+/)
|
|
18
|
+
.filter(Boolean)
|
|
19
|
+
.map((name) => [name, true]),
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
const style = [
|
|
23
|
+
width != null
|
|
24
|
+
? `width: ${typeof width === "number" ? `${width}px` : width};`
|
|
25
|
+
: "",
|
|
26
|
+
height != null
|
|
27
|
+
? `height: ${typeof height === "number" ? `${height}px` : height};`
|
|
28
|
+
: "",
|
|
29
|
+
]
|
|
30
|
+
.filter(Boolean)
|
|
31
|
+
.join(" ")
|
|
32
|
+
|
|
33
|
+
const classes = {
|
|
34
|
+
"iw-skeleton": true,
|
|
35
|
+
[`iw-skeleton-${variant}`]: variant !== "text",
|
|
36
|
+
...extraClasses,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (lines > 1) {
|
|
40
|
+
return html`<div class="iw-skeleton-stack">
|
|
41
|
+
${Array.from({ length: lines }).map(
|
|
42
|
+
() => html`<div class=${classMap(classes)} style=${style}></div>`,
|
|
43
|
+
)}
|
|
44
|
+
</div>`
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return html`<div class=${classMap(classes)} style=${style}></div>`
|
|
48
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createRender } from "../../stories/notifyStory.js"
|
|
2
|
+
import { snackbar } from "."
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Feedback/Snackbar",
|
|
6
|
+
tags: ["autodocs"],
|
|
7
|
+
render: createRender(snackbar),
|
|
8
|
+
argTypes: {
|
|
9
|
+
isOpen: { control: "boolean" },
|
|
10
|
+
message: { control: "text" },
|
|
11
|
+
position: {
|
|
12
|
+
control: "select",
|
|
13
|
+
options: ["bottom-left", "bottom-right", "top-left", "top-right"],
|
|
14
|
+
},
|
|
15
|
+
onClose: { action: "onClose" },
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const Default = {
|
|
20
|
+
args: {
|
|
21
|
+
isOpen: true,
|
|
22
|
+
message: "Saved successfully",
|
|
23
|
+
position: "bottom-left",
|
|
24
|
+
},
|
|
25
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.iw-snackbar {
|
|
2
|
+
position: fixed;
|
|
3
|
+
z-index: var(--iw-z-popover, 1060);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.iw-snackbar-bottom-left {
|
|
7
|
+
left: var(--iw-space-4);
|
|
8
|
+
bottom: var(--iw-space-4);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.iw-snackbar-bottom-right {
|
|
12
|
+
right: var(--iw-space-4);
|
|
13
|
+
bottom: var(--iw-space-4);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.iw-snackbar-top-left {
|
|
17
|
+
left: var(--iw-space-4);
|
|
18
|
+
top: var(--iw-space-4);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.iw-snackbar-top-right {
|
|
22
|
+
right: var(--iw-space-4);
|
|
23
|
+
top: var(--iw-space-4);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.iw-snackbar-content {
|
|
27
|
+
display: inline-flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
gap: var(--iw-space-2);
|
|
30
|
+
padding: var(--iw-space-2) var(--iw-space-3) var(--iw-space-2)
|
|
31
|
+
var(--iw-space-4);
|
|
32
|
+
background: color-mix(
|
|
33
|
+
in srgb,
|
|
34
|
+
var(--iw-color-surface, #222) 84%,
|
|
35
|
+
var(--iw-color-black)
|
|
36
|
+
);
|
|
37
|
+
color: var(--iw-color-text, #fff);
|
|
38
|
+
border: 1px solid
|
|
39
|
+
color-mix(in srgb, var(--iw-color-border, #555) 65%, transparent);
|
|
40
|
+
border-radius: var(--iw-radius-md);
|
|
41
|
+
box-shadow: var(--iw-shadow-lg, 0 6px 20px rgba(0, 0, 0, 0.3));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.iw-snackbar-action {
|
|
45
|
+
display: inline-flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.iw-snackbar-close {
|
|
50
|
+
border: 0 none;
|
|
51
|
+
background: transparent;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
color: inherit;
|
|
54
|
+
width: 1.5rem;
|
|
55
|
+
height: 1.5rem;
|
|
56
|
+
border-radius: var(--iw-radius-sm);
|
|
57
|
+
display: inline-flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.iw-snackbar-close:hover {
|
|
63
|
+
background-color: color-mix(in srgb, currentColor 12%, transparent);
|
|
64
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../../../types/feedback/snackbar').SnackbarProps} SnackbarProps
|
|
3
|
+
* @typedef {import('@inglorious/web').TemplateResult} TemplateResult
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { classMap, html } from "@inglorious/web"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {SnackbarProps} props
|
|
10
|
+
* @returns {TemplateResult | null}
|
|
11
|
+
*/
|
|
12
|
+
export function render(props) {
|
|
13
|
+
const {
|
|
14
|
+
isOpen = false,
|
|
15
|
+
message,
|
|
16
|
+
action,
|
|
17
|
+
className = "",
|
|
18
|
+
position = "bottom-left",
|
|
19
|
+
onClose,
|
|
20
|
+
} = props
|
|
21
|
+
|
|
22
|
+
if (!isOpen) return null
|
|
23
|
+
|
|
24
|
+
const extraClasses = Object.fromEntries(
|
|
25
|
+
className
|
|
26
|
+
.split(/\s+/)
|
|
27
|
+
.filter(Boolean)
|
|
28
|
+
.map((name) => [name, true]),
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
return html`<div
|
|
32
|
+
class=${classMap({
|
|
33
|
+
"iw-snackbar": true,
|
|
34
|
+
[`iw-snackbar-${position}`]: true,
|
|
35
|
+
...extraClasses,
|
|
36
|
+
})}
|
|
37
|
+
role="status"
|
|
38
|
+
aria-live="polite"
|
|
39
|
+
>
|
|
40
|
+
<div class="iw-snackbar-content">
|
|
41
|
+
<span class="iw-snackbar-message">${message}</span>
|
|
42
|
+
${action ? html`<span class="iw-snackbar-action">${action}</span>` : null}
|
|
43
|
+
${onClose
|
|
44
|
+
? html`<button
|
|
45
|
+
type="button"
|
|
46
|
+
class="iw-snackbar-close"
|
|
47
|
+
aria-label="Dismiss"
|
|
48
|
+
@click=${onClose}
|
|
49
|
+
>
|
|
50
|
+
×
|
|
51
|
+
</button>`
|
|
52
|
+
: null}
|
|
53
|
+
</div>
|
|
54
|
+
</div>`
|
|
55
|
+
}
|
package/src/index.js
CHANGED
|
@@ -9,6 +9,37 @@ export { rating } from "./controls/rating/index.js"
|
|
|
9
9
|
export { select } from "./controls/select/index.js"
|
|
10
10
|
export { slider } from "./controls/slider/index.js"
|
|
11
11
|
export { switchControl } from "./controls/switch/index.js"
|
|
12
|
-
export {
|
|
12
|
+
export { avatar } from "./data-display/avatar/index.js"
|
|
13
|
+
export { badge } from "./data-display/badge/index.js"
|
|
14
|
+
export { chip } from "./data-display/chip/index.js"
|
|
15
|
+
export { dataGrid } from "./data-display/data-grid/index.js"
|
|
16
|
+
export { divider } from "./data-display/divider/index.js"
|
|
17
|
+
export { icon } from "./data-display/icon/index.js"
|
|
18
|
+
export { list } from "./data-display/list/index.js"
|
|
19
|
+
export { materialIcon } from "./data-display/material-icon/index.js"
|
|
20
|
+
export { table } from "./data-display/table/index.js"
|
|
21
|
+
export { tooltip } from "./data-display/tooltip/index.js"
|
|
22
|
+
export { typography } from "./data-display/typography/index.js"
|
|
23
|
+
export { virtualList } from "./data-display/virtual-list/index.js"
|
|
24
|
+
export { alert } from "./feedback/alert/index.js"
|
|
25
|
+
export { backdrop } from "./feedback/backdrop/index.js"
|
|
26
|
+
export { dialog } from "./feedback/dialog/index.js"
|
|
27
|
+
export { progress } from "./feedback/progress/index.js"
|
|
28
|
+
export { skeleton } from "./feedback/skeleton/index.js"
|
|
29
|
+
export { snackbar } from "./feedback/snackbar/index.js"
|
|
30
|
+
export { container } from "./layout/container/index.js"
|
|
13
31
|
export { flex } from "./layout/flex/index.js"
|
|
14
32
|
export { grid } from "./layout/grid/index.js"
|
|
33
|
+
export { bottomNavigation } from "./navigation/bottom-navigation/index.js"
|
|
34
|
+
export { breadcrumbs } from "./navigation/breadcrumbs/index.js"
|
|
35
|
+
export { drawer } from "./navigation/drawer/index.js"
|
|
36
|
+
export { link } from "./navigation/link/index.js"
|
|
37
|
+
export { menu } from "./navigation/menu/index.js"
|
|
38
|
+
export { pagination } from "./navigation/pagination/index.js"
|
|
39
|
+
export { speedDial } from "./navigation/speed-dial/index.js"
|
|
40
|
+
export { stepper } from "./navigation/stepper/index.js"
|
|
41
|
+
export { tabs } from "./navigation/tabs/index.js"
|
|
42
|
+
export { accordion } from "./surfaces/accordion/index.js"
|
|
43
|
+
export { appBar } from "./surfaces/app-bar/index.js"
|
|
44
|
+
export { card } from "./surfaces/card/index.js"
|
|
45
|
+
export { paper } from "./surfaces/paper/index.js"
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { html } from "@inglorious/web"
|
|
2
|
+
|
|
3
|
+
import { createRender } from "../../stories/notifyStory.js"
|
|
4
|
+
import { container } from "."
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Layout/Container",
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
render: createRender(container),
|
|
10
|
+
argTypes: {
|
|
11
|
+
maxWidth: {
|
|
12
|
+
control: "text",
|
|
13
|
+
description:
|
|
14
|
+
"Maximum width. Presets: xs/sm/md/lg/xl, CSS length, number (px), or false/none.",
|
|
15
|
+
},
|
|
16
|
+
isFixed: {
|
|
17
|
+
control: "boolean",
|
|
18
|
+
description: "Keeps container width fixed at the selected max width.",
|
|
19
|
+
},
|
|
20
|
+
padding: {
|
|
21
|
+
control: "select",
|
|
22
|
+
options: ["none", "sm", "md", "lg", "xl"],
|
|
23
|
+
description: "Horizontal padding preset.",
|
|
24
|
+
},
|
|
25
|
+
isCentered: {
|
|
26
|
+
control: "boolean",
|
|
27
|
+
description: "Centers container with auto horizontal margins.",
|
|
28
|
+
},
|
|
29
|
+
element: {
|
|
30
|
+
control: "select",
|
|
31
|
+
options: [
|
|
32
|
+
"div",
|
|
33
|
+
"section",
|
|
34
|
+
"main",
|
|
35
|
+
"header",
|
|
36
|
+
"footer",
|
|
37
|
+
"nav",
|
|
38
|
+
"aside",
|
|
39
|
+
"article",
|
|
40
|
+
],
|
|
41
|
+
description: "Semantic element for the container.",
|
|
42
|
+
},
|
|
43
|
+
children: {
|
|
44
|
+
control: "text",
|
|
45
|
+
description: "Container content.",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
parameters: {
|
|
49
|
+
docs: {
|
|
50
|
+
description: {
|
|
51
|
+
component:
|
|
52
|
+
"Responsive width constraint wrapper for page sections and app shells.",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const Default = {
|
|
59
|
+
args: {
|
|
60
|
+
maxWidth: "lg",
|
|
61
|
+
isFixed: false,
|
|
62
|
+
padding: undefined,
|
|
63
|
+
isCentered: true,
|
|
64
|
+
element: "div",
|
|
65
|
+
children: html`<div style="padding: 1rem; border: 1px dashed currentColor;">
|
|
66
|
+
Content inside container
|
|
67
|
+
</div>`,
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const WidthPresets = {
|
|
72
|
+
render: () =>
|
|
73
|
+
html`<div style="display: grid; gap: 0.75rem;">
|
|
74
|
+
${["xs", "sm", "md", "lg", "xl"].map(
|
|
75
|
+
(size) =>
|
|
76
|
+
html`<div>
|
|
77
|
+
<div
|
|
78
|
+
style="font-size: 0.875rem; opacity: 0.85; margin-bottom: 0.25rem;"
|
|
79
|
+
>
|
|
80
|
+
${size}
|
|
81
|
+
</div>
|
|
82
|
+
${container.render({
|
|
83
|
+
maxWidth: size,
|
|
84
|
+
children: html`<div
|
|
85
|
+
style="padding: 0.5rem 0.75rem; border: 1px solid var(--iw-color-border);"
|
|
86
|
+
>
|
|
87
|
+
${size} container
|
|
88
|
+
</div>`,
|
|
89
|
+
})}
|
|
90
|
+
</div>`,
|
|
91
|
+
)}
|
|
92
|
+
</div>`,
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export const WithoutPadding = {
|
|
96
|
+
args: {
|
|
97
|
+
...Default.args,
|
|
98
|
+
padding: "none",
|
|
99
|
+
children: html`<div
|
|
100
|
+
style="padding: 1rem; background: color-mix(in srgb, var(--iw-color-primary) 14%, transparent);"
|
|
101
|
+
>
|
|
102
|
+
Edge-to-edge content
|
|
103
|
+
</div>`,
|
|
104
|
+
},
|
|
105
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.iw-container {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
width: 100%;
|
|
4
|
+
max-width: 68rem;
|
|
5
|
+
padding-inline: var(--iw-space-4);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.iw-container-centered {
|
|
9
|
+
margin-inline: auto;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.iw-container-fixed {
|
|
13
|
+
width: 100%;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.iw-container-padding-none {
|
|
17
|
+
padding: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.iw-container-padding-sm {
|
|
21
|
+
padding-left: var(--iw-space-2);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.iw-container-padding-md {
|
|
25
|
+
padding: var(--iw-space-4);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.iw-container-padding-lg {
|
|
29
|
+
padding: var(--iw-space-6);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.iw-container-padding-xl {
|
|
33
|
+
padding: var(--iw-space-8);
|
|
34
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../../../types/layout/container').ContainerProps} ContainerProps
|
|
3
|
+
* @typedef {import('@inglorious/web').TemplateResult} TemplateResult
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { classMap, html, ref, styleMap } from "@inglorious/web"
|
|
7
|
+
|
|
8
|
+
import { applyElementProps } from "../../shared/applyElementProps.js"
|
|
9
|
+
|
|
10
|
+
const SIZE_TO_MAX_WIDTH = {
|
|
11
|
+
xs: "32rem",
|
|
12
|
+
sm: "40rem",
|
|
13
|
+
md: "52rem",
|
|
14
|
+
lg: "68rem",
|
|
15
|
+
xl: "80rem",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @param {ContainerProps} props
|
|
20
|
+
* @returns {TemplateResult}
|
|
21
|
+
*/
|
|
22
|
+
export function render(props) {
|
|
23
|
+
const {
|
|
24
|
+
type, // eslint-disable-line no-unused-vars
|
|
25
|
+
element = "div",
|
|
26
|
+
children,
|
|
27
|
+
maxWidth = "lg",
|
|
28
|
+
isFixed = false,
|
|
29
|
+
padding = "md",
|
|
30
|
+
isCentered = true,
|
|
31
|
+
className = "",
|
|
32
|
+
...rest
|
|
33
|
+
} = props
|
|
34
|
+
|
|
35
|
+
const extraClasses = Object.fromEntries(
|
|
36
|
+
className
|
|
37
|
+
.split(/\s+/)
|
|
38
|
+
.filter(Boolean)
|
|
39
|
+
.map((name) => [name, true]),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
const classes = {
|
|
43
|
+
"iw-container": true,
|
|
44
|
+
"iw-container-fixed": isFixed,
|
|
45
|
+
"iw-container-centered": isCentered,
|
|
46
|
+
[`iw-container-padding-${padding}`]: true,
|
|
47
|
+
...extraClasses,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const styles = getContainerStyle(maxWidth, isFixed)
|
|
51
|
+
|
|
52
|
+
return renderElement(element, classes, styles, rest, children)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function renderElement(element, classes, styles, rest, children) {
|
|
56
|
+
const classValue = classMap(classes)
|
|
57
|
+
const styleValue = styleMap(styles)
|
|
58
|
+
const refValue = ref((el) => applyElementProps(el, rest))
|
|
59
|
+
|
|
60
|
+
switch (element) {
|
|
61
|
+
case "section":
|
|
62
|
+
return html`<section class=${classValue} style=${styleValue} ${refValue}>
|
|
63
|
+
${children}
|
|
64
|
+
</section>`
|
|
65
|
+
case "main":
|
|
66
|
+
return html`<main class=${classValue} style=${styleValue} ${refValue}>
|
|
67
|
+
${children}
|
|
68
|
+
</main>`
|
|
69
|
+
case "header":
|
|
70
|
+
return html`<header class=${classValue} style=${styleValue} ${refValue}>
|
|
71
|
+
${children}
|
|
72
|
+
</header>`
|
|
73
|
+
case "footer":
|
|
74
|
+
return html`<footer class=${classValue} style=${styleValue} ${refValue}>
|
|
75
|
+
${children}
|
|
76
|
+
</footer>`
|
|
77
|
+
case "nav":
|
|
78
|
+
return html`<nav class=${classValue} style=${styleValue} ${refValue}>
|
|
79
|
+
${children}
|
|
80
|
+
</nav>`
|
|
81
|
+
case "aside":
|
|
82
|
+
return html`<aside class=${classValue} style=${styleValue} ${refValue}>
|
|
83
|
+
${children}
|
|
84
|
+
</aside>`
|
|
85
|
+
case "article":
|
|
86
|
+
return html`<article class=${classValue} style=${styleValue} ${refValue}>
|
|
87
|
+
${children}
|
|
88
|
+
</article>`
|
|
89
|
+
default:
|
|
90
|
+
return html`<div class=${classValue} style=${styleValue} ${refValue}>
|
|
91
|
+
${children}
|
|
92
|
+
</div>`
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function getContainerStyle(maxWidth, fixed) {
|
|
97
|
+
if (maxWidth === false || maxWidth === "none") {
|
|
98
|
+
return { maxWidth: "none" }
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (fixed && typeof maxWidth === "string" && SIZE_TO_MAX_WIDTH[maxWidth]) {
|
|
102
|
+
return {
|
|
103
|
+
width: "100%",
|
|
104
|
+
maxWidth: SIZE_TO_MAX_WIDTH[maxWidth],
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (typeof maxWidth === "number") {
|
|
109
|
+
return { maxWidth: `${maxWidth}px` }
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (typeof maxWidth === "string") {
|
|
113
|
+
return {
|
|
114
|
+
maxWidth: SIZE_TO_MAX_WIDTH[maxWidth] ?? maxWidth,
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return { maxWidth: SIZE_TO_MAX_WIDTH.lg }
|
|
119
|
+
}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { html } from "@inglorious/web"
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
makeStoryRender,
|
|
5
|
-
notifyActionArgType,
|
|
6
|
-
} from "../../stories/notifyStory.js"
|
|
3
|
+
import { createRender } from "../../stories/notifyStory.js"
|
|
7
4
|
import { flex } from "."
|
|
8
5
|
|
|
9
6
|
export default {
|
|
10
7
|
title: "Layout/Flex",
|
|
11
8
|
tags: ["autodocs"],
|
|
12
|
-
render:
|
|
9
|
+
render: createRender(flex),
|
|
13
10
|
argTypes: {
|
|
14
|
-
...notifyActionArgType,
|
|
15
11
|
direction: {
|
|
16
12
|
control: "select",
|
|
17
13
|
options: ["row", "column", "row-reverse", "column-reverse"],
|
|
@@ -37,11 +33,30 @@ export default {
|
|
|
37
33
|
options: ["none", "sm", "md", "lg", "xl"],
|
|
38
34
|
description: "Spacing between children.",
|
|
39
35
|
},
|
|
40
|
-
|
|
36
|
+
padding: {
|
|
37
|
+
control: "select",
|
|
38
|
+
options: ["none", "sm", "md", "lg", "xl"],
|
|
39
|
+
description: "Inner padding for the flex container.",
|
|
40
|
+
},
|
|
41
|
+
element: {
|
|
42
|
+
control: "select",
|
|
43
|
+
options: [
|
|
44
|
+
"div",
|
|
45
|
+
"section",
|
|
46
|
+
"main",
|
|
47
|
+
"header",
|
|
48
|
+
"footer",
|
|
49
|
+
"nav",
|
|
50
|
+
"aside",
|
|
51
|
+
"article",
|
|
52
|
+
],
|
|
53
|
+
description: "Semantic element for the container.",
|
|
54
|
+
},
|
|
55
|
+
isInline: {
|
|
41
56
|
control: "boolean",
|
|
42
57
|
description: "Uses inline-flex instead of flex.",
|
|
43
58
|
},
|
|
44
|
-
|
|
59
|
+
isFullWidth: {
|
|
45
60
|
control: "boolean",
|
|
46
61
|
description: "Expands container width to 100%.",
|
|
47
62
|
},
|
|
@@ -49,6 +64,7 @@ export default {
|
|
|
49
64
|
control: "object",
|
|
50
65
|
description: "Array of templates/content rendered as-is.",
|
|
51
66
|
},
|
|
67
|
+
onClick: { action: "onClick" },
|
|
52
68
|
},
|
|
53
69
|
parameters: {
|
|
54
70
|
docs: {
|
|
@@ -67,8 +83,10 @@ Default.args = {
|
|
|
67
83
|
justify: "start",
|
|
68
84
|
align: "stretch",
|
|
69
85
|
gap: "md",
|
|
70
|
-
|
|
71
|
-
|
|
86
|
+
padding: "none",
|
|
87
|
+
element: "div",
|
|
88
|
+
isInline: false,
|
|
89
|
+
isFullWidth: false,
|
|
72
90
|
children: [
|
|
73
91
|
html`<div>First</div>`,
|
|
74
92
|
html`<div>Second</div>`,
|
package/src/layout/flex/index.js
CHANGED
|
@@ -100,4 +100,24 @@
|
|
|
100
100
|
&.iw-flex-gap-xl {
|
|
101
101
|
gap: var(--iw-space-8);
|
|
102
102
|
}
|
|
103
|
+
|
|
104
|
+
&.iw-flex-padding-none {
|
|
105
|
+
padding: 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&.iw-flex-padding-sm {
|
|
109
|
+
padding: var(--iw-space-2);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&.iw-flex-padding-md {
|
|
113
|
+
padding: var(--iw-space-4);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&.iw-flex-padding-lg {
|
|
117
|
+
padding: var(--iw-space-6);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&.iw-flex-padding-xl {
|
|
121
|
+
padding: var(--iw-space-8);
|
|
122
|
+
}
|
|
103
123
|
}
|
|
@@ -1,41 +1,68 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef {import('../../../types/layout/flex').
|
|
3
|
-
* @typedef {import('@inglorious/web').Api} Api
|
|
2
|
+
* @typedef {import('../../../types/layout/flex').FlexProps} FlexProps
|
|
4
3
|
* @typedef {import('@inglorious/web').TemplateResult} TemplateResult
|
|
5
4
|
*/
|
|
6
5
|
|
|
7
|
-
import { classMap,
|
|
6
|
+
import { classMap, ref, staticHtml, unsafeStatic } from "@inglorious/web"
|
|
7
|
+
|
|
8
|
+
import { applyElementProps } from "../../shared/applyElementProps.js"
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Flex layout component for Inglorious Web.
|
|
11
12
|
* Children are rendered as-is (templates/content composition).
|
|
12
13
|
*
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {Api} api
|
|
14
|
+
* @param {FlexProps} props
|
|
15
15
|
* @returns {TemplateResult}
|
|
16
16
|
*/
|
|
17
|
-
export function render(
|
|
17
|
+
export function render(props) {
|
|
18
18
|
const {
|
|
19
|
+
element = "div",
|
|
19
20
|
direction = "row",
|
|
20
21
|
wrap = "nowrap",
|
|
21
22
|
justify = "start",
|
|
22
23
|
align = "stretch",
|
|
23
|
-
gap = "
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
gap = "none",
|
|
25
|
+
padding = "none",
|
|
26
|
+
isInline = false,
|
|
27
|
+
isFullWidth = false,
|
|
28
|
+
className = "",
|
|
26
29
|
children = [],
|
|
27
|
-
|
|
30
|
+
onClick,
|
|
31
|
+
...rest
|
|
32
|
+
} = props
|
|
33
|
+
|
|
34
|
+
const extraClasses = Object.fromEntries(
|
|
35
|
+
className
|
|
36
|
+
.split(/\s+/)
|
|
37
|
+
.filter(Boolean)
|
|
38
|
+
.map((name) => [name, true]),
|
|
39
|
+
)
|
|
28
40
|
|
|
29
41
|
const classes = {
|
|
30
42
|
"iw-flex": true,
|
|
31
|
-
"iw-flex-inline":
|
|
32
|
-
"iw-flex-full-width":
|
|
43
|
+
"iw-flex-inline": isInline,
|
|
44
|
+
"iw-flex-full-width": isFullWidth,
|
|
33
45
|
[`iw-flex-direction-${direction}`]: true,
|
|
34
46
|
[`iw-flex-wrap-${wrap}`]: true,
|
|
35
47
|
[`iw-flex-justify-${justify}`]: true,
|
|
36
48
|
[`iw-flex-align-${align}`]: true,
|
|
37
49
|
[`iw-flex-gap-${gap}`]: true,
|
|
50
|
+
[`iw-flex-padding-${padding}`]: true,
|
|
51
|
+
...extraClasses,
|
|
38
52
|
}
|
|
39
53
|
|
|
40
|
-
return
|
|
54
|
+
return renderElement(element, classes, onClick, children, rest)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function renderElement(element, classes, onClick, children, rest) {
|
|
58
|
+
const classValue = classMap(classes)
|
|
59
|
+
const staticTag = unsafeStatic(element)
|
|
60
|
+
|
|
61
|
+
return staticHtml`<${staticTag}
|
|
62
|
+
class=${classValue}
|
|
63
|
+
@click=${onClick}
|
|
64
|
+
${ref((node) => applyElementProps(node, rest))}
|
|
65
|
+
>
|
|
66
|
+
${children}
|
|
67
|
+
</${staticTag}>`
|
|
41
68
|
}
|