@genexus/mercury 0.21.2 → 0.21.4

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.
@@ -0,0 +1,192 @@
1
+ // The following mixins, are helpers that Mercury expose publicly.
2
+ // At the time of writting only tabular-grid helpers are being included.
3
+ // Instead of bundling the actual stylesheets, these mixins have been
4
+ // copied by hand, since scss-bundle does not works with @use, which is
5
+ // the actual way for including sass modules, that Mercury is using.
6
+
7
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8
+ // copied from "src/base/_common.scss"
9
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10
+
11
+ @mixin control-remove-border() {
12
+ // This resets the border applied
13
+ // (for controls inside the property grid)
14
+ --control__border-width: 0;
15
+ --control__border-color: transparent;
16
+ --control__border-radius: 0;
17
+ }
18
+
19
+ @mixin grid-cell-remove-padding() {
20
+ // we should redefine '--grid-cell__padding-inline' here because when a control
21
+ // is inside a a tabular-grid-cell the cell padding-inline value is required to
22
+ // be applied on the control padding-inline.
23
+ padding-block: 0;
24
+ padding-inline: 0;
25
+ }
26
+
27
+ @mixin grid-cell-padding-inline-block() {
28
+ padding-block: var(--grid-cell__padding-block);
29
+ padding-inline: var(--grid-cell__padding-inline);
30
+ }
31
+
32
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
33
+ // copied from "src/components/tabular-grid/_helpers.scss"
34
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
35
+
36
+ // node type
37
+ @mixin cell-node-type-text() {
38
+ @include grid-cell-padding-inline-block();
39
+ }
40
+
41
+ @mixin cell-node-type-element() {
42
+ @include control-remove-border();
43
+ @include grid-cell-remove-padding();
44
+ padding-block: 0;
45
+ padding-inline: 0;
46
+ --control__padding-inline: var(--grid-cell__padding-inline);
47
+ // to stretch the control
48
+ display: grid;
49
+ align-items: stretch;
50
+ justify-content: stretch;
51
+ }
52
+
53
+ @mixin cell-node-type-element--hover() {
54
+ outline: var(--focus__outline-width) var(--focus__outline-style)
55
+ var(--control__border-color--hover);
56
+ outline-offset: var(--focus__outline-offset);
57
+ }
58
+
59
+ // cell alignment block
60
+ @mixin cell-alignment-block-start() {
61
+ align-items: start;
62
+ }
63
+
64
+ @mixin cell-alignment-block-center() {
65
+ align-items: center;
66
+ }
67
+
68
+ @mixin cell-alignment-block-end() {
69
+ align-items: end;
70
+ }
71
+
72
+ // cell alignment inline
73
+ @mixin cell-alignment-inline-start() {
74
+ justify-content: start;
75
+ }
76
+
77
+ @mixin cell-alignment-inline-center() {
78
+ justify-content: center;
79
+ }
80
+
81
+ @mixin cell-alignment-inline-end() {
82
+ justify-content: center;
83
+ }
84
+
85
+ // cell with ellipsis
86
+ @mixin cell-ellipsis() {
87
+ display: inline-block;
88
+ white-space: nowrap;
89
+ overflow: hidden;
90
+ text-overflow: ellipsis;
91
+ }
92
+
93
+ /// @group Grid
94
+ /// @param {String} $tabular-grid-selector [".tabular-grid"] -
95
+ /// @param {("text" | "element")} $tabular-grid-cell-node-type ["text"] -
96
+ /// @param {("start" | "center" | "end")} $tabular-grid-cell-block-alignment ["start"] -
97
+ /// @param {("start" | "center" | "end")} $tabular-grid-cell-inline-alignment ["start"] -
98
+ /// @param {Boolean} $tabular-grid-cell-apply-ellipsis [false] -
99
+ /// @param {List} $tabular-grid-affected-columns-nth-list [null] -
100
+
101
+ @mixin tabular-grid-cell-layout(
102
+ $tabular-grid-selector: ".tabular-grid",
103
+ $tabular-grid-cell-node-type: "text",
104
+ $tabular-grid-cell-block-alignment: "start",
105
+ $tabular-grid-cell-inline-alignment: "start",
106
+ $tabular-grid-cell-apply-ellipsis: false,
107
+ $tabular-grid-affected-columns-nth-list: null
108
+ ) {
109
+ $selector: null;
110
+ $cell-tag-name: "ch-tabular-grid-cell";
111
+ $where-pseudo-class: ":is";
112
+ $where-selector: ();
113
+ // the selector varies depending on wether $tabular-grid-affected-columns-nth-list is null or not.
114
+ // if it is null, all cells should be affected.
115
+ @if $tabular-grid-affected-columns-nth-list != null {
116
+ @each $nth in $tabular-grid-affected-columns-nth-list {
117
+ $where-selector: append($where-selector, ":nth-child(#{$nth})", comma);
118
+ }
119
+ $selector: #{$tabular-grid-selector}
120
+ #{$cell-tag-name}#{$where-pseudo-class
121
+ }(#{$where-selector});
122
+ } @else {
123
+ // if no $editable-columns-nth was provided, apply to all cells
124
+ $selector: #{$tabular-grid-selector} #{$cell-tag-name};
125
+ }
126
+ #{$selector} {
127
+ // node type
128
+ @if $tabular-grid-cell-node-type == "text" {
129
+ @include cell-node-type-text();
130
+ }
131
+ @if $tabular-grid-cell-node-type == "element" {
132
+ @include cell-node-type-element();
133
+ }
134
+ &:hover {
135
+ @if $tabular-grid-cell-node-type == "element" {
136
+ @include cell-node-type-element--hover();
137
+ }
138
+ }
139
+ // block alignment (only should apply if $tabular-grid-cell-node-type == "text"
140
+ @if $tabular-grid-cell-node-type ==
141
+ "text" and
142
+ $tabular-grid-cell-block-alignment ==
143
+ "start"
144
+ {
145
+ @include cell-alignment-block-start();
146
+ }
147
+ @if $tabular-grid-cell-node-type ==
148
+ "text" and
149
+ $tabular-grid-cell-block-alignment ==
150
+ "center"
151
+ {
152
+ @include cell-alignment-block-center();
153
+ }
154
+ @if $tabular-grid-cell-node-type ==
155
+ "text" and
156
+ $tabular-grid-cell-block-alignment ==
157
+ "end"
158
+ {
159
+ @include cell-alignment-block-end();
160
+ }
161
+ // inline alignment
162
+ @if $tabular-grid-cell-node-type ==
163
+ "text" and
164
+ $tabular-grid-cell-inline-alignment ==
165
+ "start"
166
+ {
167
+ @include cell-alignment-inline-start();
168
+ }
169
+ @if $tabular-grid-cell-node-type ==
170
+ "text" and
171
+ $tabular-grid-cell-inline-alignment ==
172
+ "center"
173
+ {
174
+ @include cell-alignment-inline-center();
175
+ }
176
+ @if $tabular-grid-cell-node-type ==
177
+ "text" and
178
+ $tabular-grid-cell-inline-alignment ==
179
+ "end"
180
+ {
181
+ @include cell-alignment-inline-end();
182
+ }
183
+ // ellipsis (only should apply if $tabular-grid-cell-node-type == "text"
184
+ @if $tabular-grid-cell-node-type ==
185
+ "text" and
186
+ $tabular-grid-cell-apply-ellipsis ==
187
+ true
188
+ {
189
+ @include cell-ellipsis();
190
+ }
191
+ }
192
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genexus/mercury",
3
- "version": "0.21.2",
3
+ "version": "0.21.4",
4
4
  "description": "Mercury Design System is a robust and scalable solution designed to improve product development.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -54,6 +54,7 @@
54
54
  "build.scss.bundles": "node dist/cli/bundle.js",
55
55
  "build.scss.watch": "tsc && yarn build.scss.base && yarn copy-tasks && yarn build.scss.bundles --watch -i=/assets/icons/ -f=/assets/fonts/ --outDir=../showcase/.mercury/ --avoid-hash=base/base",
56
56
  "start": "vite --port 5200 --open showcase/button.html",
57
+ "build.scss.helpers": "scss-bundle -e ./src/assets/scss/_helpers.scss -o ./src/assets/scss/helpers-bundled.scss --logLevel=info",
57
58
  "validate.ci": "yarn build-no-svg && yarn test",
58
59
  "icons-svg": "ssg-svg --srcDir=src/icons/svg-source --outDir=src/assets/icons/_generated/ --configFilePath=src/icons/svg-source/.config/color-states.json --showcaseDir=showcase/icons/ --showcaseBaseHref=../assets/icons/ --logDir=./log --objectFilePath=src/assets/MERCURY_ASSETS.ts --defaultColorType=on-surface",
59
60
  "process-icons": "ssg --configPath=./src/config/icons.js",