@basiln/utils 0.1.9 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +39 -1
  2. package/dist/Choose.js.map +1 -1
  3. package/dist/Choose.mjs +1 -1
  4. package/dist/Flex.js +13 -13
  5. package/dist/Flex.js.map +1 -1
  6. package/dist/Flex.mjs +1 -1
  7. package/dist/SafeArea.js +12 -2
  8. package/dist/SafeArea.js.map +1 -1
  9. package/dist/SafeArea.mjs +2 -2
  10. package/dist/Spacing.js +12 -2
  11. package/dist/Spacing.js.map +1 -1
  12. package/dist/Spacing.mjs +1 -1
  13. package/dist/Validate.js.map +1 -1
  14. package/dist/Validate.mjs +1 -1
  15. package/dist/{chunk-R23KSR7N.mjs → chunk-5MSITYTP.mjs} +1 -1
  16. package/dist/{chunk-R23KSR7N.mjs.map → chunk-5MSITYTP.mjs.map} +1 -1
  17. package/dist/{chunk-FTMJVXXH.mjs → chunk-5OCEFCYV.mjs} +2 -2
  18. package/dist/chunk-5OCEFCYV.mjs.map +1 -0
  19. package/dist/{chunk-RASCHI5T.mjs → chunk-75ILZSEA.mjs} +3 -5
  20. package/dist/chunk-75ILZSEA.mjs.map +1 -0
  21. package/dist/{chunk-EB5LTJRH.mjs → chunk-ASPAKWHO.mjs} +2 -2
  22. package/dist/{chunk-EB5LTJRH.mjs.map → chunk-ASPAKWHO.mjs.map} +1 -1
  23. package/dist/chunk-D2YRH4XY.mjs +19 -0
  24. package/dist/chunk-D2YRH4XY.mjs.map +1 -0
  25. package/dist/{chunk-3BSCIHE2.mjs → chunk-FEPXSL77.mjs} +4 -11
  26. package/dist/chunk-FEPXSL77.mjs.map +1 -0
  27. package/dist/{chunk-QD5QDTUG.mjs → chunk-HCRCYF7A.mjs} +1 -1
  28. package/dist/chunk-HCRCYF7A.mjs.map +1 -0
  29. package/dist/chunk-HOC4D4DT.mjs +57 -0
  30. package/dist/chunk-HOC4D4DT.mjs.map +1 -0
  31. package/dist/{chunk-KIUJWSBE.mjs → chunk-JTQFGEBG.mjs} +2 -4
  32. package/dist/chunk-JTQFGEBG.mjs.map +1 -0
  33. package/dist/{chunk-KMMS4XJ6.mjs → chunk-K7254VDU.mjs} +1 -1
  34. package/dist/{chunk-KMMS4XJ6.mjs.map → chunk-K7254VDU.mjs.map} +1 -1
  35. package/dist/{chunk-7WNTKDNW.mjs → chunk-KFMJD3YK.mjs} +1 -1
  36. package/dist/chunk-KFMJD3YK.mjs.map +1 -0
  37. package/dist/chunk-QGQNMD22.mjs +15 -0
  38. package/dist/chunk-QGQNMD22.mjs.map +1 -0
  39. package/dist/{chunk-UCZMT7TP.mjs → chunk-QKAXJVK7.mjs} +3 -13
  40. package/dist/chunk-QKAXJVK7.mjs.map +1 -0
  41. package/dist/{chunk-Z7YV6A56.mjs → chunk-RQ2CQOT7.mjs} +2 -6
  42. package/dist/chunk-RQ2CQOT7.mjs.map +1 -0
  43. package/dist/{chunk-VIGWO4EN.mjs → chunk-YQMA54XQ.mjs} +2 -2
  44. package/dist/chunk-YQMA54XQ.mjs.map +1 -0
  45. package/dist/composeEventHandlers.js.map +1 -1
  46. package/dist/composeEventHandlers.mjs +1 -1
  47. package/dist/createContext.js +3 -10
  48. package/dist/createContext.js.map +1 -1
  49. package/dist/createContext.mjs +1 -1
  50. package/dist/ellipsis.js +3 -3
  51. package/dist/ellipsis.js.map +1 -1
  52. package/dist/ellipsis.mjs +1 -1
  53. package/dist/hasBatchim.js.map +1 -1
  54. package/dist/hasBatchim.mjs +1 -1
  55. package/dist/hexToRgba.js +1 -3
  56. package/dist/hexToRgba.js.map +1 -1
  57. package/dist/hexToRgba.mjs +1 -1
  58. package/dist/index.d.mts +21 -8
  59. package/dist/index.d.ts +21 -8
  60. package/dist/index.js +107 -41
  61. package/dist/index.js.map +1 -1
  62. package/dist/index.mjs +21 -12
  63. package/dist/josa.js.map +1 -1
  64. package/dist/josa.mjs +2 -2
  65. package/dist/queryString.js +1 -5
  66. package/dist/queryString.js.map +1 -1
  67. package/dist/queryString.mjs +1 -1
  68. package/dist/useCombinedRefs.js +43 -0
  69. package/dist/useCombinedRefs.js.map +1 -0
  70. package/dist/useCombinedRefs.mjs +7 -0
  71. package/dist/useCombinedRefs.mjs.map +1 -0
  72. package/dist/useControllableState.js +100 -0
  73. package/dist/useControllableState.js.map +1 -0
  74. package/dist/useControllableState.mjs +10 -0
  75. package/dist/useControllableState.mjs.map +1 -0
  76. package/dist/usePreservedCallback.js +35 -0
  77. package/dist/usePreservedCallback.js.map +1 -0
  78. package/dist/usePreservedCallback.mjs +7 -0
  79. package/dist/usePreservedCallback.mjs.map +1 -0
  80. package/package.json +6 -4
  81. package/dist/chunk-3BSCIHE2.mjs.map +0 -1
  82. package/dist/chunk-7WNTKDNW.mjs.map +0 -1
  83. package/dist/chunk-FTMJVXXH.mjs.map +0 -1
  84. package/dist/chunk-KIUJWSBE.mjs.map +0 -1
  85. package/dist/chunk-QD5QDTUG.mjs.map +0 -1
  86. package/dist/chunk-RASCHI5T.mjs.map +0 -1
  87. package/dist/chunk-UCZMT7TP.mjs.map +0 -1
  88. package/dist/chunk-VIGWO4EN.mjs.map +0 -1
  89. package/dist/chunk-Z7YV6A56.mjs.map +0 -1
