kanto-ds 1.7.0 → 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 +15 -10
- package/dist/cdn/kanto.min.js +887 -234
- 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 +5 -5
- package/dist/components/forms/kt-date-picker/kt-date-picker.js +4 -4
- 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 +2 -2
- package/dist/components/forms/kt-input-menu/kt-input-menu.js +2 -2
- package/dist/components/forms/kt-label-input/kt-label-input.js +1 -1
- package/dist/components/forms/kt-multi-select/kt-multi-select.js +2 -2
- 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 +2 -2
- 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 +2 -2
- 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-command-palette.md +99 -0
- package/dist/docs/kt-number-input.md +77 -0
- package/dist/docs/kt-slider.md +76 -0
- package/dist/docs/kt-steps.md +79 -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/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/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 +20 -3
- package/dist/chunks/index-TWJzttLX.js.map +0 -1
|
@@ -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,GAA8C;AAClE,QAAMK,IAAQH,EAAWF,GAAQ,EAAE,KAAK,WAAW,OAAO,WAAW,MAAM,UAAA,CAAW,EACnF,cAAc,IAAI,KAAK,MAAM,GAAG,EAAE,CAAC,EACnC,IAAI,CAACG,MAASA,EAAK,IAAI,EACvB,OAAO,CAACG,MAA2C,CAAC,OAAO,SAAS,MAAM,EAAE,SAASA,CAAI,CAAC;AAC7F,SAAOD,EAAM,WAAW,IAAIA,IAAQ,CAAC,OAAO,SAAS,MAAM;AAC7D;AAGA,SAASE,EAAWC,GAAcR,GAA+B;AAC/D,QAAMS,IAAQZ,EAAKW,CAAI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AAE;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,WAAW,OAAO,WAAW,MAAM,UAAA,CAAW,EACnF,cAAc,IAAI,KAAK,MAAM,GAAG,EAAE,CAAC,EACnC,IAAI,CAACG,MAASA,EAAK,IAAI,EACvB,OAAO,CAACG,MAA2C,CAAC,OAAO,SAAS,MAAM,EAAE,SAASA,CAAI,CAAC;AAC7F,SAAOD,EAAM,WAAW,IAAIA,IAAQ,CAAC,OAAO,SAAS,MAAM;AAC7D;AAGA,SAASE,EAAWC,GAAcR,GAA+B;AAC/D,QAAMS,IAAQZ,EAAKW,CAAI;AACvB,MAAIC,EAAM,SAAS,EAAG,QAAO;AAE7B,QAAMC,w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AQ,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
6
|
import { F as q, f as E } from "../../../chunks/floating-C9RLa6cZ.js";
|
|
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-
|
|
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
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
8
|
import { F as O, f as z } from "../../../chunks/floating-C9RLa6cZ.js";
|
|
9
|
-
import { s as u } from "../../../chunks/index-
|
|
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
9
|
import { F as L, f as A } from "../../../chunks/floating-C9RLa6cZ.js";
|
|
10
|
-
import { s as l } from "../../../chunks/index-
|
|
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--)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css as p, html as i } from "lit";
|
|
2
2
|
import { query as d, property as f } 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 b = Object.defineProperty, a = (r, t, s, h) => {
|
|
5
5
|
for (var e = void 0, o = r.length - 1, n; o >= 0; o--)
|
|
6
6
|
(n = r[o]) && (e = n(t, s, e) || e);
|
|
@@ -2,12 +2,12 @@ import { css as O, nothing as l, html as c } from "lit";
|
|
|
2
2
|
import { query as R, state as d, property as a } from "lit/decorators.js";
|
|
3
3
|
import { classMap as u } from "lit/directives/class-map.js";
|
|
4
4
|
import { live as E } from "lit/directives/live.js";
|
|
5
|
-
import { K as $, d as P } from "../../../chunks/kt-element-
|
|
5
|
+
import { K as $, d as P } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
6
6
|
import { u as C, t as I, e as D } from "../../../chunks/events-r51msXNf.js";
|
|
7
7
|
import { a as L, s as z, b as B } from "../../../chunks/form-control-B74_EHtG.js";
|
|
8
8
|
import { a as T, b as F, f as y, l as V, n as _, o as w } from "../../../chunks/listbox-LsUEyGhQ.js";
|
|
9
9
|
import { F as A, f as W } from "../../../chunks/floating-C9RLa6cZ.js";
|
|
10
|
-
import { s as p } from "../../../chunks/index-
|
|
10
|
+
import { s as p } from "../../../chunks/index-BEWmAE0T.js";
|
|
11
11
|
import "../../core/kt-icon/kt-icon.js";
|
|
12
12
|
var K = Object.defineProperty, r = (m, t, i, e) => {
|
|
13
13
|
for (var o = void 0, n = m.length - 1, v; n >= 0; n--)
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
2
|
+
import { KtElement } from '#internal/kt-element';
|
|
3
|
+
import '../../core/kt-icon/kt-icon.js';
|
|
4
|
+
export type KtNumberInputSize = 'small' | 'medium' | 'large';
|
|
5
|
+
/**
|
|
6
|
+
* A number typed the way `locale` writes one, or NaN. "1 234,5" in French is
|
|
7
|
+
* 1234.5; "−20" with a true minus sign is -20; a percent sign is dropped, and
|
|
8
|
+
* `percent` divides by a hundred. Text holding letters is no number: it is
|
|
9
|
+
* turned down rather than guessed at.
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseLocaleNumber(text: string, locale: string, percent?: boolean): number;
|
|
12
|
+
/**
|
|
13
|
+
* A number field with − and + beside it: a quantity, a seat count, an amount.
|
|
14
|
+
*
|
|
15
|
+
* Type a number the way your language writes one — "1 234,5" in French — or
|
|
16
|
+
* step it with the buttons, the arrows (Page Up and Down by ten steps, Home
|
|
17
|
+
* and End to the bounds). It is kept within `min` and `max` and on `step`
|
|
18
|
+
* when the field is left. At rest it reads as the locale writes it, through
|
|
19
|
+
* `formatOptions` — a currency, a percentage, a unit.
|
|
20
|
+
*
|
|
21
|
+
* @element kt-number-input
|
|
22
|
+
*
|
|
23
|
+
* @csspart field - The field.
|
|
24
|
+
* @csspart input - The text field.
|
|
25
|
+
* @csspart decrease - The − button.
|
|
26
|
+
* @csspart increase - The + button.
|
|
27
|
+
*
|
|
28
|
+
* @fires kt-change - The value changed. `detail: { value }`, a number or null.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```html
|
|
32
|
+
* <kt-number-input label="Seats" min="1" max="50" value="5"></kt-number-input>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare class KtNumberInput extends KtElement {
|
|
36
|
+
static readonly formAssociated = true;
|
|
37
|
+
static styles: import("lit").CSSResultGroup[];
|
|
38
|
+
/** The number, or null while empty. An attribute that is no number reads as empty. */
|
|
39
|
+
value: number | null;
|
|
40
|
+
min: number;
|
|
41
|
+
max: number;
|
|
42
|
+
step: number;
|
|
43
|
+
name: string;
|
|
44
|
+
/** Accessible name, when no `<kt-label-input>` wraps it. */
|
|
45
|
+
label: string;
|
|
46
|
+
/** BCP 47 locale for reading and writing numbers. Empty: page, then browser. */
|
|
47
|
+
locale: string;
|
|
48
|
+
placeholder: string;
|
|
49
|
+
size: KtNumberInputSize;
|
|
50
|
+
disabled: boolean;
|
|
51
|
+
required: boolean;
|
|
52
|
+
/** Error message. A non-empty value puts the field in its error state. */
|
|
53
|
+
error: string;
|
|
54
|
+
/** How the number reads at rest: `{ style: 'currency', currency: 'EUR' }`. */
|
|
55
|
+
formatOptions: Intl.NumberFormatOptions;
|
|
56
|
+
private focused;
|
|
57
|
+
private formDisabled;
|
|
58
|
+
private input;
|
|
59
|
+
private internals;
|
|
60
|
+
private defaultValue;
|
|
61
|
+
private readonly errorId;
|
|
62
|
+
connectedCallback(): void;
|
|
63
|
+
willUpdate(changed: PropertyValues<this>): void;
|
|
64
|
+
formResetCallback(): void;
|
|
65
|
+
formDisabledCallback(disabled: boolean): void;
|
|
66
|
+
formStateRestoreCallback(state: string | null): void;
|
|
67
|
+
focus(options?: FocusOptions): void;
|
|
68
|
+
private get resolvedLocale();
|
|
69
|
+
private get inactive();
|
|
70
|
+
/** `n` within bounds and on the step, counted from `min` when it has one. */
|
|
71
|
+
private clamp;
|
|
72
|
+
private commit;
|
|
73
|
+
/** The text for `value`: plain while typing, the locale's format at rest. */
|
|
74
|
+
private text;
|
|
75
|
+
/** Shown as a percentage: what is typed is on a scale of a hundred. */
|
|
76
|
+
private get percent();
|
|
77
|
+
private stepBy;
|
|
78
|
+
private onKeyDown;
|
|
79
|
+
/** What was typed, read; text that is no number puts back what it had. */
|
|
80
|
+
private readTyped;
|
|
81
|
+
private onFocus;
|
|
82
|
+
private onBlur;
|
|
83
|
+
render(): TemplateResult;
|
|
84
|
+
}
|
|
85
|
+
declare global {
|
|
86
|
+
interface HTMLElementTagNameMap {
|
|
87
|
+
'kt-number-input': KtNumberInput;
|
|
88
|
+
}
|
|
89
|
+
}
|