@formkit/pro 0.111.9 → 0.111.10
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/genesis.css +1 -1
- package/index.cjs +1 -1
- package/index.d.ts +8 -1
- package/index.mjs +1 -1
- package/package.json +1 -1
- package/slider/index.mjs +1 -0
- package/slider/slider.ts +97 -0
package/package.json
CHANGED
package/slider/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createSectionFactory as a,createBaseSections as e}from"../index.mjs";const l=a("sl"),{outer:t,wrapper:s,inner:$,icon:i,label:n,prefix:r,suffix:o,help:d,messages:u,message:h}=e(l),c=l("chart",(()=>({$el:"div",if:"$chart"}))),m=l("chartBar",(()=>({$el:"div",for:["bar","index","$chart"],attrs:{"data-active":{if:"$isMulti",then:{if:"$_value.0 < $_value.1",then:"$bar.at >= $_value.0 && $bar.at <= $_value.1",else:"$bar.at >= $_value.1 && $bar.at <= $_value.0"},else:"$bar.at <= $_value"},style:{left:'$bar.at / ($max - $min) * 100 + "%"',width:'$: "calc(" + (100 / $chart.length) + "% - 2px)"',height:{if:"$largestBar",then:'$bar.value / $largestBar * 100 + "%"'}}}}))),p=l("sliderInner",(()=>({$el:"div",attrs:{"data-has-mark-labels":"$markLabels && $marks.length > 0"}}))),v=l("track",(()=>({$el:"div",attrs:{id:"$: 'track-' + $id",onClick:"$handlers.clickTrack"}}))),f=l("trackWrapper",(()=>({$el:"div"}))),b=l("trackInner",(()=>({$el:"div"}))),k=l("fill",(()=>({$el:"div",attrs:{style:"$fillStyles"}}))),_=l("linkedValues",(()=>({$el:"div"}))),x=l("maxValue",(()=>({$formkit:"number",bind:"$computedMaxInputAttrs",ignore:!0,value:{if:"$isMulti",then:"$_value.1",else:"$_value"},tabindex:{if:"$disabled",then:-1},onNode:"$handlers.maxNode",onBlur:"$handlers.inputBlur"}))),g=l("minValue",(()=>({$formkit:"number",bind:"$computedMinInputAttrs",ignore:!0,value:{if:"$isMulti",then:"$_value.0",else:"$_value"},tabindex:{if:"$disabled",then:-1},onNode:"$handlers.minNode",onBlur:"$handlers.inputBlur"}))),M=l("marks",(()=>({$el:"div",if:"$marks",class:"$classes.marks"}))),y=l("mark",(()=>({$el:"span",for:["step","index","$marks"],attrs:{"data-active":{if:"$isMulti",then:{if:"$_value.0 < $_value.1",then:"$step.at >= $_value.0 && $step.at <= $_value.1",else:"$step.at >= $_value.1 && $step.at <= $_value.0"},else:"$step.at <= $_value"},class:"$classes.mark",style:{left:'$step.at / ($max - $min) * 100 + "%"'}}}))),w=l("markLabel",(()=>({$el:"span",if:"$markLabels",children:"$step.label"}))),B=l("handles",(()=>({$el:"ul"}))),F=l("handleMax",(()=>({$el:"li",attrs:{"data-active":"$dragging","data-is-target":'$lastHandleInteraction === "max"',"data-handle":"max","data-show-tooltip":"$tooltip",class:"$: 'formkit-handle ' + $classes.handle + ' ' + $classes.handleMax",onFocus:"$handlers.focus",onClick:"$handlers.clickHandle",onMousedown:"$handlers.startDrag",onTouchstart:"$handlers.startDrag",style:"$maxHandleStyles",tabindex:{if:"$disabled",then:-1,else:0},onBlur:"$handlers.blur",onKeydown:"$handlers.keydown"}}))),H=l("handleMin",(()=>({$el:"li",if:"$isMulti",attrs:{"data-active":"$dragging","data-is-target":'$lastHandleInteraction === "min"',"data-handle":"min","data-show-tooltip":"$tooltip",class:"$: $classes.handle + ' ' + $classes.handleMin",onFocus:"$handlers.focus",onClick:"$handlers.clickHandle",onMousedown:"$handlers.startDrag",onTouchstart:"$handlers.startDrag",style:"$minHandleStyles",tabindex:{if:"$disabled",then:-1,else:0},onBlur:"$handlers.blur",onKeydown:"$handlers.keydown"}}))),I=l("tooltipMax",(()=>({$el:"div",if:'$tooltip === true || $tooltip === "auto"',children:{if:"$isMulti",then:{if:"$_value.0 < $_value.1",then:'$tooltipFormat($_value.1, "max")',else:'$tooltipFormat($_value.0, "max")'},else:'$tooltipFormat($_value, "max")'},attrs:{class:"$classes.tooltip + ' ' + $classes.tooltipMax"}}))),D=l("tooltipMin",(()=>({$el:"div",if:'$isMulti && ($tooltip === true || $tooltip === "auto")',children:{if:"$_value.0 < $_value.1",then:'$tooltipFormat($_value.0, "min")',else:'$tooltipFormat($_value.1, "min")'},attrs:{class:"$classes.tooltip + ' ' + $classes.tooltipMin"}})));export{c as chart,m as chartBar,l as createSection,k as fill,F as handleMax,H as handleMin,B as handles,d as help,i as icon,$ as inner,n as label,_ as linkedValues,y as mark,w as markLabel,M as marks,x as maxValue,h as message,u as messages,g as minValue,t as outer,r as prefix,p as sliderInner,o as suffix,I as tooltipMax,D as tooltipMin,v as track,b as trackInner,f as trackWrapper,s as wrapper};
|
package/slider/slider.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { FormKitProInput } from '@formkit/pro'
|
|
2
|
+
import { default as sliderFeature } from '../features/slider'
|
|
3
|
+
import {
|
|
4
|
+
outer,
|
|
5
|
+
wrapper,
|
|
6
|
+
label,
|
|
7
|
+
sliderInner,
|
|
8
|
+
icon,
|
|
9
|
+
prefix,
|
|
10
|
+
suffix,
|
|
11
|
+
help,
|
|
12
|
+
messages,
|
|
13
|
+
message,
|
|
14
|
+
minValue,
|
|
15
|
+
maxValue,
|
|
16
|
+
track,
|
|
17
|
+
trackWrapper,
|
|
18
|
+
trackInner,
|
|
19
|
+
fill,
|
|
20
|
+
marks,
|
|
21
|
+
mark,
|
|
22
|
+
markLabel,
|
|
23
|
+
handles,
|
|
24
|
+
handleMin,
|
|
25
|
+
handleMax,
|
|
26
|
+
tooltipMax,
|
|
27
|
+
tooltipMin,
|
|
28
|
+
linkedValues,
|
|
29
|
+
chart,
|
|
30
|
+
chartBar,
|
|
31
|
+
} from '../sections/sliderSections'
|
|
32
|
+
import { $if } from '../compose'
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Input definition for a slider input.
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
export const slider: FormKitProInput = {
|
|
39
|
+
/**
|
|
40
|
+
* The actual schema of the input, or a function that returns the schema.
|
|
41
|
+
*/
|
|
42
|
+
schema: outer(
|
|
43
|
+
wrapper(
|
|
44
|
+
label('$label'),
|
|
45
|
+
help('$help'),
|
|
46
|
+
sliderInner(
|
|
47
|
+
icon('prefix'),
|
|
48
|
+
prefix(),
|
|
49
|
+
track(
|
|
50
|
+
chart(chartBar()),
|
|
51
|
+
trackWrapper(
|
|
52
|
+
trackInner(
|
|
53
|
+
fill(),
|
|
54
|
+
marks(mark(markLabel())),
|
|
55
|
+
handles(handleMin(tooltipMin()), handleMax(tooltipMax()))
|
|
56
|
+
)
|
|
57
|
+
)
|
|
58
|
+
),
|
|
59
|
+
suffix(),
|
|
60
|
+
icon('suffix'),
|
|
61
|
+
$if('$showInput && $isMulti === false', maxValue())
|
|
62
|
+
),
|
|
63
|
+
$if('$showInput && $isMulti', linkedValues(minValue(), maxValue())),
|
|
64
|
+
messages(message('$message.value'))
|
|
65
|
+
)
|
|
66
|
+
),
|
|
67
|
+
/**
|
|
68
|
+
* The type of node, can be a list, group, or input.
|
|
69
|
+
*/
|
|
70
|
+
type: 'input',
|
|
71
|
+
/**
|
|
72
|
+
* In the dropdown family of inputs.
|
|
73
|
+
*/
|
|
74
|
+
family: '',
|
|
75
|
+
/**
|
|
76
|
+
* An array of extra props to accept for this input.
|
|
77
|
+
*/
|
|
78
|
+
props: [
|
|
79
|
+
'min',
|
|
80
|
+
'max',
|
|
81
|
+
'step',
|
|
82
|
+
'showInput',
|
|
83
|
+
'tooltip',
|
|
84
|
+
'tooltipFormat',
|
|
85
|
+
'inputAttrs',
|
|
86
|
+
'maxInputAttrs',
|
|
87
|
+
'minInputAttrs',
|
|
88
|
+
'marks',
|
|
89
|
+
'markLabels',
|
|
90
|
+
'snapToMarks',
|
|
91
|
+
'chart',
|
|
92
|
+
],
|
|
93
|
+
/**
|
|
94
|
+
* Additional features that make this input work.
|
|
95
|
+
*/
|
|
96
|
+
features: [sliderFeature],
|
|
97
|
+
}
|