@sebgroup/green-core 1.9.1 → 1.10.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 CHANGED
@@ -1,90 +1,33 @@
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>
1
+ <div align="center">
2
+ <img width="600" alt="green-core" src="https://github.com/sebgroup/green/assets/11420341/5d4b25fd-0633-498c-b50f-70f07c01ac16">
3
+ <h1>@sebgroup/green-core</h1>
4
+ <p>Green Core is a carefully crafted set of Web Components that lays the foundation for the Green Design System.</p>
5
+ </div>
9
6
 
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>
12
-
13
- ## Getting started
14
-
15
- If you are new to Green, checkout [@sebgroup/green-core](https://github.com/sebgroup/green/tree/main/libs/core).
16
-
17
- We also provide components for the following technologies:
18
-
19
- - [React](https://github.com/sebgroup/green/tree/main/libs/react)
20
- - [Angular](https://github.com/sebgroup/green/tree/main/libs/angular)
21
-
22
- If you're trying to find something specific, here's a full list of packages that we support!
23
-
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 |
34
-
35
- ## 📋 Table of content
36
-
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)
41
-
42
- ## 📚 Documentation
43
-
44
- Documentation currently resides in a few different locations:
45
-
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/)
51
-
52
- ## 🏦 Working from SEB
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.
55
-
56
- ## 🎉 Contribute
57
-
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)! 👀
59
-
60
- ## 🔨 Working locally with this repo
61
-
62
- ### Start Storybook locally
63
-
64
- To start Storybooks locally on your machine you run the following command:
7
+ ## Install
65
8
 
66
9
  ```bash
67
- npx nx run [PROJECT]:storybook
10
+ yarn install @sebgroup/green-core
11
+
12
+ # or use npm
13
+ npm install @sebgroup/green-core
68
14
  ```
69
15
 
70
- Where you replace `[PROJECT]` with a folder name from `green\libs`.
16
+ ## Use
71
17
 
72
- So to start Storybook for each component library run:
18
+ ```js
19
+ import { GdsButton } from '@sebgroup/green-core'
20
+ import { transitionalStyles } from '@sebgroup/green-core/transitional-styles'
73
21
 
74
- ```bash
75
- npx nx run chlorophyll:storybook
76
- npx nx run react:storybook
77
- npx nx run angular:storybook
22
+ //register transitional styles to get SEB's current visual design
23
+ transitionalStyles()
78
24
  ```
79
25
 
80
- If you install nx globally you can omit the npx above.
26
+ ```html
27
+ <!-- Then use the component in your html -->
28
+ <gds-button>Click me</gds-button>
29
+ ```
81
30
 
82
- ```bash
83
- # Install nx globally
84
- npm install nx -g
31
+ ## Documentation
85
32
 
