@reachfive/identity-ui 1.32.0 → 1.32.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reachfive/identity-ui",
3
- "version": "1.32.0",
3
+ "version": "1.32.2",
4
4
  "description": "ReachFive Identity Web UI SDK",
5
5
  "author": "ReachFive",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @reachfive/identity-ui - v1.32.0
3
- * Compiled Wed, 05 Feb 2025 16:08:31 UTC
2
+ * @reachfive/identity-ui - v1.32.2
3
+ * Compiled Mon, 10 Feb 2025 15:46:55 UTC
4
4
  *
5
5
  * Copyright (c) ReachFive.
6
6
  *
@@ -390,7 +390,7 @@ type ExtraParams$2 = {
390
390
  };
391
391
  interface DateFieldProps extends FieldComponentProps<Date, ExtraParams$2> {
392
392
  }
393
- declare function dateField({ key, label, yearDebounce, locale, ...props }: Optional<FieldDefinition<string, Date>, 'key' | 'label'> & Optional<ExtraParams$2, 'locale'>, config: Config): FieldCreator<Date, DateFieldProps, ExtraParams$2>;
393
+ declare function dateField({ format, key, label, locale, validator, yearDebounce, ...props }: Optional<FieldDefinition<string, Date>, 'key' | 'label'> & Optional<ExtraParams$2, 'locale'>, config: Config): FieldCreator<Date, DateFieldProps, ExtraParams$2>;
394
394
 
