@sebgroup/green-core 1.7.0 → 1.9.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 +53 -114
- package/components/datepicker/datepicker.d.ts +8 -0
- package/components/dropdown/dropdown.d.ts +4 -0
- package/components/grouped-list/grouped-list.d.ts +17 -0
- package/components/grouped-list/grouped-list.trans.styles.d.ts +2 -0
- package/components/grouped-list/list-item.d.ts +11 -0
- package/components/index.d.ts +1 -0
- package/index.js +101 -6
- package/package.json +1 -1
- package/primitives/calendar/calendar.d.ts +8 -0
- package/primitives/popover/popover.d.ts +10 -0
- package/transitional-styles.js +40 -1
package/README.md
CHANGED
|
@@ -1,112 +1,75 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<a href="https://seb.io">
|
|
3
|
+
<img src="https://github.com/sebgroup/green/assets/11420341/2fc122ba-54fc-4f22-b96d-d405079d6e50">
|
|
4
|
+
</a>
|
|
5
|
+
<br/>
|
|
6
|
+
<br/>
|
|
7
|
+
Green Design System
|
|
8
|
+
</h1>
|
|
2
9
|
|
|
3
|
-
Green is an
|
|
10
|
+
<p align="center">Green is an open-source design system built by SEB.<p>
|
|
11
|
+
<p align="center"><a href="https://github.com/sebgroup/green/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache2.0-005FAC"/></a> <a href="https://semver.org/"><img src="https://img.shields.io/badge/semantic%20versioning-006D31"/></a> <a href="https://nx.dev/"><img src="https://img.shields.io/badge/maintained%20with-nx-006D31"/></a> <a href="https://github.com/sebgroup/green/blob/main/CONTRIBUTING.md"><img src="https://img.shields.io/badge/PRs-welcome-006D31"/></a></p>
|
|
4
12
|
|
|
13
|
+
## Getting started
|
|
5
14
|
|
|
6
|
-
|
|
15
|
+
If you are new to Green, checkout [@sebgroup/green-core](https://github.com/sebgroup/green/tree/main/libs/core).
|
|
7
16
|
|
|
8
|
-
|
|
17
|
+
We also provide components for the following technologies:
|
|
9
18
|
|
|
19
|
+
- [React](https://github.com/sebgroup/green/tree/main/libs/react)
|
|
20
|
+
- [Angular](https://github.com/sebgroup/green/tree/main/libs/angular)
|
|
10
21
|
|
|
11
|
-
|
|
22
|
+
If you're trying to find something specific, here's a full list of packages that we support!
|
|
12
23
|
|
|
13
|
-
|
|
24
|
+
| Package name | Description |
|
|
25
|
+
| ------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
|
|
26
|
+
| [@sebgroup/green-core](https://github.com/sebgroup/green/tree/main/libs/core) | Webcomponent library built with [Lit](https://lit.dev) |
|
|
27
|
+
| [@sebgroup/green-react](https://github.com/sebgroup/green/tree/main/libs/react) | React component library |
|
|
28
|
+
| [@sebgroup/green-angular](https://github.com/sebgroup/green/tree/main/libs/angular) | Angular component library |
|
|
29
|
+
| [@sebgroup/chlorophyll](https://github.com/sebgroup/green/tree/main/libs/chlorophyll) | Styling framework |
|
|
30
|
+
| [@sebgroup/green-tokens](https://github.com/sebgroup/green/tree/main/libs/tokens) | Design Tokens package |
|
|
31
|
+
| [@sebgroup/green-charts](https://github.com/sebgroup/green/tree/main/libs/charts) | An SEB wrapper of [Billboard.js](https://naver.github.io/billboard.js/) |
|
|
32
|
+
| [@sebgroup/green-react-charts](https://github.com/sebgroup/green/tree/main/libs/react-charts) | A React version of the charts wrapper |
|
|
33
|
+
| [@sebgroup/green-angular-charts](https://github.com/sebgroup/green/tree/main/libs/angular-charts) | An Angular version of the charts wrapper |
|
|
14
34
|
|
|
35
|
+
## 📋 Table of content
|
|
15
36
|
|
|
16
|
-
|
|
37
|
+
- [Documentation](https://github.com/sebgroup/green/tree/main?tab=readme-ov-file#documentation)
|
|
38
|
+
- [Working from SEB](https://github.com/sebgroup/green/tree/main?tab=readme-ov-file#working-from-seb)
|
|
39
|
+
- [Contribute](https://github.com/sebgroup/green/tree/main?tab=readme-ov-file#contribute)
|
|
40
|
+
- [Working locally with this repo](https://github.com/sebgroup/green/tree/main?tab=readme-ov-file#working-locally-with-this-repo)
|
|
17
41
|
|
|
18
|
-
|
|
42
|
+
## 📚 Documentation
|
|
19
43
|
|
|
44
|
+
Documentation currently resides in a few different locations:
|
|
20
45
|
|
|
21
|
-
|
|
46
|
+
- [User Interface Guidelines (Design Library)](https://designlibrary.sebgroup.com/)
|
|
47
|
+
- [Storybook (@sebgroup/chlorophyll)](https://sebgroup.github.io/green/latest/chlorophyll/)
|
|
48
|
+
- [Storybook (@sebgroup/green-core)](https://sebgroup.github.io/green/latest/core/)
|
|
49
|
+
- [Storybook (@sebgroup/green-react)](https://sebgroup.github.io/green/latest/react/)
|
|
50
|
+
- [Storybook (@sebgroup/green-angular)](https://sebgroup.github.io/green/latest/angular/)
|
|
22
51
|
|
|
23
|
-
|
|
52
|
+
## 🏦 Working from SEB
|
|
24
53
|
|
|
54
|
+
Working from SEB and on SEB machines you need to setup things in a specific way for everything to work smooth. Checkout our [Developer Guidelines](https://github.sebank.se/pages/seb-common/Developer-garden/detail_pages/green.html) over at Developer Garden.
|
|
25
55
|
|
|
26
|
-
|
|
56
|
+
## 🎉 Contribute
|
|
27
57
|
|
|
28
|
-
|
|
58
|
+
We're always looking for contributors to help us fix bugs, build new features, or help us improve the project documentation. If you're interested, definitely check out our [Contributing Guide](https://github.com/sebgroup/green/blob/main/CONTRIBUTING.md)! 👀
|
|
29
59
|
|
|
60
|
+
## 🔨 Working locally with this repo
|
|
30
61
|
|
|
31
|
-
###
|
|
62
|
+
### Start Storybook locally
|
|
32
63
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
### We work from right to left
|
|
37
|
-
|
|
38
|
-
If something can be deployed, we deploy. Then, if a PR needs a review, we review. Then, and only then, if something can be built, we build. Flow is more important than speed.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## The design process
|
|
42
|
-
|
|
43
|
-
Green is tightly integrated with the design process. The design responsible are part of the team so that decisions can be made effectively and by those most suited.
|
|
44
|
-
|
|
45
|
-
For the most part we follow the existing design. When changes have to be made for practical reasons, clarity, uniformity, accessibility or any other reason, the design responsible make the call and the change is integrated.
|
|
46
|
-
|
|
47
|
-
This can, and will, lead to minor inconsistencies in different parts of our offering, especially as Green is not yet (even close to) at 100% adoption. This is fine. Far larger inconsistencies already exist in our current, digital ecosystem. We therefore prioritise the ability to keep moving forward and improve our customers' experience over delaying for the sake of consistency.
|
|
48
|
-
|
|
49
|
-
In the long run, consistency will be achieved by automating the roll-out of changes, be they visual, functional or qualitative, to keep all parts of our offering on the latest version. When we go Green, we stay green.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
## Develop
|
|
53
|
-
|
|
54
|
-
### Yarn
|
|
55
|
-
|
|
56
|
-
This mono repo is based on `nx` and uses `yarn` instead of `npm`. If you are unused to yarn, see the following instructions:
|
|
57
|
-
|
|
58
|
-
#### Install yarn
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
npm install yarn -g
|
|
62
|
-
```
|
|
63
|
-
Use the -g flag to install it globally on your computer.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
#### Install dependencies
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
yarn
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
#### Add a dependency to a workspace
|
|
73
|
-
|
|
74
|
-
All projects use a common set of dependencies so if you want to add `leftpad` to the chlorophyll project, just run:
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
yarn add leftpad
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
#### Run a command in `package.json`
|
|
81
|
-
|
|
82
|
-
Unlike `npm`, `yarn` doesn't require the `run` command. So if you want to run `lint` in your package or in the project root, simply type:
|
|
64
|
+
To start Storybooks locally on your machine you run the following command:
|
|
83
65
|
|
|
84
66
|
```bash
|
|
85
|
-
|
|
67
|
+
npx nx run [PROJECT]:storybook
|
|
86
68
|
```
|
|
87
69
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
- Clone the project locally from GitHub - `git clone https://github.com/sebgroup/green.git`.
|
|
91
|
-
- Create a new branch each time - `git checkout -b "DESCRIPTIVE NAME"`.
|
|
92
|
-
- Commit with the Semantic everything inscructions underneath.
|
|
93
|
-
- Pull the latest - `git pull`.
|
|
94
|
-
- Push eveything - `git push`.
|
|
95
|
-
- Make a pull request in GitHub - `https://github.com/sebgroup/green/compare`.
|
|
70
|
+
Where you replace `[PROJECT]` with a folder name from `green\libs`.
|
|
96
71
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
All projects in Green use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) to power [semantic releases](https://semantic-release.gitbook.io/semantic-release/). In order to simplify using this format, install:
|
|
100
|
-
|
|
101
|
-
```bash
|
|
102
|
-
npm install git-cz -g
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
To commit, just run `git-cz` in the terminal. Always try to add reference to an issue in the longer description with # and the issue number. Eg `#1337`.
|
|
106
|
-
|
|
107
|
-
### Start Storybook
|
|
108
|
-
|
|
109
|
-
You start the common storybooks with these commands:
|
|
72
|
+
So to start Storybook for each component library run:
|
|
110
73
|
|
|
111
74
|
```bash
|
|
112
75
|
npx nx run chlorophyll:storybook
|
|
@@ -114,38 +77,14 @@ npx nx run react:storybook
|
|
|
114
77
|
npx nx run angular:storybook
|
|
115
78
|
```
|
|
116
79
|
|
|
117
|
-
Or the general `npx nx run [PROJECT]:storybook` where you replace `[PROJECT]` with a folder name from `green\libs`.
|
|
118
|
-
|
|
119
80
|
If you install nx globally you can omit the npx above.
|
|
120
81
|
|
|
121
82
|
```bash
|
|
83
|
+
# Install nx globally
|
|
122
84
|
npm install nx -g
|
|
123
|
-
```
|
|
124
85
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
npx nx run chlorophyll:build-storybook
|
|
131
|
-
npx nx run react:build-storybook
|
|
132
|
-
npx nx run angular:build-storybook
|
|
86
|
+
# And start the storybooks
|
|
87
|
+
nx run chlorophyll:storybook
|
|
88
|
+
nx run react:storybook
|
|
89
|
+
nx run angular:storybook
|
|
133
90
|
```
|
|
134
|
-
|
|
135
|
-
### On SEB Windows computer
|
|
136
|
-
|
|
137
|
-
For the moment, `yarn` is difficult to use within the SEB environment, so instead you can install the dependencies using `npm`:
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
$ npm i --force
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
The `--force` flag is necessary in this case to convince `npm` that sub-dependency conflicts are OK.
|
|
144
|
-
|
|
145
|
-
Don't commit the generated `package-lock.json` file, since we already have a `yarn.lock` file.
|
|
146
|
-
|
|
147
|
-
If you need to add a new dependency, the `yarn.lock` file needs to be updated, and in that case you still need to use `yarn`. You can do this by temporarily disconnecting from the SEB network, or by using a non-SEB computer.
|
|
148
|
-
|
|
149
|
-
## Git
|
|
150
|
-
|
|
151
|
-
We reccommend using [GitHub Desktop](https://desktop.github.com/), as it will work smoothly with both on-prem GitHub and external GitHub without any manual configuration of proxies and certificates. Ask for help on Teams if you need assistance!
|
|
@@ -61,6 +61,14 @@ export declare class GdsDatepicker extends GdsFormControlElement<Date> {
|
|
|
61
61
|
*/
|
|
62
62
|
get dateformat(): string;
|
|
63
63
|
set dateformat(dateformat: string);
|
|
64
|
+
/**
|
|
65
|
+
* Whether to disable weekends in the calendar.
|
|
66
|
+
*/
|
|
67
|
+
disabledWeekends: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* An array of dates that should be disabled in the calendar.
|
|
70
|
+
*/
|
|
71
|
+
disabledDates?: Date[];
|
|
64
72
|
/**
|
|
65
73
|
* Get the currently focused date in the calendar popover. If no date is focused, or the calendar popover
|
|
66
74
|
* is closed, the value will be undefined.
|
|
@@ -76,6 +76,10 @@ export declare class GdsDropdown<ValueT = any> extends GdsFormControlElement<Val
|
|
|
76
76
|
* are still readable and apply appropriate custom layout or truncation if neccecary.
|
|
77
77
|
*/
|
|
78
78
|
syncPopoverWidth: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Maximum height of the dropdown list.
|
|
81
|
+
*/
|
|
82
|
+
maxHeight: number;
|
|
79
83
|
/**
|
|
80
84
|
* Size of the dropdown. Supports `medium` and `small`. There is no `large` size for dropdowns.
|
|
81
85
|
* `medium` is the default size.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { GdsElement } from '../../gds-element';
|
|
2
|
+
import './list-item';
|
|
3
|
+
/**
|
|
4
|
+
* @element gds-grouped-list
|
|
5
|
+
* @status beta
|
|
6
|
+
*
|
|
7
|
+
* Grouped lists are used to list many datapoints with labels in a structured way.
|
|
8
|
+
*/
|
|
9
|
+
export declare class GdsGroupedList extends GdsElement {
|
|
10
|
+
private _tStyles?;
|
|
11
|
+
/**
|
|
12
|
+
* The label for the list that will render in the shadowDOM as the first <li> element in the list with the class `gds-list-heading`
|
|
13
|
+
*/
|
|
14
|
+
label: string;
|
|
15
|
+
connectedCallback(): void;
|
|
16
|
+
render(): any;
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GdsElement } from '../../gds-element';
|
|
2
|
+
/**
|
|
3
|
+
* @element gds-list-item
|
|
4
|
+
* @status beta
|
|
5
|
+
*
|
|
6
|
+
* Used with `gds-grouped-list` to create a list items.
|
|
7
|
+
*/
|
|
8
|
+
export declare class GdsListItem extends GdsElement {
|
|
9
|
+
connectedCallback(): void;
|
|
10
|
+
render(): any;
|
|
11
|
+
}
|
package/components/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -77,8 +77,8 @@ function watch(propertyName, options) {
|
|
|
77
77
|
const { update } = proto;
|
|
78
78
|
const watchedProperties = Array.isArray(propertyName) ? propertyName : [propertyName];
|
|
79
79
|
proto.update = function(changedProps) {
|
|
80
|
-
watchedProperties.forEach((
|
|
81
|
-
const key =
|
|
80
|
+
watchedProperties.forEach((property11) => {
|
|
81
|
+
const key = property11;
|
|
82
82
|
if (changedProps.has(key)) {
|
|
83
83
|
const oldValue = changedProps.get(key);
|
|
84
84
|
const newValue = this[key];
|
|
@@ -144,7 +144,7 @@ function watchMediaQuery(q) {
|
|
|
144
144
|
// libs/core/src/utils/helpers/custom-element-scoping.ts
|
|
145
145
|
import { html as litHtml } from "lit";
|
|
146
146
|
import { customElement } from "lit/decorators.js";
|
|
147
|
-
var VER_SUFFIX = "-
|
|
147
|
+
var VER_SUFFIX = "-af766e";
|
|
148
148
|
var elementLookupTable = /* @__PURE__ */ new Map();
|
|
149
149
|
var gdsCustomElement = (tagName) => {
|
|
150
150
|
if (globalThis.GDS_DISABLE_VERSIONED_ELEMENTS) {
|
|
@@ -715,6 +715,8 @@ var GdsPopover = class extends GdsElement {
|
|
|
715
715
|
this.placement = "bottom-start";
|
|
716
716
|
this.calcMinWidth = (referenceEl) => `${referenceEl.offsetWidth}px`;
|
|
717
717
|
this.calcMaxWidth = (_referenceEl) => `auto`;
|
|
718
|
+
this.calcMinHeight = (referenceEl) => `auto`;
|
|
719
|
+
this.calcMaxHeight = (_referenceEl) => `500px`;
|
|
718
720
|
this._trigger = void 0;
|
|
719
721
|
this._isVirtKbVisible = false;
|
|
720
722
|
// A reference to the dialog element used to make the popover modal
|
|
@@ -910,7 +912,9 @@ registerAutoPositioning_fn = function() {
|
|
|
910
912
|
left: `${x}px`,
|
|
911
913
|
top: `${y}px`,
|
|
912
914
|
minWidth: this.calcMinWidth(referenceEl),
|
|
913
|
-
maxWidth: this.calcMaxWidth(referenceEl)
|
|
915
|
+
maxWidth: this.calcMaxWidth(referenceEl),
|
|
916
|
+
minHeight: this.calcMinHeight(referenceEl),
|
|
917
|
+
maxHeight: this.calcMaxHeight(referenceEl)
|
|
914
918
|
})
|
|
915
919
|
);
|
|
916
920
|
}));
|
|
@@ -937,6 +941,12 @@ __decorateClass([
|
|
|
937
941
|
__decorateClass([
|
|
938
942
|
property3()
|
|
939
943
|
], GdsPopover.prototype, "calcMaxWidth", 2);
|
|
944
|
+
__decorateClass([
|
|
945
|
+
property3()
|
|
946
|
+
], GdsPopover.prototype, "calcMinHeight", 2);
|
|
947
|
+
__decorateClass([
|
|
948
|
+
property3()
|
|
949
|
+
], GdsPopover.prototype, "calcMaxHeight", 2);
|
|
940
950
|
__decorateClass([
|
|
941
951
|
state3()
|
|
942
952
|
], GdsPopover.prototype, "_trigger", 2);
|
|
@@ -1127,6 +1137,7 @@ var GdsDropdown = class extends GdsFormControlElement {
|
|
|
1127
1137
|
this.compareWith = (a, b) => a === b;
|
|
1128
1138
|
this.searchFilter = (q, o) => o.innerHTML.toLowerCase().includes(q.toLowerCase());
|
|
1129
1139
|
this.syncPopoverWidth = false;
|
|
1140
|
+
this.maxHeight = 500;
|
|
1130
1141
|
this.size = "medium";
|
|
1131
1142
|
this.hideLabel = false;
|
|
1132
1143
|
__privateAdd(this, _optionElements, void 0);
|
|
@@ -1270,6 +1281,7 @@ var GdsDropdown = class extends GdsFormControlElement {
|
|
|
1270
1281
|
.open=${this.open}
|
|
1271
1282
|
.triggerRef=${this._elTriggerBtnAsync}
|
|
1272
1283
|
.calcMaxWidth=${(trigger) => this.syncPopoverWidth ? `${trigger.offsetWidth}px` : `auto`}
|
|
1284
|
+
.calcMaxHeight=${(_trigger) => `${this.maxHeight}px`}
|
|
1273
1285
|
@gds-ui-state=${(e) => this.open = e.detail.open}
|
|
1274
1286
|
>
|
|
1275
1287
|
${when2(
|
|
@@ -1407,6 +1419,9 @@ __decorateClass([
|
|
|
1407
1419
|
__decorateClass([
|
|
1408
1420
|
property5({ type: Boolean, attribute: "sync-popover-width" })
|
|
1409
1421
|
], GdsDropdown.prototype, "syncPopoverWidth", 2);
|
|
1422
|
+
__decorateClass([
|
|
1423
|
+
property5({ type: Number, attribute: "max-height" })
|
|
1424
|
+
], GdsDropdown.prototype, "maxHeight", 2);
|
|
1410
1425
|
__decorateClass([
|
|
1411
1426
|
property5()
|
|
1412
1427
|
], GdsDropdown.prototype, "size", 2);
|
|
@@ -1739,6 +1754,7 @@ var GdsCalendar = class extends GdsElement {
|
|
|
1739
1754
|
this.min = new Date((/* @__PURE__ */ new Date()).getFullYear() - 10, 0, 1);
|
|
1740
1755
|
this.max = new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 0, 1);
|
|
1741
1756
|
this.focusedDate = /* @__PURE__ */ new Date();
|
|
1757
|
+
this.disabledWeekends = false;
|
|
1742
1758
|
this.showWeekNumbers = false;
|
|
1743
1759
|
}
|
|
1744
1760
|
get focusedMonth() {
|
|
@@ -1798,11 +1814,13 @@ var GdsCalendar = class extends GdsElement {
|
|
|
1798
1814
|
</td>`
|
|
1799
1815
|
)}
|
|
1800
1816
|
${week.days.map((day) => {
|
|
1801
|
-
const
|
|
1817
|
+
const isOutsideCurrentMonth = !isSameMonth(this.focusedDate, day) || day < this.min || day > this.max;
|
|
1818
|
+
const isWeekend = day.getDay() === 0 || day.getDay() === 6;
|
|
1819
|
+
const isDisabled = isOutsideCurrentMonth || this.disabledWeekends && isWeekend || this.disabledDates && this.disabledDates.some((d) => isSameDay(d, day));
|
|
1802
1820
|
return html7`
|
|
1803
1821
|
<td
|
|
1804
1822
|
class="${classMap5({
|
|
1805
|
-
disabled: isDisabled,
|
|
1823
|
+
disabled: Boolean(isDisabled),
|
|
1806
1824
|
today: isSameDay(currentDate, day)
|
|
1807
1825
|
})}"
|
|
1808
1826
|
?disabled=${isDisabled}
|
|
@@ -1910,6 +1928,12 @@ __decorateClass([
|
|
|
1910
1928
|
__decorateClass([
|
|
1911
1929
|
property7()
|
|
1912
1930
|
], GdsCalendar.prototype, "focusedDate", 2);
|
|
1931
|
+
__decorateClass([
|
|
1932
|
+
property7({ type: Boolean, attribute: "disabled-weekends" })
|
|
1933
|
+
], GdsCalendar.prototype, "disabledWeekends", 2);
|
|
1934
|
+
__decorateClass([
|
|
1935
|
+
property7({ type: Array, attribute: "disabled-dates" })
|
|
1936
|
+
], GdsCalendar.prototype, "disabledDates", 2);
|
|
1913
1937
|
__decorateClass([
|
|
1914
1938
|
property7({ type: Number })
|
|
1915
1939
|
], GdsCalendar.prototype, "focusedMonth", 1);
|
|
@@ -2127,6 +2151,14 @@ var dateConverter = {
|
|
|
2127
2151
|
return value.toISOString();
|
|
2128
2152
|
}
|
|
2129
2153
|
};
|
|
2154
|
+
var dateArrayConverter = {
|
|
2155
|
+
fromAttribute(value) {
|
|
2156
|
+
return value.split(",").map((d) => new Date(d.trim()));
|
|
2157
|
+
},
|
|
2158
|
+
toAttribute(value) {
|
|
2159
|
+
return JSON.stringify(value.map((d) => d.toISOString()));
|
|
2160
|
+
}
|
|
2161
|
+
};
|
|
2130
2162
|
var _valueOnOpen, _renderBackToValidRangeButton, renderBackToValidRangeButton_fn, _focusDate, focusDate_fn, _getSpinnerLabel, getSpinnerLabel_fn, _getMinSpinnerValue, getMinSpinnerValue_fn, _getMaxSpinnerValue, getMaxSpinnerValue_fn, _dispatchChangeEvent2, dispatchChangeEvent_fn2, _dispatchInputEvent, dispatchInputEvent_fn, _handleFieldFocusOut, _handleSpinnerFocus, _handleClipboardCopy, _handleClipboardPaste, _handleFieldClick, _handleCalendarChange, _handleMonthChange, _handleYearChange, _handleIncrementFocusedMonth, _handleDecrementFocusedMonth, _handleCalendarFocusChange, _handlePopoverStateChange, _handleSpinnerKeydown, _parseDateFormat, parseDateFormat_fn, _handleSpinnerChange, _spinnerState, _years, years_get, _isValueOutsideRange, isValueOutsideRange_get;
|
|
2131
2163
|
var GdsDatepicker = class extends GdsFormControlElement {
|
|
2132
2164
|
constructor() {
|
|
@@ -2154,6 +2186,7 @@ var GdsDatepicker = class extends GdsFormControlElement {
|
|
|
2154
2186
|
this.showWeekNumbers = false;
|
|
2155
2187
|
this.size = "medium";
|
|
2156
2188
|
this.hideLabel = false;
|
|
2189
|
+
this.disabledWeekends = false;
|
|
2157
2190
|
this._focusedMonth = (/* @__PURE__ */ new Date()).getMonth();
|
|
2158
2191
|
this._focusedYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
2159
2192
|
this._dateFormatLayout = __privateMethod(this, _parseDateFormat, parseDateFormat_fn).call(this, "y-m-d");
|
|
@@ -2404,6 +2437,7 @@ var GdsDatepicker = class extends GdsFormControlElement {
|
|
|
2404
2437
|
<gds-dropdown
|
|
2405
2438
|
.value=${this._focusedMonth.toString()}
|
|
2406
2439
|
@change=${__privateGet(this, _handleMonthChange)}
|
|
2440
|
+
.maxHeight=${300}
|
|
2407
2441
|
label="${msg5("Month")}"
|
|
2408
2442
|
style="width:120px"
|
|
2409
2443
|
size="small"
|
|
@@ -2425,6 +2459,7 @@ var GdsDatepicker = class extends GdsFormControlElement {
|
|
|
2425
2459
|
<gds-dropdown
|
|
2426
2460
|
.value=${this._focusedYear.toString()}
|
|
2427
2461
|
@change=${__privateGet(this, _handleYearChange)}
|
|
2462
|
+
.maxHeight=${300}
|
|
2428
2463
|
label="${msg5("Year")}"
|
|
2429
2464
|
size="small"
|
|
2430
2465
|
hide-label
|
|
@@ -2453,6 +2488,8 @@ var GdsDatepicker = class extends GdsFormControlElement {
|
|
|
2453
2488
|
.min=${this.min}
|
|
2454
2489
|
.max=${this.max}
|
|
2455
2490
|
.showWeekNumbers=${this.showWeekNumbers}
|
|
2491
|
+
.disabledWeekends=${this.disabledWeekends}
|
|
2492
|
+
.disabledDates=${this.disabledDates}
|
|
2456
2493
|
></gds-calendar>
|
|
2457
2494
|
|
|
2458
2495
|
<div class="footer">
|
|
@@ -2655,6 +2692,12 @@ __decorateClass([
|
|
|
2655
2692
|
__decorateClass([
|
|
2656
2693
|
property9()
|
|
2657
2694
|
], GdsDatepicker.prototype, "dateformat", 1);
|
|
2695
|
+
__decorateClass([
|
|
2696
|
+
property9({ type: Boolean, attribute: "disabled-weekends" })
|
|
2697
|
+
], GdsDatepicker.prototype, "disabledWeekends", 2);
|
|
2698
|
+
__decorateClass([
|
|
2699
|
+
property9({ converter: dateArrayConverter, attribute: "disabled-dates" })
|
|
2700
|
+
], GdsDatepicker.prototype, "disabledDates", 2);
|
|
2658
2701
|
__decorateClass([
|
|
2659
2702
|
queryAsync3("#calendar-button")
|
|
2660
2703
|
], GdsDatepicker.prototype, "test_calendarButton", 2);
|
|
@@ -2691,10 +2734,62 @@ __decorateClass([
|
|
|
2691
2734
|
GdsDatepicker = __decorateClass([
|
|
2692
2735
|
gdsCustomElement("gds-datepicker")
|
|
2693
2736
|
], GdsDatepicker);
|
|
2737
|
+
|
|
2738
|
+
// libs/core/src/components/grouped-list/grouped-list.ts
|
|
2739
|
+
import { state as state11, property as property10 } from "lit/decorators.js";
|
|
2740
|
+
import { when as when5 } from "lit/directives/when.js";
|
|
2741
|
+
|
|
2742
|
+
// libs/core/src/components/grouped-list/list-item.ts
|
|
2743
|
+
var GdsListItem = class extends GdsElement {
|
|
2744
|
+
connectedCallback() {
|
|
2745
|
+
super.connectedCallback();
|
|
2746
|
+
this.setAttribute("role", "listitem");
|
|
2747
|
+
}
|
|
2748
|
+
render() {
|
|
2749
|
+
return html`<slot></slot>`;
|
|
2750
|
+
}
|
|
2751
|
+
};
|
|
2752
|
+
GdsListItem = __decorateClass([
|
|
2753
|
+
gdsCustomElement("gds-list-item")
|
|
2754
|
+
], GdsListItem);
|
|
2755
|
+
|
|
2756
|
+
// libs/core/src/components/grouped-list/grouped-list.ts
|
|
2757
|
+
var GdsGroupedList = class extends GdsElement {
|
|
2758
|
+
constructor() {
|
|
2759
|
+
super(...arguments);
|
|
2760
|
+
this.label = "";
|
|
2761
|
+
}
|
|
2762
|
+
connectedCallback() {
|
|
2763
|
+
super.connectedCallback();
|
|
2764
|
+
constrainSlots(this);
|
|
2765
|
+
TransitionalStyles.instance.apply(this, "gds-grouped-list");
|
|
2766
|
+
}
|
|
2767
|
+
render() {
|
|
2768
|
+
return html`${this._tStyles}${when5(
|
|
2769
|
+
this.label,
|
|
2770
|
+
() => html`<div class="gds-list-heading" aria-hidden="true" id="label">
|
|
2771
|
+
${this.label}
|
|
2772
|
+
</div>`
|
|
2773
|
+
)}
|
|
2774
|
+
<div role="list" aria-labelledby="label">
|
|
2775
|
+
<slot gds-allow="gds-list-item"></slot>
|
|
2776
|
+
</div>`;
|
|
2777
|
+
}
|
|
2778
|
+
};
|
|
2779
|
+
__decorateClass([
|
|
2780
|
+
state11()
|
|
2781
|
+
], GdsGroupedList.prototype, "_tStyles", 2);
|
|
2782
|
+
__decorateClass([
|
|
2783
|
+
property10()
|
|
2784
|
+
], GdsGroupedList.prototype, "label", 2);
|
|
2785
|
+
GdsGroupedList = __decorateClass([
|
|
2786
|
+
gdsCustomElement("gds-grouped-list")
|
|
2787
|
+
], GdsGroupedList);
|
|
2694
2788
|
export {
|
|
2695
2789
|
GdsContextMenu,
|
|
2696
2790
|
GdsDatepicker,
|
|
2697
2791
|
GdsDropdown,
|
|
2792
|
+
GdsGroupedList,
|
|
2698
2793
|
GdsMenuHeading,
|
|
2699
2794
|
GdsMenuItem,
|
|
2700
2795
|
GdsOption,
|
package/package.json
CHANGED
|
@@ -28,6 +28,14 @@ export declare class GdsCalendar extends GdsElement {
|
|
|
28
28
|
* The date that is currently focused.
|
|
29
29
|
*/
|
|
30
30
|
focusedDate: Date;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to disable weekends or not.
|
|
33
|
+
*/
|
|
34
|
+
disabledWeekends: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* An array of dates that should be disabled in the calendar.
|
|
37
|
+
*/
|
|
38
|
+
disabledDates?: Date[];
|
|
31
39
|
/**
|
|
32
40
|
* The month that is currently focused.
|
|
33
41
|
*/
|
|
@@ -43,6 +43,16 @@ export declare class GdsPopover extends GdsElement {
|
|
|
43
43
|
* By default, the popover maxWidth will be set to `auto` and will grow as needed.
|
|
44
44
|
*/
|
|
45
45
|
calcMaxWidth: (_referenceEl: HTMLElement) => string;
|
|
46
|
+
/**
|
|
47
|
+
* A callback that returns the minimum height of the popover.
|
|
48
|
+
* By default, the popover minHeight will be set to `auto`
|
|
49
|
+
*/
|
|
50
|
+
calcMinHeight: (referenceEl: HTMLElement) => string;
|
|
51
|
+
/**
|
|
52
|
+
* A callback that returns the maximum height of the popover.
|
|
53
|
+
* By default, the popover maxHeight will be set to a hard coded pixel value (check source).
|
|
54
|
+
*/
|
|
55
|
+
calcMaxHeight: (_referenceEl: HTMLElement) => string;
|
|
46
56
|
private _trigger;
|
|
47
57
|
private _isVirtKbVisible;
|
|
48
58
|
private _handleTriggerRefChanged;
|
package/transitional-styles.js
CHANGED
|
@@ -21,6 +21,12 @@ var listbox_trans_styles_default = `/**
|
|
|
21
21
|
* Use \`add-focus\` instead
|
|
22
22
|
*/
|
|
23
23
|
/** add background color, color and border-color to element when it has focus-visible i.e. tab focus */
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated in favor of Grouped list component
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated in favor of Grouped list component
|
|
29
|
+
*/
|
|
24
30
|
@layer base, reset, transitional-styles;
|
|
25
31
|
@layer transitional-styles {
|
|
26
32
|
:host {
|
|
@@ -3312,10 +3318,42 @@ function register6() {
|
|
|
3312
3318
|
TransitionalStyles.instance.register("gds-datepicker", datepicker_trans_styles_default.toString());
|
|
3313
3319
|
}
|
|
3314
3320
|
|
|
3321
|
+
// libs/core/src/components/grouped-list/grouped-list.trans.styles.scss
|
|
3322
|
+
var grouped_list_trans_styles_default = `@layer base, reset, transitional-styles;
|
|
3323
|
+
@layer transitional-styles {
|
|
3324
|
+
@layer _base, _overrides;
|
|
3325
|
+
:host {
|
|
3326
|
+
display: block;
|
|
3327
|
+
list-style: none;
|
|
3328
|
+
}
|
|
3329
|
+
@layer _base {
|
|
3330
|
+
.gds-list-heading {
|
|
3331
|
+
padding: 0.5rem 1rem;
|
|
3332
|
+
font-size: 0.875rem;
|
|
3333
|
+
font-weight: 500;
|
|
3334
|
+
background-color: var(--gds-ref-pallet-base200, #e9e9e9);
|
|
3335
|
+
}
|
|
3336
|
+
::slotted([gds-element=gds-list-item]) {
|
|
3337
|
+
all: revert;
|
|
3338
|
+
display: flex;
|
|
3339
|
+
gap: 0.25rem;
|
|
3340
|
+
justify-content: space-between;
|
|
3341
|
+
padding: 1rem;
|
|
3342
|
+
border-bottom: 1px solid var(--gds-ref-pallet-base200, #e9e9e9);
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3345
|
+
@layer _overrides {}
|
|
3346
|
+
}`;
|
|
3347
|
+
|
|
3348
|
+
// libs/core/src/components/grouped-list/grouped-list.trans.styles.ts
|
|
3349
|
+
function register7() {
|
|
3350
|
+
TransitionalStyles.instance.register("gds-grouped-list", grouped_list_trans_styles_default.toString());
|
|
3351
|
+
}
|
|
3352
|
+
|
|
3315
3353
|
// libs/core/src/utils/helpers/custom-element-scoping.ts
|
|
3316
3354
|
import { html as litHtml } from "lit";
|
|
3317
3355
|
import { customElement } from "lit/decorators.js";
|
|
3318
|
-
var VER_SUFFIX = "-
|
|
3356
|
+
var VER_SUFFIX = "-af766e";
|
|
3319
3357
|
var elementLookupTable = /* @__PURE__ */ new Map();
|
|
3320
3358
|
var templateCache = /* @__PURE__ */ new WeakMap();
|
|
3321
3359
|
function applyElementScoping(strings, ...values) {
|
|
@@ -3352,6 +3390,7 @@ var registerTransitionalStyles = () => {
|
|
|
3352
3390
|
register4();
|
|
3353
3391
|
register5();
|
|
3354
3392
|
register6();
|
|
3393
|
+
register7();
|
|
3355
3394
|
};
|
|
3356
3395
|
function supportsConstructedStylesheets() {
|
|
3357
3396
|
try {
|