@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
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "../../../chunks/chunk.CAV4X6PU.js";
|
|
2
|
+
import { createElement, useRef } from "react";
|
|
3
|
+
import { GdsSwitch as GdsSwitchClass } from "../../../components/switch/switch.component.js";
|
|
4
|
+
import { getReactComponent, useControlledChecked } from "../../../utils/react.js";
|
|
5
|
+
const GdsSwitch = (props) => {
|
|
6
|
+
GdsSwitchClass.define();
|
|
7
|
+
const JSXElement = getReactComponent("gds-switch");
|
|
8
|
+
const internalRef = useRef(null);
|
|
9
|
+
const ref = props.ref || internalRef;
|
|
10
|
+
useControlledChecked(
|
|
11
|
+
ref,
|
|
12
|
+
props.checked,
|
|
13
|
+
props.defaultChecked,
|
|
14
|
+
props.onChange,
|
|
15
|
+
props.onInput
|
|
16
|
+
);
|
|
17
|
+
const { onChange, onInput, ref: _ref, ...restProps } = props;
|
|
18
|
+
const propsWithClass = { ...restProps, class: props.className, ref };
|
|
19
|
+
return createElement(JSXElement, propsWithClass);
|
|
20
|
+
};
|
|
21
|
+
GdsSwitch.displayName = "GdsSwitch";
|
|
22
|
+
export {
|
|
23
|
+
GdsSwitch
|
|
24
|
+
};
|
|
@@ -41,7 +41,7 @@ export declare const GdsTextarea: {
|
|
|
41
41
|
maxlength?: number | undefined;
|
|
42
42
|
size?: "small" | "large" | undefined;
|
|
43
43
|
plain?: boolean | undefined;
|
|
44
|
-
autocapitalize?: "none" | "
|
|
44
|
+
autocapitalize?: "none" | "on" | "off" | "sentences" | "words" | "characters" | undefined;
|
|
45
45
|
autocorrect?: boolean | undefined;
|
|
46
46
|
autocomplete?: string | undefined;
|
|
47
47
|
autofocus?: boolean | undefined;
|
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": "3.
|
|
4
|
+
"version": "3.6.2",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
7
7
|
"type": "module",
|
|
@@ -77,6 +77,8 @@
|
|
|
77
77
|
"./components/table/table.js",
|
|
78
78
|
"./components/table/table.imports.js",
|
|
79
79
|
"./components/table/index.js",
|
|
80
|
+
"./components/switch/switch.js",
|
|
81
|
+
"./components/switch/index.js",
|
|
80
82
|
"./components/spinner/spinner.js",
|
|
81
83
|
"./components/spinner/index.js",
|
|
82
84
|
"./components/signal/signal.js",
|
package/pure.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export * from './components/sensitive/account/sensitive-account.component';
|
|
|
45
45
|
export * from './components/select/select.component';
|
|
46
46
|
export * from './components/signal/signal.component';
|
|
47
47
|
export * from './components/spinner/spinner.component';
|
|
48
|
+
export * from './components/switch/switch.component';
|
|
48
49
|
export * from './components/text/text.component';
|
|
49
50
|
export * from './components/table/table.component';
|
|
50
51
|
export * from './components/textarea/textarea.component';
|
package/pure.js
CHANGED
|
@@ -45,6 +45,7 @@ export * from "./components/sensitive/account/sensitive-account.component.js";
|
|
|
45
45
|
export * from "./components/select/select.component.js";
|
|
46
46
|
export * from "./components/signal/signal.component.js";
|
|
47
47
|
export * from "./components/spinner/spinner.component.js";
|
|
48
|
+
export * from "./components/switch/switch.component.js";
|
|
48
49
|
export * from "./components/text/text.component.js";
|
|
49
50
|
export * from "./components/table/table.component.js";
|
|
50
51
|
export * from "./components/textarea/textarea.component.js";
|
|
@@ -42,6 +42,7 @@ export declare class CemParser {
|
|
|
42
42
|
/**
|
|
43
43
|
* Checks if a component is a checkbox by checking the tag name
|
|
44
44
|
* Checkboxes need special handling to work with boolean checked state instead of string values
|
|
45
|
+
* This also applies to switch, which uses `checked` (boolean) instead of `value` (string)
|
|
45
46
|
*/
|
|
46
47
|
private static isCheckboxComponent;
|
|
47
48
|
/**
|
|
@@ -84,9 +84,10 @@ class CemParser {
|
|
|
84
84
|
/**
|
|
85
85
|
* Checks if a component is a checkbox by checking the tag name
|
|
86
86
|
* Checkboxes need special handling to work with boolean checked state instead of string values
|
|
87
|
+
* This also applies to switch, which uses `checked` (boolean) instead of `value` (string)
|
|
87
88
|
*/
|
|
88
89
|
static isCheckboxComponent(tagName) {
|
|
89
|
-
return tagName === "gds-checkbox";
|
|
90
|
+
return tagName === "gds-checkbox" || tagName === "gds-switch";
|
|
90
91
|
}
|
|
91
92
|
/**
|
|
92
93
|
* Extracts properties
|
|
@@ -223,15 +224,15 @@ class CemParser {
|
|
|
223
224
|
}
|
|
224
225
|
/**
|
|
225
226
|
* Finds primitives that are re-exported by component modules.
|
|
226
|
-
*
|
|
227
|
+
*
|
|
227
228
|
* Primitives (like GdsOption, GdsMenuHeading) are internal implementation details
|
|
228
229
|
* but some are re-exported by specific components for public use. For example:
|
|
229
230
|
* - GdsOption is re-exported by GdsDropdown
|
|
230
231
|
* - GdsMenuHeading is re-exported by GdsContextMenu
|
|
231
|
-
*
|
|
232
|
+
*
|
|
232
233
|
* This method identifies these re-exports and returns the component file path
|
|
233
234
|
* (not the primitive path) so imports point to the re-exporting component.
|
|
234
|
-
*
|
|
235
|
+
*
|
|
235
236
|
* Design choices:
|
|
236
237
|
* - Only considers *.component.ts files, not index.ts files, to ensure imports
|
|
237
238
|
* point to the actual component file (e.g., dropdown.component.js not index.js)
|