@rettangoli/ui 0.1.31 → 0.1.32-rc1

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 (89) hide show
  1. package/README.md +20 -85
  2. package/dist/rettangoli-iife-layout.min.js +113 -173
  3. package/dist/rettangoli-iife-ui.min.js +123 -183
  4. package/package.json +5 -4
  5. package/src/common/dimensions.js +72 -0
  6. package/src/common/link.js +111 -0
  7. package/src/common/responsive.js +8 -0
  8. package/src/common.js +43 -8
  9. package/src/components/accordionItem/accordionItem.handlers.js +1 -1
  10. package/src/components/accordionItem/accordionItem.schema.yaml +14 -0
  11. package/src/components/accordionItem/accordionItem.store.js +8 -8
  12. package/src/components/accordionItem/accordionItem.view.yaml +5 -35
  13. package/src/components/breadcrumb/breadcrumb.handlers.js +24 -3
  14. package/src/components/breadcrumb/breadcrumb.schema.yaml +51 -0
  15. package/src/components/breadcrumb/breadcrumb.store.js +66 -10
  16. package/src/components/breadcrumb/breadcrumb.view.yaml +18 -58
  17. package/src/components/dropdownMenu/dropdownMenu.handlers.js +17 -3
  18. package/src/components/dropdownMenu/dropdownMenu.schema.yaml +64 -0
  19. package/src/components/dropdownMenu/dropdownMenu.store.js +48 -6
  20. package/src/components/dropdownMenu/dropdownMenu.view.yaml +24 -46
  21. package/src/components/form/form.handlers.js +25 -108
  22. package/src/components/form/form.schema.yaml +283 -0
  23. package/src/components/form/form.store.js +19 -14
  24. package/src/components/form/form.view.yaml +28 -319
  25. package/src/components/globalUi/globalUi.handlers.js +2 -2
  26. package/src/components/globalUi/globalUi.schema.yaml +8 -0
  27. package/src/components/globalUi/globalUi.store.js +8 -8
  28. package/src/components/globalUi/globalUi.view.yaml +9 -46
  29. package/src/components/navbar/navbar.handlers.js +1 -1
  30. package/src/components/navbar/navbar.schema.yaml +25 -0
  31. package/src/components/navbar/navbar.store.js +28 -14
  32. package/src/components/navbar/navbar.view.yaml +21 -65
  33. package/src/components/pageOutline/pageOutline.handlers.js +17 -11
  34. package/src/components/pageOutline/pageOutline.schema.yaml +16 -0
  35. package/src/components/pageOutline/pageOutline.store.js +6 -7
  36. package/src/components/pageOutline/pageOutline.view.yaml +1 -29
  37. package/src/components/popoverInput/popoverInput.handlers.js +31 -31
  38. package/src/components/popoverInput/popoverInput.schema.yaml +18 -0
  39. package/src/components/popoverInput/popoverInput.store.js +9 -9
  40. package/src/components/popoverInput/popoverInput.view.yaml +5 -22
  41. package/src/components/select/select.handlers.js +31 -35
  42. package/src/components/select/select.schema.yaml +36 -0
  43. package/src/components/select/select.store.js +34 -35
  44. package/src/components/select/select.view.yaml +13 -56
  45. package/src/components/sidebar/sidebar.handlers.js +5 -5
  46. package/src/components/sidebar/sidebar.schema.yaml +57 -0
  47. package/src/components/sidebar/sidebar.store.js +45 -23
  48. package/src/components/sidebar/sidebar.view.yaml +79 -174
  49. package/src/components/sliderInput/sliderInput.handlers.js +28 -8
  50. package/src/components/sliderInput/sliderInput.schema.yaml +27 -0
  51. package/src/components/sliderInput/sliderInput.store.js +9 -9
  52. package/src/components/sliderInput/sliderInput.view.yaml +8 -33
  53. package/src/components/table/table.handlers.js +3 -3
  54. package/src/components/table/table.schema.yaml +27 -0
  55. package/src/components/table/table.store.js +8 -8
  56. package/src/components/table/table.view.yaml +16 -62
  57. package/src/components/tabs/tabs.schema.yaml +26 -0
  58. package/src/components/tabs/tabs.store.js +12 -9
  59. package/src/components/tabs/tabs.view.yaml +4 -60
  60. package/src/components/tooltip/tooltip.schema.yaml +18 -0
  61. package/src/components/tooltip/tooltip.store.js +7 -7
  62. package/src/components/tooltip/tooltip.view.yaml +4 -22
  63. package/src/components/waveform/waveform.handlers.js +6 -6
  64. package/src/components/waveform/waveform.schema.yaml +25 -0
  65. package/src/components/waveform/waveform.store.js +6 -6
  66. package/src/components/waveform/waveform.view.yaml +6 -34
  67. package/src/deps/createGlobalUI.js +2 -2
  68. package/src/primitives/button.js +200 -114
  69. package/src/primitives/colorPicker.js +56 -50
  70. package/src/primitives/dialog.js +2 -1
  71. package/src/primitives/image.js +73 -103
  72. package/src/primitives/input-number.js +139 -93
  73. package/src/primitives/input.js +87 -64
  74. package/src/primitives/popover.js +36 -28
  75. package/src/primitives/slider.js +6 -4
  76. package/src/primitives/svg.js +9 -10
  77. package/src/primitives/text.js +26 -47
  78. package/src/primitives/textarea.js +25 -9
  79. package/src/primitives/view.js +49 -90
  80. package/src/setup.js +1 -7
  81. package/src/styles/buttonMarginStyles.js +1 -13
  82. package/src/styles/cursorStyles.js +1 -5
  83. package/src/styles/flexDirectionStyles.js +4 -4
  84. package/src/styles/marginStylesForTarget.js +13 -0
  85. package/src/styles/textColorStyles.js +14 -6
  86. package/src/styles/textStyles.js +4 -4
  87. package/src/styles/viewStyles.js +6 -6
  88. package/src/styles/viewStylesForTarget.js +58 -0
  89. package/src/styles/flexChildStyles.js +0 -43
