@tiny-design/react 1.2.0 → 1.4.0

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 (75) hide show
  1. package/es/button/style/_index.scss +16 -11
  2. package/es/button/style/index.css +26 -5
  3. package/es/drawer/drawer.js +3 -2
  4. package/es/drawer/drawer.js.map +1 -1
  5. package/es/message/message.js +3 -2
  6. package/es/message/message.js.map +1 -1
  7. package/es/modal/modal.js +3 -2
  8. package/es/modal/modal.js.map +1 -1
  9. package/es/overlay/overlay.js +2 -2
  10. package/es/overlay/overlay.js.map +1 -1
  11. package/es/pop-confirm/style/_index.scss +4 -0
  12. package/es/pop-confirm/style/index.css +4 -0
  13. package/es/slider/style/_index.scss +1 -9
  14. package/es/slider/style/index.css +1 -6
  15. package/es/speed-dial/style/_index.scss +6 -7
  16. package/es/speed-dial/style/index.css +5 -5
  17. package/es/style/base.css +24 -3
  18. package/es/tag/style/_index.scss +24 -0
  19. package/es/tag/style/index.css +20 -0
  20. package/es/tag/types.d.ts +2 -1
  21. package/es/tag/types.js +7 -2
  22. package/es/tag/types.js.map +1 -1
  23. package/es/time-picker/style/_index.scss +13 -0
  24. package/es/time-picker/style/index.css +10 -0
  25. package/es/time-picker/time-panel.js +28 -28
  26. package/es/time-picker/time-panel.js.map +1 -1
  27. package/es/time-picker/time-picker.js +50 -29
  28. package/es/time-picker/time-picker.js.map +1 -1
  29. package/es/transition/index.js +1 -0
  30. package/es/transition/index.js.map +1 -1
  31. package/es/transition/transition.d.ts +20 -5
  32. package/es/transition/transition.js +33 -8
  33. package/es/transition/transition.js.map +1 -1
  34. package/es/transition/use-transition.js +137 -0
  35. package/es/transition/use-transition.js.map +1 -0
  36. package/es/waterfall/waterfall.js +62 -39
  37. package/es/waterfall/waterfall.js.map +1 -1
  38. package/lib/button/style/_index.scss +16 -11
  39. package/lib/button/style/index.css +26 -5
  40. package/lib/drawer/drawer.js +5 -4
  41. package/lib/drawer/drawer.js.map +1 -1
  42. package/lib/message/message.js +3 -2
  43. package/lib/message/message.js.map +1 -1
  44. package/lib/modal/modal.js +5 -4
  45. package/lib/modal/modal.js.map +1 -1
  46. package/lib/overlay/overlay.js +3 -3
  47. package/lib/overlay/overlay.js.map +1 -1
  48. package/lib/pop-confirm/style/_index.scss +4 -0
  49. package/lib/pop-confirm/style/index.css +4 -0
  50. package/lib/slider/style/_index.scss +1 -9
  51. package/lib/slider/style/index.css +1 -6
  52. package/lib/speed-dial/style/_index.scss +6 -7
  53. package/lib/speed-dial/style/index.css +5 -5
  54. package/lib/style/base.css +24 -3
  55. package/lib/tag/style/_index.scss +24 -0
  56. package/lib/tag/style/index.css +20 -0
  57. package/lib/tag/types.d.ts +2 -1
  58. package/lib/tag/types.js +7 -2
  59. package/lib/tag/types.js.map +1 -1
  60. package/lib/time-picker/style/_index.scss +13 -0
  61. package/lib/time-picker/style/index.css +10 -0
  62. package/lib/time-picker/time-panel.js +28 -28
  63. package/lib/time-picker/time-panel.js.map +1 -1
  64. package/lib/time-picker/time-picker.js +50 -29
  65. package/lib/time-picker/time-picker.js.map +1 -1
  66. package/lib/transition/index.js +1 -0
  67. package/lib/transition/index.js.map +1 -1
  68. package/lib/transition/transition.d.ts +20 -5
  69. package/lib/transition/transition.js +32 -7
  70. package/lib/transition/transition.js.map +1 -1
  71. package/lib/transition/use-transition.js +138 -0
  72. package/lib/transition/use-transition.js.map +1 -0
  73. package/lib/waterfall/waterfall.js +61 -38
  74. package/lib/waterfall/waterfall.js.map +1 -1
  75. package/package.json +3 -5
@@ -1,16 +1,16 @@
1
1
  const require_runtime = require("../_virtual/_rolldown/runtime.js");
2
2
  const require_config_context = require("../config-provider/config-context.js");
3
3
  const require_general = require("../_utils/general.js");
4
+ const require_index = require("../transition/index.js");
4
5
  const require_button = require("../button/button.js");
5
6
  const require_use_locale = require("../_utils/use-locale.js");
6
- const require_index = require("../overlay/index.js");
7
+ const require_index$1 = require("../overlay/index.js");
7
8
  const require_flex = require("../flex/flex.js");
8
9
  let react = require("react");
9
10
  react = require_runtime.__toESM(react);
10
11
  let classnames = require("classnames");
11
12
  classnames = require_runtime.__toESM(classnames);
12
13
  let react_jsx_runtime = require("react/jsx-runtime");
13
- let react_transition_group = require("react-transition-group");
14
14
  //#region src/modal/modal.tsx
15
15
  const Modal = react.default.forwardRef((props, ref) => {
16
16
  const locale = require_use_locale.useLocale();
@@ -81,7 +81,7 @@ const Modal = react.default.forwardRef((props, ref) => {
81
81
  })]
82
82
  });
83
83
  };
