baseui 0.0.0-next-2113e1821 → 0.0.0-next-e19fc5fd2

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.
@@ -33,13 +33,13 @@ function StatelessAccordion({
33
33
  return /*#__PURE__*/React.createElement(Root, _extends({
34
34
  "data-baseweb": "accordion"
35
35
  }, rootProps), React.Children.map(children, (child, index) => {
36
- let normalizedChild = (0, _reactIs.isElement)(child) || (0, _reactIs.isPortal)(child) ? child :
37
- /*#__PURE__*/
38
- // if primitive value - wrap it in a fragment
39
- React.createElement(React.Fragment, null, child);
40
- const key = normalizedChild.key || String(index);
41
- return /*#__PURE__*/React.cloneElement(normalizedChild, {
42
- disabled: normalizedChild.props.disabled || disabled,
36
+ if (!(0, _reactIs.isElement)(child) && !(0, _reactIs.isPortal)(child)) {
37
+ return child;
38
+ }
39
+ const element = child;
40
+ const key = element.key || String(index);
41
+ return /*#__PURE__*/React.cloneElement(element, {
42
+ disabled: element.props.disabled || disabled,
43
43
  expanded: expanded.includes(key),
44
44
  key,
45
45
  onChange:
@@ -66,7 +66,7 @@ function StatelessAccordion({
66
66
  expanded: next
67
67
  });
68
68
  } : onChange,
69
- overrides: normalizedChild.props.overrides || PanelOverrides,
69
+ overrides: element.props.overrides || PanelOverrides,
70
70
  renderAll
71
71
  });
72
72
  }));
@@ -34,7 +34,6 @@ const BottomNavigation = ({
34
34
  const [displayOverflow, setDisplayOverflow] = React.useState(false);
35
35
  const NavItemPanelRefs = React.useRef([]);
36
36
  function scrollToTop(idx) {
37
- // @ts-expect-error todo(ts-migration) TS2339 Property 'scrollTo' does not exist on type 'never'.
38
37
  NavItemPanelRefs.current[idx].scrollTo({
39
38
  top: 0,
40
39
  left: 0,
@@ -45,7 +44,6 @@ const BottomNavigation = ({
45
44
  if (displayOverflow) {
46
45
  setDisplayOverflow(false);
47
46
  }
48
- // @ts-expect-error todo(ts-migration) TS2722 Cannot invoke an object which is possibly 'undefined'.
49
47
  onChange({
50
48
  activeKey
51
49
  });
@@ -79,9 +77,7 @@ const BottomNavigation = ({
79
77
  if (!navItem) return;
80
78
  const isActive = activeKey === idx && !displayOverflow;
81
79
  return /*#__PURE__*/React.createElement(_panel.Panel, {
82
- isActive: isActive
83
- // @ts-expect-error todo(ts-migration) TS2345 Argument of type 'unknown' is not assignable to parameter of type 'never'.
84
- ,
80
+ isActive: isActive,
85
81
  ref: element => NavItemPanelRefs.current.push(element),
86
82
  overrides: navItem.props.overrides,
87
83
  key: idx,
@@ -66,7 +66,6 @@ function validateInput(input) {
66
66
 
67
67
  // @ts-ignore
68
68
  const bisect = (0, _d.bisector)(d => d.x0);
69
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
70
69
  const Histogram = /*#__PURE__*/React.memo(function Histogram({
71
70
  data,
72
71
  lower,
@@ -83,9 +82,7 @@ const Histogram = /*#__PURE__*/React.memo(function Histogram({
83
82
  yScale
84
83
  } = React.useMemo(() => {
85
84
  const bins = (0, _d.bin)().thresholds(Math.min(data.length, _constants.MAX_BIN_COUNT))(data);
86
- const xScale = (0, _d.scaleLinear)()
87
- // @ts-expect-error todo(ts-migration) TS2345 Argument of type '(number | undefined)[]' is not assignable to parameter of type 'Iterable<NumberValue>'.
88
- .domain([bins[0].x0, bins[bins.length - 1].x1]).range([0, _constants.HISTOGRAM_SIZE.width]).clamp(true);
85
+ const xScale = (0, _d.scaleLinear)().domain([bins[0].x0, bins[bins.length - 1].x1]).range([0, _constants.HISTOGRAM_SIZE.width]).clamp(true);
89
86
  const yScale = (0, _d.scaleLinear)()
90
87
  // @ts-ignore
91
88
  .domain([0, (0, _d.max)(bins, d => d.length)]).nice().range([_constants.HISTOGRAM_SIZE.height, 0]);
@@ -114,19 +111,15 @@ const Histogram = /*#__PURE__*/React.memo(function Histogram({
114
111
  overflow: 'visible'
115
112
  })
116
113
  }, /*#__PURE__*/React.createElement("svg", _constants.HISTOGRAM_SIZE, bins.map((d, index) => {
117
- // @ts-expect-error todo(ts-migration) TS2345 Argument of type 'number | undefined' is not assignable to parameter of type 'NumberValue'.
118
114
  const x = xScale(d.x0) + 1;
119
115
  const y = yScale(d.length);
120
- // @ts-expect-error todo(ts-migration) TS2345 Argument of type 'number | undefined' is not assignable to parameter of type 'NumberValue'.
121
116
  const width = Math.max(0, xScale(d.x1) - xScale(d.x0) - 1);
122
117
  const height = yScale(0) - yScale(d.length);
123
118
  let included;
124
119
  if (singleIndexNearest != null) {
125
120
  included = index === singleIndexNearest;
126
121
  } else {
127
- // @ts-expect-error todo(ts-migration) TS18048 'd.x1' is possibly 'undefined'.
128
122
  const withinLower = d.x1 > lower;
129
- // @ts-expect-error todo(ts-migration) TS18048 'd.x0' is possibly 'undefined'.
130
123
  const withinUpper = d.x0 <= upper;
131
124
  included = withinLower && withinUpper;
132
125
  }
@@ -201,19 +194,14 @@ function NumericalFilter(props) {
201
194
  // once the user is done inputting.
202
195
  // we validate then format to the given precision
203
196
  let l = isRange ? lv : sv;
204
- // @ts-expect-error todo(ts-migration) TS2322 Type 'string | number | undefined' is not assignable to type 'number'.
205
197
  l = validateInput(l) ? l : min;
206
198
  let h = validateInput(uv) ? uv : max;
207
-
208
- // @ts-expect-error todo(ts-migration) TS2345 Argument of type 'string | number | undefined' is not assignable to parameter of type 'number'.
209
199
  return [roundToFixed(l, precision), roundToFixed(h, precision)];
210
200
  }, [isRange, focused, sv, lv, uv, precision]);
211
201
 
212
202
  // We have our slider values range from 1 to the bin size, so we have a scale which
213
203
  // takes in the data driven range and maps it to values the scale can always handle
214
- const sliderScale = React.useMemo(() => (0, _d.scaleLinear)()
215
- // @ts-expect-error todo(ts-migration) TS2345 Argument of type '(string | undefined)[]' is not assignable to parameter of type 'Iterable<NumberValue>'.
216
- .domain([min, max]).rangeRound([1, _constants.MAX_BIN_COUNT])
204
+ const sliderScale = React.useMemo(() => (0, _d.scaleLinear)().domain([min, max]).rangeRound([1, _constants.MAX_BIN_COUNT])
217
205
  // We clamp the values within our min and max even if a user enters a huge number
218
206
  .clamp(true), [min, max]);
219
207
  let sliderValue = isRange ? [sliderScale(inputValueLower), sliderScale(inputValueUpper)] : [sliderScale(inputValueLower)];
@@ -395,10 +383,7 @@ function NumericalFilter(props) {
395
383
  },
396
384
  onFocus: () => setFocus(true),
397
385
  onBlur: () => setFocus(false)
398
- }), isRange &&
399
- /*#__PURE__*/
400
- // @ts-expect-error todo(ts-migration) TS2769 No overload matches this call.
401
- React.createElement(_input.Input, {
386
+ }), isRange && /*#__PURE__*/React.createElement(_input.Input, {
402
387
  min: min,
403
388
  max: max,
404
389
  size: _input.SIZE.mini,
package/dnd-list/list.js CHANGED
@@ -23,7 +23,7 @@ Copyright (c) Uber Technologies, Inc.
23
23
 
24
24
  This source code is licensed under the MIT license found in the
25
25
  LICENSE file in the root directory of this source tree.
26
- */
26
+ */ // @ts-ignore - react-movable is an ES module but we're in a CommonJS context
27
27
  const ItemLayer = ({
28
28
  children,
29
29
  dragged
@@ -15,7 +15,7 @@ Copyright (c) Uber Technologies, Inc.
15
15
 
16
16
  This source code is licensed under the MIT license found in the
17
17
  LICENSE file in the root directory of this source tree.
18
- */
18
+ */ // @ts-ignore - react-movable is an ES module but we're in a CommonJS context
19
19
  const defaultStateReducer = (type, nextState) => nextState;
20
20
  class StatefulListContainer extends React.Component {
21
21
  constructor(...args) {
@@ -12,7 +12,7 @@ LICENSE file in the root directory of this source tree.
12
12
  */
13
13
 
14
14
  const locale = {
15
- added: 'Description',
15
+ added: 'Uploading',
16
16
  buttonText: 'Browse files',
17
17
  contentMessage: 'or drop to upload',
18
18
  error: 'Upload failed: ',
@@ -86,7 +86,6 @@ function FileUploaderBasic(props) {
86
86
  shape: _button.SHAPE.pill,
87
87
  size: _button.SIZE.compact,
88
88
  onClick: open,
89
- role: "button",
90
89
  overrides: {
91
90
  BaseButton: {
92
91
  // @ts-ignore
@@ -106,7 +105,6 @@ function FileUploaderBasic(props) {
106
105
  shape: _button.SHAPE.pill,
107
106
  size: _button.SIZE.compact,
108
107
  onClick: open,
109
- role: "button",
110
108
  overrides: {
111
109
  BaseButton: {
112
110
  // @ts-ignore
@@ -18,7 +18,7 @@ LICENSE file in the root directory of this source tree.
18
18
  const flattenFragments = (children, ChildWrapper, depth = 0) =>
19
19
  // @ts-ignore
20
20
  React.Children.toArray(children).reduce((acc, child, i) => {
21
- if ((0, _reactIs.isFragment)(child)) {
21
+ if ((0, _reactIs.isFragment)(child) && /*#__PURE__*/React.isValidElement(child)) {
22
22
  acc.push(...flattenFragments(child.props.children, ChildWrapper, depth + 1));
23
23
  } else if ( /*#__PURE__*/React.isValidElement(child)) {
24
24
  if (ChildWrapper) {
package/list/list-item.js CHANGED
@@ -53,8 +53,6 @@ const ListItem = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
53
53
  const listItemName = _react.default.Children.count(props.children) === 0 ? ['List item'] : _react.default.Children.map(props.children, child => {
54
54
  return getMainTextFromChild(child);
55
55
  });
56
-
57
- // @ts-expect-error todo(ts-migration) TS18049 'listItemName' is possibly 'null' or 'undefined'.
58
56
  const ariaLabel = props.hasOwnProperty('aria-label') ? props['aria-label'] : listItemName[0];
59
57
  return /*#__PURE__*/_react.default.createElement(Root
60
58
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
package/locale/index.js CHANGED
@@ -30,7 +30,6 @@ const LocaleProvider = props => {
30
30
  /*#__PURE__*/
31
31
  // this is poorly documented but specifying true enforces that the object is deeply extended
32
32
  // https://www.npmjs.com/package/just-extend
33
- // @ts-expect-error todo(ts-migration) TS2740 Type '{}' is missing the following properties from type 'Locale': accordion, breadcrumbs, datepicker, datatable, and 8 more.
34
33
  React.createElement(LocaleContext.Provider, {
35
34
  value: (0, _justExtend.default)(true, {}, _en_US.default, parentLocale, locale)
36
35
  }, children)
@@ -95,7 +95,6 @@ function MobileHeader({
95
95
  $type: type,
96
96
  $expanded: expanded
97
97
  }, titleProps), title), actionButtons.length > 0 && /*#__PURE__*/React.createElement(ActionButtonsContainer, actionButtonsContainerProps, actionButtons.map((button, idx) => {
98
- // @ts-expect-error todo(ts-migration) TS2339 Property 'renderIcon' does not exist on type 'IconButton | undefined'.
99
98
  const {
100
99
  renderIcon,
101
100
  onClick,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baseui",
3
- "version": "0.0.0-next-2113e1821",
3
+ "version": "0.0.0-next-e19fc5fd2",
4
4
  "description": "A React Component library implementing the Base design language",
5
5
  "keywords": [
6
6
  "react",
@@ -16,6 +16,7 @@
16
16
  "dev:docs": "next dev documentation-site",
17
17
  "dev:ladle": "ladle serve",
18
18
  "build:docs": "next build documentation-site",
19
+ "start:docs": "npx serve@latest documentation-site/out",
19
20
  "build:ladle": "ladle build",
20
21
  "build:lib": "NODE_ENV=production babel ./src --out-dir ./dist --config-file ./publish/.babelrc.js --extensions '.ts,.tsx,.js' --ignore **.test.*,**/__tests__/**,**/e2e.*,**/template-component/**,**/test/**",
21
22
  "build:lib:dts": "tsc -p tsconfig.dist.json || true",
@@ -24,7 +25,7 @@
24
25
  "dependencies": {
25
26
  "@date-io/date-fns": "^2.13.1",
26
27
  "@date-io/moment": "^2.13.1",
27
- "baseui": "^14.0.0",
28
+ "axe-core": "^4.11.0",
28
29
  "card-validator": "^6.2.0",
29
30
  "csstype": "2.6.11",
30
31
  "d3": "^6.7.0",
@@ -57,7 +58,7 @@
57
58
  "peerDependencies": {
58
59
  "react": ">=18",
59
60
  "react-dom": ">=18",
60
- "styletron-react": "^6.1.1"
61
+ "styletron-react": ">=6"
61
62
  },
62
63
  "devDependencies": {
63
64
  "@babel/cli": "^7.23.4",
@@ -91,9 +91,7 @@ const PageControl = ({
91
91
  checked: isActive(page),
92
92
  key: page,
93
93
  "aria-label": `page ${page}`,
94
- name: name
95
- // @ts-expect-error todo(ts-migration) TS2722 Cannot invoke an object which is possibly 'undefined'.
96
- ,
94
+ name: name,
97
95
  onChange: () => onPageChange({
98
96
  nextPage: page
99
97
  }),
@@ -81,8 +81,7 @@ function SegmentedControl({
81
81
  activateOnFocus = true,
82
82
  onChange,
83
83
  overrides = {},
84
- // @ts-expect-error todo(ts-migration) TS2322 Type 'null' is not assignable to type 'string'.
85
- uid: customUid = null,
84
+ uid: customUid,
86
85
  width,
87
86
  height
88
87
  }) {
@@ -19,10 +19,9 @@ const getInitialState = (children, initialState) => {
19
19
  if (initialState && initialState.activeKey) {
20
20
  return initialState;
21
21
  } else {
22
- // @ts-expect-error todo(ts-migration) TS2533 Object is possibly 'null' or 'undefined'.
23
22
  const firstKey = React.Children.map(children,
24
23
  // @ts-expect-error todo(flow->ts) child might be not a ReactElement, theoretically including null
25
- (child, index) => child.key || String(index))[0];
24
+ (child, index) => child.key || String(index))?.[0];
26
25
  return {
27
26
  activeKey: firstKey
28
27
  };
package/sheet/sheet.js CHANGED
@@ -85,9 +85,7 @@ const Sheet = ({
85
85
  onClick: trailingAction.onClick,
86
86
  "aria-label": trailingAction.label,
87
87
  size: buttonSize
88
- }, actionButtonProps), renderActionButtonContent(trailingAction.renderIcon || trailingAction.label, buttonSize)), !trailingAction && leadingAction && /*#__PURE__*/React.createElement(EmptyDiv, emptyDivProps)), progressBar ? /*#__PURE__*/React.createElement(_progressBar.ProgressBar
89
- // @ts-expect-error todo(ts-migration) TS2783 'size' is specified more than once, so this usage will be overwritten.
90
- , _extends({
88
+ }, actionButtonProps), renderActionButtonContent(trailingAction.renderIcon || trailingAction.label, buttonSize)), !trailingAction && leadingAction && /*#__PURE__*/React.createElement(EmptyDiv, emptyDivProps)), progressBar ? /*#__PURE__*/React.createElement(_progressBar.ProgressBar, _extends({
91
89
  size: _progressBar.SIZE.small,
92
90
  overrides: {
93
91
  BarContainer: {
@@ -84,9 +84,7 @@ function Stepper({
84
84
  disabled: disabled,
85
85
  "aria-label": "value"
86
86
  }, inputProps)), /*#__PURE__*/React.createElement(IncrementButton, _extends({
87
- onClick: () => setValue(value + 1)
88
- // @ts-expect-error todo(ts-migration) TS18048 'maxValue' is possibly 'undefined'.
89
- ,
87
+ onClick: () => setValue(value + 1),
90
88
  disabled: disabled || value >= maxValue,
91
89
  "aria-label": "increment value"
92
90
  }, incrementButtonProps), /*#__PURE__*/React.createElement(IncrementButtonIcon, incrementButtonIconProps)));
@@ -67,9 +67,7 @@ function SystemBanner(props) {
67
67
  MessageContent: hasTwoActions ? (0, _overrides.mergeOverride)(systemBannerMessageContentOverrides, MessageContent || {}) : {},
68
68
  ...restOverrides
69
69
  };
70
- return /*#__PURE__*/React.createElement(_banner.Banner
71
- // @ts-expect-error todo(ts-migration) TS2322 Type '{ icon?: ArtworkIcon | undefined; onClick: ((a: SyntheticEvent<HTMLButtonElement, Event>) => unknown) | null; label: string; } | { ...; } | null' is not assignable to type 'ActionContent | undef...
72
- , _extends({
70
+ return /*#__PURE__*/React.createElement(_banner.Banner, _extends({
73
71
  action: secondaryAction ? {
74
72
  onClick: null,
75
73
  ...secondaryAction