@ncds/ui-admin 0.0.31 → 0.0.33

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.
Files changed (51) hide show
  1. package/dist/cjs/constant/color.js +1 -0
  2. package/dist/cjs/src/components/badge/Badge.js +13 -24
  3. package/dist/cjs/src/components/badge/BadgeGroup.js +62 -0
  4. package/dist/cjs/src/components/badge/index.js +11 -0
  5. package/dist/cjs/src/components/badge/utils.js +33 -0
  6. package/dist/cjs/src/components/button/ButtonCloseX.js +44 -0
  7. package/dist/cjs/src/components/date-picker/DatePicker.js +4 -5
  8. package/dist/cjs/src/components/date-picker/RangeDatePicker.js +13 -7
  9. package/dist/cjs/src/components/dropdown/Dropdown.js +20 -10
  10. package/dist/cjs/src/components/modal/Modal.js +5 -7
  11. package/dist/cjs/src/components/notification/FloatingNotification.js +30 -26
  12. package/dist/cjs/src/components/notification/FullWidthNotification.js +15 -8
  13. package/dist/cjs/src/components/notification/Notification.js +9 -30
  14. package/dist/cjs/src/components/notification/index.js +11 -11
  15. package/dist/cjs/src/constant/breakpoint.js +12 -0
  16. package/dist/cjs/src/hooks/useMediaQuery.js +29 -0
  17. package/dist/esm/constant/color.js +1 -0
  18. package/dist/esm/src/components/badge/Badge.js +13 -24
  19. package/dist/esm/src/components/badge/BadgeGroup.js +54 -0
  20. package/dist/esm/src/components/badge/index.js +2 -1
  21. package/dist/esm/src/components/badge/utils.js +25 -0
  22. package/dist/esm/src/components/button/ButtonCloseX.js +36 -0
  23. package/dist/esm/src/components/date-picker/DatePicker.js +5 -5
  24. package/dist/esm/src/components/date-picker/RangeDatePicker.js +14 -7
  25. package/dist/esm/src/components/dropdown/Dropdown.js +20 -10
  26. package/dist/esm/src/components/modal/Modal.js +5 -7
  27. package/dist/esm/src/components/notification/FloatingNotification.js +31 -27
  28. package/dist/esm/src/components/notification/FullWidthNotification.js +15 -8
  29. package/dist/esm/src/components/notification/Notification.js +10 -30
  30. package/dist/esm/src/components/notification/index.js +2 -2
  31. package/dist/esm/src/constant/breakpoint.js +6 -0
  32. package/dist/esm/src/hooks/useMediaQuery.js +22 -0
  33. package/dist/types/constant/color.d.ts +1 -0
  34. package/dist/types/src/components/badge/BadgeGroup.d.ts +17 -0
  35. package/dist/types/src/components/badge/index.d.ts +1 -0
  36. package/dist/types/src/components/badge/utils.d.ts +7 -0
  37. package/dist/types/src/components/button/Button.d.ts +1 -1
  38. package/dist/types/src/components/button/ButtonCloseX.d.ts +9 -0
  39. package/dist/types/src/components/button/ButtonGroup.d.ts +2 -2
  40. package/dist/types/src/components/date-picker/DatePicker.d.ts +2 -2
  41. package/dist/types/src/components/date-picker/RangeDatePicker.d.ts +1 -1
  42. package/dist/types/src/components/dropdown/Dropdown.d.ts +4 -1
  43. package/dist/types/src/components/modal/Modal.d.ts +1 -1
  44. package/dist/types/src/components/notification/FloatingNotification.d.ts +3 -4
  45. package/dist/types/src/components/notification/FullWidthNotification.d.ts +3 -4
  46. package/dist/types/src/components/notification/Notification.d.ts +5 -4
  47. package/dist/types/src/components/notification/index.d.ts +1 -1
  48. package/dist/types/src/constant/breakpoint.d.ts +7 -0
  49. package/dist/types/src/hooks/useMediaQuery.d.ts +6 -0
  50. package/dist/ui-admin/assets/styles/style.css +171 -136
  51. package/package.json +2 -2
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useMediaQuery = void 0;
7
+ var _react = require("react");
8
+ var useMediaQuery = function (query, options) {
9
+ var _a = (0, _react.useState)(false),
10
+ matches = _a[0],
11
+ setMatches = _a[1];
12
+ (0, _react.useEffect)(function () {
13
+ var mediaQuery = window.matchMedia(query);
14
+ setMatches(mediaQuery.matches);
15
+ var handleChange = function (e) {
16
+ var _a;
17
+ setMatches(e.matches);
18
+ if (e.matches) {
19
+ (_a = options === null || options === void 0 ? void 0 : options.onMatched) === null || _a === void 0 ? void 0 : _a.call(options);
20
+ }
21
+ };
22
+ mediaQuery.addEventListener('change', handleChange);
23
+ return function () {
24
+ mediaQuery.removeEventListener('change', handleChange);
25
+ };
26
+ }, [query, options === null || options === void 0 ? void 0 : options.onMatched]);
27
+ return matches;
28
+ };
29
+ exports.useMediaQuery = useMediaQuery;
@@ -1,4 +1,5 @@
1
1
  export var COLOR = {
2
+ gray100: '#EAECF0',
2
3
  gray200: '#D0D5DD',
3
4
  gray300: '#98A2B3',
4
5
  gray400: '#667085',
@@ -9,11 +9,12 @@ var __assign = this && this.__assign || function () {
9
9
  return __assign.apply(this, arguments);
10
10
  };
11
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
- import Icon from '@ncds/ui-admin-icon';
13
- import { svgSize } from '../button';
14
12
  import classNames from 'classnames';
15
- import { COLOR } from '../../../constant/color';
16
- import { Dot } from '../dot';
13
+ import { sideSlotRender } from './utils';
14
+ /**
15
+ * 뱃지 컴포넌트의 아이콘은 디자인 시스템에서 12px 고정으로 정의되어 있습니다.
16
+ */
17
+ var BADGE_ICON_SIZE = 12;
17
18
  export var Badge = function (_a) {
18
19
  var label = _a.label,
19
20
  _b = _a.type,
@@ -25,31 +26,19 @@ export var Badge = function (_a) {
25
26
  trailingIcon = _a.trailingIcon,
26
27
  _d = _a.size,
27
28
  size = _d === void 0 ? 'sm' : _d;
28
- var sideSlotRender = function (slot) {
29
- var _a, _b, _c, _d;
30
- if (slot.type === 'icon') {
31
- return _jsx(Icon, {
32
- name: slot.icon,
33
- height: (_a = slot.size) !== null && _a !== void 0 ? _a : svgSize[size],
34
- width: (_b = slot.size) !== null && _b !== void 0 ? _b : svgSize[size],
35
- color: slot.color ? COLOR[slot.color] : undefined
36
- });
37
- }
38
- if (slot.type === 'dot') {
39
- return _jsx(Dot, {
40
- color: (_c = slot.color) !== null && _c !== void 0 ? _c : color,
41
- size: (_d = slot.size) !== null && _d !== void 0 ? _d : 'sm'
42
- });
43
- }
44
- return slot.children;
45
- };
46
29
  return _jsxs("span", __assign({
47
30
  className: classNames('ncua-badge', "ncua-badge--".concat(type), "ncua-badge--".concat(color), "ncua-badge--".concat(size), className)
48
31
  }, {
49
- children: [leadingIcon && sideSlotRender(leadingIcon), _jsx("span", __assign({
32
+ children: [leadingIcon && sideSlotRender({
33
+ slot: leadingIcon,
34
+ defaultIconSize: BADGE_ICON_SIZE
35
+ }), _jsx("span", __assign({
50
36
  className: "ncua-badge__label"
51
37
  }, {
52
38
  children: label
53
- })), trailingIcon && sideSlotRender(trailingIcon)]
39
+ })), trailingIcon && sideSlotRender({
40
+ slot: trailingIcon,
41
+ defaultIconSize: BADGE_ICON_SIZE
42
+ })]
54
43
  }));
55
44
  };
@@ -0,0 +1,54 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
6
+ }
7
+ return t;
8
+ };
9
+ return __assign.apply(this, arguments);
10
+ };
11
+ var __rest = this && this.__rest || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
14
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
15
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
16
+ }
17
+ return t;
18
+ };
19
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
+ import classNames from 'classnames';
21
+ import { Badge } from '.';
22
+ import { sideSlotRender } from './utils';
23
+ var DEFAULT_GROUP_ICON_SIZE = 14;
24
+ export var BadgeGroup = function (_a) {
25
+ var groupLabel = _a.groupLabel,
26
+ groupIcon = _a.groupIcon,
27
+ groupClassName = _a.groupClassName,
28
+ _b = _a.color,
29
+ color = _b === void 0 ? 'neutral' : _b,
30
+ _c = _a.size,
31
+ size = _c === void 0 ? 'sm' : _c,
32
+ href = _a.href,
33
+ _d = _a.target,
34
+ target = _d === void 0 ? '_blank' : _d,
35
+ props = __rest(_a, ["groupLabel", "groupIcon", "groupClassName", "color", "size", "href", "target"]);
36
+ return _jsxs("a", __assign({
37
+ className: classNames('ncua-badge-group', "ncua-badge-group--".concat(color), "ncua-badge-group--".concat(size), groupClassName),
38
+ href: href,
39
+ target: target
40
+ }, {
41
+ children: [_jsx(Badge, __assign({
42
+ type: "pill-dark-color",
43
+ color: color,
44
+ size: size
45
+ }, props)), _jsx("span", __assign({
46
+ className: "ncua-badge-group__label"
47
+ }, {
48
+ children: groupLabel
49
+ })), groupIcon && sideSlotRender({
50
+ slot: groupIcon,
51
+ defaultIconSize: DEFAULT_GROUP_ICON_SIZE
52
+ })]
53
+ }));
54
+ };
@@ -1 +1,2 @@
1
- export * from './Badge';
1
+ export * from './Badge';
2
+ export * from './BadgeGroup';
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import Icon from '@ncds/ui-admin-icon';
3
+ import { COLOR } from '../../../constant/color';
4
+ import { Dot } from '../dot/Dot';
5
+ var DEFAULT_DOT_COLOR = 'neutral';
6
+ export var sideSlotRender = function (_a) {
7
+ var _b, _c, _d, _e;
8
+ var slot = _a.slot,
9
+ defaultIconSize = _a.defaultIconSize;
10
+ if (slot.type === 'icon') {
11
+ return _jsx(Icon, {
12
+ name: slot.icon,
13
+ height: (_b = slot.size) !== null && _b !== void 0 ? _b : defaultIconSize,
14
+ width: (_c = slot.size) !== null && _c !== void 0 ? _c : defaultIconSize,
15
+ color: slot.color ? COLOR[slot.color] : undefined
16
+ });
17
+ }
18
+ if (slot.type === 'dot') {
19
+ return _jsx(Dot, {
20
+ color: (_d = slot.color) !== null && _d !== void 0 ? _d : DEFAULT_DOT_COLOR,
21
+ size: (_e = slot.size) !== null && _e !== void 0 ? _e : 'sm'
22
+ });
23
+ }
24
+ return slot.children;
25
+ };
@@ -0,0 +1,36 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
6
+ }
7
+ return t;
8
+ };
9
+ return __assign.apply(this, arguments);
10
+ };
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import Icon from '@ncds/ui-admin-icon';
13
+ import classnames from 'classnames';
14
+ var svgSize = {
15
+ xs: 16,
16
+ sm: 20,
17
+ md: 20,
18
+ lg: 24
19
+ };
20
+ export var ButtonCloseX = function (_a) {
21
+ var size = _a.size,
22
+ _b = _a.theme,
23
+ theme = _b === void 0 ? 'light' : _b,
24
+ className = _a.className,
25
+ onClick = _a.onClick;
26
+ return _jsx("button", __assign({
27
+ className: classnames('ncua-button-close-x', "ncua-button-close-x--".concat(size), "ncua-button-close-x--".concat(theme), className),
28
+ onClick: onClick
29
+ }, {
30
+ children: _jsx(Icon, {
31
+ name: "x-close",
32
+ width: svgSize[size],
33
+ height: svgSize[size]
34
+ })
35
+ }));
36
+ };
@@ -20,10 +20,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
20
  import classNames from 'classnames';
