@massimo-cassandro/minimo 1.21.1 → 1.21.3

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 (57) hide show
  1. package/design-tokens/tokens-config-sample.mjs +1 -1
  2. package/index.js +1 -1
  3. package/package.json +1 -1
  4. package/src/components/autocomplete/autocomplete.css +116 -118
  5. package/src/components/inner-nav/inner-nav.css +10 -13
  6. package/src/components/modal-alert/modal-alert.module.css +156 -159
  7. package/src/components/modal-popup/modal-popup.module.css +84 -88
  8. package/src/components/overlay/overlay.css +10 -14
  9. package/src/components/sf-macro/sf-macro.css +68 -72
  10. package/src/components/slide-up-down-toggle/slide-up-down-toggle.module.css +90 -94
  11. package/src/components/snackbar/snackbar.module.css +89 -93
  12. package/src/components/spinner/spinner-circle-basic.css +14 -18
  13. package/src/components/spinner/spinner.module.css +4 -8
  14. package/src/components/unsplash-page/unsplash-page.module.css +255 -260
  15. package/src/css/alerts.css +81 -85
  16. package/src/css/badge.css +13 -15
  17. package/src/css/buttons/btn-close.css +53 -56
  18. package/src/css/buttons/buttons-primary.css +34 -37
  19. package/src/css/buttons/buttons-secondary.css +34 -37
  20. package/src/css/buttons/buttons.css +80 -83
  21. package/src/css/buttons/status-buttons.css +87 -90
  22. package/src/css/container.css +5 -8
  23. package/src/css/data-formats.css +24 -28
  24. package/src/css/details.css +13 -17
  25. package/src/css/dimensions.css +9 -12
  26. package/src/css/display.css +37 -41
  27. package/src/css/flex.css +35 -39
  28. package/src/css/forms/fieldset.css +56 -59
  29. package/src/css/forms/form-collections.css +12 -16
  30. package/src/css/forms/form-disabled-readonly.css +28 -31
  31. package/src/css/forms/form-group.css +13 -18
  32. package/src/css/forms/form-utilities.css +34 -39
  33. package/src/css/forms/forms.css +132 -136
  34. package/src/css/forms/input-group.css +43 -47
  35. package/src/css/forms/switch.css +75 -78
  36. package/src/css/forms/validation.css +22 -26
  37. package/src/css/grid.css +62 -66
  38. package/src/css/headings.css +28 -32
  39. package/src/css/icons.css +57 -63
  40. package/src/css/layout-base.css +13 -15
  41. package/src/css/links.css +36 -39
  42. package/src/css/margin-padding-bootstrap-media.css +1832 -1835
  43. package/src/css/margin-padding-bootstrap.css +440 -443
  44. package/src/css/margin-padding-media.css +1832 -1835
  45. package/src/css/margin-padding.css +440 -443
  46. package/src/css/overflow.css +3 -7
  47. package/src/css/position.css +1 -6
  48. package/src/css/reset.css +46 -48
  49. package/src/css/svg.css +2 -5
  50. package/src/css/table.css +61 -63
  51. package/src/css/text.css +95 -98
  52. package/src/css/visibility.css +42 -45
  53. package/src/custom-properties.css +439 -442
  54. package/src/minimo.css +3 -2
  55. package/src/utilities/dom-builder-helpers/form-tags.js +90 -3
  56. package/src/web-components/s-datatable-component/s-datatable-component.module.css +172 -175
  57. package/types/classes.d.ts +1 -0
package/src/minimo.css CHANGED
@@ -1,9 +1,10 @@
1
+ /* decomment layers if you want to use them */
1
2
  /* see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@layer */
2
- @layer reset, base, components, utilities, project, overrides;
3
+ /* @layer reset, base, components, utilities, project, overrides; */
3
4
 
4
5
  /* @import '@src/fonts.css'; */
5
6
  /* @import '@src/css/custom-media.css'; */ /* managed by postcss */
