@itilite/lumina-ui 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.css +1 -0
- package/dist/cjs/index.js +47 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types/components/Button/Button.d.ts +4 -0
- package/dist/cjs/types/components/Button/index.d.ts +1 -0
- package/dist/cjs/types/components/Button/types.d.ts +16 -0
- package/dist/cjs/types/components/index.d.ts +1 -0
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/esm/index.css +1 -0
- package/dist/esm/index.js +45 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types/components/Button/Button.d.ts +4 -0
- package/dist/esm/types/components/Button/index.d.ts +1 -0
- package/dist/esm/types/components/Button/types.d.ts +16 -0
- package/dist/esm/types/components/index.d.ts +1 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/index.d.ts +22 -0
- package/eslint.config.mjs +55 -0
- package/package.json +54 -0
- package/rollup.config.mjs +58 -0
- package/src/components/Button/Button.module.scss +199 -0
- package/src/components/Button/Button.tsx +90 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Button/types.ts +16 -0
- package/src/components/index.ts +1 -0
- package/src/global.d.ts +6 -0
- package/src/index.ts +1 -0
- package/src/types/scss.d.ts +1 -0
- package/tsconfig.json +39 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.Button-module__button___18Bed{@apply tw-flex tw-justify-center tw-gap-1 tw-items-center tw-rounded-lg}.Button-module__button___18Bed.Button-module__size_large___Gohrm{height:56px;@apply tw-px-4}.Button-module__button___18Bed.Button-module__size_large___Gohrm.Button-module__shape_circle___1CtM2{width:56px}.Button-module__button___18Bed.Button-module__size_normal___Ym8Ah{height:40px;@apply tw-px-3}.Button-module__button___18Bed.Button-module__size_normal___Ym8Ah.Button-module__shape_circle___1CtM2{width:40px}.Button-module__button___18Bed.Button-module__size_small___mGHht{height:32px;@apply tw-px-2}.Button-module__button___18Bed.Button-module__size_small___mGHht.Button-module__shape_circle___1CtM2{width:32px}.Button-module__button___18Bed.Button-module__type_primary___WbRH0{border-width:1px;@apply tw-bg-color-action-primary;@apply tw-border;@apply tw-border-solid;@apply tw-border-color-border-primary-default;box-shadow:0 1px 0 0 rgba(17,24,39,.1)}.Button-module__button___18Bed.Button-module__type_primary___WbRH0.ant-btn-primary:active,.Button-module__button___18Bed.Button-module__type_primary___WbRH0.ant-btn-primary:hover{@apply tw-bg-color-action-primary;box-shadow:0 2px 4px 0 rgba(17,24,39,.1)}.Button-module__button___18Bed.Button-module__type_primary___WbRH0:focus-visible{outline:2px solid rgba(236,93,37,.38)}.Button-module__button___18Bed.Button-module__type_primary___WbRH0.Button-module__variant_link___mo-UB,.Button-module__button___18Bed.Button-module__type_primary___WbRH0.Button-module__variant_link___mo-UB:hover,.Button-module__button___18Bed.Button-module__type_primary___WbRH0.Button-module__variant_subtle___G4bvs,.Button-module__button___18Bed.Button-module__type_primary___WbRH0.Button-module__variant_subtle___G4bvs:hover,.Button-module__button___18Bed.Button-module__type_primary___WbRH0.Button-module__variant_text___r7oFS,.Button-module__button___18Bed.Button-module__type_primary___WbRH0.Button-module__variant_text___r7oFS:hover{@apply tw-text-color-text-primary}.Button-module__button___18Bed.Button-module__type_secondary___HXHdT{border-style:solid;border-width:1px;@apply tw-bg-color-surface-dark;@apply tw-border-color-surface-dark;box-shadow:0 1px 0 0 rgba(17,24,39,.1)}.Button-module__button___18Bed.Button-module__type_secondary___HXHdT.ant-btn-primary:active,.Button-module__button___18Bed.Button-module__type_secondary___HXHdT.ant-btn-primary:hover{@apply tw-bg-color-surface-dark;box-shadow:0 2px 4px 0 rgba(17,24,39,.1)}.Button-module__button___18Bed.Button-module__type_secondary___HXHdT.ant-btn-primary:focus-visible{outline:2px solid rgba(236,93,37,.38)}.Button-module__button___18Bed.Button-module__type_secondary___HXHdT.Button-module__variant_link___mo-UB,.Button-module__button___18Bed.Button-module__type_secondary___HXHdT.Button-module__variant_link___mo-UB:hover,.Button-module__button___18Bed.Button-module__type_secondary___HXHdT.Button-module__variant_subtle___G4bvs,.Button-module__button___18Bed.Button-module__type_secondary___HXHdT.Button-module__variant_subtle___G4bvs:hover,.Button-module__button___18Bed.Button-module__type_secondary___HXHdT.Button-module__variant_text___r7oFS,.Button-module__button___18Bed.Button-module__type_secondary___HXHdT.Button-module__variant_text___r7oFS:hover{@apply tw-text-color-text-default}.Button-module__button___18Bed.Button-module__type_critical___Y0vJw{border-width:1px;@apply tw-bg-color-action-critical;@apply tw-border-solid;@apply tw-border-color-border-critical-default;box-shadow:0 1px 0 0 rgba(17,24,39,.1)}.Button-module__button___18Bed.Button-module__type_critical___Y0vJw.ant-btn-primary:active,.Button-module__button___18Bed.Button-module__type_critical___Y0vJw.ant-btn-primary:hover{@apply tw-bg-color-action-critical;box-shadow:0 2px 4px 0 rgba(17,24,39,.1)}.Button-module__button___18Bed.Button-module__type_critical___Y0vJw.ant-btn-primary:focus-visible{outline:2px solid rgba(236,93,37,.38)}.Button-module__button___18Bed.Button-module__type_critical___Y0vJw.Button-module__variant_link___mo-UB,.Button-module__button___18Bed.Button-module__type_critical___Y0vJw.Button-module__variant_link___mo-UB:hover,.Button-module__button___18Bed.Button-module__type_critical___Y0vJw.Button-module__variant_subtle___G4bvs,.Button-module__button___18Bed.Button-module__type_critical___Y0vJw.Button-module__variant_subtle___G4bvs:hover,.Button-module__button___18Bed.Button-module__type_critical___Y0vJw.Button-module__variant_text___r7oFS,.Button-module__button___18Bed.Button-module__type_critical___Y0vJw.Button-module__variant_text___r7oFS:hover{@apply tw-text-color-text-critical}.Button-module__button___18Bed.Button-module__variant_subtle___G4bvs{@apply tw-bg-color-white;@apply tw-border;@apply tw-border-solid;@apply tw-border-color-border-default-subtle;box-shadow:0 1px 0 0 rgba(17,24,39,.1)}.Button-module__button___18Bed.Button-module__variant_subtle___G4bvs.ant-btn-default:hover{box-shadow:0 2px 4px 0 rgba(17,24,39,.15);@apply tw-border-color-border-default-subtle}.Button-module__button___18Bed.Button-module__variant_subtle___G4bvs.ant-btn-default:focus-visible{outline:2px solid rgba(236,93,37,.38)}.Button-module__button___18Bed.Button-module__variant_text___r7oFS{@apply tw-bg-transparent;@apply tw-border-0;@apply tw-border-none;box-shadow:none}.Button-module__button___18Bed.Button-module__variant_text___r7oFS.ant-btn-default:hover{box-shadow:0 2px 4px 0 rgba(17,24,39,.15);@apply tw-border-none;@apply tw-bg-color-surface-default-subtle}.Button-module__button___18Bed.Button-module__variant_text___r7oFS.ant-btn-default:active{@apply tw-bg-color-surface-default-hover}.Button-module__button___18Bed.Button-module__variant_text___r7oFS.ant-btn:focus-visible{outline:2px solid rgba(236,93,37,.2)}.Button-module__button___18Bed.Button-module__variant_link___mo-UB,.Button-module__button___18Bed.Button-module__variant_link___mo-UB.ant-btn-default:hover{box-shadow:none;@apply tw-border-none;@apply tw-bg-transparent}.Button-module__button___18Bed.Button-module__variant_link___mo-UB.ant-btn-default:hover.Button-module__onHoverUnderline___OyHzj{text-decoration:underline}.Button-module__button___18Bed.Button-module__variant_link___mo-UB.ant-btn-default:active{@apply tw-bg-transparent}.Button-module__button___18Bed.Button-module__variant_link___mo-UB.ant-btn:focus-visible{outline:none}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var antd = require('antd');
|
|
5
|
+
var PropTypes = require('prop-types');
|
|
6
|
+
|
|
7
|
+
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
8
|
+
|
|
9
|
+
var classes = {"button":"Button-module__button___18Bed","size_large":"Button-module__size_large___Gohrm","shape_circle":"Button-module__shape_circle___1CtM2","size_normal":"Button-module__size_normal___Ym8Ah","size_small":"Button-module__size_small___mGHht","type_primary":"Button-module__type_primary___WbRH0","variant_subtle":"Button-module__variant_subtle___G4bvs","variant_text":"Button-module__variant_text___r7oFS","variant_link":"Button-module__variant_link___mo-UB","type_secondary":"Button-module__type_secondary___HXHdT","type_critical":"Button-module__type_critical___Y0vJw","onHoverUnderline":"Button-module__onHoverUnderline___OyHzj"};
|
|
10
|
+
|
|
11
|
+
const Button = (props) => {
|
|
12
|
+
const { type = "primary", variant = "default", size = "normal", shape = "default", className = "", icon = null, iconPosition = "start", children, onClick = () => { }, href = "", disabled = false, loading = false, onHoverUnderline = false, } = props;
|
|
13
|
+
const buttonMap = {
|
|
14
|
+
default: "primary",
|
|
15
|
+
subtle: "default",
|
|
16
|
+
text: "text",
|
|
17
|
+
link: "link",
|
|
18
|
+
};
|
|
19
|
+
// Map your sizes to Ant Design's sizes
|
|
20
|
+
const sizeMap = {
|
|
21
|
+
small: "small",
|
|
22
|
+
normal: "middle", // Map "default" to "middle"
|
|
23
|
+
large: "large",
|
|
24
|
+
};
|
|
25
|
+
return (jsxRuntime.jsx(antd.Button, { className: clsx(classes.button, classes[`size_${size}`], classes[`variant_${variant}`], classes[`shape_${shape}`], classes[`type_${type}`], `size_${size}`, `variant_${variant}`, `shape_${shape}`, `type_${type}`, className, {
|
|
26
|
+
"tw-cursor-not-allowed": disabled,
|
|
27
|
+
"tw-opacity-40": disabled,
|
|
28
|
+
}, disabled && classes.disabled, onHoverUnderline && classes.onHoverUnderline), icon: icon, iconPosition: iconPosition, onClick: onClick, size: sizeMap[size], shape: shape, type: buttonMap[variant], disabled: disabled, loading: loading, href: href || undefined, children: children }));
|
|
29
|
+
};
|
|
30
|
+
Button.propTypes = {
|
|
31
|
+
type: PropTypes.oneOf(["primary", "secondary", "critical"]),
|
|
32
|
+
variant: PropTypes.oneOf(["subtle", "text", "link"]),
|
|
33
|
+
size: PropTypes.oneOf(["large", "small"]),
|
|
34
|
+
shape: PropTypes.oneOf(["circle", "default", "round"]),
|
|
35
|
+
icon: PropTypes.node,
|
|
36
|
+
iconPosition: PropTypes.oneOf(["start", "end"]),
|
|
37
|
+
className: PropTypes.string,
|
|
38
|
+
onClick: PropTypes.func,
|
|
39
|
+
disabled: PropTypes.bool,
|
|
40
|
+
loading: PropTypes.bool,
|
|
41
|
+
href: PropTypes.string,
|
|
42
|
+
onHoverUnderline: PropTypes.bool,
|
|
43
|
+
};
|
|
44
|
+
Button.displayName = "Button";
|
|
45
|
+
|
|
46
|
+
exports.Button = Button;
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs","../../src/components/Button/Button.tsx"],"sourcesContent":["function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;",null],"names":["_jsx","AntButton"],"mappings":";;;;;;AAAA,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,GAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CA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CAAC,SAAS,GAAG;AAClB,IAAA,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;AAC3D,IAAA,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpD,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACzC,IAAA,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACtD,IAAI,EAAE,SAAS,CAAC,IAAI;IACpB,YAAY,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC/C,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,QAAQ,EAAE,SAAS,CAAC,IAAI;IACxB,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,IAAI,EAAE,SAAS,CAAC,MAAM;IACtB,gBAAgB,EAAE,SAAS,CAAC,IAAI;CAChC,CAAC;AAEF,MAAM,CAAC,WAAW,GAAG,QAAQ;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Button } from "./Button";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ButtonProps {
|
|
2
|
+
type?: "primary" | "secondary" | "critical" | undefined;
|
|
3
|
+
variant?: "subtle" | "text" | "link";
|
|
4
|
+
size?: "large" | "small";
|
|
5
|
+
shape?: "circle" | "default" | "round";
|
|
6
|
+
icon?: React.ReactNode;
|
|
7
|
+
iconPosition?: "start" | "end";
|
|
8
|
+
className?: string;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
11
|
+
href?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
onHoverUnderline?: boolean;
|
|
15
|
+
analytics?: Record<string, unknown>;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Button';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./components";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.Button-module__button___18Bed{@apply tw-flex tw-justify-center tw-gap-1 tw-items-center tw-rounded-lg}.Button-module__button___18Bed.Button-module__size_large___Gohrm{height:56px;@apply tw-px-4}.Button-module__button___18Bed.Button-module__size_large___Gohrm.Button-module__shape_circle___1CtM2{width:56px}.Button-module__button___18Bed.Button-module__size_normal___Ym8Ah{height:40px;@apply tw-px-3}.Button-module__button___18Bed.Button-module__size_normal___Ym8Ah.Button-module__shape_circle___1CtM2{width:40px}.Button-module__button___18Bed.Button-module__size_small___mGHht{height:32px;@apply tw-px-2}.Button-module__button___18Bed.Button-module__size_small___mGHht.Button-module__shape_circle___1CtM2{width:32px}.Button-module__button___18Bed.Button-module__type_primary___WbRH0{border-width:1px;@apply tw-bg-color-action-primary;@apply tw-border;@apply tw-border-solid;@apply tw-border-color-border-primary-default;box-shadow:0 1px 0 0 rgba(17,24,39,.1)}.Button-module__button___18Bed.Button-module__type_primary___WbRH0.ant-btn-primary:active,.Button-module__button___18Bed.Button-module__type_primary___WbRH0.ant-btn-primary:hover{@apply tw-bg-color-action-primary;box-shadow:0 2px 4px 0 rgba(17,24,39,.1)}.Button-module__button___18Bed.Button-module__type_primary___WbRH0:focus-visible{outline:2px solid rgba(236,93,37,.38)}.Button-module__button___18Bed.Button-module__type_primary___WbRH0.Button-module__variant_link___mo-UB,.Button-module__button___18Bed.Button-module__type_primary___WbRH0.Button-module__variant_link___mo-UB:hover,.Button-module__button___18Bed.Button-module__type_primary___WbRH0.Button-module__variant_subtle___G4bvs,.Button-module__button___18Bed.Button-module__type_primary___WbRH0.Button-module__variant_subtle___G4bvs:hover,.Button-module__button___18Bed.Button-module__type_primary___WbRH0.Button-module__variant_text___r7oFS,.Button-module__button___18Bed.Button-module__type_primary___WbRH0.Button-module__variant_text___r7oFS:hover{@apply tw-text-color-text-primary}.Button-module__button___18Bed.Button-module__type_secondary___HXHdT{border-style:solid;border-width:1px;@apply tw-bg-color-surface-dark;@apply tw-border-color-surface-dark;box-shadow:0 1px 0 0 rgba(17,24,39,.1)}.Button-module__button___18Bed.Button-module__type_secondary___HXHdT.ant-btn-primary:active,.Button-module__button___18Bed.Button-module__type_secondary___HXHdT.ant-btn-primary:hover{@apply tw-bg-color-surface-dark;box-shadow:0 2px 4px 0 rgba(17,24,39,.1)}.Button-module__button___18Bed.Button-module__type_secondary___HXHdT.ant-btn-primary:focus-visible{outline:2px solid rgba(236,93,37,.38)}.Button-module__button___18Bed.Button-module__type_secondary___HXHdT.Button-module__variant_link___mo-UB,.Button-module__button___18Bed.Button-module__type_secondary___HXHdT.Button-module__variant_link___mo-UB:hover,.Button-module__button___18Bed.Button-module__type_secondary___HXHdT.Button-module__variant_subtle___G4bvs,.Button-module__button___18Bed.Button-module__type_secondary___HXHdT.Button-module__variant_subtle___G4bvs:hover,.Button-module__button___18Bed.Button-module__type_secondary___HXHdT.Button-module__variant_text___r7oFS,.Button-module__button___18Bed.Button-module__type_secondary___HXHdT.Button-module__variant_text___r7oFS:hover{@apply tw-text-color-text-default}.Button-module__button___18Bed.Button-module__type_critical___Y0vJw{border-width:1px;@apply tw-bg-color-action-critical;@apply tw-border-solid;@apply tw-border-color-border-critical-default;box-shadow:0 1px 0 0 rgba(17,24,39,.1)}.Button-module__button___18Bed.Button-module__type_critical___Y0vJw.ant-btn-primary:active,.Button-module__button___18Bed.Button-module__type_critical___Y0vJw.ant-btn-primary:hover{@apply tw-bg-color-action-critical;box-shadow:0 2px 4px 0 rgba(17,24,39,.1)}.Button-module__button___18Bed.Button-module__type_critical___Y0vJw.ant-btn-primary:focus-visible{outline:2px solid rgba(236,93,37,.38)}.Button-module__button___18Bed.Button-module__type_critical___Y0vJw.Button-module__variant_link___mo-UB,.Button-module__button___18Bed.Button-module__type_critical___Y0vJw.Button-module__variant_link___mo-UB:hover,.Button-module__button___18Bed.Button-module__type_critical___Y0vJw.Button-module__variant_subtle___G4bvs,.Button-module__button___18Bed.Button-module__type_critical___Y0vJw.Button-module__variant_subtle___G4bvs:hover,.Button-module__button___18Bed.Button-module__type_critical___Y0vJw.Button-module__variant_text___r7oFS,.Button-module__button___18Bed.Button-module__type_critical___Y0vJw.Button-module__variant_text___r7oFS:hover{@apply tw-text-color-text-critical}.Button-module__button___18Bed.Button-module__variant_subtle___G4bvs{@apply tw-bg-color-white;@apply tw-border;@apply tw-border-solid;@apply tw-border-color-border-default-subtle;box-shadow:0 1px 0 0 rgba(17,24,39,.1)}.Button-module__button___18Bed.Button-module__variant_subtle___G4bvs.ant-btn-default:hover{box-shadow:0 2px 4px 0 rgba(17,24,39,.15);@apply tw-border-color-border-default-subtle}.Button-module__button___18Bed.Button-module__variant_subtle___G4bvs.ant-btn-default:focus-visible{outline:2px solid rgba(236,93,37,.38)}.Button-module__button___18Bed.Button-module__variant_text___r7oFS{@apply tw-bg-transparent;@apply tw-border-0;@apply tw-border-none;box-shadow:none}.Button-module__button___18Bed.Button-module__variant_text___r7oFS.ant-btn-default:hover{box-shadow:0 2px 4px 0 rgba(17,24,39,.15);@apply tw-border-none;@apply tw-bg-color-surface-default-subtle}.Button-module__button___18Bed.Button-module__variant_text___r7oFS.ant-btn-default:active{@apply tw-bg-color-surface-default-hover}.Button-module__button___18Bed.Button-module__variant_text___r7oFS.ant-btn:focus-visible{outline:2px solid rgba(236,93,37,.2)}.Button-module__button___18Bed.Button-module__variant_link___mo-UB,.Button-module__button___18Bed.Button-module__variant_link___mo-UB.ant-btn-default:hover{box-shadow:none;@apply tw-border-none;@apply tw-bg-transparent}.Button-module__button___18Bed.Button-module__variant_link___mo-UB.ant-btn-default:hover.Button-module__onHoverUnderline___OyHzj{text-decoration:underline}.Button-module__button___18Bed.Button-module__variant_link___mo-UB.ant-btn-default:active{@apply tw-bg-transparent}.Button-module__button___18Bed.Button-module__variant_link___mo-UB.ant-btn:focus-visible{outline:none}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Button as Button$1 } from 'antd';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
6
|
+
|
|
7
|
+
var classes = {"button":"Button-module__button___18Bed","size_large":"Button-module__size_large___Gohrm","shape_circle":"Button-module__shape_circle___1CtM2","size_normal":"Button-module__size_normal___Ym8Ah","size_small":"Button-module__size_small___mGHht","type_primary":"Button-module__type_primary___WbRH0","variant_subtle":"Button-module__variant_subtle___G4bvs","variant_text":"Button-module__variant_text___r7oFS","variant_link":"Button-module__variant_link___mo-UB","type_secondary":"Button-module__type_secondary___HXHdT","type_critical":"Button-module__type_critical___Y0vJw","onHoverUnderline":"Button-module__onHoverUnderline___OyHzj"};
|
|
8
|
+
|
|
9
|
+
const Button = (props) => {
|
|
10
|
+
const { type = "primary", variant = "default", size = "normal", shape = "default", className = "", icon = null, iconPosition = "start", children, onClick = () => { }, href = "", disabled = false, loading = false, onHoverUnderline = false, } = props;
|
|
11
|
+
const buttonMap = {
|
|
12
|
+
default: "primary",
|
|
13
|
+
subtle: "default",
|
|
14
|
+
text: "text",
|
|
15
|
+
link: "link",
|
|
16
|
+
};
|
|
17
|
+
// Map your sizes to Ant Design's sizes
|
|
18
|
+
const sizeMap = {
|
|
19
|
+
small: "small",
|
|
20
|
+
normal: "middle", // Map "default" to "middle"
|
|
21
|
+
large: "large",
|
|
22
|
+
};
|
|
23
|
+
return (jsx(Button$1, { className: clsx(classes.button, classes[`size_${size}`], classes[`variant_${variant}`], classes[`shape_${shape}`], classes[`type_${type}`], `size_${size}`, `variant_${variant}`, `shape_${shape}`, `type_${type}`, className, {
|
|
24
|
+
"tw-cursor-not-allowed": disabled,
|
|
25
|
+
"tw-opacity-40": disabled,
|
|
26
|
+
}, disabled && classes.disabled, onHoverUnderline && classes.onHoverUnderline), icon: icon, iconPosition: iconPosition, onClick: onClick, size: sizeMap[size], shape: shape, type: buttonMap[variant], disabled: disabled, loading: loading, href: href || undefined, children: children }));
|
|
27
|
+
};
|
|
28
|
+
Button.propTypes = {
|
|
29
|
+
type: PropTypes.oneOf(["primary", "secondary", "critical"]),
|
|
30
|
+
variant: PropTypes.oneOf(["subtle", "text", "link"]),
|
|
31
|
+
size: PropTypes.oneOf(["large", "small"]),
|
|
32
|
+
shape: PropTypes.oneOf(["circle", "default", "round"]),
|
|
33
|
+
icon: PropTypes.node,
|
|
34
|
+
iconPosition: PropTypes.oneOf(["start", "end"]),
|
|
35
|
+
className: PropTypes.string,
|
|
36
|
+
onClick: PropTypes.func,
|
|
37
|
+
disabled: PropTypes.bool,
|
|
38
|
+
loading: PropTypes.bool,
|
|
39
|
+
href: PropTypes.string,
|
|
40
|
+
onHoverUnderline: PropTypes.bool,
|
|
41
|
+
};
|
|
42
|
+
Button.displayName = "Button";
|
|
43
|
+
|
|
44
|
+
export { Button };
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs","../../src/components/Button/Button.tsx"],"sourcesContent":["function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;",null],"names":["_jsx","AntButton"],"mappings":";;;;AAAA,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,GAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAC,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAQ,SAAS,IAAI,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAA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,SAAS,CAAC,IAAI;CAChC,CAAC;AAEF,MAAM,CAAC,WAAW,GAAG,QAAQ;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Button } from "./Button";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ButtonProps {
|
|
2
|
+
type?: "primary" | "secondary" | "critical" | undefined;
|
|
3
|
+
variant?: "subtle" | "text" | "link";
|
|
4
|
+
size?: "large" | "small";
|
|
5
|
+
shape?: "circle" | "default" | "round";
|
|
6
|
+
icon?: React.ReactNode;
|
|
7
|
+
iconPosition?: "start" | "end";
|
|
8
|
+
className?: string;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
11
|
+
href?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
onHoverUnderline?: boolean;
|
|
15
|
+
analytics?: Record<string, unknown>;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Button';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./components";
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
|
|
3
|
+
interface ButtonProps {
|
|
4
|
+
type?: "primary" | "secondary" | "critical" | undefined;
|
|
5
|
+
variant?: "subtle" | "text" | "link";
|
|
6
|
+
size?: "large" | "small";
|
|
7
|
+
shape?: "circle" | "default" | "round";
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
iconPosition?: "start" | "end";
|
|
10
|
+
className?: string;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
13
|
+
href?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
onHoverUnderline?: boolean;
|
|
17
|
+
analytics?: Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare const Button: React$1.FC<ButtonProps>;
|
|
21
|
+
|
|
22
|
+
export { Button };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineConfig } from "eslint-define-config";
|
|
2
|
+
import parseForESLint from "@typescript-eslint/parser";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import path from "path";
|
|
5
|
+
|
|
6
|
+
import simpleImportSort from "eslint-plugin-simple-import-sort";
|
|
7
|
+
import unusedImports from "eslint-plugin-unused-imports";
|
|
8
|
+
import typescriptPlugin from "@typescript-eslint/eslint-plugin";
|
|
9
|
+
import importPlugin from "eslint-plugin-import";
|
|
10
|
+
import reactHooks from "eslint-plugin-react-hooks";
|
|
11
|
+
|
|
12
|
+
// Define __dirname in ES module scope
|
|
13
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
+
const __dirname = path.dirname(__filename);
|
|
15
|
+
|
|
16
|
+
export default defineConfig({
|
|
17
|
+
languageOptions: {
|
|
18
|
+
parser: parseForESLint,
|
|
19
|
+
globals: {
|
|
20
|
+
browser: "readonly",
|
|
21
|
+
es2021: "readonly",
|
|
22
|
+
commonjs: "readonly",
|
|
23
|
+
},
|
|
24
|
+
parserOptions: {
|
|
25
|
+
project: "./tsconfig.eslint.json",
|
|
26
|
+
tsconfigRootDir: __dirname,
|
|
27
|
+
sourceType: "module",
|
|
28
|
+
ecmaFeatures: {
|
|
29
|
+
jsx: true,
|
|
30
|
+
},
|
|
31
|
+
ecmaVersion: "latest", // Moved from the old parserOptions
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
// Remove the old parserOptions key entirely
|
|
35
|
+
plugins: {
|
|
36
|
+
"simple-import-sort": simpleImportSort,
|
|
37
|
+
"unused-imports": unusedImports,
|
|
38
|
+
"@typescript-eslint": typescriptPlugin,
|
|
39
|
+
"react-hooks": reactHooks,
|
|
40
|
+
import: importPlugin,
|
|
41
|
+
},
|
|
42
|
+
rules: {
|
|
43
|
+
// "@typescript-eslint/quotes": ["error", "double"], // Ensure this rule is valid
|
|
44
|
+
// "@typescript-eslint/semi": ["error", "always"],
|
|
45
|
+
"react/react-in-jsx-scope": "off",
|
|
46
|
+
"react/prop-types": "off",
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
ignores: ["node_modules", "dist/*", "*.config.mjs", "*.config.js"], // Using ignorePatterns
|
|
50
|
+
settings: {
|
|
51
|
+
react: {
|
|
52
|
+
version: "detect",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@itilite/lumina-ui",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Design system",
|
|
5
|
+
"main": "dist/cjs/index.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"author": "",
|
|
9
|
+
"license": "ISC",
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
|
12
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
13
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
14
|
+
"@types/prop-types": "^15.7.12",
|
|
15
|
+
"@types/react": "^18.3.3",
|
|
16
|
+
"@types/react-dom": "^18.3.0",
|
|
17
|
+
"@typescript-eslint/eslint-plugin": "^8.2.0",
|
|
18
|
+
"@typescript-eslint/parser": "^8.2.0",
|
|
19
|
+
"antd": "^5.20.1",
|
|
20
|
+
"autoprefixer": "^10.4.20",
|
|
21
|
+
"clsx": "^2.1.1",
|
|
22
|
+
"eslint": "^9.9.0",
|
|
23
|
+
"eslint-config-standard-with-typescript": "^43.0.1",
|
|
24
|
+
"eslint-define-config": "^2.1.0",
|
|
25
|
+
"eslint-plugin-import": "^2.29.1",
|
|
26
|
+
"eslint-plugin-react": "^7.35.0",
|
|
27
|
+
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
|
|
28
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
29
|
+
"eslint-plugin-unused-imports": "^4.1.3",
|
|
30
|
+
"postcss": "^8.4.41",
|
|
31
|
+
"postcss-scss": "^4.0.9",
|
|
32
|
+
"prop-types": "^15.8.1",
|
|
33
|
+
"react": "^18.3.1",
|
|
34
|
+
"react-dom": "^18.3.1",
|
|
35
|
+
"rollup": "^4.21.0",
|
|
36
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
37
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
38
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
39
|
+
"rollup-plugin-scss": "^4.0.0",
|
|
40
|
+
"sass": "^1.77.8",
|
|
41
|
+
"tailwindcss": "^3.4.10",
|
|
42
|
+
"tslib": "^2.6.3",
|
|
43
|
+
"typescript": "^5.5.3"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"react": ">=18"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "rollup -c",
|
|
50
|
+
"dev": "rollup -c -w",
|
|
51
|
+
"lint": "eslint ",
|
|
52
|
+
"lint:fix": "eslint ./src --ext .ts,.tsx --fix"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import resolve from "@rollup/plugin-node-resolve";
|
|
2
|
+
import typescript from "@rollup/plugin-typescript";
|
|
3
|
+
import commonjs from "@rollup/plugin-commonjs";
|
|
4
|
+
import dts from "rollup-plugin-dts";
|
|
5
|
+
import postcss from "rollup-plugin-postcss";
|
|
6
|
+
import packageJson from "./package.json" with { type: "json" };
|
|
7
|
+
import autoprefixer from 'autoprefixer';
|
|
8
|
+
|
|
9
|
+
export default [
|
|
10
|
+
{
|
|
11
|
+
input: "src/index.ts",
|
|
12
|
+
output: [
|
|
13
|
+
{
|
|
14
|
+
file: packageJson.main,
|
|
15
|
+
format: "cjs",
|
|
16
|
+
sourcemap: true,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
file: packageJson.module,
|
|
20
|
+
format: "esm",
|
|
21
|
+
sourcemap: true,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
plugins: [
|
|
25
|
+
resolve({
|
|
26
|
+
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
|
27
|
+
skip: ["react", "react-dom"],
|
|
28
|
+
modulesOnly: true
|
|
29
|
+
}),
|
|
30
|
+
commonjs({
|
|
31
|
+
exclude: "node_modules"
|
|
32
|
+
}),
|
|
33
|
+
typescript({
|
|
34
|
+
tsconfig: "./tsconfig.json",
|
|
35
|
+
exclude: ["**/*.test.tsx", "**/*.test.ts", "**/*.stories.ts", "node_modules"],
|
|
36
|
+
}),
|
|
37
|
+
postcss({
|
|
38
|
+
// modules: true, // Enable CSS Modules
|
|
39
|
+
use: ['sass'], // Enable SCSS syntax
|
|
40
|
+
extract: true, // Extract CSS to a separate file
|
|
41
|
+
minimize: true, // Minimize the output CSS
|
|
42
|
+
plugins: [
|
|
43
|
+
autoprefixer(), // Automatically add vendor prefixes
|
|
44
|
+
],
|
|
45
|
+
modules: {
|
|
46
|
+
generateScopedName: '[name]__[local]___[hash:base64:5]',
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
],
|
|
50
|
+
external: id => /^react|react-dom/.test(id), // Ignore react and react-dom from node_modules
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
input: "dist/esm/types/index.d.ts",
|
|
54
|
+
output: [{ file: "dist/index.d.ts", format: "esm" }],
|
|
55
|
+
plugins: [dts()],
|
|
56
|
+
external: [/\.css$/],
|
|
57
|
+
},
|
|
58
|
+
];
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
.button {
|
|
2
|
+
@apply tw-flex tw-justify-center tw-gap-1 tw-items-center tw-rounded-lg;
|
|
3
|
+
|
|
4
|
+
&.size_large {
|
|
5
|
+
height: 56px;
|
|
6
|
+
@apply tw-px-4;
|
|
7
|
+
&.shape_circle {
|
|
8
|
+
width: 56px;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
&.size_normal {
|
|
12
|
+
height: 40px;
|
|
13
|
+
@apply tw-px-3;
|
|
14
|
+
&.shape_circle {
|
|
15
|
+
width: 40px;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
&.size_small {
|
|
19
|
+
height: 32px;
|
|
20
|
+
@apply tw-px-2;
|
|
21
|
+
&.shape_circle {
|
|
22
|
+
width: 32px;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.type_primary {
|
|
27
|
+
border-width: 1px;
|
|
28
|
+
@apply tw-bg-color-action-primary;
|
|
29
|
+
@apply tw-border;
|
|
30
|
+
@apply tw-border-solid;
|
|
31
|
+
@apply tw-border-color-border-primary-default;
|
|
32
|
+
box-shadow: 0 1px 0 0 rgba(17, 24, 39, 0.1);
|
|
33
|
+
&:global(.ant-btn-primary):hover,
|
|
34
|
+
&:global(.ant-btn-primary):active {
|
|
35
|
+
@apply tw-bg-color-action-primary;
|
|
36
|
+
box-shadow: 0px 2px 4px 0px rgba(17, 24, 39, 0.1);
|
|
37
|
+
}
|
|
38
|
+
&:focus-visible {
|
|
39
|
+
outline: 2px solid #ec5d2561;
|
|
40
|
+
}
|
|
41
|
+
&.variant_subtle {
|
|
42
|
+
@apply tw-text-color-text-primary;
|
|
43
|
+
&:hover {
|
|
44
|
+
@apply tw-text-color-text-primary;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
&.variant_text,
|
|
48
|
+
&.variant_link {
|
|
49
|
+
@apply tw-text-color-text-primary;
|
|
50
|
+
&:hover {
|
|
51
|
+
@apply tw-text-color-text-primary;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
&.type_secondary {
|
|
56
|
+
border-width: 1px;
|
|
57
|
+
border-style: solid;
|
|
58
|
+
@apply tw-bg-color-surface-dark;
|
|
59
|
+
@apply tw-border-color-surface-dark;
|
|
60
|
+
box-shadow: 0 1px 0 0 rgba(17, 24, 39, 0.1);
|
|
61
|
+
&:global(.ant-btn-primary):hover,
|
|
62
|
+
&:global(.ant-btn-primary):active {
|
|
63
|
+
@apply tw-bg-color-surface-dark;
|
|
64
|
+
box-shadow: 0px 2px 4px 0px rgba(17, 24, 39, 0.1);
|
|
65
|
+
}
|
|
66
|
+
&:global(.ant-btn-primary):focus-visible {
|
|
67
|
+
outline: 2px solid #ec5d2561;
|
|
68
|
+
}
|
|
69
|
+
&.variant_subtle {
|
|
70
|
+
@apply tw-text-color-text-default;
|
|
71
|
+
&:hover {
|
|
72
|
+
@apply tw-text-color-text-default;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
&.variant_text,
|
|
76
|
+
&.variant_link {
|
|
77
|
+
@apply tw-text-color-text-default;
|
|
78
|
+
&:hover {
|
|
79
|
+
@apply tw-text-color-text-default;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
&.type_critical {
|
|
84
|
+
border-width: 1px;
|
|
85
|
+
@apply tw-bg-color-action-critical;
|
|
86
|
+
@apply tw-border-solid;
|
|
87
|
+
@apply tw-border-color-border-critical-default;
|
|
88
|
+
box-shadow: 0 1px 0 0 rgba(17, 24, 39, 0.1);
|
|
89
|
+
&:global(.ant-btn-primary):hover,
|
|
90
|
+
&:global(.ant-btn-primary):active {
|
|
91
|
+
@apply tw-bg-color-action-critical;
|
|
92
|
+
box-shadow: 0px 2px 4px 0px rgba(17, 24, 39, 0.1);
|
|
93
|
+
}
|
|
94
|
+
&:global(.ant-btn-primary):focus-visible {
|
|
95
|
+
outline: 2px solid #ec5d2561;
|
|
96
|
+
}
|
|
97
|
+
&.variant_subtle {
|
|
98
|
+
@apply tw-text-color-text-critical;
|
|
99
|
+
&:hover {
|
|
100
|
+
@apply tw-text-color-text-critical;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
&.variant_text,
|
|
104
|
+
&.variant_link {
|
|
105
|
+
@apply tw-text-color-text-critical;
|
|
106
|
+
&:hover {
|
|
107
|
+
@apply tw-text-color-text-critical;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
&.variant_subtle {
|
|
112
|
+
@apply tw-bg-color-white;
|
|
113
|
+
@apply tw-border;
|
|
114
|
+
@apply tw-border-solid;
|
|
115
|
+
@apply tw-border-color-border-default-subtle;
|
|
116
|
+
box-shadow: 0px 1px 0px 0px rgba(17, 24, 39, 0.1);
|
|
117
|
+
&:global(.ant-btn-default):hover {
|
|
118
|
+
box-shadow: 0px 2px 4px 0px rgba(17, 24, 39, 0.15);
|
|
119
|
+
@apply tw-border-color-border-default-subtle;
|
|
120
|
+
}
|
|
121
|
+
&:global(.ant-btn-default):focus-visible {
|
|
122
|
+
outline: 2px solid #ec5d2561;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
&.variant_text {
|
|
126
|
+
@apply tw-bg-transparent;
|
|
127
|
+
@apply tw-border-0;
|
|
128
|
+
@apply tw-border-none;
|
|
129
|
+
box-shadow: none;
|
|
130
|
+
&:global(.ant-btn-default):hover {
|
|
131
|
+
box-shadow: 0px 2px 4px 0px rgba(17, 24, 39, 0.15);
|
|
132
|
+
@apply tw-border-none;
|
|
133
|
+
@apply tw-bg-color-surface-default-subtle;
|
|
134
|
+
}
|
|
135
|
+
&:global(.ant-btn-default):active {
|
|
136
|
+
@apply tw-bg-color-surface-default-hover;
|
|
137
|
+
}
|
|
138
|
+
&:global(.ant-btn):focus-visible {
|
|
139
|
+
outline: 2px solid rgba(236, 93, 37, 0.2);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
&.variant_link {
|
|
143
|
+
@apply tw-bg-transparent;
|
|
144
|
+
@apply tw-p-0;
|
|
145
|
+
@apply tw-border-0;
|
|
146
|
+
@apply tw-border-none;
|
|
147
|
+
@apply tw-h-auto;
|
|
148
|
+
box-shadow: none;
|
|
149
|
+
&:global(.ant-btn-default):hover {
|
|
150
|
+
&.onHoverUnderline{
|
|
151
|
+
text-decoration: underline;
|
|
152
|
+
}
|
|
153
|
+
box-shadow: none;
|
|
154
|
+
@apply tw-border-none;
|
|
155
|
+
@apply tw-bg-transparent;
|
|
156
|
+
}
|
|
157
|
+
&:global(.ant-btn-default):active {
|
|
158
|
+
@apply tw-bg-transparent;
|
|
159
|
+
}
|
|
160
|
+
&:global(.ant-btn):focus-visible {
|
|
161
|
+
outline: none;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// &.disabled {
|
|
167
|
+
// background-color: #ec5d25;
|
|
168
|
+
// color: white;
|
|
169
|
+
// border-color: transparent;
|
|
170
|
+
// &.default {
|
|
171
|
+
// background-color: white;
|
|
172
|
+
// color: black;
|
|
173
|
+
// border: 1px solid #c1c3c7;
|
|
174
|
+
// box-shadow: 0px 1px 0px rgba(17, 24, 39, 0.1);
|
|
175
|
+
// }
|
|
176
|
+
// &.secondary {
|
|
177
|
+
// background-color: white;
|
|
178
|
+
// color: black;
|
|
179
|
+
// border: 1px solid #d3d8df;
|
|
180
|
+
// box-shadow: 0px 1px 0px rgba(17, 24, 39, 0.1);
|
|
181
|
+
// }
|
|
182
|
+
// &.link {
|
|
183
|
+
// border: none;
|
|
184
|
+
// box-shadow: none;
|
|
185
|
+
// background-color: white;
|
|
186
|
+
// @apply tw-text-color-text-primary tw-border-0 tw-p-0;
|
|
187
|
+
// }
|
|
188
|
+
// &.text {
|
|
189
|
+
// background: transparent;
|
|
190
|
+
// &:hover {
|
|
191
|
+
// @apply tw-bg-transparent tw-text-color-text-disabled;
|
|
192
|
+
// }
|
|
193
|
+
// }
|
|
194
|
+
// &.contain {
|
|
195
|
+
// @apply tw-border-solid tw-border tw-border-color-defaultSubtle;
|
|
196
|
+
// @apply tw-text-color-text-primary;
|
|
197
|
+
// background-color: white;
|
|
198
|
+
// }
|
|
199
|
+
// }
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Button as AntButton } from "antd";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import PropTypes from "prop-types";
|
|
5
|
+
|
|
6
|
+
import classes from "./Button.module.scss";
|
|
7
|
+
import { ButtonProps } from "./types";
|
|
8
|
+
|
|
9
|
+
const Button: React.FC<ButtonProps> = (props) => {
|
|
10
|
+
const {
|
|
11
|
+
type = "primary",
|
|
12
|
+
variant = "default",
|
|
13
|
+
size = "normal",
|
|
14
|
+
shape = "default",
|
|
15
|
+
className = "",
|
|
16
|
+
icon = null,
|
|
17
|
+
iconPosition = "start",
|
|
18
|
+
children,
|
|
19
|
+
onClick = () => {},
|
|
20
|
+
href = "",
|
|
21
|
+
disabled = false,
|
|
22
|
+
loading = false,
|
|
23
|
+
onHoverUnderline = false,
|
|
24
|
+
} = props;
|
|
25
|
+
|
|
26
|
+
const buttonMap: Record<string, "primary" | "default" | "text" | "link"> = {
|
|
27
|
+
default: "primary",
|
|
28
|
+
subtle: "default",
|
|
29
|
+
text: "text",
|
|
30
|
+
link: "link",
|
|
31
|
+
};
|
|
32
|
+
// Map your sizes to Ant Design's sizes
|
|
33
|
+
const sizeMap: Record<string, "small" | "middle" | "large"> = {
|
|
34
|
+
small: "small",
|
|
35
|
+
normal: "middle", // Map "default" to "middle"
|
|
36
|
+
large: "large",
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<AntButton
|
|
41
|
+
className={clsx(
|
|
42
|
+
classes.button,
|
|
43
|
+
classes[`size_${size}`],
|
|
44
|
+
classes[`variant_${variant}`],
|
|
45
|
+
classes[`shape_${shape}`],
|
|
46
|
+
classes[`type_${type}`],
|
|
47
|
+
`size_${size}`,
|
|
48
|
+
`variant_${variant}`,
|
|
49
|
+
`shape_${shape}`,
|
|
50
|
+
`type_${type}`,
|
|
51
|
+
className,
|
|
52
|
+
{
|
|
53
|
+
"tw-cursor-not-allowed": disabled,
|
|
54
|
+
"tw-opacity-40": disabled,
|
|
55
|
+
},
|
|
56
|
+
disabled && classes.disabled,
|
|
57
|
+
onHoverUnderline && classes.onHoverUnderline
|
|
58
|
+
)}
|
|
59
|
+
icon={icon}
|
|
60
|
+
iconPosition={iconPosition}
|
|
61
|
+
onClick={onClick}
|
|
62
|
+
size={sizeMap[size]}
|
|
63
|
+
shape={shape}
|
|
64
|
+
type={buttonMap[variant]}
|
|
65
|
+
disabled={disabled}
|
|
66
|
+
loading={loading}
|
|
67
|
+
href={href || undefined}
|
|
68
|
+
>
|
|
69
|
+
{children}
|
|
70
|
+
</AntButton>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
export default Button;
|
|
74
|
+
|
|
75
|
+
Button.propTypes = {
|
|
76
|
+
type: PropTypes.oneOf(["primary", "secondary", "critical"]),
|
|
77
|
+
variant: PropTypes.oneOf(["subtle", "text", "link"]),
|
|
78
|
+
size: PropTypes.oneOf(["large", "small"]),
|
|
79
|
+
shape: PropTypes.oneOf(["circle", "default", "round"]),
|
|
80
|
+
icon: PropTypes.node,
|
|
81
|
+
iconPosition: PropTypes.oneOf(["start", "end"]),
|
|
82
|
+
className: PropTypes.string,
|
|
83
|
+
onClick: PropTypes.func,
|
|
84
|
+
disabled: PropTypes.bool,
|
|
85
|
+
loading: PropTypes.bool,
|
|
86
|
+
href: PropTypes.string,
|
|
87
|
+
onHoverUnderline: PropTypes.bool,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
Button.displayName = "Button";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Button } from "./Button";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ButtonProps {
|
|
2
|
+
type?: "primary" | "secondary" | "critical" | undefined;
|
|
3
|
+
variant?: "subtle" | "text" | "link";
|
|
4
|
+
size?: "large" | "small";
|
|
5
|
+
shape?: "circle" | "default" | "round";
|
|
6
|
+
icon?: React.ReactNode;
|
|
7
|
+
iconPosition?: "start" | "end";
|
|
8
|
+
className?: string;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
11
|
+
href?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
onHoverUnderline?: boolean;
|
|
15
|
+
analytics?: Record<string, unknown>;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Button';
|
package/src/global.d.ts
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./components";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Language and Environment */
|
|
4
|
+
"target": "esnext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
5
|
+
"jsx": "react-jsx" /* Specify what JSX code is generated. */,
|
|
6
|
+
|
|
7
|
+
/* Modules */
|
|
8
|
+
"module": "ESNext" /* Specify what module code is generated. */,
|
|
9
|
+
"moduleResolution": "Node" /* Specify how TypeScript looks up a file from a given module specifier. */,
|
|
10
|
+
|
|
11
|
+
/* JavaScript Support */
|
|
12
|
+
"allowJs": false /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */,
|
|
13
|
+
"maxNodeModuleJsDepth": 1 /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */,
|
|
14
|
+
|
|
15
|
+
/* Emit */
|
|
16
|
+
"declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
|
|
17
|
+
"emitDeclarationOnly": true /* Only output d.ts files and not JavaScript files. */,
|
|
18
|
+
"sourceMap": true /* Create source map files for emitted JavaScript files. */,
|
|
19
|
+
"outDir": "dist" /* Specify an output folder for all emitted files. */,
|
|
20
|
+
"declarationDir": "types" /* Specify the output directory for generated declaration files. */,
|
|
21
|
+
|
|
22
|
+
/* Interop Constraints */
|
|
23
|
+
"allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */,
|
|
24
|
+
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
25
|
+
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
26
|
+
|
|
27
|
+
/* Type Checking */
|
|
28
|
+
"strict": true /* Enable all strict type-checking options. */,
|
|
29
|
+
"noUnusedLocals": true /* Enable error reporting when local variables aren't read. */,
|
|
30
|
+
"noUnusedParameters": true /* Raise an error when a function parameter isn't read. */,
|
|
31
|
+
"noImplicitReturns": true /* Enable error reporting for codepaths that do not explicitly return in a function. */,
|
|
32
|
+
"noFallthroughCasesInSwitch": true /* Enable error reporting for fallthrough cases in switch statements. */,
|
|
33
|
+
"noUncheckedIndexedAccess": true /* Add 'undefined' to a type when accessed using an index. */,
|
|
34
|
+
"allowUnreachableCode": false /* Disable error reporting for unreachable code. */,
|
|
35
|
+
|
|
36
|
+
/* Completeness */
|
|
37
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
38
|
+
}
|
|
39
|
+
}
|