84
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.default, {
84
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.default, {
85
85
  onEnter: () => setModalVisible(true),
86
86
  onExit: () => setModalVisible(false),
87
87
  zIndex,
@@ -102,11 +102,12 @@ const Modal = react.default.forwardRef((props, ref) => {
102
102
  width,
103
103
  ...style
104
104
  },
105
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_transition_group.CSSTransition, {
105
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.default, {
106
106
  appear: true,
107
107
  nodeRef,
108
108
  in: modalVisible,
109
109
  classNames: `${prefixCls}__content_${animation}`,
110
+ unmountOnExit: false,
110
111
  timeout: 0,
111
112
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
112
113
  ref: nodeRef,
@@ -1 +1 @@
1
- {"version":3,"file":"modal.js","names":["React","useLocale","getPrefixCls","ConfigContext","Flex","Button","Overlay","CSSTransition"],"sources":["../../src/modal/modal.tsx"],"sourcesContent":["import React, { useContext, useEffect, useId, useRef, useState } from 'react';\nimport classNames from 'classnames';\nimport { CSSTransition } from 'react-transition-group';\nimport Overlay from '../overlay';\nimport Button from '../button/button';\nimport Flex from '../flex/flex';\nimport { ConfigContext } from '../config-provider/config-context';\nimport { getPrefixCls } from '../_utils/general';\nimport { useLocale } from '../_utils/use-locale';\nimport { ModalProps } from './types';\n\nconst Modal = React.forwardRef<HTMLDivElement, ModalProps>((props, ref) => {\n const locale = useLocale();\n const {\n visible = false,\n width = 520,\n centered = false,\n closable = true,\n unmountOnClose = true,\n maskType = 'default',\n maskClosable = true,\n confirmText = locale.Modal.okText,\n cancelText = locale.Modal.cancelText,\n confirmLoading = false,\n animation = 'slide',\n zIndex = 1000,\n onConfirm,\n onCancel: onCancelProp,\n onClose: onCloseProp,\n top,\n header,\n footer,\n afterClose,\n confirmButtonProps,\n cancelButtonProps,\n className,\n children,\n style,\n maskStyle,\n headerStyle,\n bodyStyle,\n footerStyle,\n prefixCls: customisedCls,\n } = props;\n const onCancel = onCloseProp ?? onCancelProp;\n const [modalVisible, setModalVisible] = useState(visible);\n const configContext = useContext(ConfigContext);\n const prefixCls = getPrefixCls('modal', configContext.prefixCls, customisedCls);\n const cls = classNames(prefixCls, className, { [`${prefixCls}_centered`]: centered });\n const nodeRef = useRef<HTMLDivElement>(null);\n const previousFocusRef = useRef<HTMLElement | null>(null);\n const titleId = useId();\n\n // Focus trap + Escape key\n useEffect(() => {\n if (!visible) return;\n previousFocusRef.current = document.activeElement as HTMLElement;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n onCancel?.(e as unknown as React.MouseEvent);\n return;\n }\n if (e.key === 'Tab' && nodeRef.current) {\n const focusable = nodeRef.current.querySelectorAll<HTMLElement>(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n );\n if (focusable.length === 0) return;\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n if (e.shiftKey) {\n if (document.activeElement === first) { e.preventDefault(); last.focus(); }\n } else {\n if (document.activeElement === last) { e.preventDefault(); first.focus(); }\n }\n }\n };\n document.addEventListener('keydown', handleKeyDown);\n\n // Focus first focusable element\n requestAnimationFrame(() => {\n if (nodeRef.current) {\n const focusable = nodeRef.current.querySelectorAll<HTMLElement>(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n );\n if (focusable.length > 0) focusable[0].focus();\n }\n });\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n previousFocusRef.current?.focus();\n };\n }, [visible, onCancel]);\n\n const renderFooter = (): React.ReactNode => {\n if (React.isValidElement(footer)) {\n return footer;\n } else if (footer === null) {\n return null;\n } else {\n return (\n <Flex gap=\"sm\" justify='end' className={`${prefixCls}__footer`} style={footerStyle}>\n <Button onClick={onCancel} className={`${prefixCls}__footer-btn`} {...cancelButtonProps}>\n {cancelText}\n </Button>\n <Button\n loading={confirmLoading}\n onClick={onConfirm}\n btnType=\"primary\"\n className={`${prefixCls}__footer-btn`}\n {...confirmButtonProps}>\n {confirmText}\n </Button>\n </Flex>\n );\n }\n };\n\n return (\n <Overlay\n onEnter={(): void => setModalVisible(true)}\n onExit={(): void => setModalVisible(false)}\n zIndex={zIndex}\n type={maskType}\n unmountOnExit={unmountOnClose}\n isShow={visible}\n onExited={afterClose}\n clickCallback={(e: React.MouseEvent): void => {\n maskClosable && onCancel ? onCancel(e) : undefined;\n }}\n style={maskStyle}>\n <div ref={ref} className={cls} style={{ top }}>\n <div style={{ width, ...style }}>\n <CSSTransition\n appear={true}\n nodeRef={nodeRef}\n in={modalVisible}\n classNames={`${prefixCls}__content_${animation}`}\n timeout={0}>\n <div\n ref={nodeRef}\n className={`${prefixCls}__content`}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={header ? titleId : undefined}\n onClick={(e): void => e.stopPropagation()}>\n {closable && (\n <button type=\"button\" className={`${prefixCls}__close-btn`} onClick={onCancel} aria-label=\"Close\">\n ✕\n </button>\n )}\n {header && (\n <div className={`${prefixCls}__header`} style={headerStyle}>\n <div className={`${prefixCls}__title`} id={titleId}>{header}</div>\n </div>\n )}\n <div className={`${prefixCls}__body`} style={bodyStyle}>\n {children}\n </div>\n {renderFooter()}\n </div>\n </CSSTransition>\n </div>\n </div>\n </Overlay>\n );\n});\n\nModal.displayName = 'Modal';\n\nexport default Modal;\n"],"mappings":";;;;;;;;;;;;;;AAWA,MAAM,QA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AAG,UAAU,YAAY;KACrC,SAAS;eACT,iBAAA,GAAA,kBAAA,MAAC,OAAD;MACE,KAAK;MACL,WAAW,GAAG,UAAU;MACxB,MAAK;MACL,cAAW;MACX,mBAAiB,SAAS,UAAU,KAAA;MACpC,UAAU,MAAY,EAAE,iBAAiB;gBAN3C;OAOG,YACC,iBAAA,GAAA,kBAAA,KAAC,UAAD;QAAQ,MAAK;QAAS,WAAW,GAAG,UAAU;QAAc,SAAS;QAAU,cAAW;kBAAQ;QAEzF,CAAA;OAEV,UACC,iBAAA,GAAA,kBAAA,KAAC,OAAD;QAAK,WAAW,GAAG,UAAU;QAAW,OAAO;kBAC7C,iBAAA,GAAA,kBAAA,KAAC,OAAD;SAAK,WAAW,GAAG,UAAU;SAAU,IAAI;mBAAU;SAAa,CAAA;QAC9D,CAAA;OAER,iBAAA,GAAA,kBAAA,KAAC,OAAD;QAAK,WAAW,GAAG,UAAU;QAAS,OAAO;QAC1C;QACG,CAAA;OACL,cAAc;OACX;;KACQ,CAAA;IACZ,CAAA;GACF,CAAA;EACE,CAAA;EAEZ;AAEF,MAAM,cAAc"}
1
+ {"version":3,"file":"modal.js","names":["React","useLocale","getPrefixCls","ConfigContext","Flex","Button","Overlay","Transition"],"sources":["../../src/modal/modal.tsx"],"sourcesContent":["import React, { useContext, useEffect, useId, useRef, useState } from 'react';\nimport classNames from 'classnames';\nimport Transition from '../transition';\nimport Overlay from '../overlay';\nimport Button from '../button/button';\nimport Flex from '../flex/flex';\nimport { ConfigContext } from '../config-provider/config-context';\nimport { getPrefixCls } from '../_utils/general';\nimport { useLocale } from '../_utils/use-locale';\nimport { ModalProps } from './types';\n\nconst Modal = React.forwardRef<HTMLDivElement, ModalProps>((props, ref) => {\n const locale = useLocale();\n const {\n visible = false,\n width = 520,\n centered = false,\n closable = true,\n unmountOnClose = true,\n maskType = 'default',\n maskClosable = true,\n confirmText = locale.Modal.okText,\n cancelText = locale.Modal.cancelText,\n confirmLoading = false,\n animation = 'slide',\n zIndex = 1000,\n onConfirm,\n onCancel: onCancelProp,\n onClose: onCloseProp,\n top,\n header,\n footer,\n afterClose,\n confirmButtonProps,\n cancelButtonProps,\n className,\n children,\n style,\n maskStyle,\n headerStyle,\n bodyStyle,\n footerStyle,\n prefixCls: customisedCls,\n } = props;\n const onCancel = onCloseProp ?? onCancelProp;\n const [modalVisible, setModalVisible] = useState(visible);\n const configContext = useContext(ConfigContext);\n const prefixCls = getPrefixCls('modal', configContext.prefixCls, customisedCls);\n const cls = classNames(prefixCls, className, { [`${prefixCls}_centered`]: centered });\n const nodeRef = useRef<HTMLDivElement>(null);\n const previousFocusRef = useRef<HTMLElement | null>(null);\n const titleId = useId();\n\n // Focus trap + Escape key\n useEffect(() => {\n if (!visible) return;\n previousFocusRef.current = document.activeElement as HTMLElement;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n onCancel?.(e as unknown as React.MouseEvent);\n return;\n }\n if (e.key === 'Tab' && nodeRef.current) {\n const focusable = nodeRef.current.querySelectorAll<HTMLElement>(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n );\n if (focusable.length === 0) return;\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n if (e.shiftKey) {\n if (document.activeElement === first) { e.preventDefault(); last.focus(); }\n } else {\n if (document.activeElement === last) { e.preventDefault(); first.focus(); }\n }\n }\n };\n document.addEventListener('keydown', handleKeyDown);\n\n // Focus first focusable element\n requestAnimationFrame(() => {\n if (nodeRef.current) {\n const focusable = nodeRef.current.querySelectorAll<HTMLElement>(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n );\n if (focusable.length > 0) focusable[0].focus();\n }\n });\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n previousFocusRef.current?.focus();\n };\n }, [visible, onCancel]);\n\n const renderFooter = (): React.ReactNode => {\n if (React.isValidElement(footer)) {\n return footer;\n } else if (footer === null) {\n return null;\n } else {\n return (\n <Flex gap=\"sm\" justify='end' className={`${prefixCls}__footer`} style={footerStyle}>\n <Button onClick={onCancel} className={`${prefixCls}__footer-btn`} {...cancelButtonProps}>\n {cancelText}\n </Button>\n <Button\n loading={confirmLoading}\n onClick={onConfirm}\n btnType=\"primary\"\n className={`${prefixCls}__footer-btn`}\n {...confirmButtonProps}>\n {confirmText}\n </Button>\n </Flex>\n );\n }\n };\n\n return (\n <Overlay\n onEnter={(): void => setModalVisible(true)}\n onExit={(): void => setModalVisible(false)}\n zIndex={zIndex}\n type={maskType}\n unmountOnExit={unmountOnClose}\n isShow={visible}\n onExited={afterClose}\n clickCallback={(e: React.MouseEvent): void => {\n maskClosable && onCancel ? onCancel(e) : undefined;\n }}\n style={maskStyle}>\n <div ref={ref} className={cls} style={{ top }}>\n <div style={{ width, ...style }}>\n <Transition\n appear={true}\n nodeRef={nodeRef}\n in={modalVisible}\n classNames={`${prefixCls}__content_${animation}`}\n unmountOnExit={false}\n timeout={0}>\n <div\n ref={nodeRef}\n className={`${prefixCls}__content`}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={header ? titleId : undefined}\n onClick={(e): void => e.stopPropagation()}>\n {closable && (\n <button type=\"button\" className={`${prefixCls}__close-btn`} onClick={onCancel} aria-label=\"Close\">\n ✕\n </button>\n )}\n {header && (\n <div className={`${prefixCls}__header`} style={headerStyle}>\n <div className={`${prefixCls}__title`} id={titleId}>{header}</div>\n </div>\n )}\n <div className={`${prefixCls}__body`} style={bodyStyle}>\n {children}\n </div>\n {renderFooter()}\n </div>\n </Transition>\n </div>\n </div>\n </Overlay>\n );\n});\n\nModal.displayName = 'Modal';\n\nexport default Modal;\n"],"mappings":";;;;;;;;;;;;;;AAWA,MAAM,QAAQA,MAAAA,QAAM,YAAwC,OAAO,QAAQ;CACzE,MAAM,SAASC,mBAAAA,WAAW;CAC1B,MAAM,EACJ,UAAU,OACV,QAAQ,KACR,WAAW,OACX,WAAW,MACX,iBAAiB,MACjB,WAAW,WACX,eAAe,MACf,cAAc,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MAAY,EAAE,iBAAiB;gBAN3C;OAOG,YACC,iBAAA,GAAA,kBAAA,KAAC,UAAD;QAAQ,MAAK;QAAS,WAAW,GAAG,UAAU;QAAc,SAAS;QAAU,cAAW;kBAAQ;QAEzF,CAAA;OAEV,UACC,iBAAA,GAAA,kBAAA,KAAC,OAAD;QAAK,WAAW,GAAG,UAAU;QAAW,OAAO;kBAC7C,iBAAA,GAAA,kBAAA,KAAC,OAAD;SAAK,WAAW,GAAG,UAAU;SAAU,IAAI;mBAAU;SAAa,CAAA;QAC9D,CAAA;OAER,iBAAA,GAAA,kBAAA,KAAC,OAAD;QAAK,WAAW,GAAG,UAAU;QAAS,OAAO;QAC1C;QACG,CAAA;OACL,cAAc;OACX;;KACK,CAAA;IACT,CAAA;GACF,CAAA;EACE,CAAA;EAEZ;AAEF,MAAM,cAAc"}
@@ -1,12 +1,12 @@
1
1
  const require_runtime = require("../_virtual/_rolldown/runtime.js");
2
2
  const require_config_context = require("../config-provider/config-context.js");
3
3
  const require_general = require("../_utils/general.js");
4
- const require_index = require("../portal/index.js");
4
+ const require_index = require("../transition/index.js");
5
+ const require_index$1 = require("../portal/index.js");
5
6
  let react = require("react");
6
7
  let classnames = require("classnames");
7
8
  classnames = require_runtime.__toESM(classnames);
8
9
  let react_jsx_runtime = require("react/jsx-runtime");
9
- let react_transition_group = require("react-transition-group");
10
10
  //#region src/overlay/overlay.tsx
11
11
  let scrollLockCount = 0;
12
12
  const Overlay = (props) => {
@@ -29,7 +29,7 @@ const Overlay = (props) => {
29
29
  }
30
30
  };
31
31
  }, [isShow]);
32
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.default, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_transition_group.CSSTransition, {
32
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.default, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.default, {
33
33
  appear: true,
34
34
  nodeRef,
35
35
  onEnter,
@@ -1 +1 @@
1
- {"version":3,"file":"overlay.js","names":["getPrefixCls","ConfigContext","Portal","CSSTransition"],"sources":["../../src/overlay/overlay.tsx"],"sourcesContent":["import { useContext, useEffect, useRef } from 'react';\nimport classNames from 'classnames';\nimport Portal from '../portal';\nimport { CSSTransition } from 'react-transition-group';\nimport { ConfigContext } from '../config-provider/config-context';\nimport { getPrefixCls } from '../_utils/general';\nimport { OverlayProps } from './types';\n\nlet scrollLockCount = 0;\n\nconst Overlay = (props: OverlayProps): JSX.Element => {\n const {\n isShow = false,\n blurred = false,\n unmountOnExit = true,\n zIndex = 1000,\n type = 'default',\n clickCallback,\n onEnter,\n onEntered,\n onExit,\n onExited,\n children,\n style,\n prefixCls: customisedCls,\n } = props;\n const configContext = useContext(ConfigContext);\n const prefixCls = getPrefixCls('overlay', configContext.prefixCls, customisedCls);\n const cls = classNames(prefixCls, `${prefixCls}_${type}`, { [`${prefixCls}_blurred`]: blurred });\n const nodeRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (isShow) {\n scrollLockCount++;\n document.body.style.overflow = 'hidden';\n }\n return () => {\n if (isShow) {\n scrollLockCount--;\n if (scrollLockCount <= 0) {\n scrollLockCount = 0;\n document.body.style.overflow = '';\n }\n }\n };\n }, [isShow]);\n\n return (\n <Portal>\n <CSSTransition\n appear={true}\n nodeRef={nodeRef}\n onEnter={onEnter}\n onEntered={onEntered}\n onExit={onExit}\n onExited={onExited}\n in={isShow}\n mountOnEnter={true}\n unmountOnExit={unmountOnExit}\n classNames={`${prefixCls}_fade`}\n timeout={{ exit: 300, enter: 0 }}>\n <div ref={nodeRef} tabIndex={-1} className={cls} onClick={clickCallback} style={{ zIndex, ...style }}>\n {children}\n </div>\n </CSSTransition>\n </Portal>\n );\n};\n\nOverlay.displayName = 'Overlay';\n\nexport default Overlay;\n"],"mappings":";;;;;;;;;;AAQA,IAAI,kBAAkB;AAEtB,MAAM,WAAW,UAAqC;CACpD,MAAM,EACJ,SAAS,OACT,UAAU,OACV,gBAAgB,MAChB,SAAS,KACT,OAAO,WACP,eACA,SACA,WACA,QACA,UACA,UACA,OACA,WAAW,kBACT;CAEJ,MAAM,YAAYA,gBAAAA,aAAa,YAAA,GAAA,MAAA,YADEC,uBAAAA,cAAc,CACS,WAAW,cAAc;CACjF,MAAM,OAAA,GAAA,WAAA,SAAiB,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,GAAG,UAAU,YAAY,SAAS,CAAC;CAChG,MAAM,WAAA,GAAA,MAAA,QAAiC,KAAK;AAE5C,EAAA,GAAA,MAAA,iBAAgB;AACd,MAAI,QAAQ;AACV;AACA,YAAS,KAAK,MAAM,WAAW;;AAEjC,eAAa;AACX,OAAI,QAAQ;AACV;AACA,QAAI,mBAAmB,GAAG;AACxB,uBAAkB;AAClB,cAAS,KAAK,MAAM,WAAW;;;;IAIpC,CAAC,OAAO,CAAC;AAEZ,QACE,iBAAA,GAAA,kBAAA,KAACC,cAAAA,SAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAACC,uBAAAA,eAAD;EACE,QAAQ;EACC;EACA;EACE;EACH;EACE;EACV,IAAI;EACJ,cAAc;EACC;EACf,YAAY,GAAG,UAAU;EACzB,SAAS;GAAE,MAAM;GAAK,OAAO;GAAG;YAChC,iBAAA,GAAA,kBAAA,KAAC,OAAD;GAAK,KAAK;GAAS,UAAU;GAAI,WAAW;GAAK,SAAS;GAAe,OAAO;IAAE;IAAQ,GAAG;IAAO;GACjG;GACG,CAAA;EACQ,CAAA,EACT,CAAA;;AAIb,QAAQ,cAAc"}
1
+ {"version":3,"file":"overlay.js","names":["getPrefixCls","ConfigContext","Portal","Transition"],"sources":["../../src/overlay/overlay.tsx"],"sourcesContent":["import { useContext, useEffect, useRef } from 'react';\nimport classNames from 'classnames';\nimport Portal from '../portal';\nimport Transition from '../transition';\nimport { ConfigContext } from '../config-provider/config-context';\nimport { getPrefixCls } from '../_utils/general';\nimport { OverlayProps } from './types';\n\nlet scrollLockCount = 0;\n\nconst Overlay = (props: OverlayProps): JSX.Element => {\n const {\n isShow = false,\n blurred = false,\n unmountOnExit = true,\n zIndex = 1000,\n type = 'default',\n clickCallback,\n onEnter,\n onEntered,\n onExit,\n onExited,\n children,\n style,\n prefixCls: customisedCls,\n } = props;\n const configContext = useContext(ConfigContext);\n const prefixCls = getPrefixCls('overlay', configContext.prefixCls, customisedCls);\n const cls = classNames(prefixCls, `${prefixCls}_${type}`, { [`${prefixCls}_blurred`]: blurred });\n const nodeRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (isShow) {\n scrollLockCount++;\n document.body.style.overflow = 'hidden';\n }\n return () => {\n if (isShow) {\n scrollLockCount--;\n if (scrollLockCount <= 0) {\n scrollLockCount = 0;\n document.body.style.overflow = '';\n }\n }\n };\n }, [isShow]);\n\n return (\n <Portal>\n <Transition\n appear={true}\n nodeRef={nodeRef}\n onEnter={onEnter}\n onEntered={onEntered}\n onExit={onExit}\n onExited={onExited}\n in={isShow}\n mountOnEnter={true}\n unmountOnExit={unmountOnExit}\n classNames={`${prefixCls}_fade`}\n timeout={{ exit: 300, enter: 0 }}>\n <div ref={nodeRef} tabIndex={-1} className={cls} onClick={clickCallback} style={{ zIndex, ...style }}>\n {children}\n </div>\n </Transition>\n </Portal>\n );\n};\n\nOverlay.displayName = 'Overlay';\n\nexport default Overlay;\n"],"mappings":";;;;;;;;;;AAQA,IAAI,kBAAkB;AAEtB,MAAM,WAAW,UAAqC;CACpD,MAAM,EACJ,SAAS,OACT,UAAU,OACV,gBAAgB,MAChB,SAAS,KACT,OAAO,WACP,eACA,SACA,WACA,QACA,UACA,UACA,OACA,WAAW,kBACT;CAEJ,MAAM,YAAYA,gBAAAA,aAAa,YAAA,GAAA,MAAA,YADEC,uBAAAA,cAAc,CACS,WAAW,cAAc;CACjF,MAAM,OAAA,GAAA,WAAA,SAAiB,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,GAAG,UAAU,YAAY,SAAS,CAAC;CAChG,MAAM,WAAA,GAAA,MAAA,QAAiC,KAAK;AAE5C,EAAA,GAAA,MAAA,iBAAgB;AACd,MAAI,QAAQ;AACV;AACA,YAAS,KAAK,MAAM,WAAW;;AAEjC,eAAa;AACX,OAAI,QAAQ;AACV;AACA,QAAI,mBAAmB,GAAG;AACxB,uBAAkB;AAClB,cAAS,KAAK,MAAM,WAAW;;;;IAIpC,CAAC,OAAO,CAAC;AAEZ,QACE,iBAAA,GAAA,kBAAA,KAACC,gBAAAA,SAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAACC,cAAAA,SAAD;EACE,QAAQ;EACC;EACA;EACE;EACH;EACE;EACV,IAAI;EACJ,cAAc;EACC;EACf,YAAY,GAAG,UAAU;EACzB,SAAS;GAAE,MAAM;GAAK,OAAO;GAAG;YAChC,iBAAA,GAAA,kBAAA,KAAC,OAAD;GAAK,KAAK;GAAS,UAAU;GAAI,WAAW;GAAK,SAAS;GAAe,OAAO;IAAE;IAAQ,GAAG;IAAO;GACjG;GACG,CAAA;EACK,CAAA,EACN,CAAA;;AAIb,QAAQ,cAAc"}
@@ -15,6 +15,10 @@
15
15
  }
16
16
 
17
17
  &__buttons {
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: flex-end;
21
+ gap: 8px;
18
22
  text-align: right;
19
23
  }
20
24
 
@@ -11,6 +11,10 @@
11
11
  align-items: center;
12
12
  }
13
13
  .ty-pop-confirm__buttons {
14
+ display: flex;
15
+ align-items: center;
16
+ justify-content: flex-end;
17
+ gap: 8px;
14
18
  text-align: right;
15
19
  }
16
20
  .ty-pop-confirm__title {
@@ -5,21 +5,13 @@
5
5
  box-sizing: border-box;
6
6
  cursor: pointer;
7
7
 
8
- &_horizontal.#{$prefix}-slider {
9
- margin-bottom: $slider-margin-bottom-with-marks;
10
- }
11
-
12
- &_vertical.#{$prefix}-slider {
13
- margin-right: $slider-margin-bottom-with-marks;
14
- }
15
-
16
8
  &_horizontal {
9
+ width: 100%;
17
10
  min-height: $slider-size;
18
11
  margin: 13px 7px;
19
12
  padding: 4px 0;
20
13
 
21
14
  .#{$prefix}-slider {
22
-
23
15
  &__rail {
24
16
  width: 100%;
25
17
  height: $slider-track-size;
@@ -3,13 +3,8 @@
3
3
  box-sizing: border-box;
4
4
  cursor: pointer;
5
5
  }
6
- .ty-slider_horizontal.ty-slider {
7
- margin-bottom: 30px;
8
- }
9
- .ty-slider_vertical.ty-slider {
10
- margin-right: 30px;
11
- }
12
6
  .ty-slider_horizontal {
7
+ width: 100%;
13
8
  min-height: 12px;
14
9
  margin: 13px 7px;
15
10
  padding: 4px 0;
@@ -1,5 +1,4 @@
1
1
  @use "../../style/variables" as *;
2
- @use "sass:color";
3
2
 
4
3
  $speed-dial-fab-size: 56px;
5
4
  $speed-dial-action-size: 40px;
@@ -18,8 +17,8 @@ $speed-dial-actions-gap: 16px;
18
17
  height: $speed-dial-fab-size;
19
18
  border-radius: 50%;
20
19
  border: none;
21
- background-color: var(--ty-speed-dial-bg, #{$primary-color});
22
- color: var(--ty-speed-dial-color, #{$white-color});
20
+ background-color: var(--ty-speed-dial-bg, var(--ty-color-primary));
21
+ color: var(--ty-speed-dial-color, #fff);
23
22
  font-size: 24px;
24
23
  cursor: pointer;
25
24
  box-shadow: $box-shadow;
@@ -27,11 +26,11 @@ $speed-dial-actions-gap: 16px;
27
26
  outline: none;
28
27
 
29
28
  &:hover:not(.#{$prefix}-speed-dial__button_disabled) {
30
- background-color: var(--ty-speed-dial-bg-hover, #{color.adjust($primary-color, $lightness: -8%)});
29
+ background-color: var(--ty-speed-dial-bg-hover, var(--ty-color-primary-active));
31
30
  }
32
31
 
33
32
  &:focus-visible {
34
- box-shadow: 0 0 0 3px rgba($primary-color, 0.3), $box-shadow;
33
+ box-shadow: 0 0 0 3px var(--ty-input-focus-shadow, rgb(110 65 191 / 20%)), $box-shadow;
35
34
  }
36
35
 
37
36
  &_open {
@@ -59,7 +58,7 @@ $speed-dial-actions-gap: 16px;
59
58
  position: absolute;
60
59
  top: 50%;
61
60
  left: 50%;
62
- background-color: currentColor;
61
+ background-color: currentcolor;
63
62
  border-radius: 1px;
64
63
  translate: -50% -50%;
65
64
  }
@@ -183,7 +182,7 @@ $speed-dial-actions-gap: 16px;
183
182
  }
184
183
 
185
184
  &:focus-visible {
186
- box-shadow: 0 0 0 3px rgba($primary-color, 0.3), $box-shadow-sm;
185
+ box-shadow: 0 0 0 3px var(--ty-input-focus-shadow, rgb(110 65 191 / 20%)), $box-shadow-sm;
187
186
  }
188
187
 
189
188
  &_disabled {
@@ -10,7 +10,7 @@
10
10
  height: 56px;
11
11
  border-radius: 50%;
12
12
  border: none;
13
- background-color: var(--ty-speed-dial-bg, #6e41bf);
13
+ background-color: var(--ty-speed-dial-bg, var(--ty-color-primary));
14
14
  color: var(--ty-speed-dial-color, #fff);
15
15
  font-size: 24px;
16
16
  cursor: pointer;
@@ -19,10 +19,10 @@
19
19
  outline: none;
20
20
  }
21
21
  .ty-speed-dial__button:hover:not(.ty-speed-dial__button_disabled) {
22
- background-color: var(--ty-speed-dial-bg-hover, rgb(92.3496062992, 54.2236220472, 160.9763779528));
22
+ background-color: var(--ty-speed-dial-bg-hover, var(--ty-color-primary-active));
23
23
  }
24
24
  .ty-speed-dial__button:focus-visible {
25
- box-shadow: 0 0 0 3px rgba(110, 65, 191, 0.3), 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
25
+ box-shadow: 0 0 0 3px var(--ty-input-focus-shadow, rgba(110, 65, 191, 0.2)), 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
26
26
  }
27
27
  .ty-speed-dial__button_open .ty-speed-dial__icon-default {
28
28
  transform: rotate(45deg);
@@ -43,7 +43,7 @@
43
43
  position: absolute;
44
44
  top: 50%;
45
45
  left: 50%;
46
- background-color: currentColor;
46
+ background-color: currentcolor;
47
47
  border-radius: 1px;
48
48
  translate: -50% -50%;
49
49
  }
@@ -145,7 +145,7 @@
145
145
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
146
146
  }
147
147
  .ty-speed-dial__action:focus-visible {
148
- box-shadow: 0 0 0 3px rgba(110, 65, 191, 0.3), 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
148
+ box-shadow: 0 0 0 3px var(--ty-input-focus-shadow, rgba(110, 65, 191, 0.2)), 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
149
149
  }
150
150
  .ty-speed-dial__action_disabled {
151
151
  opacity: 0.5;
@@ -27,19 +27,26 @@
27
27
  --ty-color-fill-secondary: #f5f5f5;
28
28
  --ty-color-fill-tertiary: #f0f0f0;
29
29
  --ty-color-success: #52c41a;
30
+ --ty-color-success-hover: #73d13d;
31
+ --ty-color-success-active: #389e0d;
30
32
  --ty-color-success-bg: #f6ffed;
31
33
  --ty-color-success-border: #b7eb8f;
32
34
  --ty-color-success-text: #49b10e;
33
35
  --ty-color-warning: #ff9800;
36
+ --ty-color-warning-hover: #ffad33;
37
+ --ty-color-warning-active: #e68a00;
34
38
  --ty-color-warning-bg: #fffbe6;
35
39
  --ty-color-warning-border: #ffe58f;
36
40
  --ty-color-warning-text: #d48806;
37
41
  --ty-color-danger: #f44336;
42
+ --ty-color-danger-hover: #ff7875;
43
+ --ty-color-danger-active: #cf1322;
38
44
  --ty-color-danger-bg: #fff1f0;
39
45
  --ty-color-danger-border: #ffa39e;
40
46
  --ty-color-danger-text: #cf1322;
41
- --ty-color-danger-hover: #ff7875;
42
47
  --ty-color-info: #1890ff;
48
+ --ty-color-info-hover: #40a9ff;
49
+ --ty-color-info-active: #096dd9;
43
50
  --ty-color-info-bg: #e6f7ff;
44
51
  --ty-color-info-border: #91d5ff;
45
52
  --ty-color-info-text: #096dd9;
@@ -294,19 +301,26 @@ html[data-tiny-theme=dark] {
294
301
  --ty-color-fill-secondary: #2a2a2a;
295
302
  --ty-color-fill-tertiary: #303030;
296
303
  --ty-color-success: #49aa19;
304
+ --ty-color-success-hover: #6abe39;
305
+ --ty-color-success-active: #3c8c14;
297
306
  --ty-color-success-bg: #162312;
298
307
  --ty-color-success-border: #274916;
299
308
  --ty-color-success-text: #6abe39;
300
309
  --ty-color-warning: #d89614;
310
+ --ty-color-warning-hover: #e8b339;
311
+ --ty-color-warning-active: #b37a10;
301
312
  --ty-color-warning-bg: #2b2111;
302
313
  --ty-color-warning-border: #594214;
303
314
  --ty-color-warning-text: #e8b339;
304
315
  --ty-color-danger: #d32029;
316
+ --ty-color-danger-hover: #e84749;
317
+ --ty-color-danger-active: #ab1a20;
305
318
  --ty-color-danger-bg: #2a1215;
306
319
  --ty-color-danger-border: #58181c;
307
320
  --ty-color-danger-text: #e84749;
308
- --ty-color-danger-hover: #e84749;
309
321
  --ty-color-info: #177ddc;
322
+ --ty-color-info-hover: #3c9ae8;
323
+ --ty-color-info-active: #1268b3;
310
324
  --ty-color-info-bg: #111d2c;
311
325
  --ty-color-info-border: #15395b;
312
326
  --ty-color-info-text: #3c9ae8;
@@ -562,19 +576,26 @@ html[data-tiny-theme=dark] {
562
576
  --ty-color-fill-secondary: #2a2a2a;
563
577
  --ty-color-fill-tertiary: #303030;
564
578
  --ty-color-success: #49aa19;
579
+ --ty-color-success-hover: #6abe39;
580
+ --ty-color-success-active: #3c8c14;
565
581
  --ty-color-success-bg: #162312;
566
582
  --ty-color-success-border: #274916;
567
583
  --ty-color-success-text: #6abe39;
568
584
  --ty-color-warning: #d89614;
585
+ --ty-color-warning-hover: #e8b339;
586
+ --ty-color-warning-active: #b37a10;
569
587
  --ty-color-warning-bg: #2b2111;
570
588
  --ty-color-warning-border: #594214;
571
589
  --ty-color-warning-text: #e8b339;
572
590
  --ty-color-danger: #d32029;
591
+ --ty-color-danger-hover: #e84749;
592
+ --ty-color-danger-active: #ab1a20;
573
593
  --ty-color-danger-bg: #2a1215;
574
594
  --ty-color-danger-border: #58181c;
575
595
  --ty-color-danger-text: #e84749;
576
- --ty-color-danger-hover: #e84749;
577
596
  --ty-color-info: #177ddc;
597
+ --ty-color-info-hover: #3c9ae8;
598
+ --ty-color-info-active: #1268b3;
578
599
  --ty-color-info-bg: #111d2c;
579
600
  --ty-color-info-border: #15395b;
580
601
  --ty-color-info-text: #3c9ae8;
@@ -102,6 +102,30 @@
102
102
  background: var(--ty-tag-purple-bg);
103
103
  border-color: var(--ty-tag-purple-border);
104
104
  }
105
+
106
+ &_success {
107
+ color: var(--ty-color-success);
108
+ background: var(--ty-color-success-bg);
109
+ border-color: var(--ty-color-success-border);
110
+ }
111
+
112
+ &_info {
113
+ color: var(--ty-color-info);
114
+ background: var(--ty-color-info-bg);
115
+ border-color: var(--ty-color-info-border);
116
+ }
117
+
118
+ &_warning {
119
+ color: var(--ty-color-warning);
120
+ background: var(--ty-color-warning-bg);
121
+ border-color: var(--ty-color-warning-border);
122
+ }
123
+
124
+ &_danger {
125
+ color: var(--ty-color-danger);
126
+ background: var(--ty-color-danger-bg);
127
+ border-color: var(--ty-color-danger-border);
128
+ }
105
129
  }
106
130
 
107
131
  .#{$prefix}-checkable-tag {
@@ -88,6 +88,26 @@
88
88
  background: var(--ty-tag-purple-bg);
89
89
  border-color: var(--ty-tag-purple-border);
90
90
  }
91
+ .ty-tag_success {
92
+ color: var(--ty-color-success);
93
+ background: var(--ty-color-success-bg);
94
+ border-color: var(--ty-color-success-border);
95
+ }
96
+ .ty-tag_info {
97
+ color: var(--ty-color-info);
98
+ background: var(--ty-color-info-bg);
99
+ border-color: var(--ty-color-info-border);
100
+ }
101
+ .ty-tag_warning {
102
+ color: var(--ty-color-warning);
103
+ background: var(--ty-color-warning-bg);
104
+ border-color: var(--ty-color-warning-border);
105
+ }
106
+ .ty-tag_danger {
107
+ color: var(--ty-color-danger);
108
+ background: var(--ty-color-danger-bg);
109
+ border-color: var(--ty-color-danger-border);
110
+ }
91
111
 
92
112
  .ty-checkable-tag {
93
113
  background-color: var(--ty-tag-checkable-bg);
@@ -8,8 +8,9 @@ interface CheckableTagProps extends BaseProps {
8
8
  onChange?: (checked: boolean, e: React.MouseEvent) => void;
9
9
  children?: React.ReactNode;
10
10
  }
11
+ type StatusColor = 'success' | 'warning' | 'info' | 'danger';
11
12
  interface TagProps extends BaseProps, React.PropsWithoutRef<JSX.IntrinsicElements['div']> {
12
- color?: string;
13
+ color?: string | StatusColor;
13
14
  closable?: boolean;
14
15
  onClose?: React.MouseEventHandler;
15
16
  onClick?: React.MouseEventHandler;
package/lib/tag/types.js CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/tag/types.ts
2
1
  const PresetColors = [
3
2
  "magenta",
4
3
  "red",
@@ -10,7 +9,13 @@ const PresetColors = [
10
9
  "cyan",
11
10
  "blue",
12
11
  "geekblue",
13
- "purple"
12
+ "purple",
13
+ ...[
14
+ "success",
15
+ "info",
16
+ "warning",
17
+ "danger"
18
+ ]
14
19
  ];
15
20
  //#endregion
16
21
  exports.PresetColors = PresetColors;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/tag/types.ts"],"sourcesContent":["import React from 'react';\nimport { BaseProps } from '../_utils/props';\n\nexport interface CheckableTagProps extends BaseProps {\n defaultChecked?: boolean;\n checked?: boolean;\n onChange?: (checked: boolean, e: React.MouseEvent) => void;\n children?: React.ReactNode;\n}\n\nexport const PresetColors = [\n 'magenta',\n 'red',\n 'volcano',\n 'orange',\n 'gold',\n 'lime',\n 'green',\n 'cyan',\n 'blue',\n 'geekblue',\n 'purple',\n];\n\nexport interface TagProps extends BaseProps, React.PropsWithoutRef<JSX.IntrinsicElements['div']> {\n color?: string;\n closable?: boolean;\n onClose?: React.MouseEventHandler;\n onClick?: React.MouseEventHandler;\n defaultVisible?: boolean;\n visible?: boolean;\n children?: React.ReactNode;\n}\n"],"mappings":";AAUA,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/tag/types.ts"],"sourcesContent":["import React from 'react';\nimport { BaseProps } from '../_utils/props';\n\nexport interface CheckableTagProps extends BaseProps {\n defaultChecked?: boolean;\n checked?: boolean;\n onChange?: (checked: boolean, e: React.MouseEvent) => void;\n children?: React.ReactNode;\n}\n\nexport type StatusColor = 'success' | 'warning' | 'info' | 'danger';\n\nexport const StatusColors: StatusColor[] = ['success', 'info', 'warning', 'danger'];\n\nexport const PresetColors = [\n 'magenta',\n 'red',\n 'volcano',\n 'orange',\n 'gold',\n 'lime',\n 'green',\n 'cyan',\n 'blue',\n 'geekblue',\n 'purple',\n ...StatusColors,\n];\n\nexport interface TagProps extends BaseProps, React.PropsWithoutRef<JSX.IntrinsicElements['div']> {\n color?: string | StatusColor;\n closable?: boolean;\n onClose?: React.MouseEventHandler;\n onClick?: React.MouseEventHandler;\n defaultVisible?: boolean;\n visible?: boolean;\n children?: React.ReactNode;\n}\n"],"mappings":"AAcA,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,GAdyC;EAAC;EAAW;EAAQ;EAAW;EAAS;CAelF"}
@@ -29,6 +29,10 @@ $tp: #{$prefix}-time-picker;
29
29
  box-shadow: var(--ty-input-focus-shadow);
30
30
  }
31
31
 
32
+ &_pending &__input-field {
33
+ color: var(--ty-color-text-tertiary);
34
+ }
35
+
32
36
  &__input-field {
33
37
  flex: 1;
34
38
  border: none;
@@ -191,6 +195,15 @@ $tp: #{$prefix}-time-picker;
191
195
  }
192
196
  }
193
197
 
198
+ &_pending {
199
+ background: var(--ty-color-primary-bg);
200
+ color: var(--ty-color-text-tertiary);
201
+
202
+ &:hover {
203
+ background: var(--ty-color-primary-bg-hover);
204
+ }
205
+ }
206
+
194
207
  &_disabled {
195
208
  color: var(--ty-color-text-quaternary);
196
209
  cursor: not-allowed;
@@ -21,6 +21,9 @@
21
21
  border-color: var(--ty-color-primary);
22
22
  box-shadow: var(--ty-input-focus-shadow);
23
23
  }
24
+ .ty-time-picker_pending .ty-time-picker__input-field {
25
+ color: var(--ty-color-text-tertiary);
26
+ }
24
27
  .ty-time-picker__input-field {
25
28
  flex: 1;
26
29
  border: none;
@@ -157,6 +160,13 @@
157
160
  .ty-time-picker__cell_selected:hover {
158
161
  background: var(--ty-color-primary-bg-hover);
159
162
  }
163
+ .ty-time-picker__cell_pending {
164
+ background: var(--ty-color-primary-bg);
165
+ color: var(--ty-color-text-tertiary);
166
+ }
167
+ .ty-time-picker__cell_pending:hover {
168
+ background: var(--ty-color-primary-bg-hover);
169
+ }
160
170
  .ty-time-picker__cell_disabled {
161
171
  color: var(--ty-color-text-quaternary);
162
172
  cursor: not-allowed;
@@ -6,14 +6,16 @@ let react_jsx_runtime = require("react/jsx-runtime");
6
6
  //#region src/time-picker/time-panel.tsx
7
7
  const ITEM_HEIGHT = 28;
8
8
  const TimePanel = (props) => {
9
- const { prefixCls, value, items, disabledItems = [], loop = false, onChange } = props;
9
+ const { prefixCls, value, pendingValue, items, disabledItems = [], loop = false, onChange } = props;
10
10
  const panelRef = (0, react.useRef)(null);
11
11
  const itemRefs = (0, react.useRef)(/* @__PURE__ */ new Map());
12
12
  const isResetting = (0, react.useRef)(false);
13
13
  const clickedRef = (0, react.useRef)(false);
14
14
  const scrollToItemRef = (0, react.useRef)(null);
15
15
  const oneGroupHeight = items.length * ITEM_HEIGHT;
16
+ const displayValue = pendingValue ?? value;
16
17
  scrollToItemRef.current = (val) => {
18
+ if (val === null) return;
17
19
  const panel = panelRef.current;
18
20
  if (!panel) return;
19
21
  if (loop) {
@@ -41,8 +43,8 @@ const TimePanel = (props) => {
41
43
  clickedRef.current = false;
42
44
  return;
43
45
  }
44
- scrollToItemRef.current?.(value);
45
- }, [value]);
46
+ scrollToItemRef.current?.(displayValue);
47
+ }, [displayValue]);
46
48
  const handleScroll = (0, react.useCallback)(() => {
47
49
  if (!loop || isResetting.current) return;
48
50
  const panel = panelRef.current;
@@ -64,6 +66,16 @@ const TimePanel = (props) => {
64
66
  clickedRef.current = true;
65
67
  onChange(num);
66
68
  };
69
+ const isPending = pendingValue !== null;
70
+ const isCommitted = value !== null && pendingValue === null;
71
+ const cellCls = (num) => {
72
+ const isSelected = num === displayValue;
73
+ return (0, classnames.default)(`${prefixCls}__cell`, {
74
+ [`${prefixCls}__cell_selected`]: isSelected && isCommitted,
75
+ [`${prefixCls}__cell_pending`]: isSelected && isPending,
76
+ [`${prefixCls}__cell_disabled`]: disabledItems.includes(num)
77
+ });
78
+ };
67
79
  if (loop) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
68
80
  className: `${prefixCls}__column`,
69
81
  ref: panelRef,
@@ -74,17 +86,11 @@ const TimePanel = (props) => {
74
86
  0,
75
87
  1,
76
88
  2
77
- ].map((copyIdx) => items.map((num, i) => {
78
- const isDisabled = disabledItems.includes(num);
79
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
80
- className: (0, classnames.default)(`${prefixCls}__cell`, {
81
- [`${prefixCls}__cell_selected`]: num === value,
82
- [`${prefixCls}__cell_disabled`]: isDisabled
83
- }),
84
- onClick: () => handleClick(num),
85
- children: String(num).padStart(2, "0")
86
- }, `c${copyIdx}-${i}`);
87
- }))
89
+ ].map((copyIdx) => items.map((num, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
90
+ className: cellCls(num),
91
+ onClick: () => handleClick(num),
92
+ children: String(num).padStart(2, "0")
93
+ }, `c${copyIdx}-${i}`)))
88
94
  })
89
95
  });
90
96
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -92,20 +98,14 @@ const TimePanel = (props) => {
92
98
  ref: panelRef,
93
99
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
94
100
  className: `${prefixCls}__column-list`,
95
- children: items.map((num) => {
96
- const isDisabled = disabledItems.includes(num);
97
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
98
- ref: (el) => {
99
- if (el) itemRefs.current.set(num, el);
100
- },
101
- className: (0, classnames.default)(`${prefixCls}__cell`, {
102
- [`${prefixCls}__cell_selected`]: num === value,
103
- [`${prefixCls}__cell_disabled`]: isDisabled
104
- }),
105
- onClick: () => handleClick(num),
106
- children: String(num).padStart(2, "0")
107
- }, num);
108
- })
101
+ children: items.map((num) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
102
+ ref: (el) => {
103
+ if (el) itemRefs.current.set(num, el);
104
+ },
105
+ className: cellCls(num),
106
+ onClick: () => handleClick(num),
107
+ children: String(num).padStart(2, "0")
108
+ }, num))
109
109
  })
