@twreporter/react-typescript-components 0.1.0-beta.6 → 0.1.0-beta.7

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 (57) hide show
  1. package/lib/button/components/text-button/index.js +59 -13
  2. package/lib/button/components/text-button/index.js.map +1 -1
  3. package/lib/button/components/text-button/index.mjs +2 -1
  4. package/lib/button/components/text-button/theme.d.mts +11 -0
  5. package/lib/button/components/text-button/theme.d.ts +11 -0
  6. package/lib/button/components/text-button/theme.js +65 -0
  7. package/lib/button/components/text-button/theme.js.map +1 -0
  8. package/lib/button/components/text-button/theme.mjs +5 -0
  9. package/lib/button/components/text-button/theme.mjs.map +1 -0
  10. package/lib/button/index.js +59 -13
  11. package/lib/button/index.js.map +1 -1
  12. package/lib/button/index.mjs +3 -2
  13. package/lib/button/stories/text-button.stories.js +59 -13
  14. package/lib/button/stories/text-button.stories.js.map +1 -1
  15. package/lib/button/stories/text-button.stories.mjs +2 -1
  16. package/lib/button/stories/text-button.stories.mjs.map +1 -1
  17. package/lib/{chunk-R4F4LGAY.mjs → chunk-7NJDHQ2X.mjs} +3 -3
  18. package/lib/{chunk-R4F4LGAY.mjs.map → chunk-7NJDHQ2X.mjs.map} +1 -1
  19. package/lib/chunk-ELECTE3D.mjs +8 -0
  20. package/lib/{chunk-7DK5MO62.mjs.map → chunk-ELECTE3D.mjs.map} +1 -1
  21. package/lib/{chunk-GRCEZABQ.mjs → chunk-FF422IYY.mjs} +3 -3
  22. package/lib/{chunk-GRCEZABQ.mjs.map → chunk-FF422IYY.mjs.map} +1 -1
  23. package/lib/chunk-FVKIUNIP.mjs +58 -0
  24. package/lib/chunk-FVKIUNIP.mjs.map +1 -0
  25. package/lib/{chunk-QE5LVT7A.mjs → chunk-U22UKMAJ.mjs} +9 -15
  26. package/lib/chunk-U22UKMAJ.mjs.map +1 -0
  27. package/lib/{chunk-CZVB2Y6O.mjs → chunk-ZALXWB2J.mjs} +3 -3
  28. package/lib/{chunk-CZVB2Y6O.mjs.map → chunk-ZALXWB2J.mjs.map} +1 -1
  29. package/lib/styles.css +27 -6
  30. package/lib/styles.css.map +1 -1
  31. package/lib/title-bar/components/title-tab/index.js +59 -13
  32. package/lib/title-bar/components/title-tab/index.js.map +1 -1
  33. package/lib/title-bar/components/title-tab/index.mjs +5 -4
  34. package/lib/title-bar/components/title-tab/tab-item.js +59 -13
  35. package/lib/title-bar/components/title-tab/tab-item.js.map +1 -1
  36. package/lib/title-bar/components/title-tab/tab-item.mjs +4 -3
  37. package/lib/title-bar/components/title1.js +1 -1
  38. package/lib/title-bar/components/title1.js.map +1 -1
  39. package/lib/title-bar/components/title1.mjs +1 -1
  40. package/lib/title-bar/index.js +60 -14
  41. package/lib/title-bar/index.js.map +1 -1
  42. package/lib/title-bar/index.mjs +9 -8
  43. package/lib/title-bar/index.mjs.map +1 -1
  44. package/lib/title-bar/stories/title-tab.stories.js +59 -13
  45. package/lib/title-bar/stories/title-tab.stories.js.map +1 -1
  46. package/lib/title-bar/stories/title-tab.stories.mjs +5 -4
  47. package/lib/title-bar/stories/title-tab.stories.mjs.map +1 -1
  48. package/lib/title-bar/stories/title1.stories.js +1 -1
  49. package/lib/title-bar/stories/title1.stories.js.map +1 -1
  50. package/lib/title-bar/stories/title1.stories.mjs +1 -1
  51. package/lib/title-bar/stories/title2.stories.js +59 -13
  52. package/lib/title-bar/stories/title2.stories.js.map +1 -1
  53. package/lib/title-bar/stories/title2.stories.mjs +3 -2
  54. package/lib/title-bar/stories/title2.stories.mjs.map +1 -1
  55. package/package.json +2 -2
  56. package/lib/chunk-7DK5MO62.mjs +0 -8
  57. package/lib/chunk-QE5LVT7A.mjs.map +0 -1
@@ -71,6 +71,59 @@ var THEME = {
71
71
  transparent: "transparent",
72
72
  index: "index"
73
73
  };
