@doist/reactist 27.4.0 → 28.0.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.
@@ -1982,7 +1982,9 @@ function BaseField({
1982
1982
  hidden,
1983
1983
  'aria-describedby': originalAriaDescribedBy,
1984
1984
  id: originalId,
1985
- characterCountPosition = 'below'
1985
+ characterCountPosition = 'below',
1986
+ endSlot,
1987
+ endSlotPosition = 'bottom'
1986
1988
  }) {
1987
1989
  const id = useId(originalId);
1988
1990
  const messageId = useId();
@@ -2045,8 +2047,13 @@ function BaseField({
2045
2047
  space: "xsmall",
2046
2048
  hidden: hidden
2047
2049
  }, /*#__PURE__*/React__namespace.createElement(Box$1, {
2050
+ display: "flex",
2051
+ flexDirection: "row",
2048
2052
  className: [className, modules_540a88ff.container, tone === 'error' ? modules_540a88ff.error : null, variant === 'bordered' ? modules_540a88ff.bordered : null],
2049
- maxWidth: maxWidth
2053
+ maxWidth: maxWidth,
2054
+ alignItems: "center"
2055
+ }, /*#__PURE__*/React__namespace.createElement(Box$1, {
2056
+ flexGrow: 1
2050
2057
  }, label || auxiliaryLabel ? /*#__PURE__*/React__namespace.createElement(Box$1, {
2051
2058
  as: "span",
2052
2059
  display: "flex",
@@ -2061,7 +2068,7 @@ function BaseField({
2061
2068
  }, label) : null), auxiliaryLabel ? /*#__PURE__*/React__namespace.createElement(Box$1, {
2062
2069
  className: modules_540a88ff.auxiliaryLabel,
2063
2070
  paddingLeft: "small"
2064
- }, auxiliaryLabel) : null) : null, children(childrenProps)), message || characterCount ? /*#__PURE__*/React__namespace.createElement(Columns, {
2071
+ }, auxiliaryLabel) : null) : null, children(childrenProps)), endSlot && endSlotPosition === 'fullHeight' ? endSlot : null), message || characterCount ? /*#__PURE__*/React__namespace.createElement(Columns, {
2065
2072
  align: "right",
2066
2073
  space: "small",
2067
2074
  maxWidth: maxWidth
@@ -2077,7 +2084,7 @@ function BaseField({
2077
2084
 
2078
2085
  var modules_aaf25250 = {"inputWrapper":"c8f65b3b","readOnly":"_326f2644","bordered":"_5252fd3d","error":"_0141b7ac","slot":"b79b851f"};
2079
2086
 
2080
- const _excluded$d = ["variant", "id", "label", "value", "auxiliaryLabel", "message", "tone", "type", "maxWidth", "maxLength", "hidden", "aria-describedby", "startSlot", "endSlot", "onChange", "characterCountPosition"],
2087
+ const _excluded$d = ["variant", "id", "label", "value", "auxiliaryLabel", "message", "tone", "type", "maxWidth", "maxLength", "hidden", "aria-describedby", "startSlot", "endSlot", "onChange", "characterCountPosition", "endSlotPosition"],
2081
2088
  _excluded2$4 = ["onChange", "characterCountElement"];
2082
2089
  const TextField = /*#__PURE__*/React__namespace.forwardRef(function TextField(_ref, ref) {
2083
2090
  let {
@@ -2096,7 +2103,8 @@ const TextField = /*#__PURE__*/React__namespace.forwardRef(function TextField(_r
2096
2103
  startSlot,
2097
2104
  endSlot,
2098
2105
  onChange: originalOnChange,
2099
- characterCountPosition = 'below'
2106
+ characterCountPosition = 'below',
2107
+ endSlotPosition = 'bottom'
2100
2108
  } = _ref,
2101
2109
  props = _objectWithoutProperties(_ref, _excluded$d);
2102
2110
 
@@ -2110,6 +2118,7 @@ const TextField = /*#__PURE__*/React__namespace.forwardRef(function TextField(_r
2110
2118
  (_internalRef$current = internalRef.current) == null ? void 0 : _internalRef$current.focus();
2111
2119
  }
2112
2120
 
2121
+ const displayEndSlot = endSlot && (variant === 'default' || variant === 'bordered' && endSlotPosition === 'bottom');
2113
2122
  return /*#__PURE__*/React__namespace.createElement(BaseField, {
2114
2123
  variant: variant,
2115
2124
  id: id,
@@ -2122,7 +2131,10 @@ const TextField = /*#__PURE__*/React__namespace.forwardRef(function TextField(_r
2122
2131
  maxLength: maxLength,
2123
2132
  hidden: hidden,
2124
2133
  "aria-describedby": ariaDescribedBy,
2125
- characterCountPosition: characterCountPosition
2134
+ characterCountPosition: characterCountPosition,
2135
+ supportsStartAndEndSlots: true,
2136
+ endSlot: endSlot,
2137
+ endSlotPosition: variant === 'bordered' ? endSlotPosition : undefined
2126
2138
  }, _ref2 => {
2127
2139
  let {
2128
2140
  onChange,
@@ -2148,12 +2160,12 @@ const TextField = /*#__PURE__*/React__namespace.forwardRef(function TextField(_r
2148
2160
  originalOnChange == null ? void 0 : originalOnChange(event);
2149
2161
  onChange == null ? void 0 : onChange(event);
2150
2162
  }
2151
- })), endSlot || characterCountElement ? /*#__PURE__*/React__namespace.createElement(Box$1, {
2163
+ })), displayEndSlot || characterCountElement ? /*#__PURE__*/React__namespace.createElement(Box$1, {
2152
2164
  className: modules_aaf25250.slot,
2153
2165
  display: "flex",
2154
2166
  marginRight: variant === 'bordered' ? '-xsmall' : 'xsmall',
2155
2167
  marginLeft: variant === 'bordered' ? 'xsmall' : '-xsmall'
2156
- }, characterCountElement, endSlot) : null);
2168
+ }, characterCountElement, displayEndSlot ? endSlot : null) : null);
2157
2169
  });
2158
2170
  });
2159
2171
 
@@ -2764,9 +2776,9 @@ function ModalActions(_ref5) {
2764
2776
  }, children));
2765
2777
  }
