@operato/input 2.0.0-alpha.2 → 2.0.0-alpha.28

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.
Files changed (33) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/dist/src/ox-input-barcode.d.ts +48 -5
  3. package/dist/src/ox-input-barcode.js +96 -69
  4. package/dist/src/ox-input-barcode.js.map +1 -1
  5. package/dist/src/ox-input-data.d.ts +3 -4
  6. package/dist/src/ox-input-data.js +86 -34
  7. package/dist/src/ox-input-data.js.map +1 -1
  8. package/dist/src/ox-input-mass-fraction.d.ts +1 -0
  9. package/dist/src/ox-input-mass-fraction.js +48 -31
  10. package/dist/src/ox-input-mass-fraction.js.map +1 -1
  11. package/dist/src/ox-input-unit-number.d.ts +2 -1
  12. package/dist/src/ox-input-unit-number.js +24 -10
  13. package/dist/src/ox-input-unit-number.js.map +1 -1
  14. package/dist/stories/ox-input-barcode.stories.js +4 -0
  15. package/dist/stories/ox-input-barcode.stories.js.map +1 -1
  16. package/dist/stories/ox-input-data.stories.d.ts +33 -0
  17. package/dist/stories/ox-input-data.stories.js +40 -0
  18. package/dist/stories/ox-input-data.stories.js.map +1 -0
  19. package/dist/stories/ox-input-mass-fraction.stories.d.ts +4 -0
  20. package/dist/stories/ox-input-mass-fraction.stories.js +9 -2
  21. package/dist/stories/ox-input-mass-fraction.stories.js.map +1 -1
  22. package/dist/stories/ox-input-unit.stories.js +1 -0
  23. package/dist/stories/ox-input-unit.stories.js.map +1 -1
  24. package/dist/tsconfig.tsbuildinfo +1 -1
  25. package/package.json +17 -17
  26. package/src/ox-input-barcode.ts +127 -63
  27. package/src/ox-input-data.ts +95 -36
  28. package/src/ox-input-mass-fraction.ts +46 -32
  29. package/src/ox-input-unit-number.ts +17 -2
  30. package/stories/ox-input-barcode.stories.ts +4 -0
  31. package/stories/ox-input-data.stories.ts +55 -0
  32. package/stories/ox-input-mass-fraction.stories.ts +10 -1
  33. package/stories/ox-input-unit.stories.ts +1 -0
@@ -2,6 +2,8 @@
2
2
  * @license Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
4
 
5
+ import '@material/mwc-icon'
6
+
5
7
  import { css, html, PropertyValues } from 'lit'
6
8
  import { customElement, property, query } from 'lit/decorators.js'
7
9
  import { ifDefined } from 'lit/directives/if-defined.js'
