@true-engineering/true-react-common-ui-kit 4.0.0-alpha22 → 4.0.0-alpha24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@true-engineering/true-react-common-ui-kit",
3
- "version": "4.0.0-alpha22",
3
+ "version": "4.0.0-alpha24",
4
4
  "description": "True Engineering React UI Kit with theming support",
5
5
  "author": "True Engineering (https://trueengineering.ru)",
6
6
  "keywords": [
@@ -71,6 +71,27 @@ Default.args = {
71
71
  isRange: false,
72
72
  isClearable: true,
73
73
  shouldRenderPopperInBody: false,
74
+ popperPlacement: 'bottom-start',
75
+ };
76
+
77
+ Default.argTypes = {
78
+ popperPlacement: {
79
+ options: [
80
+ 'bottom-start',
81
+ 'bottom',
82
+ 'bottom-end',
83
+ 'top-start',
84
+ 'top',
85
+ 'top-end',
86
+ 'right-start',
87
+ 'right',
88
+ 'right-end',
89
+ 'left-start',
90
+ 'left',
91
+ 'left-end',
92
+ ],
93
+ control: 'select',
94
+ },
74
95
  };
75
96
 
76
97
  Default.parameters = {
@@ -8,6 +8,7 @@ import {
8
8
  isNotEmpty,
9
9
  isStringNotEmpty,
10
10
  } from '@true-engineering/true-react-platform-helpers';
11
+ import { offset } from '@floating-ui/react';
11
12
  import { addDataAttributes } from '../../helpers';
12
13
  import { useTweakStyles } from '../../hooks';
13
14
  import { ICommonProps } from '../../types';
@@ -70,8 +71,8 @@ export const DatePicker = forwardRef<ReactDatePicker, IDatePickerProps>(
70
71
  shouldCloseOnSelect,
71
72
  showPreviousMonths,
72
73
  preventOpenOnFocus,
73
- popperModifiers,
74
- popperPlacement,
74
+ popperModifiers = [],
75
+ popperPlacement = 'bottom-start',
75
76
  todayButton,
76
77
  highlightDates,
77
78
  calendarContainer,
@@ -264,7 +265,9 @@ export const DatePicker = forwardRef<ReactDatePicker, IDatePickerProps>(
264
265
  dayClassName={(v) => clsx(classes.day, dayClassName?.(v))}
265
266
  disabledKeyboardNavigation={disabledKeyboardNavigation}
266
267
  popperContainer={shouldRenderPopperInBody ? PopperContainer : undefined}
267
- popperModifiers={popperModifiers}
268
+ // Убираем дефолтный отступ в 10px из либы
269
+ // https://github.com/Hacker0x01/react-datepicker/blob/db67a58de2b05d2681bdf0a4977b606095d514c4/src/with_floating.tsx#L58
270
+ popperModifiers={[offset(-10), ...popperModifiers]}
268
271
  popperPlacement={popperPlacement}
269
272
  strictParsing={strictParsing}
270
273
  preventOpenOnFocus={preventOpenOnFocus}
@@ -38,7 +38,7 @@ export const clearButtonStyles = cloneDeep(innerTextButtonStyles);
38
38
  export const backButtonStyles = innerTextButtonStyles;
39
39
 
40
40
  const PICKER_TOP_MARGIN = 28;
41
- const PICKER_WITH_BUTTONS_TOP_MARGIN = 60;
41
+ const PICKER_WITH_BUTTONS_TOP_MARGIN = 56;
42
42
  const START_PICKER_LEFT_MARGIN = -20;
43
43
  const END_PICKER_LEFT_MARGIN = -170;
44
44
 
@@ -1,6 +1,6 @@
1
1
  import { animations, createThemedStyles, helpers, ITweakStyles } from '../../theme';
2
2
  import { IWithPrefix } from '../../types';
3
- import { IControlWrapperStyles } from '../ControlWrapper';
3
+ import { IControlWrapperSizes, IControlWrapperStyles } from '../ControlWrapper';
4
4
  import { IWithMessagesStyles } from '../WithMessages';
5
5
  import { ITextAreaCounterPositions } from './types';
6
6
 
@@ -84,5 +84,6 @@ export type ITextAreaStyles = ITweakStyles<
84
84
  {
85
85
  tweakWithMessages: IWithMessagesStyles;
86
86
  tweakControlWrapper: IControlWrapperStyles;
87
- } & IWithPrefix<ITextAreaCounterPositions, 'counter-'>
87
+ } & IWithPrefix<ITextAreaCounterPositions, 'counter-'> &
88
+ IControlWrapperSizes
88
89
  >;
@@ -128,7 +128,10 @@ export const TextArea = forwardRef<HTMLTextAreaElement, ITextAreaProps>(
128
128
  };
129
129
 
130
130
  return (
131
- <div className={classes.root} style={{ '--counter-length': counterString.length } as Styles}>
131
+ <div
132
+ className={clsx(classes.root, isNotEmpty(size) && classes[size])}
133
+ style={{ '--counter-length': counterString.length } as Styles}
134
+ >
132
135
  <WithMessages
133
136
  errorMessage={errorMessage}
134
137
  infoMessage={infoMessage}
@@ -148,7 +151,7 @@ export const TextArea = forwardRef<HTMLTextAreaElement, ITextAreaProps>(
148
151
  isFullWidth
149
152
  >
150
153
  <div
151
- className={clsx(classes.wrapper, isNotEmpty(size) && classes[size], {
154
+ className={clsx(classes.wrapper, {
152
155
  [classes.autoSized]: isAutoSized,
153
156
  [classes.withLabel]: hasLabel,
154
157
  })}
@@ -1,2 +1,3 @@
1
1
  export * from './TextArea';
2
2
  export type { ITextAreaStyles } from './TextArea.styles';
3
+ export * from './types';