@limetech/lime-elements 40.12.3 → 40.13.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 (86) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/drag-to-reorder-BP5YkPuu.js +3092 -0
  3. package/dist/cjs/lime-elements.cjs.js +1 -1
  4. package/dist/cjs/{limel-scroller.cjs.entry.js → limel-drag-handle_2.cjs.entry.js} +38 -0
  5. package/dist/cjs/limel-file-viewer.cjs.entry.js +64 -55
  6. package/dist/cjs/limel-form.cjs.entry.js +539 -3171
  7. package/dist/cjs/limel-tab-bar.cjs.entry.js +120 -16
  8. package/dist/cjs/limel-tab-panel.cjs.entry.js +7 -1
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/collection/components/form/form.css +59 -0
  11. package/dist/collection/components/form/form.js +49 -2
  12. package/dist/collection/components/form/show-field.js +116 -0
  13. package/dist/collection/components/form/templates/array-field-collapsible-item.js +1 -0
  14. package/dist/collection/components/form/templates/array-field-item.js +5 -0
  15. package/dist/collection/components/form/templates/array-field.js +20 -158
  16. package/dist/collection/components/form/templates/field.js +17 -0
  17. package/dist/collection/components/tab-bar/tab-bar.css +68 -22
  18. package/dist/collection/components/tab-bar/tab-bar.js +131 -4
  19. package/dist/collection/components/tab-bar/tabs.js +23 -0
  20. package/dist/collection/components/tab-panel/tab-panel.js +54 -1
  21. package/dist/collection/util/drag-to-reorder.js +116 -0
  22. package/dist/esm/{_baseForOwn-D5j7fHlv.js → _baseForOwn-vKFWmmaS.js} +1 -1
  23. package/dist/esm/{_baseIsEqual-CyF4P8uM.js → _baseIsEqual-B_JRErB0.js} +1 -1
  24. package/dist/esm/{_baseIteratee-CpbczHY1.js → _baseIteratee-CVz7aes3.js} +1 -1
  25. package/dist/esm/{_baseSet-Cw2IE6ZF.js → _baseSet-BUAq8NGm.js} +1 -1
  26. package/dist/esm/{cloneDeep-DAbOtbs8.js → cloneDeep-Bcll-3f8.js} +1 -1
  27. package/dist/esm/drag-to-reorder-BXmXIwCa.js +3086 -0
  28. package/dist/esm/{isEqual-CE83yS8T.js → isEqual-C-pK6AAU.js} +1 -1
  29. package/dist/esm/lime-elements.js +1 -1
  30. package/dist/esm/limel-chip-set.entry.js +2 -2
  31. package/dist/esm/limel-dialog.entry.js +2 -2
  32. package/dist/esm/{limel-scroller.entry.js → limel-drag-handle_2.entry.js} +38 -1
  33. package/dist/esm/limel-file-dropzone_2.entry.js +3 -3
  34. package/dist/esm/limel-file-viewer.entry.js +64 -55
  35. package/dist/esm/limel-form.entry.js +536 -3168
  36. package/dist/esm/limel-prosemirror-adapter.entry.js +3 -3
  37. package/dist/esm/limel-tab-bar.entry.js +117 -13
  38. package/dist/esm/limel-tab-panel.entry.js +7 -1
  39. package/dist/esm/limel-table.entry.js +4 -4
  40. package/dist/esm/loader.js +1 -1
  41. package/dist/lime-elements/lime-elements.esm.js +1 -1
  42. package/dist/lime-elements/{p-35bc5ed2.entry.js → p-13f2afc9.entry.js} +1 -1
  43. package/dist/lime-elements/p-3b6d4934.entry.js +1 -0
  44. package/dist/lime-elements/p-67767276.entry.js +1 -0
  45. package/dist/lime-elements/{p-fb15f608.entry.js → p-6d65ee35.entry.js} +1 -1
  46. package/dist/lime-elements/p-714ab66d.entry.js +16 -0
  47. package/dist/lime-elements/{p-ff4a8b89.entry.js → p-7ae71c13.entry.js} +1 -1
  48. package/dist/lime-elements/p-BAqAt5It.js +1 -0
  49. package/dist/lime-elements/p-Cu9Ji1iJ.js +1 -0
  50. package/dist/lime-elements/{p-BY5NjPj8.js → p-D9Ezd43A.js} +1 -1
  51. package/dist/lime-elements/{p-nVemxylR.js → p-DFu1q54T.js} +1 -1
  52. package/dist/lime-elements/p-DdnBHYb-.js +7 -0
  53. package/dist/lime-elements/{p-B6-3WXAv.js → p-DeIIlp6m.js} +1 -1
  54. package/dist/lime-elements/p-Dq0uNStc.js +1 -0
  55. package/dist/lime-elements/p-b5bb124f.entry.js +1 -0
  56. package/dist/lime-elements/{p-9168793f.entry.js → p-bd58c761.entry.js} +1 -1
  57. package/dist/lime-elements/{p-458c131f.entry.js → p-c7e34502.entry.js} +1 -1
  58. package/dist/lime-elements/p-fb526a05.entry.js +1 -0
  59. package/dist/types/components/form/form.d.ts +15 -0
  60. package/dist/types/components/form/show-field.d.ts +9 -0
  61. package/dist/types/components/form/templates/array-context.d.ts +4 -0
  62. package/dist/types/components/form/templates/array-field-collapsible-item.d.ts +5 -0
  63. package/dist/types/components/form/templates/array-field.d.ts +3 -13
  64. package/dist/types/components/form/templates/field.d.ts +1 -0
  65. package/dist/types/components/form/templates/object-field.d.ts +2 -2
  66. package/dist/types/components/tab-bar/tab-bar.d.ts +25 -0
  67. package/dist/types/components/tab-bar/tab.types.d.ts +18 -0
  68. package/dist/types/components/tab-bar/tabs.d.ts +12 -1
  69. package/dist/types/components/tab-panel/tab-panel.d.ts +18 -1
  70. package/dist/types/components.d.ts +80 -2
  71. package/dist/types/util/drag-to-reorder.d.ts +65 -0
  72. package/package.json +4 -4
  73. package/dist/cjs/isArrayLikeObject-U2Ddbw4n.js +0 -326
  74. package/dist/cjs/limel-drag-handle.cjs.entry.js +0 -42
  75. package/dist/esm/isArrayLikeObject-CJB8HbtH.js +0 -321
  76. package/dist/esm/limel-drag-handle.entry.js +0 -40
  77. package/dist/lime-elements/p-49eb2f64.entry.js +0 -13
  78. package/dist/lime-elements/p-646731b6.entry.js +0 -1
  79. package/dist/lime-elements/p-8d567e42.entry.js +0 -1
  80. package/dist/lime-elements/p-BQeIv4aA.js +0 -1
  81. package/dist/lime-elements/p-COdirXg1.js +0 -1
  82. package/dist/lime-elements/p-ORUNaKm-.js +0 -1
  83. package/dist/lime-elements/p-a5246373.entry.js +0 -1
  84. package/dist/lime-elements/p-b609552e.entry.js +0 -1
  85. package/dist/lime-elements/p-bf849dc9.entry.js +0 -1
  86. package/dist/lime-elements/p-pk5KIdKH.js +0 -1
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Open what is closed above a field, scroll it into view, focus it and
3
+ * highlight it.
4
+ *
5
+ * @param root - the element the form is rendered in
6
+ * @param path - the path of the field in the value of the form
7
+ */
8
+ export declare function showField(root: HTMLElement, path: Array<string | number>): Promise<void>;
9
+ //# sourceMappingURL=show-field.d.ts.map
@@ -3,6 +3,10 @@ import { FormSchema } from '../form.types';
3
3
  export interface ArrayFieldOptions {
4
4
  arraySchema: FormSchema;
5
5
  formData: any[];
6
+ /**
7
+ * The path of the array in the value, such as `['heroes']`
8
+ */
9
+ schemaPath: string[];
6
10
  }
