@formkit/pro 0.109.0-eb2057e

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.
@@ -0,0 +1,60 @@
1
+ import { defaultIcon } from '@formkit/inputs'
2
+ import rate from '../features/rate'
3
+ import { FormKitProInput } from '@formkit/pro'
4
+ import {
5
+ outer,
6
+ wrapper,
7
+ label,
8
+ inner,
9
+ onItems,
10
+ offItems,
11
+ onItem,
12
+ offItem,
13
+ input,
14
+ itemsWrapper,
15
+ help,
16
+ messages,
17
+ message,
18
+ icon,
19
+ prefix,
20
+ suffix,
21
+ } from '../sections/ratingSections'
22
+
23
+ /**
24
+ * Input definition for a rating input.
25
+ * @public
26
+ */
27
+ export const rating: FormKitProInput = {
28
+ /**
29
+ * The actual schema of the input, or a function that returns the schema.
30
+ */
31
+ schema: outer(
32
+ wrapper(
33
+ label('$label'),
34
+ inner(
35
+ icon('prefix'),
36
+ prefix(),
37
+ itemsWrapper(onItems(onItem()), offItems(offItem())),
38
+ input(),
39
+ suffix(),
40
+ icon('suffix')
41
+ )
42
+ ),
43
+ help('$help'),
44
+ messages(message('$message'))
45
+ ),
46
+ /**
47
+ * The type of node, can be a list, group, or input.
48
+ */
49
+ type: 'input',
50
+ /**
51
+ * An array of extra props to accept for this input.
52
+ */
53
+ props: [],
54
+ /**
55
+ * Additional features that make this input work.
56
+ */
57
+ features: [rate, defaultIcon('rating', 'star')],
58
+ }
59
+
60
+ export default rating
@@ -0,0 +1 @@
1
+ import{createSectionFactory as e,createBaseSections as t}from"../index.mjs";const o=e("rp"),{outer:i,inner:n,prefix:l,suffix:$,help:r,messages:d,message:s,icon:a}=t(o),m=o("insertControl",(()=>({$el:"button",attrs:{disabled:"$value.length >= $max",onClick:"$fns.createInsert($item.__key)",type:"button"}}))),u=o("addButton",(()=>({$formkit:"button",bind:"$addAttrs",if:"$addButton",disabled:"$value.length >= $max",onClick:"$fns.createAppend()",type:"button"}))),f=o("removeControl",(()=>({$el:"button",attrs:{disabled:"$value.length <= $min",onClick:"$fns.createRemover($item.__key)",type:"button"}}))),b=o("items",(()=>({$el:"ul",attrs:{role:"list"}}))),p=o("item",(()=>({$el:"li",for:["item","index","$value"],if:"$item.__key",attrs:{role:"listitem",key:"$item.__key","data-index":"$item.__index"}}))),_=o("downControl",(()=>({$el:"button",attrs:{disabled:"$index >= $value.length - 1",onClick:"$fns.createShift($item.__key, 1)",type:"button"}}))),C=o("upControl",(()=>({$el:"button",attrs:{disabled:"$index <= 0",onClick:"$fns.createShift($item.__key, -1)",type:"button"}}))),c=o("content","div"),k=o("fieldset",(()=>({$el:"fieldset",attrs:{id:"$id",disabled:"$disabled"}}))),y=o("legend",(()=>({$el:"legend",if:"$label"}))),x=o("group",(()=>({$formkit:"group",id:"$item.__key",index:"$item.__index"}))),v=o("controls",(()=>({$el:"ul",if:"$removeControl || $insertControl || $upControl || $downControl"}))),g=o("remove",(()=>({$el:"li",if:"$removeControl"}))),h=o("insert",(()=>({$el:"li",if:"$insertControl"}))),w=o("up",(()=>({$el:"li",if:"$upControl"}))),A=o("down",(()=>({$el:"li",if:"$downControl"}))),B=o("controlLabel","span");export{u as addButton,c as content,B as controlLabel,v as controls,o as createSection,A as down,_ as downControl,k as fieldset,x as group,r as help,a as icon,n as inner,h as insert,m as insertControl,p as item,b as items,y as legend,s as message,d as messages,i as outer,l as prefix,g as remove,f as removeControl,$ as suffix,w as up,C as upControl};
@@ -0,0 +1,112 @@
1
+ import { FormKitProInput } from '@formkit/pro'
2
+ import {
3
+ outer,
4
+ fieldset,
5
+ legend,
6
+ inner,
7
+ prefix,
8
+ items,
9
+ item,
10
+ icon,
11
+ content,
12
+ group,
13
+ controls,
14
+ remove,
15
+ removeControl,
16
+ insert,
17
+ insertControl,
18
+ addButton,
19
+ up,
20
+ upControl,
21
+ down,
22
+ downControl,
23
+ suffix,
24
+ help,
25
+ messages,
26
+ message,
27
+ controlLabel,
28
+ } from '../sections/repeaterSections'
29
+ import repeats from '../features/repeats'
30
+ import { localize, defaultIcon } from '@formkit/inputs'
31
+ import { $if } from '../compose'
32
+
33
+ /**
34
+ * Input definition for a repeater input.
35
+ * @public
36
+ */
37
+ export const repeater: FormKitProInput = {
38
+ /**
39
+ * The actual schema of the input, or a function that returns the schema.
40
+ */
41
+ schema: outer(
42
+ fieldset(
43
+ legend('$label'),
44
+ help('$help'),
45
+ inner(
46
+ prefix(),
47
+ $if(
48
+ '$slots.default',
49
+ items(
50
+ item(
51
+ content(group('$slots.default')),
52
+ controls(
53
+ up(upControl(controlLabel('$ui.moveUp.value'), icon('moveUp'))),
54
+ remove(
55
+ removeControl(
56
+ controlLabel('$ui.remove.value'),
57
+ icon('remove')
58
+ )
59
+ ),
60
+ insert(
61
+ insertControl(controlLabel('$ui.add.value'), icon('add'))
62
+ ),
63
+ down(
64
+ downControl(
65
+ controlLabel('$ui.moveDown.value'),
66
+ icon('moveDown')
67
+ )
68
+ )
69
+ )
70
+ )
71
+ )
72
+ ),
73
+ suffix()
74
+ ),
75
+ addButton('$addLabel || ($ui.add.value + " " + ($label || ""))')
76
+ ),
77
+ messages(message('$message.value'))
78
+ ),
79
+ /**
80
+ * The type of node, can be a list, group, or input.
81
+ */
82
+ type: 'list',
83
+ /**
84
+ * An array of extra props to accept for this input.
85
+ */
86
+ props: [
87
+ 'min',
88
+ 'max',
89
+ 'total',
90
+ 'upControl',
91
+ 'downControl',
92
+ 'removeControl',
93
+ 'insertControl',
94
+ 'addLabel',
95
+ 'addButton',
96
+ 'addAttrs',
97
+ ],
98
+ /**
99
+ * Additional features that make this input work.
100
+ */
101
+ features: [
102
+ repeats,
103
+ localize('remove'),
104
+ localize('add'),
105
+ localize('moveUp'),
106
+ localize('moveDown'),
107
+ defaultIcon('remove', 'trash'),
108
+ defaultIcon('add', 'add'),
109
+ defaultIcon('moveUp', 'arrowUp'),
110
+ defaultIcon('moveDown', 'arrowDown'),
111
+ ],
112
+ }
@@ -0,0 +1 @@
1
+ import{$if as e,createSectionFactory as t,createBaseSections as a}from"../index.mjs";import{icon as i}from"@formkit/inputs";const o=(e,t)=>()=>i(e,t),n=t("tl"),{outer:d,wrapper:l,inner:s,icon:r,label:$,prefix:p,suffix:c,help:u,messages:b,message:x}=a(n),v=n("input",(()=>({$el:"input",bind:"$attrs",attrs:{id:"$id",type:"text",onClick:"$handlers.click",onBlur:"$handlers.blur",onKeydown:"$handlers.keydown",onInput:"$handlers.input",onFocus:"$handlers.focus",value:"$inputText",tabindex:"0",placeholder:"$isLoadingOption && $ui.isLoading.value || $placeholder || undefined",role:"combobox",autocomplete:"off",autocapitalize:"none",readonly:"$attrs.readonly || $isLoadingOption || undefined || $multiple && $max && $value && $value.length >= $max",disabled:"$disabled || undefined",onTouchmove:"$handlers.touchmove",onTouchstart:"$handlers.touchmove",onTouchend:"$handlers.touchend","aria-autocomplete":"list","aria-expanded":"$expanded","aria-controls":'$expanded && $id + "_listbox" || undefined',"aria-describedBy":"$describedBy","aria-activedescendant":"$expanded && $activeDescendant || undefined"}}))),f=n("listboxButton",(()=>({$el:"button",attrs:{style:"$visibilityStyles",id:'$id + "_listbox_button"',type:"button",onClick:"$handlers.toggleListbox",tabindex:"-1",disabled:"$disabled || undefined","aria-haspopup":"true","aria-expanded":"$expanded","aria-controls":'$expanded && $id + "_listbox" || undefined'}}))),m=n("tagWrapper",(()=>({$el:"span",for:["option","index","$selections"],attrs:{id:'$id + "_tag-wrapper_" + $index',key:"$option.value","data-value":"$option.value",tabindex:"-1",onClick:"$handlers.selectTag($option)"}}))),g=n("tag",(()=>({$el:"div",attrs:{id:'$id + "_tag_" + $index',role:"button"}}))),h=n("removeSelection",(()=>({$el:"button",if:"$_value !== undefined",attrs:{id:'$id + "_remove_selection_" + $index',tabindex:"-1",type:"button",onClick:"$disabled !== true && $handlers.removeSelection($option)","aria-controls":"$id"}}))),y=n("tagLabel",(()=>({$el:"span"}))),_=n("tags",(()=>({$el:"div",attrs:{id:'$id + "_selections"',"aria-live":"polite",onKeydown:"$handlers.keydown"}}))),k=n("tagLoading","span"),w=function(t){const a=t("dropdownWrapper",(()=>({$el:"div",attrs:{id:'$id + "_dropdown_wrapper"',"data-is-wrapper":!0,style:"$dropdownWrapperStyles",onScroll:"$handlers.scroll"}}))),i=t("listbox",(()=>({$el:"ul",if:"$expanded || $forceExpanded",attrs:{style:"$listboxStyles",id:'$id + "_listbox"',role:"listbox","aria-activedescendant":"$activeDescendant"}}))),n=t("listitem",(()=>({$el:"li",for:["option","index","$options"],bind:"$option.attrs",attrs:{id:'$id + "_listitem_" + $index',"data-disabled":"$option.attrs.disabled","data-value":"$option.value",key:"$option.value",onClick:"$handlers.selectOption($option)",role:"option","aria-selected":"$fns.isSelected($option)","data-is-active":"$fns.isActive($option)"}}))),d=t("loadMore",(()=>({$el:"li",if:"$state.loading || $state.hasNextPage",attrs:{id:'$id + "_load_more"',key:"loadMore",role:"option",onClick:"$handlers.loadMoreSelected","aria-selected":"false","data-is-active":"$fns.isActive($loadMoreOption)"}}))),l=t("loadMoreInner","span"),s=t("emptyMessage",(()=>({$el:"li",if:"$showEmptyMessage && $state.loading !== true",attrs:{id:'$id + "_empty_message"',key:"$emptyMessage",role:"presentation"}}))),r=t("emptyMessageInner","span"),$=t("option",(()=>({$el:"div",attrs:{"data-checked":"$fns.isSelected($option)"}})));return()=>a(i(s(r("$emptyMessage")),n(e("$fns.isSelected($option)",o("selected")),$("$option.label")),d(l(e("$state.loading",o("loader")),"$state.loading && $ui.isLoading.value || $ui.loadMore.value"))))}(n);export{n as createSection,u as help,r as icon,s as inner,v as input,$ as label,w as listbox,f as listboxButton,x as message,b as messages,d as outer,p as prefix,h as removeSelection,c as suffix,g as tag,y as tagLabel,k as tagLoading,m as tagWrapper,_ as tags,l as wrapper};
@@ -0,0 +1,102 @@
1
+ import { default as dropdownFeature } from '../features/dropdown'
2
+ import { default as autocompleteFeature } from '../features/autocompletes'
3
+ import { default as taglistFeature } from '../features/taglist'
4
+ import {
5
+ dropdownKeyHandler,
6
+ dropdownDisplayHandler,
7
+ setSelectedOption,
8
+ } from '../features/dropdownFeatures'
9
+ import { getSelections } from '../features/taglistFeatures'
10
+ import { options, defaultIcon, localize } from '@formkit/inputs'
11
+ import { FormKitProInput } from '@formkit/pro'
12
+ import {
13
+ outer,
14
+ wrapper,
15
+ inner,
16
+ label,
17
+ prefix,
18
+ tag,
19
+ tagWrapper,
20
+ tagLoading,
21
+ suffix,
22
+ help,
23
+ messages,
24
+ message,
25
+ listbox,
26
+ icon,
27
+ input,
28
+ listboxButton,
29
+ tags,
30
+ tagLabel,
31
+ removeSelection,
32
+ } from '../sections/taglistSections'
33
+ import { $if } from '../compose'
34
+
35
+ /**
36
+ * Input definition for a taglist input.
37
+ * @public
38
+ */
39
+ export const taglist: FormKitProInput = {
40
+ /**
41
+ * The actual schema of the input, or a function that returns the schema.
42
+ */
43
+ schema: outer(
44
+ wrapper(
45
+ label('$label'),
46
+ inner(
47
+ icon('prefix'),
48
+ prefix(),
49
+ tags(
50
+ tagWrapper(
51
+ tag(
52
+ $if(
53
+ '$state.loading',
54
+ tagLoading('$ui.isLoading.value'),
55
+ tagLabel('$option.label')
56
+ ),
57
+ removeSelection(icon('close'))
58
+ )
59
+ ),
60
+ input()
61
+ ),
62
+ $if('$state.loading', icon('loader')),
63
+ listboxButton(icon('select')),
64
+ listbox(),
65
+ suffix(),
66
+ icon('suffix')
67
+ )
68
+ ),
69
+ help('$help'),
70
+ messages(message('$message.value'))
71
+ ),
72
+ /**
73
+ * The type of node, can be a list, group, or input.
74
+ */
75
+ type: 'input',
76
+ /**
77
+ * In the dropdown family of inputs.
78
+ */
79
+ family: 'dropdown',
80
+ /**
81
+ * An array of extra props to accept for this input.
82
+ */
83
+ props: [],
84
+ /**
85
+ * Additional features that make this input work.
86
+ */
87
+ features: [
88
+ options,
89
+ taglistFeature,
90
+ dropdownFeature(
91
+ dropdownKeyHandler,
92
+ dropdownDisplayHandler(getSelections, setSelectedOption)
93
+ ),
94
+ autocompleteFeature(getSelections),
95
+ defaultIcon('select', 'select'),
96
+ defaultIcon('close', 'close'),
97
+ defaultIcon('selected', 'check'),
98
+ defaultIcon('loader', 'spinner'),
99
+ localize('isLoading'),
100
+ localize('loadMore'),
101
+ ],
102
+ }
@@ -0,0 +1 @@
1
+ import{createSectionFactory as e,createBaseSections as l,$if as a}from"../index.mjs";const o=e("tg"),{outer:$,wrapper:t,label:i,prefix:n,suffix:r,help:b,messages:f,message:u,icon:d}=l(o),s=o("input",(()=>({$el:"input",bind:"$attrs",attrs:{type:"checkbox",id:"$id",value:"$_value",checked:"$checked",onInput:"$handlers.toggles",onBlur:"$handlers.blur",disabled:"$disabled"}}))),c=o("label",(()=>({if:"($label && $onValueLabel === undefined && $offValueLabel === undefined) || ($valueLabelDisplay === inner) && $altLabelPosition !== true",$el:"label",attrs:{for:"$id"},children:"$label"}))),h=o("altLabel",(()=>({$el:"label",if:"($label && ($onValueLabel || $offValueLabel) && $valueLabelDisplay !== hidden && $valueLabelDisplay !== inner) || $altLabelPosition === true",attrs:{for:"$id","data-label-alt":"true",style:{color:{if:"$checked",then:"$valueLabelColorOn",else:"$valueLabelColorOff"}}},children:"$label"}))),L=o("innerLabel",(()=>({$el:"div",if:"$valueLabelDisplay === inner && ($checked && $onValueLabel || $offValueLabel)",attrs:{style:{color:{if:"$checked",then:"$valueLabelColorOn",else:"$valueLabelColorOff"}}},children:{if:"$checked",then:"$onValueLabel",else:"$offValueLabel"}}))),k=o("valueLabel",(()=>({$el:"label",if:"$valueLabelDisplay !== hidden && $valueLabelDisplay !== inner && (($checked === true && $onValueLabel) || ($checked === false && $offValueLabel))",attrs:{for:"$id"},children:{if:"$checked && $onValueLabel",then:"$onValueLabel",else:{if:"$offValueLabel",then:"$offValueLabel"}}}))),p=o("inner",(()=>({$el:"label",attrs:{for:"$id",id:"$id + '_label'"}}))),v=o("track",(()=>({$el:"div",attrs:{style:{backgroundColor:{if:"$checked",then:"$trackColorOn",else:"$trackColorOff"}}}}))),V=o("thumb",(()=>({$el:"div",attrs:{style:{color:{if:"$checked",then:"$iconColorOn",else:"$iconColorOff"},backgroundColor:{if:"$checked",then:"$thumbColorOn",else:"$thumbColorOff"}}}}))),C=()=>V(a("$slots.default","$slots.default",d("thumb")));export{h as altLabel,o as createSection,c as defaultLabel,b as help,d as icon,p as inner,L as innerLabel,s as input,i as label,u as message,f as messages,$ as outer,n as prefix,r as suffix,C as thumbWrapper,v as track,k as valueLabel,t as wrapper};
@@ -0,0 +1,69 @@
1
+ import { FormKitProInput } from '@formkit/pro'
2
+ import {
3
+ outer,
4
+ wrapper,
5
+ inner,
6
+ prefix,
7
+ input,
8
+ track,
9
+ suffix,
10
+ help,
11
+ messages,
12
+ message,
13
+ thumbWrapper,
14
+ defaultLabel,
15
+ altLabel,
16
+ innerLabel,
17
+ valueLabel,
18
+ } from '../sections/toggleSections'
19
+ import toggles from '../features/toggles'
20
+
21
+ /**
22
+ * Input definition for a toggle input.
23
+ * @public
24
+ */
25
+ export const toggle: FormKitProInput = {
26
+ /**
27
+ * The actual schema of the input, or a function that returns the schema.
28
+ */
29
+ schema: outer(
30
+ wrapper(
31
+ altLabel(),
32
+ inner(prefix(), input(), track(innerLabel(), thumbWrapper()), suffix()),
33
+ valueLabel(),
34
+ defaultLabel()
35
+ ),
36
+ help('$help'),
37
+ messages(message('$message.value'))
38
+ ),
39
+ /**
40
+ * The type of node, can be a list, group, or input.
41
+ */
42
+ type: 'input',
43
+ /**
44
+ * An array of extra props to accept for this input.
45
+ */
46
+ props: [
47
+ 'checked',
48
+ 'thumbColorOff',
49
+ 'thumbColorOn',
50
+ 'iconColorOff',
51
+ 'iconColorOn',
52
+ 'valueLabelColorOff',
53
+ 'valueLabelColorOn',
54
+ 'offValue',
55
+ 'offValueLabel',
56
+ 'onValue',
57
+ 'onValueLabel',
58
+ 'thumbIcon',
59
+ 'trackColorOff',
60
+ 'trackColorOn',
61
+ 'valueLabelDisplay',
62
+ 'altLabelPosition',
63
+ ],
64
+
65
+ /**
66
+ * Additional features that make this input work.
67
+ */
68
+ features: [toggles],
69
+ }
@@ -0,0 +1 @@
1
+ import{createSectionFactory as e,createBaseSections as s}from"../index.mjs";const t=e("tf"),{outer:a,wrapper:r,inner:l,icon:i,prefix:o,suffix:n,help:d,messages:$,message:c}=s(t),u=t("fieldset",(()=>({$el:"fieldset",attrs:{id:'$id + "_fieldset"',role:"presentation","aria-describedby":{if:"$help",then:'$: "help-" + $id',else:void 0}}}))),f=t("legend",(()=>({if:"$label",$el:"legend"}))),p=t("area",(()=>({$el:"div",attrs:{id:'$id + "_area"'}}))),_=t("source",(()=>({$el:"div",attrs:{id:'$id + "_source"',class:'$classes.transferlist + " " + $classes.source'}}))),g=t("sourceHeader",(()=>({$el:"div",attrs:{id:'$id + "_source_header"',role:"presentation",class:'$classes.transferlistHeader + " " + $classes.sourceHeader'}}))),h=t("sourceHeaderLabel",(()=>({if:"$sourceLabel",$el:"label",attrs:{id:'$id + "_source_header_label"',for:'$id + "_source_search_input"',class:'$classes.transferlistHeaderLabel + " " + $classes.sourceHeaderLabel'},children:"$sourceLabel || $label"}))),b=t("sourceHeaderItemCount",(()=>({$el:"span",attrs:{id:'$id + "_source_header_item_count"',role:"presentation","aria-label":'$fns.getOptionCount() + " items"',class:'$classes.transferlistHeaderItemCount + " " + $classes.sourceHeaderItemCount'},children:"$fns.getOptionCount()"}))),m=t("targetHeaderLabel",(()=>({if:"$targetLabel",$el:"label",attrs:{id:'$id + "_target_header_label"',for:'$id + "_target_search_input"',class:'$classes.transferlistHeaderLabel + " " + $classes.targetHeaderLabel'},children:"$targetLabel || $label"}))),v=t("targetHeaderItemCount",(()=>({$el:"span",attrs:{id:'$id + "_target_header_item_count"',role:"presentation","aria-label":'$fns.getOptionCount(true) + " items"',class:'$classes.transferlistHeaderItemCount + " " + $classes.targetHeaderItemCount'},children:"$fns.getOptionCount(true)"}))),L=t("sourceControls",(()=>({$el:"div",if:"$searchable",attrs:{id:'$id + "_source_controls"',class:'$classes.transferlistControls + " " + $classes.sourceControls'}}))),y=t("sourceSearch",(()=>({if:"$searchable",$el:"div",attrs:{id:'$id + "_source_search"',class:'$classes.transferlistSearch + " " + $classes.sourceSearch'}}))),M=t("sourceSearchInput",(()=>({$el:"input",attrs:{id:'$id + "_source_search_input"',type:"text",placeholder:"$placeholder",onInput:"$handlers.onSearch",value:"$inputText",onKeydown:"$handlers.handleSourceSearchKeyDown",disabled:"$disabled","aria-label":"Search",role:"searchbox",class:'$classes.transferlistSearchInput + " " + $classes.sourceSearchInput'}}))),S=t("sourceSearchClear",(()=>({$el:"button",if:"$inputText !== undefined",attrs:{id:'$id + "_source_search_clear"',type:"button",onClick:"$handlers.clearSearch","aria-label":"Clear search",class:'$classes.transferlistSearchClear + " " + $classes.sourceSearchClear'}}))),w=t("sourceListItems",(()=>({$el:"ul",attrs:{id:'$id + "_source_list_items"',"aria-activedescendant":"$activeDescendant",onMouseover:"$handlers.onMouseEnter(true)",onMouseout:"$handlers.onMouseLeave(true)",role:"listbox","aria-multiselectable":"true","aria-roledescription":"List of options to choose from.",class:'$classes.transferlistListItems + " " + $classes.sourceListItems',onKeydown:"$handlers.sourceKeyDown",tabindex:"0",onFocus:"$handlers.sourceFocused"}}))),C=t("sourceListItem",(()=>({for:["option","index","$sourceOptions"],$el:"li",attrs:{id:'$id + "_source_list_item_" + $index',"data-value":"$option.value","aria-selected":"$selections && $selections.length > 0 && $fns.isSelected($option)","data-is-active":"$fns.isActive($option)","data-disabled":"$option.attrs.disabled",role:"option",onClick:"$option.attrs.disabled !== true && $handlers.selectOption($option, true)",key:"$option.value",class:'$classes.transferlistListItem + " " + $classes.sourceListItem'}}))),I=t("sourceOption",(()=>({$el:"div",attrs:{"data-checked":"$selections && $selections.length > 0 && $fns.isSelected($option)",class:'$classes.transferlistOption + " " + $classes.sourceOption'}}))),k=t("sourceLoadMore",(()=>({$el:"li",if:"$targetLoading !== true && $state.loading || $state.hasNextPage",attrs:{id:'$id + "_source_load_more"',key:"loadMore","aria-selected":"false",class:'$classes.transferlistLoadMore + " " + $classes.sourceLoadMore'}}))),H=t("loadMoreInner","span"),x=t("target",(()=>({$el:"div",attrs:{id:'$id + "_target"',class:'$classes.transferlist + " " + $classes.target'}}))),B=t("targetHeader",(()=>({$el:"div",attrs:{id:'$id + "_target_header"',role:"presentation",class:'$classes.transferlistHeader + " " + $classes.targetHeader'}}))),O=t("targetHeaderName",(()=>({if:"$target.label !== undefined",$el:"span",attrs:{id:'$id + "_target_header_name"',class:'$classes.transferlistHeaderName + " " + $classes.targetHeaderName'},children:"$target.label"}))),A=t("targetListItems",(()=>({$el:"ul",attrs:{id:"$id","aria-activedescendant":"$activeDescendant",onMouseover:"$handlers.onMouseEnter(false)",onMouseout:"$handlers.onMouseLeave(false)",class:'$classes.transferlistListItems + " " + $classes.targetListItems',tabindex:"0",onKeydown:"$handlers.targetKeyDown",onFocus:"$handlers.targetFocused"}}))),F=t("targetListItem",(()=>({for:["option","index","$targetOptions"],$el:"li",attrs:{id:'$id + "_target_list_item_" + $index',"data-disabled":"$option.attrs.disabled","data-value":"$option.value","aria-selected":"$selections && $selections.length && $fns.isSelected($option, $target)","data-is-active":"$fns.isActive($option)",role:"option",onClick:"$option.attrs.disabled !== true && $handlers.selectOption($option, false)",key:"$option.value",class:'$classes.transferlistListItem + " " + $classes.targetListItem'}}))),E=t("targetOption",(()=>({$el:"div",attrs:{id:'$id + "_target_list_item_" + $index',class:'$classes.transferlistOption + " " + $classes.targetOption'}}))),V=t("targetLoadMore",(()=>({$el:"li",if:"$targetLoading && $state.loading",attrs:{id:'$id + "_target_load_more"',key:"loadMore","aria-selected":"false",class:'$classes.transferlistLoadMore + " " + $classes.targetLoadMore'}}))),K=t("transferControls",(()=>({$el:"div",attrs:{id:'$id + "_transfer_controls"'}}))),D=t("transferButtonForward",(()=>({if:"$transferOnSelect !== true",$el:"button",attrs:{id:'$id + "_transfer_button_forward"',type:"button",disabled:"$selections.length === 0 || $sourceSelected === false || $disabled || ($max && $value && $value.length >= $max)",onClick:"$handlers.transferForward","aria-label":"$ui.addSelectedValues.value",title:"$ui.addSelectedValues.value",class:'$classes.transferlistButton + " " + $classes.transferButtonForward'}}))),N=t("transferButtonForwardAll",(()=>({$el:"button",attrs:{id:'$id + "_transfer_button_forward_all"',type:"button",disabled:"$options.length === $targetOptions.length || $disabled || ($max && $value && $value.length >= $max)",onClick:"$handlers.transferForwardAll","aria-label":"$ui.addAllValues.value",title:"$ui.addAllValues.value",class:'$classes.transferlistButton + " " + $classes.transferButtonForwardAll'}}))),T=t("transferButtonBackward",(()=>({if:"$transferOnSelect !== true",$el:"button",attrs:{id:'$id + "_transfer_button_backward"',onClick:"$handlers.transferBackward",type:"button",disabled:"$selections.length === 0 || $sourceSelected === true || $disabled","aria-label":"$ui.removeSelectedValues.value",title:"$ui.removeSelectedValues.value",class:'$classes.transferlistButton + " " + $classes.transferButtonBackward'}}))),P=t("transferButtonBackwardAll",(()=>({$el:"button",attrs:{id:'$id + "_transfer_button_backward_all"',onClick:"$handlers.transferBackwardAll",type:"button",disabled:"$targetOptions.length === 0 || $disabled","aria-label":"$ui.removeAllValues.value",title:"$ui.removeAllValues.value",class:'$classes.transferlistButton + " " + $classes.transferButtonBackwardAll'}}))),j=t("controlLabel","span"),q=t("sourceEmptyMessage",(()=>({$el:"li",if:"$showSourceEmptyMessage && $sourceEmptyMessage && $state.loading !== true",attrs:{id:'$id + "_source_empty_message"',key:"$sourceEmptyMessage",role:"presentation"}}))),z=t("targetEmptyMessage",(()=>({$el:"li",if:"$showTargetEmptyMessage && $targetEmptyMessage",attrs:{id:'$id + "_empty_message"',key:"$emptyMessage",role:"presentation"}}))),G=t("emptyMessageInner","span");export{p as area,j as controlLabel,t as createSection,G as emptyMessageInner,u as fieldset,d as help,i as icon,l as inner,f as legend,H as loadMoreInner,c as message,$ as messages,a as outer,o as prefix,_ as source,L as sourceControls,q as sourceEmptyMessage,g as sourceHeader,b as sourceHeaderItemCount,h as sourceHeaderLabel,C as sourceListItem,w as sourceListItems,k as sourceLoadMore,I as sourceOption,y as sourceSearch,S as sourceSearchClear,M as sourceSearchInput,n as suffix,x as target,z as targetEmptyMessage,B as targetHeader,v as targetHeaderItemCount,m as targetHeaderLabel,O as targetHeaderName,F as targetListItem,A as targetListItems,V as targetLoadMore,E as targetOption,T as transferButtonBackward,P as transferButtonBackwardAll,D as transferButtonForward,N as transferButtonForwardAll,K as transferControls,r as wrapper};
@@ -0,0 +1,194 @@
1
+ import { FormKitProInput } from '@formkit/pro'
2
+ import {
3
+ outer,
4
+ fieldset,
5
+ wrapper,
6
+ help,
7
+ controlLabel,
8
+ legend,
9
+ messages,
10
+ message,
11
+ target,
12
+ targetListItems,
13
+ targetListItem,
14
+ targetOption,
15
+ targetHeader,
16
+ targetHeaderItemCount,
17
+ targetHeaderLabel,
18
+ sourceHeaderLabel,
19
+ source,
20
+ sourceHeader,
21
+ sourceHeaderItemCount,
22
+ sourceControls,
23
+ sourceSearch,
24
+ sourceSearchInput,
25
+ sourceSearchClear,
26
+ sourceListItems,
27
+ sourceListItem,
28
+ sourceOption,
29
+ sourceLoadMore,
30
+ targetLoadMore,
31
+ loadMoreInner,
32
+ transferControls,
33
+ transferButtonForward,
34
+ transferButtonBackward,
35
+ transferButtonForwardAll,
36
+ transferButtonBackwardAll,
37
+ icon,
38
+ sourceEmptyMessage,
39
+ targetEmptyMessage,
40
+ emptyMessageInner,
41
+ } from '../sections/transferListSections'
42
+ import { default as transferListFeature } from '../features/transferlist'
43
+ import { options, defaultIcon, localize } from '@formkit/inputs'
44
+ import { $if } from '../compose'
45
+
46
+ /**
47
+ * Input definition for a transferlist input.
48
+ * @public
49
+ */
50
+ export const transferlist: FormKitProInput = {
51
+ /**
52
+ * The actual schema of the input, or a function that returns the schema.
53
+ */
54
+ schema: outer(
55
+ fieldset(
56
+ legend('$label'),
57
+ help('$help'),
58
+ wrapper(
59
+ source(
60
+ sourceHeader(sourceHeaderLabel(), sourceHeaderItemCount()),
61
+ sourceControls(
62
+ sourceSearch(sourceSearchInput(), sourceSearchClear(icon('close')))
63
+ ),
64
+ sourceListItems(
65
+ sourceEmptyMessage(emptyMessageInner('$sourceEmptyMessage')),
66
+ sourceListItem(
67
+ $if(
68
+ '$transferOnSelect !== true && $fns.isSelected($option)',
69
+ icon('selected')
70
+ ),
71
+ sourceOption('$option.label')
72
+ ),
73
+ sourceLoadMore(
74
+ loadMoreInner(
75
+ $if(
76
+ '$targetLoading !== true && $state.loading',
77
+ icon('loader')
78
+ ),
79
+ '$state.loading && $ui.isLoading.value || $ui.loadMore.value'
80
+ )
81
+ )
82
+ )
83
+ ),
84
+ transferControls(
85
+ transferButtonForwardAll(
86
+ controlLabel('$ui.addAllValues.value'),
87
+ icon('fastForward')
88
+ ),
89
+ transferButtonForward(
90
+ controlLabel('$ui.addSelectedValues.value'),
91
+ icon('moveRight')
92
+ ),
93
+ transferButtonBackward(
94
+ controlLabel('$ui.removeSelectedValues.value'),
95
+ icon('moveLeft')
96
+ ),
97
+ transferButtonBackwardAll(
98
+ controlLabel('$ui.removeAllValues.value'),
99
+ icon('rewind')
100
+ )
101
+ ),
102
+ target(
103
+ targetHeader(targetHeaderLabel(), targetHeaderItemCount()),
104
+ targetListItems(
105
+ targetEmptyMessage(
106
+ $if(
107
+ '$state.loading === false',
108
+ emptyMessageInner('$targetEmptyMessage')
109
+ )
110
+ ),
111
+ targetListItem(
112
+ $if(
113
+ '$transferOnSelect !== true && $fns.isSelected($option)',
114
+ icon('selected')
115
+ ),
116
+ targetOption('$option.label')
117
+ ),
118
+ targetLoadMore(
119
+ loadMoreInner(
120
+ $if('$targetLoading && $state.loading', icon('loader')),
121
+ '$state.loading && $ui.isLoading.value || $ui.loadMore.value'
122
+ )
123
+ )
124
+ )
125
+ )
126
+ ),
127
+ messages(message('$message.value'))
128
+ )
129
+ ),
130
+
131
+ /**
132
+ * The type of node, can be a list, group, or input.
133
+ */
134
+ type: 'input',
135
+
136
+ /**
137
+ * An array of extra props to accept for this input.
138
+ */
139
+ props: [
140
+ 'options',
141
+ 'selections',
142
+ 'activeValue',
143
+ 'activeDescendant',
144
+ 'sourceSelected',
145
+ 'targetOptions',
146
+ 'sourceOptions',
147
+ 'target',
148
+ 'source',
149
+ 'optionLoader',
150
+ 'filterOptions',
151
+ 'inputText',
152
+ 'renderList',
153
+ 'search',
154
+ 'hasNextPage',
155
+ 'page',
156
+ 'targetOptionValues',
157
+ 'targetLoading',
158
+ 'searchable',
159
+ 'sourceLabel',
160
+ 'targetLabel',
161
+ 'transferOnSelect',
162
+ 'disabled',
163
+ 'placeholder',
164
+ 'filter',
165
+ 'showSourceEmptyMessage',
166
+ 'showTargetEmptyMessage',
167
+ 'sourceEmptyMessage',
168
+ 'targetEmptyMessage',
169
+ 'clearOnSelect',
170
+ 'max',
171
+ 'debounce',
172
+ ],
173
+
174
+ /**
175
+ * Additional features that make this input work.
176
+ */
177
+ features: [
178
+ transferListFeature,
179
+ options,
180
+ defaultIcon('moveRight', 'right'),
181
+ defaultIcon('moveLeft', 'left'),
182
+ defaultIcon('fastForward', 'fastForward'),
183
+ defaultIcon('rewind', 'rewind'),
184
+ defaultIcon('close', 'close'),
185
+ defaultIcon('loader', 'spinner'),
186
+ defaultIcon('selected', 'check'),
187
+ localize('isLoading'),
188
+ localize('loadMore'),
189
+ localize('addAllValues'),
190
+ localize('addSelectedValues'),
191
+ localize('removeSelectedValues'),
192
+ localize('removeAllValues'),
193
+ ],
194
+ }