@payloadcms/ui 3.81.0-canary.4 → 3.81.0-canary.6

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 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/elements/WhereBuilder/Condition/Date/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,eAAe,IAAI,KAAK,EAAE,MAAM,YAAY,CAAA;AAO1D,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAetC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/elements/WhereBuilder/Condition/Date/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,eAAe,IAAI,KAAK,EAAE,MAAM,YAAY,CAAA;AAQ1D,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAuBtC,CAAA"}
@@ -3,6 +3,7 @@
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
4
  import { getTranslation } from '@payloadcms/translations';
5
5
  import React from 'react';
6
+ import { useConfig } from '../../../../providers/Config/index.js';
6
7
  import { useTranslation } from '../../../../providers/Translation/index.js';
7
8
  import { DatePickerField } from '../../../DatePicker/index.js';
8
9
  const baseClass = 'condition-value-date';
@@ -19,14 +20,25 @@ export const DateFilter = t0 => {
19
20
  const {
20
21
  date
21
22
  } = admin || {};
23
+ const {
24
+ config: t2
25
+ } = useConfig();
26
+ const {
27
+ admin: t3
28
+ } = t2;
29
+ const {
30
+ dateFormat: dateFormatFromConfig
31
+ } = t3;
22
32
  const {
23
33
  i18n,
24
34
  t
25
35
  } = useTranslation();
36
+ const displayFormat = date?.displayFormat || dateFormatFromConfig;
26
37
  return _jsx("div", {
27
38
  className: baseClass,
28
39
  children: _jsx(DatePickerField, {
29
40
  ...date,
41
+ displayFormat,
30
42
  onChange,
31
43
  placeholder: getTranslation(admin.placeholder, i18n) || t("general:enterAValue"),
32
44
  readOnly: disabled,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["getTranslation","React","useTranslation","DatePickerField","baseClass","DateFilter","t0","disabled","field","t1","onChange","value","admin","date","i18n","t","_jsx","className","children","placeholder","readOnly"],"sources":["../../../../../src/elements/WhereBuilder/Condition/Date/index.tsx"],"sourcesContent":["'use client'\nimport { getTranslation } from '@payloadcms/translations'\nimport React from 'react'\n\nimport type { DateFilterProps as Props } from './types.js'\n\nimport { useTranslation } from '../../../../providers/Translation/index.js'\nimport { DatePickerField } from '../../../DatePicker/index.js'\n\nconst baseClass = 'condition-value-date'\n\nexport const DateFilter: React.FC<Props> = ({ disabled, field: { admin }, onChange, value }) => {\n const { date } = admin || {}\n const { i18n, t } = useTranslation()\n\n return (\n <div className={baseClass}>\n <DatePickerField\n {...date}\n onChange={onChange}\n placeholder={getTranslation(admin.placeholder, i18n) || t('general:enterAValue')}\n readOnly={disabled}\n value={value as Date}\n />\n </div>\n )\n}\n"],"mappings":"AAAA;;;AACA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAIlB,SAASC,cAAc,QAAQ;AAC/B,SAASC,eAAe,QAAQ;AAEhC,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,UAAA,GAA8BC,EAAA;EAAC;IAAAC,QAAA;IAAAC,KAAA,EAAAC,EAAA;IAAAC,QAAA;IAAAC;EAAA,IAAAL,EAA+C;EAA5B;IAAAM;EAAA,IAAAH,EAAS;EACtE;IAAAI;EAAA,IAAiBD,KAAA,MAAU;EAC3B;IAAAE,IAAA;IAAAC;EAAA,IAAoBb,cAAA;EAAA,OAGlBc,IAAA,CAAC;IAAAC,SAAA,EAAAb,SAAA;IAAAc,QAAA,EACCF,IAAA,CAAAb,eAAA;MAAA,GACMU,IAAI;MAAAH,QAAA;MAAAS,WAAA,EAEKnB,cAAA,CAAeY,KAAA,CAAAO,WAAA,EAAmBL,IAAA,KAASC,CAAA,CAAE;MAAAK,QAAA,EAChDb,QAAA;MAAAI;IAAA,C;;CAKlB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["getTranslation","React","useConfig","useTranslation","DatePickerField","baseClass","DateFilter","t0","disabled","field","t1","onChange","value","admin","date","config","t2","t3","dateFormat","dateFormatFromConfig","i18n","t","displayFormat","_jsx","className","children","placeholder","readOnly"],"sources":["../../../../../src/elements/WhereBuilder/Condition/Date/index.tsx"],"sourcesContent":["'use client'\nimport { getTranslation } from '@payloadcms/translations'\nimport React from 'react'\n\nimport type { DateFilterProps as Props } from './types.js'\n\nimport { useConfig } from '../../../../providers/Config/index.js'\nimport { useTranslation } from '../../../../providers/Translation/index.js'\nimport { DatePickerField } from '../../../DatePicker/index.js'\n\nconst baseClass = 'condition-value-date'\n\nexport const DateFilter: React.FC<Props> = ({ disabled, field: { admin }, onChange, value }) => {\n const { date } = admin || {}\n const {\n config: {\n admin: { dateFormat: dateFormatFromConfig },\n },\n } = useConfig()\n const { i18n, t } = useTranslation()\n\n const displayFormat = date?.displayFormat || dateFormatFromConfig\n\n return (\n <div className={baseClass}>\n <DatePickerField\n {...date}\n displayFormat={displayFormat}\n onChange={onChange}\n placeholder={getTranslation(admin.placeholder, i18n) || t('general:enterAValue')}\n readOnly={disabled}\n value={value as Date}\n />\n </div>\n )\n}\n"],"mappings":"AAAA;;;AACA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAIlB,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAC/B,SAASC,eAAe,QAAQ;AAEhC,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,UAAA,GAA8BC,EAAA;EAAC;IAAAC,QAAA;IAAAC,KAAA,EAAAC,EAAA;IAAAC,QAAA;IAAAC;EAAA,IAAAL,EAA+C;EAA5B;IAAAM;EAAA,IAAAH,EAAS;EACtE;IAAAI;EAAA,IAAiBD,KAAA,MAAU;EAC3B;IAAAE,MAAA,EAAAC;EAAA,IAIId,SAAA;EAHM;IAAAW,KAAA,EAAAI;EAAA,IAAAD,EAEP;EADQ;IAAAE,UAAA,EAAAC;EAAA,IAAAF,EAAoC;EAG/C;IAAAG,IAAA;IAAAC;EAAA,IAAoBlB,cAAA;EAEpB,MAAAmB,aAAA,GAAsBR,IAAA,EAAAQ,aAAA,IAAuBH,oBAAA;EAAA,OAG3CI,IAAA,CAAC;IAAAC,SAAA,EAAAnB,SAAA;IAAAoB,QAAA,EACCF,IAAA,CAAAnB,eAAA;MAAA,GACMU,IAAI;MAAAQ,aAAA;MAAAX,QAAA;MAAAe,WAAA,EAGK1B,cAAA,CAAea,KAAA,CAAAa,WAAA,EAAmBN,IAAA,KAASC,CAAA,CAAE;MAAAM,QAAA,EAChDnB,QAAA;MAAAI;IAAA,C;;CAKlB","ignoreList":[]}