fix/space in classnames

This commit is contained in:
Gaetan 2022-11-20 12:11:45 +01:00
parent 6056cce4e9
commit 971d602d35
46 changed files with 8045 additions and 1312 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
/*! choices.js v10.1.0 | © 2022 Josh Johnson | https://github.com/jshjohnson/Choices#readme */

View file

@ -0,0 +1,3 @@
declare function _exports(on: any, config: any): void;
export = _exports;
//# sourceMappingURL=index.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../cypress/plugins/index.js"],"names":[],"mappings":"AAaiB,sDAGhB"}

View file

@ -0,0 +1 @@
//# sourceMappingURL=commands.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../cypress/support/commands.js"],"names":[],"mappings":""}

View file

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=index.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../cypress/support/index.js"],"names":[],"mappings":""}

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/components/container.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B,OAAO,EAAE,WAAW,CAAC;IAErB,IAAI,EAAE,iBAAiB,CAAC;IAExB,UAAU,EAAE,UAAU,CAAC;IAEvB,QAAQ,EAAE,mBAAmB,CAAC;IAE9B,MAAM,EAAE,OAAO,CAAC;IAEhB,SAAS,EAAE,OAAO,CAAC;IAEnB,UAAU,EAAE,OAAO,CAAC;IAEpB,UAAU,EAAE,OAAO,CA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M,CAAC,OAAO,OAAO,QAAQ;IAC3B,OAAO,EAAE,WAAW,CAAC;IAErB,IAAI,EAAE,iBAAiB,CAAC;IAExB,UAAU,EAAE,UAAU,CAAC;IAEvB,QAAQ,EAAE,OAAO,CAAC;gBAEN,EACV,OAAO,EACP,IAAI,EACJ,UAAU,GACX,EAAE;QACD,OAAO,EAAE,WAAW,CAAC;QACrB,IAAI,EAAE,iBAAiB,CAAC;QACxB,UAAU,EAAE,UAAU,CAAC;KACxB;IAOD;;OAEG;IACH,IAAI,qBAAqB,IAAI,MAAM,CAElC;IAED,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAI9C;;OAEG;IACH,IAAI,IAAI,IAAI;IAQZ;;OAEG;IACH,IAAI,IAAI,IAAI;CAOb"}
{"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/components/dropdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAGtE,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC3B,OAAO,EAAE,WAAW,CAAC;IAErB,IAAI,EAAE,iBAAiB,CAAC;IAExB,UAAU,EAAE,UAAU,CAAC;IAEvB,QAAQ,EAAE,OAAO,CAAC;gBAEN,EACV,OAAO,EACP,IAAI,EACJ,UAAU,GACX,EAAE;QACD,OAAO,EAAE,WAAW,CAAC;QACrB,IAAI,EAAE,iBAAiB,CAAC;QACxB,UAAU,EAAE,UAAU,CAAC;KACxB;IAOD;;OAEG;IACH,IAAI,qBAAqB,IAAI,MAAM,CAElC;IAED,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAI9C;;OAEG;IACH,IAAI,IAAI,IAAI;IAQZ;;OAEG;IACH,IAAI,IAAI,IAAI;CASb"}

View file

@ -1,2 +1,2 @@
export declare type ActionType = 'ADD_CHOICE' | 'FILTER_CHOICES' | 'ACTIVATE_CHOICES' | 'CLEAR_CHOICES' | 'ADD_GROUP' | 'ADD_ITEM' | 'REMOVE_ITEM' | 'HIGHLIGHT_ITEM' | 'CLEAR_ALL' | 'RESET_TO' | 'SET_IS_LOADING';
export type ActionType = 'ADD_CHOICE' | 'FILTER_CHOICES' | 'ACTIVATE_CHOICES' | 'CLEAR_CHOICES' | 'ADD_GROUP' | 'ADD_ITEM' | 'REMOVE_ITEM' | 'HIGHLIGHT_ITEM' | 'CLEAR_ALL' | 'RESET_TO' | 'SET_IS_LOADING';
//# sourceMappingURL=action-type.d.ts.map

View file

@ -1 +1 @@
{"version":3,"file":"action-type.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/interfaces/action-type.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU,GAClB,YAAY,GACZ,gBAAgB,GAChB,kBAAkB,GAClB,eAAe,GACf,WAAW,GACX,UAAU,GACV,aAAa,GACb,gBAAgB,GAChB,WAAW,GACX,UAAU,GACV,gBAAgB,CAAC"}
{"version":3,"file":"action-type.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/interfaces/action-type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAClB,YAAY,GACZ,gBAAgB,GAChB,kBAAkB,GAClB,eAAe,GACf,WAAW,GACX,UAAU,GACV,aAAa,GACb,gBAAgB,GAChB,WAAW,GACX,UAAU,GACV,gBAAgB,CAAC"}