@@ -0,0 +1,283 @@
1
+ componentName: rtgl-form
2
+ propsSchema:
3
+ type: object
4
+ properties:
5
+ key:
6
+ type: string
7
+ autofocus:
8
+ type: boolean
9
+ defaultValues:
10
+ type: object
11
+ context:
12
+ type: object
13
+ form:
14
+ type: object
15
+ properties:
16
+ title:
17
+ type: string
18
+ description:
19
+ type: string
20
+ fields:
21
+ type: array
22
+ items:
23
+ anyOf:
24
+ - type: object
25
+ properties:
26
+ name:
27
+ type: string
28
+ label:
29
+ type: string
30
+ description:
31
+ type: string
32
+ inputType:
33
+ const: input-text
34
+ placeholder:
35
+ type: string
36
+ testId:
37
+ type: string
38
+ tooltip:
39
+ type: object
40
+ properties:
41
+ content:
42
+ type: string
43
+ required:
44
+ - name
45
+ - label
46
+ - inputType
47
+ additionalProperties: false
48
+ - type: object
49
+ properties:
50
+ name:
51
+ type: string
52
+ label:
53
+ type: string
54
+ description:
55
+ type: string
56
+ inputType:
57
+ const: select
58
+ placeholder:
59
+ type: string
60
+ noClear:
61
+ type: boolean
62
+ addOption:
63
+ type: object
64
+ properties:
65
+ label:
66
+ type: string
67
+ options:
68
+ type: array
69
+ items:
70
+ type: object
71
+ properties:
72
+ label:
73
+ type: string
74
+ value:
75
+ type: any
76
+ required:
77
+ - label
78
+ - value
79
+ testId:
80
+ type: string
81
+ tooltip:
82
+ type: object
83
+ properties:
84
+ content:
85
+ type: string
86
+ required:
87
+ - name
88
+ - label
89
+ - inputType
90
+ - options
91
+ additionalProperties: false
92
+ - type: object
93
+ properties:
94
+ name:
95
+ type: string
96
+ label:
97
+ type: string
98
+ description:
99
+ type: string
100
+ inputType:
101
+ const: color-picker
102
+ value:
103
+ type: string
104
+ testId:
105
+ type: string
106
+ tooltip:
107
+ type: object
108
+ properties:
109
+ content:
110
+ type: string
111
+ required:
112
+ - name
113
+ - label
114
+ - inputType
115
+ additionalProperties: false
116
+ - type: object
117
+ properties:
118
+ name:
119
+ type: string
120
+ label:
121
+ type: string
122
+ description:
123
+ type: string
124
+ inputType:
125
+ const: slider
126
+ min:
127
+ type: number
128
+ max:
129
+ type: number
130
+ step:
131
+ type: number
132
+ value:
133
+ type: number
134
+ testId:
135
+ type: string
136
+ tooltip:
137
+ type: object
138
+ properties:
139
+ content:
140
+ type: string
141
+ required:
142
+ - name
143
+ - label
144
+ - inputType
145
+ additionalProperties: false
146
+ - type: object
147
+ properties:
148
+ name:
149
+ type: string
150
+ label:
151
+ type: string
152
+ description:
153
+ type: string
154
+ inputType:
155
+ const: slider-input
156
+ min:
157
+ type: number
158
+ max:
159
+ type: number
160
+ step:
161
+ type: number
162
+ value:
163
+ type: number
164
+ testId:
165
+ type: string
166
+ tooltip:
167
+ type: object
168
+ properties:
169
+ content:
170
+ type: string
171
+ required:
172
+ - name
173
+ - label
174
+ - inputType
175
+ additionalProperties: false
176
+ - type: object
177
+ properties:
178
+ name:
179
+ type: string
180
+ label:
181
+ type: string
182
+ description:
183
+ type: string
184
+ inputType:
185
+ const: image
186
+ width:
187
+ type: number
188
+ height:
189
+ type: number
190
+ placeholder:
191
+ type: string
192
+ testId:
193
+ type: string
194
+ tooltip:
195
+ type: object
196
+ properties:
197
+ content:
198
+ type: string
199
+ required:
200
+ - name
201
+ - label
202
+ - inputType
203
+ additionalProperties: false
204
+ - type: object
205
+ properties:
206
+ name:
207
+ type: string
208
+ label:
209
+ type: string
210
+ description:
211
+ type: string
212
+ inputType:
213
+ const: waveform
214
+ width:
215
+ type: number
216
+ height:
217
+ type: number
218
+ placeholder:
219
+ type: string
220
+ defaultValue:
221
+ type: object
222
+ waveformData:
223
+ type: object
224
+ testId:
225
+ type: string
226
+ tooltip:
227
+ type: object
228
+ properties:
229
+ content:
230
+ type: string
231
+ required:
232
+ - name
233
+ - label
234
+ - inputType
235
+ additionalProperties: false
236
+ - type: object
237
+ properties:
238
+ name:
239
+ type: string
240
+ label:
241
+ type: string
242
+ description:
243
+ type: string
244
+ inputType:
245
+ const: popover-input
246
+ placeholder:
247
+ type: string
248
+ testId:
249
+ type: string
250
+ tooltip:
251
+ type: object
252
+ properties:
253
+ content:
254
+ type: string
255
+ required:
256
+ - name
257
+ - label
258
+ - inputType
259
+ additionalProperties: false
260
+ actions:
261
+ type: object
262
+ properties:
263
+ buttons:
264
+ type: array
265
+ items:
266
+ type: object
267
+ properties:
268
+ id:
269
+ type: string
270
+ content:
271
+ type: string
272
+ testId:
273
+ type: string
274
+ required:
275
+ - id
276
+ - content
277
+ events:
278
+ form-change: {}
279
+ extra-event: {}
280
+ action-click: {}
281
+ methods:
282
+ type: object
283
+ properties: {}
@@ -80,10 +80,10 @@ const set = (obj, path, value) => {
80
80
  return obj;
81
81
  };
