kanto-ds 1.6.1 → 1.8.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/README.md +66 -13
- package/dist/cdn/kanto.min.js +7272 -0
- package/dist/chunks/{floating-B33g-M_1.js → floating-C9RLa6cZ.js} +2 -2
- package/dist/chunks/floating-C9RLa6cZ.js.map +1 -0
- package/dist/chunks/{index-TWJzttLX.js → index-BEWmAE0T.js} +21 -7
- package/dist/chunks/index-BEWmAE0T.js.map +1 -0
- package/dist/chunks/{kt-calendar-CtwOby1R.js → kt-calendar-D72xa8qr.js} +3 -3
- package/dist/chunks/{kt-calendar-CtwOby1R.js.map → kt-calendar-D72xa8qr.js.map} +1 -1
- package/dist/chunks/{kt-element-T0VbIBNp.js → kt-element-COgh6Yr1.js} +2 -2
- package/dist/chunks/{kt-element-T0VbIBNp.js.map → kt-element-COgh6Yr1.js.map} +1 -1
- package/dist/chunks/numbers-QyecMiSJ.js +9 -0
- package/dist/chunks/numbers-QyecMiSJ.js.map +1 -0
- package/dist/chunks/{segmented-field-BBXR4XFL.js → segmented-field-BCjCGF4I.js} +2 -2
- package/dist/chunks/{segmented-field-BBXR4XFL.js.map → segmented-field-BCjCGF4I.js.map} +1 -1
- package/dist/chunks/{typed-date-CPAUNHzr.js → typed-date-Z3vcUJbb.js} +2 -2
- package/dist/chunks/{typed-date-CPAUNHzr.js.map → typed-date-Z3vcUJbb.js.map} +1 -1
- package/dist/components/core/kt-avatar/kt-avatar.js +2 -2
- package/dist/components/core/kt-badge/kt-badge.js +2 -2
- package/dist/components/core/kt-button/kt-button.js +1 -1
- package/dist/components/core/kt-card/kt-card.js +1 -1
- package/dist/components/core/kt-code/kt-code.js +2 -2
- package/dist/components/core/kt-icon/kt-icon.js +1 -1
- package/dist/components/core/kt-kbd/kt-kbd.js +1 -1
- package/dist/components/core/kt-split-button/kt-split-button.js +2 -2
- package/dist/components/data/kt-chart/kt-chart.js +2 -2
- package/dist/components/data/kt-meter/kt-meter.js +1 -1
- package/dist/components/data/kt-pagination/kt-pagination.js +2 -2
- package/dist/components/data/kt-stat/kt-stat.js +1 -1
- package/dist/components/data/kt-table/kt-table.js +2 -2
- package/dist/components/data/kt-timeline/kt-timeline.js +1 -1
- package/dist/components/feedback/kt-alert/kt-alert.js +2 -2
- package/dist/components/feedback/kt-empty-state/kt-empty-state.js +1 -1
- package/dist/components/feedback/kt-progress-bar/kt-progress-bar.js +1 -1
- package/dist/components/feedback/kt-skeleton/kt-skeleton.js +1 -1
- package/dist/components/feedback/kt-toast/kt-toast.js +2 -2
- package/dist/components/feedback/kt-toast-container/kt-toast-container.js +1 -1
- package/dist/components/feedback/kt-tooltip/kt-tooltip.js +1 -1
- package/dist/components/forms/kt-calendar/kt-calendar.js +3 -3
- package/dist/components/forms/kt-checkbox/kt-checkbox.js +2 -2
- package/dist/components/forms/kt-date-input/kt-date-input.js +6 -6
- package/dist/components/forms/kt-date-picker/kt-date-picker.js +5 -5
- package/dist/components/forms/kt-drag-drop/kt-drag-drop.js +2 -2
- package/dist/components/forms/kt-form/kt-form.js +2 -2
- package/dist/components/forms/kt-input/kt-input.js +3 -3
- package/dist/components/forms/kt-input-menu/kt-input-menu.js +3 -3
- package/dist/components/forms/kt-label-input/kt-label-input.js +1 -1
- package/dist/components/forms/kt-multi-select/kt-multi-select.js +3 -3
- package/dist/components/forms/kt-number-input/kt-number-input.d.ts +89 -0
- package/dist/components/forms/kt-number-input/kt-number-input.js +350 -0
- package/dist/components/forms/kt-number-input/kt-number-input.js.map +1 -0
- package/dist/components/forms/kt-radio-group/kt-radio-group.js +2 -2
- package/dist/components/forms/kt-select/kt-select.js +3 -3
- package/dist/components/forms/kt-slider/kt-slider.d.ts +69 -0
- package/dist/components/forms/kt-slider/kt-slider.js +252 -0
- package/dist/components/forms/kt-slider/kt-slider.js.map +1 -0
- package/dist/components/forms/kt-textarea/kt-textarea.js +2 -2
- package/dist/components/forms/kt-time-input/kt-time-input.js +3 -3
- package/dist/components/forms/kt-toggle/kt-toggle.js +1 -1
- package/dist/components/navigation/kt-breadcrumb/kt-breadcrumb.js +2 -2
- package/dist/components/navigation/kt-header/kt-header.js +2 -2
- package/dist/components/navigation/kt-page-header/kt-page-header.js +1 -1
- package/dist/components/navigation/kt-segmented-control/kt-segmented-control.js +2 -2
- package/dist/components/navigation/kt-steps/kt-steps.d.ts +65 -0
- package/dist/components/navigation/kt-steps/kt-steps.js +244 -0
- package/dist/components/navigation/kt-steps/kt-steps.js.map +1 -0
- package/dist/components/navigation/kt-sub-menu-navigation/kt-sub-menu-navigation.js +2 -2
- package/dist/components/navigation/kt-tabs/kt-tabs.js +1 -1
- package/dist/components/navigation/kt-toggle-button/kt-toggle-button.js +1 -1
- package/dist/components/navigation/kt-toggle-button-group/kt-toggle-button-group.js +2 -2
- package/dist/components/overlays/kt-collapsible/kt-collapsible.js +1 -1
- package/dist/components/overlays/kt-command-palette/kt-command-palette.d.ts +87 -0
- package/dist/components/overlays/kt-command-palette/kt-command-palette.js +370 -0
- package/dist/components/overlays/kt-command-palette/kt-command-palette.js.map +1 -0
- package/dist/components/overlays/kt-confirm-dialog/kt-confirm-dialog.js +2 -2
- package/dist/components/overlays/kt-dropdown/kt-dropdown.js +3 -3
- package/dist/components/overlays/kt-modal/kt-modal.js +2 -2
- package/dist/components/overlays/kt-side-panel/kt-side-panel.js +2 -2
- package/dist/custom-elements.json +3279 -1754
- package/dist/docs/kt-alert.md +52 -0
- package/dist/docs/kt-avatar.md +46 -0
- package/dist/docs/kt-badge.md +104 -0
- package/dist/docs/kt-breadcrumb.md +53 -0
- package/dist/docs/kt-button.md +72 -0
- package/dist/docs/kt-calendar.md +98 -0
- package/dist/docs/kt-card.md +93 -0
- package/dist/docs/kt-chart.md +230 -0
- package/dist/docs/kt-checkbox.md +65 -0
- package/dist/docs/kt-code.md +88 -0
- package/dist/docs/kt-collapsible.md +50 -0
- package/dist/docs/kt-command-palette.md +99 -0
- package/dist/docs/kt-confirm-dialog.md +52 -0
- package/dist/docs/kt-date-input.md +97 -0
- package/dist/docs/kt-date-picker.md +116 -0
- package/dist/docs/kt-drag-drop.md +85 -0
- package/dist/docs/kt-dropdown.md +65 -0
- package/dist/docs/kt-empty-state.md +36 -0
- package/dist/docs/kt-form.md +93 -0
- package/dist/docs/kt-header.md +100 -0
- package/dist/docs/kt-icon.md +68 -0
- package/dist/docs/kt-input-menu.md +90 -0
- package/dist/docs/kt-input.md +137 -0
- package/dist/docs/kt-kbd.md +44 -0
- package/dist/docs/kt-label-input.md +54 -0
- package/dist/docs/kt-meter.md +79 -0
- package/dist/docs/kt-modal.md +62 -0
- package/dist/docs/kt-multi-select.md +115 -0
- package/dist/docs/kt-number-input.md +77 -0
- package/dist/docs/kt-page-header.md +53 -0
- package/dist/docs/kt-pagination.md +36 -0
- package/dist/docs/kt-progress-bar.md +66 -0
- package/dist/docs/kt-radio-group.md +73 -0
- package/dist/docs/kt-segmented-control.md +70 -0
- package/dist/docs/kt-select.md +80 -0
- package/dist/docs/kt-side-panel.md +59 -0
- package/dist/docs/kt-skeleton.md +46 -0
- package/dist/docs/kt-slider.md +76 -0
- package/dist/docs/kt-split-button.md +105 -0
- package/dist/docs/kt-stat.md +57 -0
- package/dist/docs/kt-steps.md +79 -0
- package/dist/docs/kt-sub-menu-navigation.md +118 -0
- package/dist/docs/kt-table.md +179 -0
- package/dist/docs/kt-tabs.md +87 -0
- package/dist/docs/kt-textarea.md +59 -0
- package/dist/docs/kt-time-input.md +88 -0
- package/dist/docs/kt-timeline.md +63 -0
- package/dist/docs/kt-toast-container.md +69 -0
- package/dist/docs/kt-toast.md +41 -0
- package/dist/docs/kt-toggle-button-group.md +67 -0
- package/dist/docs/kt-toggle-button.md +52 -0
- package/dist/docs/kt-toggle.md +47 -0
- package/dist/docs/kt-tooltip.md +68 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +105 -97
- package/dist/index.js.map +1 -1
- package/dist/internal/command-search.d.ts +27 -0
- package/dist/internal/floating.d.ts +4 -0
- package/dist/internal/numbers.d.ts +2 -0
- package/dist/internal/strings.d.ts +14 -0
- package/dist/react/index.d.ts +31 -0
- package/dist/react/index.js +199 -164
- package/dist/react/index.js.map +1 -1
- package/dist/react/jsx.d.ts +27 -1
- package/dist/strings/index.js +1 -1
- package/dist/tokens/base.css +4 -0
- package/dist/tokens/colors.css +5 -2
- package/dist/vscode.css-custom-data.json +26 -2
- package/dist/vscode.html-custom-data.json +120 -12
- package/dist/vue/index.d.ts +8 -0
- package/dist/vue/index.js +12 -8
- package/dist/vue/index.js.map +1 -1
- package/dist/web-types.json +347 -39
- package/package.json +41 -6
- package/dist/chunks/floating-B33g-M_1.js.map +0 -1
- package/dist/chunks/index-TWJzttLX.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmented-field-BBXR4XFL.js","sources":["../../src/internal/segments.ts","../../src/internal/segmented-field.ts"],"sourcesContent":["/**\n * The arithmetic of a segmented field — a day, a month, a year, an hour —\n * each typed digit by digit and stepped with the arrows. Pure, so the two\n * fields that share it, `<kt-date-input>` and `<kt-time-input>`, agree on\n * every key.\n */\n\nexport interface SegmentSpec {\n readonly min: number;\n readonly max: number;\n /** Digits when full: 2 for a day, 4 for a year. */\n readonly length: number;\n}\n\n/**\n * The segment's text once `digit` is typed, and whether the focus should move\n * on. It moves on when the segment is full, or as soon as no further digit\n * could follow — a day starting with 4 is the 4th. A digit that would\n * overshoot the maximum, or one typed into a full segment, starts it over.\n */\nexport function typeDigit(\n current: string,\n digit: string,\n spec: SegmentSpec,\n): { text: string; advance: boolean } {\n let text = current.length >= spec.length ? digit : current + digit;\n if (Number(text) > spec.max) text = digit;\n const advance = text.length >= spec.length || Number(text) * 10 > spec.max;\n return { text, advance };\n}\n\n/**\n * The value an arrow press lands on: the next multiple of the step — counted\n * from the minimum — in the direction of `by`, wrapping past either end. An\n * empty segment starts from its first value going up, its last going down.\n */\nexport function stepSegment(value: number | null, by: number, spec: SegmentSpec): number {\n const step = Math.abs(by) || 1;\n const first = spec.min;\n const last = spec.min + Math.floor((spec.max - spec.min) / step) * step;\n if (value === null) return by > 0 ? first : last;\n\n const offset = value - spec.min;\n if (by > 0) {\n const next = spec.min + (Math.floor(offset / step) + 1) * step;\n return next > spec.max ? first : next;\n }\n const next = offset % step === 0 ? value - step : spec.min + Math.floor(offset / step) * step;\n return next < spec.min ? last : next;\n}\n\n/** A value written with the segment's leading zeros: 4 → \"04\". */\nexport function padSegment(value: number, spec: SegmentSpec): string {\n return String(value).padStart(spec.length, '0');\n}\n","import { css, html, nothing, type PropertyValues, type TemplateResult } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { KtElement } from './kt-element.js';\nimport { emit, uniqueId } from './events.js';\nimport {\n attachFormInternals,\n setFormValue,\n setValidity,\n type UsableInternals,\n} from './form-control.js';\nimport { resolveLocale } from './locale.js';\nimport { padSegment, stepSegment, typeDigit, type SegmentSpec } from './segments.js';\n\n/** One part of a segmented field: a number typed digit by digit, or one of a few words. */\nexport interface Segment {\n readonly key: string;\n readonly label: string;\n /** What the segment shows while empty: \"dd\", \"--\". */\n readonly placeholder: string;\n /** A number, typed and stepped within these bounds… */\n readonly spec?: SegmentSpec;\n /** …stepped by this much with the arrows… */\n readonly step?: number;\n /** …or one of these words, picked by its first letter: AM, PM. */\n readonly choices?: readonly string[];\n}\n\n/** What a segmented field is made of: segments, and the characters between them. */\nexport type FieldItem = Segment | { readonly literal: string };\n\nconst isSegment = (item: FieldItem): item is Segment => 'key' in item;\n\n/** Characters that move on to the next segment, as a typist expects. */\nconst SEPARATORS = new Set(['/', '.', '-', ':', ',', ' ']);\n\nexport type KtSegmentedFieldSize = 'small' | 'medium' | 'large';\n\n/**\n * The common ground of `<kt-date-input>` and `<kt-time-input>`: a field of\n * segments — a day, a month, an hour — each its own spinbutton, typed digit by\n * digit, stepped with the arrows, the focus moving on as each fills.\n *\n * Each segment is `contenteditable`, so a phone shows its number pad, but the\n * text never changes behind the field's back: every keystroke and every input\n * event is turned into the segment's new value here. A subclass says what its\n * segments are, how they read into a value, and how a value fills them.\n */\nexport abstract class KtSegmentedField extends KtElement {\n static readonly formAssociated = true;\n\n static override styles = [\n KtElement.styles,\n css`\n :host {\n display: block;\n --field-height: var(--button-height);\n }\n :host([size='small']) {\n --field-height: var(--button-height-small);\n }\n :host([size='large']) {\n --field-height: var(--button-height-large);\n }\n\n /* The field as kt-input draws one: a fill with a resting hairline, an\n outline on hover and focus that never reflows it. */\n .field {\n display: flex;\n align-items: center;\n gap: var(--gap-element);\n height: var(--field-height);\n /* Less the segment's own padding, so the digits line up with a\n kt-input's text. */\n padding: 0 10px 0 calc(var(--button-padding-x) - 2px);\n color: var(--text-body);\n font: var(--font-input);\n background-color: var(--surface-field);\n border: var(--border-width) solid var(--border-field);\n border-radius: var(--radius-input);\n outline: var(--outline-width) solid transparent;\n cursor: text;\n transition: outline-color var(--duration-instant);\n }\n .field:hover {\n outline: var(--outline-width) solid var(--color-text-700);\n }\n .field:focus-within,\n .field.open {\n outline: var(--outline-width) solid var(--color-primary-base);\n }\n .field.error,\n .field.error:hover,\n .field.error:focus-within {\n outline: var(--outline-width) solid var(--color-danger-base);\n }\n .field.disabled {\n color: var(--text-disabled);\n background-color: var(--color-dark-14);\n cursor: not-allowed;\n }\n\n .segments {\n display: flex;\n flex: 1;\n align-items: center;\n min-width: 0;\n font-variant-numeric: tabular-nums;\n }\n\n /* A segment takes a tint while it has focus, so it is plain which part\n a digit will go into; the caret itself would only flicker. */\n .segment {\n padding: 1px 2px;\n border-radius: calc(4px * var(--radius-scale, 1));\n outline: none;\n caret-color: transparent;\n white-space: nowrap;\n }\n .segment.empty {\n color: var(--text-muted);\n }\n .segment:focus {\n color: var(--color-primary-text);\n background: var(--color-primary-soft);\n }\n .error .segment:not(.empty) {\n color: var(--color-danger-text);\n }\n .literal {\n padding: 0 1px;\n color: var(--text-muted);\n }\n\n .error-icon {\n flex: none;\n color: var(--color-danger-text);\n }\n `,\n ];\n\n protected internals: UsableInternals | null = null;\n private defaultValue: string | null = null;\n /** Set while the field writes its own value, which should not refill it. */\n private committing = false;\n protected readonly errorId = uniqueId('kt-segmented-error');\n\n /** What each segment holds, by key: digits, or the index of a choice. */\n @state() protected texts: Record<string, string> = {};\n /** Why the segments do not make a value, when they are all filled. */\n @state() protected typedError = '';\n @state() private focusedKey: string | null = null;\n /** Disabled by an enclosing `<fieldset>`, which leaves `disabled` alone. */\n @state() private formDisabled = false;\n\n @property({ type: String, reflect: true })\n value: string | null = null;\n\n @property({ type: String })\n name = '';\n\n /** Accessible name of the field, when no `<kt-label-input>` wraps it. */\n @property({ type: String })\n label = '';\n\n /** BCP 47 locale for the order and names of the segments. Empty: page, then browser. */\n @property({ type: String })\n locale = '';\n\n @property({ type: String })\n min = '';\n\n @property({ type: String })\n max = '';\n\n @property({ type: String, reflect: true })\n size: KtSegmentedFieldSize = 'medium';\n\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n @property({ type: Boolean, reflect: true })\n required = false;\n\n /** Error message. A non-empty value puts the field in its error state. */\n @property({ type: String, reflect: true })\n error = '';\n\n // --- What a subclass says ---\n\n /** The segments, in order, with what goes between them. */\n protected abstract items(): FieldItem[];\n /** What each segment holds for a value. */\n protected abstract fill(value: string | null): Record<string, string>;\n /** The value the segments make — null until they all hold something — and why not, if not. */\n protected abstract read(texts: Record<string, string>): { value: string | null; error: string };\n /** The message of a required field left empty. */\n protected abstract requiredMessage(): string;\n /** Anything after the segments: a calendar button. */\n protected renderAfter(): TemplateResult | typeof nothing {\n return nothing;\n }\n /**\n * What a segment left half-typed becomes when the focus leaves it — a\n * two-digit year written out — or null to leave it as typed.\n */\n protected completeOnBlur(_segment: Segment, _text: string): string | null {\n return null;\n }\n /** Whether a popup belonging to the field is open, for the field's outline. */\n protected get expanded(): boolean {\n return false;\n }\n\n // --- Lifecycle ---\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.internals ??= attachFormInternals(this);\n this.defaultValue = this.value;\n this.texts = this.fill(this.value);\n }\n\n override willUpdate(changed: PropertyValues<this>): void {\n // A value set from outside fills the segments; one the field wrote does not.\n if ((changed.has('value') || changed.has('locale')) && !this.committing) {\n this.texts = this.fill(this.value);\n this.typedError = '';\n }\n this.committing = false;\n\n if (\n changed.has('value') ||\n changed.has('required') ||\n changed.has('error') ||\n changed.has('typedError' as keyof KtSegmentedField) ||\n this.stringsChanged(changed)\n ) {\n setFormValue(this.internals, this.value);\n const missing = this.required && this.value === null && !this.typedError;\n setValidity(\n this.internals,\n {\n valueMissing: missing,\n badInput: Boolean(this.typedError),\n customError: Boolean(this.error),\n },\n this.error || this.typedError || (missing ? this.requiredMessage() : ''),\n );\n }\n }\n\n formResetCallback(): void {\n this.value = this.defaultValue;\n this.texts = this.fill(this.value);\n this.typedError = '';\n }\n\n /**\n * Called by the platform when the control's disabled state changes — its\n * own `disabled`, or an ancestor `<fieldset disabled>` it cannot see.\n */\n formDisabledCallback(disabled: boolean): void {\n this.formDisabled = disabled;\n }\n\n /** Called by the platform when the browser restores a session. */\n formStateRestoreCallback(state: string | null): void {\n this.value = state;\n }\n\n /** Focuses the first segment. */\n override focus(options?: FocusOptions): void {\n this.segmentElements()[0]?.focus(options);\n }\n\n protected get inactive(): boolean {\n return this.disabled || this.formDisabled;\n }\n\n protected get resolvedLocale(): string {\n return resolveLocale(this.locale);\n }\n\n // --- Values ---\n\n /** Sets a value chosen outside the segments — a day picked in a calendar. */\n protected commitValue(value: string | null): void {\n this.texts = this.fill(value);\n this.typedError = '';\n this.apply(value);\n }\n\n private setText(key: string, text: string): void {\n this.texts = { ...this.texts, [key]: text };\n const { value, error } = this.read(this.texts);\n this.typedError = error;\n this.apply(value);\n }\n\n private apply(value: string | null): void {\n if (value === this.value) return;\n this.committing = true;\n this.value = value;\n emit(this, 'kt-change', { value });\n }\n\n // --- Keyboard ---\n\n private segmentElements(): HTMLElement[] {\n return [...(this.shadowRoot?.querySelectorAll<HTMLElement>('[role=\"spinbutton\"]') ?? [])];\n }\n\n private focusSegment(index: number): void {\n this.segmentElements()[index]?.focus();\n }\n\n /** One key's effect on a segment; true when the key was the field's to handle. */\n private applyKey(key: string, segment: Segment, index: number): boolean {\n const text = this.texts[segment.key] ?? '';\n\n if (/^\\d$/.test(key) && segment.spec) {\n const typed = typeDigit(text, key, segment.spec);\n this.setText(segment.key, typed.text);\n if (typed.advance) this.focusSegment(index + 1);\n return true;\n }\n if (segment.choices && /^\\p{L}$/u.test(key)) {\n const pick = segment.choices.findIndex((choice) =>\n choice.toLowerCase().startsWith(key.toLowerCase()),\n );\n if (pick >= 0) {\n this.setText(segment.key, String(pick));\n this.focusSegment(index + 1);\n }\n return true;\n }\n\n switch (key) {\n case 'ArrowUp':\n case 'ArrowDown': {\n const by = key === 'ArrowUp' ? 1 : -1;\n if (segment.spec) {\n const current = text === '' ? null : Number(text);\n const next = stepSegment(current, by * (segment.step ?? 1), segment.spec);\n this.setText(segment.key, padSegment(next, segment.spec));\n } else if (segment.choices) {\n const count = segment.choices.length;\n const current = text === '' ? (by > 0 ? -1 : 0) : Number(text);\n this.setText(segment.key, String((current + by + count) % count));\n }\n return true;\n }\n case 'Home':\n case 'End':\n if (segment.spec) {\n const bound = key === 'Home' ? segment.spec.min : segment.spec.max;\n this.setText(segment.key, padSegment(bound, segment.spec));\n }\n return true;\n case 'ArrowLeft':\n this.focusSegment(index - 1);\n return true;\n case 'ArrowRight':\n this.focusSegment(index + 1);\n return true;\n case 'Backspace':\n case 'Delete':\n // Erase a digit at a time; once empty, Backspace goes back a segment.\n if (text) this.setText(segment.key, segment.choices ? '' : text.slice(0, -1));\n else if (key === 'Backspace') this.focusSegment(index - 1);\n return true;\n default:\n if (SEPARATORS.has(key)) {\n if (text) this.focusSegment(index + 1);\n return true;\n }\n // Any other character would land in the contenteditable as text.\n return key.length === 1;\n }\n }\n\n private onKeyDown(event: KeyboardEvent, segment: Segment, index: number): void {\n if (this.inactive || event.metaKey || event.ctrlKey || event.altKey) return;\n if (this.applyKey(event.key, segment, index)) event.preventDefault();\n }\n\n /**\n * What a phone's keyboard sends: input events rather than key presses.\n * The text is never left to the browser; each character goes through the\n * same path as a key.\n */\n private onBeforeInput(event: InputEvent, segment: Segment, index: number): void {\n event.preventDefault();\n if (this.inactive) return;\n if (event.inputType.startsWith('delete')) {\n this.applyKey('Backspace', segment, index);\n return;\n }\n for (const character of event.data ?? '') this.applyKey(character, segment, index);\n }\n\n /** A click on the field's padding or separators lands in its first empty segment. */\n private onFieldClick(event: MouseEvent): void {\n if (this.inactive) return;\n if ((event.target as HTMLElement).closest('[role=\"spinbutton\"], button, kt-tooltip')) return;\n const segments = this.items().filter(isSegment);\n const empty = segments.findIndex((segment) => !this.texts[segment.key]);\n this.focusSegment(empty >= 0 ? empty : segments.length - 1);\n }\n\n // --- Rendering ---\n\n private renderSegment(segment: Segment, index: number): TemplateResult {\n const text = this.texts[segment.key] ?? '';\n const focused = this.focusedKey === segment.key;\n let shown = segment.placeholder;\n let now: number | typeof nothing = nothing;\n if (text !== '') {\n now = Number(text);\n if (segment.choices) shown = segment.choices[Number(text)] ?? '';\n else if (segment.spec) shown = focused ? text : padSegment(Number(text), segment.spec);\n }\n\n return html`<span\n part=\"segment\"\n role=\"spinbutton\"\n class=${classMap({ segment: true, empty: text === '' })}\n data-key=${segment.key}\n tabindex=${this.inactive ? -1 : 0}\n contenteditable=${this.inactive ? 'false' : 'true'}\n inputmode=${segment.spec ? 'numeric' : 'text'}\n spellcheck=\"false\"\n autocorrect=\"off\"\n enterkeyhint=\"next\"\n aria-label=${segment.label}\n aria-valuemin=${segment.spec ? segment.spec.min : nothing}\n aria-valuemax=${segment.spec ? segment.spec.max : nothing}\n aria-valuenow=${now}\n aria-valuetext=${text === '' ? segment.placeholder : shown}\n aria-disabled=${this.inactive ? 'true' : nothing}\n @keydown=${(event: KeyboardEvent) => this.onKeyDown(event, segment, index)}\n @beforeinput=${(event: InputEvent) => this.onBeforeInput(event, segment, index)}\n @focus=${() => {\n this.focusedKey = segment.key;\n }}\n @blur=${() => {\n this.focusedKey = null;\n const completed = this.completeOnBlur(segment, this.texts[segment.key] ?? '');\n if (completed !== null && completed !== this.texts[segment.key]) {\n this.setText(segment.key, completed);\n }\n }}\n >${shown}</span\n >`;\n }\n\n override render(): TemplateResult {\n const error = this.error || this.typedError;\n let index = -1;\n\n return html`${\n error ? html`<span id=${this.errorId} class=\"visually-hidden\">${error}</span>` : nothing\n }\n <div\n part=\"field\"\n class=${classMap({\n field: true,\n error: Boolean(error),\n disabled: this.inactive,\n open: this.expanded,\n })}\n role=\"group\"\n aria-label=${this.label || nothing}\n aria-invalid=${error ? 'true' : nothing}\n aria-describedby=${error ? this.errorId : nothing}\n @click=${this.onFieldClick}\n >\n <div class=\"segments\">\n ${this.items().map((item) => {\n if (!isSegment(item)) {\n return html`<span class=\"literal\" aria-hidden=\"true\">${item.literal}</span>`;\n }\n index += 1;\n return this.renderSegment(item, index);\n })}\n </div>\n ${\n error\n ? html`<kt-tooltip class=\"error-icon\" text=${error} ?open=${this.focusedKey !== null}>\n <kt-icon name=\"circle-alert\" size=\"18\"></kt-icon>\n </kt-tooltip>`\n : nothing\n }\n ${this.renderAfter()}\n </div>`;\n }\n}\n"],"names":["typeDigit","current","digit","spec","text","advance","stepSegment","value","by","step","first","last","offset","next","padSegment","isSegment","item","SEPARATORS","KtSegmentedField","KtElement","uniqueId","css","nothing","_segment","_text","attachFormInternals","changed","setFormValue","missing","setValidity","disabled","state","options","resolveLocale","key","error","emit","index","segment","typed","pick","choice","count","bound","event","character","segments","empty","focused","shown","now","html","classMap","completed","__decorateClass","property"],"mappings":";;;;;;;AAoBO,SAASA,EACdC,GACAC,GACAC,GACoC;AACpC,MAAIC,IAAOH,EAAQ,UAAUE,EAAK,SAASD,IAAQD,IAAUC;AAC7D,EAAI,OAAOE,CAAI,IAAID,EAAK,QAAKC,IAAOF;AACpC,QAAMG,IAAUD,EAAK,UAAUD,EAAK,UAAU,OAAOC,CAAI,IA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GAoC,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GAlItBrC,EAmIpB,WAAA,UAAA;AAGAoC,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GArItBrC,EAsIpB,WAAA,UAAA;AAIAoC,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM;AAAA,GAzIrBrC,EA0IpB,WAAA,OAAA;"}
|
|
1
|
+
{"version":3,"file":"segmented-field-BCjCGF4I.js","sources":["../../src/internal/segments.ts","../../src/internal/segmented-field.ts"],"sourcesContent":["/**\n * The arithmetic of a segmented field — a day, a month, a year, an hour —\n * each typed digit by digit and stepped with the arrows. Pure, so the two\n * fields that share it, `<kt-date-input>` and `<kt-time-input>`, agree on\n * every key.\n */\n\nexport interface SegmentSpec {\n readonly min: number;\n readonly max: number;\n /** Digits when full: 2 for a day, 4 for a year. */\n readonly length: number;\n}\n\n/**\n * The segment's text once `digit` is typed, and whether the focus should move\n * on. It moves on when the segment is full, or as soon as no further digit\n * could follow — a day starting with 4 is the 4th. A digit that would\n * overshoot the maximum, or one typed into a full segment, starts it over.\n */\nexport function typeDigit(\n current: string,\n digit: string,\n spec: SegmentSpec,\n): { text: string; advance: boolean } {\n let text = current.length >= spec.length ? digit : current + digit;\n if (Number(text) > spec.max) text = digit;\n const advance = text.length >= spec.length || Number(text) * 10 > spec.max;\n return { text, advance };\n}\n\n/**\n * The value an arrow press lands on: the next multiple of the step — counted\n * from the minimum — in the direction of `by`, wrapping past either end. An\n * empty segment starts from its first value going up, its last going down.\n */\nexport function stepSegment(value: number | null, by: number, spec: SegmentSpec): number {\n const step = Math.abs(by) || 1;\n const first = spec.min;\n const last = spec.min + Math.floor((spec.max - spec.min) / step) * step;\n if (value === null) return by > 0 ? first : last;\n\n const offset = value - spec.min;\n if (by > 0) {\n const next = spec.min + (Math.floor(offset / step) + 1) * step;\n return next > spec.max ? first : next;\n }\n const next = offset % step === 0 ? value - step : spec.min + Math.floor(offset / step) * step;\n return next < spec.min ? last : next;\n}\n\n/** A value written with the segment's leading zeros: 4 → \"04\". */\nexport function padSegment(value: number, spec: SegmentSpec): string {\n return String(value).padStart(spec.length, '0');\n}\n","import { css, html, nothing, type PropertyValues, type TemplateResult } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { KtElement } from './kt-element.js';\nimport { emit, uniqueId } from './events.js';\nimport {\n attachFormInternals,\n setFormValue,\n setValidity,\n type UsableInternals,\n} from './form-control.js';\nimport { resolveLocale } from './locale.js';\nimport { padSegment, stepSegment, typeDigit, type SegmentSpec } from './segments.js';\n\n/** One part of a segmented field: a number typed digit by digit, or one of a few words. */\nexport interface Segment {\n readonly key: string;\n readonly label: string;\n /** What the segment shows while empty: \"dd\", \"--\". */\n readonly placeholder: string;\n /** A number, typed and stepped within these bounds… */\n readonly spec?: SegmentSpec;\n /** …stepped by this much with the arrows… */\n readonly step?: number;\n /** …or one of these words, picked by its first letter: AM, PM. */\n readonly choices?: readonly string[];\n}\n\n/** What a segmented field is made of: segments, and the characters between them. */\nexport type FieldItem = Segment | { readonly literal: string };\n\nconst isSegment = (item: FieldItem): item is Segment => 'key' in item;\n\n/** Characters that move on to the next segment, as a typist expects. */\nconst SEPARATORS = new Set(['/', '.', '-', ':', ',', ' ']);\n\nexport type KtSegmentedFieldSize = 'small' | 'medium' | 'large';\n\n/**\n * The common ground of `<kt-date-input>` and `<kt-time-input>`: a field of\n * segments — a day, a month, an hour — each its own spinbutton, typed digit by\n * digit, stepped with the arrows, the focus moving on as each fills.\n *\n * Each segment is `contenteditable`, so a phone shows its number pad, but the\n * text never changes behind the field's back: every keystroke and every input\n * event is turned into the segment's new value here. A subclass says what its\n * segments are, how they read into a value, and how a value fills them.\n */\nexport abstract class KtSegmentedField extends KtElement {\n static readonly formAssociated = true;\n\n static override styles = [\n KtElement.styles,\n css`\n :host {\n display: block;\n --field-height: var(--button-height);\n }\n :host([size='small']) {\n --field-height: var(--button-height-small);\n }\n :host([size='large']) {\n --field-height: var(--button-height-large);\n }\n\n /* The field as kt-input draws one: a fill with a resting hairline, an\n outline on hover and focus that never reflows it. */\n .field {\n display: flex;\n align-items: center;\n gap: var(--gap-element);\n height: var(--field-height);\n /* Less the segment's own padding, so the digits line up with a\n kt-input's text. */\n padding: 0 10px 0 calc(var(--button-padding-x) - 2px);\n color: var(--text-body);\n font: var(--font-input);\n background-color: var(--surface-field);\n border: var(--border-width) solid var(--border-field);\n border-radius: var(--radius-input);\n outline: var(--outline-width) solid transparent;\n cursor: text;\n transition: outline-color var(--duration-instant);\n }\n .field:hover {\n outline: var(--outline-width) solid var(--color-text-700);\n }\n .field:focus-within,\n .field.open {\n outline: var(--outline-width) solid var(--color-primary-base);\n }\n .field.error,\n .field.error:hover,\n .field.error:focus-within {\n outline: var(--outline-width) solid var(--color-danger-base);\n }\n .field.disabled {\n color: var(--text-disabled);\n background-color: var(--color-dark-14);\n cursor: not-allowed;\n }\n\n .segments {\n display: flex;\n flex: 1;\n align-items: center;\n min-width: 0;\n font-variant-numeric: tabular-nums;\n }\n\n /* A segment takes a tint while it has focus, so it is plain which part\n a digit will go into; the caret itself would only flicker. */\n .segment {\n padding: 1px 2px;\n border-radius: calc(4px * var(--radius-scale, 1));\n outline: none;\n caret-color: transparent;\n white-space: nowrap;\n }\n .segment.empty {\n color: var(--text-muted);\n }\n .segment:focus {\n color: var(--color-primary-text);\n background: var(--color-primary-soft);\n }\n .error .segment:not(.empty) {\n color: var(--color-danger-text);\n }\n .literal {\n padding: 0 1px;\n color: var(--text-muted);\n }\n\n .error-icon {\n flex: none;\n color: var(--color-danger-text);\n }\n `,\n ];\n\n protected internals: UsableInternals | null = null;\n private defaultValue: string | null = null;\n /** Set while the field writes its own value, which should not refill it. */\n private committing = false;\n protected readonly errorId = uniqueId('kt-segmented-error');\n\n /** What each segment holds, by key: digits, or the index of a choice. */\n @state() protected texts: Record<string, string> = {};\n /** Why the segments do not make a value, when they are all filled. */\n @state() protected typedError = '';\n @state() private focusedKey: string | null = null;\n /** Disabled by an enclosing `<fieldset>`, which leaves `disabled` alone. */\n @state() private formDisabled = false;\n\n @property({ type: String, reflect: true })\n value: string | null = null;\n\n @property({ type: String })\n name = '';\n\n /** Accessible name of the field, when no `<kt-label-input>` wraps it. */\n @property({ type: String })\n label = '';\n\n /** BCP 47 locale for the order and names of the segments. Empty: page, then browser. */\n @property({ type: String })\n locale = '';\n\n @property({ type: String })\n min = '';\n\n @property({ type: String })\n max = '';\n\n @property({ type: String, reflect: true })\n size: KtSegmentedFieldSize = 'medium';\n\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n @property({ type: Boolean, reflect: true })\n required = false;\n\n /** Error message. A non-empty value puts the field in its error state. */\n @property({ type: String, reflect: true })\n error = '';\n\n // --- What a subclass says ---\n\n /** The segments, in order, with what goes between them. */\n protected abstract items(): FieldItem[];\n /** What each segment holds for a value. */\n protected abstract fill(value: string | null): Record<string, string>;\n /** The value the segments make — null until they all hold something — and why not, if not. */\n protected abstract read(texts: Record<string, string>): { value: string | null; error: string };\n /** The message of a required field left empty. */\n protected abstract requiredMessage(): string;\n /** Anything after the segments: a calendar button. */\n protected renderAfter(): TemplateResult | typeof nothing {\n return nothing;\n }\n /**\n * What a segment left half-typed becomes when the focus leaves it — a\n * two-digit year written out — or null to leave it as typed.\n */\n protected completeOnBlur(_segment: Segment, _text: string): string | null {\n return null;\n }\n /** Whether a popup belonging to the field is open, for the field's outline. */\n protected get expanded(): boolean {\n return false;\n }\n\n // --- Lifecycle ---\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.internals ??= attachFormInternals(this);\n this.defaultValue = this.value;\n this.texts = this.fill(this.value);\n }\n\n override willUpdate(changed: PropertyValues<this>): void {\n // A value set from outside fills the segments; one the field wrote does not.\n if ((changed.has('value') || changed.has('locale')) && !this.committing) {\n this.texts = this.fill(this.value);\n this.typedError = '';\n }\n this.committing = false;\n\n if (\n changed.has('value') ||\n changed.has('required') ||\n changed.has('error') ||\n changed.has('typedError' as keyof KtSegmentedField) ||\n this.stringsChanged(changed)\n ) {\n setFormValue(this.internals, this.value);\n const missing = this.required && this.value === null && !this.typedError;\n setValidity(\n this.internals,\n {\n valueMissing: missing,\n badInput: Boolean(this.typedError),\n customError: Boolean(this.error),\n },\n this.error || this.typedError || (missing ? this.requiredMessage() : ''),\n );\n }\n }\n\n formResetCallback(): void {\n this.value = this.defaultValue;\n this.texts = this.fill(this.value);\n this.typedError = '';\n }\n\n /**\n * Called by the platform when the control's disabled state changes — its\n * own `disabled`, or an ancestor `<fieldset disabled>` it cannot see.\n */\n formDisabledCallback(disabled: boolean): void {\n this.formDisabled = disabled;\n }\n\n /** Called by the platform when the browser restores a session. */\n formStateRestoreCallback(state: string | null): void {\n this.value = state;\n }\n\n /** Focuses the first segment. */\n override focus(options?: FocusOptions): void {\n this.segmentElements()[0]?.focus(options);\n }\n\n protected get inactive(): boolean {\n return this.disabled || this.formDisabled;\n }\n\n protected get resolvedLocale(): string {\n return resolveLocale(this.locale);\n }\n\n // --- Values ---\n\n /** Sets a value chosen outside the segments — a day picked in a calendar. */\n protected commitValue(value: string | null): void {\n this.texts = this.fill(value);\n this.typedError = '';\n this.apply(value);\n }\n\n private setText(key: string, text: string): void {\n this.texts = { ...this.texts, [key]: text };\n const { value, error } = this.read(this.texts);\n this.typedError = error;\n this.apply(value);\n }\n\n private apply(value: string | null): void {\n if (value === this.value) return;\n this.committing = true;\n this.value = value;\n emit(this, 'kt-change', { value });\n }\n\n // --- Keyboard ---\n\n private segmentElements(): HTMLElement[] {\n return [...(this.shadowRoot?.querySelectorAll<HTMLElement>('[role=\"spinbutton\"]') ?? [])];\n }\n\n private focusSegment(index: number): void {\n this.segmentElements()[index]?.focus();\n }\n\n /** One key's effect on a segment; true when the key was the field's to handle. */\n private applyKey(key: string, segment: Segment, index: number): boolean {\n const text = this.texts[segment.key] ?? '';\n\n if (/^\\d$/.test(key) && segment.spec) {\n const typed = typeDigit(text, key, segment.spec);\n this.setText(segment.key, typed.text);\n if (typed.advance) this.focusSegment(index + 1);\n return true;\n }\n if (segment.choices && /^\\p{L}$/u.test(key)) {\n const pick = segment.choices.findIndex((choice) =>\n choice.toLowerCase().startsWith(key.toLowerCase()),\n );\n if (pick >= 0) {\n this.setText(segment.key, String(pick));\n this.focusSegment(index + 1);\n }\n return true;\n }\n\n switch (key) {\n case 'ArrowUp':\n case 'ArrowDown': {\n const by = key === 'ArrowUp' ? 1 : -1;\n if (segment.spec) {\n const current = text === '' ? null : Number(text);\n const next = stepSegment(current, by * (segment.step ?? 1), segment.spec);\n this.setText(segment.key, padSegment(next, segment.spec));\n } else if (segment.choices) {\n const count = segment.choices.length;\n const current = text === '' ? (by > 0 ? -1 : 0) : Number(text);\n this.setText(segment.key, String((current + by + count) % count));\n }\n return true;\n }\n case 'Home':\n case 'End':\n if (segment.spec) {\n const bound = key === 'Home' ? segment.spec.min : segment.spec.max;\n this.setText(segment.key, padSegment(bound, segment.spec));\n }\n return true;\n case 'ArrowLeft':\n this.focusSegment(index - 1);\n return true;\n case 'ArrowRight':\n this.focusSegment(index + 1);\n return true;\n case 'Backspace':\n case 'Delete':\n // Erase a digit at a time; once empty, Backspace goes back a segment.\n if (text) this.setText(segment.key, segment.choices ? '' : text.slice(0, -1));\n else if (key === 'Backspace') this.focusSegment(index - 1);\n return true;\n default:\n if (SEPARATORS.has(key)) {\n if (text) this.focusSegment(index + 1);\n return true;\n }\n // Any other character would land in the contenteditable as text.\n return key.length === 1;\n }\n }\n\n private onKeyDown(event: KeyboardEvent, segment: Segment, index: number): void {\n if (this.inactive || event.metaKey || event.ctrlKey || event.altKey) return;\n if (this.applyKey(event.key, segment, index)) event.preventDefault();\n }\n\n /**\n * What a phone's keyboard sends: input events rather than key presses.\n * The text is never left to the browser; each character goes through the\n * same path as a key.\n */\n private onBeforeInput(event: InputEvent, segment: Segment, index: number): void {\n event.preventDefault();\n if (this.inactive) return;\n if (event.inputType.startsWith('delete')) {\n this.applyKey('Backspace', segment, index);\n return;\n }\n for (const character of event.data ?? '') this.applyKey(character, segment, index);\n }\n\n /** A click on the field's padding or separators lands in its first empty segment. */\n private onFieldClick(event: MouseEvent): void {\n if (this.inactive) return;\n if ((event.target as HTMLElement).closest('[role=\"spinbutton\"], button, kt-tooltip')) return;\n const segments = this.items().filter(isSegment);\n const empty = segments.findIndex((segment) => !this.texts[segment.key]);\n this.focusSegment(empty >= 0 ? empty : segments.length - 1);\n }\n\n // --- Rendering ---\n\n private renderSegment(segment: Segment, index: number): TemplateResult {\n const text = this.texts[segment.key] ?? '';\n const focused = this.focusedKey === segment.key;\n let shown = segment.placeholder;\n let now: number | typeof nothing = nothing;\n if (text !== '') {\n now = Number(text);\n if (segment.choices) shown = segment.choices[Number(text)] ?? '';\n else if (segment.spec) shown = focused ? text : padSegment(Number(text), segment.spec);\n }\n\n return html`<span\n part=\"segment\"\n role=\"spinbutton\"\n class=${classMap({ segment: true, empty: text === '' })}\n data-key=${segment.key}\n tabindex=${this.inactive ? -1 : 0}\n contenteditable=${this.inactive ? 'false' : 'true'}\n inputmode=${segment.spec ? 'numeric' : 'text'}\n spellcheck=\"false\"\n autocorrect=\"off\"\n enterkeyhint=\"next\"\n aria-label=${segment.label}\n aria-valuemin=${segment.spec ? segment.spec.min : nothing}\n aria-valuemax=${segment.spec ? segment.spec.max : nothing}\n aria-valuenow=${now}\n aria-valuetext=${text === '' ? segment.placeholder : shown}\n aria-disabled=${this.inactive ? 'true' : nothing}\n @keydown=${(event: KeyboardEvent) => this.onKeyDown(event, segment, index)}\n @beforeinput=${(event: InputEvent) => this.onBeforeInput(event, segment, index)}\n @focus=${() => {\n this.focusedKey = segment.key;\n }}\n @blur=${() => {\n this.focusedKey = null;\n const completed = this.completeOnBlur(segment, this.texts[segment.key] ?? '');\n if (completed !== null && completed !== this.texts[segment.key]) {\n this.setText(segment.key, completed);\n }\n }}\n >${shown}</span\n >`;\n }\n\n override render(): TemplateResult {\n const error = this.error || this.typedError;\n let index = -1;\n\n return html`${\n error ? html`<span id=${this.errorId} class=\"visually-hidden\">${error}</span>` : nothing\n }\n <div\n part=\"field\"\n class=${classMap({\n field: true,\n error: Boolean(error),\n disabled: this.inactive,\n open: this.expanded,\n })}\n role=\"group\"\n aria-label=${this.label || nothing}\n aria-invalid=${error ? 'true' : nothing}\n aria-describedby=${error ? this.errorId : nothing}\n @click=${this.onFieldClick}\n >\n <div class=\"segments\">\n ${this.items().map((item) => {\n if (!isSegment(item)) {\n return html`<span class=\"literal\" aria-hidden=\"true\">${item.literal}</span>`;\n }\n index += 1;\n return this.renderSegment(item, index);\n })}\n </div>\n ${\n error\n ? html`<kt-tooltip class=\"error-icon\" text=${error} ?open=${this.focusedKey !== null}>\n <kt-icon name=\"circle-alert\" size=\"18\"></kt-icon>\n </kt-tooltip>`\n : nothing\n }\n ${this.renderAfter()}\n </div>`;\n }\n}\n"],"names":["typeDigit","current","digit","spec","text","advance","stepSegment","value","by","step","first","last","offset","next","padSegment","isSegment","item","SEPARATORS","KtSegmentedField","KtElement","uniqueId","css","nothing","_segment","_text","attachFormInternals","changed","setFormValue","missing","setValidity","disabled","state","options","resolveLocale","key","error","emit","index","segment","typed","pick","choice","count","bound","event","character","segments","empty","focused","shown","now","html","classMap","completed","__decorateClass","property"],"mappings":";;;;;;;AAoBO,SAASA,EACdC,GACAC,GACAC,GACoC;AACpC,MAAIC,IAAOH,EAAQ,UAAUE,EAAK,SAASD,IAAQD,IAAUC;AAC7D,EAAI,OAAOE,CAAI,IAAID,EAAK,QAAKC,IAAOF;AACpC,QAAMG,IAAUD,EAAK,UAAUD,EAAK,UAAU,OAAOC,CAAI,IAAI,KAAKD,EAAK;AACvE,SAAO,EAAE,MAAAC,GAAM,SAAAC,EAAA;AACjB;AAOO,SAASC,EAAYC,GAAsBC,GAAYL,GAA2B;AACvF,QAAMM,IAAO,KAAK,IAAID,CAAE,KAAK,GACvBE,IAAQP,EAAK,KACbQ,IAA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AA,UAAA;AAIAoC,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM;AAAA,GAzIrBrC,EA0IpB,WAAA,OAAA;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as w, p as x, d as $ } from "./kt-calendar-
|
|
1
|
+
import { c as w, p as x, d as $ } from "./kt-calendar-D72xa8qr.js";
|
|
2
2
|
import { d } from "./locale-C5xLkGx5.js";
|
|
3
3
|
function y(t) {
|
|
4
4
|
return t.normalize("NFD").replace(/\p{Diacritic}/gu, "").replace(/\.$/, "").toLowerCase();
|
|
@@ -100,4 +100,4 @@ export {
|
|
|
100
100
|
B as p,
|
|
101
101
|
L as t
|
|
102
102
|
};
|
|
103
|
-
//# sourceMappingURL=typed-date-
|
|
103
|
+
//# sourceMappingURL=typed-date-Z3vcUJbb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typed-date-CPAUNHzr.js","sources":["../../src/internal/typed-date.ts"],"sourcesContent":["/**\n * Reading a date someone typed, in their language.\n *\n * A field that only opens a calendar makes a date ten years away, or one\n * already on paper, a chore. Typed, it is a second's work — if the field reads\n * it the way the person writes it: day then month in London, month then day in\n * New York, month names in their own words, the year left out when it is this\n * one.\n */\nimport { daysInMonth, parseDate, compareDates, type PlainDate } from './date.js';\nimport { dateFormat } from './locale.js';\n\n/** Lowercase, without accents or a trailing full stop: \"Févr.\" reads \"fevr\". */\nfunction fold(text: string): string {\n return text\n .normalize('NFD')\n .replace(/\\p{Diacritic}/gu, '')\n .replace(/\\.$/, '')\n .toLowerCase();\n}\n\n/**\n * How the language writes a date in numbers: the order of day, month and year,\n * and what goes between them — `25/09/2026`, `09/25/2026`, `25.09.2026`.\n */\nexport function dateLayout(locale: string): {\n order: ('day' | 'month' | 'year')[];\n separator: string;\n} {\n const parts = dateFormat(locale, {\n day: '2-digit',\n month: '2-digit',\n year: 'numeric',\n }).formatToParts(new Date(2026, 8, 30));\n const separator = parts.find((part) => part.type === 'literal')?.value.trim() || '/';\n return { order: numericOrder(locale), separator };\n}\n\n/** The order the language writes day, month and year in numbers. */\nfunction numericOrder(locale: string): ('day' | 'month' | 'year')[] {\n const parts = dateFormat(locale, { day: '2-digit', month: '2-digit', year: 'numeric' })\n .formatToParts(new Date(2026, 8, 30))\n .map((part) => part.type)\n .filter((type): type is 'day' | 'month' | 'year' => ['day', 'month', 'year'].includes(type));\n return parts.length === 3 ? parts : ['day', 'month', 'year'];\n}\n\n/** The month a word names in the language, or null when it names none or several. */\nfunction monthNamed(word: string, locale: string): number | null {\n const typed = fold(word);\n if (typed.length < 3) return null;\n\n const matches = new Set<number>();\n for (let month = 1; month <= 12; month += 1) {\n const sample = new Date(2026, month - 1, 1);\n const long = fold(dateFormat(locale, { month: 'long' }).format(sample));\n const short = fold(dateFormat(locale, { month: 'short' }).format(sample));\n if (long.startsWith(typed) || short === typed) matches.add(month);\n }\n return matches.size === 1 ? [...matches][0]! : null;\n}\n\n/** A typed year: two digits are this century, or the last, whichever is nearer. */\nfunction readYear(digits: string, reference: number): number | null {\n if (digits.length === 4) return Number(digits);\n if (digits.length > 2) return null;\n const year = 2000 + Number(digits);\n return year > reference + 20 ? year - 100 : year;\n}\n\nfunction valid(year: number, month: number, day: number): PlainDate | null {\n if (month < 1 || month > 12 || day < 1 || day > daysInMonth(year, month)) return null;\n return { year, month, day };\n}\n\n/** The date, and whether a year was typed or borrowed. */\nfunction read(\n text: string,\n locale: string,\n reference: PlainDate,\n): { date: PlainDate; typedYear: boolean } | null {\n const trimmed = text.trim();\n if (!trimmed) return null;\n\n const iso = /^\\d{4}-\\d{1,2}-\\d{1,2}$/.test(trimmed)\n ? parseDate(trimmed.replace(/-(\\d)(?=-|$)/g, '-0$1'))\n : null;\n if (iso) return { date: iso, typedYear: true };\n\n const numbers: string[] = [];\n let named: number | null = null;\n for (const token of trimmed.split(/[\\s/.,-]+/).filter(Boolean)) {\n if (/^\\d+$/.test(token)) {\n numbers.push(token);\n continue;\n }\n const month = monthNamed(token, locale);\n if (month === null || named !== null) return null;\n named = month;\n }\n\n if (named !== null) {\n // \"25 Sept 2026\", \"Sep 25, 2026\", \"3 march\": the day, and maybe a year.\n if (numbers.length === 0 || numbers.length > 2) return null;\n const yearIndex = numbers.findIndex((token) => token.length === 4 || Number(token) > 31);\n const dayToken = numbers.find((_, index) => index !== yearIndex);\n if (dayToken === undefined || (numbers.length === 2 && yearIndex < 0)) return null;\n const year = yearIndex >= 0 ? readYear(numbers[yearIndex]!, reference.year) : reference.year;\n if (year === null) return null;\n const date = valid(year, named, Number(dayToken));\n return date && { date, typedYear: yearIndex >= 0 };\n }\n\n // All numbers, in the language's order; a leading four-digit year reads ISO-wise.\n if (numbers.length < 2 || numbers.length > 3) return null;\n const order =\n numbers[0]!.length === 4\n ? (['year', 'month', 'day'] as const)\n : numberOrderFor(numericOrder(locale), numbers.length);\n const field = (name: 'day' | 'month' | 'year') => numbers[order.indexOf(name)];\n\n const yearToken = field('year');\n const year = yearToken === undefined ? reference.year : readYear(yearToken, reference.year);\n if (year === null) return null;\n const date = valid(year, Number(field('month')), Number(field('day')));\n return date && { date, typedYear: yearToken !== undefined };\n}\n\n/** Two numbers are the day and month, in the language's order, with the year left out. */\nfunction numberOrderFor(\n order: ('day' | 'month' | 'year')[],\n count: number,\n): readonly ('day' | 'month' | 'year')[] {\n return count === 3 ? order : order.filter((part) => part !== 'year');\n}\n\n/** A typed year: two digits are this century or the last, whichever is nearer. */\nexport function typedYear(digits: string, reference: number): number | null {\n return readYear(digits, reference);\n}\n\n/** A date typed in `locale`, or null when it does not read as one. */\nexport function parseTypedDate(\n text: string,\n locale: string,\n reference: PlainDate,\n): PlainDate | null {\n return read(text, locale, reference)?.date ?? null;\n}\n\n/**\n * A period typed as two dates around a dash — \"1/9 – 25/9/2026\" — in order.\n * A start typed without a year borrows the end's, the year before if that\n * would put it after the end: \"20/12 – 5/1/2027\" starts in December 2026.\n */\nexport function parseTypedRange(\n text: string,\n locale: string,\n reference: PlainDate,\n): { start: PlainDate; end: PlainDate } | null {\n const halves = text.split(/\\s*[–—]\\s*|\\s+-\\s+|\\s+(?:to|au|bis|à)\\s+/i);\n if (halves.length !== 2) return null;\n\n const end = read(halves[1]!, locale, reference);\n if (!end) return null;\n const start = read(halves[0]!, locale, { ...reference, year: end.date.year });\n if (!start) return null;\n\n let from = start.date;\n if (!start.typedYear && compareDates(from, end.date) > 0) {\n const earlier = valid(from.year - 1, from.month, from.day);\n if (earlier) from = earlier;\n }\n return compareDates(from, end.date) <= 0\n ? { start: from, end: end.date }\n : { start: end.date, end: from };\n}\n\n/** `reference` written in numbers the way `locale` writes a date — for a hint. */\nexport function exampleDate(locale: string, reference: PlainDate): string {\n return dateFormat(locale, { day: '2-digit', month: '2-digit', year: 'numeric' }).format(\n new Date(reference.year, reference.month - 1, reference.day, 12),\n );\n}\n"],"names":["fold","text","dateLayout","locale","separator","dateFormat","part","numericOrder","parts","type","monthNamed","word","typed","matches","month","sample","long","short","readYear","digits","reference","year","valid","day","daysInMonth","read","trimmed","iso","parseDate","numbers","named","token","yearIndex","dayToken","_","index","date","order","numberOrderFor","field","name","yearToken","count","typedYear","parseTypedDate","parseTypedRange","halves","end","start","from","compareDates","earlier","exampleDate"],"mappings":";;AAaA,SAASA,EAAKC,GAAsB;AAClC,SAAOA,EACJ,UAAU,KAAK,EACf,QAAQ,mBAAmB,EAAE,EAC7B,QAAQ,OAAO,EAAE,EACjB,YAAA;AACL;AAMO,SAASC,EAAWC,GAGzB;AAMA,QAAMC,IALQC,EAAWF,GAAQ;AAAA,IAC/B,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,EAAA,CACP,EAAE,cAAc,IAAI,KAAK,MAAM,GAAG,EAAE,CAAC,EACd,KAAK,CAACG,MAASA,EAAK,SAAS,SAAS,GAAG,MAAM,KAAA,KAAU;AACjF,SAAO,EAAE,OAAOC,EAAaJ,CAAM,GAAG,WAAAC,EAAA;AACxC;AAGA,SAASG,EAAaJ,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F,EAAI,IAAI,IAAI,GAAG;AACxD,UAAMI,IAAU7B,EAAM2B,EAAK,OAAO,GAAGA,EAAK,OAAOA,EAAK,GAAG;AACzD,IAAIE,MAASF,IAAOE;AAAA,EACtB;AACA,SAAOD,EAAaD,GAAMF,EAAI,IAAI,KAAK,IACnC,EAAE,OAAOE,GAAM,KAAKF,EAAI,SACxB,EAAE,OAAOA,EAAI,MAAM,KAAKE,EAAA;AAC9B;AAGO,SAASG,EAAYjD,GAAgBiB,GAA8B;AACxE,SAAOf,EAAWF,GAAQ,EAAE,KAAK,WAAW,OAAO,WAAW,MAAM,UAAA,CAAW,EAAE;AAAA,IAC/E,IAAI,KAAKiB,EAAU,MAAMA,EAAU,QAAQ,GAAGA,EAAU,KAAK,EAAE;AAAA,EAAA;AAEnE;"}
|
|
1
|
+
{"version":3,"file":"typed-date-Z3vcUJbb.js","sources":["../../src/internal/typed-date.ts"],"sourcesContent":["/**\n * Reading a date someone typed, in their language.\n *\n * A field that only opens a calendar makes a date ten years away, or one\n * already on paper, a chore. Typed, it is a second's work — if the field reads\n * it the way the person writes it: day then month in London, month then day in\n * New York, month names in their own words, the year left out when it is this\n * one.\n */\nimport { daysInMonth, parseDate, compareDates, type PlainDate } from './date.js';\nimport { dateFormat } from './locale.js';\n\n/** Lowercase, without accents or a trailing full stop: \"Févr.\" reads \"fevr\". */\nfunction fold(text: string): string {\n return text\n .normalize('NFD')\n .replace(/\\p{Diacritic}/gu, '')\n .replace(/\\.$/, '')\n .toLowerCase();\n}\n\n/**\n * How the language writes a date in numbers: the order of day, month and year,\n * and what goes between them — `25/09/2026`, `09/25/2026`, `25.09.2026`.\n */\nexport function dateLayout(locale: string): {\n order: ('day' | 'month' | 'year')[];\n separator: string;\n} {\n const parts = dateFormat(locale, {\n day: '2-digit',\n month: '2-digit',\n year: 'numeric',\n }).formatToParts(new Date(2026, 8, 30));\n const separator = parts.find((part) => part.type === 'literal')?.value.trim() || '/';\n return { order: numericOrder(locale), separator };\n}\n\n/** The order the language writes day, month and year in numbers. */\nfunction numericOrder(locale: string): ('day' | 'month' | 'year')[] {\n const parts = dateFormat(locale, { day: '2-digit', month: '2-digit', year: 'numeric' })\n .formatToParts(new Date(2026, 8, 30))\n .map((part) => part.type)\n .filter((type): type is 'day' | 'month' | 'year' => ['day', 'month', 'year'].includes(type));\n return parts.length === 3 ? parts : ['day', 'month', 'year'];\n}\n\n/** The month a word names in the language, or null when it names none or several. */\nfunction monthNamed(word: string, locale: string): number | null {\n const typed = fold(word);\n if (typed.length < 3) return null;\n\n const matches = new Set<number>();\n for (let month = 1; month <= 12; month += 1) {\n const sample = new Date(2026, month - 1, 1);\n const long = fold(dateFormat(locale, { month: 'long' }).format(sample));\n const short = fold(dateFormat(locale, { month: 'short' }).format(sample));\n if (long.startsWith(typed) || short === typed) matches.add(month);\n }\n return matches.size === 1 ? [...matches][0]! : null;\n}\n\n/** A typed year: two digits are this century, or the last, whichever is nearer. */\nfunction readYear(digits: string, reference: number): number | null {\n if (digits.length === 4) return Number(digits);\n if (digits.length > 2) return null;\n const year = 2000 + Number(digits);\n return year > reference + 20 ? year - 100 : year;\n}\n\nfunction valid(year: number, month: number, day: number): PlainDate | null {\n if (month < 1 || month > 12 || day < 1 || day > daysInMonth(year, month)) return null;\n return { year, month, day };\n}\n\n/** The date, and whether a year was typed or borrowed. */\nfunction read(\n text: string,\n locale: string,\n reference: PlainDate,\n): { date: PlainDate; typedYear: boolean } | null {\n const trimmed = text.trim();\n if (!trimmed) return null;\n\n const iso = /^\\d{4}-\\d{1,2}-\\d{1,2}$/.test(trimmed)\n ? parseDate(trimmed.replace(/-(\\d)(?=-|$)/g, '-0$1'))\n : null;\n if (iso) return { date: iso, typedYear: true };\n\n const numbers: string[] = [];\n let named: number | null = null;\n for (const token of trimmed.split(/[\\s/.,-]+/).filter(Boolean)) {\n if (/^\\d+$/.test(token)) {\n numbers.push(token);\n continue;\n }\n const month = monthNamed(token, locale);\n if (month === null || named !== null) return null;\n named = month;\n }\n\n if (named !== null) {\n // \"25 Sept 2026\", \"Sep 25, 2026\", \"3 march\": the day, and maybe a year.\n if (numbers.length === 0 || numbers.length > 2) return null;\n const yearIndex = numbers.findIndex((token) => token.length === 4 || Number(token) > 31);\n const dayToken = numbers.find((_, index) => index !== yearIndex);\n if (dayToken === undefined || (numbers.length === 2 && yearIndex < 0)) return null;\n const year = yearIndex >= 0 ? readYear(numbers[yearIndex]!, reference.year) : reference.year;\n if (year === null) return null;\n const date = valid(year, named, Number(dayToken));\n return date && { date, typedYear: yearIndex >= 0 };\n }\n\n // All numbers, in the language's order; a leading four-digit year reads ISO-wise.\n if (numbers.length < 2 || numbers.length > 3) return null;\n const order =\n numbers[0]!.length === 4\n ? (['year', 'month', 'day'] as const)\n : numberOrderFor(numericOrder(locale), numbers.length);\n const field = (name: 'day' | 'month' | 'year') => numbers[order.indexOf(name)];\n\n const yearToken = field('year');\n const year = yearToken === undefined ? reference.year : readYear(yearToken, reference.year);\n if (year === null) return null;\n const date = valid(year, Number(field('month')), Number(field('day')));\n return date && { date, typedYear: yearToken !== undefined };\n}\n\n/** Two numbers are the day and month, in the language's order, with the year left out. */\nfunction numberOrderFor(\n order: ('day' | 'month' | 'year')[],\n count: number,\n): readonly ('day' | 'month' | 'year')[] {\n return count === 3 ? order : order.filter((part) => part !== 'year');\n}\n\n/** A typed year: two digits are this century or the last, whichever is nearer. */\nexport function typedYear(digits: string, reference: number): number | null {\n return readYear(digits, reference);\n}\n\n/** A date typed in `locale`, or null when it does not read as one. */\nexport function parseTypedDate(\n text: string,\n locale: string,\n reference: PlainDate,\n): PlainDate | null {\n return read(text, locale, reference)?.date ?? null;\n}\n\n/**\n * A period typed as two dates around a dash — \"1/9 – 25/9/2026\" — in order.\n * A start typed without a year borrows the end's, the year before if that\n * would put it after the end: \"20/12 – 5/1/2027\" starts in December 2026.\n */\nexport function parseTypedRange(\n text: string,\n locale: string,\n reference: PlainDate,\n): { start: PlainDate; end: PlainDate } | null {\n const halves = text.split(/\\s*[–—]\\s*|\\s+-\\s+|\\s+(?:to|au|bis|à)\\s+/i);\n if (halves.length !== 2) return null;\n\n const end = read(halves[1]!, locale, reference);\n if (!end) return null;\n const start = read(halves[0]!, locale, { ...reference, year: end.date.year });\n if (!start) return null;\n\n let from = start.date;\n if (!start.typedYear && compareDates(from, end.date) > 0) {\n const earlier = valid(from.year - 1, from.month, from.day);\n if (earlier) from = earlier;\n }\n return compareDates(from, end.date) <= 0\n ? { start: from, end: end.date }\n : { start: end.date, end: from };\n}\n\n/** `reference` written in numbers the way `locale` writes a date — for a hint. */\nexport function exampleDate(locale: string, reference: PlainDate): string {\n return dateFormat(locale, { day: '2-digit', month: '2-digit', year: 'numeric' }).format(\n new Date(reference.year, reference.month - 1, reference.day, 12),\n );\n}\n"],"names":["fold","text","dateLayout","locale","separator","dateFormat","part","numericOrder","parts","type","monthNamed","word","typed","matches","month","sample","long","short","readYear","digits","reference","year","valid","day","daysInMonth","read","trimmed","iso","parseDate","numbers","named","token","yearIndex","dayToken","_","index","date","order","numberOrderFor","field","name","yearToken","count","typedYear","parseTypedDate","parseTypedRange","halves","end","start","from","compareDates","earlier","exampleDate"],"mappings":";;AAaA,SAASA,EAAKC,GAAsB;AAClC,SAAOA,EACJ,UAAU,KAAK,EACf,QAAQ,mBAAmB,EAAE,EAC7B,QAAQ,OAAO,EAAE,EACjB,YAAA;AACL;AAMO,SAASC,EAAWC,GAGzB;AAMA,QAAMC,IALQC,EAAWF,GAAQ;AAAA,IAC/B,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,EAAA,CACP,EAAE,cAAc,IAAI,KAAK,MAAM,GAAG,EAAE,CAAC,EACd,KAAK,CAACG,MAASA,EAAK,SAAS,SAAS,GAAG,MAAM,KAAA,KAAU;AACjF,SAAO,EAAE,OAAOC,EAAaJ,CAAM,GAAG,WAAAC,EAAA;AACxC;AAGA,SAASG,EAAaJ,GAA8C;AAClE,QAAMK,IAAQH,EAAWF,GAAQ,EAAE,KAAK,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B,EAAK,OAAO,GAAGA,EAAK,OAAOA,EAAK,GAAG;AACzD,IAAIE,MAASF,IAAOE;AAAA,EACtB;AACA,SAAOD,EAAaD,GAAMF,EAAI,IAAI,KAAK,IACnC,EAAE,OAAOE,GAAM,KAAKF,EAAI,SACxB,EAAE,OAAOA,EAAI,MAAM,KAAKE,EAAA;AAC9B;AAGO,SAASG,EAAYjD,GAAgBiB,GAA8B;AACxE,SAAOf,EAAWF,GAAQ,EAAE,KAAK,WAAW,OAAO,WAAW,MAAM,UAAA,CAAW,EAAE;AAAA,IAC/E,IAAI,KAAKiB,EAAU,MAAMA,EAAU,QAAQ,GAAGA,EAAU,KAAK,EAAE;AAAA,EAAA;AAEnE;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { css as p, nothing as f, html as n } from "lit";
|
|
2
2
|
import { state as v, property as o } from "lit/decorators.js";
|
|
3
3
|
import { classMap as c } from "lit/directives/class-map.js";
|
|
4
|
-
import { K as d, d as g } from "../../../chunks/kt-element-
|
|
5
|
-
import { s as m } from "../../../chunks/index-
|
|
4
|
+
import { K as d, d as g } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
5
|
+
import { s as m } from "../../../chunks/index-BEWmAE0T.js";
|
|
6
6
|
import "../kt-icon/kt-icon.js";
|
|
7
7
|
var y = Object.defineProperty, s = (a, e, t, k) => {
|
|
8
8
|
for (var i = void 0, l = a.length - 1, h; l >= 0; l--)
|
|
@@ -2,9 +2,9 @@ import { css as h, nothing as n, html as l } from "lit";
|
|
|
2
2
|
import { property as e } from "lit/decorators.js";
|
|
3
3
|
import { classMap as b } from "lit/directives/class-map.js";
|
|
4
4
|
import { styleMap as m } from "lit/directives/style-map.js";
|
|
5
|
-
import { K as p, d as v } from "../../../chunks/kt-element-
|
|
5
|
+
import { K as p, d as v } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
6
6
|
import { e as u } from "../../../chunks/events-r51msXNf.js";
|
|
7
|
-
import { s as g } from "../../../chunks/index-
|
|
7
|
+
import { s as g } from "../../../chunks/index-BEWmAE0T.js";
|
|
8
8
|
import "../kt-icon/kt-icon.js";
|
|
9
9
|
var f = Object.defineProperty, t = (s, r, i, y) => {
|
|
10
10
|
for (var a = void 0, c = s.length - 1, d; c >= 0; c--)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css as h, html as d, nothing as i } from "lit";
|
|
2
2
|
import { property as e } from "lit/decorators.js";
|
|
3
3
|
import { classMap as p } from "lit/directives/class-map.js";
|
|
4
|
-
import { K as u, d as v } from "../../../chunks/kt-element-
|
|
4
|
+
import { K as u, d as v } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
5
5
|
import "../kt-icon/kt-icon.js";
|
|
6
6
|
var g = Object.defineProperty, a = (l, t, o, y) => {
|
|
7
7
|
for (var n = void 0, c = l.length - 1, s; c >= 0; c--)
|
|
@@ -2,7 +2,7 @@ import { css as f, nothing as r, html as d } from "lit";
|
|
|
2
2
|
import { state as g, property as a } from "lit/decorators.js";
|
|
3
3
|
import { classMap as n } from "lit/directives/class-map.js";
|
|
4
4
|
import { styleMap as u } from "lit/directives/style-map.js";
|
|
5
|
-
import { K as m, d as v } from "../../../chunks/kt-element-
|
|
5
|
+
import { K as m, d as v } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
6
6
|
import { e as b } from "../../../chunks/events-r51msXNf.js";
|
|
7
7
|
import { h as p } from "../../../chunks/slots-BPbIdxAJ.js";
|
|
8
8
|
var y = Object.defineProperty, i = (s, e, c, k) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { css as b, nothing as s, html as c } from "lit";
|
|
2
2
|
import { state as v, property as d } from "lit/decorators.js";
|
|
3
|
-
import { K as h, d as m } from "../../../chunks/kt-element-
|
|
3
|
+
import { K as h, d as m } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
4
4
|
import { e as g } from "../../../chunks/events-r51msXNf.js";
|
|
5
|
-
import { s as r } from "../../../chunks/index-
|
|
5
|
+
import { s as r } from "../../../chunks/index-BEWmAE0T.js";
|
|
6
6
|
import "../kt-icon/kt-icon.js";
|
|
7
7
|
var y = Object.defineProperty, a = (p, o, n, x) => {
|
|
8
8
|
for (var e = void 0, i = p.length - 1, l; i >= 0; i--)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css as f, html as c, nothing as l } from "lit";
|
|
2
2
|
import { property as n } from "lit/decorators.js";
|
|
3
|
-
import { K as m, d as u } from "../../../chunks/kt-element-
|
|
3
|
+
import { K as m, d as u } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
4
4
|
import { g as v } from "../../../chunks/defaults-Cpeg13O5.js";
|
|
5
5
|
var w = Object.defineProperty, o = (i, e, r, h) => {
|
|
6
6
|
for (var t = void 0, a = i.length - 1, d; a >= 0; a--)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css as c, html as i } from "lit";
|
|
2
2
|
import { property as p } from "lit/decorators.js";
|
|
3
|
-
import { K as l, d as m } from "../../../chunks/kt-element-
|
|
3
|
+
import { K as l, d as m } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
4
4
|
var f = Object.defineProperty, d = (a, t, e, h) => {
|
|
5
5
|
for (var r = void 0, s = a.length - 1, o; s >= 0; s--)
|
|
6
6
|
(o = a[s]) && (r = o(t, e, r) || r);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { css as g, nothing as p, html as a } from "lit";
|
|
2
2
|
import { query as f, state as y, property as o } from "lit/decorators.js";
|
|
3
3
|
import { classMap as w } from "lit/directives/class-map.js";
|
|
4
|
-
import { K as h, d as x } from "../../../chunks/kt-element-
|
|
4
|
+
import { K as h, d as x } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
5
5
|
import { e as k } from "../../../chunks/events-r51msXNf.js";
|
|
6
6
|
import { f as m, o as $, l as I, n as u } from "../../../chunks/listbox-LsUEyGhQ.js";
|
|
7
|
-
import { s as v } from "../../../chunks/index-
|
|
7
|
+
import { s as v } from "../../../chunks/index-BEWmAE0T.js";
|
|
8
8
|
import "../kt-button/kt-button.js";
|
|
9
9
|
import "../kt-icon/kt-icon.js";
|
|
10
10
|
import "../../overlays/kt-dropdown/kt-dropdown.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { svg as b, nothing as A, css as vt, html as G } from "lit";
|
|
2
2
|
import { query as kt, state as et, property as B } from "lit/decorators.js";
|
|
3
3
|
import { classMap as wt } from "lit/directives/class-map.js";
|
|
4
|
-
import { K as nt, d as Mt } from "../../../chunks/kt-element-
|
|
4
|
+
import { K as nt, d as Mt } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
5
5
|
import { u as At, e as lt } from "../../../chunks/events-r51msXNf.js";
|
|
6
|
-
import { s as E } from "../../../chunks/index-
|
|
6
|
+
import { s as E } from "../../../chunks/index-BEWmAE0T.js";
|
|
7
7
|
function St(s) {
|
|
8
8
|
const t = Math.floor(Math.log10(s)), e = s / 10 ** t;
|
|
9
9
|
return (e < 1.5 ? 1 : e < 3 ? 2 : e < 7 ? 5 : 10) * 10 ** t;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css as m, html as r, nothing as o } from "lit";
|
|
2
2
|
import { property as i } from "lit/decorators.js";
|
|
3
|
-
import { K as u, d as c } from "../../../chunks/kt-element-
|
|
3
|
+
import { K as u, d as c } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
4
4
|
var g = Object.defineProperty, n = (d, t, e, s) => {
|
|
5
5
|
for (var a = void 0, p = d.length - 1, h; p >= 0; p--)
|
|
6
6
|
(h = d[p]) && (a = h(t, e, a) || a);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { css as h, html as m } from "lit";
|
|
2
2
|
import { property as n } from "lit/decorators.js";
|
|
3
|
-
import { K as g, d as c } from "../../../chunks/kt-element-
|
|
3
|
+
import { K as g, d as c } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
4
4
|
import { e as u } from "../../../chunks/events-r51msXNf.js";
|
|
5
|
-
import { s as i } from "../../../chunks/index-
|
|
5
|
+
import { s as i } from "../../../chunks/index-BEWmAE0T.js";
|
|
6
6
|
import "../../core/kt-button/kt-button.js";
|
|
7
7
|
var d = Object.defineProperty, p = (r, a, t, f) => {
|
|
8
8
|
for (var e = void 0, o = r.length - 1, l; o >= 0; o--)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css as h, nothing as l, html as r } from "lit";
|
|
2
2
|
import { property as e } from "lit/decorators.js";
|
|
3
|
-
import { K as c, d as f } from "../../../chunks/kt-element-
|
|
3
|
+
import { K as c, d as f } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
4
4
|
import "../../core/kt-icon/kt-icon.js";
|
|
5
5
|
import "../../core/kt-badge/kt-badge.js";
|
|
6
6
|
import "../../feedback/kt-skeleton/kt-skeleton.js";
|
|
@@ -2,10 +2,10 @@ import { css as k, nothing as d, html as h } from "lit";
|
|
|
2
2
|
import { property as n, state as f } from "lit/decorators.js";
|
|
3
3
|
import { classMap as S } from "lit/directives/class-map.js";
|
|
4
4
|
import { styleMap as v } from "lit/directives/style-map.js";
|
|
5
|
-
import { K as w, d as R } from "../../../chunks/kt-element-
|
|
5
|
+
import { K as w, d as R } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
6
6
|
import { e as g } from "../../../chunks/events-r51msXNf.js";
|
|
7
7
|
import { r as M } from "../../../chunks/locale-C5xLkGx5.js";
|
|
8
|
-
import { s as u } from "../../../chunks/index-
|
|
8
|
+
import { s as u } from "../../../chunks/index-BEWmAE0T.js";
|
|
9
9
|
import "../../core/kt-icon/kt-icon.js";
|
|
10
10
|
import "../kt-pagination/kt-pagination.js";
|
|
11
11
|
const H = 50;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css as h, html as s, nothing as m } from "lit";
|
|
2
2
|
import { property as a } from "lit/decorators.js";
|
|
3
3
|
import { classMap as k } from "lit/directives/class-map.js";
|
|
4
|
-
import { K as c, d as f } from "../../../chunks/kt-element-
|
|
4
|
+
import { K as c, d as f } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
5
5
|
import "../../core/kt-icon/kt-icon.js";
|
|
6
6
|
var v = Object.defineProperty, i = (l, r, o, n) => {
|
|
7
7
|
for (var e = void 0, p = l.length - 1, d; p >= 0; p--)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { css as v, nothing as s, html as e } from "lit";
|
|
2
2
|
import { property as t } from "lit/decorators.js";
|
|
3
|
-
import { K as p, d as g } from "../../../chunks/kt-element-
|
|
3
|
+
import { K as p, d as g } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
4
4
|
import { e as h } from "../../../chunks/events-r51msXNf.js";
|
|
5
|
-
import { s as f } from "../../../chunks/index-
|
|
5
|
+
import { s as f } from "../../../chunks/index-BEWmAE0T.js";
|
|
6
6
|
import "../../core/kt-icon/kt-icon.js";
|
|
7
7
|
var u = Object.defineProperty, a = (n, i, c, b) => {
|
|
8
8
|
for (var o = void 0, l = n.length - 1, d; l >= 0; l--)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css as h, nothing as r, html as i } from "lit";
|
|
2
2
|
import { property as n } from "lit/decorators.js";
|
|
3
|
-
import { K as d, d as m } from "../../../chunks/kt-element-
|
|
3
|
+
import { K as d, d as m } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
4
4
|
import "../../core/kt-icon/kt-icon.js";
|
|
5
5
|
var g = Object.defineProperty, o = (s, p, c, f) => {
|
|
6
6
|
for (var t = void 0, a = s.length - 1, l; a >= 0; a--)
|
|
@@ -2,7 +2,7 @@ import { css as v, nothing as p, html as o } from "lit";
|
|
|
2
2
|
import { property as t } from "lit/decorators.js";
|
|
3
3
|
import { classMap as d } from "lit/directives/class-map.js";
|
|
4
4
|
import { styleMap as m } from "lit/directives/style-map.js";
|
|
5
|
-
import { K as u, d as b } from "../../../chunks/kt-element-
|
|
5
|
+
import { K as u, d as b } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
6
6
|
var f = Object.defineProperty, r = (n, e, i, c) => {
|
|
7
7
|
for (var s = void 0, l = n.length - 1, h; l >= 0; l--)
|
|
8
8
|
(h = n[l]) && (s = h(e, i, s) || s);
|
|
@@ -2,7 +2,7 @@ import { css as u, html as c } from "lit";
|
|
|
2
2
|
import { property as s } from "lit/decorators.js";
|
|
3
3
|
import { classMap as h } from "lit/directives/class-map.js";
|
|
4
4
|
import { styleMap as m } from "lit/directives/style-map.js";
|
|
5
|
-
import { K as d, d as f } from "../../../chunks/kt-element-
|
|
5
|
+
import { K as d, d as f } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
6
6
|
var y = Object.defineProperty, a = (n, i, t, l) => {
|
|
7
7
|
for (var e = void 0, o = n.length - 1, p; o >= 0; o--)
|
|
8
8
|
(p = n[o]) && (e = p(i, t, e) || e);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { css as v, nothing as n, html as a } from "lit";
|
|
2
2
|
import { state as u, property as s } from "lit/decorators.js";
|
|
3
|
-
import { K as p, d as m } from "../../../chunks/kt-element-
|
|
3
|
+
import { K as p, d as m } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
4
4
|
import { e as b } from "../../../chunks/events-r51msXNf.js";
|
|
5
|
-
import { s as h } from "../../../chunks/index-
|
|
5
|
+
import { s as h } from "../../../chunks/index-BEWmAE0T.js";
|
|
6
6
|
import "../../core/kt-icon/kt-icon.js";
|
|
7
7
|
import "../kt-progress-bar/kt-progress-bar.js";
|
|
8
8
|
var f = Object.defineProperty, o = (c, i, e, w) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css as c, html as m } from "lit";
|
|
2
2
|
import { property as p } from "lit/decorators.js";
|
|
3
|
-
import { K as l, d } from "../../../chunks/kt-element-
|
|
3
|
+
import { K as l, d } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
4
4
|
import "../kt-toast/kt-toast.js";
|
|
5
5
|
var f = Object.defineProperty, h = (i, t, e, n) => {
|
|
6
6
|
for (var s = void 0, o = i.length - 1, a; o >= 0; o--)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css as h, html as c } from "lit";
|
|
2
2
|
import { state as b, query as u, property as n } from "lit/decorators.js";
|
|
3
3
|
import { classMap as v } from "lit/directives/class-map.js";
|
|
4
|
-
import { K as l, d as f } from "../../../chunks/kt-element-
|
|
4
|
+
import { K as l, d as f } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
5
5
|
import { u as m } from "../../../chunks/events-r51msXNf.js";
|
|
6
6
|
import { p as w } from "../../../chunks/position-Cx_ZH5zh.js";
|
|
7
7
|
var y = Object.defineProperty, o = (r, e, s, d) => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "lit";
|
|
2
2
|
import "lit/decorators.js";
|
|
3
3
|
import "lit/directives/class-map.js";
|
|
4
|
-
import "../../../chunks/kt-element-
|
|
4
|
+
import "../../../chunks/kt-element-COgh6Yr1.js";
|
|
5
5
|
import "../../../chunks/events-r51msXNf.js";
|
|
6
6
|
import "../../../chunks/locale-C5xLkGx5.js";
|
|
7
|
-
import "../../../chunks/index-
|
|
8
|
-
import { K as f } from "../../../chunks/kt-calendar-
|
|
7
|
+
import "../../../chunks/index-BEWmAE0T.js";
|
|
8
|
+
import { K as f } from "../../../chunks/kt-calendar-D72xa8qr.js";
|
|
9
9
|
import "../../core/kt-icon/kt-icon.js";
|
|
10
10
|
export {
|
|
11
11
|
f as KtCalendar
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { css as p, nothing as a, html as c } from "lit";
|
|
2
2
|
import { query as b, property as i, state as u } from "lit/decorators.js";
|
|
3
3
|
import { live as m } from "lit/directives/live.js";
|
|
4
|
-
import { K as d, d as f } from "../../../chunks/kt-element-
|
|
4
|
+
import { K as d, d as f } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
5
5
|
import { e as k } from "../../../chunks/events-r51msXNf.js";
|
|
6
6
|
import { a as v, s as g, b as y } from "../../../chunks/form-control-B74_EHtG.js";
|
|
7
|
-
import { s as x } from "../../../chunks/index-
|
|
7
|
+
import { s as x } from "../../../chunks/index-BEWmAE0T.js";
|
|
8
8
|
import "../../core/kt-icon/kt-icon.js";
|
|
9
9
|
var C = Object.defineProperty, r = (l, e, o, $) => {
|
|
10
10
|
for (var s = void 0, n = l.length - 1, h; n >= 0; n--)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { css as D, nothing as m, html as g } from "lit";
|
|
2
2
|
import { property as w, state as x, query as $ } from "lit/decorators.js";
|
|
3
3
|
import { classMap as C } from "lit/directives/class-map.js";
|
|
4
|
-
import { d as P } from "../../../chunks/kt-element-
|
|
4
|
+
import { d as P } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
5
5
|
import { u as S, t as I } from "../../../chunks/events-r51msXNf.js";
|
|
6
|
-
import { F as q, f as E } from "../../../chunks/floating-
|
|
7
|
-
import { K as f } from "../../../chunks/segmented-field-
|
|
8
|
-
import { d as y, p as u, t as v, c as b, f as Y } from "../../../chunks/kt-calendar-
|
|
9
|
-
import { d as K, e as L, t as M } from "../../../chunks/typed-date-
|
|
10
|
-
import { s as l } from "../../../chunks/index-
|
|
6
|
+
import { F as q, f as E } from "../../../chunks/floating-C9RLa6cZ.js";
|
|
7
|
+
import { K as f } from "../../../chunks/segmented-field-BCjCGF4I.js";
|
|
8
|
+
import { d as y, p as u, t as v, c as b, f as Y } from "../../../chunks/kt-calendar-D72xa8qr.js";
|
|
9
|
+
import { d as K, e as L, t as M } from "../../../chunks/typed-date-Z3vcUJbb.js";
|
|
10
|
+
import { s as l } from "../../../chunks/index-BEWmAE0T.js";
|
|
11
11
|
import "../../core/kt-icon/kt-icon.js";
|
|
12
12
|
import "../../feedback/kt-tooltip/kt-tooltip.js";
|
|
13
13
|
var N = Object.defineProperty, c = (h, e, t, n) => {
|
|
@@ -2,14 +2,14 @@ import { css as T, nothing as d, html as p } from "lit";
|
|
|
2
2
|
import { query as S, state as h, property as s } from "lit/decorators.js";
|
|
3
3
|
import { classMap as x } from "lit/directives/class-map.js";
|
|
4
4
|
import { live as O } from "lit/directives/live.js";
|
|
5
|
-
import { K as D, d as R } from "../../../chunks/kt-element-
|
|
5
|
+
import { K as D, d as R } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
6
6
|
import { u as q, t as E, e as v } from "../../../chunks/events-r51msXNf.js";
|
|
7
7
|
import { a as B, s as F, b as L } from "../../../chunks/form-control-B74_EHtG.js";
|
|
8
|
-
import { F as z, f as K } from "../../../chunks/floating-
|
|
8
|
+
import { F as z, f as K } from "../../../chunks/floating-C9RLa6cZ.js";
|
|
9
9
|
import { r as M, d as _ } from "../../../chunks/locale-C5xLkGx5.js";
|
|
10
|
-
import { s as f } from "../../../chunks/index-
|
|
11
|
-
import { a as P, p as u, c as g, b as w, t as m, e as k, f as C, g as V, h as I, d as W } from "../../../chunks/kt-calendar-
|
|
12
|
-
import { p as U, a as Y, e as j } from "../../../chunks/typed-date-
|
|
10
|
+
import { s as f } from "../../../chunks/index-BEWmAE0T.js";
|
|
11
|
+
import { a as P, p as u, c as g, b as w, t as m, e as k, f as C, g as V, h as I, d as W } from "../../../chunks/kt-calendar-D72xa8qr.js";
|
|
12
|
+
import { p as U, a as Y, e as j } from "../../../chunks/typed-date-Z3vcUJbb.js";
|
|
13
13
|
import "../../core/kt-icon/kt-icon.js";
|
|
14
14
|
import "../../feedback/kt-tooltip/kt-tooltip.js";
|
|
15
15
|
var G = Object.defineProperty, a = (l, t, e, o) => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { css as v, nothing as p, html as c } from "lit";
|
|
2
2
|
import { query as y, state as f, property as n } from "lit/decorators.js";
|
|
3
3
|
import { classMap as b } from "lit/directives/class-map.js";
|
|
4
|
-
import { K as u, d as x } from "../../../chunks/kt-element-
|
|
4
|
+
import { K as u, d as x } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
5
5
|
import { e as h } from "../../../chunks/events-r51msXNf.js";
|
|
6
6
|
import { a as k, s as $, b as w } from "../../../chunks/form-control-B74_EHtG.js";
|
|
7
|
-
import { s as l } from "../../../chunks/index-
|
|
7
|
+
import { s as l } from "../../../chunks/index-BEWmAE0T.js";
|
|
8
8
|
import "../../core/kt-icon/kt-icon.js";
|
|
9
9
|
import "../../core/kt-button/kt-button.js";
|
|
10
10
|
const g = ["B", "KB", "MB", "GB", "TB"];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { css as f, nothing as h, html as d } from "lit";
|
|
2
2
|
import { queryAssignedElements as c, state as g, property as a } from "lit/decorators.js";
|
|
3
|
-
import { K as p, d as m } from "../../../chunks/kt-element-
|
|
3
|
+
import { K as p, d as m } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
4
4
|
import { h as y } from "../../../chunks/slots-BPbIdxAJ.js";
|
|
5
|
-
import { s as b } from "../../../chunks/index-
|
|
5
|
+
import { s as b } from "../../../chunks/index-BEWmAE0T.js";
|
|
6
6
|
import "../../feedback/kt-skeleton/kt-skeleton.js";
|
|
7
7
|
var u = Object.defineProperty, s = (r, e, o, v) => {
|
|
8
8
|
for (var i = void 0, l = r.length - 1, n; l >= 0; l--)
|
|
@@ -2,11 +2,11 @@ import { css as x, nothing as s, html as d } from "lit";
|
|
|
2
2
|
import { query as P, state as m, property as l } from "lit/decorators.js";
|
|
3
3
|
import { classMap as y } from "lit/directives/class-map.js";
|
|
4
4
|
import { live as w } from "lit/directives/live.js";
|
|
5
|
-
import { K as g, d as $ } from "../../../chunks/kt-element-
|
|
5
|
+
import { K as g, d as $ } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
6
6
|
import { t as C, e as c } from "../../../chunks/events-r51msXNf.js";
|
|
7
7
|
import { a as S, s as b, b as E } from "../../../chunks/form-control-B74_EHtG.js";
|
|
8
|
-
import { F as O, f as z } from "../../../chunks/floating-
|
|
9
|
-
import { s as u } from "../../../chunks/index-
|
|
8
|
+
import { F as O, f as z } from "../../../chunks/floating-C9RLa6cZ.js";
|
|
9
|
+
import { s as u } from "../../../chunks/index-BEWmAE0T.js";
|
|
10
10
|
import "../../core/kt-icon/kt-icon.js";
|
|
11
11
|
import "../../feedback/kt-tooltip/kt-tooltip.js";
|
|
12
12
|
const D = [
|
|
@@ -2,12 +2,12 @@ import { css as w, nothing as a, html as p } from "lit";
|
|
|
2
2
|
import { query as x, state as h, property as n } from "lit/decorators.js";
|
|
3
3
|
import { classMap as d } from "lit/directives/class-map.js";
|
|
4
4
|
import { live as k } from "lit/directives/live.js";
|
|
5
|
-
import { K as m, d as $ } from "../../../chunks/kt-element-
|
|
5
|
+
import { K as m, d as $ } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
6
6
|
import { u as I, t as y, e as f } from "../../../chunks/events-r51msXNf.js";
|
|
7
7
|
import { a as D, s as q, b as O } from "../../../chunks/form-control-B74_EHtG.js";
|
|
8
8
|
import { a as S, b as C, o as g, f as v, l as P, n as E } from "../../../chunks/listbox-LsUEyGhQ.js";
|
|
9
|
-
import { F as L, f as A } from "../../../chunks/floating-
|
|
10
|
-
import { s as l } from "../../../chunks/index-
|
|
9
|
+
import { F as L, f as A } from "../../../chunks/floating-C9RLa6cZ.js";
|
|
10
|
+
import { s as l } from "../../../chunks/index-BEWmAE0T.js";
|
|
11
11
|
import "../../core/kt-icon/kt-icon.js";
|
|
12
12
|
var V = Object.defineProperty, i = (u, t, o, r) => {
|
|
13
13
|
for (var s = void 0, c = u.length - 1, b; c >= 0; c--)
|