x-ui-design 0.2.5 → 0.2.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.
- package/dist/index.css +1 -0
- package/dist/index.esm.css +1 -0
- package/dist/index.esm.js +0 -31
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +0 -31
- package/dist/index.js.map +1 -1
- package/lib/components/Button/Button.client.tsx +2 -2
- package/lib/components/Button/Button.tsx +6 -8
- package/package.json +1 -1
package/dist/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--xui-color-hover:#f5f5f5;--xui-color-disabled:#e6e6e6;--xui-primary-color:#1677ff;--xui-primary-color-light:#40a9ff;--xui-text-color:rgba(0,0,0,.88);--xui-text-color-light:rgba(0,0,0,.5);--xui-error-color:#ff4d4f;--xui-error-color-light:#ff6668;--xui-success-color:#52c41a;--xui-background-color:#fff;--xui-font-size-xs:12px;--xui-font-size-sm:14px;--xui-font-size-md:14px;--xui-font-size-lg:16px;--xui-border-radius-sm:4px;--xui-border-radius-md:4px;--xui-border-radius-lg:6px;--xui-border-color:#d9d9d9;--xui-select-primary-color:var(--xui-primary-color);--xui-select-background-color:var(--xui-background-color)}html{font-family:sans-serif}.globalEllipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.xUi-button{border:1px solid transparent;border-radius:6px;cursor:pointer;font-weight:400;line-height:1.5715;transition:all .3s ease;user-select:none;vertical-align:middle;white-space:nowrap}.xUi-button,.xUi-button-content,.xUi-button-icon{align-items:center;display:inline-flex;justify-content:center}.xUi-button-icon{line-height:0;margin-right:.5em}.xUi-button-icon:last-child{margin-left:.5em;margin-right:0}.xUi-button-spinner{animation:xUi-spin 1s linear infinite;border:1px solid transparent;border-radius:50%;border-top:1px solid var(--xui-text-color);height:1em;width:1em}@keyframes xUi-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.xUi-button-size-small{font-size:12px;height:24px;padding:4px 12px}.xUi-button-size-middle{font-size:14px;height:32px;padding:0 16px}.xUi-button-size-large{font-size:16px;height:40px;padding:8px 20px}.xUi-button-circle{border-radius:50%;justify-content:center;padding:0}.xUi-button-circle.xUi-button-size-small{height:24px;width:24px}.xUi-button-circle.xUi-button-size-large{height:40px;width:40px}.xUi-button-round{border-radius:9999px}.xUi-button-default{background-color:#fff;border-color:var(--xui-border-color);color:rgba(0,0,0,.85)}.xUi-button-default:hover{border-color:var(--xui-primary-color);color:var(--xui-primary-color)}.xUi-button-primary{background-color:var(--xui-primary-color);border-color:var(--xui-primary-color);color:#fff}.xUi-button-primary:hover{background-color:var(--xui-primary-color-light);border-color:var(--xui-primary-color-light);color:#fff}.xUi-button-dashed{background-color:#fff;border-color:var(--xui-border-color);border-style:dashed;color:rgba(0,0,0,.85)}.xUi-button-dashed:hover{border-color:var(--xui-primary-color);color:var(--xui-primary-color)}.xUi-button-text{background-color:transparent;border-color:transparent!important;color:rgba(0,0,0,.88)}.xUi-button-text:hover{background-color:rgba(0,0,0,.04);border-color:transparent;color:rgba(0,0,0,.88)}.xUi-button-link{background-color:transparent;border-color:transparent!important;color:var(--xui-primary-color)}.xUi-button-link:hover{border-color:transparent;color:var(--xui-primary-color-light)}.xUi-button-outlined{color:#fff}.xUi-button-filled,.xUi-button-outlined{background-color:transparent;border-color:var(--xui-border-color)}.xUi-button-filled{color:var(--xui-text-color)}.xUi-button-danger{background-color:transparent;border-color:var(--xui-error-color);color:var(--xui-error-color)}.xUi-button-danger:hover{border-color:var(--xui-error-color-light);color:var(--xui-error-color-light)}.xUi-button-ghost{opacity:0}.xUi-button-ghost:hover{opacity:1}.xUi-button-block{display:flex;width:100%}.xUi-button-disabled,.xUi-button-loading{background-color:var(--xui-color-disabled);border-color:var(--xui-border-color);color:var(--xui-text-color);cursor:not-allowed;opacity:.5;pointer-events:none}.xUi-button-loading{background-color:transparent}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--xui-color-hover:#f5f5f5;--xui-color-disabled:#e6e6e6;--xui-primary-color:#1677ff;--xui-primary-color-light:#40a9ff;--xui-text-color:rgba(0,0,0,.88);--xui-text-color-light:rgba(0,0,0,.5);--xui-error-color:#ff4d4f;--xui-error-color-light:#ff6668;--xui-success-color:#52c41a;--xui-background-color:#fff;--xui-font-size-xs:12px;--xui-font-size-sm:14px;--xui-font-size-md:14px;--xui-font-size-lg:16px;--xui-border-radius-sm:4px;--xui-border-radius-md:4px;--xui-border-radius-lg:6px;--xui-border-color:#d9d9d9;--xui-select-primary-color:var(--xui-primary-color);--xui-select-background-color:var(--xui-background-color)}html{font-family:sans-serif}.globalEllipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.xUi-button{border:1px solid transparent;border-radius:6px;cursor:pointer;font-weight:400;line-height:1.5715;transition:all .3s ease;user-select:none;vertical-align:middle;white-space:nowrap}.xUi-button,.xUi-button-content,.xUi-button-icon{align-items:center;display:inline-flex;justify-content:center}.xUi-button-icon{line-height:0;margin-right:.5em}.xUi-button-icon:last-child{margin-left:.5em;margin-right:0}.xUi-button-spinner{animation:xUi-spin 1s linear infinite;border:1px solid transparent;border-radius:50%;border-top:1px solid var(--xui-text-color);height:1em;width:1em}@keyframes xUi-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.xUi-button-size-small{font-size:12px;height:24px;padding:4px 12px}.xUi-button-size-middle{font-size:14px;height:32px;padding:0 16px}.xUi-button-size-large{font-size:16px;height:40px;padding:8px 20px}.xUi-button-circle{border-radius:50%;justify-content:center;padding:0}.xUi-button-circle.xUi-button-size-small{height:24px;width:24px}.xUi-button-circle.xUi-button-size-large{height:40px;width:40px}.xUi-button-round{border-radius:9999px}.xUi-button-default{background-color:#fff;border-color:var(--xui-border-color);color:rgba(0,0,0,.85)}.xUi-button-default:hover{border-color:var(--xui-primary-color);color:var(--xui-primary-color)}.xUi-button-primary{background-color:var(--xui-primary-color);border-color:var(--xui-primary-color);color:#fff}.xUi-button-primary:hover{background-color:var(--xui-primary-color-light);border-color:var(--xui-primary-color-light);color:#fff}.xUi-button-dashed{background-color:#fff;border-color:var(--xui-border-color);border-style:dashed;color:rgba(0,0,0,.85)}.xUi-button-dashed:hover{border-color:var(--xui-primary-color);color:var(--xui-primary-color)}.xUi-button-text{background-color:transparent;border-color:transparent!important;color:rgba(0,0,0,.88)}.xUi-button-text:hover{background-color:rgba(0,0,0,.04);border-color:transparent;color:rgba(0,0,0,.88)}.xUi-button-link{background-color:transparent;border-color:transparent!important;color:var(--xui-primary-color)}.xUi-button-link:hover{border-color:transparent;color:var(--xui-primary-color-light)}.xUi-button-outlined{color:#fff}.xUi-button-filled,.xUi-button-outlined{background-color:transparent;border-color:var(--xui-border-color)}.xUi-button-filled{color:var(--xui-text-color)}.xUi-button-danger{background-color:transparent;border-color:var(--xui-error-color);color:var(--xui-error-color)}.xUi-button-danger:hover{border-color:var(--xui-error-color-light);color:var(--xui-error-color-light)}.xUi-button-ghost{opacity:0}.xUi-button-ghost:hover{opacity:1}.xUi-button-block{display:flex;width:100%}.xUi-button-disabled,.xUi-button-loading{background-color:var(--xui-color-disabled);border-color:var(--xui-border-color);color:var(--xui-text-color);cursor:not-allowed;opacity:.5;pointer-events:none}.xUi-button-loading{background-color:transparent}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,33 +1,5 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
function styleInject(css, ref) {
|
|
4
|
-
if (ref === void 0) ref = {};
|
|
5
|
-
var insertAt = ref.insertAt;
|
|
6
|
-
if (!css || typeof document === 'undefined') {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
10
|
-
var style = document.createElement('style');
|
|
11
|
-
style.type = 'text/css';
|
|
12
|
-
if (insertAt === 'top') {
|
|
13
|
-
if (head.firstChild) {
|
|
14
|
-
head.insertBefore(style, head.firstChild);
|
|
15
|
-
} else {
|
|
16
|
-
head.appendChild(style);
|
|
17
|
-
}
|
|
18
|
-
} else {
|
|
19
|
-
head.appendChild(style);
|
|
20
|
-
}
|
|
21
|
-
if (style.styleSheet) {
|
|
22
|
-
style.styleSheet.cssText = css;
|
|
23
|
-
} else {
|
|
24
|
-
style.appendChild(document.createTextNode(css));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
var css_248z$1 = ":root{--xui-color-hover:#f5f5f5;--xui-color-disabled:#e6e6e6;--xui-primary-color:#1677ff;--xui-primary-color-light:#40a9ff;--xui-text-color:rgba(0,0,0,.88);--xui-text-color-light:rgba(0,0,0,.5);--xui-error-color:#ff4d4f;--xui-error-color-light:#ff6668;--xui-success-color:#52c41a;--xui-background-color:#fff;--xui-font-size-xs:12px;--xui-font-size-sm:14px;--xui-font-size-md:14px;--xui-font-size-lg:16px;--xui-border-radius-sm:4px;--xui-border-radius-md:4px;--xui-border-radius-lg:6px;--xui-border-color:#d9d9d9;--xui-select-primary-color:var(--xui-primary-color);--xui-select-background-color:var(--xui-background-color)}html{font-family:sans-serif}.globalEllipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}";
|
|
29
|
-
styleInject(css_248z$1);
|
|
30
|
-
|
|
31
3
|
function clsx(...args) {
|
|
32
4
|
return args.flatMap(arg => {
|
|
33
5
|
if (!arg) {
|
|
@@ -51,9 +23,6 @@ function clsx(...args) {
|
|
|
51
23
|
|
|
52
24
|
const prefixClsButton = 'xUi-button';
|
|
53
25
|
|
|
54
|
-
var css_248z = ".xUi-button{border:1px solid transparent;border-radius:6px;cursor:pointer;font-weight:400;line-height:1.5715;transition:all .3s ease;user-select:none;vertical-align:middle;white-space:nowrap}.xUi-button,.xUi-button-content,.xUi-button-icon{align-items:center;display:inline-flex;justify-content:center}.xUi-button-icon{line-height:0;margin-right:.5em}.xUi-button-icon:last-child{margin-left:.5em;margin-right:0}.xUi-button-spinner{animation:xUi-spin 1s linear infinite;border:1px solid transparent;border-radius:50%;border-top:1px solid var(--xui-text-color);height:1em;width:1em}@keyframes xUi-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.xUi-button-size-small{font-size:12px;height:24px;padding:4px 12px}.xUi-button-size-middle{font-size:14px;height:32px;padding:0 16px}.xUi-button-size-large{font-size:16px;height:40px;padding:8px 20px}.xUi-button-circle{border-radius:50%;justify-content:center;padding:0}.xUi-button-circle.xUi-button-size-small{height:24px;width:24px}.xUi-button-circle.xUi-button-size-large{height:40px;width:40px}.xUi-button-round{border-radius:9999px}.xUi-button-default{background-color:#fff;border-color:var(--xui-border-color);color:rgba(0,0,0,.85)}.xUi-button-default:hover{border-color:var(--xui-primary-color);color:var(--xui-primary-color)}.xUi-button-primary{background-color:var(--xui-primary-color);border-color:var(--xui-primary-color);color:#fff}.xUi-button-primary:hover{background-color:var(--xui-primary-color-light);border-color:var(--xui-primary-color-light);color:#fff}.xUi-button-dashed{background-color:#fff;border-color:var(--xui-border-color);border-style:dashed;color:rgba(0,0,0,.85)}.xUi-button-dashed:hover{border-color:var(--xui-primary-color);color:var(--xui-primary-color)}.xUi-button-text{background-color:transparent;border-color:transparent!important;color:rgba(0,0,0,.88)}.xUi-button-text:hover{background-color:rgba(0,0,0,.04);border-color:transparent;color:rgba(0,0,0,.88)}.xUi-button-link{background-color:transparent;border-color:transparent!important;color:var(--xui-primary-color)}.xUi-button-link:hover{border-color:transparent;color:var(--xui-primary-color-light)}.xUi-button-outlined{color:#fff}.xUi-button-filled,.xUi-button-outlined{background-color:transparent;border-color:var(--xui-border-color)}.xUi-button-filled{color:var(--xui-text-color)}.xUi-button-danger{background-color:transparent;border-color:var(--xui-error-color);color:var(--xui-error-color)}.xUi-button-danger:hover{border-color:var(--xui-error-color-light);color:var(--xui-error-color-light)}.xUi-button-ghost{opacity:0}.xUi-button-ghost:hover{opacity:1}.xUi-button-block{display:flex;width:100%}.xUi-button-disabled,.xUi-button-loading{background-color:var(--xui-color-disabled);border-color:var(--xui-border-color);color:var(--xui-text-color);cursor:not-allowed;opacity:.5;pointer-events:none}.xUi-button-loading{background-color:transparent}";
|
|
55
|
-
styleInject(css_248z);
|
|
56
|
-
|
|
57
26
|
const ButtonBase = ({
|
|
58
27
|
type = 'default',
|
|
59
28
|
variant = 'solid',
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../lib/helpers/index.ts","../lib/utils/index.ts","../lib/components/Button/Button.tsx"],"sourcesContent":["import { RuleType } from '../types';\n\nexport const parseValue = (value: RuleType): RuleType => {\n if (value === 'true') {\n return true;\n }\n\n if (value === 'false') {\n return false;\n }\n\n if (!isNaN(Number(value))) {\n return Number(value);\n }\n\n return value;\n};\n\nexport function createArray(length: number): number[] {\n return Array.from({ length }, (_, index) => index);\n}\n\nexport function clsx(...args: RuleType[]): string {\n return args\n .flatMap(arg => {\n if (!arg) {\n return [];\n }\n\n if (typeof arg === 'string') {\n return [arg];\n }\n\n if (typeof arg === 'number') {\n return [String(arg)];\n }\n\n if (Array.isArray(arg)) {\n return clsx(...arg).split(' ');\n }\n\n if (typeof arg === 'object') {\n return Object.entries(arg)\n .filter(([, value]) => Boolean(value))\n .map(([key]) => key);\n }\n\n return [];\n })\n .filter(Boolean)\n .join(' ');\n}\n","export const prefixClsForm = 'xUi-form';\nexport const prefixClsFormItem = 'xUi-form-item';\nexport const prefixClsEmpty = 'xUi-empty';\nexport const prefixClsInput = 'xUi-input';\nexport const prefixClsSelect = 'xUi-select';\nexport const prefixClsCheckbox = 'xUi-checkbox';\nexport const prefixClsRadio = 'xUi-radio';\nexport const prefixClsTextArea = 'xUi-textarea';\nexport const prefixClsUpload = 'xUi-upload';\nexport const prefixClsDatePicker = 'xUi-datepicker';\nexport const prefixClsRangePicker = 'xUi-rangepicker';\nexport const prefixClsTimePicker = 'xUi-timepicker';\nexport const prefixClsButton = 'xUi-button';\nexport const prefixClsSkeleton = 'xUi-skeleton';\n","import { ReactElement, ReactNode } from 'react';\nimport { clsx } from '../../helpers';\nimport { ButtonProps } from '../../types/button';\nimport { prefixClsButton } from '../../utils';\nimport './style.css';\n\ntype ButtonBaseProps = ButtonProps & {\n iconNode?: ReactNode;\n isLoading?: boolean;\n};\n\nconst ButtonBase = ({\n type = 'default',\n variant = 'solid',\n color = 'default',\n shape = 'default',\n size = 'middle',\n htmlType = 'button',\n className,\n rootClassName,\n classNames: customClassNames = {},\n styles = {},\n prefixCls = prefixClsButton,\n iconPosition = 'start',\n disabled = false,\n ghost = false,\n danger = false,\n block = false,\n children,\n href,\n iconNode,\n isLoading = false,\n ...restProps\n}: ButtonBaseProps): ReactElement => {\n const classes = clsx(\n prefixCls,\n rootClassName,\n `${prefixCls}-${type}`,\n `${prefixCls}-${variant}`,\n `${prefixCls}-${color}`,\n `${prefixCls}-${shape}`,\n `${prefixCls}-size-${size}`,\n {\n [`${prefixCls}-block`]: block,\n [`${prefixCls}-ghost`]: ghost,\n [`${prefixCls}-danger`]: danger,\n [`${prefixCls}-loading`]: isLoading,\n [`${prefixCls}-disabled`]: disabled\n },\n className\n );\n\n const mergedDisabled = disabled || isLoading;\n\n const content = (\n <>\n {iconNode && iconPosition === 'start' && (\n <span\n className={clsx(`${prefixCls}-icon`, customClassNames.icon)}\n style={styles.icon}\n >\n {iconNode}\n </span>\n )}\n <span className={`${prefixCls}-content`}>{children}</span>\n {iconNode && iconPosition === 'end' && (\n <span\n className={clsx(`${prefixCls}-icon`, customClassNames.icon)}\n style={styles.icon}\n >\n {iconNode}\n </span>\n )}\n </>\n );\n\n if (href) {\n return (\n <a\n className={classes}\n href={mergedDisabled ? undefined : href}\n aria-disabled={mergedDisabled}\n >\n {content}\n </a>\n );\n }\n\n return (\n <button\n type={htmlType}\n className={classes}\n disabled={mergedDisabled}\n {...restProps}\n >\n {content}\n </button>\n );\n};\n\nexport default ButtonBase;\n"],"names":["clsx","args","flatMap","arg","String","Array","isArray","split","Object","entries","filter","value","Boolean","map","key","join","prefixClsButton","ButtonBase","type","variant","color","shape","size","htmlType","className","rootClassName","classNames","customClassNames","styles","prefixCls","iconPosition","disabled","ghost","danger","block","children","href","iconNode","isLoading","restProps","classes","mergedDisabled","content","_jsxs","_Fragment","_jsx","icon","style","undefined"],"mappings":";;AAsBgB,SAAAA,IAAIA,CAAC,GAAGC,IAAgB,EAAA;AACtC,EAAA,OAAOA,IAAI,CACRC,OAAO,CAACC,GAAG,IAAG;IACb,IAAI,CAACA,GAAG,EAAE;AACR,MAAA,OAAO,EAAE,CAAA;AACX,KAAA;AAEA,IAAA,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;MAC3B,OAAO,CAACA,GAAG,CAAC,CAAA;AACd,KAAA;AAEA,IAAA,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;AAC3B,MAAA,OAAO,CAACC,MAAM,CAACD,GAAG,CAAC,CAAC,CAAA;AACtB,KAAA;AAEA,IAAA,IAAIE,KAAK,CAACC,OAAO,CAACH,GAAG,CAAC,EAAE;MACtB,OAAOH,IAAI,CAAC,GAAGG,GAAG,CAAC,CAACI,KAAK,CAAC,GAAG,CAAC,CAAA;AAChC,KAAA;AAEA,IAAA,IAAI,OAAOJ,GAAG,KAAK,QAAQ,EAAE;AAC3B,MAAA,OAAOK,MAAM,CAACC,OAAO,CAACN,GAAG,CAAC,CACvBO,MAAM,CAAC,CAAC,GAAGC,KAAK,CAAC,KAAKC,OAAO,CAACD,KAAK,CAAC,CAAC,CACrCE,GAAG,CAAC,CAAC,CAACC,GAAG,CAAC,KAAKA,GAAG,CAAC,CAAA;AACxB,KAAA;AAEA,IAAA,OAAO,EAAE,CAAA;GACV,CAAC,CACDJ,MAAM,CAACE,OAAO,CAAC,CACfG,IAAI,CAAC,GAAG,CAAC,CAAA;AACd;;ACvCO,MAAMC,eAAe,GAAG,YAAY;;ACDrCC,MAAAA,UAAU,GAAGA,CAAC;AAClBC,EAAAA,IAAI,GAAG,SAAS;AAChBC,EAAAA,OAAO,GAAG,OAAO;A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AA;AAAO,GAAA,CACD,CAAA;AAEb;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -2,34 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
|
|
5
|
-
function styleInject(css, ref) {
|
|
6
|
-
if (ref === void 0) ref = {};
|
|
7
|
-
var insertAt = ref.insertAt;
|
|
8
|
-
if (!css || typeof document === 'undefined') {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
12
|
-
var style = document.createElement('style');
|
|
13
|
-
style.type = 'text/css';
|
|
14
|
-
if (insertAt === 'top') {
|
|
15
|
-
if (head.firstChild) {
|
|
16
|
-
head.insertBefore(style, head.firstChild);
|
|
17
|
-
} else {
|
|
18
|
-
head.appendChild(style);
|
|
19
|
-
}
|
|
20
|
-
} else {
|
|
21
|
-
head.appendChild(style);
|
|
22
|
-
}
|
|
23
|
-
if (style.styleSheet) {
|
|
24
|
-
style.styleSheet.cssText = css;
|
|
25
|
-
} else {
|
|
26
|
-
style.appendChild(document.createTextNode(css));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
var css_248z$1 = ":root{--xui-color-hover:#f5f5f5;--xui-color-disabled:#e6e6e6;--xui-primary-color:#1677ff;--xui-primary-color-light:#40a9ff;--xui-text-color:rgba(0,0,0,.88);--xui-text-color-light:rgba(0,0,0,.5);--xui-error-color:#ff4d4f;--xui-error-color-light:#ff6668;--xui-success-color:#52c41a;--xui-background-color:#fff;--xui-font-size-xs:12px;--xui-font-size-sm:14px;--xui-font-size-md:14px;--xui-font-size-lg:16px;--xui-border-radius-sm:4px;--xui-border-radius-md:4px;--xui-border-radius-lg:6px;--xui-border-color:#d9d9d9;--xui-select-primary-color:var(--xui-primary-color);--xui-select-background-color:var(--xui-background-color)}html{font-family:sans-serif}.globalEllipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}";
|
|
31
|
-
styleInject(css_248z$1);
|
|
32
|
-
|
|
33
5
|
function clsx(...args) {
|
|
34
6
|
return args.flatMap(arg => {
|
|
35
7
|
if (!arg) {
|
|
@@ -53,9 +25,6 @@ function clsx(...args) {
|
|
|
53
25
|
|
|
54
26
|
const prefixClsButton = 'xUi-button';
|
|
55
27
|
|
|
56
|
-
var css_248z = ".xUi-button{border:1px solid transparent;border-radius:6px;cursor:pointer;font-weight:400;line-height:1.5715;transition:all .3s ease;user-select:none;vertical-align:middle;white-space:nowrap}.xUi-button,.xUi-button-content,.xUi-button-icon{align-items:center;display:inline-flex;justify-content:center}.xUi-button-icon{line-height:0;margin-right:.5em}.xUi-button-icon:last-child{margin-left:.5em;margin-right:0}.xUi-button-spinner{animation:xUi-spin 1s linear infinite;border:1px solid transparent;border-radius:50%;border-top:1px solid var(--xui-text-color);height:1em;width:1em}@keyframes xUi-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.xUi-button-size-small{font-size:12px;height:24px;padding:4px 12px}.xUi-button-size-middle{font-size:14px;height:32px;padding:0 16px}.xUi-button-size-large{font-size:16px;height:40px;padding:8px 20px}.xUi-button-circle{border-radius:50%;justify-content:center;padding:0}.xUi-button-circle.xUi-button-size-small{height:24px;width:24px}.xUi-button-circle.xUi-button-size-large{height:40px;width:40px}.xUi-button-round{border-radius:9999px}.xUi-button-default{background-color:#fff;border-color:var(--xui-border-color);color:rgba(0,0,0,.85)}.xUi-button-default:hover{border-color:var(--xui-primary-color);color:var(--xui-primary-color)}.xUi-button-primary{background-color:var(--xui-primary-color);border-color:var(--xui-primary-color);color:#fff}.xUi-button-primary:hover{background-color:var(--xui-primary-color-light);border-color:var(--xui-primary-color-light);color:#fff}.xUi-button-dashed{background-color:#fff;border-color:var(--xui-border-color);border-style:dashed;color:rgba(0,0,0,.85)}.xUi-button-dashed:hover{border-color:var(--xui-primary-color);color:var(--xui-primary-color)}.xUi-button-text{background-color:transparent;border-color:transparent!important;color:rgba(0,0,0,.88)}.xUi-button-text:hover{background-color:rgba(0,0,0,.04);border-color:transparent;color:rgba(0,0,0,.88)}.xUi-button-link{background-color:transparent;border-color:transparent!important;color:var(--xui-primary-color)}.xUi-button-link:hover{border-color:transparent;color:var(--xui-primary-color-light)}.xUi-button-outlined{color:#fff}.xUi-button-filled,.xUi-button-outlined{background-color:transparent;border-color:var(--xui-border-color)}.xUi-button-filled{color:var(--xui-text-color)}.xUi-button-danger{background-color:transparent;border-color:var(--xui-error-color);color:var(--xui-error-color)}.xUi-button-danger:hover{border-color:var(--xui-error-color-light);color:var(--xui-error-color-light)}.xUi-button-ghost{opacity:0}.xUi-button-ghost:hover{opacity:1}.xUi-button-block{display:flex;width:100%}.xUi-button-disabled,.xUi-button-loading{background-color:var(--xui-color-disabled);border-color:var(--xui-border-color);color:var(--xui-text-color);cursor:not-allowed;opacity:.5;pointer-events:none}.xUi-button-loading{background-color:transparent}";
|
|
57
|
-
styleInject(css_248z);
|
|
58
|
-
|
|
59
28
|
const ButtonBase = ({
|
|
60
29
|
type = 'default',
|
|
61
30
|
variant = 'solid',
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../lib/helpers/index.ts","../lib/utils/index.ts","../lib/components/Button/Button.tsx"],"sourcesContent":["import { RuleType } from '../types';\n\nexport const parseValue = (value: RuleType): RuleType => {\n if (value === 'true') {\n return true;\n }\n\n if (value === 'false') {\n return false;\n }\n\n if (!isNaN(Number(value))) {\n return Number(value);\n }\n\n return value;\n};\n\nexport function createArray(length: number): number[] {\n return Array.from({ length }, (_, index) => index);\n}\n\nexport function clsx(...args: RuleType[]): string {\n return args\n .flatMap(arg => {\n if (!arg) {\n return [];\n }\n\n if (typeof arg === 'string') {\n return [arg];\n }\n\n if (typeof arg === 'number') {\n return [String(arg)];\n }\n\n if (Array.isArray(arg)) {\n return clsx(...arg).split(' ');\n }\n\n if (typeof arg === 'object') {\n return Object.entries(arg)\n .filter(([, value]) => Boolean(value))\n .map(([key]) => key);\n }\n\n return [];\n })\n .filter(Boolean)\n .join(' ');\n}\n","export const prefixClsForm = 'xUi-form';\nexport const prefixClsFormItem = 'xUi-form-item';\nexport const prefixClsEmpty = 'xUi-empty';\nexport const prefixClsInput = 'xUi-input';\nexport const prefixClsSelect = 'xUi-select';\nexport const prefixClsCheckbox = 'xUi-checkbox';\nexport const prefixClsRadio = 'xUi-radio';\nexport const prefixClsTextArea = 'xUi-textarea';\nexport const prefixClsUpload = 'xUi-upload';\nexport const prefixClsDatePicker = 'xUi-datepicker';\nexport const prefixClsRangePicker = 'xUi-rangepicker';\nexport const prefixClsTimePicker = 'xUi-timepicker';\nexport const prefixClsButton = 'xUi-button';\nexport const prefixClsSkeleton = 'xUi-skeleton';\n","import { ReactElement, ReactNode } from 'react';\nimport { clsx } from '../../helpers';\nimport { ButtonProps } from '../../types/button';\nimport { prefixClsButton } from '../../utils';\nimport './style.css';\n\ntype ButtonBaseProps = ButtonProps & {\n iconNode?: ReactNode;\n isLoading?: boolean;\n};\n\nconst ButtonBase = ({\n type = 'default',\n variant = 'solid',\n color = 'default',\n shape = 'default',\n size = 'middle',\n htmlType = 'button',\n className,\n rootClassName,\n classNames: customClassNames = {},\n styles = {},\n prefixCls = prefixClsButton,\n iconPosition = 'start',\n disabled = false,\n ghost = false,\n danger = false,\n block = false,\n children,\n href,\n iconNode,\n isLoading = false,\n ...restProps\n}: ButtonBaseProps): ReactElement => {\n const classes = clsx(\n prefixCls,\n rootClassName,\n `${prefixCls}-${type}`,\n `${prefixCls}-${variant}`,\n `${prefixCls}-${color}`,\n `${prefixCls}-${shape}`,\n `${prefixCls}-size-${size}`,\n {\n [`${prefixCls}-block`]: block,\n [`${prefixCls}-ghost`]: ghost,\n [`${prefixCls}-danger`]: danger,\n [`${prefixCls}-loading`]: isLoading,\n [`${prefixCls}-disabled`]: disabled\n },\n className\n );\n\n const mergedDisabled = disabled || isLoading;\n\n const content = (\n <>\n {iconNode && iconPosition === 'start' && (\n <span\n className={clsx(`${prefixCls}-icon`, customClassNames.icon)}\n style={styles.icon}\n >\n {iconNode}\n </span>\n )}\n <span className={`${prefixCls}-content`}>{children}</span>\n {iconNode && iconPosition === 'end' && (\n <span\n className={clsx(`${prefixCls}-icon`, customClassNames.icon)}\n style={styles.icon}\n >\n {iconNode}\n </span>\n )}\n </>\n );\n\n if (href) {\n return (\n <a\n className={classes}\n href={mergedDisabled ? undefined : href}\n aria-disabled={mergedDisabled}\n >\n {content}\n </a>\n );\n }\n\n return (\n <button\n type={htmlType}\n className={classes}\n disabled={mergedDisabled}\n {...restProps}\n >\n {content}\n </button>\n );\n};\n\nexport default ButtonBase;\n"],"names":["clsx","args","flatMap","arg","String","Array","isArray","split","Object","entries","filter","value","Boolean","map","key","join","prefixClsButton","ButtonBase","type","variant","color","shape","size","htmlType","className","rootClassName","classNames","customClassNames","styles","prefixCls","iconPosition","disabled","ghost","danger","block","children","href","iconNode","isLoading","restProps","classes","mergedDisabled","content","_jsxs","_Fragment","_jsx","icon","style","undefined"],"mappings":";;;;AAsBgB,SAAAA,IAAIA,CAAC,GAAGC,IAAgB,EAAA;AACtC,EAAA,OAAOA,IAAI,CACRC,OAAO,CAACC,GAAG,IAAG;IACb,IAAI,CAACA,GAAG,EAAE;AACR,MAAA,OAAO,EAAE,CAAA;AACX,KAAA;AAEA,IAAA,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;MAC3B,OAAO,CAACA,GAAG,CAAC,CAAA;AACd,KAAA;AAEA,IAAA,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;AAC3B,MAAA,OAAO,CAACC,MAAM,CAACD,GAAG,CAAC,CAAC,CAAA;AACtB,KAAA;AAEA,IAAA,IAAIE,KAAK,CAACC,OAAO,CAACH,GAAG,CAAC,EAAE;MACtB,OAAOH,IAAI,CAAC,GAAGG,GAAG,CAAC,CAACI,KAAK,CAAC,GAAG,CAAC,CAAA;AAChC,KAAA;AA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AAK,EAAEnB,MAAM,CAACkB,IAAI;AAEjBX,MAAAA,QAAA,EAAAE,QAAAA;MAEJ,CAAA;AAAA,GAAA,CAEJ,CAAA;AAED,EAAA,IAAID,IAAI,EAAE;IACR,OACES;AACErB,MAAAA,SAAS,EAAEgB,OAAO;AAClBJ,MAAAA,IAAI,EAAEK,cAAc,GAAGO,SAAS,GAAGZ,IAAI;AAAA,MAAA,eAAA,EACxBK,cAAc;AAE5BN,MAAAA,QAAA,EAAAO,OAAAA;AACC,KAAA,CAAA,CAAA;AAER,GAAA;EAEA,OACEG,cACE,CAAA,QAAA,EAAA;AAAA3B,IAAAA,IAAI,EAAEK,QAAQ;AACdC,IAAAA,SAAS,EAAEgB,OAAO;AAClBT,IAAAA,QAAQ,EAAEU,cAAc;AACpB,IAAA,GAAAF,SAAS;cAEZG,OAAAA;AAAO,GAAA,CACD,CAAA;AAEb;;;;"}
|
|
@@ -5,7 +5,7 @@ import ButtonBase from './Button';
|
|
|
5
5
|
import { ButtonProps } from '../../types/button';
|
|
6
6
|
import { prefixClsButton } from '../../utils';
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const ButtonClient = (props: ButtonProps) => {
|
|
9
9
|
const {
|
|
10
10
|
loading = false,
|
|
11
11
|
icon,
|
|
@@ -36,4 +36,4 @@ const MyButton = (props: ButtonProps) => {
|
|
|
36
36
|
return <ButtonBase {...props} isLoading={innerLoading} iconNode={iconNode} />;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
export default
|
|
39
|
+
export default ButtonClient;
|
|
@@ -4,12 +4,7 @@ import { ButtonProps } from '../../types/button';
|
|
|
4
4
|
import { prefixClsButton } from '../../utils';
|
|
5
5
|
import './style.css';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
iconNode?: ReactNode;
|
|
9
|
-
isLoading?: boolean;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const ButtonBase = ({
|
|
7
|
+
const Button = ({
|
|
13
8
|
type = 'default',
|
|
14
9
|
variant = 'solid',
|
|
15
10
|
color = 'default',
|
|
@@ -31,7 +26,10 @@ const ButtonBase = ({
|
|
|
31
26
|
iconNode,
|
|
32
27
|
isLoading = false,
|
|
33
28
|
...restProps
|
|
34
|
-
}:
|
|
29
|
+
}: ButtonProps & {
|
|
30
|
+
iconNode?: ReactNode;
|
|
31
|
+
isLoading?: boolean;
|
|
32
|
+
}): ReactElement => {
|
|
35
33
|
const classes = clsx(
|
|
36
34
|
prefixCls,
|
|
37
35
|
rootClassName,
|
|
@@ -98,4 +96,4 @@ const ButtonBase = ({
|
|
|
98
96
|
);
|
|
99
97
|
};
|
|
100
98
|
|
|
101
|
-
export default
|
|
99
|
+
export default Button;
|