@operato/input 8.0.0-beta.0 → 8.0.0-beta.1

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 (98) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/package.json +7 -7
  3. package/.editorconfig +0 -29
  4. package/.storybook/main.js +0 -3
  5. package/.storybook/preview.js +0 -52
  6. package/.storybook/server.mjs +0 -8
  7. package/src/index.ts +0 -35
  8. package/src/locale/locale-codes.ts +0 -18
  9. package/src/locale/locale-picker.ts +0 -43
  10. package/src/locale/localization.ts +0 -15
  11. package/src/locales/en.ts +0 -30
  12. package/src/locales/ko.ts +0 -30
  13. package/src/locales/ms.ts +0 -30
  14. package/src/locales/zh.ts +0 -30
  15. package/src/ox-buttons-radio.ts +0 -140
  16. package/src/ox-checkbox.ts +0 -181
  17. package/src/ox-form-field.ts +0 -53
  18. package/src/ox-input-3axis.ts +0 -77
  19. package/src/ox-input-3dish.ts +0 -211
  20. package/src/ox-input-angle.ts +0 -73
  21. package/src/ox-input-barcode.ts +0 -318
  22. package/src/ox-input-code.ts +0 -139
  23. package/src/ox-input-color-gradient.ts +0 -349
  24. package/src/ox-input-color-stops.ts +0 -525
  25. package/src/ox-input-color.ts +0 -338
  26. package/src/ox-input-container.ts +0 -32
  27. package/src/ox-input-crontab.ts +0 -595
  28. package/src/ox-input-data.ts +0 -219
  29. package/src/ox-input-direction.ts +0 -92
  30. package/src/ox-input-duration.ts +0 -175
  31. package/src/ox-input-file.ts +0 -209
  32. package/src/ox-input-hashtags.ts +0 -185
  33. package/src/ox-input-i18n-label.ts +0 -140
  34. package/src/ox-input-image.ts +0 -168
  35. package/src/ox-input-key-values.ts +0 -301
  36. package/src/ox-input-layout/ox-input-card-layout.ts +0 -58
  37. package/src/ox-input-layout/ox-input-grid-layout.ts +0 -64
  38. package/src/ox-input-layout/ox-input-layout.ts +0 -77
  39. package/src/ox-input-mass-fraction.ts +0 -437
  40. package/src/ox-input-multiple-colors.ts +0 -135
  41. package/src/ox-input-options.ts +0 -216
  42. package/src/ox-input-partition-keys.ts +0 -303
  43. package/src/ox-input-privilege.ts +0 -163
  44. package/src/ox-input-quantifier.ts +0 -62
  45. package/src/ox-input-range.ts +0 -146
  46. package/src/ox-input-scene-component-id.ts +0 -73
  47. package/src/ox-input-search.ts +0 -126
  48. package/src/ox-input-select-buttons.ts +0 -75
  49. package/src/ox-input-signature.ts +0 -208
  50. package/src/ox-input-stack.ts +0 -136
  51. package/src/ox-input-switch.ts +0 -117
  52. package/src/ox-input-table-column-config.ts +0 -211
  53. package/src/ox-input-table.ts +0 -404
  54. package/src/ox-input-textarea.ts +0 -86
  55. package/src/ox-input-unit-number.ts +0 -354
  56. package/src/ox-input-value-map.ts +0 -342
  57. package/src/ox-input-value-ranges.ts +0 -363
  58. package/src/ox-input-work-shift.ts +0 -290
  59. package/src/ox-select-floor.ts +0 -246
  60. package/src/ox-select.ts +0 -219
  61. package/stories/image-for-select-floor.ts +0 -2
  62. package/stories/ox-buttons-radio.stories.ts +0 -89
  63. package/stories/ox-checkbox.stories.ts +0 -111
  64. package/stories/ox-input-3axis.stories.ts +0 -77
  65. package/stories/ox-input-3dish.stories.ts +0 -106
  66. package/stories/ox-input-angle.stories.ts +0 -84
  67. package/stories/ox-input-barcode.stories.ts +0 -117
  68. package/stories/ox-input-code.stories.ts +0 -99
  69. package/stories/ox-input-crontab.stories.ts +0 -82
  70. package/stories/ox-input-data.stories.ts +0 -82
  71. package/stories/ox-input-direction.stories.ts +0 -91
  72. package/stories/ox-input-duration.stories.ts +0 -84
  73. package/stories/ox-input-file.stories.ts +0 -111
  74. package/stories/ox-input-hashtags.stories.ts +0 -82
  75. package/stories/ox-input-i18n-label.stories.ts +0 -103
  76. package/stories/ox-input-key-values.stories.ts +0 -97
  77. package/stories/ox-input-mass-fraction.stories.ts +0 -102
  78. package/stories/ox-input-multiple-colors.stories.ts +0 -72
  79. package/stories/ox-input-options.stories.ts +0 -80
  80. package/stories/ox-input-partition-keys.stories.ts +0 -84
  81. package/stories/ox-input-privilege.stories.ts +0 -108
  82. package/stories/ox-input-quantifier.stories.ts +0 -80
  83. package/stories/ox-input-range.stories.ts +0 -89
  84. package/stories/ox-input-search.stories.ts +0 -91
  85. package/stories/ox-input-select-buttons.stories.ts +0 -118
  86. package/stories/ox-input-signature.stories.ts +0 -75
  87. package/stories/ox-input-switch.stories.ts +0 -91
  88. package/stories/ox-input-table-column-config.stories.ts +0 -109
  89. package/stories/ox-input-unit.stories.ts +0 -151
  90. package/stories/ox-input-value-map.stories.ts +0 -92
  91. package/stories/ox-input-value-ranges.stories.ts +0 -92
  92. package/stories/ox-input-work-shift.stories.ts +0 -106
  93. package/stories/ox-select-floor.stories.ts +0 -197
  94. package/stories/ox-select-set-options.stories.ts +0 -208
  95. package/stories/ox-select.stories.ts +0 -181
  96. package/tsconfig.json +0 -25
  97. package/web-dev-server.config.mjs +0 -27
  98. package/web-test-runner.config.mjs +0 -41
