@sebgroup/green-core 3.5.0 → 3.6.2
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/components/checkbox/checkbox.component.js +12 -2
- package/components/dialog/dialog.component.js +5 -3
- package/components/form/form-control.d.ts +6 -0
- package/components/form/form-control.js +8 -0
- package/components/index.d.ts +1 -0
- package/components/index.js +1 -0
- package/components/segmented-control/segmented-control.component.js +9 -4
- package/components/switch/index.d.ts +1 -0
- package/components/switch/index.js +1 -0
- package/components/switch/switch.component.d.ts +44 -0
- package/components/switch/switch.component.js +185 -0
- package/components/switch/switch.d.ts +2 -0
- package/components/switch/switch.js +6 -0
- package/components/switch/switch.styles.d.ts +1 -0
- package/components/switch/switch.styles.js +239 -0
- package/custom-elements.json +30103 -29008
- package/gds-element.js +1 -1
- package/generated/mcp/components.json +14 -1
- package/generated/mcp/form-summary/guidelines.md +6 -2
- package/generated/mcp/icons.json +1 -1
- package/generated/mcp/index.json +1 -1
- package/generated/mcp/pagination/guidelines.md +16 -6
- package/generated/mcp/switch/angular.md +24 -0
- package/generated/mcp/switch/api.md +56 -0
- package/generated/mcp/switch/guidelines.md +35 -0
- package/generated/mcp/switch/index.json +9 -0
- package/generated/mcp/switch/react.md +24 -0
- package/generated/mcp/tokens.json +1 -1
- package/generated/react/index.d.ts +2 -1
- package/generated/react/index.js +2 -1
- package/generated/react/input/index.d.ts +1 -1
- package/generated/react/switch/index.d.ts +701 -0
- package/generated/react/switch/index.js +24 -0
- package/generated/react/textarea/index.d.ts +1 -1
- package/package.json +3 -1
- package/pure.d.ts +1 -0
- package/pure.js +1 -0
- package/utils/helpers/component-meta.d.ts +1 -0
- package/utils/helpers/component-meta.js +5 -4
- package/utils/helpers/custom-element-scoping.js +1 -1
package/gds-element.js
CHANGED
|
@@ -16,7 +16,7 @@ class GdsElement extends LitElement {
|
|
|
16
16
|
/**
|
|
17
17
|
* The semantic version of this element. Can be used for troubleshooting to verify the version being used.
|
|
18
18
|
*/
|
|
19
|
-
this.semanticVersion = "3.
|
|
19
|
+
this.semanticVersion = "3.6.2";
|
|
20
20
|
this.syncFirstRender = false;
|
|
21
21
|
this._isUsingTransitionalStyles = false;
|
|
22
22
|
this._dynamicStylesController = new DynamicStylesController(this);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generatedAt": "2026-04-
|
|
2
|
+
"generatedAt": "2026-04-28T12:37:25.805Z",
|
|
3
3
|
"components": [
|
|
4
4
|
{
|
|
5
5
|
"name": "gds-alert",
|
|
@@ -700,6 +700,19 @@
|
|
|
700
700
|
"react"
|
|
701
701
|
]
|
|
702
702
|
},
|
|
703
|
+
{
|
|
704
|
+
"name": "gds-switch",
|
|
705
|
+
"tagName": "gds-switch",
|
|
706
|
+
"className": "GdsSwitch",
|
|
707
|
+
"description": "",
|
|
708
|
+
"path": "switch/",
|
|
709
|
+
"files": [
|
|
710
|
+
"api",
|
|
711
|
+
"guidelines",
|
|
712
|
+
"angular",
|
|
713
|
+
"react"
|
|
714
|
+
]
|
|
715
|
+
},
|
|
703
716
|
{
|
|
704
717
|
"name": "gds-table",
|
|
705
718
|
"tagName": "gds-table",
|
|
@@ -9,11 +9,15 @@ Form summary shows all form errors in one place.
|
|
|
9
9
|
|
|
10
10
|
Form summary works automatically when placed in a form with form controls from Green Core. It has two update modes, `default` and `reactive`. In the default mode, a `refresh()` method needs to be called for the component to update and reflect the current state of the form. In the `reactive` mode, it will update on the fly as soon as the status of a control in the form changes. The `reactive` mode requires less setup to use, but the `default` mode allows for more control over the behavior.
|
|
11
11
|
|
|
12
|
-
####
|
|
12
|
+
#### Fieldset labels
|
|
13
|
+
|
|
14
|
+
To reflect the structure of the form, the summary content can be grouped using fieldset labels. These act as headings for related fields and help users quickly understand how the information is organized. By mirroring the same grouping as in the form, it becomes easier to recognize and review the content, improving both clarity and confidence before submission.
|
|
15
|
+
|
|
16
|
+
### Accessibility
|
|
13
17
|
|
|
14
18
|
Semantically, the form summary is represented as a navigation region containing an unordered list of links.
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
### Compatibility
|
|
17
21
|
|
|
18
22
|
Form summary is mainly intended for use with form controls from Green Core, but it also works with generic native form controls by using data-attributes.
|
|
19
23
|
|
package/generated/mcp/icons.json
CHANGED
package/generated/mcp/index.json
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
# Pagination
|
|
2
2
|
|
|
3
|
-
Pagination helps users navigate large result sets by dividing content into clear, manageable pages.
|
|
3
|
+
Pagination helps users navigate large result sets by dividing content into clear, manageable pages.
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
## Overview
|
|
7
7
|
|
|
8
8
|
### Usage
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
Pagination is used to divide large amounts of content into smaller pages, making it easier to navigate and understand a dataset. It is most useful when content cannot be displayed at once, or when users need to move through information in a defined order.
|
|
11
|
+
|
|
12
|
+
Use pagination when it improves readability and control, for example in tables or long lists, search results, or content listings. Avoid using pagination for small datasets or when continuous scrolling provides a better experience.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Behaviour
|
|
17
|
+
|
|
18
|
+
Pagination should clearly indicate the current page and keep navigation consistent and predictable. Unavailable actions should be disabled at the start or end of the page range. When used with data tables, the item range and total number of items should be displayed.
|
|
19
|
+
|
|
20
|
+
### Accessibility
|
|
21
|
+
|
|
22
|
+
Pagination should use a semantic navigation structure and ensure that all controls are keyboard accessible. The current page should be communicated programmatically, and visual styling alone should not be relied on to convey state.
|
|
23
|
+
|
|
24
|
+
### Do's and don'ts
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# gds-switch - Angular
|
|
2
|
+
|
|
3
|
+
## Import
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import { GdsSwitchComponent } from '@sebgroup/green-core-ng'
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
Use the component in your Angular templates:
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<gds-switch></gds-switch>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Event Handling
|
|
18
|
+
|
|
19
|
+
Events are emitted using Angular output syntax. Event names are converted from kebab-case to camelCase:
|
|
20
|
+
|
|
21
|
+
| Web Component Event | Angular Output | Handler Example |
|
|
22
|
+
|---------------------|----------------|-----------------|
|
|
23
|
+
| `input` | `input` | `(input)="handler($event)"` |
|
|
24
|
+
| `change` | `change` | `(change)="handler($event)"` |
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# gds-switch
|
|
2
|
+
|
|
3
|
+
**Class**: `GdsSwitch`
|
|
4
|
+
|
|
5
|
+
**Tag**: `<gds-switch>`
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Properties
|
|
9
|
+
|
|
10
|
+
> Some properties accept design token names. Use `get_tokens` with the appropriate category to discover valid token names and their resolved values.
|
|
11
|
+
|
|
12
|
+
| Name | Type | Default | Description |
|
|
13
|
+
|------|------|---------|-------------|
|
|
14
|
+
| `'align-self'` | `string \| undefined` | `-` | Style Expression Property that controls the `align-self` property. Supports all valid CSS `align-self` values. |
|
|
15
|
+
| `'justify-self'` | `string \| undefined` | `-` | Style Expression Property that controls the `justify-self` property. Supports all valid CSS `justify-self` values. |
|
|
16
|
+
| `'place-self'` | `string \| undefined` | `-` | Style Expression Property that controls the `place-self` property. Supports all valid CSS `place-self` values. |
|
|
17
|
+
| `'grid-column'` | `string \| undefined` | `-` | Style Expression Property that controls the `grid-column` property. Supports all valid CSS grid-column values. Documentation: https://developer.mozilla.org/en-US/docs/Web/CSS/grid-column |
|
|
18
|
+
| `'grid-row'` | `string \| undefined` | `-` | Style Expression Property that controls the `grid-row` property. Supports all valid CSS `grid-row` values. |
|
|
19
|
+
| `'grid-area'` | `string \| undefined` | `-` | Style Expression Property that controls the `grid-area` property. Supports all valid CSS `grid-area` values. |
|
|
20
|
+
| `flex` | `string \| undefined` | `-` | Style Expression Property that controls the `flex` property. Supports all valid CSS `flex` values. |
|
|
21
|
+
| `order` | `string \| undefined` | `-` | Style Expression Property that controls the `order` property. Supports all valid CSS `order` values. |
|
|
22
|
+
| `margin` | `string \| undefined` | `-` | Style Expression Property that controls the `margin` property. Only accepts space tokens. |
|
|
23
|
+
| `'margin-inline'` | `string \| undefined` | `-` | Style Expression Property that controls the `margin-inline` property. Only accepts space tokens. |
|
|
24
|
+
| `'margin-block'` | `string \| undefined` | `-` | Style Expression Property that controls the `margin-block` property. Only accepts space tokens. |
|
|
25
|
+
| `width` | `string \| undefined` | `-` | Style Expression Property that controls the `width` property. Supports space tokens and all valid CSS `width` values. |
|
|
26
|
+
| `'min-width'` | `string \| undefined` | `-` | Style Expression Property that controls the `min-width` property. Supports space tokens and all valid CSS `min-width` values. |
|
|
27
|
+
| `'max-width'` | `string \| undefined` | `-` | Style Expression Property that controls the `max-width` property. Supports space tokens and all valid CSS `max-width` values. |
|
|
28
|
+
| `'inline-size'` | `string \| undefined` | `-` | Style Expression Property that controls the `inline-size` property. Supports space tokens and all valid CSS `inline-size` values |
|
|
29
|
+
| `'min-inline-size'` | `string \| undefined` | `-` | Style Expression Property that controls the `min-inline-size` property. Supports space tokens and all valid CSS `min-inline-size` values. |
|
|
30
|
+
| `'max-inline-size'` | `string \| undefined` | `-` | Style Expression Property that controls the `max-inline-size` property. Supports space tokens and all valid CSS `max-inline-size` values. |
|
|
31
|
+
| `checked` | `boolean` | `-` | The checked state of the switch. |
|
|
32
|
+
| `controlPlacement` | `'start' \| 'end'` | `-` | Controls where the control is placed relative to the label. |
|
|
33
|
+
| `size` | `'large' \| 'small'` | `-` | Controls text and control sizing. |
|
|
34
|
+
| `'justify-content'` | `string` | `-` | Controls horizontal distribution of label and control. |
|
|
35
|
+
| `value` | `string` | `-` | The value submitted with the form when the switch is checked. Defaults to 'on', matching native checkbox behaviour. |
|
|
36
|
+
| `validator` | `GdsValidator \| undefined` | `-` | A validator that can be used to validate the form control and set an error message. |
|
|
37
|
+
| `required` | `boolean` | `-` | The required attribute can be used to communicate to users of assistive technology that the control is required. Validation still needs to be done in a validator or equivalent. |
|
|
38
|
+
| `errorMessage` | `string` | `-` | This can be used to manually control the error message that will be displayed when the control is invalid. |
|
|
39
|
+
| `invalid` | `any` | `-` | Validation state of the form control. Setting this to true triggers the invalid state of the control. |
|
|
40
|
+
| `label` | `string` | `-` | The label of the form control. |
|
|
41
|
+
| `name` | `string` | `-` | |
|
|
42
|
+
| `disabled` | `boolean` | `-` | If the input is Disabled |
|
|
43
|
+
| `syncFirstRender` | `boolean` | `-` | Force the element to perform a synchronous first render and apply style expression properties in `connectedCallback`. This guarantees that the child DOM always remains projected in DOM, since the element will attach the shadowRoot and run the first render pass in the same event loop cycle, and that declarative layout will be applied once slotted DOM is projected. Note: This will cause the first render pass to be blocking. Use sparingly and only when necessary, such as when the element needs to be measured synchronously after being added to the DOM. |
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## Events
|
|
47
|
+
|
|
48
|
+
| Name | Type | Description |
|
|
49
|
+
|------|------|-------------|
|
|
50
|
+
| `input` | `InputEvent` | Dispatched when the checked state changes. |
|
|
51
|
+
| `change` | `Event` | Dispatched when the checked state changes. |
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## Form Control
|
|
55
|
+
|
|
56
|
+
This component is a form control and inherits form-related properties and methods.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Switch
|
|
2
|
+
|
|
3
|
+
A toggle lets users switch a setting on or off.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
### Behaviour
|
|
9
|
+
|
|
10
|
+
Changing the toggle updates the state immediately. The current state should always be clear to the user, and the component should provide feedback for different interaction states such as hover, focus, pressed, and disabled.
|
|
11
|
+
|
|
12
|
+
### Size
|
|
13
|
+
|
|
14
|
+
The toggle is available in two sizes: default and small. The small size should only be used in compact views where space is limited, such as dense layouts or smaller components.
|
|
15
|
+
|
|
16
|
+
### Label
|
|
17
|
+
|
|
18
|
+
Labels describe the setting, not the state. They should be short and specific, remain clear in both on and off states, and not require additional context to understand.
|
|
19
|
+
|
|
20
|
+
For example, use labels like “Email notifications”, “Show balance”, or “Enable dark mode”. Avoid labels such as “On / Off”, “Active”, or “Enabled”, as they do not clearly communicate what the toggle controls.
|
|
21
|
+
|
|
22
|
+
### Accessibility
|
|
23
|
+
|
|
24
|
+
A toggle must have a visible and persistent label and communicate its state programmatically as on or off. It should be operable via keyboard and include a visible focus indicator. The state should not rely on color alone to be understood, and the component must meet contrast requirements in all states.
|
|
25
|
+
|
|
26
|
+
### Do's and Don'ts
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## UX Guidelines
|
|
30
|
+
|
|
31
|
+
### Writing UX text for toggle
|
|
32
|
+
|
|
33
|
+
### Keep labels short
|
|
34
|
+
|
|
35
|
+
### Provide context where needed
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# gds-switch - React
|
|
2
|
+
|
|
3
|
+
## Import
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import { GdsSwitch } from '@sebgroup/green-core/react'
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
Use the component as a React JSX element:
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<GdsSwitch />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Event Handling
|
|
18
|
+
|
|
19
|
+
Events are handled using React event handler props. Event names are converted from kebab-case to camelCase with an "on" prefix:
|
|
20
|
+
|
|
21
|
+
| Web Component Event | React Handler Prop | Handler Example |
|
|
22
|
+
|---------------------|--------------------|-----------------|
|
|
23
|
+
| `input` | `onInput` | `onInput={handler}` |
|
|
24
|
+
| `change` | `onChange` | `onChange={handler}` |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './alert/index.js';
|
|
2
|
-
export * from './badge/index.js';
|
|
3
2
|
export * from './blur/index.js';
|
|
3
|
+
export * from './badge/index.js';
|
|
4
4
|
export * from './breadcrumbs/index.js';
|
|
5
5
|
export * from './button/index.js';
|
|
6
6
|
export * from './calendar/index.js';
|
|
@@ -36,6 +36,7 @@ export * from './segmented-control/index.js';
|
|
|
36
36
|
export * from './select/index.js';
|
|
37
37
|
export * from './signal/index.js';
|
|
38
38
|
export * from './spinner/index.js';
|
|
39
|
+
export * from './switch/index.js';
|
|
39
40
|
export * from './table/index.js';
|
|
40
41
|
export * from './text/index.js';
|
|
41
42
|
export * from './textarea/index.js';
|
package/generated/react/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./alert/index.js";
|
|
2
|
-
export * from "./badge/index.js";
|
|
3
2
|
export * from "./blur/index.js";
|
|
3
|
+
export * from "./badge/index.js";
|
|
4
4
|
export * from "./breadcrumbs/index.js";
|
|
5
5
|
export * from "./button/index.js";
|
|
6
6
|
export * from "./calendar/index.js";
|
|
@@ -36,6 +36,7 @@ export * from "./segmented-control/index.js";
|
|
|
36
36
|
export * from "./select/index.js";
|
|
37
37
|
export * from "./signal/index.js";
|
|
38
38
|
export * from "./spinner/index.js";
|
|
39
|
+
export * from "./switch/index.js";
|
|
39
40
|
export * from "./table/index.js";
|
|
40
41
|
export * from "./text/index.js";
|
|
41
42
|
export * from "./textarea/index.js";
|
|
@@ -43,7 +43,7 @@ export declare const GdsInput: {
|
|
|
43
43
|
min?: (number | string) | undefined;
|
|
44
44
|
max?: (number | string) | undefined;
|
|
45
45
|
step?: (number | "any") | undefined;
|
|
46
|
-
autocapitalize?: "none" | "
|
|
46
|
+
autocapitalize?: "none" | "on" | "off" | "sentences" | "words" | "characters" | undefined;
|
|
47
47
|
autocorrect?: boolean | undefined;
|
|
48
48
|
autocomplete?: string | undefined;
|
|
49
49
|
autofocus?: boolean | undefined;
|