@haiilo/catalyst 5.4.0 → 6.0.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.
- package/dist/catalyst/catalyst.css +1071 -0
- package/dist/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/catalyst.esm.js.map +1 -1
- package/dist/catalyst/index.cdn.js +6 -0
- package/dist/catalyst/index.esm.js +2 -2
- package/dist/catalyst/index.esm.js.map +1 -1
- package/dist/catalyst/p-ad5fca6b.entry.js +10 -0
- package/dist/catalyst/p-ad5fca6b.entry.js.map +1 -0
- package/dist/catalyst/p-d7dc291a.js +2 -0
- package/dist/catalyst/p-d7dc291a.js.map +1 -0
- package/dist/catalyst/scss/index.scss +2 -0
- package/dist/catalyst/scss/vendor/_flatpickr.scss +314 -0
- package/dist/cjs/{cat-alert_27.cjs.entry.js → cat-alert_25.cjs.entry.js} +2922 -3480
- package/dist/cjs/cat-alert_25.cjs.entry.js.map +1 -0
- package/dist/cjs/{cat-icon-registry-228164a1.js → cat-icon-registry-6161e2ee.js} +14 -2
- package/dist/cjs/cat-icon-registry-6161e2ee.js.map +1 -0
- package/dist/cjs/catalyst.cjs.js +1 -1
- package/dist/cjs/index.cjs.js +12 -14
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +0 -2
- package/dist/collection/components/cat-avatar/cat-avatar.js +5 -5
- package/dist/collection/components/cat-avatar/cat-avatar.js.map +1 -1
- package/dist/collection/components/cat-button/cat-button.js +5 -7
- package/dist/collection/components/cat-button/cat-button.js.map +1 -1
- package/dist/collection/components/cat-checkbox/cat-checkbox.js +39 -42
- package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
- package/dist/collection/components/cat-datepicker/cat-datepicker.config.js +22 -0
- package/dist/collection/components/cat-datepicker/cat-datepicker.config.js.map +1 -0
- package/dist/collection/components/cat-datepicker/cat-datepicker.css +6 -369
- package/dist/collection/components/cat-datepicker/cat-datepicker.js +110 -314
- package/dist/collection/components/cat-datepicker/cat-datepicker.js.map +1 -1
- package/dist/collection/components/cat-datepicker/cat-datepicker.locale.js +51 -0
- package/dist/collection/components/cat-datepicker/cat-datepicker.locale.js.map +1 -0
- package/dist/collection/components/cat-dropdown/cat-dropdown.js +6 -9
- package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
- package/dist/collection/components/cat-form-group/cat-form-group.js +4 -5
- package/dist/collection/components/cat-form-group/cat-form-group.js.map +1 -1
- package/dist/collection/components/cat-form-hint/cat-form-hint.js +2 -6
- package/dist/collection/components/cat-form-hint/cat-form-hint.js.map +1 -1
- package/dist/collection/components/cat-i18n/cat-i18n-registry.js +13 -1
- package/dist/collection/components/cat-i18n/cat-i18n-registry.js.map +1 -1
- package/dist/collection/components/cat-input/cat-input.css +0 -377
- package/dist/collection/components/cat-input/cat-input.js +14 -40
- package/dist/collection/components/cat-input/cat-input.js.map +1 -1
- package/dist/collection/components/cat-input/input-type.js.map +1 -1
- package/dist/collection/components/cat-notification/cat-notification.js +11 -13
- package/dist/collection/components/cat-notification/cat-notification.js.map +1 -1
- package/dist/collection/components/cat-pagination/cat-pagination.js +2 -2
- package/dist/collection/components/cat-pagination/cat-pagination.js.map +1 -1
- package/dist/collection/components/cat-radio/cat-radio.js +11 -36
- package/dist/collection/components/cat-radio/cat-radio.js.map +1 -1
- package/dist/collection/components/cat-radio-group/cat-radio-group.js +37 -11
- package/dist/collection/components/cat-radio-group/cat-radio-group.js.map +1 -1
- package/dist/collection/components/cat-scrollable/cat-scrollable.js +2 -3
- package/dist/collection/components/cat-scrollable/cat-scrollable.js.map +1 -1
- package/dist/collection/components/cat-select/cat-select.js +42 -53
- package/dist/collection/components/cat-select/cat-select.js.map +1 -1
- package/dist/collection/components/cat-select-demo/cat-select-demo.js +21 -25
- package/dist/collection/components/cat-select-demo/cat-select-demo.js.map +1 -1
- package/dist/collection/components/cat-tabs/cat-tabs.js +4 -7
- package/dist/collection/components/cat-tabs/cat-tabs.js.map +1 -1
- package/dist/collection/components/cat-textarea/cat-textarea.js +17 -21
- package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
- package/dist/collection/components/cat-toggle/cat-toggle.js +38 -41
- package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
- package/dist/collection/components/cat-tooltip/cat-tooltip.js +17 -22
- package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -1
- package/dist/collection/index.cdn.js +6 -0
- package/dist/collection/scss/index.scss +2 -0
- package/dist/collection/scss/vendor/_flatpickr.scss +314 -0
- package/dist/collection/utils/platform.js +1 -1
- package/dist/collection/utils/platform.js.map +1 -1
- package/dist/components/cat-avatar2.js +5 -5
- package/dist/components/cat-avatar2.js.map +1 -1
- package/dist/components/cat-button2.js +6 -8
- package/dist/components/cat-button2.js.map +1 -1
- package/dist/components/cat-checkbox2.js +14 -15
- package/dist/components/cat-checkbox2.js.map +1 -1
- package/dist/components/cat-datepicker.js +2725 -3028
- package/dist/components/cat-datepicker.js.map +1 -1
- package/dist/components/cat-dropdown2.js +6 -9
- package/dist/components/cat-dropdown2.js.map +1 -1
- package/dist/components/cat-form-group.js +4 -5
- package/dist/components/cat-form-group.js.map +1 -1
- package/dist/components/cat-form-hint.js +2 -6
- package/dist/components/cat-form-hint.js.map +1 -1
- package/dist/components/cat-i18n-registry.js +13 -1
- package/dist/components/cat-i18n-registry.js.map +1 -1
- package/dist/components/cat-input2.js +9 -16
- package/dist/components/cat-input2.js.map +1 -1
- package/dist/components/cat-pagination.js.map +1 -1
- package/dist/components/cat-radio-group.js +15 -9
- package/dist/components/cat-radio-group.js.map +1 -1
- package/dist/components/cat-radio.js +5 -12
- package/dist/components/cat-radio.js.map +1 -1
- package/dist/components/cat-scrollable2.js +2 -3
- package/dist/components/cat-scrollable2.js.map +1 -1
- package/dist/components/cat-select-demo.js +21 -25
- package/dist/components/cat-select-demo.js.map +1 -1
- package/dist/components/cat-select2.js +42 -53
- package/dist/components/cat-select2.js.map +1 -1
- package/dist/components/cat-tabs.js +4 -7
- package/dist/components/cat-tabs.js.map +1 -1
- package/dist/components/cat-textarea.js +11 -11
- package/dist/components/cat-textarea.js.map +1 -1
- package/dist/components/cat-toggle.js +14 -15
- package/dist/components/cat-toggle.js.map +1 -1
- package/dist/components/cat-tooltip.js +17 -22
- package/dist/components/cat-tooltip.js.map +1 -1
- package/dist/components/floating-ui.dom.esm.js +55 -68
- package/dist/components/floating-ui.dom.esm.js.map +1 -1
- package/dist/components/index.js +11 -13
- package/dist/components/index.js.map +1 -1
- package/dist/esm/{cat-alert_27.entry.js → cat-alert_25.entry.js} +2922 -3478
- package/dist/esm/cat-alert_25.entry.js.map +1 -0
- package/dist/esm/{cat-icon-registry-4bd597f4.js → cat-icon-registry-f15b29d9.js} +14 -2
- package/dist/esm/cat-icon-registry-f15b29d9.js.map +1 -0
- package/dist/esm/catalyst.js +1 -1
- package/dist/esm/index.js +13 -15
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/@types/Intl.d.ts +3 -0
- package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +11 -9
- package/dist/types/components/cat-datepicker/cat-datepicker.config.d.ts +1 -0
- package/dist/types/components/cat-datepicker/cat-datepicker.d.ts +21 -65
- package/dist/types/components/cat-datepicker/cat-datepicker.locale.d.ts +3 -0
- package/dist/types/components/cat-i18n/cat-i18n-registry.d.ts +3 -0
- package/dist/types/components/cat-input/cat-input.d.ts +2 -6
- package/dist/types/components/cat-input/input-type.d.ts +1 -1
- package/dist/types/components/cat-pagination/cat-pagination.d.ts +1 -1
- package/dist/types/components/cat-radio/cat-radio.d.ts +3 -7
- package/dist/types/components/cat-radio-group/cat-radio-group.d.ts +6 -1
- package/dist/types/components/cat-textarea/cat-textarea.d.ts +4 -4
- package/dist/types/components/cat-toggle/cat-toggle.d.ts +10 -8
- package/dist/types/components.d.ts +83 -417
- package/package.json +8 -10
- package/dist/catalyst/p-34e0cbba.entry.js +0 -10
- package/dist/catalyst/p-34e0cbba.entry.js.map +0 -1
- package/dist/catalyst/p-cf32399c.js +0 -2
- package/dist/catalyst/p-cf32399c.js.map +0 -1
- package/dist/cjs/cat-alert_27.cjs.entry.js.map +0 -1
- package/dist/cjs/cat-icon-registry-228164a1.js.map +0 -1
- package/dist/collection/components/cat-datepicker/datepicker-type.js +0 -8
- package/dist/collection/components/cat-datepicker/datepicker-type.js.map +0 -1
- package/dist/collection/components/cat-datepicker/dayjs.config.js +0 -8
- package/dist/collection/components/cat-datepicker/dayjs.config.js.map +0 -1
- package/dist/collection/components/cat-datepicker/vanillajs-datepicker.config.js +0 -46
- package/dist/collection/components/cat-datepicker/vanillajs-datepicker.config.js.map +0 -1
- package/dist/collection/components/cat-label/cat-label.css +0 -22
- package/dist/collection/components/cat-label/cat-label.js +0 -134
- package/dist/collection/components/cat-label/cat-label.js.map +0 -1
- package/dist/collection/components/cat-timepicker/cat-timepicker.css +0 -5
- package/dist/collection/components/cat-timepicker/cat-timepicker.js +0 -668
- package/dist/collection/components/cat-timepicker/cat-timepicker.js.map +0 -1
- package/dist/components/cat-label.d.ts +0 -11
- package/dist/components/cat-label.js +0 -73
- package/dist/components/cat-label.js.map +0 -1
- package/dist/components/cat-timepicker.d.ts +0 -11
- package/dist/components/cat-timepicker.js +0 -258
- package/dist/components/cat-timepicker.js.map +0 -1
- package/dist/esm/cat-alert_27.entry.js.map +0 -1
- package/dist/esm/cat-icon-registry-4bd597f4.js.map +0 -1
- package/dist/types/components/cat-datepicker/datepicker-type.d.ts +0 -7
- package/dist/types/components/cat-datepicker/datepicker.d.ts +0 -1
- package/dist/types/components/cat-datepicker/dayjs.config.d.ts +0 -3
- package/dist/types/components/cat-datepicker/vanillajs-datepicker.config.d.ts +0 -4
- package/dist/types/components/cat-label/cat-label.d.ts +0 -27
- package/dist/types/components/cat-timepicker/cat-timepicker.d.ts +0 -158
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"c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AAC;EAEO,SAAS,CAAC,KAAc;IAC7B,KAAqB,CAAC,eAAe,EAAE,CAAC;IACzC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAmB,CAAC,CAAC;EACzC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Prop, State } from '@stencil/core';\n// import log from 'loglevel';\nimport { ErrorMap } from '../cat-form-hint/cat-form-hint';\n// import { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\nimport { of } from 'rxjs';\nimport { CatSelectMultipleTaggingValue, CatSelectState, CatSelectTaggingValue, Item } from '../cat-select/cat-select';\nimport { Placement } from '@floating-ui/dom';\n// import IMask from 'imask';\n\ninterface Time extends Item {\n hour: number;\n minutes: number;\n}\n\n/**\n * Inputs are used to allow users to provide text input when the expected input\n * is short. As well as plain text, Input supports various types of text,\n * including passwords and numbers.\n *\n * @slot hint - Optional hint element to be displayed with the input.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part label - The label content.\n * @part prefix - The text prefix.\n * @part suffix - The text suffix.\n */\n@Component({\n tag: 'cat-timepicker',\n styleUrl: 'cat-timepicker.scss',\n shadow: true\n})\nexport class CatTimepicker {\n private timeSelect?: HTMLCatSelectElement;\n // private timeMask?: IMask.InputMask<IMask.AnyMaskedOptions>;\n\n @Element() hostElement!: HTMLElement;\n\n @State() state?: CatSelectState;\n\n @State() hasSlottedLabel = false;\n\n @State() hasSlottedHint = false;\n\n @State() errorMap?: ErrorMap;\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 * Enable multiple selection.\n */\n @Prop() multiple = false;\n\n /**\n * The placement of the select.\n */\n @Prop() placement: Placement = 'bottom-start';\n\n /**\n * The value of the select. <br />\n * <br />\n * The value of the select depends on whether it is allowed to choose a single item or several items. <br />\n * When only one item can be selected, the value is the id of the item, in case several items can be selected, the value is an array of ids of the selected items. <br />\n * <br />\n * In case the user can add new items to the select (tags activated), the value in the single select is an object (CatSelectTaggingValue) with the id of the item or the name of the created item,\n * in the case of multiple select, it is an object (CatSelectMultipleTaggingValue) with the array of the ids of the items selected and the array of the names of the items created\n */\n @Prop({ mutable: true }) value?: string | string[] | CatSelectTaggingValue | CatSelectMultipleTaggingValue;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * The placeholder text to display within the select.\n */\n @Prop() placeholder?: string;\n\n /**\n * Optional hint text(s) to be displayed with the input.\n */\n @Prop() hint?: string | string[];\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 * 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 * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A value is required or must be checked for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * Whether the select should show a clear button.\n */\n @Prop() clearable = false;\n\n /**\n * A maximum value for date, time and numeric values.\n */\n @Prop() max?: string;\n\n /**\n * A minimum value for date, time and numeric values.\n */\n @Prop() min?: string;\n\n /**\n * The text to display in the dropdown if no results are found.\n */\n @Prop() noItems?: 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 * Attributes that will be added to the native HTML input element.\n */\n @Prop() minutesStep = 30;\n\n /**\n * Attributes that will be added to the native HTML input element.\n */\n @Prop() hourShort = this.isBrowserHour12();\n\n /**\n * Emitted when the select dropdown is opened.\n */\n @Event() catOpen!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the select dropdown is closed.\n */\n @Event() catClose!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the select loses the focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n this.hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n }\n\n componentDidLoad(): void {\n this.timeSelect?.connect(this.timeConnector);\n\n // IMask spike\n // const input = this.hostElement.shadowRoot?.querySelector('cat-select')?.shadowRoot?.querySelector('input');\n // if (input) {\n // this.timeMask = this.getTimeMask(input);\n // }\n }\n\n render() {\n return (\n <Host>\n <cat-select\n requiredMarker={this.requiredMarker}\n horizontal={this.horizontal}\n clearable={this.clearable}\n disabled={this.disabled}\n hint={this.hint}\n identifier={this.identifier}\n label={this.label}\n labelHidden={this.labelHidden}\n name={this.name}\n multiple={this.multiple}\n placeholder={this.placeholder}\n placement={this.placement}\n required={this.required}\n noItems={this.noItems}\n ref={el => (this.timeSelect = el)}\n value={this.value}\n errors={this.errors}\n errorUpdate={this.errorUpdate}\n nativeAttributes={this.nativeAttributes}\n onCatChange={event => this.onCatChange(event)}\n onCatOpen={this.onCatOpen.bind(this)}\n onCatClose={this.onCatClose.bind(this)}\n onCatBlur={this.onCatBlur.bind(this)}\n >\n {this.hasSlottedLabel && (\n <span slot=\"label\">\n <slot name=\"label\"></slot>\n </span>\n )}\n {this.hasSlottedHint && (\n <span slot=\"hint\">\n <slot name=\"hint\"></slot>\n </span>\n )}\n </cat-select>\n </Host>\n );\n }\n\n private get timeConnector() {\n return {\n resolve: (times: string[]) => {\n return of(\n times.map(t =>\n this.timeArray.find(time => time.hour === this.getHour(t) && time.minutes === this.getMinutes(t))\n )\n );\n },\n retrieve: (term: string) => {\n const filteredTimeArray = this.timeArray.filter(t => {\n if (!term) return true;\n const formatedTime = this.hourShort ? this.formatAMPM(t.hour, t.minutes) : this.formatTime(t.hour, t.minutes);\n return formatedTime.toUpperCase().includes(term.toUpperCase());\n });\n return of({\n last: true,\n totalElements: filteredTimeArray.length,\n content: filteredTimeArray\n });\n },\n render: ({ hour, minutes }: Time) => ({\n label: this.hourShort ? this.formatAMPM(hour, minutes) : this.formatTime(hour, minutes)\n })\n };\n }\n\n private get timeArray() {\n const times: Time[] = [];\n for (let hour = 0; hour < 24; hour++) {\n for (let minutes = 0; minutes < 60; minutes += this.minutesStep) {\n if (this.isHigherThanMinValue(hour, minutes) && this.isLowerThanMaxValue(hour, minutes)) {\n times.push({\n id: this.hourShort ? this.formatAMPM(hour, minutes) : this.formatTime(hour, minutes),\n hour,\n minutes\n });\n }\n }\n }\n return times;\n }\n\n private isBrowserHour12() {\n const browserLanguage = window?.navigator?.language ?? 'en';\n const hour = new Intl.DateTimeFormat(browserLanguage, { hour: 'numeric' }).format(new Date().setHours(16));\n return hour.toLowerCase().includes('pm' || 'am');\n }\n\n private getHour(time: string) {\n let hour = Number(time.split(':')[0]);\n if (time.toLowerCase().includes('pm') && hour < 12) hour = hour + 12;\n if (time.toLowerCase().includes('am') && hour == 12) hour = hour - 12;\n\n return hour;\n }\n\n private getMinutes(time: string) {\n const minutes = time.match(/:(\\d+)/);\n return Number(minutes ? minutes[1] : 0);\n }\n\n private isHigherThanMinValue(hour: number, minutes: number) {\n if (this.min) {\n const minHour = this.getHour(this.min);\n const minMinutes = this.getMinutes(this.min);\n\n return hour > minHour || (hour === minHour && minutes >= minMinutes);\n }\n\n return true;\n }\n\n private isLowerThanMaxValue(hour: number, minutes: number) {\n if (this.max) {\n const maxHour = this.getHour(this.max);\n const maxMinutes = this.getMinutes(this.max);\n\n return hour < maxHour || (hour === maxHour && minutes <= maxMinutes);\n }\n\n return true;\n }\n\n private formatAMPM(hour: number, minutes: number) {\n if (hour === 0) {\n return `12:${minutes < 10 ? `0${minutes}` : minutes} AM`;\n } else if (hour < 12) {\n return `${hour < 10 ? `0${hour}` : hour}:${minutes < 10 ? `0${minutes}` : minutes} AM`;\n } else {\n return `${hour % 12 < 10 ? `0${hour % 12}` : hour % 12}:${minutes < 10 ? `0${minutes}` : minutes} PM`;\n }\n }\n\n private formatTime(hour: number, minutes: number) {\n return `${hour < 10 ? `0${hour}` : hour}:${minutes < 10 ? `0${minutes}` : minutes}`;\n }\n\n private onCatChange(event: unknown) {\n (event as CustomEvent).stopPropagation();\n this.value = this.timeSelect?.value;\n this.catChange.emit(event);\n }\n\n private onCatOpen(event: unknown) {\n (event as CustomEvent).stopPropagation();\n this.catOpen.emit(event as FocusEvent);\n }\n\n private onCatClose(event: unknown) {\n (event as CustomEvent).stopPropagation();\n this.catClose.emit(event as FocusEvent);\n }\n\n private onCatBlur(event: unknown) {\n (event as CustomEvent).stopPropagation();\n this.catBlur.emit(event as FocusEvent);\n }\n\n // IMask spike\n\n // private getTimeMask(element: HTMLInputElement): IMask.InputMask<IMask.AnyMaskedOptions> {\n // return IMask(element, {\n // mask: 'HH:MM[ PM]',\n // lazy: true,\n // blocks: {\n // HH: {\n // mask: IMask.MaskedRange,\n // from: 0,\n // to: 23\n // },\n\n // MM: {\n // mask: IMask.MaskedRange,\n // from: 0,\n // to: 59\n // },\n\n // PM: {\n // mask: IMask.MaskedEnum,\n // enum: ['AM', 'PM', 'am', 'pm']\n // }\n // }\n // });\n // }\n}\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
|
2
|
-
|
|
3
|
-
interface CatLabel extends Components.CatLabel, HTMLElement {}
|
|
4
|
-
export const CatLabel: {
|
|
5
|
-
prototype: CatLabel;
|
|
6
|
-
new (): CatLabel;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import { c as catI18nRegistry } from './cat-i18n-registry.js';
|
|
3
|
-
|
|
4
|
-
const catLabelCss = ":host{display:inline-flex;align-items:center;min-height:2.5rem}:host([hidden]){display:none}.input-optional{margin-left:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 81, 92, 108))}";
|
|
5
|
-
|
|
6
|
-
const CatLabel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
this.__registerHost();
|
|
10
|
-
this.__attachShadow();
|
|
11
|
-
this.requiredMarker = 'optional';
|
|
12
|
-
this.horizontal = false;
|
|
13
|
-
this.for = undefined;
|
|
14
|
-
this.required = false;
|
|
15
|
-
}
|
|
16
|
-
onClick() {
|
|
17
|
-
var _a;
|
|
18
|
-
if (this.for) {
|
|
19
|
-
// focus target that is possibly hidden inside a shadow root
|
|
20
|
-
(_a = (document.getElementById(this.for) || this.findShadowTarget(this.for))) === null || _a === void 0 ? void 0 : _a.focus();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
render() {
|
|
24
|
-
return (h(Host, null, h("label", { htmlFor: this.for, onClick: this.onClick.bind(this) }, h("slot", null), !this.required && this.requiredMarker.startsWith('optional') && (h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.required'), ")")))));
|
|
25
|
-
}
|
|
26
|
-
findShadowTarget(id) {
|
|
27
|
-
var _a;
|
|
28
|
-
for (let i = 0; i < CatLabel$1.SHADOW_TARGETS.length; i++) {
|
|
29
|
-
const elems = document.getElementsByTagName(CatLabel$1.SHADOW_TARGETS[i]);
|
|
30
|
-
for (let i = 0; i < elems.length; i++) {
|
|
31
|
-
const target = (_a = elems[i].shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById(id);
|
|
32
|
-
if (target) {
|
|
33
|
-
return target;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
static get style() { return catLabelCss; }
|
|
40
|
-
}, [1, "cat-label", {
|
|
41
|
-
"requiredMarker": [1, "required-marker"],
|
|
42
|
-
"horizontal": [4],
|
|
43
|
-
"for": [1],
|
|
44
|
-
"required": [4]
|
|
45
|
-
}]);
|
|
46
|
-
CatLabel$1.SHADOW_TARGETS = [
|
|
47
|
-
'CAT-INPUT',
|
|
48
|
-
'CAT-TEXTAREA',
|
|
49
|
-
'CAT-CHECKBOX',
|
|
50
|
-
'CAT-TOGGLE',
|
|
51
|
-
'CAT-RADIO',
|
|
52
|
-
'CAT-SELECT'
|
|
53
|
-
];
|
|
54
|
-
function defineCustomElement$1() {
|
|
55
|
-
if (typeof customElements === "undefined") {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const components = ["cat-label"];
|
|
59
|
-
components.forEach(tagName => { switch (tagName) {
|
|
60
|
-
case "cat-label":
|
|
61
|
-
if (!customElements.get(tagName)) {
|
|
62
|
-
customElements.define(tagName, CatLabel$1);
|
|
63
|
-
}
|
|
64
|
-
break;
|
|
65
|
-
} });
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const CatLabel = CatLabel$1;
|
|
69
|
-
const defineCustomElement = defineCustomElement$1;
|
|
70
|
-
|
|
71
|
-
export { CatLabel, defineCustomElement };
|
|
72
|
-
|
|
73
|
-
//# sourceMappingURL=cat-label.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"cat-label.js","mappings":";;;AAAA,MAAM,WAAW,GAAG,sQAAsQ;;MCa7QA,UAAQ;;;;;0BAa8E,UAAU;sBAKtF,KAAK;;oBAUP,KAAK;;EAExB,OAAO;;IACL,IAAI,IAAI,CAAC,GAAG,EAAE;;MAEZ,OAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,0CAAE,KAAK,EAAE,CAAC;KACjF;GACF;EAED,MAAM;IACJ,QACE,EAAC,IAAI,QACH,aAAO,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IACxD,eAAa,EACZ,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,UAAU,CAAC,KAC3D,YAAM,KAAK,EAAC,gBAAgB,iBAAa,MAAM,SAC3CC,eAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,MACrB,CACR,EACA,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,UAAU,CAAC,KAC1D,YAAM,KAAK,EAAC,gBAAgB,iBAAa,MAAM,SAC3CA,eAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,MACrB,CACR,CACK,CACH,EACP;GACH;EAEO,gBAAgB,CAAC,EAAU;;IACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAGD,UAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;MACvD,MAAM,KAAK,GAAG,QAAQ,CAAC,oBAAoB,CAACA,UAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;MACxE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,MAAM,MAAM,GAAG,MAAA,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,0CAAE,cAAc,CAAC,EAAE,CAAC,CAAC;QACvD,IAAI,MAAM,EAAE;UACV,OAAO,MAAM,CAAC;SACf;OACF;KACF;IACD,OAAO,IAAI,CAAC;GACb;;;;;;;;AAnEuBA,yBAAc,GAAG;EACvC,WAAW;EACX,cAAc;EACd,cAAc;EACd,YAAY;EACZ,WAAW;EACX,YAAY;CACb,CAAC;;;;;;;;;;;;;;;;;;;;","names":["CatLabel","i18n"],"sources":["./src/components/cat-label/cat-label.scss?tag=cat-label&encapsulation=shadow","./src/components/cat-label/cat-label.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n\n:host {\n display: inline-flex;\n align-items: center;\n min-height: 2.5rem;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.input-optional {\n margin-left: 0.25rem;\n @include cat-body('xs');\n color: cat-token('color.ui.font.muted');\n}\n","import { Component, h, Host, Prop } from '@stencil/core';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\n\n/**\n * Labels are used to provide a short description of an input or form element.\n *\n * @deprecated Use label attribute of form elements instead.\n */\n@Component({\n tag: 'cat-label',\n styleUrl: 'cat-label.scss',\n shadow: true\n})\nexport class CatLabel {\n private static readonly SHADOW_TARGETS = [\n 'CAT-INPUT',\n 'CAT-TEXTAREA',\n 'CAT-CHECKBOX',\n 'CAT-TOGGLE',\n 'CAT-RADIO',\n 'CAT-SELECT'\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 * The unique identifier for a referenced input.\n */\n @Prop() for?: string;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n onClick() {\n if (this.for) {\n // focus target that is possibly hidden inside a shadow root\n (document.getElementById(this.for) || this.findShadowTarget(this.for))?.focus();\n }\n }\n\n render() {\n return (\n <Host>\n <label htmlFor={this.for} onClick={this.onClick.bind(this)}>\n <slot></slot>\n {!this.required && this.requiredMarker.startsWith('optional') && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({i18n.t('input.optional')})\n </span>\n )}\n {this.required && this.requiredMarker.startsWith('required') && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({i18n.t('input.required')})\n </span>\n )}\n </label>\n </Host>\n );\n }\n\n private findShadowTarget(id: string): HTMLElement | null {\n for (let i = 0; i < CatLabel.SHADOW_TARGETS.length; i++) {\n const elems = document.getElementsByTagName(CatLabel.SHADOW_TARGETS[i]);\n for (let i = 0; i < elems.length; i++) {\n const target = elems[i].shadowRoot?.getElementById(id);\n if (target) {\n return target;\n }\n }\n }\n return null;\n }\n}\n"],"version":3}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
|
2
|
-
|
|
3
|
-
interface CatTimepicker extends Components.CatTimepicker, HTMLElement {}
|
|
4
|
-
export const CatTimepicker: {
|
|
5
|
-
prototype: CatTimepicker;
|
|
6
|
-
new (): CatTimepicker;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import { d as defineCustomElement$9 } from './cat-avatar2.js';
|
|
3
|
-
import { d as defineCustomElement$8 } from './cat-button2.js';
|
|
4
|
-
import { d as defineCustomElement$7 } from './cat-checkbox2.js';
|
|
5
|
-
import { d as defineCustomElement$6 } from './cat-icon2.js';
|
|
6
|
-
import { d as defineCustomElement$5 } from './cat-scrollable2.js';
|
|
7
|
-
import { o as of, d as defineCustomElement$4 } from './cat-select2.js';
|
|
8
|
-
import { d as defineCustomElement$3 } from './cat-skeleton2.js';
|
|
9
|
-
import { d as defineCustomElement$2 } from './cat-spinner2.js';
|
|
10
|
-
|
|
11
|
-
const catTimepickerCss = "";
|
|
12
|
-
|
|
13
|
-
const CatTimepicker$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
14
|
-
constructor() {
|
|
15
|
-
super();
|
|
16
|
-
this.__registerHost();
|
|
17
|
-
this.__attachShadow();
|
|
18
|
-
this.catOpen = createEvent(this, "catOpen", 7);
|
|
19
|
-
this.catClose = createEvent(this, "catClose", 7);
|
|
20
|
-
this.catChange = createEvent(this, "catChange", 7);
|
|
21
|
-
this.catBlur = createEvent(this, "catBlur", 7);
|
|
22
|
-
this.state = undefined;
|
|
23
|
-
this.hasSlottedLabel = false;
|
|
24
|
-
this.hasSlottedHint = false;
|
|
25
|
-
this.errorMap = undefined;
|
|
26
|
-
this.requiredMarker = 'optional';
|
|
27
|
-
this.horizontal = false;
|
|
28
|
-
this.multiple = false;
|
|
29
|
-
this.placement = 'bottom-start';
|
|
30
|
-
this.value = undefined;
|
|
31
|
-
this.disabled = false;
|
|
32
|
-
this.placeholder = undefined;
|
|
33
|
-
this.hint = undefined;
|
|
34
|
-
this.identifier = undefined;
|
|
35
|
-
this.label = '';
|
|
36
|
-
this.name = undefined;
|
|
37
|
-
this.labelHidden = false;
|
|
38
|
-
this.required = false;
|
|
39
|
-
this.clearable = false;
|
|
40
|
-
this.max = undefined;
|
|
41
|
-
this.min = undefined;
|
|
42
|
-
this.noItems = undefined;
|
|
43
|
-
this.errors = undefined;
|
|
44
|
-
this.errorUpdate = 0;
|
|
45
|
-
this.nativeAttributes = undefined;
|
|
46
|
-
this.minutesStep = 30;
|
|
47
|
-
this.hourShort = this.isBrowserHour12();
|
|
48
|
-
}
|
|
49
|
-
componentWillRender() {
|
|
50
|
-
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
|
|
51
|
-
this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
|
|
52
|
-
}
|
|
53
|
-
componentDidLoad() {
|
|
54
|
-
var _a;
|
|
55
|
-
(_a = this.timeSelect) === null || _a === void 0 ? void 0 : _a.connect(this.timeConnector);
|
|
56
|
-
// IMask spike
|
|
57
|
-
// const input = this.hostElement.shadowRoot?.querySelector('cat-select')?.shadowRoot?.querySelector('input');
|
|
58
|
-
// if (input) {
|
|
59
|
-
// this.timeMask = this.getTimeMask(input);
|
|
60
|
-
// }
|
|
61
|
-
}
|
|
62
|
-
render() {
|
|
63
|
-
return (h(Host, null, h("cat-select", { requiredMarker: this.requiredMarker, horizontal: this.horizontal, clearable: this.clearable, disabled: this.disabled, hint: this.hint, identifier: this.identifier, label: this.label, labelHidden: this.labelHidden, name: this.name, multiple: this.multiple, placeholder: this.placeholder, placement: this.placement, required: this.required, noItems: this.noItems, ref: el => (this.timeSelect = el), value: this.value, errors: this.errors, errorUpdate: this.errorUpdate, nativeAttributes: this.nativeAttributes, onCatChange: event => this.onCatChange(event), onCatOpen: this.onCatOpen.bind(this), onCatClose: this.onCatClose.bind(this), onCatBlur: this.onCatBlur.bind(this) }, this.hasSlottedLabel && (h("span", { slot: "label" }, h("slot", { name: "label" }))), this.hasSlottedHint && (h("span", { slot: "hint" }, h("slot", { name: "hint" }))))));
|
|
64
|
-
}
|
|
65
|
-
get timeConnector() {
|
|
66
|
-
return {
|
|
67
|
-
resolve: (times) => {
|
|
68
|
-
return of(times.map(t => this.timeArray.find(time => time.hour === this.getHour(t) && time.minutes === this.getMinutes(t))));
|
|
69
|
-
},
|
|
70
|
-
retrieve: (term) => {
|
|
71
|
-
const filteredTimeArray = this.timeArray.filter(t => {
|
|
72
|
-
if (!term)
|
|
73
|
-
return true;
|
|
74
|
-
const formatedTime = this.hourShort ? this.formatAMPM(t.hour, t.minutes) : this.formatTime(t.hour, t.minutes);
|
|
75
|
-
return formatedTime.toUpperCase().includes(term.toUpperCase());
|
|
76
|
-
});
|
|
77
|
-
return of({
|
|
78
|
-
last: true,
|
|
79
|
-
totalElements: filteredTimeArray.length,
|
|
80
|
-
content: filteredTimeArray
|
|
81
|
-
});
|
|
82
|
-
},
|
|
83
|
-
render: ({ hour, minutes }) => ({
|
|
84
|
-
label: this.hourShort ? this.formatAMPM(hour, minutes) : this.formatTime(hour, minutes)
|
|
85
|
-
})
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
get timeArray() {
|
|
89
|
-
const times = [];
|
|
90
|
-
for (let hour = 0; hour < 24; hour++) {
|
|
91
|
-
for (let minutes = 0; minutes < 60; minutes += this.minutesStep) {
|
|
92
|
-
if (this.isHigherThanMinValue(hour, minutes) && this.isLowerThanMaxValue(hour, minutes)) {
|
|
93
|
-
times.push({
|
|
94
|
-
id: this.hourShort ? this.formatAMPM(hour, minutes) : this.formatTime(hour, minutes),
|
|
95
|
-
hour,
|
|
96
|
-
minutes
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return times;
|
|
102
|
-
}
|
|
103
|
-
isBrowserHour12() {
|
|
104
|
-
var _a, _b;
|
|
105
|
-
const browserLanguage = (_b = (_a = window === null || window === void 0 ? void 0 : window.navigator) === null || _a === void 0 ? void 0 : _a.language) !== null && _b !== void 0 ? _b : 'en';
|
|
106
|
-
const hour = new Intl.DateTimeFormat(browserLanguage, { hour: 'numeric' }).format(new Date().setHours(16));
|
|
107
|
-
return hour.toLowerCase().includes('pm' );
|
|
108
|
-
}
|
|
109
|
-
getHour(time) {
|
|
110
|
-
let hour = Number(time.split(':')[0]);
|
|
111
|
-
if (time.toLowerCase().includes('pm') && hour < 12)
|
|
112
|
-
hour = hour + 12;
|
|
113
|
-
if (time.toLowerCase().includes('am') && hour == 12)
|
|
114
|
-
hour = hour - 12;
|
|
115
|
-
return hour;
|
|
116
|
-
}
|
|
117
|
-
getMinutes(time) {
|
|
118
|
-
const minutes = time.match(/:(\d+)/);
|
|
119
|
-
return Number(minutes ? minutes[1] : 0);
|
|
120
|
-
}
|
|
121
|
-
isHigherThanMinValue(hour, minutes) {
|
|
122
|
-
if (this.min) {
|
|
123
|
-
const minHour = this.getHour(this.min);
|
|
124
|
-
const minMinutes = this.getMinutes(this.min);
|
|
125
|
-
return hour > minHour || (hour === minHour && minutes >= minMinutes);
|
|
126
|
-
}
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
isLowerThanMaxValue(hour, minutes) {
|
|
130
|
-
if (this.max) {
|
|
131
|
-
const maxHour = this.getHour(this.max);
|
|
132
|
-
const maxMinutes = this.getMinutes(this.max);
|
|
133
|
-
return hour < maxHour || (hour === maxHour && minutes <= maxMinutes);
|
|
134
|
-
}
|
|
135
|
-
return true;
|
|
136
|
-
}
|
|
137
|
-
formatAMPM(hour, minutes) {
|
|
138
|
-
if (hour === 0) {
|
|
139
|
-
return `12:${minutes < 10 ? `0${minutes}` : minutes} AM`;
|
|
140
|
-
}
|
|
141
|
-
else if (hour < 12) {
|
|
142
|
-
return `${hour < 10 ? `0${hour}` : hour}:${minutes < 10 ? `0${minutes}` : minutes} AM`;
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
return `${hour % 12 < 10 ? `0${hour % 12}` : hour % 12}:${minutes < 10 ? `0${minutes}` : minutes} PM`;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
formatTime(hour, minutes) {
|
|
149
|
-
return `${hour < 10 ? `0${hour}` : hour}:${minutes < 10 ? `0${minutes}` : minutes}`;
|
|
150
|
-
}
|
|
151
|
-
onCatChange(event) {
|
|
152
|
-
var _a;
|
|
153
|
-
event.stopPropagation();
|
|
154
|
-
this.value = (_a = this.timeSelect) === null || _a === void 0 ? void 0 : _a.value;
|
|
155
|
-
this.catChange.emit(event);
|
|
156
|
-
}
|
|
157
|
-
onCatOpen(event) {
|
|
158
|
-
event.stopPropagation();
|
|
159
|
-
this.catOpen.emit(event);
|
|
160
|
-
}
|
|
161
|
-
onCatClose(event) {
|
|
162
|
-
event.stopPropagation();
|
|
163
|
-
this.catClose.emit(event);
|
|
164
|
-
}
|
|
165
|
-
onCatBlur(event) {
|
|
166
|
-
event.stopPropagation();
|
|
167
|
-
this.catBlur.emit(event);
|
|
168
|
-
}
|
|
169
|
-
get hostElement() { return this; }
|
|
170
|
-
static get style() { return catTimepickerCss; }
|
|
171
|
-
}, [1, "cat-timepicker", {
|
|
172
|
-
"requiredMarker": [1, "required-marker"],
|
|
173
|
-
"horizontal": [4],
|
|
174
|
-
"multiple": [4],
|
|
175
|
-
"placement": [1],
|
|
176
|
-
"value": [1025],
|
|
177
|
-
"disabled": [4],
|
|
178
|
-
"placeholder": [1],
|
|
179
|
-
"hint": [1],
|
|
180
|
-
"identifier": [1],
|
|
181
|
-
"label": [1],
|
|
182
|
-
"name": [1],
|
|
183
|
-
"labelHidden": [4, "label-hidden"],
|
|
184
|
-
"required": [4],
|
|
185
|
-
"clearable": [4],
|
|
186
|
-
"max": [1],
|
|
187
|
-
"min": [1],
|
|
188
|
-
"noItems": [1, "no-items"],
|
|
189
|
-
"errors": [4],
|
|
190
|
-
"errorUpdate": [8, "error-update"],
|
|
191
|
-
"nativeAttributes": [16],
|
|
192
|
-
"minutesStep": [2, "minutes-step"],
|
|
193
|
-
"hourShort": [4, "hour-short"],
|
|
194
|
-
"state": [32],
|
|
195
|
-
"hasSlottedLabel": [32],
|
|
196
|
-
"hasSlottedHint": [32],
|
|
197
|
-
"errorMap": [32]
|
|
198
|
-
}]);
|
|
199
|
-
function defineCustomElement$1() {
|
|
200
|
-
if (typeof customElements === "undefined") {
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
const components = ["cat-timepicker", "cat-avatar", "cat-button", "cat-checkbox", "cat-icon", "cat-scrollable", "cat-select", "cat-skeleton", "cat-spinner"];
|
|
204
|
-
components.forEach(tagName => { switch (tagName) {
|
|
205
|
-
case "cat-timepicker":
|
|
206
|
-
if (!customElements.get(tagName)) {
|
|
207
|
-
customElements.define(tagName, CatTimepicker$1);
|
|
208
|
-
}
|
|
209
|
-
break;
|
|
210
|
-
case "cat-avatar":
|
|
211
|
-
if (!customElements.get(tagName)) {
|
|
212
|
-
defineCustomElement$9();
|
|
213
|
-
}
|
|
214
|
-
break;
|
|
215
|
-
case "cat-button":
|
|
216
|
-
if (!customElements.get(tagName)) {
|
|
217
|
-
defineCustomElement$8();
|
|
218
|
-
}
|
|
219
|
-
break;
|
|
220
|
-
case "cat-checkbox":
|
|
221
|
-
if (!customElements.get(tagName)) {
|
|
222
|
-
defineCustomElement$7();
|
|
223
|
-
}
|
|
224
|
-
break;
|
|
225
|
-
case "cat-icon":
|
|
226
|
-
if (!customElements.get(tagName)) {
|
|
227
|
-
defineCustomElement$6();
|
|
228
|
-
}
|
|
229
|
-
break;
|
|
230
|
-
case "cat-scrollable":
|
|
231
|
-
if (!customElements.get(tagName)) {
|
|
232
|
-
defineCustomElement$5();
|
|
233
|
-
}
|
|
234
|
-
break;
|
|
235
|
-
case "cat-select":
|
|
236
|
-
if (!customElements.get(tagName)) {
|
|
237
|
-
defineCustomElement$4();
|
|
238
|
-
}
|
|
239
|
-
break;
|
|
240
|
-
case "cat-skeleton":
|
|
241
|
-
if (!customElements.get(tagName)) {
|
|
242
|
-
defineCustomElement$3();
|
|
243
|
-
}
|
|
244
|
-
break;
|
|
245
|
-
case "cat-spinner":
|
|
246
|
-
if (!customElements.get(tagName)) {
|
|
247
|
-
defineCustomElement$2();
|
|
248
|
-
}
|
|
249
|
-
break;
|
|
250
|
-
} });
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
const CatTimepicker = CatTimepicker$1;
|
|
254
|
-
const defineCustomElement = defineCustomElement$1;
|
|
255
|
-
|
|
256
|
-
export { CatTimepicker, defineCustomElement };
|
|
257
|
-
|
|
258
|
-
//# sourceMappingURL=cat-timepicker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"cat-timepicker.js","mappings":";;;;;;;;;;AAAA,MAAM,gBAAgB,GAAG,EAAE;;MC8BdA,eAAa;;;;;;;;;;2BAQG,KAAK;0BAEN,KAAK;;0BAOkE,UAAU;sBAKtF,KAAK;oBAKP,KAAK;qBAKO,cAAc;;oBAgB1B,KAAK;;;;iBAoBR,EAAE;;uBAUI,KAAK;oBAKR,KAAK;qBAKJ,KAAK;;;;;uBAgCe,CAAC;;uBAUnB,EAAE;qBAKJ,IAAI,CAAC,eAAe,EAAE;;EAsB1C,mBAAmB;IACjB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC1E,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;GACzE;EAED,gBAAgB;;IACd,MAAA,IAAI,CAAC,UAAU,0CAAE,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;;;;;;GAO9C;EAED,MAAM;IACJ,QACE,EAAC,IAAI,QACH,kBACE,cAAc,EAAE,IAAI,CAAC,cAAc,EACnC,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,SAAS,EAAE,I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,EAAE,GAAG,OAAO,KAAK,CAAC;KACxF;SAAM;MACL,OAAO,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,IAAI,GAAG,EAAE,EAAE,GAAG,IAAI,GAAG,EAAE,IAAI,OAAO,GAAG,EAAE,GAAG,IAAI,OAAO,EAAE,GAAG,OAAO,KAAK,CAAC;KACvG;GACF;EAEO,UAAU,CAAC,IAAY,EAAE,OAAe;IAC9C,OAAO,GAAG,IAAI,GAAG,EAAE,GAAG,IAAI,IAAI,EAAE,GAAG,IAAI,IAAI,OAAO,GAAG,EAAE,GAAG,IAAI,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;GACrF;EAEO,WAAW,CAAC,KAAc;;IAC/B,KAAqB,CAAC,eAAe,EAAE,CAAC;IACzC,IAAI,CAAC,KAAK,GAAG,MAAA,IAAI,CAAC,UAAU,0CAAE,KAAK,CAAC;IACpC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC5B;EAEO,SAAS,CAAC,KAAc;IAC7B,KAAqB,CAAC,eAAe,EAAE,CAAC;IACzC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAmB,CAAC,CAAC;GACxC;EAEO,UAAU,CAAC,KAAc;IAC9B,KAAqB,CAAC,eAAe,EAAE,CAAC;IACzC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAmB,CAAC,CAAC;GACzC;EAEO,SAAS,CAAC,KAAc;IAC7B,KAAqB,CAAC,eAAe,EAAE,CAAC;IACzC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAmB,CAAC,CAAC;GACxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatTimepicker"],"sources":["./src/components/cat-timepicker/cat-timepicker.scss?tag=cat-timepicker&encapsulation=shadow","./src/components/cat-timepicker/cat-timepicker.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n","import { Component, Element, Event, EventEmitter, h, Host, Prop, State } from '@stencil/core';\n// import log from 'loglevel';\nimport { ErrorMap } from '../cat-form-hint/cat-form-hint';\n// import { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\nimport { of } from 'rxjs';\nimport { CatSelectMultipleTaggingValue, CatSelectState, CatSelectTaggingValue, Item } from '../cat-select/cat-select';\nimport { Placement } from '@floating-ui/dom';\n// import IMask from 'imask';\n\ninterface Time extends Item {\n hour: number;\n minutes: number;\n}\n\n/**\n * Inputs are used to allow users to provide text input when the expected input\n * is short. As well as plain text, Input supports various types of text,\n * including passwords and numbers.\n *\n * @slot hint - Optional hint element to be displayed with the input.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part label - The label content.\n * @part prefix - The text prefix.\n * @part suffix - The text suffix.\n */\n@Component({\n tag: 'cat-timepicker',\n styleUrl: 'cat-timepicker.scss',\n shadow: true\n})\nexport class CatTimepicker {\n private timeSelect?: HTMLCatSelectElement;\n // private timeMask?: IMask.InputMask<IMask.AnyMaskedOptions>;\n\n @Element() hostElement!: HTMLElement;\n\n @State() state?: CatSelectState;\n\n @State() hasSlottedLabel = false;\n\n @State() hasSlottedHint = false;\n\n @State() errorMap?: ErrorMap;\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 * Enable multiple selection.\n */\n @Prop() multiple = false;\n\n /**\n * The placement of the select.\n */\n @Prop() placement: Placement = 'bottom-start';\n\n /**\n * The value of the select. <br />\n * <br />\n * The value of the select depends on whether it is allowed to choose a single item or several items. <br />\n * When only one item can be selected, the value is the id of the item, in case several items can be selected, the value is an array of ids of the selected items. <br />\n * <br />\n * In case the user can add new items to the select (tags activated), the value in the single select is an object (CatSelectTaggingValue) with the id of the item or the name of the created item,\n * in the case of multiple select, it is an object (CatSelectMultipleTaggingValue) with the array of the ids of the items selected and the array of the names of the items created\n */\n @Prop({ mutable: true }) value?: string | string[] | CatSelectTaggingValue | CatSelectMultipleTaggingValue;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * The placeholder text to display within the select.\n */\n @Prop() placeholder?: string;\n\n /**\n * Optional hint text(s) to be displayed with the input.\n */\n @Prop() hint?: string | string[];\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 * 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 * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A value is required or must be checked for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * Whether the select should show a clear button.\n */\n @Prop() clearable = false;\n\n /**\n * A maximum value for date, time and numeric values.\n */\n @Prop() max?: string;\n\n /**\n * A minimum value for date, time and numeric values.\n */\n @Prop() min?: string;\n\n /**\n * The text to display in the dropdown if no results are found.\n */\n @Prop() noItems?: 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 * Attributes that will be added to the native HTML input element.\n */\n @Prop() minutesStep = 30;\n\n /**\n * Attributes that will be added to the native HTML input element.\n */\n @Prop() hourShort = this.isBrowserHour12();\n\n /**\n * Emitted when the select dropdown is opened.\n */\n @Event() catOpen!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the select dropdown is closed.\n */\n @Event() catClose!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the select loses the focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n this.hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n }\n\n componentDidLoad(): void {\n this.timeSelect?.connect(this.timeConnector);\n\n // IMask spike\n // const input = this.hostElement.shadowRoot?.querySelector('cat-select')?.shadowRoot?.querySelector('input');\n // if (input) {\n // this.timeMask = this.getTimeMask(input);\n // }\n }\n\n render() {\n return (\n <Host>\n <cat-select\n requiredMarker={this.requiredMarker}\n horizontal={this.horizontal}\n clearable={this.clearable}\n disabled={this.disabled}\n hint={this.hint}\n identifier={this.identifier}\n label={this.label}\n labelHidden={this.labelHidden}\n name={this.name}\n multiple={this.multiple}\n placeholder={this.placeholder}\n placement={this.placement}\n required={this.required}\n noItems={this.noItems}\n ref={el => (this.timeSelect = el)}\n value={this.value}\n errors={this.errors}\n errorUpdate={this.errorUpdate}\n nativeAttributes={this.nativeAttributes}\n onCatChange={event => this.onCatChange(event)}\n onCatOpen={this.onCatOpen.bind(this)}\n onCatClose={this.onCatClose.bind(this)}\n onCatBlur={this.onCatBlur.bind(this)}\n >\n {this.hasSlottedLabel && (\n <span slot=\"label\">\n <slot name=\"label\"></slot>\n </span>\n )}\n {this.hasSlottedHint && (\n <span slot=\"hint\">\n <slot name=\"hint\"></slot>\n </span>\n )}\n </cat-select>\n </Host>\n );\n }\n\n private get timeConnector() {\n return {\n resolve: (times: string[]) => {\n return of(\n times.map(t =>\n this.timeArray.find(time => time.hour === this.getHour(t) && time.minutes === this.getMinutes(t))\n )\n );\n },\n retrieve: (term: string) => {\n const filteredTimeArray = this.timeArray.filter(t => {\n if (!term) return true;\n const formatedTime = this.hourShort ? this.formatAMPM(t.hour, t.minutes) : this.formatTime(t.hour, t.minutes);\n return formatedTime.toUpperCase().includes(term.toUpperCase());\n });\n return of({\n last: true,\n totalElements: filteredTimeArray.length,\n content: filteredTimeArray\n });\n },\n render: ({ hour, minutes }: Time) => ({\n label: this.hourShort ? this.formatAMPM(hour, minutes) : this.formatTime(hour, minutes)\n })\n };\n }\n\n private get timeArray() {\n const times: Time[] = [];\n for (let hour = 0; hour < 24; hour++) {\n for (let minutes = 0; minutes < 60; minutes += this.minutesStep) {\n if (this.isHigherThanMinValue(hour, minutes) && this.isLowerThanMaxValue(hour, minutes)) {\n times.push({\n id: this.hourShort ? this.formatAMPM(hour, minutes) : this.formatTime(hour, minutes),\n hour,\n minutes\n });\n }\n }\n }\n return times;\n }\n\n private isBrowserHour12() {\n const browserLanguage = window?.navigator?.language ?? 'en';\n const hour = new Intl.DateTimeFormat(browserLanguage, { hour: 'numeric' }).format(new Date().setHours(16));\n return hour.toLowerCase().includes('pm' || 'am');\n }\n\n private getHour(time: string) {\n let hour = Number(time.split(':')[0]);\n if (time.toLowerCase().includes('pm') && hour < 12) hour = hour + 12;\n if (time.toLowerCase().includes('am') && hour == 12) hour = hour - 12;\n\n return hour;\n }\n\n private getMinutes(time: string) {\n const minutes = time.match(/:(\\d+)/);\n return Number(minutes ? minutes[1] : 0);\n }\n\n private isHigherThanMinValue(hour: number, minutes: number) {\n if (this.min) {\n const minHour = this.getHour(this.min);\n const minMinutes = this.getMinutes(this.min);\n\n return hour > minHour || (hour === minHour && minutes >= minMinutes);\n }\n\n return true;\n }\n\n private isLowerThanMaxValue(hour: number, minutes: number) {\n if (this.max) {\n const maxHour = this.getHour(this.max);\n const maxMinutes = this.getMinutes(this.max);\n\n return hour < maxHour || (hour === maxHour && minutes <= maxMinutes);\n }\n\n return true;\n }\n\n private formatAMPM(hour: number, minutes: number) {\n if (hour === 0) {\n return `12:${minutes < 10 ? `0${minutes}` : minutes} AM`;\n } else if (hour < 12) {\n return `${hour < 10 ? `0${hour}` : hour}:${minutes < 10 ? `0${minutes}` : minutes} AM`;\n } else {\n return `${hour % 12 < 10 ? `0${hour % 12}` : hour % 12}:${minutes < 10 ? `0${minutes}` : minutes} PM`;\n }\n }\n\n private formatTime(hour: number, minutes: number) {\n return `${hour < 10 ? `0${hour}` : hour}:${minutes < 10 ? `0${minutes}` : minutes}`;\n }\n\n private onCatChange(event: unknown) {\n (event as CustomEvent).stopPropagation();\n this.value = this.timeSelect?.value;\n this.catChange.emit(event);\n }\n\n private onCatOpen(event: unknown) {\n (event as CustomEvent).stopPropagation();\n this.catOpen.emit(event as FocusEvent);\n }\n\n private onCatClose(event: unknown) {\n (event as CustomEvent).stopPropagation();\n this.catClose.emit(event as FocusEvent);\n }\n\n private onCatBlur(event: unknown) {\n (event as CustomEvent).stopPropagation();\n this.catBlur.emit(event as FocusEvent);\n }\n\n // IMask spike\n\n // private getTimeMask(element: HTMLInputElement): IMask.InputMask<IMask.AnyMaskedOptions> {\n // return IMask(element, {\n // mask: 'HH:MM[ PM]',\n // lazy: true,\n // blocks: {\n // HH: {\n // mask: IMask.MaskedRange,\n // from: 0,\n // to: 23\n // },\n\n // MM: {\n // mask: IMask.MaskedRange,\n // from: 0,\n // to: 59\n // },\n\n // PM: {\n // mask: IMask.MaskedEnum,\n // enum: ['AM', 'PM', 'am', 'pm']\n // }\n // }\n // });\n // }\n}\n"],"version":3}
|