@kirana-ui/web 0.0.0 → 0.1.1
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/LICENSE +1 -1
- package/package.json +223 -6
- package/src/accordion.d.ts +8 -0
- package/src/accordion.js +67 -0
- package/src/accordion.js.map +1 -0
- package/src/alert-dialog.d.ts +6 -0
- package/src/alert-dialog.js +36 -0
- package/src/alert-dialog.js.map +1 -0
- package/src/around.d.ts +30 -0
- package/src/around.js +53 -0
- package/src/around.js.map +1 -0
- package/src/autocomplete.d.ts +8 -0
- package/src/autocomplete.js +42 -0
- package/src/autocomplete.js.map +1 -0
- package/src/autosize.d.ts +6 -0
- package/src/autosize.js +18 -0
- package/src/autosize.js.map +1 -0
- package/src/avatar.d.ts +7 -0
- package/src/avatar.js +38 -0
- package/src/avatar.js.map +1 -0
- package/src/button.d.ts +6 -0
- package/src/button.js +21 -0
- package/src/button.js.map +1 -0
- package/src/calendar.d.ts +12 -0
- package/src/calendar.js +60 -0
- package/src/calendar.js.map +1 -0
- package/src/carousel.d.ts +7 -0
- package/src/carousel.js +34 -0
- package/src/carousel.js.map +1 -0
- package/src/checkbox.d.ts +8 -0
- package/src/checkbox.js +42 -0
- package/src/checkbox.js.map +1 -0
- package/src/collapsible.d.ts +7 -0
- package/src/collapsible.js +32 -0
- package/src/collapsible.js.map +1 -0
- package/src/combobox.d.ts +27 -0
- package/src/combobox.js +125 -0
- package/src/combobox.js.map +1 -0
- package/src/command.d.ts +10 -0
- package/src/command.js +61 -0
- package/src/command.js.map +1 -0
- package/src/context-menu.d.ts +7 -0
- package/src/context-menu.js +11 -0
- package/src/context-menu.js.map +1 -0
- package/src/date-field.d.ts +9 -0
- package/src/date-field.js +41 -0
- package/src/date-field.js.map +1 -0
- package/src/date-picker.d.ts +11 -0
- package/src/date-picker.js +75 -0
- package/src/date-picker.js.map +1 -0
- package/src/dates.d.ts +19 -0
- package/src/dates.js +70 -0
- package/src/dates.js.map +1 -0
- package/src/dialog.d.ts +8 -0
- package/src/dialog.js +40 -0
- package/src/dialog.js.map +1 -0
- package/src/drawer.d.ts +8 -0
- package/src/drawer.js +62 -0
- package/src/drawer.js.map +1 -0
- package/src/field.d.ts +9 -0
- package/src/field.js +47 -0
- package/src/field.js.map +1 -0
- package/src/fieldset.d.ts +3 -0
- package/src/fieldset.js +17 -0
- package/src/fieldset.js.map +1 -0
- package/src/form.d.ts +7 -0
- package/src/form.js +30 -0
- package/src/form.js.map +1 -0
- package/src/hover-card.d.ts +7 -0
- package/src/hover-card.js +12 -0
- package/src/hover-card.js.map +1 -0
- package/src/hover-popup.d.ts +5 -0
- package/src/hover-popup.js +43 -0
- package/src/hover-popup.js.map +1 -0
- package/src/index.d.ts +5 -0
- package/src/index.js +49 -0
- package/src/input.d.ts +6 -0
- package/src/input.js +22 -0
- package/src/input.js.map +1 -0
- package/src/label.d.ts +3 -0
- package/src/label.js +15 -0
- package/src/label.js.map +1 -0
- package/src/listbox.d.ts +8 -0
- package/src/listbox.js +54 -0
- package/src/listbox.js.map +1 -0
- package/src/menu.d.ts +16 -0
- package/src/menu.js +139 -0
- package/src/menu.js.map +1 -0
- package/src/menubar.d.ts +7 -0
- package/src/menubar.js +22 -0
- package/src/menubar.js.map +1 -0
- package/src/message-scroller.d.ts +7 -0
- package/src/message-scroller.js +30 -0
- package/src/message-scroller.js.map +1 -0
- package/src/meter.d.ts +7 -0
- package/src/meter.js +40 -0
- package/src/meter.js.map +1 -0
- package/src/navigation-menu.d.ts +10 -0
- package/src/navigation-menu.js +77 -0
- package/src/navigation-menu.js.map +1 -0
- package/src/number-field.d.ts +9 -0
- package/src/number-field.js +57 -0
- package/src/number-field.js.map +1 -0
- package/src/otp.d.ts +9 -0
- package/src/otp.js +64 -0
- package/src/otp.js.map +1 -0
- package/src/pagination.d.ts +9 -0
- package/src/pagination.js +45 -0
- package/src/pagination.js.map +1 -0
- package/src/popover.d.ts +8 -0
- package/src/popover.js +39 -0
- package/src/popover.js.map +1 -0
- package/src/progress.d.ts +7 -0
- package/src/progress.js +40 -0
- package/src/progress.js.map +1 -0
- package/src/qr-code.d.ts +6 -0
- package/src/qr-code.js +24 -0
- package/src/qr-code.js.map +1 -0
- package/src/radio-group.d.ts +8 -0
- package/src/radio-group.js +40 -0
- package/src/radio-group.js.map +1 -0
- package/src/resizable.d.ts +7 -0
- package/src/resizable.js +38 -0
- package/src/resizable.js.map +1 -0
- package/src/runtime.d.ts +124 -0
- package/src/runtime.js +452 -0
- package/src/runtime.js.map +1 -0
- package/src/scroll-area.d.ts +7 -0
- package/src/scroll-area.js +35 -0
- package/src/scroll-area.js.map +1 -0
- package/src/select.d.ts +13 -0
- package/src/select.js +83 -0
- package/src/select.js.map +1 -0
- package/src/separator.d.ts +3 -0
- package/src/separator.js +14 -0
- package/src/separator.js.map +1 -0
- package/src/slider.d.ts +10 -0
- package/src/slider.js +71 -0
- package/src/slider.js.map +1 -0
- package/src/switch.d.ts +7 -0
- package/src/switch.js +37 -0
- package/src/switch.js.map +1 -0
- package/src/tabs.d.ts +7 -0
- package/src/tabs.js +31 -0
- package/src/tabs.js.map +1 -0
- package/src/toast.d.ts +17 -0
- package/src/toast.js +72 -0
- package/src/toast.js.map +1 -0
- package/src/toggle-group.d.ts +7 -0
- package/src/toggle-group.js +37 -0
- package/src/toggle-group.js.map +1 -0
- package/src/toggle.d.ts +7 -0
- package/src/toggle.js +32 -0
- package/src/toggle.js.map +1 -0
- package/src/toolbar.d.ts +8 -0
- package/src/toolbar.js +31 -0
- package/src/toolbar.js.map +1 -0
- package/src/tooltip.d.ts +7 -0
- package/src/tooltip.js +12 -0
- package/src/tooltip.js.map +1 -0
- package/README.md +0 -7
- package/index.js +0 -5
package/src/button.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineElement } from "./runtime.js";
|
|
2
|
+
import { createButton } from "@kirana-ui/core/button";
|
|
3
|
+
// src/button.ts
|
|
4
|
+
/**
|
|
5
|
+
* `<kui-button>` around a `kui-part="root"` button, or with `native-button="false"` another
|
|
6
|
+
* element that acts as one. `disabled`, `focusable-when-disabled`, `native-button`.
|
|
7
|
+
*/
|
|
8
|
+
const tag = defineElement({
|
|
9
|
+
tag: "kui-button",
|
|
10
|
+
props: {
|
|
11
|
+
disabled: "boolean",
|
|
12
|
+
"focusable-when-disabled": "boolean",
|
|
13
|
+
"native-button": "boolean"
|
|
14
|
+
},
|
|
15
|
+
create: (props) => createButton(props),
|
|
16
|
+
changes: {},
|
|
17
|
+
parts: { root: (controller) => controller.root }
|
|
18
|
+
});
|
|
19
|
+
export { tag };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","names":[],"sources":["../../../../packages/web/src/button.ts"],"sourcesContent":["import { createButton } from \"@kirana-ui/core/button\"\n\nimport { defineElement } from \"./runtime.ts\"\n\n/**\n * `<kui-button>` around a `kui-part=\"root\"` button, or with `native-button=\"false\"` another\n * element that acts as one. `disabled`, `focusable-when-disabled`, `native-button`.\n */\nexport const tag = defineElement({\n tag: \"kui-button\",\n props: { disabled: \"boolean\", \"focusable-when-disabled\": \"boolean\", \"native-button\": \"boolean\" },\n create: (props) => createButton(props as never),\n changes: {},\n parts: { root: (controller) => controller.root },\n})\n"],"mappings":";;;;;;;AAQA,MAAa,MAAM,cAAc;CAC/B,KAAK;CACL,OAAO;EAAE,UAAU;EAAW,2BAA2B;EAAW,iBAAiB;CAAU;CAC/F,SAAS,UAAU,aAAa,KAAc;CAC9C,SAAS,CAAC;CACV,OAAO,EAAE,OAAO,eAAe,WAAW,KAAK;AACjD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<kui-calendar>` around `kui-part="root"`, with `previous` and `next` buttons, a `heading`
|
|
3
|
+
* (it says the month) and a `grid` table. The table's head row holds a
|
|
4
|
+
* `<template kui-each="weekdays">` with a `head-cell` (`{short}`, `{narrow}`, `{long}`); its
|
|
5
|
+
* body a `<template kui-each="weeks">` with a row, which holds a `<template kui-each="days">`
|
|
6
|
+
* with a `cell` and its `day` button (`{date}`, `{label}`). `value` and `default-value` (a
|
|
7
|
+
* day as `2026-03-14`; several with commas between), `mode`, `default-focused-value`,
|
|
8
|
+
* `locale`, `calendar-system`, `min`, `max`, `disabled`, `read-only`, `fixed-weeks`;
|
|
9
|
+
* `isDateUnavailable` as a property; it tells `value-change` and `month-change`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const tag: string;
|
|
12
|
+
//# sourceMappingURL=calendar.d.ts.map
|
package/src/calendar.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { calendarParts, days } from "./dates.js";
|
|
2
|
+
import { defineElement } from "./runtime.js";
|
|
3
|
+
import { computed } from "@kirana-ui/core";
|
|
4
|
+
import { createCalendar } from "@kirana-ui/core/calendar";
|
|
5
|
+
// src/calendar.ts
|
|
6
|
+
const { parts, lists } = calendarParts((controller) => controller);
|
|
7
|
+
/**
|
|
8
|
+
* `<kui-calendar>` around `kui-part="root"`, with `previous` and `next` buttons, a `heading`
|
|
9
|
+
* (it says the month) and a `grid` table. The table's head row holds a
|
|
10
|
+
* `<template kui-each="weekdays">` with a `head-cell` (`{short}`, `{narrow}`, `{long}`); its
|
|
11
|
+
* body a `<template kui-each="weeks">` with a row, which holds a `<template kui-each="days">`
|
|
12
|
+
* with a `cell` and its `day` button (`{date}`, `{label}`). `value` and `default-value` (a
|
|
13
|
+
* day as `2026-03-14`; several with commas between), `mode`, `default-focused-value`,
|
|
14
|
+
* `locale`, `calendar-system`, `min`, `max`, `disabled`, `read-only`, `fixed-weeks`;
|
|
15
|
+
* `isDateUnavailable` as a property; it tells `value-change` and `month-change`.
|
|
16
|
+
*/
|
|
17
|
+
const tag = defineElement({
|
|
18
|
+
tag: "kui-calendar",
|
|
19
|
+
props: {
|
|
20
|
+
value: "string",
|
|
21
|
+
"default-value": "string",
|
|
22
|
+
mode: "string",
|
|
23
|
+
"default-focused-value": "string",
|
|
24
|
+
locale: "string",
|
|
25
|
+
"calendar-system": "string",
|
|
26
|
+
min: "string",
|
|
27
|
+
max: "string",
|
|
28
|
+
disabled: "boolean",
|
|
29
|
+
"read-only": "boolean",
|
|
30
|
+
"fixed-weeks": "boolean"
|
|
31
|
+
},
|
|
32
|
+
properties: ["isDateUnavailable"],
|
|
33
|
+
create: (props) => createCalendar(computed(() => {
|
|
34
|
+
const own = props.get();
|
|
35
|
+
return {
|
|
36
|
+
...own,
|
|
37
|
+
value: days(own.value),
|
|
38
|
+
defaultValue: days(own.defaultValue)
|
|
39
|
+
};
|
|
40
|
+
})),
|
|
41
|
+
changes: {
|
|
42
|
+
onValueChange: {
|
|
43
|
+
event: "value-change",
|
|
44
|
+
prop: "value"
|
|
45
|
+
},
|
|
46
|
+
onMonthChange: {
|
|
47
|
+
event: "month-change",
|
|
48
|
+
prop: "month",
|
|
49
|
+
hold: false
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
lists,
|
|
53
|
+
parts: {
|
|
54
|
+
root: (controller) => controller.root,
|
|
55
|
+
...parts
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
export { tag };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=calendar.js.map
|
|
@@ -0,0 +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\"\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\n * day as `2026-03-14`; several with commas between), `mode`, `default-focused-value`,\n * `locale`, `calendar-system`, `min`, `max`, `disabled`, `read-only`, `fixed-weeks`;\n * `isDateUnavailable` as a 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 \"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 },\n properties: [\"isDateUnavailable\"],\n create: (props) =>\n createCalendar(\n computed(() => {\n const own = props.get()\n return {\n ...own,\n value: days(own.value),\n defaultValue: days(own.defaultValue),\n } as CalendarProps\n })\n ),\n changes: {\n onValueChange: { event: \"value-change\", prop: \"value\" },\n onMonthChange: { event: \"month-change\", prop: \"month\", hold: false },\n },\n lists,\n parts: { root: (controller) => controller.root, ...parts },\n})\n"],"mappings":";;;;;AAOA,MAAM,EAAE,OAAO,UAAU,eAAyB,eAAe,UAAU;;;;;;;;;;;AAY3E,MAAa,MAAM,cAAuC;CACxD,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,MAAM;EACN,yBAAyB;EACzB,QAAQ;EACR,mBAAmB;EACnB,KAAK;EACL,KAAK;EACL,UAAU;EACV,aAAa;EACb,eAAe;CACjB;CACA,YAAY,CAAC,mBAAmB;CAChC,SAAS,UACP,eACE,eAAe;EACb,MAAM,MAAM,MAAM,IAAI;EACtB,OAAO;GACL,GAAG;GACH,OAAO,KAAK,IAAI,KAAK;GACrB,cAAc,KAAK,IAAI,YAAY;EACrC;CACF,CAAC,CACH;CACF,SAAS;EACP,eAAe;GAAE,OAAO;GAAgB,MAAM;EAAQ;EACtD,eAAe;GAAE,OAAO;GAAgB,MAAM;GAAS,MAAM;EAAM;CACrE;CACA;CACA,OAAO;EAAE,OAAO,eAAe,WAAW;EAAM,GAAG;CAAM;AAC3D,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<kui-carousel>` around `kui-part="root"`, a `viewport` with an `item` for each slide
|
|
3
|
+
* (`kui-index`, from 0), `previous` and `next` buttons, and an `indicator` button for a slide
|
|
4
|
+
* (`kui-index`). `index`, `default-index`, `orientation`, `loop`; it tells `index-change`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const tag: string;
|
|
7
|
+
//# sourceMappingURL=carousel.d.ts.map
|
package/src/carousel.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineElement } from "./runtime.js";
|
|
2
|
+
import { createCarousel } from "@kirana-ui/core/carousel";
|
|
3
|
+
// src/carousel.ts
|
|
4
|
+
const indexOf = (element) => Number(element.getAttribute("kui-index") ?? 0);
|
|
5
|
+
/**
|
|
6
|
+
* `<kui-carousel>` around `kui-part="root"`, a `viewport` with an `item` for each slide
|
|
7
|
+
* (`kui-index`, from 0), `previous` and `next` buttons, and an `indicator` button for a slide
|
|
8
|
+
* (`kui-index`). `index`, `default-index`, `orientation`, `loop`; it tells `index-change`.
|
|
9
|
+
*/
|
|
10
|
+
const tag = defineElement({
|
|
11
|
+
tag: "kui-carousel",
|
|
12
|
+
props: {
|
|
13
|
+
index: "number",
|
|
14
|
+
"default-index": "number",
|
|
15
|
+
orientation: "string",
|
|
16
|
+
loop: "boolean"
|
|
17
|
+
},
|
|
18
|
+
create: (props) => createCarousel(props),
|
|
19
|
+
changes: { onIndexChange: {
|
|
20
|
+
event: "index-change",
|
|
21
|
+
prop: "index"
|
|
22
|
+
} },
|
|
23
|
+
parts: {
|
|
24
|
+
root: (controller) => controller.root,
|
|
25
|
+
viewport: (controller) => controller.viewport,
|
|
26
|
+
item: (controller, element) => controller.item(indexOf(element)),
|
|
27
|
+
previous: (controller) => controller.previous,
|
|
28
|
+
next: (controller) => controller.next,
|
|
29
|
+
indicator: (controller, element) => controller.indicator(indexOf(element))
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
export { tag };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=carousel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel.js","names":[],"sources":["../../../../packages/web/src/carousel.ts"],"sourcesContent":["import { createCarousel } from \"@kirana-ui/core/carousel\"\nimport type { Carousel, CarouselProps } from \"@kirana-ui/core/carousel\"\n\nimport { defineElement } from \"./runtime.ts\"\n\nconst indexOf = (element: HTMLElement) => Number(element.getAttribute(\"kui-index\") ?? 0)\n\n/**\n * `<kui-carousel>` around `kui-part=\"root\"`, a `viewport` with an `item` for each slide\n * (`kui-index`, from 0), `previous` and `next` buttons, and an `indicator` button for a slide\n * (`kui-index`). `index`, `default-index`, `orientation`, `loop`; it tells `index-change`.\n */\nexport const tag = defineElement<CarouselProps, Carousel>({\n tag: \"kui-carousel\",\n props: { index: \"number\", \"default-index\": \"number\", orientation: \"string\", loop: \"boolean\" },\n create: (props) => createCarousel(props),\n changes: { onIndexChange: { event: \"index-change\", prop: \"index\" } },\n parts: {\n root: (controller) => controller.root,\n viewport: (controller) => controller.viewport,\n item: (controller, element) => controller.item(indexOf(element)),\n previous: (controller) => controller.previous,\n next: (controller) => controller.next,\n indicator: (controller, element) => controller.indicator(indexOf(element)),\n },\n})\n"],"mappings":";;;AAKA,MAAM,WAAW,YAAyB,OAAO,QAAQ,aAAa,WAAW,KAAK,CAAC;;;;;;AAOvF,MAAa,MAAM,cAAuC;CACxD,KAAK;CACL,OAAO;EAAE,OAAO;EAAU,iBAAiB;EAAU,aAAa;EAAU,MAAM;CAAU;CAC5F,SAAS,UAAU,eAAe,KAAK;CACvC,SAAS,EAAE,eAAe;EAAE,OAAO;EAAgB,MAAM;CAAQ,EAAE;CACnE,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,WAAW,eAAe,WAAW;EACrC,OAAO,YAAY,YAAY,WAAW,KAAK,QAAQ,OAAO,CAAC;EAC/D,WAAW,eAAe,WAAW;EACrC,OAAO,eAAe,WAAW;EACjC,YAAY,YAAY,YAAY,WAAW,UAAU,QAAQ,OAAO,CAAC;CAC3E;AACF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<kui-checkbox>` around a `kui-part="root"` button with an `indicator` inside, which is in
|
|
3
|
+
* the page while the box is checked or indeterminate. The root draws the hidden native input a
|
|
4
|
+
* form and a label reach. `checked`, `default-checked`, `indeterminate`, `disabled`,
|
|
5
|
+
* `read-only`, `required`, `name`, `form`, `value`; it tells `checked-change`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const tag: string;
|
|
8
|
+
//# sourceMappingURL=checkbox.d.ts.map
|
package/src/checkbox.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { fieldAround } from "./around.js";
|
|
2
|
+
import { defineElement } from "./runtime.js";
|
|
3
|
+
import { createCheckbox } from "@kirana-ui/core/checkbox";
|
|
4
|
+
// src/checkbox.ts
|
|
5
|
+
/**
|
|
6
|
+
* `<kui-checkbox>` around a `kui-part="root"` button with an `indicator` inside, which is in
|
|
7
|
+
* the page while the box is checked or indeterminate. The root draws the hidden native input a
|
|
8
|
+
* form and a label reach. `checked`, `default-checked`, `indeterminate`, `disabled`,
|
|
9
|
+
* `read-only`, `required`, `name`, `form`, `value`; it tells `checked-change`.
|
|
10
|
+
*/
|
|
11
|
+
const tag = defineElement({
|
|
12
|
+
tag: "kui-checkbox",
|
|
13
|
+
props: {
|
|
14
|
+
checked: "boolean",
|
|
15
|
+
"default-checked": "boolean",
|
|
16
|
+
indeterminate: "boolean",
|
|
17
|
+
disabled: "boolean",
|
|
18
|
+
"read-only": "boolean",
|
|
19
|
+
required: "boolean",
|
|
20
|
+
name: "string",
|
|
21
|
+
form: "string",
|
|
22
|
+
value: "string"
|
|
23
|
+
},
|
|
24
|
+
create: (props, host) => createCheckbox(props, { field: fieldAround(host) }),
|
|
25
|
+
changes: { onCheckedChange: {
|
|
26
|
+
event: "checked-change",
|
|
27
|
+
prop: "checked"
|
|
28
|
+
} },
|
|
29
|
+
parts: {
|
|
30
|
+
root: (controller) => ({
|
|
31
|
+
part: controller.root,
|
|
32
|
+
inner: controller.input
|
|
33
|
+
}),
|
|
34
|
+
indicator: (controller) => ({
|
|
35
|
+
mounted: controller.indicatorMounted,
|
|
36
|
+
part: controller.indicator
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
export { tag };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.js","names":[],"sources":["../../../../packages/web/src/checkbox.ts"],"sourcesContent":["import { createCheckbox } from \"@kirana-ui/core/checkbox\"\n\nimport { fieldAround } from \"./around.ts\"\nimport { defineElement } 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`, `indeterminate`, `disabled`,\n * `read-only`, `required`, `name`, `form`, `value`; it 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 disabled: \"boolean\",\n \"read-only\": \"boolean\",\n required: \"boolean\",\n name: \"string\",\n form: \"string\",\n value: \"string\",\n },\n create: (props, host) => createCheckbox(props, { field: fieldAround(host) }),\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"],"mappings":";;;;;;;;;;AAWA,MAAa,MAAM,cAAc;CAC/B,KAAK;CACL,OAAO;EACL,SAAS;EACT,mBAAmB;EACnB,eAAe;EACf,UAAU;EACV,aAAa;EACb,UAAU;EACV,MAAM;EACN,MAAM;EACN,OAAO;CACT;CACA,SAAS,OAAO,SAAS,eAAe,OAAO,EAAE,OAAO,YAAY,IAAI,EAAE,CAAC;CAC3E,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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<kui-collapsible>` around `kui-part="root"`, a `trigger` button and a `panel`, which is in
|
|
3
|
+
* the page while it is open (`kui-keep-mounted` keeps it). `open`, `default-open`, `disabled`; it
|
|
4
|
+
* tells `open-change`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const tag: string;
|
|
7
|
+
//# sourceMappingURL=collapsible.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineElement } from "./runtime.js";
|
|
2
|
+
import { createCollapsible } from "@kirana-ui/core/collapsible";
|
|
3
|
+
// src/collapsible.ts
|
|
4
|
+
/**
|
|
5
|
+
* `<kui-collapsible>` around `kui-part="root"`, a `trigger` button and a `panel`, which is in
|
|
6
|
+
* the page while it is open (`kui-keep-mounted` keeps it). `open`, `default-open`, `disabled`; it
|
|
7
|
+
* tells `open-change`.
|
|
8
|
+
*/
|
|
9
|
+
const tag = defineElement({
|
|
10
|
+
tag: "kui-collapsible",
|
|
11
|
+
props: {
|
|
12
|
+
open: "boolean",
|
|
13
|
+
"default-open": "boolean",
|
|
14
|
+
disabled: "boolean"
|
|
15
|
+
},
|
|
16
|
+
create: createCollapsible,
|
|
17
|
+
changes: { onOpenChange: {
|
|
18
|
+
event: "open-change",
|
|
19
|
+
prop: "open"
|
|
20
|
+
} },
|
|
21
|
+
parts: {
|
|
22
|
+
root: (controller) => controller.root,
|
|
23
|
+
trigger: (controller) => controller.trigger,
|
|
24
|
+
panel: (controller) => ({
|
|
25
|
+
mounted: controller.mounted,
|
|
26
|
+
part: controller.panel
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
export { tag };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=collapsible.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapsible.js","names":[],"sources":["../../../../packages/web/src/collapsible.ts"],"sourcesContent":["import { createCollapsible } from \"@kirana-ui/core/collapsible\"\n\nimport { defineElement } from \"./runtime.ts\"\n\n/**\n * `<kui-collapsible>` around `kui-part=\"root\"`, a `trigger` button and a `panel`, which is in\n * the page while it is open (`kui-keep-mounted` keeps it). `open`, `default-open`, `disabled`; it\n * tells `open-change`.\n */\nexport const tag = defineElement({\n tag: \"kui-collapsible\",\n props: { open: \"boolean\", \"default-open\": \"boolean\", disabled: \"boolean\" },\n create: createCollapsible,\n changes: { onOpenChange: { event: \"open-change\", prop: \"open\" } },\n parts: {\n root: (controller) => controller.root,\n trigger: (controller) => controller.trigger,\n panel: (controller) => ({ mounted: controller.mounted, part: controller.panel }),\n },\n})\n"],"mappings":";;;;;;;;AASA,MAAa,MAAM,cAAc;CAC/B,KAAK;CACL,OAAO;EAAE,MAAM;EAAW,gBAAgB;EAAW,UAAU;CAAU;CACzE,QAAQ;CACR,SAAS,EAAE,cAAc;EAAE,OAAO;EAAe,MAAM;CAAO,EAAE;CAChE,OAAO;EACL,OAAO,eAAe,WAAW;EACjC,UAAU,eAAe,WAAW;EACpC,QAAQ,gBAAgB;GAAE,SAAS,WAAW;GAAS,MAAM,WAAW;EAAM;CAChF;AACF,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Drawn, Each } from "./runtime.js";
|
|
2
|
+
import { Combobox } from "@kirana-ui/core/combobox";
|
|
3
|
+
type Parts = Record<string, (controller: Combobox<string>, element: HTMLElement) => Drawn["part"] | Drawn | undefined>;
|
|
4
|
+
/** A combobox's parts: an autocomplete has them too. */
|
|
5
|
+
export declare const PARTS: Parts;
|
|
6
|
+
/** With `multiple`: a chip for each chosen value, from a `<template kui-each="chips">`. */
|
|
7
|
+
export declare const LISTS: {
|
|
8
|
+
chips: (controller: Combobox<string>) => Each<{
|
|
9
|
+
value: string;
|
|
10
|
+
}>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* `<kui-combobox>` around an `input`, with a `trigger` and a `clear` button if it has them,
|
|
14
|
+
* and a `portal` with a `positioner` around the `popup`, which holds an `item` for each
|
|
15
|
+
* `kui-value` (`kui-disabled`, `kui-label`, `kui-id`) with an `item-indicator`, in `group`s
|
|
16
|
+
* with a `group-label` and `separator`s if it has them, and an `empty` part drawn while
|
|
17
|
+
* nothing matches. With `multiple`, the input is in a `chips` part with a
|
|
18
|
+
* `<template kui-each="chips">` holding a `chip` (`{value}`) and its `chip-remove` button.
|
|
19
|
+
* With a name it draws the hidden input a form reads. `value`,
|
|
20
|
+
* `default-value`, `input-value`, `default-input-value`, `open`, `default-open`, `disabled`,
|
|
21
|
+
* `required`, `inline`, `multiple`, `values` and `default-values` (with commas between),
|
|
22
|
+
* `name`, `form`; `items` and `filter` as properties; it tells `value-change`,
|
|
23
|
+
* `values-change`, `input-value-change` and `open-change`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const tag: string;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=combobox.d.ts.map
|
package/src/combobox.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { MARK, fieldAround, itemOptions, list, once, place, valueOf } from "./around.js";
|
|
2
|
+
import { defineElement, entryAround, partAround } from "./runtime.js";
|
|
3
|
+
import { computed } from "@kirana-ui/core";
|
|
4
|
+
import { createCombobox } from "@kirana-ui/core/combobox";
|
|
5
|
+
// src/combobox.ts
|
|
6
|
+
const groups = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
let made = 0;
|
|
8
|
+
const groupOf = (controller, element) => once(groups, element, (group) => controller.group(group.getAttribute("kui-id") ?? `kui-combobox-group-${++made}`));
|
|
9
|
+
/** A combobox's parts: an autocomplete has them too. */
|
|
10
|
+
const PARTS = {
|
|
11
|
+
input: (controller) => controller.input,
|
|
12
|
+
trigger: (controller) => controller.trigger,
|
|
13
|
+
clear: (controller) => ({
|
|
14
|
+
part: controller.clear,
|
|
15
|
+
mounted: controller.clearable
|
|
16
|
+
}),
|
|
17
|
+
positioner(controller, element) {
|
|
18
|
+
place(controller.positioning, element);
|
|
19
|
+
return {
|
|
20
|
+
mounted: controller.mounted,
|
|
21
|
+
part: controller.positioner
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
popup: (controller) => controller.popup,
|
|
25
|
+
empty: (controller) => ({
|
|
26
|
+
part: controller.emptyPart,
|
|
27
|
+
mounted: controller.empty
|
|
28
|
+
}),
|
|
29
|
+
group: (controller, element) => groupOf(controller, element)?.root,
|
|
30
|
+
"group-label": (controller, element) => groups.get(partAround(element, "group"))?.label ?? controller.groupLabel,
|
|
31
|
+
separator: (controller) => controller.separator,
|
|
32
|
+
item(controller, element) {
|
|
33
|
+
const id = element.getAttribute("kui-id") ?? `kui-combobox-item-${++made}`;
|
|
34
|
+
return controller.item(valueOf(element), () => ({
|
|
35
|
+
...itemOptions(element)(),
|
|
36
|
+
id
|
|
37
|
+
}), groupOf(controller, element.parentElement && partAround(element.parentElement, "group")));
|
|
38
|
+
},
|
|
39
|
+
chips: (controller) => controller.chips,
|
|
40
|
+
chip(controller, element) {
|
|
41
|
+
const value = entryAround(element)?.value;
|
|
42
|
+
return value === void 0 ? void 0 : controller.chip(value);
|
|
43
|
+
},
|
|
44
|
+
"chip-remove"(controller, element) {
|
|
45
|
+
const value = entryAround(element)?.value;
|
|
46
|
+
return value === void 0 ? void 0 : controller.chipRemove(value);
|
|
47
|
+
},
|
|
48
|
+
"item-indicator": (controller, element) => ({
|
|
49
|
+
part: MARK,
|
|
50
|
+
mounted: controller.selected(valueOf(partAround(element, "item")))
|
|
51
|
+
})
|
|
52
|
+
};
|
|
53
|
+
/** With `multiple`: a chip for each chosen value, from a `<template kui-each="chips">`. */
|
|
54
|
+
const LISTS = { chips: (controller) => ({
|
|
55
|
+
entries: computed(() => controller.values.get().map((value) => ({ value }))),
|
|
56
|
+
key: (chip) => chip.value
|
|
57
|
+
}) };
|
|
58
|
+
/**
|
|
59
|
+
* `<kui-combobox>` around an `input`, with a `trigger` and a `clear` button if it has them,
|
|
60
|
+
* and a `portal` with a `positioner` around the `popup`, which holds an `item` for each
|
|
61
|
+
* `kui-value` (`kui-disabled`, `kui-label`, `kui-id`) with an `item-indicator`, in `group`s
|
|
62
|
+
* with a `group-label` and `separator`s if it has them, and an `empty` part drawn while
|
|
63
|
+
* nothing matches. With `multiple`, the input is in a `chips` part with a
|
|
64
|
+
* `<template kui-each="chips">` holding a `chip` (`{value}`) and its `chip-remove` button.
|
|
65
|
+
* With a name it draws the hidden input a form reads. `value`,
|
|
66
|
+
* `default-value`, `input-value`, `default-input-value`, `open`, `default-open`, `disabled`,
|
|
67
|
+
* `required`, `inline`, `multiple`, `values` and `default-values` (with commas between),
|
|
68
|
+
* `name`, `form`; `items` and `filter` as properties; it tells `value-change`,
|
|
69
|
+
* `values-change`, `input-value-change` and `open-change`.
|
|
70
|
+
*/
|
|
71
|
+
const tag = defineElement({
|
|
72
|
+
tag: "kui-combobox",
|
|
73
|
+
props: {
|
|
74
|
+
value: "string",
|
|
75
|
+
"default-value": "string",
|
|
76
|
+
"input-value": "string",
|
|
77
|
+
"default-input-value": "string",
|
|
78
|
+
open: "boolean",
|
|
79
|
+
"default-open": "boolean",
|
|
80
|
+
disabled: "boolean",
|
|
81
|
+
required: "boolean",
|
|
82
|
+
inline: "boolean",
|
|
83
|
+
multiple: "boolean",
|
|
84
|
+
values: "string",
|
|
85
|
+
"default-values": "string",
|
|
86
|
+
name: "string",
|
|
87
|
+
form: "string"
|
|
88
|
+
},
|
|
89
|
+
properties: ["items", "filter"],
|
|
90
|
+
create: (props, host) => createCombobox(computed(() => {
|
|
91
|
+
const own = props.get();
|
|
92
|
+
return {
|
|
93
|
+
...own,
|
|
94
|
+
values: list(own.values),
|
|
95
|
+
defaultValues: list(own.defaultValues)
|
|
96
|
+
};
|
|
97
|
+
}), { field: fieldAround(host) }),
|
|
98
|
+
lists: LISTS,
|
|
99
|
+
inner: (controller) => ({
|
|
100
|
+
part: controller.hidden,
|
|
101
|
+
mounted: controller.named
|
|
102
|
+
}),
|
|
103
|
+
changes: {
|
|
104
|
+
onValueChange: {
|
|
105
|
+
event: "value-change",
|
|
106
|
+
prop: "value"
|
|
107
|
+
},
|
|
108
|
+
onValuesChange: {
|
|
109
|
+
event: "values-change",
|
|
110
|
+
prop: "values"
|
|
111
|
+
},
|
|
112
|
+
onInputValueChange: {
|
|
113
|
+
event: "input-value-change",
|
|
114
|
+
prop: "inputValue"
|
|
115
|
+
},
|
|
116
|
+
onOpenChange: {
|
|
117
|
+
event: "open-change",
|
|
118
|
+
prop: "open"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
parts: PARTS
|
|
122
|
+
});
|
|
123
|
+
export { LISTS, PARTS, tag };
|
|
124
|
+
|
|
125
|
+
//# sourceMappingURL=combobox.js.map
|
|
@@ -0,0 +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, place, valueOf } from \"./around.ts\"\nimport { defineElement, entryAround, partAround } from \"./runtime.ts\"\nimport type { Drawn, Each } 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(controller, element) {\n place(controller.positioning, element)\n return { mounted: controller.mounted, part: controller.positioner }\n },\n popup: (controller) => controller.popup,\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` around 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. 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`, `multiple`, `values` and `default-values` (with 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 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"],"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,WAAW,YAAY,SAAS;EAC9B,MAAM,WAAW,aAAa,OAAO;EACrC,OAAO;GAAE,SAAS,WAAW;GAAS,MAAM,WAAW;EAAW;CACpE;CACA,QAAQ,eAAe,WAAW;CAClC,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;;;;;;;;;;;;;;AAeA,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,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
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<kui-command>` around `kui-part="root"`, an `input` and a `list` of `item`s (`kui-value`,
|
|
3
|
+
* `kui-disabled`, `kui-label`, `kui-keywords` with commas between, `kui-id`), in `group`s
|
|
4
|
+
* with a `group-heading` and `separator`s (`kui-always-render`) if it has them, and an
|
|
5
|
+
* `empty` part drawn while nothing matches. What is typed filters the list; Enter or a press
|
|
6
|
+
* runs an item. `input-value`, `default-input-value`, `loop`, `disabled`; `filter` as a
|
|
7
|
+
* property; it tells `input-value-change` and `select`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const tag: string;
|
|
10
|
+
//# sourceMappingURL=command.d.ts.map
|
package/src/command.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { list, once, valueOf } from "./around.js";
|
|
2
|
+
import { defineElement, partAround } from "./runtime.js";
|
|
3
|
+
import { createCommand } from "@kirana-ui/core/command";
|
|
4
|
+
// src/command.ts
|
|
5
|
+
const groups = /* @__PURE__ */ new WeakMap();
|
|
6
|
+
let made = 0;
|
|
7
|
+
const groupOf = (controller, element) => once(groups, element, (group) => controller.group(group.getAttribute("kui-id") ?? `kui-command-group-${++made}`));
|
|
8
|
+
/**
|
|
9
|
+
* `<kui-command>` around `kui-part="root"`, an `input` and a `list` of `item`s (`kui-value`,
|
|
10
|
+
* `kui-disabled`, `kui-label`, `kui-keywords` with commas between, `kui-id`), in `group`s
|
|
11
|
+
* with a `group-heading` and `separator`s (`kui-always-render`) if it has them, and an
|
|
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
|
|
14
|
+
* property; it tells `input-value-change` and `select`.
|
|
15
|
+
*/
|
|
16
|
+
const tag = defineElement({
|
|
17
|
+
tag: "kui-command",
|
|
18
|
+
props: {
|
|
19
|
+
"input-value": "string",
|
|
20
|
+
"default-input-value": "string",
|
|
21
|
+
loop: "boolean",
|
|
22
|
+
disabled: "boolean"
|
|
23
|
+
},
|
|
24
|
+
properties: ["filter"],
|
|
25
|
+
create: (props) => createCommand(props),
|
|
26
|
+
changes: {
|
|
27
|
+
onInputValueChange: {
|
|
28
|
+
event: "input-value-change",
|
|
29
|
+
prop: "inputValue"
|
|
30
|
+
},
|
|
31
|
+
onSelect: {
|
|
32
|
+
event: "select",
|
|
33
|
+
prop: "value",
|
|
34
|
+
hold: false
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
parts: {
|
|
38
|
+
root: (controller) => controller.root,
|
|
39
|
+
input: (controller) => controller.input,
|
|
40
|
+
list: (controller) => controller.list,
|
|
41
|
+
empty: (controller) => ({
|
|
42
|
+
part: controller.emptyPart,
|
|
43
|
+
mounted: controller.empty
|
|
44
|
+
}),
|
|
45
|
+
group: (controller, element) => groupOf(controller, element)?.part,
|
|
46
|
+
"group-heading": (controller, element) => groups.get(partAround(element, "group"))?.heading ?? controller.heading,
|
|
47
|
+
item(controller, element) {
|
|
48
|
+
const id = element.getAttribute("kui-id") ?? `kui-command-item-${++made}`;
|
|
49
|
+
return controller.item(valueOf(element), () => ({
|
|
50
|
+
id,
|
|
51
|
+
...element.hasAttribute("kui-disabled") ? { disabled: true } : {},
|
|
52
|
+
...element.hasAttribute("kui-label") ? { label: element.getAttribute("kui-label") } : {},
|
|
53
|
+
...element.hasAttribute("kui-keywords") ? { keywords: list(element.getAttribute("kui-keywords")) } : {}
|
|
54
|
+
}), groupOf(controller, element.parentElement && partAround(element.parentElement, "group")));
|
|
55
|
+
},
|
|
56
|
+
separator: (controller, element) => controller.separator(() => element.hasAttribute("kui-always-render"))
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
export { tag };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +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\"\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"],"mappings":";;;;AAMA,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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<kui-context-menu>`: a menu for an area of the page, opened at the pointer by a secondary
|
|
3
|
+
* press, or a long one on a touch screen. Its `kui-part="trigger"` is the area; the rest are a
|
|
4
|
+
* menu's parts.
|
|
5
|
+
*/
|
|
6
|
+
export declare const tag: string;
|
|
7
|
+
//# sourceMappingURL=context-menu.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defineMenu as menu } from "./menu.js";
|
|
2
|
+
// src/context-menu.ts
|
|
3
|
+
/**
|
|
4
|
+
* `<kui-context-menu>`: a menu for an area of the page, opened at the pointer by a secondary
|
|
5
|
+
* press, or a long one on a touch screen. Its `kui-part="trigger"` is the area; the rest are a
|
|
6
|
+
* menu's parts.
|
|
7
|
+
*/
|
|
8
|
+
const tag = menu("kui-context-menu", () => ({ context: true }), (controller) => controller.area);
|
|
9
|
+
export { tag };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=context-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-menu.js","names":["defineMenu"],"sources":["../../../../packages/web/src/context-menu.ts"],"sourcesContent":["import { defineMenu } from \"./menu.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"],"mappings":";;;;;;;AAOA,MAAa,MAAMA,KACjB,2BACO,EAAE,SAAS,KAAK,KACtB,eAAe,WAAW,IAC7B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<kui-date-field>` around `kui-part="root"`, which holds a `<template kui-each="segments">`
|
|
3
|
+
* with the `segment` each part of the date is typed in (`{type}` and `{index}` say which),
|
|
4
|
+
* and the hidden `input` a form reads. `value`, `default-value`, `locale`, `min`, `max`,
|
|
5
|
+
* `disabled`, `read-only`, `required`, `name`, `form`; `placeholders` as a property; it
|
|
6
|
+
* tells `value-change`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const tag: string;
|
|
9
|
+
//# sourceMappingURL=date-field.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { fieldParts } from "./dates.js";
|
|
2
|
+
import { defineElement } from "./runtime.js";
|
|
3
|
+
import { createDateField } from "@kirana-ui/core/date-field";
|
|
4
|
+
// src/date-field.ts
|
|
5
|
+
const { parts, lists } = fieldParts((controller) => controller);
|
|
6
|
+
/**
|
|
7
|
+
* `<kui-date-field>` around `kui-part="root"`, which holds a `<template kui-each="segments">`
|
|
8
|
+
* with the `segment` each part of the date is typed in (`{type}` and `{index}` say which),
|
|
9
|
+
* and the hidden `input` a form reads. `value`, `default-value`, `locale`, `min`, `max`,
|
|
10
|
+
* `disabled`, `read-only`, `required`, `name`, `form`; `placeholders` as a property; it
|
|
11
|
+
* tells `value-change`.
|
|
12
|
+
*/
|
|
13
|
+
const tag = defineElement({
|
|
14
|
+
tag: "kui-date-field",
|
|
15
|
+
props: {
|
|
16
|
+
value: "string",
|
|
17
|
+
"default-value": "string",
|
|
18
|
+
locale: "string",
|
|
19
|
+
min: "string",
|
|
20
|
+
max: "string",
|
|
21
|
+
disabled: "boolean",
|
|
22
|
+
"read-only": "boolean",
|
|
23
|
+
required: "boolean",
|
|
24
|
+
name: "string",
|
|
25
|
+
form: "string"
|
|
26
|
+
},
|
|
27
|
+
properties: ["placeholders"],
|
|
28
|
+
create: (props) => createDateField(props),
|
|
29
|
+
changes: { onValueChange: {
|
|
30
|
+
event: "value-change",
|
|
31
|
+
prop: "value"
|
|
32
|
+
} },
|
|
33
|
+
lists,
|
|
34
|
+
parts: {
|
|
35
|
+
root: (controller) => controller.root,
|
|
36
|
+
...parts
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
export { tag };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=date-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-field.js","names":[],"sources":["../../../../packages/web/src/date-field.ts"],"sourcesContent":["import { createDateField } from \"@kirana-ui/core/date-field\"\nimport type { DateField, DateFieldProps } from \"@kirana-ui/core/date-field\"\n\nimport { fieldParts } from \"./dates.ts\"\nimport { defineElement } from \"./runtime.ts\"\n\nconst { parts, lists } = fieldParts<DateField>((controller) => controller)\n\n/**\n * `<kui-date-field>` around `kui-part=\"root\"`, which holds a `<template kui-each=\"segments\">`\n * with the `segment` each part of the date is typed in (`{type}` and `{index}` say which),\n * and the hidden `input` a form reads. `value`, `default-value`, `locale`, `min`, `max`,\n * `disabled`, `read-only`, `required`, `name`, `form`; `placeholders` as a property; it\n * tells `value-change`.\n */\nexport const tag = defineElement<DateFieldProps, DateField>({\n tag: \"kui-date-field\",\n props: {\n value: \"string\",\n \"default-value\": \"string\",\n locale: \"string\",\n min: \"string\",\n max: \"string\",\n disabled: \"boolean\",\n \"read-only\": \"boolean\",\n required: \"boolean\",\n name: \"string\",\n form: \"string\",\n },\n properties: [\"placeholders\"],\n create: (props) => createDateField(props),\n changes: { onValueChange: { event: \"value-change\", prop: \"value\" } },\n lists,\n parts: { root: (controller) => controller.root, ...parts },\n})\n"],"mappings":";;;;AAMA,MAAM,EAAE,OAAO,UAAU,YAAuB,eAAe,UAAU;;;;;;;;AASzE,MAAa,MAAM,cAAyC;CAC1D,KAAK;CACL,OAAO;EACL,OAAO;EACP,iBAAiB;EACjB,QAAQ;EACR,KAAK;EACL,KAAK;EACL,UAAU;EACV,aAAa;EACb,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,YAAY,CAAC,cAAc;CAC3B,SAAS,UAAU,gBAAgB,KAAK;CACxC,SAAS,EAAE,eAAe;EAAE,OAAO;EAAgB,MAAM;CAAQ,EAAE;CACnE;CACA,OAAO;EAAE,OAAO,eAAe,WAAW;EAAM,GAAG;CAAM;AAC3D,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<kui-date-picker>`: a date field and a calendar in a popover that are one value. A
|
|
3
|
+
* `kui-part="field"` with a date field's `segments` template and `input`; a `trigger`
|
|
4
|
+
* button; and a `portal` with a `positioner` around the `popup`, which holds the `calendar`
|
|
5
|
+
* with a calendar's parts and templates. `value`, `default-value`, `open`, `default-open`,
|
|
6
|
+
* `locale`, `min`, `max`, `calendar-system`, `fixed-weeks`, `disabled`, `read-only`,
|
|
7
|
+
* `required`, `name`, `form`; `isDateUnavailable` and `placeholders` as properties; it tells
|
|
8
|
+
* `value-change` and `open-change`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const tag: string;
|
|
11
|
+
//# sourceMappingURL=date-picker.d.ts.map
|