@sebgroup/green-core 1.15.1 → 1.17.0
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.
- package/README.md +101 -7
- package/chunks/chunk.2LQSDOD4.js +29 -0
- package/chunks/chunk.2ND5EWHE.js +65 -0
- package/chunks/chunk.2OOTOCUG.js +420 -0
- package/chunks/chunk.2WO4NHJ2.js +34 -0
- package/chunks/chunk.2Y3BHFKO.js +154 -0
- package/chunks/chunk.375BWME4.js +29 -0
- package/chunks/chunk.5VURDMKE.js +75 -0
- package/chunks/chunk.63RKNI5K.js +244 -0
- package/chunks/chunk.6NM7ENKA.js +31 -0
- package/chunks/chunk.6UA66KQU.js +153 -0
- package/chunks/chunk.7TCXY7BP.js +0 -0
- package/chunks/chunk.AQGTMWG4.js +101 -0
- package/chunks/chunk.D7H7CUS4.js +55 -0
- package/chunks/chunk.DFYMYEGD.js +78 -0
- package/chunks/chunk.EUQ5DOQM.js +560 -0
- package/chunks/chunk.HS7ICQNA.js +0 -0
- package/chunks/chunk.IYCENQZG.js +28 -0
- package/chunks/chunk.KC32OWZE.js +274 -0
- package/chunks/chunk.LUHCF4BJ.js +64 -0
- package/chunks/chunk.MAD5DQMN.js +161 -0
- package/chunks/chunk.MI4A2C2A.js +0 -0
- package/chunks/chunk.Q2T57HE7.js +0 -0
- package/chunks/chunk.QONSFT2N.js +4653 -0
- package/chunks/chunk.TMBQL2RO.js +0 -0
- package/chunks/chunk.TN6ZYAH3.js +74 -0
- package/chunks/chunk.TSDZQZBY.js +0 -0
- package/chunks/chunk.TX64TTBN.js +0 -0
- package/chunks/chunk.U4DPJ4QU.js +96 -0
- package/chunks/chunk.UF6IEONX.js +0 -0
- package/chunks/chunk.VOYMQ322.js +61 -0
- package/chunks/chunk.VYK7D6QO.js +64 -0
- package/chunks/chunk.WDZ2JTCP.js +360 -0
- package/chunks/chunk.WJDR7FTS.js +193 -0
- package/chunks/chunk.WM7HBMMV.js +54 -0
- package/chunks/chunk.XD5R3ZU3.js +460 -0
- package/chunks/chunk.XHTJVQUJ.js +140 -0
- package/chunks/chunk.XI4H54TV.js +39 -0
- package/chunks/chunk.XMPBXAGB.js +80 -0
- package/chunks/chunk.XU4HZLJL.js +0 -0
- package/chunks/chunk.YIQIH4RW.js +139 -0
- package/chunks/chunk.YJHAKLGR.js +54 -0
- package/chunks/chunk.YO24ZYAD.js +0 -0
- package/chunks/chunk.ZTE73BY2.js +655 -0
- package/chunks/chunk.ZYQWZMVY.js +467 -0
- package/components/badge/badge.js +245 -0
- package/components/button/button.d.ts +5 -5
- package/components/button/button.js +18 -0
- package/components/button/button.trans.styles.d.ts +2 -0
- package/components/button/index.d.ts +1 -0
- package/components/button/index.js +18 -0
- package/components/checkbox/checkbox.js +219 -0
- package/components/context-menu/context-menu.d.ts +2 -1
- package/components/context-menu/context-menu.js +22 -0
- package/components/context-menu/index.d.ts +3 -0
- package/components/context-menu/index.js +29 -0
- package/components/datepicker/date-part-spinner.js +10 -0
- package/components/datepicker/datepicker.d.ts +3 -2
- package/components/datepicker/datepicker.js +29 -0
- package/components/datepicker/index.d.ts +1 -0
- package/components/datepicker/index.js +29 -0
- package/components/dropdown/dropdown.d.ts +2 -2
- package/components/dropdown/dropdown.js +22 -0
- package/components/dropdown/index.d.ts +3 -0
- package/components/dropdown/index.js +30 -0
- package/components/form-control.js +12 -0
- package/components/grid/grid.d.ts +2 -2
- package/components/grid/grid.js +11 -0
- package/components/grid/grid.style.css.js +7 -0
- package/components/grid/index.d.ts +1 -0
- package/components/grid/index.js +11 -0
- package/components/grouped-list/grouped-list.js +14 -0
- package/components/grouped-list/index.d.ts +2 -0
- package/components/grouped-list/index.js +17 -0
- package/components/grouped-list/list-item.js +10 -0
- package/components/icon/icon.d.ts +2 -2
- package/components/icon/icon.js +10 -0
- package/components/icon/index.d.ts +1 -0
- package/components/icon/index.js +10 -0
- package/components/index.d.ts +4 -3
- package/components/index.js +81 -0
- package/components/input/input.js +682 -0
- package/components/radio/radio-group.js +9 -0
- package/components/radio/radio.js +240 -0
- package/components/segmented-control/index.d.ts +1 -0
- package/components/segmented-control/index.js +15 -0
- package/components/segmented-control/segment/index.d.ts +1 -0
- package/components/segmented-control/segment/index.js +13 -0
- package/components/segmented-control/segment/segment.js +12 -0
- package/components/segmented-control/segmented-control.d.ts +1 -1
- package/components/segmented-control/segmented-control.js +15 -0
- package/components/switch/switch.js +164 -0
- package/components/theme/index.d.ts +1 -0
- package/components/theme/index.js +11 -0
- package/components/theme/theme.js +11 -0
- package/components/tooltip/tooltip.js +252 -0
- package/index.js +72 -4291
- package/localization.js +3 -5
- package/package.json +7 -16
- package/primitives/calendar/calendar.js +13 -0
- package/primitives/calendar/functions.js +7 -0
- package/primitives/calendar/index.d.ts +1 -0
- package/primitives/calendar/index.js +14 -0
- package/primitives/listbox/index.d.ts +0 -1
- package/primitives/listbox/index.js +17 -0
- package/primitives/listbox/listbox.d.ts +2 -1
- package/primitives/listbox/listbox.js +16 -0
- package/primitives/listbox/option.js +14 -0
- package/primitives/menu/index.d.ts +1 -0
- package/primitives/menu/index.js +15 -0
- package/primitives/menu/menu-heading.js +11 -0
- package/primitives/menu/menu-item.d.ts +1 -2
- package/primitives/menu/menu-item.js +12 -0
- package/primitives/menu/menu.d.ts +2 -1
- package/primitives/menu/menu.js +14 -0
- package/primitives/popover/index.js +14 -0
- package/primitives/popover/popover.js +13 -0
- package/primitives/ripple/index.d.ts +1 -0
- package/primitives/ripple/index.js +11 -0
- package/primitives/ripple/ripple.d.ts +1 -1
- package/primitives/ripple/ripple.js +10 -0
- package/scoping.d.ts +1 -0
- package/scoping.js +18 -0
- package/transitional-styles.js +6 -4275
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GdsElement
|
|
3
|
+
} from "./chunk.2LQSDOD4.js";
|
|
4
|
+
import {
|
|
5
|
+
gdsCustomElement,
|
|
6
|
+
html
|
|
7
|
+
} from "./chunk.VOYMQ322.js";
|
|
8
|
+
import {
|
|
9
|
+
__decorateClass
|
|
10
|
+
} from "./chunk.5VURDMKE.js";
|
|
11
|
+
|
|
12
|
+
// libs/core/src/components/icon/icon.ts
|
|
13
|
+
import { unsafeCSS } from "lit";
|
|
14
|
+
|
|
15
|
+
// libs/core/src/components/icon/stem.styles.scss
|
|
16
|
+
var stem_styles_default = `svg:not([display=none]) {
|
|
17
|
+
contain: layout style;
|
|
18
|
+
display: flex;
|
|
19
|
+
height: 1lh;
|
|
20
|
+
isolation: isolate;
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
width: auto;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
symbol {
|
|
26
|
+
fill: none;
|
|
27
|
+
height: 24px;
|
|
28
|
+
stroke: currentColor;
|
|
29
|
+
stroke-linecap: round;
|
|
30
|
+
stroke-linejoin: round;
|
|
31
|
+
stroke-width: 2px;
|
|
32
|
+
width: 24px;
|
|
33
|
+
}`;
|
|
34
|
+
|
|
35
|
+
// libs/core/src/components/icon/icon.ts
|
|
36
|
+
var GdsIcon = class extends GdsElement {
|
|
37
|
+
constructor() {
|
|
38
|
+
super(...arguments);
|
|
39
|
+
this.open = false;
|
|
40
|
+
this.name = "";
|
|
41
|
+
}
|
|
42
|
+
static get styles() {
|
|
43
|
+
return unsafeCSS(stem_styles_default);
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
const { name } = this;
|
|
47
|
+
return html`
|
|
48
|
+
<svg display="none">
|
|
49
|
+
<symbol id="plus">
|
|
50
|
+
<line x1="12" y1="5" x2="12" y2="19" />
|
|
51
|
+
<line x1="5" y1="12" x2="19" y2="12" />
|
|
52
|
+
</symbol>
|
|
53
|
+
<symbol id="x">
|
|
54
|
+
<line x1="18" y1="6" x2="6" y2="18" />
|
|
55
|
+
<line x1="6" y1="6" x2="18" y2="18" />
|
|
56
|
+
</symbol>
|
|
57
|
+
<symbol id="chevron-right">
|
|
58
|
+
<polyline points="9 18 15 12 9 6" />
|
|
59
|
+
</symbol>
|
|
60
|
+
<symbol id="chevron-left">
|
|
61
|
+
<polyline points="15 18 9 12 15 6" />
|
|
62
|
+
</symbol>
|
|
63
|
+
<symbol id="chevron-down">
|
|
64
|
+
<polyline points="6 9 12 15 18 9" />
|
|
65
|
+
</symbol>
|
|
66
|
+
<symbol id="arrow">
|
|
67
|
+
<line x1="5" y1="12" x2="19" y2="12" />
|
|
68
|
+
<polyline points="12 5 19 12 12 19" />
|
|
69
|
+
</symbol>
|
|
70
|
+
<symbol id="bell">
|
|
71
|
+
<path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9" />
|
|
72
|
+
<path d="M13.73 21a2 2 0 0 1-3.46 0" />
|
|
73
|
+
</symbol>
|
|
74
|
+
<symbol id="calendar">
|
|
75
|
+
<rect x="3" y="4" width="18" height="18" rx="2" ry="2" />
|
|
76
|
+
<line x1="16" y1="2" x2="16" y2="6" />
|
|
77
|
+
<line x1="8" y1="2" x2="8" y2="6" />
|
|
78
|
+
<line x1="3" y1="10" x2="21" y2="10" />
|
|
79
|
+
</symbol>
|
|
80
|
+
<symbol id="lock">
|
|
81
|
+
<rect x="3" y="11" width="18" height="11" rx="2" ry="2" />
|
|
82
|
+
<path d="M7 11V7a5 5 0 0 1 10 0v4" />
|
|
83
|
+
</symbol>
|
|
84
|
+
<symbol id="eye">
|
|
85
|
+
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" />
|
|
86
|
+
<circle cx="12" cy="12" r="3" />
|
|
87
|
+
</symbol>
|
|
88
|
+
<symbol id="hash">
|
|
89
|
+
<line x1="4" y1="9" x2="20" y2="9" />
|
|
90
|
+
<line x1="4" y1="15" x2="20" y2="15" />
|
|
91
|
+
<line x1="10" y1="3" x2="8" y2="21" />
|
|
92
|
+
<line x1="16" y1="3" x2="14" y2="21" />
|
|
93
|
+
</symbol>
|
|
94
|
+
<symbol id="mail">
|
|
95
|
+
<path
|
|
96
|
+
d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"
|
|
97
|
+
/>
|
|
98
|
+
<polyline points="22,6 12,13 2,6" />
|
|
99
|
+
</symbol>
|
|
100
|
+
<symbol id="send">
|
|
101
|
+
<line x1="22" y1="2" x2="11" y2="13" />
|
|
102
|
+
<polygon points="22 2 15 22 11 13 2 9 22 2" />
|
|
103
|
+
</symbol>
|
|
104
|
+
<symbol id="info">
|
|
105
|
+
<circle cx="12" cy="12" r="10" />
|
|
106
|
+
<line x1="12" y1="16" x2="12" y2="12" />
|
|
107
|
+
<line x1="12" y1="8" x2="12.01" y2="8" />
|
|
108
|
+
</symbol>
|
|
109
|
+
<symbol id="tel">
|
|
110
|
+
<path
|
|
111
|
+
d="M15.05 5A5 5 0 0 1 19 8.95M15.05 1A9 9 0 0 1 23 8.94m-1 7.98v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"
|
|
112
|
+
/>
|
|
113
|
+
</symbol>
|
|
114
|
+
<symbol id="search">
|
|
115
|
+
<circle cx="11" cy="11" r="8" />
|
|
116
|
+
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
117
|
+
</symbol>
|
|
118
|
+
<symbol id="user">
|
|
119
|
+
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" />
|
|
120
|
+
<circle cx="12" cy="7" r="4" />
|
|
121
|
+
</symbol>
|
|
122
|
+
<symbol id="arrow-up">
|
|
123
|
+
<line x1="12" y1="19" x2="12" y2="5" />
|
|
124
|
+
<polyline points="5 12 12 5 19 12" />
|
|
125
|
+
</symbol>
|
|
126
|
+
<symbol id="arrow-down">
|
|
127
|
+
<line x1="12" y1="5" x2="12" y2="19" />
|
|
128
|
+
<polyline points="19 12 12 19 5 12" />
|
|
129
|
+
</symbol>
|
|
130
|
+
<symbol id="warning">
|
|
131
|
+
<path
|
|
132
|
+
d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"
|
|
133
|
+
/>
|
|
134
|
+
<line x1="12" y1="9" x2="12" y2="13" />
|
|
135
|
+
<path x1="12" y1="17" x2="12.01" y2="17" />
|
|
136
|
+
</symbol>
|
|
137
|
+
</svg>
|
|
138
|
+
<svg viewBox="0 0 24 24">
|
|
139
|
+
<use href="#${name}"></use>
|
|
140
|
+
</svg>
|
|
141
|
+
`;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
GdsIcon.properties = {
|
|
145
|
+
open: { type: String, reflect: true },
|
|
146
|
+
name: { type: String }
|
|
147
|
+
};
|
|
148
|
+
GdsIcon = __decorateClass([
|
|
149
|
+
gdsCustomElement("gds-icon")
|
|
150
|
+
], GdsIcon);
|
|
151
|
+
|
|
152
|
+
export {
|
|
153
|
+
GdsIcon
|
|
154
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// libs/core/src/primitives/calendar/functions.ts
|
|
2
|
+
import {
|
|
3
|
+
startOfMonth,
|
|
4
|
+
endOfMonth,
|
|
5
|
+
addDays,
|
|
6
|
+
eachWeekOfInterval,
|
|
7
|
+
eachDayOfInterval
|
|
8
|
+
} from "date-fns";
|
|
9
|
+
import { html } from "lit-html";
|
|
10
|
+
function renderMonthGridView(date, template) {
|
|
11
|
+
const monthStart = startOfMonth(date);
|
|
12
|
+
const monthEnd = endOfMonth(date);
|
|
13
|
+
const weeks = eachWeekOfInterval(
|
|
14
|
+
{ start: monthStart, end: monthEnd },
|
|
15
|
+
{ weekStartsOn: 1 }
|
|
16
|
+
);
|
|
17
|
+
return html`${template(
|
|
18
|
+
weeks.map((weekStartDay) => ({
|
|
19
|
+
days: eachDayOfInterval({
|
|
20
|
+
start: weekStartDay,
|
|
21
|
+
end: addDays(weekStartDay, 6)
|
|
22
|
+
})
|
|
23
|
+
}))
|
|
24
|
+
)}`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
renderMonthGridView
|
|
29
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
+
var __export = (target, all) => {
|
|
22
|
+
for (var name in all)
|
|
23
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
24
|
+
};
|
|
25
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
26
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
27
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
28
|
+
if (decorator = decorators[i])
|
|
29
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
30
|
+
if (kind && result)
|
|
31
|
+
__defProp(target, key, result);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
var __accessCheck = (obj, member, msg) => {
|
|
35
|
+
if (!member.has(obj))
|
|
36
|
+
throw TypeError("Cannot " + msg);
|
|
37
|
+
};
|
|
38
|
+
var __privateGet = (obj, member, getter) => {
|
|
39
|
+
__accessCheck(obj, member, "read from private field");
|
|
40
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
41
|
+
};
|
|
42
|
+
var __privateAdd = (obj, member, value) => {
|
|
43
|
+
if (member.has(obj))
|
|
44
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
45
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
46
|
+
};
|
|
47
|
+
var __privateSet = (obj, member, value, setter) => {
|
|
48
|
+
__accessCheck(obj, member, "write to private field");
|
|
49
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
50
|
+
return value;
|
|
51
|
+
};
|
|
52
|
+
var __privateWrapper = (obj, member, setter, getter) => ({
|
|
53
|
+
set _(value) {
|
|
54
|
+
__privateSet(obj, member, value, setter);
|
|
55
|
+
},
|
|
56
|
+
get _() {
|
|
57
|
+
return __privateGet(obj, member, getter);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
var __privateMethod = (obj, member, method) => {
|
|
61
|
+
__accessCheck(obj, member, "access private method");
|
|
62
|
+
return method;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
__spreadValues,
|
|
67
|
+
__spreadProps,
|
|
68
|
+
__export,
|
|
69
|
+
__decorateClass,
|
|
70
|
+
__privateGet,
|
|
71
|
+
__privateAdd,
|
|
72
|
+
__privateSet,
|
|
73
|
+
__privateWrapper,
|
|
74
|
+
__privateMethod
|
|
75
|
+
};
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import {
|
|
2
|
+
grid_style_css_default
|
|
3
|
+
} from "./chunk.XMPBXAGB.js";
|
|
4
|
+
import {
|
|
5
|
+
tokens
|
|
6
|
+
} from "./chunk.EUQ5DOQM.js";
|
|
7
|
+
import {
|
|
8
|
+
watch
|
|
9
|
+
} from "./chunk.2WO4NHJ2.js";
|
|
10
|
+
import {
|
|
11
|
+
gdsCustomElement,
|
|
12
|
+
html
|
|
13
|
+
} from "./chunk.VOYMQ322.js";
|
|
14
|
+
import {
|
|
15
|
+
__decorateClass,
|
|
16
|
+
__spreadProps,
|
|
17
|
+
__spreadValues
|
|
18
|
+
} from "./chunk.5VURDMKE.js";
|
|
19
|
+
|
|
20
|
+
// libs/core/src/components/grid/grid.ts
|
|
21
|
+
import { css, LitElement, unsafeCSS } from "lit";
|
|
22
|
+
import { property, state } from "lit/decorators.js";
|
|
23
|
+
var BreakpointPattern = new RegExp("(?<l>l:([a-z0-9]+))?\\s*(?<m>m:([a-z0-9]+))?\\s*(?<s>s:([a-z0-9]+))?");
|
|
24
|
+
var GdsGrid = class extends LitElement {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
this._gridVariables = {
|
|
28
|
+
varsColumn: css``,
|
|
29
|
+
varsGap: css``,
|
|
30
|
+
varsRowGap: css``,
|
|
31
|
+
varsPadding: css``,
|
|
32
|
+
varsAutoColumns: css``
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Lifecycle method called when the element is connected to the DOM.
|
|
37
|
+
* It updates the column, gap, and padding variables.
|
|
38
|
+
*/
|
|
39
|
+
connectedCallback() {
|
|
40
|
+
super.connectedCallback();
|
|
41
|
+
this._updateColumnVariables();
|
|
42
|
+
this._updateGapVariables();
|
|
43
|
+
this._updateRowGapVariables();
|
|
44
|
+
this._updatePaddingVariables();
|
|
45
|
+
this._updateAutoColumnsVariables();
|
|
46
|
+
}
|
|
47
|
+
_updateColumnVariables() {
|
|
48
|
+
var _a;
|
|
49
|
+
const match = (_a = this.columns) == null ? void 0 : _a.match(BreakpointPattern);
|
|
50
|
+
let columnsDesktop, columnsTablet, columnsMobile;
|
|
51
|
+
if (this.columns && !isNaN(Number(this.columns))) {
|
|
52
|
+
columnsDesktop = columnsTablet = columnsMobile = Number(this.columns);
|
|
53
|
+
} else {
|
|
54
|
+
const { l, m, s } = (match == null ? void 0 : match.groups) || {};
|
|
55
|
+
columnsDesktop = l ? Number(l.split(":")[1]) : void 0;
|
|
56
|
+
columnsTablet = m ? Number(m.split(":")[1]) : void 0;
|
|
57
|
+
columnsMobile = s ? Number(s.split(":")[1]) : void 0;
|
|
58
|
+
}
|
|
59
|
+
const columnProperties = [
|
|
60
|
+
{ name: "_columns-desktop", value: columnsDesktop },
|
|
61
|
+
{ name: "_columns-tablet", value: columnsTablet },
|
|
62
|
+
{ name: "_columns-mobile", value: columnsMobile }
|
|
63
|
+
];
|
|
64
|
+
const cssVariables = columnProperties.filter(({ value }) => value !== void 0).map(({ name, value }) => `--${name}: ${value};`).join(" ");
|
|
65
|
+
this._gridVariables = __spreadProps(__spreadValues({}, this._gridVariables), {
|
|
66
|
+
varsColumn: css`
|
|
67
|
+
${unsafeCSS(cssVariables)}
|
|
68
|
+
`
|
|
69
|
+
});
|
|
70
|
+
this.requestUpdate("_gridVariables");
|
|
71
|
+
}
|
|
72
|
+
_updateGapVariables() {
|
|
73
|
+
var _a;
|
|
74
|
+
const match = (_a = this.gap) == null ? void 0 : _a.match(BreakpointPattern);
|
|
75
|
+
let gapDesktop, gapTablet, gapMobile;
|
|
76
|
+
if (this.gap && !this.gap.includes(" ")) {
|
|
77
|
+
gapDesktop = gapTablet = gapMobile = `var(--gds-sys-grid-gap-${this.gap})`;
|
|
78
|
+
} else {
|
|
79
|
+
const { l, m, s } = (match == null ? void 0 : match.groups) || {};
|
|
80
|
+
gapDesktop = l ? `var(--gds-sys-grid-gap-${l.split(":")[1]})` : void 0;
|
|
81
|
+
gapTablet = m ? `var(--gds-sys-grid-gap-${m.split(":")[1]})` : void 0;
|
|
82
|
+
gapMobile = s ? `var(--gds-sys-grid-gap-${s.split(":")[1]})` : void 0;
|
|
83
|
+
}
|
|
84
|
+
const gapProperties = [
|
|
85
|
+
{ name: "_gap-desktop", value: gapDesktop },
|
|
86
|
+
{ name: "_gap-tablet", value: gapTablet },
|
|
87
|
+
{ name: "_gap-mobile", value: gapMobile }
|
|
88
|
+
];
|
|
89
|
+
const cssVariables = gapProperties.filter(({ value }) => value !== void 0).map(({ name, value }) => `--${name}: ${value};`).join(" ");
|
|
90
|
+
this._gridVariables = __spreadProps(__spreadValues({}, this._gridVariables), {
|
|
91
|
+
varsGap: css`
|
|
92
|
+
${unsafeCSS(cssVariables)}
|
|
93
|
+
`
|
|
94
|
+
});
|
|
95
|
+
this.requestUpdate("_gridVariables");
|
|
96
|
+
}
|
|
97
|
+
_updateRowGapVariables() {
|
|
98
|
+
var _a;
|
|
99
|
+
const match = (_a = this.rowGap) == null ? void 0 : _a.match(BreakpointPattern);
|
|
100
|
+
let rowGapDesktop, rowGapTablet, rowGapMobile;
|
|
101
|
+
if (this.rowGap && !this.rowGap.includes(" ")) {
|
|
102
|
+
rowGapDesktop = rowGapTablet = rowGapMobile = `var(--gds-sys-grid-gap-${this.rowGap})`;
|
|
103
|
+
} else {
|
|
104
|
+
const { l, m, s } = (match == null ? void 0 : match.groups) || {};
|
|
105
|
+
rowGapDesktop = l ? `var(--gds-sys-grid-gap-${l.split(":")[1]})` : void 0;
|
|
106
|
+
rowGapTablet = m ? `var(--gds-sys-grid-gap-${m.split(":")[1]})` : void 0;
|
|
107
|
+
rowGapMobile = s ? `var(--gds-sys-grid-gap-${s.split(":")[1]})` : void 0;
|
|
108
|
+
}
|
|
109
|
+
const gapProperties = [
|
|
110
|
+
{ name: "_row-gap-desktop", value: rowGapDesktop },
|
|
111
|
+
{ name: "_row-gap-tablet", value: rowGapTablet },
|
|
112
|
+
{ name: "_row-gap-mobile", value: rowGapMobile }
|
|
113
|
+
];
|
|
114
|
+
const cssVariables = gapProperties.filter(({ value }) => value !== void 0).map(({ name, value }) => `--${name}: ${value};`).join(" ");
|
|
115
|
+
this._gridVariables = __spreadProps(__spreadValues({}, this._gridVariables), {
|
|
116
|
+
varsRowGap: css`
|
|
117
|
+
${unsafeCSS(cssVariables)}
|
|
118
|
+
`
|
|
119
|
+
});
|
|
120
|
+
this.requestUpdate("_gridVariables");
|
|
121
|
+
}
|
|
122
|
+
_updatePaddingVariables() {
|
|
123
|
+
var _a;
|
|
124
|
+
const match = (_a = this.padding) == null ? void 0 : _a.match(BreakpointPattern);
|
|
125
|
+
let paddingDesktop, paddingTablet, paddingMobile;
|
|
126
|
+
if (this.padding && !this.padding.includes(" ")) {
|
|
127
|
+
paddingDesktop = paddingTablet = paddingMobile = `var(--gds-sys-grid-gap-${this.gap})`;
|
|
128
|
+
} else {
|
|
129
|
+
const { l, m, s } = (match == null ? void 0 : match.groups) || {};
|
|
130
|
+
paddingDesktop = l ? `var(--gds-sys-grid-gap-${l.split(":")[1]})` : void 0;
|
|
131
|
+
paddingTablet = m ? `var(--gds-sys-grid-gap-${m.split(":")[1]})` : void 0;
|
|
132
|
+
paddingMobile = s ? `var(--gds-sys-grid-gap-${s.split(":")[1]})` : void 0;
|
|
133
|
+
}
|
|
134
|
+
const paddingProperties = [
|
|
135
|
+
{ name: "_padding-desktop", value: paddingDesktop },
|
|
136
|
+
{ name: "_padding-tablet", value: paddingTablet },
|
|
137
|
+
{ name: "_padding-mobile", value: paddingMobile }
|
|
138
|
+
];
|
|
139
|
+
const cssVariables = paddingProperties.filter(({ value }) => value !== void 0).map(({ name, value }) => `--${name}: ${value};`).join(" ");
|
|
140
|
+
this._gridVariables = __spreadProps(__spreadValues({}, this._gridVariables), {
|
|
141
|
+
varsPadding: css`
|
|
142
|
+
${unsafeCSS(cssVariables)}
|
|
143
|
+
`
|
|
144
|
+
});
|
|
145
|
+
this.requestUpdate("_gridVariables");
|
|
146
|
+
}
|
|
147
|
+
_updateAutoColumnsVariables() {
|
|
148
|
+
var _a;
|
|
149
|
+
const match = (_a = this.autoColumns) == null ? void 0 : _a.match(BreakpointPattern);
|
|
150
|
+
let widthDesktop, widthTablet, widthMobile;
|
|
151
|
+
if (this.autoColumns && !this.autoColumns.includes(" ")) {
|
|
152
|
+
widthDesktop = widthTablet = widthMobile = `${this.autoColumns}px`;
|
|
153
|
+
} else {
|
|
154
|
+
const { l, m, s } = (match == null ? void 0 : match.groups) || {};
|
|
155
|
+
widthDesktop = l ? `${l.split(":")[1]}px` : void 0;
|
|
156
|
+
widthTablet = m ? `${m.split(":")[1]}px` : void 0;
|
|
157
|
+
widthMobile = s ? `${s.split(":")[1]}px` : void 0;
|
|
158
|
+
}
|
|
159
|
+
const widthProperties = [
|
|
160
|
+
{ name: "_col-width-mobile", value: widthMobile },
|
|
161
|
+
{ name: "_col-width-tablet", value: widthTablet },
|
|
162
|
+
{ name: "_col-width-desktop", value: widthDesktop }
|
|
163
|
+
];
|
|
164
|
+
const cssVariables = widthProperties.filter(({ value }) => value !== void 0).map(({ name, value }) => `--${name}: ${value};`).join(" ");
|
|
165
|
+
this._gridVariables = __spreadProps(__spreadValues({}, this._gridVariables), {
|
|
166
|
+
varsAutoColumns: css`
|
|
167
|
+
${unsafeCSS(cssVariables)}
|
|
168
|
+
`
|
|
169
|
+
});
|
|
170
|
+
this.requestUpdate("_gridVariables");
|
|
171
|
+
}
|
|
172
|
+
_updateGridCss() {
|
|
173
|
+
const sheet = new CSSStyleSheet();
|
|
174
|
+
sheet.replaceSync(`:host {${Object.values(this._gridVariables).join("")}} `);
|
|
175
|
+
if (this.shadowRoot) {
|
|
176
|
+
const styles = Array.isArray(GdsGrid.styles) ? GdsGrid.styles : [GdsGrid.styles];
|
|
177
|
+
const styleSheets = styles.flatMap((style) => {
|
|
178
|
+
if (Array.isArray(style)) {
|
|
179
|
+
return style.map((s) => {
|
|
180
|
+
const newSheet = new CSSStyleSheet();
|
|
181
|
+
newSheet.replaceSync(s.cssText);
|
|
182
|
+
return newSheet;
|
|
183
|
+
});
|
|
184
|
+
} else {
|
|
185
|
+
const newSheet = new CSSStyleSheet();
|
|
186
|
+
newSheet.replaceSync(style.cssText);
|
|
187
|
+
return [newSheet];
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
this.shadowRoot.adoptedStyleSheets = [sheet, ...styleSheets];
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
render() {
|
|
194
|
+
return html` <slot></slot> `;
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
GdsGrid.styles = [tokens, grid_style_css_default];
|
|
198
|
+
GdsGrid.shadowRootOptions = {
|
|
199
|
+
mode: "open",
|
|
200
|
+
delegatesFocus: true
|
|
201
|
+
};
|
|
202
|
+
__decorateClass([
|
|
203
|
+
property({ attribute: "columns", type: String })
|
|
204
|
+
], GdsGrid.prototype, "columns", 2);
|
|
205
|
+
__decorateClass([
|
|
206
|
+
property({ attribute: "gap", type: String })
|
|
207
|
+
], GdsGrid.prototype, "gap", 2);
|
|
208
|
+
__decorateClass([
|
|
209
|
+
property({ attribute: "row-gap", type: String })
|
|
210
|
+
], GdsGrid.prototype, "rowGap", 2);
|
|
211
|
+
__decorateClass([
|
|
212
|
+
property({ attribute: "padding", type: String })
|
|
213
|
+
], GdsGrid.prototype, "padding", 2);
|
|
214
|
+
__decorateClass([
|
|
215
|
+
property({ attribute: "auto-columns", type: String })
|
|
216
|
+
], GdsGrid.prototype, "autoColumns", 2);
|
|
217
|
+
__decorateClass([
|
|
218
|
+
state()
|
|
219
|
+
], GdsGrid.prototype, "_gridVariables", 2);
|
|
220
|
+
__decorateClass([
|
|
221
|
+
watch("columns")
|
|
222
|
+
], GdsGrid.prototype, "_updateColumnVariables", 1);
|
|
223
|
+
__decorateClass([
|
|
224
|
+
watch("gap")
|
|
225
|
+
], GdsGrid.prototype, "_updateGapVariables", 1);
|
|
226
|
+
__decorateClass([
|
|
227
|
+
watch("row-gap")
|
|
228
|
+
], GdsGrid.prototype, "_updateRowGapVariables", 1);
|
|
229
|
+
__decorateClass([
|
|
230
|
+
watch("padding")
|
|
231
|
+
], GdsGrid.prototype, "_updatePaddingVariables", 1);
|
|
232
|
+
__decorateClass([
|
|
233
|
+
watch("autoColumns")
|
|
234
|
+
], GdsGrid.prototype, "_updateAutoColumnsVariables", 1);
|
|
235
|
+
__decorateClass([
|
|
236
|
+
watch("_gridVariables")
|
|
237
|
+
], GdsGrid.prototype, "_updateGridCss", 1);
|
|
238
|
+
GdsGrid = __decorateClass([
|
|
239
|
+
gdsCustomElement("gds-grid")
|
|
240
|
+
], GdsGrid);
|
|
241
|
+
|
|
242
|
+
export {
|
|
243
|
+
GdsGrid
|
|
244
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// libs/core/src/utils/helpers/constrain-slots.ts
|
|
2
|
+
function constrainSlots(self) {
|
|
3
|
+
self.updateComplete.then(() => {
|
|
4
|
+
var _a, _b, _c;
|
|
5
|
+
const slots = (_a = self.shadowRoot) == null ? void 0 : _a.querySelectorAll("slot[gds-allow]");
|
|
6
|
+
if (!slots)
|
|
7
|
+
return;
|
|
8
|
+
for (const node of Array.from(self.childNodes)) {
|
|
9
|
+
if (node.nodeType === Node.TEXT_NODE && ((_b = node.textContent) == null ? void 0 : _b.trim()) === "") {
|
|
10
|
+
(_c = node.parentNode) == null ? void 0 : _c.removeChild(node);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const constrain = (slot) => {
|
|
14
|
+
var _a2, _b2;
|
|
15
|
+
const allowed = ((_a2 = slot.getAttribute("gds-allow")) == null ? void 0 : _a2.split(" ")) || [];
|
|
16
|
+
for (const node of Array.from(slot.assignedNodes())) {
|
|
17
|
+
if (!allowed.includes(node.nodeName.toLowerCase())) {
|
|
18
|
+
(_b2 = node.parentNode) == null ? void 0 : _b2.removeChild(node);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
slots.forEach((slot) => {
|
|
23
|
+
constrain(slot);
|
|
24
|
+
slot.addEventListener("slotchange", () => constrain(slot));
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
constrainSlots
|
|
31
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TransitionalStyles
|
|
3
|
+
} from "./chunk.QONSFT2N.js";
|
|
4
|
+
import {
|
|
5
|
+
GdsElement
|
|
6
|
+
} from "./chunk.2LQSDOD4.js";
|
|
7
|
+
import {
|
|
8
|
+
constrainSlots
|
|
9
|
+
} from "./chunk.6NM7ENKA.js";
|
|
10
|
+
import {
|
|
11
|
+
gdsCustomElement,
|
|
12
|
+
html
|
|
13
|
+
} from "./chunk.VOYMQ322.js";
|
|
14
|
+
import {
|
|
15
|
+
__decorateClass,
|
|
16
|
+
__privateAdd,
|
|
17
|
+
__privateMethod
|
|
18
|
+
} from "./chunk.5VURDMKE.js";
|
|
19
|
+
|
|
20
|
+
// libs/core/src/components/context-menu/context-menu.ts
|
|
21
|
+
import { nothing } from "lit";
|
|
22
|
+
import { msg } from "@lit/localize";
|
|
23
|
+
import { classMap } from "lit-html/directives/class-map.js";
|
|
24
|
+
import { property, queryAsync, state } from "lit/decorators.js";
|
|
25
|
+
|
|
26
|
+
// libs/core/src/components/context-menu/context-menu.styles.ts
|
|
27
|
+
import { css } from "lit";
|
|
28
|
+
var style = css`
|
|
29
|
+
@layer base, reset, transitional-styles;
|
|
30
|
+
@layer base {
|
|
31
|
+
button {
|
|
32
|
+
display: flex;
|
|
33
|
+
border-width: 0;
|
|
34
|
+
background-color: #ededed;
|
|
35
|
+
border-radius: calc(1px * infinity);
|
|
36
|
+
padding: 0.4rem 0.8rem;
|
|
37
|
+
font-family: inherit;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: 0.5rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
button:hover {
|
|
44
|
+
background-color: #dcdcdc;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
var context_menu_styles_default = style;
|
|
49
|
+
|
|
50
|
+
// libs/core/src/components/context-menu/context-menu.ts
|
|
51
|
+
var _handleItemClick, handleItemClick_fn;
|
|
52
|
+
var GdsContextMenu = class extends GdsElement {
|
|
53
|
+
constructor() {
|
|
54
|
+
super();
|
|
55
|
+
__privateAdd(this, _handleItemClick);
|
|
56
|
+
this.open = false;
|
|
57
|
+
this.buttonLabel = msg("Open context menu");
|
|
58
|
+
this.showLabel = false;
|
|
59
|
+
this.label = "";
|
|
60
|
+
this.placement = "bottom-start";
|
|
61
|
+
constrainSlots(this);
|
|
62
|
+
}
|
|
63
|
+
connectedCallback() {
|
|
64
|
+
super.connectedCallback();
|
|
65
|
+
TransitionalStyles.instance.apply(this, "gds-context-menu");
|
|
66
|
+
this.addEventListener("keydown", (e) => {
|
|
67
|
+
if (this.open && e.key == "Tab") {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
this.open = false;
|
|
70
|
+
this.elTriggerBtn.then((el) => el.focus());
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
render() {
|
|
75
|
+
var _a, _b, _c;
|
|
76
|
+
return html`${this._tStyles}
|
|
77
|
+
<button
|
|
78
|
+
id="trigger"
|
|
79
|
+
class="icon border-0 small ${classMap({ highlighted: this.open })}"
|
|
80
|
+
aria-label=${(_a = this.buttonLabel) != null ? _a : this.label}
|
|
81
|
+
aria-haspopup="menu"
|
|
82
|
+
aria-controls="menu"
|
|
83
|
+
aria-expanded=${this.open}
|
|
84
|
+
@click=${() => this.open = !this.open}
|
|
85
|
+
>
|
|
86
|
+
<slot name="trigger">
|
|
87
|
+
${this.showLabel ? (_b = this.buttonLabel) != null ? _b : this.label : nothing}
|
|
88
|
+
<svg width="24" height="24" viewBox="0 0 24 24">
|
|
89
|
+
<path
|
|
90
|
+
d="M14 12C14 13.1042 13.1042 14 12 14C10.8958 14 10 13.1042 10 12C10 10.8958 10.8958 10 12 10C13.1042 10 14 10.8958 14 12ZM19 10C17.8958 10 17 10.8958 17 12C17 13.1042 17.8958 14 19 14C20.1042 14 21 13.1042 21 12C21 10.8958 20.1042 10 19 10ZM5 10C3.89583 10 3 10.8958 3 12C3 13.1042 3.89583 14 5 14C6.10417 14 7 13.1042 7 12C7 10.8958 6.10417 10 5 10Z"
|
|
91
|
+
fill="#353531"
|
|
92
|
+
/>
|
|
93
|
+
</svg>
|
|
94
|
+
</slot>
|
|
95
|
+
</button>
|
|
96
|
+
<gds-popover
|
|
97
|
+
id="menu"
|
|
98
|
+
.open=${this.open}
|
|
99
|
+
.triggerRef=${this.elTriggerBtn}
|
|
100
|
+
.label=${this.label}
|
|
101
|
+
.placement=${this.placement}
|
|
102
|
+
@gds-ui-state=${(e) => this.open = e.detail.open}
|
|
103
|
+
>
|
|
104
|
+
<gds-menu
|
|
105
|
+
aria-label=${(_c = this.label) != null ? _c : this.buttonLabel}
|
|
106
|
+
@gds-menu-item-click=${__privateMethod(this, _handleItemClick, handleItemClick_fn)}
|
|
107
|
+
>
|
|
108
|
+
<slot allow="gds-menu-item gds-menu-heading"></slot>
|
|
109
|
+
</gds-menu>
|
|
110
|
+
</gds-popover>`;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
_handleItemClick = new WeakSet();
|
|
114
|
+
handleItemClick_fn = function() {
|
|
115
|
+
this.open = false;
|
|
116
|
+
};
|
|
117
|
+
GdsContextMenu.styles = [context_menu_styles_default];
|
|
118
|
+
GdsContextMenu.shadowRootOptions = {
|
|
119
|
+
mode: "open",
|
|
120
|
+
delegatesFocus: true
|
|
121
|
+
};
|
|
122
|
+
__decorateClass([
|
|
123
|
+
property({ type: Boolean, reflect: true })
|
|
124
|
+
], GdsContextMenu.prototype, "open", 2);
|
|
125
|
+
__decorateClass([
|
|
126
|
+
property({
|
|
127
|
+
attribute: "button-label"
|
|
128
|
+
})
|
|
129
|
+
], GdsContextMenu.prototype, "buttonLabel", 2);
|
|
130
|
+
__decorateClass([
|
|
131
|
+
property({
|
|
132
|
+
attribute: "show-label"
|
|
133
|
+
})
|
|
134
|
+
], GdsContextMenu.prototype, "showLabel", 2);
|
|
135
|
+
__decorateClass([
|
|
136
|
+
property()
|
|
137
|
+
], GdsContextMenu.prototype, "label", 2);
|
|
138
|
+
__decorateClass([
|
|
139
|
+
property()
|
|
140
|
+
], GdsContextMenu.prototype, "placement", 2);
|
|
141
|
+
__decorateClass([
|
|
142
|
+
state()
|
|
143
|
+
], GdsContextMenu.prototype, "_tStyles", 2);
|
|
144
|
+
__decorateClass([
|
|
145
|
+
queryAsync("#trigger")
|
|
146
|
+
], GdsContextMenu.prototype, "elTriggerBtn", 2);
|
|
147
|
+
GdsContextMenu = __decorateClass([
|
|
148
|
+
gdsCustomElement("gds-context-menu")
|
|
149
|
+
], GdsContextMenu);
|
|
150
|
+
|
|
151
|
+
export {
|
|
152
|
+
GdsContextMenu
|
|
153
|
+
};
|
|
File without changes
|