@skdx/vue 0.29.0 → 0.31.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/dist/autocomplete/AutocompleteAnatomy.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/autocomplete/AutocompleteAnatomy.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/backdrop/Backdrop.vue.cjs +1 -0
- package/dist/backdrop/Backdrop.vue.d.cts +12 -0
- package/dist/backdrop/Backdrop.vue.d.ts +12 -0
- package/dist/backdrop/Backdrop.vue.js +1 -0
- package/dist/backdrop/Backdrop.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/backdrop/Backdrop.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/backdrop/index.cjs +1 -0
- package/dist/backdrop/index.d.cts +1 -0
- package/dist/backdrop/index.d.ts +1 -0
- package/dist/backdrop/index.js +1 -0
- package/dist/badge/BadgeAnatomy.vue.d.cts +1 -1
- package/dist/badge/BadgeAnatomy.vue.d.ts +1 -1
- package/dist/badge/BadgeAnatomy.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/badge/BadgeAnatomy.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/checkbox-card/CheckboxCard.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/checkbox-card/CheckboxCard.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/checkbox-group/CheckboxGroupItem.vue.d.cts +7 -4
- package/dist/checkbox-group/CheckboxGroupItem.vue.d.ts +7 -4
- package/dist/checkbox-group/CheckboxGroupItem.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/checkbox-group/CheckboxGroupItem.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/checkbox-group/CheckboxGroupSelectAll.vue.d.cts +7 -4
- package/dist/checkbox-group/CheckboxGroupSelectAll.vue.d.ts +7 -4
- package/dist/checkbox-group/CheckboxGroupSelectAll.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/checkbox-group/CheckboxGroupSelectAll.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/chip/Chip.vue.cjs +1 -0
- package/dist/chip/Chip.vue.d.cts +12 -0
- package/dist/chip/Chip.vue.d.ts +12 -0
- package/dist/chip/Chip.vue.js +1 -0
- package/dist/chip/Chip.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/chip/Chip.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/chip/index.cjs +1 -0
- package/dist/chip/index.d.cts +1 -0
- package/dist/chip/index.d.ts +1 -0
- package/dist/chip/index.js +1 -0
- package/dist/combobox/Combobox.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/combobox/Combobox.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/combobox/primitives.d.cts +1 -0
- package/dist/combobox/primitives.d.ts +1 -0
- package/dist/date-picker/DatePickerTimeField.vue.d.cts +1 -1
- package/dist/date-picker/DatePickerTimeField.vue.d.ts +1 -1
- package/dist/date-picker/DatePickerTrigger.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/date-picker/DatePickerTrigger.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/date-range-picker/DateRangePicker.vue.cjs +1 -0
- package/dist/date-range-picker/DateRangePicker.vue.d.cts +12 -0
- package/dist/date-range-picker/DateRangePicker.vue.d.ts +12 -0
- package/dist/date-range-picker/DateRangePicker.vue.js +1 -0
- package/dist/date-range-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/date-range-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/date-range-picker/index.cjs +1 -0
- package/dist/date-range-picker/index.d.cts +1 -0
- package/dist/date-range-picker/index.d.ts +1 -0
- package/dist/date-range-picker/index.js +1 -0
- package/dist/date-time-picker/DateTimePicker.vue.cjs +1 -0
- package/dist/date-time-picker/DateTimePicker.vue.d.cts +12 -0
- package/dist/date-time-picker/DateTimePicker.vue.d.ts +12 -0
- package/dist/date-time-picker/DateTimePicker.vue.js +1 -0
- package/dist/date-time-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/date-time-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/date-time-picker/index.cjs +1 -0
- package/dist/date-time-picker/index.d.cts +1 -0
- package/dist/date-time-picker/index.d.ts +1 -0
- package/dist/date-time-picker/index.js +1 -0
- package/dist/dialog/Dialogs.vue.cjs +1 -0
- package/dist/dialog/Dialogs.vue.d.cts +17 -0
- package/dist/dialog/Dialogs.vue.d.ts +17 -0
- package/dist/dialog/Dialogs.vue.js +1 -0
- package/dist/dialog/Dialogs.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/dialog/Dialogs.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/dialog/index.cjs +1 -1
- package/dist/dialog/index.d.cts +2 -0
- package/dist/dialog/index.d.ts +2 -0
- package/dist/dialog/index.js +1 -1
- package/dist/fab/Fab.vue.cjs +1 -0
- package/dist/fab/Fab.vue.d.cts +12 -0
- package/dist/fab/Fab.vue.d.ts +12 -0
- package/dist/fab/Fab.vue.js +1 -0
- package/dist/fab/Fab.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/fab/Fab.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/fab/index.cjs +1 -0
- package/dist/fab/index.d.cts +1 -0
- package/dist/fab/index.d.ts +1 -0
- package/dist/fab/index.js +1 -0
- package/dist/field/FieldError.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/field/FieldError.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/file-upload/FileUploadAnatomy.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/file-upload/FileUploadAnatomy.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/floating-panel/FloatingPanelContent.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/floating-panel/FloatingPanelContent.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/floating-panel/FloatingPanelRoot.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/floating-panel/FloatingPanelRoot.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/floating-panel/context.d.cts +4 -0
- package/dist/floating-panel/context.d.ts +4 -0
- package/dist/gauge/Gauge.vue.cjs +1 -0
- package/dist/gauge/Gauge.vue.d.cts +12 -0
- package/dist/gauge/Gauge.vue.d.ts +12 -0
- package/dist/gauge/Gauge.vue.js +1 -0
- package/dist/gauge/Gauge.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/gauge/Gauge.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/gauge/index.cjs +1 -0
- package/dist/gauge/index.d.cts +1 -0
- package/dist/gauge/index.d.ts +1 -0
- package/dist/gauge/index.js +1 -0
- package/dist/grid/Grid.vue.cjs +1 -0
- package/dist/grid/Grid.vue.d.cts +12 -0
- package/dist/grid/Grid.vue.d.ts +12 -0
- package/dist/grid/Grid.vue.js +1 -0
- package/dist/grid/Grid.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/grid/Grid.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/grid/index.cjs +1 -0
- package/dist/grid/index.d.cts +1 -0
- package/dist/grid/index.d.ts +1 -0
- package/dist/grid/index.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +1 -1
- package/dist/listbox/ListboxAnatomy.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/listbox/ListboxAnatomy.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/paper/Paper.vue.cjs +1 -0
- package/dist/paper/Paper.vue.d.cts +12 -0
- package/dist/paper/Paper.vue.d.ts +12 -0
- package/dist/paper/Paper.vue.js +1 -0
- package/dist/paper/Paper.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/paper/Paper.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/paper/index.cjs +1 -0
- package/dist/paper/index.d.cts +1 -0
- package/dist/paper/index.d.ts +1 -0
- package/dist/paper/index.js +1 -0
- package/dist/progress/Progress.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/progress/Progress.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/select/SelectContent.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/select/SelectContent.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/speed-dial/SpeedDial.vue.d.cts +5 -0
- package/dist/speed-dial/SpeedDial.vue.d.ts +5 -0
- package/dist/speed-dial/SpeedDial.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/speed-dial/SpeedDial.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/speed-dial/SpeedDialAnatomy.vue.d.cts +5 -0
- package/dist/speed-dial/SpeedDialAnatomy.vue.d.ts +5 -0
- package/dist/speed-dial/SpeedDialAnatomy.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/speed-dial/SpeedDialAnatomy.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/speed-dial/SpeedDialContent.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/speed-dial/SpeedDialContent.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/stack/Stack.vue.cjs +1 -0
- package/dist/stack/Stack.vue.d.cts +12 -0
- package/dist/stack/Stack.vue.d.ts +12 -0
- package/dist/stack/Stack.vue.js +1 -0
- package/dist/stack/Stack.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/stack/Stack.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/stack/index.cjs +1 -0
- package/dist/stack/index.d.cts +1 -0
- package/dist/stack/index.d.ts +1 -0
- package/dist/stack/index.js +1 -0
- package/dist/table/Table.vue.d.cts +14 -3
- package/dist/table/Table.vue.d.ts +14 -3
- package/dist/table/Table.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/table/Table.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/table/TableAnatomy.vue.d.cts +1 -0
- package/dist/table/TableAnatomy.vue.d.ts +1 -0
- package/dist/table/TableAnatomy.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/table/TableAnatomy.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/table/TableColumnHeaderFilterInput.vue.cjs +1 -0
- package/dist/table/TableColumnHeaderFilterInput.vue.d.cts +11 -0
- package/dist/table/TableColumnHeaderFilterInput.vue.d.ts +11 -0
- package/dist/table/TableColumnHeaderFilterInput.vue.js +1 -0
- package/dist/table/TableColumnHeaderFilterInput.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/table/TableColumnHeaderFilterInput.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/table/TableHeaderCell.vue.d.cts +6 -0
- package/dist/table/TableHeaderCell.vue.d.ts +6 -0
- package/dist/table/TableHeaderCell.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/table/TableHeaderCell.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/table/context.d.cts +11 -0
- package/dist/table/context.d.ts +11 -0
- package/dist/table/index.d.cts +1 -1
- package/dist/table/index.d.ts +1 -1
- package/dist/table/primitives.cjs +1 -1
- package/dist/table/primitives.d.cts +2 -1
- package/dist/table/primitives.d.ts +2 -1
- package/dist/table/primitives.js +1 -1
- package/dist/timeline/Timeline.vue.d.cts +5 -0
- package/dist/timeline/Timeline.vue.d.ts +5 -0
- package/dist/timeline/Timeline.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/timeline/Timeline.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/timeline/TimelineAnatomy.vue.d.cts +4 -0
- package/dist/timeline/TimelineAnatomy.vue.d.ts +4 -0
- package/dist/timeline/TimelineAnatomy.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/timeline/TimelineAnatomy.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/timeline/types.d.cts +2 -2
- package/dist/timeline/types.d.ts +2 -2
- package/dist/tooltip/Tooltip.vue.cjs +1 -0
- package/dist/tooltip/Tooltip.vue.d.cts +12 -0
- package/dist/tooltip/Tooltip.vue.d.ts +12 -0
- package/dist/tooltip/Tooltip.vue.js +1 -0
- package/dist/tooltip/Tooltip.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/tooltip/Tooltip.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/tooltip/index.cjs +1 -0
- package/dist/tooltip/index.d.cts +1 -0
- package/dist/tooltip/index.d.ts +1 -0
- package/dist/tooltip/index.js +1 -0
- package/dist/tree-select/TreeSelect.vue.d.cts +2 -2
- package/dist/tree-select/TreeSelect.vue.d.ts +2 -2
- package/dist/utils/csv.cjs +2 -0
- package/dist/utils/csv.d.cts +43 -0
- package/dist/utils/csv.d.ts +43 -0
- package/dist/utils/csv.js +1 -0
- package/dist/utils/dialogs.cjs +1 -0
- package/dist/utils/dialogs.d.cts +96 -0
- package/dist/utils/dialogs.d.ts +96 -0
- package/dist/utils/dialogs.js +1 -0
- package/dist/utils/dismissal.cjs +1 -1
- package/dist/utils/dismissal.d.cts +7 -0
- package/dist/utils/dismissal.d.ts +7 -0
- package/dist/utils/dismissal.js +1 -1
- package/dist/utils/field-core.cjs +1 -1
- package/dist/utils/field-core.d.cts +2 -0
- package/dist/utils/field-core.d.ts +2 -0
- package/dist/utils/field-core.js +1 -1
- package/dist/utils/media-query.cjs +1 -0
- package/dist/utils/media-query.d.cts +7 -0
- package/dist/utils/media-query.d.ts +7 -0
- package/dist/utils/media-query.js +1 -0
- package/dist/utils/useDismiss.cjs +1 -1
- package/dist/utils/useDismiss.js +1 -1
- package/dist/utils/useMediaQuery.cjs +1 -0
- package/dist/utils/useMediaQuery.d.cts +11 -0
- package/dist/utils/useMediaQuery.d.ts +11 -0
- package/dist/utils/useMediaQuery.js +1 -0
- package/package.json +102 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{appearanceAttrs as t}from"../utils/appearance.js";import e from"./TimelineAnatomy.vue.js";import{createBlock as a,createCommentVNode as o,createElementBlock as s,createSlots as
|
|
1
|
+
import{appearanceAttrs as t}from"../utils/appearance.js";import e from"./TimelineAnatomy.vue.js";import{createBlock as a,createCommentVNode as o,createElementBlock as s,createSlots as i,defineComponent as n,guardReactiveProps as r,mergeProps as l,normalizeProps as m,openBlock as p,renderSlot as d,unref as c,withCtx as f}from"vue";var u=["data-orientation"],k=/* @__PURE__ */n({inheritAttrs:!1,__name:"Timeline",props:{orientation:{default:"vertical"},items:{default:void 0},align:{}},setup:n=>(k,v)=>(p(),s("ol",l({class:"skdx-timeline","data-part":"root","data-skdx-component":"timeline",role:"list","data-orientation":n.orientation},{...k.$attrs,...c(t)({align:n.align},k.$attrs)}),[d(k.$slots,"default",{},()=>[n.items?(p(),a(e,{key:0,items:n.items},i({_:2},[k.$slots.opposite?{name:"opposite",fn:f(t=>[d(k.$slots,"opposite",m(r(t)))]),key:"0"}:void 0,k.$slots.content?{name:"content",fn:f(t=>[d(k.$slots,"content",m(r(t)))]),key:"1"}:void 0]),1032,["items"])):o("",!0)])],16,u))});export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const l=require("../utils/renderProp.cjs"),
|
|
1
|
+
const l=require("../utils/renderProp.cjs"),u=require("./TimelineContent.vue.cjs"),a=require("./TimelineIndicator.vue.cjs"),i=require("./TimelineItem.vue.cjs"),c=require("./TimelineOpposite.vue.cjs"),d=require("./TimelineSeparator.vue.cjs");let e=require("vue");var s=(0,e.defineComponent)({__name:"TimelineAnatomy",props:{items:{}},setup(o){return(n,p)=>((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(o.items,(t,r)=>((0,e.openBlock)(),(0,e.createBlock)(i.default,{key:r,"data-state":t.state},{default:(0,e.withCtx)(()=>[t.opposite?((0,e.openBlock)(),(0,e.createBlock)(c.default,{key:0},{default:(0,e.withCtx)(()=>[(0,e.renderSlot)(n.$slots,"opposite",{item:t,index:r},()=>[(0,e.createVNode)((0,e.unref)(l.RenderProp),{render:()=>t.opposite},null,8,["render"])])]),_:2},1024)):(0,e.createCommentVNode)("",!0),t.indicator?((0,e.openBlock)(),(0,e.createBlock)(a.default,{key:1,"aria-label":t.indicatorLabel},{default:(0,e.withCtx)(()=>[(0,e.createVNode)((0,e.unref)(l.RenderProp),{render:()=>t.indicator},null,8,["render"])]),_:2},1032,["aria-label"])):((0,e.openBlock)(),(0,e.createBlock)(a.default,{key:2})),r<o.items.length-1?((0,e.openBlock)(),(0,e.createBlock)(d.default,{key:3})):(0,e.createCommentVNode)("",!0),(0,e.createVNode)(u.default,null,{default:(0,e.withCtx)(()=>[(0,e.renderSlot)(n.$slots,"content",{item:t,index:r},()=>[(0,e.createTextVNode)((0,e.toDisplayString)(t.content),1)])]),_:2},1024)]),_:2},1032,["data-state"]))),128))}});exports.default=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{RenderProp as e}from"../utils/renderProp.js";import t from"./TimelineContent.vue.js";import a from"./TimelineIndicator.vue.js";import r from"./TimelineItem.vue.js";import o from"./TimelineOpposite.vue.js";import i from"./TimelineSeparator.vue.js";import{Fragment as n,createBlock as s,createCommentVNode as
|
|
1
|
+
import{RenderProp as e}from"../utils/renderProp.js";import t from"./TimelineContent.vue.js";import a from"./TimelineIndicator.vue.js";import r from"./TimelineItem.vue.js";import o from"./TimelineOpposite.vue.js";import i from"./TimelineSeparator.vue.js";import{Fragment as n,createBlock as s,createCommentVNode as l,createElementBlock as m,createTextVNode as d,createVNode as p,defineComponent as u,openBlock as c,renderList as f,renderSlot as k,toDisplayString as v,unref as y,withCtx as T}from"vue";var j=/* @__PURE__ */u({__name:"TimelineAnatomy",props:{items:{}},setup:u=>(j,_)=>(c(!0),m(n,null,f(u.items,(n,m)=>(c(),s(r,{key:m,"data-state":n.state},{default:T(()=>[n.opposite?(c(),s(o,{key:0},{default:T(()=>[k(j.$slots,"opposite",{item:n,index:m},()=>[p(y(e),{render:()=>n.opposite},null,8,["render"])])]),_:2},1024)):l("",!0),n.indicator?(c(),s(a,{key:1,"aria-label":n.indicatorLabel},{default:T(()=>[p(y(e),{render:()=>n.indicator},null,8,["render"])]),_:2},1032,["aria-label"])):(c(),s(a,{key:2})),m<u.items.length-1?(c(),s(i,{key:3})):l("",!0),p(t,null,{default:T(()=>[k(j.$slots,"content",{item:n,index:m},()=>[d(v(n.content),1)])]),_:2},1024)]),_:2},1032,["data-state"]))),128))});export{j as default};
|
|
@@ -4,10 +4,10 @@ export interface TimelineItem {
|
|
|
4
4
|
/** The event, rendered in TimelineContent; override with content slot. */
|
|
5
5
|
content: string;
|
|
6
6
|
/**
|
|
7
|
-
* Metadata on the far side of the marker (timestamp, actor, elapsed time).
|
|
7
|
+
* Metadata on the far side of the marker (timestamp, actor, elapsed time), a string or a VNode.
|
|
8
8
|
* @default undefined — no opposite region.
|
|
9
9
|
*/
|
|
10
|
-
opposite?: string;
|
|
10
|
+
opposite?: string | VNode;
|
|
11
11
|
/**
|
|
12
12
|
* Indicator content (icon, number, check, or a VNode); filling it makes the marker visible and requires an accessible name.
|
|
13
13
|
* @default undefined — decorative, `aria-hidden` marker.
|
package/dist/timeline/types.d.ts
CHANGED
|
@@ -4,10 +4,10 @@ export interface TimelineItem {
|
|
|
4
4
|
/** The event, rendered in TimelineContent; override with content slot. */
|
|
5
5
|
content: string;
|
|
6
6
|
/**
|
|
7
|
-
* Metadata on the far side of the marker (timestamp, actor, elapsed time).
|
|
7
|
+
* Metadata on the far side of the marker (timestamp, actor, elapsed time), a string or a VNode.
|
|
8
8
|
* @default undefined — no opposite region.
|
|
9
9
|
*/
|
|
10
|
-
opposite?: string;
|
|
10
|
+
opposite?: string | VNode;
|
|
11
11
|
/**
|
|
12
12
|
* Indicator content (icon, number, check, or a VNode); filling it makes the marker visible and requires an accessible name.
|
|
13
13
|
* @default undefined — decorative, `aria-hidden` marker.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./Tooltip.vue_vue_type_script_setup_true_lang.cjs");var t=e.default;exports.default=t;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare var __VLS_6: string | number, __VLS_7: any;
|
|
2
|
+
type __VLS_Slots = {} & {
|
|
3
|
+
[K in NonNullable<typeof __VLS_6>]?: (props: typeof __VLS_7) => any;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
7
|
+
export default _default;
|
|
8
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
9
|
+
new (): {
|
|
10
|
+
$slots: S;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare var __VLS_6: string | number, __VLS_7: any;
|
|
2
|
+
type __VLS_Slots = {} & {
|
|
3
|
+
[K in NonNullable<typeof __VLS_6>]?: (props: typeof __VLS_7) => any;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
7
|
+
export default _default;
|
|
8
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
9
|
+
new (): {
|
|
10
|
+
$slots: S;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"./Tooltip.vue_vue_type_script_setup_true_lang.js";var e=t;export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const l=require("../popover/Popover.vue.cjs");let e=require("vue");var s=(0,e.defineComponent)({inheritAttrs:!1,__name:"Tooltip",setup(n){return(r,p)=>((0,e.openBlock)(),(0,e.createBlock)(l.default,(0,e.mergeProps)({role:"tooltip","open-on":"hover"},r.$attrs),(0,e.createSlots)({_:2},[(0,e.renderList)(r.$slots,(u,t)=>({name:t,fn:(0,e.withCtx)(o=>[(0,e.renderSlot)(r.$slots,t,(0,e.normalizeProps)((0,e.guardReactiveProps)(o??{})))])}))]),1040))}});exports.default=s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"../popover/Popover.vue.js";import{createBlock as o,createSlots as r,defineComponent as s,guardReactiveProps as t,mergeProps as a,normalizeProps as p,openBlock as n,renderList as i,renderSlot as l,withCtx as m}from"vue";var v=/* @__PURE__ */s({inheritAttrs:!1,__name:"Tooltip",setup:s=>(s,v)=>(n(),o(e,a({role:"tooltip","open-on":"hover"},s.$attrs),r({_:2},[i(s.$slots,(e,o)=>({name:o,fn:m(e=>[l(s.$slots,o,p(t(e??{})))])}))]),1040))});export{v as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Tooltip.vue.cjs");exports.SkdxTooltip=e.default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SkdxTooltip } from './Tooltip.vue.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SkdxTooltip } from './Tooltip.vue.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import o from"./Tooltip.vue.js";export{o as SkdxTooltip};
|
|
@@ -132,11 +132,11 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}
|
|
|
132
132
|
multiple: boolean;
|
|
133
133
|
readOnly: boolean;
|
|
134
134
|
value: string[] | undefined;
|
|
135
|
+
layout: "tree" | "columns";
|
|
136
|
+
expanded: string[] | undefined;
|
|
135
137
|
inputValue: string | undefined;
|
|
136
138
|
defaultInputValue: string;
|
|
137
139
|
closeOnSelect: boolean | undefined;
|
|
138
|
-
layout: "tree" | "columns";
|
|
139
|
-
expanded: string[] | undefined;
|
|
140
140
|
loadChildren: ((nodeValue: string) => void | Promise<void>) | undefined;
|
|
141
141
|
expandOnClick: boolean;
|
|
142
142
|
emptyMessage: string;
|
|
@@ -132,11 +132,11 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}
|
|
|
132
132
|
multiple: boolean;
|
|
133
133
|
readOnly: boolean;
|
|
134
134
|
value: string[] | undefined;
|
|
135
|
+
layout: "tree" | "columns";
|
|
136
|
+
expanded: string[] | undefined;
|
|
135
137
|
inputValue: string | undefined;
|
|
136
138
|
defaultInputValue: string;
|
|
137
139
|
closeOnSelect: boolean | undefined;
|
|
138
|
-
layout: "tree" | "columns";
|
|
139
|
-
expanded: string[] | undefined;
|
|
140
140
|
loadChildren: ((nodeValue: string) => void | Promise<void>) | undefined;
|
|
141
141
|
expandOnClick: boolean;
|
|
142
142
|
emptyMessage: string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function y(t){return t==null?"":t instanceof Date?t.toISOString():typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t)??""}function s(t,r){const n=y(t);return/["\r\n]/.test(n)||n.includes(r)?`"${n.replace(/"/g,'""')}"`:n}function p(t,r={}){const n=r.delimiter??",",f=t[0],i=(r.columns??(f?Object.keys(f):[])).map(e=>typeof e=="string"?{key:e}:e),o=[];r.header!==!1&&i.length&&o.push(i.map(e=>s(e.label??e.key,n)).join(n));for(const e of t)o.push(i.map(c=>s(e[c.key],n)).join(n));return o.join(`\r
|
|
2
|
+
`)}exports.toCsv=p;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** One output column: the row key to read and, optionally, the header text to print instead of the key. */
|
|
2
|
+
export interface CsvColumn<Row> {
|
|
3
|
+
/** Property of each row whose value fills this column. */
|
|
4
|
+
key: keyof Row & string;
|
|
5
|
+
/**
|
|
6
|
+
* Header cell text.
|
|
7
|
+
*
|
|
8
|
+
* @default the key itself
|
|
9
|
+
*/
|
|
10
|
+
label?: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
/** Output options for {@link toCsv}; every field has a working default. */
|
|
13
|
+
export interface CsvOptions<Row> {
|
|
14
|
+
/**
|
|
15
|
+
* Columns to emit, in order; omit to emit every key of the first row.
|
|
16
|
+
*
|
|
17
|
+
* @default Object.keys(rows[0])
|
|
18
|
+
*/
|
|
19
|
+
columns?: readonly (CsvColumn<Row> | (keyof Row & string))[] | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Field separator.
|
|
22
|
+
*
|
|
23
|
+
* @default ','
|
|
24
|
+
*/
|
|
25
|
+
delimiter?: string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the first line is the header row.
|
|
28
|
+
*
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
31
|
+
header?: boolean | undefined;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Serialises rows to RFC 4180 CSV text — CRLF line ends, fields quoted only when
|
|
35
|
+
* they contain the delimiter, a quote or a line break — ready for a Blob or a
|
|
36
|
+
* data: URL. Dates print as ISO 8601; null and undefined print as empty fields.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* toCsv(rows, { columns: [{ key: 'name', label: 'Name' }, 'amount'] });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function toCsv<Row extends object>(rows: readonly Row[], options?: CsvOptions<Row>): string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** One output column: the row key to read and, optionally, the header text to print instead of the key. */
|
|
2
|
+
export interface CsvColumn<Row> {
|
|
3
|
+
/** Property of each row whose value fills this column. */
|
|
4
|
+
key: keyof Row & string;
|
|
5
|
+
/**
|
|
6
|
+
* Header cell text.
|
|
7
|
+
*
|
|
8
|
+
* @default the key itself
|
|
9
|
+
*/
|
|
10
|
+
label?: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
/** Output options for {@link toCsv}; every field has a working default. */
|
|
13
|
+
export interface CsvOptions<Row> {
|
|
14
|
+
/**
|
|
15
|
+
* Columns to emit, in order; omit to emit every key of the first row.
|
|
16
|
+
*
|
|
17
|
+
* @default Object.keys(rows[0])
|
|
18
|
+
*/
|
|
19
|
+
columns?: readonly (CsvColumn<Row> | (keyof Row & string))[] | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Field separator.
|
|
22
|
+
*
|
|
23
|
+
* @default ','
|
|
24
|
+
*/
|
|
25
|
+
delimiter?: string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the first line is the header row.
|
|
28
|
+
*
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
31
|
+
header?: boolean | undefined;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Serialises rows to RFC 4180 CSV text — CRLF line ends, fields quoted only when
|
|
35
|
+
* they contain the delimiter, a quote or a line break — ready for a Blob or a
|
|
36
|
+
* data: URL. Dates print as ISO 8601; null and undefined print as empty fields.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* toCsv(rows, { columns: [{ key: 'name', label: 'Name' }, 'amount'] });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function toCsv<Row extends object>(rows: readonly Row[], options?: CsvOptions<Row>): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(n,t){const e=function(n){return null==n?"":n instanceof Date?n.toISOString():"string"==typeof n?n:"number"==typeof n||"boolean"==typeof n||"bigint"==typeof n?String(n):JSON.stringify(n)??""}(n);return/["\r\n]/.test(e)||e.includes(t)?`"${e.replace(/"/g,'""')}"`:e}function t(t,e={}){const o=e.delimiter??",",r=t[0],i=(e.columns??(r?Object.keys(r):[])).map(n=>"string"==typeof n?{key:n}:n),s=[];!1!==e.header&&i.length&&s.push(i.map(t=>n(t.label??t.key,o)).join(o));for(const e of t)s.push(i.map(t=>n(e[t.key],o)).join(o));return s.join("\r\n")}export{t as toCsv};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var f={alert:"OK",confirm:"Confirm",prompt:"OK"};function a(){const n=[],r=new Set;let s=0;function o(){for(const e of r)e()}function l(e,t){const i=typeof t=="string"?{title:t}:t,c={...i,id:`skdx-dialogs-${++s}`,kind:e,confirmLabel:i.confirmLabel??f[e],cancelLabel:e==="alert"?void 0:i.cancelLabel??"Cancel"};return new Promise(u=>{n.push({entry:c,resolve:u}),n.length===1&&o()})}return{subscribe(e){return r.add(e),()=>{r.delete(e)}},getCurrent:()=>n[0]?.entry??null,alert:e=>l("alert",e).then(()=>{}),confirm:e=>l("confirm",e).then(t=>t===!0),prompt:e=>l("prompt",e).then(t=>typeof t=="string"?t:null),settle(e,t){if(n[0]?.entry.id!==e)return;const{resolve:i}=n.shift();i(t),o()}}}function d(n){if(n.kind==="confirm")return!1;if(n.kind==="prompt")return null}function m(n,r){if(n.kind==="confirm")return!0;if(n.kind==="prompt")return r}exports.createDialogs=a;exports.dialogsCancelResult=d;exports.dialogsConfirmResult=m;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/** Which of the three canned dialogs an entry is. */
|
|
2
|
+
export type DialogsKind = 'alert' | 'confirm' | 'prompt';
|
|
3
|
+
/** Options common to alert, confirm and prompt; a bare string is the title. */
|
|
4
|
+
export interface DialogsOptions {
|
|
5
|
+
/** Heading of the dialog, rendered as its title and accessible name. */
|
|
6
|
+
title: string;
|
|
7
|
+
/**
|
|
8
|
+
* Body text under the title, rendered as the dialog's description.
|
|
9
|
+
*
|
|
10
|
+
* @default undefined — no description.
|
|
11
|
+
*/
|
|
12
|
+
description?: string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Label of the confirming button.
|
|
15
|
+
*
|
|
16
|
+
* @default 'OK' for alert and prompt, 'Confirm' for confirm
|
|
17
|
+
*/
|
|
18
|
+
confirmLabel?: string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Label of the cancelling button; alerts have none.
|
|
21
|
+
*
|
|
22
|
+
* @default 'Cancel'
|
|
23
|
+
*/
|
|
24
|
+
cancelLabel?: string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Severity rung the skin colours the dialog by, mirrored to `data-status`.
|
|
27
|
+
*
|
|
28
|
+
* @default undefined — the skin's own default.
|
|
29
|
+
*/
|
|
30
|
+
status?: string | undefined;
|
|
31
|
+
}
|
|
32
|
+
/** Options for a prompt, which adds a single text field to the confirm shape. */
|
|
33
|
+
export interface DialogsPromptOptions extends DialogsOptions {
|
|
34
|
+
/**
|
|
35
|
+
* Text the field starts with.
|
|
36
|
+
*
|
|
37
|
+
* @default ''
|
|
38
|
+
*/
|
|
39
|
+
defaultValue?: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Visible label of the text field.
|
|
42
|
+
*
|
|
43
|
+
* @default 'Value'
|
|
44
|
+
*/
|
|
45
|
+
label?: string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Placeholder shown in the empty field.
|
|
48
|
+
*
|
|
49
|
+
* @default undefined — no placeholder.
|
|
50
|
+
*/
|
|
51
|
+
placeholder?: string | undefined;
|
|
52
|
+
}
|
|
53
|
+
/** A queued dialog as the host renders it: resolved options plus the settle callback. */
|
|
54
|
+
export interface DialogsEntry extends DialogsPromptOptions {
|
|
55
|
+
/** Stable identity, for keying the rendered dialog. */
|
|
56
|
+
id: string;
|
|
57
|
+
/** Which canned dialog this is. */
|
|
58
|
+
kind: DialogsKind;
|
|
59
|
+
/** Resolved confirming label, never undefined. */
|
|
60
|
+
confirmLabel: string;
|
|
61
|
+
/** Resolved cancelling label, `undefined` for alerts. */
|
|
62
|
+
cancelLabel: string | undefined;
|
|
63
|
+
}
|
|
64
|
+
/** What settling an entry hands back: nothing for alert, a boolean for confirm, text or null for prompt. */
|
|
65
|
+
export type DialogsResult = void | boolean | string | null;
|
|
66
|
+
/** The queue every host renders from and every caller awaits on. */
|
|
67
|
+
export interface DialogsStore {
|
|
68
|
+
/** Subscribes to queue changes. Returns its own unsubscribe. */
|
|
69
|
+
subscribe: (listener: () => void) => () => void;
|
|
70
|
+
/** The entry currently shown, or `null` — a stable reference until the queue changes. */
|
|
71
|
+
getCurrent: () => DialogsEntry | null;
|
|
72
|
+
/** Shows a message with one button; resolves when it is dismissed. */
|
|
73
|
+
alert(options: DialogsOptions | string): Promise<void>;
|
|
74
|
+
/** Asks a yes/no question; resolves `true` on confirm, `false` on cancel or dismissal. */
|
|
75
|
+
confirm(options: DialogsOptions | string): Promise<boolean>;
|
|
76
|
+
/** Asks for one line of text; resolves the text on confirm, `null` on cancel or dismissal. */
|
|
77
|
+
prompt(options: DialogsPromptOptions | string): Promise<string | null>;
|
|
78
|
+
/** Resolves and removes the entry with `id`, then shows the next one. No-ops for an id that is not current. */
|
|
79
|
+
settle(id: string, result: DialogsResult): void;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Creates the dialog queue once per app. Hand it to the `Dialogs` host and call
|
|
83
|
+
* `alert`, `confirm` or `prompt` from anywhere; each returns a promise that
|
|
84
|
+
* settles with the user's answer.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* const dialogs = createDialogs();
|
|
89
|
+
* if (await dialogs.confirm({ title: 'Delete the project?', status: 'danger' })) remove();
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export declare function createDialogs(): DialogsStore;
|
|
93
|
+
/** What cancelling or dismissing `entry` resolves with: `false` for confirm, `null` for prompt, nothing for alert. */
|
|
94
|
+
export declare function dialogsCancelResult(entry: DialogsEntry): DialogsResult;
|
|
95
|
+
/** What confirming `entry` resolves with: `true` for confirm, the typed `draft` for prompt, nothing for alert. */
|
|
96
|
+
export declare function dialogsConfirmResult(entry: DialogsEntry, draft: string): DialogsResult;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/** Which of the three canned dialogs an entry is. */
|
|
2
|
+
export type DialogsKind = 'alert' | 'confirm' | 'prompt';
|
|
3
|
+
/** Options common to alert, confirm and prompt; a bare string is the title. */
|
|
4
|
+
export interface DialogsOptions {
|
|
5
|
+
/** Heading of the dialog, rendered as its title and accessible name. */
|
|
6
|
+
title: string;
|
|
7
|
+
/**
|
|
8
|
+
* Body text under the title, rendered as the dialog's description.
|
|
9
|
+
*
|
|
10
|
+
* @default undefined — no description.
|
|
11
|
+
*/
|
|
12
|
+
description?: string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Label of the confirming button.
|
|
15
|
+
*
|
|
16
|
+
* @default 'OK' for alert and prompt, 'Confirm' for confirm
|
|
17
|
+
*/
|
|
18
|
+
confirmLabel?: string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Label of the cancelling button; alerts have none.
|
|
21
|
+
*
|
|
22
|
+
* @default 'Cancel'
|
|
23
|
+
*/
|
|
24
|
+
cancelLabel?: string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Severity rung the skin colours the dialog by, mirrored to `data-status`.
|
|
27
|
+
*
|
|
28
|
+
* @default undefined — the skin's own default.
|
|
29
|
+
*/
|
|
30
|
+
status?: string | undefined;
|
|
31
|
+
}
|
|
32
|
+
/** Options for a prompt, which adds a single text field to the confirm shape. */
|
|
33
|
+
export interface DialogsPromptOptions extends DialogsOptions {
|
|
34
|
+
/**
|
|
35
|
+
* Text the field starts with.
|
|
36
|
+
*
|
|
37
|
+
* @default ''
|
|
38
|
+
*/
|
|
39
|
+
defaultValue?: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Visible label of the text field.
|
|
42
|
+
*
|
|
43
|
+
* @default 'Value'
|
|
44
|
+
*/
|
|
45
|
+
label?: string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Placeholder shown in the empty field.
|
|
48
|
+
*
|
|
49
|
+
* @default undefined — no placeholder.
|
|
50
|
+
*/
|
|
51
|
+
placeholder?: string | undefined;
|
|
52
|
+
}
|
|
53
|
+
/** A queued dialog as the host renders it: resolved options plus the settle callback. */
|
|
54
|
+
export interface DialogsEntry extends DialogsPromptOptions {
|
|
55
|
+
/** Stable identity, for keying the rendered dialog. */
|
|
56
|
+
id: string;
|
|
57
|
+
/** Which canned dialog this is. */
|
|
58
|
+
kind: DialogsKind;
|
|
59
|
+
/** Resolved confirming label, never undefined. */
|
|
60
|
+
confirmLabel: string;
|
|
61
|
+
/** Resolved cancelling label, `undefined` for alerts. */
|
|
62
|
+
cancelLabel: string | undefined;
|
|
63
|
+
}
|
|
64
|
+
/** What settling an entry hands back: nothing for alert, a boolean for confirm, text or null for prompt. */
|
|
65
|
+
export type DialogsResult = void | boolean | string | null;
|
|
66
|
+
/** The queue every host renders from and every caller awaits on. */
|
|
67
|
+
export interface DialogsStore {
|
|
68
|
+
/** Subscribes to queue changes. Returns its own unsubscribe. */
|
|
69
|
+
subscribe: (listener: () => void) => () => void;
|
|
70
|
+
/** The entry currently shown, or `null` — a stable reference until the queue changes. */
|
|
71
|
+
getCurrent: () => DialogsEntry | null;
|
|
72
|
+
/** Shows a message with one button; resolves when it is dismissed. */
|
|
73
|
+
alert(options: DialogsOptions | string): Promise<void>;
|
|
74
|
+
/** Asks a yes/no question; resolves `true` on confirm, `false` on cancel or dismissal. */
|
|
75
|
+
confirm(options: DialogsOptions | string): Promise<boolean>;
|
|
76
|
+
/** Asks for one line of text; resolves the text on confirm, `null` on cancel or dismissal. */
|
|
77
|
+
prompt(options: DialogsPromptOptions | string): Promise<string | null>;
|
|
78
|
+
/** Resolves and removes the entry with `id`, then shows the next one. No-ops for an id that is not current. */
|
|
79
|
+
settle(id: string, result: DialogsResult): void;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Creates the dialog queue once per app. Hand it to the `Dialogs` host and call
|
|
83
|
+
* `alert`, `confirm` or `prompt` from anywhere; each returns a promise that
|
|
84
|
+
* settles with the user's answer.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* const dialogs = createDialogs();
|
|
89
|
+
* if (await dialogs.confirm({ title: 'Delete the project?', status: 'danger' })) remove();
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export declare function createDialogs(): DialogsStore;
|
|
93
|
+
/** What cancelling or dismissing `entry` resolves with: `false` for confirm, `null` for prompt, nothing for alert. */
|
|
94
|
+
export declare function dialogsCancelResult(entry: DialogsEntry): DialogsResult;
|
|
95
|
+
/** What confirming `entry` resolves with: `true` for confirm, the typed `draft` for prompt, nothing for alert. */
|
|
96
|
+
export declare function dialogsConfirmResult(entry: DialogsEntry, draft: string): DialogsResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n={alert:"OK",confirm:"Confirm",prompt:"OK"};function e(){const e=[],t=/* @__PURE__ */new Set;let r=0;function o(){for(const n of t)n()}function i(t,i){const l="string"==typeof i?{title:i}:i,c={...l,id:"skdx-dialogs-"+ ++r,kind:t,confirmLabel:l.confirmLabel??n[t],cancelLabel:"alert"===t?void 0:l.cancelLabel??"Cancel"};return new Promise(n=>{e.push({entry:c,resolve:n}),1===e.length&&o()})}return{subscribe:n=>(t.add(n),()=>{t.delete(n)}),getCurrent:()=>e[0]?.entry??null,alert:n=>i("alert",n).then(()=>{}),confirm:n=>i("confirm",n).then(n=>!0===n),prompt:n=>i("prompt",n).then(n=>"string"==typeof n?n:null),settle(n,t){if(e[0]?.entry.id!==n)return;const{resolve:r}=e.shift();r(t),o()}}}function t(n){return"confirm"!==n.kind&&("prompt"===n.kind?null:void 0)}function r(n,e){return"confirm"===n.kind||("prompt"===n.kind?e:void 0)}export{e as createDialogs,t as dialogsCancelResult,r as dialogsConfirmResult};
|
package/dist/utils/dismissal.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var o=[];function a(e,t){let n=t;for(;n;){if(e.contains(n))return!0;const s=n.getRootNode();n=s instanceof ShadowRoot?s.host:null}return!1}function l(e,t){return e.insideElements().some(n=>t.insideElements().some(s=>s&&n&&a(n,s)))}function d(e){return o.push(e),()=>{const t=o.indexOf(e);t!==-1&&o.splice(t,1)}}function y(e,t){const n=new Set([e]);let s=!0;for(;s;){s=!1;for(const r of o)n.has(r)||[...n].some(u=>l(u,r))&&(n.add(r),s=!0)}return n.delete(e),[...n].some(r=>r.insideElements().some(u=>u&&a(u,t)))}function i(e=o){for(let t=e.length-1;t>=0;t--){const n=e[t];if(!e.some(s=>s!==n&&l(n,s)))return n}}function f(e){return i(e?o.filter(t=>t.insideElements().some(n=>n?.contains(e))):[])??i()}function m(e,t,n){return e.key!=="Escape"||!n||f(e.target)!==t?!1:(n(e),e.preventDefault(),!0)}function p(e,t){if(!t)return!0;const n=new CustomEvent(e,{cancelable:!0,detail:null});return t(n),!n.defaultPrevented}function E(e){return new CustomEvent("focus-outside",{detail:e,cancelable:!0})}var c=0;function b(e){c+=1;try{e()}finally{queueMicrotask(()=>{c-=1})}}function w(e){if(c>0)return null;const t=e.target;return!t||t===document.body?null:t}function h(e,t){return!t||e.target!==t?null:e instanceof PointerEvent?e:new PointerEvent("pointerdown",{bubbles:!0,cancelable:!0,composed:!0,pointerType:"mouse",clientX:e.clientX,clientY:e.clientY,screenX:e.screenX,screenY:e.screenY,button:e.button,buttons:e.buttons,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey})}exports.autoFocusEvent=p;exports.backdropPointerDown=h;exports.escapeLayer=f;exports.focusOnOpen=b;exports.focusOutsideEvent=E;exports.focusOutsideTarget=w;exports.handleEscapeKeyDown=m;exports.nestedLayerContains=y;exports.pushDismissLayer=d;exports.topDismissLayer=i;
|
|
@@ -9,6 +9,13 @@ export interface DismissLayer {
|
|
|
9
9
|
}
|
|
10
10
|
/** Registers an open layer and returns its teardown; layers close out of order (a parent unmount takes its children), so the teardown removes by identity, not by position. */
|
|
11
11
|
export declare function pushDismissLayer(layer: DismissLayer): () => void;
|
|
12
|
+
/**
|
|
13
|
+
* Whether `target` sits inside a layer that opened within `layer`: a portalled
|
|
14
|
+
* listbox or popover whose trigger lives in this panel. `contains()` cannot see
|
|
15
|
+
* it, so an outside-interaction check must ask the stack as well. Transitive,
|
|
16
|
+
* so a Select inside a Popover inside a Dialog still counts for the Dialog.
|
|
17
|
+
*/
|
|
18
|
+
export declare function nestedLayerContains(layer: DismissLayer, target: Node): boolean;
|
|
12
19
|
/** The layer nothing else is open inside: push order cannot rank nested layers, because a framework's effects run child-first. */
|
|
13
20
|
export declare function topDismissLayer(candidates?: readonly DismissLayer[]): DismissLayer | undefined;
|
|
14
21
|
/** The one layer an Escape belongs to: sibling non-modal layers can be open at once, so the layer holding the key's target answers, and the top layer only when none does. */
|
|
@@ -9,6 +9,13 @@ export interface DismissLayer {
|
|
|
9
9
|
}
|
|
10
10
|
/** Registers an open layer and returns its teardown; layers close out of order (a parent unmount takes its children), so the teardown removes by identity, not by position. */
|
|
11
11
|
export declare function pushDismissLayer(layer: DismissLayer): () => void;
|
|
12
|
+
/**
|
|
13
|
+
* Whether `target` sits inside a layer that opened within `layer`: a portalled
|
|
14
|
+
* listbox or popover whose trigger lives in this panel. `contains()` cannot see
|
|
15
|
+
* it, so an outside-interaction check must ask the stack as well. Transitive,
|
|
16
|
+
* so a Select inside a Popover inside a Dialog still counts for the Dialog.
|
|
17
|
+
*/
|
|
18
|
+
export declare function nestedLayerContains(layer: DismissLayer, target: Node): boolean;
|
|
12
19
|
/** The layer nothing else is open inside: push order cannot rank nested layers, because a framework's effects run child-first. */
|
|
13
20
|
export declare function topDismissLayer(candidates?: readonly DismissLayer[]): DismissLayer | undefined;
|
|
14
21
|
/** The one layer an Escape belongs to: sibling non-modal layers can be open at once, so the layer holding the key's target answers, and the top layer only when none does. */
|
package/dist/utils/dismissal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=[];function n(e,n){return e.insideElements().some(e=>
|
|
1
|
+
var e=[];function n(e,n){let t=n;for(;t;){if(e.contains(t))return!0;const n=t.getRootNode();t=n instanceof ShadowRoot?n.host:null}return!1}function t(e,t){return e.insideElements().some(e=>t.insideElements().some(t=>t&&e&&n(e,t)))}function s(n){return e.push(n),()=>{const t=e.indexOf(n);-1!==t&&e.splice(t,1)}}function o(s,o){const r=/* @__PURE__ */new Set([s]);let u=!0;for(;u;){u=!1;for(const n of e)r.has(n)||[...r].some(e=>t(e,n))&&(r.add(n),u=!0)}return r.delete(s),[...r].some(e=>e.insideElements().some(e=>e&&n(e,o)))}function r(n=e){for(let e=n.length-1;e>=0;e--){const s=n[e];if(!n.some(e=>e!==s&&t(s,e)))return s}}function u(n){return r(n?e.filter(e=>e.insideElements().some(e=>e?.contains(n))):[])??r()}function i(e,n,t){return!("Escape"!==e.key||!t||u(e.target)!==n||(t(e),e.preventDefault(),0))}function c(e,n){if(!n)return!0;const t=new CustomEvent(e,{cancelable:!0,detail:null});return n(t),!t.defaultPrevented}function a(e){return new CustomEvent("focus-outside",{detail:e,cancelable:!0})}var l=0;function f(e){l+=1;try{e()}finally{queueMicrotask(()=>{l-=1})}}function d(e){if(l>0)return null;const n=e.target;return n&&n!==document.body?n:null}function m(e,n){return n&&e.target===n?e instanceof PointerEvent?e:new PointerEvent("pointerdown",{bubbles:!0,cancelable:!0,composed:!0,pointerType:"mouse",clientX:e.clientX,clientY:e.clientY,screenX:e.screenX,screenY:e.screenY,button:e.button,buttons:e.buttons,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey}):null}export{c as autoFocusEvent,m as backdropPointerDown,u as escapeLayer,f as focusOnOpen,a as focusOutsideEvent,d as focusOutsideTarget,i as handleEscapeKeyDown,o as nestedLayerContains,s as pushDismissLayer,r as topDismissLayer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var I="validity-change",l="data-skdx-field",d="data-skdx-field-name",h="data-skdx-field-message",R="data-skdx-field-description",_="data-skdx-field-error",k="data-skdx-field-character-count",L="data-skdx-field-pending",c="data-skdx-field-resubmit",b="data-skdx-form-field",N="data-skdx-form-message",U=["validity-change","invalid","change","blur"],C="data-skdx-error-summary",S=1e3;function D(t){const e=Math.abs(t),i=e===1?"character":"characters";return t<0?`You have ${e} ${i} too many`:`You have ${e} ${i} remaining`}function F(t,e,i=0){return i<=0?!0:t>=e*i/100}var M="This field is invalid.",B="data-skdx-field-control",v=[`[${B}]`,'input:not([type="hidden"])',"select","textarea",'[role="textbox"]','[role="searchbox"]','[role="combobox"]','[role="listbox"]','[role="radiogroup"]','[role="group"]','[role="slider"]','[role="spinbutton"]','[role="checkbox"]','[role="radio"]','[role="switch"]'].join(", "),V="data-skdx-field-required-indicator",w=new Set(["INPUT","SELECT","TEXTAREA"]),O=new Set(["radiogroup","group"]),q=['input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])","button:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function f(t){return t==null?[]:(Array.isArray(t)?t:[t]).filter(e=>typeof e=="string"&&e.trim()!=="")}function A(t){for(const e of Array.from(t.querySelectorAll(v)))if(e.getAttribute("aria-hidden")!=="true"&&e.closest("[data-skdx-field]")===t)return e;return null}function m(t,e){return E(t,l,e)}function E(t,e,i){for(const r of Array.from(t.querySelectorAll(i)))if(r.closest(`[${e}]`)===t)return r;return null}function x(t){if(!t)return;const e=t;return e.type==="checkbox"||e.type==="radio"?e.checked:"value"in t?e.value:t.querySelector('input[aria-hidden="true"]')?.value}function o(t){return t==null||t===!1||t===""?!1:!(Array.isArray(t)&&t.length===0)}function a(t,e,i){i?t.setAttribute(e,""):t.removeAttribute(e)}function g(t,...e){const i=t.split(/\s+/).filter(Boolean);for(const r of e)r&&!i.includes(r)&&i.push(r);return i.join(" ")}function P(t){return t.closest("form, skdx-form")??t.parentElement??t}function G(t){const e=A(t),i=m(t,"[data-skdx-field-error]")?.textContent?.trim()||t.getAttribute("data-skdx-field-message")||t.getAttribute("data-skdx-field-name")||"";return!e?.id||!i?[]:[{id:e.id,message:i}]}function $(t){const e=E(t,b,v);if(!e?.id||e.getAttribute("aria-invalid")!=="true")return[];const i=E(t,"data-skdx-form-field","[data-skdx-form-message]:not([hidden])")?.textContent?.trim()||t.getAttribute("data-skdx-field-name")||"";return i?[{id:e.id,message:i}]:[]}function j(t){return Array.from(t.querySelectorAll(`[${l}][data-invalid], [${b}]`)).flatMap(e=>(e.hasAttribute("data-skdx-field")?G:$)(e))}var p="__skdxFieldCheckValidity",T="__skdxFieldReset";async function Y(t){const e=Array.from(t.querySelectorAll(`[${l}]`));return(await Promise.all(e.map(i=>i[p]?.()??Promise.resolve(!0)))).every(Boolean)}function H(t){for(const e of Array.from(t.querySelectorAll(`[${l}]`)))e[T]?.()}function z(t,e=document){const i=e.getElementById(t);if(!i)return;const r=i.getAttribute("role"),s=(i.tagName==="FIELDSET"||r!==null&&O.has(r)?i.querySelector(q):null)??i;s.focus(),s.scrollIntoView?.({block:"center"})}var K=class{constructor(t){this.options=t,this.props={},this.root=null,this.form=null,this.control=null,this.baseDescribedBy="",this.baseLabelledBy="",this.wroteLabelledBy=!1,this.wroteRequired=!1,this.wroteDisabled=!1,this.wroteGroupDisabled=!1,this.runToken=0,this.pending=!1,this.injected=[],this.custom=[],this.characterCount=null,this.awaitingSubmit=!1,this.handleInput=()=>{const e=this.isOverLimit(this.snapshot.count),i=this.readCount();this.update({dirty:!0,filled:o(this.resolveValue()),count:i,errors:this.composeErrors(i)}),this.scheduleCountAnnouncement(i,e),(this.props.mode==="change"||this.snapshot.errors.length>0)&&this.scheduleValidation()},this.handleFocusOut=()=>{const e=this.readCount();this.update({touched:!0,filled:o(this.resolveValue()),count:e,errors:this.composeErrors(e)});const i=this.validationTimer!==void 0;clearTimeout(this.validationTimer),this.validationTimer=void 0;const r=this.props.mode??"blur";(i||r==="blur"||this.snapshot.errors.length>0)&&this.runValidation()},this.handleSubmit=e=>{if(!this.form)return;const i=e.target;if(i!==this.form&&i?.closest?.("form")!==this.form||this.isEngineResubmit(e))return;this.markTouched();const r=this.runValidation({silent:this.hasErrorSummary()});if(y(r)){e.preventDefault(),this.awaitingSubmit=!0,Promise.resolve(r).then(()=>{this.awaitingSubmit&&(this.awaitingSubmit=!1,this.resubmitIfSettled())});return}(r.length>0||this.pending)&&e.preventDefault()},this.snapshot={controlId:"",errors:[],valid:!0,touched:!1,dirty:!1,filled:!1,count:0,validity:null}}get state(){return this.snapshot}setProps(t){const e=this.props.value;this.props=t;const i=f(t.errors??null),r=!Q(this.injected,i);r&&(this.injected=i);const s=t.value!==e;if(!r&&!s)return;const n=this.readCount();this.update({count:n,filled:o(this.resolveValue()),errors:this.composeErrors(n)})}setCharacterCount(t){if((this.characterCount?.maxLength??null)===(t?.maxLength??null)&&(this.characterCount?.threshold??0)===(t?.threshold??0))return;this.characterCount=t;const e=this.readCount();this.update({count:e,errors:this.composeErrors(e)})}readCount(){const t=this.resolveValue();return typeof t=="string"?t.length:0}countMessage(t){return(this.props.getCharacterCountMessage??D)(t)}isOverLimit(t){return this.characterCount!==null&&t>this.characterCount.maxLength}composeErrors(t=this.snapshot.count){const e=[...this.injected,...this.custom];return this.characterCount&&this.isOverLimit(t)&&e.push(this.countMessage(this.characterCount.maxLength-t)),e}scheduleCountAnnouncement(t,e){const i=this.characterCount;if(!i)return;if(clearTimeout(this.announceTimer),this.isOverLimit(t)){e||this.options.announce(this.countMessage(i.maxLength-t),"assertive");return}if(!F(t,i.maxLength,i.threshold))return;const r=i.maxLength-t;this.announceTimer=setTimeout(()=>{this.options.announce(this.countMessage(r),"polite")},S)}connect(t){this.root=t,t.setAttribute(l,""),Object.defineProperty(t,p,{value:()=>this.validate(),configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(t,T,{value:()=>this.reset(),configurable:!0,enumerable:!1,writable:!0}),t.addEventListener("input",this.handleInput,!0),t.addEventListener("change",this.handleInput,!0),t.addEventListener("focusout",this.handleFocusOut,!0),this.form=t.closest("form"),this.form&&t.ownerDocument.addEventListener("submit",this.handleSubmit,!0),this.sync();const e=this.readCount();this.update({filled:o(this.resolveValue()),count:e,errors:this.composeErrors(e)})}disconnect(){clearTimeout(this.announceTimer),clearTimeout(this.validationTimer),this.validationTimer=void 0,this.awaitingSubmit=!1;const t=this.root;t&&(t.removeEventListener("input",this.handleInput,!0),t.removeEventListener("change",this.handleInput,!0),t.removeEventListener("focusout",this.handleFocusOut,!0),this.form&&t.ownerDocument.removeEventListener("submit",this.handleSubmit,!0),delete t[p],delete t[T],this.root=null,this.form=null,this.control=null)}sync(){const t=this.root;if(!t)return;const e=A(t);e!==this.control&&(this.control=e,this.baseDescribedBy=e?.getAttribute("aria-describedby")??"",this.baseLabelledBy=e?.getAttribute("aria-labelledby")??"",this.wroteLabelledBy=!1,this.wroteRequired=!1,this.wroteDisabled=!1,this.wroteGroupDisabled=!1);const{name:i}=this.props;i?t.setAttribute(d,i):t.removeAttribute(d);const r=this.snapshot.errors.join(" ");r?t.setAttribute(h,r):t.removeAttribute(h),this.applyStateAttributes(t),e&&(e.id||(e.id=this.options.controlId),e.id!==this.snapshot.controlId&&(this.snapshot={...this.snapshot,controlId:e.id,validity:this.readValidity()},this.options.onSnapshotChange(this.snapshot)),this.applyDescribedBy(t,e),this.snapshot.errors.length>0?e.setAttribute("aria-invalid","true"):e.removeAttribute("aria-invalid"),this.applyLabelledBy(t,e),this.applyConstraintState(e),this.applyStateAttributes(e))}applyDescribedBy(t,e){const i=m(t,`[${R}]`)!==null,r=m(t,`[${_}]`)!==null,s=g(this.baseDescribedBy,i?this.options.descriptionId:void 0,r?this.options.errorId:void 0);s?e.setAttribute("aria-describedby",s):e.removeAttribute("aria-describedby")}applyLabelledBy(t,e){const i=t.ownerDocument.getElementById(this.options.labelId)!==null;this.options.grouped&&i?(e.setAttribute("aria-labelledby",g(this.baseLabelledBy,this.options.labelId)),this.wroteLabelledBy=!0):this.wroteLabelledBy&&(this.baseLabelledBy?e.setAttribute("aria-labelledby",this.baseLabelledBy):e.removeAttribute("aria-labelledby"),this.wroteLabelledBy=!1)}applyConstraintState(t){const e=w.has(t.tagName),i=this.props.required===!0,r=this.props.disabled===!0;i?(e?t.setAttribute("required",""):t.setAttribute("aria-required","true"),this.wroteRequired=!0):this.wroteRequired&&(t.removeAttribute(e?"required":"aria-required"),this.wroteRequired=!1),r?(e?t.setAttribute("disabled",""):t.setAttribute("aria-disabled","true"),this.wroteDisabled=!0):this.wroteDisabled&&(t.removeAttribute(e?"disabled":"aria-disabled"),this.wroteDisabled=!1),e||this.applyGroupDisabled(t,r)}applyGroupDisabled(t,e){const i=t.getAttribute("role");if(!(!(t.tagName==="FIELDSET"||i!==null&&O.has(i))||!e&&!this.wroteGroupDisabled)){for(const r of t.querySelectorAll("input, select, textarea, button"))e?r.setAttribute("disabled",""):r.removeAttribute("disabled");this.wroteGroupDisabled=e}}validate(){return Promise.resolve(this.runValidation()).then(t=>t.length===0)}reset(){this.injected=[],this.custom=[],this.pending=!1,this.awaitingSubmit=!1,this.runToken++,clearTimeout(this.announceTimer),clearTimeout(this.validationTimer),this.validationTimer=void 0,this.markPending(!1);const t=this.readCount();this.update({touched:!1,dirty:!1,count:t,filled:o(this.resolveValue()),errors:this.composeErrors(t)}),this.sync()}markTouched(){this.snapshot.touched||this.update({touched:!0})}applyStateAttributes(t){const{errors:e,touched:i,dirty:r,filled:s,count:n}=this.snapshot;a(t,"data-invalid",e.length>0),a(t,"data-valid",e.length===0),a(t,"data-touched",i),a(t,"data-dirty",r),a(t,"data-filled",s),a(t,"data-over-limit",this.isOverLimit(n)),a(t,"data-disabled",this.props.disabled===!0)}resolveValue(){return this.props.value!==void 0?this.props.value:x(this.control)}readValidity(){return this.control?.validity??null}markPending(t){this.root&&a(this.root,L,t)}nativeMessage(){const t=this.control;return!t?.validity||t.validity.valid?null:t.validationMessage||this.props.invalidMessage||"This field is invalid."}runValidation(t={}){const e=++this.runToken,i=this.props.validate?.(this.resolveValue());return y(i)?(this.pending=!0,this.markPending(!0),Promise.resolve(i).then(r=>e!==this.runToken?this.snapshot.errors:(this.pending=!1,this.markPending(!1),this.commit(r,t)))):this.commit(i,t)}commit(t,e){if(this.custom=f(t),this.custom.length===0){const u=this.nativeMessage();u&&!this.injected.includes(u)&&(this.custom=[u])}const i=this.readCount(),r=this.composeErrors(i),s=this.snapshot.errors.length===0;this.update({errors:r,count:i,filled:o(this.resolveValue())});const n=r[0];return n&&s&&!e.silent&&this.options.announce(n,"assertive"),r}update(t){const e={...this.snapshot,...t,valid:!0,validity:this.readValidity()};e.valid=e.errors.length===0,!X(this.snapshot,e)&&(this.snapshot=e,this.sync(),this.options.onSnapshotChange(e),this.root?.dispatchEvent(new CustomEvent(I,{bubbles:!0,composed:!0,detail:{valid:e.valid,errors:e.errors,touched:e.touched,dirty:e.dirty,filled:e.filled,count:e.count,validity:e.validity}})))}scheduleValidation(){clearTimeout(this.validationTimer),this.validationTimer=void 0;const t=this.props.mode==="change"?this.props.validationDebounceTime??0:0;if(t<=0){this.runValidation();return}this.validationTimer=setTimeout(()=>{this.validationTimer=void 0,this.runValidation()},t)}hasErrorSummary(){return this.form?.querySelector(`[${C}]`)!=null}isEngineResubmit(t){return this.form?.hasAttribute("data-skdx-field-resubmit")?(this.snapshot.errors.length>0&&t.preventDefault(),!0):!1}resubmitIfSettled(){const t=this.form;if(!(!t||typeof t.requestSubmit!="function")&&!t.querySelector("[data-skdx-field-pending]")&&!t.querySelector("[data-skdx-field][data-invalid]")){t.setAttribute(c,"");try{t.requestSubmit()}finally{t.removeAttribute(c)}}}};function y(t){return typeof t?.then=="function"}function Q(t,e){return t.length===e.length&&t.every((i,r)=>i===e[r])}function X(t,e){return t.controlId===e.controlId&&t.valid===e.valid&&t.touched===e.touched&&t.dirty===e.dirty&&t.filled===e.filled&&t.count===e.count&&t.validity===e.validity&&t.errors.length===e.errors.length&&t.errors.every((i,r)=>i===e.errors[r])}exports.CHARACTER_COUNT_ANNOUNCE_DELAY_MS=S;exports.ERROR_SUMMARY_RESCAN_EVENTS=U;exports.FIELD_CHARACTER_COUNT_ATTRIBUTE=k;exports.FIELD_CONTROL_ATTRIBUTE=B;exports.FIELD_CONTROL_SELECTOR=v;exports.FIELD_DESCRIPTION_ATTRIBUTE=R;exports.FIELD_ERROR_ATTRIBUTE=_;exports.FIELD_ERROR_SUMMARY_ATTRIBUTE=C;exports.FIELD_MESSAGE_ATTRIBUTE=h;exports.FIELD_NAME_ATTRIBUTE=d;exports.FIELD_PENDING_ATTRIBUTE=L;exports.FIELD_REQUIRED_INDICATOR_ATTRIBUTE=V;exports.FIELD_RESUBMIT_ATTRIBUTE=c;exports.FIELD_ROOT_ATTRIBUTE=l;exports.FIELD_VALIDITY_CHANGE_EVENT=I;exports.FORM_FIELD_ATTRIBUTE=b;exports.FORM_MESSAGE_ATTRIBUTE=N;exports.FieldController=K;exports.NATIVE_INVALID_FALLBACK_MESSAGE=M;exports.characterCountMessage=D;exports.characterCountVisible=F;exports.collectFieldErrors=j;exports.errorSummaryScope=P;exports.findFieldControl=A;exports.focusFieldTarget=z;exports.isFilled=o;exports.normalizeMessages=f;exports.readControlValue=x;exports.resetFields=H;exports.validateFields=Y;
|
|
1
|
+
var I="validity-change",l="data-skdx-field",d="data-skdx-field-name",h="data-skdx-field-message",R="data-skdx-field-description",_="data-skdx-field-error",k="data-skdx-field-character-count",L="data-skdx-field-pending",c="data-skdx-field-resubmit",b="data-skdx-form-field",N="data-skdx-form-message",U=["validity-change","invalid","change","blur"],C="data-skdx-error-summary",S=1e3;function D(t){const e=Math.abs(t),i=e===1?"character":"characters";return t<0?`You have ${e} ${i} too many`:`You have ${e} ${i} remaining`}function F(t,e,i=0){return i<=0?!0:t>=e*i/100}function M(t){return t.map((e,i)=>i===t.length-1||/[.!?]$/.test(e)?e:`${e}.`).join(" ")}var V="This field is invalid.",B="data-skdx-field-control",v=[`[${B}]`,'input:not([type="hidden"])',"select","textarea",'[role="textbox"]','[role="searchbox"]','[role="combobox"]','[role="listbox"]','[role="radiogroup"]','[role="group"]','[role="slider"]','[role="spinbutton"]','[role="checkbox"]','[role="radio"]','[role="switch"]'].join(", "),w="data-skdx-field-required-indicator",q=new Set(["INPUT","SELECT","TEXTAREA"]),O=new Set(["radiogroup","group"]),P=['input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])","button:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function f(t){return t==null?[]:(Array.isArray(t)?t:[t]).filter(e=>typeof e=="string"&&e.trim()!=="")}function A(t){for(const e of Array.from(t.querySelectorAll(v)))if(e.getAttribute("aria-hidden")!=="true"&&e.closest("[data-skdx-field]")===t)return e;return null}function m(t,e){return p(t,l,e)}function p(t,e,i){for(const r of Array.from(t.querySelectorAll(i)))if(r.closest(`[${e}]`)===t)return r;return null}function x(t){if(!t)return;const e=t;return e.type==="checkbox"||e.type==="radio"?e.checked:"value"in t?e.value:t.querySelector('input[aria-hidden="true"]')?.value}function o(t){return t==null||t===!1||t===""?!1:!(Array.isArray(t)&&t.length===0)}function n(t,e,i){i?t.setAttribute(e,""):t.removeAttribute(e)}function y(t,...e){const i=t.split(/\s+/).filter(Boolean);for(const r of e)r&&!i.includes(r)&&i.push(r);return i.join(" ")}function $(t){return t.closest("form, skdx-form")??t.parentElement??t}function G(t){const e=A(t),i=m(t,"[data-skdx-field-error]")?.textContent?.trim()||t.getAttribute("data-skdx-field-message")||t.getAttribute("data-skdx-field-name")||"";return!e?.id||!i?[]:[{id:e.id,message:i}]}function j(t){const e=p(t,b,v);if(!e?.id||e.getAttribute("aria-invalid")!=="true")return[];const i=p(t,"data-skdx-form-field","[data-skdx-form-message]:not([hidden])")?.textContent?.trim()||t.getAttribute("data-skdx-field-name")||"";return i?[{id:e.id,message:i}]:[]}function Y(t){return Array.from(t.querySelectorAll(`[${l}][data-invalid], [${b}]`)).flatMap(e=>(e.hasAttribute("data-skdx-field")?G:j)(e))}var E="__skdxFieldCheckValidity",T="__skdxFieldReset";async function H(t){const e=Array.from(t.querySelectorAll(`[${l}]`));return(await Promise.all(e.map(i=>i[E]?.()??Promise.resolve(!0)))).every(Boolean)}function z(t){for(const e of Array.from(t.querySelectorAll(`[${l}]`)))e[T]?.()}function K(t,e=document){const i=e.getElementById(t);if(!i)return;const r=i.getAttribute("role"),s=(i.tagName==="FIELDSET"||r!==null&&O.has(r)?i.querySelector(P):null)??i;s.focus(),s.scrollIntoView?.({block:"center"})}var Q=class{constructor(t){this.options=t,this.props={},this.root=null,this.form=null,this.control=null,this.baseDescribedBy="",this.baseLabelledBy="",this.wroteLabelledBy=!1,this.wroteRequired=!1,this.wroteDisabled=!1,this.wroteGroupDisabled=!1,this.runToken=0,this.pending=!1,this.injected=[],this.custom=[],this.characterCount=null,this.awaitingSubmit=!1,this.handleInput=()=>{const e=this.isOverLimit(this.snapshot.count),i=this.readCount();this.update({dirty:!0,filled:o(this.resolveValue()),count:i,errors:this.composeErrors(i)}),this.scheduleCountAnnouncement(i,e),(this.props.mode==="change"||this.snapshot.errors.length>0)&&this.scheduleValidation()},this.handleFocusOut=()=>{const e=this.readCount();this.update({touched:!0,filled:o(this.resolveValue()),count:e,errors:this.composeErrors(e)});const i=this.validationTimer!==void 0;clearTimeout(this.validationTimer),this.validationTimer=void 0;const r=this.props.mode??"blur";(i||r==="blur"||this.snapshot.errors.length>0)&&this.runValidation()},this.handleSubmit=e=>{if(!this.form)return;const i=e.target;if(i!==this.form&&i?.closest?.("form")!==this.form||this.isEngineResubmit(e))return;this.markTouched();const r=this.runValidation({silent:this.hasErrorSummary()});if(g(r)){e.preventDefault(),this.awaitingSubmit=!0,Promise.resolve(r).then(()=>{this.awaitingSubmit&&(this.awaitingSubmit=!1,this.resubmitIfSettled())});return}(r.length>0||this.pending)&&e.preventDefault()},this.snapshot={controlId:"",errors:[],valid:!0,touched:!1,dirty:!1,filled:!1,count:0,validity:null}}get state(){return this.snapshot}setProps(t){const e=this.props.value;this.props=t;const i=f(t.errors??null),r=!X(this.injected,i);r&&(this.injected=i);const s=t.value!==e;if(!r&&!s)return;const a=this.readCount();this.update({count:a,filled:o(this.resolveValue()),errors:this.composeErrors(a)})}setCharacterCount(t){if((this.characterCount?.maxLength??null)===(t?.maxLength??null)&&(this.characterCount?.threshold??0)===(t?.threshold??0))return;this.characterCount=t;const e=this.readCount();this.update({count:e,errors:this.composeErrors(e)})}readCount(){const t=this.resolveValue();return typeof t=="string"?t.length:0}countMessage(t){return(this.props.getCharacterCountMessage??D)(t)}isOverLimit(t){return this.characterCount!==null&&t>this.characterCount.maxLength}composeErrors(t=this.snapshot.count){const e=[...this.injected,...this.custom];return this.characterCount&&this.isOverLimit(t)&&e.push(this.countMessage(this.characterCount.maxLength-t)),e}scheduleCountAnnouncement(t,e){const i=this.characterCount;if(!i)return;if(clearTimeout(this.announceTimer),this.isOverLimit(t)){e||this.options.announce(this.countMessage(i.maxLength-t),"assertive");return}if(!F(t,i.maxLength,i.threshold))return;const r=i.maxLength-t;this.announceTimer=setTimeout(()=>{this.options.announce(this.countMessage(r),"polite")},S)}connect(t){this.root=t,t.setAttribute(l,""),Object.defineProperty(t,E,{value:()=>this.validate(),configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(t,T,{value:()=>this.reset(),configurable:!0,enumerable:!1,writable:!0}),t.addEventListener("input",this.handleInput,!0),t.addEventListener("change",this.handleInput,!0),t.addEventListener("focusout",this.handleFocusOut,!0),this.form=t.closest("form"),this.form&&t.ownerDocument.addEventListener("submit",this.handleSubmit,!0),this.sync();const e=this.readCount();this.update({filled:o(this.resolveValue()),count:e,errors:this.composeErrors(e)})}disconnect(){clearTimeout(this.announceTimer),clearTimeout(this.validationTimer),this.validationTimer=void 0,this.awaitingSubmit=!1;const t=this.root;t&&(t.removeEventListener("input",this.handleInput,!0),t.removeEventListener("change",this.handleInput,!0),t.removeEventListener("focusout",this.handleFocusOut,!0),this.form&&t.ownerDocument.removeEventListener("submit",this.handleSubmit,!0),delete t[E],delete t[T],this.root=null,this.form=null,this.control=null)}sync(){const t=this.root;if(!t)return;const e=A(t);e!==this.control&&(this.control=e,this.baseDescribedBy=e?.getAttribute("aria-describedby")??"",this.baseLabelledBy=e?.getAttribute("aria-labelledby")??"",this.wroteLabelledBy=!1,this.wroteRequired=!1,this.wroteDisabled=!1,this.wroteGroupDisabled=!1);const{name:i}=this.props;i?t.setAttribute(d,i):t.removeAttribute(d);const r=this.snapshot.errors.join(" ");r?t.setAttribute(h,r):t.removeAttribute(h),this.applyStateAttributes(t),e&&(e.id||(e.id=this.options.controlId),e.id!==this.snapshot.controlId&&(this.snapshot={...this.snapshot,controlId:e.id,validity:this.readValidity()},this.options.onSnapshotChange(this.snapshot)),this.applyDescribedBy(t,e),this.snapshot.errors.length>0?e.setAttribute("aria-invalid","true"):e.removeAttribute("aria-invalid"),this.applyLabelledBy(t,e),this.applyConstraintState(e),this.applyStateAttributes(e))}applyDescribedBy(t,e){const i=m(t,`[${R}]`)!==null,r=m(t,`[${_}]`)!==null,s=y(this.baseDescribedBy,i?this.options.descriptionId:void 0,r?this.options.errorId:void 0);s?e.setAttribute("aria-describedby",s):e.removeAttribute("aria-describedby")}applyLabelledBy(t,e){const i=t.ownerDocument.getElementById(this.options.labelId)!==null;this.options.grouped&&i?(e.setAttribute("aria-labelledby",y(this.baseLabelledBy,this.options.labelId)),this.wroteLabelledBy=!0):this.wroteLabelledBy&&(this.baseLabelledBy?e.setAttribute("aria-labelledby",this.baseLabelledBy):e.removeAttribute("aria-labelledby"),this.wroteLabelledBy=!1)}applyConstraintState(t){const e=q.has(t.tagName),i=this.props.required===!0,r=this.props.disabled===!0;i?(e?t.setAttribute("required",""):t.setAttribute("aria-required","true"),this.wroteRequired=!0):this.wroteRequired&&(t.removeAttribute(e?"required":"aria-required"),this.wroteRequired=!1),r?(e?t.setAttribute("disabled",""):t.setAttribute("aria-disabled","true"),this.wroteDisabled=!0):this.wroteDisabled&&(t.removeAttribute(e?"disabled":"aria-disabled"),this.wroteDisabled=!1),e||this.applyGroupDisabled(t,r)}applyGroupDisabled(t,e){const i=t.getAttribute("role");if(!(!(t.tagName==="FIELDSET"||i!==null&&O.has(i))||!e&&!this.wroteGroupDisabled)){for(const r of t.querySelectorAll("input, select, textarea, button"))e?r.setAttribute("disabled",""):r.removeAttribute("disabled");this.wroteGroupDisabled=e}}validate(){return Promise.resolve(this.runValidation()).then(t=>t.length===0)}reset(){this.injected=[],this.custom=[],this.pending=!1,this.awaitingSubmit=!1,this.runToken++,clearTimeout(this.announceTimer),clearTimeout(this.validationTimer),this.validationTimer=void 0,this.markPending(!1);const t=this.readCount();this.update({touched:!1,dirty:!1,count:t,filled:o(this.resolveValue()),errors:this.composeErrors(t)}),this.sync()}markTouched(){this.snapshot.touched||this.update({touched:!0})}applyStateAttributes(t){const{errors:e,touched:i,dirty:r,filled:s,count:a}=this.snapshot;n(t,"data-invalid",e.length>0),n(t,"data-valid",e.length===0),n(t,"data-touched",i),n(t,"data-dirty",r),n(t,"data-filled",s),n(t,"data-over-limit",this.isOverLimit(a)),n(t,"data-disabled",this.props.disabled===!0)}resolveValue(){return this.props.value!==void 0?this.props.value:x(this.control)}readValidity(){return this.control?.validity??null}markPending(t){this.root&&n(this.root,L,t)}nativeMessage(){const t=this.control;return!t?.validity||t.validity.valid?null:t.validationMessage||this.props.invalidMessage||"This field is invalid."}runValidation(t={}){const e=++this.runToken,i=this.props.validate?.(this.resolveValue());return g(i)?(this.pending=!0,this.markPending(!0),Promise.resolve(i).then(r=>e!==this.runToken?this.snapshot.errors:(this.pending=!1,this.markPending(!1),this.commit(r,t)))):this.commit(i,t)}commit(t,e){if(this.custom=f(t),this.custom.length===0){const u=this.nativeMessage();u&&!this.injected.includes(u)&&(this.custom=[u])}const i=this.readCount(),r=this.composeErrors(i),s=this.snapshot.errors.length===0;this.update({errors:r,count:i,filled:o(this.resolveValue())});const a=r[0];return a&&s&&!e.silent&&this.options.announce(a,"assertive"),r}update(t){const e={...this.snapshot,...t,valid:!0,validity:this.readValidity()};e.valid=e.errors.length===0,!J(this.snapshot,e)&&(this.snapshot=e,this.sync(),this.options.onSnapshotChange(e),this.root?.dispatchEvent(new CustomEvent(I,{bubbles:!0,composed:!0,detail:{valid:e.valid,errors:e.errors,touched:e.touched,dirty:e.dirty,filled:e.filled,count:e.count,validity:e.validity}})))}scheduleValidation(){clearTimeout(this.validationTimer),this.validationTimer=void 0;const t=this.props.mode==="change"?this.props.validationDebounceTime??0:0;if(t<=0){this.runValidation();return}this.validationTimer=setTimeout(()=>{this.validationTimer=void 0,this.runValidation()},t)}hasErrorSummary(){return this.form?.querySelector(`[${C}]`)!=null}isEngineResubmit(t){return this.form?.hasAttribute("data-skdx-field-resubmit")?(this.snapshot.errors.length>0&&t.preventDefault(),!0):!1}resubmitIfSettled(){const t=this.form;if(!(!t||typeof t.requestSubmit!="function")&&!t.querySelector("[data-skdx-field-pending]")&&!t.querySelector("[data-skdx-field][data-invalid]")){t.setAttribute(c,"");try{t.requestSubmit()}finally{t.removeAttribute(c)}}}};function g(t){return typeof t?.then=="function"}function X(t,e){return t.length===e.length&&t.every((i,r)=>i===e[r])}function J(t,e){return t.controlId===e.controlId&&t.valid===e.valid&&t.touched===e.touched&&t.dirty===e.dirty&&t.filled===e.filled&&t.count===e.count&&t.validity===e.validity&&t.errors.length===e.errors.length&&t.errors.every((i,r)=>i===e.errors[r])}exports.CHARACTER_COUNT_ANNOUNCE_DELAY_MS=S;exports.ERROR_SUMMARY_RESCAN_EVENTS=U;exports.FIELD_CHARACTER_COUNT_ATTRIBUTE=k;exports.FIELD_CONTROL_ATTRIBUTE=B;exports.FIELD_CONTROL_SELECTOR=v;exports.FIELD_DESCRIPTION_ATTRIBUTE=R;exports.FIELD_ERROR_ATTRIBUTE=_;exports.FIELD_ERROR_SUMMARY_ATTRIBUTE=C;exports.FIELD_MESSAGE_ATTRIBUTE=h;exports.FIELD_NAME_ATTRIBUTE=d;exports.FIELD_PENDING_ATTRIBUTE=L;exports.FIELD_REQUIRED_INDICATOR_ATTRIBUTE=w;exports.FIELD_RESUBMIT_ATTRIBUTE=c;exports.FIELD_ROOT_ATTRIBUTE=l;exports.FIELD_VALIDITY_CHANGE_EVENT=I;exports.FORM_FIELD_ATTRIBUTE=b;exports.FORM_MESSAGE_ATTRIBUTE=N;exports.FieldController=Q;exports.NATIVE_INVALID_FALLBACK_MESSAGE=V;exports.characterCountMessage=D;exports.characterCountVisible=F;exports.collectFieldErrors=Y;exports.errorSummaryScope=$;exports.findFieldControl=A;exports.focusFieldTarget=K;exports.isFilled=o;exports.joinFieldMessages=M;exports.normalizeMessages=f;exports.readControlValue=x;exports.resetFields=z;exports.validateFields=H;
|
|
@@ -46,6 +46,8 @@ export interface FieldCharacterCountOptions {
|
|
|
46
46
|
export declare function characterCountMessage(remaining: number): string;
|
|
47
47
|
/** Whether a count has passed its threshold and should be rendered/announced. */
|
|
48
48
|
export declare function characterCountVisible(count: number, maxLength: number, threshold?: number): boolean;
|
|
49
|
+
/** Joins a Field's messages into one string, separated by a period unless a message already ends in sentence punctuation. */
|
|
50
|
+
export declare function joinFieldMessages(messages: string[]): string;
|
|
49
51
|
/** Fallback message when native constraint validation has no `validationMessage`. */
|
|
50
52
|
export declare const NATIVE_INVALID_FALLBACK_MESSAGE = "This field is invalid.";
|
|
51
53
|
/** Marks an element as this Field's control, an escape hatch for composites in shadow DOM. */
|
|
@@ -46,6 +46,8 @@ export interface FieldCharacterCountOptions {
|
|
|
46
46
|
export declare function characterCountMessage(remaining: number): string;
|
|
47
47
|
/** Whether a count has passed its threshold and should be rendered/announced. */
|
|
48
48
|
export declare function characterCountVisible(count: number, maxLength: number, threshold?: number): boolean;
|
|
49
|
+
/** Joins a Field's messages into one string, separated by a period unless a message already ends in sentence punctuation. */
|
|
50
|
+
export declare function joinFieldMessages(messages: string[]): string;
|
|
49
51
|
/** Fallback message when native constraint validation has no `validationMessage`. */
|
|
50
52
|
export declare const NATIVE_INVALID_FALLBACK_MESSAGE = "This field is invalid.";
|
|
51
53
|
/** Marks an element as this Field's control, an escape hatch for composites in shadow DOM. */
|