@openremote/or-mwc-components 1.3.0-snapshot.20250117163129 → 1.3.0-snapshot.20250117163435

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.
@@ -0,0 +1,43 @@
1
+ import { getWcStorybookHelpers } from "wc-storybook-helpers";
2
+ import {InputType} from "@openremote/or-mwc-components/or-mwc-input";
3
+ import { html } from 'lit';
4
+
5
+ const { events, args, argTypes, template } = getWcStorybookHelpers("or-mwc-input");
6
+
7
+ /** @type { import('@storybook/web-components').Meta } */
8
+ const meta = {
9
+ title: "Playground/or-mwc-input/select",
10
+ component: "or-mwc-input",
11
+ args: args,
12
+ argTypes: {
13
+ ...argTypes,
14
+ type: {
15
+ options: Object.values(InputType)
16
+ }
17
+ },
18
+ parameters: {
19
+ actions: {
20
+ handles: [...events, "or-mwc-input-changed"]
21
+ },
22
+ docs: {
23
+ subtitle: "<or-mwc-input>",
24
+ story: {
25
+ height: "240px"
26
+ }
27
+ }
28
+ }
29
+ };
30
+
31
+ /** @type { import('@storybook/web-components').StoryObj } */
32
+ export const Primary = {
33
+ render: (args) => template(args),
34
+ args: {
35
+ type: InputType.SELECT,
36
+ label: "Select amount",
37
+ placeHolder: "Select amount",
38
+ options: JSON.stringify(["One", "Two", "Three"]),
39
+ fullWidth: true
40
+ }
41
+ };
42
+
43
+ export default meta;
@@ -0,0 +1,73 @@
1
+ import { getWcStorybookHelpers } from "wc-storybook-helpers";
2
+ import "@openremote/or-mwc-components/or-mwc-table";
3
+
4
+ const { events, args, argTypes, template } = getWcStorybookHelpers("or-mwc-table");
5
+
6
+ /** @type { import('@storybook/web-components').Meta } */
7
+ const meta = {
8
+ title: "Playground/or-mwc-table",
9
+ component: "or-mwc-table",
10
+ args: args,
11
+ argTypes: argTypes,
12
+ parameters: {
13
+ actions: {
14
+ handles: events
15
+ },
16
+ docs: {
17
+ subtitle: "<or-mwc-table>"
18
+ }
19
+ }
20
+ };
21
+
22
+ /** @type { import('@storybook/web-components').StoryObj } */
23
+ export const Primary = {
24
+ args: {
25
+ columns: JSON.stringify([{title: "Column 1"}, {title: "Column 2"}, {title: "Column 3"}]),
26
+ rows: JSON.stringify([
27
+ {content: ["Row 1, Column 1", "Row 1, Column 2", "Row 1, Column 3"]},
28
+ {content: ["Row 2, Column 1", "Row 2, Column 2", "Row 2, Column 3"]}
29
+ ])
30
+ },
31
+ parameters: {
32
+ docs: {
33
+ source: {
34
+ code: getExampleCode()
35
+ },
36
+ story: {
37
+ height: '240px'
38
+ }
39
+ }
40
+ },
41
+ render: (args) => template(args)
42
+ };
43
+
44
+ /* ------------------------------------------------------- */
45
+ /* UTILITY FUNCTIONS */
46
+ /* ------------------------------------------------------- */
47
+
48
+ function getExampleCode() {
49
+
50
+ //language=javascript
51
+ return `
52
+ import {TableColumn, TableRow} from "@openremote/or-mwc-components/or-mwc-table";
53
+ import "@openremote/or-mwc-components/or-mwc-table"; // this is necessary
54
+
55
+ // Set up table columns
56
+ const columns: TableColumn[] = [{title: "Column 1"}, {title: "Column 2"}, {title: "Column 3"}];
57
+
58
+ // Set up table rows
59
+ const rows: TableRow[] = [
60
+ {content: ["Row 1, Column 1", "Row 1, Column 2", "Row 1, Column 3"]},
61
+ {content: ["Row 2, Column 1", "Row 2, Column 2", "Row 2, Column 3"]}
62
+ ];
63
+
64
+ // (IF NOT USING LIT; you should parse the objects to JSON strings)
65
+ // const columnsStr = JSON.stringify(columns);
66
+ // const rowsStr = JSON.stringify(rows);
67
+
68
+ // in your HTML code use this, and inject them;
69
+ <or-mwc-table columns="columns" rows="rows"></or-mwc-table>
70
+ `
71
+ }
72
+
73
+ export default meta;