@basiln/utils 0.1.1 → 0.1.3
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/CHANGELOG.md +120 -0
- package/dist/Choose.js +50 -0
- package/dist/Choose.js.map +1 -0
- package/dist/Choose.mjs +7 -0
- package/dist/Choose.mjs.map +1 -0
- package/dist/Flex.js +70 -0
- package/dist/Flex.js.map +1 -0
- package/dist/Flex.mjs +10 -0
- package/dist/Flex.mjs.map +1 -0
- package/dist/If.js +35 -0
- package/dist/If.js.map +1 -0
- package/dist/If.mjs +7 -0
- package/dist/If.mjs.map +1 -0
- package/dist/SafeArea.js +91 -0
- package/dist/SafeArea.js.map +1 -0
- package/dist/SafeArea.mjs +10 -0
- package/dist/SafeArea.mjs.map +1 -0
- package/dist/Spacing.js +49 -0
- package/dist/Spacing.js.map +1 -0
- package/dist/Spacing.mjs +8 -0
- package/dist/Spacing.mjs.map +1 -0
- package/dist/Validate.js +43 -0
- package/dist/Validate.js.map +1 -0
- package/dist/Validate.mjs +7 -0
- package/dist/Validate.mjs.map +1 -0
- package/dist/chunk-7WNTKDNW.mjs +26 -0
- package/dist/chunk-7WNTKDNW.mjs.map +1 -0
- package/dist/chunk-C7VOPXT2.mjs +23 -0
- package/dist/chunk-C7VOPXT2.mjs.map +1 -0
- package/dist/chunk-DD3KGUQX.mjs +22 -0
- package/dist/chunk-DD3KGUQX.mjs.map +1 -0
- package/dist/chunk-FUGA35PJ.mjs +22 -0
- package/dist/chunk-FUGA35PJ.mjs.map +1 -0
- package/dist/chunk-GQPOYY4X.mjs +77 -0
- package/dist/chunk-GQPOYY4X.mjs.map +1 -0
- package/dist/chunk-HLTXXENG.mjs +39 -0
- package/dist/chunk-HLTXXENG.mjs.map +1 -0
- package/dist/chunk-OIJ4AVT7.mjs +37 -0
- package/dist/chunk-OIJ4AVT7.mjs.map +1 -0
- package/dist/chunk-Q3B6WSD7.mjs +42 -0
- package/dist/chunk-Q3B6WSD7.mjs.map +1 -0
- package/dist/chunk-QD5QDTUG.mjs +14 -0
- package/dist/chunk-QD5QDTUG.mjs.map +1 -0
- package/dist/chunk-R23KSR7N.mjs +19 -0
- package/dist/chunk-R23KSR7N.mjs.map +1 -0
- package/dist/chunk-SJJHTYZC.mjs +30 -0
- package/dist/chunk-SJJHTYZC.mjs.map +1 -0
- package/dist/chunk-T7K7QYTL.mjs +9 -0
- package/dist/chunk-T7K7QYTL.mjs.map +1 -0
- package/dist/chunk-U4T3KW7L.mjs +67 -0
- package/dist/chunk-U4T3KW7L.mjs.map +1 -0
- package/dist/chunk-UFRXNT2I.mjs +11 -0
- package/dist/chunk-UFRXNT2I.mjs.map +1 -0
- package/dist/chunk-WHYNBO2G.mjs +12 -0
- package/dist/chunk-WHYNBO2G.mjs.map +1 -0
- package/dist/chunk-XBGZ3YNL.mjs +20 -0
- package/dist/chunk-XBGZ3YNL.mjs.map +1 -0
- package/dist/chunk-Z4QPISK7.mjs +36 -0
- package/dist/chunk-Z4QPISK7.mjs.map +1 -0
- package/dist/coerceCssPixelValue.js +33 -0
- package/dist/coerceCssPixelValue.js.map +1 -0
- package/dist/coerceCssPixelValue.mjs +7 -0
- package/dist/coerceCssPixelValue.mjs.map +1 -0
- package/dist/composeEventHandlers.js +38 -0
- package/dist/composeEventHandlers.js.map +1 -0
- package/dist/composeEventHandlers.mjs +7 -0
- package/dist/composeEventHandlers.mjs.map +1 -0
- package/dist/constants/josa.js +105 -0
- package/dist/constants/josa.js.map +1 -0
- package/dist/constants/josa.mjs +15 -0
- package/dist/constants/josa.mjs.map +1 -0
- package/dist/createContext.js +56 -0
- package/dist/createContext.js.map +1 -0
- package/dist/createContext.mjs +7 -0
- package/dist/createContext.mjs.map +1 -0
- package/dist/ellipsis.js +45 -0
- package/dist/ellipsis.js.map +1 -0
- package/dist/ellipsis.mjs +9 -0
- package/dist/ellipsis.mjs.map +1 -0
- package/dist/getVar.js +36 -0
- package/dist/getVar.js.map +1 -0
- package/dist/getVar.mjs +7 -0
- package/dist/getVar.mjs.map +1 -0
- package/dist/hasBatchim.js +111 -0
- package/dist/hasBatchim.js.map +1 -0
- package/dist/hasBatchim.mjs +8 -0
- package/dist/hasBatchim.mjs.map +1 -0
- package/dist/hexToRgba.js +61 -0
- package/dist/hexToRgba.js.map +1 -0
- package/dist/hexToRgba.mjs +7 -0
- package/dist/hexToRgba.mjs.map +1 -0
- package/dist/index.d.ts +174 -0
- package/dist/index.js +456 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +64 -0
- package/dist/index.mjs.map +1 -0
- package/dist/josa.js +133 -0
- package/dist/josa.js.map +1 -0
- package/dist/josa.mjs +9 -0
- package/dist/josa.mjs.map +1 -0
- package/dist/queryString.js +91 -0
- package/dist/queryString.js.map +1 -0
- package/dist/queryString.mjs +7 -0
- package/dist/queryString.mjs.map +1 -0
- package/dist/useSafeArea.js +49 -0
- package/dist/useSafeArea.js.map +1 -0
- package/dist/useSafeArea.mjs +8 -0
- package/dist/useSafeArea.mjs.map +1 -0
- package/package.json +5 -2
- package/src/Flex.tsx +51 -0
- package/src/SafeArea.tsx +46 -0
- package/src/Spacing.tsx +30 -0
- package/src/Validate.ts +25 -0
- package/src/coerceCssPixelValue.ts +5 -0
- package/src/constants/josa.ts +72 -0
- package/src/ellipsis.ts +19 -0
- package/src/hasBatchim.ts +31 -0
- package/src/hexToRgba.ts +45 -0
- package/src/index.ts +25 -0
- package/src/josa.ts +50 -0
- package/src/queryString.ts +134 -0
- package/src/useSafeArea.ts +24 -0
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,125 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.1.3
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#30](https://github.com/seedn-corp/basiln-packages-fe/pull/30) [`817db3c`](https://github.com/seedn-corp/basiln-packages-fe/commit/817db3ca75bda217ee720e3406395b06e13427c4) Thanks [@im-binary](https://github.com/im-binary)! - direction 의 기본값 horizontal를 vertical 로 수정
|
8
|
+
|
9
|
+
## 0.1.2
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- [#8](https://github.com/seedn-corp/basiln-packages-fe/pull/8) [`7c1a636`](https://github.com/seedn-corp/basiln-packages-fe/commit/7c1a636efe1ba5c04609094f0c359ca959adf0f4) Thanks [@im-binary](https://github.com/im-binary)! - 선언적으로 flex box를 적용하고 싶을 때 사용할 수 있는 유틸 컴포넌트 Flex 추가
|
14
|
+
|
15
|
+
```tsx
|
16
|
+
// 사용 방법
|
17
|
+
|
18
|
+
<Flex justify="space-between" align="center">
|
19
|
+
...
|
20
|
+
</Flex>
|
21
|
+
```
|
22
|
+
|
23
|
+
- [#20](https://github.com/seedn-corp/basiln-packages-fe/pull/20) [`d26fcf7`](https://github.com/seedn-corp/basiln-packages-fe/commit/d26fcf7fb13987553af612bacafc814f3d6ee926) Thanks [@yoonhihi97](https://github.com/yoonhihi97)! - 정규식 검사를 할 수 있는 Validate 유틸 추가
|
24
|
+
|
25
|
+
```tsx
|
26
|
+
Validate.email('basiln@basiln.com');
|
27
|
+
Validate.phoneNumber('basiln@basiln.com');
|
28
|
+
```
|
29
|
+
|
30
|
+
- [#22](https://github.com/seedn-corp/basiln-packages-fe/pull/22) [`3f8b55e`](https://github.com/seedn-corp/basiln-packages-fe/commit/3f8b55e0125332036408cb91d2a255a4a8c51f3c) Thanks [@im-binary](https://github.com/im-binary)! - - Flex 유틸 컴포넌트의 속성 gap 을 number 타입도 허용
|
31
|
+
|
32
|
+
- [#24](https://github.com/seedn-corp/basiln-packages-fe/pull/24) [`dabf0c8`](https://github.com/seedn-corp/basiln-packages-fe/commit/dabf0c8154e7da5f0f12cb65142b396bb6e3c3f6) Thanks [@im-binary](https://github.com/im-binary)! - queryString을 create, parse, get, set할 때 사용할 수 있는 유틸입니다.
|
33
|
+
|
34
|
+
```ts
|
35
|
+
// queryString create
|
36
|
+
queryString.create({ a: '1', b: '2' }); // ?a=1&b=2&c=3
|
37
|
+
|
38
|
+
// queryString parse
|
39
|
+
queryString.parse('?a=1&b=2&c=3'); // { a: '1', b: '2' }
|
40
|
+
|
41
|
+
// queryString get
|
42
|
+
queryString.get('a'); // '1'
|
43
|
+
queryString.get('a', parseInt); // 1
|
44
|
+
|
45
|
+
// queryString set
|
46
|
+
queryString.set({ qs: '?a=1', key: 'b', value: '2' }); // '?a=1&b=2'
|
47
|
+
```
|
48
|
+
|
49
|
+
- [#13](https://github.com/seedn-corp/basiln-packages-fe/pull/13) [`68e5c1a`](https://github.com/seedn-corp/basiln-packages-fe/commit/68e5c1a57deb628f7322fff2e30c0e4be995ecb7) Thanks [@yoonhihi97](https://github.com/yoonhihi97)! - 16진수 컬러 코드를 rgba() 표기로 변환하는 유틸 추가
|
50
|
+
|
51
|
+
```tsx
|
52
|
+
// 사용 방법
|
53
|
+
|
54
|
+
hexToRgba({ hex: '#000000', alpha: 0.5 }); // 'rgba(0, 0, 0, 0.5)'
|
55
|
+
hexToRgba({ hex: '#000', alpha: 0.5 }); // 'rgba(0, 0, 0, 0.5)'
|
56
|
+
```
|
57
|
+
|
58
|
+
- [#25](https://github.com/seedn-corp/basiln-packages-fe/pull/25) [`203b91d`](https://github.com/seedn-corp/basiln-packages-fe/commit/203b91d64561931167fda6205422b34bb1962786) Thanks [@yoonhihi97](https://github.com/yoonhihi97)! - 웹뷰 환경에서 Safe Area를 선언적으로 사용할 수 있는 유틸 컴포넌트 추가
|
59
|
+
|
60
|
+
```tsx
|
61
|
+
// 사용 방법
|
62
|
+
|
63
|
+
<SafeArea>
|
64
|
+
<p>안녕하세요</p>
|
65
|
+
</SafeArea>
|
66
|
+
```
|
67
|
+
|
68
|
+
웹뷰 환경에서 SafeArea 값을 사용하기 위한 유틸 추가
|
69
|
+
|
70
|
+
```tsx
|
71
|
+
// 사용 방법
|
72
|
+
|
73
|
+
const { top } = useSafeArea();
|
74
|
+
```
|
75
|
+
|
76
|
+
- [#19](https://github.com/seedn-corp/basiln-packages-fe/pull/19) [`2a2c812`](https://github.com/seedn-corp/basiln-packages-fe/commit/2a2c812494e63c599c573ff9bf8338a5b584928d) Thanks [@im-binary](https://github.com/im-binary)! - 선언적으로 요소들의 간격을 주고 싶을 때 사용할 수 있는 Spacing 유틸 컴포넌트 추가
|
77
|
+
|
78
|
+
```tsx
|
79
|
+
// 사용 방법
|
80
|
+
|
81
|
+
<Spacing size={30}>
|
82
|
+
|
83
|
+
<Spacing size="3rem">
|
84
|
+
|
85
|
+
<Spacing size="30px" direction="horizontal">
|
86
|
+
```
|
87
|
+
|
88
|
+
- [#11](https://github.com/seedn-corp/basiln-packages-fe/pull/11) [`2e1833e`](https://github.com/seedn-corp/basiln-packages-fe/commit/2e1833e76c920b97231671cc4f64bb17d68646b3) Thanks [@yoonhihi97](https://github.com/yoonhihi97)! - ellipsis 스타일링을 위한 유틸리티 추가
|
89
|
+
|
90
|
+
```tsx
|
91
|
+
// ellipsis 사용 방법
|
92
|
+
|
93
|
+
<p css={ellipsis}>
|
94
|
+
...
|
95
|
+
</p>
|
96
|
+
|
97
|
+
const Text = styled.p`
|
98
|
+
...
|
99
|
+
${ellipsis}
|
100
|
+
`
|
101
|
+
|
102
|
+
// multiLineEllipsis 사용 방법
|
103
|
+
// line: 몇번째 line에 ellipsis를 적용할지 지정
|
104
|
+
<p css={multiLineEllipsis({line: 3})}>
|
105
|
+
...
|
106
|
+
</p>
|
107
|
+
|
108
|
+
const Text = styled.p`
|
109
|
+
...
|
110
|
+
${multiLineEllipsis({line: 3})}
|
111
|
+
`
|
112
|
+
```
|
113
|
+
|
114
|
+
- [#16](https://github.com/seedn-corp/basiln-packages-fe/pull/16) [`044a33c`](https://github.com/seedn-corp/basiln-packages-fe/commit/044a33cee600fbd1de1ba0971f2e02ba4280227e) Thanks [@yoonhihi97](https://github.com/yoonhihi97)! - 한글 문자열에 맞는 조사를 반환하는 유틸 추가
|
115
|
+
(이/가, 을/를, 은/는 제공)
|
116
|
+
|
117
|
+
```tsx
|
118
|
+
// 사용 방법
|
119
|
+
josa({ josa: '을/를', word: '망곰이' }); // 망곰이를
|
120
|
+
josa.pick({ josa: '은/는', word: '하츄핑' }); // 은
|
121
|
+
```
|
122
|
+
|
3
123
|
## 0.1.1
|
4
124
|
|
5
125
|
### Patch Changes
|
package/dist/Choose.js
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
|
20
|
+
// src/Choose.tsx
|
21
|
+
var Choose_exports = {};
|
22
|
+
__export(Choose_exports, {
|
23
|
+
Choose: () => Choose
|
24
|
+
});
|
25
|
+
module.exports = __toCommonJS(Choose_exports);
|
26
|
+
var import_react = require("react");
|
27
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
28
|
+
function Choose({ children }) {
|
29
|
+
const validChildren = import_react.Children.toArray(children);
|
30
|
+
const matchingChild = validChildren.find(
|
31
|
+
(child) => (0, import_react.isValidElement)(child) && child.type === Choose.When && child.props.condition
|
32
|
+
);
|
33
|
+
if (matchingChild) {
|
34
|
+
return matchingChild;
|
35
|
+
}
|
36
|
+
const otherwiseChild = validChildren.find(
|
37
|
+
(child) => (0, import_react.isValidElement)(child) && child.type === Choose.Otherwise
|
38
|
+
);
|
39
|
+
return otherwiseChild || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
40
|
+
}
|
41
|
+
var ChooseWhen = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
42
|
+
ChooseWhen.displayName = "Choose.When";
|
43
|
+
var ChooseOtherwise = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
44
|
+
Choose.When = ChooseWhen;
|
45
|
+
Choose.Otherwise = ChooseOtherwise;
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
47
|
+
0 && (module.exports = {
|
48
|
+
Choose
|
49
|
+
});
|
50
|
+
//# sourceMappingURL=Choose.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/Choose.tsx"],"sourcesContent":["import { isValidElement, type ReactNode, type FC, Children } from 'react';\n\nexport type ChooseWhenProps = {\n condition: boolean;\n children: ReactNode;\n};\n\nexport type ChooseProps = {\n children: ReactNode;\n};\n\nexport type ChooseOtherwiseProps = {\n children: ReactNode;\n};\n\nexport function Choose({ children }: ChooseProps) {\n const validChildren = Children.toArray(children);\n\n const matchingChild = validChildren.find(\n (child) =>\n isValidElement<ChooseWhenProps>(child) &&\n child.type === Choose.When &&\n child.props.condition\n );\n\n if (matchingChild) {\n return matchingChild;\n }\n\n const otherwiseChild = validChildren.find(\n (child) => isValidElement(child) && child.type === Choose.Otherwise\n );\n\n return otherwiseChild || <></>;\n}\n\nconst ChooseWhen: FC<ChooseWhenProps> = ({ children }) => <>{children}</>;\nChooseWhen.displayName = 'Choose.When';\n\nconst ChooseOtherwise: FC<ChooseOtherwiseProps> = ({ children }) => (\n <>{children}</>\n);\n\nChoose.When = ChooseWhen;\nChoose.Otherwise = ChooseOtherwise;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkE;AAiCvC;AAlBpB,SAAS,OAAO,EAAE,SAAS,GAAgB;AAChD,QAAM,gBAAgB,sBAAS,QAAQ,QAAQ;AAE/C,QAAM,gBAAgB,cAAc;AAAA,IAClC,CAAC,cACC,6BAAgC,KAAK,KACrC,MAAM,SAAS,OAAO,QACtB,MAAM,MAAM;AAAA,EAChB;AAEA,MAAI,eAAe;AACjB,WAAO;AAAA,EACT;AAEA,QAAM,iBAAiB,cAAc;AAAA,IACnC,CAAC,cAAU,6BAAe,KAAK,KAAK,MAAM,SAAS,OAAO;AAAA,EAC5D;AAEA,SAAO,kBAAkB,2EAAE;AAC7B;AAEA,IAAM,aAAkC,CAAC,EAAE,SAAS,MAAM,2EAAG,UAAS;AACtE,WAAW,cAAc;AAEzB,IAAM,kBAA4C,CAAC,EAAE,SAAS,MAC5D,2EAAG,UAAS;AAGd,OAAO,OAAO;AACd,OAAO,YAAY;","names":[]}
|
package/dist/Choose.mjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/Flex.js
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
|
20
|
+
// src/Flex.tsx
|
21
|
+
var Flex_exports = {};
|
22
|
+
__export(Flex_exports, {
|
23
|
+
Container: () => Container,
|
24
|
+
Flex: () => Flex
|
25
|
+
});
|
26
|
+
module.exports = __toCommonJS(Flex_exports);
|
27
|
+
var import_react = require("react");
|
28
|
+
var import_styled_components = require("styled-components");
|
29
|
+
|
30
|
+
// src/coerceCssPixelValue.ts
|
31
|
+
function coerceCssPixelValue(value) {
|
32
|
+
return typeof value === "string" ? value : `${value}px`;
|
33
|
+
}
|
34
|
+
|
35
|
+
// src/Flex.tsx
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
37
|
+
var Flex = (0, import_react.memo)(function Flex2(props) {
|
38
|
+
const {
|
39
|
+
gap = 0,
|
40
|
+
justify = "center",
|
41
|
+
align = "center",
|
42
|
+
direction = "row",
|
43
|
+
children,
|
44
|
+
...restProps
|
45
|
+
} = props;
|
46
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
47
|
+
Container,
|
48
|
+
{
|
49
|
+
$gap: gap,
|
50
|
+
$justify: justify,
|
51
|
+
$align: align,
|
52
|
+
$direction: direction,
|
53
|
+
...restProps,
|
54
|
+
children
|
55
|
+
}
|
56
|
+
);
|
57
|
+
});
|
58
|
+
var Container = import_styled_components.styled.div`
|
59
|
+
display: flex;
|
60
|
+
flex-direction: ${({ $direction }) => $direction};
|
61
|
+
gap: ${({ $gap }) => coerceCssPixelValue($gap)};
|
62
|
+
align-items: ${({ $align }) => $align};
|
63
|
+
justify-content: ${({ $justify }) => $justify};
|
64
|
+
`;
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
66
|
+
0 && (module.exports = {
|
67
|
+
Container,
|
68
|
+
Flex
|
69
|
+
});
|
70
|
+
//# sourceMappingURL=Flex.js.map
|
package/dist/Flex.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/Flex.tsx","../src/coerceCssPixelValue.ts"],"sourcesContent":["import { memo, type CSSProperties, type HTMLAttributes } from 'react';\nimport { styled } from 'styled-components';\n\nimport { coerceCssPixelValue, type CSSPixelValue } from './coerceCssPixelValue';\n\ntype Justify = CSSProperties['justifyContent'];\ntype Align = CSSProperties['alignItems'];\ntype Direction = CSSProperties['flexDirection'];\n\nexport type FlexProps = HTMLAttributes<HTMLDivElement> & {\n gap?: CSSPixelValue;\n justify?: Justify;\n align?: Align;\n direction?: Direction;\n};\n\nexport const Flex = memo(function Flex(props: FlexProps) {\n const {\n gap = 0,\n justify = 'center',\n align = 'center',\n direction = 'row',\n children,\n ...restProps\n } = props;\n\n return (\n <Container\n $gap={gap}\n $justify={justify}\n $align={align}\n $direction={direction}\n {...restProps}\n >\n {children}\n </Container>\n );\n});\n\nexport const Container = styled.div<{\n $gap: CSSPixelValue;\n $justify: Justify;\n $align: Align;\n $direction: Direction;\n}>`\n display: flex;\n flex-direction: ${({ $direction }) => $direction};\n gap: ${({ $gap }) => coerceCssPixelValue($gap)};\n align-items: ${({ $align }) => $align};\n justify-content: ${({ $justify }) => $justify};\n`;\n","export type CSSPixelValue = string | number;\n\nexport function coerceCssPixelValue(value: CSSPixelValue): string {\n return typeof value === 'string' ? value : `${value}px`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8D;AAC9D,+BAAuB;;;ACChB,SAAS,oBAAoB,OAA8B;AAChE,SAAO,OAAO,UAAU,WAAW,QAAQ,GAAG;AAChD;;;ADuBI;AAXG,IAAM,WAAO,mBAAK,SAASA,MAAK,OAAkB;AACvD,QAAM;AAAA,IACJ,MAAM;AAAA,IACN,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AAEJ,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,YAAY;AAAA,MACX,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ,CAAC;AAEM,IAAM,YAAY,gCAAO;AAAA;AAAA,oBAOZ,CAAC,EAAE,WAAW,MAAM;AAAA,SAC/B,CAAC,EAAE,KAAK,MAAM,oBAAoB,IAAI;AAAA,iBAC9B,CAAC,EAAE,OAAO,MAAM;AAAA,qBACZ,CAAC,EAAE,SAAS,MAAM;AAAA;","names":["Flex"]}
|
package/dist/Flex.mjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/If.js
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
|
20
|
+
// src/If.tsx
|
21
|
+
var If_exports = {};
|
22
|
+
__export(If_exports, {
|
23
|
+
If: () => If
|
24
|
+
});
|
25
|
+
module.exports = __toCommonJS(If_exports);
|
26
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
27
|
+
function If(props) {
|
28
|
+
const { condition, children } = props;
|
29
|
+
return condition ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children }) : null;
|
30
|
+
}
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
32
|
+
0 && (module.exports = {
|
33
|
+
If
|
34
|
+
});
|
35
|
+
//# sourceMappingURL=If.js.map
|
package/dist/If.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/If.tsx"],"sourcesContent":["import { type ReactNode } from 'react';\n\nexport type IfProps = {\n condition: boolean;\n children: ReactNode;\n};\n\nexport function If(props: IfProps) {\n const { condition, children } = props;\n\n return condition ? <>{children}</> : null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUqB;AAHd,SAAS,GAAG,OAAgB;AACjC,QAAM,EAAE,WAAW,SAAS,IAAI;AAEhC,SAAO,YAAY,2EAAG,UAAS,IAAM;AACvC;","names":[]}
|
package/dist/If.mjs
ADDED
package/dist/If.mjs.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/SafeArea.js
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
|
20
|
+
// src/SafeArea.tsx
|
21
|
+
var SafeArea_exports = {};
|
22
|
+
__export(SafeArea_exports, {
|
23
|
+
SafeArea: () => SafeArea
|
24
|
+
});
|
25
|
+
module.exports = __toCommonJS(SafeArea_exports);
|
26
|
+
var import_react2 = require("react");
|
27
|
+
|
28
|
+
// src/Spacing.tsx
|
29
|
+
var import_react = require("react");
|
30
|
+
var import_styled_components = require("styled-components");
|
31
|
+
|
32
|
+
// src/coerceCssPixelValue.ts
|
33
|
+
function coerceCssPixelValue(value) {
|
34
|
+
return typeof value === "string" ? value : `${value}px`;
|
35
|
+
}
|
36
|
+
|
37
|
+
// src/Spacing.tsx
|
38
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
39
|
+
var Spacing = (0, import_react.memo)(function Spacing2(props) {
|
40
|
+
const { direction = "vertical", size, ...restProps } = props;
|
41
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SpacingContainer, { $direction: direction, $size: size, ...restProps });
|
42
|
+
});
|
43
|
+
var SpacingContainer = import_styled_components.styled.div`
|
44
|
+
flex: none;
|
45
|
+
width: ${({ $direction, $size }) => $direction === "horizontal" ? coerceCssPixelValue($size) : void 0};
|
46
|
+
height: ${({ $direction, $size }) => $direction === "vertical" ? coerceCssPixelValue($size) : void 0};
|
47
|
+
`;
|
48
|
+
|
49
|
+
// src/useSafeArea.ts
|
50
|
+
var useSafeArea = ({
|
51
|
+
top: T = 0,
|
52
|
+
bottom: B = 0,
|
53
|
+
left: L = 0,
|
54
|
+
right: R = 0
|
55
|
+
} = {}) => {
|
56
|
+
const top = `max(${coerceCssPixelValue(T)}, env(safe-area-inset-top))`;
|
57
|
+
const bottom = `max(${coerceCssPixelValue(B)}, env(safe-area-inset-bottom))`;
|
58
|
+
const left = `max(${coerceCssPixelValue(L)}, env(safe-area-inset-left))`;
|
59
|
+
const right = `max(${coerceCssPixelValue(R)}, env(safe-area-inset-right))`;
|
60
|
+
return { top, bottom, left, right };
|
61
|
+
};
|
62
|
+
|
63
|
+
// src/SafeArea.tsx
|
64
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
65
|
+
var SafeArea = ({
|
66
|
+
as,
|
67
|
+
children,
|
68
|
+
...props
|
69
|
+
}) => {
|
70
|
+
const Component = as || "div";
|
71
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Component, { ...props, children: [
|
72
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SafeAreaTop, {}),
|
73
|
+
children,
|
74
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SafeAreaBottom, {})
|
75
|
+
] });
|
76
|
+
};
|
77
|
+
var SafeAreaTop = (0, import_react2.memo)(function SafeAreaTop2(props) {
|
78
|
+
const { top } = useSafeArea();
|
79
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Spacing, { ...props, size: top });
|
80
|
+
});
|
81
|
+
var SafeAreaBottom = (0, import_react2.memo)(function SafeAreaBottom2(props) {
|
82
|
+
const { bottom } = useSafeArea();
|
83
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Spacing, { ...props, size: bottom });
|
84
|
+
});
|
85
|
+
SafeArea.Top = SafeAreaTop;
|
86
|
+
SafeArea.Bottom = SafeAreaBottom;
|
87
|
+
// Annotate the CommonJS export names for ESM import in node:
|
88
|
+
0 && (module.exports = {
|
89
|
+
SafeArea
|
90
|
+
});
|
91
|
+
//# sourceMappingURL=SafeArea.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/SafeArea.tsx","../src/Spacing.tsx","../src/coerceCssPixelValue.ts","../src/useSafeArea.ts"],"sourcesContent":["import React, {\n memo,\n type ComponentPropsWithoutRef,\n type ReactNode,\n} from 'react';\n\nimport { Spacing } from './Spacing';\nimport { useSafeArea } from './useSafeArea';\n\nexport type SafeAreaProps<T extends React.ElementType = 'div'> = {\n as?: T;\n children: ReactNode;\n} & ComponentPropsWithoutRef<T>;\n\nexport const SafeArea = <T extends React.ElementType = 'div'>({\n as,\n children,\n ...props\n}: SafeAreaProps<T>) => {\n const Component = as || 'div';\n\n return (\n <Component {...props}>\n <SafeAreaTop />\n {children}\n <SafeAreaBottom />\n </Component>\n );\n};\n\nconst SafeAreaTop = memo(function SafeAreaTop(\n props: Omit<ComponentPropsWithoutRef<typeof Spacing>, 'size'>\n) {\n const { top } = useSafeArea();\n return <Spacing {...props} size={top} />;\n});\n\nconst SafeAreaBottom = memo(function SafeAreaBottom(\n props: Omit<ComponentPropsWithoutRef<typeof Spacing>, 'size'>\n) {\n const { bottom } = useSafeArea();\n return <Spacing {...props} size={bottom} />;\n});\n\nSafeArea.Top = SafeAreaTop;\nSafeArea.Bottom = SafeAreaBottom;\n","import { memo, type HTMLAttributes } from 'react';\nimport { styled } from 'styled-components';\n\nimport { coerceCssPixelValue, type CSSPixelValue } from './coerceCssPixelValue';\n\ntype AxisDirection = 'vertical' | 'horizontal';\n\nexport type SpacingProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {\n direction?: AxisDirection;\n size: CSSPixelValue;\n};\n\nexport const Spacing = memo(function Spacing(props: SpacingProps) {\n const { direction = 'vertical', size, ...restProps } = props;\n\n return (\n <SpacingContainer $direction={direction} $size={size} {...restProps} />\n );\n});\n\nconst SpacingContainer = styled.div<{\n $direction: SpacingProps['direction'];\n $size: SpacingProps['size'];\n}>`\n flex: none;\n width: ${({ $direction, $size }) =>\n $direction === 'horizontal' ? coerceCssPixelValue($size) : undefined};\n height: ${({ $direction, $size }) =>\n $direction === 'vertical' ? coerceCssPixelValue($size) : undefined};\n`;\n","export type CSSPixelValue = string | number;\n\nexport function coerceCssPixelValue(value: CSSPixelValue): string {\n return typeof value === 'string' ? value : `${value}px`;\n}\n","import { coerceCssPixelValue, type CSSPixelValue } from './coerceCssPixelValue';\n\nexport type SafeAreaCssValueProps = {\n top?: CSSPixelValue;\n bottom?: CSSPixelValue;\n left?: CSSPixelValue;\n right?: CSSPixelValue;\n};\n\nconst useSafeArea = ({\n top: T = 0,\n bottom: B = 0,\n left: L = 0,\n right: R = 0,\n}: SafeAreaCssValueProps = {}) => {\n const top = `max(${coerceCssPixelValue(T)}, env(safe-area-inset-top))`;\n const bottom = `max(${coerceCssPixelValue(B)}, env(safe-area-inset-bottom))`;\n const left = `max(${coerceCssPixelValue(L)}, env(safe-area-inset-left))`;\n const right = `max(${coerceCssPixelValue(R)}, env(safe-area-inset-right))`;\n\n return { top, bottom, left, right };\n};\n\nexport { useSafeArea };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAIO;;;ACJP,mBAA0C;AAC1C,+BAAuB;;;ACChB,SAAS,oBAAoB,OAA8B;AAChE,SAAO,OAAO,UAAU,WAAW,QAAQ,GAAG;AAChD;;;ADYI;AAJG,IAAM,cAAU,mBAAK,SAASC,SAAQ,OAAqB;AAChE,QAAM,EAAE,YAAY,YAAY,MAAM,GAAG,UAAU,IAAI;AAEvD,SACE,4CAAC,oBAAiB,YAAY,WAAW,OAAO,MAAO,GAAG,WAAW;AAEzE,CAAC;AAED,IAAM,mBAAmB,gCAAO;AAAA;AAAA,WAKrB,CAAC,EAAE,YAAY,MAAM,MAC5B,eAAe,eAAe,oBAAoB,KAAK,IAAI;AAAA,YACnD,CAAC,EAAE,YAAY,MAAM,MAC7B,eAAe,aAAa,oBAAoB,KAAK,IAAI;AAAA;;;AEnB7D,IAAM,cAAc,CAAC;AAAA,EACnB,KAAK,IAAI;AAAA,EACT,QAAQ,IAAI;AAAA,EACZ,MAAM,IAAI;AAAA,EACV,OAAO,IAAI;AACb,IAA2B,CAAC,MAAM;AAChC,QAAM,MAAM,OAAO,oBAAoB,CAAC;AACxC,QAAM,SAAS,OAAO,oBAAoB,CAAC;AAC3C,QAAM,OAAO,OAAO,oBAAoB,CAAC;AACzC,QAAM,QAAQ,OAAO,oBAAoB,CAAC;AAE1C,SAAO,EAAE,KAAK,QAAQ,MAAM,MAAM;AACpC;;;AHCI,IAAAC,sBAAA;AARG,IAAM,WAAW,CAAsC;AAAA,EAC5D;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAwB;AACtB,QAAM,YAAY,MAAM;AAExB,SACE,8CAAC,aAAW,GAAG,OACb;AAAA,iDAAC,eAAY;AAAA,IACZ;AAAA,IACD,6CAAC,kBAAe;AAAA,KAClB;AAEJ;AAEA,IAAM,kBAAc,oBAAK,SAASC,aAChC,OACA;AACA,QAAM,EAAE,IAAI,IAAI,YAAY;AAC5B,SAAO,6CAAC,WAAS,GAAG,OAAO,MAAM,KAAK;AACxC,CAAC;AAED,IAAM,qBAAiB,oBAAK,SAASC,gBACnC,OACA;AACA,QAAM,EAAE,OAAO,IAAI,YAAY;AAC/B,SAAO,6CAAC,WAAS,GAAG,OAAO,MAAM,QAAQ;AAC3C,CAAC;AAED,SAAS,MAAM;AACf,SAAS,SAAS;","names":["import_react","Spacing","import_jsx_runtime","SafeAreaTop","SafeAreaBottom"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/Spacing.js
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
|
20
|
+
// src/Spacing.tsx
|
21
|
+
var Spacing_exports = {};
|
22
|
+
__export(Spacing_exports, {
|
23
|
+
Spacing: () => Spacing
|
24
|
+
});
|
25
|
+
module.exports = __toCommonJS(Spacing_exports);
|
26
|
+
var import_react = require("react");
|
27
|
+
var import_styled_components = require("styled-components");
|
28
|
+
|
29
|
+
// src/coerceCssPixelValue.ts
|
30
|
+
function coerceCssPixelValue(value) {
|
31
|
+
return typeof value === "string" ? value : `${value}px`;
|
32
|
+
}
|
33
|
+
|
34
|
+
// src/Spacing.tsx
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
36
|
+
var Spacing = (0, import_react.memo)(function Spacing2(props) {
|
37
|
+
const { direction = "vertical", size, ...restProps } = props;
|
38
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SpacingContainer, { $direction: direction, $size: size, ...restProps });
|
39
|
+
});
|
40
|
+
var SpacingContainer = import_styled_components.styled.div`
|
41
|
+
flex: none;
|
42
|
+
width: ${({ $direction, $size }) => $direction === "horizontal" ? coerceCssPixelValue($size) : void 0};
|
43
|
+
height: ${({ $direction, $size }) => $direction === "vertical" ? coerceCssPixelValue($size) : void 0};
|
44
|
+
`;
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
46
|
+
0 && (module.exports = {
|
47
|
+
Spacing
|
48
|
+
});
|
49
|
+
//# sourceMappingURL=Spacing.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/Spacing.tsx","../src/coerceCssPixelValue.ts"],"sourcesContent":["import { memo, type HTMLAttributes } from 'react';\nimport { styled } from 'styled-components';\n\nimport { coerceCssPixelValue, type CSSPixelValue } from './coerceCssPixelValue';\n\ntype AxisDirection = 'vertical' | 'horizontal';\n\nexport type SpacingProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {\n direction?: AxisDirection;\n size: CSSPixelValue;\n};\n\nexport const Spacing = memo(function Spacing(props: SpacingProps) {\n const { direction = 'vertical', size, ...restProps } = props;\n\n return (\n <SpacingContainer $direction={direction} $size={size} {...restProps} />\n );\n});\n\nconst SpacingContainer = styled.div<{\n $direction: SpacingProps['direction'];\n $size: SpacingProps['size'];\n}>`\n flex: none;\n width: ${({ $direction, $size }) =>\n $direction === 'horizontal' ? coerceCssPixelValue($size) : undefined};\n height: ${({ $direction, $size }) =>\n $direction === 'vertical' ? coerceCssPixelValue($size) : undefined};\n`;\n","export type CSSPixelValue = string | number;\n\nexport function coerceCssPixelValue(value: CSSPixelValue): string {\n return typeof value === 'string' ? value : `${value}px`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0C;AAC1C,+BAAuB;;;ACChB,SAAS,oBAAoB,OAA8B;AAChE,SAAO,OAAO,UAAU,WAAW,QAAQ,GAAG;AAChD;;;ADYI;AAJG,IAAM,cAAU,mBAAK,SAASA,SAAQ,OAAqB;AAChE,QAAM,EAAE,YAAY,YAAY,MAAM,GAAG,UAAU,IAAI;AAEvD,SACE,4CAAC,oBAAiB,YAAY,WAAW,OAAO,MAAO,GAAG,WAAW;AAEzE,CAAC;AAED,IAAM,mBAAmB,gCAAO;AAAA;AAAA,WAKrB,CAAC,EAAE,YAAY,MAAM,MAC5B,eAAe,eAAe,oBAAoB,KAAK,IAAI;AAAA,YACnD,CAAC,EAAE,YAAY,MAAM,MAC7B,eAAe,aAAa,oBAAoB,KAAK,IAAI;AAAA;","names":["Spacing"]}
|
package/dist/Spacing.mjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/Validate.js
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
|
20
|
+
// src/Validate.ts
|
21
|
+
var Validate_exports = {};
|
22
|
+
__export(Validate_exports, {
|
23
|
+
Validate: () => Validate
|
24
|
+
});
|
25
|
+
module.exports = __toCommonJS(Validate_exports);
|
26
|
+
function isEmail(email) {
|
27
|
+
const regExp = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
28
|
+
return regExp.test(email);
|
29
|
+
}
|
30
|
+
function isPhoneNumber(phoneNumber) {
|
31
|
+
const regExpWithHyphen = /^01([0|1|6|7|8|9])-([0-9]{3,4})-([0-9]{4})$/;
|
32
|
+
const regExpWithoutHyphen = /^01([0|1|6|7|8|9])([0-9]{3,4})([0-9]{4})$/;
|
33
|
+
return regExpWithHyphen.test(phoneNumber) || regExpWithoutHyphen.test(phoneNumber);
|
34
|
+
}
|
35
|
+
var Validate = {
|
36
|
+
email: isEmail,
|
37
|
+
phoneNumber: isPhoneNumber
|
38
|
+
};
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
40
|
+
0 && (module.exports = {
|
41
|
+
Validate
|
42
|
+
});
|
43
|
+
//# sourceMappingURL=Validate.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/Validate.ts"],"sourcesContent":["/**\n *\n * @see 이메일 주소가 RFC 5322 표준을 따르는지 검사합니다. {@link https://emailregex.com/}\n */\nfunction isEmail(email: string) {\n const regExp =\n /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n return regExp.test(email);\n}\n\nfunction isPhoneNumber(phoneNumber: string) {\n // 하이픈 있는 형식\n const regExpWithHyphen = /^01([0|1|6|7|8|9])-([0-9]{3,4})-([0-9]{4})$/;\n // 하이픈 없는 형식\n const regExpWithoutHyphen = /^01([0|1|6|7|8|9])([0-9]{3,4})([0-9]{4})$/;\n\n return (\n regExpWithHyphen.test(phoneNumber) || regExpWithoutHyphen.test(phoneNumber)\n );\n}\n\nexport const Validate = {\n email: isEmail,\n phoneNumber: isPhoneNumber,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,SAAS,QAAQ,OAAe;AAC9B,QAAM,SACJ;AACF,SAAO,OAAO,KAAK,KAAK;AAC1B;AAEA,SAAS,cAAc,aAAqB;AAE1C,QAAM,mBAAmB;AAEzB,QAAM,sBAAsB;AAE5B,SACE,iBAAiB,KAAK,WAAW,KAAK,oBAAoB,KAAK,WAAW;AAE9E;AAEO,IAAM,WAAW;AAAA,EACtB,OAAO;AAAA,EACP,aAAa;AACf;","names":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
// src/Choose.tsx
|
2
|
+
import { isValidElement, Children } from "react";
|
3
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
4
|
+
function Choose({ children }) {
|
5
|
+
const validChildren = Children.toArray(children);
|
6
|
+
const matchingChild = validChildren.find(
|
7
|
+
(child) => isValidElement(child) && child.type === Choose.When && child.props.condition
|
8
|
+
);
|
9
|
+
if (matchingChild) {
|
10
|
+
return matchingChild;
|
11
|
+
}
|
12
|
+
const otherwiseChild = validChildren.find(
|
13
|
+
(child) => isValidElement(child) && child.type === Choose.Otherwise
|
14
|
+
);
|
15
|
+
return otherwiseChild || /* @__PURE__ */ jsx(Fragment, {});
|
16
|
+
}
|
17
|
+
var ChooseWhen = ({ children }) => /* @__PURE__ */ jsx(Fragment, { children });
|
18
|
+
ChooseWhen.displayName = "Choose.When";
|
19
|
+
var ChooseOtherwise = ({ children }) => /* @__PURE__ */ jsx(Fragment, { children });
|
20
|
+
Choose.When = ChooseWhen;
|
21
|
+
Choose.Otherwise = ChooseOtherwise;
|
22
|
+
|
23
|
+
export {
|
24
|
+
Choose
|
25
|
+
};
|
26
|
+
//# sourceMappingURL=chunk-7WNTKDNW.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/Choose.tsx"],"sourcesContent":["import { isValidElement, type ReactNode, type FC, Children } from 'react';\n\nexport type ChooseWhenProps = {\n condition: boolean;\n children: ReactNode;\n};\n\nexport type ChooseProps = {\n children: ReactNode;\n};\n\nexport type ChooseOtherwiseProps = {\n children: ReactNode;\n};\n\nexport function Choose({ children }: ChooseProps) {\n const validChildren = Children.toArray(children);\n\n const matchingChild = validChildren.find(\n (child) =>\n isValidElement<ChooseWhenProps>(child) &&\n child.type === Choose.When &&\n child.props.condition\n );\n\n if (matchingChild) {\n return matchingChild;\n }\n\n const otherwiseChild = validChildren.find(\n (child) => isValidElement(child) && child.type === Choose.Otherwise\n );\n\n return otherwiseChild || <></>;\n}\n\nconst ChooseWhen: FC<ChooseWhenProps> = ({ children }) => <>{children}</>;\nChooseWhen.displayName = 'Choose.When';\n\nconst ChooseOtherwise: FC<ChooseOtherwiseProps> = ({ children }) => (\n <>{children}</>\n);\n\nChoose.When = ChooseWhen;\nChoose.Otherwise = ChooseOtherwise;\n"],"mappings":";AAAA,SAAS,gBAAyC,gBAAgB;AAiCvC;AAlBpB,SAAS,OAAO,EAAE,SAAS,GAAgB;AAChD,QAAM,gBAAgB,SAAS,QAAQ,QAAQ;AAE/C,QAAM,gBAAgB,cAAc;AAAA,IAClC,CAAC,UACC,eAAgC,KAAK,KACrC,MAAM,SAAS,OAAO,QACtB,MAAM,MAAM;AAAA,EAChB;AAEA,MAAI,eAAe;AACjB,WAAO;AAAA,EACT;AAEA,QAAM,iBAAiB,cAAc;AAAA,IACnC,CAAC,UAAU,eAAe,KAAK,KAAK,MAAM,SAAS,OAAO;AAAA,EAC5D;AAEA,SAAO,kBAAkB,gCAAE;AAC7B;AAEA,IAAM,aAAkC,CAAC,EAAE,SAAS,MAAM,gCAAG,UAAS;AACtE,WAAW,cAAc;AAEzB,IAAM,kBAA4C,CAAC,EAAE,SAAS,MAC5D,gCAAG,UAAS;AAGd,OAAO,OAAO;AACd,OAAO,YAAY;","names":[]}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import {
|
2
|
+
COMPLETE_HANGUL_END_CHARCODE,
|
3
|
+
COMPLETE_HANGUL_START_CHARCODE,
|
4
|
+
NUMBER_OF_JONGSEONG
|
5
|
+
} from "./chunk-GQPOYY4X.mjs";
|
6
|
+
|
7
|
+
// src/hasBatchim.ts
|
8
|
+
function hasBatchim(str) {
|
9
|
+
const lastChar = str[str.length - 1];
|
10
|
+
if (!lastChar)
|
11
|
+
return false;
|
12
|
+
const charCode = lastChar.charCodeAt(0);
|
13
|
+
if (charCode < COMPLETE_HANGUL_START_CHARCODE || charCode > COMPLETE_HANGUL_END_CHARCODE) {
|
14
|
+
return false;
|
15
|
+
}
|
16
|
+
const batchimCode = (charCode - COMPLETE_HANGUL_START_CHARCODE) % NUMBER_OF_JONGSEONG;
|
17
|
+
return batchimCode > 0;
|
18
|
+
}
|
19
|
+
|
20
|
+
export {
|
21
|
+
hasBatchim
|
22
|
+
};
|
23
|
+
//# sourceMappingURL=chunk-C7VOPXT2.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/hasBatchim.ts"],"sourcesContent":["import {\n COMPLETE_HANGUL_END_CHARCODE,\n COMPLETE_HANGUL_START_CHARCODE,\n NUMBER_OF_JONGSEONG,\n} from './constants/josa';\n\n/**\n * 한글 음절의 받침 유무를 확인합니다.\n * @param str - 검사할 문자열\n * @returns 받침이 있으면 true, 없으면 false\n */\nexport function hasBatchim(str: string): boolean {\n const lastChar = str[str.length - 1];\n if (!lastChar) return false;\n\n const charCode = lastChar.charCodeAt(0);\n\n // 한글 완성형 문자인지 확인\n if (\n charCode < COMPLETE_HANGUL_START_CHARCODE ||\n charCode > COMPLETE_HANGUL_END_CHARCODE\n ) {\n return false;\n }\n\n // 받침 코드 계산\n const batchimCode =\n (charCode - COMPLETE_HANGUL_START_CHARCODE) % NUMBER_OF_JONGSEONG;\n\n return batchimCode > 0; // 받침이 있으면 true\n}\n"],"mappings":";;;;;;;AAWO,SAAS,WAAW,KAAsB;AAC/C,QAAM,WAAW,IAAI,IAAI,SAAS,CAAC;AACnC,MAAI,CAAC;AAAU,WAAO;AAEtB,QAAM,WAAW,SAAS,WAAW,CAAC;AAGtC,MACE,WAAW,kCACX,WAAW,8BACX;AACA,WAAO;AAAA,EACT;AAGA,QAAM,eACH,WAAW,kCAAkC;AAEhD,SAAO,cAAc;AACvB;","names":[]}
|