21
21
  import 'flatpickr/dist/flatpickr.css';
22
22
  import { Korean } from 'flatpickr/dist/l10n/ko';
23
- import { useRef } from 'react';
23
+ import { forwardRef } from 'react';
24
24
  import Flatpickr from 'react-flatpickr';
25
25
  import { COLOR } from '../../../constant/color';
26
- export var DatePicker = function (_a) {
26
+ export var DatePicker = /*#__PURE__*/forwardRef(function (_a, ref) {
27
27
  var _b = _a.shouldFocus,
28
28
  shouldFocus = _b === void 0 ? true : _b,
29
29
  currentDate = _a.currentDate,
@@ -32,7 +32,6 @@ export var DatePicker = function (_a) {
32
32
  onChangeDate = _a.onChangeDate,
33
33
  datePickerOptions = _a.datePickerOptions,
34
34
  attrs = __rest(_a, ["shouldFocus", "currentDate", "size", "onChangeDate", "datePickerOptions"]);
35
- var ref = useRef(null);
36
35
  var onChangeDateHandler = function (dateTimeStamp, dateStr) {
37
36
  return onChangeDate(dateStr);
38
37
  };
@@ -52,7 +51,7 @@ export var DatePicker = function (_a) {
52
51
  })
53
52
  }, {
54
53
  children: [_jsx(Flatpickr, __assign({}, attrs, {
55
- ref: ref,
54
+ ref: ref || undefined,
56
55
  className: classNames('ncua-date-picker__input'),
57
56
  options: options,
58
57
  value: currentDate
@@ -76,4 +75,5 @@ export var DatePicker = function (_a) {
76
75
  }))
77
76
  }))]
78
77
  }));
