shineout 3.10.1-beta.1 → 3.10.1-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.js CHANGED
@@ -545,5 +545,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
545
545
  // 此文件由脚本自动生成,请勿直接修改。
546
546
  // This file was generated automatically by a script. Please do not modify it directly.
547
547
  var _default = exports.default = {
548
- version: '3.10.1-beta.1'
548
+ version: '3.10.1-beta.3'
549
549
  };
package/dist/shineout.js CHANGED
@@ -13686,7 +13686,7 @@ var handleStyle = function handleStyle(style) {
13686
13686
  };
13687
13687
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
13688
13688
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
13689
- /* harmony default export */ var version = ('3.10.1-beta.1');
13689
+ /* harmony default export */ var version = ('3.10.1-beta.3');
13690
13690
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
13691
13691
 
13692
13692
 
@@ -15800,12 +15800,14 @@ var radioTokens = {
15800
15800
  radioSmallPaddingY: 'Spacing-1',
15801
15801
  radioSmallButtonPaddingY: 'Spacing-1',
15802
15802
  radioSmallButtonPaddingX: 'Spacing-8',
15803
+ radioSmallButtonFontSize: 'Font-12',
15803
15804
  radioLargeIconWidth: 'Font-16',
15804
15805
  radioLargeIconBorderWidth: 'Border-2',
15805
15806
  radioLargeLabelFontSize: 'Font-16',
15806
15807
  radioLargePaddingY: 'Spacing-7',
15807
15808
  radioLargeButtonPaddingY: 'Spacing-7',
15808
15809
  radioLargeButtonPaddingX: 'Spacing-16',
15810
+ radioLargeButtonFontSize: 'Font-16',
15809
15811
  radioLabelFontColor: 'Neutral-text-5',
15810
15812
  radioLabelFontSize: 'Font-14',
15811
15813
  radioLabelDisabledFontColor: 'Neutral-text-2'
@@ -20956,10 +20958,6 @@ var dropdown_dropdown = {
20956
20958
  marginLeft: '0',
20957
20959
  marginRight: src.dropdownCaretMarginLeft,
20958
20960
  textAlign: 'right'
20959
- },
20960
- '$wrapper[data-position^="left"] > $button & > svg': {},
20961
- '$wrapper[data-position^="top"] > $button & > svg': {
20962
- transform: 'rotate(180deg)'
20963
20961
  }
20964
20962
  },
20965
20963
  content: {
@@ -25196,11 +25194,13 @@ var radioStyle = objectSpread2_default()(objectSpread2_default()({}, animations)
25196
25194
  marginTop: 1
25197
25195
  },
25198
25196
  'button&': {
25197
+ fontSize: src.radioSmallButtonFontSize,
25199
25198
  padding: "".concat(src.radioSmallButtonPaddingY, " ").concat(src.radioSmallButtonPaddingX)
25200
25199
  }
25201
25200
  },
25202
25201
  wrapperLarge: {
25203
25202
  'button&': {
25203
+ fontSize: src.radioLargeButtonFontSize,
25204
25204
  padding: "".concat(src.radioLargeButtonPaddingY, " ").concat(src.radioLargeButtonPaddingX)
25205
25205
  }
25206
25206
  },
@@ -32966,12 +32966,40 @@ var getPositionStyle = function getPositionStyle(position, config) {
32966
32966
  }
32967
32967
  return newStyle;
32968
32968
  };
32969
- ;// CONCATENATED MODULE: ../hooks/src/common/use-position-style/get-sizing-style.ts
32969
+ ;// CONCATENATED MODULE: ../hooks/src/common/use-position-style/get-boundary-style.ts
32970
+ /**
32971
+ * 基于 boundary 容器的可用空间调整弹出方向
32972
+ * 解决 position='auto' 时方向判断基于视口而非 boundary 的问题
32973
+ */
32974
+ var adjustPositionByBoundary = function adjustPositionByBoundary(position, _ref) {
32975
+ var boundary = _ref.boundary,
32976
+ parentRect = _ref.parentRect,
32977
+ popupGap = _ref.popupGap;
32978
+ var boundaryEl = boundary();
32979
+ if (!boundaryEl) return position;
32980
+ var boundaryRect = boundaryEl.getBoundingClientRect();
32981
+ var gap = popupGap || 0;
32982
+ if (position.startsWith('bottom') || position.startsWith('top')) {
32983
+ var spaceBelow = boundaryRect.bottom - parentRect.bottom - gap;
32984
+ var spaceAbove = parentRect.top - boundaryRect.top - gap;
32985
+ if (position.startsWith('bottom') && spaceBelow < spaceAbove) {
32986
+ return position.replace('bottom', 'top');
32987
+ }
32988
+ if (position.startsWith('top') && spaceAbove < spaceBelow) {
32989
+ return position.replace('top', 'bottom');
32990
+ }
32991
+ }
32992
+ return position;
32993
+ };
32994
+
32970
32995
  // 第一阶段:支持上下边界的高度限制,为vertical模式的Menu实现的