6
- /* @import '@src/custom-properties.css'; */ /* managed by postcss-jit-props */
7
+ /* @import '@src/custom-properties.css' layer('base'); */ /* managed by postcss-jit-props */
7
8
 
8
9
  @import '@minimo/css/reset.css';
9
10
  @import '@minimo/css/layout-base.css';
@@ -1,6 +1,7 @@
1
1
  import { classnames } from '../classnames.js';
2
2
  import { randomId } from '../random-id.js';
3
3
 
4
+
4
5
  /**
5
6
  * Shared `.form-group` wrapper for the tag builders below: handles the
6
7
  * `condition` guard, `wrapperClass`, optional help text and `callback` in
@@ -45,6 +46,7 @@ function buildFormGroup({
45
46
  * @param {Object} args
46
47
  * @param {string} args.label - input label.
47
48
  * @param {string | null} args.name - input `name` attribute.
49
+ * @param {string | null} args.id - `id` attribute.
48
50
  * @param {string | number | null} args.value - input `value` attribute.
49
51
  * @param {string | null} [args.type='text'] - input `type` attribute.
50
52
  * @param {string | null} [args.wrapperClass=null] - optional class to be added to the `.form-group` wrapper.
@@ -58,6 +60,7 @@ function buildFormGroup({
58
60
  export function buildInput({
59
61
  label,
60
62
  name,
63
+ id = null,
61
64
  value = null,
62
65
  type = 'text',
63
66
  wrapperClass = null,
@@ -68,7 +71,7 @@ export function buildInput({
68
71
  callback = null
69
72
  }){
70
73
 
71
- const id = randomId();
74
+ id = id || randomId();
72
75
 
73
76
  return buildFormGroup({
74
77
  condition,
@@ -92,6 +95,86 @@ export function buildInput({
92
95
  });
93
96
  }
94
97
 
98
+ /**
99
+ * select tag builder
100
+ *
101
+ * @param {Object} args
102
+ * @param {string} args.label - select label.
103
+ * @param {string | null} args.name - select `name` attribute.
104
+ * @param {string | null} args.id - `id` attribute.
105
+ * @param {string | number | null} args.selectedValue - selected value
106
+ * @param {Array<[string|number, string]> | Array<Record<string, string>> | Record<string, string> | null} args.options -
107
+ * options value/text pairs, as an array of two-element `[[value, text], ...]` arrays,
108
+ * as an array of objects `[{somekey: value, somekey2: text},...]` objects, or as a single `{value: text, ...}` object
109
+ * @param {boolean} [args.addEmptyOption=true] - When true, and empty option tag is added at top
110
+ * @param {string | null} [args.wrapperClass=null] - optional class to be added to the `.form-group` wrapper.
111
+ * @param {string | null} [args.className=null] - optional class to be added to the `input`.
112
+ * @param {boolean} [args.condition=true] - When false, the function returns `null` without building anything.
113
+ * @param {string | HTMLElement | null} args.help - Optional help text.
114
+ * @param {(function(HTMLElement): void) | null} args.callback - Optional callback function.
115
+ * @param {Record<string, any> | null} [args.attrs={}] - Optional attributes object.
116
+ * @returns {DomBuilderItem|null} The `input` domBuilder item, or `null` when `condition` is false.
117
+ */
118
+ export function buildSelect({
119
+ label,
120
+ name,
121
+ id = null,
122
+ selectedValue = null,
123
+ options = null,
124
+ addEmptyOption = true,
125
+ wrapperClass = null,
126
+ className = null,
127
+ condition = true,
128
+ help = null,
129
+ attrs = {},
130
+ callback = null
131
+ }){
132
+
133
+ id = id || randomId();
134
+
135
+ // normalizing option as an array
136
+ if(options && !Array.isArray(options)) {
137
+ options = Object.entries(options);
138
+
139
+ } else if(options && !Array.isArray(options[0])) {
140
+ options = options.map(o => Object.values(o));
141
+ }
142
+
143
+
144
+ return buildFormGroup({
145
+ condition,
146
+ wrapperClass,
147
+ help,
148
+ children: [
149
+ `label.form-label[for:${id}] ${label}`,
150
+ {
151
+ tag: 'select',
152
+ className: classnames('form-control', className, attrs?.class),
153
+ id: id,
154
+ attrs: {
155
+ ...(attrs??{}),
156
+ name: name,
157
+ },
158
+ children: [
159
+ ...(addEmptyOption? ['option[value:]'] : []),
160
+ ...(options
161
+ ? options.map(([value, text]) => ({
162
+ tag: 'option',
163
+ attrs: {
164
+ value: value,
165
+ selected: value === selectedValue
166
+ },
167
+ content: text
168
+ }))
169
+ : []
170
+ )
171
+ ],
172
+ callback: callback
173
+ }
174
+ ]
175
+ });
176
+ }
177
+
95
178
 
