@deepnoid/ui 0.1.83 → 0.1.85

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.
@@ -5005,7 +5005,7 @@ var Icon = ({ name, size = "md", fill = false, className, onClick, ...props }) =
5005
5005
  var Icon_default = Icon;
5006
5006
 
5007
5007
  // src/components/button/button.tsx
5008
- var import_react2 = __toESM(require("react"));
5008
+ var import_react2 = require("react");
5009
5009
 
5010
5010
  // src/components/ripple/ripple.tsx
5011
5011
  var import_framer_motion = require("framer-motion");
@@ -5077,7 +5077,7 @@ function useRipple(props = {}) {
5077
5077
  var import_jsx_runtime4 = require("react/jsx-runtime");
5078
5078
  var Button = (0, import_react2.forwardRef)((originalProps, ref) => {
5079
5079
  const [props, variantProps] = mapPropsVariants(originalProps, buttonStyle.variantKeys);
5080
- const { classNames, startContent, endContent, disableRipple, children, ...buttonProps } = props;
5080
+ const { classNames, startContent, endContent, disableRipple, asChild, children, ...buttonProps } = props;
5081
5081
  const slots = (0, import_react2.useMemo)(() => buttonStyle({ ...variantProps }), [variantProps]);
5082
5082
  const { onPress: onRipplePressHandler, onClear: onClearRipple, ripples } = useRipple();
5083
5083
  const handlePress = (0, import_react2.useCallback)(
@@ -5119,25 +5119,46 @@ var Button = (0, import_react2.forwardRef)((originalProps, ref) => {
5119
5119
  [slots, classNames, originalProps.size]
5120
5120
  );
5121
5121
  const renderContent = (content) => {
5122
- if (import_react2.default.isValidElement(content)) {
5122
+ if ((0, import_react2.isValidElement)(content)) {
5123
5123
  const _content = content;
5124
5124
  const existingProps = _content.props;
5125
5125
  const mergedProps = {
5126
5126
  ...getContentProps(),
5127
5127
  className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
5128
5128
  };
5129
- return import_react2.default.cloneElement(content, mergedProps);
5129
+ return (0, import_react2.cloneElement)(content, mergedProps);
5130
5130
  } else {
5131
5131
  const contentProps = getContentProps();
5132
5132
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ...contentProps, children: content });
5133
5133
  }
5134
5134
  };
5135
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { ...getBaseProps(), children: originalProps.isLoading ? renderContent(/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon_default, { name: "loading", className: "animate-spin" })) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
5135
+ const buttonContent = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: originalProps.isLoading ? renderContent(/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon_default, { name: "loading", className: "animate-spin" })) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
5136
5136
  startContent && renderContent(startContent),
5137
5137
  children,
5138
5138
  endContent && renderContent(endContent),
5139
5139
  !disableRipple && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ripple_default, { ...getRippleProps() })
5140
5140
  ] }) });
5141
+ if (asChild && (0, import_react2.isValidElement)(children)) {
5142
+ const childElement = children;
5143
+ const baseProps = getBaseProps();
5144
+ const mergedProps = {
5145
+ ...childElement.props,
5146
+ ...baseProps,
5147
+ className: `${baseProps.className || ""} ${childElement.props.className || ""}`.trim(),
5148
+ onClick: (e) => {
5149
+ var _a, _b, _c;
5150
+ (_b = (_a = childElement.props).onClick) == null ? void 0 : _b.call(_a, e);
5151
+ (_c = baseProps.onClick) == null ? void 0 : _c.call(baseProps, e);
5152
+ },
5153
+ onMouseDown: (e) => {
5154
+ var _a, _b, _c;
5155
+ (_b = (_a = childElement.props).onMouseDown) == null ? void 0 : _b.call(_a, e);
5156
+ (_c = baseProps.onMouseDown) == null ? void 0 : _c.call(baseProps, e);
5157
+ }
5158
+ };
5159
+ return (0, import_react2.cloneElement)(childElement, mergedProps);
5160
+ }
5161
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { ...getBaseProps(), children: buttonContent });
5141
5162
  });
5142
5163
  Button.displayName = "Button";
5143
5164
  var button_default = Button;
@@ -1,17 +1,17 @@
1
1
  "use client";
2
2
  import {
3
3
  modal_default
4
- } from "../../chunk-4ORPRDPL.mjs";
4
+ } from "../../chunk-D6OJWEZM.mjs";
5
5
  import "../../chunk-SE5TU755.mjs";
