@formkit/pro 0.117.7 → 0.118.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formkit/pro",
3
- "version": "0.117.7",
3
+ "version": "0.118.0",
4
4
  "description": "FormKit Pro — Form inputs and tools for high quality forms.",
5
5
  "main": "index.cjs",
6
6
  "module": "index.mjs",
@@ -0,0 +1 @@
1
+ import{createSectionFactory as e,createBaseSections as l}from"../index.mjs";const i=e("tb"),{outer:a,inner:s,wrapper:t,label:o,prefix:r,suffix:n,help:$,messages:d,message:p,icon:b}=l(i),u=i("singleToggle",(()=>({bind:"$attrs",$el:"button",attrs:{id:"$id","aria-label":"$label","aria-pressed":"$fns.isChecked($onValue, $value)",role:"checkbox",onClick:"$handlers.toggleValue()",disabled:"$disabled",class:"$classes.input",onBlur:"$handlers.blur"}}))),c=i("multiToggle",(()=>({bind:"$attrs",$el:"button",attrs:{id:"$id+'_'+$index","aria-label":"$label","aria-pressed":"$fns.isChecked($option, $value)",role:'$multiple && "checkbox" || "radio"',onClick:"$handlers.toggleValue($option)",class:"$classes.input",title:"$option.help",disabled:"$disabled || $option.disabled",onBlur:"$handlers.blur"}}))),g=i("inputInner",(()=>({bind:"$attrs",$el:"span"}))),h=i("options",(()=>({$el:"ul",attrs:{id:"$id",role:"group","data-vertical":'$vertical && "true" || "false"',"aria-labelledby":"$id"}}))),x=i("option",(()=>({$el:"li",for:["option","index","$options"],attrs:{role:"listitem",key:"$option.value","data-index":"$index"}})));export{g as buttonInput,i as createSection,$ as help,b as icon,s as inner,o as label,p as message,d as messages,c as multiToggle,x as option,h as options,a as outer,r as prefix,u as singleToggle,n as suffix,t as wrapper};
@@ -0,0 +1,98 @@
1
+ import { FormKitProInput } from '@formkit/pro'
2
+ import { options as optionsCore } from '@formkit/inputs'
3
+ import { $if } from '../compose'
4
+ import {
5
+ outer,
6
+ wrapper,
7
+ label,
8
+ singleToggle,
9
+ multiToggle,
10
+ buttonInput,
11
+ options,
12
+ option,
13
+ help,
14
+ messages,
15
+ message,
16
+ prefix,
17
+ suffix,
18
+ icon,
19
+ } from '../sections/togglebuttonsSections'
20
+ import togglebuttonsFeatures from '../features/togglebuttons'
21
+
22
+ /**
23
+ * Input definition for a toggle group input.
24
+ * @public
25
+ */
26
+ export const togglebuttons: FormKitProInput = {
27
+ /**
28
+ * The actual schema of the input, or a function that returns the schema.
29
+ */
30
+ schema: outer(
31
+ $if(
32
+ '$options',
33
+ wrapper(
34
+ label('$label'),
35
+ options(
36
+ option(
37
+ multiToggle(
38
+ $if(
39
+ '$fns.isChecked($option) === true',
40
+ buttonInput(
41
+ '$slots.default || $slots.on || ' +
42
+ '$option.onLabel || $option.label'
43
+ ),
44
+ buttonInput(
45
+ '$slots.default || $slots.off || ' +
46
+ '$option.offLabel || $option.label'
47
+ )
48
+ ),
49
+ )
50
+ )
51
+ )
52
+ ),
53
+ wrapper(
54
+ $if(
55
+ '$label && ($slots.default || $slots.on || $onLabel)',
56
+ label('$label'),
57
+ ),
58
+ singleToggle(
59
+ icon('prefix'),
60
+ prefix(),
61
+ $if(
62
+ '$_isChecked === true',
63
+ buttonInput(
64
+ '$slots.default || $slots.on || '+
65
+ '$onLabel || $label'
66
+ ),
67
+ buttonInput(
68
+ '$slots.default || $slots.off || '+
69
+ '$offLabel || $label'
70
+ )
71
+ ),
72
+ suffix(),
73
+ icon('suffix'),
74
+ ),
75
+ ),
76
+ ),
77
+ help('$help'),
78
+ messages(message('$message.value'))
79
+ ),
80
+ /**
81
+ * The type of node, can be a list, group, or input.
82
+ */
83
+ type: 'input',
84
+
85
+ family: 'button',
86
+
87
+ /**
88
+ * An array of extra props to accept for this input.
89
+ */
90
+ props: [
91
+ 'options'
92
+ ],
93
+
94
+ /**
95
+ * Additional features that make this input work.
96
+ */
97
+ features: [togglebuttonsFeatures, optionsCore],
98
+ }