@mariotzz/tzz-element 2.0.0 → 2.1.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,155 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/Button/button.tsx
30
+ var button_exports = {};
31
+ __export(button_exports, {
32
+ Button: () => Button
33
+ });
34
+ module.exports = __toCommonJS(button_exports);
35
+ var React = __toESM(require("react"));
36
+ var import_button_module = __toESM(require("./button.module.css"));
37
+ var import_utils = require("./utils");
38
+ var import_jsx_runtime = require("react/jsx-runtime");
39
+ function hasReadableText(node) {
40
+ if (node === null || node === void 0 || typeof node === "boolean")
41
+ return false;
42
+ if (typeof node === "string" || typeof node === "number")
43
+ return String(node).trim().length > 0;
44
+ if (Array.isArray(node))
45
+ return node.some(hasReadableText);
46
+ if (React.isValidElement(node))
47
+ return hasReadableText(node.props.children);
48
+ return false;
49
+ }
50
+ var Button = React.forwardRef(
51
+ function Button2(props, ref) {
52
+ const {
53
+ variant = "default",
54
+ size = "md",
55
+ block = false,
56
+ disabled = false,
57
+ loading = false,
58
+ loadingText,
59
+ startIcon,
60
+ endIcon,
61
+ spinnerPlacement = "start",
62
+ asChild = false,
63
+ className,
64
+ children,
65
+ // 原生 props(我们需要包一层以实现 disabled/loading 的拦截)
66
+ onClick,
67
+ onKeyDown,
68
+ // 原生 button type:默认 button,避免 <form> 内误提交
69
+ type,
70
+ ...rest
71
+ } = props;
72
+ const isDisabled = disabled || loading;
73
+ if (process.env.NODE_ENV !== "production") {
74
+ if (size === "icon") {
75
+ const hasText = hasReadableText(children);
76
+ const ariaLabel = props["aria-label"];
77
+ if (!hasText && (!ariaLabel || ariaLabel.trim().length === 0)) {
78
+ console.warn(
79
+ '[tzz-element/Button] size="icon" 时建议提供 aria-label(或 children 包含可读文本),以满足无障碍要求。'
80
+ );
81
+ }
82
+ }
83
+ }
84
+ const handleClick = (e) => {
85
+ if (isDisabled) {
86
+ e.preventDefault();
87
+ e.stopPropagation();
88
+ return;
89
+ }
90
+ onClick == null ? void 0 : onClick(e);
91
+ };
92
+ const handleKeyDown = (e) => {
93
+ if (isDisabled) {
94
+ if (e.key === "Enter" || e.key === " ") {
95
+ e.preventDefault();
96
+ e.stopPropagation();
97
+ return;
98
+ }
99
+ }
100
+ onKeyDown == null ? void 0 : onKeyDown(e);
101
+ };
102
+ const classes = (0, import_utils.cn)(
103
+ import_button_module.default.button,
104
+ import_button_module.default[variant],
105
+ import_button_module.default[size],
106
+ block && import_button_module.default.block,
107
+ className
108
+ );
109
+ const content = loading ? loadingText ?? children : children;
110
+ const Spinner = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_button_module.default.iconSlot, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_button_module.default.spinner }) });
111
+ const Start = loading && spinnerPlacement === "start" ? Spinner : startIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_button_module.default.iconSlot, "aria-hidden": "true", children: startIcon }) : null;
112
+ const End = loading && spinnerPlacement === "end" ? Spinner : endIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_button_module.default.iconSlot, "aria-hidden": "true", children: endIcon }) : null;
113
+ const sharedProps = {
114
+ className: classes,
115
+ "data-variant": variant,
116
+ "data-size": size,
117
+ "data-disabled": isDisabled ? "true" : "false",
118
+ "data-loading": loading ? "true" : "false",
119
+ "aria-busy": loading ? true : void 0,
120
+ onClick: handleClick,
121
+ onKeyDown: handleKeyDown,
122
+ ...rest
123
+ };
124
+ if (asChild) {
125
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
126
+ import_utils.Slot,
127
+ {
128
+ ref,
129
+ ...sharedProps,
130
+ "aria-disabled": isDisabled ? true : void 0,
131
+ tabIndex: isDisabled ? -1 : rest.tabIndex,
132
+ children
133
+ }
134
+ );
135
+ }
136
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
137
+ "button",
138
+ {
139
+ ref,
140
+ disabled: isDisabled,
141
+ ...sharedProps,
142
+ type: type === "submit" ? "submit" : type === "reset" ? "reset" : "button",
143
+ children: [
144
+ Start,
145
+ content,
146
+ End
147
+ ]
148
+ }
149
+ );
150
+ }
151
+ );
152
+ // Annotate the CommonJS export names for ESM import in node:
153
+ 0 && (module.exports = {
154
+ Button
155
+ });
@@ -0,0 +1,164 @@
1
+ /* button.module.css
2
+ 设计目标:
3
+ - 使用 CSS Variables 方便主题化
4
+ - focus-visible 清晰可见(键盘才出现)
5
+ - disabled/loading 统一语义(原生 disabled + data-disabled)
6
+ */
7
+
8
+ .button {
9
+ --tzz-radius: 10px;
10
+ --tzz-fg: #111827;
11
+ --tzz-bg: #fff;
12
+ --tzz-border: rgba(17, 24, 39, 14%);
13
+ --tzz-primary: #1677ff;
14
+ --tzz-primary-fg: #fff;
15
+ --tzz-danger: #ef4444;
16
+ --tzz-danger-fg: #fff;
17
+ --tzz-ring: rgba(22, 119, 255, 35%);
18
+
19
+ appearance: none;
20
+ border: 1px solid var(--tzz-border);
21
+ background: var(--tzz-bg);
22
+ color: var(--tzz-fg);
23
+ display: inline-flex;
24
+ align-items: center;
25
+ justify-content: center;
26
+ vertical-align: middle;
27
+ gap: 8px;
28
+ white-space: nowrap;
29
+ user-select: none;
30
+ font-weight: 600;
31
+ line-height: 1;
32
+ text-decoration: none;
33
+ border-radius: var(--tzz-radius);
34
+ transition: background-color 160ms ease, border-color 160ms ease,
35
+ color 160ms ease, box-shadow 160ms ease, transform 80ms ease;
36
+ cursor: pointer;
37
+ }
38
+
39
+ /* sizes */
40
+ .sm {
41
+ height: 32px;
42
+ padding: 0 12px;
43
+ font-size: 13px;
44
+ }
45
+
46
+ .md {
47
+ height: 36px;
48
+ padding: 0 14px;
49
+ font-size: 14px;
50
+ }
51
+
52
+ .lg {
53
+ height: 42px;
54
+ padding: 0 18px;
55
+ font-size: 15px;
56
+ }
57
+
58
+ .icon {
59
+ height: 36px;
60
+ width: 36px;
61
+ padding: 0;
62
+ }
63
+
64
+ /* block */
65
+ .block {
66
+ width: 100%;
67
+ }
68
+
69
+ /* variants */
70
+ .default {
71
+ background: var(--tzz-bg);
72
+ color: var(--tzz-fg);
73
+ border-color: var(--tzz-border);
74
+ }
75
+
76
+ .primary {
77
+ background: var(--tzz-primary);
78
+ color: var(--tzz-primary-fg);
79
+ border-color: transparent;
80
+ }
81
+
82
+ .secondary {
83
+ background: rgba(17, 24, 39, 6%);
84
+ color: var(--tzz-fg);
85
+ border-color: rgba(17, 24, 39, 8%);
86
+ }
87
+
88
+ .ghost {
89
+ background: transparent;
90
+ color: var(--tzz-fg);
91
+ border-color: transparent;
92
+ }
93
+
94
+ .link {
95
+ background: transparent;
96
+ color: var(--tzz-primary);
97
+ border-color: transparent;
98
+ padding-left: 0;
99
+ padding-right: 0;
100
+ height: auto;
101
+ }
102
+
103
+ .destructive {
104
+ background: var(--tzz-danger);
105
+ color: var(--tzz-danger-fg);
106
+ border-color: transparent;
107
+ }
108
+
109
+ /* states: hover/active (exclude disabled/loading) */
110
+ .button:not([data-disabled='true']):not([data-loading='true']):hover {
111
+ filter: brightness(0.98);
112
+ }
113
+
114
+ .default:not([data-disabled='true']):not([data-loading='true']):hover {
115
+ background: rgba(17, 24, 39, 3%);
116
+ }
117
+
118
+ .ghost:not([data-disabled='true']):not([data-loading='true']):hover {
119
+ background: rgba(17, 24, 39, 5%);
120
+ }
121
+
122
+ .link:not([data-disabled='true']):not([data-loading='true']):hover {
123
+ text-decoration: underline;
124
+ }
125
+
126
+ .button:not([data-disabled='true']):not([data-loading='true']):active {
127
+ transform: translateY(0.5px);
128
+ }
129
+
130
+ /* focus-visible */
131
+ .button:focus-visible {
132
+ outline: none;
133
+ box-shadow: 0 0 0 4px var(--tzz-ring);
134
+ }
135
+
136
+ /* disabled/loading */
137
+ .button[disabled],
138
+ .button[data-disabled='true'] {
139
+ opacity: 0.55;
140
+ cursor: not-allowed;
141
+ }
142
+
143
+ /* spinner / icon slots */
144
+ .iconSlot {
145
+ display: inline-flex;
146
+ align-items: center;
147
+ justify-content: center;
148
+ line-height: 0;
149
+ }
150
+
151
+ .spinner {
152
+ width: 1em;
153
+ height: 1em;
154
+ border: 2px solid currentcolor;
155
+ border-right-color: transparent;
156
+ border-radius: 9999px;
157
+ animation: spin 800ms linear infinite;
158
+ }
159
+
160
+ @keyframes spin {
161
+ to {
162
+ transform: rotate(360deg);
163
+ }
164
+ }
@@ -1,7 +1,2 @@
1
- import { Button as AntButton } from 'antd';
2
- import React from 'react';
3
- export type ButtonProps = React.ComponentProps<typeof AntButton> & {
4
- dangerLight?: boolean;
5
- };
6
- export declare const Button: React.FC<ButtonProps>;
7
- export default Button;
1
+ export { Button } from './button';
2
+ export type { ButtonProps, ButtonSize, ButtonVariant } from './types';
@@ -16,19 +16,13 @@ var __copyProps = (to, from, except, desc) => {
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
 
19
- // src/Button/index.tsx
19
+ // src/Button/index.ts
20
20
  var Button_exports = {};
21
21
  __export(Button_exports, {
22
- Button: () => Button,
23
- default: () => Button_default
22
+ Button: () => import_button.Button
24
23
  });
25
24
  module.exports = __toCommonJS(Button_exports);
26
- var import_antd = require("antd");
27
- var import_jsx_runtime = require("react/jsx-runtime");
28
- var Button = ({ dangerLight, ...props }) => {
29
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Button, { ...props, danger: dangerLight ?? props.danger });
30
- };
31
- var Button_default = Button;
25
+ var import_button = require("./button");
32
26
  // Annotate the CommonJS export names for ESM import in node:
33
27
  0 && (module.exports = {
34
28
  Button
@@ -0,0 +1,58 @@
1
+ import * as React from 'react';
2
+ export type ButtonVariant = 'default' | 'primary' | 'secondary' | 'ghost' | 'link' | 'destructive';
3
+ export type ButtonSize = 'sm' | 'md' | 'lg' | 'icon';
4
+ export type ButtonIconPosition = 'start' | 'end';
5
+ type NativeButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;
6
+ export interface ButtonProps extends Omit<NativeButtonProps, 'disabled'> {
7
+ /**
8
+ * 视觉变体
9
+ */
10
+ variant?: ButtonVariant;
11
+ /**
12
+ * 尺寸
13
+ * - icon: 纯图标按钮(建议提供 aria-label)
14
+ */
15
+ size?: ButtonSize;
16
+ /**
17
+ * 是否撑满父容器宽度(类似 antd block)
18
+ */
19
+ block?: boolean;
20
+ /**
21
+ * 禁用(asChild 场景使用 aria-disabled + 阻止交互)
22
+ */
23
+ disabled?: boolean;
24
+ /**
25
+ * 加载态:自动禁用交互,并设置 aria-busy
26
+ */
27
+ loading?: boolean;
28
+ /**
29
+ * loading 时展示的文案(可选)
30
+ */
31
+ loadingText?: React.ReactNode;
32
+ /**
33
+ * 左侧图标
34
+ */
35
+ startIcon?: React.ReactNode;
36
+ /**
37
+ * 右侧图标
38
+ */
39
+ endIcon?: React.ReactNode;
40
+ /**
41
+ * spinner 所在位置(默认 start)
42
+ */
43
+ spinnerPlacement?: ButtonIconPosition;
44
+ /**
45
+ * 多态:将 Button 的 className/事件/属性注入到子元素(类似 shadcn asChild)
46
+ * - children 必须是单个 ReactElement
47
+ */
48
+ asChild?: boolean;
49
+ /**
50
+ * icon-only 的可访问性文案(size="icon" 且无可读文本时强烈建议)
51
+ */
52
+ 'aria-label'?: string;
53
+ /**
54
+ * 测试定位
55
+ */
56
+ 'data-testid'?: string;
57
+ }
58
+ export {};
@@ -2,10 +2,6 @@ var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
5
  var __copyProps = (to, from, except, desc) => {
10
6
  if (from && typeof from === "object" || typeof from === "function") {
11
7
  for (let key of __getOwnPropNames(from))
@@ -16,12 +12,6 @@ var __copyProps = (to, from, except, desc) => {
16
12
  };
17
13
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
14
 
19
- // src/Foo/index.tsx
20
- var Foo_exports = {};
21
- __export(Foo_exports, {
22
- default: () => Foo_default
23
- });
24
- module.exports = __toCommonJS(Foo_exports);
25
- var import_jsx_runtime = require("react/jsx-runtime");
26
- var Foo = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h4", { children: props.title });
27
- var Foo_default = Foo;
15
+ // src/Button/types.ts
16
+ var types_exports = {};
17
+ module.exports = __toCommonJS(types_exports);
@@ -0,0 +1,32 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * 类名合并工具(不引入 clsx/classnames,保持库自包含)
4
+ * 支持:
5
+ * - cn('a', 'b')
6
+ * - cn('a', condition && 'b')
7
+ * - cn(['a', 'b'])
8
+ * - cn({ a: true, b: false })
9
+ */
10
+ export type ClassValue = string | number | null | undefined | false | ClassValue[] | Record<string, boolean>;
11
+ export declare function cn(...inputs: ClassValue[]): string;
12
+ /**
13
+ * 合并多个 ref(forwardRef + childRef 场景)
14
+ */
15
+ export declare function composeRefs<T>(...refs: Array<React.Ref<T> | undefined>): (node: T) => void;
16
+ /**
17
+ * 合并事件处理器:先执行 ours,再执行 theirs
18
+ * - 如果 ours 调用了 preventDefault / stopPropagation,theirs 仍可能执行(取决于你是否 early return)
19
+ * 所以建议在 ours 内部对 disabled/loading 做 early return。
20
+ */
21
+ export declare function mergeHandlers<E extends {
22
+ defaultPrevented?: boolean;
23
+ }>(ours?: (event: E) => void, theirs?: (event: E) => void): (event: E) => void;
24
+ /**
25
+ * Slot:将 props/className/ref 注入到 child(asChild 模式)
26
+ * - 不依赖 @radix-ui/react-slot
27
+ * - 仅支持单个 ReactElement
28
+ */
29
+ export interface SlotProps extends React.HTMLAttributes<HTMLElement> {
30
+ children: React.ReactElement<any>;
31
+ }
32
+ export declare const Slot: React.ForwardRefExoticComponent<SlotProps & React.RefAttributes<HTMLElement>>;
@@ -0,0 +1,113 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/Button/utils.ts
30
+ var utils_exports = {};
31
+ __export(utils_exports, {
32
+ Slot: () => Slot,
33
+ cn: () => cn,
34
+ composeRefs: () => composeRefs,
35
+ mergeHandlers: () => mergeHandlers
36
+ });
37
+ module.exports = __toCommonJS(utils_exports);
38
+ var React = __toESM(require("react"));
39
+ function cn(...inputs) {
40
+ const classes = [];
41
+ const push = (v) => {
42
+ if (!v)
43
+ return;
44
+ if (typeof v === "string" || typeof v === "number") {
45
+ classes.push(String(v));
46
+ return;
47
+ }
48
+ if (Array.isArray(v)) {
49
+ v.forEach(push);
50
+ return;
51
+ }
52
+ if (typeof v === "object") {
53
+ for (const [k, ok] of Object.entries(v)) {
54
+ if (ok)
55
+ classes.push(k);
56
+ }
57
+ }
58
+ };
59
+ inputs.forEach(push);
60
+ return classes.join(" ");
61
+ }
62
+ function composeRefs(...refs) {
63
+ return (node) => {
64
+ for (const ref of refs) {
65
+ if (!ref)
66
+ continue;
67
+ if (typeof ref === "function")
68
+ ref(node);
69
+ else
70
+ ref.current = node;
71
+ }
72
+ };
73
+ }
74
+ function mergeHandlers(ours, theirs) {
75
+ return (event) => {
76
+ ours == null ? void 0 : ours(event);
77
+ if (event.defaultPrevented)
78
+ return;
79
+ theirs == null ? void 0 : theirs(event);
80
+ };
81
+ }
82
+ var Slot = React.forwardRef(function Slot2({ children, className, style, onClick, onKeyDown, ...rest }, forwardedRef) {
83
+ if (!React.isValidElement(children))
84
+ return null;
85
+ const childProps = children.props;
86
+ const mergedClassName = cn(childProps.className, className);
87
+ const mergedStyle = { ...childProps.style || {}, ...style || {} };
88
+ const mergedOnClick = mergeHandlers(
89
+ onClick,
90
+ childProps.onClick
91
+ );
92
+ const mergedOnKeyDown = mergeHandlers(
93
+ onKeyDown,
94
+ childProps.onKeyDown
95
+ );
96
+ const mergedRef = composeRefs(children.ref, forwardedRef);
97
+ return React.cloneElement(children, {
98
+ ...rest,
99
+ ...childProps,
100
+ className: mergedClassName,
101
+ style: mergedStyle,
102
+ onClick: mergedOnClick,
103
+ onKeyDown: mergedOnKeyDown,
104
+ ref: mergedRef
105
+ });
106
+ });
107
+ // Annotate the CommonJS export names for ESM import in node:
108
+ 0 && (module.exports = {
109
+ Slot,
110
+ cn,
111
+ composeRefs,
112
+ mergeHandlers
113
+ });
package/lib/index.d.ts CHANGED
@@ -1,3 +1 @@
1
- export { default as Button } from './Button';
2
- export { default as Demo } from './Demo';
3
- export { default as Foo } from './Foo';
1
+ export { Button } from './Button';
package/lib/index.js CHANGED
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __export = (target, all) => {
8
6
  for (var name in all)
@@ -16,30 +14,16 @@ var __copyProps = (to, from, except, desc) => {
16
14
  }
17
15
  return to;
18
16
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
18
 
29
19
  // src/index.ts
30
20
  var src_exports = {};
31
21
  __export(src_exports, {
32
- Button: () => import_Button.default,
33
- Demo: () => import_Demo.default,
34
- Foo: () => import_Foo.default
22
+ Button: () => import_Button.Button
35
23
  });
36
24
  module.exports = __toCommonJS(src_exports);
37
- var import_Button = __toESM(require("./Button"));
38
- var import_Demo = __toESM(require("./Demo"));
39
- var import_Foo = __toESM(require("./Foo"));
25
+ var import_Button = require("./Button");
40
26
  // Annotate the CommonJS export names for ESM import in node:
41
27
  0 && (module.exports = {
42
- Button,
43
- Demo,
44
- Foo
28
+ Button
45
29
  });
@@ -0,0 +1,4 @@
1
+ declare module '*.module.css' {
2
+ const classes: Record<string, string>;
3
+ export default classes;
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mariotzz/tzz-element",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": {
@@ -1,5 +0,0 @@
1
- import { type FC } from 'react';
2
- declare const Demo: FC<{
3
- title: string;
4
- }>;
5
- export default Demo;
package/es/Demo/index.js DELETED
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- var Demo = function Demo(props) {
4
- return /*#__PURE__*/_jsx("h4", {
5
- children: props.title
6
- });
7
- };
8
- export default Demo;
package/es/Foo/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { type FC } from 'react';
2
- declare const Foo: FC<{
3
- title: string;
4
- }>;
5
- export default Foo;
package/es/Foo/index.js DELETED
@@ -1,7 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- var Foo = function Foo(props) {
3
- return /*#__PURE__*/_jsx("h4", {
4
- children: props.title
5
- });
6
- };
7
- export default Foo;
@@ -1,5 +0,0 @@
1
- import { type FC } from 'react';
2
- declare const Demo: FC<{
3
- title: string;
4
- }>;
5
- export default Demo;