@haiilo/catalyst 6.0.0 → 6.0.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.
@@ -48,7 +48,7 @@ export class CatDatepickerFlat {
48
48
  altInput: true,
49
49
  prevArrow: '←',
50
50
  nextArrow: '→',
51
- dateFormat: 'Z',
51
+ dateFormat: this.dateFormat,
52
52
  altFormat: format,
53
53
  ariaDateFormat: format,
54
54
  mode: this.mode === 'daterange' ? 'range' : 'single',
@@ -66,7 +66,6 @@ export class CatDatepickerFlat {
66
66
  this.value = dateStr;
67
67
  }
68
68
  this.catChange.emit(this.value);
69
- console.log(this.value);
70
69
  }
71
70
  });
72
71
  }
@@ -92,10 +91,9 @@ export class CatDatepickerFlat {
92
91
  return (h("cat-input", { ref: el => (this._input = el), requiredMarker: this.requiredMarker, horizontal: this.horizontal, autoComplete: this.autoComplete, clearable: this.clearable, disabled: this.disabled, hint: this.hint, icon: this.icon, iconRight: this.iconRight, identifier: this.identifier, label: this.label, labelHidden: this.labelHidden, name: this.name, placeholder: this.placeholder, textPrefix: this.textPrefix, textSuffix: this.textSuffix, readonly: this.readonly, required: this.required, value: this.value, errors: this.errors, errorUpdate: this.errorUpdate, nativeAttributes: this.nativeAttributes, onCatChange: e => {
93
92
  e.stopPropagation();
94
93
  this.pickr?.setDate(e.detail);
95
- if (this.value !== e.detail || undefined) {
94
+ if (this.value !== (e.detail || undefined)) {
96
95
  this.value = e.detail || undefined;
97
96
  this.catChange.emit(this.value);
98
- console.log(this.value);
99
97
  }
100
98
  }, onCatFocus: e => {
101
99
  e.stopPropagation();
@@ -105,6 +103,17 @@ export class CatDatepickerFlat {
105
103
  this.catBlur.emit(e.detail);
106
104
  } }));
107
105
  }
106
+ get dateFormat() {
107
+ if (this.mode === 'week') {
108
+ return 'W';
109
+ }
110
+ else if (this.mode === 'time') {
111
+ return 'H:i';
112
+ }
113
+ else {
114
+ return 'Z';
115
+ }
116
+ }
108
117
  static get is() { return "cat-datepicker"; }
109
118
  static get encapsulation() { return "shadow"; }
110
119
  static get originalStyleUrls() {
@@ -1 +1 @@
1
- {"version":3,"file":"cat-datepicker.js","sourceRoot":"","sources":["../../../src/components/cat-datepicker/cat-datepicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAgB,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,gBAAgB,MAAM,8CAA8C,CAAC;AAE5E,OAAO,EAAE,eAAe,IAAI,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAOpD,MAAM,OAAO,iBAAiB;;0BAUqE,UAAU;sBAKtF,KAAK;;qBAUN,KAAK;oBAKN,KAAK;;;qBAeJ,KAAK;;iBAUT,EAAE;uBAKI,KAAK;;;gBAeyC,MAAM;;;;;oBAyBvD,KAAK;oBAKL,KAAK;gBAKT,CAAC;;;uBAsBwB,CAAC;;;EAjIzC,IAAY,KAAK;IACf,OAAO,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,aAAa,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC;EACtE,CAAC;EAqJD,gBAAgB;IACd,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IACzB,IAAI,KAAK,EAAE;MACT,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;MAC3C,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;MACtD,8DAA8D;MAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,IAAK,gBAAwB,CAAC,EAAE,CAAC,CAAC,C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CACF","sourcesContent":["import { Component, Event, Method, EventEmitter, Prop, h } from '@stencil/core';\nimport flatpickr from 'flatpickr';\nimport weekSelectPlugin from 'flatpickr/dist/plugins/weekSelect/weekSelect';\nimport { ErrorMap } from '../cat-form-hint/cat-form-hint';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\nimport { getFormat } from './cat-datepicker.config';\nimport { getLocale } from './cat-datepicker.locale';\n\n@Component({\n tag: 'cat-datepicker',\n styleUrl: 'cat-datepicker.scss',\n shadow: true\n})\nexport class CatDatepickerFlat {\n private pickr?: flatpickr.Instance;\n private _input?: HTMLCatInputElement;\n private get input(): HTMLInputElement | undefined {\n return this._input?.shadowRoot?.querySelector('input') ?? undefined;\n }\n\n /**\n * Whether the label need a marker to shown if the input is required or optional.\n */\n @Prop() requiredMarker: 'none' | 'required' | 'optional' | 'none!' | 'optional!' | 'required!' = 'optional';\n\n /**\n * Whether the label is on top or left.\n */\n @Prop() horizontal = false;\n\n /**\n * Hint for form autofill feature.\n */\n @Prop() autoComplete?: string;\n\n /**\n * Whether the input should show a clear button.\n */\n @Prop() clearable = false;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Optional hint text(s) to be displayed with the input.\n */\n @Prop() hint?: string | string[];\n\n /**\n * The name of an icon to be displayed in the input.\n */\n @Prop() icon?: string;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * A unique identifier for the input.\n */\n @Prop() identifier?: string;\n\n /**\n * The label for the input.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A maximum value as ISO Date string, e.g. 2017-03-04T01:23:43.000Z.\n */\n @Prop() max?: string;\n\n /**\n * A minimum value as ISO Date string, e.g. 2017-03-04T01:23:43.000Z.\n */\n @Prop() min?: string;\n\n /**\n * The mode of the datepicker, to select a date, time, both, a date range or a week number.\n */\n @Prop() mode: 'date' | 'time' | 'datetime' | 'daterange' | 'week' = 'date';\n\n /**\n * The name of the form control. Submitted with the form as part of a name/value pair.\n */\n @Prop() name?: string;\n\n /**\n * The placeholder text to display within the input.\n */\n @Prop() placeholder?: string;\n\n /**\n * A textual prefix to be displayed in the input.\n */\n @Prop() textPrefix?: string;\n\n /**\n * A textual suffix to be displayed in the input.\n */\n @Prop() textSuffix?: string;\n\n /**\n * The value is not editable.\n */\n @Prop() readonly = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * The step size to use when changing the time.\n */\n @Prop() step = 5;\n\n /**\n * The value as ISO Date string, e.g. 2017-03-04T01:23:43.000Z or as a week number string.\n */\n @Prop({ mutable: true }) value?: string;\n\n /**\n * The validation errors for this input. Will render a hint under the input\n * with the translated error message(s) `error.${key}`. If an object is\n * passed, the keys will be used as error keys and the values translation\n * parameters.\n * If the value is `true`, the input will be marked as invalid without any\n * hints under the input.\n */\n @Prop() errors?: boolean | string[] | ErrorMap;\n\n /**\n * Fine-grained control over when the errors are shown. Can be `false` to\n * never show errors, `true` to show errors on blur, or a number to show\n * errors on change with the given delay in milliseconds.\n */\n @Prop() errorUpdate: boolean | number = 0;\n\n /**\n * Attributes that will be added to the native HTML input element.\n */\n @Prop() nativeAttributes?: { [key: string]: string };\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter<string>;\n\n /**\n * Emitted when the input received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentDidLoad() {\n const input = this.input;\n if (input) {\n const locale = getLocale(i18n.getLocale());\n const format = getFormat(i18n.getLocale(), this.mode);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const plugins = this.mode === 'week' ? [new (weekSelectPlugin as any)({})] : [];\n this.pickr = flatpickr(input, {\n locale,\n plugins,\n altInput: true,\n prevArrow: '←',\n nextArrow: '→',\n dateFormat: 'Z',\n altFormat: format,\n ariaDateFormat: format,\n mode: this.mode === 'daterange' ? 'range' : 'single',\n minDate: this.min,\n maxDate: this.max,\n enableTime: this.mode === 'time' || this.mode === 'datetime',\n noCalendar: this.mode === 'time',\n weekNumbers: true,\n minuteIncrement: this.step,\n onChange: (dates, dateStr, flatpickr) => {\n if (this.mode === 'week') {\n this.value = dates[0] ? flatpickr.config.getWeek(dates[0]).toString() : undefined;\n } else {\n this.value = dateStr;\n }\n this.catChange.emit(this.value);\n console.log(this.value);\n }\n });\n }\n }\n\n /**\n * Programmatically move focus to the datepicker. Use this method instead of\n * `input.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async doFocus(options?: FocusOptions): Promise<void> {\n this._input?.doFocus(options);\n }\n\n /**\n * Programmatically remove focus from the datepicker. Use this method instead of\n * `input.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this._input?.doBlur();\n }\n\n render() {\n return (\n <cat-input\n ref={el => (this._input = el)}\n requiredMarker={this.requiredMarker}\n horizontal={this.horizontal}\n autoComplete={this.autoComplete}\n clearable={this.clearable}\n disabled={this.disabled}\n hint={this.hint}\n icon={this.icon}\n iconRight={this.iconRight}\n identifier={this.identifier}\n label={this.label}\n labelHidden={this.labelHidden}\n name={this.name}\n placeholder={this.placeholder}\n textPrefix={this.textPrefix}\n textSuffix={this.textSuffix}\n readonly={this.readonly}\n required={this.required}\n value={this.value}\n errors={this.errors}\n errorUpdate={this.errorUpdate}\n nativeAttributes={this.nativeAttributes}\n onCatChange={e => {\n e.stopPropagation();\n this.pickr?.setDate(e.detail);\n if (this.value !== e.detail || undefined) {\n this.value = e.detail || undefined;\n this.catChange.emit(this.value);\n console.log(this.value);\n }\n }}\n onCatFocus={e => {\n e.stopPropagation();\n this.catFocus.emit(e.detail);\n }}\n onCatBlur={e => {\n e.stopPropagation();\n this.catBlur.emit(e.detail);\n }}\n ></cat-input>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"cat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;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, Method, EventEmitter, Prop, h } from '@stencil/core';\nimport flatpickr from 'flatpickr';\nimport weekSelectPlugin from 'flatpickr/dist/plugins/weekSelect/weekSelect';\nimport { ErrorMap } from '../cat-form-hint/cat-form-hint';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\nimport { getFormat } from './cat-datepicker.config';\nimport { getLocale } from './cat-datepicker.locale';\n\n@Component({\n tag: 'cat-datepicker',\n styleUrl: 'cat-datepicker.scss',\n shadow: true\n})\nexport class CatDatepickerFlat {\n private pickr?: flatpickr.Instance;\n private _input?: HTMLCatInputElement;\n private get input(): HTMLInputElement | undefined {\n return this._input?.shadowRoot?.querySelector('input') ?? undefined;\n }\n\n /**\n * Whether the label need a marker to shown if the input is required or optional.\n */\n @Prop() requiredMarker: 'none' | 'required' | 'optional' | 'none!' | 'optional!' | 'required!' = 'optional';\n\n /**\n * Whether the label is on top or left.\n */\n @Prop() horizontal = false;\n\n /**\n * Hint for form autofill feature.\n */\n @Prop() autoComplete?: string;\n\n /**\n * Whether the input should show a clear button.\n */\n @Prop() clearable = false;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Optional hint text(s) to be displayed with the input.\n */\n @Prop() hint?: string | string[];\n\n /**\n * The name of an icon to be displayed in the input.\n */\n @Prop() icon?: string;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * A unique identifier for the input.\n */\n @Prop() identifier?: string;\n\n /**\n * The label for the input.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A maximum value as ISO Date string, e.g. 2017-03-04T01:23:43.000Z.\n */\n @Prop() max?: string;\n\n /**\n * A minimum value as ISO Date string, e.g. 2017-03-04T01:23:43.000Z.\n */\n @Prop() min?: string;\n\n /**\n * The mode of the datepicker, to select a date, time, both, a date range or a week number.\n */\n @Prop() mode: 'date' | 'time' | 'datetime' | 'daterange' | 'week' = 'date';\n\n /**\n * The name of the form control. Submitted with the form as part of a name/value pair.\n */\n @Prop() name?: string;\n\n /**\n * The placeholder text to display within the input.\n */\n @Prop() placeholder?: string;\n\n /**\n * A textual prefix to be displayed in the input.\n */\n @Prop() textPrefix?: string;\n\n /**\n * A textual suffix to be displayed in the input.\n */\n @Prop() textSuffix?: string;\n\n /**\n * The value is not editable.\n */\n @Prop() readonly = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * The step size to use when changing the time.\n */\n @Prop() step = 5;\n\n /**\n * The value as ISO Date string, e.g. 2017-03-04T01:23:43.000Z or as a week number string.\n */\n @Prop({ mutable: true }) value?: string;\n\n /**\n * The validation errors for this input. Will render a hint under the input\n * with the translated error message(s) `error.${key}`. If an object is\n * passed, the keys will be used as error keys and the values translation\n * parameters.\n * If the value is `true`, the input will be marked as invalid without any\n * hints under the input.\n */\n @Prop() errors?: boolean | string[] | ErrorMap;\n\n /**\n * Fine-grained control over when the errors are shown. Can be `false` to\n * never show errors, `true` to show errors on blur, or a number to show\n * errors on change with the given delay in milliseconds.\n */\n @Prop() errorUpdate: boolean | number = 0;\n\n /**\n * Attributes that will be added to the native HTML input element.\n */\n @Prop() nativeAttributes?: { [key: string]: string };\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter<string>;\n\n /**\n * Emitted when the input received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentDidLoad() {\n const input = this.input;\n if (input) {\n const locale = getLocale(i18n.getLocale());\n const format = getFormat(i18n.getLocale(), this.mode);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const plugins = this.mode === 'week' ? [new (weekSelectPlugin as any)({})] : [];\n this.pickr = flatpickr(input, {\n locale,\n plugins,\n altInput: true,\n prevArrow: '←',\n nextArrow: '→',\n dateFormat: this.dateFormat,\n altFormat: format,\n ariaDateFormat: format,\n mode: this.mode === 'daterange' ? 'range' : 'single',\n minDate: this.min,\n maxDate: this.max,\n enableTime: this.mode === 'time' || this.mode === 'datetime',\n noCalendar: this.mode === 'time',\n weekNumbers: true,\n minuteIncrement: this.step,\n onChange: (dates, dateStr, flatpickr) => {\n if (this.mode === 'week') {\n this.value = dates[0] ? flatpickr.config.getWeek(dates[0]).toString() : undefined;\n } else {\n this.value = dateStr;\n }\n this.catChange.emit(this.value);\n }\n });\n }\n }\n\n /**\n * Programmatically move focus to the datepicker. Use this method instead of\n * `input.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async doFocus(options?: FocusOptions): Promise<void> {\n this._input?.doFocus(options);\n }\n\n /**\n * Programmatically remove focus from the datepicker. Use this method instead of\n * `input.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this._input?.doBlur();\n }\n\n render() {\n return (\n <cat-input\n ref={el => (this._input = el)}\n requiredMarker={this.requiredMarker}\n horizontal={this.horizontal}\n autoComplete={this.autoComplete}\n clearable={this.clearable}\n disabled={this.disabled}\n hint={this.hint}\n icon={this.icon}\n iconRight={this.iconRight}\n identifier={this.identifier}\n label={this.label}\n labelHidden={this.labelHidden}\n name={this.name}\n placeholder={this.placeholder}\n textPrefix={this.textPrefix}\n textSuffix={this.textSuffix}\n readonly={this.readonly}\n required={this.required}\n value={this.value}\n errors={this.errors}\n errorUpdate={this.errorUpdate}\n nativeAttributes={this.nativeAttributes}\n onCatChange={e => {\n e.stopPropagation();\n this.pickr?.setDate(e.detail);\n if (this.value !== (e.detail || undefined)) {\n this.value = e.detail || undefined;\n this.catChange.emit(this.value);\n }\n }}\n onCatFocus={e => {\n e.stopPropagation();\n this.catFocus.emit(e.detail);\n }}\n onCatBlur={e => {\n e.stopPropagation();\n this.catBlur.emit(e.detail);\n }}\n ></cat-input>\n );\n }\n\n private get dateFormat(): string {\n if (this.mode === 'week') {\n return 'W';\n } else if (this.mode === 'time') {\n return 'H:i';\n } else {\n return 'Z';\n }\n }\n}\n"]}
@@ -25,7 +25,7 @@ function monthsForLocale(language, month = 'long') {
25
25
  export function getLocale(language) {
26
26
  return {
27
27
  firstDayOfWeek: getFirstDayOfWeek(language),
28
- rangeSeparator: ' ',
28
+ rangeSeparator: ' - ',
29
29
  weekAbbreviation: '',
30
30
  yearAriaLabel: i18n.t('datepicker.year'),
31
31
  monthAriaLabel: i18n.t('datepicker.month'),
@@ -1 +1 @@
1
- {"version":3,"file":"cat-datepicker.locale.js","sourceRoot":"","sources":["../../../src/components/cat-datepicker/cat-datepicker.locale.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,IAAI,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAExE,MAAM,UAAU,SAAS,CAAC,QAAgB;EACxC,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;KACtF,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;KAClB,WAAW,EAAE,CAAC;EACjB,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAgB;EACzC,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;EACzC,8DAA8D;EAC9D,MAAM,QAAQ,GAAI,MAAc,CAAC,WAAW,EAAE,EAAE,IAAK,MAAc,CAAC,QAAQ,CAAC;EAC7E,OAAO,QAAQ,EAAE,QAAQ,IAAI,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,aAAa,CAAC,QAAgB,EAAE,UAAuC,MAAM;EACpF,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;EACxB,MAAM,cAAc,GA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,CAAC,CAAC,CAAC,mBAAmB,CAAC;IACxC,SAAS,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC;IAC/B,QAAQ,EAAE;MACR,8DAA8D;MAC9D,SAAS,EAAE,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAQ;MAClD,8DAA8D;MAC9D,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAQ;KACjD;IACD,MAAM,EAAE;MACN,8DAA8D;MAC9D,SAAS,EAAE,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAQ;MACpD,8DAA8D;MAC9D,QAAQ,EAAE,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAQ;KACnD;GACF,CAAC;AACJ,CAAC","sourcesContent":["import { CustomLocale } from 'flatpickr/dist/types/locale';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\n\nexport function getHour12(language: string): boolean {\n const dateStr = new Intl.DateTimeFormat(language, { hour: '2-digit', minute: '2-digit' })\n .format(new Date())\n .toLowerCase();\n return dateStr.includes('am') || dateStr.includes('pm');\n}\n\nfunction getFirstDayOfWeek(language: string): number {\n const locale = new Intl.Locale(language);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const weekInfo = (locale as any).getWeekInfo?.() ?? (locale as any).weekInfo;\n return weekInfo?.firstDay ?? 1;\n}\n\nfunction daysForLocale(language: string, weekday: 'long' | 'short' | 'narrow' = 'long') {\n const date = new Date();\n const firstDayOfWeek = date.getUTCDate() - date.getUTCDay();\n const format = new Intl.DateTimeFormat(language, { weekday }).format;\n return [...Array(7).keys()].map(day => format(date.setUTCDate(firstDayOfWeek + day)));\n}\n\nfunction monthsForLocale(language: string, month: 'long' | 'short' = 'long') {\n const date = new Date();\n const format = new Intl.DateTimeFormat(language, { month }).format;\n return [...Array(12).keys()].map(month => format(date.setUTCMonth(month)));\n}\n\nexport function getLocale(language: string): CustomLocale {\n return {\n firstDayOfWeek: getFirstDayOfWeek(language),\n rangeSeparator: ' ',\n weekAbbreviation: '',\n yearAriaLabel: i18n.t('datepicker.year'),\n monthAriaLabel: i18n.t('datepicker.month'),\n hourAriaLabel: i18n.t('datepicker.hour'),\n minuteAriaLabel: i18n.t('datepicker.minute'),\n toggleTitle: i18n.t('datepicker.toggle'),\n scrollTitle: i18n.t('datepicker.scroll'),\n time_24hr: !getHour12(language),\n weekdays: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n shorthand: daysForLocale(language, 'short') as any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n longhand: daysForLocale(language, 'long') as any\n },\n months: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n shorthand: monthsForLocale(language, 'short') as any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n longhand: monthsForLocale(language, 'long') as any\n }\n };\n}\n"]}
1
+ {"version":3,"file":"cat-datepicker.locale.js","sourceRoot":"","sources":["../../../src/components/cat-datepicker/cat-datepicker.locale.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,IAAI,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAExE,MAAM,UAAU,SAAS,CAAC,QAAgB;EACxC,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;KACtF,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;KAClB,WAAW,EAAE,CAAC;EACjB,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAgB;EACzC,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;EACzC,8DAA8D;EAC9D,MAAM,QAAQ,GAAI,MAAc,CAAC,WAAW,EAAE,EAAE,IAAK,MAAc,CAAC,QAAQ,CAAC;EAC7E,OAAO,QAAQ,E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C,CAAC,iBAAiB,CAAC;IACxC,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC;IAC5C,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC;IACxC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC;IACxC,SAAS,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC;IAC/B,QAAQ,EAAE;MACR,8DAA8D;MAC9D,SAAS,EAAE,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAQ;MAClD,8DAA8D;MAC9D,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAQ;KACjD;IACD,MAAM,EAAE;MACN,8DAA8D;MAC9D,SAAS,EAAE,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAQ;MACpD,8DAA8D;MAC9D,QAAQ,EAAE,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAQ;KACnD;GACF,CAAC;AACJ,CAAC","sourcesContent":["import { CustomLocale } from 'flatpickr/dist/types/locale';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\n\nexport function getHour12(language: string): boolean {\n const dateStr = new Intl.DateTimeFormat(language, { hour: '2-digit', minute: '2-digit' })\n .format(new Date())\n .toLowerCase();\n return dateStr.includes('am') || dateStr.includes('pm');\n}\n\nfunction getFirstDayOfWeek(language: string): number {\n const locale = new Intl.Locale(language);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const weekInfo = (locale as any).getWeekInfo?.() ?? (locale as any).weekInfo;\n return weekInfo?.firstDay ?? 1;\n}\n\nfunction daysForLocale(language: string, weekday: 'long' | 'short' | 'narrow' = 'long') {\n const date = new Date();\n const firstDayOfWeek = date.getUTCDate() - date.getUTCDay();\n const format = new Intl.DateTimeFormat(language, { weekday }).format;\n return [...Array(7).keys()].map(day => format(date.setUTCDate(firstDayOfWeek + day)));\n}\n\nfunction monthsForLocale(language: string, month: 'long' | 'short' = 'long') {\n const date = new Date();\n const format = new Intl.DateTimeFormat(language, { month }).format;\n return [...Array(12).keys()].map(month => format(date.setUTCMonth(month)));\n}\n\nexport function getLocale(language: string): CustomLocale {\n return {\n firstDayOfWeek: getFirstDayOfWeek(language),\n rangeSeparator: ' - ',\n weekAbbreviation: '',\n yearAriaLabel: i18n.t('datepicker.year'),\n monthAriaLabel: i18n.t('datepicker.month'),\n hourAriaLabel: i18n.t('datepicker.hour'),\n minuteAriaLabel: i18n.t('datepicker.minute'),\n toggleTitle: i18n.t('datepicker.toggle'),\n scrollTitle: i18n.t('datepicker.scroll'),\n time_24hr: !getHour12(language),\n weekdays: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n shorthand: daysForLocale(language, 'short') as any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n longhand: daysForLocale(language, 'long') as any\n },\n months: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n shorthand: monthsForLocale(language, 'short') as any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n longhand: monthsForLocale(language, 'long') as any\n }\n };\n}\n"]}
@@ -2702,7 +2702,7 @@ function monthsForLocale(language, month = 'long') {
2702
2702
  function getLocale(language) {
2703
2703
  return {
2704
2704
  firstDayOfWeek: getFirstDayOfWeek(language),
2705
- rangeSeparator: ' ',
2705
+ rangeSeparator: ' - ',
2706
2706
  weekAbbreviation: '',
2707
2707
  yearAriaLabel: catI18nRegistry.t('datepicker.year'),
2708
2708
  monthAriaLabel: catI18nRegistry.t('datepicker.month'),
@@ -2778,7 +2778,7 @@ const CatDatepickerFlat = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
2778
2778
  altInput: true,
2779
2779
  prevArrow: '←',
2780
2780
  nextArrow: '→',
2781
- dateFormat: 'Z',
2781
+ dateFormat: this.dateFormat,
2782
2782
  altFormat: format,
2783
2783
  ariaDateFormat: format,
2784
2784
  mode: this.mode === 'daterange' ? 'range' : 'single',
@@ -2796,7 +2796,6 @@ const CatDatepickerFlat = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
2796
2796
  this.value = dateStr;
2797
2797
  }
2798
2798
  this.catChange.emit(this.value);
2799
- console.log(this.value);
2800
2799
  }
2801
2800
  });
2802
2801
  }
@@ -2822,10 +2821,9 @@ const CatDatepickerFlat = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
2822
2821
  return (h("cat-input", { ref: el => (this._input = el), requiredMarker: this.requiredMarker, horizontal: this.horizontal, autoComplete: this.autoComplete, clearable: this.clearable, disabled: this.disabled, hint: this.hint, icon: this.icon, iconRight: this.iconRight, identifier: this.identifier, label: this.label, labelHidden: this.labelHidden, name: this.name, placeholder: this.placeholder, textPrefix: this.textPrefix, textSuffix: this.textSuffix, readonly: this.readonly, required: this.required, value: this.value, errors: this.errors, errorUpdate: this.errorUpdate, nativeAttributes: this.nativeAttributes, onCatChange: e => {
2823
2822
  e.stopPropagation();
2824
2823
  this.pickr?.setDate(e.detail);
2825
- if (this.value !== e.detail || undefined) {
2824
+ if (this.value !== (e.detail || undefined)) {
2826
2825
  this.value = e.detail || undefined;
2827
2826
  this.catChange.emit(this.value);
2828
- console.log(this.value);
2829
2827
  }
2830
2828
  }, onCatFocus: e => {
2831
2829
  e.stopPropagation();
@@ -2835,6 +2833,17 @@ const CatDatepickerFlat = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
2835
2833
  this.catBlur.emit(e.detail);
2836
2834
  } }));
2837
2835
  }
2836
+ get dateFormat() {
2837
+ if (this.mode === 'week') {
2838
+ return 'W';
2839
+ }
2840
+ else if (this.mode === 'time') {
2841
+ return 'H:i';
2842
+ }
2843
+ else {
2844
+ return 'Z';
2845
+ }
2846
+ }
2838
2847
  static get style() { return catDatepickerCss; }
2839
2848
  }, [1, "cat-datepicker", {
2840
2849
  "requiredMarker": [1, "required-marker"],