@sebgroup/green-core 1.15.0 → 1.16.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.274BU2AI.js +244 -0
- 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.3SEVAGLE.js +96 -0
- package/chunks/chunk.522C22QY.js +460 -0
- package/chunks/chunk.5VURDMKE.js +75 -0
- package/chunks/chunk.6NM7ENKA.js +31 -0
- package/chunks/chunk.6UA66KQU.js +153 -0
- package/chunks/chunk.7P5N6NZL.js +560 -0
- package/chunks/chunk.7TCXY7BP.js +0 -0
- package/chunks/chunk.D7H7CUS4.js +55 -0
- package/chunks/chunk.DFYMYEGD.js +78 -0
- package/chunks/chunk.HS7ICQNA.js +0 -0
- package/chunks/chunk.IYCENQZG.js +28 -0
- package/chunks/chunk.J2A6J77W.js +81 -0
- package/chunks/chunk.KC32OWZE.js +274 -0
- package/chunks/chunk.KV4SDMFS.js +101 -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.NOYHINYP.js +467 -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.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.XHTJVQUJ.js +140 -0
- package/chunks/chunk.XI4H54TV.js +39 -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/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 -4278
- package/localization.js +40 -44
- 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
package/README.md
CHANGED
|
@@ -15,19 +15,113 @@ npm install @sebgroup/green-core
|
|
|
15
15
|
|
|
16
16
|
## Use
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
import { GdsButton } from '@sebgroup/green-core'
|
|
20
|
-
import { transitionalStyles } from '@sebgroup/green-core/transitional-styles'
|
|
18
|
+
There are three main ways you can use Green Core:
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
- With Lit
|
|
21
|
+
- With Angular
|
|
22
|
+
- With React
|
|
23
|
+
|
|
24
|
+
But that said, the components in Green Core are just regular Web Components, so you can use them with or without any framework.
|
|
25
|
+
|
|
26
|
+
### Using Lit
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { css, customElement, LitElement } from 'lit'
|
|
30
|
+
|
|
31
|
+
// This custom `html` template literal tag from Green Core extends the default `lit-html` tag to handle element version scoping.
|
|
32
|
+
import { html } from '@sebgroup/green-core/scoping'
|
|
33
|
+
|
|
34
|
+
// Trtansitional styles applies the current 2016 design language to the components
|
|
35
|
+
import { registerTransitionalStyles } from '@sebgroup/green-core/transitional-styles'
|
|
36
|
+
|
|
37
|
+
// Import the components that you need
|
|
38
|
+
import '@sebgroup/green-core/components/button'
|
|
39
|
+
|
|
40
|
+
@customElement('my-app')
|
|
41
|
+
export class MyApp extends LitElement {
|
|
42
|
+
static styles = css``
|
|
43
|
+
|
|
44
|
+
connectedCallback() {
|
|
45
|
+
super.connectedCallback()
|
|
46
|
+
|
|
47
|
+
// Register transitional styles to get SEB's current visual design
|
|
48
|
+
registerTransitionalStyles()
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
render() {
|
|
52
|
+
return html`<gds-button>Click me!</gds-button>`
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Using Angular
|
|
58
|
+
|
|
59
|
+
Angular has support for using web components directly in the template. To enable it, you need to do the following:
|
|
60
|
+
|
|
61
|
+
Add the `CUSTOM_ELEMENTS_SCHEMA` in the module where you plan to use the components. It is recommended to add this as locally as possible, only on the moduls/components where you need it, and not in the app module.
|
|
62
|
+
|
|
63
|
+
You also need the `NggCoreWrapperModule` from `@sebgroup/green-angular`.
|
|
64
|
+
|
|
65
|
+
In your module:
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'
|
|
69
|
+
import { NggCoreWrapperModule } from '@sebgroup/green-angular'
|
|
70
|
+
|
|
71
|
+
@NgModule({
|
|
72
|
+
// Add the NggCoreWrapperModule to the `imports` array
|
|
73
|
+
imports: [NggCoreWrapperModule],
|
|
74
|
+
// Add the CUSTOM_ELEMENTS_SCHEMA to the `schemas` array
|
|
75
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
76
|
+
})
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
In your component:
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import '@sebgroup/green-core/components/button'
|
|
83
|
+
|
|
84
|
+
// Transitional styles
|
|
85
|
+
import { registerTransitionalStyles } from '@sebgroup/green-core/transitional-styles'
|
|
86
|
+
registerTransitionalStyles()
|
|
24
87
|
```
|
|
25
88
|
|
|
89
|
+
Use the webcomponent in your template with the `*nggCoreElement` directive.
|
|
90
|
+
|
|
91
|
+
In your template:
|
|
92
|
+
|
|
26
93
|
```html
|
|
27
|
-
|
|
28
|
-
<gds-button>Click me</gds-button>
|
|
94
|
+
<gds-button *nggCoreElement>Click me!</gds-button>
|
|
29
95
|
```
|
|
30
96
|
|
|
97
|
+
The `*nggCoreElement` directive comes from the `NggCoreWrapperModule` you imported above. It has the same pupose as the custom html template tag mentioned in the Lit example above: It handles custom element scoping for you.
|
|
98
|
+
|
|
99
|
+
### Using React
|
|
100
|
+
|
|
101
|
+
In most cases, we already exort React wrappers for these components from the `@sebgroup/green-react` package. In those cases you can just use those. But you can also easily create your own wrappers using `@lit/react`.
|
|
102
|
+
|
|
103
|
+
Here is an example:
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
import React from 'react'
|
|
107
|
+
import { createComponent } from '@lit/react'
|
|
108
|
+
|
|
109
|
+
import { GdsButton } from '@sebgroup/green-core/component/button'
|
|
110
|
+
import { getScopedTagName } from '@sebgroup/green-core/scoping'
|
|
111
|
+
import { registerTransitionalStyles } from '@sebgroup/green-core/transitional-styles'
|
|
112
|
+
|
|
113
|
+
registerTransitionalStyles()
|
|
114
|
+
|
|
115
|
+
export const Button = createComponent({
|
|
116
|
+
tagName: getScopedTagName('gds-button'),
|
|
117
|
+
elementClass: GdsButton,
|
|
118
|
+
react: React,
|
|
119
|
+
events: { onClick: 'click' }, // Event callbacks need to be explicitly mapped to DOM events
|
|
120
|
+
})
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Then you can just use `<Button />` like a regular React component.
|
|
124
|
+
|
|
31
125
|
## Documentation
|
|
32
126
|
|
|
33
127
|
Check out the [Storybook (@sebgroup/core)](https://sebgroup.github.io/green/latest/core/) for components and documentation.
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import {
|
|
2
|
+
grid_style_css_default
|
|
3
|
+
} from "./chunk.J2A6J77W.js";
|
|
4
|
+
import {
|
|
5
|
+
tokens
|
|
6
|
+
} from "./chunk.7P5N6NZL.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,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getUnscopedTagName
|
|
3
|
+
} from "./chunk.VOYMQ322.js";
|
|
4
|
+
|
|
5
|
+
// libs/core/src/gds-element.ts
|
|
6
|
+
import { LitElement } from "lit";
|
|
7
|
+
var GdsElement = class extends LitElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
/**
|
|
11
|
+
* The unscoped name of this element.
|
|
12
|
+
*/
|
|
13
|
+
this.gdsElementName = "";
|
|
14
|
+
/**
|
|
15
|
+
* Whether the element is using transitional styles.
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
this._isUsingTransitionalStyles = false;
|
|
19
|
+
}
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
super.connectedCallback();
|
|
22
|
+
this.gdsElementName = getUnscopedTagName(this.tagName.toLowerCase()) || this.gdsElementName;
|
|
23
|
+
this.setAttribute("gds-element", this.gdsElementName);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
GdsElement
|
|
29
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// libs/core/src/primitives/listbox/option.styles.ts
|
|
2
|
+
import { css } from "lit";
|
|
3
|
+
var style = css`
|
|
4
|
+
@layer base, reset, transitional-styles;
|
|
5
|
+
@layer base {
|
|
6
|
+
:host {
|
|
7
|
+
display: block;
|
|
8
|
+
padding: 1rem 1.5rem;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
:host(:not(:last-child)) {
|
|
13
|
+
border-bottom: 1px solid #e0e0e0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:host(:hover) {
|
|
17
|
+
background-color: #ededed;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:host(:focus-visible) {
|
|
21
|
+
outline: auto;
|
|
22
|
+
outline-offset: -6px;
|
|
23
|
+
outline-color: #666;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
var option_styles_default = style;
|
|
28
|
+
|
|
29
|
+
// libs/core/src/mixins/focusable.ts
|
|
30
|
+
var Focusable = (superClass) => {
|
|
31
|
+
class HighlightableElement extends superClass {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
this.onblur = (e) => {
|
|
35
|
+
this.setAttribute("tabindex", "-1");
|
|
36
|
+
this.dispatchEvent(
|
|
37
|
+
new FocusEvent("gds-blur", {
|
|
38
|
+
bubbles: true,
|
|
39
|
+
composed: true,
|
|
40
|
+
relatedTarget: e.relatedTarget
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
this.onfocus = (e) => {
|
|
45
|
+
this.dispatchEvent(
|
|
46
|
+
new FocusEvent("gds-focus", {
|
|
47
|
+
bubbles: true,
|
|
48
|
+
composed: true,
|
|
49
|
+
relatedTarget: e.relatedTarget
|
|
50
|
+
})
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
focus(options) {
|
|
55
|
+
this.setAttribute("tabindex", "0");
|
|
56
|
+
super.focus(options);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return HighlightableElement;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export {
|
|
63
|
+
option_styles_default,
|
|
64
|
+
Focusable
|
|
65
|
+
};
|