playbook_ui 14.22.0.pre.alpha.PLAY2254datepickerdefaultdatenullvalueturbo8533 → 14.22.0.pre.alpha.PLAY2254datepickerdefaultdatenullvalueturbo8612

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 (28) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +6 -7
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -2
  4. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +2 -2
  5. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +10 -2
  6. data/app/pb_kits/playbook/pb_table/_table.tsx +4 -4
  7. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.jsx +8 -8
  8. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_react.md +1 -1
  9. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.jsx +12 -12
  10. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_react.md +3 -3
  11. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.jsx +12 -12
  12. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_react.md +3 -3
  13. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input.html.erb +18 -0
  14. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input_rails.md +1 -0
  15. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +1 -0
  16. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +3 -0
  17. data/dist/chunks/{_typeahead-BszXPiWi.js → _typeahead-C0lpNFcU.js} +1 -1
  18. data/dist/chunks/_weekday_stacked-DFFZPW5i.js +45 -0
  19. data/dist/chunks/{lib-BUnAetLK.js → lib-C1ZF3sQV.js} +1 -1
  20. data/dist/chunks/{pb_form_validation-C0_FS7e9.js → pb_form_validation-DGI8PFYA.js} +1 -1
  21. data/dist/chunks/vendor.js +1 -1
  22. data/dist/playbook-doc.js +2 -2
  23. data/dist/playbook-rails-react-bindings.js +1 -1
  24. data/dist/playbook-rails.js +1 -1
  25. data/lib/playbook/version.rb +1 -1
  26. metadata +9 -7
  27. data/dist/chunks/_weekday_stacked-BOI-NAUo.js +0 -45
  28. /data/app/pb_kits/playbook/pb_typeahead/docs/{_typeahead_preserve_input.md → _typeahead_preserve_input_react.md} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 567b391c419da9e3cf4d19032b27f7a6263ae4e1eaa405478f7d898346615a51
4
- data.tar.gz: d84820b333cf1f164fdb1b4b36b117641704faef98f4536ee6642279a9299789
3
+ metadata.gz: 9a87fa98852351432ea5eabd56eecad627fe87d811c1bbef24dfb808a56a82d6
4
+ data.tar.gz: 72116b01022bf7057b9b302b82e5e4ad04ad725ebed7767790f70ac63b9c6104
5
5
  SHA512:
6
- metadata.gz: e12362bbf552aca4ac900aac3ca3099977ba55ce61d3598c9a31dcb0e1e2747b8cba83ec688311b135c38ae8728d0be67c783a0d6d6f2987444cb01d7085ce18
7
- data.tar.gz: e0e3390a30724e0c4538674a071f04f15b4bbb6c0787f9efac4d71b8d09a85812dac0c298cb2db3f82eeb02af958e980da4b44fcf3b9e9a1efd7847df7d80468
6
+ metadata.gz: 0b4277e148137bae2774222750331a4f7ee5bad60fb00bebf30a1ec61a5ca99c237327025bd71c8c589b65ad5a5c6d4cc60a93494566ddd0d90b5a647a792751
7
+ data.tar.gz: d528d61d673da43c6f94cf98432da6266bf81347e1cd5bc39df125c7d58b7ba8000f3804cf88ef3b1f28e08e68ee3c5c70316bac333ac4cfda1ffa90009062fd
@@ -20,7 +20,7 @@ interface CustomCellProps {
20
20
  customRenderer?: (row: Row<GenericObject>, value: string | undefined) => React.ReactNode
21
21
  selectableRows?: boolean
22
22
  customStyle?: GenericObject
23
- }
23
+ }
24
24
 
