@ioca/react 1.3.86 → 1.3.88

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/cjs/components/button/button.js +2 -0
  2. package/lib/cjs/components/button/button.js.map +1 -1
  3. package/lib/cjs/components/button/confirm.js +58 -0
  4. package/lib/cjs/components/button/confirm.js.map +1 -0
  5. package/lib/cjs/components/drawer/drawer.js +33 -27
  6. package/lib/cjs/components/drawer/drawer.js.map +1 -1
  7. package/lib/cjs/components/dropdown/dropdown.js +6 -2
  8. package/lib/cjs/components/dropdown/dropdown.js.map +1 -1
  9. package/lib/cjs/components/form/useForm.js +8 -2
  10. package/lib/cjs/components/form/useForm.js.map +1 -1
  11. package/lib/cjs/components/input/input.js +2 -1
  12. package/lib/cjs/components/input/input.js.map +1 -1
  13. package/lib/cjs/components/input/number.js +1 -1
  14. package/lib/cjs/components/input/number.js.map +1 -1
  15. package/lib/cjs/components/input/range.js +8 -9
  16. package/lib/cjs/components/input/range.js.map +1 -1
  17. package/lib/cjs/components/input/textarea.js +1 -1
  18. package/lib/cjs/components/input/textarea.js.map +1 -1
  19. package/lib/cjs/components/modal/modal.js +14 -8
  20. package/lib/cjs/components/modal/modal.js.map +1 -1
  21. package/lib/cjs/components/popconfirm/popconfirm.js +1 -1
  22. package/lib/cjs/components/popconfirm/popconfirm.js.map +1 -1
  23. package/lib/cjs/components/progress/progress.js +3 -3
  24. package/lib/cjs/components/progress/progress.js.map +1 -1
  25. package/lib/css/index.css +1 -1
  26. package/lib/css/index.css.map +1 -1
  27. package/lib/es/components/button/button.js +2 -0
  28. package/lib/es/components/button/button.js.map +1 -1
  29. package/lib/es/components/button/confirm.js +54 -0
  30. package/lib/es/components/button/confirm.js.map +1 -0
  31. package/lib/es/components/drawer/drawer.js +34 -28
  32. package/lib/es/components/drawer/drawer.js.map +1 -1
  33. package/lib/es/components/dropdown/dropdown.js +6 -2
  34. package/lib/es/components/dropdown/dropdown.js.map +1 -1
  35. package/lib/es/components/form/useForm.js +8 -2
  36. package/lib/es/components/form/useForm.js.map +1 -1
  37. package/lib/es/components/input/input.js +2 -1
  38. package/lib/es/components/input/input.js.map +1 -1
  39. package/lib/es/components/input/number.js +1 -1
  40. package/lib/es/components/input/number.js.map +1 -1
  41. package/lib/es/components/input/range.js +8 -9
  42. package/lib/es/components/input/range.js.map +1 -1
  43. package/lib/es/components/input/textarea.js +1 -1
  44. package/lib/es/components/input/textarea.js.map +1 -1
  45. package/lib/es/components/modal/modal.js +14 -8
  46. package/lib/es/components/modal/modal.js.map +1 -1
  47. package/lib/es/components/popconfirm/popconfirm.js +1 -1
  48. package/lib/es/components/popconfirm/popconfirm.js.map +1 -1
  49. package/lib/es/components/progress/progress.js +4 -4
  50. package/lib/es/components/progress/progress.js.map +1 -1
  51. package/lib/index.js +132 -62
  52. package/lib/types/components/button/confirm.d.ts +6 -0
  53. package/lib/types/components/button/type.d.ts +9 -1
  54. package/lib/types/components/dropdown/type.d.ts +2 -1
  55. package/lib/types/components/form/type.d.ts +1 -1
  56. package/lib/types/type/index.d.ts +1 -1
  57. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"popconfirm.js","sources":["../../../../packages/components/popconfirm/popconfirm.tsx"],"sourcesContent":["import { InfoOutlined } from \"@ricons/material\";\nimport { useReactive } from \"ahooks\";\nimport { MouseEvent } from \"react\";\nimport Button from \"../button\";\nimport { IButton } from \"../button/type\";\nimport Flex from \"../flex\";\nimport Icon from \"../icon\";\nimport Popup from \"../popup\";\nimport \"./index.css\";\nimport { IPopconfirm } from \"./type\";\n\nconst defaultOk = {\n\tchildren: \"确定\",\n};\n\nconst defaultCancel = {\n\tchildren: \"取消\",\n\tsecondary: true,\n};\n\nconst Popconfirm = (props: IPopconfirm) => {\n\tconst {\n\t\ttrigger = \"click\",\n\t\tvisible,\n\t\ticon = <Icon icon={<InfoOutlined />} className='error' size='1.2em' />,\n\t\tcontent,\n\t\tokButtonProps,\n\t\tcancelButtonProps,\n\t\tchildren,\n\t\talign = \"end\",\n\t\tposition = \"top\",\n\t\toffset = 12,\n\t\textra,\n\t\tonOk,\n\t\tonClose,\n\t\t...restProps\n\t} = props;\n\n\tconst state = useReactive({\n\t\tloading: false,\n\t\tvisible,\n\t});\n\n\tconst ok: IButton = okButtonProps\n\t\t? Object.assign({}, defaultOk, okButtonProps)\n\t\t: defaultOk;\n\tconst cancel: IButton = cancelButtonProps\n\t\t? Object.assign({}, defaultCancel, cancelButtonProps)\n\t\t: defaultCancel;\n\n\tconst handleVisibleChange = (v: boolean) => {\n\t\tstate.visible = v;\n\t\trestProps.onVisibleChange?.(v);\n\t};\n\n\tconst handleOk = async (e: MouseEvent<HTMLElement>) => {\n\t\tstate.loading = true;\n\t\tok.onClick?.(e);\n\n\t\tonOk?.()\n\t\t\t?.then(() => {\n\t\t\t\tstate.visible = false;\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tstate.loading = false;\n\t\t\t});\n\t};\n\n\tconst handleCancel = async (e: MouseEvent<HTMLElement>) => {\n\t\tcancel.onClick?.(e);\n\t\tawait onClose?.();\n\t\tstate.visible = false;\n\t};\n\n\tconst popconfirmContent = (\n\t\t<div className='i-popconfirm'>\n\t\t\t<Flex gap='.5em'>\n\t\t\t\t{icon}\n\t\t\t\t<div className='i-popconfirm-content'>{content}</div>\n\t\t\t</Flex>\n\n\t\t\t<Flex\n\t\t\t\tgap={12}\n\t\t\t\tjustify='flex-end'\n\t\t\t\tclassName='mt-8 i-popconfirm-footer'\n\t\t\t>\n\t\t\t\t{cancelButtonProps !== null && (\n\t\t\t\t\t<Button {...cancel} onClick={handleCancel} />\n\t\t\t\t)}\n\t\t\t\t{extra}\n\t\t\t\t{okButtonProps !== null && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tloading={state.loading}\n\t\t\t\t\t\t{...ok}\n\t\t\t\t\t\tonClick={handleOk}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</Flex>\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<Popup\n\t\t\tcontent={popconfirmContent}\n\t\t\t{...restProps}\n\t\t\ttrigger={trigger}\n\t\t\tvisible={state.visible}\n\t\t\talign={align}\n\t\t\toffset={offset}\n\t\t\tposition={position}\n\t\t\tonVisibleChange={handleVisibleChange}\n\t\t>\n\t\t\t{children}\n\t\t</Popup>\n\t);\n};\n\nexport default Popconfirm;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;AAWA,MAAM,SAAS,GAAG;AACjB,IAAA,QAAQ,EAAE,IAAI;CACd;AAED,MAAM,aAAa,GAAG;AACrB,IAAA,QAAQ,EAAE,IAAI;AACd,IAAA,SAAS,EAAE,IAAI;CACf;AAED,MAAM,UAAU,GAAG,CAAC,KAAkB,KAAI;IACzC,MAAM,EACL,OAAO,GAAG,OAAO,EACjB,OAAO,EACP,IAAI,GAAGA,GAAC,CAAA,IAAI,EAAC,EAAA,IAAI,EAAEA,GAAA,CAAC,YAAY,EAAA,EAAA,CAAG,EAAE,SAAS,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO,EAAG,CAAA,EACtE,OAAO,EACP,aAAa,EACb,iBAAiB,EACjB,QAAQ,EACR,KAAK,GAAG,KAAK,EACb,QAAQ,GAAG,KAAK,EAChB,MAAM,GAAG,EAAE,EACX,KAAK,EACL,IAAI,EACJ,OAAO,EACP,GAAG,SAAS,EACZ,GAAG,KAAK;IAET,MAAM,KAAK,GAAG,WAAW,CAAC;AACzB,QAAA,OAAO,EAAE,KAAK;QACd,OAAO;AACP,KAAA,CAAC;IAEF,MAAM,EAAE,GAAY;UACjB,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,aAAa;UAC1C,SAAS;IACZ,MAAM,MAAM,GAAY;UACrB,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,aAAa,EAAE,iBAAiB;UAClD,aAAa;AAEhB,IAAA,MAAM,mBAAmB,GAAG,CAAC,CAAU,KAAI;AAC1C,QA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AQ,EAAA,CAChB,CACF,CACK,EAAA,CAAA,CAAA,EAAA,CACF,CACN;AAED,IAAA,QACCA,GAAC,CAAA,KAAK,EACL,EAAA,OAAO,EAAE,iBAAiB,EAAA,GACtB,SAAS,EACb,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,mBAAmB,YAEnC,QAAQ,EAAA,CACF;AAEV;;;;"}
