@designbasekorea/ui 0.1.14 → 0.1.16

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/dist/index.js CHANGED
@@ -4902,6 +4902,17 @@ const Input = React.forwardRef(({ type = 'text', label, placeholder, defaultValu
4902
4902
  });
4903
4903
  Input.displayName = 'Input';
4904
4904
 
4905
+ // DoneIcon이 있으면 사용하고, 없으면 기본 SVG 사용
4906
+ let DoneIcon = null;
4907
+ let MinusIcon = null;
4908
+ try {
4909
+ const icons = require('@designbasekorea/icons');
4910
+ DoneIcon = icons.DoneIcon || null;
4911
+ MinusIcon = icons.MinusIcon || null;
4912
+ }
4913
+ catch (e) {
4914
+ // 아이콘 패키지가 없으면 기본 SVG 사용
4915
+ }
4905
4916
  const Checkbox = React.forwardRef(({ isSelected, defaultSelected, isIndeterminate = false, isDisabled = false, isReadOnly = false, isRequired = false, hasLabel = true, size = 'm', children, className, name, value, onChange, ...props }, forwardedRef) => {
4906
4917
  const [selected, setSelected] = React.useState(isSelected ?? defaultSelected ?? false);
4907
4918
  React.useEffect(() => {
@@ -4923,16 +4934,7 @@ const Checkbox = React.forwardRef(({ isSelected, defaultSelected, isIndeterminat
4923
4934
  'designbase-checkbox--readonly': isReadOnly,
4924
4935
  'designbase-checkbox--no-label': !hasLabel,
4925
4936
  }, className);
4926
- const getIconColor = () => {
4927
- if (isDisabled) {
4928
- return 'var(--color-action-interactive-icon-disabled)';
4929
- }
4930
- if (selected || isIndeterminate) {
4931
- return 'var(--color-action-interactive-icon-selected)';
4932
- }
4933
- return 'var(--color-action-interactive-icon)';
4934
- };
4935
- return (jsxRuntimeExports.jsxs("label", { className: classes, children: [jsxRuntimeExports.jsx("input", { ...props, ref: forwardedRef, name: name, value: value, type: "checkbox", checked: selected, onChange: handleChange, disabled: isDisabled, readOnly: isReadOnly, required: isRequired, className: "designbase-checkbox__input" }), jsxRuntimeExports.jsxs("div", { className: "designbase-checkbox__visual", children: [selected && !isIndeterminate && (jsxRuntimeExports.jsx("svg", { className: "designbase-checkbox__check-icon", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntimeExports.jsx("path", { d: "M20 6L9 17L4 12", stroke: getIconColor(), strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })), isIndeterminate && (jsxRuntimeExports.jsx("svg", { className: "designbase-checkbox__indeterminate-icon", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntimeExports.jsx("path", { d: "M5 12H19", stroke: getIconColor(), strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }))] }), children && jsxRuntimeExports.jsx("span", { className: "designbase-checkbox__label", children: children })] }));
4937
+ return (jsxRuntimeExports.jsxs("label", { className: classes, children: [jsxRuntimeExports.jsx("input", { ...props, ref: forwardedRef, name: name, value: value, type: "checkbox", checked: selected, onChange: handleChange, disabled: isDisabled, readOnly: isReadOnly, required: isRequired, className: "designbase-checkbox__input" }), jsxRuntimeExports.jsxs("div", { className: "designbase-checkbox__visual", children: [selected && !isIndeterminate && (jsxRuntimeExports.jsx("div", { className: "designbase-checkbox__check-icon", children: DoneIcon ? (jsxRuntimeExports.jsx(DoneIcon, { size: 16 })) : (jsxRuntimeExports.jsx("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", children: jsxRuntimeExports.jsx("path", { d: "M20 6L9 17L4 12", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })) })), isIndeterminate && (jsxRuntimeExports.jsx("div", { className: "designbase-checkbox__indeterminate-icon", children: MinusIcon ? (jsxRuntimeExports.jsx(MinusIcon, { size: 16 })) : (jsxRuntimeExports.jsx("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", children: jsxRuntimeExports.jsx("path", { d: "M5 12H19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })) }))] }), children && jsxRuntimeExports.jsx("span", { className: "designbase-checkbox__label", children: children })] }));
4936
4938
  });
4937
4939
  Checkbox.displayName = 'Checkbox';
4938
4940