@@ -169,7 +171,7 @@ const UNIT_SYSTEMS: { [unit: string]: { [unit: string]: number | ((v: number) =>
169
171
  }
170
172
 
171
173
  @customElement('ox-input-unit-number')
172
- export class OxInputUnit extends OxFormField {
174
+ export class OxInputUnitNumber extends OxFormField {
173
175
  static styles = [
174
176
  css`
175
177
  :host {
@@ -205,13 +207,25 @@ export class OxInputUnit extends OxFormField {
205
207
  }
206
208
 
207
209
  #unit {
208
- display: inline;
210
+ flex: 1;
211
+ display: flex;
212
+ align-items: center;
209
213
  position: relative;
210
214
  margin-left: var(--margin-narrow);
211
215
  font: var(--label-font);
212
216
  color: var(--label-color);
213
217
  min-width: 24px;
214
218
  }
219
+
220
+ mwc-icon {
221
+ font-size: 18px;
222
+ color: var(--primary-color, #3c3938);
223
+ margin-left: auto;
224
+ }
225
+
226
+ ox-popup-list {
227
+ right: 0;
228
+ }
215
229
  `
216
230
  ]
217
231
 
@@ -258,6 +272,7 @@ export class OxInputUnit extends OxFormField {
258
272
  <div option value=${this.stdUnit}>${this.stdUnit}</div>
259
273
  ${units.map(unit => html`<div option value=${unit}>${unit}</div>`)}
260
274
  </ox-popup-list>
275
+ <mwc-icon>expand_more</mwc-icon>
261
276
  </div>
262
277
  `
263
278
  }
@@ -43,6 +43,10 @@ const Template: Story<ArgTypes> = ({
43
43
  <link href="/themes/app-theme.css" rel="stylesheet" />
44
44
  <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
45
45
  <style>
46
+ #root {
47
+ height: 500px;
48
+ }
49
+
46
50
  ox-input-barcode {
47
51
  font-size: 80px;
48
52
  --input-font: initial;
@@ -0,0 +1,55 @@
1
+ import '../src/ox-input-data.js'
2
+
3
+ import { html, TemplateResult } from 'lit'
4
+
5
+ export default {
6
+ title: 'ox-input-data',
7
+ component: 'ox-input-data',
8
+ argTypes: {
9
+ value: { control: 'text' },
10
+ name: { control: 'text' },
11
+ language: { control: 'select', options: ['javascript', 'sql', 'json'] },
12
+ disabled: { control: 'boolean' }
13
+ }
14
+ }
15
+
16
+ interface Story<T> {
17
+ (args: T): TemplateResult
18
+ args?: Partial<T>
19
+ argTypes?: Record<string, unknown>
20
+ }
21
+
22
+ interface ArgTypes {
23
+ name?: string
24
+ value?: string | number | object
25
+ disabled?: boolean
26
+ }
27
+
28
+ const Template: Story<ArgTypes> = ({ name = 'code', value = '', disabled }: ArgTypes) => html`
29
+ <link href="/themes/app-theme.css" rel="stylesheet" />
30
+ <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
31
+ <style>
32
+ body {
33
+ }
34
+ ox-input-data {
35
+ height: 300px;
36
+ }
37
+ </style>
38
+
39
+ <ox-input-data
40
+ @change=${(e: Event) => {
41
+ const value = (e.target as HTMLInputElement).value
42
+ console.log('value : ', value, typeof value)
43
+ }}
44
+ name=${name}
45
+ .value=${value}
46
+ ?disabled=${disabled}
47
+ >
48
+ </ox-input-data>
49
+ `
50
+
51
+ export const Regular = Template.bind({})
52
+ Regular.args = {
53
+ name: 'data',
54
+ value: ''
55
+ }
@@ -9,6 +9,7 @@ export default {
9
9
  name: { control: 'text' },
10
10
  value: { control: 'object' },
11
11
  defaultValue: { control: 'object' },
12
+ composable: { control: 'boolean' },
12
13
  disabled: { control: 'boolean' }
13
14
  }
14
15
  }
@@ -23,6 +24,7 @@ interface ArgTypes {
23
24
  name?: string
24
25
  value?: object
25
26
  defaultValue?: object
27
+ composable?: boolean
26
28
  disabled?: boolean
27
29
  }
28
30
 
@@ -30,6 +32,7 @@ const Template: Story<ArgTypes> = ({
30
32
  name = 'mass-fraction',
31
33
  value = {},
32
34
  defaultValue = {},
35
+ composable = true,
33
36
  disabled
34
37
  }: ArgTypes) => html`
35
38
  <link href="/themes/app-theme.css" rel="stylesheet" />
@@ -46,6 +49,7 @@ const Template: Story<ArgTypes> = ({
46
49
  name=${name}
47
50
  .value=${value}
48
51
  .defaultValue=${defaultValue}
52
+ ?composable=${composable}
49
53
  ?disabled=${disabled}
50
54
  >
51
55
  </ox-input-mass-fraction>
@@ -54,7 +58,12 @@ const Template: Story<ArgTypes> = ({
54
58
  export const Regular = Template.bind({})
55
59
  Regular.args = {
56
60
  name: 'mass-fraction',
57
- value: {},
61
+ value: {
62
+ H2O: 0.8,
63
+ N2O: 0.1,
64
+ CO2: 0.1
65
+ },
66
+ composable: true,
58
67
  defaultValue: {
59
68
  H2O: 0.8,
60
69
  N2O: 0.1,
@@ -68,6 +68,7 @@ const Template: Story<ArgTypes> = ({
68
68
  userUnit,
69
69
  disabled
70
70
  }: ArgTypes) => html`
71
+ <link href="https://fonts.googleapis.com/css?family=Material+Icons" rel="stylesheet" />
71
72
  <link href="/themes/app-theme.css" rel="stylesheet" />
72
73
  <ox-input-unit-number
73
74
  name=${name}