86
- # And start the storybooks
87
- nx run chlorophyll:storybook
88
- nx run react:storybook
89
- nx run angular:storybook
90
- ```
33
+ Check out the [Storybook (@sebgroup/core)](https://sebgroup.github.io/green/latest/core/) for components and documentation.
@@ -0,0 +1,24 @@
1
+ /**
2
+ * This config can be used when using jest for testing an application that directly or
3
+ * indirectly (through green-react or green-angular) use the Green Core web components.
4
+ *
5
+ * The config includes the following:
6
+ * - `transformIgnorePatterns` to ignore transforming certain Green and Lit files
7
+ * - `setupFilesAfterEnv` that mocks some browser APIs that are used by the web components
8
+ */
9
+
10
+ module.exports = {
11
+ apply: (config) => {
12
+ config.transformIgnorePatterns = [
13
+ ...(config.transformIgnorePatterns || []),
14
+ 'node_modules/(?!.*.mjs$|@sebgroup/green-react|@sebgroup/extract|@sebgroup/green-core|lit-element|lit-html|lit|@lit|@lit-labs/)',
15
+ ]
16
+
17
+ config.setupFilesAfterEnv = [
18
+ ...(config.setupFilesAfterEnv || []),
19
+ __dirname + '/setup-jest.js',
20
+ ]
21
+
22
+ return config
23
+ },
24
+ }
package/index.js CHANGED
@@ -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 = "-260c87";
147
+ var VER_SUFFIX = "-4c1087";
148
148
  var elementLookupTable = /* @__PURE__ */ new Map();
149
149
  var gdsCustomElement = (tagName) => {
150
150
  if (globalThis.GDS_DISABLE_VERSIONED_ELEMENTS) {
@@ -1315,7 +1315,7 @@ var GdsDropdown = class extends GdsFormControlElement {
1315
1315
  this._handleValueChange();
1316
1316
  return;
1317
1317
  }
1318
- if (!this.value) {
1318
+ if (this.value === void 0) {
1319
1319
  if (this.placeholder)
1320
1320
  this.value = this.placeholder.value;
1321
1321
  else
@@ -2318,9 +2318,9 @@ var GdsDatepicker = class extends GdsFormControlElement {
2318
2318
  * The spinner state keeps track of the spinner values regardless of wheter a complete date has been enter yet.
2319
2319
  */
2320
2320
  __privateAdd(this, _spinnerState, {
2321
- year: "yyyy",
2322
- month: "mm",
2323
- day: "dd"
2321
+ year: "YYYY",
2322
+ month: "MM",
2323
+ day: "DD"
2324
2324
  });
2325
2325
  }
2326
2326
  get dateformat() {
@@ -2525,9 +2525,9 @@ var GdsDatepicker = class extends GdsFormControlElement {
2525
2525
  _handleValueChange() {
2526
2526
  if (!this.value) {
2527
2527
  __privateSet(this, _spinnerState, {
2528
- year: "yyyy",
2529
- month: "mm",
2530
- day: "dd"
2528
+ year: "YYYY",
2529
+ month: "MM",
2530
+ day: "DD"
2531
2531
  });
2532
2532
  return;
2533
2533
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sebgroup/green-core",
3
3
  "description": "A carefully crafted set of Web Components, laying the foundation of the Green Design System.",
4
- "version": "1.9.1",
4
+ "version": "1.10.0",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
7
7
  "type": "module",
@@ -40,6 +40,9 @@
40
40
  "./localization": {
41
41
  "types": "./localization.d.ts",
42
42
  "default": "./localization.js"
43
+ },
44
+ "./jest-config": {
45
+ "default": "./green-jest-config.cjs"
43
46
  }
44
47
  }
45
48
  }
package/setup-jest.js ADDED
@@ -0,0 +1,34 @@
1
+ global.CSSStyleSheet = function () {}
2
+ global.CSSStyleSheet.prototype.replaceSync = (k) => false
3
+
4
+ global.HTMLElement.prototype.attachInternals = () => {
5
+ return new global.ElementInternals()
6
+ }
7
+
8
+ global.ElementInternals = function () {}
9
+ global.ElementInternals.prototype.setValidity = () => {}
10
+ global.ElementInternals.prototype.setFormValue = () => {}
11
+
12
+ window.matchMedia = () => {
13
+ return {
14
+ matches: false,
15
+ addEventListener: () => {},
16
+ removeEventListener: () => {},
17
+ }
18
+ }
19
+
20
+ global.HTMLElement.prototype.close = () => {}
21
+
22
+ Object.defineProperty(window, 'matchMedia', {
23
+ writable: true,
24
+ value: jest.fn().mockImplementation((query) => ({
25
+ matches: false,
26
+ media: query,
27
+ onchange: null,
28
+ addListener: jest.fn(), // deprecated
29
+ removeListener: jest.fn(), // deprecated
30
+ addEventListener: jest.fn(),
31
+ removeEventListener: jest.fn(),
32
+ dispatchEvent: jest.fn(),
33
+ })),
34
+ })
@@ -662,6 +662,7 @@ button[type=button]:where(:not(.primary,
662
662
  button[type=reset]:where(:not(.primary, .tertiary, .ghost, .danger, .close, .link)):disabled,
663
663
  button[type=reset]:where(:not(.primary, .tertiary, .ghost, .danger, .close, .link)).disabled,
664
664
  button[type=reset]:where(:not(.primary, .tertiary, .ghost, .danger, .close, .link))[aria-disabled=true] {
665
+ background: var(--sg-form-control-bg-disabled) !important;
665
666
  color: var(--text-disabled-color) !important;
666
667
  border-color: var(--border-disabled-color) !important;
667
668
  cursor: not-allowed;
@@ -1000,6 +1001,7 @@ button.tertiary[aria-disabled=true],
1000
1001
  a.button.tertiary:disabled,
1001
1002
  a.button.tertiary.disabled,
1002
1003
  a.button.tertiary[aria-disabled=true] {
1004
+ background: var(--sg-form-control-bg-disabled) !important;
1003
1005
  color: var(--text-disabled-color) !important;
1004
1006
  border-color: var(--border-disabled-color) !important;
1005
1007
  cursor: not-allowed;
@@ -2577,6 +2579,7 @@ var dropdown_trans_styles_default = `/**
2577
2579
  border-color: rgb(0, 122, 199);
2578
2580
  }
2579
2581
  button:disabled, button.disabled, button[aria-disabled=true] {
2582
+ background: var(--sg-form-control-bg-disabled) !important;
2580
2583
  color: var(--text-disabled-color) !important;
2581
2584
  border-color: var(--border-disabled-color) !important;
2582
2585
  cursor: not-allowed;
@@ -2697,6 +2700,10 @@ i.sg-icon.sg-icon-ellipsis::before {
2697
2700
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3C!--! Font Awesome Pro 6.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc.--%3E%3Cpath d='M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z'/%3E%3C/svg%3E");
2698
2701
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3C!--! Font Awesome Pro 6.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc.--%3E%3Cpath d='M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z'/%3E%3C/svg%3E");
2699
2702
  }
2703
+ i.sg-icon.sg-icon-grip-vertical::before {
2704
+ -webkit-mask-image: url("data:image/svg+xml, %3Csvg height='1em' viewBox='0 0 320 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M40 352l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40zm192 0l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40zM40 320c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0zM232 192l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40zM40 160c-22.1 0-40-17.9-40-40L0 72C0 49.9 17.9 32 40 32l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0zM232 32l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40z' /%3E%3C/svg%3E");
2705
+ mask-image: url("data:image/svg+xml, %3Csvg height='1em' viewBox='0 0 320 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M40 352l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40zm192 0l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40zM40 320c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0zM232 192l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40zM40 160c-22.1 0-40-17.9-40-40L0 72C0 49.9 17.9 32 40 32l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0zM232 32l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40z' /%3E%3C/svg%3E");
2706
+ }
2700
2707
  i.sg-icon.sg-icon-next::before {
2701
2708
  background: none;
2702
2709
  border-bottom: 2px solid;
@@ -3032,6 +3039,10 @@ i.sg-icon.sg-icon-ellipsis::before {
3032
3039
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3C!--! Font Awesome Pro 6.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc.--%3E%3Cpath d='M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z'/%3E%3C/svg%3E");
3033
3040
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3C!--! Font Awesome Pro 6.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc.--%3E%3Cpath d='M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z'/%3E%3C/svg%3E");
3034
3041
  }
3042
+ i.sg-icon.sg-icon-grip-vertical::before {
3043
+ -webkit-mask-image: url("data:image/svg+xml, %3Csvg height='1em' viewBox='0 0 320 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M40 352l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40zm192 0l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40zM40 320c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0zM232 192l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40zM40 160c-22.1 0-40-17.9-40-40L0 72C0 49.9 17.9 32 40 32l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0zM232 32l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40z' /%3E%3C/svg%3E");
3044
+ mask-image: url("data:image/svg+xml, %3Csvg height='1em' viewBox='0 0 320 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M40 352l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40zm192 0l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40zM40 320c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0zM232 192l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40zM40 160c-22.1 0-40-17.9-40-40L0 72C0 49.9 17.9 32 40 32l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0zM232 32l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40z' /%3E%3C/svg%3E");
3045
+ }
3035
3046
  i.sg-icon.sg-icon-next::before {
3036
3047
  background: none;
3037
3048
  border-bottom: 2px solid;
@@ -3355,7 +3366,7 @@ function register7() {
3355
3366
  // libs/core/src/utils/helpers/custom-element-scoping.ts
3356
3367
  import { html as litHtml } from "lit";
3357
3368
  import { customElement } from "lit/decorators.js";
3358
- var VER_SUFFIX = "-260c87";
3369
+ var VER_SUFFIX = "-4c1087";
3359
3370
  var elementLookupTable = /* @__PURE__ */ new Map();
3360
3371
  var templateCache = /* @__PURE__ */ new WeakMap();
3361
3372
  function applyElementScoping(strings, ...values) {