package/README.md CHANGED
@@ -24,6 +24,8 @@ yarn add @basiln/utils
24
24
  - [getVar](#getvar)
25
25
  - [Format](#format)
26
26
  - [DomainFormat](#domainformat)
27
+ - [useCombinedRefs](#usecombinedrefs)
28
+ - [useControllableState](#usecontrollablestate)
27
29
 
28
30
  ### `If`
29
31
 
@@ -345,5 +347,41 @@ DomainFormat.userLevel({level: '1', language: 'en'}) // MASTER
345
347
  // Mode 추가가 필요한 경우
346
348
  DomainFormat.modeName('R', {R: '실외기 잠금'}); // 실외기 잠금
347
349
  DomainFormat.modeColor('R', {N: 'gray'}); // 'gray'
350
+ ```
351
+ ---
352
+ ### `useCombinedRefs`
353
+ 컴포넌트 내부에 선언된 ref와, 사용하는 부분에서 forwarded된 ref를 합칠 수 있도록 하는 hook 입니다.
354
+ #### 사용법
355
+ ```tsx
356
+ const TextField = forwardRef((props, forwardedRef) => {
357
+ const ref = useRef<HTMLInputElement | null>(null);
358
+ const combinedRefs = useCombinedRefs(ref, forwardedRef);
359
+ return <input ref={ref} />
360
+ })
361
+ ```
362
+ ---
363
+ ### `useControllableState`
364
+ 사용자의 입력을 통해 상태를 관리할 때와 사용자의 입력을 상태로 관리하지 않고 싶을 때 두 경우 모두를 지원하는 hook 입니다.
365
+ #### 사용법 ([참고](https://github.com/seedn-corp/leaf-airmate-web-fe/blob/20bec52b87814e7c0a9f174b08bdaa0bff2e8680/src/components/historyInfo/Select/index.tsx#L14-L33))
366
+ ```tsx
367
+ const [value, setValue] = useControllableState({
368
+ prop: valueFromProps,
369
+ defaultProp: defaultValue,
370
+ onChange: onValueChange,
371
+ });
372
+ return (
373
+ <SelectProvider
374
+ value={value}
375
+ onValueChange={setValue}
376
+ triggerWidth={triggerWidth}
377
+ onTriggerWidthChange={setTriggerWidth}
378
+ >
379
+ <SelectPrimitive.Root value={value} onValueChange={setValue} {...restProps}>
380
+ <div ref={ref}>{children}</div>
381
+ </SelectPrimitive.Root>
382
+ </SelectProvider>
383
+ );
384
+ });
385
+
386
+ ```
348
387
 
349
- ```
@@ -1 +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":[]}
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) && child.type === Choose.When && 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 }) => <>{children}</>;\n\nChoose.When = ChooseWhen;\nChoose.Otherwise = ChooseOtherwise;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkE;AA+BvC;AAhBpB,SAAS,OAAO,EAAE,SAAS,GAAgB;AAChD,QAAM,gBAAgB,sBAAS,QAAQ,QAAQ;AAE/C,QAAM,gBAAgB,cAAc;AAAA,IAClC,CAAC,cACC,6BAAgC,KAAK,KAAK,MAAM,SAAS,OAAO,QAAQ,MAAM,MAAM;AAAA,EACxF;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,MAAM,2EAAG,UAAS;AAEhF,OAAO,OAAO;AACd,OAAO,YAAY;","names":[]}
package/dist/Choose.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Choose
3
- } from "./chunk-7WNTKDNW.mjs";
3
+ } from "./chunk-KFMJD3YK.mjs";
4
4
  export {
5
5
  Choose
6
6
  };
package/dist/Flex.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/Flex.tsx
@@ -25,7 +35,7 @@ __export(Flex_exports, {
25
35
  });
26
36
  module.exports = __toCommonJS(Flex_exports);
27
37
  var import_react = require("react");
28
- var import_styled_components = require("styled-components");
38
+ var import_styled = __toESM(require("@emotion/styled"));
29
39
 
30
40
  // src/coerceCssPixelValue.ts
31
41
  function coerceCssPixelValue(value) {
@@ -43,19 +53,9 @@ var Flex = (0, import_react.memo)(function Flex2(props) {
43
53
  children,
44
54
  ...restProps
45
55
  } = 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
- );
56
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Container, { $gap: gap, $justify: justify, $align: align, $direction: direction, ...restProps, children });
57
57
  });
58
- var Container = import_styled_components.styled.div`
58
+ var Container = import_styled.default.div`
59
59
  display: flex;
60
60
  flex-direction: ${({ $direction }) => $direction};
61
61
  gap: ${({ $gap }) => coerceCssPixelValue($gap)};
package/dist/Flex.js.map CHANGED
@@ -1 +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,KAAK;AACrD;;;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,UAAU;AAAA,SACzC,CAAC,EAAE,KAAK,MAAM,oBAAoB,IAAI,CAAC;AAAA,iBAC/B,CAAC,EAAE,OAAO,MAAM,MAAM;AAAA,qBAClB,CAAC,EAAE,SAAS,MAAM,QAAQ;AAAA;","names":["Flex"]}
1
+ {"version":3,"sources":["../src/Flex.tsx","../src/coerceCssPixelValue.ts"],"sourcesContent":["import { memo, type CSSProperties, type HTMLAttributes } from 'react';\nimport styled from '@emotion/styled';\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 $gap={gap} $justify={justify} $align={align} $direction={direction} {...restProps}>\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,oBAAmB;;;ACCZ,SAAS,oBAAoB,OAA8B;AAChE,SAAO,OAAO,UAAU,WAAW,QAAQ,GAAG,KAAK;AACrD;;;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,4CAAC,aAAU,MAAM,KAAK,UAAU,SAAS,QAAQ,OAAO,YAAY,WAAY,GAAG,WAChF,UACH;AAEJ,CAAC;AAEM,IAAM,YAAY,cAAAC,QAAO;AAAA;AAAA,oBAOZ,CAAC,EAAE,WAAW,MAAM,UAAU;AAAA,SACzC,CAAC,EAAE,KAAK,MAAM,oBAAoB,IAAI,CAAC;AAAA,iBAC/B,CAAC,EAAE,OAAO,MAAM,MAAM;AAAA,qBAClB,CAAC,EAAE,SAAS,MAAM,QAAQ;AAAA;","names":["Flex","styled"]}
package/dist/Flex.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Container,
3
3
  Flex
4
- } from "./chunk-UCZMT7TP.mjs";
4
+ } from "./chunk-QKAXJVK7.mjs";
5
5
  import "./chunk-OQ3L65JI.mjs";