6
6
  import "../../chunk-AF4I7ZQS.mjs";
7
7
  import "../../chunk-MY5U63QO.mjs";
8
8
  import "../../chunk-JBSV7GCL.mjs";
9
9
  import "../../chunk-ITWKPTSD.mjs";
10
- import "../../chunk-B6YYZVT6.mjs";
11
- import "../../chunk-Z6IOS3S6.mjs";
10
+ import "../../chunk-V5OCV42N.mjs";
11
+ import "../../chunk-P6CRHHI3.mjs";
12
12
  import "../../chunk-6WSACUIB.mjs";
13
- import "../../chunk-6PNKRBUT.mjs";
14
13
  import "../../chunk-LXHUO6VM.mjs";
14
+ import "../../chunk-6PNKRBUT.mjs";
15
15
  import "../../chunk-ZYIIXWVY.mjs";
16
16
  import "../../chunk-JP4TEWP7.mjs";
17
17
  import "../../chunk-E3G5QXSH.mjs";
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import "../../chunk-6WSACUIB.mjs";
3
- import {
4
- useRipple
5
- } from "../../chunk-6PNKRBUT.mjs";
6
3
  import {
7
4
  ripple_default
8
5
  } from "../../chunk-LXHUO6VM.mjs";
6
+ import {
7
+ useRipple
8
+ } from "../../chunk-6PNKRBUT.mjs";
9
9
  import "../../chunk-AC6TWLRT.mjs";
10
10
  export {
11
11
  ripple_default as Ripple,
package/dist/index.js CHANGED
@@ -5773,7 +5773,7 @@ var backdropStyle = tv({
5773
5773
  var import_react10 = require("react");
5774
5774
 
5775
5775
  // src/components/button/button.tsx
5776
- var import_react6 = __toESM(require("react"));
5776
+ var import_react6 = require("react");
5777
5777
 
5778
5778
  // src/components/ripple/ripple.tsx
5779
5779
  var import_framer_motion = require("framer-motion");
@@ -5845,7 +5845,7 @@ function useRipple(props = {}) {
5845
5845
  var import_jsx_runtime8 = require("react/jsx-runtime");
5846
5846
  var Button = (0, import_react6.forwardRef)((originalProps, ref) => {
5847
5847
  const [props, variantProps] = mapPropsVariants(originalProps, buttonStyle.variantKeys);
5848
- const { classNames, startContent, endContent, disableRipple, children, ...buttonProps } = props;
5848
+ const { classNames, startContent, endContent, disableRipple, asChild, children, ...buttonProps } = props;
5849
5849
  const slots = (0, import_react6.useMemo)(() => buttonStyle({ ...variantProps }), [variantProps]);
5850
5850
  const { onPress: onRipplePressHandler, onClear: onClearRipple, ripples } = useRipple();
5851
5851
  const handlePress = (0, import_react6.useCallback)(
@@ -5887,25 +5887,46 @@ var Button = (0, import_react6.forwardRef)((originalProps, ref) => {
5887
5887
  [slots, classNames, originalProps.size]
5888
5888
  );
5889
5889
  const renderContent = (content) => {
5890
- if (import_react6.default.isValidElement(content)) {
5890
+ if ((0, import_react6.isValidElement)(content)) {
5891
5891
  const _content = content;
5892
5892
  const existingProps = _content.props;
5893
5893
  const mergedProps = {
5894
5894
  ...getContentProps(),
5895
5895
  className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
5896
5896
  };
5897
- return import_react6.default.cloneElement(content, mergedProps);
5897
+ return (0, import_react6.cloneElement)(content, mergedProps);
5898
5898
  } else {
5899
5899
  const contentProps = getContentProps();
5900
5900
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ...contentProps, children: content });
5901
5901
  }
5902
5902
  };
5903
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { ...getBaseProps(), children: originalProps.isLoading ? renderContent(/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon_default, { name: "loading", className: "animate-spin" })) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
5903
+ const buttonContent = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: originalProps.isLoading ? renderContent(/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon_default, { name: "loading", className: "animate-spin" })) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
5904
5904
  startContent && renderContent(startContent),
5905
5905
  children,
5906
5906
  endContent && renderContent(endContent),
5907
5907
  !disableRipple && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ripple_default, { ...getRippleProps() })
5908
5908
  ] }) });