View file

@ -1,56 +1,56 @@
/** Classes added to HTML generated by By default classnames follow the BEM notation. */
export interface ClassNames {
/** @default 'choices' */
containerOuter: string;
containerOuter: string | Array<string>;
/** @default 'choices__inner' */
containerInner: string;
containerInner: string | Array<string>;
/** @default 'choices__input' */
input: string;
input: string | Array<string>;
/** @default 'choices__input--cloned' */
inputCloned: string;
inputCloned: string | Array<string>;
/** @default 'choices__list' */
list: string;
list: string | Array<string>;
/** @default 'choices__list--multiple' */
listItems: string;
listItems: string | Array<string>;
/** @default 'choices__list--single' */
listSingle: string;
listSingle: string | Array<string>;
/** @default 'choices__list--dropdown' */
listDropdown: string;
listDropdown: string | Array<string>;
/** @default 'choices__item' */
item: string;
item: string | Array<string>;
/** @default 'choices__item--selectable' */
itemSelectable: string;
itemSelectable: string | Array<string>;
/** @default 'choices__item--disabled' */
itemDisabled: string;
itemDisabled: string | Array<string>;
/** @default 'choices__item--choice' */
itemChoice: string;
itemChoice: string | Array<string>;
/** @default 'choices__placeholder' */
placeholder: string;
placeholder: string | Array<string>;
/** @default 'choices__group' */
group: string;
group: string | Array<string>;
/** @default 'choices__heading' */
groupHeading: string;
groupHeading: string | Array<string>;
/** @default 'choices__button' */
button: string;
button: string | Array<string>;
/** @default 'is-active' */
activeState: string;
activeState: string | Array<string>;
/** @default 'is-focused' */
focusState: string;
focusState: string | Array<string>;
/** @default 'is-open' */
openState: string;
openState: string | Array<string>;
/** @default 'is-disabled' */
disabledState: string;
disabledState: string | Array<string>;
/** @default 'is-highlighted' */
highlightedState: string;
highlightedState: string | Array<string>;
/** @default 'is-selected' */
selectedState: string;
selectedState: string | Array<string>;
/** @default 'is-flipped' */
flippedState: string;
flippedState: string | Array<string>;
/** @default 'is-loading' */
loadingState: string;
loadingState: string | Array<string>;
/** @default 'has-no-results' */
noResults: string;
noResults: string | Array<string>;
/** @default 'has-no-choices' */
noChoices: string;
noChoices: string | Array<string>;
}
//# sourceMappingURL=class-names.d.ts.map

View file

@ -1 +1 @@
{"version":3,"file":"class-names.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/interfaces/class-names.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,MAAM,WAAW,UAAU;IACzB,yBAAyB;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,gCAAgC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAC;IACrB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,cAAc,EAAE,MAAM,CAAC;IACvB,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAC;IACrB,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,gBAAgB,EAAE,MAAM,CAAC;IACzB,6BAA6B;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,4BAA4B;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,4BAA4B;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;CACnB"}
{"version":3,"file":"class-names.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/interfaces/class-names.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,MAAM,WAAW,UAAU;IACzB,yBAAyB;IACzB,cAAc,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IACvC,gCAAgC;IAChC,cAAc,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IACvC,gCAAgC;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AG,KAAK,CAAC,MAAM,CAAC,CAAC;IAClC,6BAA6B;IAC7B,aAAa,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IACtC,gCAAgC;IAChC,gBAAgB,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IACzC,6BAA6B;IAC7B,aAAa,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IACtC,4BAA4B;IAC5B,YAAY,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IACrC,4BAA4B;IAC5B,YAAY,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IACrC,gCAAgC;IAChC,SAAS,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAClC,gCAAgC;IAChC,SAAS,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;CACnC"}

View file

@ -1,2 +1,2 @@
export declare type EventType = 'addItem' | 'removeItem' | 'highlightItem' | 'unhighlightItem' | 'choice' | 'change' | 'search' | 'showDropdown' | 'hideDropdown' | 'highlightChoice';
export type EventType = 'addItem' | 'removeItem' | 'highlightItem' | 'unhighlightItem' | 'choice' | 'change' | 'search' | 'showDropdown' | 'hideDropdown' | 'highlightChoice';
//# sourceMappingURL=event-type.d.ts.map

View file

@ -1 +1 @@
{"version":3,"file":"event-type.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/interfaces/event-type.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS,GACjB,SAAS,GACT,YAAY,GACZ,eAAe,GACf,iBAAiB,GACjB,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,cAAc,GACd,cAAc,GACd,iBAAiB,CAAC"}
{"version":3,"file":"event-type.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/interfaces/event-type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,YAAY,GACZ,eAAe,GACf,iBAAiB,GACjB,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,cAAc,GACd,cAAc,GACd,iBAAiB,CAAC"}