2766
2778
 
2767
- var modules_40c67f5b = {"tab":"faa5b46e","track":"_93de0ded","tab-neutral":"_82a91995","tab-themed":"f150e9da","track-neutral":"_10f229b4","track-themed":"_54f03992"};
2779
+ var modules_40c67f5b = {"tab":"_9f64e89a","fullTabList":"_49fe8e5a","track":"_1f449e3a","selected":"a8ac92b1","tab-neutral":"_6c6b8a2b","tab-themed":"_0eddd76d","track-neutral":"be66f12e","track-themed":"d21ccd50","selected-neutral":"_33211e81","selected-themed":"_4d1cbd10"};
2768
2780
 
2769
- const _excluded$5 = ["children", "space"],
2781
+ const _excluded$5 = ["children", "space", "width", "align", "exceptionallySetClassName"],
2770
2782
  _excluded2$1 = ["children", "id", "renderMode"];
2771
2783
  const TabsContext = /*#__PURE__*/React__namespace.createContext(null);
2772
2784
  /**
@@ -2807,6 +2819,7 @@ function Tabs({
2807
2819
  const Tab = /*#__PURE__*/React__namespace.forwardRef(function Tab({
2808
2820
  children,
2809
2821
  id,
2822
+ disabled,
2810
2823
  exceptionallySetClassName,
2811
2824
  render,
2812
2825
  onClick
@@ -2821,6 +2834,7 @@ const Tab = /*#__PURE__*/React__namespace.forwardRef(function Tab({
2821
2834
  return /*#__PURE__*/React__namespace.createElement(react.Tab, {
2822
2835
  id: id,
2823
2836
  ref: ref,
2837
+ disabled: disabled,
2824
2838
  store: tabStore,
2825
2839
  render: render,
2826
2840
  className: className,
@@ -2834,11 +2848,42 @@ const Tab = /*#__PURE__*/React__namespace.forwardRef(function Tab({
2834
2848
  function TabList(_ref2) {
2835
2849
  let {
2836
2850
  children,
2837
- space
2851
+ space,
2852
+ width = 'maxContent',
2853
+ align = 'start',
2854
+ exceptionallySetClassName
2838
2855
  } = _ref2,
2839
2856
  props = _objectWithoutProperties(_ref2, _excluded$5);
2840
2857
 
2841
2858
  const tabContextValue = React__namespace.useContext(TabsContext);
2859
+ const [selectedTabElement, setSelectedTabElement] = React__namespace.useState(null);
2860
+ const [selectedTabStyle, setSelectedTabStyle] = React__namespace.useState({});
2861
+ const tabListRef = React__namespace.useRef(null);
2862
+ const selectedId = tabContextValue == null ? void 0 : tabContextValue.tabStore.useState('selectedId');
2863
+ React__namespace.useLayoutEffect(() => {
2864
+ function updateSelectedTabStyle() {
2865
+ if (!selectedId || !tabListRef.current) {
2866
+ return;
2867
+ }
2868
+
2869
+ const tabs = tabListRef.current.querySelectorAll('[role="tab"]');
2870
+ const selectedTab = Array.from(tabs).find(tab => tab.getAttribute('id') === selectedId);
2871
+
2872
+ if (selectedTab) {
2873
+ setSelectedTabElement(selectedTab);
2874
+ setSelectedTabStyle({
2875
+ left: selectedTab.offsetLeft + "px",
2876
+ width: selectedTab.offsetWidth + "px"
2877
+ });
2878
+ }
2879
+ }
2880
+
2881
+ updateSelectedTabStyle();
2882
+ window.addEventListener('resize', updateSelectedTabStyle);
2883
+ return function cleanupEventListener() {
2884
+ window.removeEventListener('resize', updateSelectedTabStyle);
2885
+ };
2886
+ }, [selectedId]);
2842
2887
 
2843
2888
  if (!tabContextValue) {
2844
2889
  return null;
@@ -2848,20 +2893,35 @@ function TabList(_ref2) {
2848
2893
  tabStore,
2849
2894
  variant
2850
2895
  } = tabContextValue;
2896
+ const justifyContentAlignMap = {
2897
+ start: 'flexStart',
2898
+ end: 'flexEnd',
2899
+ center: 'center'
2900
+ };
2851
2901
  return (
2852
2902
  /*#__PURE__*/
2853
- // The extra <div> prevents <Inline>'s negative margins from collapsing when used in a flex container
2854
- // which will render the track with the wrong height
2855
- React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement(react.TabList, _objectSpread2({
2903
+ // This extra <Box> not only provides alignment for the tabs, but also prevents <Inline>'s
2904
+ // negative margins from collapsing when used in a flex container which will render the
2905
+ // track with the wrong height
2906
+ React__namespace.createElement(Box$1, {
2907
+ display: "flex",
2908
+ justifyContent: width === 'full' ? 'center' : justifyContentAlignMap[align]
2909
+ }, /*#__PURE__*/React__namespace.createElement(react.TabList, _objectSpread2({
2856
2910
  store: tabStore,
2857
2911
  render: /*#__PURE__*/React__namespace.createElement(Box$1, {
2858
2912
  position: "relative",
2859
- width: "maxContent"
2860
- })
2913
+ width: width,
2914
+ className: exceptionallySetClassName
2915
+ }),
2916
+ ref: tabListRef
2861
2917
  }, props), /*#__PURE__*/React__namespace.createElement(Box$1, {
2862
2918
  className: [modules_40c67f5b.track, modules_40c67f5b["track-" + variant]]
2863
- }), /*#__PURE__*/React__namespace.createElement(Inline, {
2864
- space: space
2919
+ }), selectedTabElement ? /*#__PURE__*/React__namespace.createElement(Box$1, {
2920
+ className: [modules_40c67f5b.selected, modules_40c67f5b["selected-" + variant]],
2921
+ style: selectedTabStyle
2922
+ }) : null, /*#__PURE__*/React__namespace.createElement(Inline, {
2923
+ space: space,
2924
+ exceptionallySetClassName: classNames__default["default"](width === 'full' ? modules_40c67f5b.fullTabList : null)
2865
2925
  }, children)))
2866
2926
  );
2867
2927
  }