@synergy-design-system/react 1.0.0-main.10

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/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2023, SickDesignSystem
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,88 @@
1
+ # @synergy-design-system/react
2
+
3
+ This package provides [React.js](https://react.dev/) wrappers for [Synergy Web Components](https://github.com/SickDesignSystem/synergy/tree/main/packages/components).
4
+
5
+ ## Getting started
6
+
7
+ ### 1. Package installation
8
+
9
+ Run the following steps to install the required packages.
10
+
11
+ ```bash
12
+ # Install the base library and required css files
13
+ npm install --save @synergy-design-system/react @synergy-design-system/tokens
14
+
15
+ # Only if not already installed
16
+ npm install --save react react-dom
17
+ ```
18
+
19
+ > ⚠️ Note we do **not** ship react in this package.
20
+ > You will have to install React by yourself first!
21
+
22
+ ### 2. Add the wanted theme to your application
23
+
24
+ The components will not display correctly without the needed theme. Please include either light or dark theme in your application, for example in a newly installed vite React application:
25
+
26
+ ```tsx
27
+ // main.tsx
28
+ import { StrictMode } from 'react';
29
+ import { createRoot } from 'react-dom/client';
30
+ import { App } from './App';
31
+
32
+ // Add this line to enable the light theme for your application
33
+ import '@synergy-design-system/tokens/dist/themes/light.css';
34
+
35
+ createRoot(document.getElementById('root')!).render(
36
+ <StrictMode>
37
+ <App />
38
+ </StrictMode>,
39
+ );
40
+ ```
41
+
42
+ ### 3. Importing and rendering components
43
+
44
+ You may now use the components by importing them from the `@synergy-design-system/react` package and rendering them in a react component.
45
+
46
+ ```tsx
47
+ import { SynButton } from '../dist';
48
+
49
+ export const MyButton = () => (
50
+ <SynButton type="button" variant="primary">
51
+ SynButton Example
52
+ </SynButton>
53
+ );
54
+ ```
55
+
56
+ ## 4. Using component events
57
+
58
+ This library makes use of [@lit/react](https://lit.dev/docs/frameworks/react/) to wrap the existing Synergy Web Components.
59
+ All events will be automatically set up to work without the need to attach event listeners manually.
60
+ Just use them with the default react `onEVENT` prefix, where `EVENT` is the camelCased name of the event.
61
+
62
+ ```tsx
63
+ import { SynButton } from '../dist';
64
+
65
+ export const MyButton = () => (
66
+ <SynButton
67
+ onSynBlur={e => console.log('button blur event', e)}
68
+ onSynFocus={e => console.log('button focus event', e)}
69
+ onSynInvalid={e => console.log('button flagged as invalid', e)}
70
+ >
71
+ SynButton Example
72
+ </SynButton>
73
+ );
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Development
79
+
80
+ To create a new version of this package, proceed in the following way:
81
+
82
+ 1. Check out the [Synergy Design System Repository](https://github.com/SickDesignSystem/synergy).
83
+ 2. Run `pnpm i -r` to install all dependencies.
84
+ 3. Build the `@synergy-design-system/components` package (or run `pnpm build` in the project root to build everything).
85
+ 4. Move to to `packages/_private/react-demo` and use `pnpm start` to spin up a local vite project using react and typescript to validate the build.
86
+
87
+ > ⚠️ The build process will always try to sync this packages `package.json.version` field with the latest version from `@synergy-design-system/components`!
88
+ > Therefore, it is best to not alter the version string
@@ -0,0 +1,25 @@
1
+ // ../react/src/components/input.ts
2
+ import * as React from "react";
3
+ import { createComponent } from "@lit/react";
4
+ import Component from "@synergy-design-system/components/components/input/input.component.js";
5
+ var tagName = "syn-input";
6
+ Component.define("syn-input");
7
+ var SynInput = createComponent({
8
+ displayName: "SynInput",
9
+ elementClass: Component,
10
+ events: {
11
+ onSynBlur: "syn-blur",
12
+ onSynChange: "syn-change",
13
+ onSynClear: "syn-clear",
14
+ onSynFocus: "syn-focus",
15
+ onSynInput: "syn-input",
16
+ onSynInvalid: "syn-invalid"
17
+ },
18
+ react: React,
19
+ tagName
20
+ });
21
+
22
+ export {
23
+ SynInput
24
+ };
25
+ //# sourceMappingURL=chunk.K57RP7HQ.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/components/input.ts"],
4
+ "sourcesContent": ["// ---------------------------------------------------------------------\n// \uD83D\uDD12 AUTOGENERATED @synergy-design-system/react wrappers for @synergy-design-system/components\n// Please do not edit this file directly!\n// It will get recreated when running pnpm build.\n// ---------------------------------------------------------------------\nimport * as React from 'react';\nimport { createComponent } from '@lit/react';\nimport Component from '@synergy-design-system/components/components/input/input.component.js';\n\nimport { type EventName } from '@lit/react';\nimport type {\n SynBlurEvent, SynChangeEvent, SynClearEvent, SynFocusEvent, SynInputEvent, SynInvalidEvent,\n} from '@synergy-design-system/components';\n\nconst tagName = 'syn-input';\nComponent.define('syn-input');\n\n/**\n * @summary Inputs collect data from the user.\n * @documentation https://synergy.style/components/input\n * @status stable\n * @since 2.0\n *\n * @dependency syn-icon\n *\n * @slot label - The input's label. Alternatively, you can use the `label` attribute.\n * @slot prefix - Used to prepend a presentational icon or similar element to the input.\n * @slot suffix - Used to append a presentational icon or similar element to the input.\n * @slot clear-icon - An icon to use in lieu of the default clear icon.\n * @slot show-password-icon - An icon to use in lieu of the default show password icon.\n * @slot hide-password-icon - An icon to use in lieu of the default hide password icon.\n * @slot help-text - Text that describes how to use the input. Alternatively, you can use the `help-text` attribute.\n *\n * @event syn-blur - Emitted when the control loses focus.\n * @event syn-change - Emitted when an alteration to the control's value is committed by the user.\n * @event syn-clear - Emitted when the clear button is activated.\n * @event syn-focus - Emitted when the control gains focus.\n * @event syn-input - Emitted when the control receives input.\n * @event syn-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied.\n *\n * @csspart form-control - The form control that wraps the label, input, and help text.\n * @csspart form-control-label - The label's wrapper.\n * @csspart form-control-input - The input's wrapper.\n * @csspart form-control-help-text - The help text's wrapper.\n * @csspart base - The component's base wrapper.\n * @csspart input - The internal `<input>` control.\n * @csspart prefix - The container that wraps the prefix.\n * @csspart clear-button - The clear button.\n * @csspart password-toggle-button - The password toggle button.\n * @csspart suffix - The container that wraps the suffix.\n */\nexport const SynInput = createComponent({\n displayName: 'SynInput',\n elementClass: Component,\n events: {\n onSynBlur: 'syn-blur' as EventName<SynBlurEvent>,\n onSynChange: 'syn-change' as EventName<SynChangeEvent>,\n onSynClear: 'syn-clear' as EventName<SynClearEvent>,\n onSynFocus: 'syn-focus' as EventName<SynFocusEvent>,\n onSynInput: 'syn-input' as EventName<SynInputEvent>,\n onSynInvalid: 'syn-invalid' as EventName<SynInvalidEvent>,\n },\n react: React,\n tagName,\n});\n\nexport type { SynBlurEvent } from '@synergy-design-system/components';\nexport type { SynChangeEvent } from '@synergy-design-system/components';\nexport type { SynClearEvent } from '@synergy-design-system/components';\nexport type { SynFocusEvent } from '@synergy-design-system/components';\nexport type { SynInputEvent } from '@synergy-design-system/components';\nexport type { SynInvalidEvent } from '@synergy-design-system/components';\n"],
5
+ "mappings": ";AAKA,YAAY,WAAW;AACvB,SAAS,uBAAuB;AAChC,OAAO,eAAe;AAOtB,IAAM,UAAU;AAChB,UAAU,OAAO,WAAW;AAoCrB,IAAM,WAAW,gBAAgB;AAAA,EACtC,aAAa;AAAA,EACb,cAAc;AAAA,EACd,QAAQ;AAAA,IACN,WAAW;AAAA,IACX,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,cAAc;AAAA,EAChB;AAAA,EACA,OAAO;AAAA,EACP;AACF,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,22 @@
1
+ // ../react/src/components/button.ts
2
+ import * as React from "react";
3
+ import { createComponent } from "@lit/react";
4
+ import Component from "@synergy-design-system/components/components/button/button.component.js";
5
+ var tagName = "syn-button";
6
+ Component.define("syn-button");
7
+ var SynButton = createComponent({
8
+ displayName: "SynButton",
9
+ elementClass: Component,
10
+ events: {
11
+ onSynBlur: "syn-blur",
12
+ onSynFocus: "syn-focus",
13
+ onSynInvalid: "syn-invalid"
14
+ },
15
+ react: React,
16
+ tagName
17
+ });
18
+
19
+ export {
20
+ SynButton
21
+ };
22
+ //# sourceMappingURL=chunk.TTUPZLN7.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/components/button.ts"],
4
+ "sourcesContent": ["// ---------------------------------------------------------------------\n// \uD83D\uDD12 AUTOGENERATED @synergy-design-system/react wrappers for @synergy-design-system/components\n// Please do not edit this file directly!\n// It will get recreated when running pnpm build.\n// ---------------------------------------------------------------------\nimport * as React from 'react';\nimport { createComponent } from '@lit/react';\nimport Component from '@synergy-design-system/components/components/button/button.component.js';\n\nimport { type EventName } from '@lit/react';\nimport type { SynBlurEvent, SynFocusEvent, SynInvalidEvent } from '@synergy-design-system/components';\n\nconst tagName = 'syn-button';\nComponent.define('syn-button');\n\n/**\n * @summary Buttons represent actions that are available to the user.\n * @documentation https://synergy.style/components/button\n * @status stable\n * @since 2.0\n *\n * @dependency syn-icon\n * @dependency syn-spinner\n *\n * @event syn-blur - Emitted when the button loses focus.\n * @event syn-focus - Emitted when the button gains focus.\n * @event syn-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied.\n *\n * @slot - The button's label.\n * @slot prefix - A presentational prefix icon or similar element.\n * @slot suffix - A presentational suffix icon or similar element.\n *\n * @csspart base - The component's base wrapper.\n * @csspart prefix - The container that wraps the prefix.\n * @csspart label - The button's label.\n * @csspart suffix - The container that wraps the suffix.\n * @csspart caret - The button's caret icon, an `<syn-icon>` element.\n * @csspart spinner - The spinner that shows when the button is in the loading state.\n */\nexport const SynButton = createComponent({\n displayName: 'SynButton',\n elementClass: Component,\n events: {\n onSynBlur: 'syn-blur' as EventName<SynBlurEvent>,\n onSynFocus: 'syn-focus' as EventName<SynFocusEvent>,\n onSynInvalid: 'syn-invalid' as EventName<SynInvalidEvent>,\n },\n react: React,\n tagName,\n});\n\nexport type { SynBlurEvent } from '@synergy-design-system/components';\nexport type { SynFocusEvent } from '@synergy-design-system/components';\nexport type { SynInvalidEvent } from '@synergy-design-system/components';\n"],
5
+ "mappings": ";AAKA,YAAY,WAAW;AACvB,SAAS,uBAAuB;AAChC,OAAO,eAAe;AAKtB,IAAM,UAAU;AAChB,UAAU,OAAO,YAAY;AA0BtB,IAAM,YAAY,gBAAgB;AAAA,EACvC,aAAa;AAAA,EACb,cAAc;AAAA,EACd,QAAQ;AAAA,IACN,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,cAAc;AAAA,EAChB;AAAA,EACA,OAAO;AAAA,EACP;AACF,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,35 @@
1
+ import Component from '@synergy-design-system/components/components/button/button.component.js';
2
+ import { type EventName } from '@lit/react';
3
+ import type { SynBlurEvent, SynFocusEvent, SynInvalidEvent } from '@synergy-design-system/components';
4
+ /**
5
+ * @summary Buttons represent actions that are available to the user.
6
+ * @documentation https://synergy.style/components/button
7
+ * @status stable
8
+ * @since 2.0
9
+ *
10
+ * @dependency syn-icon
11
+ * @dependency syn-spinner
12
+ *
13
+ * @event syn-blur - Emitted when the button loses focus.
14
+ * @event syn-focus - Emitted when the button gains focus.
15
+ * @event syn-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied.
16
+ *
17
+ * @slot - The button's label.
18
+ * @slot prefix - A presentational prefix icon or similar element.
19
+ * @slot suffix - A presentational suffix icon or similar element.
20
+ *
21
+ * @csspart base - The component's base wrapper.
22
+ * @csspart prefix - The container that wraps the prefix.
23
+ * @csspart label - The button's label.
24
+ * @csspart suffix - The container that wraps the suffix.
25
+ * @csspart caret - The button's caret icon, an `<syn-icon>` element.
26
+ * @csspart spinner - The spinner that shows when the button is in the loading state.
27
+ */
28
+ export declare const SynButton: import("@lit/react").ReactWebComponent<Component, {
29
+ onSynBlur: EventName<SynBlurEvent>;
30
+ onSynFocus: EventName<SynFocusEvent>;
31
+ onSynInvalid: EventName<SynInvalidEvent>;
32
+ }>;
33
+ export type { SynBlurEvent } from '@synergy-design-system/components';
34
+ export type { SynFocusEvent } from '@synergy-design-system/components';
35
+ export type { SynInvalidEvent } from '@synergy-design-system/components';
@@ -0,0 +1,7 @@
1
+ import {
2
+ SynButton
3
+ } from "../chunks/chunk.TTUPZLN7.js";
4
+ export {
5
+ SynButton
6
+ };
7
+ //# sourceMappingURL=button.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,51 @@
1
+ import Component from '@synergy-design-system/components/components/input/input.component.js';
2
+ import { type EventName } from '@lit/react';
3
+ import type { SynBlurEvent, SynChangeEvent, SynClearEvent, SynFocusEvent, SynInputEvent, SynInvalidEvent } from '@synergy-design-system/components';
4
+ /**
5
+ * @summary Inputs collect data from the user.
6
+ * @documentation https://synergy.style/components/input
7
+ * @status stable
8
+ * @since 2.0
9
+ *
10
+ * @dependency syn-icon
11
+ *
12
+ * @slot label - The input's label. Alternatively, you can use the `label` attribute.
13
+ * @slot prefix - Used to prepend a presentational icon or similar element to the input.
14
+ * @slot suffix - Used to append a presentational icon or similar element to the input.
15
+ * @slot clear-icon - An icon to use in lieu of the default clear icon.
16
+ * @slot show-password-icon - An icon to use in lieu of the default show password icon.
17
+ * @slot hide-password-icon - An icon to use in lieu of the default hide password icon.
18
+ * @slot help-text - Text that describes how to use the input. Alternatively, you can use the `help-text` attribute.
19
+ *
20
+ * @event syn-blur - Emitted when the control loses focus.
21
+ * @event syn-change - Emitted when an alteration to the control's value is committed by the user.
22
+ * @event syn-clear - Emitted when the clear button is activated.
23
+ * @event syn-focus - Emitted when the control gains focus.
24
+ * @event syn-input - Emitted when the control receives input.
25
+ * @event syn-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied.
26
+ *
27
+ * @csspart form-control - The form control that wraps the label, input, and help text.
28
+ * @csspart form-control-label - The label's wrapper.
29
+ * @csspart form-control-input - The input's wrapper.
30
+ * @csspart form-control-help-text - The help text's wrapper.
31
+ * @csspart base - The component's base wrapper.
32
+ * @csspart input - The internal `<input>` control.
33
+ * @csspart prefix - The container that wraps the prefix.
34
+ * @csspart clear-button - The clear button.
35
+ * @csspart password-toggle-button - The password toggle button.
36
+ * @csspart suffix - The container that wraps the suffix.
37
+ */
38
+ export declare const SynInput: import("@lit/react").ReactWebComponent<Component, {
39
+ onSynBlur: EventName<SynBlurEvent>;
40
+ onSynChange: EventName<SynChangeEvent>;
41
+ onSynClear: EventName<SynClearEvent>;
42
+ onSynFocus: EventName<SynFocusEvent>;
43
+ onSynInput: EventName<SynInputEvent>;
44
+ onSynInvalid: EventName<SynInvalidEvent>;
45
+ }>;
46
+ export type { SynBlurEvent } from '@synergy-design-system/components';
47
+ export type { SynChangeEvent } from '@synergy-design-system/components';
48
+ export type { SynClearEvent } from '@synergy-design-system/components';
49
+ export type { SynFocusEvent } from '@synergy-design-system/components';
50
+ export type { SynInputEvent } from '@synergy-design-system/components';
51
+ export type { SynInvalidEvent } from '@synergy-design-system/components';
@@ -0,0 +1,7 @@
1
+ import {
2
+ SynInput
3
+ } from "../chunks/chunk.K57RP7HQ.js";
4
+ export {
5
+ SynInput
6
+ };
7
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ export { SynButton } from './components/button.js';
2
+ export { SynInput } from './components/input.js';
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ import {
2
+ SynButton
3
+ } from "./chunks/chunk.TTUPZLN7.js";
4
+ import {
5
+ SynInput
6
+ } from "./chunks/chunk.K57RP7HQ.js";
7
+ export {
8
+ SynButton,
9
+ SynInput
10
+ };
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "author": {
3
+ "name": "SICK Global UX Foundation",
4
+ "url": "https://www.sick.com"
5
+ },
6
+ "dependencies": {
7
+ "@lit/react": "^1.0.0",
8
+ "@synergy-design-system/components": "1.0.0-main.10"
9
+ },
10
+ "description": "React wrappers for the Synergy Design System",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js"
15
+ },
16
+ "./components/*": "./dist/components/*"
17
+ },
18
+ "types": "./dist/index.d.ts",
19
+ "files": [
20
+ "dist",
21
+ "CHANGELOG.md",
22
+ "README.md"
23
+ ],
24
+ "homepage": "https://github.com/SickDesignSystem/synergy/tree/main/packages/react",
25
+ "keywords": [
26
+ "React Web Component Wrapper",
27
+ "React Components",
28
+ "React Design System",
29
+ "Design System",
30
+ "SDS",
31
+ "Synergy Design System",
32
+ "SICK",
33
+ "SICK Design System"
34
+ ],
35
+ "license": "BSD-3-Clause",
36
+ "name": "@synergy-design-system/react",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "https://github.com/SickDesignSystem/synergy.git",
40
+ "directory": "packages/react"
41
+ },
42
+ "type": "module",
43
+ "version": "1.0.0-main.10",
44
+ "devDependencies": {
45
+ "@types/react": "^18.2.31",
46
+ "react": "^18.2.0"
47
+ }
48
+ }