@designbasekorea/ui 0.1.39 → 0.1.40

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.esm.js CHANGED
@@ -2262,7 +2262,124 @@ const Button = forwardRef(({ variant = 'primary', size = 'm', radius, fullWidth
2262
2262
  });
2263
2263
  Button.displayName = 'Button';
2264
2264
 
2265
- const AdBanner = ({ type = 'hero', variant = 'primary', title, subtitle, ctaText, onCtaClick, onClose, autoClose = false, closeDelay = 5000, icon, className, }) => {
2265
+ // Designbase 테마 기반 색상 계열 (hex 사용)
2266
+ const colorSchemes = {
2267
+ primary: [
2268
+ '#48c3ff', // blue-400
2269
+ '#1ea2ff', // blue-500
2270
+ '#0683ff', // blue-600
2271
+ '#006fff', // blue-700
2272
+ '#0855c5', // blue-800
2273
+ ],
2274
+ secondary: [
2275
+ '#a4adb2', // neutral-400
2276
+ '#8c9499', // neutral-500
2277
+ '#757b80', // neutral-600
2278
+ '#5e6366', // neutral-700
2279
+ '#464a4d', // neutral-800
2280
+ ],
2281
+ success: [
2282
+ '#4ade80', // green-400
2283
+ '#22c55e', // green-500
2284
+ '#16a34a', // green-600
2285
+ '#14b8a6', // teal-500
2286
+ '#0d9485', // teal-600
2287
+ ],
2288
+ warning: [
2289
+ '#ff8c32', // orange-400
2290
+ '#ff6b0a', // orange-500
2291
+ '#ff5100', // orange-600
2292
+ '#ffe50d', // yellow-400
2293
+ '#ffd600', // yellow-500
2294
+ ],
2295
+ error: [
2296
+ '#f87171', // red-400
2297
+ '#ef4444', // red-500
2298
+ '#dc2626', // red-600
2299
+ '#b91c1c', // red-700
2300
+ '#991b1b', // red-800
2301
+ ],
2302
+ info: [
2303
+ '#48c3ff', // blue-400
2304
+ '#1ea2ff', // blue-500
2305
+ '#0683ff', // blue-600
2306
+ '#006fff', // blue-700
2307
+ '#0855c5', // blue-800
2308
+ ],
2309
+ purple: [
2310
+ '#a385ff', // purple-400
2311
+ '#8a58ff', // purple-500
2312
+ '#7830f7', // purple-600
2313
+ '#6a1ee3', // purple-700
2314
+ '#5818bf', // purple-800
2315
+ ],
2316
+ ocean: [
2317
+ '#1ea2ff', // blue-500
2318
+ '#48c3ff', // blue-400
2319
+ '#2dd4c2', // teal-400
2320
+ '#14b8a6', // teal-500
2321
+ '#0d9485', // teal-600
2322
+ ],
2323
+ sunset: [
2324
+ '#ff8c32', // orange-400
2325
+ '#ff6b0a', // orange-500
2326
+ '#ff5100', // orange-600
2327
+ '#ef4444', // red-500
2328
+ '#f87171', // red-400
2329
+ ],
2330
+ };
2331
+ const RandomGradient = ({ scheme = 'primary', width = '100%', height = '600px', blur = 60, colorCount = 4, animated = false, animationDuration = 10, overlay = true, overlayOpacity = 0.2, children, className, }) => {
2332
+ const [gradientStyle, setGradientStyle] = useState({});
2333
+ // 그라데이션 생성 함수
2334
+ const generateGradient = useMemo(() => {
2335
+ return () => {
2336
+ const schemeColors = colorSchemes[scheme];
2337
+ const numColors = Math.min(6, Math.max(3, colorCount));
2338
+ const colors = [];
2339
+ for (let i = 0; i < numColors; i++) {
2340
+ const randomColor = schemeColors[Math.floor(Math.random() * schemeColors.length)];
2341
+ colors.push(randomColor);
2342
+ }
2343
+ const positions = Array.from({ length: numColors }, () => Math.random() * 100).sort((a, b) => a - b);
2344
+ const gradientStops = colors.map((color, i) => `${color} ${positions[i]}%`).join(', ');
2345
+ const centerX = Math.random() * 100;
2346
+ const centerY = Math.random() * 100;
2347
+ return {
2348
+ background: `radial-gradient(circle at ${centerX}% ${centerY}%, ${gradientStops})`,
2349
+ filter: `blur(${blur}px)`,
2350
+ transition: `all ${animationDuration}s ease-in-out`,
2351
+ };
2352
+ };
2353
+ }, [scheme, colorCount, blur, animationDuration]);
2354
+ // 초기 그라데이션 및 애니메이션
2355
+ useEffect(() => {
2356
+ setGradientStyle(generateGradient());
2357
+ if (animated) {
2358
+ const interval = setInterval(() => {
2359
+ setGradientStyle(generateGradient());
2360
+ }, animationDuration * 1000);
2361
+ return () => clearInterval(interval);
2362
+ }
2363
+ }, [animated, animationDuration, generateGradient]);
2364
+ const classes = clsx('designbase-random-gradient', {
2365
+ 'designbase-random-gradient--animated': animated,
2366
+ 'designbase-random-gradient--with-overlay': overlay,
2367
+ }, className);
2368
+ const containerStyle = {
2369
+ width: typeof width === 'number' ? `${width}px` : width,
2370
+ height: typeof height === 'number' ? `${height}px` : height,
2371
+ };
2372
+ const overlayStyle = overlay
2373
+ ? {
2374
+ background: `linear-gradient(45deg, ${colorSchemes[scheme][0]}, ${colorSchemes[scheme][1]})`,
2375
+ opacity: overlayOpacity,
2376
+ }
2377
+ : {};
2378
+ return (jsxs("div", { className: classes, style: containerStyle, children: [jsx("div", { className: "designbase-random-gradient__background", style: gradientStyle }), overlay && (jsx("div", { className: "designbase-random-gradient__overlay", style: overlayStyle })), children && (jsx("div", { className: "designbase-random-gradient__content", children: children }))] }));
2379
+ };
2380
+ RandomGradient.displayName = 'RandomGradient';
2381
+
2382
+ const AdBanner = ({ type = 'hero', variant = 'primary', title, subtitle, ctaText, onCtaClick, onClose, autoClose = false, closeDelay = 5000, icon, useRandomGradient = false, gradientScheme, gradientAnimated = true, className, }) => {
2266
2383
  const [isVisible, setIsVisible] = useState(true);
2267
2384
  const [progress, setProgress] = useState(100);
2268
2385
  useEffect(() => {
@@ -2292,6 +2409,7 @@ const AdBanner = ({ type = 'hero', variant = 'primary', title, subtitle, ctaText
2292
2409
  return null;
2293
2410
  const classes = clsx('designbase-ad-banner', `designbase-ad-banner--type-${type}`, `designbase-ad-banner--variant-${variant}`, {
2294
2411
  'designbase-ad-banner--auto-close': autoClose,
2412
+ 'designbase-ad-banner--with-gradient': useRandomGradient,
2295
2413
  }, className);
2296
2414
  // 기본 아이콘
2297
2415
  const defaultIcons = {
@@ -2304,7 +2422,23 @@ const AdBanner = ({ type = 'hero', variant = 'primary', title, subtitle, ctaText
2304
2422
  const displayTitle = title || getDefaultTitle(type);
2305
2423
  const displaySubtitle = subtitle || getDefaultSubtitle(type);
2306
2424
  const displayCtaText = ctaText || getDefaultCtaText(type);
2307
- return (jsx("div", { className: classes, children: jsxs("div", { className: "designbase-ad-banner__content", children: [jsx("button", { className: "designbase-ad-banner__close", onClick: handleClose, "aria-label": "\uB2EB\uAE30", children: jsx(CloseIcon, { size: type === 'hero' ? 20 : 18 }) }), type === 'hero' && (jsxs(Fragment, { children: [jsx("div", { className: "designbase-ad-banner__decoration designbase-ad-banner__decoration--top" }), jsx("div", { className: "designbase-ad-banner__decoration designbase-ad-banner__decoration--bottom" })] })), jsxs("div", { className: "designbase-ad-banner__main", children: [jsxs("div", { className: "designbase-ad-banner__icon", children: [displayIcon, type === 'topbar' && (jsx("span", { className: "designbase-ad-banner__label", children: "\uD2B9\uBCC4 \uC774\uBCA4\uD2B8" })), type === 'floating' && (jsx("span", { className: "designbase-ad-banner__badge", children: "HOT DEAL" }))] }), jsxs("div", { className: "designbase-ad-banner__text", children: [jsx("h2", { className: "designbase-ad-banner__title", children: displayTitle }), jsx("p", { className: "designbase-ad-banner__subtitle", children: displaySubtitle })] }), jsx("div", { className: "designbase-ad-banner__actions", children: jsxs(Button, { variant: "primary", size: type === 'hero' ? 'l' : type === 'card' ? 's' : 'm', onPress: handleCtaClick, className: "designbase-ad-banner__cta", fullWidth: type === 'floating', children: [displayCtaText, jsx(ArrowRightIcon, { size: type === 'hero' ? 20 : 16 })] }) })] }), autoClose && (jsx("div", { className: "designbase-ad-banner__progress", children: jsx("div", { className: "designbase-ad-banner__progress-bar", style: { width: `${progress}%` } }) }))] }) }));
2425
+ // variant 따른 그라데이션 색상 계열 매핑
2426
+ const getGradientScheme = () => {
2427
+ if (gradientScheme)
2428
+ return gradientScheme;
2429
+ const schemeMap = {
2430
+ primary: 'primary',
2431
+ secondary: 'secondary',
2432
+ success: 'success',
2433
+ warning: 'warning',
2434
+ error: 'error',
2435
+ gradient: 'sunset',
2436
+ };
2437
+ return schemeMap[variant];
2438
+ };
2439
+ // 배너 컨텐츠
2440
+ const bannerContent = (jsxs("div", { className: "designbase-ad-banner__content", children: [jsx("button", { className: "designbase-ad-banner__close", onClick: handleClose, "aria-label": "\uB2EB\uAE30", children: jsx(CloseIcon, { size: type === 'hero' ? 20 : 18 }) }), type === 'hero' && !useRandomGradient && (jsxs(Fragment, { children: [jsx("div", { className: "designbase-ad-banner__decoration designbase-ad-banner__decoration--top" }), jsx("div", { className: "designbase-ad-banner__decoration designbase-ad-banner__decoration--bottom" })] })), jsxs("div", { className: "designbase-ad-banner__main", children: [jsxs("div", { className: "designbase-ad-banner__icon", children: [displayIcon, type === 'topbar' && (jsx("span", { className: "designbase-ad-banner__label", children: "\uD2B9\uBCC4 \uC774\uBCA4\uD2B8" })), type === 'floating' && (jsx("span", { className: "designbase-ad-banner__badge", children: "HOT DEAL" }))] }), jsxs("div", { className: "designbase-ad-banner__text", children: [jsx("h2", { className: "designbase-ad-banner__title", children: displayTitle }), jsx("p", { className: "designbase-ad-banner__subtitle", children: displaySubtitle })] }), jsx("div", { className: "designbase-ad-banner__actions", children: jsxs(Button, { variant: "primary", size: type === 'hero' ? 'l' : type === 'card' ? 's' : 'm', onPress: handleCtaClick, className: "designbase-ad-banner__cta", fullWidth: type === 'floating', children: [displayCtaText, jsx(ArrowRightIcon, { size: type === 'hero' ? 20 : 16 })] }) })] }), autoClose && (jsx("div", { className: "designbase-ad-banner__progress", children: jsx("div", { className: "designbase-ad-banner__progress-bar", style: { width: `${progress}%` } }) }))] }));
2441
+ return (jsx("div", { className: classes, children: useRandomGradient ? (jsx(RandomGradient, { scheme: getGradientScheme(), animated: gradientAnimated, height: "100%", width: "100%", className: "designbase-ad-banner__gradient-bg", children: bannerContent })) : (bannerContent) }));
2308
2442
  };
2309
2443
  // 기본 텍스트 헬퍼
2310
2444
  function getDefaultTitle(type) {
@@ -8617,123 +8751,6 @@ const ProgressStep = ({ items, size = 'm', layout = 'vertical', currentStep = 0,
8617
8751
  }) }));
8618
8752
  };
8619
8753
 
8620
- // Designbase 테마 기반 색상 계열 (hex 값 사용)
8621
- const colorSchemes = {
8622
- primary: [
8623
- '#48c3ff', // blue-400
8624
- '#1ea2ff', // blue-500
8625
- '#0683ff', // blue-600
8626
- '#006fff', // blue-700
8627
- '#0855c5', // blue-800
8628
- ],
8629
- secondary: [
8630
- '#a4adb2', // neutral-400
8631
- '#8c9499', // neutral-500
8632
- '#757b80', // neutral-600
8633
- '#5e6366', // neutral-700
8634
- '#464a4d', // neutral-800
8635
- ],
8636
- success: [
8637
- '#4ade80', // green-400
8638
- '#22c55e', // green-500
8639
- '#16a34a', // green-600
8640
- '#14b8a6', // teal-500
8641
- '#0d9485', // teal-600
8642
- ],
8643
- warning: [
8644
- '#ff8c32', // orange-400
8645
- '#ff6b0a', // orange-500
8646
- '#ff5100', // orange-600
8647
- '#ffe50d', // yellow-400
8648
- '#ffd600', // yellow-500
8649
- ],
8650
- error: [
8651
- '#f87171', // red-400
8652
- '#ef4444', // red-500
8653
- '#dc2626', // red-600
8654
- '#b91c1c', // red-700
8655
- '#991b1b', // red-800
8656
- ],
8657
- info: [
8658
- '#48c3ff', // blue-400
8659
- '#1ea2ff', // blue-500
8660
- '#0683ff', // blue-600
8661
- '#006fff', // blue-700
8662
- '#0855c5', // blue-800
8663
- ],
8664
- purple: [
8665
- '#a385ff', // purple-400
8666
- '#8a58ff', // purple-500
8667
- '#7830f7', // purple-600
8668
- '#6a1ee3', // purple-700
8669
- '#5818bf', // purple-800
8670
- ],
8671
- ocean: [
8672
- '#1ea2ff', // blue-500
8673
- '#48c3ff', // blue-400
8674
- '#2dd4c2', // teal-400
8675
- '#14b8a6', // teal-500
8676
- '#0d9485', // teal-600
8677
- ],
8678
- sunset: [
8679
- '#ff8c32', // orange-400
8680
- '#ff6b0a', // orange-500
8681
- '#ff5100', // orange-600
8682
- '#ef4444', // red-500
8683
- '#f87171', // red-400
8684
- ],
8685
- };
8686
- const RandomGradient = ({ scheme = 'primary', width = '100%', height = '600px', blur = 60, colorCount = 4, animated = false, animationDuration = 10, overlay = true, overlayOpacity = 0.2, children, className, }) => {
8687
- const [gradientStyle, setGradientStyle] = useState({});
8688
- // 그라데이션 생성 함수
8689
- const generateGradient = useMemo(() => {
8690
- return () => {
8691
- const schemeColors = colorSchemes[scheme];
8692
- const numColors = Math.min(6, Math.max(3, colorCount));
8693
- const colors = [];
8694
- for (let i = 0; i < numColors; i++) {
8695
- const randomColor = schemeColors[Math.floor(Math.random() * schemeColors.length)];
8696
- colors.push(randomColor);
8697
- }
8698
- const positions = Array.from({ length: numColors }, () => Math.random() * 100).sort((a, b) => a - b);
8699
- const gradientStops = colors.map((color, i) => `${color} ${positions[i]}%`).join(', ');
8700
- const centerX = Math.random() * 100;
8701
- const centerY = Math.random() * 100;
8702
- return {
8703
- background: `radial-gradient(circle at ${centerX}% ${centerY}%, ${gradientStops})`,
8704
- filter: `blur(${blur}px)`,
8705
- transition: `all ${animationDuration}s ease-in-out`,
8706
- };
8707
- };
8708
- }, [scheme, colorCount, blur, animationDuration]);
8709
- // 초기 그라데이션 및 애니메이션
8710
- useEffect(() => {
8711
- setGradientStyle(generateGradient());
8712
- if (animated) {
8713
- const interval = setInterval(() => {
8714
- setGradientStyle(generateGradient());
8715
- }, animationDuration * 1000);
8716
- return () => clearInterval(interval);
8717
- }
8718
- }, [animated, animationDuration, generateGradient]);
8719
- const classes = clsx('designbase-random-gradient', {
8720
- 'designbase-random-gradient--animated': animated,
8721
- 'designbase-random-gradient--with-overlay': overlay,
8722
- }, className);
8723
- const containerStyle = {
8724
- width: typeof width === 'number' ? `${width}px` : width,
8725
- height: typeof height === 'number' ? `${height}px` : height,
8726
- };
8727
- const overlayStyle = overlay
8728
- ? {
8729
- background: `linear-gradient(45deg, ${colorSchemes[scheme][0]}, ${colorSchemes[scheme][1]})`,
8730
- opacity: overlayOpacity,
8731
- }
8732
- : {};
8733
- return (jsxs("div", { className: classes, style: containerStyle, children: [jsx("div", { className: "designbase-random-gradient__background", style: gradientStyle }), overlay && (jsx("div", { className: "designbase-random-gradient__overlay", style: overlayStyle })), children && (jsx("div", { className: "designbase-random-gradient__content", children: children }))] }));
8734
- };
8735
- RandomGradient.displayName = 'RandomGradient';
8736
-
8737
8754
  const RangeSlider = ({ value, range, min = 0, max = 100, step = 1, size = 'm', variant = 'default', showValue = false, showMarks = false, marks = [], markLabels = {}, disabled = false, readOnly = false, fullWidth = false, vertical = false, onChange, onRangeChange, className, ...props }) => {
8738
8755
  const [internalValue, setInternalValue] = useState(value ?? min);
8739
8756
  const [internalRange, setInternalRange] = useState(range ?? [min, max]);