395
395
  interface Option {
396
396
  label: string;
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @reachfive/identity-ui - v1.32.0
3
- * Compiled Wed, 05 Feb 2025 16:08:31 UTC
2
+ * @reachfive/identity-ui - v1.32.2
3
+ * Compiled Mon, 10 Feb 2025 15:46:55 UTC
4
4
  *
5
5
  * Copyright (c) ReachFive.
6
6
  *
@@ -39580,7 +39580,7 @@
39580
39580
  */
39581
39581
  function toDate(argument, context) {
39582
39582
  // [TODO] Get rid of `toDate` or `constructFrom`?
39583
- return constructFrom(argument, argument);
39583
+ return constructFrom(context || argument, argument);
39584
39584
  }
39585
39585
 
39586
39586
  function normalizeDates(context, ...dates) {
@@ -39893,7 +39893,7 @@
39893
39893
  * //=> Wed Dec 31 2014 23:59:59.999
39894
39894
  */
39895
39895
  function endOfYear(date, options) {
39896
- const _date = toDate(date);
39896
+ const _date = toDate(date, options?.in);
39897
39897
  const year = _date.getFullYear();
39898
39898
  _date.setFullYear(year + 1, 0, 0);
39899
39899
  _date.setHours(23, 59, 59, 999);
@@ -39927,7 +39927,7 @@
39927
39927
  * //=> Wed Jan 01 2014 00:00:00
39928
39928
  */
39929
39929
  function startOfYear(date, options) {
39930
- const date_ = toDate(date);
39930
+ const date_ = toDate(date, options?.in);
39931
39931
  date_.setFullYear(date_.getFullYear(), 0, 1);
39932
39932
  date_.setHours(0, 0, 0, 0);
39933
39933
  return date_;
@@ -39979,20 +39979,23 @@
39979
39979
  * //=> '19:00:52Z'
39980
39980
  */
39981
39981
  function formatISO(date, options) {
39982
- const date_ = toDate(date);
39982
+ const date_ = toDate(date, options?.in);
39983
39983
 
39984
39984
  if (isNaN(+date_)) {
39985
39985
  throw new RangeError("Invalid time value");
39986
39986
  }
39987
39987
 
39988
+ const format = options?.format ?? "extended";
39989
+ const representation = options?.representation ?? "complete";
39990
+
39988
39991
  let result = "";
39989
39992
  let tzOffset = "";
39990
39993
 
39991
- const dateDelimiter = "-" ;
39992
- const timeDelimiter = ":" ;
39994
+ const dateDelimiter = format === "extended" ? "-" : "";
39995
+ const timeDelimiter = format === "extended" ? ":" : "";
39993
39996
 
39994
39997
  // Representation is either 'date' or 'complete'
39995
- {
39998
+ if (representation !== "time") {
39996
39999
  const day = addLeadingZeros(date_.getDate(), 2);
39997
40000
  const month = addLeadingZeros(date_.getMonth() + 1, 2);
39998
40001
  const year = addLeadingZeros(date_.getFullYear(), 4);
@@ -40002,7 +40005,7 @@
40002
40005
  }
40003
40006
 
40004
40007
  // Representation is either 'time' or 'complete'
40005
- {
40008
+ if (representation !== "date") {
40006
40009
  // Add the timezone.
40007
40010
  const offset = date_.getTimezoneOffset();
40008
40011
 
@@ -40058,7 +40061,7 @@
40058
40061
  * //=> 29
40059
40062
  */
40060
40063
  function getDate(date, options) {
40061
- return toDate(date).getDate();
40064
+ return toDate(date, options?.in).getDate();
40062
40065
  }
40063
40066
 
40064
40067
  /**
@@ -40084,7 +40087,7 @@
40084
40087
  * //=> 29
40085
40088
  */
40086
40089
  function getDaysInMonth(date, options) {
40087
- const _date = toDate(date);
40090
+ const _date = toDate(date, options?.in);
40088
40091
  const year = _date.getFullYear();
40089
40092
  const monthIndex = _date.getMonth();
40090
40093
  const lastDayOfMonth = constructFrom(_date, 0);
@@ -40116,7 +40119,7 @@
40116
40119
  * //=> 1
40117
40120
  */
40118
40121
  function getMonth(date, options) {
40119
- return toDate(date).getMonth();
40122
+ return toDate(date, options?.in).getMonth();
40120
40123
  }
40121
40124
 
40122
40125
  /**
@@ -40142,7 +40145,7 @@
40142
40145
  * //=> 2014
40143
40146
  */
40144
40147
  function getYear(date, options) {
40145
- return toDate(date).getFullYear();
40148
+ return toDate(date, options?.in).getFullYear();
40146
40149
  }
40147
40150
 
40148
40151
  /**
@@ -40327,7 +40330,7 @@
40327
40330
  if (isNaN(offset)) return invalidDate();
40328
40331
  } else {
40329
40332
  const tmpDate = new Date(timestamp + time);
40330
- const result = toDate(0);
40333
+ const result = toDate(0, options?.in);
40331
40334
  result.setFullYear(
40332
40335
  tmpDate.getUTCFullYear(),
40333
40336
  tmpDate.getUTCMonth(),
@@ -40342,7 +40345,7 @@
40342
40345
  return result;
40343
40346
  }
40344
40347
 
40345
- return toDate(timestamp + time + offset);
40348
+ return toDate(timestamp + time + offset, options?.in);
40346
40349
  }
40347
40350
 
40348
40351
  const patterns = {
@@ -40706,26 +40709,28 @@
40706
40709
  parameters: { format: dateFormat$2(locale) }
40707
40710
  });
40708
40711
  function dateField({
40712
+ format,
40709
40713
  key = "date",
40710
40714
  label = "date",
40711
- yearDebounce,
40712
40715
  locale,
40716
+ validator,
40717
+ yearDebounce,
40713
40718
  ...props
40714
40719
  }, config) {
40715
40720
  return createField({
40716
40721
  key,
40717
40722
  label,
40718
40723
  ...props,
40719
- format: {
40724
+ format: format ?? {
40720
40725
  bind: (value) => {
40721
40726
  const dt = value ? parseISO(value) : void 0;
40722
40727
  return dt && isValid(dt) ? { raw: dt } : void 0;
40723
40728
  },
40724
40729
  unbind: (value) => {
40725
- return isRichFormValue(value, "raw") ? formatISO(value.raw) : value ? formatISO(value) : null;
40730
+ return isRichFormValue(value, "raw") ? formatISO(value.raw, { representation: "date" }) : value ? formatISO(value, { representation: "date" }) : null;
40726
40731
  }
40727
40732
  },
40728
- validator: props.validator ? datetimeValidator(config.language).and(props.validator) : datetimeValidator(config.language),
40733
+ validator: validator ? datetimeValidator(config.language).and(validator) : datetimeValidator(config.language),
40729
40734
  component: DateField,
40730
40735
  extendedParams: {
40731
40736
  locale: locale ?? config.language,