@ncds/ui-admin 0.0.19 → 0.0.21

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.
@@ -124,6 +124,17 @@ Object.keys(_spinner).forEach(function (key) {
124
124
  }
125
125
  });
126
126
  });
127
+ var _tag = require("./tag");
128
+ Object.keys(_tag).forEach(function (key) {
129
+ if (key === "default" || key === "__esModule") return;
130
+ if (key in exports && exports[key] === _tag[key]) return;
131
+ Object.defineProperty(exports, key, {
132
+ enumerable: true,
133
+ get: function () {
134
+ return _tag[key];
135
+ }
136
+ });
137
+ });
127
138
  var _toggle = require("./toggle");
128
139
  Object.keys(_toggle).forEach(function (key) {
129
140
  if (key === "default" || key === "__esModule") return;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Tag = void 0;
7
+ var _jsxRuntime = require("react/jsx-runtime");
8
+ var _uiAdminIcon = _interopRequireDefault(require("@ncds/ui-admin-icon"));
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _color = require("../../../constant/color");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ var __assign = void 0 && (void 0).__assign || function () {
13
+ __assign = Object.assign || function (t) {
14
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
15
+ s = arguments[i];
16
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
17
+ }
18
+ return t;
19
+ };
20
+ return __assign.apply(this, arguments);
21
+ };
22
+ var Tag = function (_a) {
23
+ var _b = _a.size,
24
+ size = _b === void 0 ? 'sm' : _b,
25
+ icon = _a.icon,
26
+ text = _a.text,
27
+ count = _a.count,
28
+ close = _a.close,
29
+ onButtonClick = _a.onButtonClick;
30
+ var closeSize = {
31
+ sm: 14,
32
+ md: 16
33
+ };
34
+ return (0, _jsxRuntime.jsxs)("span", __assign({
35
+ className: (0, _classnames.default)('ncua-tag', "ncua-tag--".concat(size), {
36
+ 'ncua-tag--dot': (icon === null || icon === void 0 ? void 0 : icon.name) === 'dot'
37
+ })
38
+ }, {
39
+ children: [icon && icon.name !== 'dot' && (0, _jsxRuntime.jsx)(_uiAdminIcon.default, {
40
+ name: icon.name,
41
+ width: 16,
42
+ height: 16,
43
+ color: icon.color
44
+ }), (0, _jsxRuntime.jsx)("span", __assign({
45
+ className: "ncua-tag__text"
46
+ }, {
47
+ children: text
48
+ })), count && (0, _jsxRuntime.jsx)("span", __assign({
49
+ className: "ncua-tag__count"
50
+ }, {
51
+ children: count
52
+ })), close && (0, _jsxRuntime.jsx)("button", __assign({
53
+ type: "button",
54
+ className: "ncua-tag__close",
55
+ onClick: onButtonClick
56
+ }, {
57
+ children: (0, _jsxRuntime.jsx)(_uiAdminIcon.default, {
58
+ name: "x-close",
59
+ color: _color.COLOR.gray300,
60
+ width: closeSize[size],
61
+ height: closeSize[size]
62
+ })
63
+ }))]
64
+ }));
65
+ };
66
+ exports.Tag = Tag;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _Tag = require("./Tag");
7
+ Object.keys(_Tag).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _Tag[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _Tag[key];
14
+ }
15
+ });
16
+ });
@@ -9,5 +9,6 @@ export * from './radio';
9
9
  export * from './select';
10
10
  export * from './shared';
11
11
  export * from './spinner';
12
+ export * from './tag';
12
13
  export * from './toggle';
13
14
  export * from './tooltip';
@@ -0,0 +1,58 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
12
+ import Icon from '@ncds/ui-admin-icon';
13
+ import classNames from 'classnames';
14
+ import { COLOR } from '../../../constant/color';
15
+ export var Tag = function (_a) {
16
+ var _b = _a.size,
17
+ size = _b === void 0 ? 'sm' : _b,
18
+ icon = _a.icon,
19
+ text = _a.text,
20
+ count = _a.count,
21
+ close = _a.close,
22
+ onButtonClick = _a.onButtonClick;
23
+ var closeSize = {
24
+ sm: 14,
25
+ md: 16
26
+ };
27
+ return _jsxs("span", __assign({
28
+ className: classNames('ncua-tag', "ncua-tag--".concat(size), {
29
+ 'ncua-tag--dot': (icon === null || icon === void 0 ? void 0 : icon.name) === 'dot'
30
+ })
31
+ }, {
32
+ children: [icon && icon.name !== 'dot' && _jsx(Icon, {
33
+ name: icon.name,
34
+ width: 16,
35
+ height: 16,
36
+ color: icon.color
37
+ }), _jsx("span", __assign({
38
+ className: "ncua-tag__text"
39
+ }, {
40
+ children: text
41
+ })), count && _jsx("span", __assign({
42
+ className: "ncua-tag__count"
43
+ }, {
44
+ children: count
45
+ })), close && _jsx("button", __assign({
46
+ type: "button",
47
+ className: "ncua-tag__close",
48
+ onClick: onButtonClick
49
+ }, {
50
+ children: _jsx(Icon, {
51
+ name: "x-close",
52
+ color: COLOR.gray300,
53
+ width: closeSize[size],
54
+ height: closeSize[size]
55
+ })
56
+ }))]
57
+ }));
58
+ };
@@ -0,0 +1 @@
1
+ export * from './Tag';
@@ -9,6 +9,7 @@ export * from './radio';
9
9
  export * from './select';