32996
+ // 第二阶段:支持上下边界的高度限制,为Dropdown实现的
32971
32997
  // TODO 后续支持左右边界的宽度限制
32972
- var getSizingStyle = function getSizingStyle(position, _ref) {
32973
- var boundary = _ref.boundary,
32974
- parentRect = _ref.parentRect;
32998
+ var getBoundaryStyle = function getBoundaryStyle(position, _ref2) {
32999
+ var _maxHeight;
33000
+ var boundary = _ref2.boundary,
33001
+ parentRect = _ref2.parentRect,
33002
+ popupGap = _ref2.popupGap;
32975
33003
  var boundaryEl = boundary();
32976
33004
  if (!boundaryEl) return {};
32977
33005
  var boundaryRect = boundaryEl.getBoundingClientRect();
@@ -32980,9 +33008,13 @@ var getSizingStyle = function getSizingStyle(position, _ref) {
32980
33008
  maxHeight = boundaryRect.bottom - parentRect.top;
32981
33009
  } else if (position.endsWith('-bottom')) {
32982
33010
  maxHeight = parentRect.bottom - boundaryRect.top;
33011
+ } else if (position.startsWith('bottom')) {
33012
+ maxHeight = boundaryRect.bottom - parentRect.bottom - (popupGap || 0);
33013
+ } else if (position.startsWith('top')) {
33014
+ maxHeight = parentRect.top - boundaryRect.top - (popupGap || 0);
32983
33015
  }
32984
33016
  return {
32985
- maxHeight: maxHeight,
33017
+ maxHeight: Math.max((_maxHeight = maxHeight) !== null && _maxHeight !== void 0 ? _maxHeight : 0, 0),
32986
33018
  overflowY: 'auto'
32987
33019
  };
32988
33020
  };
@@ -33338,14 +33370,12 @@ var usePositionStyle = function usePositionStyle(config) {
33338
33370
  adjust = _ref.adjust,
33339
33371
  offset = _ref.offset,
33340
33372
  checkPosition = _ref.checkPosition,
33341
- setSizingStyle = _ref.setSizingStyle;
33373
+ setBoundaryStyle = _ref.setBoundaryStyle;
33342
33374
  // 初次渲染无样式的时候, 隐藏展示
33343
33375
  var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(hideStyle),
33344
33376
  _useState2 = slicedToArray_default()(_useState, 2),
33345
33377
  style = _useState2[0],
33346
33378
  setStyle = _useState2[1];
33347
- // const [sizingStyle, setSizingStyle] = useState<React.CSSProperties>();
33348
-
33349
33379
  var _React$useRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef({
33350
33380
  containerRect: {
33351
33381
  left: 0,
@@ -33366,7 +33396,7 @@ var usePositionStyle = function usePositionStyle(config) {
33366
33396
  context = _React$useRef.current;
33367
33397
  var parentElNewPosition = useCheckElementPosition(parentElRef, {
33368
33398
  scrollContainer: scrollElRef === null || scrollElRef === void 0 ? void 0 : scrollElRef.current,
33369
- enable: show && (adjust || checkPosition)
33399
+ enable: show && (adjust || checkPosition || !!boundary)
33370
33400
  });
33371
33401
  var parentElBorderWidth = useCheckElementBorderWidth(parentElRef, {
33372
33402
  direction: 'horizontal',
@@ -33651,7 +33681,18 @@ var usePositionStyle = function usePositionStyle(config) {
33651
33681
  };
33652
33682
  context.parentRect = parentElRef.current.getBoundingClientRect();
33653
33683
  var realPosition = position;
33654
- if (adjust) {
33684
+
33685
+ // 运行时检测 boundary 是否返回有效元素
33686
+ var boundaryAvailable = typeof boundary === 'function' && boundary() !== null;
33687
+ if (boundaryAvailable) {
33688
+ // boundary 模式:基于边界容器的可用空间调整方向
33689
+ realPosition = adjustPositionByBoundary(realPosition, {
33690
+ boundary: boundary,
33691
+ parentRect: context.parentRect,
33692
+ popupGap: popupGap
33693
+ });
33694
+ } else if (adjust) {
33695
+ // 无 boundary 或 boundary 返回 null 时,fallback 到视口调整
33655
33696
  var popupInfo = getPopUpInfo(context.parentRect);
33656
33697
  context.popUpHeight = popupInfo.height;
33657
33698
  context.popUpWidth = popupInfo.width;
@@ -33675,14 +33716,15 @@ var usePositionStyle = function usePositionStyle(config) {
33675
33716
  } else if (realPosition.indexOf('bottom') === 0) {
33676
33717
  newStyle.transformOrigin = 'center top';
33677
33718
  }
33678
- if (boundary && show && popupElRef.current) {
33679
- var newSizingStyle = getSizingStyle(realPosition, {
33719
+ if (boundaryAvailable && show && popupElRef.current) {
33720
+ var newBoundaryStyle = getBoundaryStyle(realPosition, {
33680
33721
  boundary: boundary,
33681
- parentRect: context.parentRect
33722
+ parentRect: context.parentRect,
33723
+ popupGap: popupGap
33682
33724
  });
33683
33725
  return {
33684
33726
  newStyle: newStyle,
33685
- newSizingStyle: newSizingStyle
33727
+ newBoundaryStyle: newBoundaryStyle
33686
33728
  };
33687
33729
  }
33688
33730
  return {
@@ -33692,11 +33734,11 @@ var usePositionStyle = function usePositionStyle(config) {
33692
33734
  var updateStyle = use_persist_fn(function () {
33693
33735
  var _getStyle = getStyle(),
33694
33736
  newStyle = _getStyle.newStyle,
33695
- newSizingStyle = _getStyle.newSizingStyle;
33737
+ newBoundaryStyle = _getStyle.newBoundaryStyle;
33696
33738
  if (newStyle && !shallow_equal(style, newStyle)) {
33697
33739
  setStyle(newStyle);
33698
33740
  }
33699
- setSizingStyle === null || setSizingStyle === void 0 || setSizingStyle(newSizingStyle);
33741
+ setBoundaryStyle === null || setBoundaryStyle === void 0 || setBoundaryStyle(newBoundaryStyle);
33700
33742
 
33701
33743
  // 当父元素的滚动容器滚动时,判断是否需要更新弹出层位置,包括是否隐藏弹出层(通过hideStyle隐藏,不是show状态)
33702
33744
  if (show) {
@@ -33821,7 +33863,7 @@ var AbsoluteList = function AbsoluteList(props) {
33821
33863
  adjust = props.adjust,
33822
33864
  onAdjust = props.onAdjust,
33823
33865
  offset = props.offset,
33824
- setSizingStyle = props.setSizingStyle,
33866
+ setBoundaryStyle = props.setBoundaryStyle,
33825
33867
  _props$destroy = props.destroy,
33826
33868
  destroy = _props$destroy === void 0 ? false : _props$destroy,
33827
33869
  _props$lazy = props.lazy,
@@ -33870,7 +33912,7 @@ var AbsoluteList = function AbsoluteList(props) {
33870
33912
  offset: offset,
33871
33913
  onAdjust: onAdjust,
33872
33914
  checkPosition: checkPosition,
33873
- setSizingStyle: setSizingStyle
33915
+ setBoundaryStyle: setBoundaryStyle
33874
33916
  }),
33875
33917
  style = _usePositionStyle.style;
33876
33918
  var childStyle = children.props.style;
@@ -33980,8 +34022,8 @@ var Popover = function Popover(props) {
33980
34022
  setPositionState = _React$useState2[1];
33981
34023
  var _React$useState3 = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(),
33982
34024
  _React$useState4 = slicedToArray_default()(_React$useState3, 2),
33983
- contentStyle = _React$useState4[0],
33984
- setContentStyle = _React$useState4[1];
34025
+ boundaryStyle = _React$useState4[0],
34026
+ setBoundaryStyle = _React$useState4[1];
33985
34027
 
33986
34028
  // Semantic DOM 访问器:合并用户 classNames / styles、setConfig 全局兜底与内部 JSS class
33987
34029
  // 优先级(高→低):props > setConfig({ popover: { ... } }) > 内部默认
@@ -34132,7 +34174,7 @@ var Popover = function Popover(props) {
34132
34174
  lazy: props.lazy,
34133
34175
  offset: mergedOffset,
34134
34176
  updateKey: updateKey,
34135
- setSizingStyle: props.boundary ? setContentStyle : undefined,
34177
+ setBoundaryStyle: props.boundary ? setBoundaryStyle : undefined,
34136
34178
  children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", objectSpread2_default()(objectSpread2_default()(objectSpread2_default()({
34137
34179
  className: classnames_default()(className, popoverStyle === null || popoverStyle === void 0 ? void 0 : popoverStyle.rootClass, popoverStyle === null || popoverStyle === void 0 ? void 0 : popoverStyle.wrapper, open && (popoverStyle === null || popoverStyle === void 0 ? void 0 : popoverStyle.wrapperOpen), !showArrow && (popoverStyle === null || popoverStyle === void 0 ? void 0 : popoverStyle.hideArrow), animation === false && (popoverStyle === null || popoverStyle === void 0 ? void 0 : popoverStyle.wrapperNoAnimation), semClass('root')),
34138
34180
  style: objectSpread2_default()(objectSpread2_default()({}, containerStyle), semStyle('root'))
@@ -34150,7 +34192,7 @@ var Popover = function Popover(props) {
34150
34192
  dir: config.direction
34151
34193
  }), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
34152
34194
  className: classnames_default()(popoverStyle === null || popoverStyle === void 0 ? void 0 : popoverStyle.content, (typeof childrened === 'string' || props.useTextStyle) && (popoverStyle === null || popoverStyle === void 0 ? void 0 : popoverStyle.text), semClass('content')),
34153
- style: objectSpread2_default()(objectSpread2_default()(objectSpread2_default()({}, contentStyle), style), semStyle('content')),
34195
+ style: objectSpread2_default()(objectSpread2_default()(objectSpread2_default()({}, style), boundaryStyle), semStyle('content')),
34154
34196
  onClick: emptyEvent,
34155
34197
  children: /*#__PURE__*/(0,jsx_runtime.jsx)(Provider, {
34156
34198
  value: providerValue,
@@ -52355,6 +52397,67 @@ var DrawerComp = drawer;
52355
52397
  DrawerComp.displayName = 'ShineoutDrawer';
52356
52398
  DrawerComp.Submit = src_modal_0.Submit;
52357
52399
  /* harmony default export */ var src_drawer = (DrawerComp);
52400
+ ;// CONCATENATED MODULE: ../hooks/src/common/use-boundary/index.tsx
52401
+
52402
+
52403
+ /**
52404
+ * useBoundary Hook
52405
+ *
52406
+ * 用于管理弹出层的边界样式,支持延迟清除功能
52407
+ *
52408
+ * @param options - 配置选项
52409
+ * @returns 包含 boundaryStyle 和 setBoundaryStyle 的对象
52410
+ *
52411
+ * @example
52412
+ * ```tsx
52413
+ * const { boundaryStyle, setBoundaryStyle } = useBoundary({ clearDelay: 300 });
52414
+ *
52415
+ * 设置边界样式
52416
+ * setBoundaryStyle({ maxHeight: 200, overflowY: 'auto' });
52417
+ *
52418
+ * 清除边界样式(延迟执行)
52419
+ * setBoundaryStyle();
52420
+ * ```
52421
+ */
52422
+ var useBoundary = function useBoundary() {
52423
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
52424
+ var _options$clearDelay = options.clearDelay,
52425
+ clearDelay = _options$clearDelay === void 0 ? 300 : _options$clearDelay;
52426
+ var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(),
52427
+ _useState2 = slicedToArray_default()(_useState, 2),
52428
+ boundaryStyle = _useState2[0],
52429
+ _setBoundaryStyle = _useState2[1];
52430
+ var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
52431
+ boundaryTimer: null
52432
+ }),
52433
+ context = _useRef.current;
52434
+ var setBoundaryStyle = function setBoundaryStyle(style) {
52435
+ if (!style) {
52436
+ // 延迟清除边界样式
52437
+ context.boundaryTimer = setTimeout(function () {
52438
+ _setBoundaryStyle(undefined);
52439
+ }, clearDelay);
52440
+ } else {
52441
+ // 立即设置边界样式,取消之前的清除定时器
52442
+ if (context.boundaryTimer) {
52443
+ clearTimeout(context.boundaryTimer);
52444
+ context.boundaryTimer = null;
52445
+ }
52446
+ _setBoundaryStyle(style);
52447
+ }
52448
+ };
52449
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
52450
+ return function () {
52451
+ if (context.boundaryTimer) {
52452
+ clearTimeout(context.boundaryTimer);
52453
+ }
52454
+ };
52455
+ }, []);
52456
+ return {
52457
+ boundaryStyle: boundaryStyle,
52458
+ setBoundaryStyle: setBoundaryStyle
52459
+ };
52460
+ };
52358
52461
  ;// CONCATENATED MODULE: ../base/src/dropdown/Item.tsx
52359
52462
  'use client';
52360
52463
 
@@ -52493,7 +52596,8 @@ var Dropdown = function Dropdown(props) {
52493
52596
  zIndex = props.zIndex,
52494
52597
  popupClassName = props.popupClassName,
52495
52598
  classNamesProp = props.classNames,
52496
- stylesProp = props.styles;
52599
+ stylesProp = props.styles,
52600
+ boundary = props.boundary;
52497
52601
  var dropdownClasses = jssStyle === null || jssStyle === void 0 || (_jssStyle$dropdown = jssStyle.dropdown) === null || _jssStyle$dropdown === void 0 ? void 0 : _jssStyle$dropdown.call(jssStyle);
52498
52602
  var config = useConfig();
52499
52603
  var isRtl = config.direction === 'rtl';
@@ -52541,6 +52645,21 @@ var Dropdown = function Dropdown(props) {
52541
52645
  _useSemantic2 = slicedToArray_default()(_useSemantic, 2),
52542
52646
  semClass = _useSemantic2[0],
52543
52647
  semStyle = _useSemantic2[1];
52648
+ var _useBoundary = useBoundary({
52649
+ clearDelay: 300
52650
+ }),
52651
+ boundaryStyle = _useBoundary.boundaryStyle,
52652
+ setBoundaryStyle = _useBoundary.setBoundaryStyle;
52653
+ var finalBoundary = boundary === true ? function () {
52654
+ return getClosestScrollContainer(targetRef.current);
52655
+ } : boundary === false ? undefined : boundary;
52656
+ var contentStyle = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
52657
+ return objectSpread2_default()(objectSpread2_default()({
52658
+ width: width,
52659
+ minWidth: 90,
52660
+ gridTemplateColumns: columns ? "repeat(".concat(columns, ", 1fr)") : undefined
52661
+ }, !isSub ? semStyle('list') : undefined), boundaryStyle);
52662
+ }, [width, columns, isSub, semStyle, boundaryStyle]);
52544
52663
 
52545
52664
  // buttonProps
52546
52665
  var type = props.type,
@@ -52668,14 +52787,12 @@ var Dropdown = function Dropdown(props) {
52668
52787
  popupGap: 4,
52669
52788
  popupElRef: popupRef,
52670
52789
  adjust: adjust,
52790
+ boundary: finalBoundary,
52791
+ setBoundaryStyle: finalBoundary ? setBoundaryStyle : undefined,
52671
52792
  children: /*#__PURE__*/(0,jsx_runtime.jsx)(animation_list, {
52672
52793
  display: columns ? 'grid' : 'block',
52673
52794
  className: classnames_default()(popupClassName, dropdownClasses === null || dropdownClasses === void 0 ? void 0 : dropdownClasses.list, hasChildren && (dropdownClasses === null || dropdownClasses === void 0 ? void 0 : dropdownClasses.listHasChildren), columns !== undefined && columns > 1 && (dropdownClasses === null || dropdownClasses === void 0 ? void 0 : dropdownClasses.boxList), size === 'small' && (dropdownClasses === null || dropdownClasses === void 0 ? void 0 : dropdownClasses.listSmall), size === 'large' && (dropdownClasses === null || dropdownClasses === void 0 ? void 0 : dropdownClasses.listLarge), !isSub && semClass('list')),
52674
- style: objectSpread2_default()({
52675
- width: width,
52676
- minWidth: 90,
52677
- gridTemplateColumns: columns ? "repeat(".concat(columns, ", 1fr)") : undefined
52678
- }, !isSub ? semStyle('list') : undefined),
52795
+ style: contentStyle,
52679
52796
  type: 'fade',
52680
52797
  duration: 'fast',
52681
52798
  show: open,
@@ -79660,7 +79777,7 @@ var watermark_interface = __webpack_require__(6640);
79660
79777
 
79661
79778
 
79662
79779
  /* harmony default export */ var src_0 = ({
79663
- version: '3.10.1-beta.1'
79780
+ version: '3.10.1-beta.3'
79664
79781
  });
79665
79782
  }();
79666
79783
  /******/ return __webpack_exports__;