@ioca/react 1.3.87 → 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 (48) 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/input/input.js +1 -1
  10. package/lib/cjs/components/input/input.js.map +1 -1
  11. package/lib/cjs/components/input/number.js +1 -1
  12. package/lib/cjs/components/input/number.js.map +1 -1
  13. package/lib/cjs/components/input/range.js +8 -9
  14. package/lib/cjs/components/input/range.js.map +1 -1
  15. package/lib/cjs/components/input/textarea.js +1 -1
  16. package/lib/cjs/components/input/textarea.js.map +1 -1
  17. package/lib/cjs/components/modal/modal.js +14 -8
  18. package/lib/cjs/components/modal/modal.js.map +1 -1
  19. package/lib/cjs/components/progress/progress.js +3 -3
  20. package/lib/cjs/components/progress/progress.js.map +1 -1
  21. package/lib/css/index.css +1 -1
  22. package/lib/css/index.css.map +1 -1
  23. package/lib/es/components/button/button.js +2 -0
  24. package/lib/es/components/button/button.js.map +1 -1
  25. package/lib/es/components/button/confirm.js +54 -0
  26. package/lib/es/components/button/confirm.js.map +1 -0
  27. package/lib/es/components/drawer/drawer.js +34 -28
  28. package/lib/es/components/drawer/drawer.js.map +1 -1
  29. package/lib/es/components/dropdown/dropdown.js +6 -2
  30. package/lib/es/components/dropdown/dropdown.js.map +1 -1
  31. package/lib/es/components/input/input.js +1 -1
  32. package/lib/es/components/input/input.js.map +1 -1
  33. package/lib/es/components/input/number.js +1 -1
  34. package/lib/es/components/input/number.js.map +1 -1
  35. package/lib/es/components/input/range.js +8 -9
  36. package/lib/es/components/input/range.js.map +1 -1
  37. package/lib/es/components/input/textarea.js +1 -1
  38. package/lib/es/components/input/textarea.js.map +1 -1
  39. package/lib/es/components/modal/modal.js +14 -8
  40. package/lib/es/components/modal/modal.js.map +1 -1
  41. package/lib/es/components/progress/progress.js +4 -4
  42. package/lib/es/components/progress/progress.js.map +1 -1
  43. package/lib/index.js +122 -59
  44. package/lib/types/components/button/confirm.d.ts +6 -0
  45. package/lib/types/components/button/type.d.ts +9 -1
  46. package/lib/types/components/dropdown/type.d.ts +2 -1
  47. package/lib/types/type/index.d.ts +0 -1
  48. package/package.json +1 -1
@@ -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,GAAG,OAAO,GAAG,OAAO;IAC3C,MAAM,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM;IACxC,MAAM,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO;AAE5C,IAAA,MAAM,YAAY,GAAG,OAAO,CAAC,MAAK;QACjC,IAAI,KAAK,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAA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,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,CAAC;IAEF,MAAM,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO;IAC3C,MAAM,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM;IACxC,MAAM,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO;IAE5C,MAAM,aAAa,GAAG,MAAK;QAC1B,IAAI,KAAK,GAAG,CAAC,KAAK,CAAC,KAA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AAA,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
 
