@synergy-design-system/react 2.17.0 → 2.18.1

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 CHANGED
@@ -7,6 +7,10 @@ This package aims for an improved UX when used in React applications:
7
7
  - Auto-completion
8
8
  - Event handling
9
9
 
10
+ > Note that with react@19 and above, react has full support for web-components.
11
+ > For those react versions, this package can be used by loading custom types,
12
+ > you **do not need to use the exported components** anymore.
13
+
10
14
  ## Getting started
11
15
 
12
16
  ### 1. Package installation
@@ -54,14 +58,63 @@ createRoot(document.getElementById("root")!).render(
54
58
  );
55
59
  ```
56
60
 
57
- ### 3. Importing and rendering components
61
+ ### 3. Using native Synergy components in react (only for react >= 19.0.0) in Typescript projects
62
+
63
+ React@19 finally shipped with official support for web components.
64
+ With this version of react, you are free to **use our native web components** directly in your application.
65
+
66
+ However, you will likely receive errors because our elements are not known to React as available (in react speech `intrinsic`) elements. This will also occur when using typescript. For this reason, we provide **type only wrappers** for all versions of react from version 19.0.0 onward.
67
+
68
+ Using synergy in a typescript project with React@19 can be easily achieved via one line of code. There is no need to import `@synergy-design-system/react` in your code directly anymore!
69
+
70
+ Just add the following definition to your projects typescript configuration file (e.g. `tsconfig.json`):
71
+
72
+ ```json
73
+ {
74
+ "compilerOptions": {
75
+ "types": ["@synergy-design-system/react/types/latest"]
76
+ }
77
+ }
78
+ ```
79
+
80
+ This makes sure your project knows about our list of intrinsic elements. This will also enable **automatic type checks and auto completion for properties** for all synergy elements.
81
+
82
+ You may now use the components by importing them from the `@synergy-design-system/component` package and rendering them in a React component.
83
+
84
+ ```tsx
85
+ // You may also load the complete bundle somewhere in your application,
86
+ // but directly including only needed components leads to smaller bundles.
87
+ import "@synergy-design-system/components/components/button/button.js";
88
+ import "@synergy-design-system/components/components/input/input.js";
89
+
90
+ export const MyButton = () => <syn-button type="submit">Submit me</syn-button>;
91
+ export const MyInput = () => (
92
+ <syn-input name="my-input" onsyn-change={e => console.log(e)} required />
93
+ );
94
+ ```
95
+
96
+ #### 3.1. Migrating from synergies react wrappers to native components
97
+
98
+ 1. First make sure you have react@19 or higher installed in your project.
99
+ 2. Upgrade `@synergy-design-system/react` to the latest version.
100
+ 3. Add the required types to your typescript configuration (`compilerOptions.types=['@synergy-design-system/react/types/latest']`).
101
+ 4. Run typescript to verify everything is still fine.
102
+ 5. Replace occurrences of the old synergy components with their native counterpart (e.g. `<SynButton>` should be exchanged for `<syn-button>`). When using native synergy components, make sure to double check on event names (e.g. `<SynInput onSynInput={e => null} />` will become `<syn-input onsyn-input={e => null} />`).
103
+ 6. When you are done, remove all occurrences of `@synergy-design-system/react` from your code.
104
+
105
+ ---
106
+
107
+ ### 4. Using the lit wrappers (required for react < 19.0.0, optional for react >= 19.0.0)
58
108
 
59
109
  You may now use the components by importing them from the `@synergy-design-system/react` package and rendering them in a React component.
60
110
 
61
111
  ```tsx
62
- import { SynButton } from "@synergy-design-system/react";
112
+ import { SynButton, SynInput } from "@synergy-design-system/react";
63
113
 
64
114
  export const MyButton = () => <SynButton type="submit">Submit me</SynButton>;
