@synergy-design-system/react 1.1.0 → 1.2.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 +11 -10
- package/dist/chunks/chunk.7T7PO2AE.js +20 -0
- package/dist/chunks/chunk.7T7PO2AE.js.map +7 -0
- package/dist/components/tag.d.ts +24 -0
- package/dist/components/tag.js +7 -0
- package/dist/components/tag.js.map +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
This package provides [React.js](https://react.dev/) wrappers for [Synergy Web Components](https://github.com/synergy-design-system/synergy-design-system/tree/main/packages/components).
|
|
4
4
|
|
|
5
5
|
This package aims for an improved UX when used in React applications:
|
|
6
|
+
|
|
6
7
|
- Auto-completion
|
|
7
8
|
- Event handling
|
|
8
9
|
|
|
@@ -29,14 +30,14 @@ The components will not display correctly without the needed theme. Please inclu
|
|
|
29
30
|
|
|
30
31
|
```tsx
|
|
31
32
|
// main.tsx
|
|
32
|
-
import { StrictMode } from
|
|
33
|
-
import { createRoot } from
|
|
34
|
-
import { App } from
|
|
33
|
+
import { StrictMode } from "react";
|
|
34
|
+
import { createRoot } from "react-dom/client";
|
|
35
|
+
import { App } from "./App";
|
|
35
36
|
|
|
36
37
|
// Add this line to enable the light theme for your application
|
|
37
|
-
import
|
|
38
|
+
import "@synergy-design-system/tokens/themes/light.css";
|
|
38
39
|
|
|
39
|
-
createRoot(document.getElementById(
|
|
40
|
+
createRoot(document.getElementById("root")!).render(
|
|
40
41
|
<StrictMode>
|
|
41
42
|
<App />
|
|
42
43
|
</StrictMode>,
|
|
@@ -48,7 +49,7 @@ createRoot(document.getElementById('root')!).render(
|
|
|
48
49
|
You may now use the components by importing them from the `@synergy-design-system/react` package and rendering them in a react component.
|
|
49
50
|
|
|
50
51
|
```tsx
|
|
51
|
-
import { SynButton } from
|
|
52
|
+
import { SynButton } from "@synergy-design-system/react";
|
|
52
53
|
|
|
53
54
|
export const MyButton = () => (
|
|
54
55
|
<SynButton type="button" variant="filled">
|
|
@@ -64,13 +65,13 @@ All events will be automatically set up to work without the need to attach event
|
|
|
64
65
|
Just use them with the default react `onEVENT` prefix, where `EVENT` is the camelCased name of the event.
|
|
65
66
|
|
|
66
67
|
```tsx
|
|
67
|
-
import { SynButton } from
|
|
68
|
+
import { SynButton } from "@synergy-design-system/react";
|
|
68
69
|
|
|
69
70
|
export const MyButton = () => (
|
|
70
71
|
<SynButton
|
|
71
|
-
onSynBlur={e => console.log(
|
|
72
|
-
onSynFocus={e => console.log(
|
|
73
|
-
onSynInvalid={e => console.log(
|
|
72
|
+
onSynBlur={e => console.log("button blur event", e)}
|
|
73
|
+
onSynFocus={e => console.log("button focus event", e)}
|
|
74
|
+
onSynInvalid={e => console.log("button flagged as invalid", e)}
|
|
74
75
|
>
|
|
75
76
|
SynButton Example
|
|
76
77
|
</SynButton>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// ../react/src/components/tag.ts
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { createComponent } from "@lit/react";
|
|
4
|
+
import Component from "@synergy-design-system/components/components/tag/tag.component.js";
|
|
5
|
+
var tagName = "syn-tag";
|
|
6
|
+
Component.define("syn-tag");
|
|
7
|
+
var SynTag = createComponent({
|
|
8
|
+
displayName: "SynTag",
|
|
9
|
+
elementClass: Component,
|
|
10
|
+
events: {
|
|
11
|
+
onSynRemove: "syn-remove"
|
|
12
|
+
},
|
|
13
|
+
react: React,
|
|
14
|
+
tagName
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
SynTag
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=chunk.7T7PO2AE.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/tag.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/tag/tag.component.js';\n\nimport { type EventName } from '@lit/react';\nimport type { SynRemoveEvent } from '@synergy-design-system/components';\n\nconst tagName = 'syn-tag';\nComponent.define('syn-tag');\n\n/**\n * @summary Tags are used as labels to organize things or to indicate a selection.\n * @documentation https://synergy.style/components/tag\n * @status stable\n * @since 2.0\n *\n * @dependency syn-icon-button\n *\n * @slot - The tag's content.\n *\n * @event syn-remove - Emitted when the remove button is activated.\n *\n * @csspart base - The component's base wrapper.\n * @csspart content - The tag's content.\n * @csspart remove-button - The tag's remove button, an `<syn-icon-button>`.\n * @csspart remove-button__base - The remove button's exported `base` part.\n */\nexport const SynTag = createComponent({\n displayName: 'SynTag',\n elementClass: Component,\n events: {\n onSynRemove: 'syn-remove' as EventName<SynRemoveEvent>,\n },\n react: React,\n tagName,\n});\n\nexport type { SynRemoveEvent } from '@synergy-design-system/components';\n"],
|
|
5
|
+
"mappings": ";AAKA,YAAY,WAAW;AACvB,SAAS,uBAAuB;AAChC,OAAO,eAAe;AAKtB,IAAM,UAAU;AAChB,UAAU,OAAO,SAAS;AAmBnB,IAAM,SAAS,gBAAgB;AAAA,EACpC,aAAa;AAAA,EACb,cAAc;AAAA,EACd,QAAQ;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA,OAAO;AAAA,EACP;AACF,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Component from '@synergy-design-system/components/components/tag/tag.component.js';
|
|
2
|
+
import { type EventName } from '@lit/react';
|
|
3
|
+
import type { SynRemoveEvent } from '@synergy-design-system/components';
|
|
4
|
+
/**
|
|
5
|
+
* @summary Tags are used as labels to organize things or to indicate a selection.
|
|
6
|
+
* @documentation https://synergy.style/components/tag
|
|
7
|
+
* @status stable
|
|
8
|
+
* @since 2.0
|
|
9
|
+
*
|
|
10
|
+
* @dependency syn-icon-button
|
|
11
|
+
*
|
|
12
|
+
* @slot - The tag's content.
|
|
13
|
+
*
|
|
14
|
+
* @event syn-remove - Emitted when the remove button is activated.
|
|
15
|
+
*
|
|
16
|
+
* @csspart base - The component's base wrapper.
|
|
17
|
+
* @csspart content - The tag's content.
|
|
18
|
+
* @csspart remove-button - The tag's remove button, an `<syn-icon-button>`.
|
|
19
|
+
* @csspart remove-button__base - The remove button's exported `base` part.
|
|
20
|
+
*/
|
|
21
|
+
export declare const SynTag: import("@lit/react").ReactWebComponent<Component, {
|
|
22
|
+
onSynRemove: EventName<SynRemoveEvent>;
|
|
23
|
+
}>;
|
|
24
|
+
export type { SynRemoveEvent } from '@synergy-design-system/components';
|
package/dist/index.d.ts
CHANGED
|
@@ -8,4 +8,5 @@ export { SynRadio } from './components/radio.js';
|
|
|
8
8
|
export { SynRadioButton } from './components/radio-button.js';
|
|
9
9
|
export { SynRadioGroup } from './components/radio-group.js';
|
|
10
10
|
export { SynSwitch } from './components/switch.js';
|
|
11
|
+
export { SynTag } from './components/tag.js';
|
|
11
12
|
export { SynTextarea } from './components/textarea.js';
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,9 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
SynSwitch
|
|
9
9
|
} from "./chunks/chunk.TOR523VV.js";
|
|
10
|
+
import {
|
|
11
|
+
SynTag
|
|
12
|
+
} from "./chunks/chunk.7T7PO2AE.js";
|
|
10
13
|
import {
|
|
11
14
|
SynTextarea
|
|
12
15
|
} from "./chunks/chunk.4YY6TGIA.js";
|
|
@@ -42,6 +45,7 @@ export {
|
|
|
42
45
|
SynRadioButton,
|
|
43
46
|
SynRadioGroup,
|
|
44
47
|
SynSwitch,
|
|
48
|
+
SynTag,
|
|
45
49
|
SynTextarea
|
|
46
50
|
};
|
|
47
51
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@lit/react": "^1.0.0",
|
|
8
|
-
"@synergy-design-system/components": "^1.
|
|
8
|
+
"@synergy-design-system/components": "^1.2.0"
|
|
9
9
|
},
|
|
10
10
|
"description": "React wrappers for the Synergy Design System",
|
|
11
11
|
"exports": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"directory": "packages/react"
|
|
41
41
|
},
|
|
42
42
|
"type": "module",
|
|
43
|
-
"version": "1.
|
|
43
|
+
"version": "1.2.0",
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/react": "^18.2.31",
|
|
46
46
|
"react": "^18.2.0"
|