@vkontakte/vkui 7.7.0 → 7.7.2

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 (36) hide show
  1. package/dist/components/CalendarHeader/CalendarHeader.d.ts.map +1 -1
  2. package/dist/components/CalendarHeader/CalendarHeader.js +1 -1
  3. package/dist/components/CalendarHeader/CalendarHeader.js.map +1 -1
  4. package/dist/components/DateInput/DateInput.d.ts +1 -1
  5. package/dist/components/DateInput/DateInput.d.ts.map +1 -1
  6. package/dist/components/DateInput/DateInput.js +9 -5
  7. package/dist/components/DateInput/DateInput.js.map +1 -1
  8. package/dist/components/DateRangeInput/DateRangeInput.d.ts +1 -1
  9. package/dist/components/DateRangeInput/DateRangeInput.d.ts.map +1 -1
  10. package/dist/components/DateRangeInput/DateRangeInput.js +11 -7
  11. package/dist/components/DateRangeInput/DateRangeInput.js.map +1 -1
  12. package/dist/components/TabsItem/TabsItem.js +1 -1
  13. package/dist/components/TabsItem/TabsItem.js.map +1 -1
  14. package/dist/components.css +1 -1
  15. package/dist/components.css.map +1 -1
  16. package/dist/cssm/components/CalendarHeader/CalendarHeader.js +1 -1
  17. package/dist/cssm/components/CalendarHeader/CalendarHeader.js.map +1 -1
  18. package/dist/cssm/components/DateInput/DateInput.js +7 -4
  19. package/dist/cssm/components/DateInput/DateInput.js.map +1 -1
  20. package/dist/cssm/components/DateInput/DateInput.module.css +11 -4
  21. package/dist/cssm/components/DateRangeInput/DateRangeInput.js +9 -7
  22. package/dist/cssm/components/DateRangeInput/DateRangeInput.js.map +1 -1
  23. package/dist/cssm/components/TabsItem/TabsItem.js +1 -1
  24. package/dist/cssm/components/TabsItem/TabsItem.js.map +1 -1
  25. package/dist/vkui.css +1 -1
  26. package/dist/vkui.css.map +1 -1
  27. package/package.json +1 -1
  28. package/src/components/CalendarHeader/CalendarHeader.tsx +5 -1
  29. package/src/components/DateInput/DateInput.module.css +11 -3
  30. package/src/components/DateInput/DateInput.module.css.d.ts.map +1 -1
  31. package/src/components/DateInput/DateInput.tsx +13 -3
  32. package/src/components/DateRangeInput/DateRangeInput.tsx +15 -6
  33. package/src/components/TabsItem/TabsItem.tsx +1 -1
  34. package/dist/cssm/components/DateRangeInput/DateRangeInput.module.css +0 -24
  35. package/src/components/DateRangeInput/DateRangeInput.module.css +0 -20
  36. package/src/components/DateRangeInput/DateRangeInput.module.css.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "type": "module",
3
- "version": "7.7.0",
3
+ "version": "7.7.2",
4
4
  "name": "@vkontakte/vkui",
5
5
  "description": "VKUI library",
6
6
  "module": "./dist/index.js",
