@ssa-ui-kit/core 2.17.1 → 2.18.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.
@@ -1,2 +1,2 @@
1
1
  import { DateRangePickerProps } from './types';
2
- export declare const DateRangePicker: ({ format, openCalendarMode, showCalendarIcon, ...rest }: DateRangePickerProps) => import("@emotion/react/jsx-runtime").JSX.Element;
2
+ export declare const DateRangePicker: ({ format, openCalendarMode, showCalendarIcon, showStatusArea, ...rest }: DateRangePickerProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const TriggerStatusArea: () => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -15,11 +15,16 @@ export type DateRangePickerProps = {
15
15
  openCalendarMode?: 'icon' | 'input' | 'both';
16
16
  inputProps?: Partial<InputProps>;
17
17
  status?: FieldContextValue['status'];
18
+ showStatusArea?: boolean;
18
19
  dateMin?: string;
19
20
  dateMax?: string;
20
21
  disabled?: boolean;
21
- helperText?: string;
22
22
  showCalendarIcon?: boolean;
23
+ messages?: {
24
+ description?: string;
25
+ success?: string;
26
+ error?: string;
27
+ };
23
28
  classNames?: {
24
29
  trigger?: {
25
30
  root?: string;
package/dist/index.js CHANGED
@@ -13071,7 +13071,8 @@ const DatePickerCalendar = () => {
13071
13071
  paddingTop: 16,
13072
13072
  width: 346,
13073
13073
  height: 370,
13074
- alignItems: 'flex-start'
13074
+ alignItems: 'flex-start',
13075
+ zIndex: 100
13075
13076
  }, true ? "" : 0, true ? "" : 0),
13076
13077
  children: [(0,jsx_runtime_namespaceObject.jsx)(DatePickerHeader, {}), (0,jsx_runtime_namespaceObject.jsx)(PopoverDescription, {
13077
13078
  as: "div",
@@ -14028,7 +14029,8 @@ const Calendar_DatePickerCalendar = () => {
14028
14029
  width: 346,
14029
14030
  height: 370,
14030
14031
  alignItems: 'flex-start',
14031
- margin: '14px 0 0 -14px'
14032
+ margin: '14px 0 0 -14px',
14033
+ zIndex: 100
14032
14034
  }, true ? "" : 0, true ? "" : 0),
14033
14035
  children: [(0,jsx_runtime_namespaceObject.jsx)(Header_Header, {}), (0,jsx_runtime_namespaceObject.jsx)(PopoverDescription, {
14034
14036
  as: "div",
@@ -14163,55 +14165,6 @@ const FieldControl = /*#__PURE__*/external_react_default().forwardRef(function F
14163
14165
  children: _children
14164
14166
  });
14165
14167
  });
14166
- ;// ./src/components/Field/FieldDescription.tsx
14167
-
14168
-
14169
-
14170
- const FieldDescription = ({
14171
- children
14172
- }) => {
14173
- const ctx = useFieldContext();
14174
- if (ctx.status !== 'basic') {
14175
- return null;
14176
- }
14177
- return (0,jsx_runtime_namespaceObject.jsx)(FormHelperText_FormHelperText, {
14178
- status: "basic",
14179
- children: children
14180
- });
14181
- };
14182
- ;// ./src/components/Field/FieldError.tsx
14183
-
14184
-
14185
-
14186
- const FieldError = ({
14187
- children
14188
- }) => {
14189
- const ctx = useFieldContext();
14190
- if (ctx.status !== 'error') {
14191
- return null;
14192
- }
14193
- return (0,jsx_runtime_namespaceObject.jsx)(FormHelperText_FormHelperText, {
14194
- status: "error",
14195
- "data-testid": "field-error",
14196
- children: children
14197
- });
14198
- };
14199
- ;// ./src/components/Field/FieldSuccess.tsx
14200
-
14201
-
14202
-
14203
- const FieldSuccess = ({
14204
- children
14205
- }) => {
14206
- const ctx = useFieldContext();
14207
- if (ctx.status !== 'success') {
14208
- return null;
14209
- }
14210
- return (0,jsx_runtime_namespaceObject.jsx)(FormHelperText_FormHelperText, {
14211
- status: "success",
14212
- children: children
14213
- });
14214
- };
14215
14168
  ;// ./src/components/DateRangePicker/components/TriggerInput.tsx
14216
14169
  function TriggerInput_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
14217
14170
 
@@ -14247,7 +14200,7 @@ const TriggerInput = ({
14247
14200
  inputToRef,
14248
14201
  inputProps,
14249
14202
  disabled,
14250
- helperText,
14203
+ messages,
14251
14204
  setLastFocusedElement,
14252
14205
  classNames,
14253
14206
  onBlur: handleBlur
@@ -14301,7 +14254,7 @@ const TriggerInput = ({
14301
14254
  showStatusIcon: false,
14302
14255
  errors: fieldError,
14303
14256
  status: fieldStatus,
14304
- helperText: helperText,
14257
+ helperText: fieldStatus === 'basic' ? messages?.description : messages?.error,
14305
14258
  helperClassName: /*#__PURE__*/(0,css_namespaceObject.css)( true ? {
14306
14259
  name: "lhoo11",
14307
14260
  styles: "&>span::first-letter{text-transform:uppercase;}"
@@ -14310,6 +14263,90 @@ const TriggerInput = ({
14310
14263
  })
14311
14264
  });
14312
14265
  };
14266
+ ;// ./src/components/Field/FieldDescription.tsx
14267
+
14268
+
14269
+
14270
+ const FieldDescription = ({
14271
+ children
14272
+ }) => {
14273
+ const ctx = useFieldContext();
14274
+ if (ctx.status !== 'basic') {
14275
+ return null;
14276
+ }
14277
+ return (0,jsx_runtime_namespaceObject.jsx)(FormHelperText_FormHelperText, {
14278
+ status: "basic",
14279
+ "data-testid": "field-description",
14280
+ children: children
14281
+ });
14282
+ };
14283
+ ;// ./src/components/Field/FieldError.tsx
14284
+
14285
+
14286
+
14287
+ const FieldError = ({
14288
+ children
14289
+ }) => {
14290
+ const ctx = useFieldContext();
14291
+ if (ctx.status !== 'error') {
14292
+ return null;
14293
+ }
14294
+ return (0,jsx_runtime_namespaceObject.jsx)(FormHelperText_FormHelperText, {
14295
+ status: "error",
14296
+ "data-testid": "field-error",
14297
+ children: children
14298
+ });
14299
+ };
14300
+ ;// ./src/components/Field/FieldSuccess.tsx
14301
+
14302
+
14303
+
14304
+ const FieldSuccess = ({
14305
+ children
14306
+ }) => {
14307
+ const ctx = useFieldContext();
14308
+ if (ctx.status !== 'success') {
14309
+ return null;
14310
+ }
14311
+ return (0,jsx_runtime_namespaceObject.jsx)(FormHelperText_FormHelperText, {
14312
+ status: "success",
14313
+ "data-testid": "field-success",
14314
+ children: children
14315
+ });
14316
+ };
14317
+ ;// ./src/components/DateRangePicker/components/TriggerStatusArea.tsx
14318
+ function TriggerStatusArea_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
14319
+
14320
+
14321
+
14322
+
14323
+ var TriggerStatusArea_ref = true ? {
14324
+ name: "ud49p1",
14325
+ styles: "color:inherit;&::first-letter{text-transform:uppercase;}"
14326
+ } : 0;
14327
+ const TriggerStatusArea = () => {
14328
+ const formContext = (0,external_react_hook_form_namespaceObject.useFormContext)();
14329
+ const {
14330
+ messages,
14331
+ nameFrom,
14332
+ nameTo
14333
+ } = useDateRangePickerContext();
14334
+ const errorsFrom = formContext.formState.errors[nameFrom]?.message;
14335
+ const errorsTo = formContext.formState.errors[nameTo]?.message;
14336
+ const errorMessage = [errorsFrom, errorsTo].filter(Boolean);
14337
+ return (0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
14338
+ children: [messages?.description && (0,jsx_runtime_namespaceObject.jsx)(FieldDescription, {
14339
+ children: messages?.description
14340
+ }), (errorMessage.length || messages?.error) && (0,jsx_runtime_namespaceObject.jsx)(FieldError, {
14341
+ children: errorMessage.length ? errorMessage.map((error, index) => (0,jsx_runtime_namespaceObject.jsx)("span", {
14342
+ css: TriggerStatusArea_ref,
14343
+ children: error
14344
+ }, `error-${index}`)) : messages?.error
14345
+ }), messages?.success && (0,jsx_runtime_namespaceObject.jsx)(FieldSuccess, {
14346
+ children: messages?.success
14347
+ })]
14348
+ });
14349
+ };
14313
14350
  ;// ./src/components/DateRangePicker/components/Trigger.tsx
14314
14351
 
14315
14352
  function Trigger_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
@@ -14326,10 +14363,6 @@ var Trigger_ref = true ? {
14326
14363
  name: "1ldd2k6",
14327
14364
  styles: "margin:0 3px"
14328
14365
  } : 0;
14329
- var Trigger_ref2 = true ? {
14330
- name: "ud49p1",
14331
- styles: "color:inherit;&::first-letter{text-transform:uppercase;}"
14332
- } : 0;
14333
14366
  const Trigger = () => {
14334
14367
  const {
14335
14368
  nameFrom,
@@ -14338,16 +14371,15 @@ const Trigger = () => {
14338
14371
  lastFocusedElement,
14339
14372
  disabled,
14340
14373
  status,
14341
- helperText,
14342
14374
  openCalendarMode,
14343
14375
  isOpen,
14344
14376
  showCalendarIcon,
14377
+ showStatusArea,
14345
14378
  classNames,
14346
14379
  setIsOpen,
14347
14380
  handleToggleOpen
14348
14381
  } = useDateRangePickerContext();
14349
14382
  const theme = (0,react_namespaceObject.useTheme)();
14350
- const formContext = (0,external_react_hook_form_namespaceObject.useFormContext)();
14351
14383
  const wrapperRef = (0,external_react_namespaceObject.useRef)(null);
14352
14384
  (0,hooks_namespaceObject.useClickOutside)(wrapperRef, event => {
14353
14385
  const {
@@ -14358,9 +14390,6 @@ const Trigger = () => {
14358
14390
  setIsOpen(false);
14359
14391
  }
14360
14392
  });
14361
- const errorsFrom = formContext.formState.errors[nameFrom]?.message;
14362
- const errorsTo = formContext.formState.errors[nameTo]?.message;
14363
- const errorMessage = [errorsFrom, errorsTo].filter(Boolean);
14364
14393
  return (0,jsx_runtime_namespaceObject.jsxs)(FieldRoot, {
14365
14394
  status: status,
14366
14395
  disabled: disabled,
@@ -14420,16 +14449,7 @@ const Trigger = () => {
14420
14449
  }, true ? "" : 0, true ? "" : 0)
14421
14450
  })]
14422
14451
  })
14423
- }), (0,jsx_runtime_namespaceObject.jsx)(FieldDescription, {
14424
- children: helperText
14425
- }), (0,jsx_runtime_namespaceObject.jsx)(FieldError, {
14426
- children: errorMessage ? errorMessage.map((error, index) => (0,jsx_runtime_namespaceObject.jsx)("span", {
14427
- css: Trigger_ref2,
14428
- children: error
14429
- }, `error-${index}`)) : helperText
14430
- }), (0,jsx_runtime_namespaceObject.jsx)(FieldSuccess, {
14431
- children: helperText
14432
- })]
14452
+ }), showStatusArea && (0,jsx_runtime_namespaceObject.jsx)(TriggerStatusArea, {})]
14433
14453
  });
14434
14454
  };
14435
14455
  ;// ./src/components/DateRangePicker/components/Content.tsx
@@ -14891,11 +14911,13 @@ const DateRangePicker = ({
14891
14911
  format = constants_DEFAULT_MASK_FORMAT,
14892
14912
  openCalendarMode = 'icon',
14893
14913
  showCalendarIcon = true,
14914
+ showStatusArea = true,
14894
14915
  ...rest
14895
14916
  }) => (0,jsx_runtime_namespaceObject.jsx)(DateRangePickerProvider, {
14896
14917
  format: format,
14897
14918
  openCalendarMode: openCalendarMode,
14898
14919
  showCalendarIcon: showCalendarIcon,
14920
+ showStatusArea: showStatusArea,
14899
14921
  ...rest,
14900
14922
  children: (0,jsx_runtime_namespaceObject.jsx)(Content_DatePickerContent, {})
14901
14923
  });