-
Notifications
You must be signed in to change notification settings - Fork 636
Expand file tree
/
Copy pathdefaults.ts
More file actions
95 lines (93 loc) · 3.04 KB
/
defaults.ts
File metadata and controls
95 lines (93 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import { ClassNames } from './interfaces/class-names';
import { Options } from './interfaces/options';
import { sortByAlpha } from './lib/utils';
export const DEFAULT_CLASSNAMES: ClassNames = {
containerOuter: ['choices'],
containerInner: ['choices__inner'],
input: ['choices__input'],
inputCloned: ['choices__input--cloned'],
list: ['choices__list'],
listItems: ['choices__list--multiple'],
listSingle: ['choices__list--single'],
listDropdown: ['choices__list--dropdown'],
item: ['choices__item'],
itemSelectable: ['choices__item--selectable'],
itemDisabled: ['choices__item--disabled'],
itemChoice: ['choices__item--choice'],
description: ['choices__description'],
placeholder: ['choices__placeholder'],
group: ['choices__group'],
groupHeading: ['choices__heading'],
button: ['choices__button'],
activeState: ['is-active'],
focusState: ['is-focused'],
openState: ['is-open'],
disabledState: ['is-disabled'],
highlightedState: ['is-highlighted'],
selectedState: ['is-selected'],
flippedState: ['is-flipped'],
loadingState: ['is-loading'],
notice: ['choices__notice'],
addChoice: ['choices__item--selectable', 'add-choice'],
noResults: ['has-no-results'],
noChoices: ['has-no-choices'],
} as const;
export const DEFAULT_CONFIG: Options = {
items: [],
choices: [],
silent: false,
renderChoiceLimit: -1,
maxItemCount: -1,
renderItems: true,
closeDropdownOnSelect: 'auto',
singleModeForMultiSelect: false,
addChoices: false,
addItems: true,
addItemFilter: (value: string): boolean => !!value && value !== '',
removeItems: true,
removeItemButton: false,
removeItemButtonAlignLeft: false,
editItems: false,
allowHTML: false,
allowHtmlUserInput: false,
duplicateItemsAllowed: true,
delimiter: ',',
paste: true,
searchEnabled: true,
searchChoices: true,
searchFloor: 1,
searchResultLimit: 4,
searchFields: ['label', 'value'],
position: 'auto',
resetScrollPosition: true,
shouldSort: true,
shouldSortItems: false,
sorter: sortByAlpha,
shadowRoot: null,
placeholder: true,
placeholderValue: null,
searchPlaceholderValue: null,
prependValue: null,
appendValue: null,
renderSelectedChoices: 'auto',
loadingText: 'Loading...',
noResultsText: 'No results found',
noChoicesText: 'No choices to choose from',
itemSelectText: 'Press to select',
itemDeselectText: 'Press to deselect',
uniqueItemText: 'Only unique values can be added',
customAddItemText: 'Only values matching specific conditions can be added',
addItemText: (value: string) => `Press Enter to add <b>"${value}"</b>`,
removeItemIconText: (): string => `Remove item`,
removeItemLabelText: (value: string): string => `Remove item: ${value}`,
maxItemText: (maxItemCount: number): string => `Only ${maxItemCount} values can be added`,
valueComparer: (value1: string, value2: string): boolean => value1 === value2,
fuseOptions: {
includeScore: true,
},
labelId: '',
callbackOnInit: null,
callbackOnCreateTemplates: null,
classNames: DEFAULT_CLASSNAMES,
appendGroupInSearch: false,
} as const;