79
- };
78
+ });
79
+ DatePicker.displayName = 'DatePicker';
@@ -9,12 +9,12 @@ var __assign = this && this.__assign || function () {
9
9
  return __assign.apply(this, arguments);
10
10
  };
11
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
- import { useCallback, useEffect } from 'react';
12
+ import { useCallback, useEffect, forwardRef } from 'react';
13
13
  import { isNil } from 'lodash';
14
14
  import moment from 'moment';
15
15
  import { DatePicker } from './DatePicker';
16
16
  import { getDateFormat } from './utils';
17
- export var RangeDatePicker = function (_a) {
17
+ export var RangeDatePicker = /*#__PURE__*/forwardRef(function (_a, ref) {
18
18
  var startDateOptions = _a.startDateOptions,
19
19
  endDateOptions = _a.endDateOptions,
20
20
  validationOption = _a.validationOption,
@@ -38,6 +38,7 @@ export var RangeDatePicker = function (_a) {
38
38
  if (isOverPeriod === void 0) {
39
39
  isOverPeriod = false;
40
40
  }
41
+ if (!(validationOption === null || validationOption === void 0 ? void 0 : validationOption.setting)) return;
41
42
  var _a = validationOption.setting,
42
43
  unit = _a.unit,
43
44
  period = _a.period;
@@ -78,7 +79,7 @@ export var RangeDatePicker = function (_a) {
78
79
  if (!isValidPeriod) {
79
80
  changeSettingDateAndAlert('start', !isValidPeriod);
80
81
  }
81
- }, [startDateOptions.currentDate]);
82
+ }, [startDateOptions.currentDate, endDateOptions.currentDate, validationOption, resetDateAndAlert, changeSettingDateAndAlert]);
82
83
  useEffect(function () {
83
84
  var _a;
84
85
  var needResetDate = validateDateType(endDateOptions.currentDate) && !isNil((_a = validationOption === null || validationOption === void 0 ? void 0 : validationOption.initDate) === null || _a === void 0 ? void 0 : _a.endDate) && moment(endDateOptions.currentDate).isBefore(startDateOptions.currentDate);
@@ -101,10 +102,16 @@ export var RangeDatePicker = function (_a) {
101
102
  if (!isValidPeriod) {
102
103
  changeSettingDateAndAlert('end', !isValidPeriod);
103
104
  }
104
- }, [endDateOptions.currentDate]);
105
+ }, [endDateOptions.currentDate, startDateOptions.currentDate, validationOption, resetDateAndAlert, changeSettingDateAndAlert]);
105
106
  return _jsxs("div", __assign({
106
- className: "ncua-range-date-picker"
107
+ className: "ncua-range-date-picker",
108
+ ref: ref || undefined
107
109
  }, {
108
- children: [_jsx(DatePicker, __assign({}, startDateOptions)), "-", _jsx(DatePicker, __assign({}, endDateOptions))]
110
+ children: [_jsx(DatePicker, __assign({}, startDateOptions, {
111
+ ref: undefined
112
+ })), "-", _jsx(DatePicker, __assign({}, endDateOptions, {
113
+ ref: undefined
114
+ }))]
109
115
  }));