6
6
  export {
7
7
  Container,
package/dist/SafeArea.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/SafeArea.tsx
@@ -27,7 +37,7 @@ var import_react2 = require("react");
27
37
 
28
38
  // src/Spacing.tsx
29
39
  var import_react = require("react");
30
- var import_styled_components = require("styled-components");
40
+ var import_styled = __toESM(require("@emotion/styled"));
31
41
 
32
42
  // src/coerceCssPixelValue.ts
33
43
  function coerceCssPixelValue(value) {
@@ -40,7 +50,7 @@ var Spacing = (0, import_react.memo)(function Spacing2(props) {
40
50
  const { direction = "vertical", size, ...restProps } = props;
41
51
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SpacingContainer, { $direction: direction, $size: size, ...restProps });
42
52
  });
43
- var SpacingContainer = import_styled_components.styled.div`
53
+ var SpacingContainer = import_styled.default.div`
44
54
  flex: none;
45
55
  width: ${({ $direction, $size }) => $direction === "horizontal" ? coerceCssPixelValue($size) : void 0};
46
56
  height: ${({ $direction, $size }) => $direction === "vertical" ? coerceCssPixelValue($size) : void 0};
@@ -1 +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,KAAK;AACrD;;;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,MAAS;AAAA,YAC5D,CAAC,EAAE,YAAY,MAAM,MAC7B,eAAe,aAAa,oBAAoB,KAAK,IAAI,MAAS;AAAA;;;AEnBtE,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,CAAC;AACzC,QAAM,SAAS,OAAO,oBAAoB,CAAC,CAAC;AAC5C,QAAM,OAAO,OAAO,oBAAoB,CAAC,CAAC;AAC1C,QAAM,QAAQ,OAAO,oBAAoB,CAAC,CAAC;AAE3C,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"]}
1
+ {"version":3,"sources":["../src/SafeArea.tsx","../src/Spacing.tsx","../src/coerceCssPixelValue.ts","../src/useSafeArea.ts"],"sourcesContent":["import React, { memo, type ComponentPropsWithoutRef, type ReactNode } 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 '@emotion/styled';\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 <SpacingContainer $direction={direction} $size={size} {...restProps} />;\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,gBAA2E;;;ACA3E,mBAA0C;AAC1C,oBAAmB;;;ACCZ,SAAS,oBAAoB,OAA8B;AAChE,SAAO,OAAO,UAAU,WAAW,QAAQ,GAAG,KAAK;AACrD;;;ADWS;AAHF,IAAM,cAAU,mBAAK,SAASC,SAAQ,OAAqB;AAChE,QAAM,EAAE,YAAY,YAAY,MAAM,GAAG,UAAU,IAAI;AAEvD,SAAO,4CAAC,oBAAiB,YAAY,WAAW,OAAO,MAAO,GAAG,WAAW;AAC9E,CAAC;AAED,IAAM,mBAAmB,cAAAC,QAAO;AAAA;AAAA,WAKrB,CAAC,EAAE,YAAY,MAAM,MAC5B,eAAe,eAAe,oBAAoB,KAAK,IAAI,MAAS;AAAA,YAC5D,CAAC,EAAE,YAAY,MAAM,MAC7B,eAAe,aAAa,oBAAoB,KAAK,IAAI,MAAS;AAAA;;;AEjBtE,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,CAAC;AACzC,QAAM,SAAS,OAAO,oBAAoB,CAAC,CAAC;AAC5C,QAAM,OAAO,OAAO,oBAAoB,CAAC,CAAC;AAC1C,QAAM,QAAQ,OAAO,oBAAoB,CAAC,CAAC;AAE3C,SAAO,EAAE,KAAK,QAAQ,MAAM,MAAM;AACpC;;;AHHI,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","styled","import_jsx_runtime","SafeAreaTop","SafeAreaBottom"]}
package/dist/SafeArea.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  SafeArea
3
- } from "./chunk-RASCHI5T.mjs";
3
+ } from "./chunk-75ILZSEA.mjs";
4
4
  import "./chunk-ANMBV2U3.mjs";
5
- import "./chunk-VIGWO4EN.mjs";
5
+ import "./chunk-YQMA54XQ.mjs";
6
6
  import "./chunk-OQ3L65JI.mjs";
7
7
  export {
8
8
  SafeArea
package/dist/Spacing.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/Spacing.tsx
@@ -24,7 +34,7 @@ __export(Spacing_exports, {
24
34
  });
25
35
  module.exports = __toCommonJS(Spacing_exports);
26
36
  var import_react = require("react");
27
- var import_styled_components = require("styled-components");
37
+ var import_styled = __toESM(require("@emotion/styled"));
28
38
 
29
39
  // src/coerceCssPixelValue.ts
30
40
  function coerceCssPixelValue(value) {
@@ -37,7 +47,7 @@ var Spacing = (0, import_react.memo)(function Spacing2(props) {
37
47
  const { direction = "vertical", size, ...restProps } = props;
38
48
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SpacingContainer, { $direction: direction, $size: size, ...restProps });
39
49
  });
40
- var SpacingContainer = import_styled_components.styled.div`
50
+ var SpacingContainer = import_styled.default.div`
41
51
  flex: none;
42
52
  width: ${({ $direction, $size }) => $direction === "horizontal" ? coerceCssPixelValue($size) : void 0};
43
53
  height: ${({ $direction, $size }) => $direction === "vertical" ? coerceCssPixelValue($size) : void 0};
@@ -1 +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,KAAK;AACrD;;;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,MAAS;AAAA,YAC5D,CAAC,EAAE,YAAY,MAAM,MAC7B,eAAe,aAAa,oBAAoB,KAAK,IAAI,MAAS;AAAA;","names":["Spacing"]}
1
+ {"version":3,"sources":["../src/Spacing.tsx","../src/coerceCssPixelValue.ts"],"sourcesContent":["import { memo, type HTMLAttributes } from 'react';\nimport styled from '@emotion/styled';\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 <SpacingContainer $direction={direction} $size={size} {...restProps} />;\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,oBAAmB;;;ACCZ,SAAS,oBAAoB,OAA8B;AAChE,SAAO,OAAO,UAAU,WAAW,QAAQ,GAAG,KAAK;AACrD;;;ADWS;AAHF,IAAM,cAAU,mBAAK,SAASA,SAAQ,OAAqB;AAChE,QAAM,EAAE,YAAY,YAAY,MAAM,GAAG,UAAU,IAAI;AAEvD,SAAO,4CAAC,oBAAiB,YAAY,WAAW,OAAO,MAAO,GAAG,WAAW;AAC9E,CAAC;AAED,IAAM,mBAAmB,cAAAC,QAAO;AAAA;AAAA,WAKrB,CAAC,EAAE,YAAY,MAAM,MAC5B,eAAe,eAAe,oBAAoB,KAAK,IAAI,MAAS;AAAA,YAC5D,CAAC,EAAE,YAAY,MAAM,MAC7B,eAAe,aAAa,oBAAoB,KAAK,IAAI,MAAS;AAAA;","names":["Spacing","styled"]}
package/dist/Spacing.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Spacing
3
- } from "./chunk-VIGWO4EN.mjs";
3
+ } from "./chunk-YQMA54XQ.mjs";
4
4
  import "./chunk-OQ3L65JI.mjs";