74
+
75
+ // src/button/components/text-button/theme.ts
76
+ var getDisabledContainerTheme = (theme) => {
77
+ return [
78
+ // default theme
79
+ "text-gray-400 hover:text-gray-400",
80
+ // photography & transparent theme
81
+ {
82
+ "text-gray-500 hover:text-gray-500": theme === THEME.photography || theme === THEME.transparent
83
+ }
84
+ ];
85
+ };
86
+ var getActiveContainerTheme = (theme, style) => {
87
+ return [
88
+ // default theme
89
+ {
90
+ "text-gray-800 hover:text-gray-800": style === 2 /* LIGHT */,
91
+ "text-brand-heavy hover:text-brand-heavy": style === 1 /* DARK */,
92
+ "text-brand-dark hover:text-brand-dark": style === 0 /* BRAND */
93
+ },
94
+ // photography theme
95
+ {
96
+ "text-gray-400 hover:text-gray-400": theme === THEME.photography && style === 2 /* LIGHT */,
97
+ "text-supportive-pastel hover:text-supportive-pastel": theme === THEME.photography && style !== 2 /* LIGHT */
98
+ },
99
+ // transparent theme
100
+ {
101
+ "text-gray-black hover:text-gray-black": theme === THEME.transparent && style === 2 /* LIGHT */,
102
+ "text-gray-200 hover:text-gray-200": theme === THEME.transparent && style !== 2 /* LIGHT */
103
+ }
104
+ ];
105
+ };
106
+ var getContainerTheme = (theme, style) => {
107
+ return [
108
+ // default theme
109
+ {
110
+ "text-gray-600 hover:text-gray-800": style === 2 /* LIGHT */,
111
+ "text-gray-800 hover:text-brand-heavy": style === 1 /* DARK */,
112
+ "text-brand-heavy hover:text-brand-dark": style === 0 /* BRAND */
113
+ },
114
+ // photography
115
+ {
116
+ "text-gray-300 hover:text-gray-400": theme === THEME.photography && style === 2 /* LIGHT */,
117
+ "text-gray-white hover:text-supportive-pastel": theme === THEME.photography && style === 1 /* DARK */,
118
+ "text-supportive-faded hover:text-supportive-pastel": theme === THEME.photography && style === 0 /* BRAND */
119
+ },
120
+ // transparent theme
121
+ {
122
+ "text-gray-800 hover:text-gray-black": theme === THEME.transparent && style === 2 /* LIGHT */,
123
+ "text-gray-white hover:text-gray-200": theme === THEME.transparent && style !== 2 /* LIGHT */
124
+ }
125
+ ];
126
+ };
74
127
  var TextButton = ({
75
128
  text,
76
129
  leftIconComponent,
@@ -84,9 +137,13 @@ var TextButton = ({
84
137
  className = ""
85
138
  }) => {
86
139
  const TextJSX = react.useMemo(
87
- () => size === 0 /* S */ ? /* @__PURE__ */ jsxRuntime.jsx(P2, { text }) : /* @__PURE__ */ jsxRuntime.jsx(P1, { text }),
140
+ () => size === 0 /* S */ ? /* @__PURE__ */ jsxRuntime.jsx(P2, { text, weight: P2.Weight.bold }) : /* @__PURE__ */ jsxRuntime.jsx(P1, { text, weight: P1.Weight.bold }),
88
141
  [size, text]
89
142
  );
143
+ const themeClass = react.useMemo(() => {
144
+ const themeFunc = disabled ? getDisabledContainerTheme : active ? getActiveContainerTheme : getContainerTheme;
145
+ return themeFunc(theme, style);
146
+ }, [disabled, active, theme, style]);
90
147
  return /* @__PURE__ */ jsxRuntime.jsx(
91
148
  "div",
92
149
  {
@@ -96,18 +153,7 @@ var TextButton = ({
96
153
  "cursor-default": disabled,
97
154
  "cursor-pointer": !disabled
98
155
  },
99
- {
100
- "text-gray-500 hover:text-gray-500": disabled && (theme === THEME.photography || theme === THEME.transparent),
101
- "text-gray-400 hover:text-gray-400": disabled || theme === THEME.photography && style === 2 /* LIGHT */ && !active && !disabled,
102
- "text-gray-200 hover:text-supportive-pastel": theme === THEME.photography && !active && !disabled,
103
- "text-gray-300 hover:text-gray-400": theme === THEME.photography && style === 2 /* LIGHT */ && active && !disabled,
104
- "text-gray-white hover:text-supportive-pastel": theme === THEME.photography && style === 1 /* DARK */ && active && !disabled,
105
- "text-supportive-faded hover:text-supportive-pastel": theme === THEME.photography && style === 0 /* BRAND */ && active && !disabled,
106
- "text-gray-100 hover:text-gray-200": theme === THEME.transparent && !active && !disabled,
107
- "text-gray-white hover:text-gray-white": theme === THEME.transparent && active && !disabled,
108
- "text-gray-600 hover:text-brand-heavy": theme === THEME.normal && !active && !disabled,
109
- "text-brand-heavy hover:text-brand-heavy": theme === THEME.normal && active && !disabled
110
- },
156
+ themeClass,
111
157
  className
112
158
  ),
113
159
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex justify-center items-center", children: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/text/enum/index.ts","../../../../src/text/paragraph.tsx","../../../../src/button/enum.ts","../../../../src/button/constant.ts","../../../../src/button/components/text-button/index.tsx"],"names":["jsx","clsx","Size","Style","useMemo","jsxs"],"mappings":";;;;;;;;;;;;;AASO,IAAM,MAAA,GAAS;AAAA,EACpB,UAAA,EAAY,aAAA;AAAA,EACZ,MAAA,EAAQ,QAAA;AAAA,EACR,IAAA,EAAM;AACR,CAAA;ACHA,IAAM,SAAA,GAAY,mDAAA;AAElB,IAAM,YAAA,GAAe;AAAA,EACnB,EAAA,EAAI,aAAA;AAAA,EACJ,EAAA,EAAI,aAAA;AAAA,EACJ,EAAA,EAAI,aAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AAEA,IAAM,gBAAA,GAAmB,CAAC,OAAA,KAAuC;AAC/D,EAAA,MAAM,YAAkE,CAAC;AAAA,IACvE,IAAA,GAAO,EAAA;AAAA,IACP,SAAS,MAAA,CAAO,MAAA;AAAA,IAChB,SAAA,GAAY,EAAA;AAAA,IACZ,GAAG;AAAA,GACL,qBACEA,cAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAWC,sBAAA;AAAA,QACT,SAAA;AAAA,QACA,aAAa,OAAO,CAAA;AAAA,QACpB,QAAQ,MAAM,CAAA,CAAA;AAAA,QACd;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA;AAAA,GACH;AAEF,EAAA,SAAA,CAAU,WAAA,GAAc,OAAA;AACxB,EAAA,SAAA,CAAU,MAAA,GAAS,MAAA;AACnB,EAAA,OAAO,SAAA;AACT,CAAA;AAEA,IAAM,EAAA,GAAK,iBAAiB,IAAI,CAAA;AAChC,IAAM,EAAA,GAAK,iBAAiB,IAAI,CAAA;AACrB,iBAAiB,IAAI;AACrB,iBAAiB,IAAI;;;AC9CzB,IAAK,IAAA,qBAAAC,KAAAA,KAAL;AACL,EAAAA,KAAA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AC,KAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAWJ,uBAAK,kCAAA,EAAoC;AAAA,cAClD,WAAA,EAAa,OAAA;AAAA,cACb,eAAe,CAAC;AAAA,aACjB,CAAA;AAAA,YAED,QAAA,EAAA;AAAA,8BAAAD,cAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,4BAAA,EAA8B,QAAA,EAAA,iBAAA,EAAkB,CAAA;AAAA,cAC9D,OAAA;AAAA,8BACDA,cAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,8BAA8B,QAAA,EAAA,kBAAA,EAAmB;AAAA;AAAA;AAAA,SAClE;AAAA,wBACAA,cAAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAWC,sBAAAA;AAAA,cACT,iDAAA;AAAA,cACA,uEAAA;AAAA,cACA;AAAA,gBACE,aAAA,EAAe,IAAA,KAAA,CAAA;AAAA,gBACf,aAAA,EAAe,IAAA,KAAA,CAAA;AAAA,eACjB;AAAA,cACA;AAAA,gBACE,aAAa,CAAC,OAAA;AAAA,gBACd,aAAA,EAAe;AAAA;AACjB;AACF;AAAA;AACF,OAAA,EACF;AAAA;AAAA,GACF;AAEJ,CAAA;AACA,UAAA,CAAW,IAAA,GAAO,IAAA;AAClB,UAAA,CAAW,KAAA,GAAQ,KAAA;AACnB,UAAA,CAAW,KAAA,GAAQ,KAAA;AAEnB,IAAO,mBAAA,GAAQ","file":"index.js","sourcesContent":["import type { ValuesOf } from '../../types'\n\nexport const TYPE = {\n default: 'default',\n article: 'article',\n} as const\n\nexport type Type = ValuesOf<typeof TYPE>\n\nexport const WEIGHT = {\n extraLight: 'extra-light',\n normal: 'normal',\n bold: 'bold',\n} as const\n\nexport type Weight = ValuesOf<typeof WEIGHT>\n","import clsx from 'clsx'\nimport type React from 'react'\nimport { WEIGHT, type Weight } from './enum'\n\ntype ParagraphProps = React.HTMLAttributes<HTMLParagraphElement> & {\n text?: string\n weight?: Weight\n className?: string\n}\n\nconst baseClass = 'font-default leading-[150%] flex items-center m-0'\n\nconst variantClass = {\n P1: 'text-[16px]',\n P2: 'text-[14px]',\n P3: 'text-[12px]',\n P4: 'text-[10px]',\n}\n\nconst ParagraphVariant = (variant: keyof typeof variantClass) => {\n const Component: React.FC<ParagraphProps> & { Weight: typeof WEIGHT } = ({\n text = '',\n weight = WEIGHT.normal,\n className = '',\n ...props\n }) => (\n <p\n className={clsx(\n baseClass,\n variantClass[variant],\n `font-${weight}`,\n className\n )}\n {...props}\n >\n {text}\n </p>\n )\n Component.displayName = variant\n Component.Weight = WEIGHT\n return Component\n}\n\nconst P1 = ParagraphVariant('P1')\nconst P2 = ParagraphVariant('P2')\nconst P3 = ParagraphVariant('P3')\nconst P4 = ParagraphVariant('P4')\n\nexport { P1, P2, P3, P4 }\n","export enum Size {\n S,\n L,\n}\n\nexport enum Style {\n BRAND,\n DARK,\n LIGHT,\n}\n","import type { ValuesOf } from '../types'\n\nexport const THEME = {\n normal: 'normal',\n photography: 'photography',\n transparent: 'transparent',\n index: 'index',\n} as const\n\nexport type Theme = ValuesOf<typeof THEME>\n","import { type FC, type ReactElement, useMemo } from 'react'\nimport clsx from 'clsx'\n// components\nimport { P1, P2 } from '../../../text/paragraph'\n// enums\nimport { Size, Style } from '../../enum'\n// type\nimport type { Theme } from '../../constant'\n// constants\nimport { THEME } from '../../constant'\n\ntype TextButtonProps = {\n text: string\n leftIconComponent?: ReactElement\n rightIconComponent?: ReactElement\n size?: Size\n style?: Style\n theme?: Theme\n active?: boolean\n disabled?: boolean\n loading?: boolean\n className?: string\n}\nconst TextButton: FC<TextButtonProps> & {\n Size: typeof Size\n Style: typeof Style\n THEME: typeof THEME\n} = ({\n text,\n leftIconComponent,\n rightIconComponent,\n size = Size.S,\n theme = THEME.normal,\n style = Style.DARK,\n active = false,\n disabled = false,\n loading = false,\n className = '',\n}) => {\n const TextJSX = useMemo(\n () => (size === Size.S ? <P2 text={text} /> : <P1 text={text} />),\n [size, text]\n )\n\n return (\n <div\n className={clsx(\n 'flex items-center',\n {\n 'cursor-default': disabled,\n 'cursor-pointer': !disabled,\n },\n {\n 'text-gray-500 hover:text-gray-500':\n disabled &&\n (theme === THEME.photography || theme === THEME.transparent),\n 'text-gray-400 hover:text-gray-400':\n disabled ||\n (theme === THEME.photography &&\n style === Style.LIGHT &&\n !active &&\n !disabled),\n 'text-gray-200 hover:text-supportive-pastel':\n theme === THEME.photography && !active && !disabled,\n 'text-gray-300 hover:text-gray-400':\n theme === THEME.photography &&\n style === Style.LIGHT &&\n active &&\n !disabled,\n 'text-gray-white hover:text-supportive-pastel':\n theme === THEME.photography &&\n style === Style.DARK &&\n active &&\n !disabled,\n 'text-supportive-faded hover:text-supportive-pastel':\n theme === THEME.photography &&\n style === Style.BRAND &&\n active &&\n !disabled,\n 'text-gray-100 hover:text-gray-200':\n theme === THEME.transparent && !active && !disabled,\n 'text-gray-white hover:text-gray-white':\n theme === THEME.transparent && active && !disabled,\n 'text-gray-600 hover:text-brand-heavy':\n theme === THEME.normal && !active && !disabled,\n 'text-brand-heavy hover:text-brand-heavy':\n theme === THEME.normal && active && !disabled,\n },\n className\n )}\n >\n <div className=\"relative flex justify-center items-center\">\n <div\n className={clsx('flex justify-center items-center', {\n 'opacity-0': loading,\n 'opacity-100': !loading,\n })}\n >\n <div className=\"flex items-center mr-[4px]\">{leftIconComponent}</div>\n {TextJSX}\n <div className=\"flex items-center ml-[4px]\">{rightIconComponent}</div>\n </div>\n <span\n className={clsx(\n 'inline-block absolute box-border animation-spin',\n 'border-2 border-solid border-gray-400 border-t-gray-600 rounded-[50%]',\n {\n 'size-[18px]': size === Size.S,\n 'size-[24px]': size === Size.L,\n },\n {\n 'opacity-0': !loading,\n 'opacity-100': loading,\n }\n )}\n />\n </div>\n </div>\n )\n}\nTextButton.Size = Size\nTextButton.Style = Style\nTextButton.THEME = THEME\n\nexport default TextButton\n"]}
1
+ {"version":3,"sources":["../../../../src/text/enum/index.ts","../../../../src/text/paragraph.tsx","../../../../src/button/enum.ts","../../../../src/button/constant.ts","../../../../src/button/components/text-button/theme.ts","../../../../src/button/components/text-button/index.tsx"],"names":["jsx","clsx","Size","Style","useMemo","jsxs"],"mappings":";;;;;;;;;;;;;AASO,IAAM,MAAA,GAAS;AAAA,EACpB,UAAA,EAAY,aAAA;AAAA,EACZ,MAAA,EAAQ,QAAA;AAAA,EACR,IAAA,EAAM;AACR,CAAA;ACHA,IAAM,SAAA,GAAY,mDAAA;AAElB,IAAM,YAAA,GAAe;AAAA,EACnB,EAAA,EAAI,aAAA;AAAA,EACJ,EAAA,EAAI,aAAA;AAAA,EACJ,EAAA,EAAI,aAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AAEA,IAAM,gBAAA,GAAmB,CAAC,OAAA,KAAuC;AAC/D,EAAA,MAAM,YAAkE,CAAC;AAAA,IACvE,IAAA,GAAO,EAAA;AAAA,IACP,SAAS,MAAA,CAAO,MAAA;AAAA,IAChB,SAAA,GAAY,EAAA;AAAA,IACZ,GAAG;AAAA,GACL,qBACEA,cAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAWC,sBAAA;AAAA,QACT,SAAA;AAAA,QACA,aAAa,OAAO,CAAA;AAAA,QACpB,QAAQ,MAAM,CAAA,CAAA;AAAA,QACd;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA;AAAA,GACH;AAEF,EAAA,SAAA,CAAU,WAAA,GAAc,OAAA;AACxB,EAAA,SAAA,CAAU,MAAA,GAAS,MAAA;AACnB,EAAA,OAAO,SAAA;AACT,CAAA;AAEA,IAAM,EAAA,GAAK,iBAAiB,IAAI,CAAA;AAChC,IAAM,EAAA,GAAK,iBAAiB,IAAI,CAAA;AACrB,iBAAiB,IAAI;AACrB,iBAAiB,IAAI;;;AC9CzB,IAAK,IAAA,qBAAAC,KAAAA,KAAL;AACL,EAAAA,KAAAA,CAAAA,KAAAA,CAAA,GAAA,CAA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BAAA,EAA8B,QAAA,EAAA,iBAAA,EAAkB,CAAA;AAAA,cAC9D,OAAA;AAAA,8BACDA,cAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,8BAA8B,QAAA,EAAA,kBAAA,EAAmB;AAAA;AAAA;AAAA,SAClE;AAAA,wBACAA,cAAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAWC,sBAAAA;AAAA,cACT,iDAAA;AAAA,cACA,uEAAA;AAAA,cACA;AAAA,gBACE,aAAA,EAAe,IAAA,KAAA,CAAA;AAAA,gBACf,aAAA,EAAe,IAAA,KAAA,CAAA;AAAA,eACjB;AAAA,cACA;AAAA,gBACE,aAAa,CAAC,OAAA;AAAA,gBACd,aAAA,EAAe;AAAA;AACjB;AACF;AAAA;AACF,OAAA,EACF;AAAA;AAAA,GACF;AAEJ,CAAA;AACA,UAAA,CAAW,IAAA,GAAO,IAAA;AAClB,UAAA,CAAW,KAAA,GAAQ,KAAA;AACnB,UAAA,CAAW,KAAA,GAAQ,KAAA;AAEnB,IAAO,mBAAA,GAAQ","file":"index.js","sourcesContent":["import type { ValuesOf } from '../../types'\n\nexport const TYPE = {\n default: 'default',\n article: 'article',\n} as const\n\nexport type Type = ValuesOf<typeof TYPE>\n\nexport const WEIGHT = {\n extraLight: 'extra-light',\n normal: 'normal',\n bold: 'bold',\n} as const\n\nexport type Weight = ValuesOf<typeof WEIGHT>\n","import clsx from 'clsx'\nimport type React from 'react'\nimport { WEIGHT, type Weight } from './enum'\n\ntype ParagraphProps = React.HTMLAttributes<HTMLParagraphElement> & {\n text?: string\n weight?: Weight\n className?: string\n}\n\nconst baseClass = 'font-default leading-[150%] flex items-center m-0'\n\nconst variantClass = {\n P1: 'text-[16px]',\n P2: 'text-[14px]',\n P3: 'text-[12px]',\n P4: 'text-[10px]',\n}\n\nconst ParagraphVariant = (variant: keyof typeof variantClass) => {\n const Component: React.FC<ParagraphProps> & { Weight: typeof WEIGHT } = ({\n text = '',\n weight = WEIGHT.normal,\n className = '',\n ...props\n }) => (\n <p\n className={clsx(\n baseClass,\n variantClass[variant],\n `font-${weight}`,\n className\n )}\n {...props}\n >\n {text}\n </p>\n )\n Component.displayName = variant\n Component.Weight = WEIGHT\n return Component\n}\n\nconst P1 = ParagraphVariant('P1')\nconst P2 = ParagraphVariant('P2')\nconst P3 = ParagraphVariant('P3')\nconst P4 = ParagraphVariant('P4')\n\nexport { P1, P2, P3, P4 }\n","export enum Size {\n S,\n L,\n}\n\nexport enum Style {\n BRAND,\n DARK,\n LIGHT,\n}\n","import type { ValuesOf } from '../types'\n\nexport const THEME = {\n normal: 'normal',\n photography: 'photography',\n transparent: 'transparent',\n index: 'index',\n} as const\n\nexport type Theme = ValuesOf<typeof THEME>\n","// constants\nimport { THEME } from '../../constant'\n// type\nimport type { Theme } from '../../constant'\nimport type { ClassArray } from 'clsx'\n// enum\nimport { Style } from '../../enum'\n\ntype ThemeFunc = (theme: Theme, style?: Style) => ClassArray\n\nexport const getDisabledContainerTheme: ThemeFunc = (theme) => {\n return [\n // default theme\n 'text-gray-400 hover:text-gray-400',\n // photography & transparent theme\n {\n 'text-gray-500 hover:text-gray-500': theme === THEME.photography || theme === THEME.transparent,\n }\n ]\n}\n\nexport const getActiveContainerTheme: ThemeFunc = (theme, style) => {\n return [\n // default theme\n {\n 'text-gray-800 hover:text-gray-800': style === Style.LIGHT,\n 'text-brand-heavy hover:text-brand-heavy': style === Style.DARK,\n 'text-brand-dark hover:text-brand-dark': style === Style.BRAND,\n },\n // photography theme\n {\n 'text-gray-400 hover:text-gray-400': theme === THEME.photography && style === Style.LIGHT,\n 'text-supportive-pastel hover:text-supportive-pastel': theme === THEME.photography && style !== Style.LIGHT,\n },\n // transparent theme\n {\n 'text-gray-black hover:text-gray-black': theme === THEME.transparent && style === Style.LIGHT,\n 'text-gray-200 hover:text-gray-200': theme === THEME.transparent && style !== Style.LIGHT,\n },\n ]\n}\n\nexport const getContainerTheme: ThemeFunc = (theme, style) => {\n return [\n // default theme\n {\n 'text-gray-600 hover:text-gray-800': style === Style.LIGHT,\n 'text-gray-800 hover:text-brand-heavy': style === Style.DARK,\n 'text-brand-heavy hover:text-brand-dark': style === Style.BRAND,\n },\n // photography\n {\n 'text-gray-300 hover:text-gray-400': theme === THEME.photography && style === Style.LIGHT,\n 'text-gray-white hover:text-supportive-pastel': theme === THEME.photography && style === Style.DARK,\n 'text-supportive-faded hover:text-supportive-pastel': theme === THEME.photography && style === Style.BRAND,\n },\n // transparent theme\n {\n 'text-gray-800 hover:text-gray-black': theme === THEME.transparent && style === Style.LIGHT,\n 'text-gray-white hover:text-gray-200': theme === THEME.transparent && style !== Style.LIGHT,\n },\n ]\n}","import { type FC, type ReactElement, useMemo } from 'react'\nimport clsx from 'clsx'\n// components\nimport { P1, P2 } from '../../../text/paragraph'\n// enums\nimport { Size, Style } from '../../enum'\n// type\nimport type { Theme } from '../../constant'\n// constants\nimport { THEME } from '../../constant'\n// utils\nimport { getContainerTheme, getActiveContainerTheme, getDisabledContainerTheme } from './theme'\n\ntype TextButtonProps = {\n text: string\n leftIconComponent?: ReactElement\n rightIconComponent?: ReactElement\n size?: Size\n style?: Style\n theme?: Theme\n active?: boolean\n disabled?: boolean\n loading?: boolean\n className?: string\n}\nconst TextButton: FC<TextButtonProps> & {\n Size: typeof Size\n Style: typeof Style\n THEME: typeof THEME\n} = ({\n text,\n leftIconComponent,\n rightIconComponent,\n size = Size.S,\n theme = THEME.normal,\n style = Style.DARK,\n active = false,\n disabled = false,\n loading = false,\n className = '',\n}) => {\n const TextJSX = useMemo(\n () => (size === Size.S ? <P2 text={text} weight={P2.Weight.bold} /> : <P1 text={text} weight={P1.Weight.bold} />),\n [size, text]\n )\n const themeClass = useMemo(() => {\n const themeFunc = disabled ? getDisabledContainerTheme : (active ? getActiveContainerTheme : getContainerTheme)\n return themeFunc(theme, style)\n }, [disabled, active, theme, style])\n\n return (\n <div\n className={clsx(\n 'flex items-center',\n {\n 'cursor-default': disabled,\n 'cursor-pointer': !disabled,\n },\n themeClass,\n className\n )}\n >\n <div className=\"relative flex justify-center items-center\">\n <div\n className={clsx('flex justify-center items-center', {\n 'opacity-0': loading,\n 'opacity-100': !loading,\n })}\n >\n <div className=\"flex items-center mr-[4px]\">{leftIconComponent}</div>\n {TextJSX}\n <div className=\"flex items-center ml-[4px]\">{rightIconComponent}</div>\n </div>\n <span\n className={clsx(\n 'inline-block absolute box-border animation-spin',\n 'border-2 border-solid border-gray-400 border-t-gray-600 rounded-[50%]',\n {\n 'size-[18px]': size === Size.S,\n 'size-[24px]': size === Size.L,\n },\n {\n 'opacity-0': !loading,\n 'opacity-100': loading,\n }\n )}\n />\n </div>\n </div>\n )\n}\nTextButton.Size = Size\nTextButton.Style = Style\nTextButton.THEME = THEME\n\nexport default TextButton\n"]}
@@ -1,4 +1,5 @@
1
- export { text_button_default as default } from '../../../chunk-QE5LVT7A.mjs';
1
+ export { text_button_default as default } from '../../../chunk-U22UKMAJ.mjs';
2
+ import '../../../chunk-FVKIUNIP.mjs';
2
3
  import '../../../chunk-HQG6Q2EY.mjs';
3
4
  import '../../../chunk-UM7RNC2Y.mjs';
4
5
  import '../../../chunk-JB4TYHDE.mjs';
@@ -0,0 +1,11 @@
1
+ import { Theme } from '../../constant.mjs';
2
+ import { ClassArray } from 'clsx';
3
+ import { Style } from '../../enum.mjs';
4
+ import '../../../types/index.mjs';
5
+
6
+ type ThemeFunc = (theme: Theme, style?: Style) => ClassArray;
7
+ declare const getDisabledContainerTheme: ThemeFunc;
8
+ declare const getActiveContainerTheme: ThemeFunc;
9
+ declare const getContainerTheme: ThemeFunc;
10
+
11
+ export { getActiveContainerTheme, getContainerTheme, getDisabledContainerTheme };
@@ -0,0 +1,11 @@
1
+ import { Theme } from '../../constant.js';
2
+ import { ClassArray } from 'clsx';
3
+ import { Style } from '../../enum.js';
4
+ import '../../../types/index.js';
5
+
6
+ type ThemeFunc = (theme: Theme, style?: Style) => ClassArray;
7
+ declare const getDisabledContainerTheme: ThemeFunc;
8
+ declare const getActiveContainerTheme: ThemeFunc;
9
+ declare const getContainerTheme: ThemeFunc;
10
+
11
+ export { getActiveContainerTheme, getContainerTheme, getDisabledContainerTheme };
@@ -0,0 +1,65 @@
1
+ 'use strict';
2
+
3
+ // src/button/constant.ts
4
+ var THEME = {
5
+ photography: "photography",
6
+ transparent: "transparent"};
7
+
8
+ // src/button/components/text-button/theme.ts
9
+ var getDisabledContainerTheme = (theme) => {
10
+ return [
11
+ // default theme
12
+ "text-gray-400 hover:text-gray-400",
13
+ // photography & transparent theme
14
+ {
15
+ "text-gray-500 hover:text-gray-500": theme === THEME.photography || theme === THEME.transparent
16
+ }
17
+ ];
18
+ };
19
+ var getActiveContainerTheme = (theme, style) => {
20
+ return [
21
+ // default theme
22
+ {
23
+ "text-gray-800 hover:text-gray-800": style === 2 /* LIGHT */,
24
+ "text-brand-heavy hover:text-brand-heavy": style === 1 /* DARK */,
25
+ "text-brand-dark hover:text-brand-dark": style === 0 /* BRAND */
26
+ },
27
+ // photography theme
28
+ {
29
+ "text-gray-400 hover:text-gray-400": theme === THEME.photography && style === 2 /* LIGHT */,
30
+ "text-supportive-pastel hover:text-supportive-pastel": theme === THEME.photography && style !== 2 /* LIGHT */
31
+ },
32
+ // transparent theme
33
+ {
34
+ "text-gray-black hover:text-gray-black": theme === THEME.transparent && style === 2 /* LIGHT */,
35
+ "text-gray-200 hover:text-gray-200": theme === THEME.transparent && style !== 2 /* LIGHT */
36
+ }
37
+ ];
38
+ };
39
+ var getContainerTheme = (theme, style) => {
40
+ return [
41
+ // default theme
42
+ {
43
+ "text-gray-600 hover:text-gray-800": style === 2 /* LIGHT */,
44
+ "text-gray-800 hover:text-brand-heavy": style === 1 /* DARK */,
45
+ "text-brand-heavy hover:text-brand-dark": style === 0 /* BRAND */
46
+ },
47
+ // photography
48
+ {
49
+ "text-gray-300 hover:text-gray-400": theme === THEME.photography && style === 2 /* LIGHT */,
50
+ "text-gray-white hover:text-supportive-pastel": theme === THEME.photography && style === 1 /* DARK */,
51
+ "text-supportive-faded hover:text-supportive-pastel": theme === THEME.photography && style === 0 /* BRAND */
52
+ },
53
+ // transparent theme
54
+ {
55
+ "text-gray-800 hover:text-gray-black": theme === THEME.transparent && style === 2 /* LIGHT */,
56
+ "text-gray-white hover:text-gray-200": theme === THEME.transparent && style !== 2 /* LIGHT */
57
+ }
58
+ ];
59
+ };
60
+
61
+ exports.getActiveContainerTheme = getActiveContainerTheme;
62
+ exports.getContainerTheme = getContainerTheme;
63
+ exports.getDisabledContainerTheme = getDisabledContainerTheme;
64
+ //# sourceMappingURL=theme.js.map
65
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/button/constant.ts","../../../../src/button/components/text-button/theme.ts"],"names":[],"mappings":";;;AAEO,IAAM,KAAA,GAAQ;AAAA,EAEnB,WAAA,EAAa,aAAA;AAAA,EACb,WAAA,EAAa,aAEf,CAAA;;;ACGO,IAAM,yBAAA,GAAuC,CAAC,KAAA,KAAU;AAC7D,EAAA,OAAO;AAAA;AAAA,IAEL,mCAAA;AAAA;AAAA,IAEA;AAAA,MACE,mCAAA,EAAqC,KAAA,KAAU,KAAA,CAAM,WAAA,IAAe,UAAU,KAAA,CAAM;AAAA;AACtF,GACF;AACF;AAEO,IAAM,uBAAA,GAAqC,CAAC,KAAA,EAAO,KAAA,KAAU;AAClE,EAAA,OAAO;AAAA;AAAA,IAEL;AAAA,MACE,mCAAA,EAAqC,KAAA,KAAA,CAAA;AAAA,MACrC,yCAAA,EAA2C,KAAA,KAAA,CAAA;AAAA,MAC3C,uCAAA,EAAyC,KAAA,KAAA,CAAA;AAAA,KAC3C;AAAA;AAAA,IAEA;AAAA,MACE,mCAAA,EAAqC,KAAA,KAAU,KAAA,CAAM,WAAA,IAAe,KAAA,KAAA,CAAA;AAAA,MACpE,qDAAA,EAAuD,KAAA,KAAU,KAAA,CAAM,WAAA,IAAe,KAAA,KAAA,CAAA;AAAA,KACxF;AAAA;AAAA,IAEA;AAAA,MACE,uCAAA,EAAyC,KAAA,KAAU,KAAA,CAAM,WAAA,IAAe,KAAA,KAAA,CAAA;AAAA,MACxE,mCAAA,EAAqC,KAAA,KAAU,KAAA,CAAM,WAAA,IAAe,KAAA,KAAA,CAAA;AAAA;AACtE,GACF;AACF;AAEO,IAAM,iBAAA,GAA+B,CAAC,KAAA,EAAO,KAAA,KAAU;AAC5D,EAAA,OAAO;AAAA;AAAA,IAEL;AAAA,MACE,mCAAA,EAAqC,KAAA,KAAA,CAAA;AAAA,MACrC,sCAAA,EAAwC,KAAA,KAAA,CAAA;AAAA,MACxC,wCAAA,EAA0C,KAAA,KAAA,CAAA;AAAA,KAC5C;AAAA;AAAA,IAEA;AAAA,MACE,mCAAA,EAAqC,KAAA,KAAU,KAAA,CAAM,WAAA,IAAe,KAAA,KAAA,CAAA;AAAA,MACpE,8CAAA,EAAgD,KAAA,KAAU,KAAA,CAAM,WAAA,IAAe,KAAA,KAAA,CAAA;AAAA,MAC/E,oDAAA,EAAsD,KAAA,KAAU,KAAA,CAAM,WAAA,IAAe,KAAA,KAAA,CAAA;AAAA,KACvF;AAAA;AAAA,IAEA;AAAA,MACE,qCAAA,EAAuC,KAAA,KAAU,KAAA,CAAM,WAAA,IAAe,KAAA,KAAA,CAAA;AAAA,MACtE,qCAAA,EAAuC,KAAA,KAAU,KAAA,CAAM,WAAA,IAAe,KAAA,KAAA,CAAA;AAAA;AACxE,GACF;AACF","file":"theme.js","sourcesContent":["import type { ValuesOf } from '../types'\n\nexport const THEME = {\n normal: 'normal',\n photography: 'photography',\n transparent: 'transparent',\n index: 'index',\n} as const\n\nexport type Theme = ValuesOf<typeof THEME>\n","// constants\nimport { THEME } from '../../constant'\n// type\nimport type { Theme } from '../../constant'\nimport type { ClassArray } from 'clsx'\n// enum\nimport { Style } from '../../enum'\n\ntype ThemeFunc = (theme: Theme, style?: Style) => ClassArray\n\nexport const getDisabledContainerTheme: ThemeFunc = (theme) => {\n return [\n // default theme\n 'text-gray-400 hover:text-gray-400',\n // photography & transparent theme\n {\n 'text-gray-500 hover:text-gray-500': theme === THEME.photography || theme === THEME.transparent,\n }\n ]\n}\n\nexport const getActiveContainerTheme: ThemeFunc = (theme, style) => {\n return [\n // default theme\n {\n 'text-gray-800 hover:text-gray-800': style === Style.LIGHT,\n 'text-brand-heavy hover:text-brand-heavy': style === Style.DARK,\n 'text-brand-dark hover:text-brand-dark': style === Style.BRAND,\n },\n // photography theme\n {\n 'text-gray-400 hover:text-gray-400': theme === THEME.photography && style === Style.LIGHT,\n 'text-supportive-pastel hover:text-supportive-pastel': theme === THEME.photography && style !== Style.LIGHT,\n },\n // transparent theme\n {\n 'text-gray-black hover:text-gray-black': theme === THEME.transparent && style === Style.LIGHT,\n 'text-gray-200 hover:text-gray-200': theme === THEME.transparent && style !== Style.LIGHT,\n },\n ]\n}\n\nexport const getContainerTheme: ThemeFunc = (theme, style) => {\n return [\n // default theme\n {\n 'text-gray-600 hover:text-gray-800': style === Style.LIGHT,\n 'text-gray-800 hover:text-brand-heavy': style === Style.DARK,\n 'text-brand-heavy hover:text-brand-dark': style === Style.BRAND,\n },\n // photography\n {\n 'text-gray-300 hover:text-gray-400': theme === THEME.photography && style === Style.LIGHT,\n 'text-gray-white hover:text-supportive-pastel': theme === THEME.photography && style === Style.DARK,\n 'text-supportive-faded hover:text-supportive-pastel': theme === THEME.photography && style === Style.BRAND,\n },\n // transparent theme\n {\n 'text-gray-800 hover:text-gray-black': theme === THEME.transparent && style === Style.LIGHT,\n 'text-gray-white hover:text-gray-200': theme === THEME.transparent && style !== Style.LIGHT,\n },\n ]\n}"]}
@@ -0,0 +1,5 @@
1
+ export { getActiveContainerTheme, getContainerTheme, getDisabledContainerTheme } from '../../../chunk-FVKIUNIP.mjs';
2
+ import '../../../chunk-JB4TYHDE.mjs';
3
+ import '../../../chunk-URJXIWFX.mjs';
4
+ //# sourceMappingURL=theme.mjs.map
5
+ //# sourceMappingURL=theme.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"theme.mjs"}
@@ -73,6 +73,59 @@ var THEME = {
73
73
  transparent: "transparent",
74
74
  index: "index"
75
75
  };
76
+
77
+ // src/button/components/text-button/theme.ts
78
+ var getDisabledContainerTheme = (theme) => {
79
+ return [
80
+ // default theme
81
+ "text-gray-400 hover:text-gray-400",
82
+ // photography & transparent theme
83
+ {
84
+ "text-gray-500 hover:text-gray-500": theme === THEME.photography || theme === THEME.transparent
85
+ }
86
+ ];
87
+ };
88
+ var getActiveContainerTheme = (theme, style) => {
89
+ return [
90
+ // default theme
91
+ {
92
+ "text-gray-800 hover:text-gray-800": style === 2 /* LIGHT */,
93
+ "text-brand-heavy hover:text-brand-heavy": style === 1 /* DARK */,
94
+ "text-brand-dark hover:text-brand-dark": style === 0 /* BRAND */
95
+ },
96
+ // photography theme
97
+ {
98
+ "text-gray-400 hover:text-gray-400": theme === THEME.photography && style === 2 /* LIGHT */,
99
+ "text-supportive-pastel hover:text-supportive-pastel": theme === THEME.photography && style !== 2 /* LIGHT */
100
+ },
101
+ // transparent theme
102
+ {
103
+ "text-gray-black hover:text-gray-black": theme === THEME.transparent && style === 2 /* LIGHT */,
104
+ "text-gray-200 hover:text-gray-200": theme === THEME.transparent && style !== 2 /* LIGHT */
105
+ }
106
+ ];
107
+ };
108
+ var getContainerTheme = (theme, style) => {
109
+ return [
110
+ // default theme
111
+ {
112
+ "text-gray-600 hover:text-gray-800": style === 2 /* LIGHT */,
113
+ "text-gray-800 hover:text-brand-heavy": style === 1 /* DARK */,
114
+ "text-brand-heavy hover:text-brand-dark": style === 0 /* BRAND */
115
+ },
116
+ // photography
117
+ {
118
+ "text-gray-300 hover:text-gray-400": theme === THEME.photography && style === 2 /* LIGHT */,
119
+ "text-gray-white hover:text-supportive-pastel": theme === THEME.photography && style === 1 /* DARK */,
120
+ "text-supportive-faded hover:text-supportive-pastel": theme === THEME.photography && style === 0 /* BRAND */
121
+ },
122
+ // transparent theme
123
+ {
124
+ "text-gray-800 hover:text-gray-black": theme === THEME.transparent && style === 2 /* LIGHT */,
125
+ "text-gray-white hover:text-gray-200": theme === THEME.transparent && style !== 2 /* LIGHT */
126
+ }
127
+ ];
128
+ };
76
129
  var TextButton = ({
77
130
  text,
78
131
  leftIconComponent,
@@ -86,9 +139,13 @@ var TextButton = ({
86
139
  className = ""
87
140
  }) => {
88
141
  const TextJSX = react.useMemo(
89
- () => size === 0 /* S */ ? /* @__PURE__ */ jsxRuntime.jsx(P2, { text }) : /* @__PURE__ */ jsxRuntime.jsx(P1, { text }),
142
+ () => size === 0 /* S */ ? /* @__PURE__ */ jsxRuntime.jsx(P2, { text, weight: P2.Weight.bold }) : /* @__PURE__ */ jsxRuntime.jsx(P1, { text, weight: P1.Weight.bold }),
90
143
  [size, text]
91
144
  );
145
+ const themeClass = react.useMemo(() => {
146
+ const themeFunc = disabled ? getDisabledContainerTheme : active ? getActiveContainerTheme : getContainerTheme;
147
+ return themeFunc(theme, style);
148
+ }, [disabled, active, theme, style]);
92
149
  return /* @__PURE__ */ jsxRuntime.jsx(
93
150
  "div",
94
151
  {
@@ -98,18 +155,7 @@ var TextButton = ({
98
155
  "cursor-default": disabled,
99
156
  "cursor-pointer": !disabled
100
157
  },
101
- {
102
- "text-gray-500 hover:text-gray-500": disabled && (theme === THEME.photography || theme === THEME.transparent),
103
- "text-gray-400 hover:text-gray-400": disabled || theme === THEME.photography && style === 2 /* LIGHT */ && !active && !disabled,
104
- "text-gray-200 hover:text-supportive-pastel": theme === THEME.photography && !active && !disabled,
105
- "text-gray-300 hover:text-gray-400": theme === THEME.photography && style === 2 /* LIGHT */ && active && !disabled,
106
- "text-gray-white hover:text-supportive-pastel": theme === THEME.photography && style === 1 /* DARK */ && active && !disabled,
107
- "text-supportive-faded hover:text-supportive-pastel": theme === THEME.photography && style === 0 /* BRAND */ && active && !disabled,
108
- "text-gray-100 hover:text-gray-200": theme === THEME.transparent && !active && !disabled,
109
- "text-gray-white hover:text-gray-white": theme === THEME.transparent && active && !disabled,
110
- "text-gray-600 hover:text-brand-heavy": theme === THEME.normal && !active && !disabled,
111
- "text-brand-heavy hover:text-brand-heavy": theme === THEME.normal && active && !disabled
112
- },
158
+ themeClass,
113
159
  className
114
160
  ),
115
161
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex justify-center items-center", children: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/text/enum/index.ts","../../src/text/paragraph.tsx","../../src/button/enum.ts","../../src/button/constant.ts","../../src/button/components/text-button/index.tsx","../../src/button/index.ts"],"names":["jsx","clsx","Size","Style","useMemo","jsxs"],"mappings":";;;;;;;;;;;;;;;AASO,IAAM,MAAA,GAAS;AAAA,EACpB,UAAA,EAAY,aAAA;AAAA,EACZ,MAAA,EAAQ,QAAA;AAAA,EACR,IAAA,EAAM;AACR,CAAA;ACHA,IAAM,SAAA,GAAY,mDAAA;AAElB,IAAM,YAAA,GAAe;AAAA,EACnB,EAAA,EAAI,aAAA;AAAA,EACJ,EAAA,EAAI,aAAA;AAAA,EACJ,EAAA,EAAI,aAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AAEA,IAAM,gBAAA,GAAmB,CAAC,OAAA,KAAuC;AAC/D,EAAA,MAAM,YAAkE,CAAC;AAAA,IACvE,IAAA,GAAO,EAAA;AAAA,IACP,SAAS,MAAA,CAAO,MAAA;AAAA,IAChB,SAAA,GAAY,EAAA;AAAA,IACZ,GAAG;AAAA,GACL,qBACEA,cAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAWC,sBAAA;AAAA,QACT,SAAA;AAAA,QACA,aAAa,OAAO,CAAA;AAAA,QACpB,QAAQ,MAAM,CAAA,CAAA;AAAA,QACd;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA;AAAA,GACH;AAEF,EAAA,SAAA,CAAU,WAAA,GAAc,OAAA;AACxB,EAAA,SAAA,CAAU,M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'\n\nexport const TYPE = {\n default: 'default',\n article: 'article',\n} as const\n\nexport type Type = ValuesOf<typeof TYPE>\n\nexport const WEIGHT = {\n extraLight: 'extra-light',\n normal: 'normal',\n bold: 'bold',\n} as const\n\nexport type Weight = ValuesOf<typeof WEIGHT>\n","import clsx from 'clsx'\nimport type React from 'react'\nimport { WEIGHT, type Weight } from './enum'\n\ntype ParagraphProps = React.HTMLAttributes<HTMLParagraphElement> & {\n text?: string\n weight?: Weight\n className?: string\n}\n\nconst baseClass = 'font-default leading-[150%] flex items-center m-0'\n\nconst variantClass = {\n P1: 'text-[16px]',\n P2: 'text-[14px]',\n P3: 'text-[12px]',\n P4: 'text-[10px]',\n}\n\nconst ParagraphVariant = (variant: keyof typeof variantClass) => {\n const Component: React.FC<ParagraphProps> & { Weight: typeof WEIGHT } = ({\n text = '',\n weight = WEIGHT.normal,\n className = '',\n ...props\n }) => (\n <p\n className={clsx(\n baseClass,\n variantClass[variant],\n `font-${weight}`,\n className\n )}\n {...props}\n >\n {text}\n </p>\n )\n Component.displayName = variant\n Component.Weight = WEIGHT\n return Component\n}\n\nconst P1 = ParagraphVariant('P1')\nconst P2 = ParagraphVariant('P2')\nconst P3 = ParagraphVariant('P3')\nconst P4 = ParagraphVariant('P4')\n\nexport { P1, P2, P3, P4 }\n","export enum Size {\n S,\n L,\n}\n\nexport enum Style {\n BRAND,\n DARK,\n LIGHT,\n}\n","import type { ValuesOf } from '../types'\n\nexport const THEME = {\n normal: 'normal',\n photography: 'photography',\n transparent: 'transparent',\n index: 'index',\n} as const\n\nexport type Theme = ValuesOf<typeof THEME>\n","import { type FC, type ReactElement, useMemo } from 'react'\nimport clsx from 'clsx'\n// components\nimport { P1, P2 } from '../../../text/paragraph'\n// enums\nimport { Size, Style } from '../../enum'\n// type\nimport type { Theme } from '../../constant'\n// constants\nimport { THEME } from '../../constant'\n\ntype TextButtonProps = {\n text: string\n leftIconComponent?: ReactElement\n rightIconComponent?: ReactElement\n size?: Size\n style?: Style\n theme?: Theme\n active?: boolean\n disabled?: boolean\n loading?: boolean\n className?: string\n}\nconst TextButton: FC<TextButtonProps> & {\n Size: typeof Size\n Style: typeof Style\n THEME: typeof THEME\n} = ({\n text,\n leftIconComponent,\n rightIconComponent,\n size = Size.S,\n theme = THEME.normal,\n style = Style.DARK,\n active = false,\n disabled = false,\n loading = false,\n className = '',\n}) => {\n const TextJSX = useMemo(\n () => (size === Size.S ? <P2 text={text} /> : <P1 text={text} />),\n [size, text]\n )\n\n return (\n <div\n className={clsx(\n 'flex items-center',\n {\n 'cursor-default': disabled,\n 'cursor-pointer': !disabled,\n },\n {\n 'text-gray-500 hover:text-gray-500':\n disabled &&\n (theme === THEME.photography || theme === THEME.transparent),\n 'text-gray-400 hover:text-gray-400':\n disabled ||\n (theme === THEME.photography &&\n style === Style.LIGHT &&\n !active &&\n !disabled),\n 'text-gray-200 hover:text-supportive-pastel':\n theme === THEME.photography && !active && !disabled,\n 'text-gray-300 hover:text-gray-400':\n theme === THEME.photography &&\n style === Style.LIGHT &&\n active &&\n !disabled,\n 'text-gray-white hover:text-supportive-pastel':\n theme === THEME.photography &&\n style === Style.DARK &&\n active &&\n !disabled,\n 'text-supportive-faded hover:text-supportive-pastel':\n theme === THEME.photography &&\n style === Style.BRAND &&\n active &&\n !disabled,\n 'text-gray-100 hover:text-gray-200':\n theme === THEME.transparent && !active && !disabled,\n 'text-gray-white hover:text-gray-white':\n theme === THEME.transparent && active && !disabled,\n 'text-gray-600 hover:text-brand-heavy':\n theme === THEME.normal && !active && !disabled,\n 'text-brand-heavy hover:text-brand-heavy':\n theme === THEME.normal && active && !disabled,\n },\n className\n )}\n >\n <div className=\"relative flex justify-center items-center\">\n <div\n className={clsx('flex justify-center items-center', {\n 'opacity-0': loading,\n 'opacity-100': !loading,\n })}\n >\n <div className=\"flex items-center mr-[4px]\">{leftIconComponent}</div>\n {TextJSX}\n <div className=\"flex items-center ml-[4px]\">{rightIconComponent}</div>\n </div>\n <span\n className={clsx(\n 'inline-block absolute box-border animation-spin',\n 'border-2 border-solid border-gray-400 border-t-gray-600 rounded-[50%]',\n {\n 'size-[18px]': size === Size.S,\n 'size-[24px]': size === Size.L,\n },\n {\n 'opacity-0': !loading,\n 'opacity-100': loading,\n }\n )}\n />\n </div>\n </div>\n )\n}\nTextButton.Size = Size\nTextButton.Style = Style\nTextButton.THEME = THEME\n\nexport default TextButton\n","import TextButton from './components/text-button'\n\nexport { TextButton }\n\nexport default { TextButton }\n"]}
1
+ {"version":3,"sources":["../../src/text/enum/index.ts","../../src/text/paragraph.tsx","../../src/button/enum.ts","../../src/button/constant.ts","../../src/button/components/text-button/theme.ts","../../src/button/components/text-button/index.tsx","../../src/button/index.ts"],"names":["jsx","clsx","Size","Style","useMemo","jsxs"],"mappings":";;;;;;;;;;;;;;;AASO,IAAM,MAAA,GAAS;AAAA,EACpB,UAAA,EAAY,aAAA;AAAA,EACZ,MAAA,EAAQ,QAAA;AAAA,EACR,IAAA,EAAM;AACR,CAAA;ACHA,IAAM,SAAA,GAAY,mDAAA;AAElB,IAAM,YAAA,GAAe;AAAA,EACnB,EAAA,EAAI,aAAA;AAAA,EACJ,EAAA,EAAI,aAAA;AAAA,EACJ,EAAA,EAAI,aAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AAEA,IAAM,gBAAA,GAAmB,CAAC,OAAA,KAAuC;AAC/D,EAAA,MAAM,YAAkE,CAAC;AAAA,IACvE,IAAA,GAAO,EAAA;AAAA,IACP,SAAS,MAAA,CAAO,MAAA;AAAA,IAChB,SAAA,GAAY,EAAA;AAAA,IACZ,GAAG;AAAA,GACL,qBACEA,cAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAWC,sBAAA;AAAA,QACT,SAAA;AAAA,QACA,aAAa,OAAO,CAAA;AAAA,QACpB,QAAQ,MAAM,CAAA,CAAA;AAAA,QACd;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA;AAAA,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OACF;AAAA,MAEA,QAAA,kBAAAI,eAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,2CAAA,EACb,QAAA,EAAA;AAAA,wBAAAA,eAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAWJ,uBAAK,kCAAA,EAAoC;AAAA,cAClD,WAAA,EAAa,OAAA;AAAA,cACb,eAAe,CAAC;AAAA,aACjB,CAAA;AAAA,YAED,QAAA,EAAA;AAAA,8BAAAD,cAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,4BAAA,EAA8B,QAAA,EAAA,iBAAA,EAAkB,CAAA;AAAA,cAC9D,OAAA;AAAA,8BACDA,cAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,8BAA8B,QAAA,EAAA,kBAAA,EAAmB;AAAA;AAAA;AAAA,SAClE;AAAA,wBACAA,cAAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAWC,sBAAAA;AAAA,cACT,iDAAA;AAAA,cACA,uEAAA;AAAA,cACA;AAAA,gBACE,aAAA,EAAe,IAAA,KAAA,CAAA;AAAA,gBACf,aAAA,EAAe,IAAA,KAAA,CAAA;AAAA,eACjB;AAAA,cACA;AAAA,gBACE,aAAa,CAAC,OAAA;AAAA,gBACd,aAAA,EAAe;AAAA;AACjB;AACF;AAAA;AACF,OAAA,EACF;AAAA;AAAA,GACF;AAEJ,CAAA;AACA,UAAA,CAAW,IAAA,GAAO,IAAA;AAClB,UAAA,CAAW,KAAA,GAAQ,KAAA;AACnB,UAAA,CAAW,KAAA,GAAQ,KAAA;AAEnB,IAAO,mBAAA,GAAQ;;;AC3Ff,IAAO,cAAA,GAAQ,EAAE,UAAA,EAAA,mBAAA","file":"index.js","sourcesContent":["import type { ValuesOf } from '../../types'\n\nexport const TYPE = {\n default: 'default',\n article: 'article',\n} as const\n\nexport type Type = ValuesOf<typeof TYPE>\n\nexport const WEIGHT = {\n extraLight: 'extra-light',\n normal: 'normal',\n bold: 'bold',\n} as const\n\nexport type Weight = ValuesOf<typeof WEIGHT>\n","import clsx from 'clsx'\nimport type React from 'react'\nimport { WEIGHT, type Weight } from './enum'\n\ntype ParagraphProps = React.HTMLAttributes<HTMLParagraphElement> & {\n text?: string\n weight?: Weight\n className?: string\n}\n\nconst baseClass = 'font-default leading-[150%] flex items-center m-0'\n\nconst variantClass = {\n P1: 'text-[16px]',\n P2: 'text-[14px]',\n P3: 'text-[12px]',\n P4: 'text-[10px]',\n}\n\nconst ParagraphVariant = (variant: keyof typeof variantClass) => {\n const Component: React.FC<ParagraphProps> & { Weight: typeof WEIGHT } = ({\n text = '',\n weight = WEIGHT.normal,\n className = '',\n ...props\n }) => (\n <p\n className={clsx(\n baseClass,\n variantClass[variant],\n `font-${weight}`,\n className\n )}\n {...props}\n >\n {text}\n </p>\n )\n Component.displayName = variant\n Component.Weight = WEIGHT\n return Component\n}\n\nconst P1 = ParagraphVariant('P1')\nconst P2 = ParagraphVariant('P2')\nconst P3 = ParagraphVariant('P3')\nconst P4 = ParagraphVariant('P4')\n\nexport { P1, P2, P3, P4 }\n","export enum Size {\n S,\n L,\n}\n\nexport enum Style {\n BRAND,\n DARK,\n LIGHT,\n}\n","import type { ValuesOf } from '../types'\n\nexport const THEME = {\n normal: 'normal',\n photography: 'photography',\n transparent: 'transparent',\n index: 'index',\n} as const\n\nexport type Theme = ValuesOf<typeof THEME>\n","// constants\nimport { THEME } from '../../constant'\n// type\nimport type { Theme } from '../../constant'\nimport type { ClassArray } from 'clsx'\n// enum\nimport { Style } from '../../enum'\n\ntype ThemeFunc = (theme: Theme, style?: Style) => ClassArray\n\nexport const getDisabledContainerTheme: ThemeFunc = (theme) => {\n return [\n // default theme\n 'text-gray-400 hover:text-gray-400',\n // photography & transparent theme\n {\n 'text-gray-500 hover:text-gray-500': theme === THEME.photography || theme === THEME.transparent,\n }\n ]\n}\n\nexport const getActiveContainerTheme: ThemeFunc = (theme, style) => {\n return [\n // default theme\n {\n 'text-gray-800 hover:text-gray-800': style === Style.LIGHT,\n 'text-brand-heavy hover:text-brand-heavy': style === Style.DARK,\n 'text-brand-dark hover:text-brand-dark': style === Style.BRAND,\n },\n // photography theme\n {\n 'text-gray-400 hover:text-gray-400': theme === THEME.photography && style === Style.LIGHT,\n 'text-supportive-pastel hover:text-supportive-pastel': theme === THEME.photography && style !== Style.LIGHT,\n },\n // transparent theme\n {\n 'text-gray-black hover:text-gray-black': theme === THEME.transparent && style === Style.LIGHT,\n 'text-gray-200 hover:text-gray-200': theme === THEME.transparent && style !== Style.LIGHT,\n },\n ]\n}\n\nexport const getContainerTheme: ThemeFunc = (theme, style) => {\n return [\n // default theme\n {\n 'text-gray-600 hover:text-gray-800': style === Style.LIGHT,\n 'text-gray-800 hover:text-brand-heavy': style === Style.DARK,\n 'text-brand-heavy hover:text-brand-dark': style === Style.BRAND,\n },\n // photography\n {\n 'text-gray-300 hover:text-gray-400': theme === THEME.photography && style === Style.LIGHT,\n 'text-gray-white hover:text-supportive-pastel': theme === THEME.photography && style === Style.DARK,\n 'text-supportive-faded hover:text-supportive-pastel': theme === THEME.photography && style === Style.BRAND,\n },\n // transparent theme\n {\n 'text-gray-800 hover:text-gray-black': theme === THEME.transparent && style === Style.LIGHT,\n 'text-gray-white hover:text-gray-200': theme === THEME.transparent && style !== Style.LIGHT,\n },\n ]\n}","import { type FC, type ReactElement, useMemo } from 'react'\nimport clsx from 'clsx'\n// components\nimport { P1, P2 } from '../../../text/paragraph'\n// enums\nimport { Size, Style } from '../../enum'\n// type\nimport type { Theme } from '../../constant'\n// constants\nimport { THEME } from '../../constant'\n// utils\nimport { getContainerTheme, getActiveContainerTheme, getDisabledContainerTheme } from './theme'\n\ntype TextButtonProps = {\n text: string\n leftIconComponent?: ReactElement\n rightIconComponent?: ReactElement\n size?: Size\n style?: Style\n theme?: Theme\n active?: boolean\n disabled?: boolean\n loading?: boolean\n className?: string\n}\nconst TextButton: FC<TextButtonProps> & {\n Size: typeof Size\n Style: typeof Style\n THEME: typeof THEME\n} = ({\n text,\n leftIconComponent,\n rightIconComponent,\n size = Size.S,\n theme = THEME.normal,\n style = Style.DARK,\n active = false,\n disabled = false,\n loading = false,\n className = '',\n}) => {\n const TextJSX = useMemo(\n () => (size === Size.S ? <P2 text={text} weight={P2.Weight.bold} /> : <P1 text={text} weight={P1.Weight.bold} />),\n [size, text]\n )\n const themeClass = useMemo(() => {\n const themeFunc = disabled ? getDisabledContainerTheme : (active ? getActiveContainerTheme : getContainerTheme)\n return themeFunc(theme, style)\n }, [disabled, active, theme, style])\n\n return (\n <div\n className={clsx(\n 'flex items-center',\n {\n 'cursor-default': disabled,\n 'cursor-pointer': !disabled,\n },\n themeClass,\n className\n )}\n >\n <div className=\"relative flex justify-center items-center\">\n <div\n className={clsx('flex justify-center items-center', {\n 'opacity-0': loading,\n 'opacity-100': !loading,\n })}\n >\n <div className=\"flex items-center mr-[4px]\">{leftIconComponent}</div>\n {TextJSX}\n <div className=\"flex items-center ml-[4px]\">{rightIconComponent}</div>\n </div>\n <span\n className={clsx(\n 'inline-block absolute box-border animation-spin',\n 'border-2 border-solid border-gray-400 border-t-gray-600 rounded-[50%]',\n {\n 'size-[18px]': size === Size.S,\n 'size-[24px]': size === Size.L,\n },\n {\n 'opacity-0': !loading,\n 'opacity-100': loading,\n }\n )}\n />\n </div>\n </div>\n )\n}\nTextButton.Size = Size\nTextButton.Style = Style\nTextButton.THEME = THEME\n\nexport default TextButton\n","import TextButton from './components/text-button'\n\nexport { TextButton }\n\nexport default { TextButton }\n"]}
@@ -1,5 +1,6 @@
1
- export { button_default as default } from '../chunk-7DK5MO62.mjs';
2
- export { text_button_default as TextButton } from '../chunk-QE5LVT7A.mjs';
1
+ export { button_default as default } from '../chunk-ELECTE3D.mjs';
2
+ export { text_button_default as TextButton } from '../chunk-U22UKMAJ.mjs';
3
+ import '../chunk-FVKIUNIP.mjs';
3
4
  import '../chunk-HQG6Q2EY.mjs';
4
5
  import '../chunk-UM7RNC2Y.mjs';
5
6
  import '../chunk-JB4TYHDE.mjs';
@@ -96,6 +96,59 @@ var THEME = {
96
96
  transparent: "transparent",
97
97
  index: "index"
98
98
  };
99
+
100
+ // src/button/components/text-button/theme.ts
101
+ var getDisabledContainerTheme = (theme) => {
102
+ return [
103
+ // default theme
104
+ "text-gray-400 hover:text-gray-400",
105
+ // photography & transparent theme
106
+ {
107
+ "text-gray-500 hover:text-gray-500": theme === THEME.photography || theme === THEME.transparent
108
+ }
109
+ ];
110
+ };
111
+ var getActiveContainerTheme = (theme, style) => {
112
+ return [
113
+ // default theme
114
+ {
115
+ "text-gray-800 hover:text-gray-800": style === 2 /* LIGHT */,
116
+ "text-brand-heavy hover:text-brand-heavy": style === 1 /* DARK */,
117
+ "text-brand-dark hover:text-brand-dark": style === 0 /* BRAND */
118
+ },
119
+ // photography theme
120
+ {
121
+ "text-gray-400 hover:text-gray-400": theme === THEME.photography && style === 2 /* LIGHT */,
122
+ "text-supportive-pastel hover:text-supportive-pastel": theme === THEME.photography && style !== 2 /* LIGHT */
123
+ },
124
+ // transparent theme
125
+ {
126
+ "text-gray-black hover:text-gray-black": theme === THEME.transparent && style === 2 /* LIGHT */,
127
+ "text-gray-200 hover:text-gray-200": theme === THEME.transparent && style !== 2 /* LIGHT */
128
+ }
129
+ ];
130
+ };
131
+ var getContainerTheme = (theme, style) => {
132
+ return [
133
+ // default theme
134
+ {
135
+ "text-gray-600 hover:text-gray-800": style === 2 /* LIGHT */,
136
+ "text-gray-800 hover:text-brand-heavy": style === 1 /* DARK */,
137
+ "text-brand-heavy hover:text-brand-dark": style === 0 /* BRAND */
138
+ },
139
+ // photography
140
+ {
141
+ "text-gray-300 hover:text-gray-400": theme === THEME.photography && style === 2 /* LIGHT */,
142
+ "text-gray-white hover:text-supportive-pastel": theme === THEME.photography && style === 1 /* DARK */,
143
+ "text-supportive-faded hover:text-supportive-pastel": theme === THEME.photography && style === 0 /* BRAND */
144
+ },
145
+ // transparent theme
146
+ {
147
+ "text-gray-800 hover:text-gray-black": theme === THEME.transparent && style === 2 /* LIGHT */,
148
+ "text-gray-white hover:text-gray-200": theme === THEME.transparent && style !== 2 /* LIGHT */
149
+ }
150
+ ];
151
+ };
99
152
  var TextButton = ({
100
153
  text,
101
154
  leftIconComponent,
@@ -109,9 +162,13 @@ var TextButton = ({
109
162
  className = ""
110
163
  }) => {
111
164
  const TextJSX = react.useMemo(
112
- () => size === 0 /* S */ ? /* @__PURE__ */ jsxRuntime.jsx(P2, { text }) : /* @__PURE__ */ jsxRuntime.jsx(P1, { text }),
165
+ () => size === 0 /* S */ ? /* @__PURE__ */ jsxRuntime.jsx(P2, { text, weight: P2.Weight.bold }) : /* @__PURE__ */ jsxRuntime.jsx(P1, { text, weight: P1.Weight.bold }),
113
166
  [size, text]
114
167
  );
168
+ const themeClass = react.useMemo(() => {
169
+ const themeFunc = disabled ? getDisabledContainerTheme : active ? getActiveContainerTheme : getContainerTheme;
170
+ return themeFunc(theme, style);
171
+ }, [disabled, active, theme, style]);
115
172
  return /* @__PURE__ */ jsxRuntime.jsx(
116
173
  "div",
117
174
  {
@@ -121,18 +178,7 @@ var TextButton = ({
121
178
  "cursor-default": disabled,
122
179
  "cursor-pointer": !disabled
123
180
  },
124
- {
125
- "text-gray-500 hover:text-gray-500": disabled && (theme === THEME.photography || theme === THEME.transparent),
126
- "text-gray-400 hover:text-gray-400": disabled || theme === THEME.photography && style === 2 /* LIGHT */ && !active && !disabled,
127
- "text-gray-200 hover:text-supportive-pastel": theme === THEME.photography && !active && !disabled,
128
- "text-gray-300 hover:text-gray-400": theme === THEME.photography && style === 2 /* LIGHT */ && active && !disabled,
129
- "text-gray-white hover:text-supportive-pastel": theme === THEME.photography && style === 1 /* DARK */ && active && !disabled,
130
- "text-supportive-faded hover:text-supportive-pastel": theme === THEME.photography && style === 0 /* BRAND */ && active && !disabled,
131
- "text-gray-100 hover:text-gray-200": theme === THEME.transparent && !active && !disabled,
132
- "text-gray-white hover:text-gray-white": theme === THEME.transparent && active && !disabled,
133
- "text-gray-600 hover:text-brand-heavy": theme === THEME.normal && !active && !disabled,
134
- "text-brand-heavy hover:text-brand-heavy": theme === THEME.normal && active && !disabled
135
- },
181
+ themeClass,
136
182
  className
137
183
  ),
138
184
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex justify-center items-center", children: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/storybook/utils/get-enum-arg.ts","../../../src/text/enum/index.ts","../../../src/text/paragraph.tsx","../../../src/button/enum.ts","../../../src/button/constant.ts","../../../src/button/components/text-button/index.tsx","../../../src/button/stories/text-button.stories.ts"],"names":["jsx","clsx","Size","Style","useMemo","jsxs"],"mappings":";;;;;;;;;;;;;AAMO,SAAS,qBAAA,CACd,QACA,YAAA,EACmB;AACnB,EAAA,OAAO;AAAA,IACL,YAAA;AAAA,IACA,OAAA,EAAS,MAAA,CAAO,MAAA,CAAO,MAAM,CAAA;AAAA,IAC7B,OAAA,EAAS,EAAE,IAAA,EAAM,OAAA;AAAQ,GAC3B;AACF;AASO,SAAS,mBAAA,CACd,YACA,YAAA,EAC0B;AAE1B,EAAA,MAAM,IAAA,GAAO,MAAA,CAAO,IAAA,CAAK,UAAU,CAAA,CAAE,MAAA;AAAA,IAAO,CAAC,GAAA,KAC3C,MAAA,CAAO,KAAA,CAAM,MAAA,CAAO,GAAG,CAAC;AAAA,GAC1B;AAEA,EAAA,MAAM,UAAsC,EAAC;AAC7C,EAAA,IAAA,CAAK,OAAA,CAAQ,CAAC,GAAA,KAAQ;AACpB,IAAA,OAAA,CAAQ,GAAG,CAAA,GAAI,UAAA,CAAW,GAAc,CAAA;AAAA,EAC1C,CAAC,CAAA;AAGD,EAAA,MAAM,UAAA,GACJ,IAAA,CAAK,IAAA,CAAK,CAAC,GAAA,KAAQ,UAAA,CAAW,GAAc,CAAA,KAAM,YAAY,CAAA,IAAK,IAAA,CAAK,CAAC,CAAA;AAE3E,EAAA,OAAO;AAAA,IACL,YAAA,EAAc,WAAW,UAA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;AAEtE,CAAA;AAEA,IAAO,2BAAA,GAAQ;AAGR,IAAM,KAAA,GAAe;AAAA,EAC1B,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM,cAAA;AAAA,IACN,IAAA,EAAM,oBAAW,IAAA,CAAK,CAAA;AAAA,IACtB,KAAA,EAAO,oBAAW,KAAA,CAAM,MAAA;AAAA,IACxB,KAAA,EAAO,oBAAW,KAAA,CAAM,IAAA;AAAA,IACxB,MAAA,EAAQ,KAAA;AAAA,IACR,QAAA,EAAU,KAAA;AAAA,IACV,OAAA,EAAS;AAAA,GACX;AAAA,EACA,UAAA,EAAY,EAAE,QAAA,EAAU,EAAE,SAAS,CAAC,WAAW,GAAE;AACnD","file":"text-button.stories.js","sourcesContent":["type RadioArgObject<T> = {\n defaultValue: T\n options: T[]\n control: { type: 'radio' }\n}\n\nexport function getRadioArgFromObject<T extends string | number>(\n object: Record<string, T>,\n defaultValue: T\n): RadioArgObject<T> {\n return {\n defaultValue,\n options: Object.values(object),\n control: { type: 'radio' },\n }\n}\n\ntype RadioArgEnum<E> = {\n defaultValue: E\n options: string[]\n mapping: Record<string, E>\n control: { type: 'radio' }\n}\n\nexport function getRadioArgFromEnum<E extends Record<string, string | number>>(\n enumObject: E,\n defaultValue: E[keyof E]\n): RadioArgEnum<E[keyof E]> {\n // Only keep \"real\" keys (filter numeric reverse mapping)\n const keys = Object.keys(enumObject).filter((key) =>\n Number.isNaN(Number(key))\n )\n\n const mapping: Record<string, E[keyof E]> = {}\n keys.forEach((key) => {\n mapping[key] = enumObject[key as keyof E]\n })\n\n // Find the key corresponding to the default value\n const defaultKey =\n keys.find((key) => enumObject[key as keyof E] === defaultValue) || keys[0]\n\n return {\n defaultValue: enumObject[defaultKey as keyof E],\n options: keys,\n mapping,\n control: { type: 'radio' },\n }\n}\n","import type { ValuesOf } from '../../types'\n\nexport const TYPE = {\n default: 'default',\n article: 'article',\n} as const\n\nexport type Type = ValuesOf<typeof TYPE>\n\nexport const WEIGHT = {\n extraLight: 'extra-light',\n normal: 'normal',\n bold: 'bold',\n} as const\n\nexport type Weight = ValuesOf<typeof WEIGHT>\n","import clsx from 'clsx'\nimport type React from 'react'\nimport { WEIGHT, type Weight } from './enum'\n\ntype ParagraphProps = React.HTMLAttributes<HTMLParagraphElement> & {\n text?: string\n weight?: Weight\n className?: string\n}\n\nconst baseClass = 'font-default leading-[150%] flex items-center m-0'\n\nconst variantClass = {\n P1: 'text-[16px]',\n P2: 'text-[14px]',\n P3: 'text-[12px]',\n P4: 'text-[10px]',\n}\n\nconst ParagraphVariant = (variant: keyof typeof variantClass) => {\n const Component: React.FC<ParagraphProps> & { Weight: typeof WEIGHT } = ({\n text = '',\n weight = WEIGHT.normal,\n className = '',\n ...props\n }) => (\n <p\n className={clsx(\n baseClass,\n variantClass[variant],\n `font-${weight}`,\n className\n )}\n {...props}\n >\n {text}\n </p>\n )\n Component.displayName = variant\n Component.Weight = WEIGHT\n return Component\n}\n\nconst P1 = ParagraphVariant('P1')\nconst P2 = ParagraphVariant('P2')\nconst P3 = ParagraphVariant('P3')\nconst P4 = ParagraphVariant('P4')\n\nexport { P1, P2, P3, P4 }\n","export enum Size {\n S,\n L,\n}\n\nexport enum Style {\n BRAND,\n DARK,\n LIGHT,\n}\n","import type { ValuesOf } from '../types'\n\nexport const THEME = {\n normal: 'normal',\n photography: 'photography',\n transparent: 'transparent',\n index: 'index',\n} as const\n\nexport type Theme = ValuesOf<typeof THEME>\n","import { type FC, type ReactElement, useMemo } from 'react'\nimport clsx from 'clsx'\n// components\nimport { P1, P2 } from '../../../text/paragraph'\n// enums\nimport { Size, Style } from '../../enum'\n// type\nimport type { Theme } from '../../constant'\n// constants\nimport { THEME } from '../../constant'\n\ntype TextButtonProps = {\n text: string\n leftIconComponent?: ReactElement\n rightIconComponent?: ReactElement\n size?: Size\n style?: Style\n theme?: Theme\n active?: boolean\n disabled?: boolean\n loading?: boolean\n className?: string\n}\nconst TextButton: FC<TextButtonProps> & {\n Size: typeof Size\n Style: typeof Style\n THEME: typeof THEME\n} = ({\n text,\n leftIconComponent,\n rightIconComponent,\n size = Size.S,\n theme = THEME.normal,\n style = Style.DARK,\n active = false,\n disabled = false,\n loading = false,\n className = '',\n}) => {\n const TextJSX = useMemo(\n () => (size === Size.S ? <P2 text={text} /> : <P1 text={text} />),\n [size, text]\n )\n\n return (\n <div\n className={clsx(\n 'flex items-center',\n {\n 'cursor-default': disabled,\n 'cursor-pointer': !disabled,\n },\n {\n 'text-gray-500 hover:text-gray-500':\n disabled &&\n (theme === THEME.photography || theme === THEME.transparent),\n 'text-gray-400 hover:text-gray-400':\n disabled ||\n (theme === THEME.photography &&\n style === Style.LIGHT &&\n !active &&\n !disabled),\n 'text-gray-200 hover:text-supportive-pastel':\n theme === THEME.photography && !active && !disabled,\n 'text-gray-300 hover:text-gray-400':\n theme === THEME.photography &&\n style === Style.LIGHT &&\n active &&\n !disabled,\n 'text-gray-white hover:text-supportive-pastel':\n theme === THEME.photography &&\n style === Style.DARK &&\n active &&\n !disabled,\n 'text-supportive-faded hover:text-supportive-pastel':\n theme === THEME.photography &&\n style === Style.BRAND &&\n active &&\n !disabled,\n 'text-gray-100 hover:text-gray-200':\n theme === THEME.transparent && !active && !disabled,\n 'text-gray-white hover:text-gray-white':\n theme === THEME.transparent && active && !disabled,\n 'text-gray-600 hover:text-brand-heavy':\n theme === THEME.normal && !active && !disabled,\n 'text-brand-heavy hover:text-brand-heavy':\n theme === THEME.normal && active && !disabled,\n },\n className\n )}\n >\n <div className=\"relative flex justify-center items-center\">\n <div\n className={clsx('flex justify-center items-center', {\n 'opacity-0': loading,\n 'opacity-100': !loading,\n })}\n >\n <div className=\"flex items-center mr-[4px]\">{leftIconComponent}</div>\n {TextJSX}\n <div className=\"flex items-center ml-[4px]\">{rightIconComponent}</div>\n </div>\n <span\n className={clsx(\n 'inline-block absolute box-border animation-spin',\n 'border-2 border-solid border-gray-400 border-t-gray-600 rounded-[50%]',\n {\n 'size-[18px]': size === Size.S,\n 'size-[24px]': size === Size.L,\n },\n {\n 'opacity-0': !loading,\n 'opacity-100': loading,\n }\n )}\n />\n </div>\n </div>\n )\n}\nTextButton.Size = Size\nTextButton.Style = Style\nTextButton.THEME = THEME\n\nexport default TextButton\n","import type { Meta, StoryObj } from '@storybook/react-vite'\n// utils\nimport {\n getRadioArgFromObject,\n getRadioArgFromEnum,\n} from '../../storybook/utils/get-enum-arg'\n// components\nimport TextButton from '../components/text-button'\n\nconst meta = {\n title: 'Button/TextButton',\n component: TextButton,\n argTypes: {\n size: getRadioArgFromEnum(TextButton.Size, TextButton.Size.S),\n theme: getRadioArgFromObject(TextButton.THEME, TextButton.THEME.normal),\n style: getRadioArgFromEnum(TextButton.Style, TextButton.Style.DARK),\n },\n} satisfies Meta<typeof TextButton>\n\nexport default meta\ntype Story = StoryObj<typeof meta>\n\nexport const Basic: Story = {\n args: {\n text: '文字',\n size: TextButton.Size.S,\n theme: TextButton.THEME.normal,\n style: TextButton.Style.DARK,\n active: false,\n disabled: false,\n loading: false,\n },\n parameters: { controls: { exclude: ['className'] } },\n}\n"]}
1
+ {"version":3,"sources":["../../../src/storybook/utils/get-enum-arg.ts","../../../src/text/enum/index.ts","../../../src/text/paragraph.tsx","../../../src/button/enum.ts","../../../src/button/constant.ts","../../../src/button/components/text-button/theme.ts","../../../src/button/components/text-button/index.tsx","../../../src/button/stories/text-button.stories.ts"],"names":["jsx","clsx","Size","Style","useMemo","jsxs"],"mappings":";;;;;;;;;;;;;AAMO,SAAS,qBAAA,CACd,QACA,YAAA,EACmB;AACnB,EAAA,OAAO;AAAA,IACL,YAAA;AAAA,IACA,OAAA,EAAS,MAAA,CAAO,MAAA,CAAO,MAAM,CAAA;AAAA,IAC7B,OAAA,EAAS,EAAE,IAAA,EAAM,OAAA;AAAQ,GAC3B;AACF;AASO,SAAS,mBAAA,CACd,YACA,YAAA,EAC0B;AAE1B,EAAA,MAAM,IAAA,GAAO,MAAA,CAAO,IAAA,CAAK,UAAU,CAAA,CAAE,MAA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A,EACX,QAAA,EAAU;AAAA,IACR,MAAM,mBAAA,CAAoB,mBAAA,CAAW,IAAA,EAAM,mBAAA,CAAW,KAAK,CAAC,CAAA;AAAA,IAC5D,OAAO,qBAAA,CAAsB,mBAAA,CAAW,KAAA,EAAO,mBAAA,CAAW,MAAM,MAAM,CAAA;AAAA,IACtE,OAAO,mBAAA,CAAoB,mBAAA,CAAW,KAAA,EAAO,mBAAA,CAAW,MAAM,IAAI;AAAA;AAEtE,CAAA;AAEA,IAAO,2BAAA,GAAQ;AAGR,IAAM,KAAA,GAAe;AAAA,EAC1B,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM,cAAA;AAAA,IACN,IAAA,EAAM,oBAAW,IAAA,CAAK,CAAA;AAAA,IACtB,KAAA,EAAO,oBAAW,KAAA,CAAM,MAAA;AAAA,IACxB,KAAA,EAAO,oBAAW,KAAA,CAAM,IAAA;AAAA,IACxB,MAAA,EAAQ,KAAA;AAAA,IACR,QAAA,EAAU,KAAA;AAAA,IACV,OAAA,EAAS;AAAA,GACX;AAAA,EACA,UAAA,EAAY,EAAE,QAAA,EAAU,EAAE,SAAS,CAAC,WAAW,GAAE;AACnD","file":"text-button.stories.js","sourcesContent":["type RadioArgObject<T> = {\n defaultValue: T\n options: T[]\n control: { type: 'radio' }\n}\n\nexport function getRadioArgFromObject<T extends string | number>(\n object: Record<string, T>,\n defaultValue: T\n): RadioArgObject<T> {\n return {\n defaultValue,\n options: Object.values(object),\n control: { type: 'radio' },\n }\n}\n\ntype RadioArgEnum<E> = {\n defaultValue: E\n options: string[]\n mapping: Record<string, E>\n control: { type: 'radio' }\n}\n\nexport function getRadioArgFromEnum<E extends Record<string, string | number>>(\n enumObject: E,\n defaultValue: E[keyof E]\n): RadioArgEnum<E[keyof E]> {\n // Only keep \"real\" keys (filter numeric reverse mapping)\n const keys = Object.keys(enumObject).filter((key) =>\n Number.isNaN(Number(key))\n )\n\n const mapping: Record<string, E[keyof E]> = {}\n keys.forEach((key) => {\n mapping[key] = enumObject[key as keyof E]\n })\n\n // Find the key corresponding to the default value\n const defaultKey =\n keys.find((key) => enumObject[key as keyof E] === defaultValue) || keys[0]\n\n return {\n defaultValue: enumObject[defaultKey as keyof E],\n options: keys,\n mapping,\n control: { type: 'radio' },\n }\n}\n","import type { ValuesOf } from '../../types'\n\nexport const TYPE = {\n default: 'default',\n article: 'article',\n} as const\n\nexport type Type = ValuesOf<typeof TYPE>\n\nexport const WEIGHT = {\n extraLight: 'extra-light',\n normal: 'normal',\n bold: 'bold',\n} as const\n\nexport type Weight = ValuesOf<typeof WEIGHT>\n","import clsx from 'clsx'\nimport type React from 'react'\nimport { WEIGHT, type Weight } from './enum'\n\ntype ParagraphProps = React.HTMLAttributes<HTMLParagraphElement> & {\n text?: string\n weight?: Weight\n className?: string\n}\n\nconst baseClass = 'font-default leading-[150%] flex items-center m-0'\n\nconst variantClass = {\n P1: 'text-[16px]',\n P2: 'text-[14px]',\n P3: 'text-[12px]',\n P4: 'text-[10px]',\n}\n\nconst ParagraphVariant = (variant: keyof typeof variantClass) => {\n const Component: React.FC<ParagraphProps> & { Weight: typeof WEIGHT } = ({\n text = '',\n weight = WEIGHT.normal,\n className = '',\n ...props\n }) => (\n <p\n className={clsx(\n baseClass,\n variantClass[variant],\n `font-${weight}`,\n className\n )}\n {...props}\n >\n {text}\n </p>\n )\n Component.displayName = variant\n Component.Weight = WEIGHT\n return Component\n}\n\nconst P1 = ParagraphVariant('P1')\nconst P2 = ParagraphVariant('P2')\nconst P3 = ParagraphVariant('P3')\nconst P4 = ParagraphVariant('P4')\n\nexport { P1, P2, P3, P4 }\n","export enum Size {\n S,\n L,\n}\n\nexport enum Style {\n BRAND,\n DARK,\n LIGHT,\n}\n","import type { ValuesOf } from '../types'\n\nexport const THEME = {\n normal: 'normal',\n photography: 'photography',\n transparent: 'transparent',\n index: 'index',\n} as const\n\nexport type Theme = ValuesOf<typeof THEME>\n","// constants\nimport { THEME } from '../../constant'\n// type\nimport type { Theme } from '../../constant'\nimport type { ClassArray } from 'clsx'\n// enum\nimport { Style } from '../../enum'\n\ntype ThemeFunc = (theme: Theme, style?: Style) => ClassArray\n\nexport const getDisabledContainerTheme: ThemeFunc = (theme) => {\n return [\n // default theme\n 'text-gray-400 hover:text-gray-400',\n // photography & transparent theme\n {\n 'text-gray-500 hover:text-gray-500': theme === THEME.photography || theme === THEME.transparent,\n }\n ]\n}\n\nexport const getActiveContainerTheme: ThemeFunc = (theme, style) => {\n return [\n // default theme\n {\n 'text-gray-800 hover:text-gray-800': style === Style.LIGHT,\n 'text-brand-heavy hover:text-brand-heavy': style === Style.DARK,\n 'text-brand-dark hover:text-brand-dark': style === Style.BRAND,\n },\n // photography theme\n {\n 'text-gray-400 hover:text-gray-400': theme === THEME.photography && style === Style.LIGHT,\n 'text-supportive-pastel hover:text-supportive-pastel': theme === THEME.photography && style !== Style.LIGHT,\n },\n // transparent theme\n {\n 'text-gray-black hover:text-gray-black': theme === THEME.transparent && style === Style.LIGHT,\n 'text-gray-200 hover:text-gray-200': theme === THEME.transparent && style !== Style.LIGHT,\n },\n ]\n}\n\nexport const getContainerTheme: ThemeFunc = (theme, style) => {\n return [\n // default theme\n {\n 'text-gray-600 hover:text-gray-800': style === Style.LIGHT,\n 'text-gray-800 hover:text-brand-heavy': style === Style.DARK,\n 'text-brand-heavy hover:text-brand-dark': style === Style.BRAND,\n },\n // photography\n {\n 'text-gray-300 hover:text-gray-400': theme === THEME.photography && style === Style.LIGHT,\n 'text-gray-white hover:text-supportive-pastel': theme === THEME.photography && style === Style.DARK,\n 'text-supportive-faded hover:text-supportive-pastel': theme === THEME.photography && style === Style.BRAND,\n },\n // transparent theme\n {\n 'text-gray-800 hover:text-gray-black': theme === THEME.transparent && style === Style.LIGHT,\n 'text-gray-white hover:text-gray-200': theme === THEME.transparent && style !== Style.LIGHT,\n },\n ]\n}","import { type FC, type ReactElement, useMemo } from 'react'\nimport clsx from 'clsx'\n// components\nimport { P1, P2 } from '../../../text/paragraph'\n// enums\nimport { Size, Style } from '../../enum'\n// type\nimport type { Theme } from '../../constant'\n// constants\nimport { THEME } from '../../constant'\n// utils\nimport { getContainerTheme, getActiveContainerTheme, getDisabledContainerTheme } from './theme'\n\ntype TextButtonProps = {\n text: string\n leftIconComponent?: ReactElement\n rightIconComponent?: ReactElement\n size?: Size\n style?: Style\n theme?: Theme\n active?: boolean\n disabled?: boolean\n loading?: boolean\n className?: string\n}\nconst TextButton: FC<TextButtonProps> & {\n Size: typeof Size\n Style: typeof Style\n THEME: typeof THEME\n} = ({\n text,\n leftIconComponent,\n rightIconComponent,\n size = Size.S,\n theme = THEME.normal,\n style = Style.DARK,\n active = false,\n disabled = false,\n loading = false,\n className = '',\n}) => {\n const TextJSX = useMemo(\n () => (size === Size.S ? <P2 text={text} weight={P2.Weight.bold} /> : <P1 text={text} weight={P1.Weight.bold} />),\n [size, text]\n )\n const themeClass = useMemo(() => {\n const themeFunc = disabled ? getDisabledContainerTheme : (active ? getActiveContainerTheme : getContainerTheme)\n return themeFunc(theme, style)\n }, [disabled, active, theme, style])\n\n return (\n <div\n className={clsx(\n 'flex items-center',\n {\n 'cursor-default': disabled,\n 'cursor-pointer': !disabled,\n },\n themeClass,\n className\n )}\n >\n <div className=\"relative flex justify-center items-center\">\n <div\n className={clsx('flex justify-center items-center', {\n 'opacity-0': loading,\n 'opacity-100': !loading,\n })}\n >\n <div className=\"flex items-center mr-[4px]\">{leftIconComponent}</div>\n {TextJSX}\n <div className=\"flex items-center ml-[4px]\">{rightIconComponent}</div>\n </div>\n <span\n className={clsx(\n 'inline-block absolute box-border animation-spin',\n 'border-2 border-solid border-gray-400 border-t-gray-600 rounded-[50%]',\n {\n 'size-[18px]': size === Size.S,\n 'size-[24px]': size === Size.L,\n },\n {\n 'opacity-0': !loading,\n 'opacity-100': loading,\n }\n )}\n />\n </div>\n </div>\n )\n}\nTextButton.Size = Size\nTextButton.Style = Style\nTextButton.THEME = THEME\n\nexport default TextButton\n","import type { Meta, StoryObj } from '@storybook/react-vite'\n// utils\nimport {\n getRadioArgFromObject,\n getRadioArgFromEnum,\n} from '../../storybook/utils/get-enum-arg'\n// components\nimport TextButton from '../components/text-button'\n\nconst meta = {\n title: 'Button/TextButton',\n component: TextButton,\n argTypes: {\n size: getRadioArgFromEnum(TextButton.Size, TextButton.Size.S),\n theme: getRadioArgFromObject(TextButton.THEME, TextButton.THEME.normal),\n style: getRadioArgFromEnum(TextButton.Style, TextButton.Style.DARK),\n },\n} satisfies Meta<typeof TextButton>\n\nexport default meta\ntype Story = StoryObj<typeof meta>\n\nexport const Basic: Story = {\n args: {\n text: '文字',\n size: TextButton.Size.S,\n theme: TextButton.THEME.normal,\n style: TextButton.Style.DARK,\n active: false,\n disabled: false,\n loading: false,\n },\n parameters: { controls: { exclude: ['className'] } },\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { getRadioArgFromEnum, getRadioArgFromObject } from '../../chunk-QOLETTSG.mjs';
2
- import { text_button_default } from '../../chunk-QE5LVT7A.mjs';
2
+ import { text_button_default } from '../../chunk-U22UKMAJ.mjs';
3
+ import '../../chunk-FVKIUNIP.mjs';
3
4
  import '../../chunk-HQG6Q2EY.mjs';
4
5
  import '../../chunk-UM7RNC2Y.mjs';
5
6
  import '../../chunk-JB4TYHDE.mjs';