110
- };
116
+ });
117
+ RangeDatePicker.displayName = 'RangeDatePicker';
@@ -17,10 +17,16 @@ export var Dropdown = function (_a) {
17
17
  align = _b === void 0 ? 'left' : _b,
18
18
  header = _a.header,
19
19
  groups = _a.groups,
20
- className = _a.className;
21
- var _c = useState(false),
22
- isOpen = _c[0],
23
- setIsOpen = _c[1];
20
+ className = _a.className,
21
+ _c = _a.opened,
22
+ opened = _c === void 0 ? false : _c,
23
+ _d = _a.closeOnClickItem,
24
+ closeOnClickItem = _d === void 0 ? true : _d,
25
+ _e = _a.closeOnClickOutside,
26
+ closeOnClickOutside = _e === void 0 ? true : _e;
27
+ var _f = useState(opened),
28
+ isOpen = _f[0],
29
+ setIsOpen = _f[1];
24
30
  var dropdownRef = useRef(null);
25
31
  var toggleDropdown = function () {
26
32
  setIsOpen(!isOpen);
@@ -33,15 +39,19 @@ export var Dropdown = function (_a) {
33
39
  var handleClickItem = function (item) {
34
40
  if (!item.disabled && item.onClick) {
35
41
  item.onClick();
36
- setIsOpen(false);
42
+ if (closeOnClickItem) {
43
+ setIsOpen(false);
44
+ }
37
45
  }
38
46
  };
39
47
  useEffect(function () {
40
- document.addEventListener('mousedown', handleClickOutside);
41
- return function () {
42
- document.removeEventListener('mousedown', handleClickOutside);
43
- };
44
- }, []);
48
+ if (closeOnClickOutside) {
49
+ document.addEventListener('mousedown', handleClickOutside);
50
+ return function () {
51
+ document.removeEventListener('mousedown', handleClickOutside);
52
+ };
53
+ }
54
+ }, [closeOnClickOutside]);
45
55
  var renderTrigger = function () {
46
56
  switch (trigger.type) {
47
57
  case 'custom':
@@ -20,8 +20,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
20
20
  import classnames from 'classnames';
21
21
  import { useEffect, useRef } from 'react';
22
22
  import ReactDOM from 'react-dom';
23
+ import { ButtonCloseX } from '../button/ButtonCloseX';
23
24
  import { FeaturedIcon } from '../featured-icon';
24
- import Icon from '@ncds/ui-admin-icon';
25
25
  export var Modal = function (_a) {
26
26
  var isOpen = _a.isOpen,
27
27
  onClose = _a.onClose,
@@ -104,14 +104,12 @@ Modal.Header = function (_a) {
104
104
  }, {
105
105
  children: subtitle
106
106
  }))]
107
- })), children, !hideCloseButton && _jsx("button", __assign({
107
+ })), children, !hideCloseButton && _jsx(ButtonCloseX, {
108
108
  className: "ncua-modal__close-button",
109
+ size: "sm",
110
+ theme: "light",
109
111
  onClick: onClose
110
- }, {
111
- children: _jsx(Icon, {
112
- name: "x"
113
- })
114
- }))]
112
+ })]
115
113
  })), showDivider && _jsx("div", {
116
114
  className: "ncua-modal__header-divider"
117
115
  })]
