@spectric/ui 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Button.d.ts +8 -3
- package/dist/components/index.d.ts +2 -0
- package/dist/components/input.d.ts +3 -1
- package/dist/components/pagination/index.d.ts +1 -0
- package/dist/components/pagination/pagination.d.ts +60 -0
- package/dist/components/query_bar/QueryBar.d.ts +2 -3
- package/dist/components/table/body.d.ts +44 -0
- package/dist/components/table/cell.d.ts +53 -0
- package/dist/components/table/header.d.ts +42 -0
- package/dist/components/table/index.d.ts +1 -0
- package/dist/components/table/table.d.ts +90 -0
- package/dist/custom-elements.json +105 -6
- package/dist/index.es.js +1454 -1144
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +178 -72
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/components/Button.ts +12 -4
- package/src/components/button.css.ts +66 -0
- package/src/components/index.ts +3 -1
- package/src/components/input.ts +19 -2
- package/src/components/pagination/index.ts +1 -0
- package/src/components/pagination/pagination.css +10 -0
- package/src/components/pagination/pagination.ts +133 -0
- package/src/components/query_bar/QueryBar.ts +7 -21
- package/src/components/table/body.ts +69 -0
- package/src/components/table/cell.ts +117 -0
- package/src/components/table/header.ts +68 -0
- package/src/components/table/index.ts +1 -0
- package/src/components/table/table.css +36 -0
- package/src/components/table/table.ts +131 -0
- package/src/stories/Button.stories.ts +3 -2
- package/src/stories/QueryBar.stories.ts +7 -0
- package/src/stories/fixtures/data.ts +3 -0
- package/src/stories/pagination.stories.ts +63 -0
- package/src/stories/table.stories.ts +74 -0
- package/dist/assets/Banner-CZ3qKIQC.js +0 -172
- package/dist/assets/Banner.stories-BMf4MBpI.js +0 -19
- package/dist/assets/BitDisplay.stories-wztXxpxe.js +0 -18
- package/dist/assets/Bits-C_TSTjST.js +0 -1
- package/dist/assets/Button.stories-gHxjWwVf.js +0 -142
- package/dist/assets/Color-F6OSRLHC-AjFOL-zN.js +0 -1
- package/dist/assets/DocsRenderer-CFRXHY34-CvW79YxE.js +0 -761
- package/dist/assets/Header.stories-Bc09U6g1.js +0 -25
- package/dist/assets/Page.stories-DNJKhAFs.js +0 -114
- package/dist/assets/QueryBar.stories-Da5C-SV4.js +0 -17
- package/dist/assets/_commonjsHelpers-Cpj98o6Y.js +0 -1
- package/dist/assets/chunk-L4EGOTBX-AI5g0G5Z.js +0 -2
- package/dist/assets/data-CwENMT7L.js +0 -3
- package/dist/assets/dialog-CFHXbUTQ.js +0 -611
- package/dist/assets/directive-helpers-IbK5tOA8.js +0 -5
- package/dist/assets/entry-preview-Di-j0SPB.js +0 -4
- package/dist/assets/entry-preview-docs-CUBRpM7y.js +0 -1
- package/dist/assets/iframe-BQFuVTVZ.js +0 -2
- package/dist/assets/index-BCiKWbv6.js +0 -1
- package/dist/assets/index-BHYIh-Xd.js +0 -8
- package/dist/assets/index-DBGhiA-l.js +0 -1
- package/dist/assets/index-DrFu-skq.js +0 -6
- package/dist/assets/index-oFsFREWh.js +0 -9
- package/dist/assets/input.stories-Cgdv-5bN.js +0 -58
- package/dist/assets/lit-element-UdLzEcH-.js +0 -19
- package/dist/assets/preview-BWzBA1C2.js +0 -396
- package/dist/assets/preview-CGiTbRot.js +0 -2
- package/dist/assets/preview-D77C14du.js +0 -34
- package/dist/assets/preview-DEMzn_yN.js +0 -1
- package/dist/assets/preview-DFmD0pui.js +0 -1
- package/dist/assets/preview-DGUiP6tS.js +0 -7
- package/dist/assets/preview-DQVTHjv1.js +0 -182
- package/dist/assets/preview-aVwhiz9X.js +0 -1
- package/dist/assets/tiny-invariant-CopsF_GD.js +0 -1
- package/dist/components/input.css.d.ts +0 -2
- package/dist/favicon.svg +0 -1
- package/dist/iframe.html +0 -639
- package/dist/index.html +0 -190
- package/dist/index.json +0 -1
- package/dist/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/nunito-sans-bold.woff2 +0 -0
- package/dist/nunito-sans-italic.woff2 +0 -0
- package/dist/nunito-sans-regular.woff2 +0 -0
- package/dist/project.json +0 -1
- package/dist/sb-addons/chromatic-com-storybook-8/manager-bundle.js +0 -333
- package/dist/sb-addons/chromatic-com-storybook-8/manager-bundle.js.LEGAL.txt +0 -40
- package/dist/sb-addons/essentials-actions-2/manager-bundle.js +0 -3
- package/dist/sb-addons/essentials-actions-2/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-backgrounds-3/manager-bundle.js +0 -12
- package/dist/sb-addons/essentials-backgrounds-3/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-controls-1/manager-bundle.js +0 -391
- package/dist/sb-addons/essentials-controls-1/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-measure-6/manager-bundle.js +0 -3
- package/dist/sb-addons/essentials-measure-6/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-outline-7/manager-bundle.js +0 -3
- package/dist/sb-addons/essentials-outline-7/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-toolbars-5/manager-bundle.js +0 -3
- package/dist/sb-addons/essentials-toolbars-5/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-viewport-4/manager-bundle.js +0 -3
- package/dist/sb-addons/essentials-viewport-4/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +0 -3
- package/dist/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-common-assets/favicon.svg +0 -1
- package/dist/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/dist/sb-manager/globals-module-info.js +0 -1028
- package/dist/sb-manager/globals-runtime.js +0 -40861
- package/dist/sb-manager/globals.js +0 -48
- package/dist/sb-manager/runtime.js +0 -13338
- package/dist/sb-preview/globals.js +0 -33
- package/dist/sb-preview/runtime.js +0 -7174
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
spectric-table{
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
}
|
|
5
|
+
spectric-table tr{
|
|
6
|
+
text-align: center;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
spectric-table-header{
|
|
10
|
+
display: table-header-group;
|
|
11
|
+
}
|
|
12
|
+
spectric-table div[role="table"]{
|
|
13
|
+
display: table;
|
|
14
|
+
}
|
|
15
|
+
spectric-table-body {
|
|
16
|
+
display: table-row-group;
|
|
17
|
+
}
|
|
18
|
+
spectric-table-cell{
|
|
19
|
+
display: contents;
|
|
20
|
+
}
|
|
21
|
+
spectric-table-cell td{
|
|
22
|
+
position: relative;
|
|
23
|
+
}
|
|
24
|
+
spectric-table .filterable {
|
|
25
|
+
padding-top: 10px;
|
|
26
|
+
}
|
|
27
|
+
spectric-table-cell .table-cell-actions{
|
|
28
|
+
position: absolute;
|
|
29
|
+
display: flex;
|
|
30
|
+
width: 100%;
|
|
31
|
+
flex-direction: row-reverse;
|
|
32
|
+
visibility: hidden;
|
|
33
|
+
}
|
|
34
|
+
spectric-table-cell td:hover .table-cell-actions{
|
|
35
|
+
visibility: unset;
|
|
36
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { html, LitElement, TemplateResult } from 'lit';
|
|
2
|
+
import "../pagination";
|
|
3
|
+
import "./header"
|
|
4
|
+
import "./body"
|
|
5
|
+
import { customElement, property, } from 'lit/decorators.js';
|
|
6
|
+
import { HTMLElementTagWithEvents, ReactElementWithPropsAndEvents } from '../types';
|
|
7
|
+
import "./table.css"
|
|
8
|
+
export const TableElementTag = "spectric-table"
|
|
9
|
+
import { spreadProps } from '../../utils/spread';
|
|
10
|
+
import { PaginationChangeProps, PaginationProps } from '../pagination';
|
|
11
|
+
import { FilterEvent } from './cell';
|
|
12
|
+
export type { TableProps, TableEvents }
|
|
13
|
+
|
|
14
|
+
export type DomRenderable = HTMLElement | TemplateResult | string | number | null
|
|
15
|
+
|
|
16
|
+
export type ColumnSettings<T> = {
|
|
17
|
+
hidden?: boolean
|
|
18
|
+
sortable?: boolean
|
|
19
|
+
filterable?: boolean
|
|
20
|
+
title?: string
|
|
21
|
+
key?: string
|
|
22
|
+
render?: (row: T, table: TableElement<T>) => DomRenderable
|
|
23
|
+
}
|
|
24
|
+
interface TableProps<T> {
|
|
25
|
+
pagination?: PaginationProps
|
|
26
|
+
columns: ColumnSettings<T>[]
|
|
27
|
+
data: T[]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Table Element
|
|
32
|
+
*
|
|
33
|
+
* The table element is a bit more complex and the column settings and data can only be set through the properties
|
|
34
|
+
*
|
|
35
|
+
*
|
|
36
|
+
* React
|
|
37
|
+
*
|
|
38
|
+
* ``` tsx
|
|
39
|
+
* <spectric-table data={[{col1:1}]} columns={[{key:"col1",}]} ></spectric-table>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* Javascript
|
|
43
|
+
*
|
|
44
|
+
* ``` js
|
|
45
|
+
* table = document.createElement("spectric-table")
|
|
46
|
+
* table.data = [{col1:1}]
|
|
47
|
+
* table.columns = [{key:"col1",}]
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* HTML
|
|
51
|
+
*
|
|
52
|
+
* ``` html
|
|
53
|
+
* <spectric-table id="table"></spectric-table>
|
|
54
|
+
* <script>
|
|
55
|
+
* document.querySelector("#table")
|
|
56
|
+
* table.data = [{col1:1}]
|
|
57
|
+
* table.columns = [{key:"col1",}]
|
|
58
|
+
* </script>
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
@customElement(TableElementTag)
|
|
62
|
+
export class TableElement<T> extends LitElement implements TableProps<T> {
|
|
63
|
+
@property({ type: Array, attribute: false })
|
|
64
|
+
data: T[] = [];
|
|
65
|
+
@property({ type: Object, attribute: false })
|
|
66
|
+
pagination?: PaginationProps | undefined;
|
|
67
|
+
@property({ attribute: false })
|
|
68
|
+
columns: ColumnSettings<T>[] = [];
|
|
69
|
+
private _handlePaginationChange = (e: CustomEvent<PaginationChangeProps>) => {
|
|
70
|
+
e.preventDefault()
|
|
71
|
+
e.stopPropagation()
|
|
72
|
+
if (this.pagination) {
|
|
73
|
+
this.pagination.size
|
|
74
|
+
this.pagination = { ...this.pagination, ...e.detail }
|
|
75
|
+
}
|
|
76
|
+
this._emitChange()
|
|
77
|
+
};
|
|
78
|
+
private _emitChange = () => {
|
|
79
|
+
let { pagination } = this
|
|
80
|
+
this.dispatchEvent(new CustomEvent<{ pagination?: PaginationChangeProps }>("change", { detail: { pagination } }))
|
|
81
|
+
}
|
|
82
|
+
//@ts-ignore
|
|
83
|
+
private __DO_NOT_USE_filter = () => {
|
|
84
|
+
//This is only here to document events that bubble up from lower components
|
|
85
|
+
this.dispatchEvent(new CustomEvent<FilterEvent<T>>("filter"))
|
|
86
|
+
}
|
|
87
|
+
protected createRenderRoot(): HTMLElement | DocumentFragment {
|
|
88
|
+
return this
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
protected render(): unknown {
|
|
92
|
+
let columns = this.columns.filter(column => !column.hidden)
|
|
93
|
+
return html`
|
|
94
|
+
<div role="table">
|
|
95
|
+
<spectric-table-header .columns=${columns}></spectric-table-header>
|
|
96
|
+
<spectric-table-body .columns=${columns} .data=${this.data} .table=${this}></spectric-table-body>
|
|
97
|
+
</div>
|
|
98
|
+
${this.pagination ? html`<spectric-pagination ${spreadProps(this.pagination)} @change=${this._handlePaginationChange}></spectric-pagination>` : null}
|
|
99
|
+
`;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface TableEvents {
|
|
104
|
+
'change': (event: CustomEvent<{ pagination: PaginationChangeProps }>) => void;
|
|
105
|
+
'filter': (event: CustomEvent<FilterEvent<any>>) => void;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
declare global {
|
|
109
|
+
interface HTMLElementTagNameMap {
|
|
110
|
+
[TableElementTag]: HTMLElementTagWithEvents<TableElement<any>, TableEvents>
|
|
111
|
+
|
|
112
|
+
}
|
|
113
|
+
namespace JSX {
|
|
114
|
+
interface IntrinsicElements {
|
|
115
|
+
/**
|
|
116
|
+
* @see {@link DialogElement}
|
|
117
|
+
*/
|
|
118
|
+
[TableElementTag]: ReactElementWithPropsAndEvents<TableElement<any>, TableProps<any>, TableEvents>;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
namespace React {
|
|
122
|
+
namespace JSX {
|
|
123
|
+
interface IntrinsicElements {
|
|
124
|
+
/**
|
|
125
|
+
* @see {@link DialogElement}
|
|
126
|
+
*/
|
|
127
|
+
[TableElementTag]: ReactElementWithPropsAndEvents<TableElement<any>, TableProps<any>, TableEvents>
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -13,6 +13,7 @@ const meta = {
|
|
|
13
13
|
<spectric-button
|
|
14
14
|
?disabled=${args.disabled}
|
|
15
15
|
?danger=${args.danger}
|
|
16
|
+
?icon=${args.icon}
|
|
16
17
|
variant=${ifDefined(args.variant)}
|
|
17
18
|
size=${ifDefined(args.size)}
|
|
18
19
|
backgroundColor=${ifDefined(args.backgroundColor)}
|
|
@@ -31,11 +32,11 @@ const meta = {
|
|
|
31
32
|
backgroundColor: { control: 'color', description: "sets the background color for the element" },
|
|
32
33
|
size: {
|
|
33
34
|
control: { type: 'select' },
|
|
34
|
-
options:
|
|
35
|
+
options: Object.values(ButtonSizes),
|
|
35
36
|
},
|
|
36
37
|
variant: {
|
|
37
38
|
control: { type: 'select' },
|
|
38
|
-
options:
|
|
39
|
+
options: Object.values(ButtonVariants),
|
|
39
40
|
},
|
|
40
41
|
disabled: {
|
|
41
42
|
control: { type: 'boolean' },
|
|
@@ -25,6 +25,7 @@ const meta = {
|
|
|
25
25
|
<spectric-query
|
|
26
26
|
.fields=${args.fields}
|
|
27
27
|
.getValuesForField=${fakevalues}
|
|
28
|
+
value=${ifDefined(args.value)}
|
|
28
29
|
@change=${(e: CustomEvent<any>) => {
|
|
29
30
|
code = e.detail
|
|
30
31
|
updateArgs({ ...args })
|
|
@@ -61,3 +62,9 @@ export const Basic: Story = {
|
|
|
61
62
|
},
|
|
62
63
|
};
|
|
63
64
|
|
|
65
|
+
export const ShouldHaveValue: Story = {
|
|
66
|
+
args: {
|
|
67
|
+
outputLanguage: "toCql",
|
|
68
|
+
value:"test: * and test_num > 10"
|
|
69
|
+
},
|
|
70
|
+
};
|
|
@@ -15,6 +15,9 @@ export const modulations = [
|
|
|
15
15
|
//pulled from https://www.sigidwiki.com/wiki/Category:Digital signals that don't have a space or -
|
|
16
16
|
export const signals = ["802.11n", "8PSK", "ASCII", "AUTOSPEC", "Aprizesat", "Autocab", "Bluetooth", "CCITT", "CDMA420", "CHIP", "CHU", "COFDMTV", "CompuLert", "Contestia", "Coquelet", "DCF77", "DominoEX", "DominoF", "EIA", "FLEX", "FSK441", "FSQ", "FST4W", "FT4", "FT8", "Hellschreiber", "ISCAT", "JS8", "JT4", "JT65", "JT6M", "JT9", "JTMS", "Kiwi", "Lentus", "LoRa", "MDC1200", "MOBITEX", "MSK144", "MT63", "Milstar", "NML", "NOV", "NPM", "NWC", "Olivia", "OpenSky", "Orbcomm", "PACKET", "PAX", "PI4", "POCSAG", "PSK2K", "Piccolo", "ProVoice", "Q15X25", "ROS", "RTTYM", "ReFLEX", "SIGFOX", "SPREAD", "Serdolik", "SkyOFDM", "THOR", "THROB", "TT2300", "TWINPLEX", "Tetrapol", "VISEL", "VOICE", "WSPR", "WiMAX", "WinDRM"]
|
|
17
17
|
export const filterByColumn = async (field, text) => {
|
|
18
|
+
if(field === "time_seen"){
|
|
19
|
+
return []
|
|
20
|
+
}
|
|
18
21
|
if (field === "modulations") {
|
|
19
22
|
return modulations.filter(v => v.match(new RegExp(text, "gi")))
|
|
20
23
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/web-components";
|
|
2
|
+
|
|
3
|
+
import { PaginationChangeProps, type PaginationProps as Props } from "../components/pagination/pagination";
|
|
4
|
+
import { html } from "lit";
|
|
5
|
+
import '../components';
|
|
6
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
7
|
+
import { useArgs } from "@storybook/client-api";
|
|
8
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
9
|
+
const meta = {
|
|
10
|
+
title: "UI/Pagination",
|
|
11
|
+
tags: ["autodocs"],
|
|
12
|
+
component: "spectric-pagination",
|
|
13
|
+
render: (args) => {
|
|
14
|
+
const [_, updateArgs] = useArgs();
|
|
15
|
+
|
|
16
|
+
return html`
|
|
17
|
+
<spectric-pagination
|
|
18
|
+
page=${ifDefined(args.page)}
|
|
19
|
+
pageSize=${ifDefined(args.pageSize)}
|
|
20
|
+
totalItems=${ifDefined(args.totalItems)}
|
|
21
|
+
size=${args.size}
|
|
22
|
+
@change=${(e: CustomEvent<PaginationChangeProps>) => {
|
|
23
|
+
updateArgs({ ...e.detail });
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
</spectric-pagination>
|
|
27
|
+
`;
|
|
28
|
+
},
|
|
29
|
+
argTypes: {
|
|
30
|
+
size: {
|
|
31
|
+
control: { type: 'select' },
|
|
32
|
+
options: ['small', 'medium', 'large'],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
args: {
|
|
36
|
+
page: 1,
|
|
37
|
+
pageSize: 3,
|
|
38
|
+
size: "small",
|
|
39
|
+
totalItems: 103,
|
|
40
|
+
},
|
|
41
|
+
} satisfies Meta<Props>;
|
|
42
|
+
|
|
43
|
+
export default meta;
|
|
44
|
+
type Story = StoryObj<Props>;
|
|
45
|
+
|
|
46
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
47
|
+
export const Basic: Story = {
|
|
48
|
+
args: {
|
|
49
|
+
page: 1,
|
|
50
|
+
pageSize: 3,
|
|
51
|
+
totalItems: 103,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* When the total items is unknown pagination will only shows page size
|
|
56
|
+
*/
|
|
57
|
+
export const NoTotalItems: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
page: 1,
|
|
60
|
+
pageSize: 3,
|
|
61
|
+
totalItems: undefined,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/web-components";
|
|
2
|
+
|
|
3
|
+
import { PaginationChangeProps, type TableProps as Props } from "../components/";
|
|
4
|
+
import { html } from "lit";
|
|
5
|
+
import '../components';
|
|
6
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
7
|
+
import { useArgs } from "@storybook/client-api";
|
|
8
|
+
import { FilterEvent } from "../components/table/cell";
|
|
9
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
10
|
+
type TestData = {
|
|
11
|
+
name: string
|
|
12
|
+
company: string
|
|
13
|
+
contact: string
|
|
14
|
+
country: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const data: TestData[] = [
|
|
18
|
+
{ name: "Sean", company: "Spectric Labs", "contact": "123-4567", "country": "US" },
|
|
19
|
+
{ name: "Kipp", company: "Spectric Labs", "contact": "123-4567", "country": "UK" },
|
|
20
|
+
{ name: "Adam", company: "Spectric Labs", "contact": "123-4567", "country": "US" },
|
|
21
|
+
{ name: "Chris", company: "Spectric Labs", "contact": "123-4567", "country": "US" },
|
|
22
|
+
{ name: "Michael", company: "Spectric Labs", "contact": "123-4567", "country": "US" },
|
|
23
|
+
{ name: "Matt", company: "Spectric Labs", "contact": "123-4567", "country": "US" },
|
|
24
|
+
{ name: "Grant", company: "Spectric Labs", "contact": "123-4567", "country": "UK" },]
|
|
25
|
+
const meta = {
|
|
26
|
+
title: "UI/Table",
|
|
27
|
+
tags: ["autodocs"],
|
|
28
|
+
component: "spectric-table",
|
|
29
|
+
render: (args) => {
|
|
30
|
+
const [_, updateArgs] = useArgs();
|
|
31
|
+
|
|
32
|
+
return html`
|
|
33
|
+
<spectric-table
|
|
34
|
+
.pagination=${args.pagination}
|
|
35
|
+
.columns=${args.columns}
|
|
36
|
+
.data=${!args.pagination ? data : data.slice((args.pagination.page - 1) * args.pagination.pageSize, (args.pagination.page) * args.pagination.pageSize)}
|
|
37
|
+
@filter=${(e: CustomEvent<FilterEvent<any>>) => {
|
|
38
|
+
alert(`filter ${e.detail.include ? "for" : "out"} event value ${e.detail.value}`)
|
|
39
|
+
}}
|
|
40
|
+
@change=${(e: CustomEvent<PaginationChangeProps>) => {
|
|
41
|
+
console.log(e)
|
|
42
|
+
updateArgs({ ...e.detail });
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
</spectric-table>
|
|
46
|
+
`;
|
|
47
|
+
},
|
|
48
|
+
argTypes: {
|
|
49
|
+
},
|
|
50
|
+
args: {
|
|
51
|
+
pagination: {
|
|
52
|
+
page: 1,
|
|
53
|
+
pageSize: 3,
|
|
54
|
+
size: "small",
|
|
55
|
+
totalItems: data.length,
|
|
56
|
+
},
|
|
57
|
+
columns: [{ "title": "Company", key: "company" }, { "title": "Name", key: "name" }, { "title": "Contact", key: "contact" }, { "title": "Country", key: "country", filterable: true }]
|
|
58
|
+
},
|
|
59
|
+
} satisfies Meta<Props<TestData>>;
|
|
60
|
+
|
|
61
|
+
export default meta;
|
|
62
|
+
type Story = StoryObj<Props<TestData>>;
|
|
63
|
+
|
|
64
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
65
|
+
export const Basic: Story = {
|
|
66
|
+
args: {
|
|
67
|
+
pagination: {
|
|
68
|
+
page: 1,
|
|
69
|
+
pageSize: 3,
|
|
70
|
+
size: "small",
|
|
71
|
+
totalItems: data.length,
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
};
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import{T as g,i as x,u as $,f as w,r as y,x as h}from"./lit-element-UdLzEcH-.js";/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const _={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},k=t=>(...e)=>({_$litDirective$:t,values:e});let E=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,r,o){this._$Ct=e,this._$AM=r,this._$Ci=o}_$AS(e,r){return this.update(e,r)}update(e,r){return this.render(...r)}};/**
|
|
6
|
-
* @license
|
|
7
|
-
* Copyright 2018 Google LLC
|
|
8
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const v="important",C=" !"+v,m=k(class extends E{constructor(t){var e;if(super(t),t.type!==_.ATTRIBUTE||t.name!=="style"||((e=t.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,r)=>{const o=t[r];return o==null?e:e+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${o};`},"")}update(t,[e]){const{style:r}=t.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const o of this.ft)e[o]==null&&(this.ft.delete(o),o.includes("-")?r.removeProperty(o):r[o]=null);for(const o in e){const n=e[o];if(n!=null){this.ft.add(o);const s=typeof n=="string"&&n.endsWith(C);o.includes("-")||s?r.setProperty(o,s?n.slice(0,-11):n,s?v:""):r[o]=n}}return g}}),P=x`
|
|
10
|
-
:host{
|
|
11
|
-
display: inline-block;
|
|
12
|
-
--text-on-color: var(--spectric-text-on-color, #ffffff);
|
|
13
|
-
--text-on-color-disabled: var(--spectric-text-on-color-disabled, #8d8d8d);
|
|
14
|
-
--text-placeholder: var(--spectric-text-placeholder, rgba(22, 22, 22, 0.4));
|
|
15
|
-
--text-primary: var(--spectric-text-primary, #161616);
|
|
16
|
-
--text-secondary: var(--spectric-text-secondary, #525252);
|
|
17
|
-
--button-border-radius: var(--spectric-border-radius,.4em);
|
|
18
|
-
--button-separator: var(--spectric-button-separator, #e0e0e0);
|
|
19
|
-
--button-primary: var(--spectric-button-primary,#1ea7fd);
|
|
20
|
-
--button-secondary: var(--spectric-button-secondary, #77878b);
|
|
21
|
-
--button-tertiary: var(--spectric-button-tertiary, #0f62fe);
|
|
22
|
-
--button-danger-primary: var(--spectric-button-danger-primary, #da1e28);
|
|
23
|
-
--button-danger-secondary: var(--spectric-button-danger-secondary, #da1e28);
|
|
24
|
-
--button-danger-active: var(--spectric-button-danger-active, #750e13);
|
|
25
|
-
--button-primary-active: var(--spectric-button-primary-active, #002d9c);
|
|
26
|
-
--button-secondary-active: var(--spectric-button-secondary-active, #6f6f6f);
|
|
27
|
-
--button-tertiary-active: var(--spectric-button-tertiary-active, #002d9c);
|
|
28
|
-
--button-danger-hover: var(--spectric-button-danger-hover, #b81921);
|
|
29
|
-
--button-primary-hover: var(--spectric-button-primary-hover, #0050e6);
|
|
30
|
-
--button-secondary-hover: var(--spectric-button-secondary-hover, #474747);
|
|
31
|
-
--button-tertiary-hover: var(--spectric-button-tertiary-hover, #0050e6);
|
|
32
|
-
--button-disabled: var(--spectric-button-disabled, #c6c6c6);
|
|
33
|
-
}
|
|
34
|
-
:host([disabled]) { pointer-events: none }
|
|
35
|
-
|
|
36
|
-
.spectric-button {
|
|
37
|
-
pointer-events:none;
|
|
38
|
-
position: relative;
|
|
39
|
-
display: inline-block;
|
|
40
|
-
cursor: pointer;
|
|
41
|
-
border: 0;
|
|
42
|
-
border-radius: var(--button-border-radius);
|
|
43
|
-
font-weight: 700;
|
|
44
|
-
line-height: 2em;
|
|
45
|
-
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
46
|
-
overflow:hidden;
|
|
47
|
-
}
|
|
48
|
-
.animation{
|
|
49
|
-
pointer-events: none;
|
|
50
|
-
transition: background-color 0.3s cubic-bezier(0.25, 0.8, 0.5, 1), opacity 0.4s cubic-bezier(0.25, 0.8, 0.5, 1);
|
|
51
|
-
width: 100%;
|
|
52
|
-
height: 100%;
|
|
53
|
-
position: absolute;
|
|
54
|
-
left: 0;
|
|
55
|
-
top: 0;
|
|
56
|
-
}
|
|
57
|
-
.animation::before {
|
|
58
|
-
content: "";
|
|
59
|
-
position: absolute;
|
|
60
|
-
top: 0;
|
|
61
|
-
left: 0 /* rtl:ignore */;
|
|
62
|
-
width: 100%;
|
|
63
|
-
height: 100%;
|
|
64
|
-
}
|
|
65
|
-
:host(:active) .animation::after {
|
|
66
|
-
box-shadow: 0 0 0 0 black;
|
|
67
|
-
position: absolute;
|
|
68
|
-
opacity: 1;
|
|
69
|
-
transition: 0s;
|
|
70
|
-
}
|
|
71
|
-
.animation::after{
|
|
72
|
-
content: "";
|
|
73
|
-
display: block;
|
|
74
|
-
position: absolute;
|
|
75
|
-
border-radius: var(--border-radius);
|
|
76
|
-
left: 0;
|
|
77
|
-
top: 0;
|
|
78
|
-
width: 100%;
|
|
79
|
-
height: 100%;
|
|
80
|
-
opacity: 0;
|
|
81
|
-
transition: all .5s;
|
|
82
|
-
box-shadow: 0 0 30px black inset;
|
|
83
|
-
}
|
|
84
|
-
.spectric-button.spectric-button--secondary .animation::after , .spectric-button.spectric-button--text .animation::after {
|
|
85
|
-
box-shadow: 0 0 30px white inset;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.spectric-button:disabled{
|
|
89
|
-
cursor: not-allowed;
|
|
90
|
-
pointer-events: none;
|
|
91
|
-
filter: contrast(0.5);
|
|
92
|
-
/* background-color:var(--button-disabled); */
|
|
93
|
-
color:var(--text-on-color-disabled);
|
|
94
|
-
}
|
|
95
|
-
.spectric-button:disabled .animation , :host(:disabled:hover) .animation{
|
|
96
|
-
background-color: rgba(0, 0, 0, 0);
|
|
97
|
-
opacity:1
|
|
98
|
-
}
|
|
99
|
-
.spectric-button-danger--true:hover{
|
|
100
|
-
background-color:var(--button-danger-hover);
|
|
101
|
-
}
|
|
102
|
-
.spectric-button--primary.spectric-button-danger--true {
|
|
103
|
-
background-color:var(--button-danger-primary);
|
|
104
|
-
box-shadow:none;
|
|
105
|
-
}
|
|
106
|
-
.spectric-button--secondary.spectric-button-danger--true {
|
|
107
|
-
color: var(--text-on-color);
|
|
108
|
-
background-color:color-mix(in srgb, var(--button-danger-primary) 70%, transparent);
|
|
109
|
-
box-shadow:none;
|
|
110
|
-
}
|
|
111
|
-
.spectric-button--text.spectric-button-danger--true {
|
|
112
|
-
color:var(--button-danger-primary);
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
:host(:hover) .spectric-button--text.spectric-button-danger--true {
|
|
116
|
-
background-color:var(--button-danger-primary);
|
|
117
|
-
color:var(--text-on-color)
|
|
118
|
-
}
|
|
119
|
-
:host(:hover) .animation{
|
|
120
|
-
background: currentColor;
|
|
121
|
-
opacity: 0.15;
|
|
122
|
-
}
|
|
123
|
-
.spectric-button--primary {
|
|
124
|
-
box-shadow: color-mix(in srgb, var(--button-primary) 50%, transparent) 0px 0px 0px 1px inset;
|
|
125
|
-
background-color: var(--button-primary);
|
|
126
|
-
color: var(--text-on-color);
|
|
127
|
-
}
|
|
128
|
-
.spectric-button--secondary {
|
|
129
|
-
background-color:transparent;
|
|
130
|
-
box-shadow: var(--button-secondary) 0px 0px 0px 1px inset;
|
|
131
|
-
color: var(--button-secondary);
|
|
132
|
-
}
|
|
133
|
-
.spectric-button--text {
|
|
134
|
-
background-color: transparent;
|
|
135
|
-
color: var(--text-secondary);
|
|
136
|
-
}
|
|
137
|
-
.spectric-button--small {
|
|
138
|
-
padding: 5px 10px;
|
|
139
|
-
font-size: 12px;
|
|
140
|
-
}
|
|
141
|
-
.spectric-button--medium {
|
|
142
|
-
padding: 6px 17px;
|
|
143
|
-
font-size: 14px;
|
|
144
|
-
}
|
|
145
|
-
.spectric-button--large {
|
|
146
|
-
padding: 7px 24px;
|
|
147
|
-
font-size: 16px;
|
|
148
|
-
}
|
|
149
|
-
`;/**
|
|
150
|
-
* @license
|
|
151
|
-
* Copyright 2017 Google LLC
|
|
152
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
153
|
-
*/const f=t=>(e,r)=>{r!==void 0?r.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)};/**
|
|
154
|
-
* @license
|
|
155
|
-
* Copyright 2017 Google LLC
|
|
156
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
157
|
-
*/const T={attribute:!0,type:String,converter:$,reflect:!1,hasChanged:w},O=(t=T,e,r)=>{const{kind:o,metadata:n}=r;let s=globalThis.litPropertyMetadata.get(n);if(s===void 0&&globalThis.litPropertyMetadata.set(n,s=new Map),s.set(r.name,t),o==="accessor"){const{name:i}=r;return{set(d){const b=e.get.call(this);e.set.call(this,d),this.requestUpdate(i,b,t)},init(d){return d!==void 0&&this.P(i,void 0,t),d}}}if(o==="setter"){const{name:i}=r;return function(d){const b=this[i];e.call(this,d),this.requestUpdate(i,b,t)}}throw Error("Unsupported decorator location: "+o)};function a(t){return(e,r)=>typeof r=="object"?O(t,e,r):((o,n,s)=>{const i=n.hasOwnProperty(s);return n.constructor.createProperty(s,i?{...o,wrapped:!0}:o),i?Object.getOwnPropertyDescriptor(n,s):void 0})(t,e,r)}var S=Object.defineProperty,A=Object.getOwnPropertyDescriptor,l=(t,e,r,o)=>{for(var n=o>1?void 0:o?A(e,r):e,s=t.length-1,i;s>=0;s--)(i=t[s])&&(n=(o?i(e,r,n):i(n))||n);return o&&n&&S(e,r,n),n},D=(t=>(t.large="large",t.medium="medium",t.small="small",t))(D||{}),j=(t=>(t.primary="primary",t.secondary="secondary",t.text="text",t))(j||{});const I={primary:"spectric-button--primary",secondary:"spectric-button--secondary",text:"spectric-button--text"};let c=class extends y{constructor(){super(...arguments),this.variant="primary",this.disabled=!1,this.size="large",this.label="",this.danger=!1,this._onClick=t=>{if(t instanceof CustomEvent)return;t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation();const e={bubbles:!0,composed:!0,detail:t};this.dispatchEvent(new CustomEvent("click",e))}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._onClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._onClick)}render(){const t=I[this.variant]||"spectric-button--primary";return h`
|
|
158
|
-
<button
|
|
159
|
-
type="button"
|
|
160
|
-
?disabled=${this.disabled}
|
|
161
|
-
class=${["spectric-button",`spectric-button-danger--${this.danger||!1}`,`spectric-button--${this.size||"medium"}`,t].join(" ")}
|
|
162
|
-
style=${m({backgroundColor:this.backgroundColor})}
|
|
163
|
-
>
|
|
164
|
-
<span class="animation"></span>
|
|
165
|
-
<slot>${this.label}</slot>
|
|
166
|
-
</button>
|
|
167
|
-
`}};c.styles=P;l([a({type:String,reflect:!0})],c.prototype,"variant",2);l([a({type:Boolean,reflect:!0})],c.prototype,"disabled",2);l([a({type:String,reflect:!0})],c.prototype,"backgroundColor",2);l([a({type:String,reflect:!0})],c.prototype,"size",2);l([a({type:String,reflect:!0})],c.prototype,"label",2);l([a({type:Boolean,reflect:!0})],c.prototype,"danger",2);c=l([f("spectric-button")],c);var z=Object.defineProperty,U=Object.getOwnPropertyDescriptor,u=(t,e,r,o)=>{for(var n=o>1?void 0:o?U(e,r):e,s=t.length-1,i;s>=0;s--)(i=t[s])&&(n=(o?i(e,r,n):i(n))||n);return o&&n&&z(e,r,n),n};const L={display:"flex",alignItems:"center",backgroundColor:"black",color:"white",textAlign:"center"};let p=class extends y{constructor(){super(...arguments),this.dismissable=!1,this.text="",this.bannerId="",this.headerStyle={},this._dismissed=!1,this.onDismiss=t=>{t.preventDefault(),t.stopPropagation();const e={bubbles:!0,composed:!0};this._dismissed=!0;let{bannerId:r,text:o,headerStyle:n,dismissable:s}=this;this.dispatchEvent(new CustomEvent("bannerDismissed",{detail:{bannerId:r,text:o,headerStyle:n,dismissable:s},...e}))}}render(){if(!this._dismissed)return h`
|
|
168
|
-
<header style=${m({...L,...this.headerStyle})}>
|
|
169
|
-
<div style="flex-grow:1"><slot name="text">${this.text}</slot><slot></slot></div>
|
|
170
|
-
${this.dismissable?h`<spectric-button size="small" @click=${this.onDismiss}>X</spectric-button>`:null}
|
|
171
|
-
</header>
|
|
172
|
-
`}};u([a({type:Boolean,reflect:!0})],p.prototype,"dismissable",2);u([a({type:String,reflect:!0})],p.prototype,"text",2);u([a({type:String,reflect:!0})],p.prototype,"bannerId",2);u([a({type:Object})],p.prototype,"headerStyle",2);u([a({state:!0,type:Boolean,attribute:!1})],p.prototype,"_dismissed",2);p=u([f("spectric-banner")],p);export{j as B,D as a,_ as b,k as e,E as i,a as n,m as o,f as t};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import"./Banner-CZ3qKIQC.js";import{x as l}from"./lit-element-UdLzEcH-.js";const u={title:"UI/Banner",tags:["autodocs"],component:"spectric-banner",render:e=>(console.log(e),l`<spectric-banner ?dismissable=${e.dismissable} .headerStyle=${e.headerStyle}>${e.text}</spectric-banner>
|
|
2
|
-
`),args:{text:"Banner with default style"}},r={args:{text:"Unclassified",headerStyle:{backgroundColor:"green",color:"white"}}},s={args:{text:"Can be dismissed",dismissable:!0,headerStyle:{backgroundColor:"cornflowerblue",color:"white"}}};var n,a,o;r.parameters={...r.parameters,docs:{...(n=r.parameters)==null?void 0:n.docs,source:{originalSource:`{
|
|
3
|
-
args: {
|
|
4
|
-
text: "Unclassified",
|
|
5
|
-
headerStyle: {
|
|
6
|
-
backgroundColor: "green",
|
|
7
|
-
color: "white"
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}`,...(o=(a=r.parameters)==null?void 0:a.docs)==null?void 0:o.source}}};var t,i,c;s.parameters={...s.parameters,docs:{...(t=s.parameters)==null?void 0:t.docs,source:{originalSource:`{
|
|
11
|
-
args: {
|
|
12
|
-
text: "Can be dismissed",
|
|
13
|
-
dismissable: true,
|
|
14
|
-
headerStyle: {
|
|
15
|
-
backgroundColor: "cornflowerblue",
|
|
16
|
-
color: "white"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}`,...(c=(i=s.parameters)==null?void 0:i.docs)==null?void 0:c.source}}};const b=["ClassificationBanner","DismissableBanner"];export{r as ClassificationBanner,s as DismissableBanner,b as __namedExportsOrder,u as default};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import"./Banner-CZ3qKIQC.js";import"./dialog-CFHXbUTQ.js";import{x as s}from"./lit-element-UdLzEcH-.js";import{E as o}from"./Bits-C_TSTjST.js";import"./directive-helpers-IbK5tOA8.js";const n={title:"DSP Related/BitDisplay",tags:["autodocs"],component:"spectric-bit-display",render:r=>s`
|
|
2
|
-
<spectric-bit-display
|
|
3
|
-
frameWidth=${r.frameWidth}
|
|
4
|
-
scale=${r.scale}
|
|
5
|
-
.arrayBuffer=${r.arrayBuffer}
|
|
6
|
-
width=${r.width}
|
|
7
|
-
height=${r.height}
|
|
8
|
-
>
|
|
9
|
-
</spectric-bit-display>
|
|
10
|
-
`},e={args:{scale:1,frameWidth:100,width:200,height:200,arrayBuffer:o.buffer}};var t,a,i;e.parameters={...e.parameters,docs:{...(t=e.parameters)==null?void 0:t.docs,source:{originalSource:`{
|
|
11
|
-
args: {
|
|
12
|
-
scale: 1,
|
|
13
|
-
frameWidth: 100,
|
|
14
|
-
width: 200,
|
|
15
|
-
height: 200,
|
|
16
|
-
arrayBuffer: ExampleBits.buffer
|
|
17
|
-
}
|
|
18
|
-
}`,...(i=(a=e.parameters)==null?void 0:a.docs)==null?void 0:i.source}}};const h=["Primary"];export{e as Primary,h as __namedExportsOrder,n as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const t=Array(2e4).fill(0).map((a,r)=>String.fromCharCode(r%4===0?85:r%3===0||r%2?r%255:Math.floor(Math.random()*255)));var o=t.length;const e=new Uint8Array(o);e.set(Array.from(t).map(a=>a.charCodeAt(0)));export{e as E};
|