View file

@ -1,2 +1,2 @@
export declare type PassedElementType = 'text' | 'select-one' | 'select-multiple';
export type PassedElementType = 'text' | 'select-one' | 'select-multiple';
//# sourceMappingURL=passed-element-type.d.ts.map

View file

@ -1 +1 @@
{"version":3,"file":"passed-element-type.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/interfaces/passed-element-type.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB,GAAG,MAAM,GAAG,YAAY,GAAG,iBAAiB,CAAC"}
{"version":3,"file":"passed-element-type.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/interfaces/passed-element-type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,YAAY,GAAG,iBAAiB,CAAC"}

View file

@ -1,2 +1,2 @@
export declare type PositionOptionsType = 'auto' | 'top' | 'bottom';
export type PositionOptionsType = 'auto' | 'top' | 'bottom';
//# sourceMappingURL=position-options-type.d.ts.map

View file

@ -1 +1 @@
{"version":3,"file":"position-options-type.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/interfaces/position-options-type.ts"],"names":[],"mappings":"AAAA,oBAAY,mBAAmB,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC"}
{"version":3,"file":"position-options-type.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/interfaces/position-options-type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC"}

View file

@ -23,5 +23,7 @@ export declare const cloneObject: (obj: object) => object;
* Returns an array of keys present on the first but missing on the second object
*/
export declare const diff: (a: Record<string, any>, b: Record<string, any>) => string[];
export declare const getClassNames: (ClassNames: Array<string> | string) => Array<string>;
export declare const getClassNamesSelector: (option: string | Array<string> | null) => string;
export {};
//# sourceMappingURL=utils.d.ts.map

View file