@@ -16,11 +16,14 @@ var __rest = this && this.__rest || function (s, e) {
16
16
  }
17
17
  return t;
18
18
  };
19
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
20
- import { FeaturedIcon } from '../featured-icon/FeaturedIcon';
21
- import Icon from '@ncds/ui-admin-icon';
19
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
20
  import classNames from 'classnames';
23
21
  import { forwardRef } from 'react';
22
+ import { MEDIA_QUERY } from '../../constant/breakpoint';
23
+ import { useMediaQuery } from '../../hooks/useMediaQuery';
24
+ import { Button } from '../button';
25
+ import { ButtonCloseX } from '../button/ButtonCloseX';
26
+ import { FeaturedIcon } from '../featured-icon/FeaturedIcon';
24
27
  var iconNameMap = {
25
28
  neutral: 'pin-02',
26
29
  error: 'alert-triangle',
@@ -30,22 +33,25 @@ var iconNameMap = {
30
33
  export var FloatingNotification = /*#__PURE__*/forwardRef(function (_a, ref) {
31
34
  var title = _a.title,
32
35
  supportingText = _a.supportingText,
33
- _b = _a.variant,
34
- variant = _b === void 0 ? 'neutral' : _b,
36
+ _b = _a.color,
37
+ color = _b === void 0 ? 'neutral' : _b,
35
38
  onClose = _a.onClose,
36
39
  className = _a.className,
37
40
  actions = _a.actions,
38
- rest = __rest(_a, ["title", "supportingText", "variant", "onClose", "className", "actions"]);
39
- var iconColor = variant;
41
+ rest = __rest(_a, ["title", "supportingText", "color", "onClose", "className", "actions"]);
42
+ var iconColor = color;
40
43
  var featuredIconProps = {
41
- name: iconNameMap[variant],
44
+ name: iconNameMap[color],
42
45
  size: 'sm',
43
46
  color: iconColor,
44
47
  theme: 'dark-circle'
45
48
  };
49
+ var isMobile = useMediaQuery(MEDIA_QUERY.mobile, {
50
+ onMatched: onClose
51
+ });
46
52
  return _jsxs("div", __assign({
47
53
  ref: ref,
48
- className: classNames('ncua-floating-notification', "ncua-floating-notification--".concat(variant), className),
54
+ className: classNames('ncua-floating-notification', "ncua-floating-notification--".concat(color), className),
49
55
  role: "alert"
50
56
  }, rest, {
51
57
  children: [_jsx("div", __assign({
@@ -54,14 +60,9 @@ export var FloatingNotification = /*#__PURE__*/forwardRef(function (_a, ref) {
54
60
  children: _jsxs("div", __assign({
55
61
  className: "ncua-floating-notification__container"
56
62
  }, {
57
- children: [iconNameMap[variant] && _jsxs(_Fragment, {
58
- children: [_jsx(FeaturedIcon, __assign({}, featuredIconProps, {
59
- className: "ncua-floating-notification__pc-icon"
60
- })), _jsx(FeaturedIcon, __assign({}, featuredIconProps, {
61
- size: "md",
62
- className: "ncua-floating-notification__mobile-icon"
63
- }))]
64
- }), _jsxs("div", __assign({
63
+ children: [iconNameMap[color] && _jsx(FeaturedIcon, __assign({}, featuredIconProps, {
64
+ size: isMobile ? 'md' : 'sm'
65
+ })), _jsxs("div", __assign({
65
66
  className: "ncua-floating-notification__text-container"
66
67
  }, {
67
68
  children: [_jsx("div", __assign({
@@ -79,19 +80,22 @@ export var FloatingNotification = /*#__PURE__*/forwardRef(function (_a, ref) {
79
80
  })), actions && _jsx("div", __assign({
80
81
  className: "ncua-floating-notification__actions"
81
82
  }, {
82
- children: actions
83
+ children: actions.map(function (action) {
84
+ return _jsx(Button, {
85
+ size: "xs",
86
+ hierarchy: action.hierarchy || 'link',
87
+ label: action.label,
88
+ onClick: action === null || action === void 0 ? void 0 : action.onClick
89
+ }, "".concat(action.label, "-").concat(action.hierarchy));
90
+ })
83
91
  }))]
84
92
  }))]
85
93
  }))
86
- })), onClose && _jsx("button", __assign({
87
- type: "button",
94
+ })), onClose && _jsx(ButtonCloseX, {
95
+ theme: "light",
88
96
  className: "ncua-floating-notification__close-button",
89
- onClick: onClose,
90
- "aria-label": "\uC54C\uB9BC \uB2EB\uAE30"
91
- }, {
92
- children: _jsx(Icon, {
93
- name: "x"
94
- })
95
- }))]
97
+ size: isMobile ? 'sm' : 'xs',
98
+ onClick: onClose
99
+ })]
96
100
  }));
97
101
  });
@@ -36,19 +36,19 @@ var iconColorMap = {
36
36
  export var FullWidthNotification = /*#__PURE__*/forwardRef(function (_a, ref) {
37
37
  var title = _a.title,
38
38
  supportingText = _a.supportingText,
39
- _b = _a.variant,
40
- variant = _b === void 0 ? 'neutral' : _b,
39
+ _b = _a.color,
40
+ color = _b === void 0 ? 'neutral' : _b,
41
41
  onClose = _a.onClose,
42
42
  className = _a.className,
43
43
  actions = _a.actions,
44
- rest = __rest(_a, ["title", "supportingText", "variant", "onClose", "className", "actions"]);
44
+ rest = __rest(_a, ["title", "supportingText", "color", "onClose", "className", "actions"]);
45
45
  var closeIconSize = {
46
46
  width: 20,
47
47
  height: 20
48
48
  };
49
49
  return _jsx("div", __assign({
50
50
  ref: ref,
51
- className: classNames('ncua-full-width-notification', "ncua-full-width-notification--".concat(variant), className),
51
+ className: classNames('ncua-full-width-notification', "ncua-full-width-notification--".concat(color), className),
52
52
  role: "alert"
53
53
  }, rest, {
54
54
  children: _jsx("div", __assign({
@@ -61,10 +61,10 @@ export var FullWidthNotification = /*#__PURE__*/forwardRef(function (_a, ref) {
61
61
  className: "ncua-full-width-notification__content-wrapper"
62
62
  }, {
63
63
  children: [_jsx(Icon, {
64
- name: iconNameMap[variant],
64
+ name: iconNameMap[color],
65
65
  width: 16,
66
66
  height: 16,
67
- color: COLOR[iconColorMap[variant]],
67
+ color: COLOR[iconColorMap[color]],
68
68
  className: "ncua-full-width-notification__icon"
69
69
  }), _jsxs("div", __assign({
70
70
  className: "ncua-full-width-notification__text-container"
@@ -85,7 +85,14 @@ export var FullWidthNotification = /*#__PURE__*/forwardRef(function (_a, ref) {
85
85
  children: [actions && _jsx("div", __assign({
86
86
  className: "ncua-full-width-notification__actions"
87
87
  }, {
88
- children: actions
88
+ children: actions.map(function (action) {
89
+ return _jsx("button", __assign({
90
+ onClick: action.onClick,
91
+ className: classNames('ncua-notification__action-button', "ncua-notification__action-button--".concat(action.hierarchy || 'link'))
92
+ }, {
93
+ children: action.label
94
+ }), "".concat(action.label, "-").concat(action.hierarchy));
95
+ })
89
96
  })), onClose && _jsx("button", __assign({
90
97
  type: "button",
91
98
  className: "ncua-full-width-notification__close-button",
@@ -95,7 +102,7 @@ export var FullWidthNotification = /*#__PURE__*/forwardRef(function (_a, ref) {
95
102
  children: _jsx(Icon, __assign({
96
103
  name: "x-close"
97
104
  }, closeIconSize, {
98
- color: COLOR[iconColorMap[variant]]
105
+ color: COLOR[iconColorMap[color]]
99
106
  }))
100
107
  }))]
101
108
  }))]
@@ -16,43 +16,23 @@ var __rest = this && this.__rest || function (s, e) {
16
16
  }
17
17
  return t;
18
18
  };
19
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
19
+ import { jsx as _jsx } from "react/jsx-runtime";
20
20
  import { forwardRef } from 'react';
21
- import classNames from 'classnames';
22
21
  import { FloatingNotification } from './FloatingNotification';
23
22
  import { FullWidthNotification } from './FullWidthNotification';
24
23
  export var Notification = /*#__PURE__*/forwardRef(function (_a, ref) {
25
24
  var _b = _a.type,
26
25
  type = _b === void 0 ? 'floating' : _b,
27
- title = _a.title,
28
- supportingText = _a.supportingText,
29
- _c = _a.variant,
30
- variant = _c === void 0 ? 'neutral' : _c,
31
- onClose = _a.onClose,
32
- className = _a.className,
33
- actions = _a.actions,
34
- rest = __rest(_a, ["type", "title", "supportingText", "variant", "onClose", "className", "actions"]);
35
- var actionsContent = actions && actions.length > 0 ? _jsx(_Fragment, {
36
- children: actions.map(function (action, index) {
37
- return _jsx("button", __assign({
38
- onClick: action.onClick,
39
- className: classNames('ncua-notification__action-button', "ncua-notification__action-button--".concat(action.hierarchy || 'link-gray'))
40
- }, {
41
- children: action.label
42
- }), index);
43
- })
44
- }) : null;
45
- var sharedProps = __assign({
46
- title: title,
47
- supportingText: supportingText,
48
- variant: variant,
49
- onClose: onClose,
50
- className: className,
51
- actions: actionsContent
52
- }, rest);
53
- return type === 'floating' ? _jsx(FloatingNotification, __assign({}, sharedProps, {
26
+ _c = _a.color,
27
+ color = _c === void 0 ? 'neutral' : _c,
28
+ rest = __rest(_a, ["type", "color"]);
29
+ return type === 'floating' ? _jsx(FloatingNotification, __assign({
30
+ color: color
31
+ }, rest, {
54
32
  ref: ref
55
- })) : _jsx(FullWidthNotification, __assign({}, sharedProps, {
33
+ })) : _jsx(FullWidthNotification, __assign({
34
+ color: color
35
+ }, rest, {
56
36
  ref: ref
57
37
  }));
58
38
  });
@@ -1,3 +1,3 @@
1
+ export * from './Notification';
1
2
  export * from './FloatingNotification';
2
- export * from './FullWidthNotification';
3
- export * from './Notification';
3
+ export * from './FullWidthNotification';
@@ -0,0 +1,6 @@
1
+ export var BREAKPOINT = {
2
+ mobile: '768px'
3
+ };
4
+ export var MEDIA_QUERY = {
5
+ mobile: "(max-width: ".concat(BREAKPOINT.mobile, ")")
6
+ };
@@ -0,0 +1,22 @@
1
+ import { useEffect, useState } from 'react';
2
+ export var useMediaQuery = function (query, options) {
3
+ var _a = useState(false),
4
+ matches = _a[0],
5
+ setMatches = _a[1];
6
+ useEffect(function () {
7
+ var mediaQuery = window.matchMedia(query);
8
+ setMatches(mediaQuery.matches);
9
+ var handleChange = function (e) {
10
+ var _a;
11
+ setMatches(e.matches);
12
+ if (e.matches) {
13
+ (_a = options === null || options === void 0 ? void 0 : options.onMatched) === null || _a === void 0 ? void 0 : _a.call(options);
14
+ }
15
+ };
16
+ mediaQuery.addEventListener('change', handleChange);
17
+ return function () {
18
+ mediaQuery.removeEventListener('change', handleChange);
19
+ };
20
+ }, [query, options === null || options === void 0 ? void 0 : options.onMatched]);
21
+ return matches;
22
+ };
@@ -1,4 +1,5 @@
1
1
  export declare const COLOR: {
2
+ gray100: string;
2
3
  gray200: string;
3
4
  gray300: string;
4
5
  gray400: string;
@@ -0,0 +1,17 @@
1
+ import { ColorTone } from 'ui-admin/constant/color';
2
+ import { BadgeProps } from '.';
3
+ import { Size } from '../../../constant/size';
4
+ import { SideSlotType } from '../../types/side-slot';
5
+ export type BadgeGroupSize = Extract<Size, 'xs' | 'sm'>;
6
+ export type BadgeGroupColor = Extract<ColorTone, 'neutral' | 'error' | 'warning' | 'success'>;
7
+ export type BadgeGroupProps = Omit<BadgeProps, 'type' | 'size' | 'color'> & {
8
+ groupLabel: string;
9
+ groupIcon?: SideSlotType;
10
+ groupClassName?: string;
11
+ size?: BadgeGroupSize;
12
+ color?: BadgeGroupColor;
13
+ href?: string;
14
+ target?: string;
15
+ };
16
+ export declare const BadgeGroup: ({ groupLabel, groupIcon, groupClassName, color, size, href, target, ...props }: BadgeGroupProps) => import("react/jsx-runtime").JSX.Element;
17
+ //# sourceMappingURL=BadgeGroup.d.ts.map