baseui 0.0.0-next-39f6d48 → 0.0.0-next-d6f91d4

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.
@@ -17,11 +17,14 @@ export interface ComboboxOverrides {
17
17
  ListItem?: Override<any>;
18
18
  }
19
19
 
20
- export type PropsT<OptionT = unknown> = {
20
+ export type PropsT<OptionT = any> = {
21
21
  autocomplete?: boolean;
22
22
  disabled?: boolean;
23
- mapOptionToNode?: ({isSelected: boolean, option: OptionT}) => React.ReactNode;
24
- mapOptionToString: (OptionT) => string;
23
+ mapOptionToNode?: (option: {
24
+ isSelected: boolean;
25
+ option: OptionT;
26
+ }) => React.ReactNode;
27
+ mapOptionToString: (option: OptionT) => string;
25
28
  id?: string;
26
29
  name?: string;
27
30
  inputRef?: React.Ref<HTMLInputElement>;
@@ -273,7 +273,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
273
273
  range = _this$props2.range,
274
274
  separateRangeInputs = _this$props2.separateRangeInputs;
275
275
 
276
- if (mask === null) {
276
+ if (mask === null || mask === undefined && formatString !== DEFAULT_DATE_FORMAT) {
277
277
  return null;
278
278
  }
279
279
 
@@ -281,16 +281,6 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
281
281
  return _this.normalizeDashes(mask);
282
282
  }
283
283
 
284
- var normalizedFormatString = _this.normalizeDashes(formatString);
285
-
286
- if (formatString && !separateRangeInputs) {
287
- if (range) {
288
- return "".concat(normalizedFormatString, " \u2013 ").concat(normalizedFormatString).replace(/[a-z]/gi, '9');
289
- } else {
290
- return normalizedFormatString.replace(/[a-z]/gi, '9');
291
- }
292
- }
293
-
294
284
  if (range && !separateRangeInputs) {
295
285
  return '9999/99/99 – 9999/99/99';
296
286
  }
@@ -303,6 +293,8 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
303
293
 
304
294
  var mask = _this.getMask();
305
295
 
296
+ var formatString = _this.normalizeDashes(_this.props.formatString);
297
+
306
298
  if (typeof mask === 'string' && inputValue === mask.replace(/9/g, ' ') || inputValue.length === 0) {
307
299
  if (_this.props.onChange) {
308
300
  if (_this.props.range) {
@@ -321,8 +313,6 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
321
313
  inputValue: inputValue
322
314
  });
323
315
 
324
- var formatString = _this.normalizeDashes(_this.props.formatString);
325
-
326
316
  var parseDateString = function parseDateString(dateString) {
327
317
  if (formatString === DEFAULT_DATE_FORMAT) {
328
318
  return _this.dateHelpers.parse(dateString, 'slashDate', _this.props.locale);
@@ -229,7 +229,10 @@ export default class Datepicker<T = Date> extends React.Component<
229
229
  getMask = () => {
230
230
  const {formatString, mask, range, separateRangeInputs} = this.props;
231
231
 
232
- if (mask === null) {
232
+ if (
233
+ mask === null ||
234
+ (mask === undefined && formatString !== DEFAULT_DATE_FORMAT)
235
+ ) {
233
236
  return null;
234
237
  }
235
238
 
@@ -237,18 +240,6 @@ export default class Datepicker<T = Date> extends React.Component<
237
240
  return this.normalizeDashes(mask);
238
241
  }
239
242
 
240
- const normalizedFormatString = this.normalizeDashes(formatString);
241
- if (formatString && !separateRangeInputs) {
242
- if (range) {
243
- return `${normalizedFormatString} – ${normalizedFormatString}`.replace(
244
- /[a-z]/gi,
245
- '9',
246
- );
247
- } else {
248
- return normalizedFormatString.replace(/[a-z]/gi, '9');
249
- }
250
- }
251
-
252
243
  if (range && !separateRangeInputs) {
253
244
  return '9999/99/99 – 9999/99/99';
254
245
  }
@@ -270,6 +261,7 @@ export default class Datepicker<T = Date> extends React.Component<
270
261
  : event.currentTarget.value;
271
262
 
272
263
  const mask = this.getMask();
264
+ const formatString = this.normalizeDashes(this.props.formatString);
273
265
 
274
266
  if (
275
267
  (typeof mask === 'string' && inputValue === mask.replace(/9/g, ' ')) ||
@@ -286,7 +278,6 @@ export default class Datepicker<T = Date> extends React.Component<
286
278
 
287
279
  this.setState({inputValue});
288
280
 
289
- const formatString = this.normalizeDashes(this.props.formatString);
290
281
  const parseDateString = dateString => {
291
282
  if (formatString === DEFAULT_DATE_FORMAT) {
292
283
  return this.dateHelpers.parse(
@@ -185,7 +185,7 @@ export default class Datepicker extends React.Component {
185
185
  separateRangeInputs
186
186
  } = this.props;
187
187
 
188
- if (mask === null) {
188
+ if (mask === null || mask === undefined && formatString !== DEFAULT_DATE_FORMAT) {
189
189
  return null;
190
190
  }
191
191
 
@@ -193,16 +193,6 @@ export default class Datepicker extends React.Component {
193
193
  return this.normalizeDashes(mask);
194
194
  }
195
195
 
196
- const normalizedFormatString = this.normalizeDashes(formatString);
197
-
198
- if (formatString && !separateRangeInputs) {
199
- if (range) {
200
- return `${normalizedFormatString} – ${normalizedFormatString}`.replace(/[a-z]/gi, '9');
201
- } else {
202
- return normalizedFormatString.replace(/[a-z]/gi, '9');
203
- }
204
- }
205
-
206
196
  if (range && !separateRangeInputs) {
207
197
  return '9999/99/99 – 9999/99/99';
208
198
  }
@@ -213,6 +203,7 @@ export default class Datepicker extends React.Component {
213
203
  _defineProperty(this, "handleInputChange", (event, separatedInput) => {
214
204
  const inputValue = this.props.range && this.props.separateRangeInputs ? combineSeparatedInputs(event.currentTarget.value, this.state.inputValue, separatedInput) : event.currentTarget.value;
215
205
  const mask = this.getMask();
206
+ const formatString = this.normalizeDashes(this.props.formatString);
216
207
 
217
208
  if (typeof mask === 'string' && inputValue === mask.replace(/9/g, ' ') || inputValue.length === 0) {
218
209
  if (this.props.onChange) {
@@ -231,7 +222,6 @@ export default class Datepicker extends React.Component {
231
222
  this.setState({
232
223
  inputValue
233
224
  });
234
- const formatString = this.normalizeDashes(this.props.formatString);
235
225
 
236
226
  const parseDateString = dateString => {
237
227
  if (formatString === DEFAULT_DATE_FORMAT) {
@@ -255,7 +255,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
255
255
  range = _this$props2.range,
256
256
  separateRangeInputs = _this$props2.separateRangeInputs;
257
257
 
258
- if (mask === null) {
258
+ if (mask === null || mask === undefined && formatString !== DEFAULT_DATE_FORMAT) {
259
259
  return null;
260
260
  }
261
261
 
@@ -263,16 +263,6 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
263
263
  return _this.normalizeDashes(mask);
264
264
  }
265
265
 
266
- var normalizedFormatString = _this.normalizeDashes(formatString);
267
-
268
- if (formatString && !separateRangeInputs) {
269
- if (range) {
270
- return "".concat(normalizedFormatString, " \u2013 ").concat(normalizedFormatString).replace(/[a-z]/gi, '9');
271
- } else {
272
- return normalizedFormatString.replace(/[a-z]/gi, '9');
273
- }
274
- }
275
-
276
266
  if (range && !separateRangeInputs) {
277
267
  return '9999/99/99 – 9999/99/99';
278
268
  }
@@ -285,6 +275,8 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
285
275
 
286
276
  var mask = _this.getMask();
287
277
 
278
+ var formatString = _this.normalizeDashes(_this.props.formatString);
279
+
288
280
  if (typeof mask === 'string' && inputValue === mask.replace(/9/g, ' ') || inputValue.length === 0) {
289
281
  if (_this.props.onChange) {
290
282
  if (_this.props.range) {
@@ -303,8 +295,6 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
303
295
  inputValue: inputValue
304
296
  });
305
297
 
306
- var formatString = _this.normalizeDashes(_this.props.formatString);
307
-
308
298
  var parseDateString = function parseDateString(dateString) {
309
299
  if (formatString === DEFAULT_DATE_FORMAT) {
310
300
  return _this.dateHelpers.parse(dateString, 'slashDate', _this.props.locale);
@@ -40,11 +40,12 @@ export interface FLOATING_MARKER_ANCHOR_TYPES {
40
40
  square: 'square';
41
41
  }
42
42
 
43
- export type NeedleSizeT = ValueOf<NEEDLE_SIZES>;
44
- export type PinHeadT = ValueOf<PINHEAD_TYPES>;
45
- export type PinHeadSizeT = ValueOf<PINHEAD_SIZES_SHAPES>;
46
- export type AnchorPositionsT = ValueOf<FLOATING_MARKER_ANCHOR_POSITIONS>;
47
- export type FloatingMarkerSizeT = ValueOf<FLOATING_MARKER_SIZES>;
43
+ export type NeedleSizeT = NEEDLE_SIZES[keyof NEEDLE_SIZES];
44
+ export type PinHeadT = PINHEAD_TYPES[keyof PINHEAD_TYPES];
45
+ export type PinHeadSizeT = PINHEAD_SIZES_SHAPES[keyof PINHEAD_SIZES_SHAPES];
46
+ export type AnchorPositionsT = FLOATING_MARKER_ANCHOR_POSITIONS[keyof FLOATING_MARKER_ANCHOR_POSITIONS];
47
+ export type FloatingMarkerSizeT = FLOATING_MARKER_SIZES[keyof FLOATING_MARKER_SIZES];
48
+ export type FloatingMarkerAnchorTypeT = FLOATING_MARKER_ANCHOR_TYPES[keyof FLOATING_MARKER_ANCHOR_TYPES];
48
49
 
49
50
  export type FixedMarkerOverridesT = {
50
51
  Root?: Override<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baseui",
3
- "version": "0.0.0-next-39f6d48",
3
+ "version": "0.0.0-next-d6f91d4",
4
4
  "description": "A React Component library implementing the Base design language",
5
5
  "keywords": [
6
6
  "react",
@@ -1,22 +1,27 @@
1
1
  import * as React from 'react';
2
2
 
3
3
  import {Override} from '../overrides';
4
- import {DURATION, PLACEMENT} from './constants.js';
5
- export {DURATION, PLACEMENT} from './constants.js';
6
-
7
- export type DurationT =
8
- | typeof DURATION.infinite
9
- | typeof DURATION.short
10
- | typeof DURATION.medium
11
- | typeof DURATION.long;
12
-
13
- export type PlacementT =
14
- | typeof PLACEMENT.topLeft
15
- | typeof PLACEMENT.top
16
- | typeof PLACEMENT.topRight
17
- | typeof PLACEMENT.bottomLeft
18
- | typeof PLACEMENT.bottom
19
- | typeof PLACEMENT.bottomRight;
4
+
5
+ declare const DURATION: {
6
+ infinite: number;
7
+ short: number;
8
+ medium: number;
9
+ long: number;
10
+ };
11
+
12
+ declare const PLACEMENT: {
13
+ topLeft: 'topLeft';
14
+ top: 'top';
15
+ topRight: 'topRight';
16
+ bottomRight: 'bottomRight';
17
+ bottom: 'bottom';
18
+ bottomLeft: 'bottomLeft';
19
+ };
20
+ export {DURATION, PLACEMENT};
21
+
22
+ export type DurationT = (typeof DURATION)[keyof typeof DURATION];
23
+
24
+ export type PlacementT = (typeof PLACEMENT)[keyof typeof PLACEMENT];
20
25
 
21
26
  export type SnackbarElementOverridesT = {
22
27
  Root?: Override<any>;