@kirana-ui/vue 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/llms.txt +1867 -268
- package/package.json +18 -2
- package/skills/kirana-ui-primitives/SKILL.md +163 -0
- package/src/accordion.d.ts +42 -75
- package/src/accordion.js +4 -2
- package/src/accordion.js.map +1 -1
- package/src/agent.d.ts +1 -0
- package/src/agent.js +1 -0
- package/src/alert-dialog.d.ts +3 -2
- package/src/autocomplete.d.ts +4 -2
- package/src/autosize.d.ts +9 -9
- package/src/autosize.js.map +1 -1
- package/src/avatar.d.ts +37 -13
- package/src/avatar.js +39 -15
- package/src/avatar.js.map +1 -1
- package/src/button.d.ts +4 -21
- package/src/button.js.map +1 -1
- package/src/calendar.d.ts +71 -99
- package/src/calendar.js +81 -11
- package/src/calendar.js.map +1 -1
- package/src/carousel.d.ts +36 -58
- package/src/carousel.js.map +1 -1
- package/src/checkbox-group-context.d.ts +5 -0
- package/src/checkbox-group-context.js +6 -0
- package/src/checkbox-group-context.js.map +1 -0
- package/src/checkbox-group.d.ts +12 -0
- package/src/checkbox-group.js +44 -0
- package/src/checkbox-group.js.map +1 -0
- package/src/checkbox.d.ts +29 -50
- package/src/checkbox.js +11 -4
- package/src/checkbox.js.map +1 -1
- package/src/collapsible.d.ts +26 -36
- package/src/collapsible.js.map +1 -1
- package/src/combobox.d.ts +161 -290
- package/src/combobox.js +62 -4
- package/src/combobox.js.map +1 -1
- package/src/command.d.ts +43 -86
- package/src/command.js +2 -0
- package/src/command.js.map +1 -1
- package/src/context-menu.d.ts +4 -2
- package/src/date-field.d.ts +31 -61
- package/src/date-field.js +7 -3
- package/src/date-field.js.map +1 -1
- package/src/date-picker.d.ts +86 -139
- package/src/date-picker.js +12 -1
- package/src/date-picker.js.map +1 -1
- package/src/dialog.d.ts +93 -145
- package/src/dialog.js +7 -2
- package/src/dialog.js.map +1 -1
- package/src/direction.d.ts +5 -8
- package/src/direction.js.map +1 -1
- package/src/drawer.d.ts +3 -2
- package/src/element.d.ts +23 -0
- package/src/element.js +90 -0
- package/src/element.js.map +1 -0
- package/src/field.d.ts +63 -45
- package/src/field.js +3 -2
- package/src/field.js.map +1 -1
- package/src/fieldset.d.ts +12 -13
- package/src/fieldset.js.map +1 -1
- package/src/form.d.ts +5 -15
- package/src/form.js.map +1 -1
- package/src/hover-card.d.ts +29 -43
- package/src/hover-card.js.map +1 -1
- package/src/hover-popup.d.ts +27 -46
- package/src/hover-popup.js +4 -1
- package/src/hover-popup.js.map +1 -1
- package/src/index.d.ts +16 -3
- package/src/index.js +2 -1
- package/src/input.d.ts +12 -14
- package/src/input.js.map +1 -1
- package/src/label.d.ts +3 -3
- package/src/label.js.map +1 -1
- package/src/listbox.d.ts +34 -89
- package/src/listbox.js.map +1 -1
- package/src/menu.d.ts +170 -533
- package/src/menu.js.map +1 -1
- package/src/menubar.d.ts +6 -24
- package/src/menubar.js.map +1 -1
- package/src/message-scroller.d.ts +23 -17
- package/src/message-scroller.js.map +1 -1
- package/src/meter.d.ts +10 -31
- package/src/meter.js.map +1 -1
- package/src/navigation-menu.d.ts +77 -88
- package/src/navigation-menu.js +13 -12
- package/src/navigation-menu.js.map +1 -1
- package/src/number-field.d.ts +104 -68
- package/src/number-field.js +98 -68
- package/src/number-field.js.map +1 -1
- package/src/otp.d.ts +33 -54
- package/src/otp.js +4 -2
- package/src/otp.js.map +1 -1
- package/src/pagination.d.ts +31 -58
- package/src/pagination.js.map +1 -1
- package/src/popover.d.ts +83 -36
- package/src/popover.js +68 -8
- package/src/popover.js.map +1 -1
- package/src/primitive.d.ts +21 -0
- package/src/primitive.js +27 -0
- package/src/primitive.js.map +1 -0
- package/src/progress.d.ts +28 -31
- package/src/progress.js.map +1 -1
- package/src/qr-code.d.ts +12 -21
- package/src/qr-code.js.map +1 -1
- package/src/radio-group.d.ts +37 -75
- package/src/radio-group.js +8 -4
- package/src/radio-group.js.map +1 -1
- package/src/resizable.d.ts +26 -45
- package/src/resizable.js.map +1 -1
- package/src/runtime.d.ts +93 -21
- package/src/runtime.js +24 -25
- package/src/runtime.js.map +1 -1
- package/src/scroll-area.d.ts +33 -28
- package/src/scroll-area.js.map +1 -1
- package/src/select.d.ts +88 -147
- package/src/select.js +33 -6
- package/src/select.js.map +1 -1
- package/src/separator.d.ts +4 -9
- package/src/separator.js.map +1 -1
- package/src/slider.d.ts +66 -80
- package/src/slider.js +11 -10
- package/src/slider.js.map +1 -1
- package/src/switch.d.ts +21 -39
- package/src/switch.js +2 -2
- package/src/switch.js.map +1 -1
- package/src/tabs.d.ts +44 -98
- package/src/tabs.js.map +1 -1
- package/src/testing.d.ts +1 -0
- package/src/testing.js +1 -0
- package/src/toast.d.ts +58 -45
- package/src/toast.js +46 -17
- package/src/toast.js.map +1 -1
- package/src/toggle-group.d.ts +8 -39
- package/src/toggle-group.js.map +1 -1
- package/src/toggle.d.ts +5 -34
- package/src/toggle.js.map +1 -1
- package/src/toolbar.d.ts +31 -69
- package/src/toolbar.js.map +1 -1
- package/src/tooltip.d.ts +29 -43
- package/src/tooltip.js.map +1 -1
- package/src/value-bar.d.ts +26 -35
- package/src/value-bar.js +10 -3
- package/src/value-bar.js.map +1 -1
package/src/combobox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.js","names":[],"sources":["../../../../packages/vue/src/combobox.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createAutocomplete } from \"@kirana-ui/core/autocomplete\"\nimport type { AutocompleteProps } from \"@kirana-ui/core/autocomplete\"\nimport { createCombobox } from \"@kirana-ui/core/combobox\"\nimport type { Combobox as Controller, ComboboxGroup, ComboboxProps } from \"@kirana-ui/core/combobox\"\nimport { defineComponent, h, inject, provide, useId } from \"vue\"\nimport type { InjectionKey, PropType } from \"vue\"\n\nimport { useFieldAround } from \"./field-context.ts\"\nimport { positionerComponent } from \"./popover.ts\"\nimport {\n context,\n controller,\n fromSignal,\n optional,\n partComponent,\n portalComponent,\n toSignal,\n} from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"Combobox\")\nconst ITEM: InjectionKey<unknown> = Symbol(\"ComboboxItem\")\nconst ANY = null as unknown as PropType<unknown>\n\nconst GROUP: InjectionKey<ComboboxGroup | null> = Symbol(\"ComboboxGroup\")\n\n/** Items that belong together, named by their `GroupLabel`. Hidden while none is shown. */\nconst Group = defineComponent({\n name: \"ComboboxGroup\",\n inheritAttrs: false,\n props: { id: String },\n setup(props, { attrs, slots }) {\n const generated = useId()\n const group = scope.use().group(props.id ?? generated)\n provide(GROUP, group)\n const Element = partComponent(\"ComboboxGroupElement\", \"div\", () => group.root)\n return () => h(Element, attrs, slots)\n },\n})\n\n/** Names the group it is in. With no group around it, it is plain text. */\nconst GroupLabel = partComponent(\n \"ComboboxGroupLabel\",\n \"div\",\n () => inject(GROUP, null)?.label ?? scope.use().groupLabel\n)\n\nconst HiddenInput = partComponent(\"ComboboxHiddenInput\", \"input\", () => scope.use().hidden)\n\n/** `v-model:value`, `v-model:inputValue`, `v-model:open`; the `-change` events carry the details. */\nconst Root = defineComponent({\n name: \"ComboboxRoot\",\n props: {\n value: { type: ANY, default: undefined as unknown },\n defaultValue: { type: ANY, default: null as unknown },\n inputValue: String,\n defaultInputValue: String,\n open: optional(Boolean),\n defaultOpen: Boolean,\n disabled: Boolean,\n required: Boolean,\n multiple: Boolean,\n values: optional(Array as PropType<readonly unknown[]>),\n defaultValues: Array as PropType<readonly unknown[]>,\n inline: Boolean,\n virtualized: Object as PropType<ComboboxProps[\"virtualized\"]>,\n name: String,\n form: String,\n items: Array as PropType<readonly { value: unknown; label: string }[]>,\n filter: {\n type: null as unknown as PropType<((label: string, query: string) => boolean) | null>,\n default: undefined,\n },\n id: String,\n },\n emits: [\n \"update:value\",\n \"valueChange\",\n \"update:inputValue\",\n \"inputValueChange\",\n \"update:open\",\n \"openChange\",\n \"update:values\",\n \"valuesChange\",\n ],\n setup(props, { slots, emit }) {\n const generated = useId()\n const field = useFieldAround()\n const made = scope.provide(\n controller(within(createCombobox, { field }), () => ({\n id: props.id ?? generated,\n value: props.value,\n defaultValue: props.defaultValue,\n inputValue: props.inputValue,\n defaultInputValue: props.defaultInputValue,\n open: props.open,\n defaultOpen: props.defaultOpen,\n disabled: props.disabled,\n required: props.required,\n multiple: props.multiple,\n values: props.values,\n defaultValues: props.defaultValues,\n onValuesChange(values: unknown[], details: ChangeDetails) {\n emit(\"valuesChange\", values, details)\n if (!details.canceled) emit(\"update:values\", values)\n },\n inline: props.inline,\n virtualized: props.virtualized,\n name: props.name,\n form: props.form,\n items: props.items,\n filter: props.filter,\n onValueChange(value: unknown, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n onInputValueChange(value: string, details: ChangeDetails) {\n emit(\"inputValueChange\", value, details)\n if (!details.canceled) emit(\"update:inputValue\", value)\n },\n onOpenChange(open: boolean, details: ChangeDetails) {\n emit(\"openChange\", open, details)\n if (!details.canceled) emit(\"update:open\", open)\n },\n }))\n )\n const named = fromSignal(made.named)\n return () => [slots.default?.(), named.value ? h(HiddenInput) : null]\n },\n})\n\n/** `label` is what is filtered and what the input shows; the item's text when left out. */\nconst Item = defineComponent({\n name: \"ComboboxItem\",\n inheritAttrs: false,\n props: {\n value: { type: ANY, required: true },\n disabled: optional(Boolean),\n label: String,\n id: String,\n index: Number,\n },\n setup(props, { attrs, slots }) {\n // An item is its value for as long as it is in the page.\n const value = props.value\n const generated = useId()\n const options = toSignal(() => ({\n disabled: props.disabled,\n label: props.label,\n index: props.index,\n id: props.id ?? generated,\n }))\n const part = scope.use().item(value, () => options.get(), inject(GROUP, null) ?? undefined)\n provide(ITEM, value)\n const Element = partComponent(\"ComboboxItemElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n})\n\nconst ItemIndicator = defineComponent({\n name: \"ComboboxItemIndicator\",\n inheritAttrs: false,\n props: { keepMounted: Boolean },\n setup(props, { attrs, slots }) {\n const value = inject(ITEM)\n const made = scope.use()\n const selected = fromSignal(made.selected(value))\n const Element = partComponent(\"ComboboxItemIndicatorElement\", \"span\", () =>\n made.itemIndicator(value)\n )\n return () => (selected.value || props.keepMounted ? h(Element, attrs, slots) : null)\n },\n})\n\n/** A button that empties the input and the value. Drawn while there is something to clear. */\nconst Clear = defineComponent({\n name: \"ComboboxClear\",\n inheritAttrs: false,\n props: { keepMounted: Boolean },\n setup(props, { attrs, slots }) {\n const made = scope.use()\n const clearable = fromSignal(made.clearable)\n const Element = partComponent(\"ComboboxClearElement\", \"button\", () => made.clear)\n return () => (clearable.value || props.keepMounted ? h(Element, attrs, slots) : null)\n },\n})\n\nconst CHIP: InjectionKey<unknown> = Symbol(\"ComboboxChip\")\n\n/** With `multiple`: one chosen value. Its `value` is what its remove button takes away. */\nconst Chip = defineComponent({\n name: \"ComboboxChip\",\n inheritAttrs: false,\n props: { value: { type: ANY, required: true } },\n setup(props, { attrs, slots }) {\n // A chip is its value for as long as it is in the page.\n const value = props.value\n provide(CHIP, value)\n const part = scope.use().chip(value)\n const Element = partComponent(\"ComboboxChipElement\", \"span\", () => part)\n return () => h(Element, attrs, slots)\n },\n})\n\n/** Drawn while no item is shown for what was typed. */\nconst Empty = defineComponent({\n name: \"ComboboxEmpty\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const made = scope.use()\n const empty = fromSignal(made.empty)\n const Element = partComponent(\"ComboboxEmptyElement\", \"div\", () => made.emptyPart)\n return () => (empty.value ? h(Element, attrs, slots) : null)\n },\n})\n\n/** A combobox whose text is the value: `v-model` is the text. The list only suggests. */\nconst AutocompleteRoot = defineComponent({\n name: \"AutocompleteRoot\",\n props: {\n modelValue: String,\n defaultValue: String,\n open: optional(Boolean),\n defaultOpen: Boolean,\n mode: String as PropType<AutocompleteProps[\"mode\"]>,\n filter: {\n type: null as unknown as PropType<AutocompleteProps[\"filter\"]>,\n default: undefined,\n },\n openOnInputClick: Boolean,\n disabled: Boolean,\n required: Boolean,\n name: String,\n form: String,\n virtualized: Object as PropType<AutocompleteProps[\"virtualized\"]>,\n id: String,\n },\n emits: [\"update:modelValue\", \"valueChange\", \"update:open\", \"openChange\"],\n setup(props, { slots, emit }) {\n const generated = useId()\n scope.provide(\n controller(within(createAutocomplete, { field: useFieldAround() }), () => ({\n id: props.id ?? generated,\n value: props.modelValue,\n defaultValue: props.defaultValue,\n open: props.open,\n defaultOpen: props.defaultOpen,\n mode: props.mode,\n filter: props.filter,\n openOnInputClick: props.openOnInputClick,\n disabled: props.disabled,\n required: props.required,\n name: props.name,\n form: props.form,\n virtualized: props.virtualized,\n onValueChange(value: string, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:modelValue\", value)\n },\n onOpenChange(open: boolean, details: ChangeDetails) {\n emit(\"openChange\", open, details)\n if (!details.canceled) emit(\"update:open\", open)\n },\n }))\n )\n return () => slots.default?.()\n },\n})\n\nexport const Combobox = {\n Root,\n Input: partComponent(\"ComboboxInput\", \"input\", () => scope.use().input),\n Trigger: partComponent(\"ComboboxTrigger\", \"button\", () => scope.use().trigger),\n Clear,\n /** With `multiple`: what holds the chips and the input. */\n Chips: partComponent(\"ComboboxChips\", \"div\", () => scope.use().chips),\n Chip,\n ChipRemove: partComponent(\"ComboboxChipRemove\", \"button\", () =>\n scope.use().chipRemove(inject(CHIP))\n ),\n Portal: portalComponent(\"ComboboxPortal\", () => scope.use().mounted),\n Positioner: positionerComponent(\n \"ComboboxPositioner\",\n () => scope.use(),\n partComponent(\"ComboboxPositionerElement\", \"div\", () => scope.use().positioner)\n ),\n Popup: partComponent(\"ComboboxPopup\", \"div\", () => scope.use().popup),\n Group,\n GroupLabel,\n /** A line between groups. */\n Separator: partComponent(\"ComboboxSeparator\", \"div\", () => scope.use().separator),\n Item,\n ItemIndicator,\n Empty,\n}\n\nexport const Autocomplete = {\n Root: AutocompleteRoot,\n Input: Combobox.Input,\n Trigger: Combobox.Trigger,\n Clear: Combobox.Clear,\n Portal: Combobox.Portal,\n Positioner: Combobox.Positioner,\n Popup: Combobox.Popup,\n Group: Combobox.Group,\n GroupLabel: Combobox.GroupLabel,\n Separator: Combobox.Separator,\n Item: Combobox.Item,\n Empty: Combobox.Empty,\n}\n"],"mappings":";;;;;;;;AAqBA,MAAM,QAAQ,QAAoB,UAAU;AAC5C,MAAM,OAA8B,OAAO,cAAc;AACzD,MAAM,MAAM;AAEZ,MAAM,QAA4C,OAAO,eAAe;;AAGxE,MAAM,QAAQ,gBAAgB;CAC5B,MAAM;CACN,cAAc;CACd,OAAO,EAAE,IAAI,OAAO;CACpB,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,YAAY,MAAM;EACxB,MAAM,QAAQ,MAAM,IAAI,CAAC,CAAC,MAAM,MAAM,MAAM,SAAS;EACrD,QAAQ,OAAO,KAAK;EACpB,MAAM,UAAU,cAAc,wBAAwB,aAAa,MAAM,IAAI;EAC7E,aAAa,EAAE,SAAS,OAAO,KAAK;CACtC;AACF,CAAC;;AAGD,MAAM,aAAa,cACjB,sBACA,aACM,OAAO,OAAO,IAAI,CAAC,EAAE,SAAS,MAAM,IAAI,CAAC,CAAC,UAClD;AAEA,MAAM,cAAc,cAAc,uBAAuB,eAAe,MAAM,IAAI,CAAC,CAAC,MAAM;;AAG1F,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,OAAO;EACL,OAAO;GAAE,MAAM;GAAK,SAAS,KAAA;EAAqB;EAClD,cAAc;GAAE,MAAM;GAAK,SAAS;EAAgB;EACpD,YAAY;EACZ,mBAAmB;EACnB,MAAM,SAAS,OAAO;EACtB,aAAa;EACb,UAAU;EACV,UAAU;EACV,UAAU;EACV,QAAQ,SAAS,KAAqC;EACtD,eAAe;EACf,QAAQ;EACR,aAAa;EACb,MAAM;EACN,MAAM;EACN,OAAO;EACP,QAAQ;GACN,MAAM;GACN,SAAS,KAAA;EACX;EACA,IAAI;CACN;CACA,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
1
|
+
{"version":3,"file":"combobox.js","names":[],"sources":["../../../../packages/vue/src/combobox.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createAutocomplete } from \"@kirana-ui/core/autocomplete\"\nimport type { AutocompleteProps } from \"@kirana-ui/core/autocomplete\"\nimport { createCombobox } from \"@kirana-ui/core/combobox\"\nimport type {\n Combobox as Controller,\n ComboboxEntry,\n ComboboxGroup,\n ComboboxItemOptions,\n ComboboxProps,\n ComboboxShown,\n} from \"@kirana-ui/core/combobox\"\nimport { defineComponent, Fragment, h, inject, provide, useId } from \"vue\"\nimport type { InjectionKey, PropType, PublicProps } from \"vue\"\n\nimport { useFieldAround } from \"./field-context.ts\"\nimport { positionerComponent } from \"./popover.ts\"\nimport {\n context,\n controller,\n fromSignal,\n optional,\n partComponent,\n portalComponent,\n toSignal,\n} from \"./runtime.ts\"\nimport type {\n Changes,\n Listeners,\n PartComponent,\n PartComponentProps,\n PlainComponent,\n PlainInstance,\n StatesOf,\n} from \"./runtime.ts\"\n\nexport type { PositionerProps } from \"./popover.ts\"\nexport type { PortalProps } from \"./runtime.ts\"\n\ntype State = StatesOf<\"combobox\">\n\nconst scope = context<Controller>(\"Combobox\")\nconst ITEM: InjectionKey<unknown> = Symbol(\"ComboboxItem\")\nconst ANY = null as unknown as PropType<unknown>\n\nconst GROUP: InjectionKey<ComboboxGroup | null> = Symbol(\"ComboboxGroup\")\n\nexport interface GroupProps extends PartComponentProps {\n id?: string | undefined\n}\n\n/** Items that belong together, named by their `GroupLabel`. Hidden while none is shown. */\nconst Group = defineComponent({\n name: \"ComboboxGroup\",\n inheritAttrs: false,\n props: { id: String },\n setup(props, { attrs, slots }) {\n const generated = useId()\n const group = scope.use().group(props.id ?? generated)\n provide(GROUP, group)\n const Element = partComponent(\"ComboboxGroupElement\", \"div\", () => group.root)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"group\"], GroupProps>\n\n/** Names the group it is in. With no group around it, it is plain text. */\nconst GroupLabel = partComponent<\"div\", State[\"groupLabel\"]>(\n \"ComboboxGroupLabel\",\n \"div\",\n () => inject(GROUP, null)?.label ?? scope.use().groupLabel\n)\n\nconst HiddenInput = partComponent(\"ComboboxHiddenInput\", \"input\", () => scope.use().hidden)\n\nexport type RootProps<Value = unknown> = Omit<\n ComboboxProps<Value>,\n \"id\" | \"onValueChange\" | \"onValuesChange\" | \"onInputValueChange\" | \"onOpenChange\"\n> & { id?: string | undefined }\n\n/** The value is `null` when the combobox is cleared. */\nexport type RootEmits<Value = unknown> = Changes<\"value\", Value | null> &\n Changes<\"values\", Value[]> &\n Changes<\"inputValue\", string> &\n Changes<\"open\", boolean>\n\n/** `v-model:value`, `v-model:inputValue`, `v-model:open`; the `-change` events carry the details. */\nconst Root = defineComponent({\n name: \"ComboboxRoot\",\n props: {\n value: { type: ANY, default: undefined as unknown },\n defaultValue: { type: ANY, default: null as unknown },\n inputValue: String,\n defaultInputValue: String,\n open: optional(Boolean),\n defaultOpen: Boolean,\n disabled: Boolean,\n readOnly: Boolean,\n required: Boolean,\n multiple: Boolean,\n values: optional(Array as PropType<readonly unknown[]>),\n defaultValues: Array as PropType<readonly unknown[]>,\n inline: Boolean,\n virtualized: Object as PropType<ComboboxProps[\"virtualized\"]>,\n autoHighlight: Boolean,\n name: String,\n form: String,\n items: [Array, Object] as PropType<ComboboxProps[\"items\"]>,\n filter: {\n type: null as unknown as PropType<((label: string, query: string) => boolean) | null>,\n default: undefined,\n },\n id: String,\n },\n emits: [\n \"update:value\",\n \"valueChange\",\n \"update:inputValue\",\n \"inputValueChange\",\n \"update:open\",\n \"openChange\",\n \"update:values\",\n \"valuesChange\",\n ],\n setup(props, { slots, emit }) {\n const generated = useId()\n const field = useFieldAround()\n const made = scope.provide(\n controller(within(createCombobox, { field }), () => ({\n id: props.id ?? generated,\n value: props.value,\n defaultValue: props.defaultValue,\n inputValue: props.inputValue,\n defaultInputValue: props.defaultInputValue,\n open: props.open,\n defaultOpen: props.defaultOpen,\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n multiple: props.multiple,\n values: props.values,\n defaultValues: props.defaultValues,\n onValuesChange(values: unknown[], details: ChangeDetails) {\n emit(\"valuesChange\", values, details)\n if (!details.canceled) emit(\"update:values\", values)\n },\n inline: props.inline,\n virtualized: props.virtualized,\n autoHighlight: props.autoHighlight,\n name: props.name,\n form: props.form,\n items: props.items,\n filter: props.filter,\n onValueChange(value: unknown, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n onInputValueChange(value: string, details: ChangeDetails) {\n emit(\"inputValueChange\", value, details)\n if (!details.canceled) emit(\"update:inputValue\", value)\n },\n onOpenChange(open: boolean, details: ChangeDetails) {\n emit(\"openChange\", open, details)\n if (!details.canceled) emit(\"update:open\", open)\n },\n }))\n )\n const named = fromSignal(made.named)\n return () => [slots.default?.(), named.value ? h(HiddenInput) : null]\n },\n}) as unknown as new <Value = unknown>(\n props: RootProps<Value> & Listeners<RootEmits<Value>> & PublicProps\n) => PlainInstance<RootProps<Value>, RootEmits<Value>, {}>\n\nexport interface ItemProps extends Omit<ComboboxItemOptions, \"id\">, PartComponentProps {\n /** What the combobox's value is while this item is the chosen one. */\n value: unknown\n id?: string | undefined\n}\n\n/** `label` is what is filtered and what the input shows; the item's text when left out. */\nconst Item = defineComponent({\n name: \"ComboboxItem\",\n inheritAttrs: false,\n props: {\n value: { type: ANY, required: true },\n disabled: optional(Boolean),\n label: String,\n id: String,\n index: Number,\n },\n setup(props, { attrs, slots }) {\n // An item is its value for as long as it is in the page.\n const value = props.value\n const generated = useId()\n const options = toSignal(() => ({\n disabled: props.disabled,\n label: props.label,\n index: props.index,\n id: props.id ?? generated,\n }))\n const part = scope.use().item(value, () => options.get(), inject(GROUP, null) ?? undefined)\n provide(ITEM, value)\n const Element = partComponent(\"ComboboxItemElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"item\"], ItemProps>\n\nexport interface ItemIndicatorProps extends PartComponentProps {\n /** Keeps the mark in the page while its item is not chosen. */\n keepMounted?: boolean | undefined\n}\n\nconst ItemIndicator = defineComponent({\n name: \"ComboboxItemIndicator\",\n inheritAttrs: false,\n props: { keepMounted: Boolean },\n setup(props, { attrs, slots }) {\n const value = inject(ITEM)\n const made = scope.use()\n const selected = fromSignal(made.selected(value))\n const Element = partComponent(\"ComboboxItemIndicatorElement\", \"span\", () =>\n made.itemIndicator(value)\n )\n return () => (selected.value || props.keepMounted ? h(Element, attrs, slots) : null)\n },\n}) as unknown as PartComponent<\"span\", State[\"itemIndicator\"], ItemIndicatorProps>\n\nexport interface ClearProps extends PartComponentProps {\n /** Keeps the button in the page while there is nothing to clear. */\n keepMounted?: boolean | undefined\n}\n\n/** A button that empties the input and the value. Drawn while there is something to clear. */\nconst Clear = defineComponent({\n name: \"ComboboxClear\",\n inheritAttrs: false,\n props: { keepMounted: Boolean },\n setup(props, { attrs, slots }) {\n const made = scope.use()\n const clearable = fromSignal(made.clearable)\n const Element = partComponent(\"ComboboxClearElement\", \"button\", () => made.clear)\n return () => (clearable.value || props.keepMounted ? h(Element, attrs, slots) : null)\n },\n}) as unknown as PartComponent<\"button\", State[\"clear\"], ClearProps>\n\nconst CHIP: InjectionKey<unknown> = Symbol(\"ComboboxChip\")\n\nexport interface ChipProps extends PartComponentProps {\n /** The chosen value it stands for: what its remove button takes away. */\n value: unknown\n}\n\n/** With `multiple`: one chosen value. Its `value` is what its remove button takes away. */\nconst Chip = defineComponent({\n name: \"ComboboxChip\",\n inheritAttrs: false,\n props: { value: { type: ANY, required: true } },\n setup(props, { attrs, slots }) {\n // A chip is its value for as long as it is in the page.\n const value = props.value\n provide(CHIP, value)\n const part = scope.use().chip(value)\n const Element = partComponent(\"ComboboxChipElement\", \"span\", () => part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"span\", State[\"chip\"], ChipProps>\n\nexport type EmptyProps = PartComponentProps\n\n/** Drawn while no item is shown for what was typed. */\nconst Empty = defineComponent({\n name: \"ComboboxEmpty\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const made = scope.use()\n const empty = fromSignal(made.empty)\n const Element = partComponent(\"ComboboxEmptyElement\", \"div\", () => made.emptyPart)\n return () => (empty.value ? h(Element, attrs, slots) : null)\n },\n}) as unknown as PartComponent<\"div\", State[\"empty\"], EmptyProps>\n\nexport interface ValueProps {\n /** What it shows while nothing is chosen. */\n placeholder?: string | undefined\n}\n\n/**\n * The chosen value's label, or `placeholder` while nothing is chosen; with `multiple`, the\n * chosen labels with commas between. Or what its slot makes of them\n * (`v-slot=\"{ value, label }\"`, with `multiple` `v-slot=\"{ values, labels }\"`, in the order\n * they were chosen). For a button that is the combobox, its input inside the popup. It draws\n * no element.\n */\nconst Value = defineComponent({\n name: \"ComboboxValue\",\n props: { placeholder: { type: String, default: \"\" } },\n setup(props, { slots }) {\n const shown = fromSignal(scope.use().shown)\n return () =>\n slots.default ? slots.default(shown.value) : (shown.value.label ?? props.placeholder)\n },\n}) as unknown as PlainComponent<ValueProps, {}, ComboboxShown>\n\nexport interface CollectionProps {\n /** A group the root's `items` gave: its items left are then what is drawn. */\n of?: ComboboxEntry | undefined\n}\n\n/**\n * Draws the list from the root's `items`: its slot (`v-slot=\"{ entry }\"`) once for each item\n * left for what was typed, or for each group that has items left; with `of`, for each of that\n * group's. The root then filters, and no item hides itself. It draws no element.\n */\nconst Collection = defineComponent({\n name: \"ComboboxCollection\",\n props: { of: Object as PropType<ComboboxEntry> },\n setup(props, { slots }) {\n // A group is known by its key, which is its own for as long as it is drawn.\n const entries = fromSignal(scope.use().entries(props.of))\n return () =>\n entries.value.map((entry) => h(Fragment, { key: entry.key }, slots.default?.({ entry })))\n },\n}) as unknown as PlainComponent<CollectionProps, {}, { entry: ComboboxEntry }>\n\nexport type AutocompleteRootProps = Omit<\n AutocompleteProps,\n \"id\" | \"value\" | \"onValueChange\" | \"onOpenChange\"\n> & {\n /** The text, which is the value: `v-model`. */\n modelValue?: string | undefined\n id?: string | undefined\n}\n\nexport type AutocompleteRootEmits = {\n \"update:modelValue\": (value: string) => void\n valueChange: (value: string, details: ChangeDetails) => void\n} & Changes<\"open\", boolean>\n\n/** A combobox whose text is the value: `v-model` is the text. The list only suggests. */\nconst AutocompleteRoot = defineComponent({\n name: \"AutocompleteRoot\",\n props: {\n modelValue: String,\n defaultValue: String,\n open: optional(Boolean),\n defaultOpen: Boolean,\n mode: String as PropType<AutocompleteProps[\"mode\"]>,\n filter: {\n type: null as unknown as PropType<AutocompleteProps[\"filter\"]>,\n default: undefined,\n },\n openOnInputClick: Boolean,\n disabled: Boolean,\n readOnly: Boolean,\n items: [Array, Object] as PropType<AutocompleteProps[\"items\"]>,\n required: Boolean,\n name: String,\n form: String,\n virtualized: Object as PropType<AutocompleteProps[\"virtualized\"]>,\n autoHighlight: Boolean,\n id: String,\n },\n emits: [\"update:modelValue\", \"valueChange\", \"update:open\", \"openChange\"],\n setup(props, { slots, emit }) {\n const generated = useId()\n scope.provide(\n controller(within(createAutocomplete, { field: useFieldAround() }), () => ({\n id: props.id ?? generated,\n value: props.modelValue,\n defaultValue: props.defaultValue,\n open: props.open,\n defaultOpen: props.defaultOpen,\n mode: props.mode,\n filter: props.filter,\n openOnInputClick: props.openOnInputClick,\n disabled: props.disabled,\n readOnly: props.readOnly,\n items: props.items,\n required: props.required,\n name: props.name,\n form: props.form,\n virtualized: props.virtualized,\n autoHighlight: props.autoHighlight,\n onValueChange(value: string, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:modelValue\", value)\n },\n onOpenChange(open: boolean, details: ChangeDetails) {\n emit(\"openChange\", open, details)\n if (!details.canceled) emit(\"update:open\", open)\n },\n }))\n )\n return () => slots.default?.()\n },\n}) as unknown as PlainComponent<AutocompleteRootProps, AutocompleteRootEmits>\n\nexport type InputProps = PartComponentProps\nexport type TriggerProps = PartComponentProps\nexport type ChipsProps = PartComponentProps\nexport type ChipRemoveProps = PartComponentProps\nexport type PopupProps = PartComponentProps\nexport type ListProps = PartComponentProps\nexport type GroupLabelProps = PartComponentProps\nexport type SeparatorProps = PartComponentProps\nexport type StatusProps = PartComponentProps\n\n/**\n * Says how the list stands (\"3 results\", \"Loading\") to software that reads the page, as its\n * text changes. Keep it in the page and change what it holds: inside the popup, or beside the\n * input.\n */\nconst Status = partComponent<\"div\", State[\"status\"]>(\n \"ComboboxStatus\",\n \"div\",\n () => scope.use().status\n)\n\nexport const Combobox = {\n Root,\n Input: partComponent<\"input\", State[\"input\"]>(\"ComboboxInput\", \"input\", () => scope.use().input),\n Trigger: partComponent<\"button\", State[\"trigger\"]>(\n \"ComboboxTrigger\",\n \"button\",\n () => scope.use().trigger\n ),\n Value,\n Clear,\n /** With `multiple`: what holds the chips and the input. */\n Chips: partComponent<\"div\", State[\"chips\"]>(\"ComboboxChips\", \"div\", () => scope.use().chips),\n Chip,\n ChipRemove: partComponent<\"button\", State[\"chipRemove\"]>(\"ComboboxChipRemove\", \"button\", () =>\n scope.use().chipRemove(inject(CHIP))\n ),\n Portal: portalComponent(\"ComboboxPortal\", () => scope.use().mounted),\n Positioner: positionerComponent<State[\"positioner\"]>(\n \"ComboboxPositioner\",\n () => scope.use(),\n partComponent(\"ComboboxPositionerElement\", \"div\", () => scope.use().positioner)\n ),\n Popup: partComponent<\"div\", State[\"popup\"]>(\"ComboboxPopup\", \"div\", () => scope.use().popup),\n /**\n * The items' own box inside the popup, when the popup holds more than items (an input): it\n * is then the listbox.\n */\n List: partComponent<\"div\", State[\"list\"]>(\"ComboboxList\", \"div\", () => scope.use().list),\n Collection,\n Group,\n GroupLabel,\n /** A line between groups. */\n Separator: partComponent<\"div\", State[\"separator\"]>(\n \"ComboboxSeparator\",\n \"div\",\n () => scope.use().separator\n ),\n Item,\n ItemIndicator,\n Empty,\n Status,\n}\n\nexport const Autocomplete = {\n Root: AutocompleteRoot,\n Input: Combobox.Input,\n Trigger: Combobox.Trigger,\n Clear: Combobox.Clear,\n Portal: Combobox.Portal,\n Positioner: Combobox.Positioner,\n Popup: Combobox.Popup,\n List: Combobox.List,\n Collection: Combobox.Collection,\n Group: Combobox.Group,\n GroupLabel: Combobox.GroupLabel,\n Separator: Combobox.Separator,\n Item: Combobox.Item,\n Empty: Combobox.Empty,\n Status: Combobox.Status,\n}\n"],"mappings":";;;;;;;;AA0CA,MAAM,QAAQ,QAAoB,UAAU;AAC5C,MAAM,OAA8B,OAAO,cAAc;AACzD,MAAM,MAAM;AAEZ,MAAM,QAA4C,OAAO,eAAe;;AAOxE,MAAM,QAAQ,gBAAgB;CAC5B,MAAM;CACN,cAAc;CACd,OAAO,EAAE,IAAI,OAAO;CACpB,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,YAAY,MAAM;EACxB,MAAM,QAAQ,MAAM,IAAI,CAAC,CAAC,MAAM,MAAM,MAAM,SAAS;EACrD,QAAQ,OAAO,KAAK;EACpB,MAAM,UAAU,cAAc,wBAAwB,aAAa,MAAM,IAAI;EAC7E,aAAa,EAAE,SAAS,OAAO,KAAK;CACtC;AACF,CAAC;;AAGD,MAAM,aAAa,cACjB,sBACA,aACM,OAAO,OAAO,IAAI,CAAC,EAAE,SAAS,MAAM,IAAI,CAAC,CAAC,UAClD;AAEA,MAAM,cAAc,cAAc,uBAAuB,eAAe,MAAM,IAAI,CAAC,CAAC,MAAM;;AAc1F,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,OAAO;EACL,OAAO;GAAE,MAAM;GAAK,SAAS,KAAA;EAAqB;EAClD,cAAc;GAAE,MAAM;GAAK,SAAS;EAAgB;EACpD,YAAY;EACZ,mBAAmB;EACnB,MAAM,SAAS,OAAO;EACtB,aAAa;EACb,UAAU;EACV,UAAU;EACV,UAAU;EACV,UAAU;EACV,QAAQ,SAAS,KAAqC;EACtD,eAAe;EACf,QAAQ;EACR,aAAa;EACb,eAAe;EACf,MAAM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AiBD,MAAM,SAAS,cACb,kBACA,aACM,MAAM,IAAI,CAAC,CAAC,MACpB;AAEA,MAAa,WAAW;CACtB;CACA,OAAO,cAAuC,iBAAiB,eAAe,MAAM,IAAI,CAAC,CAAC,KAAK;CAC/F,SAAS,cACP,mBACA,gBACM,MAAM,IAAI,CAAC,CAAC,OACpB;CACA;CACA;;CAEA,OAAO,cAAqC,iBAAiB,aAAa,MAAM,IAAI,CAAC,CAAC,KAAK;CAC3F;CACA,YAAY,cAA6C,sBAAsB,gBAC7E,MAAM,IAAI,CAAC,CAAC,WAAW,OAAO,IAAI,CAAC,CACrC;CACA,QAAQ,gBAAgB,wBAAwB,MAAM,IAAI,CAAC,CAAC,OAAO;CACnE,YAAY,oBACV,4BACM,MAAM,IAAI,GAChB,cAAc,6BAA6B,aAAa,MAAM,IAAI,CAAC,CAAC,UAAU,CAChF;CACA,OAAO,cAAqC,iBAAiB,aAAa,MAAM,IAAI,CAAC,CAAC,KAAK;;;;;CAK3F,MAAM,cAAoC,gBAAgB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;CACvF;CACA;CACA;;CAEA,WAAW,cACT,qBACA,aACM,MAAM,IAAI,CAAC,CAAC,SACpB;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,eAAe;CAC1B,MAAM;CACN,OAAO,SAAS;CAChB,SAAS,SAAS;CAClB,OAAO,SAAS;CAChB,QAAQ,SAAS;CACjB,YAAY,SAAS;CACrB,OAAO,SAAS;CAChB,MAAM,SAAS;CACf,YAAY,SAAS;CACrB,OAAO,SAAS;CAChB,YAAY,SAAS;CACrB,WAAW,SAAS;CACpB,MAAM,SAAS;CACf,OAAO,SAAS;CAChB,QAAQ,SAAS;AACnB"}
|
package/src/command.d.ts
CHANGED
|
@@ -1,89 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Changes, PartComponent, PartComponentProps } from "./runtime.js";
|
|
2
|
+
import { ChangeDetails } from "@kirana-ui/core";
|
|
3
|
+
import { CommandItemOptions, CommandProps } from "@kirana-ui/core/command";
|
|
4
|
+
export type RootProps = Omit<CommandProps, "id" | "onInputValueChange" | "onSelect"> & {
|
|
5
|
+
id?: string | undefined;
|
|
6
|
+
} & PartComponentProps;
|
|
7
|
+
export type RootEmits = Changes<"inputValue", string> & {
|
|
8
|
+
/** An item was chosen: its value. */
|
|
9
|
+
select: (value: string, details: ChangeDetails) => void;
|
|
10
|
+
};
|
|
11
|
+
export type EmptyProps = PartComponentProps;
|
|
12
|
+
export interface GroupProps extends PartComponentProps {
|
|
13
|
+
id?: string | undefined;
|
|
14
|
+
}
|
|
15
|
+
export type GroupHeadingProps = PartComponentProps;
|
|
16
|
+
export interface ItemProps extends Omit<CommandItemOptions, "id">, PartComponentProps {
|
|
17
|
+
/** What `@select` is told when this item is chosen. */
|
|
18
|
+
value: string;
|
|
19
|
+
id?: string | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface SeparatorProps extends PartComponentProps {
|
|
22
|
+
/** Keeps the line while something is typed. */
|
|
23
|
+
alwaysRender?: boolean | undefined;
|
|
24
|
+
}
|
|
25
|
+
export type InputProps = PartComponentProps;
|
|
26
|
+
export type ListProps = PartComponentProps;
|
|
3
27
|
export declare const Command: {
|
|
4
|
-
Root:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
default: undefined;
|
|
22
|
-
};
|
|
23
|
-
loop: BooleanConstructor;
|
|
24
|
-
disabled: BooleanConstructor;
|
|
25
|
-
id: StringConstructor;
|
|
26
|
-
}>> & Readonly<{
|
|
27
|
-
onInputValueChange?: ((...args: any[]) => any) | undefined;
|
|
28
|
-
onSelect?: ((...args: any[]) => any) | undefined;
|
|
29
|
-
"onUpdate:inputValue"?: ((...args: any[]) => any) | undefined;
|
|
30
|
-
}>, {
|
|
31
|
-
filter: ((label: string, query: string, keywords: readonly string[]) => boolean) | null | undefined;
|
|
32
|
-
loop: boolean;
|
|
33
|
-
disabled: boolean;
|
|
34
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
35
|
-
Input: import("vue").Component;
|
|
36
|
-
List: import("vue").Component;
|
|
37
|
-
Empty: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
38
|
-
[key: string]: any;
|
|
39
|
-
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
40
|
-
Group: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
41
|
-
id: StringConstructor;
|
|
42
|
-
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
43
|
-
[key: string]: any;
|
|
44
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
45
|
-
id: StringConstructor;
|
|
46
|
-
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
47
|
-
GroupHeading: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
48
|
-
[key: string]: any;
|
|
49
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
50
|
-
Item: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
51
|
-
value: {
|
|
52
|
-
type: StringConstructor;
|
|
53
|
-
required: true;
|
|
54
|
-
};
|
|
55
|
-
disabled: {
|
|
56
|
-
type: BooleanConstructor;
|
|
57
|
-
default: undefined;
|
|
58
|
-
};
|
|
59
|
-
label: StringConstructor;
|
|
60
|
-
keywords: PropType<readonly string[]>;
|
|
61
|
-
id: StringConstructor;
|
|
62
|
-
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
63
|
-
[key: string]: any;
|
|
64
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
65
|
-
value: {
|
|
66
|
-
type: StringConstructor;
|
|
67
|
-
required: true;
|
|
68
|
-
};
|
|
69
|
-
disabled: {
|
|
70
|
-
type: BooleanConstructor;
|
|
71
|
-
default: undefined;
|
|
72
|
-
};
|
|
73
|
-
label: StringConstructor;
|
|
74
|
-
keywords: PropType<readonly string[]>;
|
|
75
|
-
id: StringConstructor;
|
|
76
|
-
}>> & Readonly<{}>, {
|
|
77
|
-
disabled: boolean;
|
|
78
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
79
|
-
Separator: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
80
|
-
alwaysRender: BooleanConstructor;
|
|
81
|
-
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
82
|
-
[key: string]: any;
|
|
83
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
84
|
-
alwaysRender: BooleanConstructor;
|
|
85
|
-
}>> & Readonly<{}>, {
|
|
86
|
-
alwaysRender: boolean;
|
|
87
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
28
|
+
Root: PartComponent<"div", {
|
|
29
|
+
readonly disabled?: true | undefined;
|
|
30
|
+
}, RootProps, RootEmits>;
|
|
31
|
+
Input: PartComponent<"input", {
|
|
32
|
+
readonly disabled?: true | undefined;
|
|
33
|
+
}, PartComponentProps, {}, unknown>;
|
|
34
|
+
List: PartComponent<"div", {
|
|
35
|
+
readonly empty?: true | undefined;
|
|
36
|
+
}, PartComponentProps, {}, unknown>;
|
|
37
|
+
Empty: PartComponent<"div", Record<never, never>, PartComponentProps>;
|
|
38
|
+
Group: PartComponent<"div", Record<never, never>, GroupProps>;
|
|
39
|
+
GroupHeading: PartComponent<"div", Record<never, never>, PartComponentProps>;
|
|
40
|
+
Item: PartComponent<"div", {
|
|
41
|
+
readonly highlighted?: true | undefined;
|
|
42
|
+
readonly disabled?: true | undefined;
|
|
43
|
+
}, ItemProps>;
|
|
44
|
+
Separator: PartComponent<"div", Record<never, never>, SeparatorProps>;
|
|
88
45
|
};
|
|
89
46
|
//# sourceMappingURL=command.d.ts.map
|
package/src/command.js
CHANGED
|
@@ -17,6 +17,7 @@ const Root = defineComponent({
|
|
|
17
17
|
default: void 0
|
|
18
18
|
},
|
|
19
19
|
loop: Boolean,
|
|
20
|
+
autoHighlight: optional(Boolean),
|
|
20
21
|
disabled: Boolean,
|
|
21
22
|
id: String
|
|
22
23
|
},
|
|
@@ -33,6 +34,7 @@ const Root = defineComponent({
|
|
|
33
34
|
defaultInputValue: props.defaultInputValue,
|
|
34
35
|
filter: props.filter,
|
|
35
36
|
loop: props.loop,
|
|
37
|
+
autoHighlight: props.autoHighlight,
|
|
36
38
|
disabled: props.disabled,
|
|
37
39
|
onInputValueChange(value, details) {
|
|
38
40
|
emit("inputValueChange", value, details);
|
package/src/command.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","names":[],"sources":["../../../../packages/vue/src/command.ts"],"sourcesContent":["import type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createCommand } from \"@kirana-ui/core/command\"\nimport type {
|
|
1
|
+
{"version":3,"file":"command.js","names":[],"sources":["../../../../packages/vue/src/command.ts"],"sourcesContent":["import type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createCommand } from \"@kirana-ui/core/command\"\nimport type {\n CommandGroup,\n CommandItemOptions,\n CommandProps,\n Command as Controller,\n} from \"@kirana-ui/core/command\"\nimport { defineComponent, h, inject, provide, useId } from \"vue\"\nimport type { InjectionKey, PropType } from \"vue\"\n\nimport { context, controller, fromSignal, optional, partComponent, toSignal } from \"./runtime.ts\"\nimport type { Changes, PartComponent, PartComponentProps, StatesOf } from \"./runtime.ts\"\n\ntype State = StatesOf<\"command\">\n\nconst scope = context<Controller>(\"Command\")\nconst GROUP: InjectionKey<CommandGroup> = Symbol(\"CommandGroup\")\n\nconst RootElement = partComponent(\"CommandRootElement\", \"div\", () => scope.use().root)\n\nexport type RootProps = Omit<CommandProps, \"id\" | \"onInputValueChange\" | \"onSelect\"> & {\n id?: string | undefined\n} & PartComponentProps\n\nexport type RootEmits = Changes<\"inputValue\", string> & {\n /** An item was chosen: its value. */\n select: (value: string, details: ChangeDetails) => void\n}\n\n/** `v-model:inputValue`; `@select` hears the item chosen. */\nconst Root = defineComponent({\n name: \"CommandRoot\",\n inheritAttrs: false,\n props: {\n inputValue: String,\n defaultInputValue: String,\n filter: {\n type: null as unknown as PropType<CommandProps[\"filter\"]>,\n default: undefined,\n },\n loop: Boolean,\n autoHighlight: optional(Boolean),\n disabled: Boolean,\n id: String,\n },\n emits: [\"update:inputValue\", \"inputValueChange\", \"select\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n scope.provide(\n controller(createCommand, () => ({\n id: props.id ?? generated,\n inputValue: props.inputValue,\n defaultInputValue: props.defaultInputValue,\n filter: props.filter,\n loop: props.loop,\n autoHighlight: props.autoHighlight,\n disabled: props.disabled,\n onInputValueChange(value: string, details: ChangeDetails) {\n emit(\"inputValueChange\", value, details)\n if (!details.canceled) emit(\"update:inputValue\", value)\n },\n onSelect: (value: string, details: ChangeDetails) => emit(\"select\", value, details),\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"root\"], RootProps, RootEmits>\n\nconst EmptyElement = partComponent(\"CommandEmptyElement\", \"div\", () => scope.use().emptyPart)\n\nexport type EmptyProps = PartComponentProps\n\n/** Drawn while no item is shown for what was typed. */\nconst Empty = defineComponent({\n name: \"CommandEmpty\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const empty = fromSignal(scope.use().empty)\n return () => (empty.value ? h(EmptyElement, attrs, slots) : null)\n },\n}) as unknown as PartComponent<\"div\", State[\"empty\"], EmptyProps>\n\nexport interface GroupProps extends PartComponentProps {\n id?: string | undefined\n}\n\n/** Items under a `<Command.GroupHeading>`. Hidden while none of them is shown. */\nconst Group = defineComponent({\n name: \"CommandGroup\",\n inheritAttrs: false,\n props: { id: String },\n setup(props, { attrs, slots }) {\n const generated = useId()\n const group = scope.use().group(props.id ?? generated)\n provide(GROUP, group)\n const Element = partComponent(\"CommandGroupElement\", \"div\", () => group.part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"group\"], GroupProps>\n\nexport type GroupHeadingProps = PartComponentProps\n\nconst GroupHeading = defineComponent({\n name: \"CommandGroupHeading\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const part = inject(GROUP, undefined)?.heading ?? scope.use().heading\n const Element = partComponent(\"CommandGroupHeadingElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"groupHeading\"], GroupHeadingProps>\n\nexport interface ItemProps extends Omit<CommandItemOptions, \"id\">, PartComponentProps {\n /** What `@select` is told when this item is chosen. */\n value: string\n id?: string | undefined\n}\n\n/** `label` is what is filtered, the item's text when left out; `keywords` are other words for it. */\nconst Item = defineComponent({\n name: \"CommandItem\",\n inheritAttrs: false,\n props: {\n value: { type: String, required: true },\n disabled: optional(Boolean),\n label: String,\n keywords: Array as PropType<readonly string[]>,\n id: String,\n },\n setup(props, { attrs, slots }) {\n const generated = useId()\n const options = toSignal(() => ({\n disabled: props.disabled,\n label: props.label,\n keywords: props.keywords,\n id: props.id ?? generated,\n }))\n const part = scope.use().item(props.value, () => options.get(), inject(GROUP, undefined))\n const Element = partComponent(\"CommandItemElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"item\"], ItemProps>\n\nexport interface SeparatorProps extends PartComponentProps {\n /** Keeps the line while something is typed. */\n alwaysRender?: boolean | undefined\n}\n\n/** A line between groups: gone while something is typed, unless `always-render`. */\nconst Separator = defineComponent({\n name: \"CommandSeparator\",\n inheritAttrs: false,\n props: { alwaysRender: Boolean },\n setup(props, { attrs, slots }) {\n const options = toSignal(() => ({ alwaysRender: props.alwaysRender }))\n const part = scope.use().separator(() => options.get().alwaysRender)\n const Element = partComponent(\"CommandSeparatorElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"separator\"], SeparatorProps>\n\nexport type InputProps = PartComponentProps\nexport type ListProps = PartComponentProps\nexport const Command = {\n Root,\n Input: partComponent<\"input\", State[\"input\"]>(\"CommandInput\", \"input\", () => scope.use().input),\n List: partComponent<\"div\", State[\"list\"]>(\"CommandList\", \"div\", () => scope.use().list),\n Empty,\n Group,\n GroupHeading,\n Item,\n Separator,\n}\n"],"mappings":";;;;AAgBA,MAAM,QAAQ,QAAoB,SAAS;AAC3C,MAAM,QAAoC,OAAO,cAAc;AAE/D,MAAM,cAAc,cAAc,sBAAsB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;;AAYrF,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO;EACL,YAAY;EACZ,mBAAmB;EACnB,QAAQ;GACN,MAAM;GACN,SAAS,KAAA;EACX;EACA,MAAM;EACN,eAAe,SAAS,OAAO;EAC/B,UAAU;EACV,IAAI;CACN;CACA,OAAO;EAAC;EAAqB;EAAoB;CAAQ;CACzD,MAAM,OAAO,EAAE,OAAO,OAA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1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { PortalProps } from "./runtime.js";
|
|
2
|
+
import { PositionerProps } from "./popover.js";
|
|
3
|
+
import { ArrowProps, CheckboxItemEmits, CheckboxItemIndicatorProps, CheckboxItemProps, ContextMenu, ContextRootProps, ContextTriggerProps, GroupLabelProps, GroupProps, ItemProps, LinkItemProps, Menu, PopupProps, RadioGroupEmits, RadioGroupProps, RadioItemIndicatorProps, RadioItemProps, RootEmits, SeparatorProps, SubmenuRootEmits, SubmenuRootProps, SubmenuTriggerProps } from "./menu.js";
|
|
4
|
+
export { type ArrowProps, type CheckboxItemEmits, type CheckboxItemIndicatorProps, type CheckboxItemProps, ContextMenu, type ContextRootProps, type ContextTriggerProps, type GroupLabelProps, type GroupProps, type ItemProps, type LinkItemProps, type Menu, type PopupProps, type PortalProps, type PositionerProps, type RadioGroupEmits, type RadioGroupProps, type RadioItemIndicatorProps, type RadioItemProps, type RootEmits, type ContextRootProps as RootProps, type SeparatorProps, type SubmenuRootEmits, type SubmenuRootProps, type SubmenuTriggerProps, type ContextTriggerProps as TriggerProps };
|
package/src/date-field.d.ts
CHANGED
|
@@ -1,70 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Changes, PartComponent, PartComponentProps, PlainComponent } from "./runtime.js";
|
|
2
2
|
import { DateField as DateField$1, DateFieldProps, DateFieldSegment } from "@kirana-ui/core/date-field";
|
|
3
|
+
/**
|
|
4
|
+
* The date field its parts are inside. Exported for a component that is made of one (a date picker
|
|
5
|
+
* provides its own to the date field's parts).
|
|
6
|
+
*/
|
|
3
7
|
declare const scope: {
|
|
4
8
|
provide(controller: DateField$1): DateField$1;
|
|
5
9
|
use(): DateField$1;
|
|
6
10
|
};
|
|
11
|
+
export type RootProps = Omit<DateFieldProps, "id" | "onValueChange"> & {
|
|
12
|
+
id?: string | undefined;
|
|
13
|
+
} & PartComponentProps;
|
|
14
|
+
/** The value is `null` while the date is not whole. */
|
|
15
|
+
export type RootEmits = Changes<"value", string | null>;
|
|
16
|
+
export type SegmentsProps = Record<never, never>;
|
|
17
|
+
export interface SegmentProps extends PartComponentProps {
|
|
18
|
+
/** The piece it draws, as `DateField.Segments` gives it. */
|
|
19
|
+
segment: DateFieldSegment;
|
|
20
|
+
}
|
|
21
|
+
export type InputProps = PartComponentProps;
|
|
7
22
|
export declare const DateField: {
|
|
8
|
-
Root:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
id: StringConstructor;
|
|
24
|
-
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
25
|
-
[key: string]: any;
|
|
26
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "valueChange")[], "update:value" | "valueChange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
27
|
-
value: {
|
|
28
|
-
type: PropType<string | null>;
|
|
29
|
-
default: undefined;
|
|
30
|
-
};
|
|
31
|
-
defaultValue: PropType<string | null>;
|
|
32
|
-
locale: StringConstructor;
|
|
33
|
-
min: StringConstructor;
|
|
34
|
-
max: StringConstructor;
|
|
35
|
-
placeholders: PropType<DateFieldProps["placeholders"]>;
|
|
36
|
-
disabled: BooleanConstructor;
|
|
37
|
-
readOnly: BooleanConstructor;
|
|
38
|
-
required: BooleanConstructor;
|
|
39
|
-
name: StringConstructor;
|
|
40
|
-
form: StringConstructor;
|
|
41
|
-
id: StringConstructor;
|
|
42
|
-
}>> & Readonly<{
|
|
43
|
-
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
44
|
-
onValueChange?: ((...args: any[]) => any) | undefined;
|
|
45
|
-
}>, {
|
|
46
|
-
value: string | null;
|
|
47
|
-
disabled: boolean;
|
|
48
|
-
readOnly: boolean;
|
|
49
|
-
required: boolean;
|
|
50
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
51
|
-
Segments: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
52
|
-
[key: string]: any;
|
|
53
|
-
}>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
54
|
-
Segment: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
55
|
-
segment: {
|
|
56
|
-
type: PropType<DateFieldSegment>;
|
|
57
|
-
required: true;
|
|
58
|
-
};
|
|
59
|
-
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
60
|
-
[key: string]: any;
|
|
61
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
62
|
-
segment: {
|
|
63
|
-
type: PropType<DateFieldSegment>;
|
|
64
|
-
required: true;
|
|
65
|
-
};
|
|
66
|
-
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
67
|
-
Input: import("vue").Component;
|
|
23
|
+
Root: PartComponent<"div", {
|
|
24
|
+
readonly disabled?: true | undefined;
|
|
25
|
+
readonly readonly?: true | undefined;
|
|
26
|
+
readonly invalid?: true | undefined;
|
|
27
|
+
}, RootProps, RootEmits>;
|
|
28
|
+
Segments: PlainComponent<SegmentsProps, {}, {
|
|
29
|
+
segment: DateFieldSegment;
|
|
30
|
+
}>;
|
|
31
|
+
Segment: PartComponent<"span", {
|
|
32
|
+
readonly segment?: "day" | "literal" | "month" | "year" | undefined;
|
|
33
|
+
readonly placeholder?: true | undefined;
|
|
34
|
+
readonly disabled?: true | undefined;
|
|
35
|
+
readonly invalid?: true | undefined;
|
|
36
|
+
}, SegmentProps>;
|
|
37
|
+
Input: PartComponent<"input", Record<never, never>, PartComponentProps, {}, unknown>;
|
|
68
38
|
};
|
|
69
39
|
export { scope as dateFieldScope };
|
|
70
40
|
//# sourceMappingURL=date-field.d.ts.map
|
package/src/date-field.js
CHANGED
|
@@ -4,6 +4,10 @@ import { within } from "@kirana-ui/core";
|
|
|
4
4
|
import { Fragment, defineComponent, h, useId } from "vue";
|
|
5
5
|
import { createDateField } from "@kirana-ui/core/date-field";
|
|
6
6
|
// src/date-field.ts
|
|
7
|
+
/**
|
|
8
|
+
* The date field its parts are inside. Exported for a component that is made of one (a date picker
|
|
9
|
+
* provides its own to the date field's parts).
|
|
10
|
+
*/
|
|
7
11
|
const scope = context("DateField");
|
|
8
12
|
const RootElement = partComponent("DateFieldRootElement", "div", () => scope.use().root);
|
|
9
13
|
const DateField = {
|
|
@@ -63,11 +67,11 @@ const DateField = {
|
|
|
63
67
|
type: Object,
|
|
64
68
|
required: true
|
|
65
69
|
} },
|
|
66
|
-
setup(props, { attrs }) {
|
|
70
|
+
setup(props, { attrs, slots }) {
|
|
67
71
|
const { part, text } = scope.use().segment(props.segment);
|
|
68
72
|
const shown = fromSignal(text);
|
|
69
|
-
const Element = partComponent("DateFieldSegmentElement", "span", () => part);
|
|
70
|
-
return () => h(Element, attrs,
|
|
73
|
+
const Element = partComponent("DateFieldSegmentElement", "span", () => part, (content, composed) => composed && content != null && content.length > 0 ? content : [shown.value]);
|
|
74
|
+
return () => h(Element, attrs, slots);
|
|
71
75
|
}
|
|
72
76
|
}),
|
|
73
77
|
Input: partComponent("DateFieldInput", "input", () => scope.use().input)
|
package/src/date-field.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-field.js","names":[],"sources":["../../../../packages/vue/src/date-field.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createDateField } from \"@kirana-ui/core/date-field\"\nimport type {\n DateField as Controller,\n DateFieldProps,\n DateFieldSegment,\n} from \"@kirana-ui/core/date-field\"\nimport { Fragment, defineComponent, h, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { context, controller, fromSignal, optional, partComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"DateField\")\n/** For a component made of this one's parts: a date picker. */\nexport { scope as dateFieldScope }\n\nconst RootElement = partComponent(\"DateFieldRootElement\", \"div\", () => scope.use().root)\n\n/** `v-model:value`, and `@value-change=\"(value, details) => …\"`. */\nconst Root = defineComponent({\n name: \"DateFieldRoot\",\n inheritAttrs: false,\n props: {\n value: optional([String, null] as unknown as PropType<string | null>),\n defaultValue: String as PropType<string | null>,\n locale: String,\n min: String,\n max: String,\n placeholders: Object as PropType<DateFieldProps[\"placeholders\"]>,\n disabled: Boolean,\n readOnly: Boolean,\n required: Boolean,\n name: String,\n form: String,\n id: String,\n },\n emits: [\"update:value\", \"valueChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const direction = useDirectionAround()\n scope.provide(\n controller(within(createDateField, { direction }), () => ({\n id: props.id ?? generated,\n value: props.value,\n defaultValue: props.defaultValue,\n locale: props.locale,\n min: props.min,\n max: props.max,\n placeholders: props.placeholders,\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n name: props.name,\n form: props.form,\n onValueChange(value: string | null, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n})\n\n/** Its slot once for each piece of the date, in the locale's order: `v-slot=\"{ segment }\"`. */\nconst Segments = defineComponent({\n name: \"DateFieldSegments\",\n setup(_, { slots }) {\n const segments = fromSignal(scope.use().segments)\n return () =>\n segments.value.map((segment) =>\n h(Fragment, { key: `${segment.index}-${segment.type}` }, slots.default?.({ segment }))\n )\n },\n})\n\n/** One piece: a part that is typed, or what stands between two. It writes its own text. */\nconst Segment = defineComponent({\n name: \"DateFieldSegment\",\n inheritAttrs: false,\n props: { segment: { type: Object as PropType<DateFieldSegment>, required: true } },\n setup(props, { attrs }) {\n const { part, text } = scope.use().segment(props.segment)\n const shown = fromSignal(text)\n const Element = partComponent(\"DateFieldSegmentElement\"
|
|
1
|
+
{"version":3,"file":"date-field.js","names":[],"sources":["../../../../packages/vue/src/date-field.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createDateField } from \"@kirana-ui/core/date-field\"\nimport type {\n DateField as Controller,\n DateFieldProps,\n DateFieldSegment,\n} from \"@kirana-ui/core/date-field\"\nimport { Fragment, defineComponent, h, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { context, controller, fromSignal, optional, partComponent } from \"./runtime.ts\"\nimport type {\n Changes,\n PartComponent,\n PartComponentProps,\n PlainComponent,\n StatesOf,\n} from \"./runtime.ts\"\n\ntype State = StatesOf<\"dateField\">\n\n/**\n * The date field its parts are inside. Exported for a component that is made of one (a date picker\n * provides its own to the date field's parts).\n */\nconst scope = context<Controller>(\"DateField\")\n/** For a component made of this one's parts: a date picker. */\nexport { scope as dateFieldScope }\n\nconst RootElement = partComponent(\"DateFieldRootElement\", \"div\", () => scope.use().root)\n\nexport type RootProps = Omit<DateFieldProps, \"id\" | \"onValueChange\"> & {\n id?: string | undefined\n} & PartComponentProps\n\n/** The value is `null` while the date is not whole. */\nexport type RootEmits = Changes<\"value\", string | null>\n\n/** `v-model:value`, and `@value-change=\"(value, details) => …\"`. */\nconst Root = defineComponent({\n name: \"DateFieldRoot\",\n inheritAttrs: false,\n props: {\n value: optional([String, null] as unknown as PropType<string | null>),\n defaultValue: String as PropType<string | null>,\n locale: String,\n min: String,\n max: String,\n placeholders: Object as PropType<DateFieldProps[\"placeholders\"]>,\n disabled: Boolean,\n readOnly: Boolean,\n required: Boolean,\n name: String,\n form: String,\n id: String,\n },\n emits: [\"update:value\", \"valueChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const direction = useDirectionAround()\n scope.provide(\n controller(within(createDateField, { direction }), () => ({\n id: props.id ?? generated,\n value: props.value,\n defaultValue: props.defaultValue,\n locale: props.locale,\n min: props.min,\n max: props.max,\n placeholders: props.placeholders,\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n name: props.name,\n form: props.form,\n onValueChange(value: string | null, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"root\"], RootProps, RootEmits>\n\nexport type SegmentsProps = Record<never, never>\n\n/** Its slot once for each piece of the date, in the locale's order: `v-slot=\"{ segment }\"`. */\nconst Segments = defineComponent({\n name: \"DateFieldSegments\",\n setup(_, { slots }) {\n const segments = fromSignal(scope.use().segments)\n return () =>\n segments.value.map((segment) =>\n h(Fragment, { key: `${segment.index}-${segment.type}` }, slots.default?.({ segment }))\n )\n },\n}) as unknown as PlainComponent<SegmentsProps, {}, { segment: DateFieldSegment }>\n\nexport interface SegmentProps extends PartComponentProps {\n /** The piece it draws, as `DateField.Segments` gives it. */\n segment: DateFieldSegment\n}\n\n/** One piece: a part that is typed, or what stands between two. It writes its own text. */\nconst Segment = defineComponent({\n name: \"DateFieldSegment\",\n inheritAttrs: false,\n props: { segment: { type: Object as PropType<DateFieldSegment>, required: true } },\n setup(props, { attrs, slots }) {\n const { part, text } = scope.use().segment(props.segment)\n const shown = fromSignal(text)\n // Its text is the field's to write, whatever its slot holds: with `as-child` the slot is\n // the caller's element, which holds the text unless it writes its own.\n const Element = partComponent(\n \"DateFieldSegmentElement\",\n \"span\",\n () => part,\n (content, composed) =>\n composed && content != null && content.length > 0 ? content : [shown.value]\n )\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"span\", State[\"segment\"], SegmentProps>\n\nexport type InputProps = PartComponentProps\nconst Input = partComponent<\"input\", State[\"input\"]>(\n \"DateFieldInput\",\n \"input\",\n () => scope.use().input\n)\n\nexport const DateField = { Root, Segments, Segment, Input }\n"],"mappings":";;;;;;;;;;AA2BA,MAAM,QAAQ,QAAoB,WAAW;AAI7C,MAAM,cAAc,cAAc,wBAAwB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;AAsGvF,MAAa,YAAY;CAAE,MA5Fd,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO;GACL,OAAO,SAAS,CAAC,QAAQ,IAAI,CAAuC;GACpE,cAAc;GACd,QAAQ;GACR,KAAK;GACL,KAAK;GACL,cAAc;GACd,UAAU;GACV,UAAU;GACV,UAAU;GACV,MAAM;GACN,MAAM;GACN,IAAI;EACN;EACA,OAAO,CAAC,gBAAgB,aAAa;EACrC,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;GACnC,MAAM,YAAY,MAAM;GACxB,MAAM,YAAY,mBAAmB;GACrC,MAAM,QACJ,WAAW,OAAO,iBAAiB,EAAE,UAAU,CAAC,UAAU;IACxD,IAAI,MAAM,MAAM;IAChB,OAAO,MAAM;IACb,cAAc,MAAM;IACpB,QAAQ,MAAM;IACd,KAAK,MAAM;IACX,KAAK,MAAM;IACX,cAAc,MAAM;IACpB,UAAU,MAAM;IAChB,UAAU,MAAM;IAChB,UAAU,MAAM;IAChB,MAAM,MAAM;IACZ,MAAM,MAAM;IACZ,cAAc,OAAsB,SAAwB;KAC1D,KAAK,eAAe,OAAO,OAAO;KAClC,IAAI,CAAC,QAAQ,UAAU,KAAK,gBAAgB,KAAK;IACnD;GACF,EAAE,CACJ;GACA,aAAa,EAAE,aAAa,OAAO,KAAK;EAC1C;CACF,CAiD2B;CAAM,UA5ChB,gBAAgB;EAC/B,MAAM;EACN,MAAM,GAAG,EAAE,SAAS;GAClB,MAAM,WAAW,WAAW,MAAM,IAAI,CAA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