5
5
  export {
6
6
  Spacing
@@ -1 +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":[]}
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 regExpWithHyphen.test(phoneNumber) || regExpWithoutHyphen.test(phoneNumber);\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,SAAO,iBAAiB,KAAK,WAAW,KAAK,oBAAoB,KAAK,WAAW;AACnF;AAEO,IAAM,WAAW;AAAA,EACtB,OAAO;AAAA,EACP,aAAa;AACf;","names":[]}
package/dist/Validate.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Validate
3
- } from "./chunk-R23KSR7N.mjs";
3
+ } from "./chunk-5MSITYTP.mjs";
4
4
  export {
5
5
  Validate
6
6
  };
@@ -16,4 +16,4 @@ var Validate = {
16
16
  export {
17
17
  Validate
18
18
  };
19
- //# sourceMappingURL=chunk-R23KSR7N.mjs.map
19
+ //# sourceMappingURL=chunk-5MSITYTP.mjs.map
@@ -1 +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":";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":[]}
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 regExpWithHyphen.test(phoneNumber) || regExpWithoutHyphen.test(phoneNumber);\n}\n\nexport const Validate = {\n email: isEmail,\n phoneNumber: isPhoneNumber,\n};\n"],"mappings":";AAIA,SAAS,QAAQ,OAAe;AAC9B,QAAM,SACJ;AACF,SAAO,OAAO,KAAK,KAAK;AAC1B;AAEA,SAAS,cAAc,aAAqB;AAE1C,QAAM,mBAAmB;AAEzB,QAAM,sBAAsB;AAE5B,SAAO,iBAAiB,KAAK,WAAW,KAAK,oBAAoB,KAAK,WAAW;AACnF;AAEO,IAAM,WAAW;AAAA,EACtB,OAAO;AAAA,EACP,aAAa;AACf;","names":[]}
@@ -1,5 +1,5 @@
1
1
  // src/ellipsis.ts