@@ -1,349 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import '@operato/i18n/ox-i18n.js'
6
- import '@polymer/paper-dropdown-menu/paper-dropdown-menu'
7
- import '@polymer/paper-listbox/paper-listbox'
8
- import '@polymer/paper-item/paper-item'
9
- import '@operato/input/ox-input-angle.js'
10
- import '@operato/input/ox-input-color-stops.js'
11
-
12
- import { css, html } from 'lit'
13
- import { customElement, property } from 'lit/decorators.js'
14
-
15
- import { ColorStop } from './ox-input-color-stops.js'
16
- import { OxFormField } from './ox-form-field.js'
17
-
18
- export type GradientOption = {
19
- type: 'linear' | 'radial'
20
- rotation: number
21
- direction?:
22
- | 'left-to-right'
23
- | 'lefttop-to-rightbottom'
24
- | 'top-to-bottom'
25
- | 'righttop-to-leftbottom'
26
- | 'right-to-left'
27
- | 'rightbottom-to-lefttop'
28
- | 'bottom-to-top'
29
- | 'leftbottom-to-righttop'
30
- | 'left-to-right'
31
- | 'center-to-corner'
32
- center?: 'center' | 'left-top' | 'right-top' | 'right-bottom' | 'left-bottom'
33
- colorStops?: ColorStop[]
34
- }
35
-
36
- @customElement('ox-input-color-gradient')
37
- export class OxInputColorGradient extends OxFormField {
38
- static styles = css`
39
- :host {
40
- display: grid;
41
-
42
- grid-template-columns: repeat(10, 1fr);
43
- grid-gap: 5px;
44
- grid-auto-rows: minmax(24px, auto);
45
-
46
- align-items: center;
47
- }
48
-
49
- :host > * {
50
- align-self: stretch;
51
- }
52
-
53
- :host > label {
54
- grid-column: span 2;
55
- text-align: right;
56
- text-transform: capitalize;
57
- align-self: center;
58
- }
59
-
60
- :host > .icon-only-label {
61
- grid-column: span 1;
62
- }
63
-
64
- :host > input,
65
- :host > [editors] {
66
- grid-column: span 8;
67
- }
68
-
69
- :host > select {
70
- grid-column: span 4;
71
- height: 100%;
72
- border: 1px solid rgba(0, 0, 0, 0.2);
73
- }
74
-
75
- :host > ox-input-angle {
76
- grid-column: span 3;
77
- }
78
-
79
- ox-input-color-stops {
80
- grid-column: span 10;
81
- }
82
-
83
- .host > input[type='checkbox'] {
84
- grid-column: 3 / 4;
85
- }
86
-
87
- .host > input[type='checkbox'] ~ label {
88
- grid-column: span 7;
89
- text-align: left;
90
- }
91
-
92
- [editors] > :not([active-selector]) {
93
- display: none;
94
- }
95
-
96
- [gradient-direction] {
97
- overflow: hidden;
98
- max-width: 210px;
99
- }
100
-
101
- [gradient-direction] paper-item {
102
- background: url(/assets/images/icon-editor-gradient-direction.png) 50% 0 no-repeat;
103
- min-height: 32px;
104
- padding: 3px 5px;
105
- width: 30px;
106
- float: left;
107
- }
108
-
109
- [gradient-direction] [name='lefttop-to-rightbottom'] {
110
- background-position: 50% 4px;
111
- }
112
-
113
- [gradient-direction] [name='left-top'] {
114
- background-position: 50% 4px;
115
- }
116
-
117
- [gradient-direction] [name='top-to-bottom'] {
118
- background-position: 50% -46px;
119
- }
120
-
121
- [gradient-direction] [name='righttop-to-leftbottom'] {
122
- background-position: 50% -96px;
123
- }
124
-
125
- [gradient-direction] [name='right-top'] {
126
- background-position: 50% -96px;
127
- }
128
-
129
- [gradient-direction] [name='right-to-left'] {
130
- background-position: 50% -146px;
131
- }
132
-
133
- [gradient-direction] [name='rightbottom-to-lefttop'] {
134
- background-position: 50% -196px;
135
- }
136
-
137
- [gradient-direction] [name='right-bottom'] {
138
- background-position: 50% -196px;
139
- }
140
-
141
- [gradient-direction] [name='bottom-to-top'] {
142
- background-position: 50% -246px;
143
- }
144
-
145
- [gradient-direction] [name='leftbottom-to-righttop'] {
146
- background-position: 50% -296px;
147
- }
148
-
149
- [gradient-direction] [name='left-bottom'] {
150
- background-position: 50% -296px;
151
- }
152
-
153
- [gradient-direction] [name='left-to-right'] {
154
- background-position: 50% -346px;
155
- }
156
-
157
- [gradient-direction] [name='center-to-corner'] {
158
- background-position: 50% -396px;
159
- }
160
-
161
- [gradient-direction] [name='center'] {
162
- background-position: 50% -396px;
163
- }
164
-
165
- [gradient-direction] paper-item[focused] {
166
- background-color: rgba(255, 246, 143, 0.5);
167
- }
168
-
169
- .icon-only-label {
170
- top: 0 !important;
171
- width: 30px !important;
172
- height: 24px;
173
- background: url(/assets/images/icon-properties-label.png) no-repeat;
174
- }
175
-
176
- .icon-only-label.color {
177
- background-position: 70% -198px;
178
- }
179
- `
180
-
181
- @property({ type: Object }) value: GradientOption = {
182
- type: 'linear',
183
- direction: 'left-to-right',
184
- rotation: 0
185
- }
186
-
187
- firstUpdated() {
188
- this.renderRoot.addEventListener('change', this._onChange.bind(this))
189
- }
190
-
191
- _onChange(e: Event) {
192
- var element = e.target as HTMLElement & { type: string }
193
- var key = element.getAttribute('value-key')
194
-
195
- if (!key) {
196
- return
197
- }
198
-
199
- var value
200
-
201
- switch (element.tagName) {
202
- case 'INPUT':
203
- switch (element.type) {
204
- case 'checkbox':
205
- value = (element as HTMLInputElement).checked
206
- break
207
- case 'number':
208
- value = Number((element as HTMLInputElement).value) || 0
209
- break
210
- case 'text':
211
- value = String((element as HTMLInputElement).value)
212
- }
213
- break
214
-
215
- case 'PAPER-BUTTON':
216
- value = (element as any).active
217
- break
218
-
219
- case 'PAPER-LISTBOX':
220
- value = (element as any).selected
221
- break
222
-
223
- default:
224
- value = (element as HTMLInputElement).value
225
- break
226
- }
227
-
228
- if (key === 'rotation') {
229
- this.value = {
230
- ...this.value,
231
- rotation: value,
232
- direction: undefined
233
- }
234
- } else if (key === 'direction') {
235
- if (value) {
236
- this.value = {
237
- ...this.value,
238
- direction: value,
239
- rotation: this._convertDirectionToRotation(value)
240
- }
241
- }
242
- } else {
243
- this.value = {
244
- ...this.value,
245
- [key]: value
246
- }
247
- }
248
-
249
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
250
- }
251
-
252
- render() {
253
- var selector = (this.value && this.value.type) || 'linear'
254
- var value = this.value || {}
255
-
256
- return html`
257
- <label> <ox-i18n msgid="label.type">type</ox-i18n> </label>
258
- <select value-key="type" .value=${value.type || 'linear'} ?disabled=${this.disabled}>
259
- <option>linear</option>
260
- <option>radial</option>
261
- </select>
262
-
263
- <label class="icon-only-label color"></label>
264
- <ox-input-angle value-key="rotation" .value=${value.rotation || 0} ?disabled=${this.disabled}> </ox-input-angle>
265
-
266
- <label> <ox-i18n msgid="label.direction">direction</ox-i18n> </label>
267
- <div editors>
268
- <paper-dropdown-menu no-label-float="true" ?active-selector=${selector == 'linear'} .value=${value.direction}>
269
- <paper-listbox
270
- @selected-changed=${(e: Event) => this._onChange(e)}
271
- value-key="direction"
272
- slot="dropdown-content"
273
- gradient-direction
274
- .selected=${value.direction}
275
- attr-for-selected="name"
276
- >
277
- <paper-item name="lefttop-to-rightbottom"></paper-item>
278
- <paper-item name="top-to-bottom"></paper-item>
279
- <paper-item name="righttop-to-leftbottom"></paper-item>
280
- <paper-item name="right-to-left"></paper-item>
281
- <paper-item name="rightbottom-to-lefttop"></paper-item>
282
- <paper-item name="bottom-to-top"></paper-item>
283
- <paper-item name="leftbottom-to-righttop"></paper-item>
284
- <paper-item name="left-to-right"></paper-item>
285
- <paper-item name="center-to-corner"></paper-item>
286
- </paper-listbox>
287
- </paper-dropdown-menu>
288
-
289
- <paper-dropdown-menu no-label-float="true" ?active-selector=${selector == 'radial'} .value=${value.center}>
290
- <paper-listbox
291
- @selected-changed=${(e: Event) => this._onChange(e)}
292
- value-key="center"
293
- slot="dropdown-content"
294
- gradient-direction
295
- .selected=${value.center || 'center'}
296
- attr-for-selected="name"
297
- >
298
- <paper-item name="center"></paper-item>
299
- <paper-item name="left-top"></paper-item>
300
- <paper-item name="right-top"></paper-item>
301
- <paper-item name="right-bottom"></paper-item>
302
- <paper-item name="left-bottom"></paper-item>
303
- </paper-listbox>
304
- </paper-dropdown-menu>
305
- </div>
306
-
307
- <ox-input-color-stops
308
- value-key="colorStops"
309
- type="gradient"
310
- .value=${value.colorStops}
311
- ?disabled=${this.disabled}
312
- >
313
- </ox-input-color-stops>
314
- `
315
- }
316
-
317
- _convertDirectionToRotation(direction: string): number {
318
- var rotation
319
- switch (direction) {
320
- case 'lefttop-to-rightbottom':
321
- rotation = 45
322
- break
323
- case 'top-to-bottom':
324
- rotation = 90
325
- break
326
- case 'righttop-to-leftbottom':
327
- rotation = 135
328
- break
329
- case 'right-to-left':
330
- rotation = 180
331
- break
332
- case 'rightbottom-to-lefttop':
333
- rotation = 215
334
- break
335
- case 'bottom-to-top':
336
- rotation = 270
337
- break
338
- case 'leftbottom-to-righttop':
339
- rotation = 315
340
- break
341
- case 'left-to-right':
342
- default:
343
- rotation = 0
344
- break
345
- }
346
-
347
- return (rotation / 360) * Math.PI * 2
348
- }
349
- }