@ -1 +1 @@
{"version":3,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F,CAAC;AAEF,eAAO,MAAM,aAAa,YACf,WAAW,QACd,SAAS,eACH,MAAM,GAAG,IAAI,KACxB,OAQF,CAAC;AAEF,eAAO,MAAM,aAAa,UACjB,GAAG,EAAE,SACL,MAAM,mBAEZ,OAOC,CAAC;AAEL,eAAO,MAAM,WAAW,QAAS,MAAM,KAAG,MACT,CAAC;AAElC;;GAEG;AACH,eAAO,MAAM,IAAI,MACZ,OAAO,MAAM,EAAE,GAAG,CAAC,KACnB,OAAO,MAAM,EAAE,GAAG,CAAC,KACrB,MAAM,EAKR,CAAC;AAEF,eAAO,MAAM,aAAa,eACZ,MAAM,MAAM,CAAC,GAAG,MAAM,KACjC,MAAM,MAAM,CAEd,CAAC;AAEF,eAAO,MAAM,qBAAqB,WACxB,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,IAAI,WAWtC,CAAC"}

View file

@ -2,7 +2,7 @@ import { AddChoiceAction, FilterChoicesAction, ActivateChoicesAction, ClearChoic
import { AddItemAction, RemoveItemAction } from '../actions/items';
import { Choice } from '../interfaces/choice';
export declare const defaultState: never[];
declare type ActionTypes = AddChoiceAction | FilterChoicesAction | ActivateChoicesAction | ClearChoicesAction | AddItemAction | RemoveItemAction | Record<string, never>;
type ActionTypes = AddChoiceAction | FilterChoicesAction | ActivateChoicesAction | ClearChoicesAction | AddItemAction | RemoveItemAction | Record<string, never>;
export default function choices(state?: Choice[], action?: ActionTypes): Choice[];
export {};
//# sourceMappingURL=choices.d.ts.map

View file

@ -1 +1 @@
{"version":3,"file":"choices.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/reducers/choices.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,eAAO,MAAM,YAAY,SAAK,CAAC;AAE/B,aAAK,WAAW,GACZ,eAAe,GACf,mBAAmB,GACnB,qBAAqB,GACrB,kBAAkB,GAClB,aAAa,GACb,gBAAgB,GAChB,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE1B,MAAM,CAAC,OAAO,UAAU,OAAO,CAC7B,KAAK,GAAE,MAAM,EAAiB,EAC9B,MAAM,GAAE,WAAgB,GACvB,MAAM,EAAE,CAwGV"}
{"version":3,"file":"choices.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/reducers/choices.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,eAAO,MAAM,YAAY,SAAK,CAAC;AAE/B,KAAK,WAAW,GACZ,eAAe,GACf,mBAAmB,GACnB,qBAAqB,GACrB,kBAAkB,GAClB,aAAa,GACb,gBAAgB,GAChB,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE1B,MAAM,CAAC,OAAO,UAAU,OAAO,CAC7B,KAAK,GAAE,MAAM,EAAiB,EAC9B,MAAM,GAAE,WAAgB,GACvB,MAAM,EAAE,CAwGV"}

View file

@ -3,7 +3,7 @@ import { ClearChoicesAction } from '../actions/choices';
import { Group } from '../interfaces/group';
import { State } from '../interfaces/state';
export declare const defaultState: never[];
declare type ActionTypes = AddGroupAction | ClearChoicesAction | Record<string, never>;
type ActionTypes = AddGroupAction | ClearChoicesAction | Record<string, never>;
export default function groups(state?: Group[], action?: ActionTypes): State['groups'];
export {};
//# sourceMappingURL=groups.d.ts.map

View file

@ -1 +1 @@
{"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/reducers/groups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,eAAO,MAAM,YAAY,SAAK,CAAC;AAE/B,aAAK,WAAW,GAAG,cAAc,GAAG,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE/E,MAAM,CAAC,OAAO,UAAU,MAAM,CAC5B,KAAK,GAAE,KAAK,EAAiB,EAC7B,MAAM,GAAE,WAAgB,GACvB,KAAK,CAAC,QAAQ,CAAC,CAwBjB"}
{"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/reducers/groups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,eAAO,MAAM,YAAY,SAAK,CAAC;AAE/B,KAAK,WAAW,GAAG,cAAc,GAAG,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE/E,MAAM,CAAC,OAAO,UAAU,MAAM,CAC5B,KAAK,GAAE,KAAK,EAAiB,EAC7B,MAAM,GAAE,WAAgB,GACvB,KAAK,CAAC,QAAQ,CAAC,CAwBjB"}

View file

@ -2,7 +2,7 @@ import { AddItemAction, RemoveItemAction, HighlightItemAction } from '../actions
import { Item } from '../interfaces/item';
import { State } from '../interfaces/state';
export declare const defaultState: never[];
declare type ActionTypes = AddItemAction | RemoveItemAction | HighlightItemAction | Record<string, never>;
type ActionTypes = AddItemAction | RemoveItemAction | HighlightItemAction | Record<string, never>;
export default function items(state?: Item[], action?: ActionTypes): State['items'];
export {};
//# sourceMappingURL=items.d.ts.map

View file

@ -1 +1 @@
{"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/reducers/items.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,eAAO,MAAM,YAAY,SAAK,CAAC;AAE/B,aAAK,WAAW,GACZ,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE1B,MAAM,CAAC,OAAO,UAAU,KAAK,CAC3B,KAAK,GAAE,IAAI,EAAiB,EAC5B,MAAM,GAAE,WAAgB,GACvB,KAAK,CAAC,OAAO,CAAC,CA0DhB"}
{"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/reducers/items.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,eAAO,MAAM,YAAY,SAAK,CAAC;AAE/B,KAAK,WAAW,GACZ,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE1B,MAAM,CAAC,OAAO,UAAU,KAAK,CAC3B,KAAK,GAAE,IAAI,EAAiB,EAC5B,MAAM,GAAE,WAAgB,GACvB,KAAK,CAAC,OAAO,CAAC,CA0DhB"}

View file

@ -1,7 +1,7 @@
import { SetIsLoadingAction } from '../actions/misc';
import { State } from '../interfaces/state';
export declare const defaultState = false;
declare type ActionTypes = SetIsLoadingAction | Record<string, never>;
type ActionTypes = SetIsLoadingAction | Record<string, never>;
declare const general: (state?: boolean, action?: ActionTypes) => State['loading'];
export default general;
//# sourceMappingURL=loading.d.ts.map

View file

@ -1 +1 @@
{"version":3,"file":"loading.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/reducers/loading.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,eAAO,MAAM,YAAY,QAAQ,CAAC;AAElC,aAAK,WAAW,GAAG,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE9D,QAAA,MAAM,OAAO,6BAEH,WAAW,KAClB,KAAK,CAAC,SAAS,CAUjB,CAAC;AAEF,eAAe,OAAO,CAAC"}
{"version":3,"file":"loading.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/reducers/loading.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,eAAO,MAAM,YAAY,QAAQ,CAAC;AAElC,KAAK,WAAW,GAAG,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE9D,QAAA,MAAM,OAAO,6BAEH,WAAW,KAClB,KAAK,CAAC,SAAS,CAUjB,CAAC;AAEF,eAAe,OAAO,CAAC"}

View file

@ -6,7 +6,7 @@ import { Choice } from './interfaces/choice';
import { Group } from './interfaces/group';
import { Item } from './interfaces/item';
import { PassedElementType } from './interfaces/passed-element-type';
declare type TemplateOptions = Record<'classNames' | 'allowHTML', any>;
type TemplateOptions = Record<'classNames' | 'allowHTML', any>;
declare const templates: {
containerOuter({ classNames: { containerOuter } }: TemplateOptions, dir: HTMLElement['dir'], isSelectElement: boolean, isSelectOneElement: boolean, searchEnabled: boolean, passedElementType: PassedElementType, labelId: string): HTMLDivElement;
containerInner({ classNames: { containerInner }, }: TemplateOptions): HTMLDivElement;

View file

@ -1 +1 @@
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../../src/scripts/templates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAGrE,aAAK,eAAe,GAAG,MAAM,CAAC,YAAY,GAAG,WAAW,EAAE,GAAG,CAAC,CAAC;AAE/D,QAAA,MAAM,SAAS;uDAEyB,eAAe,OAC9C,WAAW,CAAC,KAAK,CAAC,mBACN,OAAO,sBACJ,OAAO,iBACZ,OAAO,qBACH,iBAAiB,WAC3B,MAAM,GACd,cAAc;wDAiCd,eAAe,GAAG,cAAc;8DAOgB,eAAe,sBAC5C,OAAO,GAC1B,cAAc;4DAO6B,eAAe,SACpD,MAAM,GACZ,cAAc;uGAiBZ,eAAe,sGAUf,IAAI,oBACW,OAAO,GACxB,cAAc;yCAmDW,eAAe,sBACrB,OAAO,GAC1B,cAAc;mFAiBZ,eAAe,2BACO,KAAK,GAC7B,cAAc;wHAsCZ,eAAe,qHAUf,MAAM,cACG,MAAM,GACjB,cAAc;kDAqCyB,eAAe,oBACrC,MAAM,GACvB,gBAAgB;sDAmBhB,eAAe,GAAG,cAAc;mFAa9B,eAAe,aACP,MAAM,SACX,YAAY,GAAG,YAAY,GAAG,EAAE,GACrC,cAAc;kEAqBd,IAAI,GAAG,iBAAiB;CAW5B,CAAC;AAEF,eAAe,SAAS,CAAC"}
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../../src/scripts/templates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAIrE,KAAK,eAAe,GAAG,MAAM,CAAC,YAAY,GAAG,WAAW,EAAE,GAAG,CAAC,CAAC;AAE/D,QAAA,MAAM,SAAS;uDAEyB,eAAe,OAC9C,WAAW,CAAC,KAAK,CAAC,mBACN,OAAO,sBACJ,OAAO,iBACZ,OAAO,qBACH,iBAAiB,WAC3B,MAAM,GACd,cAAc;wDAiCd,eAAe,GAAG,cAAc;8DAOgB,eAAe,sBAC5C,OAAO,GAC1B,cAAc;4DAO6B,eAAe,SACpD,MAAM,GACZ,cAAc;uGAiBZ,eAAe,sGAUf,IAAI,oBACW,OAAO,GACxB,cAAc;yCAuDW,eAAe,sBACrB,OAAO,GAC1B,cAAc;mFAiBZ,eAAe,2BACO,KAAK,GAC7B,cAAc;wHAsCZ,eAAe,qHAUf,MAAM,cACG,MAAM,GACjB,cAAc;kDAqCyB,eAAe,oBACrC,MAAM,GACvB,gBAAgB;sDAmBhB,eAAe,GAAG,cAAc;mFAa9B,eAAe,aACP,MAAM,SACX,YAAY,GAAG,YAAY,GAAG,EAAE,GACrC,cAAc;kEAqBd,IAAI,GAAG,iBAAiB;CAW5B,CAAC;AAEF,eAAe,SAAS,CAAC"}

View file

@ -41,6 +41,8 @@ import {
existsInArray,
generateId,
getAdjacentEl,
getClassNames,
getClassNamesSelector,
getType,
isScrolledIntoView,
isType,
@ -1192,7 +1194,7 @@ class Choices implements Choices {
_handleLoadingState(setLoading = true): void {
let placeholderItem = this.itemList.getChild(
`.${this.config.classNames.placeholder}`,
getClassNamesSelector(this.config.classNames.placeholder),
);
if (setLoading) {
@ -1571,7 +1573,7 @@ class Choices implements Choices {
if (hasActiveDropdown) {
const highlightedChoice = this.dropdown.getChild(
`.${this.config.classNames.highlightedState}`,
getClassNamesSelector(this.config.classNames.highlightedState),
);
if (highlightedChoice) {
@ -1628,7 +1630,7 @@ class Choices implements Choices {
}
} else {
const currentEl = this.dropdown.element.querySelector(
`.${this.config.classNames.highlightedState}`,
getClassNamesSelector(this.config.classNames.highlightedState),
);
if (currentEl) {
nextEl = getAdjacentEl(
@ -1892,13 +1894,15 @@ class Choices implements Choices {
let passedEl = el;
const highlightedChoices = Array.from(
this.dropdown.element.querySelectorAll(
`.${this.config.classNames.highlightedState}`,
getClassNamesSelector(this.config.classNames.highlightedState),
),
);
// Remove any highlighted choices
highlightedChoices.forEach((choice) => {
choice.classList.remove(this.config.classNames.highlightedState);
choice.classList.remove(
...getClassNames(this.config.classNames.highlightedState),
);
choice.setAttribute('aria-selected', 'false');
});
@ -1919,7 +1923,9 @@ class Choices implements Choices {
}
}
passedEl.classList.add(this.config.classNames.highlightedState);
passedEl.classList.add(
...getClassNames(this.config.classNames.highlightedState),
);
passedEl.setAttribute('aria-selected', 'true');
this.passedElement.triggerEvent(EVENTS.highlightChoice, { el: passedEl });

View file

@ -1,4 +1,4 @@
import { wrap } from '../lib/utils';
import { getClassNames, wrap } from '../lib/utils';
import { SELECT_ONE_TYPE } from '../constants';
import { ClassNames } from '../interfaces/class-names';
import { PositionOptionsType } from '../interfaces/position-options-type';
@ -88,25 +88,29 @@ export default class Container {
}
open(dropdownPos: number): void {
this.element.classList.add(this.classNames.openState);
this.element.classList.add(...getClassNames(this.classNames.openState));
this.element.setAttribute('aria-expanded', 'true');
this.isOpen = true;
if (this.shouldFlip(dropdownPos)) {
this.element.classList.add(this.classNames.flippedState);
this.element.classList.add(
...getClassNames(this.classNames.flippedState),
);
this.isFlipped = true;
}
}
close(): void {
this.element.classList.remove(this.classNames.openState);
this.element.classList.remove(...getClassNames(this.classNames.openState));
this.element.setAttribute('aria-expanded', 'false');
this.removeActiveDescendant();
this.isOpen = false;
// A dropdown flips if it does not have space within the page
if (this.isFlipped) {
this.element.classList.remove(this.classNames.flippedState);
this.element.classList.remove(
...getClassNames(this.classNames.flippedState),
);
this.isFlipped = false;
}
}
@ -118,15 +122,17 @@ export default class Container {
}
addFocusState(): void {
this.element.classList.add(this.classNames.focusState);
this.element.classList.add(...getClassNames(this.classNames.focusState));
}
removeFocusState(): void {
this.element.classList.remove(this.classNames.focusState);
this.element.classList.remove(...getClassNames(this.classNames.focusState));
}
enable(): void {
this.element.classList.remove(this.classNames.disabledState);
this.element.classList.remove(
...getClassNames(this.classNames.disabledState),
);
this.element.removeAttribute('aria-disabled');
if (this.type === SELECT_ONE_TYPE) {
this.element.setAttribute('tabindex', '0');
@ -135,7 +141,7 @@ export default class Container {
}
disable(): void {
this.element.classList.add(this.classNames.disabledState);
this.element.classList.add(...getClassNames(this.classNames.disabledState));
this.element.setAttribute('aria-disabled', 'true');
if (this.type === SELECT_ONE_TYPE) {
this.element.setAttribute('tabindex', '-1');
@ -157,13 +163,15 @@ export default class Container {
}
addLoadingState(): void {
this.element.classList.add(this.classNames.loadingState);
this.element.classList.add(...getClassNames(this.classNames.loadingState));
this.element.setAttribute('aria-busy', 'true');
this.isLoading = true;
}
removeLoadingState(): void {
this.element.classList.remove(this.classNames.loadingState);
this.element.classList.remove(
...getClassNames(this.classNames.loadingState),
);
this.element.removeAttribute('aria-busy');
this.isLoading = false;
}

View file

@ -1,6 +1,7 @@
import { expect } from 'chai';
import sinon from 'sinon';
import { DEFAULT_CLASSNAMES } from '../defaults';
import { getClassNamesSelector } from '../lib/utils';
import Dropdown from './dropdown';
describe('components/dropdown', () => {
@ -76,7 +77,9 @@ describe('components/dropdown', () => {
it('returns child element', () => {
const expectedResponse = childElement;
const actualResponse = instance.getChild(`.${childClass}`);
const actualResponse = instance.getChild(
getClassNamesSelector(childClass),
);
expect(expectedResponse).to.eql(actualResponse);
});
});

View file

@ -1,5 +1,6 @@
import { ClassNames } from '../interfaces/class-names';
import { PassedElementType } from '../interfaces/passed-element-type';
import { getClassNames } from '../lib/utils';
export default class Dropdown {
element: HTMLElement;
@ -40,7 +41,7 @@ export default class Dropdown {
* Show dropdown to user by adding active state class
*/
show(): this {
this.element.classList.add(this.classNames.activeState);
this.element.classList.add(...getClassNames(this.classNames.activeState));
this.element.setAttribute('aria-expanded', 'true');
this.isActive = true;
@ -51,7 +52,9 @@ export default class Dropdown {
* Hide dropdown from user
*/
hide(): this {
this.element.classList.remove(this.classNames.activeState);
this.element.classList.remove(
...getClassNames(this.classNames.activeState),
);
this.element.setAttribute('aria-expanded', 'false');
this.isActive = false;

View file

@ -1,4 +1,5 @@
import { expect } from 'chai';
import { getClassNames } from '../lib/utils';
import List from './list';
describe('components/list', () => {
@ -41,7 +42,7 @@ describe('components/list', () => {
it('appends passed node to element', () => {
const elementToAppend = document.createElement('span');
const childClass = 'test-element';
elementToAppend.classList.add(childClass);
elementToAppend.classList.add(...getClassNames(childClass));
expect(instance.element.querySelector(`.${childClass}`)).to.equal(null);
instance.append(elementToAppend);
expect(instance.element.querySelector(`.${childClass}`)).to.equal(
@ -56,7 +57,7 @@ describe('components/list', () => {
beforeEach(() => {
childElement = document.createElement('span');
childElement.classList.add(childClass);
childElement.classList.add(...getClassNames(childClass));
instance.element.appendChild(childElement);
});

View file

@ -1,4 +1,5 @@
import { expect } from 'chai';
import { getClassNames } from '../lib/utils';
import { DEFAULT_CLASSNAMES } from '../defaults';
import WrappedElement from './wrapped-element';
@ -79,8 +80,12 @@ describe('components/wrappedElement', () => {
it('hides element', () => {
instance.conceal();
expect(instance.element.tabIndex).to.equal(-1);
const classesToCheck = getClassNames(instance.classNames.input);
expect(
instance.element.classList.contains(instance.classNames.input),
[...instance.element.classList].some(
(className) => classesToCheck.indexOf(className) !== -1,
),
).to.equal(true);
expect(instance.element.hidden).to.be.true;
expect(instance.element.getAttribute('data-choice')).to.equal('active');
@ -101,8 +106,12 @@ describe('components/wrappedElement', () => {
it('shows element', () => {
instance.reveal();
expect(instance.element.tabIndex).to.equal(0);
const classesToCheck = getClassNames(instance.classNames.input);
expect(
instance.element.classList.contains(instance.classNames.input),
[...instance.element.classList].some(
(className) => classesToCheck.indexOf(className) !== -1,
),
).to.equal(false);
expect(instance.element.hidden).to.be.false;
expect(instance.element.getAttribute('style')).to.equal(originalStyling);

View file

@ -1,6 +1,6 @@
import { ClassNames } from '../interfaces/class-names';
import { EventType } from '../interfaces/event-type';
import { dispatchEvent } from '../lib/utils';
import { dispatchEvent, getClassNames } from '../lib/utils';
export default class WrappedElement {
element: HTMLInputElement | HTMLSelectElement;
@ -42,7 +42,7 @@ export default class WrappedElement {
conceal(): void {
// Hide passed input
this.element.classList.add(this.classNames.input);
this.element.classList.add(...getClassNames(this.classNames.input));
this.element.hidden = true;
// Remove element from tab index
@ -60,7 +60,7 @@ export default class WrappedElement {
reveal(): void {
// Reinstate passed element
this.element.classList.remove(this.classNames.input);
this.element.classList.remove(...getClassNames(this.classNames.input));
this.element.hidden = false;
this.element.removeAttribute('tabindex');

View file

@ -15,7 +15,7 @@ export const DEFAULT_CLASSNAMES: ClassNames = {
itemSelectable: 'choices__item--selectable',
itemDisabled: 'choices__item--disabled',
itemChoice: 'choices__item--choice',
placeholder: 'choices__placeholder',
placeholder: ['choices__placeholder'],
group: 'choices__group',
groupHeading: 'choices__heading',
button: 'choices__button',

View file

@ -1,55 +1,55 @@
/** Classes added to HTML generated by By default classnames follow the BEM notation. */
export interface ClassNames {
/** @default 'choices' */
containerOuter: string;
containerOuter: string | Array<string>;
/** @default 'choices__inner' */
containerInner: string;
containerInner: string | Array<string>;
/** @default 'choices__input' */
input: string;
input: string | Array<string>;
/** @default 'choices__input--cloned' */
inputCloned: string;
inputCloned: string | Array<string>;
/** @default 'choices__list' */
list: string;
list: string | Array<string>;
/** @default 'choices__list--multiple' */
listItems: string;
listItems: string | Array<string>;
/** @default 'choices__list--single' */
listSingle: string;
listSingle: string | Array<string>;
/** @default 'choices__list--dropdown' */
listDropdown: string;
listDropdown: string | Array<string>;
/** @default 'choices__item' */
item: string;
item: string | Array<string>;
/** @default 'choices__item--selectable' */
itemSelectable: string;
itemSelectable: string | Array<string>;
/** @default 'choices__item--disabled' */
itemDisabled: string;
itemDisabled: string | Array<string>;
/** @default 'choices__item--choice' */
itemChoice: string;
itemChoice: string | Array<string>;
/** @default 'choices__placeholder' */
placeholder: string;
placeholder: string | Array<string>;
/** @default 'choices__group' */
group: string;
group: string | Array<string>;
/** @default 'choices__heading' */
groupHeading: string;
groupHeading: string | Array<string>;
/** @default 'choices__button' */
button: string;
button: string | Array<string>;
/** @default 'is-active' */
activeState: string;
activeState: string | Array<string>;
/** @default 'is-focused' */
focusState: string;
focusState: string | Array<string>;
/** @default 'is-open' */
openState: string;
openState: string | Array<string>;
/** @default 'is-disabled' */
disabledState: string;
disabledState: string | Array<string>;
/** @default 'is-highlighted' */
highlightedState: string;
highlightedState: string | Array<string>;
/** @default 'is-selected' */
selectedState: string;
selectedState: string | Array<string>;
/** @default 'is-flipped' */
flippedState: string;
flippedState: string | Array<string>;
/** @default 'is-loading' */
loadingState: string;
loadingState: string | Array<string>;
/** @default 'has-no-results' */
noResults: string;
noResults: string | Array<string>;
/** @default 'has-no-choices' */
noChoices: string;
noChoices: string | Array<string>;
}

View file

@ -180,3 +180,23 @@ export const diff = (
return aKeys.filter((i) => bKeys.indexOf(i) < 0);
};
export const getClassNames = (
ClassNames: Array<string> | string,
): Array<string> => {
return Array.isArray(ClassNames) ? ClassNames : [ClassNames];
};
export const getClassNamesSelector = (
option: string | Array<string> | null,
) => {
if (option && Array.isArray(option)) {
return option
.map((item) => {
return `.${item}`;
})
.join(' ');
}
return `.${option}`;
};

View file

@ -7,6 +7,7 @@ import { Choice } from './interfaces/choice';
import { Group } from './interfaces/group';
import { Item } from './interfaces/item';
import { PassedElementType } from './interfaces/passed-element-type';
import { getClassNames } from './lib/utils';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type TemplateOptions = Record<'classNames' | 'allowHTML', any>;
@ -122,14 +123,18 @@ const templates = {
}
if (isPlaceholder) {
div.classList.add(placeholder);
div.classList.add(...getClassNames(placeholder));
}
div.classList.add(highlighted ? highlightedState : itemSelectable);
div.classList.add(
...(highlighted
? getClassNames(highlightedState)
: getClassNames(itemSelectable)),
);
if (removeItemButton) {
if (disabled) {
div.classList.remove(itemSelectable);
div.classList.remove(...getClassNames(itemSelectable));
}
div.dataset.deletable = '';
/** @todo This MUST be localizable, not hardcoded! */
@ -230,11 +235,11 @@ const templates = {
});
if (isSelected) {
div.classList.add(selectedState);
div.classList.add(...getClassNames(selectedState));
}
if (isPlaceholder) {
div.classList.add(placeholder);
div.classList.add(...getClassNames(placeholder));
}
div.setAttribute('role', groupId && groupId > 0 ? 'treeitem' : 'option');
@ -247,11 +252,11 @@ const templates = {
});
if (isDisabled) {
div.classList.add(itemDisabled);
div.classList.add(...getClassNames(itemDisabled));
div.dataset.choiceDisabled = '';
div.setAttribute('aria-disabled', 'true');
} else {
div.classList.add(itemSelectable);
div.classList.add(...getClassNames(itemSelectable));
div.dataset.choiceSelectable = '';
}
@ -283,7 +288,7 @@ const templates = {
}: TemplateOptions): HTMLDivElement {
const div = document.createElement('div');
div.classList.add(list, listDropdown);
div.classList.add(...getClassNames(list), ...getClassNames(listDropdown));
div.setAttribute('aria-expanded', 'false');
return div;

7367
yarn.lock Normal file

File diff suppressed because it is too large Load diff