1
+ {"version":3,"file":"popconfirm.js","sources":["../../../../packages/components/popconfirm/popconfirm.tsx"],"sourcesContent":["import { InfoOutlined } from \"@ricons/material\";\nimport { useReactive } from \"ahooks\";\nimport { MouseEvent } from \"react\";\nimport Button from \"../button\";\nimport { IButton } from \"../button/type\";\nimport Flex from \"../flex\";\nimport Icon from \"../icon\";\nimport Popup from \"../popup\";\nimport \"./index.css\";\nimport { IPopconfirm } from \"./type\";\n\nconst defaultOk = {\n\tchildren: \"确定\",\n};\n\nconst defaultCancel = {\n\tchildren: \"取消\",\n\tsecondary: true,\n};\n\nconst Popconfirm = (props: IPopconfirm) => {\n\tconst {\n\t\ttrigger = \"click\",\n\t\tvisible,\n\t\ticon = <Icon icon={<InfoOutlined />} className='error' size='1.2em' />,\n\t\tcontent,\n\t\tokButtonProps,\n\t\tcancelButtonProps,\n\t\tchildren,\n\t\talign = \"end\",\n\t\tposition = \"top\",\n\t\toffset = 12,\n\t\textra,\n\t\tonOk,\n\t\tonClose,\n\t\t...restProps\n\t} = props;\n\n\tconst state = useReactive({\n\t\tloading: false,\n\t\tvisible,\n\t});\n\n\tconst ok: IButton = okButtonProps\n\t\t? Object.assign({}, defaultOk, okButtonProps)\n\t\t: defaultOk;\n\tconst cancel: IButton = cancelButtonProps\n\t\t? Object.assign({}, defaultCancel, cancelButtonProps)\n\t\t: defaultCancel;\n\n\tconst handleVisibleChange = (v: boolean) => {\n\t\tstate.visible = v;\n\t\trestProps.onVisibleChange?.(v);\n\t};\n\n\tconst handleOk = async (e: MouseEvent<HTMLElement>) => {\n\t\tstate.loading = true;\n\t\tok.onClick?.(e);\n\n\t\tonOk?.()\n\t\t\t?.then(() => {\n\t\t\t\tstate.visible = false;\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tstate.loading = false;\n\t\t\t});\n\t};\n\n\tconst handleCancel = async (e: MouseEvent<HTMLElement>) => {\n\t\tcancel.onClick?.(e);\n\t\tawait onClose?.();\n\t\tstate.visible = false;\n\t};\n\n\tconst popconfirmContent = (\n\t\t<div className='i-popconfirm'>\n\t\t\t<Flex gap='.5em'>\n\t\t\t\t{icon}\n\t\t\t\t<div className='i-popconfirm-content'>{content}</div>\n\t\t\t</Flex>\n\n\t\t\t<Flex gap={12} justify='flex-end' className='i-popconfirm-footer'>\n\t\t\t\t{cancelButtonProps !== null && (\n\t\t\t\t\t<Button {...cancel} onClick={handleCancel} />\n\t\t\t\t)}\n\t\t\t\t{extra}\n\t\t\t\t{okButtonProps !== null && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tloading={state.loading}\n\t\t\t\t\t\t{...ok}\n\t\t\t\t\t\tonClick={handleOk}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</Flex>\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<Popup\n\t\t\tcontent={popconfirmContent}\n\t\t\t{...restProps}\n\t\t\ttrigger={trigger}\n\t\t\tvisible={state.visible}\n\t\t\talign={align}\n\t\t\toffset={offset}\n\t\t\tposition={position}\n\t\t\tonVisibleChange={handleVisibleChange}\n\t\t>\n\t\t\t{children}\n\t\t</Popup>\n\t);\n};\n\nexport default Popconfirm;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;AAWA,MAAM,SAAS,GAAG;AACjB,IAAA,QAAQ,EAAE,IAAI;CACd;AAED,MAAM,aAAa,GAAG;AACrB,IAAA,QAAQ,EAAE,IAAI;AACd,IAAA,SAAS,EAAE,IAAI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ames';
4
- import { useRef, useMemo, useEffect } from 'react';
4
+ import { useRef, useEffect } from 'react';
5
5
  import { useMouseMove, useMouseUp } from '../../js/hooks.js';
6
6
  import Circle from './circle.js';
7
7
  import Line from './line.js';
@@ -18,12 +18,12 @@ const Progress = (props) => {
18
18
  const pageXY = vertical ? "pageY" : "pageX";
19
19
  const rectTL = vertical ? "top" : "left";
20
20
  const rectWH = vertical ? "height" : "width";
21
- const toFixedValue = useMemo(() => {
21
+ const getFixedValue = () => {
22
22
  let value = +state.value.toFixed(precision);
23
23
  value = Math.min(100, value);
24
24
  value = Math.max(0, value);
25
25
  return value;
26
- }, [state.value, precision]);
26
+ };
27
27
  const handleMouseDown = (e) => {
28
28
  if (!ref.current || !draggable)
29
29
  return;
@@ -57,7 +57,7 @@ const Progress = (props) => {
57
57
  const handleMouseUp = () => {
58
58
  if (!state.dragging || !draggable)
59
59
  return;
60
- onChange?.(toFixedValue);
60
+ onChange?.(getFixedValue());
61
61
  state.dragging = false;
62
62
  onDraggingChange?.(false);
63
63
  };
@@ -1 +1 @@
1
- {"version":3,"file":"progress.js","sources":["../../../../packages/components/progress/progress.tsx"],"sourcesContent":["import { useReactive } from \"ahooks\";\nimport classNames from \"classnames\";\nimport { useEffect, useMemo, useRef } from \"react\";\nimport \"../../css/input.css\";\nimport { useMouseMove, useMouseUp } from \"../../js/hooks\";\nimport Circle from \"./circle\";\nimport \"./index.css\";\nimport Line from \"./line\";\nimport { IProgress } from \"./type\";\n\nconst Progress = (props: IProgress) => {\n\tconst {\n\t\tvalue = 0,\n\t\tlineWidth = 8,\n\t\tcircleSize = 40,\n\t\tprecision = 0,\n\t\tstyle,\n\t\tdraggable = true,\n\t\ttype = \"line\",\n\t\tbarClass,\n\t\tvertical,\n\t\tlabel,\n\t\tlabelInline,\n\t\tclassName,\n\t\trenderCursor,\n\t\tonChange,\n\t\tonDraggingChange,\n\t} = props;\n\n\tconst ref = useRef<HTMLDivElement>(null);\n\tconst state = useReactive({\n\t\tvalue,\n\t\tdragging: false,\n\t\tsize: 0,\n\t\tstart: 0,\n\t});\n\n\tconst pageXY = vertical ? \"pageY\" : \"pageX\";\n\tconst rectTL = vertical ? \"top\" : \"left\";\n\tconst rectWH = vertical ? \"height\" : \"width\";\n\n\tconst toFixedValue = useMemo(() => {\n\t\tlet value = +state.value.toFixed(precision);\n\t\tvalue = Math.min(100, value);\n\t\tvalue = Math.max(0, value);\n\n\t\treturn value;\n\t}, [state.value, precision]);\n\n\tconst handleMouseDown = (e) => {\n\t\tif (!ref.current || !draggable) return;\n\n\t\tif (e.touches) {\n\t\t\te = e.touches[0];\n\t\t}\n\n\t\tconst rect = ref.current.getBoundingClientRect();\n\t\tconst value = ((e[pageXY] - rect[rectTL]) * 100) / rect[rectWH];\n\n\t\tObject.assign(state, {\n\t\t\tvalue: vertical ? 100 - value : value,\n\t\t\tsize: rect[rectWH],\n\t\t\tstart: rect[rectTL],\n\t\t\tdragging: true,\n\t\t});\n\t\tonDraggingChange?.(true);\n\t};\n\n\tconst handleMouseMove = (e) => {\n\t\tif (!state.dragging || !draggable) return;\n\t\te.preventDefault();\n\n\t\tif (e.touches) {\n\t\t\te = e.touches[0];\n\t\t}\n\n\t\tconst { start, size } = state;\n\t\tconst offset = e[pageXY] - start;\n\n\t\tif (offset < 0 || offset > size) return;\n\n\t\tconst value = ((e[pageXY] - start) * 100) / size;\n\t\tstate.value = vertical ? 100 - value : value;\n\t};\n\n\tconst handleMouseUp = () => {\n\t\tif (!state.dragging || !draggable) return;\n\n\t\tonChange?.(toFixedValue);\n\t\tstate.dragging = false;\n\t\tonDraggingChange?.(false);\n\t};\n\n\tuseMouseMove(handleMouseMove);\n\tuseMouseUp(handleMouseUp);\n\n\tuseEffect(() => {\n\t\tif (value > 100) {\n\t\t\tstate.value = 100;\n\t\t\treturn;\n\t\t}\n\n\t\tif (value < 0) {\n\t\t\tstate.value = 0;\n\t\t\treturn;\n\t\t}\n\n\t\tstate.value = value;\n\t}, [value]);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames(\"i-input-label\", className, {\n\t\t\t\t\"i-input-inline\": labelInline,\n\t\t\t})}\n\t\t\tstyle={style}\n\t\t>\n\t\t\t{label && <span className='i-input-label-text'>{label}</span>}\n\n\t\t\t{type === \"line\" && (\n\t\t\t\t<Line\n\t\t\t\t\tref={ref}\n\t\t\t\t\tvertical={vertical}\n\t\t\t\t\tlineWidth={lineWidth}\n\t\t\t\t\tbarClass={barClass}\n\t\t\t\t\tdragging={state.dragging}\n\t\t\t\t\tvalue={state.value}\n\t\t\t\t\trenderCursor={renderCursor}\n\t\t\t\t\tonMouseDown={handleMouseDown}\n\t\t\t\t\tonTouchStart={handleMouseDown}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t{type === \"circle\" && (\n\t\t\t\t<Circle\n\t\t\t\t\tvalue={state.value}\n\t\t\t\t\tcircleSize={circleSize}\n\t\t\t\t\tlineWidth={lineWidth}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nexport default Progress;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;AAUA,MAAM,QAAQ,GAAG,CAAC,KAAgB,KAAI;IACrC,MAAM,EACL,KAAK,GAAG,CAAC,EACT,SAAS,GAAG,CAAC,EACb,UAAU,GAAG,EAAE,EACf,SAAS,GAAG,CAAC,EACb,KAAK,EACL,SAAS,GAAG,IAAI,EAChB,IAAI,GAAG,MAAM,EACb,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,WAAW,EACX,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,gBAAgB,GAChB,GAAG,KAAK;AAET,IAAA,MAAM,GAAG,GAAG,MAAM,CAAiB,IAAI,CAAC;IACxC,MAAM,KAAK,GAAG,WAAW,CAAC;QACzB,KAAK;AACL,QAAA,QAAQ,EAAE,KAAK;AACf,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,KAAK,EAAE,CAAC;AACR,KAAA,CAAC;IAEF,MAAM,MAAM,GAAG,QAAQ,G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,EAAE,SAAS,EAAE;AACjD,YAAA,gBAAgB,EAAE,WAAW;AAC7B,SAAA,CAAC,EACF,KAAK,EAAE,KAAK,EAEX,QAAA,EAAA,CAAA,KAAK,IAAIC,GAAM,CAAA,MAAA,EAAA,EAAA,SAAS,EAAC,oBAAoB,EAAA,QAAA,EAAE,KAAK,EAAQ,CAAA,EAE5D,IAAI,KAAK,MAAM,KACfA,GAAA,CAAC,IAAI,EACJ,EAAA,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,eAAe,EAC5B,YAAY,EAAE,eAAe,GAC5B,CACF,EAEA,IAAI,KAAK,QAAQ,KACjBA,GAAA,CAAC,MAAM,EACN,EAAA,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,GACnB,CACF,CAAA,EAAA,CACI;AAER;;;;"}
1
+ {"version":3,"file":"progress.js","sources":["../../../../packages/components/progress/progress.tsx"],"sourcesContent":["import { useReactive } from \"ahooks\";\nimport classNames from \"classnames\";\nimport { useEffect, useRef } from \"react\";\nimport \"../../css/input.css\";\nimport { useMouseMove, useMouseUp } from \"../../js/hooks\";\nimport Circle from \"./circle\";\nimport \"./index.css\";\nimport Line from \"./line\";\nimport { IProgress } from \"./type\";\n\nconst Progress = (props: IProgress) => {\n\tconst {\n\t\tvalue = 0,\n\t\tlineWidth = 8,\n\t\tcircleSize = 40,\n\t\tprecision = 0,\n\t\tstyle,\n\t\tdraggable = true,\n\t\ttype = \"line\",\n\t\tbarClass,\n\t\tvertical,\n\t\tlabel,\n\t\tlabelInline,\n\t\tclassName,\n\t\trenderCursor,\n\t\tonChange,\n\t\tonDraggingChange,\n\t} = props;\n\n\tconst ref = useRef<HTMLDivElement>(null);\n\tconst state = useReactive({\n\t\tvalue,\n\t\tdragging: false,\n\t\tsize: 0,\n\t\tstart: 0,\n\t});\n\n\tconst pageXY = vertical ? \"pageY\" : \"pageX\";\n\tconst rectTL = vertical ? \"top\" : \"left\";\n\tconst rectWH = vertical ? \"height\" : \"width\";\n\n\tconst getFixedValue = () => {\n\t\tlet value = +state.value.toFixed(precision);\n\t\tvalue = Math.min(100, value);\n\t\tvalue = Math.max(0, value);\n\n\t\treturn value;\n\t};\n\n\tconst handleMouseDown = (e) => {\n\t\tif (!ref.current || !draggable) return;\n\n\t\tif (e.touches) {\n\t\t\te = e.touches[0];\n\t\t}\n\n\t\tconst rect = ref.current.getBoundingClientRect();\n\t\tconst value = ((e[pageXY] - rect[rectTL]) * 100) / rect[rectWH];\n\n\t\tObject.assign(state, {\n\t\t\tvalue: vertical ? 100 - value : value,\n\t\t\tsize: rect[rectWH],\n\t\t\tstart: rect[rectTL],\n\t\t\tdragging: true,\n\t\t});\n\t\tonDraggingChange?.(true);\n\t};\n\n\tconst handleMouseMove = (e) => {\n\t\tif (!state.dragging || !draggable) return;\n\t\te.preventDefault();\n\n\t\tif (e.touches) {\n\t\t\te = e.touches[0];\n\t\t}\n\n\t\tconst { start, size } = state;\n\t\tconst offset = e[pageXY] - start;\n\n\t\tif (offset < 0 || offset > size) return;\n\n\t\tconst value = ((e[pageXY] - start) * 100) / size;\n\t\tstate.value = vertical ? 100 - value : value;\n\t};\n\n\tconst handleMouseUp = () => {\n\t\tif (!state.dragging || !draggable) return;\n\n\t\tonChange?.(getFixedValue());\n\t\tstate.dragging = false;\n\t\tonDraggingChange?.(false);\n\t};\n\n\tuseMouseMove(handleMouseMove);\n\tuseMouseUp(handleMouseUp);\n\n\tuseEffect(() => {\n\t\tif (value > 100) {\n\t\t\tstate.value = 100;\n\t\t\treturn;\n\t\t}\n\n\t\tif (value < 0) {\n\t\t\tstate.value = 0;\n\t\t\treturn;\n\t\t}\n\n\t\tstate.value = value;\n\t}, [value]);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames(\"i-input-label\", className, {\n\t\t\t\t\"i-input-inline\": labelInline,\n\t\t\t})}\n\t\t\tstyle={style}\n\t\t>\n\t\t\t{label && <span className='i-input-label-text'>{label}</span>}\n\n\t\t\t{type === \"line\" && (\n\t\t\t\t<Line\n\t\t\t\t\tref={ref}\n\t\t\t\t\tvertical={vertical}\n\t\t\t\t\tlineWidth={lineWidth}\n\t\t\t\t\tbarClass={barClass}\n\t\t\t\t\tdragging={state.dragging}\n\t\t\t\t\tvalue={state.value}\n\t\t\t\t\trenderCursor={renderCursor}\n\t\t\t\t\tonMouseDown={handleMouseDown}\n\t\t\t\t\tonTouchStart={handleMouseDown}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t{type === \"circle\" && (\n\t\t\t\t<Circle\n\t\t\t\t\tvalue={state.value}\n\t\t\t\t\tcircleSize={circleSize}\n\t\t\t\t\tlineWidth={lineWidth}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nexport default Progress;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;AAUA,MAAM,QAAQ,GAAG,CAAC,KAAgB,KAAI;IACrC,MAAM,EACL,KAAK,GAAG,CAAC,EACT,SAAS,GAAG,CAAC,EACb,UAAU,GAAG,EAAE,EACf,SAAS,GAAG,CAAC,EACb,KAAK,EACL,SAAS,GAAG,IAAI,EAChB,IAAI,GAAG,MAAM,EACb,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,WAAW,EACX,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,gBAAgB,GAChB,GAAG,KAAK;AAET,IAAA,MAAM,GAAG,GAAG,MAAM,CAAiB,IAAI,CAAC;IACxC,MAAM,KAAK,GAAG,WAAW,CAAC;QACzB,KAAK;AACL,QAAA,QAAQ,EAAE,KAAK;AACf,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,KAAK,EAAE,CAAC;AACR,KAAA,CAA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AAA,gBAAgB,EAAE,WAAW;AAC7B,SAAA,CAAC,EACF,KAAK,EAAE,KAAK,EAEX,QAAA,EAAA,CAAA,KAAK,IAAIC,GAAM,CAAA,MAAA,EAAA,EAAA,SAAS,EAAC,oBAAoB,EAAA,QAAA,EAAE,KAAK,EAAQ,CAAA,EAE5D,IAAI,KAAK,MAAM,KACfA,GAAA,CAAC,IAAI,EACJ,EAAA,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,eAAe,EAC5B,YAAY,EAAE,eAAe,GAC5B,CACF,EAEA,IAAI,KAAK,QAAQ,KACjBA,GAAA,CAAC,MAAM,EACN,EAAA,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,GACnB,CACF,CAAA,EAAA,CACI;AAER;;;;"}
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import classNames from 'classnames';
3
3
  import { debounce, uid, throttle, pick, title } from 'radash';
4
- import { useMemo, Children, cloneElement, useEffect, createElement, isValidElement, useState, useRef, Fragment as Fragment$1, useLayoutEffect, useImperativeHandle, createContext, useContext } from 'react';
4
+ import { useMemo, Children, cloneElement, useEffect, createElement, isValidElement, useState, useRef, Fragment as Fragment$1, useTransition, useLayoutEffect, useImperativeHandle, createContext, useContext } from 'react';
5
5
  import { SkipPreviousRound, CloseRound, MinusRound, PlusRound, InboxTwotone, FormatBoldRound, FormatItalicRound, FormatUnderlinedRound, StrikethroughSRound, RedoRound, UndoRound, ClearAllRound, PauseRound, PlayArrowRound, StopRound, VolumeOffRound, VolumeDownRound, FullscreenExitRound, FullscreenRound, FeedOutlined, AspectRatioRound, OpenInNewRound, FileDownloadOutlined, RotateRightRound, RotateLeftRound, KeyboardArrowLeftRound, KeyboardArrowRightRound, HideImageTwotone, SyncAltRound, VisibilityRound, VisibilityOffRound, MoreHorizRound, SearchRound, CheckRound, UnfoldMoreRound, CalendarMonthTwotone, AccessTimeRound, InfoOutlined, KeyboardArrowDownRound, ListAltRound, DriveFolderUploadOutlined, PlusSharp } from '@ricons/material';
6
6
  import { useReactive, useCreation, useSize } from 'ahooks';
7
7
  import { createRoot } from 'react-dom/client';
@@ -71,6 +71,54 @@ const Loading = (props) => {
71
71
  }, children: jsx("circle", { cx: '12', cy: '12', r: '9.5', fill: 'none', strokeWidth: '3', strokeLinecap: 'round', strokeDasharray: 40, strokeDashoffset: 0 }) })), text] }));
