@coreui/react-pro 4.11.3 → 4.12.0-alpha.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.
Files changed (67) hide show
  1. package/README.md +1 -1
  2. package/dist/components/date-range-picker/CDateRangePicker copy.d.ts +114 -0
  3. package/dist/components/date-range-picker/CDateRangePicker.d.ts +49 -1
  4. package/dist/components/multi-select/CMultiSelect.d.ts +34 -3
  5. package/dist/components/multi-select/CMultiSelectNativeSelect.d.ts +4 -5
  6. package/dist/components/multi-select/CMultiSelectOptions.d.ts +4 -2
  7. package/dist/components/multi-select/CMultiSelectSelection.d.ts +1 -0
  8. package/dist/components/multi-select/types.d.ts +7 -3
  9. package/dist/components/multi-select/utils.d.ts +5 -5
  10. package/dist/components/multi-select-new/CMultiSelect.d.ts +133 -0
  11. package/dist/components/multi-select-new/CMultiSelectNativeSelect.d.ts +7 -0
  12. package/dist/components/multi-select-new/CMultiSelectNew.d.ts +121 -0
  13. package/dist/components/multi-select-new/CMultiSelectOptions.d.ts +16 -0
  14. package/dist/components/multi-select-new/CMultiSelectSelection.d.ts +11 -0
  15. package/dist/components/multi-select-new/index.d.ts +2 -0
  16. package/dist/components/multi-select-new/types.d.ts +15 -0
  17. package/dist/components/multi-select-new/utils.d.ts +11 -0
  18. package/dist/components/picker/CPicker copy.d.ts +82 -0
  19. package/dist/components/picker/CPicker.d.ts +14 -56
  20. package/dist/components/picker copy/CPicker.d.ts +82 -0
  21. package/dist/components/popover/CPopover.d.ts +1 -1
  22. package/dist/components/time-picker/CTimePicker.d.ts +41 -1
  23. package/dist/components/tooltip/CTooltip.d.ts +3 -3
  24. package/dist/index.es.js +2197 -2074
  25. package/dist/index.es.js.map +1 -1
  26. package/dist/index.js +2196 -2073
  27. package/dist/index.js.map +1 -1
  28. package/dist/utils/index.d.ts +2 -1
  29. package/dist/utils/isRTL.d.ts +2 -0
  30. package/package.json +7 -7
  31. package/src/components/calendar/__tests__/__snapshots__/CCalendar.spec.tsx.snap +601 -555
  32. package/src/components/date-picker/__tests__/__snapshots__/CDatePicker.spec.tsx.snap +599 -561
  33. package/src/components/date-range-picker/CDateRangePicker.tsx +198 -97
  34. package/src/components/date-range-picker/__tests__/__snapshots__/CDateRangePicker.spec.tsx.snap +1197 -1121
  35. package/src/components/dropdown/CDropdownMenu.tsx +5 -4
  36. package/src/components/dropdown/__tests__/__snapshots__/CDropdown.spec.tsx.snap +1 -1
  37. package/src/components/element-cover/CElementCover.tsx +1 -0
  38. package/src/components/multi-select/CMultiSelect.tsx +200 -79
  39. package/src/components/multi-select/CMultiSelectNativeSelect.tsx +34 -24
  40. package/src/components/multi-select/CMultiSelectOptions.tsx +25 -23
  41. package/src/components/multi-select/CMultiSelectSelection.tsx +36 -7
  42. package/src/components/multi-select/__tests__/CMultiSelect.spec.tsx +25 -14
  43. package/src/components/multi-select/__tests__/CMultiSelectNativeSelect.spec.tsx +1 -1
  44. package/src/components/multi-select/__tests__/CMultiSelectOptions.spec.tsx +4 -4
  45. package/src/components/multi-select/__tests__/CMultiSelectSelection.spec.tsx +0 -1
  46. package/src/components/multi-select/__tests__/__snapshots__/CMultiSelect.spec.tsx.snap +136 -30
  47. package/src/components/multi-select/__tests__/__snapshots__/CMultiSelectNativeSelect.spec.tsx.snap +2 -0
  48. package/src/components/multi-select/__tests__/__snapshots__/CMultiSelectOptions.spec.tsx.snap +3 -1
  49. package/src/components/multi-select/__tests__/__snapshots__/CMultiSelectSelection.spec.tsx.snap +2 -2
  50. package/src/components/multi-select/types.ts +9 -4
  51. package/src/components/multi-select/utils.ts +56 -39
  52. package/src/components/picker/CPicker.tsx +113 -138
  53. package/src/components/popover/CPopover.tsx +62 -26
  54. package/src/components/smart-table/__tests__/CSmartTable.spec.tsx +1 -1
  55. package/src/components/smart-table/__tests__/__snapshots__/CSmartTable.spec.tsx.snap +580 -0
  56. package/src/components/time-picker/CTimePicker.tsx +182 -82
  57. package/src/components/time-picker/__tests__/__snapshots__/CTimePicker.spec.tsx.snap +1078 -0
  58. package/src/components/tooltip/CTooltip.tsx +66 -31
  59. package/src/components/virtual-scroller/CVirtualScroller.tsx +0 -1
  60. package/src/utils/index.ts +2 -1
  61. package/src/utils/isRTL.ts +13 -0
  62. package/src/components/multi-select/__tests__/CMultiSelectCleaner.spec.tsx +0 -15
  63. package/src/components/multi-select/__tests__/CMultiSelectSearchInput.spec.tsx +0 -17
  64. package/src/components/multi-select/__tests__/CMultiSelectSelectAllButton.spec.tsx +0 -21
  65. package/src/components/multi-select/__tests__/__snapshots__/CMultiSelectCleaner.spec.tsx.snap +0 -19
  66. package/src/components/multi-select/__tests__/__snapshots__/CMultiSelectSearchInput.spec.tsx.snap +0 -20
  67. package/src/components/multi-select/__tests__/__snapshots__/CMultiSelectSelectAllButton.spec.tsx.snap +0 -24