82
82
 
83
- const blacklistedAttrs = ["id", "class", "style", "slot"];
83
+ const blacklistedAttrs = ["id", "class", "style", "slot", "form", "defaultValues", "context", "autofocus", "key"];
84
84
 
85
- const stringifyAttrs = (attrs) => {
86
- return Object.entries(attrs)
85
+ const stringifyAttrs = (props = {}) => {
86
+ return Object.entries(props)
87
87
  .filter(([key]) => !blacklistedAttrs.includes(key))
88
88
  .map(([key, value]) => `${key}=${value}`)
89
89
  .join(" ");
@@ -102,8 +102,8 @@ export const selectForm = ({ props }) => {
102
102
  };
103
103
 
104
104
 
105
- export const selectViewData = ({ state, props, attrs }) => {
106
- const containerAttrString = stringifyAttrs(attrs);
105
+ export const selectViewData = ({ state, props }) => {
106
+ const containerAttrString = stringifyAttrs(props);
107
107
 
108
108
  const form = selectForm({ state, props });
109
109
  const fields = structuredClone(form.fields || []);
@@ -136,7 +136,7 @@ export const selectViewData = ({ state, props, attrs }) => {
136
136
  });
137
137
 
138
138
  return {
139
- key: attrs?.key,
139
+ key: props?.key,
140
140
  containerAttrString,
141
141
  title: form?.title || "",
142
142
  description: form?.description || "",
@@ -166,11 +166,15 @@ export const getFormFieldValue = ({ state }, name) => {
166
166
  return get(state.formValues, name);
167
167
  };
168
168
 
169
- export const setFormValues = (state, formValues) => {
170
- state.formValues = formValues || {};
169
+ export const setFormValues = ({ state }, payload = {}) => {
170
+ state.formValues = payload.formValues || {};
171
171
  };
172
172
 
173
- export const setFormFieldValue = (state, { name, value, props }) => {
173
+ export const setFormFieldValue = ({ state, props }, payload = {}) => {
174
+ const { name, value } = payload;
175
+ if (!name) {
176
+ return;
177
+ }
174
178
  set(state.formValues, name, value);
175
179
  // remove non visible values
176
180
  const form = selectForm({ state, props });
@@ -181,16 +185,17 @@ export const setFormFieldValue = (state, { name, value, props }) => {
181
185
  state.formValues = formValues;
182
186
  };
183
187
 
184
- export const showTooltip = (state, { x, y, content }) => {
188
+ export const showTooltip = ({ state }, payload = {}) => {
189
+ const { x, y, content } = payload;
185
190
  state.tooltipState = {
186
191
  open: true,
187
- x: x,
188
- y: y,
189
- content: content
192
+ x,
193
+ y,
194
+ content,
190
195
  };
191
196
  };
192
197
 
193
- export const hideTooltip = (state) => {
198
+ export const hideTooltip = ({ state }) => {
194
199
  state.tooltipState = {
195
200
  ...state.tooltipState,
196
201
  open: false