@@ -1880,17 +1938,19 @@ function Modal(props) {
1880
1938
  const [show, setShow] = useState(visible);
1881
1939
  const [active, setActive] = useState(false);
1882
1940
  const [bounced, setBounced] = useState(false);
1941
+ const [client, setClient] = useState(false);
1883
1942
  const toggable = useRef(true);
1884
1943
  const handleShow = async () => {
1885
1944
  if (!toggable.current)
1886
1945
  return;
1887
1946
  (!keepDOM || !show) && setShow(true);
1888
1947
  toggable.current = false;
1889
- setTimeout(() => {
1948
+ const timer = setTimeout(() => {
1890
1949
  setActive(true);
1891
1950
  onVisibleChange?.(true);
1892
1951
  toggable.current = true;
1893
1952
  }, 24);
1953
+ return () => clearTimeout(timer);
1894
1954
  };
1895
1955
  const handleHide = () => {
1896
1956
  if (!toggable.current)
@@ -1898,21 +1958,22 @@ function Modal(props) {
1898
1958
  toggable.current = false;
1899
1959
  if (!closable) {
1900
1960
  setBounced(true);
1901
- setTimeout(() => {
1961
+ const timer = setTimeout(() => {
1902
1962
  setBounced(false);
1903
1963
  toggable.current = true;
1904
1964
  }, 400);
1905
- return;
1965
+ return () => clearTimeout(timer);
1906
1966
  }
1907
1967
  setActive(false);
1908
- setTimeout(() => {
1968
+ const timer = setTimeout(() => {
1909
1969
  !keepDOM && setShow(false);
1910
1970
  toggable.current = true;
1911
1971
  onVisibleChange?.(false);
1912
1972
  onClose?.();
1913
1973
  }, 240);
1974
+ return () => clearTimeout(timer);
1914
1975
  };
1915
- const handleBackdropClick = function () {
1976
+ const handleBackdropClick = () => {
1916
1977
  backdropClosable && handleHide();
1917
1978
  };
1918
1979
  useKeydown((e) => {
@@ -1923,19 +1984,22 @@ function Modal(props) {
1923
1984
  useEffect(() => {
1924
1985
  visible ? handleShow() : handleHide();
1925
1986
  }, [visible]);
1987
+ useEffect(() => {
1988
+ setClient(true);
1989
+ }, []);
1926
1990
  const handleClick = () => {
1927
1991
  if (typeof document === "undefined")
1928
1992
  return;
1929
1993
  document.documentElement.click();
1930
1994
  };
1931
- if (!show)
1995
+ if (!show || !client)
1932
1996
  return null;
1933
1997
  return createPortal(jsx("div", { className: classNames("i-modal-container", {
1934
1998
  "i-modal-backdrop": !hideBackdrop,
1935
1999
  "i-modal-customized": customized,
1936
2000
  "i-modal-active": active,
1937
2001
  fixed,
1938
- }, 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", {
1939
2003
  bounced,
1940
2004
  shadow: !hideShadow,
1941
2005
  }), style: {
@@ -1945,7 +2009,7 @@ function Modal(props) {
1945
2009
  e.stopPropagation();
1946
2010
  handleClick();
1947
2011
  onClick?.(e);
1948
- }, ...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);
1949
2013
  }
1950
2014
  Modal.useModal = useModal;
1951
2015
 
@@ -1990,7 +2054,7 @@ function HighLight(props) {
1990
2054
  return jsx(Text, { ...restProps, children: content });
1991
2055
  }
1992
2056
 
1993
- function Number$2(props) {
2057
+ function Number$3(props) {
1994
2058
  const { count, to, decimal, thousand = ",", duration = 2400, easing, ...restProps } = props;
1995
2059
  const [n, setN] = useState(count);
1996
2060
  const number = useMemo(() => {
@@ -2010,7 +2074,7 @@ function Number$2(props) {
2010
2074
  return jsx(Text, { ...restProps, children: number });
2011
2075
  }
2012
2076
 
2013
- function Number$1(props) {
2077
+ function Number$2(props) {
2014
2078
  const { seconds, zero, units, ...restProps } = props;
2015
2079
  const text = useMemo(() => {
2016
2080
  if (seconds === undefined)
@@ -2044,8 +2108,8 @@ const Text = (props) => {
2044
2108
  "i-text-gradient-wave": wave,
2045
2109
  }), children: children }));
2046
2110
  };
2047
- Text.Number = Number$2;
2048
- Text.Time = Number$1;
2111
+ Text.Number = Number$3;
2112
+ Text.Time = Number$2;
2049
2113
  Text.HighLight = HighLight;
2050
2114
 
2051
2115
  function Circle(props) {
@@ -2076,12 +2140,12 @@ const Progress = (props) => {
2076
2140
  const pageXY = vertical ? "pageY" : "pageX";
2077
2141
  const rectTL = vertical ? "top" : "left";
2078
2142
  const rectWH = vertical ? "height" : "width";
2079
- const toFixedValue = useMemo(() => {
2143
+ const getFixedValue = () => {
2080
2144
  let value = +state.value.toFixed(precision);
2081
2145
  value = Math.min(100, value);
2082
2146
  value = Math.max(0, value);
2083
2147
  return value;
2084
- }, [state.value, precision]);
2148
+ };
2085
2149
  const handleMouseDown = (e) => {
2086
2150
  if (!ref.current || !draggable)
2087
2151
  return;
@@ -2115,7 +2179,7 @@ const Progress = (props) => {
2115
2179
  const handleMouseUp = () => {
2116
2180
  if (!state.dragging || !draggable)
2117
2181
  return;
2118
- onChange?.(toFixedValue);
2182
+ onChange?.(getFixedValue());
2119
2183
  state.dragging = false;
2120
2184
  onDraggingChange?.(false);
2121
2185
  };
@@ -2568,8 +2632,8 @@ function InputContainer(props) {
2568
2632
  }), children: tip }))] }));
2569
2633
  }
2570
2634
 
2571
- const Number = (props) => {
2572
- 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;
2573
2637
  const state = useReactive({
2574
2638
  value,
2575
2639
  });
@@ -2613,7 +2677,7 @@ const Number = (props) => {
2613
2677
  };
2614
2678
 
2615
2679
  const Range = (props) => {
2616
- 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;
2617
2681
  const state = useReactive({
2618
2682
  value,
2619
2683
  });
@@ -2648,9 +2712,7 @@ const Range = (props) => {
2648
2712
  e?.preventDefault();
2649
2713
  e?.stopPropagation();
2650
2714
  const range = state.value ? state.value : [];
2651
- const v = range[0];
2652
- range[0] = range[1];
2653
- range[1] = v;
2715
+ [range[0], range[1]] = [range[1], range[0]];
2654
2716
  state.value = range;
2655
2717
  onChange?.(range);
2656
2718
  };
@@ -2663,14 +2725,15 @@ const Range = (props) => {
2663
2725
  ...restProps,
2664
2726
  };
2665
2727
  const handleBlur = () => {
2728
+ if (!autoSwitch)
2729
+ return;
2666
2730
  const range = Array.isArray(state.value) ? state.value : [];
2667
2731
  if (range.length < 2)
2668
2732
  return;
2669
- const l = +range[0];
2670
- const r = +range[1];
2671
- if (l <= r)
2672
- return;
2673
- handleSwitch();
2733
+ const [left, right] = range.map(Number);
2734
+ if (left > right) {
2735
+ handleSwitch();
2736
+ }
2674
2737
  };
2675
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", {
2676
2739
  [`i-input-${status}`]: status !== "normal",
@@ -2679,7 +2742,7 @@ const Range = (props) => {
2679
2742
  };
2680
2743
 
2681
2744
  const Textarea = (props) => {
2682
- 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;
2683
2746
  const state = useReactive({
2684
2747
  value,
2685
2748
  });
@@ -2718,7 +2781,7 @@ const Textarea = (props) => {
2718
2781
  };
2719
2782
 
2720
2783
  const Input = ((props) => {
2721
- const { ref, type = "text", label, name, value = props.initValue ?? "", initValue = "", prepend, append, labelInline, className, status = "normal", message, tip, clear, width, hideVisible, border, underline, 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;
2722
2785
  const state = useReactive({
2723
2786
  value,
2724
2787
  type,
@@ -2772,7 +2835,7 @@ const Input = ((props) => {
2772
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 })] }) }));
2773
2836
  });
2774
2837
  Input.Textarea = Textarea;
2775
- Input.Number = Number;
2838
+ Input.Number = Number$1;
2776
2839
  Input.Range = Range;
2777
2840
 
2778
2841
  const AlignMap = {
@@ -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;
@@ -15,7 +15,6 @@ 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ioca/react",
3
- "version": "1.3.87",
3
+ "version": "1.3.88",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",