@diwacopilot/components-react 1.2.3 → 1.3.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.
@@ -0,0 +1,91 @@
1
+ /**
2
+ * @diwacopilot/components-react/server
3
+ *
4
+ * RSC-safe (React Server Component-safe) exports.
5
+ *
6
+ * These are pure function components that render Diwa custom element shells as
7
+ * plain HTML attributes. They do NOT import `createReactComponent`, do NOT call
8
+ * `defineCustomElements()`, and do NOT extend React.Component — so they are safe
9
+ * to import in Next.js Server Components (and any other RSC-compatible runtime).
10
+ *
11
+ * On the server they produce the correct HTML skeleton; the browser upgrades the
12
+ * custom elements and attaches shadow DOM once the Stencil bundle loads.
13
+ *
14
+ * Supported components (presentational / no event delegation or refs needed):
15
+ * DHeading, DText, DDivider, DBadge, DIcon
16
+ *
17
+ * Interactive components (DButton, DInput*, DModal, DFlyout, …) are intentionally
18
+ * excluded — they rely on refs, DOM event delegation, and the custom element
19
+ * registry. Import them from '@diwacopilot/components-react' inside a 'use client'
20
+ * file as before.
21
+ */
22
+ import React from 'react';
23
+ type Theme = 'light' | 'dark';
24
+ export type HeadingSize = 'display' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'inherit';
25
+ export type HeadingTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'div';
26
+ export type HeadingAlign = 'start' | 'center' | 'end';
27
+ export type HeadingColor = 'primary' | 'secondary' | 'inherit';
28
+ export type HeadingWeight = 'semibold' | 'bold';
29
+ export interface DHeadingProps {
30
+ size?: HeadingSize;
31
+ tag?: HeadingTag;
32
+ weight?: HeadingWeight;
33
+ align?: HeadingAlign;
34
+ color?: HeadingColor;
35
+ theme?: Theme;
36
+ className?: string;
37
+ style?: React.CSSProperties;
38
+ children?: React.ReactNode;
39
+ }
40
+ export declare function DHeading({ size, tag, weight, align, color, theme, className, style, children, }: DHeadingProps): React.DOMElement<Record<string, unknown>, Element>;
41
+ export type TextTag = 'p' | 'span' | 'div' | 'label' | 'li';
42
+ export type TextSize = 'x-small' | 'small' | 'medium' | 'large' | 'x-large' | 'xx-large';
43
+ export type TextWeight = 'regular' | 'semibold' | 'bold';
44
+ export type TextAlign = 'start' | 'center' | 'end';
45
+ export type TextColor = 'primary' | 'secondary' | 'tertiary' | 'inherit';
46
+ export interface DTextProps {
47
+ tag?: TextTag;
48
+ size?: TextSize;
49
+ weight?: TextWeight;
50
+ align?: TextAlign;
51
+ color?: TextColor;
52
+ ellipsis?: boolean;
53
+ theme?: Theme;
54
+ className?: string;
55
+ style?: React.CSSProperties;
56
+ children?: React.ReactNode;
57
+ }
58
+ export declare function DText({ tag, size, weight, align, color, ellipsis, theme, className, style, children, }: DTextProps): React.DOMElement<Record<string, unknown>, Element>;
59
+ export type DividerOrientation = 'horizontal' | 'vertical';
60
+ export interface DDividerProps {
61
+ orientation?: DividerOrientation;
62
+ theme?: Theme;
63
+ className?: string;
64
+ style?: React.CSSProperties;
65
+ }
66
+ export declare function DDivider({ orientation, theme, className, style, }: DDividerProps): React.DOMElement<Record<string, unknown>, Element>;
67
+ export type BadgeVariant = 'neutral' | 'accent' | 'success' | 'warning' | 'danger';
68
+ export type BadgeSize = 'sm' | 'md';
69
+ export interface DBadgeProps {
70
+ variant?: BadgeVariant;
71
+ size?: BadgeSize;
72
+ label?: string;
73
+ dot?: boolean;
74
+ theme?: Theme;
75
+ className?: string;
76
+ style?: React.CSSProperties;
77
+ children?: React.ReactNode;
78
+ }
79
+ export declare function DBadge({ variant, size, label, dot, theme, className, style, children, }: DBadgeProps): React.DOMElement<Record<string, unknown>, Element>;
80
+ export interface DIconProps {
81
+ name: string;
82
+ size?: number;
83
+ color?: string;
84
+ label?: string;
85
+ theme?: Theme;
86
+ className?: string;
87
+ style?: React.CSSProperties;
88
+ }
89
+ export declare function DIcon({ name, size, color, label, theme, className, style, }: DIconProps): React.DOMElement<Record<string, unknown>, Element>;
90
+ export {};
91
+ //# sourceMappingURL=index.d.ts.map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B,KAAc,EACd,SAAS,EACT,KAAK,GACN,EAAE,aAAa,sDAUf;AAID,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AACnF,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;AAEpC,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,wBAAgB,MAAM,CAAC,EACrB,OAAmB,EACnB,IAAW,EACX,KAAK,EACL,GAAW,EACX,KAAc,EACd,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EAAE,WAAW,sDAab;AASD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED,wBAAgB,KAAK,CAAC,EACpB,IAAI,EACJ,IAAS,EACT,KAAsB,EACtB,KAAK,EACL,KAAc,EACd,SAAS,EACT,KAAK,GACN,EAAE,UAAU,sDAaZ"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * @diwacopilot/components-react/server
3
+ *
4
+ * RSC-safe (React Server Component-safe) exports.
5
+ *
6
+ * These are pure function components that render Diwa custom element shells as
7
+ * plain HTML attributes. They do NOT import `createReactComponent`, do NOT call
8
+ * `defineCustomElements()`, and do NOT extend React.Component — so they are safe
9
+ * to import in Next.js Server Components (and any other RSC-compatible runtime).
10
+ *
11
+ * On the server they produce the correct HTML skeleton; the browser upgrades the
12
+ * custom elements and attaches shadow DOM once the Stencil bundle loads.
13
+ *
14
+ * Supported components (presentational / no event delegation or refs needed):
15
+ * DHeading, DText, DDivider, DBadge, DIcon
16
+ *
17
+ * Interactive components (DButton, DInput*, DModal, DFlyout, …) are intentionally
18
+ * excluded — they rely on refs, DOM event delegation, and the custom element
19
+ * registry. Import them from '@diwacopilot/components-react' inside a 'use client'
20
+ * file as before.
21
+ */
22
+ import React from 'react';
23
+ export function DHeading({ size = 'h2', tag, weight = 'bold', align = 'start', color = 'primary', theme = 'dark', className, style, children, }) {
24
+ const props = {
25
+ size,
26
+ weight,
27
+ align,
28
+ color,
29
+ theme,
30
+ suppressHydrationWarning: true,
31
+ };
32
+ if (tag !== undefined)
33
+ props['tag'] = tag;
34
+ if (className !== undefined)
35
+ props['class'] = className;
36
+ if (style !== undefined)
37
+ props['style'] = style;
38
+ return React.createElement('diwa-heading', props, children);
39
+ }
40
+ export function DText({ tag = 'p', size = 'small', weight = 'regular', align = 'start', color = 'primary', ellipsis = false, theme = 'dark', className, style, children, }) {
41
+ const props = {
42
+ tag,
43
+ size,
44
+ weight,
45
+ align,
46
+ color,
47
+ theme,
48
+ suppressHydrationWarning: true,
49
+ };
50
+ if (ellipsis)
51
+ props['ellipsis'] = true;
52
+ if (className !== undefined)
53
+ props['class'] = className;
54
+ if (style !== undefined)
55
+ props['style'] = style;
56
+ return React.createElement('diwa-text', props, children);
57
+ }
58
+ export function DDivider({ orientation = 'horizontal', theme = 'dark', className, style, }) {
59
+ const props = {
60
+ orientation,
61
+ theme,
62
+ suppressHydrationWarning: true,
63
+ };
64
+ if (className !== undefined)
65
+ props['class'] = className;
66
+ if (style !== undefined)
67
+ props['style'] = style;
68
+ return React.createElement('diwa-divider', props);
69
+ }
70
+ export function DBadge({ variant = 'neutral', size = 'md', label, dot = false, theme = 'dark', className, style, children, }) {
71
+ const props = {
72
+ variant,
73
+ size,
74
+ theme,
75
+ suppressHydrationWarning: true,
76
+ };
77
+ if (dot)
78
+ props['dot'] = true;
79
+ if (label !== undefined)
80
+ props['label'] = label;
81
+ if (className !== undefined)
82
+ props['class'] = className;
83
+ if (style !== undefined)
84
+ props['style'] = style;
85
+ return React.createElement('diwa-badge', props, children);
86
+ }
87
+ export function DIcon({ name, size = 24, color = 'currentColor', label, theme = 'dark', className, style, }) {
88
+ const props = {
89
+ name,
90
+ size,
91
+ color,
92
+ theme,
93
+ suppressHydrationWarning: true,
94
+ };
95
+ if (label !== undefined)
96
+ props['label'] = label;
97
+ if (className !== undefined)
98
+ props['class'] = className;
99
+ if (style !== undefined)
100
+ props['style'] = style;
101
+ return React.createElement('diwa-icon', props);
102
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diwacopilot/components-react",
3
- "version": "1.2.3",
3
+ "version": "1.3.0",
4
4
  "description": "React wrapper package for Diwa Web Components.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,6 +14,10 @@
14
14
  ".": {
15
15
  "types": "./dist/index.d.ts",
16
16
  "import": "./dist/index.js"
17
+ },
18
+ "./server": {
19
+ "types": "./dist/server/index.d.ts",
20
+ "import": "./dist/server/index.js"
17
21
  }
18
22
  },
19
23
  "scripts": {