2
- import { css } from "styled-components";
2
+ import { css } from "@emotion/react";
3
3
  var ellipsis = css`
4
4
  overflow: hidden;
5
5
  text-overflow: ellipsis;
@@ -17,4 +17,4 @@ export {
17
17
  ellipsis,
18
18
  multiLineEllipsis
19
19
  };
20
- //# sourceMappingURL=chunk-FTMJVXXH.mjs.map
20
+ //# sourceMappingURL=chunk-5OCEFCYV.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ellipsis.ts"],"sourcesContent":["import { css } from '@emotion/react';\n\nexport type MultiLineEllipsisProps = {\n line: number;\n};\n\nexport const ellipsis = css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nexport const multiLineEllipsis = ({ line }: MultiLineEllipsisProps) => css`\n display: -webkit-box;\n overflow: hidden;\n text-overflow: ellipsis;\n -webkit-line-clamp: ${line};\n -webkit-box-orient: vertical;\n`;\n"],"mappings":";AAAA,SAAS,WAAW;AAMb,IAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAMjB,IAAM,oBAAoB,CAAC,EAAE,KAAK,MAA8B;AAAA;AAAA;AAAA;AAAA,wBAI/C,IAAI;AAAA;AAAA;","names":[]}
@@ -3,12 +3,10 @@ import {
3
3
  } from "./chunk-ANMBV2U3.mjs";
4
4
  import {
5
5
  Spacing
6
- } from "./chunk-VIGWO4EN.mjs";
6
+ } from "./chunk-YQMA54XQ.mjs";
7
7
 
8
8
  // src/SafeArea.tsx
9
- import {
10
- memo
11
- } from "react";
9
+ import { memo } from "react";
12
10
  import { jsx, jsxs } from "react/jsx-runtime";
13
11
  var SafeArea = ({
14
12
  as,
@@ -36,4 +34,4 @@ SafeArea.Bottom = SafeAreaBottom;
36
34
  export {
37
35
  SafeArea
38
36
  };
39
- //# sourceMappingURL=chunk-RASCHI5T.mjs.map
37
+ //# sourceMappingURL=chunk-75ILZSEA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/SafeArea.tsx"],"sourcesContent":["import React, { memo, type ComponentPropsWithoutRef, type ReactNode } 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"],"mappings":";;;;;;;;AAAA,SAAgB,YAA2D;AAkBvE,SACE,KADF;AARG,IAAM,WAAW,CAAsC;AAAA,EAC5D;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAwB;AACtB,QAAM,YAAY,MAAM;AAExB,SACE,qBAAC,aAAW,GAAG,OACb;AAAA,wBAAC,eAAY;AAAA,IACZ;AAAA,IACD,oBAAC,kBAAe;AAAA,KAClB;AAEJ;AAEA,IAAM,cAAc,KAAK,SAASA,aAChC,OACA;AACA,QAAM,EAAE,IAAI,IAAI,YAAY;AAC5B,SAAO,oBAAC,WAAS,GAAG,OAAO,MAAM,KAAK;AACxC,CAAC;AAED,IAAM,iBAAiB,KAAK,SAASC,gBACnC,OACA;AACA,QAAM,EAAE,OAAO,IAAI,YAAY;AAC/B,SAAO,oBAAC,WAAS,GAAG,OAAO,MAAM,QAAQ;AAC3C,CAAC;AAED,SAAS,MAAM;AACf,SAAS,SAAS;","names":["SafeAreaTop","SafeAreaBottom"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  hasBatchim
3
- } from "./chunk-KMMS4XJ6.mjs";
3
+ } from "./chunk-K7254VDU.mjs";
4
4
 
5
5
  // src/josa.ts
6
6
  function josa(props) {
@@ -27,4 +27,4 @@ josa.pick = josaPicker;
27
27
  export {
28
28
  josa
29
29
  };
30
- //# sourceMappingURL=chunk-EB5LTJRH.mjs.map
30
+ //# sourceMappingURL=chunk-ASPAKWHO.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/josa.ts"],"sourcesContent":["import { hasBatchim } from './hasBatchim';\n\ntype JosaOption = '이/가' | '을/를' | '은/는';\n\ntype ExtractJosaOption<T> = T extends `${infer A}/${infer B}` ? A | B : never;\n\nexport type JosaProps<U extends JosaOption> = {\n word: string;\n josa: U;\n};\n\n/**\n * 주어진 단어와 조사 옵션을 기반으로 올바른 조사를 반환합니다.\n * @returns 단어와 올바른 조사가 결합된 문자열\n */\nexport function josa<U extends JosaOption>(\n props: JosaProps<U>\n): `${JosaProps<U>['word']}${ExtractJosaOption<U>}` {\n const { word, josa } = props;\n\n if (!word) {\n return word as `${JosaProps<U>['word']}${ExtractJosaOption<U>}`;\n }\n\n return `${word}${josaPicker({\n word,\n josa,\n })}` as `${JosaProps<U>['word']}${ExtractJosaOption<U>}`;\n}\n\n/**\n * 주어진 단어와 조사 옵션을 기반으로 올바른 조사를 선택합니다.\n * @returns 올바른 조사\n */\nfunction josaPicker<U extends JosaOption>(\n props: JosaProps<U>\n): ExtractJosaOption<U> {\n const { word, josa } = props;\n\n if (!word) {\n return josa.split('/')[0] as ExtractJosaOption<U>;\n }\n\n const has받침 = hasBatchim(word);\n const index = has받침 ? 0 : 1;\n\n return josa.split('/')[index] as ExtractJosaOption<U>;\n}\n\njosa.pick = josaPicker;\n"],"mappings":";;;;;AAeO,SAAS,KACd,OACkD;AAClD,QAAM,EAAE,MAAM,MAAAA,MAAK,IAAI;AAEvB,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AAEA,SAAO,GAAG,IAAI,GAAG,WAAW;AAAA,IAC1B;AAAA,IACA,MAAAA;AAAA,EACF,CAAC,CAAC;AACJ;AAMA,SAAS,WACP,OACsB;AACtB,QAAM,EAAE,MAAM,MAAAA,MAAK,IAAI;AAEvB,MAAI,CAAC,MAAM;AACT,WAAOA,MAAK,MAAM,GAAG,EAAE,CAAC;AAAA,EAC1B;AAEA,QAAM,kBAAQ,WAAW,IAAI;AAC7B,QAAM,QAAQ,kBAAQ,IAAI;AAE1B,SAAOA,MAAK,MAAM,GAAG,EAAE,KAAK;AAC9B;AAEA,KAAK,OAAO;","names":["josa"]}
1
+ {"version":3,"sources":["../src/josa.ts"],"sourcesContent":["import { hasBatchim } from './hasBatchim';\n\ntype JosaOption = '이/가' | '을/를' | '은/는';\n\ntype ExtractJosaOption<T> = T extends `${infer A}/${infer B}` ? A | B : never;\n\nexport type JosaProps<U extends JosaOption> = {\n word: string;\n josa: U;\n};\n\n/**\n * 주어진 단어와 조사 옵션을 기반으로 올바른 조사를 반환합니다.\n * @returns 단어와 올바른 조사가 결합된 문자열\n */\nexport function josa<U extends JosaOption>(\n props: JosaProps<U>\n): `${JosaProps<U>['word']}${ExtractJosaOption<U>}` {\n const { word, josa } = props;\n\n if (!word) {\n return word as `${JosaProps<U>['word']}${ExtractJosaOption<U>}`;\n }\n\n return `${word}${josaPicker({\n word,\n josa,\n })}` as `${JosaProps<U>['word']}${ExtractJosaOption<U>}`;\n}\n\n/**\n * 주어진 단어와 조사 옵션을 기반으로 올바른 조사를 선택합니다.\n * @returns 올바른 조사\n */\nfunction josaPicker<U extends JosaOption>(props: JosaProps<U>): ExtractJosaOption<U> {\n const { word, josa } = props;\n\n if (!word) {\n return josa.split('/')[0] as ExtractJosaOption<U>;\n }\n\n const has받침 = hasBatchim(word);\n const index = has받침 ? 0 : 1;\n\n return josa.split('/')[index] as ExtractJosaOption<U>;\n}\n\njosa.pick = josaPicker;\n"],"mappings":";;;;;AAeO,SAAS,KACd,OACkD;AAClD,QAAM,EAAE,MAAM,MAAAA,MAAK,IAAI;AAEvB,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AAEA,SAAO,GAAG,IAAI,GAAG,WAAW;AAAA,IAC1B;AAAA,IACA,MAAAA;AAAA,EACF,CAAC,CAAC;AACJ;AAMA,SAAS,WAAiC,OAA2C;AACnF,QAAM,EAAE,MAAM,MAAAA,MAAK,IAAI;AAEvB,MAAI,CAAC,MAAM;AACT,WAAOA,MAAK,MAAM,GAAG,EAAE,CAAC;AAAA,EAC1B;AAEA,QAAM,kBAAQ,WAAW,IAAI;AAC7B,QAAM,QAAQ,kBAAQ,IAAI;AAE1B,SAAOA,MAAK,MAAM,GAAG,EAAE,KAAK;AAC9B;AAEA,KAAK,OAAO;","names":["josa"]}
@@ -0,0 +1,19 @@
1
+ // src/useCombinedRefs.ts
2
+ import { useCallback } from "react";
3
+ var useCombinedRefs = (...refs) => useCallback(
4
+ (element) => refs.forEach((ref) => {
5
+ if (!ref) {
6
+ return;
7
+ }
8
+ if (typeof ref === "function") {
9
+ return ref(element);
10
+ }
11
+ ref.current = element;
12
+ }),
13
+ [refs]
14
+ );
15
+
16
+ export {
17
+ useCombinedRefs
18
+ };
19
+ //# sourceMappingURL=chunk-D2YRH4XY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/useCombinedRefs.ts"],"sourcesContent":["import { type Ref, useCallback } from 'react';\n// Reference: https://github.com/facebook/react/issues/13029#issuecomment-497641073\nexport const useCombinedRefs = <T>(...refs: Array<Ref<T>>): Ref<T> =>\n useCallback(\n (element: T) =>\n refs.forEach((ref) => {\n if (!ref) {\n return;\n }\n if (typeof ref === 'function') {\n return ref(element);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (ref as any).current = element;\n }),\n [refs]\n );\n"],"mappings":";AAAA,SAAmB,mBAAmB;AAE/B,IAAM,kBAAkB,IAAO,SACpC;AAAA,EACE,CAAC,YACC,KAAK,QAAQ,CAAC,QAAQ;AACpB,QAAI,CAAC,KAAK;AACR;AAAA,IACF;AACA,QAAI,OAAO,QAAQ,YAAY;AAC7B,aAAO,IAAI,OAAO;AAAA,IACpB;AAEA,IAAC,IAAY,UAAU;AAAA,EACzB,CAAC;AAAA,EACH,CAAC,IAAI;AACP;","names":[]}
@@ -6,23 +6,16 @@ import {
6
6
  } from "react";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  function createContext(rootComponentName, defaultContext) {
9
- const Context = createContextRaw(
10
- defaultContext
11
- );
9
+ const Context = createContextRaw(defaultContext);
12
10
  function Provider(props) {
13
11
  const { children, ...contextValues } = props;
14
- const value = useMemo(
15
- () => contextValues,
16
- [contextValues]
17
- );
12
+ const value = useMemo(() => contextValues, [contextValues]);
18
13
  return /* @__PURE__ */ jsx(Context.Provider, { value, children });
19
14
  }
20
15
  function useContext(consumerName) {
21
16
  const context = useContextRaw(Context);
22
17
  if (context == null) {
23
- throw new Error(
24
- `${consumerName}\uC740 ${rootComponentName}\uD558\uC704\uC5D0\uC11C \uC0AC\uC6A9\uD574\uC57C \uD569\uB2C8\uB2E4.`
25
- );
18
+ throw new Error(`${consumerName}\uC740 ${rootComponentName}\uD558\uC704\uC5D0\uC11C \uC0AC\uC6A9\uD574\uC57C \uD569\uB2C8\uB2E4.`);
26
19
  }
27
20
  return context;
28
21
  }
@@ -33,4 +26,4 @@ function createContext(rootComponentName, defaultContext) {
33
26
  export {
34
27
  createContext
35
28
  };
36
- //# sourceMappingURL=chunk-3BSCIHE2.mjs.map
29
+ //# sourceMappingURL=chunk-FEPXSL77.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/createContext.tsx"],"sourcesContent":["import {\n useMemo,\n createContext as createContextRaw,\n useContext as useContextRaw,\n type PropsWithChildren,\n} from 'react';\n\nexport function createContext<ContextValueType extends object | null>(\n rootComponentName: string,\n defaultContext?: ContextValueType\n) {\n const Context = createContextRaw<ContextValueType | undefined>(defaultContext);\n\n function Provider(props: PropsWithChildren<ContextValueType>) {\n const { children, ...contextValues } = props;\n\n const value = useMemo(() => contextValues, [contextValues]) as ContextValueType;\n\n return <Context.Provider value={value}>{children}</Context.Provider>;\n }\n\n function useContext(consumerName: string) {\n const context = useContextRaw(Context);\n if (context == null) {\n throw new Error(`${consumerName}은 ${rootComponentName}하위에서 사용해야 합니다.`);\n }\n\n return context;\n }\n\n Provider.displayName = `${rootComponentName}Provider`;\n return [Provider, useContext] as const;\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA,iBAAiB;AAAA,EACjB,cAAc;AAAA,OAET;AAaI;AAXJ,SAAS,cACd,mBACA,gBACA;AACA,QAAM,UAAU,iBAA+C,cAAc;AAE7E,WAAS,SAAS,OAA4C;AAC5D,UAAM,EAAE,UAAU,GAAG,cAAc,IAAI;AAEvC,UAAM,QAAQ,QAAQ,MAAM,eAAe,CAAC,aAAa,CAAC;AAE1D,WAAO,oBAAC,QAAQ,UAAR,EAAiB,OAAe,UAAS;AAAA,EACnD;AAEA,WAAS,WAAW,cAAsB;AACxC,UAAM,UAAU,cAAc,OAAO;AACrC,QAAI,WAAW,MAAM;AACnB,YAAM,IAAI,MAAM,GAAG,YAAY,UAAK,iBAAiB,uEAAgB;AAAA,IACvE;AAEA,WAAO;AAAA,EACT;AAEA,WAAS,cAAc,GAAG,iBAAiB;AAC3C,SAAO,CAAC,UAAU,UAAU;AAC9B;","names":[]}
@@ -11,4 +11,4 @@ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForD
11
11
  export {
12
12
  composeEventHandlers
13
13
  };
14
- //# sourceMappingURL=chunk-QD5QDTUG.mjs.map
14
+ //# sourceMappingURL=chunk-HCRCYF7A.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/composeEventHandlers.ts"],"sourcesContent":["// @see https://github.com/radix-ui/primitives/blob/main/packages/core/primitive/src/primitive.tsx\n\nexport function composeEventHandlers<E>(\n originalEventHandler?: (event: E) => void,\n ourEventHandler?: (event: E) => void,\n { checkForDefaultPrevented = true } = {}\n) {\n return function handleEvent(event: E) {\n originalEventHandler?.(event);\n\n if (checkForDefaultPrevented === false || !(event as unknown as Event).defaultPrevented) {\n return ourEventHandler?.(event);\n }\n };\n}\n"],"mappings":";AAEO,SAAS,qBACd,sBACA,iBACA,EAAE,2BAA2B,KAAK,IAAI,CAAC,GACvC;AACA,SAAO,SAAS,YAAY,OAAU;AACpC,2BAAuB,KAAK;AAE5B,QAAI,6BAA6B,SAAS,CAAE,MAA2B,kBAAkB;AACvF,aAAO,kBAAkB,KAAK;AAAA,IAChC;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,57 @@
1
+ import {
2
+ usePreservedCallback_default
3
+ } from "./chunk-QGQNMD22.mjs";
4
+
5
+ // src/useControllableState.ts
6
+ import * as React from "react";
7
+ function noop() {
8
+ }
9
+ var useControllableState = ({
10
+ prop,
11
+ defaultProp,
12
+ onChange = noop
13
+ }) => {
14
+ const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({
15
+ defaultProp,
16
+ onChange
17
+ });
18
+ const isControlled = prop !== void 0;
19
+ const value = isControlled ? prop : uncontrolledProp;
20
+ const handleChange = usePreservedCallback_default(onChange);
21
+ const setValue = React.useCallback(
22
+ (nextValue) => {
23
+ if (isControlled) {
24
+ const setter = nextValue;
25
+ const value2 = typeof nextValue === "function" ? setter(prop) : nextValue;
26
+ if (value2 !== prop) handleChange(value2);
27
+ } else {
28
+ setUncontrolledProp(nextValue);
29
+ }
30
+ },
31
+ [isControlled, prop, setUncontrolledProp, handleChange]
32
+ );
33
+ return [value, setValue];
34
+ };
35
+ var useUncontrolledState = ({
36
+ defaultProp,
37
+ onChange = noop
38
+ }) => {
39
+ const uncontrolledState = React.useState(defaultProp);
40
+ const [value] = uncontrolledState;
41
+ const prevValueRef = React.useRef(value);
42
+ const handleChange = usePreservedCallback_default(onChange);
43
+ React.useEffect(() => {
44
+ if (prevValueRef.current !== value) {
45
+ handleChange(value);
46
+ prevValueRef.current = value;
47
+ }
48
+ }, [value, prevValueRef, handleChange]);
49
+ return uncontrolledState;
50
+ };
51
+ var useControllableState_default = useControllableState;
52
+
53
+ export {
54
+ useControllableState,
55
+ useControllableState_default
56
+ };
57
+ //# sourceMappingURL=chunk-HOC4D4DT.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/useControllableState.ts"],"sourcesContent":["import * as React from 'react';\n\nimport usePreservedCallback from './usePreservedCallback';\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nfunction noop() {}\nexport type UseControllableStateParams<T> = {\n prop?: T | undefined;\n defaultProp?: T | undefined;\n onChange?: (state: T) => void;\n};\ntype SetStateFn<T> = (prevState?: T) => T;\n/**\n * @description\n * Radix UI's useControllableState\n */\nexport const useControllableState = <T>({\n prop,\n defaultProp,\n onChange = noop,\n}: UseControllableStateParams<T>) => {\n const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({\n defaultProp,\n onChange,\n });\n const isControlled = prop !== undefined;\n const value = isControlled ? prop : uncontrolledProp;\n const handleChange = usePreservedCallback(onChange);\n const setValue: React.Dispatch<React.SetStateAction<T | undefined>> = React.useCallback(\n (nextValue) => {\n if (isControlled) {\n const setter = nextValue as SetStateFn<T>;\n const value = typeof nextValue === 'function' ? setter(prop) : nextValue;\n if (value !== prop) handleChange(value as T);\n } else {\n setUncontrolledProp(nextValue);\n }\n },\n [isControlled, prop, setUncontrolledProp, handleChange]\n );\n return [value, setValue] as const;\n};\nconst useUncontrolledState = <T>({\n defaultProp,\n onChange = noop,\n}: Omit<UseControllableStateParams<T>, 'prop'>) => {\n const uncontrolledState = React.useState<T | undefined>(defaultProp);\n const [value] = uncontrolledState;\n const prevValueRef = React.useRef(value);\n const handleChange = usePreservedCallback(onChange);\n React.useEffect(() => {\n if (prevValueRef.current !== value) {\n handleChange(value as T);\n prevValueRef.current = value;\n }\n }, [value, prevValueRef, handleChange]);\n return uncontrolledState;\n};\nexport default useControllableState;\n"],"mappings":";;;;;AAAA,YAAY,WAAW;AAIvB,SAAS,OAAO;AAAC;AAWV,IAAM,uBAAuB,CAAI;AAAA,EACtC;AAAA,EACA;AAAA,EACA,WAAW;AACb,MAAqC;AACnC,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,qBAAqB;AAAA,IACnE;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,eAAe,SAAS;AAC9B,QAAM,QAAQ,eAAe,OAAO;AACpC,QAAM,eAAe,6BAAqB,QAAQ;AAClD,QAAM,WAAsE;AAAA,IAC1E,CAAC,cAAc;AACb,UAAI,cAAc;AAChB,cAAM,SAAS;AACf,cAAMA,SAAQ,OAAO,cAAc,aAAa,OAAO,IAAI,IAAI;AAC/D,YAAIA,WAAU,KAAM,cAAaA,MAAU;AAAA,MAC7C,OAAO;AACL,4BAAoB,SAAS;AAAA,MAC/B;AAAA,IACF;AAAA,IACA,CAAC,cAAc,MAAM,qBAAqB,YAAY;AAAA,EACxD;AACA,SAAO,CAAC,OAAO,QAAQ;AACzB;AACA,IAAM,uBAAuB,CAAI;AAAA,EAC/B;AAAA,EACA,WAAW;AACb,MAAmD;AACjD,QAAM,oBAA0B,eAAwB,WAAW;AACnE,QAAM,CAAC,KAAK,IAAI;AAChB,QAAM,eAAqB,aAAO,KAAK;AACvC,QAAM,eAAe,6BAAqB,QAAQ;AAClD,EAAM,gBAAU,MAAM;AACpB,QAAI,aAAa,YAAY,OAAO;AAClC,mBAAa,KAAU;AACvB,mBAAa,UAAU;AAAA,IACzB;AAAA,EACF,GAAG,CAAC,OAAO,cAAc,YAAY,CAAC;AACtC,SAAO;AACT;AACA,IAAO,+BAAQ;","names":["value"]}
@@ -19,9 +19,7 @@ function isValidAlpha(alpha) {
19
19
  }
20
20
  function hexToRgba({ hex, alpha = 1 }) {
21
21
  if (!isValidAlpha(alpha)) {
22
- throw new Error(
23
- `Invalid alpha value. Must be between 0 and 1, received: ${alpha}`
24
- );
22
+ throw new Error(`Invalid alpha value. Must be between 0 and 1, received: ${alpha}`);
25
23
  }
26
24
  const validatedHex = validateHex(hex);
27
25
  const expandedHex = expandHex(validatedHex);
@@ -34,4 +32,4 @@ function hexToRgba({ hex, alpha = 1 }) {
34
32
  export {
35
33
  hexToRgba
36
34
  };
37
- //# sourceMappingURL=chunk-KIUJWSBE.mjs.map
35
+ //# sourceMappingURL=chunk-JTQFGEBG.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hexToRgba.ts"],"sourcesContent":["export type HexToRgbaProps = { hex: string; alpha?: number };\n\nfunction parseHexToDecimal(hex: string): number {\n return parseInt(hex, 16);\n}\n\nfunction validateHex(hex: string): string {\n const match = /^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.exec(hex);\n if (!match) {\n throw new Error(\n `Invalid hex value: \"${hex}\". Expected formats: \"#RGB\", \"RGB\", \"#RRGGBB\", or \"RRGGBB\".`\n );\n }\n return match[1];\n}\n\nfunction expandHex(hex: string): string {\n return hex.length === 3\n ? hex\n .split('')\n .map((char) => char + char)\n .join('')\n : hex;\n}\n\nfunction isValidAlpha(alpha: number): boolean {\n return alpha >= 0 && alpha <= 1;\n}\n\nexport function hexToRgba({ hex, alpha = 1 }: HexToRgbaProps): string {\n if (!isValidAlpha(alpha)) {\n throw new Error(`Invalid alpha value. Must be between 0 and 1, received: ${alpha}`);\n }\n\n const validatedHex = validateHex(hex);\n const expandedHex = expandHex(validatedHex);\n\n const r = parseHexToDecimal(expandedHex.slice(0, 2));\n const g = parseHexToDecimal(expandedHex.slice(2, 4));\n const b = parseHexToDecimal(expandedHex.slice(4, 6));\n\n return `rgba(${r},${g},${b},${alpha})`;\n}\n"],"mappings":";AAEA,SAAS,kBAAkB,KAAqB;AAC9C,SAAO,SAAS,KAAK,EAAE;AACzB;AAEA,SAAS,YAAY,KAAqB;AACxC,QAAM,QAAQ,sCAAsC,KAAK,GAAG;AAC5D,MAAI,CAAC,OAAO;AACV,UAAM,IAAI;AAAA,MACR,uBAAuB,GAAG;AAAA,IAC5B;AAAA,EACF;AACA,SAAO,MAAM,CAAC;AAChB;AAEA,SAAS,UAAU,KAAqB;AACtC,SAAO,IAAI,WAAW,IAClB,IACG,MAAM,EAAE,EACR,IAAI,CAAC,SAAS,OAAO,IAAI,EACzB,KAAK,EAAE,IACV;AACN;AAEA,SAAS,aAAa,OAAwB;AAC5C,SAAO,SAAS,KAAK,SAAS;AAChC;AAEO,SAAS,UAAU,EAAE,KAAK,QAAQ,EAAE,GAA2B;AACpE,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI,MAAM,2DAA2D,KAAK,EAAE;AAAA,EACpF;AAEA,QAAM,eAAe,YAAY,GAAG;AACpC,QAAM,cAAc,UAAU,YAAY;AAE1C,QAAM,IAAI,kBAAkB,YAAY,MAAM,GAAG,CAAC,CAAC;AACnD,QAAM,IAAI,kBAAkB,YAAY,MAAM,GAAG,CAAC,CAAC;AACnD,QAAM,IAAI,kBAAkB,YAAY,MAAM,GAAG,CAAC,CAAC;AAEnD,SAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK;AACrC;","names":[]}
@@ -19,4 +19,4 @@ function hasBatchim(str) {
19
19
  export {
20
20
  hasBatchim
21
21
  };
22
- //# sourceMappingURL=chunk-KMMS4XJ6.mjs.map
22
+ //# sourceMappingURL=chunk-K7254VDU.mjs.map
@@ -1 +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,SAAU,QAAO;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":[]}
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 (charCode < COMPLETE_HANGUL_START_CHARCODE || charCode > COMPLETE_HANGUL_END_CHARCODE) {\n return false;\n }\n\n // 받침 코드 계산\n const batchimCode = (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,SAAU,QAAO;AAEtB,QAAM,WAAW,SAAS,WAAW,CAAC;AAGtC,MAAI,WAAW,kCAAkC,WAAW,8BAA8B;AACxF,WAAO;AAAA,EACT;AAGA,QAAM,eAAe,WAAW,kCAAkC;AAElE,SAAO,cAAc;AACvB;","names":[]}
@@ -23,4 +23,4 @@ Choose.Otherwise = ChooseOtherwise;
23
23
  export {
24
24
  Choose
25
25
  };
26
- //# sourceMappingURL=chunk-7WNTKDNW.mjs.map
26
+ //# sourceMappingURL=chunk-KFMJD3YK.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) && child.type === Choose.When && 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 }) => <>{children}</>;\n\nChoose.When = ChooseWhen;\nChoose.Otherwise = ChooseOtherwise;\n"],"mappings":";AAAA,SAAS,gBAAyC,gBAAgB;AA+BvC;AAhBpB,SAAS,OAAO,EAAE,SAAS,GAAgB;AAChD,QAAM,gBAAgB,SAAS,QAAQ,QAAQ;AAE/C,QAAM,gBAAgB,cAAc;AAAA,IAClC,CAAC,UACC,eAAgC,KAAK,KAAK,MAAM,SAAS,OAAO,QAAQ,MAAM,MAAM;AAAA,EACxF;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,MAAM,gCAAG,UAAS;AAEhF,OAAO,OAAO;AACd,OAAO,YAAY;","names":[]}
@@ -0,0 +1,15 @@
1
+ // src/usePreservedCallback.ts
2
+ import { useEffect, useMemo, useRef } from "react";
3
+ var usePreservedCallback = (callback) => {
4
+ const callbackRef = useRef(callback);
5
+ useEffect(() => {
6
+ callbackRef.current = callback;
7
+ }, [callback]);
8
+ return useMemo(() => (...args) => callbackRef.current?.(...args), []);
9
+ };
10
+ var usePreservedCallback_default = usePreservedCallback;
11
+
12
+ export {
13
+ usePreservedCallback_default
14
+ };
15
+ //# sourceMappingURL=chunk-QGQNMD22.mjs.map