@@ -276,7 +276,11 @@ export const CalendarHeader = ({
276
276
  forceDropdownPortal={false}
277
277
  selectType="accent"
278
278
  aria-label={changeYearLabel}
279
- data-testid={yearDropdownTestId}
279
+ data-testid={
280
+ typeof yearDropdownTestId === 'string'
281
+ ? yearDropdownTestId
282
+ : yearDropdownTestId?.(currentYear)
283
+ }
280
284
  onInputKeyDown={stopPropogationOfEscapeKeyboardEventWhenSelectIsOpen}
281
285
  />
282
286
  </div>
@@ -9,6 +9,14 @@
9
9
  --vkui_internal--DateInput_input_margin_inline_end: 14px;
10
10
  }
11
11
 
12
+ .hasBefore .wrapper {
13
+ --vkui_internal--DateInput_input_margin_inline_start: 0px;
14
+ }
15
+
16
+ .hasAfter .wrapper {
17
+ --vkui_internal--DateInput_input_margin_inline_end: 0px;
18
+ }
19
+
12
20
  .input {
13
21
  z-index: var(--vkui_internal--z_index_form_field_element);
14
22
  display: block;
@@ -48,12 +56,12 @@
48
56
  letter-spacing: 6px !important;
49
57
  }
50
58
 
51
- .sizeYCompact .input {
52
- margin-inline-end: 22px;
59
+ .sizeYCompact:not(.hasAfter) .wrapper {
60
+ --vkui_internal--DateInput_input_margin_inline_end: 22px;
53
61
  }
54
62
 
55
63
  @media (--sizeY-compact) {
56
- .sizeYNone .input {
64
+ .sizeYNone:not(.hasAfter) .wrapper {
57
65
  --vkui_internal--DateInput_input_margin_inline_end: 22px;
58
66
  }
59
67
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["./DateInput.module.css"],"names":["wrapper","input","hidden","customValue","inputTimeDivider","sizeYCompact","sizeYNone"],"mappings":"AAAA;AAAA,E,aAAAA,S,WAAA;AAAA,E,aAWAC,O,WAXA;AAAA,E,aAwBAC,Q,WAxBA;AAAA,E,aA4BAC,a,WA5BA;AAAA,E,aA6CAC,kB,WA7CA;AAAA,E,aAkDAC,c,WAlDA;AAAA,E,aAkDcJ,O,WAlDd;AAAA,E,aAuDEK,W,WAvDF;AAAA,E,aAuDaL,O,WAvDb;AAAA;AAAA","file":"DateInput.module.css.d.ts","sourceRoot":""}
1
+ {"version":3,"sources":["./DateInput.module.css"],"names":["wrapper","hasBefore","hasAfter","input","hidden","customValue","inputTimeDivider","sizeYCompact","sizeYNone"],"mappings":"AAAA;AAAA,E,aAAAA,S,WAAA;AAAA,E,aAWAC,W,WAXA;AAAA,E,aAWWD,S,WAXX;AAAA,E,aAeAE,U,WAfA;AAAA,E,aAeUF,S,WAfV;AAAA,E,aAmBAG,O,WAnBA;AAAA,E,aAgCAC,Q,WAhCA;AAAA,E,aAoCAC,a,WApCA;AAAA,E,aAqDAC,kB,WArDA;AAAA,E,aA0DAC,c,WA1DA;AAAA,E,aA0DkBL,U,WA1DlB;AAAA,E,aA0D6BF,S,WA1D7B;AAAA,E,aA+DEQ,W,WA/DF;AAAA,E,aA+DiBN,U,WA/DjB;AAAA,E,aA+D4BF,S,WA/D5B;AAAA;AAAA","file":"DateInput.module.css.d.ts","sourceRoot":""}
@@ -283,6 +283,7 @@ export const DateInput = ({
283
283
  readOnly,
284
284
  'disableCalendar': disableCalendarProp = false,
285
285
  'aria-label': ariaLabel = '',
286
+ before,
286
287
  ...props
287
288
  }: DateInputProps): React.ReactNode => {
288
289
  const daysRef = React.useRef<HTMLSpanElement>(null);
@@ -431,16 +432,25 @@ export const DateInput = ({
431
432
  }
432
433
  }, [handleFieldEnter, openCalendar, accessible]);
433
434
 
435
+ const showCalendarButton = !disableCalendar && (accessible || (!accessible && !value));
436
+ const showClearButton = value && !readOnly;
437
+
434
438
  return (
435
439
  <FormField
436
440
  style={style}
437
- className={classNames(sizeY !== 'regular' && sizeYClassNames[sizeY], className)}
441
+ className={classNames(
442
+ sizeY !== 'regular' && sizeYClassNames[sizeY],
443
+ !!before && styles.hasBefore,
444
+ (showCalendarButton || showClearButton) && styles.hasAfter,
445
+ className,
446
+ )}
438
447
  getRootRef={handleRootRef}
439
448
  role="group"
440
449
  aria-labelledby={`${ariaLabelId} ${currentDateLabelId}`}
450
+ before={before}
441
451
  after={
442
452
  <React.Fragment>
443
- {!disableCalendar && (accessible || (!accessible && !value)) ? (
453
+ {showCalendarButton ? (
444
454
  <IconButton
445
455
  hoverMode="opacity"
446
456
  label={showCalendarLabel}
@@ -450,7 +460,7 @@ export const DateInput = ({
450
460
  <Icon20CalendarOutline />
451
461
  </IconButton>
452
462
  ) : null}
453
- {value && !readOnly ? (
463
+ {showClearButton ? (
454
464
  <IconButton
455
465
  hoverMode="opacity"
456
466
  label={clearFieldLabel}
@@ -26,12 +26,11 @@ import { NumberInputLike } from '../NumberInputLike/NumberInputLike';
26
26
  import { Popper } from '../Popper/Popper';
27
27
  import { Text } from '../Typography/Text/Text';
28
28
  import { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden';
29
- import styles from './DateRangeInput.module.css';
30
29
  import dateInputStyles from '../DateInput/DateInput.module.css';
31
30
 
32
31
  const sizeYClassNames = {
33
- none: styles.sizeYNone,
34
- compact: styles.sizeYCompact,
32
+ none: dateInputStyles.sizeYNone,
33
+ compact: dateInputStyles.sizeYCompact,
35
34
  };
36
35
 
37
36
  type DateTestsProps = {
@@ -261,6 +260,7 @@ export const DateRangeInput = ({
261
260
  accessible,
262
261
  readOnly,
263
262
  'disableCalendar': disableCalendarProp = false,
263
+ before,
264
264
  ...props
265
265
  }: DateRangeInputProps): React.ReactNode => {
266
266
  const daysStartRef = React.useRef<HTMLSpanElement>(null);
@@ -417,16 +417,25 @@ export const DateRangeInput = ({
417
417
  }
418
418
  }, [handleFieldEnter, openCalendar, accessible]);
419
419
 
420
+ const showCalendarButton = !disableCalendar && (accessible || (!accessible && !value));
421
+ const showClearButton = value && !readOnly;
422
+
420
423
  return (
421
424
  <FormField
422
425
  style={style}
423
- className={classNames(sizeY !== 'regular' && sizeYClassNames[sizeY], className)}
426
+ className={classNames(
427
+ sizeY !== 'regular' && sizeYClassNames[sizeY],
428
+ !!before && dateInputStyles.hasBefore,
429
+ (showCalendarButton || showClearButton) && dateInputStyles.hasAfter,
430
+ className,
431
+ )}
424
432
  getRootRef={handleRootRef}
425
433
  role="group"
426
434
  aria-labelledby={`${ariaLabelId} ${currentDateLabelId}`}
435
+ before={before}
427
436
  after={
428
437
  <>
429
- {!disableCalendar && (accessible || (!accessible && !value)) ? (
438
+ {showCalendarButton ? (
430
439
  <IconButton
431
440
  hoverMode="opacity"
432
441
  label={showCalendarLabel}
@@ -436,7 +445,7 @@ export const DateRangeInput = ({
436
445
  <Icon20CalendarOutline />
437
446
  </IconButton>
438
447
  ) : null}
439
- {value && !readOnly ? (
448
+ {showClearButton ? (
440
449
  <IconButton
441
450
  hoverMode="opacity"
442
451
  label={clearFieldLabel}
@@ -212,7 +212,7 @@ export const TabsItem = ({
212
212
  withGaps && styles.withGaps,
213
213
  layoutFillMode !== 'auto' && fillModeClassNames[layoutFillMode],
214
214
  )}
215
- onClick={_onClick}
215
+ onClick={controller ? _onClick : onClick}
216
216
  id={id}
217
217
  {...restProps}
218
218
  >
@@ -1,24 +0,0 @@
1
- .input {
2
- z-index: var(--vkui_internal--z_index_form_field_element);
3
- flex-grow: 1;
4
- align-self: center;
5
- margin-inline: 10px 14px;
6
- font-variant-numeric: tabular-nums;
7
- white-space: nowrap;
8
- cursor: text;
9
- -webkit-user-select: text;
10
- -moz-user-select: text;
11
- user-select: text;
12
- }
13
-
14
- .sizeYCompact .input {
15
- -webkit-margin-end: 22px;
16
- margin-inline-end: 22px;
17
- }
18
-
19
- @media (pointer: fine) and (min-width: 768px),(max-height: 414.9px) {
20
- .sizeYNone .input {
21
- -webkit-margin-end: 22px;
22
- margin-inline-end: 22px;
23
- }
24
- }
@@ -1,20 +0,0 @@
1
- .input {
2
- z-index: var(--vkui_internal--z_index_form_field_element);
3
- flex-grow: 1;
4
- align-self: center;
5
- margin-inline: 10px 14px;
6
- font-variant-numeric: tabular-nums;
7
- white-space: nowrap;
8
- cursor: text;
9
- user-select: text;
10
- }
11
-
12
- .sizeYCompact .input {
13
- margin-inline-end: 22px;
14
- }
15
-
16
- @media (--sizeY-compact) {
17
- .sizeYNone .input {
18
- margin-inline-end: 22px;
19
- }
20
- }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["./DateRangeInput.module.css"],"names":["input","sizeYCompact","sizeYNone"],"mappings":"AAAA;AAAA,E,aAAAA,O,WAAA;AAAA,E,aAWAC,c,WAXA;AAAA,E,aAWcD,O,WAXd;AAAA,E,aAgBEE,W,WAhBF;AAAA,E,aAgBaF,O,WAhBb;AAAA;AAAA","file":"DateRangeInput.module.css.d.ts","sourceRoot":""}