5909
+ if (asChild && (0, import_react6.isValidElement)(children)) {
5910
+ const childElement = children;
5911
+ const baseProps = getBaseProps();
5912
+ const mergedProps = {
5913
+ ...childElement.props,
5914
+ ...baseProps,
5915
+ className: `${baseProps.className || ""} ${childElement.props.className || ""}`.trim(),
5916
+ onClick: (e) => {
5917
+ var _a, _b, _c;
5918
+ (_b = (_a = childElement.props).onClick) == null ? void 0 : _b.call(_a, e);
5919
+ (_c = baseProps.onClick) == null ? void 0 : _c.call(baseProps, e);
5920
+ },
5921
+ onMouseDown: (e) => {
5922
+ var _a, _b, _c;
5923
+ (_b = (_a = childElement.props).onMouseDown) == null ? void 0 : _b.call(_a, e);
5924
+ (_c = baseProps.onMouseDown) == null ? void 0 : _c.call(baseProps, e);
5925
+ }
5926
+ };
5927
+ return (0, import_react6.cloneElement)(childElement, mergedProps);
5928
+ }
5929
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { ...getBaseProps(), children: buttonContent });
5909
5930
  });
5910
5931
  Button.displayName = "Button";
5911
5932
  var button_default = Button;
package/dist/index.mjs CHANGED
@@ -60,7 +60,7 @@ import {
60
60
  import "./chunk-DJOG6Z35.mjs";
61
61
  import {
62
62
  modal_default
63
- } from "./chunk-4ORPRDPL.mjs";
63
+ } from "./chunk-D6OJWEZM.mjs";
64
64
  import "./chunk-7B7LRG5J.mjs";
65
65
  import {
66
66
  pagination_default
@@ -70,7 +70,7 @@ import "./chunk-32GA3YW4.mjs";
70
70
  import "./chunk-RLXOHILK.mjs";
71
71
  import {
72
72
  fileUpload_default
73
- } from "./chunk-7GFYCPP3.mjs";
73
+ } from "./chunk-Q3JMHIW5.mjs";
74
74
  import "./chunk-2GCSFWHD.mjs";
75
75
  import {
76
76
  input_default
@@ -111,14 +111,14 @@ import {
111
111
  import {
112
112
  chip_default
113
113
  } from "./chunk-TZHEZEJ5.mjs";
114
- import "./chunk-KYIODWXL.mjs";
115
- import {
116
- breadcrumb_default
117
- } from "./chunk-RE2WH26E.mjs";
118
114
  import "./chunk-SE5TU755.mjs";
119
115
  import {
120
116
  backdrop_default
121
117
  } from "./chunk-AF4I7ZQS.mjs";
118
+ import "./chunk-KYIODWXL.mjs";
119
+ import {
120
+ breadcrumb_default
121
+ } from "./chunk-RE2WH26E.mjs";
122
122
  import "./chunk-MY5U63QO.mjs";
123
123
  import {
124
124
  text_button_default
@@ -128,13 +128,13 @@ import {
128
128
  } from "./chunk-ITWKPTSD.mjs";
129
129
  import {
130
130
  button_default
131
- } from "./chunk-B6YYZVT6.mjs";
131
+ } from "./chunk-V5OCV42N.mjs";
132
132
  import {
133
133
  icon_button_default
134
- } from "./chunk-Z6IOS3S6.mjs";
134
+ } from "./chunk-P6CRHHI3.mjs";
135
135
  import "./chunk-6WSACUIB.mjs";
136
- import "./chunk-6PNKRBUT.mjs";
137
136
  import "./chunk-LXHUO6VM.mjs";
137
+ import "./chunk-6PNKRBUT.mjs";
138
138
  import "./chunk-NMSDSEBD.mjs";
139
139
  import {
140
140
  accordion_default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepnoid/ui",
3
- "version": "0.1.83",
3
+ "version": "0.1.85",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import {
3
- useRipple
4
- } from "./chunk-6PNKRBUT.mjs";
5
2
  import {
6
3
  ripple_default
7
4
  } from "./chunk-LXHUO6VM.mjs";
5
+ import {
6
+ useRipple
7
+ } from "./chunk-6PNKRBUT.mjs";
8
8
  import {
9
9
  Icon_default
10
10
  } from "./chunk-JP4TEWP7.mjs";