@@ -1,19 +1,21 @@
1
- import React, { forwardRef, Fragment, HTMLAttributes, ReactNode } from 'react'
1
+ import React, { forwardRef, HTMLAttributes, ReactNode } from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import classNames from 'classnames'
4
4
 
5
- import { CVirtualScroller } from './../virtual-scroller'
5
+ import { CElementCover } from '../element-cover'
6
+ import { CVirtualScroller } from '../virtual-scroller'
6
7
 
7
8
  import { getNextSibling, getPreviousSibling } from './utils'
8
- import type { Option } from './types'
9
- import { CElementCover } from '../element-cover'
9
+ import type { Option, OptionsGroup } from './types'
10
10
 
11
11
  export interface CMultiSelectOptionsProps extends HTMLAttributes<HTMLDivElement> {
12
12
  handleOptionOnClick?: (option: Option) => void
13
13
  loading?: boolean
14
- options: Option[]
14
+ options: (Option | OptionsGroup)[]
15
15
  optionsMaxHeight?: number | string
16
16
  optionsStyle?: 'checkbox' | 'text'
17
+ optionsTemplate?: (option: Option) => ReactNode
18
+ optionsGroupsTemplate?: (option: OptionsGroup) => ReactNode
17
19
  searchNoResultsLabel?: string | ReactNode
18
20
  selected: Option[]
19
21
  virtualScroller?: boolean
@@ -28,6 +30,8 @@ export const CMultiSelectOptions = forwardRef<HTMLDivElement, CMultiSelectOption
28
30
  options,
29
31
  optionsMaxHeight,
30
32
  optionsStyle,
33
+ optionsTemplate,
34
+ optionsGroupsTemplate,
31
35
  searchNoResultsLabel,
32
36
  selected,
33
37
  virtualScroller,
@@ -39,37 +43,29 @@ export const CMultiSelectOptions = forwardRef<HTMLDivElement, CMultiSelectOption
39
43
  if (event.code === 'Space' || event.key === 'Enter') {
40
44
  event.preventDefault()
41
45
  handleOptionOnClick && handleOptionOnClick(option)
42
- return
43
46
  }
44
47
 
45
48
  if (event.key === 'Down' || event.key === 'ArrowDown') {
46
49
  event.preventDefault()
47
50
  const target = event.target as HTMLElement
48
51
  const next = getNextSibling(target, '.form-multi-select-option')
49
- if (next) {
50
- ;(next as HTMLElement).focus() // eslint-disable-line prettier/prettier
51
- }
52
+
53
+ next && (next as HTMLElement).focus()
52
54
  }
53
55
 
54
56
  if (event.key === 'Up' || event.key === 'ArrowUp') {
55
57
  event.preventDefault()
56
58
  const target = event.target as HTMLElement
57
59
  const prev = getPreviousSibling(target, '.form-multi-select-option')
58
- if (prev) {
59
- ;(prev as HTMLElement).focus() // eslint-disable-line prettier/prettier
60
- }
60
+
61
+ prev && (prev as HTMLElement).focus()
61
62
  }
62
63
  }
