@inglorious/ui 1.0.1 → 2.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/package.json +11 -9
- package/src/controls/button/button.stories.js +2 -2
- package/src/controls/button/index.js +1 -1
- package/src/controls/button/template.js +2 -2
- package/src/controls/button-group/button-group.stories.js +2 -2
- package/src/controls/button-group/index.js +1 -1
- package/src/controls/button-group/template.js +4 -4
- package/src/controls/checkbox/checkbox.stories.js +2 -2
- package/src/controls/checkbox/index.js +1 -1
- package/src/controls/checkbox/template.js +2 -2
- package/src/controls/combobox/combobox.stories.js +3 -3
- package/src/controls/combobox/index.js +2 -2
- package/src/controls/combobox/template.js +35 -14
- package/src/controls/fab/fab.stories.js +2 -2
- package/src/controls/fab/index.js +1 -1
- package/src/controls/fab/template.js +4 -4
- package/src/controls/icon-button/icon-button.stories.js +2 -2
- package/src/controls/icon-button/index.js +1 -1
- package/src/controls/icon-button/template.js +4 -4
- package/src/controls/input/index.js +1 -1
- package/src/controls/input/input.stories.js +2 -2
- package/src/controls/input/template.js +2 -2
- package/src/controls/radio-group/index.js +1 -1
- package/src/controls/radio-group/radio-group.stories.js +2 -2
- package/src/controls/radio-group/template.js +2 -2
- package/src/controls/rating/index.js +1 -1
- package/src/controls/rating/rating.stories.js +2 -2
- package/src/controls/rating/template.js +2 -2
- package/src/controls/select/index.js +1 -1
- package/src/controls/select/select.stories.js +2 -2
- package/src/controls/select/template.js +2 -2
- package/src/controls/slider/index.js +1 -1
- package/src/controls/slider/slider.stories.js +2 -2
- package/src/controls/slider/template.js +2 -2
- package/src/controls/switch/index.js +1 -1
- package/src/controls/switch/switch.stories.js +2 -2
- package/src/controls/switch/template.js +2 -2
- package/src/data-display/avatar/avatar.stories.js +2 -2
- package/src/data-display/avatar/index.js +1 -1
- package/src/data-display/avatar/template.js +2 -1
- package/src/data-display/badge/badge.stories.js +2 -2
- package/src/data-display/badge/index.js +1 -1
- package/src/data-display/badge/template.js +7 -0
- package/src/data-display/chip/chip.stories.js +2 -2
- package/src/data-display/chip/index.js +1 -1
- package/src/data-display/chip/template.js +7 -0
- package/src/data-display/data-grid/data-grid.stories.js +4 -4
- package/src/data-display/data-grid/filters/index.js +10 -10
- package/src/data-display/data-grid/filters/input.js +3 -3
- package/src/data-display/data-grid/filters/range.js +4 -4
- package/src/data-display/data-grid/filters/select.js +3 -3
- package/src/data-display/data-grid/index.js +2 -2
- package/src/data-display/data-grid/template.js +40 -28
- package/src/data-display/divider/divider.stories.js +2 -2
- package/src/data-display/divider/index.js +1 -1
- package/src/data-display/divider/template.js +7 -0
- package/src/data-display/icon/icon-implementations.mdx +4 -4
- package/src/data-display/icon/icon-utf8.stories.js +9 -9
- package/src/data-display/icon/icon.stories.js +2 -2
- package/src/data-display/icon/index.js +1 -1
- package/src/data-display/icon/template.js +7 -0
- package/src/data-display/list/index.js +2 -2
- package/src/data-display/list/list.stories.js +2 -2
- package/src/data-display/list/template.js +22 -13
- package/src/data-display/material-icon/index.js +1 -1
- package/src/data-display/material-icon/material-icon.stories.js +2 -2
- package/src/data-display/material-icon/template.js +7 -0
- package/src/data-display/table/index.js +1 -1
- package/src/data-display/table/table.stories.js +2 -2
- package/src/data-display/table/template.js +19 -1
- package/src/data-display/tooltip/index.js +1 -1
- package/src/data-display/tooltip/template.js +2 -0
- package/src/data-display/tooltip/tooltip.stories.js +2 -2
- package/src/data-display/typography/index.js +1 -1
- package/src/data-display/typography/template.js +2 -0
- package/src/data-display/typography/typography.stories.js +2 -2
- package/src/data-display/virtual-list/index.js +1 -1
- package/src/data-display/virtual-list/template.js +4 -2
- package/src/examples/dashboard/app-drawer.js +15 -15
- package/src/examples/dashboard/app-header.js +33 -33
- package/src/examples/dashboard/dashboard-jsx.jsx +76 -0
- package/src/examples/dashboard/dashboard-vue.vue +68 -0
- package/src/examples/dashboard/dashboard.js +43 -42
- package/src/examples/dashboard/dashboard.stories.js +46 -16
- package/src/examples/dashboard/mode.js +1 -1
- package/src/examples/dashboard/primitive-content.js +248 -248
- package/src/examples/dashboard/primitive-section.js +25 -25
- package/src/examples/dashboard/router.js +1 -1
- package/src/examples/dashboard/social-card.js +14 -14
- package/src/examples/dashboard/stat-card.js +12 -12
- package/src/examples/dashboard/theme.js +1 -1
- package/src/examples/dashboard/traffic-card.js +22 -22
- package/src/examples/dashboard/traffic-sales-card.js +39 -39
- package/src/feedback/alert/alert.stories.js +2 -2
- package/src/feedback/alert/index.js +2 -2
- package/src/feedback/alert/template.js +2 -0
- package/src/feedback/backdrop/backdrop.stories.js +2 -2
- package/src/feedback/backdrop/index.js +2 -2
- package/src/feedback/backdrop/template.js +2 -0
- package/src/feedback/dialog/dialog.stories.js +2 -2
- package/src/feedback/dialog/index.js +2 -2
- package/src/feedback/dialog/template.js +2 -0
- package/src/feedback/progress/index.js +1 -1
- package/src/feedback/progress/progress.stories.js +2 -2
- package/src/feedback/progress/template.js +3 -1
- package/src/feedback/skeleton/index.js +2 -2
- package/src/feedback/skeleton/skeleton.stories.js +2 -2
- package/src/feedback/skeleton/template.js +2 -0
- package/src/feedback/snackbar/index.js +2 -2
- package/src/feedback/snackbar/snackbar.stories.js +2 -2
- package/src/feedback/snackbar/template.js +2 -0
- package/src/index.js +45 -45
- package/src/layout/container/container.stories.js +3 -3
- package/src/layout/container/index.js +1 -1
- package/src/layout/container/template.js +2 -0
- package/src/layout/flex/flex.stories.js +2 -2
- package/src/layout/flex/index.js +1 -1
- package/src/layout/flex/template.js +2 -3
- package/src/layout/grid/grid.stories.js +2 -2
- package/src/layout/grid/index.js +1 -1
- package/src/layout/grid/template.js +2 -3
- package/src/navigation/bottom-navigation/bottom-navigation.stories.js +2 -2
- package/src/navigation/bottom-navigation/index.js +1 -1
- package/src/navigation/bottom-navigation/template.js +16 -2
- package/src/navigation/breadcrumbs/breadcrumbs.stories.js +2 -2
- package/src/navigation/breadcrumbs/index.js +1 -1
- package/src/navigation/breadcrumbs/template.js +16 -2
- package/src/navigation/drawer/drawer.stories.js +2 -2
- package/src/navigation/drawer/index.js +1 -1
- package/src/navigation/drawer/template.js +15 -13
- package/src/navigation/link/index.js +2 -2
- package/src/navigation/link/link.stories.js +2 -2
- package/src/navigation/link/template.js +2 -0
- package/src/navigation/menu/index.js +1 -1
- package/src/navigation/menu/menu.stories.js +2 -2
- package/src/navigation/menu/template.js +15 -1
- package/src/navigation/pagination/index.js +1 -1
- package/src/navigation/pagination/pagination.stories.js +2 -2
- package/src/navigation/pagination/template.js +20 -4
- package/src/navigation/speed-dial/index.js +1 -1
- package/src/navigation/speed-dial/speed-dial.stories.js +2 -2
- package/src/navigation/speed-dial/template.js +15 -1
- package/src/navigation/stepper/index.js +1 -1
- package/src/navigation/stepper/stepper.stories.js +2 -2
- package/src/navigation/stepper/template.js +15 -1
- package/src/navigation/tabs/index.js +1 -1
- package/src/navigation/tabs/tabs.stories.js +2 -2
- package/src/navigation/tabs/template.js +17 -1
- package/src/surfaces/accordion/accordion.stories.js +2 -2
- package/src/surfaces/accordion/index.js +1 -1
- package/src/surfaces/accordion/template.js +15 -1
- package/src/surfaces/app-bar/app-bar.stories.js +2 -2
- package/src/surfaces/app-bar/index.js +1 -1
- package/src/surfaces/app-bar/template.js +2 -0
- package/src/surfaces/card/card.stories.js +2 -2
- package/src/surfaces/card/index.js +1 -1
- package/src/surfaces/card/template.js +19 -1
- package/src/surfaces/paper/index.js +2 -2
- package/src/surfaces/paper/paper.stories.js +3 -3
- package/src/surfaces/paper/template.js +2 -0
- package/types/controls/button-group.d.ts +1 -1
- package/types/controls/button.d.ts +2 -2
- package/types/controls/checkbox.d.ts +1 -1
- package/types/controls/combobox.d.ts +2 -1
- package/types/controls/fab.d.ts +1 -1
- package/types/controls/icon-button.d.ts +1 -1
- package/types/controls/input.d.ts +1 -1
- package/types/controls/radio-group.d.ts +1 -1
- package/types/controls/rating.d.ts +1 -1
- package/types/controls/select.d.ts +1 -1
- package/types/controls/slider.d.ts +1 -1
- package/types/controls/switch.d.ts +1 -1
- package/types/data-display/avatar.d.ts +1 -1
- package/types/data-display/badge.d.ts +1 -1
- package/types/data-display/chip.d.ts +1 -1
- package/types/data-display/data-grid.d.ts +2 -1
- package/types/data-display/divider.d.ts +1 -1
- package/types/data-display/icon.d.ts +1 -1
- package/types/data-display/list.d.ts +2 -1
- package/types/data-display/material-icon.d.ts +1 -1
- package/types/data-display/table.d.ts +2 -1
- package/types/data-display/tooltip.d.ts +1 -1
- package/types/data-display/typography.d.ts +1 -1
- package/types/data-display/virtual-list.d.ts +1 -1
- package/types/feedback/alert.d.ts +1 -1
- package/types/feedback/backdrop.d.ts +1 -1
- package/types/feedback/dialog.d.ts +1 -1
- package/types/feedback/progress.d.ts +1 -1
- package/types/feedback/skeleton.d.ts +1 -1
- package/types/feedback/snackbar.d.ts +1 -1
- package/types/layout/container.d.ts +1 -1
- package/types/layout/flex.d.ts +1 -1
- package/types/layout/grid.d.ts +1 -1
- package/types/navigation/bottom-navigation.d.ts +2 -1
- package/types/navigation/breadcrumbs.d.ts +2 -1
- package/types/navigation/drawer.d.ts +1 -1
- package/types/navigation/link.d.ts +1 -1
- package/types/navigation/menu.d.ts +2 -1
- package/types/navigation/pagination.d.ts +2 -1
- package/types/navigation/speed-dial.d.ts +2 -1
- package/types/navigation/stepper.d.ts +2 -1
- package/types/navigation/tabs.d.ts +2 -1
- package/types/surfaces/accordion.d.ts +2 -1
- package/types/surfaces/app-bar.d.ts +1 -1
- package/types/surfaces/card.d.ts +2 -1
- package/types/surfaces/paper.d.ts +1 -1
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
import { classMap, html, styleMap } from "@inglorious/web"
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Renders an avatar with image, initials, or fallback content.
|
|
10
|
+
* Supports size, shape, and automatic background color generation.
|
|
10
11
|
* @param {AvatarProps} props
|
|
11
12
|
* @returns {TemplateResult}
|
|
12
13
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRender } from "../../stories/notifyStory.js"
|
|
2
|
-
import {
|
|
2
|
+
import { Badge } from "."
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
title: "Data Display/Badge",
|
|
6
6
|
tags: ["autodocs"],
|
|
7
|
-
render: createRender(
|
|
7
|
+
render: createRender(Badge),
|
|
8
8
|
argTypes: {
|
|
9
9
|
children: { control: "text", description: "Badge content." },
|
|
10
10
|
color: {
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef {import('../../../types/data-display/badge').BadgeProps} BadgeProps
|
|
3
|
+
* @typedef {import('@inglorious/web').TemplateResult} TemplateResult
|
|
3
4
|
*/
|
|
4
5
|
|
|
5
6
|
import { classMap, html, styleMap } from "@inglorious/web"
|
|
6
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Renders a compact badge for status, labels, or counts.
|
|
10
|
+
* Supports color, variant, size, shape, and optional ring styling.
|
|
11
|
+
* @param {BadgeProps} props
|
|
12
|
+
* @returns {TemplateResult}
|
|
13
|
+
*/
|
|
7
14
|
export function render(props) {
|
|
8
15
|
const {
|
|
9
16
|
children,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRender } from "../../stories/notifyStory.js"
|
|
2
|
-
import {
|
|
2
|
+
import { Chip } from "."
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
title: "Data Display/Chip",
|
|
6
6
|
tags: ["autodocs"],
|
|
7
|
-
render: createRender(
|
|
7
|
+
render: createRender(Chip),
|
|
8
8
|
argTypes: {
|
|
9
9
|
children: { control: "text", description: "Chip label content." },
|
|
10
10
|
isRemovable: {
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef {import('../../../types/data-display/chip').ChipProps} ChipProps
|
|
3
|
+
* @typedef {import('@inglorious/web').TemplateResult} TemplateResult
|
|
3
4
|
*/
|
|
4
5
|
|
|
5
6
|
import { classMap, html } from "@inglorious/web"
|
|
6
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Renders a compact chip label with optional remove action.
|
|
10
|
+
* Use chips for tags, filters, or selected values.
|
|
11
|
+
* @param {ChipProps} props
|
|
12
|
+
* @returns {TemplateResult}
|
|
13
|
+
*/
|
|
7
14
|
export function render(props) {
|
|
8
15
|
const {
|
|
9
16
|
children,
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
createEntityRender,
|
|
3
3
|
notifyActionArgType,
|
|
4
4
|
} from "../../stories/notifyStory.js"
|
|
5
|
-
import {
|
|
5
|
+
import { DataGrid } from "."
|
|
6
6
|
|
|
7
7
|
const baseRows = [
|
|
8
8
|
{ id: 1, name: "Charlie", age: 35, active: true, role: "Admin" },
|
|
@@ -57,7 +57,7 @@ function createRows(count) {
|
|
|
57
57
|
export default {
|
|
58
58
|
title: "Data Display/DataGrid",
|
|
59
59
|
tags: ["autodocs"],
|
|
60
|
-
render: createEntityRender({
|
|
60
|
+
render: createEntityRender({ DataGrid }),
|
|
61
61
|
argTypes: {
|
|
62
62
|
...notifyActionArgType,
|
|
63
63
|
id: { control: "text", description: "Optional grid id" },
|
|
@@ -75,7 +75,7 @@ export default {
|
|
|
75
75
|
export const Default = {
|
|
76
76
|
args: {
|
|
77
77
|
id: "dataGrid",
|
|
78
|
-
type: "
|
|
78
|
+
type: "DataGrid",
|
|
79
79
|
rows: baseRows,
|
|
80
80
|
columns: baseColumns,
|
|
81
81
|
search: {},
|
|
@@ -130,7 +130,7 @@ export const FlexibleWidths = {
|
|
|
130
130
|
export const Virtualized = {
|
|
131
131
|
args: {
|
|
132
132
|
id: "virtualizedGrid",
|
|
133
|
-
type: "
|
|
133
|
+
type: "DataGrid",
|
|
134
134
|
rows: createRows(1000),
|
|
135
135
|
columns: baseColumns,
|
|
136
136
|
search: null,
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { choose, html } from "@inglorious/web"
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { InputFilter } from "./input.js"
|
|
4
|
+
import { RangeFilter } from "./range.js"
|
|
5
|
+
import { SelectFilter } from "./select.js"
|
|
6
6
|
|
|
7
|
-
export const
|
|
7
|
+
export const Filters = {
|
|
8
8
|
render(entity, column) {
|
|
9
9
|
return html`${choose(
|
|
10
10
|
column.filter.type,
|
|
11
11
|
[
|
|
12
|
-
["range", () =>
|
|
13
|
-
["date", () =>
|
|
14
|
-
["time", () =>
|
|
15
|
-
["datetime", () =>
|
|
16
|
-
["select", () =>
|
|
12
|
+
["range", () => RangeFilter.render(entity, column)],
|
|
13
|
+
["date", () => RangeFilter.render(entity, column)],
|
|
14
|
+
["time", () => RangeFilter.render(entity, column)],
|
|
15
|
+
["datetime", () => RangeFilter.render(entity, column)],
|
|
16
|
+
["select", () => SelectFilter.render(entity, column)],
|
|
17
17
|
],
|
|
18
|
-
() =>
|
|
18
|
+
() => InputFilter.render(entity, column),
|
|
19
19
|
)}`
|
|
20
20
|
},
|
|
21
21
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Input } from "../../../controls/input"
|
|
2
2
|
import { format } from "./helpers"
|
|
3
3
|
|
|
4
4
|
const DEFAULT_PLACEHOLDER = {
|
|
@@ -6,9 +6,9 @@ const DEFAULT_PLACEHOLDER = {
|
|
|
6
6
|
text: "Contains...",
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export const
|
|
9
|
+
export const InputFilter = {
|
|
10
10
|
render(entity, column) {
|
|
11
|
-
return
|
|
11
|
+
return Input.render({
|
|
12
12
|
name: column.id,
|
|
13
13
|
inputType: column.filter.type,
|
|
14
14
|
placeholder:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html } from "@inglorious/web"
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Input } from "../../../controls/input"
|
|
4
4
|
import { format } from "./helpers"
|
|
5
5
|
|
|
6
6
|
const RANGE_TYPE = {
|
|
@@ -10,10 +10,10 @@ const RANGE_TYPE = {
|
|
|
10
10
|
datetime: "datetime-local",
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export const
|
|
13
|
+
export const RangeFilter = {
|
|
14
14
|
render(entity, column) {
|
|
15
15
|
return html`<div class="iw-data-grid-filter-range">
|
|
16
|
-
${
|
|
16
|
+
${Input.render({
|
|
17
17
|
name: `${column.id}Min`,
|
|
18
18
|
inputType: RANGE_TYPE[column.filter.type],
|
|
19
19
|
placeholder: column.filter.placeholder ?? "≥",
|
|
@@ -28,7 +28,7 @@ export const rangeFilter = {
|
|
|
28
28
|
})
|
|
29
29
|
},
|
|
30
30
|
})}
|
|
31
|
-
${
|
|
31
|
+
${Input.render({
|
|
32
32
|
name: `${column.id}Max`,
|
|
33
33
|
inputType: RANGE_TYPE[column.filter.type],
|
|
34
34
|
placeholder: column.filter.placeholder ?? "≤",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Select } from "../../../controls/select"
|
|
2
2
|
import { format } from "./helpers"
|
|
3
3
|
|
|
4
|
-
export const
|
|
4
|
+
export const SelectFilter = {
|
|
5
5
|
render(entity, column) {
|
|
6
|
-
return
|
|
6
|
+
return Select.render({
|
|
7
7
|
name: column.id,
|
|
8
8
|
size: "sm",
|
|
9
9
|
isFullWidth: true,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as handlers from "./handlers.js"
|
|
2
2
|
import * as helpers from "./helpers.js"
|
|
3
|
-
import {
|
|
3
|
+
import { DataGrid as renderers } from "./template.js"
|
|
4
4
|
|
|
5
|
-
export const
|
|
5
|
+
export const DataGrid = {
|
|
6
6
|
...handlers,
|
|
7
7
|
...renderers,
|
|
8
8
|
render(entity, api) {
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
import { classMap, html, repeat, when } from "@inglorious/web"
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
10
|
+
import { Input } from "../../controls/input/index.js"
|
|
11
|
+
import { Select } from "../../controls/select/index.js"
|
|
12
|
+
import { Pagination } from "../../navigation/pagination/index.js"
|
|
13
|
+
import { VirtualList } from "../virtual-list/index.js"
|
|
14
|
+
import { Filters } from "./filters"
|
|
15
15
|
import {
|
|
16
16
|
getPaginationInfo,
|
|
17
17
|
getRowKeyValue,
|
|
@@ -25,9 +25,10 @@ const PRETTY_PAGE = 1
|
|
|
25
25
|
const FIRST_PAGE = 0
|
|
26
26
|
const LAST_PAGE = 1
|
|
27
27
|
|
|
28
|
-
export const
|
|
28
|
+
export const DataGrid = {
|
|
29
29
|
/**
|
|
30
|
-
* Main entrypoint
|
|
30
|
+
* Main entrypoint for the data grid template. It delegates to the base grid renderer so overrides can still reuse it.
|
|
31
|
+
* Data grids support sorting, filtering, selection, pagination, and optional virtualization.
|
|
31
32
|
* @param {DataGridProps} props The data grid props.
|
|
32
33
|
* @returns {TemplateResult} The rendered data grid.
|
|
33
34
|
*/
|
|
@@ -36,7 +37,8 @@ export const dataGrid = {
|
|
|
36
37
|
},
|
|
37
38
|
|
|
38
39
|
/**
|
|
39
|
-
* Renders the data grid
|
|
40
|
+
* Renders the data grid container and wires the header, body, and footer regions.
|
|
41
|
+
* This is the canonical renderer that custom `render()` overrides should call.
|
|
40
42
|
* @param {DataGridProps} props The data grid props.
|
|
41
43
|
* @returns {TemplateResult} The rendered data grid.
|
|
42
44
|
*/
|
|
@@ -55,7 +57,8 @@ export const dataGrid = {
|
|
|
55
57
|
},
|
|
56
58
|
|
|
57
59
|
/**
|
|
58
|
-
* Renders the
|
|
60
|
+
* Renders the grid header region, including optional toolbar and column headers.
|
|
61
|
+
* Column rendering is delegated to `renderHeaderColumn`.
|
|
59
62
|
* @param {DataGridProps} props The data grid props.
|
|
60
63
|
* @returns {TemplateResult} The rendered header.
|
|
61
64
|
*/
|
|
@@ -74,7 +77,8 @@ export const dataGrid = {
|
|
|
74
77
|
},
|
|
75
78
|
|
|
76
79
|
/**
|
|
77
|
-
* Renders the toolbar
|
|
80
|
+
* Renders the toolbar row that contains search, bulk actions, and filtering controls.
|
|
81
|
+
* Override to customize the global header tools.
|
|
78
82
|
* @param {DataGridProps} props The data grid props.
|
|
79
83
|
* @returns {TemplateResult}
|
|
80
84
|
*/
|
|
@@ -85,7 +89,8 @@ export const dataGrid = {
|
|
|
85
89
|
},
|
|
86
90
|
|
|
87
91
|
/**
|
|
88
|
-
* Renders a single column
|
|
92
|
+
* Renders a single column header cell, including sorting and filter affordances.
|
|
93
|
+
* Override to customize header labels or controls per column.
|
|
89
94
|
* @param {DataGridProps} props The data grid props.
|
|
90
95
|
* @param {object} payload The payload.
|
|
91
96
|
* @param {Column} payload.column The column definition.
|
|
@@ -103,7 +108,7 @@ export const dataGrid = {
|
|
|
103
108
|
${column.title} ${getSortIcon(getSortDirection(props, column.id))}
|
|
104
109
|
</div>
|
|
105
110
|
|
|
106
|
-
${column.isFilterable &&
|
|
111
|
+
${column.isFilterable && Filters.render(props, column)}
|
|
107
112
|
|
|
108
113
|
<div
|
|
109
114
|
class="iw-data-grid-column-resizer"
|
|
@@ -118,13 +123,14 @@ export const dataGrid = {
|
|
|
118
123
|
},
|
|
119
124
|
|
|
120
125
|
/**
|
|
121
|
-
* Renders the search
|
|
126
|
+
* Renders the global search input shown in the grid toolbar.
|
|
127
|
+
* Used when `search` is enabled in the grid props.
|
|
122
128
|
* @param {DataGridProps} props The data grid props.
|
|
123
129
|
* @returns {TemplateResult} The rendered search bar.
|
|
124
130
|
*/
|
|
125
131
|
renderSearchbar(props) {
|
|
126
132
|
return html`<div class="iw-data-grid-searchbar">
|
|
127
|
-
${
|
|
133
|
+
${Input.render({
|
|
128
134
|
size: "sm",
|
|
129
135
|
isFullWidth: true,
|
|
130
136
|
name: "search",
|
|
@@ -137,7 +143,8 @@ export const dataGrid = {
|
|
|
137
143
|
},
|
|
138
144
|
|
|
139
145
|
/**
|
|
140
|
-
* Renders the
|
|
146
|
+
* Renders the grid body, either as a standard list of rows or as a virtualized list.
|
|
147
|
+
* Row rendering is delegated to `renderRow`.
|
|
141
148
|
* @param {DataGridProps} props The data grid props.
|
|
142
149
|
* @returns {TemplateResult} The rendered data grid body.
|
|
143
150
|
*/
|
|
@@ -157,7 +164,7 @@ export const dataGrid = {
|
|
|
157
164
|
const virtualState = getVirtualizationState(props, rows.length)
|
|
158
165
|
const virtualEntity = {
|
|
159
166
|
id: props.id,
|
|
160
|
-
type: "
|
|
167
|
+
type: "DataGridVirtualRows",
|
|
161
168
|
items: rows,
|
|
162
169
|
className: "iw-data-grid-body",
|
|
163
170
|
scrollTop: virtualState.scrollTop,
|
|
@@ -183,11 +190,12 @@ export const dataGrid = {
|
|
|
183
190
|
}),
|
|
184
191
|
}
|
|
185
192
|
|
|
186
|
-
return
|
|
193
|
+
return VirtualList.render(virtualEntity, virtualApi)
|
|
187
194
|
},
|
|
188
195
|
|
|
189
196
|
/**
|
|
190
|
-
* Renders a single row
|
|
197
|
+
* Renders a single data row and wires row click/selection handlers.
|
|
198
|
+
* Cells are delegated to `renderCell` for customization.
|
|
191
199
|
* @param {DataGridProps} props The data grid props.
|
|
192
200
|
* @param {object} payload The payload.
|
|
193
201
|
* @param {Row} payload.row The row data.
|
|
@@ -220,7 +228,8 @@ export const dataGrid = {
|
|
|
220
228
|
},
|
|
221
229
|
|
|
222
230
|
/**
|
|
223
|
-
* Renders a single cell
|
|
231
|
+
* Renders a single cell container and delegates the value to `renderValue`.
|
|
232
|
+
* Override to customize per-column cell structure.
|
|
224
233
|
* @param {DataGridProps} props The data grid props.
|
|
225
234
|
* @param {object} payload The payload.
|
|
226
235
|
* @param {any} payload.cell The cell data.
|
|
@@ -243,7 +252,8 @@ export const dataGrid = {
|
|
|
243
252
|
},
|
|
244
253
|
|
|
245
254
|
/**
|
|
246
|
-
* Renders the
|
|
255
|
+
* Renders the raw cell value for a column.
|
|
256
|
+
* Override to format values or inject custom content.
|
|
247
257
|
* @param {DataGridProps} _props The data grid props (ignored).
|
|
248
258
|
* @param {object} payload The payload.
|
|
249
259
|
* @param {any} payload.value The value to render.
|
|
@@ -254,7 +264,8 @@ export const dataGrid = {
|
|
|
254
264
|
},
|
|
255
265
|
|
|
256
266
|
/**
|
|
257
|
-
* Renders the
|
|
267
|
+
* Renders the grid footer, including pagination controls and page size selectors.
|
|
268
|
+
* Footer elements are delegated to `renderPagination` and `renderPageSize`.
|
|
258
269
|
* @param {DataGridProps} props The data grid props.
|
|
259
270
|
* @returns {TemplateResult} The rendered footer.
|
|
260
271
|
*/
|
|
@@ -281,14 +292,15 @@ export const dataGrid = {
|
|
|
281
292
|
},
|
|
282
293
|
|
|
283
294
|
/**
|
|
284
|
-
* Renders the
|
|
295
|
+
* Renders pagination controls for the grid footer.
|
|
296
|
+
* Override to provide custom paging UI.
|
|
285
297
|
* @param {DataGridProps} props The data grid props.
|
|
286
298
|
* @param {object} pagination The pagination info object from `getPaginationInfo`.
|
|
287
299
|
* @returns {TemplateResult} The rendered pagination controls.
|
|
288
300
|
*/
|
|
289
301
|
renderPagination(props, paginationInfo) {
|
|
290
302
|
return html`<div class="iw-data-grid-row">
|
|
291
|
-
${
|
|
303
|
+
${Pagination.renderControl(
|
|
292
304
|
{
|
|
293
305
|
buttonSize: "sm",
|
|
294
306
|
buttonVariant: "outline",
|
|
@@ -301,7 +313,7 @@ export const dataGrid = {
|
|
|
301
313
|
onChange: () => props.onPageChange?.(FIRST_PAGE),
|
|
302
314
|
},
|
|
303
315
|
)}
|
|
304
|
-
${
|
|
316
|
+
${Pagination.renderControl(
|
|
305
317
|
{
|
|
306
318
|
buttonSize: "sm",
|
|
307
319
|
buttonVariant: "outline",
|
|
@@ -314,7 +326,7 @@ export const dataGrid = {
|
|
|
314
326
|
onChange: () => props.onPagePrev?.(),
|
|
315
327
|
},
|
|
316
328
|
)}
|
|
317
|
-
${
|
|
329
|
+
${Input.render({
|
|
318
330
|
name: "page",
|
|
319
331
|
size: "sm",
|
|
320
332
|
inputType: "number",
|
|
@@ -325,7 +337,7 @@ export const dataGrid = {
|
|
|
325
337
|
})}
|
|
326
338
|
/
|
|
327
339
|
<span>${paginationInfo.totalPages}</span>
|
|
328
|
-
${
|
|
340
|
+
${Pagination.renderControl(
|
|
329
341
|
{
|
|
330
342
|
buttonSize: "sm",
|
|
331
343
|
buttonVariant: "outline",
|
|
@@ -338,7 +350,7 @@ export const dataGrid = {
|
|
|
338
350
|
onChange: () => props.onPageNext?.(),
|
|
339
351
|
},
|
|
340
352
|
)}
|
|
341
|
-
${
|
|
353
|
+
${Pagination.renderControl(
|
|
342
354
|
{
|
|
343
355
|
buttonSize: "sm",
|
|
344
356
|
buttonVariant: "outline",
|
|
@@ -358,7 +370,7 @@ export const dataGrid = {
|
|
|
358
370
|
renderPageSize(props, pagination) {
|
|
359
371
|
return html`<div class="iw-data-grid-footer-row">
|
|
360
372
|
<div>Page size:</div>
|
|
361
|
-
${
|
|
373
|
+
${Select.render({
|
|
362
374
|
size: "sm",
|
|
363
375
|
value: pagination.pageSize,
|
|
364
376
|
options: pagination.pageSizes,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { render } from "@inglorious/web/test"
|
|
2
2
|
|
|
3
3
|
import { createRender } from "../../stories/notifyStory.js"
|
|
4
|
-
import {
|
|
4
|
+
import { Divider } from "."
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
title: "Data Display/Divider",
|
|
8
8
|
tags: ["autodocs"],
|
|
9
|
-
render: createRender(
|
|
9
|
+
render: createRender(Divider),
|
|
10
10
|
argTypes: {
|
|
11
11
|
orientation: {
|
|
12
12
|
control: "select",
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef {import('../../../types/data-display/divider').DividerProps} DividerProps
|
|
3
|
+
* @typedef {import('@inglorious/web').TemplateResult} TemplateResult
|
|
3
4
|
*/
|
|
4
5
|
|
|
5
6
|
import { classMap, html } from "@inglorious/web"
|
|
6
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Renders a horizontal or vertical divider line.
|
|
10
|
+
* Supports inset styling for aligned content blocks.
|
|
11
|
+
* @param {DividerProps} props
|
|
12
|
+
* @returns {TemplateResult}
|
|
13
|
+
*/
|
|
7
14
|
export function render(props) {
|
|
8
15
|
const { orientation = "horizontal", isInset = false } = props
|
|
9
16
|
|
|
@@ -83,13 +83,13 @@ Use this page as a quick reference for supported icon strategies in `@inglorious
|
|
|
83
83
|
<div className="iw-icon-tab-panels">
|
|
84
84
|
<section className="iw-icon-tab-panel iw-icon-tab-panel-generic">
|
|
85
85
|
<p>Use <code>@inglorious/ui/icon</code> for glyphs, emoji, and simple symbols. Reference: <a href="/?path=/story/data-display-icon--unicode">UTF-8 Icons</a></p>
|
|
86
|
-
<pre><code>{`
|
|
86
|
+
<pre><code>{`Icon.render({ children: "★", size: "md", color: "primary" })`}</code></pre>
|
|
87
87
|
<div className="iw-icon-example">★ ⚑ ♫</div>
|
|
88
88
|
</section>
|
|
89
89
|
|
|
90
90
|
<section className="iw-icon-tab-panel iw-icon-tab-panel-svg">
|
|
91
91
|
<p>Use inline SVG when you want a custom icon pack without font dependencies.</p>
|
|
92
|
-
<pre><code>{`
|
|
92
|
+
<pre><code>{`Icon.render({
|
|
93
93
|
children: html\`<svg viewBox="0 0 24 24" ...>...</svg>\`,
|
|
94
94
|
size: "md",
|
|
95
95
|
})`}</code></pre>
|
|
@@ -109,7 +109,7 @@ Use this page as a quick reference for supported icon strategies in `@inglorious
|
|
|
109
109
|
|
|
110
110
|
<section className="iw-icon-tab-panel iw-icon-tab-panel-material">
|
|
111
111
|
<p>Use <code>@inglorious/ui/material-icon</code> when Material Symbols fonts are loaded. Reference: <a href="https://fonts.google.com/icons?icon.set=Material+Icons" target="_blank">Material Icons</a></p>
|
|
112
|
-
<pre><code>{`
|
|
112
|
+
<pre><code>{`MaterialIcon.render({ name: "home", filled: true, size: "md" })`}</code></pre>
|
|
113
113
|
<div className="iw-icon-example">
|
|
114
114
|
<span className="iw-material-symbol" aria-hidden="true">home</span>
|
|
115
115
|
<span className="iw-material-symbol" aria-hidden="true">settings</span>
|
|
@@ -119,7 +119,7 @@ Use this page as a quick reference for supported icon strategies in `@inglorious
|
|
|
119
119
|
|
|
120
120
|
<section className="iw-icon-tab-panel iw-icon-tab-panel-fa">
|
|
121
121
|
<p>Load Font Awesome CSS globally, then pass an icon element as <code>children</code>. Reference: <a href="https://fontawesome.com/search" target="_blank">Font Awesome Icons</a></p>
|
|
122
|
-
<pre><code>{`
|
|
122
|
+
<pre><code>{`Icon.render({
|
|
123
123
|
children: html\`<i class="fa-solid fa-user" aria-hidden="true"></i>\`,
|
|
124
124
|
})`}</code></pre>
|
|
125
125
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VirtualList } from "@inglorious/ui/virtual-list"
|
|
2
2
|
import { html, repeat } from "@inglorious/web"
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { Button } from "../../controls/button"
|
|
5
5
|
import {
|
|
6
6
|
createEntityRender,
|
|
7
7
|
notifyActionArgType,
|
|
8
8
|
} from "../../stories/notifyStory.js"
|
|
9
|
-
import {
|
|
9
|
+
import { Icon } from "."
|
|
10
10
|
|
|
11
11
|
const unicodeList = {
|
|
12
|
-
...
|
|
12
|
+
...VirtualList,
|
|
13
13
|
|
|
14
14
|
create(entity) {
|
|
15
|
-
|
|
15
|
+
VirtualList.create(entity)
|
|
16
16
|
|
|
17
17
|
const items = []
|
|
18
18
|
let rowIndex = 0
|
|
@@ -35,7 +35,7 @@ const unicodeList = {
|
|
|
35
35
|
},
|
|
36
36
|
|
|
37
37
|
render(entity, api) {
|
|
38
|
-
return
|
|
38
|
+
return VirtualList.render(entity, {
|
|
39
39
|
...api,
|
|
40
40
|
getType: () => unicodeList,
|
|
41
41
|
})
|
|
@@ -64,7 +64,7 @@ const unicodeList = {
|
|
|
64
64
|
.toUpperCase()
|
|
65
65
|
.padStart(4, "0")}`
|
|
66
66
|
|
|
67
|
-
return
|
|
67
|
+
return Button.render({
|
|
68
68
|
id: code,
|
|
69
69
|
variant: "ghost",
|
|
70
70
|
color: "default",
|
|
@@ -72,7 +72,7 @@ const unicodeList = {
|
|
|
72
72
|
shape: "square",
|
|
73
73
|
ariaLabel: label,
|
|
74
74
|
onClick: () => copyGlyph(glyph),
|
|
75
|
-
children:
|
|
75
|
+
children: Icon.render({
|
|
76
76
|
children: glyph,
|
|
77
77
|
size,
|
|
78
78
|
color: "current",
|
|
@@ -128,7 +128,7 @@ export default {
|
|
|
128
128
|
export const Unicode = {
|
|
129
129
|
args: {
|
|
130
130
|
id: "unicodeList",
|
|
131
|
-
type: "
|
|
131
|
+
type: "UnicodeList",
|
|
132
132
|
start: 0,
|
|
133
133
|
end: 129799,
|
|
134
134
|
columns: 20,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRender } from "../../stories/notifyStory.js"
|
|
2
|
-
import {
|
|
2
|
+
import { Icon } from "."
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
title: "Data Display/Icon",
|
|
6
6
|
tags: ["autodocs"],
|
|
7
|
-
render: createRender(
|
|
7
|
+
render: createRender(Icon),
|
|
8
8
|
argTypes: {
|
|
9
9
|
children: { control: "text", description: "Icon glyph or inline content." },
|
|
10
10
|
size: {
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef {import('../../../types/data-display/icon').IconProps} IconProps
|
|
3
|
+
* @typedef {import('@inglorious/web').TemplateResult} TemplateResult
|
|
3
4
|
*/
|
|
4
5
|
|
|
5
6
|
import { classMap, html } from "@inglorious/web"
|
|
6
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Renders an inline icon element with size and color control.
|
|
10
|
+
* Use it for custom SVG, emoji, or font-based glyphs.
|
|
11
|
+
* @param {IconProps} props
|
|
12
|
+
* @returns {TemplateResult}
|
|
13
|
+
*/
|
|
7
14
|
export function render({ children, size = "md", color = "current", onClick }) {
|
|
8
15
|
return html`<span
|
|
9
16
|
class=${classMap({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRender } from "../../stories/notifyStory.js"
|
|
2
|
-
import {
|
|
2
|
+
import { List } from "."
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
title: "Data Display/List",
|
|
6
6
|
tags: ["autodocs"],
|
|
7
|
-
render: createRender(
|
|
7
|
+
render: createRender(List),
|
|
8
8
|
argTypes: {
|
|
9
9
|
items: {
|
|
10
10
|
control: "object",
|