7
11
  export declare const ArrayFieldContext: import("react").Context<ArrayFieldOptions>;
8
12
  /**
@@ -39,6 +39,10 @@ export interface CollapsibleItemProps {
39
39
  * errors when this is `true`, keeping a freshly loaded form silent.
40
40
  */
41
41
  revealErrors?: boolean;
42
+ /**
43
+ * The schema path of the item, such as `/heroes/0`
44
+ */
45
+ schemaPath?: string;
42
46
  }
43
47
  export declare class CollapsibleItemTemplate extends React.Component<PropsWithChildren<CollapsibleItemProps>> {
44
48
  props: PropsWithChildren<CollapsibleItemProps>;
@@ -55,6 +59,7 @@ export declare class CollapsibleItemTemplate extends React.Component<PropsWithCh
55
59
  class: string;
56
60
  ref: (section: HTMLLimelCollapsibleSectionElement) => void;
57
61
  'is-open': boolean;
62
+ 'data-schema-path': string;
58
63
  'data-reorder-id': string;
59
64
  'data-reorderable': string;
60
65
  invalid: boolean;
@@ -7,14 +7,11 @@ interface ArrayFieldTemplateState {
7
7
  }
8
8
  export declare class ArrayFieldTemplate extends React.Component<ArrayFieldTemplateProps, ArrayFieldTemplateState> {
9
9
  private container?;
10
- private sortable?;
11
- private dragSnapshot?;
12
- private draggedItemIndex?;
13
- private dropElevationTimeout?;
14
- private dropElevationTarget?;
10
+ private readonly dragToReorder;
15
11
  private cachedContextValue;
16
12
  private cachedSchema?;
17
13
  private cachedFormData?;
14
+ private cachedPath?;
18
15
  constructor(props: ArrayFieldTemplateProps);
19
16
  componentWillUnmount(): void;
20
17
  componentDidMount(): void;
@@ -24,16 +21,9 @@ export declare class ArrayFieldTemplate extends React.Component<ArrayFieldTempla
24
21
  private readonly handleAddClick;
25
22
  private readonly setContainer;
26
23
  private getOrderedItems;
27
- private readonly handleSortStart;
28
- private readonly handleSortEnd;
24
+ private readonly handleReorder;
29
25
  private setupDragController;
30
- private teardownDragController;
31
26
  private canReorderItems;
32
- private readOrderFromDom;
33
- private getReorderId;
34
- private applyDropElevation;
35
- private scheduleDropElevationRemoval;
36
- private clearDropElevationTimer;
37
27
  private arraysEqual;
38
28
  private extractIndices;
39
29
  private getContextValue;
@@ -2,5 +2,6 @@ import React from 'react';
2
2
  export declare const FieldTemplate: (props: any) => React.DetailedReactHTMLElement<{
3
3
  className: any;
4
4
  style: React.CSSProperties;
5
+ 'data-schema-path': string;
5
6
  }, HTMLElement>;
6
7
  //# sourceMappingURL=field.d.ts.map
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import { LimeObjectFieldTemplateProps } from './types';
3
- export declare const ObjectFieldTemplate: (props: LimeObjectFieldTemplateProps) => React.FunctionComponentElement<React.ProviderProps<import("./array-context").ArrayFieldOptions>> | React.FunctionComponentElement<React.FragmentProps> | React.ReactElement<{
3
+ export declare const ObjectFieldTemplate: (props: LimeObjectFieldTemplateProps) => React.FunctionComponentElement<React.FragmentProps> | React.ReactElement<{
4
4
  header: string;
5
5
  id: string;
6
6
  'is-open': boolean;
7
7
  invalid: boolean;
8
- }, string | React.JSXElementConstructor<any>>;
8
+ }, string | React.JSXElementConstructor<any>> | React.FunctionComponentElement<React.ProviderProps<import("./array-context").ArrayFieldOptions>>;
9
9
  /**
10
10
  * Render a schema path as a leading-slash string. Root → `/`,
11
11
  * `['rules']` → `/rules`, `['rules', 'details']` → `/rules/details`.
@@ -9,6 +9,7 @@ import { Tab } from './tab.types';
9
9
  * A tab bar can contain an unlimited number of tabs. However, depending on the device width and width of the tabs, the number of tabs that are visible at the same time will vary. When there is limited horizontal space, the component shows a left-arrow and/or right-arrow button, which scrolls and reveals the additional tabs. The tab bar can also be swiped left and right on a touch-device. A vertical tab bar does the same, upwards and downwards.
10
10
  * The arrows are only a shortcut for people who use a mouse or a touch screen. Screen readers do not announce them, and the Tab key skips them. People who use a keyboard or a screen reader move between the tabs, and the tab bar keeps the selected tab in view.
11
11
  * The left and right arrow keys move to the previous and the next tab, and select it. In a vertical tab bar, the up and down arrow keys do that instead. Home and End move to the first and the last tab. Moving past the last tab continues at the first one, and the other way around. The Tab key moves on to what comes after the tab bar, and moving back with Shift and Tab lands on the selected tab, or on the first tab when none is selected.
12
+ * Set `allowTabReorder` to let the user drag the tabs into the order they want. Every tab then gets a drag handle, and the tab bar emits `reorderTab` when the user drops a tab in a new place. The tab bar does not change `tabs` itself, so the component that uses it decides the new order, and can save it for the user. A tab that the component does not move, stays where it was. The tabs can be reordered with a mouse and a touch screen, but not yet with the keyboard.
12
13
  * :::tip Other things to consider
13
14
  * Never divide the content of a tab using a nested tab bar.
14
15
  * Never place two tab bars within the same screen.
@@ -22,6 +23,8 @@ import { Tab } from './tab.types';
22
23
  * @exampleComponent limel-example-tab-bar-with-equal-tab-width
23
24
  * @exampleComponent limel-example-tab-bar-vertical
24
25
  * @exampleComponent limel-example-tab-bar-tab-width
26
+ * @exampleComponent limel-example-tab-bar-reorder
27
+ * @exampleComponent limel-example-tab-bar-reorder-vertical
25
28
  */
26
29
  export declare class TabBar {
27
30
  /**
@@ -33,24 +36,45 @@ export declare class TabBar {
33
36
  * to, or in a column, next to it.
34
37
  */
35
38
  orientation: 'horizontal' | 'vertical';
39
+ /**
40
+ * Set to `true` to let the user reorder the tabs by dragging them. Listen
41
+ * for `reorderTab` and give the tab bar the tabs in their new order.
42
+ */
43
+ allowTabReorder: boolean;
36
44
  /**
37
45
  * Emitted when a tab has been changed
38
46
  */
39
47
  private changeTab;
48
+ /**
49
+ * Emitted when the user has dragged a tab to a new place. The tab bar does
50
+ * not change `tabs` itself. The tab stays where it was until `tabs` is set
51
+ * to the tabs in their new order.
52
+ */
53
+ private reorderTab;
40
54
  private host;
41
55
  private revealedTabId?;
42
56
  private hasLoaded;
43
57
  private isLaidOutAgain;
58
+ private tabIdsAfterReorder?;
59
+ private dragToReorder?;
60
+ private renderedTabs;
61
+ private tabWithFocus?;
44
62
  constructor();
45
63
  connectedCallback(): Promise<void>;
64
+ disconnectedCallback(): void;
46
65
  componentDidLoad(): void;
66
+ componentWillRender(): void;
47
67
  componentDidRender(): Promise<void>;
48
68
  render(): any;
49
69
  protected tabsChanged(newTabs?: Tab[], oldTabs?: Tab[]): void;
50
70
  protected orientationChanged(): void;
51
71
  private getOrientation;
52
72
  private getNavigationOptions;
73
+ private restoreFocus;
53
74
  private getTabElements;
75
+ private canReorderTabs;
76
+ private setUpReordering;
77
+ private readonly handleReorder;
54
78
  /**
55
79
  * A tab that is activated by the user receives focus, and the scroller
56
80
  * reveals what receives focus. This is for a tab that becomes active
@@ -65,6 +89,7 @@ export declare class TabBar {
65
89
  private activateTab;
66
90
  private sortByInactive;
67
91
  private renderIcon;
92
+ private renderTabOrMovableTab;
68
93
  private renderTab;
69
94
  private triggerIconColorWarning;
70
95
  }
@@ -40,4 +40,22 @@ export interface Tab {
40
40
  */
41
41
  badge?: number | string;
42
42
  }
43
+ /**
44
+ * Describes a tab that the user has moved to a new place.
45
+ * @public
46
+ */
47
+ export interface TabReorderEvent {
48
+ /**
49
+ * The tab that was moved
50
+ */
51
+ tab: Tab;
52
+ /**
53
+ * The position that the tab had in `tabs` before it was moved
54
+ */
55
+ fromIndex: number;
56
+ /**
57
+ * The position that the tab gets in `tabs` after it has been moved
58
+ */
59
+ toIndex: number;
60
+ }
43
61
  //# sourceMappingURL=tab.types.d.ts.map
@@ -1,4 +1,5 @@
1
- import { Tab } from './tab.types';
1
+ import type { ReorderEvent } from '../../util/drag-to-reorder';
2
+ import { Tab, TabReorderEvent } from './tab.types';
2
3
  /**
3
4
  * Set a tabs `active` state to true in a list of tabs. The previous tab with
4
5
  * `active` set to true will have it set to `false` instead.
@@ -8,4 +9,14 @@ import { Tab } from './tab.types';
8
9
  * @returns a copy of the list of tabs with the changed tabs replaced
9
10
  */
10
11
  export declare function setActiveTab(tabs: Tab[], index: number): Tab[];
12
+ /**
13
+ * Describe a move that the user has made, in the tabs that the user made it in.
14
+ *
15
+ * @param tabs - the tabs of the tab bar now
16
+ * @param reorder - the move, as the list of tabs that the user dragged reported
17
+ * it
18
+ * @returns the move, or `undefined` when `tabs` are not the tabs that the user
19
+ * began to drag, since the move would point to another tab then
20
+ */
21
+ export declare function getTabReorder(tabs: Tab[], reorder: ReorderEvent): TabReorderEvent | undefined;
11
22
  //# sourceMappingURL=tabs.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter } from '../../stencil-public-runtime';
2
- import { Tab } from '../tab-bar/tab.types';
2
+ import { Tab, TabReorderEvent } from '../tab-bar/tab.types';
3
3
  /**
4
4
  * The `limel-tab-panel` component uses the `limel-tab-bar` component together
5
5
  * with custom slotted components and will display the content for the currently
@@ -15,10 +15,16 @@ import { Tab } from '../tab-bar/tab.types';
15
15
  * The slotted components can also emit the `changeTab` event to update anything
16
16
  * inside the actual tab, e.g. to change the icon, color or badge.
17
17
  *
18
+ * Set `allowTabReorder` to let the user reorder the tabs by dragging them. The
19
+ * panel does not change `tabs` itself. Listen for `reorderTab`, and give the
20
+ * panel the tabs in their new order. The tabs can be reordered with a mouse
21
+ * and a touch screen, but not yet with the keyboard.
22
+ *
18
23
  * @slot - Content to put inside the `limel-tab-panel`. Each slotted element
19
24
  * must have the `id` attribute equal to the id of the tab it belongs to.
20
25
  * @exampleComponent limel-example-tab-panel-basic
21
26
  * @exampleComponent limel-example-tab-panel-vertical
27
+ * @exampleComponent limel-example-tab-panel-reorder
22
28
  */
23
29
  export declare class TabPanel {
24
30
  /**
@@ -30,10 +36,21 @@ export declare class TabPanel {
30
36
  * column, to the left of it.
31
37
  */
32
38
  orientation: 'horizontal' | 'vertical';
39
+ /**
40
+ * Set to `true` to let the user reorder the tabs by dragging them. Listen
41
+ * for `reorderTab` and give the panel the tabs in their new order.
42
+ */
43
+ allowTabReorder: boolean;
33
44
  /**
34
45
  * Emitted when a tab has been changed
35
46
  */
36
47
  protected changeTab: EventEmitter<Tab>;
48
+ /**
49
+ * Emitted when the user has dragged a tab to a new place. The panel does
50
+ * not change `tabs` itself. The tab stays where it was until `tabs` is set
51
+ * to the tabs in their new order.
52
+ */
53
+ protected reorderTab: EventEmitter<TabReorderEvent>;
37
54
  private host;
38
55
  private slotElements;
39
56
  constructor();
@@ -51,7 +51,7 @@ import { EditorUiType } from "./components/text-editor/types";
51
51
  import { Option } from "./components/select/option.types";
52
52
  import { SidePanelAction, SidePanelActionSelect, SidePanelEntry } from "./components/side-panel/side-panel.types";
53
53
  import { SpinnerSize } from "./components/spinner/spinner.types";
54
- import { Tab } from "./components/tab-bar/tab.types";
54
+ import { Tab, TabReorderEvent } from "./components/tab-bar/tab.types";
55
55
  import { Column, ColumnAggregate, ColumnSorter, RowData, RowReorderEvent, TableParams } from "./components/table/table.types";
56
56
  import { Layout } from "./components/table/layout";
57
57
  import { EditorTextLink } from "./components/text-editor/prosemirror-adapter/menu/types";
@@ -101,7 +101,7 @@ export { EditorUiType } from "./components/text-editor/types";
101
101
  export { Option } from "./components/select/option.types";
102
102
  export { SidePanelAction, SidePanelActionSelect, SidePanelEntry } from "./components/side-panel/side-panel.types";
103
103
  export { SpinnerSize } from "./components/spinner/spinner.types";
104
- export { Tab } from "./components/tab-bar/tab.types";
104
+ export { Tab, TabReorderEvent } from "./components/tab-bar/tab.types";
105
105
  export { Column, ColumnAggregate, ColumnSorter, RowData, RowReorderEvent, TableParams } from "./components/table/table.types";
106
106
  export { Layout } from "./components/table/layout";
107
107
  export { EditorTextLink } from "./components/text-editor/prosemirror-adapter/menu/types";
@@ -1900,6 +1900,7 @@ export namespace Components {
1900
1900
  * @exampleComponent limel-example-form-row-layout
1901
1901
  * @exampleComponent limel-example-builtin-field-types-form
1902
1902
  * @exampleComponent limel-example-code-editor-form
1903
+ * @exampleComponent limel-example-form-highlighted-field
1903
1904
  */
1904
1905
  interface LimelForm {
1905
1906
  /**
@@ -1911,6 +1912,11 @@ export namespace Components {
1911
1912
  * Extra errors to display in the form. Typical use case is asynchronous errors generated server side.
1912
1913
  */
1913
1914
  "errors": ValidationError;
1915
+ /**
1916
+ * The path in the value of a field to take the user to, such as `['heroes', 2, 'name']`. When it changes, the form opens the sections and list items the field is in, scrolls it into view, focuses it and briefly highlights it. If the path goes further than the form can show, such as into a custom component, the closest field above the end of the path is shown. To show the same field again, set it to `undefined` first.
1917
+ * @beta
1918
+ */
1919
+ "highlightedField"?: Array<string | number>;
1914
1920
  /**
1915
1921
  * Factory for creating properties for custom form components When using custom components in the form some properties might have to be set dynamically. If this factory is set, it will be called with the current schema for the field for each custom component in the form. The factory must return an object where each key is the name of the property that should be set, along with its value.
1916
1922
  */
@@ -3965,6 +3971,7 @@ export namespace Components {
3965
3971
  * A tab bar can contain an unlimited number of tabs. However, depending on the device width and width of the tabs, the number of tabs that are visible at the same time will vary. When there is limited horizontal space, the component shows a left-arrow and/or right-arrow button, which scrolls and reveals the additional tabs. The tab bar can also be swiped left and right on a touch-device. A vertical tab bar does the same, upwards and downwards.
3966
3972
  * The arrows are only a shortcut for people who use a mouse or a touch screen. Screen readers do not announce them, and the Tab key skips them. People who use a keyboard or a screen reader move between the tabs, and the tab bar keeps the selected tab in view.
3967
3973
  * The left and right arrow keys move to the previous and the next tab, and select it. In a vertical tab bar, the up and down arrow keys do that instead. Home and End move to the first and the last tab. Moving past the last tab continues at the first one, and the other way around. The Tab key moves on to what comes after the tab bar, and moving back with Shift and Tab lands on the selected tab, or on the first tab when none is selected.
3974
+ * Set `allowTabReorder` to let the user drag the tabs into the order they want. Every tab then gets a drag handle, and the tab bar emits `reorderTab` when the user drops a tab in a new place. The tab bar does not change `tabs` itself, so the component that uses it decides the new order, and can save it for the user. A tab that the component does not move, stays where it was. The tabs can be reordered with a mouse and a touch screen, but not yet with the keyboard.
3968
3975
  * :::tip Other things to consider
3969
3976
  * Never divide the content of a tab using a nested tab bar.
3970
3977
  * Never place two tab bars within the same screen.
@@ -3977,8 +3984,15 @@ export namespace Components {
3977
3984
  * @exampleComponent limel-example-tab-bar-with-equal-tab-width
3978
3985
  * @exampleComponent limel-example-tab-bar-vertical
3979
3986
  * @exampleComponent limel-example-tab-bar-tab-width
3987
+ * @exampleComponent limel-example-tab-bar-reorder
3988
+ * @exampleComponent limel-example-tab-bar-reorder-vertical
3980
3989
  */
3981
3990
  interface LimelTabBar {
3991
+ /**
3992
+ * Set to `true` to let the user reorder the tabs by dragging them. Listen for `reorderTab` and give the tab bar the tabs in their new order.
3993
+ * @default false
3994
+ */
3995
+ "allowTabReorder": boolean;
3982
3996
  /**
3983
3997
  * Whether the tabs are laid out in a row, above the content they belong to, or in a column, next to it.
3984
3998
  * @default 'horizontal'
@@ -4002,10 +4016,20 @@ export namespace Components {
4002
4016
  * load data or render anything until the tab is active.
4003
4017
  * The slotted components can also emit the `changeTab` event to update anything
4004
4018
  * inside the actual tab, e.g. to change the icon, color or badge.
4019
+ * Set `allowTabReorder` to let the user reorder the tabs by dragging them. The
4020
+ * panel does not change `tabs` itself. Listen for `reorderTab`, and give the
4021
+ * panel the tabs in their new order. The tabs can be reordered with a mouse
4022
+ * and a touch screen, but not yet with the keyboard.
4005
4023
  * @exampleComponent limel-example-tab-panel-basic
4006
4024
  * @exampleComponent limel-example-tab-panel-vertical
4025
+ * @exampleComponent limel-example-tab-panel-reorder
4007
4026
  */
4008
4027
  interface LimelTabPanel {
4028
+ /**
4029
+ * Set to `true` to let the user reorder the tabs by dragging them. Listen for `reorderTab` and give the panel the tabs in their new order.
4030
+ * @default false
4031
+ */
4032
+ "allowTabReorder": boolean;
4009
4033
  /**
4010
4034
  * Whether the tabs are laid out in a row, above the content, or in a column, to the left of it.
4011
4035
  * @default 'horizontal'
@@ -5651,6 +5675,7 @@ declare global {
5651
5675
  * @exampleComponent limel-example-form-row-layout
5652
5676
  * @exampleComponent limel-example-builtin-field-types-form
5653
5677
  * @exampleComponent limel-example-code-editor-form
5678
+ * @exampleComponent limel-example-form-highlighted-field
5654
5679
  */
5655
5680
  interface HTMLLimelFormElement extends Components.LimelForm, HTMLStencilElement {
5656
5681
  addEventListener<K extends keyof HTMLLimelFormElementEventMap>(type: K, listener: (this: HTMLLimelFormElement, ev: LimelFormCustomEvent<HTMLLimelFormElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
@@ -6837,6 +6862,7 @@ declare global {
6837
6862
  };
6838
6863
  interface HTMLLimelTabBarElementEventMap {
6839
6864
  "changeTab": Tab;
6865
+ "reorderTab": TabReorderEvent;
6840
6866
  }
6841
6867
  /**
6842
6868
  * Tabs are great to organize information hierarchically in the interface and divide it into distinct categories. Using tabs, you can create groups of content that are related and at the same level in the hierarchy.
@@ -6848,6 +6874,7 @@ declare global {
6848
6874
  * A tab bar can contain an unlimited number of tabs. However, depending on the device width and width of the tabs, the number of tabs that are visible at the same time will vary. When there is limited horizontal space, the component shows a left-arrow and/or right-arrow button, which scrolls and reveals the additional tabs. The tab bar can also be swiped left and right on a touch-device. A vertical tab bar does the same, upwards and downwards.
6849
6875
  * The arrows are only a shortcut for people who use a mouse or a touch screen. Screen readers do not announce them, and the Tab key skips them. People who use a keyboard or a screen reader move between the tabs, and the tab bar keeps the selected tab in view.
6850
6876
  * The left and right arrow keys move to the previous and the next tab, and select it. In a vertical tab bar, the up and down arrow keys do that instead. Home and End move to the first and the last tab. Moving past the last tab continues at the first one, and the other way around. The Tab key moves on to what comes after the tab bar, and moving back with Shift and Tab lands on the selected tab, or on the first tab when none is selected.
6877
+ * Set `allowTabReorder` to let the user drag the tabs into the order they want. Every tab then gets a drag handle, and the tab bar emits `reorderTab` when the user drops a tab in a new place. The tab bar does not change `tabs` itself, so the component that uses it decides the new order, and can save it for the user. A tab that the component does not move, stays where it was. The tabs can be reordered with a mouse and a touch screen, but not yet with the keyboard.
6851
6878
  * :::tip Other things to consider
6852
6879
  * Never divide the content of a tab using a nested tab bar.
6853
6880
  * Never place two tab bars within the same screen.
@@ -6860,6 +6887,8 @@ declare global {
6860
6887
  * @exampleComponent limel-example-tab-bar-with-equal-tab-width
6861
6888
  * @exampleComponent limel-example-tab-bar-vertical
6862
6889
  * @exampleComponent limel-example-tab-bar-tab-width
6890
+ * @exampleComponent limel-example-tab-bar-reorder
6891
+ * @exampleComponent limel-example-tab-bar-reorder-vertical
6863
6892
  */
6864
6893
  interface HTMLLimelTabBarElement extends Components.LimelTabBar, HTMLStencilElement {
6865
6894
  addEventListener<K extends keyof HTMLLimelTabBarElementEventMap>(type: K, listener: (this: HTMLLimelTabBarElement, ev: LimelTabBarCustomEvent<HTMLLimelTabBarElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
@@ -6877,6 +6906,7 @@ declare global {
6877
6906
  };
6878
6907
  interface HTMLLimelTabPanelElementEventMap {
6879
6908
  "changeTab": Tab;
6909
+ "reorderTab": TabReorderEvent;
6880
6910
  }
6881
6911
  /**
6882
6912
  * The `limel-tab-panel` component uses the `limel-tab-bar` component together
@@ -6890,8 +6920,13 @@ declare global {
6890
6920
  * load data or render anything until the tab is active.
6891
6921
  * The slotted components can also emit the `changeTab` event to update anything
6892
6922
  * inside the actual tab, e.g. to change the icon, color or badge.
6923
+ * Set `allowTabReorder` to let the user reorder the tabs by dragging them. The
6924
+ * panel does not change `tabs` itself. Listen for `reorderTab`, and give the
6925
+ * panel the tabs in their new order. The tabs can be reordered with a mouse
6926
+ * and a touch screen, but not yet with the keyboard.
6893
6927
  * @exampleComponent limel-example-tab-panel-basic
6894
6928
  * @exampleComponent limel-example-tab-panel-vertical
6929
+ * @exampleComponent limel-example-tab-panel-reorder
6895
6930
  */
6896
6931
  interface HTMLLimelTabPanelElement extends Components.LimelTabPanel, HTMLStencilElement {
6897
6932
  addEventListener<K extends keyof HTMLLimelTabPanelElementEventMap>(type: K, listener: (this: HTMLLimelTabPanelElement, ev: LimelTabPanelCustomEvent<HTMLLimelTabPanelElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
@@ -9087,6 +9122,7 @@ declare namespace LocalJSX {
9087
9122
  * @exampleComponent limel-example-form-row-layout
9088
9123
  * @exampleComponent limel-example-builtin-field-types-form
9089
9124
  * @exampleComponent limel-example-code-editor-form
9125
+ * @exampleComponent limel-example-form-highlighted-field
9090
9126
  */
9091
9127
  interface LimelForm {
9092
9128
  /**
@@ -9098,6 +9134,11 @@ declare namespace LocalJSX {
9098
9134
  * Extra errors to display in the form. Typical use case is asynchronous errors generated server side.
9099
9135
  */
9100
9136
  "errors"?: ValidationError;
9137
+ /**
9138
+ * The path in the value of a field to take the user to, such as `['heroes', 2, 'name']`. When it changes, the form opens the sections and list items the field is in, scrolls it into view, focuses it and briefly highlights it. If the path goes further than the form can show, such as into a custom component, the closest field above the end of the path is shown. To show the same field again, set it to `undefined` first.
9139
+ * @beta
9140
+ */
9141
+ "highlightedField"?: Array<string | number>;
9101
9142
  /**
9102
9143
  * Emitted when a change is made within the form
9103
9144
  */
@@ -11272,6 +11313,7 @@ declare namespace LocalJSX {
11272
11313
  * A tab bar can contain an unlimited number of tabs. However, depending on the device width and width of the tabs, the number of tabs that are visible at the same time will vary. When there is limited horizontal space, the component shows a left-arrow and/or right-arrow button, which scrolls and reveals the additional tabs. The tab bar can also be swiped left and right on a touch-device. A vertical tab bar does the same, upwards and downwards.
11273
11314
  * The arrows are only a shortcut for people who use a mouse or a touch screen. Screen readers do not announce them, and the Tab key skips them. People who use a keyboard or a screen reader move between the tabs, and the tab bar keeps the selected tab in view.
11274
11315
  * The left and right arrow keys move to the previous and the next tab, and select it. In a vertical tab bar, the up and down arrow keys do that instead. Home and End move to the first and the last tab. Moving past the last tab continues at the first one, and the other way around. The Tab key moves on to what comes after the tab bar, and moving back with Shift and Tab lands on the selected tab, or on the first tab when none is selected.
11316
+ * Set `allowTabReorder` to let the user drag the tabs into the order they want. Every tab then gets a drag handle, and the tab bar emits `reorderTab` when the user drops a tab in a new place. The tab bar does not change `tabs` itself, so the component that uses it decides the new order, and can save it for the user. A tab that the component does not move, stays where it was. The tabs can be reordered with a mouse and a touch screen, but not yet with the keyboard.
11275
11317
  * :::tip Other things to consider
11276
11318
  * Never divide the content of a tab using a nested tab bar.
11277
11319
  * Never place two tab bars within the same screen.
@@ -11284,12 +11326,23 @@ declare namespace LocalJSX {
11284
11326
  * @exampleComponent limel-example-tab-bar-with-equal-tab-width
11285
11327
  * @exampleComponent limel-example-tab-bar-vertical
11286
11328
  * @exampleComponent limel-example-tab-bar-tab-width
11329
+ * @exampleComponent limel-example-tab-bar-reorder
11330
+ * @exampleComponent limel-example-tab-bar-reorder-vertical
11287
11331
  */
11288
11332
  interface LimelTabBar {
11333
+ /**
11334
+ * Set to `true` to let the user reorder the tabs by dragging them. Listen for `reorderTab` and give the tab bar the tabs in their new order.
11335
+ * @default false
11336
+ */
11337
+ "allowTabReorder"?: boolean;
11289
11338
  /**
11290
11339
  * Emitted when a tab has been changed
11291
11340
  */
11292
11341
  "onChangeTab"?: (event: LimelTabBarCustomEvent<Tab>) => void;
11342
+ /**
11343
+ * Emitted when the user has dragged a tab to a new place. The tab bar does not change `tabs` itself. The tab stays where it was until `tabs` is set to the tabs in their new order.
11344
+ */
11345
+ "onReorderTab"?: (event: LimelTabBarCustomEvent<TabReorderEvent>) => void;
11293
11346
  /**
11294
11347
  * Whether the tabs are laid out in a row, above the content they belong to, or in a column, next to it.
11295
11348
  * @default 'horizontal'
@@ -11313,14 +11366,28 @@ declare namespace LocalJSX {
11313
11366
  * load data or render anything until the tab is active.
11314
11367
  * The slotted components can also emit the `changeTab` event to update anything
11315
11368
  * inside the actual tab, e.g. to change the icon, color or badge.
11369
+ * Set `allowTabReorder` to let the user reorder the tabs by dragging them. The
11370
+ * panel does not change `tabs` itself. Listen for `reorderTab`, and give the
11371
+ * panel the tabs in their new order. The tabs can be reordered with a mouse
11372
+ * and a touch screen, but not yet with the keyboard.
11316
11373
  * @exampleComponent limel-example-tab-panel-basic
11317
11374
  * @exampleComponent limel-example-tab-panel-vertical
11375
+ * @exampleComponent limel-example-tab-panel-reorder
11318
11376
  */
11319
11377
  interface LimelTabPanel {
11378
+ /**
11379
+ * Set to `true` to let the user reorder the tabs by dragging them. Listen for `reorderTab` and give the panel the tabs in their new order.
11380
+ * @default false
11381
+ */
11382
+ "allowTabReorder"?: boolean;
11320
11383
  /**
11321
11384
  * Emitted when a tab has been changed
11322
11385
  */
11323
11386
  "onChangeTab"?: (event: LimelTabPanelCustomEvent<Tab>) => void;
11387
+ /**
11388
+ * Emitted when the user has dragged a tab to a new place. The panel does not change `tabs` itself. The tab stays where it was until `tabs` is set to the tabs in their new order.
11389
+ */
11390
+ "onReorderTab"?: (event: LimelTabPanelCustomEvent<TabReorderEvent>) => void;
11324
11391
  /**
11325
11392
  * Whether the tabs are laid out in a row, above the content, or in a column, to the left of it.
11326
11393
  * @default 'horizontal'
@@ -12325,9 +12392,11 @@ declare namespace LocalJSX {
12325
12392
  }
12326
12393
  interface LimelTabBarAttributes {
12327
12394
  "orientation": 'horizontal' | 'vertical';
12395
+ "allowTabReorder": boolean;
12328
12396
  }
12329
12397
  interface LimelTabPanelAttributes {
12330
12398
  "orientation": 'horizontal' | 'vertical';
12399
+ "allowTabReorder": boolean;
12331
12400
  }
12332
12401
  interface LimelTableAttributes {
12333
12402
  "mode": 'local' | 'remote';
@@ -13116,6 +13185,7 @@ declare module "@stencil/core" {
13116
13185
  * @exampleComponent limel-example-form-row-layout
13117
13186
  * @exampleComponent limel-example-builtin-field-types-form
13118
13187
  * @exampleComponent limel-example-code-editor-form
13188
+ * @exampleComponent limel-example-form-highlighted-field
13119
13189
  */
13120
13190
  "limel-form": LocalJSX.IntrinsicElements["limel-form"] & JSXBase.HTMLAttributes<HTMLLimelFormElement>;
13121
13191
  /**
@@ -13839,6 +13909,7 @@ declare module "@stencil/core" {
13839
13909
  * A tab bar can contain an unlimited number of tabs. However, depending on the device width and width of the tabs, the number of tabs that are visible at the same time will vary. When there is limited horizontal space, the component shows a left-arrow and/or right-arrow button, which scrolls and reveals the additional tabs. The tab bar can also be swiped left and right on a touch-device. A vertical tab bar does the same, upwards and downwards.
13840
13910
  * The arrows are only a shortcut for people who use a mouse or a touch screen. Screen readers do not announce them, and the Tab key skips them. People who use a keyboard or a screen reader move between the tabs, and the tab bar keeps the selected tab in view.
13841
13911
  * The left and right arrow keys move to the previous and the next tab, and select it. In a vertical tab bar, the up and down arrow keys do that instead. Home and End move to the first and the last tab. Moving past the last tab continues at the first one, and the other way around. The Tab key moves on to what comes after the tab bar, and moving back with Shift and Tab lands on the selected tab, or on the first tab when none is selected.
13912
+ * Set `allowTabReorder` to let the user drag the tabs into the order they want. Every tab then gets a drag handle, and the tab bar emits `reorderTab` when the user drops a tab in a new place. The tab bar does not change `tabs` itself, so the component that uses it decides the new order, and can save it for the user. A tab that the component does not move, stays where it was. The tabs can be reordered with a mouse and a touch screen, but not yet with the keyboard.
13842
13913
  * :::tip Other things to consider
13843
13914
  * Never divide the content of a tab using a nested tab bar.
13844
13915
  * Never place two tab bars within the same screen.
@@ -13851,6 +13922,8 @@ declare module "@stencil/core" {
13851
13922
  * @exampleComponent limel-example-tab-bar-with-equal-tab-width
13852
13923
  * @exampleComponent limel-example-tab-bar-vertical
13853
13924
  * @exampleComponent limel-example-tab-bar-tab-width
13925
+ * @exampleComponent limel-example-tab-bar-reorder
13926
+ * @exampleComponent limel-example-tab-bar-reorder-vertical
13854
13927
  */
13855
13928
  "limel-tab-bar": LocalJSX.IntrinsicElements["limel-tab-bar"] & JSXBase.HTMLAttributes<HTMLLimelTabBarElement>;
13856
13929
  /**
@@ -13865,8 +13938,13 @@ declare module "@stencil/core" {
13865
13938
  * load data or render anything until the tab is active.
13866
13939
  * The slotted components can also emit the `changeTab` event to update anything
13867
13940
  * inside the actual tab, e.g. to change the icon, color or badge.
13941
+ * Set `allowTabReorder` to let the user reorder the tabs by dragging them. The
13942
+ * panel does not change `tabs` itself. Listen for `reorderTab`, and give the
13943
+ * panel the tabs in their new order. The tabs can be reordered with a mouse
13944
+ * and a touch screen, but not yet with the keyboard.
13868
13945
  * @exampleComponent limel-example-tab-panel-basic
13869
13946
  * @exampleComponent limel-example-tab-panel-vertical
13947
+ * @exampleComponent limel-example-tab-panel-reorder
13870
13948
  */
13871
13949
  "limel-tab-panel": LocalJSX.IntrinsicElements["limel-tab-panel"] & JSXBase.HTMLAttributes<HTMLLimelTabPanelElement>;
13872
13950
  /**
@@ -0,0 +1,65 @@
1
+ export type ReorderDirection = 'vertical' | 'horizontal';
2
+ export interface DragToReorderOptions {
3
+ /**
4
+ * Selector for the children of the list that the user can drag.
5
+ */
6
+ draggable: string;
7
+ /**
8
+ * Put the dragged child back where it was when it is dropped, for a list
9
+ * whose owner renders the new order itself.
10
+ */
11
+ revertDrop?: boolean;
12
+ /**
13
+ * Called when a drop has changed the order of the list.
14
+ */
15
+ onReorder: (event: ReorderEvent) => void;
16
+ }
17
+ export interface ReorderEvent {
18
+ /**
19
+ * The `data-reorder-id` of every child of the list, in the new order.
20
+ */
21
+ order: string[];
22
+ /**
23
+ * Where the dragged child was before the drop.
24
+ */
25
+ fromIndex: number;
26
+ /**
27
+ * Where the dragged child is after the drop.
28
+ */
29
+ toIndex: number;
30
+ }
31
+ /**
32
+ * Lets the user reorder the children of a list with a drag handle.
33
+ *
34
+ * Every child of the list has a `data-reorder-id`, and the drag starts from
35
+ * an element with the `data-drag-handle` attribute inside a child.
36
+ */
37
+ export declare class DragToReorder {
38
+ private readonly options;
39
+ private container?;
40
+ private direction?;
41
+ private sortable?;
42
+ private orderBeforeDrag;
43
+ private nextSiblingBeforeDrag?;
44
+ private elevatedItem?;
45
+ private elevationTimeout?;
46
+ constructor(options: DragToReorderOptions);
47
+ /**
48
+ * @param container - the list
49
+ * @param direction - the way the children are laid out. Leave it out to
50
+ * let SortableJS find out. Setting up the same list again without it keeps
51
+ * the direction that the list has.
52
+ */
53
+ setup(container: HTMLElement, direction?: ReorderDirection): void;
54
+ teardown(): void;
55
+ private readonly handleStart;
56
+ private readonly handleEnd;
57
+ private putBack;
58
+ private changeDirection;
59
+ private getDraggableItems;
60
+ private readOrder;
61
+ private elevate;
62
+ private keepElevatedBriefly;
63
+ private removeElevation;
64
+ }
65
+ //# sourceMappingURL=drag-to-reorder.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-elements",
3
- "version": "40.12.3",
3
+ "version": "40.13.0",
4
4
  "description": "Lime Elements",
5
5
  "author": "Lime Technologies",
6
6
  "license": "Apache-2.0",
@@ -54,7 +54,7 @@
54
54
  "devDependencies": {
55
55
  "@commitlint/cli": "^21.2.3",
56
56
  "@commitlint/config-conventional": "^21.2.3",
57
- "@limetech/eslint-config": "^5.0.1",
57
+ "@limetech/eslint-config": "^5.0.3",
58
58
  "@microsoft/api-extractor": "^7.59.4",
59
59
  "@playwright/test": "1.64.1",
60
60
  "@popperjs/core": "^2.11.8",
@@ -76,7 +76,7 @@
76
76
  "cross-env": "^10.1.0",
77
77
  "dayjs": "^1.11.23",
78
78
  "diff": "^9.0.0",
79
- "eslint": "^10.12.0",
79
+ "eslint": "^10.13.0",
80
80
  "flatpickr": "^4.6.13",
81
81
  "glob": "^13.0.6",
82
82
  "globals": "^17.13.0",
@@ -93,7 +93,7 @@
93
93
  "morphdom": "^2.7.8",
94
94
  "number-abbreviate": "^2.0.0",
95
95
  "parse-css-color": "^0.2.1",
96
- "postal-mime": "^4.0.7",
96
+ "postal-mime": "^4.0.8",
97
97
  "prettier": "^3.9.10",
98
98
  "prosemirror-example-setup": "^1.2.3",
99
99
  "prosemirror-markdown": "^1.13.8",