96
179
  /**
97
180
  * Checkbox tag builder
@@ -99,6 +182,7 @@ export function buildInput({
99
182
  * @param {Object} args
100
183
  * @param {string} args.label - checkbox label.
101
184
  * @param {string | null} args.name - checkbox `name` attribute.
185
+ * @param {string | null} args.id - `id` attribute.
102
186
  * @param {string | number | null} [args.value=1] - checkbox `value` attribute.
103
187
  * @param {boolean} [args.checked=false] - checkbox `checked` attribute.
104
188
  * @param {string | null} [args.wrapperClass=null] - optional class to be added to the `.form-group` wrapper (used only when `addFormGroup` is true).
@@ -112,6 +196,7 @@ export function buildInput({
112
196
  export function buildCheckbox({
113
197
  label,
114
198
  name,
199
+ id = null,
115
200
  value = 1,
116
201
  checked = false,
117
202
  wrapperClass = null,
@@ -134,7 +219,7 @@ export function buildCheckbox({
134
219
  </div>
135
220
  </div>
136
221
  */
137
- const id = randomId();
222
+ id = id || randomId();
138
223
 
139
224
  const tag = {
140
225
  className: classnames('form-check', !addFormGroup && !help && wrapperClass),
@@ -176,6 +261,7 @@ export function buildCheckbox({
176
261
  * @param {Object} args
177
262
  * @param {string} args.label - textarea label.
178
263
  * @param {string | null} args.name - textarea `name` attribute.
264
+ * @param {string | null} args.id - `id` attribute.
179
265
  * @param {string | number | null} args.value - textarea content.
180
266
  * @param {boolean} [args.autosize=true] - adds `autosize` class
181
267
  * @param {string | null} [args.wrapperClass=null] - optional class to be added to the `.form-group` wrapper.
@@ -189,6 +275,7 @@ export function buildCheckbox({
189
275
  export function buildTextarea({
190
276
  label,
191
277
  name,
278
+ id = null,
192
279
  value = null,
193
280
  wrapperClass = null,
194
281
  className = null,
@@ -199,7 +286,7 @@ export function buildTextarea({
199
286
  autosize = true
200
287
  }) {
201
288
 
202
- const id = randomId();
289
+ id = id || randomId();
203
290
 
204
291
  return buildFormGroup({
205
292
  condition,
@@ -1,223 +1,220 @@
1
- @layer components {
2
1
 
3
- /* frontend/src/web-components/s-datatable-component.module.css */
2
+ /* frontend/src/web-components/s-datatable-component.module.css */
4
3
 
5
- /* import delle custom properties gestito da jit-props */
4
+ /* import delle custom properties gestito da jit-props */
6
5
 
7
6
 
8
- /* purgecss start ignore */
7
+ /* purgecss start ignore */
9
8
 
10
- /* .datatable-wrapper.no-header .datatable-container {
11
- border-top: 1px solid #d9d9d9;
9
+ /* .datatable-wrapper.no-header .datatable-container {
10
+ border-top: 1px solid #d9d9d9;
12
11
  } */
13
- .datatableWrapper {
14
- margin-block: var(--size-md);
15
- }
12
+ .datatableWrapper {
13
+ margin-block: var(--size-md);
14
+ }
16
15
 
17
- .topArea {
18
- display: flex;
19
- flex-flow: row nowrap;
20
- gap: 2rem;
21
- align-items: center;
22
- justify-content: flex-end;
23
- padding-block-end: var(--size-xs);
16
+ .topArea {
17
+ display: flex;
18
+ flex-flow: row nowrap;
19
+ gap: 2rem;
20
+ align-items: center;
21
+ justify-content: flex-end;
22
+ padding-block-end: var(--size-xs);
24
23
 
25
- /* stylelint-disable-next-line selector-class-pattern */
26
- &:has(.info), &:has(:global(.datatable-top-slot)) {
27
- justify-content: space-between;
28
- }
24
+ /* stylelint-disable-next-line selector-class-pattern */
25
+ &:has(.info), &:has(:global(.datatable-top-slot)) {
26
+ justify-content: space-between;
29
27
  }
28
+ }
30
29
 
31
- .searchWrapper {
32
- max-width: 50%;
33
- }
30
+ .searchWrapper {
31
+ max-width: 50%;
32
+ }
34
33
 
35
- .table {
36
- margin-block: 0;
37
- border-block: var(--_border); /* definito in minimo table */
34
+ .table {
35
+ margin-block: 0;
36
+ border-block: var(--_border); /* definito in minimo table */
38
37
 
39
- thead {
40
- th:has(.sortBtn) {
41
- padding-inline-end: 0;
42
- }
38
+ thead {
39
+ th:has(.sortBtn) {
40
+ padding-inline-end: 0;
43
41
  }
44
-
45
42
  }
46
43
 
47
- /* cella unica per indicare l'assenza di record */
48
- .empty {
49
- /* stylelint-disable-next-line declaration-no-important */
50
- padding-block: var(--size-sm) !important;
51
- font-style: italic;
52
- color: var(--text-muted);
53
- /* stylelint-disable-next-line declaration-no-important */
54
- text-align: center !important;
55
- }
44
+ }
56
45
 
57
- .hasIcon {
58
- /* stylelint-disable-next-line declaration-no-important */
59
- text-align: center !important;
60
- svg {
61
- display: inline-block;
62
- width: 1.05em;
63
- }
64
- }
46
+ /* cella unica per indicare l'assenza di record */
47
+ .empty {
48
+ /* stylelint-disable-next-line declaration-no-important */
49
+ padding-block: var(--size-sm) !important;
50
+ font-style: italic;
51
+ color: var(--text-muted);
52
+ /* stylelint-disable-next-line declaration-no-important */
53
+ text-align: center !important;
54
+ }
65
55
 
56
+ .hasIcon {
57
+ /* stylelint-disable-next-line declaration-no-important */
58
+ text-align: center !important;
59
+ svg {
60
+ display: inline-block;
61
+ width: 1.05em;
62
+ }
63
+ }
66
64
 
67
- [data-sortable='true'] {
68
65
 
69
- @media (hover: hover) {
70
- &:hover {
71
- background-color: var(--sdt-thead-hover-background-color);
72
- }
73
- }
66
+ [data-sortable='true'] {
74
67
 
75
- .sortBtn {
76
- padding: 0 1.5em 0 0;
77
- &::after {
78
- position: absolute;
79
- top: 50%;
80
- right: .1em;
81
- display: block;
82
- width: 1em;
83
- height: 1em;
84
- translate: 0 -50%;
85
- }
68
+ @media (hover: hover) {
69
+ &:hover {
70
+ background-color: var(--sdt-thead-hover-background-color);
86
71
  }
72
+ }
87
73
 
88
- &:not(.sortAscending):not(.sortDescending){
89
- .sortBtn::after {
90
- content: url('../../icons/arrows-down-up.svg?cssInline');
91
- opacity: .4;
92
- }
74
+ .sortBtn {
75
+ padding: 0 1.5em 0 0;
76
+ &::after {
77
+ position: absolute;
78
+ top: 50%;
79
+ right: .1em;
80
+ display: block;
81
+ width: 1em;
82
+ height: 1em;
83
+ translate: 0 -50%;
93
84
  }
94
85
  }
95
- .sortAscending {
86
+
87
+ &:not(.sortAscending):not(.sortDescending){
96
88
  .sortBtn::after {
97
- content: url('../../icons/arrow-up.svg?cssInline');
89
+ content: url('../../icons/arrows-down-up.svg?cssInline');
90
+ opacity: .4;
98
91
  }
99
92
  }
100
- .sortDescending {
101
- .sortBtn::after {
102
- content: url('../../icons/arrow-down.svg?cssInline');
103
- }
93
+ }
94
+ .sortAscending {
95
+ .sortBtn::after {
96
+ content: url('../../icons/arrow-up.svg?cssInline');
97
+ }
98
+ }
99
+ .sortDescending {
100
+ .sortBtn::after {
101
+ content: url('../../icons/arrow-down.svg?cssInline');
104
102
  }
103
+ }
105
104
 
106
- .sortBtn {
107
- position: relative;
108
- display: block;
109
- width: 100%;
110
- height: 100%;
105
+ .sortBtn {
106
+ position: relative;
107
+ display: block;
108
+ width: 100%;
109
+ height: 100%;
111
110
 
112
- padding: var(--table-cell-padding-block) var(--table-cell-padding-inline);
113
- line-height: var(--table-cell-line-height);
111
+ padding: var(--table-cell-padding-block) var(--table-cell-padding-inline);
112
+ line-height: var(--table-cell-line-height);
114
113
 
115
- text-align: start;
116
- }
114
+ text-align: start;
115
+ }
117
116
 
118
- /* stylelint-disable selector-class-pattern */
119
- :global(.text-start), :global(.text-left) {
120
- .sortBtn {
121
- text-align: start;
122
- }
117
+ /* stylelint-disable selector-class-pattern */
118
+ :global(.text-start), :global(.text-left) {
119
+ .sortBtn {
120
+ text-align: start;
123
121
  }
124
- :global(.text-end), :global(.text-right) {
125
- .sortBtn {
126
- text-align: end;
127
- }
122
+ }
123
+ :global(.text-end), :global(.text-right) {
124
+ .sortBtn {
125
+ text-align: end;
128
126
  }
129
- :global(.text-center) {
130
- .sortBtn {
131
- text-align: center;
132
- }
127
+ }
128
+ :global(.text-center) {
129
+ .sortBtn {
130
+ text-align: center;
133
131
  }
134
- /* stylelint-enable selector-class-pattern */
135
-
136
- .bottomArea {
137
- display: flex;
138
- flex-flow: row wrap;
139
- gap: var(--size-md);
140
- align-content: center;
141
- align-items: center;
142
- justify-content: flex-end;
143
- margin-block-start: var(--size-xs);
144
- }
145
- .info {
146
- font-size: var(--font-size-sm);
147
- font-style: italic;
148
- color: var(--text-muted);
149
- }
150
-
151
- /* pagination */
152
- /* .paginationNav {} */
153
- .paginationList, .paginationListItem, .paginationListItemBtn {
154
- padding: 0;
155
- margin: 0;
156
- }
157
-
158
- .paginationList {
159
- display: flex;
160
- flex-flow: row wrap;
161
- gap: 0;
162
- align-items: stretch;
163
- justify-content: flex-start;
164
- list-style: none;
165
- }
166
- .paginationListItem {
167
- border: var(--sdt-pagination-border);
168
- border-style: solid solid solid none;
169
-
170
- &:first-child {
171
- border-inline-start-style: solid;
172
- border-radius: var(--radius-xxs) 0 0 var(--radius-xxs);
173
- }
174
- &:last-child {
175
- border-radius: 0 var(--radius-xxs) var(--radius-xxs) 0;
176
- }
132
+ }
133
+ /* stylelint-enable selector-class-pattern */
134
+
135
+ .bottomArea {
136
+ display: flex;
137
+ flex-flow: row wrap;
138
+ gap: var(--size-md);
139
+ align-content: center;
140
+ align-items: center;
141
+ justify-content: flex-end;
142
+ margin-block-start: var(--size-xs);
143
+ }
144
+ .info {
145
+ font-size: var(--font-size-sm);
146
+ font-style: italic;
147
+ color: var(--text-muted);
148
+ }
177
149
 
178
- @media (hover: hover) {
179
- &:hover {
180
- color: var(--sdt-hover-color);
181
- background-color: var(--sdt-hover-background-color);
182
- }
183
- }
150
+ /* pagination */
151
+ /* .paginationNav {} */
152
+ .paginationList, .paginationListItem, .paginationListItemBtn {
153
+ padding: 0;
154
+ margin: 0;
155
+ }
184
156
 
185
- }
157
+ .paginationList {
158
+ display: flex;
159
+ flex-flow: row wrap;
160
+ gap: 0;
161
+ align-items: stretch;
162
+ justify-content: flex-start;
163
+ list-style: none;
164
+ }
165
+ .paginationListItem {
166
+ border: var(--sdt-pagination-border);
167
+ border-style: solid solid solid none;
186
168
 
187
- .paginationDisabled {
188
- pointer-events: none;
169
+ &:first-child {
170
+ border-inline-start-style: solid;
171
+ border-radius: var(--radius-xxs) 0 0 var(--radius-xxs);
172
+ }
173
+ &:last-child {
174
+ border-radius: 0 var(--radius-xxs) var(--radius-xxs) 0;
175
+ }
189
176
 
190
- .paginationListItemBtn {
191
- opacity: .7;
177
+ @media (hover: hover) {
178
+ &:hover {
179
+ color: var(--sdt-hover-color);
180
+ background-color: var(--sdt-hover-background-color);
192
181
  }
193
182
  }
194
183
 
195
- .paginationActive {
196
- color: var(--sdt-hover-color);
197
- background-color: var(--sdt-hover-background-color);
198
- }
184
+ }
199
185
 
200
- .paginationListItemBtn {
201
- display: flex;
202
- align-items: center;
203
- justify-content: center;
204
- height: 100%;
205
- padding: var(--sdt-pagination-padding-block) var(--sdt-pagination-padding-inline);
206
- color: inherit;
207
- background-color: transparent;
208
- border: none;
209
-
210
- &.hasSvg {
211
- padding-inline: calc(var(--sdt-pagination-padding-inline) / 2);
212
- }
186
+ .paginationDisabled {
187
+ pointer-events: none;
213
188
 
214
- svg {
215
- width: 1em;
216
- aspect-ratio: 1;
217
- fill: currentColor;
218
- }
189
+ .paginationListItemBtn {
190
+ opacity: .7;
219
191
  }
192
+ }
193
+
194
+ .paginationActive {
195
+ color: var(--sdt-hover-color);
196
+ background-color: var(--sdt-hover-background-color);
197
+ }
220
198
 
221
- /* purgecss end ignore */
199
+ .paginationListItemBtn {
200
+ display: flex;
201
+ align-items: center;
202
+ justify-content: center;
203
+ height: 100%;
204
+ padding: var(--sdt-pagination-padding-block) var(--sdt-pagination-padding-inline);
205
+ color: inherit;
206
+ background-color: transparent;
207
+ border: none;
222
208
 
209
+ &.hasSvg {
210
+ padding-inline: calc(var(--sdt-pagination-padding-inline) / 2);
211
+ }
212
+
213
+ svg {
214
+ width: 1em;
215
+ aspect-ratio: 1;
216
+ fill: currentColor;
217
+ }
223
218
  }
219
+
220
+ /* purgecss end ignore */
@@ -1169,6 +1169,7 @@ export type MinimoClass =
1169
1169
  | 'pis-xxs-lap'
1170
1170
  | 'pis-xxs-mob'
1171
1171
  | 'pis-xxs-tab'
1172
+ | 'position-relative'
1172
1173
  | 'ps'
1173
1174
  | 'ps-0'
1174
1175
  | 'ps-0-dsk'