115
+ export const MyInput = () => (
116
+ <SynInput name="my-input" onSynChange={e => console.log(e)} required />
117
+ );
65
118
  ```
66
119
 
67
120
  ### 4. Usage of the components
@@ -20,4 +20,4 @@ var SynSideNav = createComponent({
20
20
  export {
21
21
  SynSideNav
22
22
  };
23
- //# sourceMappingURL=chunk.CYZ6F7G6.js.map
23
+ //# sourceMappingURL=chunk.2JXRC7UA.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/components/side-nav.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/side-nav/side-nav.component.js';\n\nimport { type EventName } from '@lit/react';\nimport type { SynShowEvent } from '@synergy-design-system/components';\nimport type { SynAfterShowEvent } from '@synergy-design-system/components';\nimport type { SynHideEvent } from '@synergy-design-system/components';\nimport type { SynAfterHideEvent } from '@synergy-design-system/components';\n\nconst tagName = 'syn-side-nav';\nComponent.define('syn-side-nav');\n\n/**\n * @summary The <syn-side-nav /> element contains secondary navigation and fits below the header.\n * It can be used to group multiple navigation items (<syn-nav-item />s) together.\n *\n * @example\n * <syn-side-nav open>\n * <syn-nav-item >Item 1</syn-nav-item>\n * <syn-nav-item divider>Item 2</syn-nav-item>\n * </syn-side-nav>\n *\n * @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-side-nav--docs\n * @status stable\n * @since 1.14.0\n *\n * @dependency syn-divider\n * @dependency syn-drawer\n *\n * @slot - The main content of the side-nav. Used for <syn-nav-item /> elements.\n * @slot footer - The footer content of the side-nav. Used for <syn-nav-item /> elements.\n * Please avoid having to many nav-items as it can massively influence the user experience.\n *\n * @event syn-show - Emitted when the side-nav opens.\n * @event syn-after-show - Emitted after the side-nav opens and all animations are complete.\n * @event syn-hide - Emitted when the side-nav closes.\n * @event syn-after-hide - Emitted after the side-nav closes and all animations are complete.\n *\n * @csspart base - The components base wrapper\n * @csspart drawer - The drawer that is used under the hood for creating the side-nav\n * @csspart content-container - The components main content container\n * @csspart content - The components main content\n * @csspart footer-container - The components footer content container\n * @csspart footer-divider - The components footer divider\n * @csspart footer - The components footer content\n * @csspart overlay - The overlay that covers the screen behind the side-nav.\n *\n * @cssproperty --side-nav-open-width - The width of the side-nav if in open state\n *\n * @animation sideNav.showNonRail - The animation to use when showing the side-nav in non-rail mode.\n * @animation sideNav.showRail - The animation to use when showing the side-nav in rail mode.\n * @animation sideNav.hideNonRail - The animation to use when hiding the side-nav in non-rail mode.\n * @animation sideNav.hideRail - The animation to use when hiding the side-nav in rail mode.\n * @animation sideNav.overlay.show - The animation to use when showing the side-nav's overlay.\n * @animation sideNav.overlay.hide - The animation to use when hiding the side-nav's overlay.\n */\nexport const SynSideNav = createComponent({\n displayName: 'SynSideNav',\n elementClass: Component,\n events: {\n onSynShow: 'syn-show' as EventName<SynShowEvent>,\n onSynAfterShow: 'syn-after-show' as EventName<SynAfterShowEvent>,\n onSynHide: 'syn-hide' as EventName<SynHideEvent>,\n onSynAfterHide: 'syn-after-hide' as EventName<SynAfterHideEvent>,\n },\n react: React,\n tagName,\n});\n\nexport type { SynShowEvent } from '@synergy-design-system/components';\nexport type { SynAfterShowEvent } from '@synergy-design-system/components';\nexport type { SynHideEvent } from '@synergy-design-system/components';\nexport type { SynAfterHideEvent } from '@synergy-design-system/components';\n"],
5
- "mappings": ";AAKA,YAAY,WAAW;AACvB,SAAS,uBAAuB;AAChC,OAAO,eAAe;AAQtB,IAAM,UAAU;AAChB,UAAU,OAAO,cAAc;AA8CxB,IAAM,aAAa,gBAAgB;AAAA,EACxC,aAAa;AAAA,EACb,cAAc;AAAA,EACd,QAAQ;AAAA,IACN,WAAW;AAAA,IACX,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,gBAAgB;AAAA,EAClB;AAAA,EACA,OAAO;AAAA,EACP;AACF,CAAC;",
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/side-nav/side-nav.component.js';\n\nimport { type EventName } from '@lit/react';\nimport type { SynShowEvent } from '@synergy-design-system/components';\nimport type { SynAfterShowEvent } from '@synergy-design-system/components';\nimport type { SynHideEvent } from '@synergy-design-system/components';\nimport type { SynAfterHideEvent } from '@synergy-design-system/components';\n\nconst tagName = 'syn-side-nav';\nComponent.define('syn-side-nav');\n\n/**\n * @summary The <syn-side-nav /> element contains secondary navigation and fits below the header.\n * It can be used to group multiple navigation items (<syn-nav-item />s) together.\n *\n * @example\n * <syn-side-nav open>\n * <syn-nav-item >Item 1</syn-nav-item>\n * <syn-nav-item divider>Item 2</syn-nav-item>\n * </syn-side-nav>\n *\n * @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-side-nav--docs\n * @status stable\n * @since 1.14.0\n *\n * @dependency syn-divider\n * @dependency syn-drawer\n *\n * @slot - The main content of the side-nav. Used for <syn-nav-item /> elements.\n * @slot footer - The footer content of the side-nav. Used for <syn-nav-item /> elements.\n * Please avoid having to many nav-items as it can massively influence the user experience.\n *\n * @event syn-show - Emitted when the side-nav opens.\n * @event syn-after-show - Emitted after the side-nav opens and all animations are complete.\n * @event syn-hide - Emitted when the side-nav closes.\n * @event syn-after-hide - Emitted after the side-nav closes and all animations are complete.\n *\n * @csspart base - The components base wrapper\n * @csspart drawer - The drawer that is used under the hood for creating the side-nav\n * @csspart content-container - The components main content container\n * @csspart content - The components main content\n * @csspart footer-container - The components footer content container\n (where the footer slot content is rendered)\n * @csspart footer-divider - The components footer divider\n * @csspart footer - The components footer content\n * @csspart overlay - The overlay that covers the screen behind the side-nav.\n * @csspart panel - The side-nav's panel (where the whole content is rendered).\n * @csspart body - The side-nav's body (where the default slot content is rendered)\n * @csspart drawer__base - The drawer's base wrapper\n *\n * @cssproperty --side-nav-open-width - The width of the side-nav if in open state\n *\n * @animation sideNav.showNonRail - The animation to use when showing the side-nav in non-rail mode.\n * @animation sideNav.showRail - The animation to use when showing the side-nav in rail mode.\n * @animation sideNav.hideNonRail - The animation to use when hiding the side-nav in non-rail mode.\n * @animation sideNav.hideRail - The animation to use when hiding the side-nav in rail mode.\n * @animation sideNav.overlay.show - The animation to use when showing the side-nav's overlay.\n * @animation sideNav.overlay.hide - The animation to use when hiding the side-nav's overlay.\n */\nexport const SynSideNav = createComponent({\n displayName: 'SynSideNav',\n elementClass: Component,\n events: {\n onSynShow: 'syn-show' as EventName<SynShowEvent>,\n onSynAfterShow: 'syn-after-show' as EventName<SynAfterShowEvent>,\n onSynHide: 'syn-hide' as EventName<SynHideEvent>,\n onSynAfterHide: 'syn-after-hide' as EventName<SynAfterHideEvent>,\n },\n react: React,\n tagName,\n});\n\nexport type { SynShowEvent } from '@synergy-design-system/components';\nexport type { SynAfterShowEvent } from '@synergy-design-system/components';\nexport type { SynHideEvent } from '@synergy-design-system/components';\nexport type { SynAfterHideEvent } from '@synergy-design-system/components';\n"],
5
+ "mappings": ";AAKA,YAAY,WAAW;AACvB,SAAS,uBAAuB;AAChC,OAAO,eAAe;AAQtB,IAAM,UAAU;AAChB,UAAU,OAAO,cAAc;AAkDxB,IAAM,aAAa,gBAAgB;AAAA,EACxC,aAAa;AAAA,EACb,cAAc;AAAA,EACd,QAAQ;AAAA,IACN,WAAW;AAAA,IACX,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,gBAAgB;AAAA,EAClB;AAAA,EACA,OAAO;AAAA,EACP;AACF,CAAC;",
6
6
  "names": []
7
7
  }
@@ -35,9 +35,13 @@ import type { SynAfterHideEvent } from '@synergy-design-system/components';
35
35
  * @csspart content-container - The components main content container
36
36
  * @csspart content - The components main content
37
37
  * @csspart footer-container - The components footer content container
38
+ (where the footer slot content is rendered)
38
39
  * @csspart footer-divider - The components footer divider
39
40
  * @csspart footer - The components footer content
40
41
  * @csspart overlay - The overlay that covers the screen behind the side-nav.
42
+ * @csspart panel - The side-nav's panel (where the whole content is rendered).
43
+ * @csspart body - The side-nav's body (where the default slot content is rendered)
44
+ * @csspart drawer__base - The drawer's base wrapper
41
45
  *
42
46
  * @cssproperty --side-nav-open-width - The width of the side-nav if in open state
43
47
  *
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SynSideNav
3
- } from "../chunks/chunk.CYZ6F7G6.js";
3
+ } from "../chunks/chunk.2JXRC7UA.js";
4
4
  export {
5
5
  SynSideNav
6
6
  };
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ import {
36
36
  } from "./chunks/chunk.DDVND3A3.js";
37
37
  import {
38
38
  SynSideNav
39
- } from "./chunks/chunk.CYZ6F7G6.js";
39
+ } from "./chunks/chunk.2JXRC7UA.js";
40
40
  import {
41
41
  SynSpinner
42
42
  } from "./chunks/chunk.YLB4QDAX.js";