@wonjin-dev/reacts 1.3.1 → 1.4.0
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/components/index.esm.js +15 -66
- package/dist/components/index.esm.js.map +1 -1
- package/dist/components/index.js +15 -66
- package/dist/components/index.js.map +1 -1
- package/dist/components/utils/formatCareerPeriod/index.d.ts +41 -0
- package/dist/components/utils/formatCareerPeriod/index.test.d.ts +1 -0
- package/dist/hooks/index.esm.js +37 -117
- package/dist/hooks/index.esm.js.map +1 -1
- package/dist/hooks/index.js +37 -117
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/utils/formatCareerPeriod/index.d.ts +41 -0
- package/dist/hooks/utils/formatCareerPeriod/index.test.d.ts +1 -0
- package/dist/utils/index.esm.js +3 -7
- package/dist/utils/index.esm.js.map +1 -1
- package/dist/utils/index.js +3 -7
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/utils/formatCareerPeriod/index.d.ts +41 -0
- package/dist/utils/utils/formatCareerPeriod/index.test.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,50 +1,5 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
/******************************************************************************
|
|
4
|
-
Copyright (c) Microsoft Corporation.
|
|
5
|
-
|
|
6
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
7
|
-
purpose with or without fee is hereby granted.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
-
***************************************************************************** */
|
|
17
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var __assign = function() {
|
|
21
|
-
__assign = Object.assign || function __assign(t) {
|
|
22
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
23
|
-
s = arguments[i];
|
|
24
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
25
|
-
}
|
|
26
|
-
return t;
|
|
27
|
-
};
|
|
28
|
-
return __assign.apply(this, arguments);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
function __rest(s, e) {
|
|
32
|
-
var t = {};
|
|
33
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
34
|
-
t[p] = s[p];
|
|
35
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
36
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
37
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
38
|
-
t[p[i]] = s[p[i]];
|
|
39
|
-
}
|
|
40
|
-
return t;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
44
|
-
var e = new Error(message);
|
|
45
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
3
|
function styleInject(css, ref) {
|
|
49
4
|
if ( ref === void 0 ) ref = {};
|
|
50
5
|
var insertAt = ref.insertAt;
|
|
@@ -72,41 +27,35 @@ function styleInject(css, ref) {
|
|
|
72
27
|
}
|
|
73
28
|
}
|
|
74
29
|
|
|
75
|
-
var css_248z$1 = ".styles-module__typography___uJJgf{font-family:inherit;font-size:1rem;font-style:normal;font-weight:400;line-height:1.5}.styles-module__typography_color_grey900___tH77b{color:#21252a}.styles-module__typography_color_grey800___f4wMy{color:#3b3f45}.styles-module__typography_color_grey700___GSJui{color:#737373}.styles-module__typography_color_grey600___x6U6a{color:#7f848a}.styles-module__typography_color_grey500___VffNJ{color:#878e98}.styles-module__typography_color_grey400___h8LXZ{color:#a1a6ae}.styles-module__typography_color_grey300___CrH9u{color:#bcc0c6}.styles-module__typography_color_grey200___4e7wo{color:#d8dbe0}.styles-module__typography_color_grey100___s2JGa{color:#f1f3f5}.styles-module__typography_size_sm___IXCiS{font-size:.75rem}.styles-module__typography_size_md___vBKHL{font-size:1rem}.styles-module__typography_size_lg___UE2ty{font-size:1.125rem}.styles-module__typography_size_xl___e2zNJ{font-size:1.375rem}.styles-module__typography_size_2xl___XPIIz{font-size:1.75rem}.styles-module__typography_size_3xl___6dl0M{font-size:2rem}.styles-module__typography_weight_400___LwHSh{font-weight:400}.styles-module__typography_weight_500___QwNXS{font-weight:500}.styles-module__typography_weight_600___tWEhF{font-weight:600}.styles-module__typography_weight_700___V455e{font-weight:700}.styles-
|
|
76
|
-
var styles$1 = {"typography":"styles-module__typography___uJJgf","typography_color_grey900":"styles-module__typography_color_grey900___tH77b","typography_color_grey800":"styles-module__typography_color_grey800___f4wMy","typography_color_grey700":"styles-module__typography_color_grey700___GSJui","typography_color_grey600":"styles-module__typography_color_grey600___x6U6a","typography_color_grey500":"styles-module__typography_color_grey500___VffNJ","typography_color_grey400":"styles-module__typography_color_grey400___h8LXZ","typography_color_grey300":"styles-module__typography_color_grey300___CrH9u","typography_color_grey200":"styles-module__typography_color_grey200___4e7wo","typography_color_grey100":"styles-module__typography_color_grey100___s2JGa","typography_size_sm":"styles-module__typography_size_sm___IXCiS","typography_size_md":"styles-module__typography_size_md___vBKHL","typography_size_lg":"styles-module__typography_size_lg___UE2ty","typography_size_xl":"styles-module__typography_size_xl___e2zNJ","typography_size_2xl":"styles-module__typography_size_2xl___XPIIz","typography_size_3xl":"styles-module__typography_size_3xl___6dl0M","typography_weight_400":"styles-module__typography_weight_400___LwHSh","typography_weight_500":"styles-module__typography_weight_500___QwNXS","typography_weight_600":"styles-module__typography_weight_600___tWEhF","typography_weight_700":"styles-module__typography_weight_700___V455e","
|
|
30
|
+
var css_248z$1 = ".styles-module__typography___uJJgf{font-family:inherit;font-size:1rem;font-style:normal;font-weight:400;line-height:1.5}.styles-module__typography_color_grey900___tH77b{color:#21252a}.styles-module__typography_color_grey800___f4wMy{color:#3b3f45}.styles-module__typography_color_grey700___GSJui{color:#737373}.styles-module__typography_color_grey600___x6U6a{color:#7f848a}.styles-module__typography_color_grey500___VffNJ{color:#878e98}.styles-module__typography_color_grey400___h8LXZ{color:#a1a6ae}.styles-module__typography_color_grey300___CrH9u{color:#bcc0c6}.styles-module__typography_color_grey200___4e7wo{color:#d8dbe0}.styles-module__typography_color_grey100___s2JGa{color:#f1f3f5}.styles-module__typography_size_sm___IXCiS{font-size:.75rem}.styles-module__typography_size_md___vBKHL{font-size:1rem}.styles-module__typography_size_lg___UE2ty{font-size:1.125rem}.styles-module__typography_size_xl___e2zNJ{font-size:1.375rem}.styles-module__typography_size_2xl___XPIIz{font-size:1.75rem}.styles-module__typography_size_3xl___6dl0M{font-size:2rem}.styles-module__typography_weight_400___LwHSh{font-weight:400}.styles-module__typography_weight_500___QwNXS{font-weight:500}.styles-module__typography_weight_600___tWEhF{font-weight:600}.styles-module__typography_weight_700___V455e{font-weight:700}.styles-module__typography_deco_normal___LdTNr{font-style:normal}.styles-module__typography_deco_italic___MXbnH{font-style:italic}.styles-module__typography_deco_underline___cVSHd{text-decoration:underline;text-decoration-skip-ink:none}.styles-module__typography_deco_line-through___BISKr{text-decoration:line-through}.styles-module__typography_highlight_underline___a-iY0{display:inline-block;position:relative;z-index:1}.styles-module__typography_highlight_underline___a-iY0:after{background-color:#ffe600;border-radius:.1375em;bottom:.125rem;content:\"\";height:.4em;left:0;opacity:.7;position:absolute;width:100%;z-index:-1}";
|
|
31
|
+
var styles$1 = {"typography":"styles-module__typography___uJJgf","typography_color_grey900":"styles-module__typography_color_grey900___tH77b","typography_color_grey800":"styles-module__typography_color_grey800___f4wMy","typography_color_grey700":"styles-module__typography_color_grey700___GSJui","typography_color_grey600":"styles-module__typography_color_grey600___x6U6a","typography_color_grey500":"styles-module__typography_color_grey500___VffNJ","typography_color_grey400":"styles-module__typography_color_grey400___h8LXZ","typography_color_grey300":"styles-module__typography_color_grey300___CrH9u","typography_color_grey200":"styles-module__typography_color_grey200___4e7wo","typography_color_grey100":"styles-module__typography_color_grey100___s2JGa","typography_size_sm":"styles-module__typography_size_sm___IXCiS","typography_size_md":"styles-module__typography_size_md___vBKHL","typography_size_lg":"styles-module__typography_size_lg___UE2ty","typography_size_xl":"styles-module__typography_size_xl___e2zNJ","typography_size_2xl":"styles-module__typography_size_2xl___XPIIz","typography_size_3xl":"styles-module__typography_size_3xl___6dl0M","typography_weight_400":"styles-module__typography_weight_400___LwHSh","typography_weight_500":"styles-module__typography_weight_500___QwNXS","typography_weight_600":"styles-module__typography_weight_600___tWEhF","typography_weight_700":"styles-module__typography_weight_700___V455e","typography_deco_normal":"styles-module__typography_deco_normal___LdTNr","typography_deco_italic":"styles-module__typography_deco_italic___MXbnH","typography_deco_underline":"styles-module__typography_deco_underline___cVSHd","typography_deco_line-through":"styles-module__typography_deco_line-through___BISKr","typography_highlight_underline":"styles-module__typography_highlight_underline___a-iY0"};
|
|
77
32
|
styleInject(css_248z$1);
|
|
78
33
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
82
|
-
args[_i] = arguments[_i];
|
|
83
|
-
}
|
|
84
|
-
return args.reduce(function (acc, className) {
|
|
34
|
+
const classNames = (...args) => {
|
|
35
|
+
return args.reduce((acc, className) => {
|
|
85
36
|
if (className) {
|
|
86
|
-
return acc ?
|
|
37
|
+
return acc ? `${acc} ${className}` : className;
|
|
87
38
|
}
|
|
88
39
|
return acc;
|
|
89
40
|
}, '');
|
|
90
41
|
};
|
|
91
42
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return (jsx(Component, __assign({ className: classes }, props, { children: children })));
|
|
43
|
+
const Typography = ({ as, children, size = 'md', weight = 400, color = 'grey900', deco = 'normal', highlight, className = '', ...props }) => {
|
|
44
|
+
const Component = as || 'p';
|
|
45
|
+
const cx = classNames(styles$1.typography, styles$1[`typography_size_${size}`], styles$1[`typography_weight_${weight}`], Array.isArray(deco)
|
|
46
|
+
? deco.map((deco) => styles$1[`typography_deco_${deco}`]).join(' ')
|
|
47
|
+
: styles$1[`typography_deco_${deco}`], styles$1[`typography_color_${color}`], styles$1[`typography_highlight_${highlight}`], className);
|
|
48
|
+
return (jsx(Component, { className: cx, ...props, children: children }));
|
|
99
49
|
};
|
|
100
50
|
|
|
101
51
|
var css_248z = ".styles-module__flex___-sE2d{display:flex}.styles-module__flex_direction_row___HF6XY{flex-direction:row}.styles-module__flex_direction_column___HZa9-{flex-direction:column}.styles-module__flex_1___bAI3t{flex:1}.styles-module__flex_auto___mZzmi{flex:auto}.styles-module__flex_none___a2fut{flex:none}.styles-module__flex_initial___ZAC4D{flex:initial}.styles-module__flex_justify_start___W8iUD{justify-content:flex-start}.styles-module__flex_justify_end___Jm-3w{justify-content:flex-end}.styles-module__flex_justify_center___wbTay{justify-content:center}.styles-module__flex_justify_between___OLU6W{justify-content:space-between}.styles-module__flex_justify_around___C5Cs7{justify-content:space-around}.styles-module__flex_justify_evenly___A---h{justify-content:space-evenly}.styles-module__flex_align_start___VbWeX{align-items:flex-start}.styles-module__flex_align_end___uSXC7{align-items:flex-end}.styles-module__flex_align_center___uEXyg{align-items:center}.styles-module__flex_align_baseline___zkgAx{align-items:baseline}.styles-module__flex_align_stretch___r0bsz{align-items:stretch}";
|
|
102
52
|
var styles = {"flex":"styles-module__flex___-sE2d","flex_direction_row":"styles-module__flex_direction_row___HF6XY","flex_direction_column":"styles-module__flex_direction_column___HZa9-","flex_1":"styles-module__flex_1___bAI3t","flex_auto":"styles-module__flex_auto___mZzmi","flex_none":"styles-module__flex_none___a2fut","flex_initial":"styles-module__flex_initial___ZAC4D","flex_justify_start":"styles-module__flex_justify_start___W8iUD","flex_justify_end":"styles-module__flex_justify_end___Jm-3w","flex_justify_center":"styles-module__flex_justify_center___wbTay","flex_justify_between":"styles-module__flex_justify_between___OLU6W","flex_justify_around":"styles-module__flex_justify_around___C5Cs7","flex_justify_evenly":"styles-module__flex_justify_evenly___A---h","flex_align_start":"styles-module__flex_align_start___VbWeX","flex_align_end":"styles-module__flex_align_end___uSXC7","flex_align_center":"styles-module__flex_align_center___uEXyg","flex_align_baseline":"styles-module__flex_align_baseline___zkgAx","flex_align_stretch":"styles-module__flex_align_stretch___r0bsz"};
|
|
103
53
|
styleInject(css_248z);
|
|
104
54
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return (jsx(Component, __assign({ className: classes, style: gap ? __assign({ gap: "".concat(gap / 16, "rem") }, props.style) : props.style }, props, { children: children })));
|
|
55
|
+
const Flex = ({ as, children, direction = 'row', flex, justifyContent, alignItems, gap, className = '', ...props }) => {
|
|
56
|
+
const Component = as || 'div';
|
|
57
|
+
const classes = classNames(styles.flex, styles[`flex_direction_${direction}`], flex ? styles[`flex_${flex}`] : undefined, justifyContent ? styles[`flex_justify_${justifyContent}`] : undefined, alignItems ? styles[`flex_align_${alignItems}`] : undefined, className);
|
|
58
|
+
return (jsx(Component, { className: classes, style: gap ? { gap: `${gap / 16}rem`, ...props.style } : props.style, ...props, children: children }));
|
|
110
59
|
};
|
|
111
60
|
|
|
112
61
|
export { Flex, Typography };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../node_modules/.pnpm/@rollup+plugin-typescript@11.1.6_rollup@4.9.1_tslib@2.6.2_typescript@5.3.3/node_modules/tslib/tslib.es6.js","../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../../src/utils/classNames/index.ts","../../src/components/Typography/index.tsx","../../src/components/Flex/index.tsx"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n function next() {\r\n while (env.stack.length) {\r\n var rec = env.stack.pop();\r\n try {\r\n var result = rec.dispose && rec.dispose.call(rec.value);\r\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n};\r\n","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","const classNames = (...args: (string | undefined)[]) => {\n\treturn args.reduce((acc, className) => {\n\t\tif (className) {\n\t\t\treturn acc ? `${acc} ${className}` : className;\n\t\t}\n\t\treturn acc;\n\t}, '');\n};\n\nexport default classNames;\n","import React, { type ElementType } from 'react';\nimport { PolymorphicComponent } from '../_types';\nimport styles from './styles.module.scss';\nimport { classNames } from '@/utils';\nimport { palette } from '../_design/palette';\n\ntype TypographyDecoType = 'normal' | 'italic' | 'underline' | 'line-through';\n\ninterface StyledProps {\n\tdeco?: TypographyDecoType | TypographyDecoType[];\n\tweight?: 400 | 500 | 600 | 700;\n\tcolor?: keyof typeof palette;\n\tsize?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';\n\thighlight?: 'underline';\n}\n\nconst Typography = <T extends ElementType = 'p'>({\n\tas,\n\tchildren,\n\tsize = 'md',\n\tweight = 400,\n\tcolor = 'grey900',\n\tdeco = 'normal',\n\thighlight,\n\tclassName = '',\n\t...props\n}: PolymorphicComponent<T, StyledProps>) => {\n\tconst Component = as || 'p';\n\n\tconst classes = classNames(\n\t\tstyles.typography,\n\t\tstyles[`typography_size_${size}`],\n\t\tstyles[`typography_weight_${weight}`],\n\t\tArray.isArray(deco)\n\t\t\t? deco.map((deco) => styles[`typography_deco_${deco}`]).join(' ')\n\t\t\t: styles[`typography_deco_${deco}`],\n\t\tstyles[`typography_color_${color}`],\n\t\tstyles[`typography_highlight_${highlight}`],\n\t\tclassName\n\t);\n\n\treturn (\n\t\t<Component className={classes} {...props}>\n\t\t\t{children}\n\t\t</Component>\n\t);\n};\n\nexport default Typography;\n","import React, { type ElementType } from 'react';\nimport type { PolymorphicComponent } from '../_types';\nimport styles from './styles.module.scss';\nimport { classNames } from '@/utils';\n\ninterface StyledProps {\n\tdirection?: 'row' | 'column';\n\tflex?: '1' | 'auto' | 'none' | 'initial';\n\tjustifyContent?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly';\n\talignItems?: 'start' | 'end' | 'center' | 'baseline' | 'stretch';\n\tgap?: number;\n}\n\nconst Flex = <E extends ElementType = 'div'>({\n\tas,\n\tchildren,\n\tdirection = 'row',\n\tflex,\n\tjustifyContent,\n\talignItems,\n\tgap,\n\tclassName = '',\n\t...props\n}: PolymorphicComponent<E, StyledProps>) => {\n\tconst Component = as || 'div';\n\n\tconst classes = classNames(\n\t\tstyles.flex,\n\t\tstyles[`flex_direction_${direction}`],\n\t\tflex ? styles[`flex_${flex}`] : undefined,\n\t\tjustifyContent ? styles[`flex_justify_${justifyContent}`] : undefined,\n\t\talignItems ? styles[`flex_align_${alignItems}`] : undefined,\n\t\tclassName\n\t);\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={classes}\n\t\t\tstyle={gap ? { gap: `${gap / 16}rem`, ...props.style } : props.style}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</Component>\n\t);\n};\n\nexport default Fl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AAK,QAAA,CAAA,EAAA,GAAG,EAAE,EAAG,CAAA,MAAA,CAAA,GAAG,GAAG,EAAE,QAAK,EAAK,EAAA,KAAK,CAAC,KAAK,IAAK,KAAK,CAAC,KAAK,EAChE,EAAA,KAAK,cAER,QAAQ,EAAA,CAAA,CACE,EACX;AACH;;;;","x_google_ignoreList":[0,1]}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../../src/utils/classNames/index.ts","../../src/components/Typography/index.tsx","../../src/components/Flex/index.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","const classNames = (...args: (string | undefined)[]) => {\n\treturn args.reduce((acc, className) => {\n\t\tif (className) {\n\t\t\treturn acc ? `${acc} ${className}` : className;\n\t\t}\n\t\treturn acc;\n\t}, '');\n};\n\nexport default classNames;\n","import React, { type ElementType } from 'react';\nimport { PolymorphicComponent } from '../_types';\nimport styles from './styles.module.scss';\nimport { classNames } from '@/utils';\nimport { palette } from '../_design/palette';\n\ntype TypographyDecoType = 'normal' | 'italic' | 'underline' | 'line-through';\n\ninterface StyledProps {\n\tdeco?: TypographyDecoType | TypographyDecoType[];\n\tweight?: 400 | 500 | 600 | 700;\n\tcolor?: keyof typeof palette;\n\tsize?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';\n\thighlight?: 'underline';\n}\n\nconst Typography = <T extends ElementType = 'p'>({\n\tas,\n\tchildren,\n\tsize = 'md',\n\tweight = 400,\n\tcolor = 'grey900',\n\tdeco = 'normal',\n\thighlight,\n\tclassName = '',\n\t...props\n}: PolymorphicComponent<T, StyledProps>) => {\n\tconst Component = as || 'p';\n\n\tconst cx = classNames(\n\t\tstyles.typography,\n\t\tstyles[`typography_size_${size}`],\n\t\tstyles[`typography_weight_${weight}`],\n\t\tArray.isArray(deco)\n\t\t\t? deco.map((deco) => styles[`typography_deco_${deco}`]).join(' ')\n\t\t\t: styles[`typography_deco_${deco}`],\n\t\tstyles[`typography_color_${color}`],\n\t\tstyles[`typography_highlight_${highlight}`],\n\t\tclassName\n\t);\n\n\treturn (\n\t\t<Component className={cx} {...props}>\n\t\t\t{children}\n\t\t</Component>\n\t);\n};\n\nexport default Typography;\n","import React, { type ElementType } from 'react';\nimport type { PolymorphicComponent } from '../_types';\nimport styles from './styles.module.scss';\nimport { classNames } from '@/utils';\n\ninterface StyledProps {\n\tdirection?: 'row' | 'column';\n\tflex?: '1' | 'auto' | 'none' | 'initial';\n\tjustifyContent?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly';\n\talignItems?: 'start' | 'end' | 'center' | 'baseline' | 'stretch';\n\tgap?: number;\n}\n\nconst Flex = <E extends ElementType = 'div'>({\n\tas,\n\tchildren,\n\tdirection = 'row',\n\tflex,\n\tjustifyContent,\n\talignItems,\n\tgap,\n\tclassName = '',\n\t...props\n}: PolymorphicComponent<E, StyledProps>) => {\n\tconst Component = as || 'div';\n\n\tconst classes = classNames(\n\t\tstyles.flex,\n\t\tstyles[`flex_direction_${direction}`],\n\t\tflex ? styles[`flex_${flex}`] : undefined,\n\t\tjustifyContent ? styles[`flex_justify_${justifyContent}`] : undefined,\n\t\talignItems ? styles[`flex_align_${alignItems}`] : undefined,\n\t\tclassName\n\t);\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={classes}\n\t\t\tstyle={gap ? { gap: `${gap / 16}rem`, ...props.style } : props.style}\n\t\t\t{...props}\n\t\t>\n\t\t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I,GAAG,CAAgC,EAC5C,EAAE,EACF,QAAQ,EACR,SAAS,GAAG,KAAK,EACjB,IAAI,EACJ,cAAc,EACd,UAAU,EACV,GAAG,EACH,SAAS,GAAG,EAAE,EACd,GAAG,KAAK,EAC8B,KAAI;AAC1C,IAAA,MAAM,SAAS,GAAG,EAAE,IAAI,KAAK,CAAC;AAE9B,IAAA,MAAM,OAAO,GAAG,UAAU,CACzB,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,CAAkB,eAAA,EAAA,SAAS,CAAE,CAAA,CAAC,EACrC,IAAI,GAAG,MAAM,CAAC,CAAA,KAAA,EAAQ,IAAI,CAAA,CAAE,CAAC,GAAG,SAAS,EACzC,cAAc,GAAG,MAAM,CAAC,CAAA,aAAA,EAAgB,cAAc,CAAA,CAAE,CAAC,GAAG,SAAS,EACrE,UAAU,GAAG,MAAM,CAAC,CAAc,WAAA,EAAA,UAAU,CAAE,CAAA,CAAC,GAAG,SAAS,EAC3D,SAAS,CACT,CAAC;AAEF,IAAA,QACCA,GAAC,CAAA,SAAS,IACT,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE,CAAA,GAAA,CAAK,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,KAAK,EAChE,GAAA,KAAK,YAER,QAAQ,EAAA,CACE,EACX;AACH;;;;","x_google_ignoreList":[0]}
|
package/dist/components/index.js
CHANGED
|
@@ -2,51 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
|
|
5
|
-
/******************************************************************************
|
|
6
|
-
Copyright (c) Microsoft Corporation.
|
|
7
|
-
|
|
8
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
9
|
-
purpose with or without fee is hereby granted.
|
|
10
|
-
|
|
11
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
12
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
13
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
18
|
-
***************************************************************************** */
|
|
19
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var __assign = function() {
|
|
23
|
-
__assign = Object.assign || function __assign(t) {
|
|
24
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
25
|
-
s = arguments[i];
|
|
26
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
27
|
-
}
|
|
28
|
-
return t;
|
|
29
|
-
};
|
|
30
|
-
return __assign.apply(this, arguments);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
function __rest(s, e) {
|
|
34
|
-
var t = {};
|
|
35
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
36
|
-
t[p] = s[p];
|
|
37
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
38
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
39
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
40
|
-
t[p[i]] = s[p[i]];
|
|
41
|
-
}
|
|
42
|
-
return t;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
46
|
-
var e = new Error(message);
|
|
47
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
5
|
function styleInject(css, ref) {
|
|
51
6
|
if ( ref === void 0 ) ref = {};
|
|
52
7
|
var insertAt = ref.insertAt;
|
|
@@ -74,41 +29,35 @@ function styleInject(css, ref) {
|
|
|
74
29
|
}
|
|
75
30
|
}
|
|
76
31
|
|
|
77
|
-
var css_248z$1 = ".styles-module__typography___uJJgf{font-family:inherit;font-size:1rem;font-style:normal;font-weight:400;line-height:1.5}.styles-module__typography_color_grey900___tH77b{color:#21252a}.styles-module__typography_color_grey800___f4wMy{color:#3b3f45}.styles-module__typography_color_grey700___GSJui{color:#737373}.styles-module__typography_color_grey600___x6U6a{color:#7f848a}.styles-module__typography_color_grey500___VffNJ{color:#878e98}.styles-module__typography_color_grey400___h8LXZ{color:#a1a6ae}.styles-module__typography_color_grey300___CrH9u{color:#bcc0c6}.styles-module__typography_color_grey200___4e7wo{color:#d8dbe0}.styles-module__typography_color_grey100___s2JGa{color:#f1f3f5}.styles-module__typography_size_sm___IXCiS{font-size:.75rem}.styles-module__typography_size_md___vBKHL{font-size:1rem}.styles-module__typography_size_lg___UE2ty{font-size:1.125rem}.styles-module__typography_size_xl___e2zNJ{font-size:1.375rem}.styles-module__typography_size_2xl___XPIIz{font-size:1.75rem}.styles-module__typography_size_3xl___6dl0M{font-size:2rem}.styles-module__typography_weight_400___LwHSh{font-weight:400}.styles-module__typography_weight_500___QwNXS{font-weight:500}.styles-module__typography_weight_600___tWEhF{font-weight:600}.styles-module__typography_weight_700___V455e{font-weight:700}.styles-
|
|
78
|
-
var styles$1 = {"typography":"styles-module__typography___uJJgf","typography_color_grey900":"styles-module__typography_color_grey900___tH77b","typography_color_grey800":"styles-module__typography_color_grey800___f4wMy","typography_color_grey700":"styles-module__typography_color_grey700___GSJui","typography_color_grey600":"styles-module__typography_color_grey600___x6U6a","typography_color_grey500":"styles-module__typography_color_grey500___VffNJ","typography_color_grey400":"styles-module__typography_color_grey400___h8LXZ","typography_color_grey300":"styles-module__typography_color_grey300___CrH9u","typography_color_grey200":"styles-module__typography_color_grey200___4e7wo","typography_color_grey100":"styles-module__typography_color_grey100___s2JGa","typography_size_sm":"styles-module__typography_size_sm___IXCiS","typography_size_md":"styles-module__typography_size_md___vBKHL","typography_size_lg":"styles-module__typography_size_lg___UE2ty","typography_size_xl":"styles-module__typography_size_xl___e2zNJ","typography_size_2xl":"styles-module__typography_size_2xl___XPIIz","typography_size_3xl":"styles-module__typography_size_3xl___6dl0M","typography_weight_400":"styles-module__typography_weight_400___LwHSh","typography_weight_500":"styles-module__typography_weight_500___QwNXS","typography_weight_600":"styles-module__typography_weight_600___tWEhF","typography_weight_700":"styles-module__typography_weight_700___V455e","
|
|
32
|
+
var css_248z$1 = ".styles-module__typography___uJJgf{font-family:inherit;font-size:1rem;font-style:normal;font-weight:400;line-height:1.5}.styles-module__typography_color_grey900___tH77b{color:#21252a}.styles-module__typography_color_grey800___f4wMy{color:#3b3f45}.styles-module__typography_color_grey700___GSJui{color:#737373}.styles-module__typography_color_grey600___x6U6a{color:#7f848a}.styles-module__typography_color_grey500___VffNJ{color:#878e98}.styles-module__typography_color_grey400___h8LXZ{color:#a1a6ae}.styles-module__typography_color_grey300___CrH9u{color:#bcc0c6}.styles-module__typography_color_grey200___4e7wo{color:#d8dbe0}.styles-module__typography_color_grey100___s2JGa{color:#f1f3f5}.styles-module__typography_size_sm___IXCiS{font-size:.75rem}.styles-module__typography_size_md___vBKHL{font-size:1rem}.styles-module__typography_size_lg___UE2ty{font-size:1.125rem}.styles-module__typography_size_xl___e2zNJ{font-size:1.375rem}.styles-module__typography_size_2xl___XPIIz{font-size:1.75rem}.styles-module__typography_size_3xl___6dl0M{font-size:2rem}.styles-module__typography_weight_400___LwHSh{font-weight:400}.styles-module__typography_weight_500___QwNXS{font-weight:500}.styles-module__typography_weight_600___tWEhF{font-weight:600}.styles-module__typography_weight_700___V455e{font-weight:700}.styles-module__typography_deco_normal___LdTNr{font-style:normal}.styles-module__typography_deco_italic___MXbnH{font-style:italic}.styles-module__typography_deco_underline___cVSHd{text-decoration:underline;text-decoration-skip-ink:none}.styles-module__typography_deco_line-through___BISKr{text-decoration:line-through}.styles-module__typography_highlight_underline___a-iY0{display:inline-block;position:relative;z-index:1}.styles-module__typography_highlight_underline___a-iY0:after{background-color:#ffe600;border-radius:.1375em;bottom:.125rem;content:\"\";height:.4em;left:0;opacity:.7;position:absolute;width:100%;z-index:-1}";
|
|
33
|
+
var styles$1 = {"typography":"styles-module__typography___uJJgf","typography_color_grey900":"styles-module__typography_color_grey900___tH77b","typography_color_grey800":"styles-module__typography_color_grey800___f4wMy","typography_color_grey700":"styles-module__typography_color_grey700___GSJui","typography_color_grey600":"styles-module__typography_color_grey600___x6U6a","typography_color_grey500":"styles-module__typography_color_grey500___VffNJ","typography_color_grey400":"styles-module__typography_color_grey400___h8LXZ","typography_color_grey300":"styles-module__typography_color_grey300___CrH9u","typography_color_grey200":"styles-module__typography_color_grey200___4e7wo","typography_color_grey100":"styles-module__typography_color_grey100___s2JGa","typography_size_sm":"styles-module__typography_size_sm___IXCiS","typography_size_md":"styles-module__typography_size_md___vBKHL","typography_size_lg":"styles-module__typography_size_lg___UE2ty","typography_size_xl":"styles-module__typography_size_xl___e2zNJ","typography_size_2xl":"styles-module__typography_size_2xl___XPIIz","typography_size_3xl":"styles-module__typography_size_3xl___6dl0M","typography_weight_400":"styles-module__typography_weight_400___LwHSh","typography_weight_500":"styles-module__typography_weight_500___QwNXS","typography_weight_600":"styles-module__typography_weight_600___tWEhF","typography_weight_700":"styles-module__typography_weight_700___V455e","typography_deco_normal":"styles-module__typography_deco_normal___LdTNr","typography_deco_italic":"styles-module__typography_deco_italic___MXbnH","typography_deco_underline":"styles-module__typography_deco_underline___cVSHd","typography_deco_line-through":"styles-module__typography_deco_line-through___BISKr","typography_highlight_underline":"styles-module__typography_highlight_underline___a-iY0"};
|
|
79
34
|
styleInject(css_248z$1);
|
|
80
35
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
84
|
-
args[_i] = arguments[_i];
|
|
85
|
-
}
|
|
86
|
-
return args.reduce(function (acc, className) {
|
|
36
|
+
const classNames = (...args) => {
|
|
37
|
+
return args.reduce((acc, className) => {
|
|
87
38
|
if (className) {
|
|
88
|
-
return acc ?
|
|
39
|
+
return acc ? `${acc} ${className}` : className;
|
|
89
40
|
}
|
|
90
41
|
return acc;
|
|
91
42
|
}, '');
|
|
92
43
|
};
|
|
93
44
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return (jsxRuntime.jsx(Component, __assign({ className: classes }, props, { children: children })));
|
|
45
|
+
const Typography = ({ as, children, size = 'md', weight = 400, color = 'grey900', deco = 'normal', highlight, className = '', ...props }) => {
|
|
46
|
+
const Component = as || 'p';
|
|
47
|
+
const cx = classNames(styles$1.typography, styles$1[`typography_size_${size}`], styles$1[`typography_weight_${weight}`], Array.isArray(deco)
|
|
48
|
+
? deco.map((deco) => styles$1[`typography_deco_${deco}`]).join(' ')
|
|
49
|
+
: styles$1[`typography_deco_${deco}`], styles$1[`typography_color_${color}`], styles$1[`typography_highlight_${highlight}`], className);
|
|
50
|
+
return (jsxRuntime.jsx(Component, { className: cx, ...props, children: children }));
|
|
101
51
|
};
|
|
102
52
|
|
|
103
53
|
var css_248z = ".styles-module__flex___-sE2d{display:flex}.styles-module__flex_direction_row___HF6XY{flex-direction:row}.styles-module__flex_direction_column___HZa9-{flex-direction:column}.styles-module__flex_1___bAI3t{flex:1}.styles-module__flex_auto___mZzmi{flex:auto}.styles-module__flex_none___a2fut{flex:none}.styles-module__flex_initial___ZAC4D{flex:initial}.styles-module__flex_justify_start___W8iUD{justify-content:flex-start}.styles-module__flex_justify_end___Jm-3w{justify-content:flex-end}.styles-module__flex_justify_center___wbTay{justify-content:center}.styles-module__flex_justify_between___OLU6W{justify-content:space-between}.styles-module__flex_justify_around___C5Cs7{justify-content:space-around}.styles-module__flex_justify_evenly___A---h{justify-content:space-evenly}.styles-module__flex_align_start___VbWeX{align-items:flex-start}.styles-module__flex_align_end___uSXC7{align-items:flex-end}.styles-module__flex_align_center___uEXyg{align-items:center}.styles-module__flex_align_baseline___zkgAx{align-items:baseline}.styles-module__flex_align_stretch___r0bsz{align-items:stretch}";
|
|
104
54
|
var styles = {"flex":"styles-module__flex___-sE2d","flex_direction_row":"styles-module__flex_direction_row___HF6XY","flex_direction_column":"styles-module__flex_direction_column___HZa9-","flex_1":"styles-module__flex_1___bAI3t","flex_auto":"styles-module__flex_auto___mZzmi","flex_none":"styles-module__flex_none___a2fut","flex_initial":"styles-module__flex_initial___ZAC4D","flex_justify_start":"styles-module__flex_justify_start___W8iUD","flex_justify_end":"styles-module__flex_justify_end___Jm-3w","flex_justify_center":"styles-module__flex_justify_center___wbTay","flex_justify_between":"styles-module__flex_justify_between___OLU6W","flex_justify_around":"styles-module__flex_justify_around___C5Cs7","flex_justify_evenly":"styles-module__flex_justify_evenly___A---h","flex_align_start":"styles-module__flex_align_start___VbWeX","flex_align_end":"styles-module__flex_align_end___uSXC7","flex_align_center":"styles-module__flex_align_center___uEXyg","flex_align_baseline":"styles-module__flex_align_baseline___zkgAx","flex_align_stretch":"styles-module__flex_align_stretch___r0bsz"};
|
|
105
55
|
styleInject(css_248z);
|
|
106
56
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return (jsxRuntime.jsx(Component, __assign({ className: classes, style: gap ? __assign({ gap: "".concat(gap / 16, "rem") }, props.style) : props.style }, props, { children: children })));
|
|
57
|
+
const Flex = ({ as, children, direction = 'row', flex, justifyContent, alignItems, gap, className = '', ...props }) => {
|
|
58
|
+
const Component = as || 'div';
|
|
59
|
+
const classes = classNames(styles.flex, styles[`flex_direction_${direction}`], flex ? styles[`flex_${flex}`] : undefined, justifyContent ? styles[`flex_justify_${justifyContent}`] : undefined, alignItems ? styles[`flex_align_${alignItems}`] : undefined, className);
|
|
60
|
+
return (jsxRuntime.jsx(Component, { className: classes, style: gap ? { gap: `${gap / 16}rem`, ...props.style } : props.style, ...props, children: children }));
|
|
112
61
|
};
|
|
113
62
|
|
|
114
63
|
exports.Flex = Flex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../node_modules/.pnpm/@rollup+plugin-typescript@11.1.6_rollup@4.9.1_tslib@2.6.2_typescript@5.3.3/node_modules/tslib/tslib.es6.js","../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../../src/utils/classNames/index.ts","../../src/components/Typography/index.tsx","../../src/components/Flex/index.tsx"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n function next() {\r\n while (env.stack.length) {\r\n var rec = env.stack.pop();\r\n try {\r\n var result = rec.dispose && rec.dispose.call(rec.value);\r\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n};\r\n","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","const classNames = (...args: (string | undefined)[]) => {\n\treturn args.reduce((acc, className) => {\n\t\tif (className) {\n\t\t\treturn acc ? `${acc} ${className}` : className;\n\t\t}\n\t\treturn acc;\n\t}, '');\n};\n\nexport default classNames;\n","import React, { type ElementType } from 'react';\nimport { PolymorphicComponent } from '../_types';\nimport styles from './styles.module.scss';\nimport { classNames } from '@/utils';\nimport { palette } from '../_design/palette';\n\ntype TypographyDecoType = 'normal' | 'italic' | 'underline' | 'line-through';\n\ninterface StyledProps {\n\tdeco?: TypographyDecoType | TypographyDecoType[];\n\tweight?: 400 | 500 | 600 | 700;\n\tcolor?: keyof typeof palette;\n\tsize?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';\n\thighlight?: 'underline';\n}\n\nconst Typography = <T extends ElementType = 'p'>({\n\tas,\n\tchildren,\n\tsize = 'md',\n\tweight = 400,\n\tcolor = 'grey900',\n\tdeco = 'normal',\n\thighlight,\n\tclassName = '',\n\t...props\n}: PolymorphicComponent<T, StyledProps>) => {\n\tconst Component = as || 'p';\n\n\tconst classes = classNames(\n\t\tstyles.typography,\n\t\tstyles[`typography_size_${size}`],\n\t\tstyles[`typography_weight_${weight}`],\n\t\tArray.isArray(deco)\n\t\t\t? deco.map((deco) => styles[`typography_deco_${deco}`]).join(' ')\n\t\t\t: styles[`typography_deco_${deco}`],\n\t\tstyles[`typography_color_${color}`],\n\t\tstyles[`typography_highlight_${highlight}`],\n\t\tclassName\n\t);\n\n\treturn (\n\t\t<Component className={classes} {...props}>\n\t\t\t{children}\n\t\t</Component>\n\t);\n};\n\nexport default Typography;\n","import React, { type ElementType } from 'react';\nimport type { PolymorphicComponent } from '../_types';\nimport styles from './styles.module.scss';\nimport { classNames } from '@/utils';\n\ninterface StyledProps {\n\tdirection?: 'row' | 'column';\n\tflex?: '1' | 'auto' | 'none' | 'initial';\n\tjustifyContent?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly';\n\talignItems?: 'start' | 'end' | 'center' | 'baseline' | 'stretch';\n\tgap?: number;\n}\n\nconst Flex = <E extends ElementType = 'div'>({\n\tas,\n\tchildren,\n\tdirection = 'row',\n\tflex,\n\tjustifyContent,\n\talignItems,\n\tgap,\n\tclassName = '',\n\t...props\n}: PolymorphicComponent<E, StyledProps>) => {\n\tconst Component = as || 'div';\n\n\tconst classes = classNames(\n\t\tstyles.flex,\n\t\tstyles[`flex_direction_${direction}`],\n\t\tflex ? styles[`flex_${flex}`] : undefined,\n\t\tjustifyContent ? styles[`flex_justify_${justifyContent}`] : undefined,\n\t\talignItems ? styles[`flex_align_${alignItems}`] : undefined,\n\t\tclassName\n\t);\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={classes}\n\t\t\tstyle={gap ? { gap: `${gap / 16}rem`, ...props.style } : props.style}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</Component>\n\t);\n};\n\nexport default Flex;\n"],"names":["styles","_jsx"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAeA;AACO,IAAI,QAAQ,GAAG,WAAW;AACjC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,QAAQ,CAAC,CAAC,EAAE;AACrD,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AAC7D,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAC7B,YAAY,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACzF,SAAS;AACT,QAAQ,OAAO,CAAC,CAAC;AACjB,MAAK;AACL,IAAI,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAC3C,EAAC;AACD;AACO,SAAS,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE;AAC7B,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;AACf,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,C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S,EACzC,cAAc,GAAG,MAAM,CAAC,eAAA,CAAA,MAAA,CAAgB,cAAc,CAAE,CAAC,GAAG,SAAS,EACrE,UAAU,GAAG,MAAM,CAAC,aAAc,CAAA,MAAA,CAAA,UAAU,CAAE,CAAC,GAAG,SAAS,EAC3D,SAAS,CACT,CAAC;AAEF,IAAA,QACCA,cAAC,CAAA,SAAS,EACT,QAAA,CAAA,EAAA,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,GAAG,GAAK,QAAA,CAAA,EAAA,GAAG,EAAE,EAAG,CAAA,MAAA,CAAA,GAAG,GAAG,EAAE,QAAK,EAAK,EAAA,KAAK,CAAC,KAAK,IAAK,KAAK,CAAC,KAAK,EAChE,EAAA,KAAK,cAER,QAAQ,EAAA,CAAA,CACE,EACX;AACH;;;;;","x_google_ignoreList":[0,1]}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../../src/utils/classNames/index.ts","../../src/components/Typography/index.tsx","../../src/components/Flex/index.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","const classNames = (...args: (string | undefined)[]) => {\n\treturn args.reduce((acc, className) => {\n\t\tif (className) {\n\t\t\treturn acc ? `${acc} ${className}` : className;\n\t\t}\n\t\treturn acc;\n\t}, '');\n};\n\nexport default classNames;\n","import React, { type ElementType } from 'react';\nimport { PolymorphicComponent } from '../_types';\nimport styles from './styles.module.scss';\nimport { classNames } from '@/utils';\nimport { palette } from '../_design/palette';\n\ntype TypographyDecoType = 'normal' | 'italic' | 'underline' | 'line-through';\n\ninterface StyledProps {\n\tdeco?: TypographyDecoType | TypographyDecoType[];\n\tweight?: 400 | 500 | 600 | 700;\n\tcolor?: keyof typeof palette;\n\tsize?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';\n\thighlight?: 'underline';\n}\n\nconst Typography = <T extends ElementType = 'p'>({\n\tas,\n\tchildren,\n\tsize = 'md',\n\tweight = 400,\n\tcolor = 'grey900',\n\tdeco = 'normal',\n\thighlight,\n\tclassName = '',\n\t...props\n}: PolymorphicComponent<T, StyledProps>) => {\n\tconst Component = as || 'p';\n\n\tconst cx = classNames(\n\t\tstyles.typography,\n\t\tstyles[`typography_size_${size}`],\n\t\tstyles[`typography_weight_${weight}`],\n\t\tArray.isArray(deco)\n\t\t\t? deco.map((deco) => styles[`typography_deco_${deco}`]).join(' ')\n\t\t\t: styles[`typography_deco_${deco}`],\n\t\tstyles[`typography_color_${color}`],\n\t\tstyles[`typography_highlight_${highlight}`],\n\t\tclassName\n\t);\n\n\treturn (\n\t\t<Component className={cx} {...props}>\n\t\t\t{children}\n\t\t</Component>\n\t);\n};\n\nexport default Typography;\n","import React, { type ElementType } from 'react';\nimport type { PolymorphicComponent } from '../_types';\nimport styles from './styles.module.scss';\nimport { classNames } from '@/utils';\n\ninterface StyledProps {\n\tdirection?: 'row' | 'column';\n\tflex?: '1' | 'auto' | 'none' | 'initial';\n\tjustifyContent?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly';\n\talignItems?: 'start' | 'end' | 'center' | 'baseline' | 'stretch';\n\tgap?: number;\n}\n\nconst Flex = <E extends ElementType = 'div'>({\n\tas,\n\tchildren,\n\tdirection = 'row',\n\tflex,\n\tjustifyContent,\n\talignItems,\n\tgap,\n\tclassName = '',\n\t...props\n}: PolymorphicComponent<E, StyledProps>) => {\n\tconst Component = as || 'div';\n\n\tconst classes = classNames(\n\t\tstyles.flex,\n\t\tstyles[`flex_direction_${direction}`],\n\t\tflex ? styles[`flex_${flex}`] : undefined,\n\t\tjustifyContent ? styles[`flex_justify_${justifyContent}`] : undefined,\n\t\talignItems ? styles[`flex_align_${alignItems}`] : undefined,\n\t\tclassName\n\t);\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={classes}\n\t\t\tstyle={gap ? { gap: `${gap / 16}rem`, ...props.style } : props.style}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</Component>\n\t);\n};\n\nexport default Flex;\n"],"names":["styles","_jsx"],"mappings":";;;;AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,KAAK,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;AACjC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;AAC9B;AACA,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,EAAE;AAC1D;AACA,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAC9C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;AAC1B;AACA,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AAChD,KAAK,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC9B,KAAK;AACL,GAAG,MAAM;AACT,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5B,GAAG;AACH;AACA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1
|
+
/**
|
|
2
|
+
* Formats the career duration between two dates into a readable string.
|
|
3
|
+
* It handles internationalization (Korean/English) and the "Present" status for ongoing roles.
|
|
4
|
+
*
|
|
5
|
+
* @param props - The configuration object.
|
|
6
|
+
* @param props.startAt - The start date of the period.
|
|
7
|
+
* @param props.endAt - The end date. If undefined, it defaults to the current date (calculates duration up to now) and displays "Present" or "현재".
|
|
8
|
+
* @param props.showDuration - Whether to append the calculated duration (e.g., "(2y 6m)"). Defaults to true.
|
|
9
|
+
* @param props.lng - Language code ('ko' | 'en'). Defaults to 'ko'.
|
|
10
|
+
* @returns A formatted string: "YYYY.MM ~ YYYY.MM (Duration)" or "YYYY.MM ~ Present (Duration)".
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // 1. Ongoing role (Korean default)
|
|
14
|
+
* // Current date: 2024-02
|
|
15
|
+
* formatCareerPeriod({ startAt: new Date('2023-01-01') });
|
|
16
|
+
* // Output: "2023.01 ~ 현재 (1년 2개월)"
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // 2. Completed role with duration (English)
|
|
20
|
+
* formatCareerPeriod({
|
|
21
|
+
* startAt: new Date('2020-01-01'),
|
|
22
|
+
* endAt: new Date('2022-06-01'),
|
|
23
|
+
* lng: 'en'
|
|
24
|
+
* });
|
|
25
|
+
* // Output: "2020.01 ~ 2022.06 (2y 6m)"
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // 3. Hide duration
|
|
29
|
+
* formatCareerPeriod({
|
|
30
|
+
* startAt: new Date('2020-01-01'),
|
|
31
|
+
* endAt: new Date('2020-05-01'),
|
|
32
|
+
* showDuration: false
|
|
33
|
+
* });
|
|
34
|
+
* // Output: "2020.01 ~ 2020.05"
|
|
35
|
+
*/
|
|
36
|
+
export declare function formatCareerPeriod({ startAt, endAt, showDuration, lng, }: {
|
|
37
|
+
startAt: Date;
|
|
38
|
+
endAt?: Date;
|
|
39
|
+
showDuration?: boolean;
|
|
40
|
+
lng?: string;
|
|
41
|
+
}): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/hooks/index.esm.js
CHANGED
|
@@ -1,132 +1,52 @@
|
|
|
1
1
|
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
-
***************************************************************************** */
|
|
17
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var __assign = function() {
|
|
21
|
-
__assign = Object.assign || function __assign(t) {
|
|
22
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
23
|
-
s = arguments[i];
|
|
24
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
25
|
-
}
|
|
26
|
-
return t;
|
|
27
|
-
};
|
|
28
|
-
return __assign.apply(this, arguments);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
32
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
33
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
34
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
35
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
36
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
37
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function __generator(thisArg, body) {
|
|
42
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
43
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
44
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
45
|
-
function step(op) {
|
|
46
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
47
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
48
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
49
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
50
|
-
switch (op[0]) {
|
|
51
|
-
case 0: case 1: t = op; break;
|
|
52
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
53
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
54
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
55
|
-
default:
|
|
56
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
57
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
58
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
59
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
60
|
-
if (t[2]) _.ops.pop();
|
|
61
|
-
_.trys.pop(); continue;
|
|
62
|
-
}
|
|
63
|
-
op = body.call(thisArg, _);
|
|
64
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
65
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
70
|
-
var e = new Error(message);
|
|
71
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
var useFetch = function (url, options) {
|
|
75
|
-
var _a = useState(), data = _a[0], setData = _a[1];
|
|
76
|
-
var _b = useState(false), isLoading = _b[0], setIsLoading = _b[1];
|
|
77
|
-
var _c = useState(null), error = _c[0], setError = _c[1];
|
|
78
|
-
var optionsRef = useRef(options);
|
|
79
|
-
useEffect(function () {
|
|
3
|
+
const useFetch = (url, options) => {
|
|
4
|
+
const [data, setData] = useState();
|
|
5
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
6
|
+
const [error, setError] = useState(null);
|
|
7
|
+
const optionsRef = useRef(options);
|
|
8
|
+
useEffect(() => {
|
|
80
9
|
optionsRef.current = options;
|
|
81
10
|
}, [options]);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
setData(res);
|
|
100
|
-
return [3 /*break*/, 5];
|
|
101
|
-
case 3:
|
|
102
|
-
e_1 = _a.sent();
|
|
103
|
-
if (e_1 instanceof Error && e_1.name === 'AbortError') {
|
|
104
|
-
return [2 /*return*/];
|
|
105
|
-
}
|
|
106
|
-
err = e_1 instanceof Error ? e_1 : new Error('알 수 없는 오류가 발생했습니다.');
|
|
107
|
-
setError(err);
|
|
108
|
-
return [3 /*break*/, 5];
|
|
109
|
-
case 4:
|
|
110
|
-
setIsLoading(false);
|
|
111
|
-
return [7 /*endfinally*/];
|
|
112
|
-
case 5: return [2 /*return*/];
|
|
11
|
+
const request = useCallback(async (signal) => {
|
|
12
|
+
try {
|
|
13
|
+
setIsLoading(true);
|
|
14
|
+
setError(null);
|
|
15
|
+
const response = await fetch(url, {
|
|
16
|
+
...optionsRef.current,
|
|
17
|
+
signal,
|
|
18
|
+
});
|
|
19
|
+
if (!response.ok) {
|
|
20
|
+
throw new Error(`[${response.status}] ${url} 요청에 실패했습니다.`);
|
|
21
|
+
}
|
|
22
|
+
const res = (await response.json());
|
|
23
|
+
setData(res);
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
if (e instanceof Error && e.name === 'AbortError') {
|
|
27
|
+
return;
|
|
113
28
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
29
|
+
const err = e instanceof Error ? e : new Error('알 수 없는 오류가 발생했습니다.');
|
|
30
|
+
setError(err);
|
|
31
|
+
}
|
|
32
|
+
finally {
|
|
33
|
+
setIsLoading(false);
|
|
34
|
+
}
|
|
35
|
+
}, [url]);
|
|
36
|
+
useEffect(() => {
|
|
117
37
|
if (typeof window === 'undefined')
|
|
118
38
|
return;
|
|
119
|
-
|
|
39
|
+
const controller = new AbortController();
|
|
120
40
|
request(controller.signal);
|
|
121
|
-
return
|
|
41
|
+
return () => {
|
|
122
42
|
controller.abort();
|
|
123
43
|
};
|
|
124
44
|
}, [request]);
|
|
125
45
|
return {
|
|
126
|
-
data
|
|
127
|
-
isLoading
|
|
128
|
-
error
|
|
129
|
-
refetch:
|
|
46
|
+
data,
|
|
47
|
+
isLoading,
|
|
48
|
+
error,
|
|
49
|
+
refetch: () => request(new AbortController().signal),
|
|
130
50
|
};
|
|
131
51
|
};
|
|
132
52
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../node_modules/.pnpm/@rollup+plugin-typescript@11.1.6_rollup@4.9.1_tslib@2.6.2_typescript@5.3.3/node_modules/tslib/tslib.es6.js","../../src/hooks/useFetch/index.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n function next() {\r\n while (env.stack.length) {\r\n var rec = env.stack.pop();\r\n try {\r\n var result = rec.dispose && rec.dispose.call(rec.value);\r\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n};\r\n","import { useCallback, useEffect, useState, useRef } from 'react';\n\nconst useFetch = <T>(url: string, options?: RequestInit) => {\n\tconst [data, setData] = useState<T>();\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<Error | null>(null);\n\n\tconst optionsRef = useRef(options);\n\tuseEffect(() => {\n\t\toptionsRef.current = options;\n\t}, [options]);\n\n\tconst request = useCallback(\n\t\tasync (signal: AbortSignal) => {\n\t\t\ttry {\n\t\t\t\tsetIsLoading(true);\n\t\t\t\tsetError(null);\n\n\t\t\t\tconst response = await fetch(url, {\n\t\t\t\t\t...optionsRef.current,\n\t\t\t\t\tsignal,\n\t\t\t\t});\n\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tthrow new Error(`[${response.status}] ${url} 요청에 실패했습니다.`);\n\t\t\t\t}\n\n\t\t\t\tconst res = (await response.json()) as T;\n\t\t\t\tsetData(res);\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof Error && e.name === 'AbortError') {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst err =\n\t\t\t\t\te instanceof Error ? e : new Error('알 수 없는 오류가 발생했습니다.');\n\t\t\t\tsetError(err);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[url]\n\t);\n\n\tuseEffect(() => {\n\t\tif (typeof window === 'undefined') return;\n\n\t\tconst controller = new AbortController();\n\t\trequest(controller.signal);\n\n\t\treturn () => {\n\t\t\tcontroller.abort();\n\t\t};\n\t}, [request]);\n\n\treturn {\n\t\tdata,\n\t\tisLoading,\n\t\terror,\n\t\trefetch: () => request(new AbortController().signal),\n\t};\n};\n\nexport default useFetch;\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAeA;AACO,IAAI,QAAQ,GAAG,WAAW;AACjC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,QAAQ,CAAC,CAAC,EAAE;AACrD,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AAC7D,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAC7B,YAAY,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACzF,SAAS;AACT,QAAQ,OAAO,CAAC,CAAC;AACjB,MAAK;AACL,IAAI,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAC3C,EAAC;AAyED;AACO,SAAS,SAAS,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,SAAS,EAAE;AAC7D,IAAI,SAAS,KAAK,CAAC,KAAK,EAAE,EAAE,OAAO,KAAK,YAAY,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,UAAU,OAAO,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;AAChH,IAAI,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,EAA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AA,IAAI,EAAA,IAAA;AACJ,QAAA,SAAS,EAAA,SAAA;AACT,QAAA,KAAK,EAAA,KAAA;AACL,QAAA,OAAO,EAAE,YAAA,EAAM,OAAA,OAAO,CAAC,IAAI,eAAe,EAAE,CAAC,MAAM,CAAC,CAAA,EAAA;KACpD,CAAC;AACH;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../src/hooks/useFetch/index.ts"],"sourcesContent":["import { useCallback, useEffect, useState, useRef } from 'react';\n\nconst useFetch = <T>(url: string, options?: RequestInit) => {\n\tconst [data, setData] = useState<T>();\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<Error | null>(null);\n\n\tconst optionsRef = useRef(options);\n\tuseEffect(() => {\n\t\toptionsRef.current = options;\n\t}, [options]);\n\n\tconst request = useCallback(\n\t\tasync (signal: AbortSignal) => {\n\t\t\ttry {\n\t\t\t\tsetIsLoading(true);\n\t\t\t\tsetError(null);\n\n\t\t\t\tconst response = await fetch(url, {\n\t\t\t\t\t...optionsRef.current,\n\t\t\t\t\tsignal,\n\t\t\t\t});\n\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tthrow new Error(`[${response.status}] ${url} 요청에 실패했습니다.`);\n\t\t\t\t}\n\n\t\t\t\tconst res = (await response.json()) as T;\n\t\t\t\tsetData(res);\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof Error && e.name === 'AbortError') {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst err =\n\t\t\t\t\te instanceof Error ? e : new Error('알 수 없는 오류가 발생했습니다.');\n\t\t\t\tsetError(err);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[url]\n\t);\n\n\tuseEffect(() => {\n\t\tif (typeof window === 'undefined') return;\n\n\t\tconst controller = new AbortController();\n\t\trequest(controller.signal);\n\n\t\treturn () => {\n\t\t\tcontroller.abort();\n\t\t};\n\t}, [request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AAY,EAAE;gBAClD,OAAO;aACP;AAED,YAAA,MAAM,GAAG,GACR,CAAC,YAAY,KAAK,GAAG,CAAC,GAAG,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;YAC1D,QAAQ,CAAC,GAAG,CAAC,CAAC;SACd;gBAAS;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;SACpB;AACF,KAAC,EACD,CAAC,GAAG,CAAC,CACL,CAAC;IAEF,SAAS,CAAC,MAAK;QACd,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAO;AAE1C,QAAA,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;AACzC,QAAA,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AAE3B,QAAA,OAAO,MAAK;YACX,UAAU,CAAC,KAAK,EAAE,CAAC;AACpB,SAAC,CAAC;AACH,KAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO;QACN,IAAI;QACJ,SAAS;QACT,KAAK;QACL,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,eAAe,EAAE,CAAC,MAAM,CAAC;KACpD,CAAC;AACH;;;;"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -2,133 +2,53 @@
|
|
|
2
2
|
|
|
3
3
|
var react = require('react');
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
12
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
13
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
18
|
-
***************************************************************************** */
|
|
19
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var __assign = function() {
|
|
23
|
-
__assign = Object.assign || function __assign(t) {
|
|
24
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
25
|
-
s = arguments[i];
|
|
26
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
27
|
-
}
|
|
28
|
-
return t;
|
|
29
|
-
};
|
|
30
|
-
return __assign.apply(this, arguments);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
34
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
35
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
36
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
37
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
38
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
39
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function __generator(thisArg, body) {
|
|
44
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
45
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
46
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
47
|
-
function step(op) {
|
|
48
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
49
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
50
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
51
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
52
|
-
switch (op[0]) {
|
|
53
|
-
case 0: case 1: t = op; break;
|
|
54
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
55
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
56
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
57
|
-
default:
|
|
58
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
59
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
60
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
61
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
62
|
-
if (t[2]) _.ops.pop();
|
|
63
|
-
_.trys.pop(); continue;
|
|
64
|
-
}
|
|
65
|
-
op = body.call(thisArg, _);
|
|
66
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
67
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
72
|
-
var e = new Error(message);
|
|
73
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
var useFetch = function (url, options) {
|
|
77
|
-
var _a = react.useState(), data = _a[0], setData = _a[1];
|
|
78
|
-
var _b = react.useState(false), isLoading = _b[0], setIsLoading = _b[1];
|
|
79
|
-
var _c = react.useState(null), error = _c[0], setError = _c[1];
|
|
80
|
-
var optionsRef = react.useRef(options);
|
|
81
|
-
react.useEffect(function () {
|
|
5
|
+
const useFetch = (url, options) => {
|
|
6
|
+
const [data, setData] = react.useState();
|
|
7
|
+
const [isLoading, setIsLoading] = react.useState(false);
|
|
8
|
+
const [error, setError] = react.useState(null);
|
|
9
|
+
const optionsRef = react.useRef(options);
|
|
10
|
+
react.useEffect(() => {
|
|
82
11
|
optionsRef.current = options;
|
|
83
12
|
}, [options]);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
setData(res);
|
|
102
|
-
return [3 /*break*/, 5];
|
|
103
|
-
case 3:
|
|
104
|
-
e_1 = _a.sent();
|
|
105
|
-
if (e_1 instanceof Error && e_1.name === 'AbortError') {
|
|
106
|
-
return [2 /*return*/];
|
|
107
|
-
}
|
|
108
|
-
err = e_1 instanceof Error ? e_1 : new Error('알 수 없는 오류가 발생했습니다.');
|
|
109
|
-
setError(err);
|
|
110
|
-
return [3 /*break*/, 5];
|
|
111
|
-
case 4:
|
|
112
|
-
setIsLoading(false);
|
|
113
|
-
return [7 /*endfinally*/];
|
|
114
|
-
case 5: return [2 /*return*/];
|
|
13
|
+
const request = react.useCallback(async (signal) => {
|
|
14
|
+
try {
|
|
15
|
+
setIsLoading(true);
|
|
16
|
+
setError(null);
|
|
17
|
+
const response = await fetch(url, {
|
|
18
|
+
...optionsRef.current,
|
|
19
|
+
signal,
|
|
20
|
+
});
|
|
21
|
+
if (!response.ok) {
|
|
22
|
+
throw new Error(`[${response.status}] ${url} 요청에 실패했습니다.`);
|
|
23
|
+
}
|
|
24
|
+
const res = (await response.json());
|
|
25
|
+
setData(res);
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
if (e instanceof Error && e.name === 'AbortError') {
|
|
29
|
+
return;
|
|
115
30
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
31
|
+
const err = e instanceof Error ? e : new Error('알 수 없는 오류가 발생했습니다.');
|
|
32
|
+
setError(err);
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
setIsLoading(false);
|
|
36
|
+
}
|
|
37
|
+
}, [url]);
|
|
38
|
+
react.useEffect(() => {
|
|
119
39
|
if (typeof window === 'undefined')
|
|
120
40
|
return;
|
|
121
|
-
|
|
41
|
+
const controller = new AbortController();
|
|
122
42
|
request(controller.signal);
|
|
123
|
-
return
|
|
43
|
+
return () => {
|
|
124
44
|
controller.abort();
|
|
125
45
|
};
|
|
126
46
|
}, [request]);
|
|
127
47
|
return {
|
|
128
|
-
data
|
|
129
|
-
isLoading
|
|
130
|
-
error
|
|
131
|
-
refetch:
|
|
48
|
+
data,
|
|
49
|
+
isLoading,
|
|
50
|
+
error,
|
|
51
|
+
refetch: () => request(new AbortController().signal),
|
|
132
52
|
};
|
|
133
53
|
};
|
|
134
54
|
|
package/dist/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../node_modules/.pnpm/@rollup+plugin-typescript@11.1.6_rollup@4.9.1_tslib@2.6.2_typescript@5.3.3/node_modules/tslib/tslib.es6.js","../../src/hooks/useFetch/index.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n function next() {\r\n while (env.stack.length) {\r\n var rec = env.stack.pop();\r\n try {\r\n var result = rec.dispose && rec.dispose.call(rec.value);\r\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n};\r\n","import { useCallback, useEffect, useState, useRef } from 'react';\n\nconst useFetch = <T>(url: string, options?: RequestInit) => {\n\tconst [data, setData] = useState<T>();\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<Error | null>(null);\n\n\tconst optionsRef = useRef(options);\n\tuseEffect(() => {\n\t\toptionsRef.current = options;\n\t}, [options]);\n\n\tconst request = useCallback(\n\t\tasync (signal: AbortSignal) => {\n\t\t\ttry {\n\t\t\t\tsetIsLoading(true);\n\t\t\t\tsetError(null);\n\n\t\t\t\tconst response = await fetch(url, {\n\t\t\t\t\t...optionsRef.current,\n\t\t\t\t\tsignal,\n\t\t\t\t});\n\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tthrow new Error(`[${response.status}] ${url} 요청에 실패했습니다.`);\n\t\t\t\t}\n\n\t\t\t\tconst res = (await response.json()) as T;\n\t\t\t\tsetData(res);\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof Error && e.name === 'AbortError') {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst err =\n\t\t\t\t\te instanceof Error ? e : new Error('알 수 없는 오류가 발생했습니다.');\n\t\t\t\tsetError(err);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[url]\n\t);\n\n\tuseEffect(() => {\n\t\tif (typeof window === 'undefined') return;\n\n\t\tconst controller = new AbortController();\n\t\trequest(controller.signal);\n\n\t\treturn () => {\n\t\t\tcontroller.abort();\n\t\t};\n\t}, [request]);\n\n\treturn {\n\t\tdata,\n\t\tisLoading,\n\t\terror,\n\t\trefetch: () => request(new AbortController().signal),\n\t};\n};\n\nexport default useFetch;\n"],"names":["useState","useRef","useEffect","useCallback"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAeA;AACO,IAAI,QAAQ,GAAG,WAAW;AACjC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,QAAQ,CAAC,CAAC,EAAE;AACrD,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AAC7D,YAAY,CA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GAAG,CAAC,CAAC;;;;oBAEb,IAAI,GAAC,YAAY,KAAK,IAAI,GAAC,CAAC,IAAI,KAAK,YAAY,EAAE;wBAClD,OAAO,CAAA,CAAA,YAAA,CAAA;qBACP;AAEK,oBAAA,GAAG,GACR,GAAC,YAAY,KAAK,GAAG,GAAC,GAAG,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;oBAC1D,QAAQ,CAAC,GAAG,CAAC,CAAC;;;oBAEd,YAAY,CAAC,KAAK,CAAC,CAAC;;;;;AAErB,KAAA,CAAA,CAAA,EAAA,EACD,CAAC,GAAG,CAAC,CACL,CAAC;AAEF,IAAAD,eAAS,CAAC,YAAA;QACT,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAO;AAE1C,QAAA,IAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;AACzC,QAAA,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAE3B,OAAO,YAAA;YACN,UAAU,CAAC,KAAK,EAAE,CAAC;AACpB,SAAC,CAAC;AACH,KAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO;AACN,QAAA,IAAI,EAAA,IAAA;AACJ,QAAA,SAAS,EAAA,SAAA;AACT,QAAA,KAAK,EAAA,KAAA;AACL,QAAA,OAAO,EAAE,YAAA,EAAM,OAAA,OAAO,CAAC,IAAI,eAAe,EAAE,CAAC,MAAM,CAAC,CAAA,EAAA;KACpD,CAAC;AACH;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/hooks/useFetch/index.ts"],"sourcesContent":["import { useCallback, useEffect, useState, useRef } from 'react';\n\nconst useFetch = <T>(url: string, options?: RequestInit) => {\n\tconst [data, setData] = useState<T>();\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<Error | null>(null);\n\n\tconst optionsRef = useRef(options);\n\tuseEffect(() => {\n\t\toptionsRef.current = options;\n\t}, [options]);\n\n\tconst request = useCallback(\n\t\tasync (signal: AbortSignal) => {\n\t\t\ttry {\n\t\t\t\tsetIsLoading(true);\n\t\t\t\tsetError(null);\n\n\t\t\t\tconst response = await fetch(url, {\n\t\t\t\t\t...optionsRef.current,\n\t\t\t\t\tsignal,\n\t\t\t\t});\n\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tthrow new Error(`[${response.status}] ${url} 요청에 실패했습니다.`);\n\t\t\t\t}\n\n\t\t\t\tconst res = (await response.json()) as T;\n\t\t\t\tsetData(res);\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof Error && e.name === 'AbortError') {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst err =\n\t\t\t\t\te instanceof Error ? e : new Error('알 수 없는 오류가 발생했습니다.');\n\t\t\t\tsetError(err);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[url]\n\t);\n\n\tuseEffect(() => {\n\t\tif (typeof window === 'undefined') return;\n\n\t\tconst controller = new AbortController();\n\t\trequest(controller.signal);\n\n\t\treturn () => {\n\t\t\tcontroller.abort();\n\t\t};\n\t}, [request]);\n\n\treturn {\n\t\tdata,\n\t\tisLoading,\n\t\terror,\n\t\trefetch: () => request(new AbortController().signal),\n\t};\n};\n\nexport default useFetch;\n"],"names":["useState","useRef","useEffect","useCallback"],"mappings":";;;;AAEA,MAAM,QAAQ,GAAG,CAAI,GAAW,EAAE,OAAqB,KAAI;IAC1D,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAGA,cAAQ,EAAK,CAAC;IACtC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAGA,cAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAGA,cAAQ,CAAe,IAAI,CAAC,CAAC;AAEvD,IAAA,MAAM,UAAU,GAAGC,YAAM,CAAC,OAAO,CAAC,CAAC;IACnCC,eAAS,CAAC,MAAK;AACd,QA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AK,EAAE,CAAC;AACpB,SAAC,CAAC;AACH,KAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO;QACN,IAAI;QACJ,SAAS;QACT,KAAK;QACL,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,eAAe,EAAE,CAAC,MAAM,CAAC;KACpD,CAAC;AACH;;;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats the career duration between two dates into a readable string.
|
|
3
|
+
* It handles internationalization (Korean/English) and the "Present" status for ongoing roles.
|
|
4
|
+
*
|
|
5
|
+
* @param props - The configuration object.
|
|
6
|
+
* @param props.startAt - The start date of the period.
|
|
7
|
+
* @param props.endAt - The end date. If undefined, it defaults to the current date (calculates duration up to now) and displays "Present" or "현재".
|
|
8
|
+
* @param props.showDuration - Whether to append the calculated duration (e.g., "(2y 6m)"). Defaults to true.
|
|
9
|
+
* @param props.lng - Language code ('ko' | 'en'). Defaults to 'ko'.
|
|
10
|
+
* @returns A formatted string: "YYYY.MM ~ YYYY.MM (Duration)" or "YYYY.MM ~ Present (Duration)".
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // 1. Ongoing role (Korean default)
|
|
14
|
+
* // Current date: 2024-02
|
|
15
|
+
* formatCareerPeriod({ startAt: new Date('2023-01-01') });
|
|
16
|
+
* // Output: "2023.01 ~ 현재 (1년 2개월)"
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // 2. Completed role with duration (English)
|
|
20
|
+
* formatCareerPeriod({
|
|
21
|
+
* startAt: new Date('2020-01-01'),
|
|
22
|
+
* endAt: new Date('2022-06-01'),
|
|
23
|
+
* lng: 'en'
|
|
24
|
+
* });
|
|
25
|
+
* // Output: "2020.01 ~ 2022.06 (2y 6m)"
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // 3. Hide duration
|
|
29
|
+
* formatCareerPeriod({
|
|
30
|
+
* startAt: new Date('2020-01-01'),
|
|
31
|
+
* endAt: new Date('2020-05-01'),
|
|
32
|
+
* showDuration: false
|
|
33
|
+
* });
|
|
34
|
+
* // Output: "2020.01 ~ 2020.05"
|
|
35
|
+
*/
|
|
36
|
+
export declare function formatCareerPeriod({ startAt, endAt, showDuration, lng, }: {
|
|
37
|
+
startAt: Date;
|
|
38
|
+
endAt?: Date;
|
|
39
|
+
showDuration?: boolean;
|
|
40
|
+
lng?: string;
|
|
41
|
+
}): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/utils/index.esm.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
4
|
-
args[_i] = arguments[_i];
|
|
5
|
-
}
|
|
6
|
-
return args.reduce(function (acc, className) {
|
|
1
|
+
const classNames = (...args) => {
|
|
2
|
+
return args.reduce((acc, className) => {
|
|
7
3
|
if (className) {
|
|
8
|
-
return acc ?
|
|
4
|
+
return acc ? `${acc} ${className}` : className;
|
|
9
5
|
}
|
|
10
6
|
return acc;
|
|
11
7
|
}, '');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../src/utils/classNames/index.ts"],"sourcesContent":["const classNames = (...args: (string | undefined)[]) => {\n\treturn args.reduce((acc, className) => {\n\t\tif (className) {\n\t\t\treturn acc ? `${acc} ${className}` : className;\n\t\t}\n\t\treturn acc;\n\t}, '');\n};\n\nexport default classNames;\n"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../src/utils/classNames/index.ts"],"sourcesContent":["const classNames = (...args: (string | undefined)[]) => {\n\treturn args.reduce((acc, className) => {\n\t\tif (className) {\n\t\t\treturn acc ? `${acc} ${className}` : className;\n\t\t}\n\t\treturn acc;\n\t}, '');\n};\n\nexport default classNames;\n"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG,CAAC,GAAG,IAA4B,KAAI;IACtD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,SAAS,KAAI;QACrC,IAAI,SAAS,EAAE;AACd,YAAA,OAAO,GAAG,GAAG,CAAG,EAAA,GAAG,CAAI,CAAA,EAAA,SAAS,CAAE,CAAA,GAAG,SAAS,CAAC;SAC/C;AACD,QAAA,OAAO,GAAG,CAAC;KACX,EAAE,EAAE,CAAC,CAAC;AACR;;;;"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6
|
-
args[_i] = arguments[_i];
|
|
7
|
-
}
|
|
8
|
-
return args.reduce(function (acc, className) {
|
|
3
|
+
const classNames = (...args) => {
|
|
4
|
+
return args.reduce((acc, className) => {
|
|
9
5
|
if (className) {
|
|
10
|
-
return acc ?
|
|
6
|
+
return acc ? `${acc} ${className}` : className;
|
|
11
7
|
}
|
|
12
8
|
return acc;
|
|
13
9
|
}, '');
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/utils/classNames/index.ts"],"sourcesContent":["const classNames = (...args: (string | undefined)[]) => {\n\treturn args.reduce((acc, className) => {\n\t\tif (className) {\n\t\t\treturn acc ? `${acc} ${className}` : className;\n\t\t}\n\t\treturn acc;\n\t}, '');\n};\n\nexport default classNames;\n"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/utils/classNames/index.ts"],"sourcesContent":["const classNames = (...args: (string | undefined)[]) => {\n\treturn args.reduce((acc, className) => {\n\t\tif (className) {\n\t\t\treturn acc ? `${acc} ${className}` : className;\n\t\t}\n\t\treturn acc;\n\t}, '');\n};\n\nexport default classNames;\n"],"names":[],"mappings":";;AAAA,MAAM,UAAU,GAAG,CAAC,GAAG,IAA4B,KAAI;IACtD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,SAAS,KAAI;QACrC,IAAI,SAAS,EAAE;AACd,YAAA,OAAO,GAAG,GAAG,CAAG,EAAA,GAAG,CAAI,CAAA,EAAA,SAAS,CAAE,CAAA,GAAG,SAAS,CAAC;SAC/C;AACD,QAAA,OAAO,GAAG,CAAC;KACX,EAAE,EAAE,CAAC,CAAC;AACR;;;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats the career duration between two dates into a readable string.
|
|
3
|
+
* It handles internationalization (Korean/English) and the "Present" status for ongoing roles.
|
|
4
|
+
*
|
|
5
|
+
* @param props - The configuration object.
|
|
6
|
+
* @param props.startAt - The start date of the period.
|
|
7
|
+
* @param props.endAt - The end date. If undefined, it defaults to the current date (calculates duration up to now) and displays "Present" or "현재".
|
|
8
|
+
* @param props.showDuration - Whether to append the calculated duration (e.g., "(2y 6m)"). Defaults to true.
|
|
9
|
+
* @param props.lng - Language code ('ko' | 'en'). Defaults to 'ko'.
|
|
10
|
+
* @returns A formatted string: "YYYY.MM ~ YYYY.MM (Duration)" or "YYYY.MM ~ Present (Duration)".
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // 1. Ongoing role (Korean default)
|
|
14
|
+
* // Current date: 2024-02
|
|
15
|
+
* formatCareerPeriod({ startAt: new Date('2023-01-01') });
|
|
16
|
+
* // Output: "2023.01 ~ 현재 (1년 2개월)"
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // 2. Completed role with duration (English)
|
|
20
|
+
* formatCareerPeriod({
|
|
21
|
+
* startAt: new Date('2020-01-01'),
|
|
22
|
+
* endAt: new Date('2022-06-01'),
|
|
23
|
+
* lng: 'en'
|
|
24
|
+
* });
|
|
25
|
+
* // Output: "2020.01 ~ 2022.06 (2y 6m)"
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // 3. Hide duration
|
|
29
|
+
* formatCareerPeriod({
|
|
30
|
+
* startAt: new Date('2020-01-01'),
|
|
31
|
+
* endAt: new Date('2020-05-01'),
|
|
32
|
+
* showDuration: false
|
|
33
|
+
* });
|
|
34
|
+
* // Output: "2020.01 ~ 2020.05"
|
|
35
|
+
*/
|
|
36
|
+
export declare function formatCareerPeriod({ startAt, endAt, showDuration, lng, }: {
|
|
37
|
+
startAt: Date;
|
|
38
|
+
endAt?: Date;
|
|
39
|
+
showDuration?: boolean;
|
|
40
|
+
lng?: string;
|
|
41
|
+
}): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|