@kirana-ui/web 0.2.0 → 0.3.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/llms.txt +248 -74
- package/package.json +6 -2
- package/skills/kirana-ui-primitives/SKILL.md +29 -8
- package/src/alert-dialog.d.ts +2 -2
- package/src/alert-dialog.js +6 -2
- package/src/alert-dialog.js.map +1 -1
- package/src/around.d.ts +21 -4
- package/src/around.js +34 -12
- package/src/around.js.map +1 -1
- package/src/autocomplete.d.ts +6 -3
- package/src/autocomplete.js +8 -4
- package/src/autocomplete.js.map +1 -1
- package/src/avatar.d.ts +11 -5
- package/src/avatar.js +39 -10
- package/src/avatar.js.map +1 -1
- package/src/calendar.d.ts +9 -5
- package/src/calendar.js +21 -9
- package/src/calendar.js.map +1 -1
- package/src/checkbox-group.d.ts +22 -0
- package/src/checkbox-group.js +36 -0
- package/src/checkbox-group.js.map +1 -0
- package/src/checkbox.d.ts +4 -2
- package/src/checkbox.js +10 -4
- package/src/checkbox.js.map +1 -1
- package/src/combobox.d.ts +17 -4
- package/src/combobox.js +43 -6
- package/src/combobox.js.map +1 -1
- package/src/command.d.ts +1 -1
- package/src/command.js +2 -1
- package/src/command.js.map +1 -1
- package/src/context-menu.d.ts +2 -1
- package/src/context-menu.js.map +1 -1
- package/src/date-picker.d.ts +7 -4
- package/src/date-picker.js +12 -3
- package/src/date-picker.js.map +1 -1
- package/src/dates.d.ts +5 -2
- package/src/dates.js +50 -15
- package/src/dates.js.map +1 -1
- package/src/dialog.d.ts +2 -2
- package/src/dialog.js +6 -2
- package/src/dialog.js.map +1 -1
- package/src/hover-card.d.ts +2 -1
- package/src/hover-card.js.map +1 -1
- package/src/index.d.ts +7 -3
- package/src/index.js +1 -0
- package/src/menu.d.ts +2 -1
- package/src/menu.js.map +1 -1
- package/src/navigation-menu.d.ts +2 -1
- package/src/navigation-menu.js.map +1 -1
- package/src/number-field.d.ts +5 -2
- package/src/number-field.js +23 -3
- package/src/number-field.js.map +1 -1
- package/src/otp.d.ts +1 -1
- package/src/otp.js +2 -1
- package/src/otp.js.map +1 -1
- package/src/popover.d.ts +8 -7
- package/src/popover.js +33 -5
- package/src/popover.js.map +1 -1
- package/src/radio-group.d.ts +2 -1
- package/src/radio-group.js +9 -2
- package/src/radio-group.js.map +1 -1
- package/src/runtime.d.ts +7 -2
- package/src/runtime.js +7 -4
- package/src/runtime.js.map +1 -1
- package/src/select.d.ts +3 -2
- package/src/select.js +2 -1
- package/src/select.js.map +1 -1
- package/src/slider.d.ts +2 -2
- package/src/slider.js +3 -2
- package/src/slider.js.map +1 -1
- package/src/tooltip.d.ts +2 -1
- package/src/tooltip.js.map +1 -1
package/src/calendar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.js","names":[],"sources":["../../../../packages/web/src/calendar.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport { createCalendar } from \"@kirana-ui/core/calendar\"\nimport type { Calendar, CalendarProps } from \"@kirana-ui/core/calendar\"\n\nimport { calendarParts, days } from \"./dates.ts\"\nimport { defineElement } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\nconst { parts, lists } = calendarParts<Calendar>((controller) => controller)\n\n/**\n * `<kui-calendar>` around `kui-part=\"root\"`, with `previous` and `next` buttons, a `heading`\n * (it says the month) and a `grid` table. The table's head row holds a\n * `<template kui-each=\"weekdays\">` with a `head-cell` (`{short}`, `{narrow}`, `{long}`); its\n * body a `<template kui-each=\"weeks\">` with a row, which holds a `<template kui-each=\"days\">`\n * with a `cell` and its `day` button (`{date}`, `{label}`). `value` and `default-value` (a
|
|
1
|
+
{"version":3,"file":"calendar.js","names":[],"sources":["../../../../packages/web/src/calendar.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport { createCalendar } from \"@kirana-ui/core/calendar\"\nimport type { Calendar, CalendarProps } from \"@kirana-ui/core/calendar\"\n\nimport { calendarParts, days } from \"./dates.ts\"\nimport { defineElement } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\nconst { parts, lists } = calendarParts<Calendar>((controller) => controller)\n\n/**\n * `<kui-calendar>` around `kui-part=\"root\"`, with `previous` and `next` buttons, a `heading`\n * (it says the month) and a `grid` table. The table's head row holds a\n * `<template kui-each=\"weekdays\">` with a `head-cell` (`{short}`, `{narrow}`, `{long}`); its\n * body a `<template kui-each=\"weeks\">` with a row, which holds a `<template kui-each=\"days\">`\n * with a `cell` and its `day` button (`{date}`, `{label}`). With several `months`, a\n * `<template kui-each=\"months\">` (`{index}`, `{month}`, `{title}`) holds each month's\n * `heading` and `grid`. An `<input kui-part=\"input\">` submits the value under `name`.\n * `value` and `default-value` (a day as `2026-03-14`; a range's first and last, or a list's\n * days, with commas between), `mode`, `min-days`, `max-days`, `months`, `paged-navigation`,\n * `month`, `default-month`, `default-focused-value`, `locale`, `calendar-system`, `min`,\n * `max`, `disabled`, `read-only`, `fixed-weeks`, `name`, `form`; `isDateUnavailable` as a\n * property; it tells `value-change` and `month-change`.\n */\nexport const tag = defineElement<CalendarProps, Calendar>({\n tag: \"kui-calendar\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n mode: \"string\",\n \"min-days\": \"number\",\n \"max-days\": \"number\",\n months: \"number\",\n \"paged-navigation\": \"boolean\",\n month: \"string\",\n \"default-month\": \"string\",\n \"default-focused-value\": \"string\",\n locale: \"string\",\n \"calendar-system\": \"string\",\n min: \"string\",\n max: \"string\",\n disabled: \"boolean\",\n \"read-only\": \"boolean\",\n \"fixed-weeks\": \"boolean\",\n name: \"string\",\n form: \"string\",\n },\n properties: [\"isDateUnavailable\"],\n create: (props) =>\n createCalendar(\n computed(() => {\n const own = props.get()\n return {\n ...own,\n value: days(own.value, own.mode),\n defaultValue: days(own.defaultValue, own.mode),\n } as CalendarProps\n })\n ),\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onMonthChange: { event: \"month-change\", prop: \"month\" },\n },\n lists,\n parts: {\n root: (controller) => controller.root,\n input: (controller) => controller.input,\n ...parts,\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-calendar\": ElementOf<\n typeof tag,\n { \"value-change\": [\"onValueChange\", \"value\"]; \"month-change\": [\"onMonthChange\", \"month\"] }\n >\n }\n}\n"],"mappings":";;;;;AAQA,MAAM,EAAE,OAAO,UAAU,eAAyB,eAAe,UAAU;;;;;;;;;;;;;;;AAgB3E,MAAa,MAAM,cAAuC;CACxD,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,MAAM;EACN,YAAY;EACZ,YAAY;EACZ,QAAQ;EACR,oBAAoB;EACpB,OAAO;EACP,iBAAiB;EACjB,yBAAyB;EACzB,QAAQ;EACR,mBAAmB;EACnB,KAAK;EACL,KAAK;EACL,UAAU;EACV,aAAa;EACb,eAAe;EACf,MAAM;EACN,MAAM;CACR;CACA,YAAY,CAAC,mBAAmB;CAChC,SAAS,UACP,eACE,eAAe;EACb,MAAM,MAAM,MAAM,IAAI;EACtB,OAAO;GACL,GAAG;GACH,OAAO,KAAK,IAAI,OAAO,IAAI,IAAI;GAC/B,cAAc,KAAK,IAAI,cAAc,IAAI,IAAI;EAC/C;CACF,CAAC,CACH;CACF,SAAS;EACP,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;EACtD,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;CACxD;CACA;CACA,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,QAAQ,eAAe,WAAW;EAClC,GAAG;CACL;AACF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ElementOf, Tag } from "./runtime.js";
|
|
2
|
+
import { CheckboxGroup, CheckboxGroupProps } from "@kirana-ui/core/checkbox-group";
|
|
3
|
+
type Props = Omit<CheckboxGroupProps, "value" | "defaultValue" | "allValues"> & {
|
|
4
|
+
value?: string | readonly string[];
|
|
5
|
+
defaultValue?: string | readonly string[];
|
|
6
|
+
allValues?: string | readonly string[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* `<kui-checkbox-group>` around `kui-part="root"` and its `<kui-checkbox>`es, each with a
|
|
10
|
+
* `value`; one marked `parent` stands for every value of `all-values`. `value`,
|
|
11
|
+
* `default-value` and `all-values` (with commas between), `disabled`; it tells `value-change`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const tag: Tag<Props, CheckboxGroup>;
|
|
14
|
+
declare global {
|
|
15
|
+
interface HTMLElementTagNameMap {
|
|
16
|
+
"kui-checkbox-group": ElementOf<typeof tag, {
|
|
17
|
+
"value-change": ["onValueChange", "value"];
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=checkbox-group.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { fieldAround, list } from "./around.js";
|
|
2
|
+
import { defineElement } from "./runtime.js";
|
|
3
|
+
import { computed } from "@kirana-ui/core";
|
|
4
|
+
import { createCheckboxGroup } from "@kirana-ui/core/checkbox-group";
|
|
5
|
+
// src/checkbox-group.ts
|
|
6
|
+
/**
|
|
7
|
+
* `<kui-checkbox-group>` around `kui-part="root"` and its `<kui-checkbox>`es, each with a
|
|
8
|
+
* `value`; one marked `parent` stands for every value of `all-values`. `value`,
|
|
9
|
+
* `default-value` and `all-values` (with commas between), `disabled`; it tells `value-change`.
|
|
10
|
+
*/
|
|
11
|
+
const tag = defineElement({
|
|
12
|
+
tag: "kui-checkbox-group",
|
|
13
|
+
props: {
|
|
14
|
+
value: "string",
|
|
15
|
+
"default-value": "string",
|
|
16
|
+
"all-values": "string",
|
|
17
|
+
disabled: "boolean"
|
|
18
|
+
},
|
|
19
|
+
create: (props, host) => createCheckboxGroup(computed(() => {
|
|
20
|
+
const own = props.get();
|
|
21
|
+
return {
|
|
22
|
+
...own,
|
|
23
|
+
value: list(own.value),
|
|
24
|
+
defaultValue: list(own.defaultValue),
|
|
25
|
+
allValues: list(own.allValues)
|
|
26
|
+
};
|
|
27
|
+
}), { field: fieldAround(host) }),
|
|
28
|
+
changes: { onValueChange: {
|
|
29
|
+
event: "value-change",
|
|
30
|
+
prop: "value"
|
|
31
|
+
} },
|
|
32
|
+
parts: { root: (controller) => controller.root }
|
|
33
|
+
});
|
|
34
|
+
export { tag };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=checkbox-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox-group.js","names":[],"sources":["../../../../packages/web/src/checkbox-group.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport { createCheckboxGroup } from \"@kirana-ui/core/checkbox-group\"\nimport type { CheckboxGroup, CheckboxGroupProps } from \"@kirana-ui/core/checkbox-group\"\n\nimport { fieldAround, list } from \"./around.ts\"\nimport { defineElement } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\ntype Props = Omit<CheckboxGroupProps, \"value\" | \"defaultValue\" | \"allValues\"> & {\n value?: string | readonly string[]\n defaultValue?: string | readonly string[]\n allValues?: string | readonly string[]\n}\n\n/**\n * `<kui-checkbox-group>` around `kui-part=\"root\"` and its `<kui-checkbox>`es, each with a\n * `value`; one marked `parent` stands for every value of `all-values`. `value`,\n * `default-value` and `all-values` (with commas between), `disabled`; it tells `value-change`.\n */\nexport const tag = defineElement<Props, CheckboxGroup>({\n tag: \"kui-checkbox-group\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n \"all-values\": \"string\",\n disabled: \"boolean\",\n },\n create: (props, host) =>\n createCheckboxGroup(\n computed(() => {\n const own = props.get()\n return {\n ...own,\n value: list(own.value),\n defaultValue: list(own.defaultValue),\n allValues: list(own.allValues),\n }\n }),\n { field: fieldAround(host) }\n ),\n changes: { onValueChange: { event: \"value-change\", prop: \"value\" } },\n parts: { root: (controller) => controller.root },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-checkbox-group\": ElementOf<typeof tag, { \"value-change\": [\"onValueChange\", \"value\"] }>\n }\n}\n"],"mappings":";;;;;;;;;;AAmBA,MAAa,MAAM,cAAoC;CACrD,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,cAAc;EACd,UAAU;CACZ;CACA,SAAS,OAAO,SACd,oBACE,eAAe;EACb,MAAM,MAAM,MAAM,IAAI;EACtB,OAAO;GACL,GAAG;GACH,OAAO,KAAK,IAAI,KAAK;GACrB,cAAc,KAAK,IAAI,YAAY;GACnC,WAAW,KAAK,IAAI,SAAS;EAC/B;CACF,CAAC,GACD,EAAE,OAAO,YAAY,IAAI,EAAE,CAC7B;CACF,SAAS,EAAE,eAAe;EAAE,OAAO;EAAgB,MAAM;CAAQ,EAAE;CACnE,OAAO,EAAE,OAAO,eAAe,WAAW,KAAK;AACjD,CAAC"}
|
package/src/checkbox.d.ts
CHANGED
|
@@ -3,8 +3,10 @@ import { CheckboxProps } from "@kirana-ui/core/checkbox";
|
|
|
3
3
|
/**
|
|
4
4
|
* `<kui-checkbox>` around a `kui-part="root"` button with an `indicator` inside, which is in
|
|
5
5
|
* the page while the box is checked or indeterminate. The root draws the hidden native input a
|
|
6
|
-
* form and a label reach.
|
|
7
|
-
*
|
|
6
|
+
* form and a label reach. Inside a `<kui-checkbox-group>` it is one of the group's boxes, by
|
|
7
|
+
* its `value`, or with `parent` the one that stands for them all. `checked`, `default-checked`,
|
|
8
|
+
* `indeterminate`, `parent`, `disabled`, `read-only`, `required`, `name`, `form`, `value`; it
|
|
9
|
+
* tells `checked-change`.
|
|
8
10
|
*/
|
|
9
11
|
export declare const tag: Tag<{
|
|
10
12
|
id: string;
|
package/src/checkbox.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { fieldAround } from "./around.js";
|
|
2
|
-
import { defineElement } from "./runtime.js";
|
|
2
|
+
import { controllerAround, defineElement } from "./runtime.js";
|
|
3
3
|
import { createCheckbox } from "@kirana-ui/core/checkbox";
|
|
4
4
|
// src/checkbox.ts
|
|
5
5
|
/**
|
|
6
6
|
* `<kui-checkbox>` around a `kui-part="root"` button with an `indicator` inside, which is in
|
|
7
7
|
* the page while the box is checked or indeterminate. The root draws the hidden native input a
|
|
8
|
-
* form and a label reach.
|
|
9
|
-
*
|
|
8
|
+
* form and a label reach. Inside a `<kui-checkbox-group>` it is one of the group's boxes, by
|
|
9
|
+
* its `value`, or with `parent` the one that stands for them all. `checked`, `default-checked`,
|
|
10
|
+
* `indeterminate`, `parent`, `disabled`, `read-only`, `required`, `name`, `form`, `value`; it
|
|
11
|
+
* tells `checked-change`.
|
|
10
12
|
*/
|
|
11
13
|
const tag = defineElement({
|
|
12
14
|
tag: "kui-checkbox",
|
|
@@ -14,6 +16,7 @@ const tag = defineElement({
|
|
|
14
16
|
checked: "boolean",
|
|
15
17
|
"default-checked": "boolean",
|
|
16
18
|
indeterminate: "boolean",
|
|
19
|
+
parent: "boolean",
|
|
17
20
|
disabled: "boolean",
|
|
18
21
|
"read-only": "boolean",
|
|
19
22
|
required: "boolean",
|
|
@@ -21,7 +24,10 @@ const tag = defineElement({
|
|
|
21
24
|
form: "string",
|
|
22
25
|
value: "string"
|
|
23
26
|
},
|
|
24
|
-
create: (props, host) => createCheckbox(props, {
|
|
27
|
+
create: (props, host) => createCheckbox(props, {
|
|
28
|
+
field: fieldAround(host),
|
|
29
|
+
group: controllerAround(host, "kui-checkbox-group")
|
|
30
|
+
}),
|
|
25
31
|
changes: { onCheckedChange: {
|
|
26
32
|
event: "checked-change",
|
|
27
33
|
prop: "checked"
|
package/src/checkbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","names":[],"sources":["../../../../packages/web/src/checkbox.ts"],"sourcesContent":["import { createCheckbox } from \"@kirana-ui/core/checkbox\"\nimport type { CheckboxProps } from \"@kirana-ui/core/checkbox\"\n\nimport { fieldAround } from \"./around.ts\"\nimport { defineElement } from \"./runtime.ts\"\nimport type { As, ElementOf } from \"./runtime.ts\"\n\n/**\n * `<kui-checkbox>` around a `kui-part=\"root\"` button with an `indicator` inside, which is in\n * the page while the box is checked or indeterminate. The root draws the hidden native input a\n * form and a label reach. `checked`, `default-checked
|
|
1
|
+
{"version":3,"file":"checkbox.js","names":[],"sources":["../../../../packages/web/src/checkbox.ts"],"sourcesContent":["import { createCheckbox } from \"@kirana-ui/core/checkbox\"\nimport type { CheckboxGroupLink, CheckboxProps } from \"@kirana-ui/core/checkbox\"\n\nimport { fieldAround } from \"./around.ts\"\nimport { controllerAround, defineElement } from \"./runtime.ts\"\nimport type { As, ElementOf } from \"./runtime.ts\"\n\ntype Group = { readonly link: CheckboxGroupLink }\n\n/**\n * `<kui-checkbox>` around a `kui-part=\"root\"` button with an `indicator` inside, which is in\n * the page while the box is checked or indeterminate. The root draws the hidden native input a\n * form and a label reach. Inside a `<kui-checkbox-group>` it is one of the group's boxes, by\n * its `value`, or with `parent` the one that stands for them all. `checked`, `default-checked`,\n * `indeterminate`, `parent`, `disabled`, `read-only`, `required`, `name`, `form`, `value`; it\n * tells `checked-change`.\n */\nexport const tag = defineElement({\n tag: \"kui-checkbox\",\n props: {\n checked: \"boolean\",\n \"default-checked\": \"boolean\",\n indeterminate: \"boolean\",\n parent: \"boolean\",\n disabled: \"boolean\",\n \"read-only\": \"boolean\",\n required: \"boolean\",\n name: \"string\",\n form: \"string\",\n value: \"string\",\n },\n create: (props, host) =>\n createCheckbox(props, {\n field: fieldAround(host),\n group: controllerAround<Group>(host, \"kui-checkbox-group\"),\n }),\n changes: { onCheckedChange: { event: \"checked-change\", prop: \"checked\" } },\n parts: {\n root: (controller) => ({ part: controller.root, inner: controller.input }),\n indicator: (controller) => ({\n mounted: controller.indicatorMounted,\n part: controller.indicator,\n }),\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-checkbox\": ElementOf<\n As<typeof tag, CheckboxProps>,\n { \"checked-change\": [\"onCheckedChange\", \"checked\"] }\n >\n }\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAa,MAAM,cAAc;CAC/B,KAAK;CACL,OAAO;EACL,SAAS;EACT,mBAAmB;EACnB,eAAe;EACf,QAAQ;EACR,UAAU;EACV,aAAa;EACb,UAAU;EACV,MAAM;EACN,MAAM;EACN,OAAO;CACT;CACA,SAAS,OAAO,SACd,eAAe,OAAO;EACpB,OAAO,YAAY,IAAI;EACvB,OAAO,iBAAwB,MAAM,oBAAoB;CAC3D,CAAC;CACH,SAAS,EAAE,iBAAiB;EAAE,OAAO;EAAkB,MAAM;CAAU,EAAE;CACzE,OAAO;EACL,OAAO,gBAAgB;GAAE,MAAM,WAAW;GAAM,OAAO,WAAW;EAAM;EACxE,YAAY,gBAAgB;GAC1B,SAAS,WAAW;GACpB,MAAM,WAAW;EACnB;CACF;AACF,CAAC"}
|
package/src/combobox.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Drawn, Each, ElementOf, Tag } from "./runtime.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Placed } from "./around.js";
|
|
3
|
+
import { Combobox, ComboboxEntry, ComboboxProps } from "@kirana-ui/core/combobox";
|
|
3
4
|
type Props = Omit<ComboboxProps<string>, "values" | "defaultValues"> & {
|
|
4
5
|
values?: string | readonly string[];
|
|
5
6
|
defaultValues?: string | readonly string[];
|
|
@@ -7,11 +8,16 @@ type Props = Omit<ComboboxProps<string>, "values" | "defaultValues"> & {
|
|
|
7
8
|
type Parts = Record<string, (controller: Combobox<string>, element: HTMLElement) => Drawn["part"] | Drawn | undefined>;
|
|
8
9
|
/** A combobox's parts: an autocomplete has them too. */
|
|
9
10
|
export declare const PARTS: Parts;
|
|
10
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* With `multiple`: a chip for each chosen value, from a `<template kui-each="chips">`. With
|
|
13
|
+
* `items` as data: what is left of them, from a `<template kui-each="collection">`; one
|
|
14
|
+
* written in a group's copy is that group's items left.
|
|
15
|
+
*/
|
|
11
16
|
export declare const LISTS: {
|
|
12
17
|
chips: (controller: Combobox<string>) => Each<{
|
|
13
18
|
value: string;
|
|
14
19
|
}>;
|
|
20
|
+
collection: (controller: Combobox<string>, around: unknown) => Each<ComboboxEntry<string>>;
|
|
15
21
|
};
|
|
16
22
|
/**
|
|
17
23
|
* `<kui-combobox>` around an `input`, with a `trigger` and a `clear` button if it has them,
|
|
@@ -22,9 +28,16 @@ export declare const LISTS: {
|
|
|
22
28
|
* nothing matches. The `input` may be inside the `popup`, the items then in a `list` part: the
|
|
23
29
|
* popup is placed against the `trigger`, and the input has focus while it is open. With `multiple`, the input is in a `chips` part with a
|
|
24
30
|
* `<template kui-each="chips">` holding a `chip` (`{value}`) and its `chip-remove` button.
|
|
31
|
+
* With the input in the popup, the `trigger` may hold a `value` part: it says the chosen
|
|
32
|
+
* value's label, or its `kui-placeholder`. A `status` part says how the list stands to
|
|
33
|
+
* software that reads the page, as the page changes its text. With `items` given as data, the
|
|
34
|
+
* list is a `<template kui-each="collection">` holding an `item` (`kui-value="{value}"`,
|
|
35
|
+
* `{label}`; `kui-when="item"` where groups are given too) or a `group`
|
|
36
|
+
* (`kui-when="group"`, `{value}` its name) with a `<template kui-each="collection">` of its
|
|
37
|
+
* own for its items: the element filters, and draws what is left.
|
|
25
38
|
* With a name it draws the hidden input a form reads. `value`,
|
|
26
39
|
* `default-value`, `input-value`, `default-input-value`, `open`, `default-open`, `disabled`,
|
|
27
|
-
* `required`, `inline`, `auto-highlight`, `multiple`, `values` and `default-values` (with
|
|
40
|
+
* `read-only`, `required`, `inline`, `auto-highlight`, `multiple`, `values` and `default-values` (with
|
|
28
41
|
* commas between),
|
|
29
42
|
* `name`, `form`; `items` and `filter` as properties; it tells `value-change`,
|
|
30
43
|
* `values-change`, `input-value-change` and `open-change`.
|
|
@@ -37,7 +50,7 @@ declare global {
|
|
|
37
50
|
"values-change": ["onValuesChange", "values"];
|
|
38
51
|
"input-value-change": ["onInputValueChange", "inputValue"];
|
|
39
52
|
"open-change": ["onOpenChange", "open"];
|
|
40
|
-
}
|
|
53
|
+
}> & Placed;
|
|
41
54
|
}
|
|
42
55
|
}
|
|
43
56
|
export {};
|
package/src/combobox.js
CHANGED
|
@@ -10,6 +10,11 @@ const groupOf = (controller, element) => once(groups, element, (group) => contro
|
|
|
10
10
|
const PARTS = {
|
|
11
11
|
input: (controller) => controller.input,
|
|
12
12
|
trigger: (controller) => controller.trigger,
|
|
13
|
+
value: (controller, element) => ({
|
|
14
|
+
part: PLAIN,
|
|
15
|
+
text: computed(() => controller.shown.get().label ?? element.getAttribute("kui-placeholder") ?? void 0)
|
|
16
|
+
}),
|
|
17
|
+
status: (controller) => controller.status,
|
|
13
18
|
clear: (controller) => ({
|
|
14
19
|
part: controller.clear,
|
|
15
20
|
mounted: controller.clearable
|
|
@@ -26,8 +31,13 @@ const PARTS = {
|
|
|
26
31
|
separator: (controller) => controller.separator,
|
|
27
32
|
item(controller, element) {
|
|
28
33
|
const id = element.getAttribute("kui-id") ?? `kui-combobox-item-${++made}`;
|
|
34
|
+
const off = () => {
|
|
35
|
+
const entry = entryAround(element);
|
|
36
|
+
return entry?.type === "item" && entry.disabled ? { disabled: true } : {};
|
|
37
|
+
};
|
|
29
38
|
return controller.item(valueOf(element), () => ({
|
|
30
39
|
...itemOptions(element)(),
|
|
40
|
+
...off(),
|
|
31
41
|
id
|
|
32
42
|
}), groupOf(controller, element.parentElement && partAround(element.parentElement, "group")));
|
|
33
43
|
},
|
|
@@ -45,11 +55,30 @@ const PARTS = {
|
|
|
45
55
|
mounted: controller.selected(valueOf(partAround(element, "item")))
|
|
46
56
|
})
|
|
47
57
|
};
|
|
48
|
-
/**
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
58
|
+
/** A part that draws no element of its own in a framework: here, the page's element as it is. */
|
|
59
|
+
const PLAIN = {
|
|
60
|
+
props: computed(() => ({})),
|
|
61
|
+
attach: () => () => {}
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* With `multiple`: a chip for each chosen value, from a `<template kui-each="chips">`. With
|
|
65
|
+
* `items` as data: what is left of them, from a `<template kui-each="collection">`; one
|
|
66
|
+
* written in a group's copy is that group's items left.
|
|
67
|
+
*/
|
|
68
|
+
const LISTS = {
|
|
69
|
+
chips: (controller) => ({
|
|
70
|
+
entries: computed(() => controller.values.get().map((value) => ({ value }))),
|
|
71
|
+
key: (chip) => chip.value
|
|
72
|
+
}),
|
|
73
|
+
collection: (controller, around) => {
|
|
74
|
+
const group = around;
|
|
75
|
+
return {
|
|
76
|
+
entries: controller.entries(group?.type === "group" ? group : void 0),
|
|
77
|
+
key: (entry) => entry.key,
|
|
78
|
+
type: (entry) => entry.type
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
};
|
|
53
82
|
/**
|
|
54
83
|
* `<kui-combobox>` around an `input`, with a `trigger` and a `clear` button if it has them,
|
|
55
84
|
* and a `portal` with a `positioner` (`kui-side` … and `kui-anchor`, an element's id) around
|
|
@@ -59,9 +88,16 @@ const LISTS = { chips: (controller) => ({
|
|
|
59
88
|
* nothing matches. The `input` may be inside the `popup`, the items then in a `list` part: the
|
|
60
89
|
* popup is placed against the `trigger`, and the input has focus while it is open. With `multiple`, the input is in a `chips` part with a
|
|
61
90
|
* `<template kui-each="chips">` holding a `chip` (`{value}`) and its `chip-remove` button.
|
|
91
|
+
* With the input in the popup, the `trigger` may hold a `value` part: it says the chosen
|
|
92
|
+
* value's label, or its `kui-placeholder`. A `status` part says how the list stands to
|
|
93
|
+
* software that reads the page, as the page changes its text. With `items` given as data, the
|
|
94
|
+
* list is a `<template kui-each="collection">` holding an `item` (`kui-value="{value}"`,
|
|
95
|
+
* `{label}`; `kui-when="item"` where groups are given too) or a `group`
|
|
96
|
+
* (`kui-when="group"`, `{value}` its name) with a `<template kui-each="collection">` of its
|
|
97
|
+
* own for its items: the element filters, and draws what is left.
|
|
62
98
|
* With a name it draws the hidden input a form reads. `value`,
|
|
63
99
|
* `default-value`, `input-value`, `default-input-value`, `open`, `default-open`, `disabled`,
|
|
64
|
-
* `required`, `inline`, `auto-highlight`, `multiple`, `values` and `default-values` (with
|
|
100
|
+
* `read-only`, `required`, `inline`, `auto-highlight`, `multiple`, `values` and `default-values` (with
|
|
65
101
|
* commas between),
|
|
66
102
|
* `name`, `form`; `items` and `filter` as properties; it tells `value-change`,
|
|
67
103
|
* `values-change`, `input-value-change` and `open-change`.
|
|
@@ -76,6 +112,7 @@ const tag = defineElement({
|
|
|
76
112
|
open: "boolean",
|
|
77
113
|
"default-open": "boolean",
|
|
78
114
|
disabled: "boolean",
|
|
115
|
+
"read-only": "boolean",
|
|
79
116
|
required: "boolean",
|
|
80
117
|
inline: "boolean",
|
|
81
118
|
"auto-highlight": "boolean",
|
package/src/combobox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.js","names":[],"sources":["../../../../packages/web/src/combobox.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport type { Combobox, ComboboxGroup, ComboboxProps } from \"@kirana-ui/core/combobox\"\nimport { createCombobox } from \"@kirana-ui/core/combobox\"\n\nimport { fieldAround, itemOptions, list, MARK, once, positioner, valueOf } from \"./around.ts\"\nimport { defineElement, entryAround, partAround } from \"./runtime.ts\"\nimport type { Drawn, Each, ElementOf } from \"./runtime.ts\"\n\ntype Props = Omit<ComboboxProps<string>, \"values\" | \"defaultValues\"> & {\n values?: string | readonly string[]\n defaultValues?: string | readonly string[]\n}\n\nconst groups = new WeakMap<HTMLElement, ComboboxGroup>()\nlet made = 0\n\nconst groupOf = (controller: Combobox<string>, element: HTMLElement | null) =>\n once(groups, element, (group) =>\n controller.group(group.getAttribute(\"kui-id\") ?? `kui-combobox-group-${++made}`)\n )\n\ntype Parts = Record<\n string,\n (controller: Combobox<string>, element: HTMLElement) => Drawn[\"part\"] | Drawn | undefined\n>\n\n/** A combobox's parts: an autocomplete has them too. */\nexport const PARTS: Parts = {\n input: (controller) => controller.input,\n trigger: (controller) => controller.trigger,\n clear: (controller) => ({ part: controller.clear, mounted: controller.clearable }),\n positioner,\n popup: (controller) => controller.popup,\n list: (controller) => controller.list,\n empty: (controller) => ({ part: controller.emptyPart, mounted: controller.empty }),\n group: (controller, element) => groupOf(controller, element)?.root,\n // Outside a group it is plain text, and names nothing.\n \"group-label\": (controller, element) =>\n groups.get(partAround(element, \"group\")!)?.label ?? controller.groupLabel,\n separator: (controller) => controller.separator,\n item(controller, element) {\n const id = element.getAttribute(\"kui-id\") ?? `kui-combobox-item-${++made}`\n return controller.item(\n valueOf(element),\n () => ({ ...itemOptions(element)(), id }),\n groupOf(controller, element.parentElement && partAround(element.parentElement, \"group\"))\n )\n },\n chips: (controller) => controller.chips,\n chip(controller, element) {\n const value = entryAround<{ value: string }>(element)?.value\n return value === undefined ? undefined : controller.chip(value)\n },\n \"chip-remove\"(controller, element) {\n const value = entryAround<{ value: string }>(element)?.value\n return value === undefined ? undefined : controller.chipRemove(value)\n },\n \"item-indicator\": (controller, element) => ({\n part: MARK,\n mounted: controller.selected(valueOf(partAround(element, \"item\"))),\n }),\n}\n\n/** With `multiple`: a chip for each chosen value, from a `<template kui-each=\"chips\">`. */\nexport const LISTS = {\n chips: (controller: Combobox<string>): Each<{ value: string }> => ({\n entries: computed(() => controller.values.get().map((value) => ({ value }))),\n key: (chip) => chip.value,\n }),\n}\n\n/**\n * `<kui-combobox>` around an `input`, with a `trigger` and a `clear` button if it has them,\n * and a `portal` with a `positioner` (`kui-side` … and `kui-anchor`, an element's id) around\n * the `popup`, which holds an `item` for each\n * `kui-value` (`kui-disabled`, `kui-label`, `kui-id`) with an `item-indicator`, in `group`s\n * with a `group-label` and `separator`s if it has them, and an `empty` part drawn while\n * nothing matches. The `input` may be inside the `popup`, the items then in a `list` part: the\n * popup is placed against the `trigger`, and the input has focus while it is open. With `multiple`, the input is in a `chips` part with a\n * `<template kui-each=\"chips\">` holding a `chip` (`{value}`) and its `chip-remove` button.\n * With a name it draws the hidden input a form reads. `value`,\n * `default-value`, `input-value`, `default-input-value`, `open`, `default-open`, `disabled`,\n * `required`, `inline`, `auto-highlight`, `multiple`, `values` and `default-values` (with\n * commas between),\n * `name`, `form`; `items` and `filter` as properties; it tells `value-change`,\n * `values-change`, `input-value-change` and `open-change`.\n */\nexport const tag = defineElement<Props, Combobox<string>>({\n tag: \"kui-combobox\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n \"input-value\": \"string\",\n \"default-input-value\": \"string\",\n open: \"boolean\",\n \"default-open\": \"boolean\",\n disabled: \"boolean\",\n required: \"boolean\",\n inline: \"boolean\",\n \"auto-highlight\": \"boolean\",\n multiple: \"boolean\",\n values: \"string\",\n \"default-values\": \"string\",\n name: \"string\",\n form: \"string\",\n },\n properties: [\"items\", \"filter\"],\n create: (props, host) =>\n createCombobox<string>(\n computed(() => {\n const own = props.get()\n return { ...own, values: list(own.values), defaultValues: list(own.defaultValues) }\n }),\n { field: fieldAround(host) }\n ),\n lists: LISTS,\n inner: (controller) => ({ part: controller.hidden, mounted: controller.named }),\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onValuesChange: { event: \"values-change\", prop: \"values\" },\n onInputValueChange: { event: \"input-value-change\", prop: \"inputValue\" },\n onOpenChange: { event: \"open-change\", prop: \"open\" },\n },\n parts: PARTS,\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-combobox\": ElementOf<\n typeof tag,\n {\n \"value-change\": [\"onValueChange\", \"value\"]\n \"values-change\": [\"onValuesChange\", \"values\"]\n \"input-value-change\": [\"onInputValueChange\", \"inputValue\"]\n \"open-change\": [\"onOpenChange\", \"open\"]\n }\n >\n }\n}\n"],"mappings":";;;;;AAaA,MAAM,yBAAS,IAAI,QAAoC;AACvD,IAAI,OAAO;AAEX,MAAM,WAAW,YAA8B,YAC7C,KAAK,QAAQ,UAAU,UACrB,WAAW,MAAM,MAAM,aAAa,QAAQ,KAAK,sBAAsB,EAAE,MAAM,CACjF;;AAQF,MAAa,QAAe;CAC1B,QAAQ,eAAe,WAAW;CAClC,UAAU,eAAe,WAAW;CACpC,QAAQ,gBAAgB;EAAE,MAAM,WAAW;EAAO,SAAS,WAAW;CAAU;CAChF;CACA,QAAQ,eAAe,WAAW;CAClC,OAAO,eAAe,WAAW;CACjC,QAAQ,gBAAgB;EAAE,MAAM,WAAW;EAAW,SAAS,WAAW;CAAM;CAChF,QAAQ,YAAY,YAAY,QAAQ,YAAY,OAAO,CAAC,EAAE;CAE9D,gBAAgB,YAAY,YAC1B,OAAO,IAAI,WAAW,SAAS,OAAO,CAAE,CAAC,EAAE,SAAS,WAAW;CACjE,YAAY,eAAe,WAAW;CACtC,KAAK,YAAY,SAAS;EACxB,MAAM,KAAK,QAAQ,aAAa,QAAQ,KAAK,qBAAqB,EAAE;EACpE,OAAO,WAAW,KAChB,QAAQ,OAAO,UACR;GAAE,GAAG,YAAY,OAAO,CAAC,CAAC;GAAG;EAAG,IACvC,QAAQ,YAAY,QAAQ,iBAAiB,WAAW,QAAQ,eAAe,OAAO,CAAC,CACzF;CACF;CACA,QAAQ,eAAe,WAAW;CAClC,KAAK,YAAY,SAAS;EACxB,MAAM,QAAQ,YAA+B,OAAO,CAAC,EAAE;EACvD,OAAO,UAAU,KAAA,IAAY,KAAA,IAAY,WAAW,KAAK,KAAK;CAChE;CACA,cAAc,YAAY,SAAS;EACjC,MAAM,QAAQ,YAA+B,OAAO,CAAC,EAAE;EACvD,OAAO,UAAU,KAAA,IAAY,KAAA,IAAY,WAAW,WAAW,KAAK;CACtE;CACA,mBAAmB,YAAY,aAAa;EAC1C,MAAM;EACN,SAAS,WAAW,SAAS,QAAQ,WAAW,SAAS,MAAM,CAAC,CAAC;CACnE;AACF;;AAGA,MAAa,QAAQ,EACnB,QAAQ,gBAA2D;CACjE,SAAS,eAAe,WAAW,OAAO,IAAI,CAAC,CAAC,KAAK,WAAW,EAAE,MAAM,EAAE,CAAC;CAC3E,MAAM,SAAS,KAAK;AACtB,GACF;;;;;;;;;;;;;;;;;AAkBA,MAAa,MAAM,cAAuC;CACxD,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,eAAe;EACf,uBAAuB;EACvB,MAAM;EACN,gBAAgB;EAChB,UAAU;EACV,UAAU;EACV,QAAQ;EACR,kBAAkB;EAClB,UAAU;EACV,QAAQ;EACR,kBAAkB;EAClB,MAAM;EACN,MAAM;CACR;CACA,YAAY,CAAC,SAAS,QAAQ;CAC9B,SAAS,OAAO,SACd,eACE,eAAe;EACb,MAAM,MAAM,MAAM,IAAI;EACtB,OAAO;GAAE,GAAG;GAAK,QAAQ,KAAK,IAAI,MAAM;GAAG,eAAe,KAAK,IAAI,aAAa;EAAE;CACpF,CAAC,GACD,EAAE,OAAO,YAAY,IAAI,EAAE,CAC7B;CACF,OAAO;CACP,QAAQ,gBAAgB;EAAE,MAAM,WAAW;EAAQ,SAAS,WAAW;CAAM;CAC7E,SAAS;EACP,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;EACtD,gBAAgB;GAAE,OAAO;GAAiB,MAAM;EAAS;EACzD,oBAAoB;GAAE,OAAO;GAAsB,MAAM;EAAa;EACtE,cAAc;GAAE,OAAO;GAAe,MAAM;EAAO;CACrD;CACA,OAAO;AACT,CAAC"}
|
|
1
|
+
{"version":3,"file":"combobox.js","names":[],"sources":["../../../../packages/web/src/combobox.ts"],"sourcesContent":["import { computed } from \"@kirana-ui/core\"\nimport type {\n Combobox,\n ComboboxEntry,\n ComboboxGroup,\n ComboboxProps,\n} from \"@kirana-ui/core/combobox\"\nimport { createCombobox } from \"@kirana-ui/core/combobox\"\n\nimport { fieldAround, itemOptions, list, MARK, once, positioner, valueOf } from \"./around.ts\"\nimport type { Placed } from \"./around.ts\"\nimport { defineElement, entryAround, partAround } from \"./runtime.ts\"\nimport type { Drawn, Each, ElementOf } from \"./runtime.ts\"\n\ntype Props = Omit<ComboboxProps<string>, \"values\" | \"defaultValues\"> & {\n values?: string | readonly string[]\n defaultValues?: string | readonly string[]\n}\n\nconst groups = new WeakMap<HTMLElement, ComboboxGroup>()\nlet made = 0\n\nconst groupOf = (controller: Combobox<string>, element: HTMLElement | null) =>\n once(groups, element, (group) =>\n controller.group(group.getAttribute(\"kui-id\") ?? `kui-combobox-group-${++made}`)\n )\n\ntype Parts = Record<\n string,\n (controller: Combobox<string>, element: HTMLElement) => Drawn[\"part\"] | Drawn | undefined\n>\n\n/** A combobox's parts: an autocomplete has them too. */\nexport const PARTS: Parts = {\n input: (controller) => controller.input,\n trigger: (controller) => controller.trigger,\n // It says the chosen value's label, or its `kui-placeholder`, unless the page wrote there.\n value: (controller, element) => ({\n part: PLAIN,\n text: computed(\n () => controller.shown.get().label ?? element.getAttribute(\"kui-placeholder\") ?? undefined\n ),\n }),\n status: (controller) => controller.status,\n clear: (controller) => ({ part: controller.clear, mounted: controller.clearable }),\n positioner,\n popup: (controller) => controller.popup,\n list: (controller) => controller.list,\n empty: (controller) => ({ part: controller.emptyPart, mounted: controller.empty }),\n group: (controller, element) => groupOf(controller, element)?.root,\n // Outside a group it is plain text, and names nothing.\n \"group-label\": (controller, element) =>\n groups.get(partAround(element, \"group\")!)?.label ?? controller.groupLabel,\n separator: (controller) => controller.separator,\n item(controller, element) {\n const id = element.getAttribute(\"kui-id\") ?? `kui-combobox-item-${++made}`\n // Drawn from data, its entry says whether it can be chosen.\n const off = () => {\n const entry = entryAround<ComboboxEntry<string>>(element)\n return entry?.type === \"item\" && entry.disabled ? { disabled: true } : {}\n }\n return controller.item(\n valueOf(element),\n () => ({ ...itemOptions(element)(), ...off(), id }),\n groupOf(controller, element.parentElement && partAround(element.parentElement, \"group\"))\n )\n },\n chips: (controller) => controller.chips,\n chip(controller, element) {\n const value = entryAround<{ value: string }>(element)?.value\n return value === undefined ? undefined : controller.chip(value)\n },\n \"chip-remove\"(controller, element) {\n const value = entryAround<{ value: string }>(element)?.value\n return value === undefined ? undefined : controller.chipRemove(value)\n },\n \"item-indicator\": (controller, element) => ({\n part: MARK,\n mounted: controller.selected(valueOf(partAround(element, \"item\"))),\n }),\n}\n\n/** A part that draws no element of its own in a framework: here, the page's element as it is. */\nconst PLAIN = { props: computed(() => ({})), attach: () => () => {} }\n\n/**\n * With `multiple`: a chip for each chosen value, from a `<template kui-each=\"chips\">`. With\n * `items` as data: what is left of them, from a `<template kui-each=\"collection\">`; one\n * written in a group's copy is that group's items left.\n */\nexport const LISTS = {\n chips: (controller: Combobox<string>): Each<{ value: string }> => ({\n entries: computed(() => controller.values.get().map((value) => ({ value }))),\n key: (chip) => chip.value,\n }),\n collection: (controller: Combobox<string>, around: unknown): Each<ComboboxEntry<string>> => {\n const group = around as ComboboxEntry<string> | undefined\n return {\n entries: controller.entries(group?.type === \"group\" ? group : undefined),\n key: (entry) => entry.key,\n type: (entry) => entry.type,\n }\n },\n}\n\n/**\n * `<kui-combobox>` around an `input`, with a `trigger` and a `clear` button if it has them,\n * and a `portal` with a `positioner` (`kui-side` … and `kui-anchor`, an element's id) around\n * the `popup`, which holds an `item` for each\n * `kui-value` (`kui-disabled`, `kui-label`, `kui-id`) with an `item-indicator`, in `group`s\n * with a `group-label` and `separator`s if it has them, and an `empty` part drawn while\n * nothing matches. The `input` may be inside the `popup`, the items then in a `list` part: the\n * popup is placed against the `trigger`, and the input has focus while it is open. With `multiple`, the input is in a `chips` part with a\n * `<template kui-each=\"chips\">` holding a `chip` (`{value}`) and its `chip-remove` button.\n * With the input in the popup, the `trigger` may hold a `value` part: it says the chosen\n * value's label, or its `kui-placeholder`. A `status` part says how the list stands to\n * software that reads the page, as the page changes its text. With `items` given as data, the\n * list is a `<template kui-each=\"collection\">` holding an `item` (`kui-value=\"{value}\"`,\n * `{label}`; `kui-when=\"item\"` where groups are given too) or a `group`\n * (`kui-when=\"group\"`, `{value}` its name) with a `<template kui-each=\"collection\">` of its\n * own for its items: the element filters, and draws what is left.\n * With a name it draws the hidden input a form reads. `value`,\n * `default-value`, `input-value`, `default-input-value`, `open`, `default-open`, `disabled`,\n * `read-only`, `required`, `inline`, `auto-highlight`, `multiple`, `values` and `default-values` (with\n * commas between),\n * `name`, `form`; `items` and `filter` as properties; it tells `value-change`,\n * `values-change`, `input-value-change` and `open-change`.\n */\nexport const tag = defineElement<Props, Combobox<string>>({\n tag: \"kui-combobox\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n \"input-value\": \"string\",\n \"default-input-value\": \"string\",\n open: \"boolean\",\n \"default-open\": \"boolean\",\n disabled: \"boolean\",\n \"read-only\": \"boolean\",\n required: \"boolean\",\n inline: \"boolean\",\n \"auto-highlight\": \"boolean\",\n multiple: \"boolean\",\n values: \"string\",\n \"default-values\": \"string\",\n name: \"string\",\n form: \"string\",\n },\n properties: [\"items\", \"filter\"],\n create: (props, host) =>\n createCombobox<string>(\n computed(() => {\n const own = props.get()\n return { ...own, values: list(own.values), defaultValues: list(own.defaultValues) }\n }),\n { field: fieldAround(host) }\n ),\n lists: LISTS,\n inner: (controller) => ({ part: controller.hidden, mounted: controller.named }),\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onValuesChange: { event: \"values-change\", prop: \"values\" },\n onInputValueChange: { event: \"input-value-change\", prop: \"inputValue\" },\n onOpenChange: { event: \"open-change\", prop: \"open\" },\n },\n parts: PARTS,\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-combobox\": ElementOf<\n typeof tag,\n {\n \"value-change\": [\"onValueChange\", \"value\"]\n \"values-change\": [\"onValuesChange\", \"values\"]\n \"input-value-change\": [\"onInputValueChange\", \"inputValue\"]\n \"open-change\": [\"onOpenChange\", \"open\"]\n }\n > &\n Placed\n }\n}\n"],"mappings":";;;;;AAmBA,MAAM,yBAAS,IAAI,QAAoC;AACvD,IAAI,OAAO;AAEX,MAAM,WAAW,YAA8B,YAC7C,KAAK,QAAQ,UAAU,UACrB,WAAW,MAAM,MAAM,aAAa,QAAQ,KAAK,sBAAsB,EAAE,MAAM,CACjF;;AAQF,MAAa,QAAe;CAC1B,QAAQ,eAAe,WAAW;CAClC,UAAU,eAAe,WAAW;CAEpC,QAAQ,YAAY,aAAa;EAC/B,MAAM;EACN,MAAM,eACE,WAAW,MAAM,IAAI,CAAC,CAAC,SAAS,QAAQ,aAAa,iBAAiB,KAAK,KAAA,CACnF;CACF;CACA,SAAS,eAAe,WAAW;CACnC,QAAQ,gBAAgB;EAAE,MAAM,WAAW;EAAO,SAAS,WAAW;CAAU;CAChF;CACA,QAAQ,eAAe,WAAW;CAClC,OAAO,eAAe,WAAW;CACjC,QAAQ,gBAAgB;EAAE,MAAM,WAAW;EAAW,SAAS,WAAW;CAAM;CAChF,QAAQ,YAAY,YAAY,QAAQ,YAAY,OAAO,CAAC,EAAE;CAE9D,gBAAgB,YAAY,YAC1B,OAAO,IAAI,WAAW,SAAS,OAAO,CAAE,CAAC,EAAE,SAAS,WAAW;CACjE,YAAY,eAAe,WAAW;CACtC,KAAK,YAAY,SAAS;EACxB,MAAM,KAAK,QAAQ,aAAa,QAAQ,KAAK,qBAAqB,EAAE;EAEpE,MAAM,YAAY;GAChB,MAAM,QAAQ,YAAmC,OAAO;GACxD,OAAO,OAAO,SAAS,UAAU,MAAM,WAAW,EAAE,UAAU,KAAK,IAAI,CAAC;EAC1E;EACA,OAAO,WAAW,KAChB,QAAQ,OAAO,UACR;GAAE,GAAG,YAAY,OAAO,CAAC,CAAC;GAAG,GAAG,IAAI;GAAG;EAAG,IACjD,QAAQ,YAAY,QAAQ,iBAAiB,WAAW,QAAQ,eAAe,OAAO,CAAC,CACzF;CACF;CACA,QAAQ,eAAe,WAAW;CAClC,KAAK,YAAY,SAAS;EACxB,MAAM,QAAQ,YAA+B,OAAO,CAAC,EAAE;EACvD,OAAO,UAAU,KAAA,IAAY,KAAA,IAAY,WAAW,KAAK,KAAK;CAChE;CACA,cAAc,YAAY,SAAS;EACjC,MAAM,QAAQ,YAA+B,OAAO,CAAC,EAAE;EACvD,OAAO,UAAU,KAAA,IAAY,KAAA,IAAY,WAAW,WAAW,KAAK;CACtE;CACA,mBAAmB,YAAY,aAAa;EAC1C,MAAM;EACN,SAAS,WAAW,SAAS,QAAQ,WAAW,SAAS,MAAM,CAAC,CAAC;CACnE;AACF;;AAGA,MAAM,QAAQ;CAAE,OAAO,gBAAgB,CAAC,EAAE;CAAG,oBAAoB,CAAC;AAAE;;;;;;AAOpE,MAAa,QAAQ;CACnB,QAAQ,gBAA2D;EACjE,SAAS,eAAe,WAAW,OAAO,IAAI,CAAC,CAAC,KAAK,WAAW,EAAE,MAAM,EAAE,CAAC;EAC3E,MAAM,SAAS,KAAK;CACtB;CACA,aAAa,YAA8B,WAAiD;EAC1F,MAAM,QAAQ;EACd,OAAO;GACL,SAAS,WAAW,QAAQ,OAAO,SAAS,UAAU,QAAQ,KAAA,CAAS;GACvE,MAAM,UAAU,MAAM;GACtB,OAAO,UAAU,MAAM;EACzB;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAa,MAAM,cAAuC;CACxD,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,eAAe;EACf,uBAAuB;EACvB,MAAM;EACN,gBAAgB;EAChB,UAAU;EACV,aAAa;EACb,UAAU;EACV,QAAQ;EACR,kBAAkB;EAClB,UAAU;EACV,QAAQ;EACR,kBAAkB;EAClB,MAAM;EACN,MAAM;CACR;CACA,YAAY,CAAC,SAAS,QAAQ;CAC9B,SAAS,OAAO,SACd,eACE,eAAe;EACb,MAAM,MAAM,MAAM,IAAI;EACtB,OAAO;GAAE,GAAG;GAAK,QAAQ,KAAK,IAAI,MAAM;GAAG,eAAe,KAAK,IAAI,aAAa;EAAE;CACpF,CAAC,GACD,EAAE,OAAO,YAAY,IAAI,EAAE,CAC7B;CACF,OAAO;CACP,QAAQ,gBAAgB;EAAE,MAAM,WAAW;EAAQ,SAAS,WAAW;CAAM;CAC7E,SAAS;EACP,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;EACtD,gBAAgB;GAAE,OAAO;GAAiB,MAAM;EAAS;EACzD,oBAAoB;GAAE,OAAO;GAAsB,MAAM;EAAa;EACtE,cAAc;GAAE,OAAO;GAAe,MAAM;EAAO;CACrD;CACA,OAAO;AACT,CAAC"}
|
package/src/command.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Command, CommandProps } from "@kirana-ui/core/command";
|
|
|
5
5
|
* `kui-disabled`, `kui-label`, `kui-keywords` with commas between, `kui-id`), in `group`s
|
|
6
6
|
* with a `group-heading` and `separator`s (`kui-always-render`) if it has them, and an
|
|
7
7
|
* `empty` part drawn while nothing matches. What is typed filters the list; Enter or a press
|
|
8
|
-
* runs an item. `input-value`, `default-input-value`, `loop`, `disabled`; `filter` as a
|
|
8
|
+
* runs an item. `input-value`, `default-input-value`, `loop`, `auto-highlight` (on unless `="false"`), `disabled`; `filter` as a
|
|
9
9
|
* property; it tells `input-value-change` and `select`.
|
|
10
10
|
*/
|
|
11
11
|
export declare const tag: Tag<CommandProps, Command>;
|
package/src/command.js
CHANGED
|
@@ -10,7 +10,7 @@ const groupOf = (controller, element) => once(groups, element, (group) => contro
|
|
|
10
10
|
* `kui-disabled`, `kui-label`, `kui-keywords` with commas between, `kui-id`), in `group`s
|
|
11
11
|
* with a `group-heading` and `separator`s (`kui-always-render`) if it has them, and an
|
|
12
12
|
* `empty` part drawn while nothing matches. What is typed filters the list; Enter or a press
|
|
13
|
-
* runs an item. `input-value`, `default-input-value`, `loop`, `disabled`; `filter` as a
|
|
13
|
+
* runs an item. `input-value`, `default-input-value`, `loop`, `auto-highlight` (on unless `="false"`), `disabled`; `filter` as a
|
|
14
14
|
* property; it tells `input-value-change` and `select`.
|
|
15
15
|
*/
|
|
16
16
|
const tag = defineElement({
|
|
@@ -19,6 +19,7 @@ const tag = defineElement({
|
|
|
19
19
|
"input-value": "string",
|
|
20
20
|
"default-input-value": "string",
|
|
21
21
|
loop: "boolean",
|
|
22
|
+
"auto-highlight": "boolean",
|
|
22
23
|
disabled: "boolean"
|
|
23
24
|
},
|
|
24
25
|
properties: ["filter"],
|
package/src/command.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","names":[],"sources":["../../../../packages/web/src/command.ts"],"sourcesContent":["import { createCommand } from \"@kirana-ui/core/command\"\nimport type { Command, CommandGroup, CommandProps } from \"@kirana-ui/core/command\"\n\nimport { list, once, valueOf } from \"./around.ts\"\nimport { defineElement, partAround } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\nconst groups = new WeakMap<HTMLElement, CommandGroup>()\nlet made = 0\nconst groupOf = (controller: Command, element: HTMLElement | null) =>\n once(groups, element, (group) =>\n controller.group(group.getAttribute(\"kui-id\") ?? `kui-command-group-${++made}`)\n )\n\n/**\n * `<kui-command>` around `kui-part=\"root\"`, an `input` and a `list` of `item`s (`kui-value`,\n * `kui-disabled`, `kui-label`, `kui-keywords` with commas between, `kui-id`), in `group`s\n * with a `group-heading` and `separator`s (`kui-always-render`) if it has them, and an\n * `empty` part drawn while nothing matches. What is typed filters the list; Enter or a press\n * runs an item. `input-value`, `default-input-value`, `loop`, `disabled`; `filter` as a\n * property; it tells `input-value-change` and `select`.\n */\nexport const tag = defineElement<CommandProps, Command>({\n tag: \"kui-command\",\n props: {\n \"input-value\": \"string\",\n \"default-input-value\": \"string\",\n loop: \"boolean\",\n disabled: \"boolean\",\n },\n properties: [\"filter\"],\n create: (props) => createCommand(props),\n changes: {\n onInputValueChange: { event: \"input-value-change\", prop: \"inputValue\" },\n onSelect: { event: \"select\", prop: \"value\", hold: false },\n },\n parts: {\n root: (controller) => controller.root,\n input: (controller) => controller.input,\n list: (controller) => controller.list,\n empty: (controller) => ({ part: controller.emptyPart, mounted: controller.empty }),\n group: (controller, element) => groupOf(controller, element)?.part,\n \"group-heading\": (controller, element) =>\n groups.get(partAround(element, \"group\")!)?.heading ?? controller.heading,\n item(controller, element) {\n const id = element.getAttribute(\"kui-id\") ?? `kui-command-item-${++made}`\n return controller.item(\n valueOf(element),\n () => ({\n id,\n ...(element.hasAttribute(\"kui-disabled\") ? { disabled: true } : {}),\n ...(element.hasAttribute(\"kui-label\")\n ? { label: element.getAttribute(\"kui-label\")! }\n : {}),\n ...(element.hasAttribute(\"kui-keywords\")\n ? { keywords: list(element.getAttribute(\"kui-keywords\"))! }\n : {}),\n }),\n groupOf(controller, element.parentElement && partAround(element.parentElement, \"group\"))\n )\n },\n separator: (controller, element) =>\n controller.separator(() => element.hasAttribute(\"kui-always-render\")),\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-command\": ElementOf<\n typeof tag,\n { \"input-value-change\": [\"onInputValueChange\", \"inputValue\"]; select: [\"onSelect\", \"value\"] }\n >\n }\n}\n"],"mappings":";;;;AAOA,MAAM,yBAAS,IAAI,QAAmC;AACtD,IAAI,OAAO;AACX,MAAM,WAAW,YAAqB,YACpC,KAAK,QAAQ,UAAU,UACrB,WAAW,MAAM,MAAM,aAAa,QAAQ,KAAK,qBAAqB,EAAE,MAAM,CAChF;;;;;;;;;AAUF,MAAa,MAAM,cAAqC;CACtD,KAAK;CACL,OAAO;EACL,eAAe;EACf,uBAAuB;EACvB,MAAM;EACN,UAAU;CACZ;CACA,YAAY,CAAC,QAAQ;CACrB,SAAS,UAAU,cAAc,KAAK;CACtC,SAAS;EACP,oBAAoB;GAAE,OAAO;GAAsB,MAAM;EAAa;EACtE,UAAU;GAAE,OAAO;GAAU,MAAM;GAAS,MAAM;EAAM;CAC1D;CACA,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,QAAQ,eAAe,WAAW;EAClC,OAAO,eAAe,WAAW;EACjC,QAAQ,gBAAgB;GAAE,MAAM,WAAW;GAAW,SAAS,WAAW;EAAM;EAChF,QAAQ,YAAY,YAAY,QAAQ,YAAY,OAAO,CAAC,EAAE;EAC9D,kBAAkB,YAAY,YAC5B,OAAO,IAAI,WAAW,SAAS,OAAO,CAAE,CAAC,EAAE,WAAW,WAAW;EACnE,KAAK,YAAY,SAAS;GACxB,MAAM,KAAK,QAAQ,aAAa,QAAQ,KAAK,oBAAoB,EAAE;GACnE,OAAO,WAAW,KAChB,QAAQ,OAAO,UACR;IACL;IACA,GAAI,QAAQ,aAAa,cAAc,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;IACjE,GAAI,QAAQ,aAAa,WAAW,IAChC,EAAE,OAAO,QAAQ,aAAa,WAAW,EAAG,IAC5C,CAAC;IACL,GAAI,QAAQ,aAAa,cAAc,IACnC,EAAE,UAAU,KAAK,QAAQ,aAAa,cAAc,CAAC,EAAG,IACxD,CAAC;GACP,IACA,QAAQ,YAAY,QAAQ,iBAAiB,WAAW,QAAQ,eAAe,OAAO,CAAC,CACzF;EACF;EACA,YAAY,YAAY,YACtB,WAAW,gBAAgB,QAAQ,aAAa,mBAAmB,CAAC;CACxE;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"command.js","names":[],"sources":["../../../../packages/web/src/command.ts"],"sourcesContent":["import { createCommand } from \"@kirana-ui/core/command\"\nimport type { Command, CommandGroup, CommandProps } from \"@kirana-ui/core/command\"\n\nimport { list, once, valueOf } from \"./around.ts\"\nimport { defineElement, partAround } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\nconst groups = new WeakMap<HTMLElement, CommandGroup>()\nlet made = 0\nconst groupOf = (controller: Command, element: HTMLElement | null) =>\n once(groups, element, (group) =>\n controller.group(group.getAttribute(\"kui-id\") ?? `kui-command-group-${++made}`)\n )\n\n/**\n * `<kui-command>` around `kui-part=\"root\"`, an `input` and a `list` of `item`s (`kui-value`,\n * `kui-disabled`, `kui-label`, `kui-keywords` with commas between, `kui-id`), in `group`s\n * with a `group-heading` and `separator`s (`kui-always-render`) if it has them, and an\n * `empty` part drawn while nothing matches. What is typed filters the list; Enter or a press\n * runs an item. `input-value`, `default-input-value`, `loop`, `auto-highlight` (on unless `=\"false\"`), `disabled`; `filter` as a\n * property; it tells `input-value-change` and `select`.\n */\nexport const tag = defineElement<CommandProps, Command>({\n tag: \"kui-command\",\n props: {\n \"input-value\": \"string\",\n \"default-input-value\": \"string\",\n loop: \"boolean\",\n \"auto-highlight\": \"boolean\",\n disabled: \"boolean\",\n },\n properties: [\"filter\"],\n create: (props) => createCommand(props),\n changes: {\n onInputValueChange: { event: \"input-value-change\", prop: \"inputValue\" },\n onSelect: { event: \"select\", prop: \"value\", hold: false },\n },\n parts: {\n root: (controller) => controller.root,\n input: (controller) => controller.input,\n list: (controller) => controller.list,\n empty: (controller) => ({ part: controller.emptyPart, mounted: controller.empty }),\n group: (controller, element) => groupOf(controller, element)?.part,\n \"group-heading\": (controller, element) =>\n groups.get(partAround(element, \"group\")!)?.heading ?? controller.heading,\n item(controller, element) {\n const id = element.getAttribute(\"kui-id\") ?? `kui-command-item-${++made}`\n return controller.item(\n valueOf(element),\n () => ({\n id,\n ...(element.hasAttribute(\"kui-disabled\") ? { disabled: true } : {}),\n ...(element.hasAttribute(\"kui-label\")\n ? { label: element.getAttribute(\"kui-label\")! }\n : {}),\n ...(element.hasAttribute(\"kui-keywords\")\n ? { keywords: list(element.getAttribute(\"kui-keywords\"))! }\n : {}),\n }),\n groupOf(controller, element.parentElement && partAround(element.parentElement, \"group\"))\n )\n },\n separator: (controller, element) =>\n controller.separator(() => element.hasAttribute(\"kui-always-render\")),\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-command\": ElementOf<\n typeof tag,\n { \"input-value-change\": [\"onInputValueChange\", \"inputValue\"]; select: [\"onSelect\", \"value\"] }\n >\n }\n}\n"],"mappings":";;;;AAOA,MAAM,yBAAS,IAAI,QAAmC;AACtD,IAAI,OAAO;AACX,MAAM,WAAW,YAAqB,YACpC,KAAK,QAAQ,UAAU,UACrB,WAAW,MAAM,MAAM,aAAa,QAAQ,KAAK,qBAAqB,EAAE,MAAM,CAChF;;;;;;;;;AAUF,MAAa,MAAM,cAAqC;CACtD,KAAK;CACL,OAAO;EACL,eAAe;EACf,uBAAuB;EACvB,MAAM;EACN,kBAAkB;EAClB,UAAU;CACZ;CACA,YAAY,CAAC,QAAQ;CACrB,SAAS,UAAU,cAAc,KAAK;CACtC,SAAS;EACP,oBAAoB;GAAE,OAAO;GAAsB,MAAM;EAAa;EACtE,UAAU;GAAE,OAAO;GAAU,MAAM;GAAS,MAAM;EAAM;CAC1D;CACA,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,QAAQ,eAAe,WAAW;EAClC,OAAO,eAAe,WAAW;EACjC,QAAQ,gBAAgB;GAAE,MAAM,WAAW;GAAW,SAAS,WAAW;EAAM;EAChF,QAAQ,YAAY,YAAY,QAAQ,YAAY,OAAO,CAAC,EAAE;EAC9D,kBAAkB,YAAY,YAC5B,OAAO,IAAI,WAAW,SAAS,OAAO,CAAE,CAAC,EAAE,WAAW,WAAW;EACnE,KAAK,YAAY,SAAS;GACxB,MAAM,KAAK,QAAQ,aAAa,QAAQ,KAAK,oBAAoB,EAAE;GACnE,OAAO,WAAW,KAChB,QAAQ,OAAO,UACR;IACL;IACA,GAAI,QAAQ,aAAa,cAAc,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;IACjE,GAAI,QAAQ,aAAa,WAAW,IAChC,EAAE,OAAO,QAAQ,aAAa,WAAW,EAAG,IAC5C,CAAC;IACL,GAAI,QAAQ,aAAa,cAAc,IACnC,EAAE,UAAU,KAAK,QAAQ,aAAa,cAAc,CAAC,EAAG,IACxD,CAAC;GACP,IACA,QAAQ,YAAY,QAAQ,iBAAiB,WAAW,QAAQ,eAAe,OAAO,CAAC,CACzF;EACF;EACA,YAAY,YAAY,YACtB,WAAW,gBAAgB,QAAQ,aAAa,mBAAmB,CAAC;CACxE;AACF,CAAC"}
|
package/src/context-menu.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ElementOf, Tag, Told } from "./runtime.js";
|
|
2
|
+
import { Placed } from "./around.js";
|
|
2
3
|
/**
|
|
3
4
|
* `<kui-context-menu>`: a menu for an area of the page, opened at the pointer by a secondary
|
|
4
5
|
* press, or a long one on a touch screen. Its `kui-part="trigger"` is the area; the rest are a
|
|
@@ -12,7 +13,7 @@ declare global {
|
|
|
12
13
|
}, {
|
|
13
14
|
"checked-change": Told<"checked", boolean>;
|
|
14
15
|
"value-change": Told<"value", string>;
|
|
15
|
-
}
|
|
16
|
+
}> & Placed;
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
//# sourceMappingURL=context-menu.d.ts.map
|
package/src/context-menu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-menu.js","names":["defineMenu"],"sources":["../../../../packages/web/src/context-menu.ts"],"sourcesContent":["import { defineMenu } from \"./menu.ts\"\nimport type { ElementOf, Told } from \"./runtime.ts\"\n\n/**\n * `<kui-context-menu>`: a menu for an area of the page, opened at the pointer by a secondary\n * press, or a long one on a touch screen. Its `kui-part=\"trigger\"` is the area; the rest are a\n * menu's parts.\n */\nexport const tag = defineMenu(\n \"kui-context-menu\",\n () => ({ context: true }),\n (controller) => controller.area\n)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-context-menu\": ElementOf<\n typeof tag,\n { \"open-change\": [\"onOpenChange\", \"open\"] },\n { \"checked-change\": Told<\"checked\", boolean>; \"value-change\": Told<\"value\", string> }\n
|
|
1
|
+
{"version":3,"file":"context-menu.js","names":["defineMenu"],"sources":["../../../../packages/web/src/context-menu.ts"],"sourcesContent":["import { defineMenu } from \"./menu.ts\"\nimport type { Placed } from \"./around.ts\"\nimport type { ElementOf, Told } from \"./runtime.ts\"\n\n/**\n * `<kui-context-menu>`: a menu for an area of the page, opened at the pointer by a secondary\n * press, or a long one on a touch screen. Its `kui-part=\"trigger\"` is the area; the rest are a\n * menu's parts.\n */\nexport const tag = defineMenu(\n \"kui-context-menu\",\n () => ({ context: true }),\n (controller) => controller.area\n)\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-context-menu\": ElementOf<\n typeof tag,\n { \"open-change\": [\"onOpenChange\", \"open\"] },\n { \"checked-change\": Told<\"checked\", boolean>; \"value-change\": Told<\"value\", string> }\n > &\n Placed\n }\n}\n"],"mappings":";;;;;;;AASA,MAAa,MAAMA,KACjB,2BACO,EAAE,SAAS,KAAK,KACtB,eAAe,WAAW,IAC7B"}
|
package/src/date-picker.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { ElementOf, Tag } from "./runtime.js";
|
|
2
|
+
import { Placed } from "./around.js";
|
|
2
3
|
import { DatePicker, DatePickerProps } from "@kirana-ui/core/date-picker";
|
|
3
4
|
/**
|
|
4
5
|
* `<kui-date-picker>`: a date field and a calendar in a popover that are one value. A
|
|
5
6
|
* `kui-part="field"` with a date field's `segments` template and `input`; a `trigger`
|
|
6
7
|
* button; and a `portal` with a `positioner` around the `popup`, which holds the `calendar`
|
|
7
8
|
* with a calendar's parts and templates. `value`, `default-value`, `open`, `default-open`,
|
|
8
|
-
* `locale`, `min`, `max`, `calendar-system`, `fixed-weeks`, `
|
|
9
|
-
* `
|
|
10
|
-
* `
|
|
9
|
+
* `locale`, `min`, `max`, `calendar-system`, `fixed-weeks`, `months` (each drawn in a
|
|
10
|
+
* `<template kui-each="months">`), `paged-navigation`, `month`, `default-month`, `disabled`,
|
|
11
|
+
* `read-only`, `required`, `name`, `form`; `isDateUnavailable` and `placeholders` as
|
|
12
|
+
* properties; it tells `value-change`, `open-change` and `month-change`.
|
|
11
13
|
*/
|
|
12
14
|
export declare const tag: Tag<DatePickerProps, DatePicker & {
|
|
13
15
|
mounted: unknown;
|
|
@@ -17,7 +19,8 @@ declare global {
|
|
|
17
19
|
"kui-date-picker": ElementOf<typeof tag, {
|
|
18
20
|
"value-change": ["onValueChange", "value"];
|
|
19
21
|
"open-change": ["onOpenChange", "open"];
|
|
20
|
-
|
|
22
|
+
"month-change": ["onMonthChange", "month"];
|
|
23
|
+
}> & Placed;
|
|
21
24
|
}
|
|
22
25
|
}
|
|
23
26
|
//# sourceMappingURL=date-picker.d.ts.map
|
package/src/date-picker.js
CHANGED
|
@@ -10,9 +10,10 @@ const calendar = calendarParts((controller) => controller.calendar);
|
|
|
10
10
|
* `kui-part="field"` with a date field's `segments` template and `input`; a `trigger`
|
|
11
11
|
* button; and a `portal` with a `positioner` around the `popup`, which holds the `calendar`
|
|
12
12
|
* with a calendar's parts and templates. `value`, `default-value`, `open`, `default-open`,
|
|
13
|
-
* `locale`, `min`, `max`, `calendar-system`, `fixed-weeks`, `
|
|
14
|
-
* `
|
|
15
|
-
* `
|
|
13
|
+
* `locale`, `min`, `max`, `calendar-system`, `fixed-weeks`, `months` (each drawn in a
|
|
14
|
+
* `<template kui-each="months">`), `paged-navigation`, `month`, `default-month`, `disabled`,
|
|
15
|
+
* `read-only`, `required`, `name`, `form`; `isDateUnavailable` and `placeholders` as
|
|
16
|
+
* properties; it tells `value-change`, `open-change` and `month-change`.
|
|
16
17
|
*/
|
|
17
18
|
const tag = defineElement({
|
|
18
19
|
tag: "kui-date-picker",
|
|
@@ -26,6 +27,10 @@ const tag = defineElement({
|
|
|
26
27
|
max: "string",
|
|
27
28
|
"calendar-system": "string",
|
|
28
29
|
"fixed-weeks": "boolean",
|
|
30
|
+
months: "number",
|
|
31
|
+
"paged-navigation": "boolean",
|
|
32
|
+
month: "string",
|
|
33
|
+
"default-month": "string",
|
|
29
34
|
disabled: "boolean",
|
|
30
35
|
"read-only": "boolean",
|
|
31
36
|
required: "boolean",
|
|
@@ -48,6 +53,10 @@ const tag = defineElement({
|
|
|
48
53
|
onOpenChange: {
|
|
49
54
|
event: "open-change",
|
|
50
55
|
prop: "open"
|
|
56
|
+
},
|
|
57
|
+
onMonthChange: {
|
|
58
|
+
event: "month-change",
|
|
59
|
+
prop: "month"
|
|
51
60
|
}
|
|
52
61
|
},
|
|
53
62
|
lists: {
|
package/src/date-picker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.js","names":[],"sources":["../../../../packages/web/src/date-picker.ts"],"sourcesContent":["import { createDatePicker } from \"@kirana-ui/core/date-picker\"\nimport type { DatePicker, DatePickerProps } from \"@kirana-ui/core/date-picker\"\n\nimport { positioner } from \"./around.ts\"\nimport { calendarParts, fieldParts } from \"./dates.ts\"\nimport { defineElement } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\nconst field = fieldParts<DatePicker>((controller) => controller.field)\nconst calendar = calendarParts<DatePicker>((controller) => controller.calendar)\n\n/**\n * `<kui-date-picker>`: a date field and a calendar in a popover that are one value. A\n * `kui-part=\"field\"` with a date field's `segments` template and `input`; a `trigger`\n * button; and a `portal` with a `positioner` around the `popup`, which holds the `calendar`\n * with a calendar's parts and templates. `value`, `default-value`, `open`, `default-open`,\n * `locale`, `min`, `max`, `calendar-system`, `fixed-weeks`, `
|
|
1
|
+
{"version":3,"file":"date-picker.js","names":[],"sources":["../../../../packages/web/src/date-picker.ts"],"sourcesContent":["import { createDatePicker } from \"@kirana-ui/core/date-picker\"\nimport type { DatePicker, DatePickerProps } from \"@kirana-ui/core/date-picker\"\n\nimport { positioner } from \"./around.ts\"\nimport type { Placed } from \"./around.ts\"\nimport { calendarParts, fieldParts } from \"./dates.ts\"\nimport { defineElement } from \"./runtime.ts\"\nimport type { ElementOf } from \"./runtime.ts\"\n\nconst field = fieldParts<DatePicker>((controller) => controller.field)\nconst calendar = calendarParts<DatePicker>((controller) => controller.calendar)\n\n/**\n * `<kui-date-picker>`: a date field and a calendar in a popover that are one value. A\n * `kui-part=\"field\"` with a date field's `segments` template and `input`; a `trigger`\n * button; and a `portal` with a `positioner` around the `popup`, which holds the `calendar`\n * with a calendar's parts and templates. `value`, `default-value`, `open`, `default-open`,\n * `locale`, `min`, `max`, `calendar-system`, `fixed-weeks`, `months` (each drawn in a\n * `<template kui-each=\"months\">`), `paged-navigation`, `month`, `default-month`, `disabled`,\n * `read-only`, `required`, `name`, `form`; `isDateUnavailable` and `placeholders` as\n * properties; it tells `value-change`, `open-change` and `month-change`.\n */\nexport const tag = defineElement<DatePickerProps, DatePicker & { mounted: unknown }>({\n tag: \"kui-date-picker\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n open: \"boolean\",\n \"default-open\": \"boolean\",\n locale: \"string\",\n min: \"string\",\n max: \"string\",\n \"calendar-system\": \"string\",\n \"fixed-weeks\": \"boolean\",\n months: \"number\",\n \"paged-navigation\": \"boolean\",\n month: \"string\",\n \"default-month\": \"string\",\n disabled: \"boolean\",\n \"read-only\": \"boolean\",\n required: \"boolean\",\n name: \"string\",\n form: \"string\",\n },\n properties: [\"isDateUnavailable\", \"placeholders\"],\n create(props) {\n const picker = createDatePicker(props)\n // What a portal waits for: the popover's.\n return { ...picker, mounted: picker.popover.mounted }\n },\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onOpenChange: { event: \"open-change\", prop: \"open\" },\n onMonthChange: { event: \"month-change\", prop: \"month\" },\n },\n lists: { ...field.lists, ...calendar.lists },\n parts: {\n field: (controller) => controller.field.root,\n ...field.parts,\n trigger: (controller) => controller.popover.trigger,\n positioner: (controller, element) => positioner(controller.popover, element),\n popup: (controller) => controller.popover.popup,\n calendar: (controller) => controller.calendar.root,\n ...calendar.parts,\n },\n})\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"kui-date-picker\": ElementOf<\n typeof tag,\n {\n \"value-change\": [\"onValueChange\", \"value\"]\n \"open-change\": [\"onOpenChange\", \"open\"]\n \"month-change\": [\"onMonthChange\", \"month\"]\n }\n > &\n Placed\n }\n}\n"],"mappings":";;;;;AASA,MAAM,QAAQ,YAAwB,eAAe,WAAW,KAAK;AACrE,MAAM,WAAW,eAA2B,eAAe,WAAW,QAAQ;;;;;;;;;;;AAY9E,MAAa,MAAM,cAAkE;CACnF,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,MAAM;EACN,gBAAgB;EAChB,QAAQ;EACR,KAAK;EACL,KAAK;EACL,mBAAmB;EACnB,eAAe;EACf,QAAQ;EACR,oBAAoB;EACpB,OAAO;EACP,iBAAiB;EACjB,UAAU;EACV,aAAa;EACb,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,YAAY,CAAC,qBAAqB,cAAc;CAChD,OAAO,OAAO;EACZ,MAAM,SAAS,iBAAiB,KAAK;EAErC,OAAO;GAAE,GAAG;GAAQ,SAAS,OAAO,QAAQ;EAAQ;CACtD;CACA,SAAS;EACP,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;EACtD,cAAc;GAAE,OAAO;GAAe,MAAM;EAAO;EACnD,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;CACxD;CACA,OAAO;EAAE,GAAG,MAAM;EAAO,GAAG,SAAS;CAAM;CAC3C,OAAO;EACL,QAAQ,eAAe,WAAW,MAAM;EACxC,GAAG,MAAM;EACT,UAAU,eAAe,WAAW,QAAQ;EAC5C,aAAa,YAAY,YAAY,WAAW,WAAW,SAAS,OAAO;EAC3E,QAAQ,eAAe,WAAW,QAAQ;EAC1C,WAAW,eAAe,WAAW,SAAS;EAC9C,GAAG,SAAS;CACd;AACF,CAAC"}
|
package/src/dates.d.ts
CHANGED
|
@@ -13,7 +13,10 @@ export declare function calendarParts<Controller>(of: (controller: Controller) =
|
|
|
13
13
|
parts: Parts<Controller>;
|
|
14
14
|
lists: Lists<Controller>;
|
|
15
15
|
};
|
|
16
|
-
/**
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* A calendar's value as an attribute writes it: a day, or several with commas between (a
|
|
18
|
+
* range's first and last, or a list's days).
|
|
19
|
+
*/
|
|
20
|
+
export declare function days(given: unknown, mode?: unknown): unknown;
|
|
18
21
|
export {};
|
|
19
22
|
//# sourceMappingURL=dates.d.ts.map
|