25
25
  export const CustomCell = ({
26
26
  getValue,
@@ -35,7 +35,7 @@ export const CustomCell = ({
35
35
 
36
36
  const handleOnExpand = (row: Row<GenericObject>) => {
37
37
  onRowToggleClick && onRowToggleClick(row);
38
-
38
+
39
39
  if (!expandedControl) {
40
40
  setExpanded({ ...expanded, [row.id]: !row.getIsExpanded() });
41
41
  }
@@ -46,8 +46,8 @@ export const CustomCell = ({
46
46
 
47
47
  return (
48
48
  <div style={{ paddingLeft: `${row.depth * 1.25}em`}}>
49
- <Flex
50
- alignItems="center"
49
+ <Flex
50
+ alignItems="center"
51
51
  columnGap="xs"
52
52
  justify="start"
53
53
  orientation="row"
@@ -71,12 +71,11 @@ export const CustomCell = ({
71
71
  >
72
72
  {row.getIsExpanded() ? (
73
73
  <Icon cursor="pointer"
74
- icon="circle-play"
75
- rotation={90}
74
+ icon="circle-play-down"
76
75
  />
77
76
  ) : (
78
77
  <Icon cursor="pointer"
79
- icon="circle-play"
78
+ icon="circle-play"
80
79
  />
81
80
  )}
82
81
  </button>
@@ -19,8 +19,8 @@ examples:
19
19
  - advanced_table_selectable_rows_actions_rails: Selectable Rows (With Actions)
20
20
  - advanced_table_selectable_rows_header_rails: Selectable Rows (No Actions Bar)
21
21
  - advanced_table_scrollbar_none: Advanced Table Scrollbar None
22
- # - advanced_table_column_styling_rails: Column Styling
23
- # - advanced_table_column_styling_column_headers_rails: Column Styling with Multiple Headers
22
+ - advanced_table_column_styling_rails: Column Styling
23
+ - advanced_table_column_styling_column_headers_rails: Column Styling with Multiple Headers
24
24
 
25
25
  react:
26
26
  - advanced_table_default: Default (Required Props)
@@ -30,11 +30,11 @@
30
30
  class="gray-icon expand-toggle-icon"
31
31
  data-advanced-table="true">
32
32
  <%= pb_rails("icon", props: { id: "advanced-table_open_icon", icon: "circle-play", cursor: "pointer" }) %>
33
- <%= pb_rails("icon", props: { id: "advanced-table_close_icon", icon: "circle-play", cursor: "pointer", rotation: 90 }) %>
33
+ <%= pb_rails("icon", props: { id: "advanced-table_close_icon", icon: "circle-play-down", cursor: "pointer" }) %>
34
34
  </button>
35
35
  <% end %>
36
36
  <% end %>
37
- <%= pb_rails("flex/flex_item") do %>
37
+ <%= pb_rails("flex/flex_item") do %>
38
38
  <% if column[:custom_renderer].present? %>
39
39
  <%= raw(column[:custom_renderer].call(object.row, custom_renderer_value(column, index))) %>
40
40
  <% elsif index.zero? %>
@@ -89,6 +89,14 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
89
89
  }
90
90
  }
91
91
 
92
+ const maybeDefaultDate = () => {
93
+ const inputEl = document.querySelector(`#${pickerId}`) as HTMLInputElement
94
+ if (!inputEl?.value?.trim()) {
95
+ return defaultDateGetter()
96
+ }
97
+ return undefined
98
+ }
99
+
92
100
  const disabledWeekDays = () => {
93
101
  return (
94
102
  [
@@ -206,7 +214,7 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
206
214
  closeOnSelect,
207
215
  disableMobile: true,
208
216
  dateFormat: getDateFormat(),
209
- defaultDate: defaultDateGetter(),
217
+ defaultDate: maybeDefaultDate(),
210
218
  disable: disabledParser(),
211
219
  enableTime,
212
220
  locale: {
@@ -275,7 +283,7 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
275
283
  picker.monthsDropdownContainer.value = picker.currentMonth
276
284
 
277
285
  /* Reset date picker to default value on form.reset() */
278
- if (defaultDate !== '' && defaultDate !== null && defaultDate !== undefined) {
286
+ if (defaultDate) {
279
287
  picker.setDate(defaultDate)
280
288
  yearChangeHook(picker)
281
289
  }
@@ -104,8 +104,8 @@ const Table = (props: TableProps): React.ReactElement => {
104
104
 
105
105
  stickyLeftColumn.forEach((colId, index) => {
106
106
  const isLastColumn = index === stickyLeftColumn.length - 1;
107
- const header = document.querySelector(`th[id="${colId}"]`);
108
- const cells = document.querySelectorAll(`td[id="${colId}"]`);
107
+ const header = document.querySelector(`th[data-sticky-id="${colId}"]`);
108
+ const cells = document.querySelectorAll(`td[data-sticky-id="${colId}"]`);
109
109
 
110
110
  if (header) {
111
111
  header.classList.add('sticky');
@@ -155,8 +155,8 @@ const Table = (props: TableProps): React.ReactElement => {
155
155
 
156
156
  stickyRightColumnReversed.forEach((colId, index) => {
157
157
  const isLastColumn = index === stickyRightColumn.length - 1;
158
- const header = document.querySelector(`th[id="${colId}"]`);
159
- const cells = document.querySelectorAll(`td[id="${colId}"]`);
158
+ const header = document.querySelector(`th[data-sticky-id="${colId}"]`);
159
+ const cells = document.querySelectorAll(`td[data-sticky-id="${colId}"]`);
160
160
 
161
161
  if (header) {
162
162
  header.classList.add('sticky');
@@ -11,7 +11,7 @@ const TableStickyColumns = () => {
11
11
  >
12
12
  <thead>
13
13
  <tr>
14
- <th id="a">{'Column 1'}</th>
14
+ <th data-sticky-id="a">{'Column 1'}</th>
15
15
  <th>{'Column 2'}</th>
16
16
  <th>{'Column 3'}</th>
17
17
  <th>{'Column 4'}</th>
@@ -25,12 +25,12 @@ const TableStickyColumns = () => {
25
25
  <th>{'Column 12'}</th>
26
26
  <th>{'Column 13'}</th>
27
27
  <th>{'Column 14'}</th>
28
- <th id="b">{'Column 15'}</th>
28
+ <th data-sticky-id="b">{'Column 15'}</th>
29
29
  </tr>
30
30
  </thead>
31
31
  <tbody>
32
32
  <tr>
33
- <td id="a">{'Value 1'}</td>
33
+ <td data-sticky-id="a">{'Value 1'}</td>
34
34
  <td>{'Value 2'}</td>
35
35
  <td>{'Value 3'}</td>
36
36
  <td>{'Value 4'}</td>
@@ -44,10 +44,10 @@ const TableStickyColumns = () => {
44
44
  <td>{'Value 12'}</td>
45
45
  <td>{'Value 13'}</td>
46
46
  <td>{'Value 14'}</td>
47
- <td id="b">{'Value 15'}</td>
47
+ <td data-sticky-id="b">{'Value 15'}</td>
48
48
  </tr>
49
49
  <tr>
50
- <td id="a">{'Value 1'}</td>
50
+ <td data-sticky-id="a">{'Value 1'}</td>
51
51
  <td>{'Value 2'}</td>
52
52
  <td>{'Value 3'}</td>
53
53
  <td>{'Value 4'}</td>
@@ -61,10 +61,10 @@ const TableStickyColumns = () => {
61
61
  <td>{'Value 12'}</td>
62
62
  <td>{'Value 13'}</td>
63
63
  <td>{'Value 14'}</td>
64
- <td id="b">{'Value 15'}</td>
64
+ <td data-sticky-id="b">{'Value 15'}</td>
65
65
  </tr>
66
66
  <tr>
67
- <td id="a">{'Value 1'}</td>
67
+ <td data-sticky-id="a">{'Value 1'}</td>
68
68
  <td>{'Value 2'}</td>
69
69
  <td>{'Value 3'}</td>
70
70
  <td>{'Value 4'}</td>
@@ -78,7 +78,7 @@ const TableStickyColumns = () => {
78
78
  <td>{'Value 12'}</td>
79
79
  <td>{'Value 13'}</td>
80
80
  <td>{'Value 14'}</td>
81
- <td id="b">{'Value 15'}</td>
81
+ <td data-sticky-id="b">{'Value 15'}</td>
82
82
  </tr>
83
83
  </tbody>
84
84
  </Table>
@@ -1,3 +1,3 @@
1
1
  The `stickyLeftColumn` and `stickyRightColumn` props can be used together on the same table as needed.
2
2
 
3
- Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using props.
3
+ Please ensure that unique `data-sticky-id`s are used for all columns across multiple tables. Using the same columns `data-sticky-id`s on multiple tables can lead to issues when using props.
@@ -10,9 +10,9 @@ const TableStickyLeftColumns = () => {
10
10
  >
11
11
  <thead>
12
12
  <tr>
13
- <th id="1">{'Column 1'}</th>
14
- <th id="2">{'Column 2'}</th>
15
- <th id="3">{'Column 3'}</th>
13
+ <th data-sticky-id="1">{'Column 1'}</th>
14
+ <th data-sticky-id="2">{'Column 2'}</th>
15
+ <th data-sticky-id="3">{'Column 3'}</th>
16
16
  <th>{'Column 4'}</th>
17
17
  <th>{'Column 5'}</th>
18
18
  <th>{'Column 6'}</th>
@@ -29,9 +29,9 @@ const TableStickyLeftColumns = () => {
29
29
  </thead>
30
30
  <tbody>
31
31
  <tr>
32
- <td id="1">{'Value 1'}</td>
33
- <td id="2">{'Value 2'}</td>
34
- <td id="3">{'Value 3'}</td>
32
+ <td data-sticky-id="1">{'Value 1'}</td>
33
+ <td data-sticky-id="2">{'Value 2'}</td>
34
+ <td data-sticky-id="3">{'Value 3'}</td>
35
35
  <td>{'Value 4'}</td>
36
36
  <td>{'Value 5'}</td>
37
37
  <td>{'Value 6'}</td>
@@ -46,9 +46,9 @@ const TableStickyLeftColumns = () => {
46
46
  <td>{'Value 15'}</td>
47
47
  </tr>
48
48
  <tr>
49
- <td id="1">{'Value 1'}</td>
50
- <td id="2">{'Value 2'}</td>
51
- <td id="3">{'Value 3'}</td>
49
+ <td data-sticky-id="1">{'Value 1'}</td>
50
+ <td data-sticky-id="2">{'Value 2'}</td>
51
+ <td data-sticky-id="3">{'Value 3'}</td>
52
52
  <td>{'Value 4'}</td>
53
53
  <td>{'Value 5'}</td>
54
54
  <td>{'Value 6'}</td>
@@ -63,9 +63,9 @@ const TableStickyLeftColumns = () => {
63
63
  <td>{'Value 15'}</td>
64
64
  </tr>
65
65
  <tr>
66
- <td id="1">{'Value 1'}</td>
67
- <td id="2">{'Value 2'}</td>
68
- <td id="3">{'Value 3'}</td>
66
+ <td data-sticky-id="1">{'Value 1'}</td>
67
+ <td data-sticky-id="2">{'Value 2'}</td>
68
+ <td data-sticky-id="3">{'Value 3'}</td>
69
69
  <td>{'Value 4'}</td>
70
70
  <td>{'Value 5'}</td>
71
71
  <td>{'Value 6'}</td>
@@ -1,5 +1,5 @@
1
- The `stickyLeftColumn` prop expects an array of the column ids you want to be sticky. Make sure to add the corresponding id to the `<th>` and `<td>`.
1
+ The `stickyLeftColumn` prop expects an array of the column `data-sticky-id`s you want to be sticky. Make sure to add the corresponding `data-sticky-id` to the `<th>` and `<td>`.
2
2
 
3
- If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>`
3
+ If you are using the sub-component variant, then you will pass the `data-sticky-id` to `<Table.Header>` and `<Table.Cell>`
4
4
 
5
- Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using `stickyLeftColumn` prop.
5
+ Please ensure that unique `data-sticky-id`s are used for all columns across multiple tables. Using the same columns `data-sticky-id`s on multiple tables can lead to issues when using `stickyLeftColumn` prop.
@@ -22,9 +22,9 @@ const TableStickyRightColumns = () => {
22
22
  <th>{'Column 10'}</th>
23
23
  <th>{'Column 11'}</th>
24
24
  <th>{'Column 12'}</th>
25
- <th id="13">{'Column 13'}</th>
26
- <th id="14">{'Column 14'}</th>
27
- <th id="15">{'Column 15'}</th>
25
+ <th data-sticky-id="13">{'Column 13'}</th>
26
+ <th data-sticky-id="14">{'Column 14'}</th>
27
+ <th data-sticky-id="15">{'Column 15'}</th>
28
28
  </tr>
29
29
  </thead>
30
30
  <tbody>
@@ -41,9 +41,9 @@ const TableStickyRightColumns = () => {
41
41
  <td>{'Value 10'}</td>
42
42
  <td>{'Value 11'}</td>
43
43
  <td>{'Value 12'}</td>
44
- <td id="13">{'Value 13'}</td>
45
- <td id="14">{'Value 14'}</td>
46
- <td id="15">{'Value 15'}</td>
44
+ <td data-sticky-id="13">{'Value 13'}</td>
45
+ <td data-sticky-id="14">{'Value 14'}</td>
46
+ <td data-sticky-id="15">{'Value 15'}</td>
47
47
  </tr>
48
48
  <tr>
49
49
  <td>{'Value 1'}</td>
@@ -58,9 +58,9 @@ const TableStickyRightColumns = () => {
58
58
  <td>{'Value 10'}</td>
59
59
  <td>{'Value 11'}</td>
60
60
  <td>{'Value 12'}</td>
61
- <td id="13">{'Value 13'}</td>
62
- <td id="14">{'Value 14'}</td>
63
- <td id="15">{'Value 15'}</td>
61
+ <td data-sticky-id="13">{'Value 13'}</td>
62
+ <td data-sticky-id="14">{'Value 14'}</td>
63
+ <td data-sticky-id="15">{'Value 15'}</td>
64
64
  </tr>
65
65
  <tr>
66
66
  <td>{'Value 1'}</td>
@@ -75,9 +75,9 @@ const TableStickyRightColumns = () => {
75
75
  <td>{'Value 10'}</td>
76
76
  <td>{'Value 11'}</td>
77
77
  <td>{'Value 12'}</td>
78
- <td id="13">{'Value 13'}</td>
79
- <td id="14">{'Value 14'}</td>
80
- <td id="15">{'Value 15'}</td>
78
+ <td data-sticky-id="13">{'Value 13'}</td>
79
+ <td data-sticky-id="14">{'Value 14'}</td>
80
+ <td data-sticky-id="15">{'Value 15'}</td>
81
81
  </tr>
82
82
  </tbody>
83
83
  </Table>
@@ -1,5 +1,5 @@
1
- The `stickyRightColumn` prop works in the same way as the above `stickyLeftColumn` prop. It expects an array of the column ids you want to be sticky. Make sure to add the corresponding id to the `<th>` and `<td>`.
1
+ The `stickyRightColumn` prop works in the same way as the above `stickyLeftColumn` prop. It expects an array of the column `data-sticky-id`s you want to be sticky. Make sure to add the corresponding `data-sticky-id` to the `<th>` and `<td>`.
2
2
 
3
- If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>`
3
+ If you are using the sub-component variant, then you will pass the `data-sticky-id` to `<Table.Header>` and `<Table.Cell>`
4
4
 
5
- Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using the `stickyRightColumn` prop.
5
+ Please ensure that unique `data-sticky-id`s are used for all columns across multiple tables. Using the same columns `data-sticky-id`s on multiple tables can lead to issues when using the `stickyRightColumn` prop.
@@ -0,0 +1,18 @@
1
+ <%
2
+ options = [
3
+ { label: 'Orange', value: '#FFA500' },
4
+ { label: 'Red', value: '#FF0000' },
5
+ { label: 'Green', value: '#00FF00' },
6
+ { label: 'Blue', value: '#0000FF' },
7
+ ]
8
+ %>
9
+
10
+ <%= pb_rails("typeahead", props: {
11
+ id: "typeahead-preserve-search-input",
12
+ is_multi: false,
13
+ label: "Colors",
14
+ options: options,
15
+ placeholder: "Select...",
16
+ preserve_search_input: true,
17
+ })
18
+ %>
@@ -0,0 +1 @@
1
+ By default, text is not preserved in the typeahead kit when you click off of the input field. You can utilize the `preserve_search_input` prop in order to prevent text from being cleared when the field loses focus
@@ -15,6 +15,7 @@ examples:
15
15
  - typeahead_dynamic_options: Dynamic Options
16
16
  - typeahead_dynamic_options_pure_rails: Dynamic Options (Pure Rails)
17
17
  - typeahead_disabled: Disabled
18
+ - typeahead_preserve_input: Preserve Search Input
18
19
 
19
20
  react:
20
21
  - typeahead_default: Default
@@ -54,6 +54,8 @@ module Playbook
54
54
  default: nil
55
55
  prop :disabled, type: Playbook::Props::Boolean,
56
56
  default: false
57
+ prop :preserve_search_input, type: Playbook::Props::Boolean,
58
+ default: false
57
59
 
58
60
  def classname
59
61
  default_margin_bottom = margin_bottom.present? ? "" : " mb_sm"
@@ -103,6 +105,7 @@ module Playbook
103
105
  optionsByContext: options_by_context,
104
106
  clearOnContextChange: clear_on_context_change,
105
107
  disabled: disabled,
108
+ preserveSearchInput: preserve_search_input,
106
109
  }
107
110
 
108
111
  base_options[:getOptionLabel] = get_option_label if get_option_label.present?
@@ -1,4 +1,4 @@
1
- import{jsx as jsx$1,Fragment,jsxs}from"react/jsx-runtime";import*as React from"react";import React__default,{createContext,useReducer,useEffect,useMemo,useContext,createElement,useRef,forwardRef,useState,useLayoutEffect,useCallback,useImperativeHandle,Component,Fragment as Fragment$1}from"react";import{g as getDefaultExportFromCjs,v as filter,w as omit,s as noop$2,u as useCollapsible,x as createPopper,y as uniqueId,z as get,A as flip$2,B as offset$2,C as shift$2,E as arrow$3,F as computePosition$1,G as createCoords$1,H as round$1,I as max$1,J as min$1,K as rectToClientRect$1,k as getAllIcons,t as colors$1,L as highchartsTheme,M as merge,N as highchartsDarkTheme,O as getAugmentedNamespace,Q as typography,S as cloneDeep,n as isEmpty$1,T as isString}from"./lib-BUnAetLK.js";import*as ReactDOM from"react-dom";import ReactDOM__default,{createPortal}from"react-dom";import{TrixEditor}from"react-trix";import Trix from"trix";import require$$0 from"react-is";const initialState={items:[],dragData:{id:"",initialGroup:""},isDragging:"",activeContainer:""};const reducer=(state,action)=>{switch(action.type){case"SET_ITEMS":return{...state,items:action.payload};case"SET_DRAG_DATA":return{...state,dragData:action.payload};case"SET_IS_DRAGGING":return{...state,isDragging:action.payload};case"SET_ACTIVE_CONTAINER":return{...state,activeContainer:action.payload};case"CHANGE_CATEGORY":return{...state,items:state.items.map((item=>item.id===action.payload.itemId?{...item,container:action.payload.container}:item))};case"REORDER_ITEMS":{const{dragId:dragId,targetId:targetId}=action.payload;const newItems=[...state.items];const draggedItem=newItems.find((item=>item.id===dragId));const draggedIndex=newItems.indexOf(draggedItem);const targetIndex=newItems.findIndex((item=>item.id===targetId));newItems.splice(draggedIndex,1);newItems.splice(targetIndex,0,draggedItem);return{...state,items:newItems}}default:return state}};const DragContext=createContext({});const DraggableContext=()=>useContext(DragContext);const DraggableProvider=({children:children,initialItems:initialItems,onReorder:onReorder,onDragStart:onDragStart,onDragEnter:onDragEnter,onDragEnd:onDragEnd,onDrop:onDrop,onDragOver:onDragOver,dropZone:dropZone={type:"ghost",color:"neutral",direction:"vertical"}})=>{const[state,dispatch]=useReducer(reducer,initialState);let dropZoneType="ghost";let dropZoneColor="neutral";let dropZoneDirection="vertical";if(typeof dropZone==="string"){dropZoneType=dropZone}else{dropZoneType=dropZone.type||"ghost";dropZoneColor=dropZone.type==="line"?dropZone.color||"primary":dropZone.color||"neutral";if(dropZoneType==="line"){dropZoneDirection=dropZone.direction||"vertical"}}useEffect((()=>{dispatch({type:"SET_ITEMS",payload:initialItems})}),[initialItems]);useEffect((()=>{onReorder(state.items)}),[state.items]);const handleDragStart=(id,container)=>{dispatch({type:"SET_DRAG_DATA",payload:{id:id,initialGroup:container}});dispatch({type:"SET_IS_DRAGGING",payload:id});if(onDragStart)onDragStart(id,container)};const handleDragEnter=(id,container)=>{if(state.dragData.id!==id){dispatch({type:"REORDER_ITEMS",payload:{dragId:state.dragData.id,targetId:id}});dispatch({type:"SET_DRAG_DATA",payload:{id:state.dragData.id,initialGroup:container}})}if(onDragEnter)onDragEnter(id,container)};const handleDragEnd=()=>{dispatch({type:"SET_IS_DRAGGING",payload:""});dispatch({type:"SET_ACTIVE_CONTAINER",payload:""});if(onDragEnd)onDragEnd()};const changeCategory=(itemId,container)=>{dispatch({type:"CHANGE_CATEGORY",payload:{itemId:itemId,container:container}})};const handleDrop=container=>{dispatch({type:"SET_IS_DRAGGING",payload:""});dispatch({type:"SET_ACTIVE_CONTAINER",payload:""});changeCategory(state.dragData.id,container);if(onDrop)onDrop(container)};const handleDragOver=(e,container)=>{e.preventDefault();dispatch({type:"SET_ACTIVE_CONTAINER",payload:container});if(onDragOver)onDragOver(e,container)};const contextValue=useMemo((()=>({items:state.items,dragData:state.dragData,isDragging:state.isDragging,activeContainer:state.activeContainer,dropZone:dropZoneType,dropZoneColor:dropZoneColor,...dropZoneType==="line"?{direction:dropZoneDirection}:{},handleDragStart:handleDragStart,handleDragEnter:handleDragEnter,handleDragEnd:handleDragEnd,handleDrop:handleDrop,handleDragOver:handleDragOver})),[state,dropZoneType,dropZoneColor,dropZoneDirection]);return jsx$1(DragContext.Provider,{value:contextValue,children:children})};var classnames$1={exports:{}};
1
+ import{jsx as jsx$1,Fragment,jsxs}from"react/jsx-runtime";import*as React from"react";import React__default,{createContext,useReducer,useEffect,useMemo,useContext,createElement,useRef,forwardRef,useState,useLayoutEffect,useCallback,useImperativeHandle,Component,Fragment as Fragment$1}from"react";import{g as getDefaultExportFromCjs,v as filter,w as omit,s as noop$2,u as useCollapsible,x as createPopper,y as uniqueId,z as get,A as flip$2,B as offset$2,C as shift$2,E as arrow$3,F as computePosition$1,G as createCoords$1,H as round$1,I as max$1,J as min$1,K as rectToClientRect$1,k as getAllIcons,t as colors$1,L as highchartsTheme,M as merge,N as highchartsDarkTheme,O as getAugmentedNamespace,Q as typography,S as cloneDeep,n as isEmpty$1,T as isString}from"./lib-C1ZF3sQV.js";import*as ReactDOM from"react-dom";import ReactDOM__default,{createPortal}from"react-dom";import{TrixEditor}from"react-trix";import Trix from"trix";import require$$0 from"react-is";const initialState={items:[],dragData:{id:"",initialGroup:""},isDragging:"",activeContainer:""};const reducer=(state,action)=>{switch(action.type){case"SET_ITEMS":return{...state,items:action.payload};case"SET_DRAG_DATA":return{...state,dragData:action.payload};case"SET_IS_DRAGGING":return{...state,isDragging:action.payload};case"SET_ACTIVE_CONTAINER":return{...state,activeContainer:action.payload};case"CHANGE_CATEGORY":return{...state,items:state.items.map((item=>item.id===action.payload.itemId?{...item,container:action.payload.container}:item))};case"REORDER_ITEMS":{const{dragId:dragId,targetId:targetId}=action.payload;const newItems=[...state.items];const draggedItem=newItems.find((item=>item.id===dragId));const draggedIndex=newItems.indexOf(draggedItem);const targetIndex=newItems.findIndex((item=>item.id===targetId));newItems.splice(draggedIndex,1);newItems.splice(targetIndex,0,draggedItem);return{...state,items:newItems}}default:return state}};const DragContext=createContext({});const DraggableContext=()=>useContext(DragContext);const DraggableProvider=({children:children,initialItems:initialItems,onReorder:onReorder,onDragStart:onDragStart,onDragEnter:onDragEnter,onDragEnd:onDragEnd,onDrop:onDrop,onDragOver:onDragOver,dropZone:dropZone={type:"ghost",color:"neutral",direction:"vertical"}})=>{const[state,dispatch]=useReducer(reducer,initialState);let dropZoneType="ghost";let dropZoneColor="neutral";let dropZoneDirection="vertical";if(typeof dropZone==="string"){dropZoneType=dropZone}else{dropZoneType=dropZone.type||"ghost";dropZoneColor=dropZone.type==="line"?dropZone.color||"primary":dropZone.color||"neutral";if(dropZoneType==="line"){dropZoneDirection=dropZone.direction||"vertical"}}useEffect((()=>{dispatch({type:"SET_ITEMS",payload:initialItems})}),[initialItems]);useEffect((()=>{onReorder(state.items)}),[state.items]);const handleDragStart=(id,container)=>{dispatch({type:"SET_DRAG_DATA",payload:{id:id,initialGroup:container}});dispatch({type:"SET_IS_DRAGGING",payload:id});if(onDragStart)onDragStart(id,container)};const handleDragEnter=(id,container)=>{if(state.dragData.id!==id){dispatch({type:"REORDER_ITEMS",payload:{dragId:state.dragData.id,targetId:id}});dispatch({type:"SET_DRAG_DATA",payload:{id:state.dragData.id,initialGroup:container}})}if(onDragEnter)onDragEnter(id,container)};const handleDragEnd=()=>{dispatch({type:"SET_IS_DRAGGING",payload:""});dispatch({type:"SET_ACTIVE_CONTAINER",payload:""});if(onDragEnd)onDragEnd()};const changeCategory=(itemId,container)=>{dispatch({type:"CHANGE_CATEGORY",payload:{itemId:itemId,container:container}})};const handleDrop=container=>{dispatch({type:"SET_IS_DRAGGING",payload:""});dispatch({type:"SET_ACTIVE_CONTAINER",payload:""});changeCategory(state.dragData.id,container);if(onDrop)onDrop(container)};const handleDragOver=(e,container)=>{e.preventDefault();dispatch({type:"SET_ACTIVE_CONTAINER",payload:container});if(onDragOver)onDragOver(e,container)};const contextValue=useMemo((()=>({items:state.items,dragData:state.dragData,isDragging:state.isDragging,activeContainer:state.activeContainer,dropZone:dropZoneType,dropZoneColor:dropZoneColor,...dropZoneType==="line"?{direction:dropZoneDirection}:{},handleDragStart:handleDragStart,handleDragEnter:handleDragEnter,handleDragEnd:handleDragEnd,handleDrop:handleDrop,handleDragOver:handleDragOver})),[state,dropZoneType,dropZoneColor,dropZoneDirection]);return jsx$1(DragContext.Provider,{value:contextValue,children:children})};var classnames$1={exports:{}};
2
2
  /*!
3
3
  Copyright (c) 2018 Jed Watson.
4
4
  Licensed under the MIT License (MIT), see