@sebgroup/green-core 1.7.0 → 1.8.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/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 +55 -3
- package/package.json +1 -1
- 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/react)
|
|
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!
|
|
@@ -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 = "-3d880b";
|
|
148
148
|
var elementLookupTable = /* @__PURE__ */ new Map();
|
|
149
149
|
var gdsCustomElement = (tagName) => {
|
|
150
150
|
if (globalThis.GDS_DISABLE_VERSIONED_ELEMENTS) {
|
|
@@ -2691,10 +2691,62 @@ __decorateClass([
|
|
|
2691
2691
|
GdsDatepicker = __decorateClass([
|
|
2692
2692
|
gdsCustomElement("gds-datepicker")
|
|
2693
2693
|
], GdsDatepicker);
|
|
2694
|
+
|
|
2695
|
+
// libs/core/src/components/grouped-list/grouped-list.ts
|
|
2696
|
+
import { state as state11, property as property10 } from "lit/decorators.js";
|
|
2697
|
+
import { when as when5 } from "lit/directives/when.js";
|
|
2698
|
+
|
|
2699
|
+
// libs/core/src/components/grouped-list/list-item.ts
|
|
2700
|
+
var GdsListItem = class extends GdsElement {
|
|
2701
|
+
connectedCallback() {
|
|
2702
|
+
super.connectedCallback();
|
|
2703
|
+
this.setAttribute("role", "listitem");
|
|
2704
|
+
}
|
|
2705
|
+
render() {
|
|
2706
|
+
return html`<slot></slot>`;
|
|
2707
|
+
}
|
|
2708
|
+
};
|
|
2709
|
+
GdsListItem = __decorateClass([
|
|
2710
|
+
gdsCustomElement("gds-list-item")
|
|
2711
|
+
], GdsListItem);
|
|
2712
|
+
|
|
2713
|
+
// libs/core/src/components/grouped-list/grouped-list.ts
|
|
2714
|
+
var GdsGroupedList = class extends GdsElement {
|
|
2715
|
+
constructor() {
|
|
2716
|
+
super(...arguments);
|
|
2717
|
+
this.label = "";
|
|
2718
|
+
}
|
|
2719
|
+
connectedCallback() {
|
|
2720
|
+
super.connectedCallback();
|
|
2721
|
+
constrainSlots(this);
|
|
2722
|
+
TransitionalStyles.instance.apply(this, "gds-grouped-list");
|
|
2723
|
+
}
|
|
2724
|
+
render() {
|
|
2725
|
+
return html`${this._tStyles}${when5(
|
|
2726
|
+
this.label,
|
|
2727
|
+
() => html`<div class="gds-list-heading" aria-hidden="true" id="label">
|
|
2728
|
+
${this.label}
|
|
2729
|
+
</div>`
|
|
2730
|
+
)}
|
|
2731
|
+
<div role="list" aria-labelledby="label">
|
|
2732
|
+
<slot gds-allow="gds-list-item"></slot>
|
|
2733
|
+
</div>`;
|
|
2734
|
+
}
|
|
2735
|
+
};
|
|
2736
|
+
__decorateClass([
|
|
2737
|
+
state11()
|
|
2738
|
+
], GdsGroupedList.prototype, "_tStyles", 2);
|
|
2739
|
+
__decorateClass([
|
|
2740
|
+
property10()
|
|
2741
|
+
], GdsGroupedList.prototype, "label", 2);
|
|
2742
|
+
GdsGroupedList = __decorateClass([
|
|
2743
|
+
gdsCustomElement("gds-grouped-list")
|
|
2744
|
+
], GdsGroupedList);
|
|
2694
2745
|
export {
|
|
2695
2746
|
GdsContextMenu,
|
|
2696
2747
|
GdsDatepicker,
|
|
2697
2748
|
GdsDropdown,
|
|
2749
|
+
GdsGroupedList,
|
|
2698
2750
|
GdsMenuHeading,
|
|
2699
2751
|
GdsMenuItem,
|
|
2700
2752
|
GdsOption,
|
package/package.json
CHANGED
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 = "-3d880b";
|
|
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 {
|