110
110
  });
111
111
  };
@@ -1 +1 @@
1
- {"version":3,"file":"time-panel.js","names":[],"sources":["../../src/time-picker/time-panel.tsx"],"sourcesContent":["import { useRef, useEffect, useCallback } from 'react';\nimport classNames from 'classnames';\n\nexport interface TimePanelProps {\n value: number;\n items: number[];\n disabledItems?: number[];\n loop?: boolean;\n onChange: (num: number) => void;\n prefixCls: string;\n}\n\nconst ITEM_HEIGHT = 28; // 4px padding-top + 20px line-height + 4px padding-bottom\n\nconst TimePanel = (props: TimePanelProps): React.ReactElement => {\n const { prefixCls, value, items, disabledItems = [], loop = false, onChange } = props;\n const panelRef = useRef<HTMLDivElement>(null);\n const itemRefs = useRef<Map<number, HTMLLIElement>>(new Map());\n const isResetting = useRef(false);\n const clickedRef = useRef(false);\n const scrollToItemRef = useRef<((val: number) => void) | null>(null);\n\n const oneGroupHeight = items.length * ITEM_HEIGHT;\n\n scrollToItemRef.current = (val: number) => {\n const panel = panelRef.current;\n if (!panel) return;\n\n if (loop) {\n const idx = items.indexOf(val);\n if (idx === -1) return;\n const top = oneGroupHeight + idx * ITEM_HEIGHT;\n isResetting.current = true;\n panel.scrollTo({ top, behavior: 'auto' });\n requestAnimationFrame(() => { isResetting.current = false; });\n } else {\n const el = itemRefs.current.get(val);\n if (el) {\n panel.scrollTo({ top: el.offsetTop, behavior: 'auto' });\n }\n }\n };\n\n useEffect(() => {\n if (clickedRef.current) {\n clickedRef.current = false;\n return;\n }\n scrollToItemRef.current?.(value);\n }, [value]);\n\n // Scroll reset for loop mode\n const handleScroll = useCallback(() => {\n if (!loop || isResetting.current) return;\n const panel = panelRef.current;\n if (!panel) return;\n\n const st = panel.scrollTop;\n if (st < oneGroupHeight || st >= 2 * oneGroupHeight) {\n isResetting.current = true;\n panel.scrollTo({ top: (st % oneGroupHeight) + oneGroupHeight, behavior: 'auto' });\n requestAnimationFrame(() => { isResetting.current = false; });\n }\n }, [loop, oneGroupHeight]);\n\n const handleClick = (num: number) => {\n if (disabledItems.includes(num)) return;\n clickedRef.current = true;\n onChange(num);\n };\n\n if (loop) {\n const copies = [0, 1, 2];\n return (\n <div className={`${prefixCls}__column`} ref={panelRef} onScroll={handleScroll}>\n <ul className={`${prefixCls}__column-list`}>\n {copies.map((copyIdx) =>\n items.map((num, i) => {\n const isDisabled = disabledItems.includes(num);\n const cls = classNames(`${prefixCls}__cell`, {\n [`${prefixCls}__cell_selected`]: num === value,\n [`${prefixCls}__cell_disabled`]: isDisabled,\n });\n return (\n <li\n key={`c${copyIdx}-${i}`}\n className={cls}\n onClick={() => handleClick(num)}>\n {String(num).padStart(2, '0')}\n </li>\n );\n })\n )}\n </ul>\n </div>\n );\n }\n\n return (\n <div className={`${prefixCls}__column`} ref={panelRef}>\n <ul className={`${prefixCls}__column-list`}>\n {items.map((num) => {\n const isDisabled = disabledItems.includes(num);\n const cls = classNames(`${prefixCls}__cell`, {\n [`${prefixCls}__cell_selected`]: num === value,\n [`${prefixCls}__cell_disabled`]: isDisabled,\n });\n return (\n <li\n key={num}\n ref={(el) => {\n if (el) itemRefs.current.set(num, el);\n }}\n className={cls}\n onClick={() => handleClick(num)}>\n {String(num).padStart(2, '0')}\n </li>\n );\n })}\n </ul>\n </div>\n );\n};\n\nexport default TimePanel;\n"],"mappings":";;;;;;AAYA,MAAM,cAAc;AAEpB,MAAM,aAAa,UAA8C;CAC/D,MAAM,EAAE,WAAW,OAAO,OAAO,gBAAgB,EAAE,EAAE,OAAO,OAAO,aAAa;CAChF,MAAM,YAAA,GAAA,MAAA,QAAkC,KAAK;CAC7C,MAAM,YAAA,GAAA,MAAA,wBAA8C,IAAI,KAAK,CAAC;CAC9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EAAK,WAAW,GAAG,UAAU;EAAW,KAAK;EAAU,UAAU;YAC/D,iBAAA,GAAA,kBAAA,KAAC,MAAD;GAAI,WAAW,GAAG,UAAU;aAHjB;IAAC;IAAG;IAAG;IAAE,CAIV,KAAK,YACX,MAAM,KAAK,KAAK,MAAM;IACpB,MAAM,aAAa,cAAc,SAAS,IAAI;AAK9C,WACE,iBAAA,GAAA,kBAAA,KAAC,MAAD;KAEE,YAAA,GAAA,WAAA,SAPmB,GAAG,UAAU,SAAS;OAC1C,GAAG,UAAU,mBAAmB,QAAQ;OACxC,GAAG,UAAU,mBAAmB;MAClC,CAAC;KAKE,eAAe,YAAY,IAAI;eAC9B,OAAO,IAAI,CAAC,SAAS,GAAG,IAAI;KAC1B,EAJE,IAAI,QAAQ,GAAG,IAIjB;KAEP,CACH;GACE,CAAA;EACD,CAAA;AAIV,QACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EAAK,WAAW,GAAG,UAAU;EAAW,KAAK;YAC3C,iBAAA,GAAA,kBAAA,KAAC,MAAD;GAAI,WAAW,GAAG,UAAU;aACzB,MAAM,KAAK,QAAQ;IAClB,MAAM,aAAa,cAAc,SAAS,IAAI;AAK9C,WACE,iBAAA,GAAA,kBAAA,KAAC,MAAD;KAEE,MAAM,OAAO;AACX,UAAI,GAAI,UAAS,QAAQ,IAAI,KAAK,GAAG;;KAEvC,YAAA,GAAA,WAAA,SAVmB,GAAG,UAAU,SAAS;OAC1C,GAAG,UAAU,mBAAmB,QAAQ;OACxC,GAAG,UAAU,mBAAmB;MAClC,CAAC;KAQE,eAAe,YAAY,IAAI;eAC9B,OAAO,IAAI,CAAC,SAAS,GAAG,IAAI;KAC1B,EAPE,IAOF;KAEP;GACC,CAAA;EACD,CAAA"}
1
+ {"version":3,"file":"time-panel.js","names":[],"sources":["../../src/time-picker/time-panel.tsx"],"sourcesContent":["import { useRef, useEffect, useCallback } from 'react';\nimport classNames from 'classnames';\n\nexport interface TimePanelProps {\n value: number | null;\n pendingValue: number | null;\n items: number[];\n disabledItems?: number[];\n loop?: boolean;\n onChange: (num: number) => void;\n prefixCls: string;\n}\n\nconst ITEM_HEIGHT = 28; // 4px padding-top + 20px line-height + 4px padding-bottom\n\nconst TimePanel = (props: TimePanelProps): React.ReactElement => {\n const { prefixCls, value, pendingValue, items, disabledItems = [], loop = false, onChange } = props;\n const panelRef = useRef<HTMLDivElement>(null);\n const itemRefs = useRef<Map<number, HTMLLIElement>>(new Map());\n const isResetting = useRef(false);\n const clickedRef = useRef(false);\n const scrollToItemRef = useRef<((val: number | null) => void) | null>(null);\n\n const oneGroupHeight = items.length * ITEM_HEIGHT;\n\n // The displayed value: pending takes priority, then committed\n const displayValue = pendingValue ?? value;\n\n scrollToItemRef.current = (val: number | null) => {\n if (val === null) return;\n const panel = panelRef.current;\n if (!panel) return;\n\n if (loop) {\n const idx = items.indexOf(val);\n if (idx === -1) return;\n const top = oneGroupHeight + idx * ITEM_HEIGHT;\n isResetting.current = true;\n panel.scrollTo({ top, behavior: 'auto' });\n requestAnimationFrame(() => { isResetting.current = false; });\n } else {\n const el = itemRefs.current.get(val);\n if (el) {\n panel.scrollTo({ top: el.offsetTop, behavior: 'auto' });\n }\n }\n };\n\n useEffect(() => {\n if (clickedRef.current) {\n clickedRef.current = false;\n return;\n }\n scrollToItemRef.current?.(displayValue);\n }, [displayValue]);\n\n // Scroll reset for loop mode\n const handleScroll = useCallback(() => {\n if (!loop || isResetting.current) return;\n const panel = panelRef.current;\n if (!panel) return;\n\n const st = panel.scrollTop;\n if (st < oneGroupHeight || st >= 2 * oneGroupHeight) {\n isResetting.current = true;\n panel.scrollTo({ top: (st % oneGroupHeight) + oneGroupHeight, behavior: 'auto' });\n requestAnimationFrame(() => { isResetting.current = false; });\n }\n }, [loop, oneGroupHeight]);\n\n const handleClick = (num: number) => {\n if (disabledItems.includes(num)) return;\n clickedRef.current = true;\n onChange(num);\n };\n\n const isPending = pendingValue !== null;\n const isCommitted = value !== null && pendingValue === null;\n\n const cellCls = (num: number) => {\n const isSelected = num === displayValue;\n return classNames(`${prefixCls}__cell`, {\n [`${prefixCls}__cell_selected`]: isSelected && isCommitted,\n [`${prefixCls}__cell_pending`]: isSelected && isPending,\n [`${prefixCls}__cell_disabled`]: disabledItems.includes(num),\n });\n };\n\n if (loop) {\n const copies = [0, 1, 2];\n return (\n <div className={`${prefixCls}__column`} ref={panelRef} onScroll={handleScroll}>\n <ul className={`${prefixCls}__column-list`}>\n {copies.map((copyIdx) =>\n items.map((num, i) => (\n <li\n key={`c${copyIdx}-${i}`}\n className={cellCls(num)}\n onClick={() => handleClick(num)}>\n {String(num).padStart(2, '0')}\n </li>\n ))\n )}\n </ul>\n </div>\n );\n }\n\n return (\n <div className={`${prefixCls}__column`} ref={panelRef}>\n <ul className={`${prefixCls}__column-list`}>\n {items.map((num) => (\n <li\n key={num}\n ref={(el) => {\n if (el) itemRefs.current.set(num, el);\n }}\n className={cellCls(num)}\n onClick={() => handleClick(num)}>\n {String(num).padStart(2, '0')}\n </li>\n ))}\n </ul>\n </div>\n );\n};\n\nexport default TimePanel;\n"],"mappings":";;;;;;AAaA,MAAM,cAAc;AAEpB,MAAM,aAAa,UAA8C;CAC/D,MAAM,EAAE,WAAW,OAAO,cAAc,OAAO,gBAAgB,EAAE,EAAE,OAAO,OAAO,aAAa;CAC9F,MAAM,YAAA,GAAA,MAAA,QAAkC,KAAK;CAC7C,MAAM,YAAA,GAAA,MAAA,wBAA8C,IAAI,KAAK,CAAC;CAC9D,MAAM,eAAA,GAAA,MAAA,QAAqB,MAAM;CACjC,MAAM,cAAA,GAAA,MAAA,QAAoB,MAAM;CAChC,MAAM,mBAAA,GAAA,MAAA,QAAgE,KAAK;CAE3E,MAAM,iBAAiB,MAAM,SAAS;CAGtC,MAAM,eAAe,gBAAgB;AAErC,iBAAgB,WAAW,QAAuB;AAChD,MAAI,QAAQ,KAAM;EAClB,MAAM,QAAQ,SAAS;AACvB,MAAI,CAAC,MAAO;AAEZ,MAAI,MAAM;G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