@operato/input 1.5.19 → 1.5.23

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/CHANGELOG.md CHANGED
@@ -3,6 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ### [1.5.23](https://github.com/hatiolab/operato/compare/v1.5.22...v1.5.23) (2023-11-05)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * ox-input-permission ([9d40cfd](https://github.com/hatiolab/operato/commit/9d40cfdff5e8fd5dec6b5c3e562c81d0f3dd8c48))
12
+ * ox-input-permission and ox-grist-editor-permission ([e6cab98](https://github.com/hatiolab/operato/commit/e6cab98d3f745f29b8c17077a549891f59b442b9))
13
+
14
+
15
+
16
+ ### [1.5.22](https://github.com/hatiolab/operato/compare/v1.5.21...v1.5.22) (2023-11-04)
17
+
18
+
19
+ ### :bug: Bug Fix
20
+
21
+ * tweak ox-input-textarea ([617f9dd](https://github.com/hatiolab/operato/commit/617f9dd668195f9f14bb97f0c1b20e7878549396))
22
+
23
+
24
+
6
25
  ### [1.5.19](https://github.com/hatiolab/operato/compare/v1.5.18...v1.5.19) (2023-11-03)
7
26
 
8
27
 
@@ -90,16 +90,16 @@ let OxInputDuration = class OxInputDuration extends OxFormField {
90
90
  const seconds = d - minutes * 60;
91
91
  return html `
92
92
  <form @change=${this.onChange.bind(this)}>
93
- <input id="days" type="number" .value=${days} pattern="\\d*" />
93
+ <input id="days" type="number" .value=${String(days || 0)} pattern="\\d*" />
94
94
  <label for="days">${i18next.t('label.days')}</label>
95
95
 
96
- <input id="hours" type="number" .value=${hours} pattern="[01]?\\d|2[0-3]" />
96
+ <input id="hours" type="number" .value=${String(hours || 0)} pattern="[01]?\\d|2[0-3]" />
97
97
  <label for="hour">${i18next.t('label.hours')}</label>
98
98
 
99
- <input id="minutes" type="number" .value=${minutes} pattern="[0-5]?\\d" />
99
+ <input id="minutes" type="number" .value=${String(minutes || 0)} pattern="[0-5]?\\d" />
100
100
  <label for="minute">${i18next.t('label.minutes')}</label>
101
101
 
102
- <input id="seconds" type="number" .value=${seconds} pattern="[0-5]?\\d" />
102
+ <input id="seconds" type="number" .value=${String(seconds || 0)} pattern="[0-5]?\\d" />
103
103
  <label for="second">${i18next.t('label.seconds')}</label>
104
104
 
105
105
  <button
@@ -1 +1 @@
1
- {"version":3,"file":"ox-input-duration.js","sourceRoot":"","sources":["../../src/ox-input-duration.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,sBAAsB,CAAA;AAE7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGtC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,WAAW;aACvC,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuElB,AAvEY,CAuEZ;IAID,MAAM;QACJ,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAA;QAE/B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAA;QACxC,CAAC,IAAI,IAAI,GAAG,EAAE,GAAG,IAAI,CAAA;QACrB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;QAClC,CAAC,IAAI,KAAK,GAAG,IAAI,CAAA;QACjB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,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MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACtC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAC1C,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAE1C,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC,CAAA;QAEvG,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI,CAAC,KAAK;SACnB,CAAC,CACH,CAAA;IACH,CAAC;;AAlFmC;IAAnC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAuB;AAqDlC;IAAf,KAAK,CAAC,OAAO,CAAC;6CAAwB;AACtB;IAAhB,KAAK,CAAC,QAAQ,CAAC;8CAAyB;AACtB;IAAlB,KAAK,CAAC,UAAU,CAAC;gDAA2B;AAC1B;IAAlB,KAAK,CAAC,UAAU,CAAC;gDAA2B;AAlIlC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA6J3B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/mwc-button'\n\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\n\nimport { OxFormField } from './ox-form-field'\n\n@customElement('ox-input-duration')\nexport class OxInputDuration extends OxFormField {\n static styles = css`\n :host {\n text-align: center;\n padding: 10px;\n }\n\n :host * {\n box-sizing: border-box;\n }\n\n :host *:focus {\n outline: none;\n }\n\n form {\n width: 100%;\n height: 100%;\n justify-content: center;\n }\n\n input {\n border: 0;\n border-bottom: var(--border-dark-color);\n padding: var(--input-padding);\n padding-right: 0;\n max-width: 70px;\n font: var(--input-font);\n color: var(--primary-text-color);\n text-align: right;\n }\n\n input:focus {\n outline: none;\n border-bottom: 1px solid var(--primary-color);\n }\n\n input:invalid {\n border-bottom: 1px solid var(--status-danger-color);\n color: var(--status-danger-color);\n }\n\n label {\n width: 100%;\n margin-right: var(--margin-default);\n font: normal 0.8em var(--theme-font);\n color: var(--primary-color);\n }\n\n button {\n border: var(--button-border);\n border-radius: var(--border-radius);\n background-color: var(--button-background-color);\n padding: var(--padding-narrow) var(--padding-default);\n min-height: 35px;\n line-height: 0.8;\n color: var(--button-color);\n cursor: pointer;\n }\n button + button {\n margin-left: -5px;\n }\n button mwc-icon {\n font-size: var(--fontsize-default);\n }\n button:focus,\n button:hover,\n button:active {\n border: var(--button-activ-border);\n background-color: var(--button-background-focus-color);\n color: var(--theme-white-color);\n }\n `\n\n @property({ type: Number }) declare value?: number\n\n render() {\n var d = Number(this.value || 0)\n\n const days = Math.floor(d / (3600 * 24))\n d -= days * 24 * 3600\n const hours = Math.floor(d / 3600)\n d -= hours * 3600\n const minutes = Math.floor(d / 60)\n const seconds = d - minutes * 60\n\n return html`\n <form @change=${this.onChange.bind(this)}>\n <input id=\"days\" type=\"number\" .value=${days} pattern=\"\\\\d*\" />\n <label for=\"days\">${i18next.t('label.days')}</label>\n\n <input id=\"hours\" type=\"number\" .value=${hours} pattern=\"[01]?\\\\d|2[0-3]\" />\n <label for=\"hour\">${i18next.t('label.hours')}</label>\n\n <input id=\"minutes\" type=\"number\" .value=${minutes} pattern=\"[0-5]?\\\\d\" />\n <label for=\"minute\">${i18next.t('label.minutes')}</label>\n\n <input id=\"seconds\" type=\"number\" .value=${seconds} pattern=\"[0-5]?\\\\d\" />\n <label for=\"second\">${i18next.t('label.seconds')}</label>\n\n <button\n type=\"button\"\n @click=${(e: Event) => {\n e.preventDefault()\n e.stopPropagation()\n\n this.value = 0\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }}\n >\n <mwc-icon>backspace</mwc-icon>\n </button>\n </form>\n `\n }\n\n firstUpdated() {\n ;(this.renderRoot.querySelector('input') as HTMLInputElement).focus()\n }\n\n @query('#days') days!: HTMLInputElement\n @query('#hours') hours!: HTMLInputElement\n @query('#minutes') minutes!: HTMLInputElement\n @query('#seconds') seconds!: HTMLInputElement\n\n onChange(e: Event) {\n e.stopPropagation()\n\n var form = this.renderRoot.querySelector('form') as HTMLFormElement\n var valid = form.checkValidity()\n if (!valid) {\n form.reportValidity()\n return\n }\n\n const days = Number(this.days.value)\n const hours = Number(this.hours.value)\n const minutes = Number(this.minutes.value)\n const seconds = Number(this.seconds.value)\n\n this.value = (days || 0) * 24 * 60 * 60 + (hours || 0) * 60 * 60 + (minutes || 0) * 60 + (seconds || 0)\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
1
+ {"version":3,"file":"ox-input-duration.js","sourceRoot":"","sources":["../../src/ox-input-duration.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,sBAAsB,CAAA;AAE7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGtC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,WAAW;aACvC,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AA;IACH,CAAC;;AAlF2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAe;AAqD1B;IAAf,KAAK,CAAC,OAAO,CAAC;6CAAwB;AACtB;IAAhB,KAAK,CAAC,QAAQ,CAAC;8CAAyB;AACtB;IAAlB,KAAK,CAAC,UAAU,CAAC;gDAA2B;AAC1B;IAAlB,KAAK,CAAC,UAAU,CAAC;gDAA2B;AAlIlC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA6J3B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/mwc-button'\n\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\n\nimport { OxFormField } from './ox-form-field'\n\n@customElement('ox-input-duration')\nexport class OxInputDuration extends OxFormField {\n static styles = css`\n :host {\n text-align: center;\n padding: 10px;\n }\n\n :host * {\n box-sizing: border-box;\n }\n\n :host *:focus {\n outline: none;\n }\n\n form {\n width: 100%;\n height: 100%;\n justify-content: center;\n }\n\n input {\n border: 0;\n border-bottom: var(--border-dark-color);\n padding: var(--input-padding);\n padding-right: 0;\n max-width: 70px;\n font: var(--input-font);\n color: var(--primary-text-color);\n text-align: right;\n }\n\n input:focus {\n outline: none;\n border-bottom: 1px solid var(--primary-color);\n }\n\n input:invalid {\n border-bottom: 1px solid var(--status-danger-color);\n color: var(--status-danger-color);\n }\n\n label {\n width: 100%;\n margin-right: var(--margin-default);\n font: normal 0.8em var(--theme-font);\n color: var(--primary-color);\n }\n\n button {\n border: var(--button-border);\n border-radius: var(--border-radius);\n background-color: var(--button-background-color);\n padding: var(--padding-narrow) var(--padding-default);\n min-height: 35px;\n line-height: 0.8;\n color: var(--button-color);\n cursor: pointer;\n }\n button + button {\n margin-left: -5px;\n }\n button mwc-icon {\n font-size: var(--fontsize-default);\n }\n button:focus,\n button:hover,\n button:active {\n border: var(--button-activ-border);\n background-color: var(--button-background-focus-color);\n color: var(--theme-white-color);\n }\n `\n\n @property({ type: Number }) value?: number\n\n render() {\n var d = Number(this.value || 0)\n\n const days = Math.floor(d / (3600 * 24))\n d -= days * 24 * 3600\n const hours = Math.floor(d / 3600)\n d -= hours * 3600\n const minutes = Math.floor(d / 60)\n const seconds = d - minutes * 60\n\n return html`\n <form @change=${this.onChange.bind(this)}>\n <input id=\"days\" type=\"number\" .value=${String(days || 0)} pattern=\"\\\\d*\" />\n <label for=\"days\">${i18next.t('label.days')}</label>\n\n <input id=\"hours\" type=\"number\" .value=${String(hours || 0)} pattern=\"[01]?\\\\d|2[0-3]\" />\n <label for=\"hour\">${i18next.t('label.hours')}</label>\n\n <input id=\"minutes\" type=\"number\" .value=${String(minutes || 0)} pattern=\"[0-5]?\\\\d\" />\n <label for=\"minute\">${i18next.t('label.minutes')}</label>\n\n <input id=\"seconds\" type=\"number\" .value=${String(seconds || 0)} pattern=\"[0-5]?\\\\d\" />\n <label for=\"second\">${i18next.t('label.seconds')}</label>\n\n <button\n type=\"button\"\n @click=${(e: Event) => {\n e.preventDefault()\n e.stopPropagation()\n\n this.value = 0\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }}\n >\n <mwc-icon>backspace</mwc-icon>\n </button>\n </form>\n `\n }\n\n firstUpdated() {\n ;(this.renderRoot.querySelector('input') as HTMLInputElement).focus()\n }\n\n @query('#days') days!: HTMLInputElement\n @query('#hours') hours!: HTMLInputElement\n @query('#minutes') minutes!: HTMLInputElement\n @query('#seconds') seconds!: HTMLInputElement\n\n onChange(e: Event) {\n e.stopPropagation()\n\n var form = this.renderRoot.querySelector('form') as HTMLFormElement\n var valid = form.checkValidity()\n if (!valid) {\n form.reportValidity()\n return\n }\n\n const days = Number(this.days.value)\n const hours = Number(this.hours.value)\n const minutes = Number(this.minutes.value)\n const seconds = Number(this.seconds.value)\n\n this.value = (days || 0) * 24 * 60 * 60 + (hours || 0) * 60 * 60 + (minutes || 0) * 60 + (seconds || 0)\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import '@material/mwc-button';
5
+ import { OxFormField } from './ox-form-field';
6
+ export declare class OxInputPermission extends OxFormField {
7
+ static styles: import("lit").CSSResult;
8
+ value?: {
9
+ category: string;
10
+ privilege: string;
11
+ owner: boolean;
12
+ super: boolean;
13
+ } | null;
14
+ privileges: {
15
+ name: string;
16
+ category: string;
17
+ description: string;
18
+ }[];
19
+ private form;
20
+ render(): import("lit-html").TemplateResult<1>;
21
+ buildValue(): {
22
+ category: string;
23
+ privilege: string;
24
+ owner: boolean;
25
+ super: boolean;
26
+ };
27
+ firstUpdated(): void;
28
+ onChange(e: Event): void;
29
+ }
@@ -0,0 +1,204 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { __decorate } from "tslib";
5
+ import '@material/mwc-button';
6
+ import { css, html } from 'lit';
7
+ import { customElement, property, query } from 'lit/decorators.js';
8
+ import { ifDefined } from 'lit/directives/if-defined.js';
9
+ import { i18next } from '@operato/i18n';
10
+ import { OxFormField } from './ox-form-field';
11
+ let OxInputPermission = class OxInputPermission extends OxFormField {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.privileges = [];
15
+ }
16
+ static { this.styles = css `
17
+ :host {
18
+ text-align: center;
19
+ padding: 10px;
20
+ }
21
+
22
+ :host * {
23
+ box-sizing: border-box;
24
+ }
25
+
26
+ :host *:focus {
27
+ outline: none;
28
+ }
29
+
30
+ form {
31
+ display: flex;
32
+ flex-direction: column;
33
+
34
+ width: 100%;
35
+ height: 100%;
36
+ }
37
+
38
+ div[values] {
39
+ flex: 1;
40
+ display: grid;
41
+ grid-template-columns: 1fr 1fr;
42
+ grid-gap: 10px;
43
+ }
44
+
45
+ div[values] > [col1] {
46
+ text-align: right;
47
+ }
48
+
49
+ div[values] > [col2] {
50
+ text-align: left;
51
+ margin-right: auto;
52
+ }
53
+
54
+ input {
55
+ border: 0;
56
+ border-bottom: var(--border-dark-color);
57
+ padding: var(--input-padding);
58
+ padding-right: 0;
59
+ max-width: 70px;
60
+ font: var(--input-font);
61
+ color: var(--primary-text-color);
62
+ text-align: right;
63
+ }
64
+
65
+ input:focus {
66
+ outline: none;
67
+ border-bottom: 1px solid var(--primary-color);
68
+ }
69
+
70
+ input:invalid {
71
+ border-bottom: 1px solid var(--status-danger-color);
72
+ color: var(--status-danger-color);
73
+ }
74
+
75
+ label {
76
+ margin-right: var(--margin-default);
77
+ font: normal 0.8em var(--theme-font);
78
+ color: var(--primary-color);
79
+ }
80
+
81
+ div[buttons] {
82
+ display: flex;
83
+ flex-direction: row;
84
+ justify-content: center;
85
+ padding: 10px;
86
+ gap: 10px;
87
+ }
88
+
89
+ button {
90
+ border: var(--button-border);
91
+ border-radius: var(--border-radius);
92
+ background-color: var(--button-background-color);
93
+ padding: var(--padding-narrow) var(--padding-default);
94
+ min-height: 35px;
95
+ line-height: 0.8;
96
+ color: var(--button-color);
97
+ cursor: pointer;
98
+ }
99
+ button:focus,
100
+ button:hover,
101
+ button:active {
102
+ border: var(--button-activ-border);
103
+ background-color: var(--button-background-focus-color);
104
+ color: var(--theme-white-color);
105
+ }
106
+ `; }
107
+ render() {
108
+ const { category, privilege, owner, super: superUser } = this.value || {};
109
+ const privileges = this.privileges || [];
110
+ return html `
111
+ <form @change=${this.onChange.bind(this)}>
112
+ <div values>
113
+ <label for="privilege" col1>${i18next.t('label.privilege')}</label>
114
+ <select id="privilege" name="privilege" value=${ifDefined(privilege)}>
115
+ <option value="">&nbsp;</option>
116
+ ${privileges.map(p => html `<option
117
+ value=${`${p.category}-${p.name}`}
118
+ ?selected=${category == p.category && privilege == p.name}
119
+ >
120
+ ${p.description}
121
+ </option>`)}
122
+ </select>
123
+
124
+ <label for="owner" col1>${i18next.t('label.domain-owner')}</label>
125
+ <input id="owner" type="checkbox" name="owner" ?checked=${owner} col2></input>
126
+
127
+ <label for="super" col1>${i18next.t('label.superuser')}</label>
128
+ <input id="super" type="checkbox" name="super" ?checked=${superUser} col2></input>
129
+ </div>
130
+
131
+ <div buttons>
132
+ <button
133
+ type="button"
134
+ @click=${(e) => {
135
+ this.value = null;
136
+ this.dispatchEvent(new CustomEvent('change', {
137
+ bubbles: true,
138
+ composed: true,
139
+ detail: this.value
140
+ }));
141
+ }}
142
+ >
143
+ reset
144
+ </button>
145
+
146
+ <button
147
+ type="button"
148
+ @click=${(e) => {
149
+ e.preventDefault();
150
+ e.stopPropagation();
151
+ this.value = this.buildValue();
152
+ this.dispatchEvent(new CustomEvent('change', {
153
+ bubbles: true,
154
+ composed: true,
155
+ detail: this.value
156
+ }));
157
+ }}
158
+ >
159
+ OK
160
+ </button>
161
+ </div>
162
+ </form>
163
+ `;
164
+ }
165
+ buildValue() {
166
+ const formData = new FormData(this.form);
167
+ const [category, privilege] = formData.get('privilege').split('-');
168
+ const owner = formData.get('owner');
169
+ const superUser = formData.get('super');
170
+ return {
171
+ category,
172
+ privilege,
173
+ owner: owner == 'on',
174
+ super: superUser == 'on'
175
+ };
176
+ }
177
+ firstUpdated() {
178
+ ;
179
+ this.renderRoot.querySelector('input').focus();
180
+ }
181
+ onChange(e) {
182
+ e.stopPropagation();
183
+ this.value = this.buildValue();
184
+ this.dispatchEvent(new CustomEvent('change', {
185
+ bubbles: true,
186
+ composed: true,
187
+ detail: this.value
188
+ }));
189
+ }
190
+ };
191
+ __decorate([
192
+ property({ type: Object })
193
+ ], OxInputPermission.prototype, "value", void 0);
194
+ __decorate([
195
+ property({ type: Array })
196
+ ], OxInputPermission.prototype, "privileges", void 0);
197
+ __decorate([
198
+ query('form')
199
+ ], OxInputPermission.prototype, "form", void 0);
200
+ OxInputPermission = __decorate([
201
+ customElement('ox-input-permission')
202
+ ], OxInputPermission);
203
+ export { OxInputPermission };
204
+ //# sourceMappingURL=ox-input-permission.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-input-permission.js","sourceRoot":"","sources":["../../src/ox-input-permission.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,sBAAsB,CAAA;AAE7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGtC,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,WAAW;IAA3C;;QAoGsB,eAAU,GAA8D,EAAE,CAAA;IA0GvG,CAAC;aA7MQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FlB,AA1FY,CA0FZ;IAaD,MAAM;QACJ,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAA;QACzE,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,EAAE,CAAA;QAExC,OAAO,IAAI,CAAA;sBACO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;;wCAEN,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC;0DACV,SAAS,CAAC,SAAS,CAAC;;cAEhE,UAAU,CAAC,GAAG,CACd,CAAC,CAAC,EAAE,CACF,IAAI,CAAA;0BACM,GAAG,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE;8BACrB,QAAQ,IAA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AQ;YACR,SAAS;YACT,KAAK,EAAE,KAAK,IAAI,IAAI;YACpB,KAAK,EAAE,SAAS,IAAI,IAAI;SACzB,CAAA;IACH,CAAC;IAED,YAAY;QACV,CAAC;QAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAsB,CAAC,KAAK,EAAE,CAAA;IACvE,CAAC;IAED,QAAQ,CAAC,CAAQ;QACf,CAAC,CAAC,eAAe,EAAE,CAAA;QAEnB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,CAAA;QAE9B,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI,CAAC,KAAK;SACnB,CAAC,CACH,CAAA;IACH,CAAC;;AAhH2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAKnB;AAEmB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;qDAA2E;AAE9E;IAAtB,KAAK,CAAC,MAAM,CAAC;+CAA+B;AAtGlC,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CA8M7B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/mwc-button'\n\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\n\nimport { i18next } from '@operato/i18n'\n\nimport { OxFormField } from './ox-form-field'\n\n@customElement('ox-input-permission')\nexport class OxInputPermission extends OxFormField {\n static styles = css`\n :host {\n text-align: center;\n padding: 10px;\n }\n\n :host * {\n box-sizing: border-box;\n }\n\n :host *:focus {\n outline: none;\n }\n\n form {\n display: flex;\n flex-direction: column;\n\n width: 100%;\n height: 100%;\n }\n\n div[values] {\n flex: 1;\n display: grid;\n grid-template-columns: 1fr 1fr;\n grid-gap: 10px;\n }\n\n div[values] > [col1] {\n text-align: right;\n }\n\n div[values] > [col2] {\n text-align: left;\n margin-right: auto;\n }\n\n input {\n border: 0;\n border-bottom: var(--border-dark-color);\n padding: var(--input-padding);\n padding-right: 0;\n max-width: 70px;\n font: var(--input-font);\n color: var(--primary-text-color);\n text-align: right;\n }\n\n input:focus {\n outline: none;\n border-bottom: 1px solid var(--primary-color);\n }\n\n input:invalid {\n border-bottom: 1px solid var(--status-danger-color);\n color: var(--status-danger-color);\n }\n\n label {\n margin-right: var(--margin-default);\n font: normal 0.8em var(--theme-font);\n color: var(--primary-color);\n }\n\n div[buttons] {\n display: flex;\n flex-direction: row;\n justify-content: center;\n padding: 10px;\n gap: 10px;\n }\n\n button {\n border: var(--button-border);\n border-radius: var(--border-radius);\n background-color: var(--button-background-color);\n padding: var(--padding-narrow) var(--padding-default);\n min-height: 35px;\n line-height: 0.8;\n color: var(--button-color);\n cursor: pointer;\n }\n button:focus,\n button:hover,\n button:active {\n border: var(--button-activ-border);\n background-color: var(--button-background-focus-color);\n color: var(--theme-white-color);\n }\n `\n\n @property({ type: Object }) value?: {\n category: string\n privilege: string\n owner: boolean\n super: boolean\n } | null\n\n @property({ type: Array }) privileges: { name: string; category: string; description: string }[] = []\n\n @query('form') private form!: HTMLFormElement\n\n render() {\n const { category, privilege, owner, super: superUser } = this.value || {}\n const privileges = this.privileges || []\n\n return html`\n <form @change=${this.onChange.bind(this)}>\n <div values>\n <label for=\"privilege\" col1>${i18next.t('label.privilege')}</label>\n <select id=\"privilege\" name=\"privilege\" value=${ifDefined(privilege)}>\n <option value=\"\">&nbsp;</option>\n ${privileges.map(\n p =>\n html`<option\n value=${`${p.category}-${p.name}`}\n ?selected=${category == p.category && privilege == p.name}\n >\n ${p.description}\n </option>`\n )}\n </select>\n\n <label for=\"owner\" col1>${i18next.t('label.domain-owner')}</label>\n <input id=\"owner\" type=\"checkbox\" name=\"owner\" ?checked=${owner} col2></input>\n\n <label for=\"super\" col1>${i18next.t('label.superuser')}</label>\n <input id=\"super\" type=\"checkbox\" name=\"super\" ?checked=${superUser} col2></input>\n </div>\n\n <div buttons>\n <button\n type=\"button\"\n @click=${(e: Event) => {\n this.value = null\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }}\n >\n reset\n </button>\n\n <button\n type=\"button\"\n @click=${(e: Event) => {\n e.preventDefault()\n e.stopPropagation()\n\n this.value = this.buildValue()\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }}\n >\n OK\n </button>\n </div> \n </form>\n `\n }\n\n buildValue() {\n const formData = new FormData(this.form)\n\n const [category, privilege] = (formData.get('privilege') as string).split('-')\n const owner = formData.get('owner') as string\n const superUser = formData.get('super') as string\n\n return {\n category,\n privilege,\n owner: owner == 'on',\n super: superUser == 'on'\n }\n }\n\n firstUpdated() {\n ;(this.renderRoot.querySelector('input') as HTMLInputElement).focus()\n }\n\n onChange(e: Event) {\n e.stopPropagation()\n\n this.value = this.buildValue()\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
@@ -11,6 +11,6 @@ export declare class OxInputTextarea extends OxFormField {
11
11
  connectedCallback(): void;
12
12
  updated(changes: PropertyValues<this>): void;
13
13
  onInput(e: Event): void;
14
- onKeydown(e: Event): void;
14
+ onKeydown(e: KeyboardEvent): void;
15
15
  onChange(e: Event): void;
16
16
  }
@@ -58,7 +58,9 @@ let OxInputTextarea = class OxInputTextarea extends OxFormField {
58
58
  this.textarea.style.height = this.textarea.scrollHeight + 'px';
59
59
  }
60
60
  onKeydown(e) {
61
- e.stopPropagation();
61
+ if (e.key === 'Enter') {
62
+ e.stopPropagation();
63
+ }
62
64
  }
63
65
  onChange(e) {
64
66
  this.value = this.textarea.value;
@@ -1 +1 @@
1
- {"version":3,"file":"ox-input-textarea.js","sourceRoot":"","sources":["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,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAA;IAChE,CAAC;IAED,SAAS,CAAC,CAAQ;QAChB,CAAC,CAAC,eAAe,EAAE,CAAA;IACrB,CAAC;IAED,QAAQ,CAAC,CAAQ;QACf,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAA;QAEhC,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,MAAM,EAAE,IAAI,CAAC,KAAK;YAClB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAA;IACH,CAAC;;AAhD2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAmB;AAE3B;IAAlB,KAAK,CAAC,UAAU,CAAC;iDAA4B;AAzBnC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAwE3B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, html, PropertyValues } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field'\n\n@customElement('ox-input-textarea')\nexport class OxInputTextarea extends OxFormField {\n static styles = [\n css`\n :host {\n display: flex;\n }\n\n textarea {\n flex: 1;\n height: auto;\n resize: none;\n overflow: hidden;\n border: none;\n outline: none;\n background-color: transparent;\n\n font-family: inherit;\n font-size: inherit;\n font-weight: inherit;\n }\n `\n ]\n\n @property({ type: String }) value: string = ''\n\n @query('textarea') textarea!: HTMLInputElement\n\n render() {\n return html`\n <textarea\n .value=${this.value}\n @input=${this.onInput.bind(this)}\n @keydown=${this.onKeydown.bind(this)}\n @change=${this.onChange.bind(this)}\n ></textarea>\n `\n }\n\n connectedCallback() {\n super.connectedCallback()\n requestAnimationFrame(() => {\n this.textarea.focus()\n })\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value')) {\n this.textarea.style.height = 'auto'\n this.textarea.style.height = this.textarea.scrollHeight + 'px'\n }\n }\n\n onInput(e: Event) {\n this.textarea.style.height = 'auto'\n this.textarea.style.height = this.textarea.scrollHeight + 'px'\n }\n\n onKeydown(e: Event) {\n e.stopPropagation()\n }\n\n onChange(e: Event) {\n this.value = this.textarea.value\n\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: this.value,\n bubbles: true,\n composed: true\n })\n )\n }\n}\n"]}
1
+ {"version":3,"file":"ox-input-textarea.js","sourceRoot":"","sources":["../../src/ox-input-textarea.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGtC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,WAAW;IAAzC;;QAuBuB,UAAK,GAAW,EAAE,CAAA;IAmDhD,CAAC;aAzEQ,WAAM,GAAG;QACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;KAkBF;KACF,AApBY,CAoBZ;IAMD,MAAM;QACJ,OAAO,IAAI,CAAA;;iBAEE,IAAI,CAAC,KAAK;iBACV,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;mBACrB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;kBAC1B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;;KAErC,CAAA;IACH,CAAC;IAED,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAA;QACzB,qBAAqB,CAAC,GAAG,EAAE;YACzB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAA;QACvB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,CAAC,OAA6B;QACnC,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;YACxB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAA;YACnC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAA;SAC/D;IACH,CAAC;IAED,OAAO,CAAC,CAAQ;QACd,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAA;QACnC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAA;IAChE,CAAC;IAED,SAAS,CAAC,CAAgB;QACxB,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE;YACrB,CAAC,CAAC,eAAe,EAAE,CAAA;SACpB;IACH,CAAC;IAED,QAAQ,CAAC,CAAQ;QACf,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAA;QAEhC,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,MAAM,EAAE,IAAI,CAAC,KAAK;YAClB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAA;IACH,CAAC;;AAlD2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAmB;AAE3B;IAAlB,KAAK,CAAC,UAAU,CAAC;iDAA4B;AAzBnC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA0E3B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, html, PropertyValues } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field'\n\n@customElement('ox-input-textarea')\nexport class OxInputTextarea extends OxFormField {\n static styles = [\n css`\n :host {\n display: flex;\n }\n\n textarea {\n flex: 1;\n height: auto;\n resize: none;\n overflow: hidden;\n border: none;\n outline: none;\n background-color: transparent;\n\n font-family: inherit;\n font-size: inherit;\n font-weight: inherit;\n }\n `\n ]\n\n @property({ type: String }) value: string = ''\n\n @query('textarea') textarea!: HTMLInputElement\n\n render() {\n return html`\n <textarea\n .value=${this.value}\n @input=${this.onInput.bind(this)}\n @keydown=${this.onKeydown.bind(this)}\n @change=${this.onChange.bind(this)}\n ></textarea>\n `\n }\n\n connectedCallback() {\n super.connectedCallback()\n requestAnimationFrame(() => {\n this.textarea.focus()\n })\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value')) {\n this.textarea.style.height = 'auto'\n this.textarea.style.height = this.textarea.scrollHeight + 'px'\n }\n }\n\n onInput(e: Event) {\n this.textarea.style.height = 'auto'\n this.textarea.style.height = this.textarea.scrollHeight + 'px'\n }\n\n onKeydown(e: KeyboardEvent) {\n if (e.key === 'Enter') {\n e.stopPropagation()\n }\n }\n\n onChange(e: Event) {\n this.value = this.textarea.value\n\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: this.value,\n bubbles: true,\n composed: true\n })\n )\n }\n}\n"]}
@@ -0,0 +1,36 @@
1
+ import '../src/ox-input-permission.js';
2
+ import '../src/locale/locale-picker.js';
3
+ import { TemplateResult } from 'lit';
4
+ declare const _default: {
5
+ title: string;
6
+ component: string;
7
+ argTypes: {
8
+ value: {
9
+ control: string;
10
+ };
11
+ name: {
12
+ control: string;
13
+ };
14
+ };
15
+ };
16
+ export default _default;
17
+ interface Story<T> {
18
+ (args: T): TemplateResult;
19
+ args?: Partial<T>;
20
+ argTypes?: Record<string, unknown>;
21
+ }
22
+ interface ArgTypes {
23
+ name?: string;
24
+ privileges: {
25
+ name: string;
26
+ category: string;
27
+ description: string;
28
+ }[];
29
+ value?: {
30
+ privilege: string;
31
+ category: string;
32
+ owner: boolean;
33
+ super: boolean;
34
+ } | null;
35
+ }
36
+ export declare const Regular: Story<ArgTypes>;
@@ -0,0 +1,55 @@
1
+ import '../src/ox-input-permission.js';
2
+ import '../src/locale/locale-picker.js';
3
+ import { html } from 'lit';
4
+ export default {
5
+ title: 'ox-input-permission',
6
+ component: 'ox-input-permission',
7
+ argTypes: {
8
+ value: { control: 'number' },
9
+ name: { control: 'text' }
10
+ }
11
+ };
12
+ const Template = ({ name = 'permission', value = null, privileges }) => html `
13
+ <link href="/themes/app-theme.css" rel="stylesheet" />
14
+ <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
15
+ <style>
16
+ body {
17
+ }
18
+ </style>
19
+
20
+ <locale-picker></locale-picker>
21
+ <br /><br />
22
+
23
+ <ox-input-permission
24
+ @change=${(e) => {
25
+ console.log(e.target.value);
26
+ }}
27
+ name=${name}
28
+ .value=${value}
29
+ .privileges=${privileges}
30
+ >
31
+ </ox-input-permission>
32
+ `;
33
+ export const Regular = Template.bind({});
34
+ Regular.args = {
35
+ name: 'permission',
36
+ privileges: [
37
+ {
38
+ name: 'query',
39
+ category: 'aaa',
40
+ description: 'readable aaa'
41
+ },
42
+ {
43
+ name: 'mutation',
44
+ category: 'aaa',
45
+ description: 'writable aaa'
46
+ }
47
+ ],
48
+ value: {
49
+ privilege: 'mutation',
50
+ category: 'aaa',
51
+ owner: true,
52
+ super: true
53
+ }
54
+ };
55
+ //# sourceMappingURL=ox-input-permission.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-input-permission.stories.js","sourceRoot":"","sources":["../../stories/ox-input-permission.stories.ts"],"names":[],"mappings":"AAAA,OAAO,+BAA+B,CAAA;AACtC,OAAO,gCAAgC,CAAA;AAEvC,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAE1C,eAAe;IACb,KAAK,EAAE,qBAAqB;IAC5B,SAAS,EAAE,qBAAqB;IAChC,QAAQ,EAAE;QACR,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QAC5B,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;KAC1B;CACF,CAAA;AAmBD,MAAM,QAAQ,GAAoB,CAAC,EAAE,IAAI,GAAG,YAAY,EAAE,KAAK,GAAG,IAAI,EAAE,UAAU,EAAY,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;;;;cAYzF,CAAC,CAAQ,EAAE,EAAE;IACrB,OAAO,CAAC,GAAG,CAAE,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC,CAAA;AACnD,CAAC;WACM,IAAI;aACF,KAAK;kBACA,UAAU;;;CAG3B,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG;IACb,IAAI,EAAE,YAAY;IAClB,UAAU,EAAE;QACV;YACE,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,cAAc;SAC5B;QACD;YACE,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,cAAc;SAC5B;KACF;IACD,KAAK,EAAE;QACL,SAAS,EAAE,UAAU;QACrB,QAAQ,EAAE,KAAK;QACf,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,IAAI;KACZ;CACF,CAAA","sourcesContent":["import '../src/ox-input-permission.js'\nimport '../src/locale/locale-picker.js'\n\nimport { html, TemplateResult } from 'lit'\n\nexport default {\n title: 'ox-input-permission',\n component: 'ox-input-permission',\n argTypes: {\n value: { control: 'number' },\n name: { control: 'text' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n name?: string\n privileges: { name: string; category: string; description: string }[]\n value?: {\n privilege: string\n category: string\n owner: boolean\n super: boolean\n } | null\n}\n\nconst Template: Story<ArgTypes> = ({ name = 'permission', value = null, privileges }: ArgTypes) => html`\n <link href=\"/themes/app-theme.css\" rel=\"stylesheet\" />\n <link href=\"https://fonts.googleapis.com/css?family=Material+Icons&display=block\" rel=\"stylesheet\" />\n <style>\n body {\n }\n </style>\n\n <locale-picker></locale-picker>\n <br /><br />\n\n <ox-input-permission\n @change=${(e: Event) => {\n console.log((e.target as HTMLInputElement).value)\n }}\n name=${name}\n .value=${value}\n .privileges=${privileges}\n >\n </ox-input-permission>\n`\n\nexport const Regular = Template.bind({})\nRegular.args = {\n name: 'permission',\n privileges: [\n {\n name: 'query',\n category: 'aaa',\n description: 'readable aaa'\n },\n {\n name: 'mutation',\n category: 'aaa',\n description: 'writable aaa'\n }\n ],\n value: {\n privilege: 'mutation',\n category: 'aaa',\n owner: true,\n super: true\n }\n}\n"]}