10
10
  export * from './shared';
11
11
  export * from './spinner';
12
+ export * from './tag';
12
13
  export * from './toggle';
13
14
  export * from './tooltip';
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,19 @@
1
+ import { IconName } from '@ncds/ui-admin-icon';
2
+ import { FC, MouseEventHandler } from 'react';
3
+ import { COLOR } from '../../../constant/color';
4
+ import { Size } from '../../../constant/size';
5
+ type TagIcon = {
6
+ name: IconName | 'dot';
7
+ color?: keyof typeof COLOR;
8
+ };
9
+ interface TagProps {
10
+ size?: Extract<Size, 'sm' | 'md'>;
11
+ icon?: TagIcon;
12
+ text: string;
13
+ count?: string;
14
+ close?: boolean;
15
+ onButtonClick?: MouseEventHandler<HTMLButtonElement>;
16
+ }
17
+ export declare const Tag: FC<TagProps>;
18
+ export {};
19
+ //# sourceMappingURL=Tag.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from './Tag';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -1282,6 +1282,79 @@ button {
1282
1282
  transform: translateY(3px);
1283
1283
  }
1284
1284
 
1285
+ .ncua-tag {
1286
+ display: inline-flex;
1287
+ align-items: center;
1288
+ border-radius: 6px;
1289
+ border: 1px solid var(--gray-200);
1290
+ color: var(--gray-500);
1291
+ line-height: 1.5;
1292
+ font-weight: var(--font-weights-commerce-sans-1);
1293
+ background-color: var(--base-white);
1294
+ vertical-align: top;
1295
+ overflow: hidden;
1296
+ }
1297
+ .ncua-tag--sm {
1298
+ font-size: var(--font-size-xxs);
1299
+ padding: 2px 8px;
1300
+ line-height: 14px;
1301
+ }
1302
+ .ncua-tag--md {
1303
+ font-size: var(--font-size-sm);
1304
+ padding: 1px 9px;
1305
+ line-height: 22px;
1306
+ }
1307
+ .ncua-tag__text {
1308
+ overflow: hidden;
1309
+ display: block;
1310
+ text-overflow: ellipsis;
1311
+ white-space: nowrap;
1312
+ word-wrap: break-word;
1313
+ }
1314
+ .ncua-tag > svg {
1315
+ margin-right: 4px;
1316
+ }
1317
+ .ncua-tag--dot .ncua-tag__text {
1318
+ position: relative;
1319
+ padding-left: 12px;
1320
+ }
1321
+ .ncua-tag--dot .ncua-tag__text::before {
1322
+ position: absolute;
1323
+ top: 50%;
1324
+ left: 0;
1325
+ content: "";
1326
+ transform: translateY(-50%);
1327
+ width: 6px;
1328
+ height: 6px;
1329
+ background-color: var(--primary-red-500);
1330
+ border-radius: 50%;
1331
+ }
1332
+ .ncua-tag__count {
1333
+ display: inline-flex;
1334
+ align-items: center;
1335
+ min-width: 16px;
1336
+ height: 16px;
1337
+ margin-left: 6px;
1338
+ margin-right: -5px;
1339
+ padding: 0 5px;
1340
+ background-color: var(--gray-100);
1341
+ border-radius: 3px;
1342
+ text-align: center;
1343
+ }
1344
+ .ncua-tag__count + .ncua-tag__close {
1345
+ margin-left: 6px;
1346
+ }
1347
+ .ncua-tag__close {
1348
+ margin-left: 3px;
1349
+ margin-right: -5px;
1350
+ padding: 0;
1351
+ display: inline-flex;
1352
+ align-items: center;
1353
+ cursor: pointer;
1354
+ background-color: transparent;
1355
+ border: none;
1356
+ }
1357
+
1285
1358
  .ncua-tooltip {
1286
1359
  position: relative;
1287
1360
  font-size: 12px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ncds/ui-admin",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "description": "nhn-commerce의 어드민 디자인 시스템입니다.",
5
5
  "scripts": {
6
6
  "barrel": "node barrel.js",
@@ -52,9 +52,9 @@
52
52
  "design-system"
53
53
  ],
54
54
  "license": "MIT",
55
- "main": "dist/cjs/ui-admin/index.js",
56
- "module": "dist/esm/ui-admin/index.js",
57
- "types": "dist/types/ui-admin/index.d.ts",
55
+ "main": "dist/cjs/index.js",
56
+ "module": "dist/esm/index.js",
57
+ "types": "dist/types/index.d.ts",
58
58
  "msw": {
59
59
  "workerDirectory": "public"
60
60
  },
@@ -62,7 +62,7 @@
62
62
  "dependencies": {
63
63
  "@ncds/types-common": "^1.0.0",
64
64
  "@ncds/types-layout": "^1.0.0",
65
- "@ncds/ui-admin-icon": "0.0.15",
65
+ "@ncds/ui-admin-icon": "0.0.16",
66
66
  "classnames": "^2.3.2",
67
67
  "react-flatpickr": "^4.0.10",
68
68
  "swiper": "^11.1.1"