@vialiq/web-components 0.18.0 → 0.20.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/README.md +516 -118
- package/base/controllers/floating-controller.d.ts +1 -1
- package/base/controllers/floating-controller.d.ts.map +1 -1
- package/base/draggable-mixin.d.ts.map +1 -1
- package/base/focus-trap-mixin.d.ts.map +1 -1
- package/base/overlay-manager.d.ts +10 -1
- package/base/overlay-manager.d.ts.map +1 -1
- package/base/resizable-mixin.d.ts.map +1 -1
- package/button/vi-button.d.ts +2 -0
- package/button/vi-button.d.ts.map +1 -1
- package/button/vi-button.js +40 -11
- package/index.d.ts +7 -0
- package/index.js +6 -0
- package/keyboard-controller-DqpJtUuK.js +320 -0
- package/{overlay-manager-xco6S92C.js → overlay-manager-Ch_6fr_D.js} +61 -2
- package/package.json +2 -2
- package/tooltip/vi-tooltip.js +1 -1
|
@@ -24,7 +24,7 @@ export interface FloatingControllerOptions {
|
|
|
24
24
|
/** Element or selector string to constrain flipping. */
|
|
25
25
|
boundary?: () => HTMLElement | string | null;
|
|
26
26
|
/** Whether the floating element should be forced to match the reference element's width. */
|
|
27
|
-
matchWidth?: boolean;
|
|
27
|
+
matchWidth?: boolean | (() => boolean);
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* FloatingController
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floating-controller.d.ts","sourceRoot":"","sources":["../../../../../libs/web-components/src/base/controllers/floating-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,KAAK,CAAC;AACjE,OAAO,EAAmD,KAAK,SAAS,EAAmB,MAAM,kBAAkB,CAAC;AAGpH;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,qEAAqE;IACrE,SAAS,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IACpC,sEAAsE;IACtE,QAAQ,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IACnC,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,SAAS,CAAC;IAC5B,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC;IACtB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,WAAW,GAAG,MAAM,GAAG,IAAI,CAAC;IAC7C,4FAA4F;IAC5F,UAAU,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"floating-controller.d.ts","sourceRoot":"","sources":["../../../../../libs/web-components/src/base/controllers/floating-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,KAAK,CAAC;AACjE,OAAO,EAAmD,KAAK,SAAS,EAAmB,MAAM,kBAAkB,CAAC;AAGpH;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,qEAAqE;IACrE,SAAS,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IACpC,sEAAsE;IACtE,QAAQ,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IACnC,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,SAAS,CAAC;IAC5B,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC;IACtB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,WAAW,GAAG,MAAM,GAAG,IAAI,CAAC;IAC7C,4FAA4F;IAC5F,UAAU,CAAC,EAAE,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,CAAC;CACxC;AAED;;;;;;;;;GASG;AACH,qBAAa,kBAAmB,YAAW,kBAAkB;IAKzD,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,OAAO;IALjB,OAAO,CAAC,QAAQ,CAAC,CAAa;IAC9B,OAAO,CAAC,cAAc,CAAuB;gBAGnC,IAAI,EAAE,sBAAsB,EAC5B,OAAO,EAAE,yBAAyB;IAK5C,gBAAgB;IAIhB;;;;;OAKG;IACH,KAAK;IAyBL;;;;;OAKG;IACH,IAAI;IAgBJ;;;;;;OAMG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CA0DtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draggable-mixin.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/base/draggable-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAItD,KAAK,WAAW,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAEzD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE7D,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,eAAe,CAAC;IACjC,SAAS,KAAK,WAAW,IAAI,WAAW,GAAG,IAAI,CAAC;IAChD,SAAS,KAAK,WAAW,IAAI,WAAW,GAAG,IAAI,CAAC;IAChD,SAAS,CAAC,UAAU,IAAI,IAAI;IAC5B,SAAS,CAAC,SAAS,IAAI,IAAI;CAC5B;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,WAAW,CAAC,UAAU,CAAC,EAC9D,IAAI,EAAE,CAAC,GACN,CAAC,GAAG,WAAW,CAAC,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"draggable-mixin.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/base/draggable-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAItD,KAAK,WAAW,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAEzD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE7D,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,eAAe,CAAC;IACjC,SAAS,KAAK,WAAW,IAAI,WAAW,GAAG,IAAI,CAAC;IAChD,SAAS,KAAK,WAAW,IAAI,WAAW,GAAG,IAAI,CAAC;IAChD,SAAS,CAAC,UAAU,IAAI,IAAI;IAC5B,SAAS,CAAC,SAAS,IAAI,IAAI;CAC5B;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,WAAW,CAAC,UAAU,CAAC,EAC9D,IAAI,EAAE,CAAC,GACN,CAAC,GAAG,WAAW,CAAC,kBAAkB,CAAC,CAgTrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focus-trap-mixin.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/base/focus-trap-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAKjC,KAAK,WAAW,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"focus-trap-mixin.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/base/focus-trap-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAKjC,KAAK,WAAW,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAUzD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC;;;;;;;;OAQG;IACH,SAAS,CAAC,kBAAkB,CAC1B,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,EACjC,SAAS,CAAC,EAAE,OAAO,GAClB,IAAI;IAEP;;;;OAIG;IACH,SAAS,CAAC,oBAAoB,CAAC,WAAW,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI;CACvE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6FG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,WAAW,CAAC,UAAU,CAAC,EAC9D,IAAI,EAAE,CAAC,GACN,CAAC,GAAG,WAAW,CAAC,kBAAkB,CAAC,CAkRrC"}
|
|
@@ -15,6 +15,8 @@ declare class OverlayManagerService {
|
|
|
15
15
|
private getBaseZIndex;
|
|
16
16
|
private overlays;
|
|
17
17
|
private _previousOverflow;
|
|
18
|
+
private _previousPaddingRight;
|
|
19
|
+
private _inertedElements;
|
|
18
20
|
/**
|
|
19
21
|
* Registers an element as an active overlay.
|
|
20
22
|
* Calculates and returns the appropriate z-index for this overlay.
|
|
@@ -24,7 +26,9 @@ declare class OverlayManagerService {
|
|
|
24
26
|
* @param scrollStrategy How this overlay interacts with background scrolling.
|
|
25
27
|
* @returns The calculated z-index to be applied to the element.
|
|
26
28
|
*/
|
|
27
|
-
register(element: HTMLElement, type?: OverlayType, scrollStrategy?: ScrollStrategy
|
|
29
|
+
register(element: HTMLElement, type?: OverlayType, scrollStrategy?: ScrollStrategy, options?: {
|
|
30
|
+
noBackdrop?: boolean;
|
|
31
|
+
}): number;
|
|
28
32
|
/**
|
|
29
33
|
* Unregisters an element, removing it from the overlay stack.
|
|
30
34
|
* Should be called when the overlay is closed or disconnected from the DOM.
|
|
@@ -47,6 +51,11 @@ declare class OverlayManagerService {
|
|
|
47
51
|
* @returns True if the element has the highest z-index in the registry.
|
|
48
52
|
*/
|
|
49
53
|
isTopOverlay(element: HTMLElement): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Syncs the `inert` attribute on `document.body` children based on the active overlay stack.
|
|
56
|
+
* Modals with a backdrop trap focus globally, so everything beneath them must be `inert`.
|
|
57
|
+
*/
|
|
58
|
+
private _syncInertState;
|
|
50
59
|
/**
|
|
51
60
|
* Locks or unlocks the document.body scroll based on the active overlays.
|
|
52
61
|
* Modals (and other overlays with scrollStrategy='block') require the body
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay-manager.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/base/overlay-manager.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC;AACrE,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"overlay-manager.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/base/overlay-manager.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC;AACrE,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,CAAC;AAU9C;;;;;;;;;;GAUG;AACH,cAAM,qBAAqB;IACzB,OAAO,CAAC,aAAa;IAiBrB,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,iBAAiB,CAAuB;IAChD,OAAO,CAAC,qBAAqB,CAAuB;IACpD,OAAO,CAAC,gBAAgB,CAAqB;IAE7C;;;;;;;;OAQG;IACI,QAAQ,CACb,OAAO,EAAE,WAAW,EACpB,IAAI,GAAE,WAAwB,EAC9B,cAAc,CAAC,EAAE,cAAc,EAC/B,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,GACjC,MAAM;IAyBT;;;;;OAKG;IACI,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAM7C;;;;;OAKG;IACI,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI;IAKrD;;;;;;OAMG;IACI,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO;IAQlD;;;OAGG;IACH,OAAO,CAAC,eAAe;IA4CvB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;CAyC1B;AAGD,eAAO,MAAM,cAAc,uBAA8B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resizable-mixin.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/base/resizable-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"resizable-mixin.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/base/resizable-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAGV,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAIb,KAAK,WAAW,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAEzD,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,KAAK,aAAa,IAAI,WAAW,GAAG,IAAI,CAAC;IAClD,SAAS,CAAC,oBAAoB,IAAI,cAAc;IAChD,SAAS,CAAC,YAAY,IAAI,IAAI;CAC/B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,WAAW,CAAC,UAAU,CAAC,EAC9D,IAAI,EAAE,CAAC,GACN,CAAC,GAAG,WAAW,CAAC,kBAAkB,CAAC,CA2NrC"}
|
package/button/vi-button.d.ts
CHANGED
|
@@ -53,6 +53,8 @@ export declare class ViButton extends ViButton_base {
|
|
|
53
53
|
accessor iconOnly: boolean;
|
|
54
54
|
/** Disables the button. */
|
|
55
55
|
accessor disabled: boolean;
|
|
56
|
+
/** The button type — 'button', 'submit', or 'reset'. Forwarded to the inner native button. */
|
|
57
|
+
accessor type: 'button' | 'submit' | 'reset';
|
|
56
58
|
/** Accessible label forwarded to the inner native button. */
|
|
57
59
|
accessor ariaLabel: string | null;
|
|
58
60
|
private accessor _hasIcon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vi-button.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/button/vi-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAG9F,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAE9F;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnD;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,KAAK,CAAC;;AAElD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBACa,QAAS,SAAQ,aAAyB;IACrD,OAAgB,MAAM,0BAAmC;IAEzD,cAAuB,iBAAiB,IAAI,iBAAiB,GAAG,IAAI,CAEnE;IAED,sBAAsB;IACqB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAa;IAEvF,mDAAmD;IACR,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAQ;IAE5E,sHAAsH;IAC9C,QAAQ,CAAC,aAAa,EAAE,mBAAmB,CAAW;IAE9H,0EAA0E;IACL,QAAQ,CAAC,SAAS,UAAS;IAEhG,kGAAkG;IAC9B,QAAQ,CAAC,QAAQ,UAAS;IAE9F,2BAA2B;IACiB,QAAQ,CAAC,QAAQ,UAAS;IAEtE,6DAA6D;IAC7D,SAAyD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEhF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAElC,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAe/C,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,OAAO;
|
|
1
|
+
{"version":3,"file":"vi-button.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/button/vi-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAG9F,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAE9F;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnD;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,KAAK,CAAC;;AAElD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBACa,QAAS,SAAQ,aAAyB;IACrD,OAAgB,MAAM,0BAAmC;IAEzD,cAAuB,iBAAiB,IAAI,iBAAiB,GAAG,IAAI,CAEnE;IAED,sBAAsB;IACqB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAa;IAEvF,mDAAmD;IACR,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAQ;IAE5E,sHAAsH;IAC9C,QAAQ,CAAC,aAAa,EAAE,mBAAmB,CAAW;IAE9H,0EAA0E;IACL,QAAQ,CAAC,SAAS,UAAS;IAEhG,kGAAkG;IAC9B,QAAQ,CAAC,QAAQ,UAAS;IAE9F,2BAA2B;IACiB,QAAQ,CAAC,QAAQ,UAAS;IAEtE,8FAA8F;IACnD,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAY;IAEnG,6DAA6D;IAC7D,SAAyD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEhF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAElC,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAe/C,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,OAAO;IAwBN,MAAM,IAAI,cAAc;CAwBlC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
|
package/button/vi-button.js
CHANGED
|
@@ -380,7 +380,7 @@ function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
|
|
|
380
380
|
function _identity(x) {
|
|
381
381
|
return x;
|
|
382
382
|
}
|
|
383
|
-
var _dec, _initClass, _FocusableMixin, _dec1, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, /** Visual variant. */ _init_variant, /** Size scale — controls padding and font-size. */ _init_size, /** Icon placement: 'start' (before label) or 'end' (after label). CSS order handles it — no DOM changes on toggle. */ _init_iconPlacement, /** When true, stretches the button to fill the width of its container. */ _init_fullWidth, /** When true, styles the button for an icon-only layout (typically square with equal padding). */ _init_iconOnly, /** Disables the button. */ _init_disabled, /** Accessible label forwarded to the inner native button. */ _init_ariaLabel, _init__hasIcon, _initProto;
|
|
383
|
+
var _dec, _initClass, _FocusableMixin, _dec1, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, /** Visual variant. */ _init_variant, /** Size scale — controls padding and font-size. */ _init_size, /** Icon placement: 'start' (before label) or 'end' (after label). CSS order handles it — no DOM changes on toggle. */ _init_iconPlacement, /** When true, stretches the button to fill the width of its container. */ _init_fullWidth, /** When true, styles the button for an icon-only layout (typically square with equal padding). */ _init_iconOnly, /** Disables the button. */ _init_disabled, /** The button type — 'button', 'submit', or 'reset'. Forwarded to the inner native button. */ _init_type, /** Accessible label forwarded to the inner native button. */ _init_ariaLabel, _init__hasIcon, _initProto;
|
|
384
384
|
let _ViButton;
|
|
385
385
|
_dec = customElement('vi-button'), _dec1 = property({
|
|
386
386
|
type: String,
|
|
@@ -404,8 +404,11 @@ _dec = customElement('vi-button'), _dec1 = property({
|
|
|
404
404
|
type: Boolean,
|
|
405
405
|
reflect: true
|
|
406
406
|
}), _dec7 = property({
|
|
407
|
+
type: String,
|
|
408
|
+
reflect: true
|
|
409
|
+
}), _dec8 = property({
|
|
407
410
|
attribute: 'aria-label'
|
|
408
|
-
}),
|
|
411
|
+
}), _dec9 = state();
|
|
409
412
|
new class extends _identity {
|
|
410
413
|
constructor(){
|
|
411
414
|
super(_ViButton), _initClass();
|
|
@@ -413,7 +416,7 @@ new class extends _identity {
|
|
|
413
416
|
static{
|
|
414
417
|
class ViButton extends (_FocusableMixin = FocusableMixin(ViElement)) {
|
|
415
418
|
static{
|
|
416
|
-
({ e: [_init_variant, _init_size, _init_iconPlacement, _init_fullWidth, _init_iconOnly, _init_disabled, _init_ariaLabel, _init__hasIcon, _initProto], c: [_ViButton, _initClass] } = _apply_decs_2203_r(this, [
|
|
419
|
+
({ e: [_init_variant, _init_size, _init_iconPlacement, _init_fullWidth, _init_iconOnly, _init_disabled, _init_type, _init_ariaLabel, _init__hasIcon, _initProto], c: [_ViButton, _initClass] } = _apply_decs_2203_r(this, [
|
|
417
420
|
[
|
|
418
421
|
_dec1,
|
|
419
422
|
1,
|
|
@@ -447,11 +450,16 @@ new class extends _identity {
|
|
|
447
450
|
[
|
|
448
451
|
_dec7,
|
|
449
452
|
1,
|
|
450
|
-
"
|
|
453
|
+
"type"
|
|
451
454
|
],
|
|
452
455
|
[
|
|
453
456
|
_dec8,
|
|
454
457
|
1,
|
|
458
|
+
"ariaLabel"
|
|
459
|
+
],
|
|
460
|
+
[
|
|
461
|
+
_dec9,
|
|
462
|
+
1,
|
|
455
463
|
"_hasIcon"
|
|
456
464
|
]
|
|
457
465
|
], [
|
|
@@ -504,19 +512,26 @@ new class extends _identity {
|
|
|
504
512
|
set disabled(_v) {
|
|
505
513
|
this.#___private_disabled_6 = _v;
|
|
506
514
|
}
|
|
507
|
-
#
|
|
515
|
+
#___private_type_7 = _init_type(this, 'button');
|
|
516
|
+
get type() {
|
|
517
|
+
return this.#___private_type_7;
|
|
518
|
+
}
|
|
519
|
+
set type(_v) {
|
|
520
|
+
this.#___private_type_7 = _v;
|
|
521
|
+
}
|
|
522
|
+
#___private_ariaLabel_8 = _init_ariaLabel(this, null);
|
|
508
523
|
get ariaLabel() {
|
|
509
|
-
return this.#
|
|
524
|
+
return this.#___private_ariaLabel_8;
|
|
510
525
|
}
|
|
511
526
|
set ariaLabel(_v) {
|
|
512
|
-
this.#
|
|
527
|
+
this.#___private_ariaLabel_8 = _v;
|
|
513
528
|
}
|
|
514
|
-
#
|
|
529
|
+
#___private__hasIcon_9 = _init__hasIcon(this, false);
|
|
515
530
|
get _hasIcon() {
|
|
516
|
-
return this.#
|
|
531
|
+
return this.#___private__hasIcon_9;
|
|
517
532
|
}
|
|
518
533
|
set _hasIcon(_v) {
|
|
519
|
-
this.#
|
|
534
|
+
this.#___private__hasIcon_9 = _v;
|
|
520
535
|
}
|
|
521
536
|
updated(changed) {
|
|
522
537
|
super.updated(changed);
|
|
@@ -542,6 +557,20 @@ new class extends _identity {
|
|
|
542
557
|
if (this.disabled) {
|
|
543
558
|
event.preventDefault();
|
|
544
559
|
event.stopImmediatePropagation();
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
// Shadow DOM isolation: a <button type="reset|submit"> inside a shadow root
|
|
563
|
+
// cannot natively interact with the parent form. We must do it manually.
|
|
564
|
+
if (this.type === 'reset' || this.type === 'submit') {
|
|
565
|
+
const form = event.composedPath().find((n)=>n instanceof HTMLFormElement);
|
|
566
|
+
if (form) {
|
|
567
|
+
if (this.type === 'reset') {
|
|
568
|
+
form.reset();
|
|
569
|
+
} else {
|
|
570
|
+
const submitter = event.currentTarget instanceof HTMLButtonElement ? event.currentTarget : undefined;
|
|
571
|
+
form.requestSubmit(submitter);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
545
574
|
}
|
|
546
575
|
}
|
|
547
576
|
render() {
|
|
@@ -550,7 +579,7 @@ new class extends _identity {
|
|
|
550
579
|
<button
|
|
551
580
|
class="button"
|
|
552
581
|
part="button"
|
|
553
|
-
type
|
|
582
|
+
type=${this.type}
|
|
554
583
|
tabindex="0"
|
|
555
584
|
?disabled=${disabled}
|
|
556
585
|
aria-label=${this.ariaLabel ?? nothing}
|
package/index.d.ts
CHANGED
|
@@ -25,6 +25,10 @@ export { ViBadge } from './badge/vi-badge.js';
|
|
|
25
25
|
export type { BadgeVariant, BadgeSize } from './badge/vi-badge.js';
|
|
26
26
|
export { ViAlert } from './alert/vi-alert.js';
|
|
27
27
|
export type { AlertVariant } from './alert/vi-alert.js';
|
|
28
|
+
export { ViModal } from './modal/vi-modal.js';
|
|
29
|
+
export type { ModalVariant, DrawerPlacement, ModalSize } from './modal/vi-modal.js';
|
|
30
|
+
export { ViModalHeader } from './modal/vi-modal-header.js';
|
|
31
|
+
export { ViModalFooter } from './modal/vi-modal-footer.js';
|
|
28
32
|
export { ViChip } from './chip/vi-chip.js';
|
|
29
33
|
export type { ChipVariant, ChipSize } from './chip/vi-chip.js';
|
|
30
34
|
export { ViChipGroup } from './chip/vi-chip-group.js';
|
|
@@ -34,4 +38,7 @@ export { ViTag } from './tag/vi-tag.js';
|
|
|
34
38
|
export type { TagVariant, TagAppearance, TagSize } from './tag/vi-tag.js';
|
|
35
39
|
export { ViSwitch } from './switch/vi-switch.js';
|
|
36
40
|
export type { SwitchSize, LabelPlacement } from './switch/vi-switch.js';
|
|
41
|
+
export { ViSelect } from './select/vi-select.js';
|
|
42
|
+
export { ViSelectOption } from './select/vi-select-option.js';
|
|
43
|
+
export { ViSelectGroup } from './select/vi-select-group.js';
|
|
37
44
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -12,8 +12,14 @@ export { ViAccordion } from './accordion/vi-accordion.js';
|
|
|
12
12
|
export { ViAccordionItem } from './accordion/vi-accordion-item.js';
|
|
13
13
|
export { ViBadge } from './badge/vi-badge.js';
|
|
14
14
|
export { ViAlert } from './alert/vi-alert.js';
|
|
15
|
+
export { ViModal } from './modal/vi-modal.js';
|
|
16
|
+
export { ViModalHeader } from './modal/vi-modal-header.js';
|
|
17
|
+
export { ViModalFooter } from './modal/vi-modal-footer.js';
|
|
15
18
|
export { ViChip } from './chip/vi-chip.js';
|
|
16
19
|
export { ViChipGroup } from './chip/vi-chip-group.js';
|
|
17
20
|
export { ViAnimation } from './animation/vi-animation.js';
|
|
18
21
|
export { ViTag } from './tag/vi-tag.js';
|
|
19
22
|
export { ViSwitch } from './switch/vi-switch.js';
|
|
23
|
+
export { ViSelect } from './select/vi-select.js';
|
|
24
|
+
export { ViSelectOption } from './select/vi-select-option.js';
|
|
25
|
+
export { ViSelectGroup } from './select/vi-select-group.js';
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { autoUpdate, offset, flip, size, computePosition } from '@floating-ui/dom';
|
|
2
|
+
import { O as OverlayManager } from './overlay-manager-Ch_6fr_D.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* FloatingController
|
|
6
|
+
*
|
|
7
|
+
* A Lit Reactive Controller that manages `@floating-ui/dom` positioning logic.
|
|
8
|
+
* It abstracts away the complex math and event listeners (autoUpdate) required to
|
|
9
|
+
* keep a popup/dropdown anchored to a reference element during scrolling/resizing.
|
|
10
|
+
*
|
|
11
|
+
* It also automatically registers the floating element with the `OverlayManager`
|
|
12
|
+
* to ensure correct z-index stacking when `hoist` is true.
|
|
13
|
+
*/ class FloatingController {
|
|
14
|
+
host;
|
|
15
|
+
options;
|
|
16
|
+
_cleanup;
|
|
17
|
+
_overlayZIndex = null;
|
|
18
|
+
constructor(host, options){
|
|
19
|
+
this.host = host;
|
|
20
|
+
this.options = options;
|
|
21
|
+
this.host.addController(this);
|
|
22
|
+
}
|
|
23
|
+
hostDisconnected() {
|
|
24
|
+
this.stop();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Starts the floating UI `autoUpdate` listener cycle.
|
|
28
|
+
* This should be called when the popover physically opens (e.g., in `updated()`).
|
|
29
|
+
*
|
|
30
|
+
* If `hoist` is true, it also acquires a high z-index from the `OverlayManager`.
|
|
31
|
+
*/ start() {
|
|
32
|
+
const ref = this.options.reference();
|
|
33
|
+
const floating = this.options.floating();
|
|
34
|
+
if (!ref || !floating) return;
|
|
35
|
+
// autoUpdate automatically cleans up previous listeners if called multiple times,
|
|
36
|
+
// but it's safer to just track and call cleanup manually.
|
|
37
|
+
if (this._cleanup) this.stop();
|
|
38
|
+
const hoist = this.options.hoist?.() ?? false;
|
|
39
|
+
// Register with OverlayManager if hoisted
|
|
40
|
+
if (hoist) {
|
|
41
|
+
this._overlayZIndex = OverlayManager.register(floating, 'dropdown');
|
|
42
|
+
floating.style.zIndex = this._overlayZIndex.toString();
|
|
43
|
+
}
|
|
44
|
+
this._cleanup = autoUpdate(ref, floating, ()=>this.updatePosition(), {
|
|
45
|
+
animationFrame: false
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Stops the floating UI `autoUpdate` listener cycle.
|
|
50
|
+
* This should be called when the popover closes, or when the host component disconnects.
|
|
51
|
+
*
|
|
52
|
+
* It also releases its z-index back to the `OverlayManager`.
|
|
53
|
+
*/ stop() {
|
|
54
|
+
if (this._cleanup) {
|
|
55
|
+
this._cleanup();
|
|
56
|
+
this._cleanup = undefined;
|
|
57
|
+
}
|
|
58
|
+
const floating = this.options.floating();
|
|
59
|
+
if (floating && this._overlayZIndex !== null) {
|
|
60
|
+
OverlayManager.unregister(floating);
|
|
61
|
+
this._overlayZIndex = null;
|
|
62
|
+
// Remove inline z-index only if we managed it
|
|
63
|
+
floating.style.removeProperty('z-index');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Imperatively calculates and applies the new coordinates (`x`, `y`) using Floating UI.
|
|
68
|
+
*
|
|
69
|
+
* This method applies various CSS property resets (`margin`, `bottom`, `right`, `minWidth`)
|
|
70
|
+
* to ensure that the base CSS of the floating element does not distort the absolute coordinates
|
|
71
|
+
* provided by Floating UI.
|
|
72
|
+
*/ async updatePosition() {
|
|
73
|
+
const ref = this.options.reference();
|
|
74
|
+
const floating = this.options.floating();
|
|
75
|
+
if (!ref || !floating) return;
|
|
76
|
+
const placementStr = this.options.placement?.() ?? 'bottom-start';
|
|
77
|
+
const hoist = this.options.hoist?.() ?? false;
|
|
78
|
+
const boundaryOpt = this.options.boundary?.();
|
|
79
|
+
let boundaryElement = 'clippingAncestors';
|
|
80
|
+
if (boundaryOpt instanceof HTMLElement) {
|
|
81
|
+
boundaryElement = boundaryOpt;
|
|
82
|
+
} else if (typeof boundaryOpt === 'string' && boundaryOpt) {
|
|
83
|
+
const customBoundary = document.querySelector(boundaryOpt);
|
|
84
|
+
if (customBoundary) boundaryElement = customBoundary;
|
|
85
|
+
}
|
|
86
|
+
const middlewares = [
|
|
87
|
+
offset(this.options.offset ?? 4),
|
|
88
|
+
flip({
|
|
89
|
+
boundary: boundaryElement,
|
|
90
|
+
fallbackPlacements: [
|
|
91
|
+
'top-start',
|
|
92
|
+
'bottom-start',
|
|
93
|
+
'top-end',
|
|
94
|
+
'bottom-end'
|
|
95
|
+
]
|
|
96
|
+
})
|
|
97
|
+
];
|
|
98
|
+
const matchWidthVal = typeof this.options.matchWidth === 'function' ? this.options.matchWidth() : this.options.matchWidth;
|
|
99
|
+
middlewares.push(size({
|
|
100
|
+
apply: ({ rects })=>{
|
|
101
|
+
if (matchWidthVal !== false) {
|
|
102
|
+
Object.assign(floating.style, {
|
|
103
|
+
width: `${rects.reference.width}px`,
|
|
104
|
+
minWidth: 'auto'
|
|
105
|
+
});
|
|
106
|
+
} else {
|
|
107
|
+
Object.assign(floating.style, {
|
|
108
|
+
width: 'auto',
|
|
109
|
+
minWidth: `${rects.reference.width}px`
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}));
|
|
114
|
+
const { x, y, placement } = await computePosition(ref, floating, {
|
|
115
|
+
placement: placementStr,
|
|
116
|
+
strategy: hoist ? 'fixed' : 'absolute',
|
|
117
|
+
middleware: middlewares
|
|
118
|
+
});
|
|
119
|
+
floating.setAttribute('data-placement', placement);
|
|
120
|
+
Object.assign(floating.style, {
|
|
121
|
+
left: `${x}px`,
|
|
122
|
+
top: `${y}px`,
|
|
123
|
+
right: 'auto',
|
|
124
|
+
bottom: 'auto',
|
|
125
|
+
position: hoist ? 'fixed' : 'absolute',
|
|
126
|
+
margin: '0'
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
class ListboxKeyboardController {
|
|
132
|
+
host;
|
|
133
|
+
config;
|
|
134
|
+
_searchString = '';
|
|
135
|
+
_searchTimeout;
|
|
136
|
+
constructor(host, config){
|
|
137
|
+
this.host = host;
|
|
138
|
+
this.config = config;
|
|
139
|
+
this.host.addController(this);
|
|
140
|
+
}
|
|
141
|
+
hostConnected() {}
|
|
142
|
+
handleKeyDown(e) {
|
|
143
|
+
if (this.host.disabled) return;
|
|
144
|
+
const options = this.config.getFilteredOptions();
|
|
145
|
+
const isSlotted = this.config.getSlottedItems().length > 0;
|
|
146
|
+
const activeIndex = this.config.getActiveIndex();
|
|
147
|
+
switch(e.key){
|
|
148
|
+
case 'ArrowDown':
|
|
149
|
+
e.preventDefault();
|
|
150
|
+
if (!this.host.open) this.config.openDropdown();
|
|
151
|
+
this._navigate(1);
|
|
152
|
+
break;
|
|
153
|
+
case 'ArrowUp':
|
|
154
|
+
e.preventDefault();
|
|
155
|
+
if (!this.host.open) this.config.openDropdown();
|
|
156
|
+
this._navigate(-1);
|
|
157
|
+
break;
|
|
158
|
+
case 'Enter':
|
|
159
|
+
e.preventDefault();
|
|
160
|
+
if (this.host.open) {
|
|
161
|
+
if (isSlotted) {
|
|
162
|
+
const visible = this.config.getVisibleSlottedItems();
|
|
163
|
+
if (activeIndex >= 0 && activeIndex < visible.length) {
|
|
164
|
+
const item = visible[activeIndex];
|
|
165
|
+
this.config.selectOption({
|
|
166
|
+
value: item.value,
|
|
167
|
+
label: item.label || item.value,
|
|
168
|
+
searchText: item.searchText.length > 0 ? item.searchText.join(' ') : undefined,
|
|
169
|
+
group: item.group || undefined,
|
|
170
|
+
disabled: item.disabled,
|
|
171
|
+
icon: item.icon || undefined,
|
|
172
|
+
description: item.description || undefined,
|
|
173
|
+
data: item.data
|
|
174
|
+
});
|
|
175
|
+
} else if (this.host.mode === 'tags' || this.host.mode === 'creatable') {
|
|
176
|
+
this.config.handleCreate();
|
|
177
|
+
}
|
|
178
|
+
} else if (activeIndex >= 0 && activeIndex < options.length) {
|
|
179
|
+
this.config.selectOption(options[activeIndex]);
|
|
180
|
+
} else if (this.host.mode === 'tags' || this.host.mode === 'creatable') {
|
|
181
|
+
this.config.handleCreate();
|
|
182
|
+
}
|
|
183
|
+
} else if (this.host.mode === 'tags' || this.host.mode === 'creatable') {
|
|
184
|
+
this.config.handleCreate();
|
|
185
|
+
} else {
|
|
186
|
+
this.config.openDropdown();
|
|
187
|
+
}
|
|
188
|
+
break;
|
|
189
|
+
case ',':
|
|
190
|
+
if (this.host.mode === 'tags') {
|
|
191
|
+
e.preventDefault();
|
|
192
|
+
this.config.handleCreate();
|
|
193
|
+
}
|
|
194
|
+
break;
|
|
195
|
+
case 'Escape':
|
|
196
|
+
if (this.host.open) {
|
|
197
|
+
e.preventDefault();
|
|
198
|
+
this.config.close();
|
|
199
|
+
}
|
|
200
|
+
break;
|
|
201
|
+
case 'Backspace':
|
|
202
|
+
if (this.host.isSearchable && !this.config.getQuery() && (this.host.mode === 'multi' || this.host.mode === 'tags')) {
|
|
203
|
+
const selected = this.config.getSelectedValues();
|
|
204
|
+
if (selected.length > 0) {
|
|
205
|
+
this.config.removeTag(selected[selected.length - 1]);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
break;
|
|
209
|
+
case 'Home':
|
|
210
|
+
if (this.host.open) {
|
|
211
|
+
e.preventDefault();
|
|
212
|
+
const len = isSlotted ? this.config.getVisibleSlottedItems().length : options.length;
|
|
213
|
+
if (len > 0) this._navigate(1, 0);
|
|
214
|
+
}
|
|
215
|
+
break;
|
|
216
|
+
case 'End':
|
|
217
|
+
if (this.host.open) {
|
|
218
|
+
e.preventDefault();
|
|
219
|
+
const len = isSlotted ? this.config.getVisibleSlottedItems().length : options.length;
|
|
220
|
+
if (len > 0) this._navigate(-1, len - 1);
|
|
221
|
+
}
|
|
222
|
+
break;
|
|
223
|
+
case ' ':
|
|
224
|
+
if (!this.host.isSearchable && !this.host.open) {
|
|
225
|
+
e.preventDefault();
|
|
226
|
+
this.config.openDropdown();
|
|
227
|
+
} else if (!this.host.isSearchable && this.host.open && this._searchString.length > 0) {
|
|
228
|
+
e.preventDefault();
|
|
229
|
+
this._handleTypeAhead(' ');
|
|
230
|
+
}
|
|
231
|
+
break;
|
|
232
|
+
default:
|
|
233
|
+
if (!this.host.isSearchable && e.key.length === 1 && !e.ctrlKey && !e.altKey && !e.metaKey) {
|
|
234
|
+
e.preventDefault();
|
|
235
|
+
this._handleTypeAhead(e.key);
|
|
236
|
+
}
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
_handleTypeAhead(char) {
|
|
241
|
+
if (this._searchTimeout) {
|
|
242
|
+
clearTimeout(this._searchTimeout);
|
|
243
|
+
}
|
|
244
|
+
this._searchTimeout = setTimeout(()=>{
|
|
245
|
+
this._searchString = '';
|
|
246
|
+
this.config.onTypeAheadChange?.(this._searchString);
|
|
247
|
+
}, 1000);
|
|
248
|
+
this._searchString += char.toLowerCase();
|
|
249
|
+
this.config.onTypeAheadChange?.(this._searchString);
|
|
250
|
+
const options = this.config.getFilteredOptions();
|
|
251
|
+
const isSlotted = this.config.getSlottedItems().length > 0;
|
|
252
|
+
const visible = isSlotted ? this.config.getVisibleSlottedItems() : [];
|
|
253
|
+
const len = isSlotted ? visible.length : options.length;
|
|
254
|
+
if (len === 0) return;
|
|
255
|
+
const getLabel = (i)=>{
|
|
256
|
+
if (isSlotted) {
|
|
257
|
+
return (visible[i]?.label || visible[i]?.textContent || '').toLowerCase();
|
|
258
|
+
}
|
|
259
|
+
return (options[i]?.label || options[i]?.value || '').toLowerCase();
|
|
260
|
+
};
|
|
261
|
+
const isDisabled = (i)=>(isSlotted ? visible[i]?.disabled : options[i]?.disabled) ?? false;
|
|
262
|
+
// Start searching from current active index + 1
|
|
263
|
+
const startIdx = Math.max(0, this.config.getActiveIndex());
|
|
264
|
+
let matchIdx = -1;
|
|
265
|
+
// Search after current index
|
|
266
|
+
for(let i = startIdx + 1; i < len; i++){
|
|
267
|
+
if (!isDisabled(i) && getLabel(i).startsWith(this._searchString)) {
|
|
268
|
+
matchIdx = i;
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
// Wrap around to start
|
|
273
|
+
if (matchIdx === -1) {
|
|
274
|
+
for(let i = 0; i <= startIdx; i++){
|
|
275
|
+
if (!isDisabled(i) && getLabel(i).startsWith(this._searchString)) {
|
|
276
|
+
matchIdx = i;
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
if (matchIdx !== -1) {
|
|
282
|
+
this.config.setActiveIndex(matchIdx);
|
|
283
|
+
if (isSlotted) this.config.updateSlottedActiveState(matchIdx);
|
|
284
|
+
this.config.scrollToActiveIndex();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
_navigate(direction, startFrom) {
|
|
288
|
+
const options = this.config.getFilteredOptions();
|
|
289
|
+
const isSlotted = this.config.getSlottedItems().length > 0;
|
|
290
|
+
const visible = isSlotted ? this.config.getVisibleSlottedItems() : [];
|
|
291
|
+
const len = isSlotted ? visible.length : options.length;
|
|
292
|
+
const isDisabled = (i)=>(isSlotted ? visible[i]?.disabled : options[i]?.disabled) ?? false;
|
|
293
|
+
if (len === 0) {
|
|
294
|
+
this.config.setActiveIndex(-1);
|
|
295
|
+
if (isSlotted) this.config.updateSlottedActiveState(-1);
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
let next = startFrom !== undefined ? startFrom : this.config.getActiveIndex();
|
|
299
|
+
if (startFrom === undefined && next === -1) {
|
|
300
|
+
next = direction === 1 ? -1 : 0;
|
|
301
|
+
} else if (startFrom !== undefined) {
|
|
302
|
+
if (!isDisabled(next)) {
|
|
303
|
+
this.config.setActiveIndex(next);
|
|
304
|
+
if (isSlotted) this.config.updateSlottedActiveState(next);
|
|
305
|
+
this.config.scrollToActiveIndex();
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
for(let step = 0; step < len; step++){
|
|
310
|
+
next = (next + direction + len) % len;
|
|
311
|
+
if (!isDisabled(next)) break;
|
|
312
|
+
}
|
|
313
|
+
if (isDisabled(next)) next = -1;
|
|
314
|
+
this.config.setActiveIndex(next);
|
|
315
|
+
if (isSlotted) this.config.updateSlottedActiveState(next);
|
|
316
|
+
this.config.scrollToActiveIndex();
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export { FloatingController as F, ListboxKeyboardController as L };
|