@kirana-ui/react 0.3.0 → 0.4.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/CHANGELOG.md +140 -0
- package/llms.txt +1507 -121
- package/package.json +44 -3
- package/skills/kirana-ui-primitives/SKILL.md +24 -4
- package/src/accordion.d.ts +2 -2
- package/src/accordion.js +3 -2
- package/src/accordion.js.map +1 -1
- package/src/autosize.d.ts +1 -1
- package/src/avatar.d.ts +2 -2
- package/src/avatar.js +3 -3
- package/src/avatar.js.map +1 -1
- package/src/button.d.ts +5 -2
- package/src/button.js +4 -1
- package/src/button.js.map +1 -1
- package/src/calendar.d.ts +6 -6
- package/src/calendar.js +13 -5
- package/src/calendar.js.map +1 -1
- package/src/carousel.d.ts +6 -3
- package/src/carousel.js +1 -1
- package/src/carousel.js.map +1 -1
- package/src/checkbox-group.d.ts +2 -1
- package/src/checkbox-group.js +1 -1
- package/src/checkbox-group.js.map +1 -1
- package/src/checkbox.d.ts +6 -1
- package/src/checkbox.js +1 -1
- package/src/checkbox.js.map +1 -1
- package/src/collapsible.d.ts +1 -1
- package/src/color-picker.d.ts +61 -0
- package/src/color-picker.js +119 -0
- package/src/color-picker.js.map +1 -0
- package/src/combobox.d.ts +13 -4
- package/src/combobox.js +13 -5
- package/src/combobox.js.map +1 -1
- package/src/command.d.ts +3 -3
- package/src/command.js.map +1 -1
- package/src/date-field.d.ts +2 -2
- package/src/date-field.js +3 -2
- package/src/date-field.js.map +1 -1
- package/src/date-picker.d.ts +29 -8
- package/src/date-picker.js +21 -5
- package/src/date-picker.js.map +1 -1
- package/src/dialog.d.ts +6 -6
- package/src/dialog.js +22 -7
- package/src/dialog.js.map +1 -1
- package/src/direction.d.ts +1 -1
- package/src/direction.js +1 -1
- package/src/editable.d.ts +32 -0
- package/src/editable.js +63 -0
- package/src/editable.js.map +1 -0
- package/src/field.d.ts +1 -1
- package/src/fieldset.d.ts +1 -1
- package/src/file-upload.d.ts +54 -0
- package/src/file-upload.js +96 -0
- package/src/file-upload.js.map +1 -0
- package/src/form.d.ts +1 -1
- package/src/hover-popup.d.ts +1 -1
- package/src/hover-popup.js +1 -1
- package/src/index.d.ts +26 -8
- package/src/index.js +11 -1
- package/src/input.d.ts +1 -1
- package/src/input.js +1 -1
- package/src/label.d.ts +1 -1
- package/src/listbox.d.ts +1 -1
- package/src/listbox.js +1 -1
- package/src/menu.d.ts +5 -5
- package/src/menu.js +14 -9
- package/src/menu.js.map +1 -1
- package/src/menubar.d.ts +2 -2
- package/src/menubar.js +4 -2
- package/src/menubar.js.map +1 -1
- package/src/message-scroller.d.ts +1 -1
- package/src/navigation-menu.d.ts +5 -5
- package/src/navigation-menu.js +14 -4
- package/src/navigation-menu.js.map +1 -1
- package/src/number-field.d.ts +2 -1
- package/src/number-field.js +1 -1
- package/src/number-field.js.map +1 -1
- package/src/otp.d.ts +3 -2
- package/src/otp.js +9 -2
- package/src/otp.js.map +1 -1
- package/src/pagination.d.ts +1 -1
- package/src/password-input.d.ts +23 -0
- package/src/password-input.js +40 -0
- package/src/password-input.js.map +1 -0
- package/src/popover.d.ts +1 -1
- package/src/popover.js +1 -1
- package/src/qr-code.d.ts +1 -1
- package/src/radio-group.d.ts +1 -1
- package/src/radio-group.js +1 -1
- package/src/rating.d.ts +28 -0
- package/src/rating.js +59 -0
- package/src/rating.js.map +1 -0
- package/src/resizable.d.ts +1 -1
- package/src/resizable.js +1 -1
- package/src/runtime.d.ts +10 -3
- package/src/runtime.js +18 -4
- package/src/runtime.js.map +1 -1
- package/src/scroll-area.d.ts +1 -1
- package/src/scroll-area.js +1 -1
- package/src/select.d.ts +17 -6
- package/src/select.js +6 -3
- package/src/select.js.map +1 -1
- package/src/separator.d.ts +1 -1
- package/src/slider.d.ts +1 -1
- package/src/slider.js +1 -1
- package/src/steps.d.ts +51 -0
- package/src/steps.js +69 -0
- package/src/steps.js.map +1 -0
- package/src/switch.d.ts +2 -1
- package/src/switch.js +1 -1
- package/src/switch.js.map +1 -1
- package/src/tabs.d.ts +2 -2
- package/src/tabs.js +4 -3
- package/src/tabs.js.map +1 -1
- package/src/tags-input.d.ts +47 -0
- package/src/tags-input.js +92 -0
- package/src/tags-input.js.map +1 -0
- package/src/time-field.d.ts +32 -0
- package/src/time-field.js +67 -0
- package/src/time-field.js.map +1 -0
- package/src/toast.d.ts +1 -1
- package/src/toggle-group.d.ts +2 -2
- package/src/toggle-group.js +4 -3
- package/src/toggle-group.js.map +1 -1
- package/src/toggle.d.ts +1 -1
- package/src/toggle.js +1 -1
- package/src/toolbar.d.ts +14 -6
- package/src/toolbar.js +19 -9
- package/src/toolbar.js.map +1 -1
- package/src/tour.d.ts +61 -0
- package/src/tour.js +68 -0
- package/src/tour.js.map +1 -0
- package/src/tree.d.ts +45 -0
- package/src/tree.js +93 -0
- package/src/tree.js.map +1 -0
- package/src/use-render.js +1 -1
- package/src/value-bar.d.ts +1 -1
package/src/date-picker.js
CHANGED
|
@@ -3,10 +3,10 @@ import { DateField, DateFieldContext as Context$2 } from "./date-field.js";
|
|
|
3
3
|
import { DirectionContext } from "./direction-context.js";
|
|
4
4
|
import { Popover, PopoverContext as Context$3 } from "./popover.js";
|
|
5
5
|
import { parts, useController, usePart } from "./runtime.js";
|
|
6
|
-
import { within } from "@kirana-ui/core";
|
|
7
|
-
import { createDatePicker } from "@kirana-ui/core/date-picker";
|
|
8
6
|
import { createContext, useContext } from "react";
|
|
7
|
+
import { within } from "@kirana-ui/core";
|
|
9
8
|
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
import { createDatePicker } from "@kirana-ui/core/date-picker";
|
|
10
10
|
// src/date-picker.tsx
|
|
11
11
|
const Context = createContext(null);
|
|
12
12
|
function useDatePicker(part) {
|
|
@@ -32,10 +32,24 @@ function Root({ children, ...props }) {
|
|
|
32
32
|
})
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
/**
|
|
36
|
-
|
|
35
|
+
/**
|
|
36
|
+
* The typed date: what holds its segments and its hidden input. With `mode="range"` there are
|
|
37
|
+
* two, `range="start"` and `range="end"`, each giving its own parts their field.
|
|
38
|
+
*/
|
|
39
|
+
function Field({ range, ...props }) {
|
|
40
|
+
const picker = useDatePicker("Field");
|
|
41
|
+
const field = range === "end" && picker.endField || picker.field;
|
|
42
|
+
return /* @__PURE__ */ jsx(Context$2.Provider, {
|
|
43
|
+
value: field,
|
|
44
|
+
children: usePart(field.root, "div", props)
|
|
45
|
+
});
|
|
46
|
+
}
|
|
37
47
|
/** The calendar: what holds its heading, its buttons and its grid. */
|
|
38
48
|
const CalendarRoot = (props) => usePart(useDatePicker("Calendar").calendar.root, "div", props);
|
|
49
|
+
/** Empties the value, and gives focus to the field. Disabled while there is none. */
|
|
50
|
+
const Clear = (props) => usePart(useDatePicker("Clear").clear, "button", props);
|
|
51
|
+
/** Makes the value the one it is given: pressed while it is. */
|
|
52
|
+
const Preset = ({ value, ...props }) => usePart(useDatePicker("Preset").preset(value), "button", props);
|
|
39
53
|
const DatePicker = /* @__PURE__ */ parts("DatePicker", {
|
|
40
54
|
Root,
|
|
41
55
|
Field,
|
|
@@ -56,7 +70,9 @@ const DatePicker = /* @__PURE__ */ parts("DatePicker", {
|
|
|
56
70
|
HeadCell: Calendar.HeadCell,
|
|
57
71
|
Weeks: Calendar.Weeks,
|
|
58
72
|
Cell: Calendar.Cell,
|
|
59
|
-
Day: Calendar.Day
|
|
73
|
+
Day: Calendar.Day,
|
|
74
|
+
Clear,
|
|
75
|
+
Preset
|
|
60
76
|
});
|
|
61
77
|
export { DatePicker };
|
|
62
78
|
|
package/src/date-picker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.js","names":["DateFieldContext","PopoverContext","CalendarContext"],"sources":["../../../../packages/react/src/date-picker.tsx"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { StateOf } from \"@kirana-ui/core\"\nimport { createDatePicker } from \"@kirana-ui/core/date-picker\"\nimport type {
|
|
1
|
+
{"version":3,"file":"date-picker.js","names":["DateFieldContext","PopoverContext","CalendarContext"],"sources":["../../../../packages/react/src/date-picker.tsx"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { StateOf } from \"@kirana-ui/core\"\nimport { createDatePicker } from \"@kirana-ui/core/date-picker\"\nimport type {\n DatePicker as Controller,\n DatePickerMode,\n DatePickerProps,\n DatePickerRange,\n} from \"@kirana-ui/core/date-picker\"\nimport type { Vocabulary } from \"@kirana-ui/core/vocabulary\"\nimport { createContext, useContext } from \"react\"\nimport type { ReactElement, ReactNode } from \"react\"\n\nimport { Calendar, CalendarContext } from \"./calendar.tsx\"\nimport { DateField, DateFieldContext } from \"./date-field.tsx\"\nimport { DirectionContext } from \"./direction-context.ts\"\nimport { Popover, PopoverContext } from \"./popover.tsx\"\nimport { parts, useController, usePart } from \"./runtime.tsx\"\nimport type { PartComponentProps } from \"./runtime.tsx\"\n\nexport type {\n CellProps,\n DayProps,\n GridProps,\n HeadCellProps,\n HeadingProps,\n MonthsProps,\n NextProps,\n PreviousProps,\n WeekdaysProps,\n WeeksProps,\n} from \"./calendar.tsx\"\nexport type { InputProps, SegmentProps, SegmentsProps } from \"./date-field.tsx\"\nexport type { PopupProps, PortalProps, PositionerProps, TriggerProps } from \"./popover.tsx\"\n\ntype Parts = Vocabulary[\"datePicker\"]\n\nconst Context = createContext<Controller | null>(null)\n\nfunction useDatePicker(part: string): Controller {\n const controller = useContext(Context)\n if (!controller) throw new Error(`<DatePicker.${part}> must be inside <DatePicker.Root>`)\n return controller\n}\n\n/** `value` and `onValueChange` are typed by `mode`: a day, or a range. */\nexport type RootProps<Mode extends DatePickerMode = \"single\"> = Omit<\n DatePickerProps<Mode>,\n \"id\"\n> & { id?: string; children?: ReactNode }\n\n/** A date field, and a calendar in a popover, with one value between them. It draws nothing. */\nfunction Root<Mode extends DatePickerMode = \"single\">({\n children,\n ...props\n}: RootProps<Mode>): ReactElement {\n const direction = useContext(DirectionContext) ?? undefined\n // The core holds either mode's value; the caller's is its mode's.\n const controller = useController<DatePickerProps, Controller>(\n within(createDatePicker, { direction }),\n props as Omit<DatePickerProps, \"id\"> & { id?: string }\n )\n return (\n <Context.Provider value={controller}>\n <DateFieldContext.Provider value={controller.field}>\n <PopoverContext.Provider value={controller.popover}>\n <CalendarContext.Provider value={controller.calendar}>\n {children}\n </CalendarContext.Provider>\n </PopoverContext.Provider>\n </DateFieldContext.Provider>\n </Context.Provider>\n )\n}\n\nexport type FieldProps = PartComponentProps<\n \"div\",\n StateOf<Parts[\"field\"]>,\n {\n /**\n * With `mode=\"range\"`: which day of the range it is typed in, the first (`\"start\"`, the\n * default) or the last (`\"end\"`).\n */\n range?: \"start\" | \"end\" | undefined\n }\n>\nexport type CalendarProps = PartComponentProps<\"div\", StateOf<Parts[\"calendar\"]>>\nexport type ClearProps = PartComponentProps<\"button\", StateOf<Parts[\"clear\"]>>\nexport type PresetProps = PartComponentProps<\n \"button\",\n StateOf<Parts[\"preset\"]>,\n {\n /** The value its press gives: a day, or with `mode=\"range\"` a range. */\n value: string | DatePickerRange\n }\n>\n\n/**\n * The typed date: what holds its segments and its hidden input. With `mode=\"range\"` there are\n * two, `range=\"start\"` and `range=\"end\"`, each giving its own parts their field.\n */\nfunction Field({ range, ...props }: FieldProps): ReactElement {\n const picker = useDatePicker(\"Field\")\n const field = (range === \"end\" && picker.endField) || picker.field\n return (\n <DateFieldContext.Provider value={field}>\n {usePart(field.root, \"div\", props)}\n </DateFieldContext.Provider>\n )\n}\n/** The calendar: what holds its heading, its buttons and its grid. */\nconst CalendarRoot = (props: CalendarProps) =>\n usePart(useDatePicker(\"Calendar\").calendar.root, \"div\", props)\n\n/** Empties the value, and gives focus to the field. Disabled while there is none. */\nconst Clear = (props: ClearProps) => usePart(useDatePicker(\"Clear\").clear, \"button\", props)\n/** Makes the value the one it is given: pressed while it is. */\nconst Preset = ({ value, ...props }: PresetProps) =>\n usePart(useDatePicker(\"Preset\").preset(value), \"button\", props)\n\nexport const DatePicker = /* @__PURE__ */ parts(\"DatePicker\", {\n Root,\n Field,\n Segments: DateField.Segments,\n Segment: DateField.Segment,\n Input: DateField.Input,\n Trigger: Popover.Trigger,\n Portal: Popover.Portal,\n Positioner: Popover.Positioner,\n Popup: Popover.Popup,\n Calendar: CalendarRoot,\n Heading: Calendar.Heading,\n Previous: Calendar.Previous,\n Next: Calendar.Next,\n Months: Calendar.Months,\n Grid: Calendar.Grid,\n Weekdays: Calendar.Weekdays,\n HeadCell: Calendar.HeadCell,\n Weeks: Calendar.Weeks,\n Cell: Calendar.Cell,\n Day: Calendar.Day,\n Clear,\n Preset,\n})\n"],"mappings":";;;;;;;;;;AAqCA,MAAM,UAAU,cAAiC,IAAI;AAErD,SAAS,cAAc,MAA0B;CAC/C,MAAM,aAAa,WAAW,OAAO;CACrC,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,eAAe,KAAK,mCAAmC;CACxF,OAAO;AACT;;AASA,SAAS,KAA6C,EACpD,UACA,GAAG,SAC6B;CAChC,MAAM,YAAY,WAAW,gBAAgB,KAAK,KAAA;CAElD,MAAM,aAAa,cACjB,OAAO,kBAAkB,EAAE,UAAU,CAAC,GACtC,KACF;CACA,OACE,oBAAC,QAAQ,UAAT;EAAkB,OAAO;EACvB,UAAA,oBAACA,UAAiB,UAAlB;GAA2B,OAAO,WAAW;GAC3C,UAAA,oBAACC,UAAe,UAAhB;IAAyB,OAAO,WAAW;IACzC,UAAA,oBAACC,UAAgB,UAAjB;KAA0B,OAAO,WAAW;KACzC;IACuB,CAAA;GACH,CAAA;EACA,CAAA;CACX,CAAA;AAEtB;;;;;AA4BA,SAAS,MAAM,EAAE,OAAO,GAAG,SAAmC;CAC5D,MAAM,SAAS,cAAc,OAAO;CACpC,MAAM,QAAS,UAAU,SAAS,OAAO,YAAa,OAAO;CAC7D,OACE,oBAACF,UAAiB,UAAlB;EAA2B,OAAO;EAC/B,UAAA,QAAQ,MAAM,MAAM,OAAO,KAAK;CACR,CAAA;AAE/B;;AAEA,MAAM,gBAAgB,UACpB,QAAQ,cAAc,UAAU,CAAC,CAAC,SAAS,MAAM,OAAO,KAAK;;AAG/D,MAAM,SAAS,UAAsB,QAAQ,cAAc,OAAO,CAAC,CAAC,OAAO,UAAU,KAAK;;AAE1F,MAAM,UAAU,EAAE,OAAO,GAAG,YAC1B,QAAQ,cAAc,QAAQ,CAAC,CAAC,OAAO,KAAK,GAAG,UAAU,KAAK;AAEhE,MAAa,aAA6B,sBAAM,cAAc;CAC5D;CACA;CACA,UAAU,UAAU;CACpB,SAAS,UAAU;CACnB,OAAO,UAAU;CACjB,SAAS,QAAQ;CACjB,QAAQ,QAAQ;CAChB,YAAY,QAAQ;CACpB,OAAO,QAAQ;CACf,UAAU;CACV,SAAS,SAAS;CAClB,UAAU,SAAS;CACnB,MAAM,SAAS;CACf,QAAQ,SAAS;CACjB,MAAM,SAAS;CACf,UAAU,SAAS;CACnB,UAAU,SAAS;CACnB,OAAO,SAAS;CAChB,MAAM,SAAS;CACf,KAAK,SAAS;CACd;CACA;AACF,CAAC"}
|
package/src/dialog.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PartComponentProps, PortalProps } from "./runtime.js";
|
|
2
|
-
import { StateOf } from "@kirana-ui/core";
|
|
3
2
|
import { ReactElement, ReactNode } from "react";
|
|
3
|
+
import { StateOf } from "@kirana-ui/core";
|
|
4
4
|
import { AlertDialogProps } from "@kirana-ui/core/alert-dialog";
|
|
5
|
-
import { DialogProps } from "@kirana-ui/core/dialog";
|
|
5
|
+
import { DialogButtonOptions, DialogProps } from "@kirana-ui/core/dialog";
|
|
6
6
|
import { DrawerProps } from "@kirana-ui/core/drawer";
|
|
7
7
|
import { Vocabulary } from "@kirana-ui/core/vocabulary";
|
|
8
8
|
type Parts = Vocabulary["dialog"];
|
|
@@ -12,21 +12,21 @@ export type RootProps = Omit<DialogProps, "id"> & {
|
|
|
12
12
|
};
|
|
13
13
|
declare function Root({ children, ...props }: RootProps): ReactElement;
|
|
14
14
|
declare function Portal({ children }: PortalProps): ReactElement | null;
|
|
15
|
-
export type TriggerProps = PartComponentProps<"button", StateOf<Parts["trigger"]
|
|
15
|
+
export type TriggerProps = PartComponentProps<"button", StateOf<Parts["trigger"]>, DialogButtonOptions>;
|
|
16
16
|
export type BackdropProps = PartComponentProps<"div", StateOf<Parts["backdrop"]>>;
|
|
17
17
|
export type ViewportProps = PartComponentProps<"div", StateOf<Parts["viewport"]>>;
|
|
18
18
|
export type PopupProps = PartComponentProps<"div", StateOf<Parts["popup"]>>;
|
|
19
19
|
export type TitleProps = PartComponentProps<"h2", StateOf<Parts["title"]>>;
|
|
20
20
|
export type DescriptionProps = PartComponentProps<"p", StateOf<Parts["description"]>>;
|
|
21
|
-
export type CloseProps = PartComponentProps<"button", StateOf<Parts["close"]
|
|
22
|
-
declare
|
|
21
|
+
export type CloseProps = PartComponentProps<"button", StateOf<Parts["close"]>, DialogButtonOptions>;
|
|
22
|
+
declare function Trigger({ disabled, ...props }: TriggerProps): ReactElement;
|
|
23
23
|
declare const Backdrop: (props: BackdropProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
24
24
|
/** What a long dialog scrolls in, around its popup: it may be left out. */
|
|
25
25
|
declare const Viewport: (props: ViewportProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
26
26
|
declare const Popup: (props: PopupProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
27
27
|
declare const Title: (props: TitleProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
28
28
|
declare const Description: (props: DescriptionProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
29
|
-
declare
|
|
29
|
+
declare function Close({ disabled, ...props }: CloseProps): ReactElement;
|
|
30
30
|
export declare const Dialog: {
|
|
31
31
|
readonly Root: typeof Root;
|
|
32
32
|
readonly Trigger: typeof Trigger;
|
package/src/dialog.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { DirectionContext } from "./direction-context.js";
|
|
2
|
+
import { Portal as Portal$1, parts, useController, useOptions, usePart, useSignal } from "./runtime.js";
|
|
3
|
+
import { createContext, useContext, useMemo } from "react";
|
|
4
|
+
import { within } from "@kirana-ui/core";
|
|
3
5
|
import { jsx } from "react/jsx-runtime";
|
|
4
6
|
import { createAlertDialog } from "@kirana-ui/core/alert-dialog";
|
|
5
7
|
import { createDialog } from "@kirana-ui/core/dialog";
|
|
@@ -12,7 +14,8 @@ function useDialog(part) {
|
|
|
12
14
|
return controller;
|
|
13
15
|
}
|
|
14
16
|
function Root({ children, ...props }) {
|
|
15
|
-
const
|
|
17
|
+
const direction = useContext(DirectionContext) ?? void 0;
|
|
18
|
+
const controller = useController(within(createDialog, { direction }), props);
|
|
16
19
|
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
17
20
|
value: controller,
|
|
18
21
|
children
|
|
@@ -21,14 +24,24 @@ function Root({ children, ...props }) {
|
|
|
21
24
|
function Portal({ children }) {
|
|
22
25
|
return useSignal(useDialog("Portal").mounted) ? /* @__PURE__ */ jsx(Portal$1, { children }) : null;
|
|
23
26
|
}
|
|
24
|
-
|
|
27
|
+
function Trigger({ disabled, ...props }) {
|
|
28
|
+
const controller = useDialog("Trigger");
|
|
29
|
+
const options = useOptions({ disabled });
|
|
30
|
+
const part = useMemo(() => controller.triggerPart(() => options.get()), [controller, options]);
|
|
31
|
+
return usePart(part, "button", props);
|
|
32
|
+
}
|
|
25
33
|
const Backdrop = (props) => usePart(useDialog("Backdrop").backdrop, "div", props);
|
|
26
34
|
/** What a long dialog scrolls in, around its popup: it may be left out. */
|
|
27
35
|
const Viewport = (props) => usePart(useDialog("Viewport").viewport, "div", props);
|
|
28
36
|
const Popup = (props) => usePart(useDialog("Popup").popup, "div", props);
|
|
29
37
|
const Title = (props) => usePart(useDialog("Title").title, "h2", props);
|
|
30
38
|
const Description = (props) => usePart(useDialog("Description").description, "p", props);
|
|
31
|
-
|
|
39
|
+
function Close({ disabled, ...props }) {
|
|
40
|
+
const controller = useDialog("Close");
|
|
41
|
+
const options = useOptions({ disabled });
|
|
42
|
+
const part = useMemo(() => controller.closePart(() => options.get()), [controller, options]);
|
|
43
|
+
return usePart(part, "button", props);
|
|
44
|
+
}
|
|
32
45
|
const Dialog = /* @__PURE__ */ parts("Dialog", {
|
|
33
46
|
Root,
|
|
34
47
|
Trigger,
|
|
@@ -41,7 +54,8 @@ const Dialog = /* @__PURE__ */ parts("Dialog", {
|
|
|
41
54
|
Close
|
|
42
55
|
});
|
|
43
56
|
function AlertRoot({ children, ...props }) {
|
|
44
|
-
const
|
|
57
|
+
const direction = useContext(DirectionContext) ?? void 0;
|
|
58
|
+
const controller = useController(within(createAlertDialog, { direction }), props);
|
|
45
59
|
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
46
60
|
value: controller,
|
|
47
61
|
children
|
|
@@ -53,7 +67,8 @@ const AlertDialog = /* @__PURE__ */ parts("AlertDialog", {
|
|
|
53
67
|
Root: AlertRoot
|
|
54
68
|
});
|
|
55
69
|
function DrawerRoot({ children, ...props }) {
|
|
56
|
-
const
|
|
70
|
+
const direction = useContext(DirectionContext) ?? void 0;
|
|
71
|
+
const controller = useController(within(createDrawer, { direction }), props);
|
|
57
72
|
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
58
73
|
value: controller,
|
|
59
74
|
children
|
package/src/dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","names":["BodyPortal"],"sources":["../../../../packages/react/src/dialog.tsx"],"sourcesContent":["import type { StateOf } from \"@kirana-ui/core\"\nimport { createAlertDialog } from \"@kirana-ui/core/alert-dialog\"\nimport type { AlertDialogProps } from \"@kirana-ui/core/alert-dialog\"\nimport { createDialog } from \"@kirana-ui/core/dialog\"\nimport { createDrawer } from \"@kirana-ui/core/drawer\"\nimport type { DrawerProps } from \"@kirana-ui/core/drawer\"\nimport type { Dialog as Controller, DialogProps } from \"@kirana-ui/core/dialog\"\nimport type { Vocabulary } from \"@kirana-ui/core/vocabulary\"\nimport { createContext, useContext } from \"react\"\nimport type { ReactElement, ReactNode } from \"react\"\n\nimport { Portal as BodyPortal
|
|
1
|
+
{"version":3,"file":"dialog.js","names":["BodyPortal"],"sources":["../../../../packages/react/src/dialog.tsx"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { StateOf } from \"@kirana-ui/core\"\nimport { createAlertDialog } from \"@kirana-ui/core/alert-dialog\"\nimport type { AlertDialogProps } from \"@kirana-ui/core/alert-dialog\"\nimport { createDialog } from \"@kirana-ui/core/dialog\"\nimport { createDrawer } from \"@kirana-ui/core/drawer\"\nimport type { DrawerProps } from \"@kirana-ui/core/drawer\"\nimport type { Dialog as Controller, DialogButtonOptions, DialogProps } from \"@kirana-ui/core/dialog\"\nimport type { Vocabulary } from \"@kirana-ui/core/vocabulary\"\nimport { createContext, useContext, useMemo } from \"react\"\nimport type { ReactElement, ReactNode } from \"react\"\n\nimport { DirectionContext } from \"./direction-context.ts\"\nimport {\n Portal as BodyPortal,\n parts,\n useController,\n useOptions,\n usePart,\n useSignal,\n} from \"./runtime.tsx\"\nimport type { PartComponentProps, PortalProps } from \"./runtime.tsx\"\n\nexport type { PortalProps }\n\ntype Parts = Vocabulary[\"dialog\"]\n\nconst Context = createContext<Controller | null>(null)\n\nfunction useDialog(part: string): Controller {\n const controller = useContext(Context)\n if (!controller) throw new Error(`<Dialog.${part}> must be inside <Dialog.Root>`)\n return controller\n}\n\nexport type RootProps = Omit<DialogProps, \"id\"> & { id?: string; children?: ReactNode }\n\nfunction Root({ children, ...props }: RootProps): ReactElement {\n const direction = useContext(DirectionContext) ?? undefined\n const controller = useController(within(createDialog, { direction }), props)\n return <Context.Provider value={controller}>{children}</Context.Provider>\n}\n\nfunction Portal({ children }: PortalProps): ReactElement | null {\n const mounted = useSignal(useDialog(\"Portal\").mounted)\n return mounted ? <BodyPortal>{children}</BodyPortal> : null\n}\n\nexport type TriggerProps = PartComponentProps<\n \"button\",\n StateOf<Parts[\"trigger\"]>,\n DialogButtonOptions\n>\nexport type BackdropProps = PartComponentProps<\"div\", StateOf<Parts[\"backdrop\"]>>\nexport type ViewportProps = PartComponentProps<\"div\", StateOf<Parts[\"viewport\"]>>\nexport type PopupProps = PartComponentProps<\"div\", StateOf<Parts[\"popup\"]>>\nexport type TitleProps = PartComponentProps<\"h2\", StateOf<Parts[\"title\"]>>\nexport type DescriptionProps = PartComponentProps<\"p\", StateOf<Parts[\"description\"]>>\nexport type CloseProps = PartComponentProps<\"button\", StateOf<Parts[\"close\"]>, DialogButtonOptions>\n\nfunction Trigger({ disabled, ...props }: TriggerProps): ReactElement {\n const controller = useDialog(\"Trigger\")\n const options = useOptions({ disabled })\n const part = useMemo(() => controller.triggerPart(() => options.get()), [controller, options])\n return usePart(part, \"button\", props)\n}\nconst Backdrop = (props: BackdropProps) => usePart(useDialog(\"Backdrop\").backdrop, \"div\", props)\n/** What a long dialog scrolls in, around its popup: it may be left out. */\nconst Viewport = (props: ViewportProps) => usePart(useDialog(\"Viewport\").viewport, \"div\", props)\nconst Popup = (props: PopupProps) => usePart(useDialog(\"Popup\").popup, \"div\", props)\nconst Title = (props: TitleProps) => usePart(useDialog(\"Title\").title, \"h2\", props)\nconst Description = (props: DescriptionProps) =>\n usePart(useDialog(\"Description\").description, \"p\", props)\nfunction Close({ disabled, ...props }: CloseProps): ReactElement {\n const controller = useDialog(\"Close\")\n const options = useOptions({ disabled })\n const part = useMemo(() => controller.closePart(() => options.get()), [controller, options])\n return usePart(part, \"button\", props)\n}\n\nexport const Dialog = /* @__PURE__ */ parts(\"Dialog\", {\n Root,\n Trigger,\n Portal,\n Backdrop,\n Viewport,\n Popup,\n Title,\n Description,\n Close,\n})\n\nexport type AlertRootProps = Omit<AlertDialogProps, \"id\"> & { id?: string; children?: ReactNode }\n\nfunction AlertRoot({ children, ...props }: AlertRootProps): ReactElement {\n const direction = useContext(DirectionContext) ?? undefined\n const controller = useController(within(createAlertDialog, { direction }), props)\n return <Context.Provider value={controller}>{children}</Context.Provider>\n}\n\n/** A dialog that asks for an answer: a press outside it does not close it. Its parts are a dialog's. */\nexport const AlertDialog = /* @__PURE__ */ parts(\"AlertDialog\", { ...Dialog, Root: AlertRoot })\n\nexport type DrawerRootProps = Omit<DrawerProps, \"id\"> & { id?: string; children?: ReactNode }\n\nfunction DrawerRoot({ children, ...props }: DrawerRootProps): ReactElement {\n const direction = useContext(DirectionContext) ?? undefined\n const controller = useController(within(createDrawer, { direction }), props)\n return <Context.Provider value={controller}>{children}</Context.Provider>\n}\n\ntype DrawerParts = Vocabulary[\"drawer\"]\n\nexport type DrawerBackdropProps = PartComponentProps<\"div\", StateOf<DrawerParts[\"backdrop\"]>>\nexport type DrawerPopupProps = PartComponentProps<\"div\", StateOf<DrawerParts[\"popup\"]>>\n\n// A dialog's, which a drawer's controller gives more to say: how far it has been dragged.\nconst DrawerBackdrop: (props: DrawerBackdropProps) => ReactElement = Dialog.Backdrop\nconst DrawerPopup: (props: DrawerPopupProps) => ReactElement = Dialog.Popup\n\n// A drawer has no viewport: it lies at an edge of the page, and what scrolls is inside it.\nconst { Viewport: _, ...shared } = Dialog\n\n/** A dialog that comes from an edge and is dragged back to it. Its parts are a dialog's. */\nexport const Drawer = /* @__PURE__ */ parts(\"Drawer\", {\n ...shared,\n Root: DrawerRoot,\n Backdrop: DrawerBackdrop,\n Popup: DrawerPopup,\n})\n"],"mappings":";;;;;;;;;AA2BA,MAAM,UAAU,cAAiC,IAAI;AAErD,SAAS,UAAU,MAA0B;CAC3C,MAAM,aAAa,WAAW,OAAO;CACrC,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,WAAW,KAAK,+BAA+B;CAChF,OAAO;AACT;AAIA,SAAS,KAAK,EAAE,UAAU,GAAG,SAAkC;CAC7D,MAAM,YAAY,WAAW,gBAAgB,KAAK,KAAA;CAClD,MAAM,aAAa,cAAc,OAAO,cAAc,EAAE,UAAU,CAAC,GAAG,KAAK;CAC3E,OAAO,oBAAC,QAAQ,UAAT;EAAkB,OAAO;EAAa;CAA2B,CAAA;AAC1E;AAEA,SAAS,OAAO,EAAE,YAA8C;CAE9D,OADgB,UAAU,UAAU,QAAQ,CAAC,CAAC,OACjC,IAAI,oBAACA,UAAD,EAAa,SAAqB,CAAA,IAAI;AACzD;AAcA,SAAS,QAAQ,EAAE,UAAU,GAAG,SAAqC;CACnE,MAAM,aAAa,UAAU,SAAS;CACtC,MAAM,UAAU,WAAW,EAAE,SAAS,CAAC;CACvC,MAAM,OAAO,cAAc,WAAW,kBAAkB,QAAQ,IAAI,CAAC,GAAG,CAAC,YAAY,OAAO,CAAC;CAC7F,OAAO,QAAQ,MAAM,UAAU,KAAK;AACtC;AACA,MAAM,YAAY,UAAyB,QAAQ,UAAU,UAAU,CAAC,CAAC,UAAU,OAAO,KAAK;;AAE/F,MAAM,YAAY,UAAyB,QAAQ,UAAU,UAAU,CAAC,CAAC,UAAU,OAAO,KAAK;AAC/F,MAAM,SAAS,UAAsB,QAAQ,UAAU,OAAO,CAAC,CAAC,OAAO,OAAO,KAAK;AACnF,MAAM,SAAS,UAAsB,QAAQ,UAAU,OAAO,CAAC,CAAC,OAAO,MAAM,KAAK;AAClF,MAAM,eAAe,UACnB,QAAQ,UAAU,aAAa,CAAC,CAAC,aAAa,KAAK,KAAK;AAC1D,SAAS,MAAM,EAAE,UAAU,GAAG,SAAmC;CAC/D,MAAM,aAAa,UAAU,OAAO;CACpC,MAAM,UAAU,WAAW,EAAE,SAAS,CAAC;CACvC,MAAM,OAAO,cAAc,WAAW,gBAAgB,QAAQ,IAAI,CAAC,GAAG,CAAC,YAAY,OAAO,CAAC;CAC3F,OAAO,QAAQ,MAAM,UAAU,KAAK;AACtC;AAEA,MAAa,SAAyB,sBAAM,UAAU;CACpD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAID,SAAS,UAAU,EAAE,UAAU,GAAG,SAAuC;CACvE,MAAM,YAAY,WAAW,gBAAgB,KAAK,KAAA;CAClD,MAAM,aAAa,cAAc,OAAO,mBAAmB,EAAE,UAAU,CAAC,GAAG,KAAK;CAChF,OAAO,oBAAC,QAAQ,UAAT;EAAkB,OAAO;EAAa;CAA2B,CAAA;AAC1E;;AAGA,MAAa,cAA8B,sBAAM,eAAe;CAAE,GAAG;CAAQ,MAAM;AAAU,CAAC;AAI9F,SAAS,WAAW,EAAE,UAAU,GAAG,SAAwC;CACzE,MAAM,YAAY,WAAW,gBAAgB,KAAK,KAAA;CAClD,MAAM,aAAa,cAAc,OAAO,cAAc,EAAE,UAAU,CAAC,GAAG,KAAK;CAC3E,OAAO,oBAAC,QAAQ,UAAT;EAAkB,OAAO;EAAa;CAA2B,CAAA;AAC1E;AAQA,MAAM,iBAA+D,OAAO;AAC5E,MAAM,cAAyD,OAAO;AAGtE,MAAM,EAAE,UAAU,GAAG,GAAG,WAAW;;AAGnC,MAAa,SAAyB,sBAAM,UAAU;CACpD,GAAG;CACH,MAAM;CACN,UAAU;CACV,OAAO;AACT,CAAC"}
|
package/src/direction.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Direction } from "@kirana-ui/core";
|
|
2
1
|
import { ReactElement, ReactNode } from "react";
|
|
2
|
+
import { Direction } from "@kirana-ui/core";
|
|
3
3
|
/** What `DirectionProvider` takes. */
|
|
4
4
|
export interface DirectionProviderProps {
|
|
5
5
|
/** The reading direction of what is inside. `ltr` when left out. */
|
package/src/direction.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DirectionContext } from "./direction-context.js";
|
|
2
2
|
import { useController, useSignal } from "./runtime.js";
|
|
3
|
-
import { signal } from "@kirana-ui/core";
|
|
4
3
|
import { useContext, useState } from "react";
|
|
4
|
+
import { signal } from "@kirana-ui/core";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { createDirection } from "@kirana-ui/core/direction";
|
|
7
7
|
// src/direction.tsx
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { PartComponentProps } from "./runtime.js";
|
|
2
|
+
import { ReactElement } from "react";
|
|
3
|
+
import { StateOf } from "@kirana-ui/core";
|
|
4
|
+
import { EditableProps } from "@kirana-ui/core/editable";
|
|
5
|
+
import { Vocabulary } from "@kirana-ui/core/vocabulary";
|
|
6
|
+
type Parts = Vocabulary["editable"];
|
|
7
|
+
export type RootProps = PartComponentProps<"div", StateOf<Parts["root"]>, Omit<EditableProps, "id"> & {
|
|
8
|
+
id?: string;
|
|
9
|
+
}>;
|
|
10
|
+
declare function Root({ value, defaultValue, onValueChange, editing, defaultEditing, onEditingChange, placeholder, activation, submitOnBlur, selectOnFocus, disabled, readOnly, required, name, form, id, ...rest }: RootProps): ReactElement;
|
|
11
|
+
export type PreviewProps = PartComponentProps<"span", StateOf<Parts["preview"]>>;
|
|
12
|
+
/** Says the text, or the placeholder while there is none, unless it is given children. */
|
|
13
|
+
declare function Preview(props: PreviewProps): ReactElement;
|
|
14
|
+
export type InputProps = PartComponentProps<"input", StateOf<Parts["input"]>>;
|
|
15
|
+
/** An `<input>`; a `<textarea>` through `render`. */
|
|
16
|
+
declare const Input: (props: InputProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
17
|
+
export type EditTriggerProps = PartComponentProps<"button", StateOf<Parts["editTrigger"]>>;
|
|
18
|
+
declare const EditTrigger: (props: EditTriggerProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
19
|
+
export type SubmitTriggerProps = PartComponentProps<"button", StateOf<Parts["submitTrigger"]>>;
|
|
20
|
+
declare const SubmitTrigger: (props: SubmitTriggerProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
21
|
+
export type CancelTriggerProps = PartComponentProps<"button", StateOf<Parts["cancelTrigger"]>>;
|
|
22
|
+
declare const CancelTrigger: (props: CancelTriggerProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
23
|
+
export declare const Editable: {
|
|
24
|
+
readonly Root: typeof Root;
|
|
25
|
+
readonly Preview: typeof Preview;
|
|
26
|
+
readonly Input: typeof Input;
|
|
27
|
+
readonly EditTrigger: typeof EditTrigger;
|
|
28
|
+
readonly SubmitTrigger: typeof SubmitTrigger;
|
|
29
|
+
readonly CancelTrigger: typeof CancelTrigger;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=editable.d.ts.map
|
package/src/editable.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { FieldContext } from "./field-context.js";
|
|
2
|
+
import { parts, useController, useOwnText, usePart, useSignal } from "./runtime.js";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
import { within } from "@kirana-ui/core";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { createEditable } from "@kirana-ui/core/editable";
|
|
7
|
+
// src/editable.tsx
|
|
8
|
+
const Context = createContext(null);
|
|
9
|
+
function useEditable(part) {
|
|
10
|
+
const controller = useContext(Context);
|
|
11
|
+
if (!controller) throw new Error(`<Editable.${part}> must be inside <Editable.Root>`);
|
|
12
|
+
return controller;
|
|
13
|
+
}
|
|
14
|
+
function Root({ value, defaultValue, onValueChange, editing, defaultEditing, onEditingChange, placeholder, activation, submitOnBlur, selectOnFocus, disabled, readOnly, required, name, form, id, ...rest }) {
|
|
15
|
+
const field = useContext(FieldContext) ?? void 0;
|
|
16
|
+
const controller = useController(within(createEditable, { field }), {
|
|
17
|
+
value,
|
|
18
|
+
defaultValue,
|
|
19
|
+
onValueChange,
|
|
20
|
+
editing,
|
|
21
|
+
defaultEditing,
|
|
22
|
+
onEditingChange,
|
|
23
|
+
placeholder,
|
|
24
|
+
activation,
|
|
25
|
+
submitOnBlur,
|
|
26
|
+
selectOnFocus,
|
|
27
|
+
disabled,
|
|
28
|
+
readOnly,
|
|
29
|
+
required,
|
|
30
|
+
name,
|
|
31
|
+
form,
|
|
32
|
+
id
|
|
33
|
+
});
|
|
34
|
+
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
35
|
+
value: controller,
|
|
36
|
+
children: usePart(controller.root, "div", rest)
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/** Says the text, or the placeholder while there is none, unless it is given children. */
|
|
40
|
+
function Preview(props) {
|
|
41
|
+
const controller = useEditable("Preview");
|
|
42
|
+
const text = useSignal(controller.text);
|
|
43
|
+
return usePart(controller.preview, "span", {
|
|
44
|
+
...props,
|
|
45
|
+
children: props.children ?? text
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/** An `<input>`; a `<textarea>` through `render`. */
|
|
49
|
+
const Input = (props) => usePart(useOwnText(useEditable("Input").input), "input", props);
|
|
50
|
+
const EditTrigger = (props) => usePart(useEditable("EditTrigger").editTrigger, "button", props);
|
|
51
|
+
const SubmitTrigger = (props) => usePart(useEditable("SubmitTrigger").submitTrigger, "button", props);
|
|
52
|
+
const CancelTrigger = (props) => usePart(useEditable("CancelTrigger").cancelTrigger, "button", props);
|
|
53
|
+
const Editable = /* @__PURE__ */ parts("Editable", {
|
|
54
|
+
Root,
|
|
55
|
+
Preview,
|
|
56
|
+
Input,
|
|
57
|
+
EditTrigger,
|
|
58
|
+
SubmitTrigger,
|
|
59
|
+
CancelTrigger
|
|
60
|
+
});
|
|
61
|
+
export { Editable };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=editable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editable.js","names":[],"sources":["../../../../packages/react/src/editable.tsx"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { StateOf } from \"@kirana-ui/core\"\nimport { createEditable } from \"@kirana-ui/core/editable\"\nimport type { Editable as Controller, EditableProps } from \"@kirana-ui/core/editable\"\nimport type { Vocabulary } from \"@kirana-ui/core/vocabulary\"\nimport { createContext, useContext } from \"react\"\nimport type { ReactElement } from \"react\"\n\nimport { FieldContext } from \"./field-context.ts\"\nimport { parts, useController, useOwnText, usePart, useSignal } from \"./runtime.tsx\"\nimport type { PartComponentProps } from \"./runtime.tsx\"\n\ntype Parts = Vocabulary[\"editable\"]\n\nconst Context = createContext<Controller | null>(null)\n\nfunction useEditable(part: string): Controller {\n const controller = useContext(Context)\n if (!controller) throw new Error(`<Editable.${part}> must be inside <Editable.Root>`)\n return controller\n}\n\nexport type RootProps = PartComponentProps<\n \"div\",\n StateOf<Parts[\"root\"]>,\n Omit<EditableProps, \"id\"> & { id?: string }\n>\n\nfunction Root({\n value,\n defaultValue,\n onValueChange,\n editing,\n defaultEditing,\n onEditingChange,\n placeholder,\n activation,\n submitOnBlur,\n selectOnFocus,\n disabled,\n readOnly,\n required,\n name,\n form,\n id,\n ...rest\n}: RootProps): ReactElement {\n const field = useContext(FieldContext) ?? undefined\n const controller = useController<EditableProps, Controller>(within(createEditable, { field }), {\n value,\n defaultValue,\n onValueChange,\n editing,\n defaultEditing,\n onEditingChange,\n placeholder,\n activation,\n submitOnBlur,\n selectOnFocus,\n disabled,\n readOnly,\n required,\n name,\n form,\n id,\n })\n return (\n <Context.Provider value={controller}>{usePart(controller.root, \"div\", rest)}</Context.Provider>\n )\n}\n\nexport type PreviewProps = PartComponentProps<\"span\", StateOf<Parts[\"preview\"]>>\n\n/** Says the text, or the placeholder while there is none, unless it is given children. */\nfunction Preview(props: PreviewProps): ReactElement {\n const controller = useEditable(\"Preview\")\n const text = useSignal(controller.text)\n return usePart(controller.preview, \"span\", { ...props, children: props.children ?? text })\n}\n\nexport type InputProps = PartComponentProps<\"input\", StateOf<Parts[\"input\"]>>\n\n/** An `<input>`; a `<textarea>` through `render`. */\nconst Input = (props: InputProps) => usePart(useOwnText(useEditable(\"Input\").input), \"input\", props)\n\nexport type EditTriggerProps = PartComponentProps<\"button\", StateOf<Parts[\"editTrigger\"]>>\n\nconst EditTrigger = (props: EditTriggerProps) =>\n usePart(useEditable(\"EditTrigger\").editTrigger, \"button\", props)\n\nexport type SubmitTriggerProps = PartComponentProps<\"button\", StateOf<Parts[\"submitTrigger\"]>>\n\nconst SubmitTrigger = (props: SubmitTriggerProps) =>\n usePart(useEditable(\"SubmitTrigger\").submitTrigger, \"button\", props)\n\nexport type CancelTriggerProps = PartComponentProps<\"button\", StateOf<Parts[\"cancelTrigger\"]>>\n\nconst CancelTrigger = (props: CancelTriggerProps) =>\n usePart(useEditable(\"CancelTrigger\").cancelTrigger, \"button\", props)\n\nexport const Editable = /* @__PURE__ */ parts(\"Editable\", {\n Root,\n Preview,\n Input,\n EditTrigger,\n SubmitTrigger,\n CancelTrigger,\n})\n"],"mappings":";;;;;;;AAcA,MAAM,UAAU,cAAiC,IAAI;AAErD,SAAS,YAAY,MAA0B;CAC7C,MAAM,aAAa,WAAW,OAAO;CACrC,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,aAAa,KAAK,iCAAiC;CACpF,OAAO;AACT;AAQA,SAAS,KAAK,EACZ,OACA,cACA,eACA,SACA,gBACA,iBACA,aACA,YACA,cACA,eACA,UACA,UACA,UACA,MACA,MACA,IACA,GAAG,QACuB;CAC1B,MAAM,QAAQ,WAAW,YAAY,KAAK,KAAA;CAC1C,MAAM,aAAa,cAAyC,OAAO,gBAAgB,EAAE,MAAM,CAAC,GAAG;EAC7F;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,OACE,oBAAC,QAAQ,UAAT;EAAkB,OAAO;EAAa,UAAA,QAAQ,WAAW,MAAM,OAAO,IAAI;CAAoB,CAAA;AAElG;;AAKA,SAAS,QAAQ,OAAmC;CAClD,MAAM,aAAa,YAAY,SAAS;CACxC,MAAM,OAAO,UAAU,WAAW,IAAI;CACtC,OAAO,QAAQ,WAAW,SAAS,QAAQ;EAAE,GAAG;EAAO,UAAU,MAAM,YAAY;CAAK,CAAC;AAC3F;;AAKA,MAAM,SAAS,UAAsB,QAAQ,WAAW,YAAY,OAAO,CAAC,CAAC,KAAK,GAAG,SAAS,KAAK;AAInG,MAAM,eAAe,UACnB,QAAQ,YAAY,aAAa,CAAC,CAAC,aAAa,UAAU,KAAK;AAIjE,MAAM,iBAAiB,UACrB,QAAQ,YAAY,eAAe,CAAC,CAAC,eAAe,UAAU,KAAK;AAIrE,MAAM,iBAAiB,UACrB,QAAQ,YAAY,eAAe,CAAC,CAAC,eAAe,UAAU,KAAK;AAErE,MAAa,WAA2B,sBAAM,YAAY;CACxD;CACA;CACA;CACA;CACA;CACA;AACF,CAAC"}
|
package/src/field.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PartComponentProps } from "./runtime.js";
|
|
2
|
-
import { StateOf } from "@kirana-ui/core";
|
|
3
2
|
import { ReactElement, ReactNode } from "react";
|
|
3
|
+
import { StateOf } from "@kirana-ui/core";
|
|
4
4
|
import { FieldProps, FieldValidity, ValidityKey } from "@kirana-ui/core/field";
|
|
5
5
|
import { Vocabulary } from "@kirana-ui/core/vocabulary";
|
|
6
6
|
type Parts = Vocabulary["field"];
|
package/src/fieldset.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PartComponentProps } from "./runtime.js";
|
|
2
|
-
import { StateOf } from "@kirana-ui/core";
|
|
3
2
|
import { ReactElement } from "react";
|
|
3
|
+
import { StateOf } from "@kirana-ui/core";
|
|
4
4
|
import { Fieldset as Fieldset$1, FieldsetProps } from "@kirana-ui/core/fieldset";
|
|
5
5
|
import { Vocabulary } from "@kirana-ui/core/vocabulary";
|
|
6
6
|
type Parts = Vocabulary["fieldset"];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { PartComponentProps } from "./runtime.js";
|
|
2
|
+
import { ReactElement, ReactNode } from "react";
|
|
3
|
+
import { StateOf } from "@kirana-ui/core";
|
|
4
|
+
import { FileUploadEntry, FileUploadProps } from "@kirana-ui/core/file-upload";
|
|
5
|
+
import { Vocabulary } from "@kirana-ui/core/vocabulary";
|
|
6
|
+
type Parts = Vocabulary["fileUpload"];
|
|
7
|
+
export type RootProps = PartComponentProps<"div", StateOf<Parts["root"]>, Omit<FileUploadProps, "id"> & {
|
|
8
|
+
id?: string;
|
|
9
|
+
}>;
|
|
10
|
+
declare function Root({ files, defaultFiles, onFilesChange, onFilesReject, accept, multiple, maxFiles, maxSize, minSize, validate, disabled, required, name, form, id, ...rest }: RootProps): ReactElement;
|
|
11
|
+
export type DropzoneProps = PartComponentProps<"div", StateOf<Parts["dropzone"]>>;
|
|
12
|
+
declare function Dropzone(props: DropzoneProps): ReactElement;
|
|
13
|
+
export type TriggerProps = PartComponentProps<"button", StateOf<Parts["trigger"]>>;
|
|
14
|
+
declare const Trigger: (props: TriggerProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
15
|
+
export type ListProps = PartComponentProps<"ul", StateOf<Parts["list"]>>;
|
|
16
|
+
declare const List: (props: ListProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
17
|
+
export interface ItemsProps {
|
|
18
|
+
/** Draws one file, once for each. */
|
|
19
|
+
children: (entry: FileUploadEntry) => ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/** Draws its child once for each file, kept by the file's key. */
|
|
22
|
+
declare function Items({ children }: ItemsProps): ReactElement;
|
|
23
|
+
export type ItemProps = PartComponentProps<"li", StateOf<Parts["item"]>, {
|
|
24
|
+
/** The file it is, as `Items` gave it. */
|
|
25
|
+
entry: FileUploadEntry;
|
|
26
|
+
}>;
|
|
27
|
+
declare function Item({ entry, ...props }: ItemProps): ReactElement;
|
|
28
|
+
export type ItemNameProps = PartComponentProps<"span", StateOf<Parts["itemName"]>>;
|
|
29
|
+
/** Says the file's name unless it is given children. */
|
|
30
|
+
declare function ItemName(props: ItemNameProps): ReactElement;
|
|
31
|
+
export type ItemSizeProps = PartComponentProps<"span", StateOf<Parts["itemSize"]>, {
|
|
32
|
+
/** The language the number is written in. Default: the reader's. */
|
|
33
|
+
locale?: string;
|
|
34
|
+
}>;
|
|
35
|
+
/** Says the file's size as people read one unless it is given children. */
|
|
36
|
+
declare function ItemSize({ locale, ...props }: ItemSizeProps): ReactElement;
|
|
37
|
+
export type ItemRemoveProps = PartComponentProps<"button", StateOf<Parts["itemRemove"]>>;
|
|
38
|
+
declare const ItemRemove: (props: ItemRemoveProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
39
|
+
export type ClearProps = PartComponentProps<"button", StateOf<Parts["clear"]>>;
|
|
40
|
+
declare const Clear: (props: ClearProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
41
|
+
export declare const FileUpload: {
|
|
42
|
+
readonly Root: typeof Root;
|
|
43
|
+
readonly Dropzone: typeof Dropzone;
|
|
44
|
+
readonly Trigger: typeof Trigger;
|
|
45
|
+
readonly List: typeof List;
|
|
46
|
+
readonly Items: typeof Items;
|
|
47
|
+
readonly Item: typeof Item;
|
|
48
|
+
readonly ItemName: typeof ItemName;
|
|
49
|
+
readonly ItemSize: typeof ItemSize;
|
|
50
|
+
readonly ItemRemove: typeof ItemRemove;
|
|
51
|
+
readonly Clear: typeof Clear;
|
|
52
|
+
};
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=file-upload.d.ts.map
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { FieldContext } from "./field-context.js";
|
|
2
|
+
import { PartElement, parts, useController, usePart, useSignal } from "./runtime.js";
|
|
3
|
+
import { Fragment, createContext, useContext } from "react";
|
|
4
|
+
import { within } from "@kirana-ui/core";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { createFileUpload, formatBytes } from "@kirana-ui/core/file-upload";
|
|
7
|
+
// src/file-upload.tsx
|
|
8
|
+
const Context = createContext(null);
|
|
9
|
+
const ItemContext = createContext(null);
|
|
10
|
+
function useFileUpload(part) {
|
|
11
|
+
const controller = useContext(Context);
|
|
12
|
+
if (!controller) throw new Error(`<FileUpload.${part}> must be inside <FileUpload.Root>`);
|
|
13
|
+
return controller;
|
|
14
|
+
}
|
|
15
|
+
function useEntry(part) {
|
|
16
|
+
const entry = useContext(ItemContext);
|
|
17
|
+
if (!entry) throw new Error(`<FileUpload.${part}> must be inside <FileUpload.Item>`);
|
|
18
|
+
return entry;
|
|
19
|
+
}
|
|
20
|
+
function Root({ files, defaultFiles, onFilesChange, onFilesReject, accept, multiple, maxFiles, maxSize, minSize, validate, disabled, required, name, form, id, ...rest }) {
|
|
21
|
+
const field = useContext(FieldContext) ?? void 0;
|
|
22
|
+
const controller = useController(within(createFileUpload, { field }), {
|
|
23
|
+
files,
|
|
24
|
+
defaultFiles,
|
|
25
|
+
onFilesChange,
|
|
26
|
+
onFilesReject,
|
|
27
|
+
accept,
|
|
28
|
+
multiple,
|
|
29
|
+
maxFiles,
|
|
30
|
+
maxSize,
|
|
31
|
+
minSize,
|
|
32
|
+
validate,
|
|
33
|
+
disabled,
|
|
34
|
+
required,
|
|
35
|
+
name,
|
|
36
|
+
form,
|
|
37
|
+
id
|
|
38
|
+
});
|
|
39
|
+
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
40
|
+
value: controller,
|
|
41
|
+
children: usePart(controller.root, "div", rest)
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function Dropzone(props) {
|
|
45
|
+
const controller = useFileUpload("Dropzone");
|
|
46
|
+
return usePart(controller.dropzone, "div", props, void 0, (content) => /* @__PURE__ */ jsxs(Fragment$1, { children: [content, /* @__PURE__ */ jsx(PartElement, {
|
|
47
|
+
of: controller.input,
|
|
48
|
+
tag: "input"
|
|
49
|
+
})] }));
|
|
50
|
+
}
|
|
51
|
+
const Trigger = (props) => usePart(useFileUpload("Trigger").trigger, "button", props);
|
|
52
|
+
const List = (props) => usePart(useFileUpload("List").list, "ul", props);
|
|
53
|
+
/** Draws its child once for each file, kept by the file's key. */
|
|
54
|
+
function Items({ children }) {
|
|
55
|
+
const entries = useSignal(useFileUpload("Items").entries);
|
|
56
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: entries.map((entry) => /* @__PURE__ */ jsx(Fragment, { children: children(entry) }, entry.key)) });
|
|
57
|
+
}
|
|
58
|
+
function Item({ entry, ...props }) {
|
|
59
|
+
return /* @__PURE__ */ jsx(ItemContext.Provider, {
|
|
60
|
+
value: entry,
|
|
61
|
+
children: usePart(useFileUpload("Item").item(entry.key), "li", props)
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/** Says the file's name unless it is given children. */
|
|
65
|
+
function ItemName(props) {
|
|
66
|
+
const entry = useEntry("ItemName");
|
|
67
|
+
return usePart(useFileUpload("ItemName").itemName(entry.key), "span", {
|
|
68
|
+
...props,
|
|
69
|
+
children: props.children ?? entry.file.name
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/** Says the file's size as people read one unless it is given children. */
|
|
73
|
+
function ItemSize({ locale, ...props }) {
|
|
74
|
+
const entry = useEntry("ItemSize");
|
|
75
|
+
return usePart(useFileUpload("ItemSize").itemSize(entry.key), "span", {
|
|
76
|
+
...props,
|
|
77
|
+
children: props.children ?? formatBytes(entry.file.size, locale)
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const ItemRemove = (props) => usePart(useFileUpload("ItemRemove").itemRemove(useEntry("ItemRemove").key), "button", props);
|
|
81
|
+
const Clear = (props) => usePart(useFileUpload("Clear").clear, "button", props);
|
|
82
|
+
const FileUpload = /* @__PURE__ */ parts("FileUpload", {
|
|
83
|
+
Root,
|
|
84
|
+
Dropzone,
|
|
85
|
+
Trigger,
|
|
86
|
+
List,
|
|
87
|
+
Items,
|
|
88
|
+
Item,
|
|
89
|
+
ItemName,
|
|
90
|
+
ItemSize,
|
|
91
|
+
ItemRemove,
|
|
92
|
+
Clear
|
|
93
|
+
});
|
|
94
|
+
export { FileUpload };
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=file-upload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload.js","names":[],"sources":["../../../../packages/react/src/file-upload.tsx"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { StateOf } from \"@kirana-ui/core\"\nimport { createFileUpload, formatBytes } from \"@kirana-ui/core/file-upload\"\nimport type {\n FileUpload as Controller,\n FileUploadEntry,\n FileUploadProps,\n} from \"@kirana-ui/core/file-upload\"\nimport type { Vocabulary } from \"@kirana-ui/core/vocabulary\"\nimport { Fragment, createContext, useContext } from \"react\"\nimport type { ReactElement, ReactNode } from \"react\"\n\nimport { FieldContext } from \"./field-context.ts\"\nimport { PartElement, parts, useController, usePart, useSignal } from \"./runtime.tsx\"\nimport type { PartComponentProps } from \"./runtime.tsx\"\n\ntype Parts = Vocabulary[\"fileUpload\"]\n\nconst Context = createContext<Controller | null>(null)\n// The file an item is, for the parts inside it.\nconst ItemContext = createContext<FileUploadEntry | null>(null)\n\nfunction useFileUpload(part: string): Controller {\n const controller = useContext(Context)\n if (!controller) throw new Error(`<FileUpload.${part}> must be inside <FileUpload.Root>`)\n return controller\n}\n\nfunction useEntry(part: string): FileUploadEntry {\n const entry = useContext(ItemContext)\n if (!entry) throw new Error(`<FileUpload.${part}> must be inside <FileUpload.Item>`)\n return entry\n}\n\nexport type RootProps = PartComponentProps<\n \"div\",\n StateOf<Parts[\"root\"]>,\n Omit<FileUploadProps, \"id\"> & { id?: string }\n>\n\nfunction Root({\n files,\n defaultFiles,\n onFilesChange,\n onFilesReject,\n accept,\n multiple,\n maxFiles,\n maxSize,\n minSize,\n validate,\n disabled,\n required,\n name,\n form,\n id,\n ...rest\n}: RootProps): ReactElement {\n const field = useContext(FieldContext) ?? undefined\n const controller = useController<FileUploadProps, Controller>(\n within(createFileUpload, { field }),\n {\n files,\n defaultFiles,\n onFilesChange,\n onFilesReject,\n accept,\n multiple,\n maxFiles,\n maxSize,\n minSize,\n validate,\n disabled,\n required,\n name,\n form,\n id,\n }\n )\n return (\n <Context.Provider value={controller}>{usePart(controller.root, \"div\", rest)}</Context.Provider>\n )\n}\n\nexport type DropzoneProps = PartComponentProps<\"div\", StateOf<Parts[\"dropzone\"]>>\n\nfunction Dropzone(props: DropzoneProps): ReactElement {\n const controller = useFileUpload(\"Dropzone\")\n return usePart(controller.dropzone, \"div\", props, undefined, (content) => (\n // The native file input is the element's last child, whatever element was asked for.\n <>\n {content}\n <PartElement of={controller.input} tag=\"input\" />\n </>\n ))\n}\n\nexport type TriggerProps = PartComponentProps<\"button\", StateOf<Parts[\"trigger\"]>>\n\nconst Trigger = (props: TriggerProps) => usePart(useFileUpload(\"Trigger\").trigger, \"button\", props)\n\nexport type ListProps = PartComponentProps<\"ul\", StateOf<Parts[\"list\"]>>\n\nconst List = (props: ListProps) => usePart(useFileUpload(\"List\").list, \"ul\", props)\n\nexport interface ItemsProps {\n /** Draws one file, once for each. */\n children: (entry: FileUploadEntry) => ReactNode\n}\n\n/** Draws its child once for each file, kept by the file's key. */\nfunction Items({ children }: ItemsProps): ReactElement {\n const entries = useSignal(useFileUpload(\"Items\").entries)\n return (\n <>\n {entries.map((entry) => (\n <Fragment key={entry.key}>{children(entry)}</Fragment>\n ))}\n </>\n )\n}\n\nexport type ItemProps = PartComponentProps<\n \"li\",\n StateOf<Parts[\"item\"]>,\n {\n /** The file it is, as `Items` gave it. */\n entry: FileUploadEntry\n }\n>\n\nfunction Item({ entry, ...props }: ItemProps): ReactElement {\n return (\n <ItemContext.Provider value={entry}>\n {usePart(useFileUpload(\"Item\").item(entry.key), \"li\", props)}\n </ItemContext.Provider>\n )\n}\n\nexport type ItemNameProps = PartComponentProps<\"span\", StateOf<Parts[\"itemName\"]>>\n\n/** Says the file's name unless it is given children. */\nfunction ItemName(props: ItemNameProps): ReactElement {\n const entry = useEntry(\"ItemName\")\n return usePart(useFileUpload(\"ItemName\").itemName(entry.key), \"span\", {\n ...props,\n children: props.children ?? entry.file.name,\n })\n}\n\nexport type ItemSizeProps = PartComponentProps<\n \"span\",\n StateOf<Parts[\"itemSize\"]>,\n {\n /** The language the number is written in. Default: the reader's. */\n locale?: string\n }\n>\n\n/** Says the file's size as people read one unless it is given children. */\nfunction ItemSize({ locale, ...props }: ItemSizeProps): ReactElement {\n const entry = useEntry(\"ItemSize\")\n return usePart(useFileUpload(\"ItemSize\").itemSize(entry.key), \"span\", {\n ...props,\n children: props.children ?? formatBytes(entry.file.size, locale),\n })\n}\n\nexport type ItemRemoveProps = PartComponentProps<\"button\", StateOf<Parts[\"itemRemove\"]>>\n\nconst ItemRemove = (props: ItemRemoveProps) =>\n usePart(useFileUpload(\"ItemRemove\").itemRemove(useEntry(\"ItemRemove\").key), \"button\", props)\n\nexport type ClearProps = PartComponentProps<\"button\", StateOf<Parts[\"clear\"]>>\n\nconst Clear = (props: ClearProps) => usePart(useFileUpload(\"Clear\").clear, \"button\", props)\n\nexport const FileUpload = /* @__PURE__ */ parts(\"FileUpload\", {\n Root,\n Dropzone,\n Trigger,\n List,\n Items,\n Item,\n ItemName,\n ItemSize,\n ItemRemove,\n Clear,\n})\n"],"mappings":";;;;;;;AAkBA,MAAM,UAAU,cAAiC,IAAI;AAErD,MAAM,cAAc,cAAsC,IAAI;AAE9D,SAAS,cAAc,MAA0B;CAC/C,MAAM,aAAa,WAAW,OAAO;CACrC,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,eAAe,KAAK,mCAAmC;CACxF,OAAO;AACT;AAEA,SAAS,SAAS,MAA+B;CAC/C,MAAM,QAAQ,WAAW,WAAW;CACpC,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,eAAe,KAAK,mCAAmC;CACnF,OAAO;AACT;AAQA,SAAS,KAAK,EACZ,OACA,cACA,eACA,eACA,QACA,UACA,UACA,SACA,SACA,UACA,UACA,UACA,MACA,MACA,IACA,GAAG,QACuB;CAC1B,MAAM,QAAQ,WAAW,YAAY,KAAK,KAAA;CAC1C,MAAM,aAAa,cACjB,OAAO,kBAAkB,EAAE,MAAM,CAAC,GAClC;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CACA,OACE,oBAAC,QAAQ,UAAT;EAAkB,OAAO;EAAa,UAAA,QAAQ,WAAW,MAAM,OAAO,IAAI;CAAoB,CAAA;AAElG;AAIA,SAAS,SAAS,OAAoC;CACpD,MAAM,aAAa,cAAc,UAAU;CAC3C,OAAO,QAAQ,WAAW,UAAU,OAAO,OAAO,KAAA,IAAY,YAE5D,qBAAA,YAAA,EAAA,UAAA,CACG,SACD,oBAAC,aAAD;EAAa,IAAI,WAAW;EAAO,KAAI;CAAS,CAAA,CAChD,EAAA,CAAA,CACH;AACH;AAIA,MAAM,WAAW,UAAwB,QAAQ,cAAc,SAAS,CAAC,CAAC,SAAS,UAAU,KAAK;AAIlG,MAAM,QAAQ,UAAqB,QAAQ,cAAc,MAAM,CAAC,CAAC,MAAM,MAAM,KAAK;;AAQlF,SAAS,MAAM,EAAE,YAAsC;CACrD,MAAM,UAAU,UAAU,cAAc,OAAO,CAAC,CAAC,OAAO;CACxD,OACE,oBAAA,YAAA,EAAA,UACG,QAAQ,KAAK,UACZ,oBAAC,UAAD,EAAA,UAA2B,SAAS,KAAK,EAAY,GAAtC,MAAM,GAAgC,CACtD,EACD,CAAA;AAEN;AAWA,SAAS,KAAK,EAAE,OAAO,GAAG,SAAkC;CAC1D,OACE,oBAAC,YAAY,UAAb;EAAsB,OAAO;EAC1B,UAAA,QAAQ,cAAc,MAAM,CAAC,CAAC,KAAK,MAAM,GAAG,GAAG,MAAM,KAAK;CACvC,CAAA;AAE1B;;AAKA,SAAS,SAAS,OAAoC;CACpD,MAAM,QAAQ,SAAS,UAAU;CACjC,OAAO,QAAQ,cAAc,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,GAAG,QAAQ;EACpE,GAAG;EACH,UAAU,MAAM,YAAY,MAAM,KAAK;CACzC,CAAC;AACH;;AAYA,SAAS,SAAS,EAAE,QAAQ,GAAG,SAAsC;CACnE,MAAM,QAAQ,SAAS,UAAU;CACjC,OAAO,QAAQ,cAAc,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,GAAG,QAAQ;EACpE,GAAG;EACH,UAAU,MAAM,YAAY,YAAY,MAAM,KAAK,MAAM,MAAM;CACjE,CAAC;AACH;AAIA,MAAM,cAAc,UAClB,QAAQ,cAAc,YAAY,CAAC,CAAC,WAAW,SAAS,YAAY,CAAC,CAAC,GAAG,GAAG,UAAU,KAAK;AAI7F,MAAM,SAAS,UAAsB,QAAQ,cAAc,OAAO,CAAC,CAAC,OAAO,UAAU,KAAK;AAE1F,MAAa,aAA6B,sBAAM,cAAc;CAC5D;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC"}
|
package/src/form.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PartComponentProps } from "./runtime.js";
|
|
2
|
-
import { StateOf } from "@kirana-ui/core";
|
|
3
2
|
import { ReactElement } from "react";
|
|
3
|
+
import { StateOf } from "@kirana-ui/core";
|
|
4
4
|
import { Form as Form$1, FormProps as FormProps$1 } from "@kirana-ui/core/form";
|
|
5
5
|
import { Vocabulary } from "@kirana-ui/core/vocabulary";
|
|
6
6
|
/** The form a field is in, if it is in one. */
|
package/src/hover-popup.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PartComponentProps, PartTag, PortalProps, PositionerOptions, PositionerProps } from "./runtime.js";
|
|
2
|
-
import { PartState, ReadonlySignal } from "@kirana-ui/core";
|
|
3
2
|
import { ReactElement, ReactNode } from "react";
|
|
3
|
+
import { PartState, ReadonlySignal } from "@kirana-ui/core";
|
|
4
4
|
import { HoverPopup, HoverPopupProps } from "@kirana-ui/core/tooltip";
|
|
5
5
|
export type RootProps = Omit<HoverPopupProps, "id"> & {
|
|
6
6
|
id?: string;
|
package/src/hover-popup.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Portal, parts, useController, usePart, usePositioning, useSignal } from "./runtime.js";
|
|
2
|
-
import { defined } from "@kirana-ui/core";
|
|
3
2
|
import { createContext, useContext } from "react";
|
|
3
|
+
import { defined } from "@kirana-ui/core";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
// src/hover-popup.tsx
|
|
6
6
|
/** The parts of a popup the pointer opens: a tooltip's, a hover card's. */
|