63
64
 
64
- const createOptions = (options: Option[]): JSX.Element | JSX.Element[] =>
65
+ const createOptions = (options: (Option | OptionsGroup)[]): JSX.Element | JSX.Element[] =>
65
66
  options.length > 0 ? (
66
- options.map((option: Option, index: number) =>
67
- option.options ? (
68
- <Fragment key={index}>
69
- <div className="form-multi-select-optgroup-label">{option.label}</div>
70
- {createOptions(option.options)}
71
- </Fragment>
72
- ) : (
67
+ options.map((option: Option | OptionsGroup, index: number) =>
68
+ 'value' in option ? (
73
69
  <div
74
70
  className={classNames('form-multi-select-option', {
75
71
  'form-multi-select-option-with-checkbox': optionsStyle === 'checkbox',
@@ -77,11 +73,15 @@ export const CMultiSelectOptions = forwardRef<HTMLDivElement, CMultiSelectOption
77
73
  disabled: option.disabled,
78
74
  })}
79
75
  key={index}
80
- onClick={() => handleOptionOnClick && handleOptionOnClick(option)}
81
- onKeyDown={(event) => handleKeyDown(event, option)}
76
+ onClick={() => handleOptionOnClick && handleOptionOnClick(option as Option)}
77
+ onKeyDown={(event) => handleKeyDown(event, option as Option)}
82
78
  tabIndex={0}
83
79
  >
84
- {option.text}
80
+ {optionsTemplate ? optionsTemplate(option as Option) : option.text}
81
+ </div>
82
+ ) : (
83
+ <div className="form-multi-select-optgroup-label" key={index}>
84
+ {optionsGroupsTemplate ? optionsGroupsTemplate(option as OptionsGroup) : option.label}
85
85
  </div>
86
86
  ),
87
87
  )
@@ -122,6 +122,8 @@ CMultiSelectOptions.propTypes = {
122
122
  options: PropTypes.array.isRequired,
123
123
  optionsMaxHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
124
124
  optionsStyle: PropTypes.oneOf(['checkbox', 'text']),
125
+ optionsTemplate: PropTypes.func,
126
+ optionsGroupsTemplate: PropTypes.func,
125
127
  searchNoResultsLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
126
128
  virtualScroller: PropTypes.bool,
127
129
  visibleItems: PropTypes.number,
@@ -1,4 +1,6 @@
1
1
  import React, { forwardRef, HTMLAttributes } from 'react'
2
+
3
+ import classNames from 'classnames'
2
4
  import PropTypes from 'prop-types'
3
5
 
4
6
  import type { SelectedOption } from './types'
@@ -6,6 +8,7 @@ import type { SelectedOption } from './types'
6
8
  export interface CMultiSelectSelectionProps extends HTMLAttributes<HTMLSpanElement> {
7
9
  multiple?: boolean
8
10
  onRemove?: (option: SelectedOption) => void
11
+ placeholder?: string
9
12
  search?: boolean | 'external'
10
13
  selected?: SelectedOption[]
11
14
  selectionType?: 'counter' | 'tags' | 'text'
@@ -13,12 +16,31 @@ export interface CMultiSelectSelectionProps extends HTMLAttributes<HTMLSpanEleme
13
16
  }
14
17
 
15
18
  export const CMultiSelectSelection = forwardRef<HTMLSpanElement, CMultiSelectSelectionProps>(
16
- ({ multiple, onRemove, search, selected = [], selectionType, selectionTypeCounterText }, ref) => {
19
+ (
20
+ {
21
+ children,
22
+ multiple,
23
+ placeholder,
24
+ onRemove,
25
+ search,
26
+ selected = [],
27
+ selectionType,
28
+ selectionTypeCounterText,
29
+ },
30
+ ref,
31
+ ) => {
17
32
  return (
18
- <span className="form-multi-select-selection" ref={ref}>
33
+ <span
34
+ className={classNames('form-multi-select-selection', {
35
+ 'form-multi-select-selection-tags': multiple && selectionType === 'tags',
36
+ })}
37
+ ref={ref}
38
+ >
39
+ {multiple && selectionType === 'counter' && !search && selected.length === 0 && placeholder}
19
40
  {multiple &&
20
41
  selectionType === 'counter' &&
21
42
  !search &&
43
+ selected.length > 0 &&
22
44
  `${selected.length} ${selectionTypeCounterText}`}
23
45
  {multiple &&
24
46
  selectionType === 'tags' &&
@@ -29,20 +51,26 @@ export const CMultiSelectSelection = forwardRef<HTMLSpanElement, CMultiSelectSel
29
51
  {option.text}
30
52
  {!option.disabled && (
31
53
  <button
32
- className="form-multi-select-tag-delete close"
54
+ className="form-multi-select-tag-delete"
33
55
  aria-label="Close"
34
56
  onClick={() => onRemove && onRemove(option)}
35
- >
36
- <span aria-hidden="true">×</span>
37
- </button>
57
+ />
38
58
  )}
39
59
  </span>
40
60
  )
41
61
  }
42
62
  return
43
63
  })}
44
- {multiple && selectionType === 'text' && selected.map((option) => option.text).join(', ')}
64
+ {multiple &&
65
+ selectionType === 'text' &&
66
+ selected.map((option, index) => (
67
+ <span key={index}>
68
+ {option.text}
69
+ {index === selected.length - 1 ? '' : ','}&nbsp;
70
+ </span>
71
+ ))}
45
72
  {!multiple && !search && selected.map((option) => option.text)[0]}
73
+ {children}
46
74
  </span>
47
75
  )
48
76
  },
@@ -51,6 +79,7 @@ export const CMultiSelectSelection = forwardRef<HTMLSpanElement, CMultiSelectSel
51
79
  CMultiSelectSelection.propTypes = {
52
80
  multiple: PropTypes.bool,
53
81
  onRemove: PropTypes.func,
82
+ placeholder: PropTypes.string,
54
83
  search: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf<'external'>(['external'])]),
55
84
  selected: PropTypes.array,
56
85
  selectionType: PropTypes.oneOf(['counter', 'tags', 'text']),
@@ -11,15 +11,16 @@ const options = [
11
11
  {
12
12
  value: 1,
13
13
  text: 'Bootstrap',
14
+ selected: true,
14
15
  },
15
16
  {
16
17
  value: 2,
17
18
  text: 'React.js',
18
- selected: true,
19
19
  },
20
20
  {
21
21
  value: 3,
22
22
  text: 'Vue.js',
23
+ selected: true,
23
24
  },
24
25
  {
25
26
  label: 'backend',
@@ -35,6 +36,8 @@ const options = [
35
36
  {
36
37
  value: 6,
37
38
  text: 'Node.js',
39
+ disabled: true,
40
+ selected: true,
38
41
  },
39
42
  ],
40
43
  },
@@ -71,25 +74,33 @@ test('CMultiSelect customize', async () => {
71
74
  if (container.firstChild === null) {
72
75
  expect(true).toBe(false)
73
76
  } else {
74
- expect(container.firstChild.firstChild).toHaveAttribute('value', 'value1')
75
- expect(container.firstChild.firstChild).toHaveTextContent('text1')
76
- expect(container.firstChild.lastChild).toHaveAttribute('value', 'value3')
77
- expect(container.firstChild.lastChild).toHaveTextContent('text3')
77
+ expect(container.firstChild.firstChild).toHaveAttribute('value', '1')
78
+ expect(container.firstChild.firstChild).toHaveTextContent('Bootstrap')
79
+ expect(container.firstChild.lastChild).toHaveAttribute('value', '6')
80
+ expect(container.firstChild.lastChild).toHaveTextContent('Node.js')
78
81
  }
79
82
  expect(container.lastChild).toHaveClass('form-multi-select')
80
83
  expect(container.lastChild).toHaveClass('show')
81
- expect(container.lastChild).toHaveClass('form-multi-select-selection-tags')
82
84
  expect(container.lastChild).toHaveClass('bazinga')
83
85
 
84
86
  if (container.lastChild === null) {
85
87
  expect(true).toBe(false)
86
88
  } else {
87
- expect(container.lastChild.firstChild).toHaveClass('form-multi-select-selection')
89
+ expect(container.lastChild.firstChild).toHaveClass('form-multi-select-toggler')
88
90
  if (container.lastChild.firstChild === null) {
89
91
  expect(true).toBe(false)
90
92
  } else {
91
- expect(container.lastChild.firstChild.firstChild).toHaveClass('form-multi-select-tag')
92
- expect(container.lastChild.firstChild.firstChild).toHaveTextContent('text3')
93
+ expect(container.lastChild.firstChild.firstChild).toHaveClass(
94
+ 'form-multi-select-selection-tags',
95
+ )
96
+ if (container.lastChild.firstChild.firstChild === null) {
97
+ expect(true).toBe(false)
98
+ } else {
99
+ expect(container.lastChild.firstChild.firstChild.firstChild).toHaveClass(
100
+ 'form-multi-select-tag',
101
+ )
102
+ expect(container.lastChild.firstChild.firstChild.firstChild).toHaveTextContent('Bootstrap')
103
+ }
93
104
  }
94
105
  expect(container.lastChild.lastChild).toHaveClass('form-multi-select-dropdown')
95
106
  if (container.lastChild.lastChild === null) {
@@ -112,7 +123,7 @@ test('CMultiSelect customize', async () => {
112
123
  expect(container.lastChild.lastChild.lastChild.firstChild).toHaveClass(
113
124
  'form-multi-select-option-with-checkbox',
114
125
  )
115
- expect(container.lastChild.lastChild.lastChild.firstChild).toHaveTextContent('text1')
126
+ expect(container.lastChild.lastChild.lastChild.firstChild).toHaveTextContent('Angular')
116
127
  expect(container.lastChild.lastChild.lastChild.lastChild).toHaveClass(
117
128
  'form-multi-select-option',
118
129
  )
@@ -121,7 +132,7 @@ test('CMultiSelect customize', async () => {
121
132
  )
122
133
  expect(container.lastChild.lastChild.lastChild.lastChild).toHaveClass('form-multi-selected')
123
134
  expect(container.lastChild.lastChild.lastChild.lastChild).toHaveClass('disabled')
124
- expect(container.lastChild.lastChild.lastChild.lastChild).toHaveTextContent('text3')
135
+ expect(container.lastChild.lastChild.lastChild.lastChild).toHaveTextContent('Node.js')
125
136
  }
126
137
  }
127
138
  }
@@ -149,15 +160,15 @@ test('CMultiSelect fire events', async () => {
149
160
  onChange={event}
150
161
  />,
151
162
  )
152
- expect(event).toHaveBeenCalledTimes(2)
163
+ expect(event).toHaveBeenCalledTimes(1)
153
164
  const option = document.querySelector('.form-multi-select-option')
154
165
  if (option !== null) {
155
166
  fireEvent.click(option)
156
167
  }
157
- expect(event).toHaveBeenCalledTimes(3)
168
+ expect(event).toHaveBeenCalledTimes(2)
158
169
  const removeButton = document.querySelector('.form-multi-select-tag-delete')
159
170
  if (removeButton !== null) {
160
171
  fireEvent.click(removeButton)
161
172
  }
162
- expect(event).toHaveBeenCalledTimes(4)
173
+ expect(event).toHaveBeenCalledTimes(3)
163
174
  })
@@ -2,7 +2,7 @@ import * as React from 'react'
2
2
  import { render } from '@testing-library/react'
3
3
  import '@testing-library/jest-dom/extend-expect'
4
4
  import { CMultiSelectNativeSelect } from '../CMultiSelectNativeSelect'
5
- import { Option } from '../CMultiSelect'
5
+ import { Option } from '../types'
6
6
 
7
7
  test('loads and displays CMultiSelectNativeSelect component', async () => {
8
8
  const { container } = render(<CMultiSelectNativeSelect options={[]} />)
@@ -2,7 +2,7 @@ import * as React from 'react'
2
2
  import { render, fireEvent } from '@testing-library/react'
3
3
  import '@testing-library/jest-dom/extend-expect'
4
4
  import { CMultiSelectOptions } from '../CMultiSelectOptions'
5
- import { Option } from '../CMultiSelect'
5
+ import { Option } from '../types'
6
6
 
7
7
  const options: Option[] = [
8
8
  {
@@ -19,7 +19,7 @@ const options: Option[] = [
19
19
 
20
20
  test('loads and displays CMultiSelectOptions component', async () => {
21
21
  const { container } = render(
22
- <CMultiSelectOptions options={[]} searchNoResultsLabel="some no result label" />,
22
+ <CMultiSelectOptions options={[]} searchNoResultsLabel="some no result label" selected={[]} />,
23
23
  )
24
24
  expect(container).toMatchSnapshot()
25
25
  expect(container.firstChild).toHaveClass('form-multi-select-options')
@@ -38,6 +38,7 @@ test('CMultiSelectOptions customize', async () => {
38
38
  optionsMaxHeight="200"
39
39
  optionsStyle="checkbox"
40
40
  searchNoResultsLabel="some - searchNoResultsLabel"
41
+ selected={[]}
41
42
  />,
42
43
  )
43
44
  expect(container).toMatchSnapshot()
@@ -48,7 +49,6 @@ test('CMultiSelectOptions customize', async () => {
48
49
  } else {
49
50
  expect(container.firstChild.firstChild).toHaveClass('form-multi-select-option')
50
51
  expect(container.firstChild.firstChild).toHaveClass('form-multi-select-option-with-checkbox')
51
- expect(container.firstChild.firstChild).toHaveClass('form-multi-selected')
52
52
  expect(container.firstChild.firstChild).toHaveClass('disabled')
53
53
  expect(container.firstChild.firstChild).toHaveTextContent('text1')
54
54
  expect(container.firstChild.lastChild).toHaveClass('form-multi-select-option')
@@ -59,7 +59,7 @@ test('CMultiSelectOptions customize', async () => {
59
59
 
60
60
  test('CMultiSelectOptions handle on click', async () => {
61
61
  const onClick = jest.fn()
62
- render(<CMultiSelectOptions options={options} handleOptionOnClick={onClick} />)
62
+ render(<CMultiSelectOptions options={options} handleOptionOnClick={onClick} selected={[]} />)
63
63
  expect(onClick).toHaveBeenCalledTimes(0)
64
64
  const option = document.querySelector('.form-multi-select-option')
65
65
  if (option !== null) {
@@ -41,7 +41,6 @@ test('CMultiSelectSelection customize tags', async () => {
41
41
  expect(true).toBe(false)
42
42
  } else {
43
43
  expect(container.firstChild.firstChild.lastChild).toHaveClass('form-multi-select-tag-delete')
44
- expect(container.firstChild.firstChild.lastChild).toHaveClass('close')
45
44
  expect(container.firstChild.firstChild.lastChild).toHaveAttribute('aria-label', 'Close')
46
45
  if (container.firstChild.firstChild.lastChild === null) {
47
46
  expect(true).toBe(false)
@@ -3,45 +3,97 @@
3
3
  exports[`CMultiSelect customize 1`] = `
4
4
  <div>
5
5
  <select
6
+ class="multi-select-new"
6
7
  multiple=""
7
8
  style="display: none;"
8
9
  tabindex="-1"
9
10
  >
10
11
  <option
11
- value="value1"
12
+ value="1"
12
13
  >
13
- text1
14
+ Bootstrap
15
+ </option>
16
+ <option
17
+ value="3"
18
+ >
19
+ Vue.js
14
20
  </option>
15
21
  <option
16
22
  disabled=""
17
- value="value3"
23
+ value="6"
18
24
  >
19
- text3
25
+ Node.js
20
26
  </option>
21
27
  </select>
22
28
  <div
23
- class="form-multi-select show form-multi-select-selection-tags bazinga"
29
+ aria-expanded="true"
30
+ class="form-multi-select show bazinga"
24
31
  >
25
- <span
26
- class="form-multi-select-selection"
32
+ <div
33
+ class="form-multi-select-toggler"
27
34
  >
28
35
  <span
29
- class="form-multi-select-tag"
36
+ class="form-multi-select-selection form-multi-select-selection-tags"
30
37
  >
31
- text3
38
+ <span
39
+ class="form-multi-select-tag"
40
+ >
41
+ Bootstrap
42
+ <button
43
+ aria-label="Close"
44
+ class="form-multi-select-tag-delete"
45
+ >
46
+ <span
47
+ aria-hidden="true"
48
+ >
49
+ ×
50
+ </span>
51
+ </button>
52
+ </span>
53
+ <span
54
+ class="form-multi-select-tag"
55
+ >
56
+ Vue.js
57
+ <button
58
+ aria-label="Close"
59
+ class="form-multi-select-tag-delete"
60
+ >
61
+ <span
62
+ aria-hidden="true"
63
+ >
64
+ ×
65
+ </span>
66
+ </button>
67
+ </span>
68
+ <span
69
+ class="form-multi-select-tag"
70
+ >
71
+ Node.js
72
+ </span>
73
+ <input
74
+ autocomplete="off"
75
+ class="form-multi-select-search"
76
+ size="2"
77
+ type="text"
78
+ />
32
79
  </span>
33
- </span>
34
- <button
35
- class="form-multi-select-selection-cleaner"
36
- type="button"
37
- />
38
- <input
39
- class="form-multi-select-search"
40
- size="2"
41
- type="text"
42
- />
80
+ <div
81
+ class="form-multi-select-buttons"
82
+ >
83
+ <button
84
+ class="form-multi-select-cleaner"
85
+ type="button"
86
+ />
87
+ <button
88
+ class="form-multi-select-indicator"
89
+ type="button"
90
+ />
91
+ </div>
92
+ </div>
43
93
  <div
44
94
  class="form-multi-select-dropdown"
95
+ role="menu"
96
+ style="position: absolute; left: 0px; top: 0px; margin: 0px;"
45
97
  >
46
98
  <button
47
99
  class="form-multi-select-all"
@@ -55,13 +107,50 @@ exports[`CMultiSelect customize 1`] = `
55
107
  >
56
108
  <div
57
109
  class="form-multi-select-option form-multi-select-option-with-checkbox"
110
+ tabindex="0"
111
+ >
112
+ Angular
113
+ </div>
114
+ <div
115
+ class="form-multi-select-option form-multi-select-option-with-checkbox form-multi-selected"
116
+ tabindex="0"
117
+ >
118
+ Bootstrap
119
+ </div>
120
+ <div
121
+ class="form-multi-select-option form-multi-select-option-with-checkbox"
122
+ tabindex="0"
123
+ >
124
+ React.js
125
+ </div>
126
+ <div
127
+ class="form-multi-select-option form-multi-select-option-with-checkbox form-multi-selected"
128
+ tabindex="0"
58
129
  >
59
- text1
130
+ Vue.js
131
+ </div>
132
+ <div
133
+ class="form-multi-select-optgroup-label"
134
+ >
135
+ backend
136
+ </div>
137
+ <div
138
+ class="form-multi-select-option form-multi-select-option-with-checkbox"
139
+ tabindex="0"
140
+ >
141
+ Django
142
+ </div>
143
+ <div
144
+ class="form-multi-select-option form-multi-select-option-with-checkbox"
145
+ tabindex="0"
146
+ >
147
+ Laravel
60
148
  </div>
61
149
  <div
62
150
  class="form-multi-select-option form-multi-select-option-with-checkbox form-multi-selected disabled"
151
+ tabindex="0"
63
152
  >
64
- text3
153
+ Node.js
65
154
  </div>
66
155
  </div>
67
156
  </div>
@@ -72,23 +161,40 @@ exports[`CMultiSelect customize 1`] = `
72
161
  exports[`loads and displays CMultiSelect component 1`] = `
73
162
  <div>
74
163
  <select
164
+ class="multi-select-new"
75
165
  multiple=""
76
166
  style="display: none;"
77
167
  tabindex="-1"
78
168
  />
79
169
  <div
80
- class="form-multi-select form-multi-select-selection-tags"
170
+ aria-expanded="false"
171
+ class="form-multi-select"
81
172
  >
82
- <span
83
- class="form-multi-select-selection"
84
- />
85
- <input
86
- class="form-multi-select-search"
87
- placeholder="Select..."
88
- type="text"
89
- />
173
+ <div
174
+ class="form-multi-select-toggler"
175
+ >
176
+ <span
177
+ class="form-multi-select-selection form-multi-select-selection-tags"
178
+ >
179
+ <input
180
+ autocomplete="off"
181
+ class="form-multi-select-search"
182
+ placeholder="Select..."
183
+ type="text"
184
+ />
185
+ </span>
186
+ <div
187
+ class="form-multi-select-buttons"
188
+ >
189
+ <button
190
+ class="form-multi-select-indicator"
191
+ type="button"
192
+ />
193
+ </div>
194
+ </div>
90
195
  <div
91
196
  class="form-multi-select-dropdown"
197
+ role="menu"
92
198
  >
93
199
  <button
94
200
  class="form-multi-select-all"
@@ -3,6 +3,7 @@
3
3
  exports[`CMultiSelectNativeSelect customize 1`] = `
4
4
  <div>
5
5
  <select
6
+ class="multi-select-new"
6
7
  multiple=""
7
8
  style="display: none;"
8
9
  tabindex="-1"
@@ -30,6 +31,7 @@ exports[`CMultiSelectNativeSelect customize 1`] = `
30
31
  exports[`loads and displays CMultiSelectNativeSelect component 1`] = `
31
32
  <div>
32
33
  <select
34
+ class="multi-select-new"
33
35
  style="display: none;"
34
36
  tabindex="-1"
35
37
  />
@@ -7,12 +7,14 @@ exports[`CMultiSelectOptions customize 1`] = `
7
7
  style="max-height: 200; overflow: scroll;"
8
8
  >
9
9
  <div
10
- class="form-multi-select-option form-multi-select-option-with-checkbox form-multi-selected disabled"
10
+ class="form-multi-select-option form-multi-select-option-with-checkbox disabled"
11
+ tabindex="0"
11
12
  >
12
13
  text1
13
14
  </div>
14
15
  <div
15
16
  class="form-multi-select-option form-multi-select-option-with-checkbox"
17
+ tabindex="0"
16
18
  >
17
19
  text3
18
20
  </div>
@@ -13,7 +13,7 @@ exports[`CMultiSelectSelection customize counter 1`] = `
13
13
  exports[`CMultiSelectSelection customize tags 1`] = `
14
14
  <div>
15
15
  <span
16
- class="form-multi-select-selection"
16
+ class="form-multi-select-selection form-multi-select-selection-tags"
17
17
  >
18
18
  <span
19
19
  class="form-multi-select-tag"
@@ -21,7 +21,7 @@ exports[`CMultiSelectSelection customize tags 1`] = `
21
21
  text1
22
22
  <button
23
23
  aria-label="Close"
24
- class="form-multi-select-tag-delete close"
24
+ class="form-multi-select-tag-delete"
25
25
  >
26
26
  <span
27
27
  aria-hidden="true"
@@ -1,16 +1,21 @@
1
1
  export type Option = {
2
2
  custom?: boolean
3
3
  disabled?: boolean
4
- label?: string
5
- options?: Option[]
6
- order?: number
7
4
  selected?: boolean
8
- text: string
5
+ text: string // TODO: change to label in v5
9
6
  value: number | string
7
+ [key: string]: number | string | any
8
+ }
9
+
10
+ export type OptionsGroup = {
11
+ label: string
12
+ options?: Option[]
13
+ [key: string]: number | string | any
10
14
  }
11
15
 
12
16
  export type SelectedOption = {
13
17
  disabled?: boolean
14
18
  text: string
15
19
  value: number | string
20
+ [key: string]: number | string | any
16
21
  }