72
72
  };
73
73
 
74
+ const defaultOk$1 = {
75
+ children: "确定",
76
+ className: "bg-error",
77
+ };
78
+ const defaultCancel$1 = {
79
+ children: "取消",
80
+ secondary: true,
81
+ };
82
+ function Confirm(props) {
83
+ const { ref, okButtonProps, cancelButtonProps, onOk, onCancel, onClick, ...restProps } = props;
84
+ const state = useReactive({
85
+ active: false,
86
+ loading: false,
87
+ });
88
+ const ok = okButtonProps
89
+ ? Object.assign({}, defaultOk$1, okButtonProps)
90
+ : defaultOk$1;
91
+ const cancel = cancelButtonProps
92
+ ? Object.assign({}, defaultCancel$1, cancelButtonProps)
93
+ : defaultCancel$1;
94
+ const handleClick = (e) => {
95
+ onClick?.(e);
96
+ state.active = true;
97
+ };
98
+ const hanldeOk = async () => {
99
+ if (state.loading)
100
+ return;
101
+ state.loading = true;
102
+ try {
103
+ const res = await onOk?.();
104
+ if (res !== false) {
105
+ state.active = false;
106
+ }
107
+ }
108
+ finally {
109
+ state.loading = false;
110
+ }
111
+ };
112
+ const handleCancel = () => {
113
+ onCancel?.();
114
+ state.active = false;
115
+ };
116
+ if (!state.active) {
117
+ return jsx(Button, { ref: ref, ...restProps, onClick: handleClick });
118
+ }
119
+ return (jsxs(Button.Group, { children: [jsx(Button, { ...ok, loading: state.loading, onClick: hanldeOk }), jsx(Button, { ...cancel, disabled: state.loading, onClick: handleCancel })] }));
120
+ }
121
+
74
122
  function Group(props) {
75
123
  const { children, vertical, buttonProps, className, style } = props;
76
124
  const nodes = useMemo(() => {
@@ -173,6 +221,7 @@ const Button = (props) => {
173
221
  }, childNodes);
174
222
  };
175
223
  Button.Toggle = Toggle;
224
+ Button.Confirm = Confirm;
176
225
  Button.Group = Group;
177
226
 
178
227
  const Icon = (props) => {
@@ -1048,38 +1097,42 @@ function Drawer(props) {
1048
1097
  const state = useReactive({
1049
1098
  show: visible,
1050
1099
  active: visible,
1051
- init: false,
1052
1100
  });
1053
- useEffect(() => {
1054
- visible ? handleShow() : handleHide();
1055
- }, [visible]);
1056
- const handleShow = () => {
1057
- if (!toggable.current)
1101
+ const [isPending, startTransition] = useTransition();
1102
+ const handleHide = () => {
1103
+ if (!toggable.current || isPending)
1058
1104
  return;
1059
- state.show = true;
1060
- onVisibleChange?.(true);
1061
1105
  toggable.current = false;
1062
- setTimeout(() => {
1063
- state.active = true;
1064
- toggable.current = true;
1065
- state.init = true;
1066
- }, 24);
1106
+ startTransition(() => {
1107
+ state.active = false;
1108
+ setTimeout(() => {
1109
+ if (!keepDOM) {
1110
+ state.show = false;
1111
+ }
1112
+ onVisibleChange?.(false);
1113
+ toggable.current = true;
1114
+ onClose?.();
1115
+ }, 240);
1116
+ });
1067
1117
  };
1068
- const handleHide = () => {
1069
- if (!toggable.current)
1118
+ const handleShow = () => {
1119
+ if (!toggable.current || isPending)
1070
1120
  return;
1121
+ state.show = true;
1122
+ onVisibleChange?.(true);
1071
1123
  toggable.current = false;
1072
- state.active = false;
1073
- setTimeout(() => {
1074
- if (!keepDOM) {
1075
- state.show = false;
1076
- }
1077
- onVisibleChange?.(false);
1078
- toggable.current = true;
1079
- onClose?.();
1080
- }, 240);
1124
+ startTransition(() => {
1125
+ // 确保 DOM 已经挂载
1126
+ requestAnimationFrame(() => {
1127
+ state.active = true;
1128
+ toggable.current = true;
1129
+ });
1130
+ });
1081
1131
  };
1082
- const handleBackdropClick = function () {
1132
+ useEffect(() => {
1133
+ visible ? handleShow() : handleHide();
1134
+ }, [visible]);
1135
+ const handleBackdropClick = () => {
1083
1136
  backdropClosable && handleHide();
1084
1137
  };
1085
1138
  useKeydown((e) => {
@@ -1089,9 +1142,11 @@ function Drawer(props) {
1089
1142
  }, {
1090
1143
  disabled: disabledEsc,
1091
1144
  });
1092
- return createPortal(state.show && (jsx("div", { className: classNames("i-backdrop-drawer", className, {
1145
+ if (!state.show)
1146
+ return null;
1147
+ return createPortal(jsx("div", { className: classNames("i-backdrop-drawer", className, {
1093
1148
  "i-active": state.active,
1094
- }), onClick: handleBackdropClick, ...restProps, children: jsxs("div", { className: classNames("i-drawer", `i-drawer-${position}`), onClick: (e) => e.stopPropagation(), children: [jsxs("header", { className: 'i-drawer-header', children: [header, jsx(Helpericon, { active: !hideCloseButton, className: 'i-drawer-close', onClick: handleHide })] }), jsx("div", { className: 'i-drawer-content', children: children }), jsx("div", { className: 'i-drawer-footer', children: footer })] }) })), document?.body ?? null);
1149
+ }), onClick: handleBackdropClick, ...restProps, children: jsxs("div", { className: classNames("i-drawer", `i-drawer-${position}`), onClick: (e) => e.stopPropagation(), children: [header && (jsxs("header", { className: 'i-drawer-header', children: [header, !hideCloseButton && (jsx(Helpericon, { className: 'i-drawer-close', onClick: handleHide }))] })), jsx("div", { className: 'i-drawer-content', children: children }), footer && jsx("div", { className: 'i-drawer-footer', children: footer })] }) }), document.body);
1095
1150
  }
1096
1151
 
1097
1152
  const Item$4 = (props) => {
@@ -1382,8 +1437,11 @@ const Item$3 = (props) => {
1382
1437
  };
1383
1438
 
1384
1439
  const Dropdown = (props) => {
1385
- const { width, content, children, ...restProps } = props;
1386
- return (jsx(Popup, { trigger: 'click', position: 'bottom', touchable: true, content: jsx(List$1, { className: 'i-dropdown-content', style: { minWidth: width }, children: content }), ...restProps, children: children }));
1440
+ const { visible, width, content, children, ...restProps } = props;
1441
+ const [active, setActive] = useState(visible);
1442
+ return (jsx(Popup, { trigger: 'click', position: 'bottom', content: jsx(List$1, { className: 'i-dropdown-content', style: { minWidth: width }, children: typeof content === "function"
1443
+ ? content(() => setActive(false))
1444
+ : content }), ...restProps, touchable: true, visible: active, onVisibleChange: setActive, children: children }));
1387
1445
  };
1388
1446
  Dropdown.Item = Item$3;
1389
1447
 
@@ -1688,7 +1746,10 @@ class IFormInstance {
1688
1746
  Object.assign(rule, o);
1689
1747
  }
1690
1748
  const isValid = rule.validator?.(data[field], this);
1691
- if (!isValid) {
1749
+ if (typeof isValid === "string") {
1750
+ rule.message = isValid;
1751
+ }
1752
+ if (isValid !== true) {
1692
1753
  PubSub.publish(`${id}:invalid:${field}`, {
1693
1754
  message: rule.message,
1694
1755
  status: "error",
@@ -1721,7 +1782,10 @@ class IFormInstance {
1721
1782
  Object.assign(rule, o);
1722
1783
  }
1723
1784
  const isValid = rule.validator?.(data[name], this);
1724
- if (!isValid) {
1785
+ if (typeof isValid === "string") {
1786
+ rule.message = isValid;
1787
+ }
1788
+ if (isValid !== true) {
1725
1789
  PubSub.publish(`${id}:invalid:${name}`, {
1726
1790
  message: rule.message,
1727
1791
  status: "error",
@@ -1874,17 +1938,19 @@ function Modal(props) {
1874
1938
  const [show, setShow] = useState(visible);
1875
1939
  const [active, setActive] = useState(false);
1876
1940
  const [bounced, setBounced] = useState(false);
1941
+ const [client, setClient] = useState(false);
1877
1942
  const toggable = useRef(true);
1878
1943
  const handleShow = async () => {
1879
1944
  if (!toggable.current)
1880
1945
  return;
1881
1946
  (!keepDOM || !show) && setShow(true);
1882
1947
  toggable.current = false;
1883
- setTimeout(() => {
1948
+ const timer = setTimeout(() => {
1884
1949
  setActive(true);
1885
1950
  onVisibleChange?.(true);
1886
1951
  toggable.current = true;
1887
1952
  }, 24);
1953
+ return () => clearTimeout(timer);
1888
1954
  };
1889
1955
  const handleHide = () => {
1890
1956
  if (!toggable.current)
@@ -1892,21 +1958,22 @@ function Modal(props) {
1892
1958
  toggable.current = false;
1893
1959
  if (!closable) {
1894
1960
  setBounced(true);
1895
- setTimeout(() => {
1961
+ const timer = setTimeout(() => {
1896
1962
  setBounced(false);
1897
1963
  toggable.current = true;
1898
1964
  }, 400);
1899
- return;
1965
+ return () => clearTimeout(timer);
1900
1966
  }
1901
1967
  setActive(false);
1902
- setTimeout(() => {
1968
+ const timer = setTimeout(() => {
1903
1969
  !keepDOM && setShow(false);
1904
1970
  toggable.current = true;
1905
1971
  onVisibleChange?.(false);
1906
1972
  onClose?.();
1907
1973
  }, 240);
1974
+ return () => clearTimeout(timer);
1908
1975
  };
1909
- const handleBackdropClick = function () {
1976
+ const handleBackdropClick = () => {
1910
1977
  backdropClosable && handleHide();
1911
1978
  };
1912
1979
  useKeydown((e) => {
@@ -1917,19 +1984,22 @@ function Modal(props) {
1917
1984
  useEffect(() => {
1918
1985
  visible ? handleShow() : handleHide();
1919
1986
  }, [visible]);
1987
+ useEffect(() => {
1988
+ setClient(true);
1989
+ }, []);
1920
1990
  const handleClick = () => {
1921
1991
  if (typeof document === "undefined")
1922
1992
  return;
1923
1993
  document.documentElement.click();
1924
1994
  };
1925
- if (!show)
1995
+ if (!show || !client)
1926
1996
  return null;
1927
1997
  return createPortal(jsx("div", { className: classNames("i-modal-container", {
1928
1998
  "i-modal-backdrop": !hideBackdrop,
1929
1999
  "i-modal-customized": customized,
1930
2000
  "i-modal-active": active,
1931
2001
  fixed,
1932
- }, className), style: style, onClick: handleBackdropClick, children: jsxs("div", { className: classNames("i-modal", {
2002
+ }, className), style: style, onClick: handleBackdropClick, "aria-modal": 'true', "aria-hidden": !active, children: jsxs("div", { className: classNames("i-modal", {
1933
2003
  bounced,
1934
2004
  shadow: !hideShadow,
1935
2005
  }), style: {
@@ -1939,7 +2009,7 @@ function Modal(props) {
1939
2009
  e.stopPropagation();
1940
2010
  handleClick();
1941
2011
  onClick?.(e);
1942
- }, ...restProps, children: [customized && children, !customized && (jsx(Content$1, { title: title, hideCloseButton: hideCloseButton, footer: footer, okButtonProps: okButtonProps, cancelButtonProps: cancelButtonProps, children: children, footerLeft: footerLeft, onOk: onOk, onClose: handleHide }))] }) }), document?.body ?? null);
2012
+ }, role: 'dialog', "aria-labelledby": title ? "modal-title" : undefined, ...restProps, children: [customized && children, !customized && (jsx(Content$1, { title: title, hideCloseButton: hideCloseButton, footer: footer, okButtonProps: okButtonProps, cancelButtonProps: cancelButtonProps, children: children, footerLeft: footerLeft, onOk: onOk, onClose: handleHide }))] }) }), document?.body ?? null);
1943
2013
  }
1944
2014
  Modal.useModal = useModal;
1945
2015
 
@@ -1984,7 +2054,7 @@ function HighLight(props) {
1984
2054
  return jsx(Text, { ...restProps, children: content });
1985
2055
  }
1986
2056
 
1987
- function Number$2(props) {
2057
+ function Number$3(props) {
1988
2058
  const { count, to, decimal, thousand = ",", duration = 2400, easing, ...restProps } = props;
1989
2059
  const [n, setN] = useState(count);
1990
2060
  const number = useMemo(() => {
@@ -2004,7 +2074,7 @@ function Number$2(props) {
2004
2074
  return jsx(Text, { ...restProps, children: number });
2005
2075
  }
2006
2076
 
2007
- function Number$1(props) {
2077
+ function Number$2(props) {
2008
2078
  const { seconds, zero, units, ...restProps } = props;
2009
2079
  const text = useMemo(() => {
2010
2080
  if (seconds === undefined)
@@ -2038,8 +2108,8 @@ const Text = (props) => {
2038
2108
  "i-text-gradient-wave": wave,
2039
2109
  }), children: children }));
2040
2110
  };
2041
- Text.Number = Number$2;
2042
- Text.Time = Number$1;
2111
+ Text.Number = Number$3;
2112
+ Text.Time = Number$2;
2043
2113
  Text.HighLight = HighLight;
2044
2114
 
2045
2115
  function Circle(props) {
@@ -2070,12 +2140,12 @@ const Progress = (props) => {
2070
2140
  const pageXY = vertical ? "pageY" : "pageX";
2071
2141
  const rectTL = vertical ? "top" : "left";
2072
2142
  const rectWH = vertical ? "height" : "width";
2073
- const toFixedValue = useMemo(() => {
2143
+ const getFixedValue = () => {
2074
2144
  let value = +state.value.toFixed(precision);
2075
2145
  value = Math.min(100, value);
2076
2146
  value = Math.max(0, value);
2077
2147
  return value;
2078
- }, [state.value, precision]);
2148
+ };
2079
2149
  const handleMouseDown = (e) => {
2080
2150
  if (!ref.current || !draggable)
2081
2151
  return;
@@ -2109,7 +2179,7 @@ const Progress = (props) => {
2109
2179
  const handleMouseUp = () => {
2110
2180
  if (!state.dragging || !draggable)
2111
2181
  return;
2112
- onChange?.(toFixedValue);
2182
+ onChange?.(getFixedValue());
2113
2183
  state.dragging = false;
2114
2184
  onDraggingChange?.(false);
2115
2185
  };
@@ -2562,8 +2632,8 @@ function InputContainer(props) {
2562
2632
  }), children: tip }))] }));
2563
2633
  }
2564
2634
 
2565
- const Number = (props) => {
2566
- const { ref, label, name, value = props.initValue ?? "", initValue, labelInline, step = 1, min = -Infinity, max = Infinity, thousand, precision, type, className, width, status = "normal", append, border, prepend, disabled, message, tip, hideControl, style, onChange, onEnter, onInput, onBlur, ...restProps } = props;
2635
+ const Number$1 = (props) => {
2636
+ const { ref, label, name, value = "", labelInline, step = 1, min = -Infinity, max = Infinity, thousand, precision, type, className, width, status = "normal", append, border, prepend, disabled, message, tip, hideControl, style, onChange, onEnter, onInput, onBlur, ...restProps } = props;
2567
2637
  const state = useReactive({
2568
2638
  value,
2569
2639
  });
@@ -2607,7 +2677,7 @@ const Number = (props) => {
2607
2677
  };
2608
2678
 
2609
2679
  const Range = (props) => {
2610
- const { label, name, value = props.initValue ?? "", initValue, labelInline, min = -Infinity, max = Infinity, type, className, status = "normal", message, tip, append, prepend, step = 1, width, thousand, precision, hideControl, placeholder, border, autoSwitch, onChange, onBlur, style, ...restProps } = props;
2680
+ const { label, name, value, labelInline, min = -Infinity, max = Infinity, type, className, status = "normal", message, tip, append, prepend, step = 1, width, thousand, precision, hideControl, placeholder, border, autoSwitch, onChange, onBlur, style, ...restProps } = props;
2611
2681
  const state = useReactive({
2612
2682
  value,
2613
2683
  });
@@ -2642,9 +2712,7 @@ const Range = (props) => {
2642
2712
  e?.preventDefault();
2643
2713
  e?.stopPropagation();
2644
2714
  const range = state.value ? state.value : [];
2645
- const v = range[0];
2646
- range[0] = range[1];
2647
- range[1] = v;
2715
+ [range[0], range[1]] = [range[1], range[0]];
2648
2716
  state.value = range;
2649
2717
  onChange?.(range);
2650
2718
  };
@@ -2657,14 +2725,15 @@ const Range = (props) => {
2657
2725
  ...restProps,
2658
2726
  };
2659
2727
  const handleBlur = () => {
2728
+ if (!autoSwitch)
2729
+ return;
2660
2730
  const range = Array.isArray(state.value) ? state.value : [];
2661
2731
  if (range.length < 2)
2662
2732
  return;
2663
- const l = +range[0];
2664
- const r = +range[1];
2665
- if (l <= r)
2666
- return;
2667
- handleSwitch();
2733
+ const [left, right] = range.map(Number);
2734
+ if (left > right) {
2735
+ handleSwitch();
2736
+ }
2668
2737
  };
2669
2738
  return (jsx(InputContainer, { label: label, labelInline: labelInline, className: className, style: { width, ...style }, tip: message ?? tip, status: status, children: jsxs("div", { className: classNames("i-input-item", {
2670
2739
  [`i-input-${status}`]: status !== "normal",
@@ -2673,7 +2742,7 @@ const Range = (props) => {
2673
2742
  };
2674
2743
 
2675
2744
  const Textarea = (props) => {
2676
- const { ref, label, name, value = props.initValue, initValue, labelInline, className, status = "normal", message, tip, autoSize, border, width, style, onChange, onEnter, ...restProps } = props;
2745
+ const { ref, label, name, value = "", labelInline, className, status = "normal", message, tip, autoSize, border, width, style, onChange, onEnter, ...restProps } = props;
2677
2746
  const state = useReactive({
2678
2747
  value,
2679
2748
  });
@@ -2712,7 +2781,7 @@ const Textarea = (props) => {
2712
2781
  };
2713
2782
 
2714
2783
  const Input = ((props) => {
2715
- const { ref, type = "text", label, name, value = props.initValue ?? "", initValue = "", prepend, append, labelInline, className, status = "normal", message, tip, clear, width, hideVisible, border, required, maxLength, onChange, onEnter, style, ...restProps } = props;
2784
+ const { ref, type = "text", label, name, value = "", prepend, append, labelInline, className, status = "normal", message, tip, clear, width, hideVisible, border, underline, required, maxLength, onChange, onEnter, style, ...restProps } = props;
2716
2785
  const state = useReactive({
2717
2786
  value,
2718
2787
  type,
@@ -2762,10 +2831,11 @@ const Input = ((props) => {
2762
2831
  return (jsx(InputContainer, { label: label, labelInline: labelInline, className: className, style: { width, ...style }, tip: message ?? tip, status: status, required: required, children: jsxs("div", { className: classNames("i-input-item", {
2763
2832
  [`i-input-${status}`]: status !== "normal",
2764
2833
  "i-input-borderless": !border,
2834
+ "i-input-underline": underline,
2765
2835
  }), children: [prepend && jsx("div", { className: 'i-input-prepend', children: prepend }), jsx("input", { ...inputProps }), maxLength && state.value?.length > 0 && (jsxs("span", { className: 'color-8 pr-4 font-sm', children: [state.value.length, " / ", maxLength] })), jsx(Helpericon, { active: !!clearable || showHelper, icon: HelperIcon, onClick: handleHelperClick }), append && jsx("div", { className: 'i-input-append', children: append })] }) }));
2766
2836
  });
2767
2837
  Input.Textarea = Textarea;
2768
- Input.Number = Number;
2838
+ Input.Number = Number$1;
2769
2839
  Input.Range = Range;
2770
2840
 
2771
2841
  const AlignMap = {
@@ -3512,7 +3582,7 @@ const Popconfirm = (props) => {
3512
3582
  await onClose?.();
3513
3583
  state.visible = false;
3514
3584
  };
3515
- const popconfirmContent = (jsxs("div", { className: 'i-popconfirm', children: [jsxs(Flex, { gap: '.5em', children: [icon, jsx("div", { className: 'i-popconfirm-content', children: content })] }), jsxs(Flex, { gap: 12, justify: 'flex-end', className: 'mt-8 i-popconfirm-footer', children: [cancelButtonProps !== null && (jsx(Button, { ...cancel, onClick: handleCancel })), extra, okButtonProps !== null && (jsx(Button, { loading: state.loading, ...ok, onClick: handleOk }))] })] }));
3585
+ const popconfirmContent = (jsxs("div", { className: 'i-popconfirm', children: [jsxs(Flex, { gap: '.5em', children: [icon, jsx("div", { className: 'i-popconfirm-content', children: content })] }), jsxs(Flex, { gap: 12, justify: 'flex-end', className: 'i-popconfirm-footer', children: [cancelButtonProps !== null && (jsx(Button, { ...cancel, onClick: handleCancel })), extra, okButtonProps !== null && (jsx(Button, { loading: state.loading, ...ok, onClick: handleOk }))] })] }));
3516
3586
  return (jsx(Popup, { content: popconfirmContent, ...restProps, trigger: trigger, visible: state.visible, align: align, offset: offset, position: position, onVisibleChange: handleVisibleChange, children: children }));
3517
3587
  };
3518
3588
 
@@ -0,0 +1,6 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { IButtonConfirm } from './type.js';
3
+
4
+ declare function Confirm(props: IButtonConfirm): react_jsx_runtime.JSX.Element;
5
+
6
+ export { Confirm as default };
@@ -1,5 +1,6 @@
1
1
  import { ForwardRefExoticComponent, RefAttributes, ButtonHTMLAttributes, AnchorHTMLAttributes, ReactNode, CSSProperties, RefObject } from 'react';
2
2
  import { LinkProps } from 'react-router';
3
+ import Confirm from './confirm.js';
3
4
  import Group from './group.js';
4
5
  import Toggle from './toggle.js';
5
6
 
@@ -29,6 +30,12 @@ interface IButtonToggle extends IButton {
29
30
  toggable?: () => boolean | Promise<boolean>;
30
31
  onToggle?: (active: boolean) => void;
31
32
  }
33
+ interface IButtonConfirm extends IButton {
34
+ okButtonProps?: IButton;
35
+ cancelButtonProps?: IButton;
36
+ onOk?: () => void | boolean | Promise<void | boolean>;
37
+ onCancel?: () => void;
38
+ }
32
39
  interface IButtonGroup {
33
40
  children?: ReactNode;
34
41
  vertical?: boolean;
@@ -39,6 +46,7 @@ interface IButtonGroup {
39
46
  interface CompositionButton extends ForwardRefExoticComponent<IButton & RefAttributes<HTMLElement>> {
40
47
  Toggle: typeof Toggle;
41
48
  Group: typeof Group;
49
+ Confirm: typeof Confirm;
42
50
  }
43
51
 
44
- export type { CompositionButton, IButton, IButtonGroup, IButtonToggle };
52
+ export type { CompositionButton, IButton, IButtonConfirm, IButtonGroup, IButtonToggle };
@@ -2,8 +2,9 @@ import { ReactNode } from 'react';
2
2
  import { IListItem } from '../list/type.js';
3
3
  import { IPopup } from '../popup/type.js';
4
4
 
5
- interface IDropdown extends IPopup {
5
+ interface IDropdown extends Omit<IPopup, "content"> {
6
6
  width?: string | number;
7
+ content?: ReactNode | ((close: () => void) => ReactNode);
7
8
  }
8
9
  interface IDropItem extends IListItem {
9
10
  more?: ReactNode;
@@ -1,7 +1,7 @@
1
1
  import { HTMLAttributes, ReactNode } from 'react';
2
2
  import { IFormInstance } from './useForm.js';
3
3
 
4
- type TValidator = (value: any, form: IFormInstance) => boolean;
4
+ type TValidator = (value: any, form: IFormInstance) => boolean | string;
5
5
  type TRule = {
6
6
  validator: TValidator;
7
7
  message?: string;
@@ -15,10 +15,10 @@ interface BaseInput extends TValidate {
15
15
  label?: ReactNode;
16
16
  ref?: RefObject<HTMLInputElement | null>;
17
17
  value?: any;
18
- initValue?: any;
19
18
  labelInline?: boolean;
20
19
  clear?: boolean;
21
20
  border?: boolean;
21
+ underline?: boolean;
22
22
  tip?: ReactNode;
23
23
  onChange?: (value: any, e?: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
24
24
  onEnter?: (e: KeyboardEvent) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ioca/react",
3
- "version": "1.3.86",
3
+ "version": "1.3.88",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",