@sebgroup/green-core 3.5.1 → 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.
Files changed (36) hide show
  1. package/components/checkbox/checkbox.component.js +12 -2
  2. package/components/form/form-control.d.ts +6 -0
  3. package/components/form/form-control.js +8 -0
  4. package/components/index.d.ts +1 -0
  5. package/components/index.js +1 -0
  6. package/components/switch/index.d.ts +1 -0
  7. package/components/switch/index.js +1 -0
  8. package/components/switch/switch.component.d.ts +44 -0
  9. package/components/switch/switch.component.js +185 -0
  10. package/components/switch/switch.d.ts +2 -0
  11. package/components/switch/switch.js +6 -0
  12. package/components/switch/switch.styles.d.ts +1 -0
  13. package/components/switch/switch.styles.js +239 -0
  14. package/custom-elements.json +73286 -72191
  15. package/gds-element.js +1 -1
  16. package/generated/mcp/components.json +14 -1
  17. package/generated/mcp/icons.json +1 -1
  18. package/generated/mcp/index.json +1 -1
  19. package/generated/mcp/switch/angular.md +24 -0
  20. package/generated/mcp/switch/api.md +56 -0
  21. package/generated/mcp/switch/guidelines.md +35 -0
  22. package/generated/mcp/switch/index.json +9 -0
  23. package/generated/mcp/switch/react.md +24 -0
  24. package/generated/mcp/tokens.json +1 -1
  25. package/generated/react/index.d.ts +1 -0
  26. package/generated/react/index.js +1 -0
  27. package/generated/react/input/index.d.ts +1 -1
  28. package/generated/react/switch/index.d.ts +701 -0
  29. package/generated/react/switch/index.js +24 -0
  30. package/generated/react/textarea/index.d.ts +1 -1
  31. package/package.json +3 -1
  32. package/pure.d.ts +1 -0
  33. package/pure.js +1 -0
  34. package/utils/helpers/component-meta.d.ts +1 -0
  35. package/utils/helpers/component-meta.js +5 -4
  36. 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.5.1";
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-24T13:51:13.604Z",
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",
@@ -1,5 +1,5 @@
1
1
  {
2
- "generatedAt": "2026-04-24T13:51:13.604Z",
2
+ "generatedAt": "2026-04-28T12:37:25.805Z",
3
3
  "icons": [
4
4
  {
5
5
  "name": "gds-icon-ai",
@@ -1,5 +1,5 @@
1
1
  {
2
- "generatedAt": "2026-04-24T13:51:13.604Z",
2
+ "generatedAt": "2026-04-28T12:37:25.805Z",
3
3
  "instructions": "./INSTRUCTIONS.md",
4
4
  "components": "./components.json",
5
5
  "icons": "./icons.json",
@@ -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,9 @@
1
+ {
2
+ "name": "gds-switch",
3
+ "files": {
4
+ "api": "api.md",
5
+ "guidelines": "guidelines.md",
6
+ "angular": "angular.md",
7
+ "react": "react.md"
8
+ }
9
+ }
@@ -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,5 +1,5 @@
1
1
  {
2
- "generatedAt": "2026-04-24T13:51:12.719Z",
2
+ "generatedAt": "2026-04-28T12:37:25.720Z",
3
3
  "categories": {
4
4
  "space": {
5
5
  "description": "Spacing tokens for padding, margin, gap, and other spacing",
@@ -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';
@@ -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" | "off" | "on" | "sentences" | "words" | "characters" | undefined;
46
+ autocapitalize?: "none" | "on" | "off" | "sentences" | "words" | "characters" | undefined;
47
47
  autocorrect?: boolean | undefined;
48
48
  autocomplete?: string | undefined;
49
49
  autofocus?: boolean | undefined;