@motifx-community/ui 0.1.0-beta.1 → 0.1.0-beta.2

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 (160) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +16 -10
  3. package/dist/components/calendar/Calendar.d.ts +12 -0
  4. package/dist/components/calendar/calendar-props.d.ts +5 -0
  5. package/dist/components/daterangebox/DateRangeBox.d.ts +121 -0
  6. package/dist/components/daterangebox/date-range-box-props.d.ts +35 -0
  7. package/dist/components/daterangebox/date-range-preset.d.ts +6 -0
  8. package/dist/components/daterangebox/date-range.d.ts +2 -0
  9. package/dist/components/daterangebox/index.d.ts +4 -0
  10. package/dist/components/fileuploader/FileUploader.d.ts +133 -0
  11. package/dist/components/fileuploader/file-uploader-props.d.ts +46 -0
  12. package/dist/components/fileuploader/files-added-event-args.d.ts +9 -0
  13. package/dist/components/fileuploader/index.d.ts +7 -0
  14. package/dist/components/fileuploader/upload-event-args.d.ts +10 -0
  15. package/dist/components/fileuploader/upload-item.d.ts +12 -0
  16. package/dist/components/fileuploader/upload-mode.d.ts +2 -0
  17. package/dist/components/fileuploader/upload-status.d.ts +2 -0
  18. package/dist/components/loadpanel/LoadPanel.d.ts +70 -0
  19. package/dist/components/loadpanel/index.d.ts +3 -0
  20. package/dist/components/loadpanel/load-panel-props.d.ts +29 -0
  21. package/dist/components/loadpanel/load-panel-target.d.ts +3 -0
  22. package/dist/components/popover/Popover.d.ts +98 -0
  23. package/dist/components/popover/index.d.ts +5 -0
  24. package/dist/components/popover/popover-close-reason.d.ts +2 -0
  25. package/dist/components/popover/popover-closing-event-args.d.ts +8 -0
  26. package/dist/components/popover/popover-props.d.ts +39 -0
  27. package/dist/components/popover/popover-show-on.d.ts +2 -0
  28. package/dist/components/scrollview/ScrollView.d.ts +109 -0
  29. package/dist/components/scrollview/index.d.ts +7 -0
  30. package/dist/components/scrollview/pull-down-event-args.d.ts +9 -0
  31. package/dist/components/scrollview/reach-bottom-event-args.d.ts +9 -0
  32. package/dist/components/scrollview/scroll-event-args.d.ts +7 -0
  33. package/dist/components/scrollview/scroll-view-bars.d.ts +2 -0
  34. package/dist/components/scrollview/scroll-view-direction.d.ts +2 -0
  35. package/dist/components/scrollview/scroll-view-props.d.ts +31 -0
  36. package/dist/components/sortable/Sortable.d.ts +106 -0
  37. package/dist/components/sortable/index.d.ts +5 -0
  38. package/dist/components/sortable/sortable-drag-event-args.d.ts +15 -0
  39. package/dist/components/sortable/sortable-drop-event-args.d.ts +11 -0
  40. package/dist/components/sortable/sortable-orientation.d.ts +2 -0
  41. package/dist/components/sortable/sortable-props.d.ts +34 -0
  42. package/dist/components/stepper/Stepper.d.ts +121 -0
  43. package/dist/components/stepper/Wizard.d.ts +112 -0
  44. package/dist/components/stepper/WizardStep.d.ts +44 -0
  45. package/dist/components/stepper/index.d.ts +13 -0
  46. package/dist/components/stepper/step-changed-event-args.d.ts +11 -0
  47. package/dist/components/stepper/step-changing-event-args.d.ts +18 -0
  48. package/dist/components/stepper/stepper-item.d.ts +20 -0
  49. package/dist/components/stepper/stepper-label-position.d.ts +2 -0
  50. package/dist/components/stepper/stepper-orientation.d.ts +1 -0
  51. package/dist/components/stepper/stepper-props.d.ts +32 -0
  52. package/dist/components/stepper/stepper-status.d.ts +2 -0
  53. package/dist/components/stepper/wizard-finishing-event-args.d.ts +7 -0
  54. package/dist/components/stepper/wizard-props.d.ts +48 -0
  55. package/dist/components/stepper/wizard-step-props.d.ts +32 -0
  56. package/dist/core/flow-home.d.ts +6 -0
  57. package/dist/core/fold-text.d.ts +6 -0
  58. package/dist/core/ui-locale.d.ts +0 -2
  59. package/dist/core/ui-strings.d.ts +41 -0
  60. package/dist/generated/tokens.d.ts +1146 -11
  61. package/dist/index.d.ts +8 -1
  62. package/dist/index.js +22564 -20283
  63. package/dist/index.js.map +1 -1
  64. package/dist/locales/en.json +38 -1
  65. package/dist/locales/tr.json +38 -1
  66. package/dist/styles.css +1825 -5
  67. package/dist/tokens/index.d.ts +1146 -11
  68. package/dist/tokens/index.js +1146 -11
  69. package/dist/tokens/index.js.map +1 -1
  70. package/dist/tr-B218zMtu.js +1191 -0
  71. package/dist/tr-B218zMtu.js.map +1 -0
  72. package/docs/accordion.md +1 -1
  73. package/docs/actionsheet.md +1 -1
  74. package/docs/avatar.md +1 -1
  75. package/docs/badge.md +1 -1
  76. package/docs/bottomsheet.md +3 -3
  77. package/docs/breadcrumb.md +2 -2
  78. package/docs/button.md +3 -3
  79. package/docs/buttongroup.md +1 -1
  80. package/docs/calendar.md +1 -1
  81. package/docs/card.md +1 -1
  82. package/docs/checkbox.md +3 -3
  83. package/docs/chip.md +1 -1
  84. package/docs/colorbox.md +1 -1
  85. package/docs/combobox.md +1 -1
  86. package/docs/control.md +1 -1
  87. package/docs/datagrid-api.md +3 -3
  88. package/docs/datagrid-bands.md +1 -1
  89. package/docs/datagrid-drag-select.md +1 -1
  90. package/docs/datagrid-drag.md +1 -1
  91. package/docs/datagrid-editing.md +1 -1
  92. package/docs/datagrid-filtering.md +1 -1
  93. package/docs/datagrid-forms.md +1 -1
  94. package/docs/datagrid-grouping.md +1 -1
  95. package/docs/datagrid-layout.md +1 -1
  96. package/docs/datagrid-lookups.md +1 -1
  97. package/docs/datagrid-master-detail.md +1 -1
  98. package/docs/datagrid-scrolling.md +1 -1
  99. package/docs/datagrid-selection.md +1 -1
  100. package/docs/datagrid.md +1 -1
  101. package/docs/datebox.md +3 -3
  102. package/docs/daterangebox.md +192 -0
  103. package/docs/drawer.md +1 -1
  104. package/docs/dropdown.md +3 -3
  105. package/docs/fileuploader.md +201 -0
  106. package/docs/filterbuilder.md +3 -3
  107. package/docs/formlayout.md +1 -1
  108. package/docs/home.md +1 -1
  109. package/docs/keyboard.md +1 -1
  110. package/docs/language.md +229 -0
  111. package/docs/layout.md +3 -3
  112. package/docs/listbox.md +3 -3
  113. package/docs/loadpanel.md +184 -0
  114. package/docs/lookup.md +1 -1
  115. package/docs/menus.md +1 -1
  116. package/docs/numberbox.md +3 -3
  117. package/docs/pagination.md +1 -1
  118. package/docs/popover.md +221 -0
  119. package/docs/progress.md +3 -3
  120. package/docs/radiogroup.md +1 -1
  121. package/docs/rating.md +1 -1
  122. package/docs/scheduler-agenda.md +1 -1
  123. package/docs/scheduler-big-data.md +1 -1
  124. package/docs/scheduler-editing.md +1 -1
  125. package/docs/scheduler-form.md +1 -1
  126. package/docs/scheduler-icalendar.md +1 -1
  127. package/docs/scheduler-mobile.md +1 -1
  128. package/docs/scheduler-recurrence.md +1 -1
  129. package/docs/scheduler-resources.md +1 -1
  130. package/docs/scheduler-timeline.md +1 -1
  131. package/docs/scheduler.md +1 -1
  132. package/docs/scrollview.md +185 -0
  133. package/docs/showcase.md +1 -1
  134. package/docs/skeleton.md +1 -1
  135. package/docs/slider.md +3 -3
  136. package/docs/sortable.md +213 -0
  137. package/docs/stepper.md +238 -0
  138. package/docs/switch.md +1 -1
  139. package/docs/tabdocs-dock.md +1 -1
  140. package/docs/tabdocs-drag.md +1 -1
  141. package/docs/tabdocs-menus.md +1 -1
  142. package/docs/tabdocs-mobile.md +1 -1
  143. package/docs/tabdocs-tabs.md +1 -1
  144. package/docs/tabdocs-windows.md +1 -1
  145. package/docs/tabdocs-workspace.md +1 -1
  146. package/docs/tabdocs.md +1 -1
  147. package/docs/tabs.md +3 -3
  148. package/docs/tagbox.md +3 -3
  149. package/docs/textarea.md +3 -3
  150. package/docs/textbox.md +3 -3
  151. package/docs/toast.md +3 -3
  152. package/docs/tokens.md +349 -122
  153. package/docs/toolbar.md +3 -3
  154. package/docs/tooltip.md +1 -1
  155. package/docs/treeview.md +3 -3
  156. package/docs/window.md +3 -3
  157. package/docs/wizard.md +240 -0
  158. package/llms-full.txt +2415 -240
  159. package/llms.txt +10 -1
  160. package/package.json +9 -3
@@ -0,0 +1,3 @@
1
+ export { LoadPanel } from './LoadPanel';
2
+ export type { LoadPanelProps } from './load-panel-props';
3
+ export type { LoadPanelTarget } from './load-panel-target';
@@ -0,0 +1,29 @@
1
+ import type { Bind } from '@motifx/core';
2
+ import type { ControlProps } from '../../core/control';
3
+ import type { LoadPanelTarget } from './load-panel-target';
4
+ /** Props of `LoadPanel`. Each one is also a settable property; a function is followed. */
5
+ export interface LoadPanelProps extends ControlProps {
6
+ /** What it covers: a component or an element; `null` (the default) covers the whole page. */
7
+ target?: Bind<LoadPanelTarget | undefined>;
8
+ /** The message under the indicator. The same property as `text`. Default: the kit's "Loading…". */
9
+ message?: Bind<string>;
10
+ /** Shown or not; `x-model` binds it two-way. Default `false`. */
11
+ value?: Bind<boolean>;
12
+ /** Milliseconds before it shows, so quick work does not flash it. Default `0`. */
13
+ delay?: Bind<number>;
14
+ /** Dims what it covers. Default `true`. */
15
+ shade?: Bind<boolean>;
16
+ /** The pane behind the indicator and the message. Default `true`. */
17
+ showPane?: Bind<boolean>;
18
+ /** The turning indicator. Default `true`. */
19
+ showIndicator?: Bind<boolean>;
20
+ /** A Cancel button in the pane; `onCancel` tells, and the panel hides. Default `false`. */
21
+ cancelable?: Bind<boolean>;
22
+ /** The Cancel button's text. Default: the kit's "Cancel". */
23
+ cancelText?: Bind<string>;
24
+ /** A press on the shade hides it. Default `false`. */
25
+ closeOnOutside?: Bind<boolean>;
26
+ onShown?: () => void;
27
+ onHidden?: () => void;
28
+ onCancel?: () => void;
29
+ }
@@ -0,0 +1,3 @@
1
+ import type { ComponentBase } from '@motifx/core';
2
+ /** What a load panel covers: a component, an element, or the whole page (`null`). */
3
+ export type LoadPanelTarget = ComponentBase | HTMLElement | null;
@@ -0,0 +1,98 @@
1
+ import { Component, Emitter, type Bind, type ComponentBase, type Event as MotifEvent, type IBaseProp } from "@motifx/core";
2
+ import { Control } from "../../core/control";
3
+ import type { PopupPlacement } from "../../parts/popup/popup-placement";
4
+ import { Button } from "../button/Button";
5
+ import type { TooltipTarget } from "../tooltip/tooltip-target";
6
+ import type { PopoverCloseReason } from "./popover-close-reason";
7
+ import type { PopoverClosingEventArgs } from "./popover-closing-event-args";
8
+ import type { PopoverProps } from "./popover-props";
9
+ import type { PopoverShowOn } from "./popover-show-on";
10
+ /**
11
+ * Content next to the element it belongs to: a title, a close button, anything in it. It opens on a press on its
12
+ * target (`showOn: 'click'`), when the pointer rests on the target (`'hover'`) or from code; it follows the target
13
+ * while the page scrolls, opens on the other side when there is no room, and points at the target with an arrow
14
+ * where the design language draws one. Focus goes in when it opens by a press and back to the target when it
15
+ * closes; Escape, a press outside, focus leaving and the close button close it.
16
+ *
17
+ * @example
18
+ * <Button ref={b => (this.info = b)} text="Details" />
19
+ * <Popover target={() => this.info} title="Order 42" showClose>
20
+ * <p>Shipped yesterday.</p>
21
+ * </Popover>
22
+ */
23
+ export declare class Popover extends Control<HTMLDivElement, PopoverProps> {
24
+ arrowPart: Component<HTMLSpanElement>;
25
+ header: Component<HTMLDivElement>;
26
+ titlePart: Component<HTMLDivElement>;
27
+ closeButton: Button;
28
+ body: Component<HTMLDivElement>;
29
+ contentPart: ComponentBase | null;
30
+ anchor: HTMLElement | null;
31
+ opened: boolean;
32
+ placedItself: boolean;
33
+ watched: Document | null;
34
+ frame: number;
35
+ showTimer: ReturnType<typeof setTimeout> | null;
36
+ hideTimer: ReturnType<typeof setTimeout> | null;
37
+ unlink: (() => void) | null;
38
+ telling: boolean;
39
+ openedEmitter: Emitter<void>;
40
+ closing: Emitter<PopoverClosingEventArgs>;
41
+ closed: Emitter<PopoverCloseReason>;
42
+ constructor(props?: IBaseProp<PopoverProps>);
43
+ get target(): TooltipTarget | null;
44
+ set target(value: Bind<TooltipTarget | null>);
45
+ get title(): string;
46
+ set title(value: Bind<string>);
47
+ get label(): string;
48
+ set label(value: Bind<string>);
49
+ get content(): ComponentBase | null;
50
+ set content(value: Bind<ComponentBase | null>);
51
+ get showOn(): PopoverShowOn;
52
+ set showOn(value: Bind<PopoverShowOn>);
53
+ get placement(): PopupPlacement;
54
+ set placement(value: Bind<PopupPlacement>);
55
+ get arrow(): boolean;
56
+ set arrow(value: Bind<boolean>);
57
+ get showClose(): boolean;
58
+ set showClose(value: Bind<boolean>);
59
+ get width(): string | number | null;
60
+ set width(value: Bind<string | number | null>);
61
+ get closeOnOutside(): boolean;
62
+ set closeOnOutside(value: Bind<boolean>);
63
+ get delay(): number;
64
+ set delay(value: Bind<number>);
65
+ get hideDelay(): number;
66
+ set hideDelay(value: Bind<number>);
67
+ /** Open or not. Reactive; setting it opens or closes. */
68
+ get value(): boolean;
69
+ set value(value: Bind<boolean>);
70
+ /** Whether it is open now. */
71
+ get isOpen(): boolean;
72
+ get onOpened(): MotifEvent<void>;
73
+ /** About to close (`reason`); `cancel = true` keeps it open. */
74
+ get onClosing(): MotifEvent<PopoverClosingEventArgs>;
75
+ get onClosed(): MotifEvent<PopoverCloseReason>;
76
+ /** Opens it next to its target; `false` without a target on the page, or when disabled. Focus goes in. */
77
+ open(): boolean;
78
+ /** Closes it; `onClosing` may keep it open. Focus inside goes back to the target. */
79
+ close(reason?: PopoverCloseReason): boolean;
80
+ toggle(): void;
81
+ /** Lines it up with its target again, e.g. after its content changed size. */
82
+ place(): void;
83
+ tell(open: boolean): void;
84
+ drawHeader(): void;
85
+ drawContent(): void;
86
+ attach(anchor: HTMLElement | null, again?: boolean): void;
87
+ pointerIn(): void;
88
+ pointerOut(): void;
89
+ clearTimers(): void;
90
+ listen(doc: Document): void;
91
+ stopListening(): void;
92
+ schedule: () => void;
93
+ onScroll: (e: Event) => void;
94
+ onPointerDown: (e: PointerEvent) => void;
95
+ keyDown(e: KeyboardEvent): void;
96
+ focusOut(e: FocusEvent): void;
97
+ protected applyProperty(name: string, value: unknown): void;
98
+ }
@@ -0,0 +1,5 @@
1
+ export { Popover } from './Popover';
2
+ export type { PopoverProps } from './popover-props';
3
+ export type { PopoverShowOn } from './popover-show-on';
4
+ export type { PopoverCloseReason } from './popover-close-reason';
5
+ export type { PopoverClosingEventArgs } from './popover-closing-event-args';
@@ -0,0 +1,2 @@
1
+ /** Why a popover closed. */
2
+ export type PopoverCloseReason = 'escape' | 'outside' | 'focus' | 'toggle' | 'hover' | 'close-button' | 'code';
@@ -0,0 +1,8 @@
1
+ import type { EventArgs } from '@motifx/core';
2
+ import type { Popover } from './Popover';
3
+ import type { PopoverCloseReason } from './popover-close-reason';
4
+ /** The popover is about to close. `cancel = true` keeps it open. */
5
+ export interface PopoverClosingEventArgs extends EventArgs {
6
+ reason: PopoverCloseReason;
7
+ source: Popover;
8
+ }
@@ -0,0 +1,39 @@
1
+ import type { Bind, ComponentBase } from '@motifx/core';
2
+ import type { ControlProps } from '../../core/control';
3
+ import type { PopupPlacement } from '../../parts/popup/popup-placement';
4
+ import type { TooltipTarget } from '../tooltip/tooltip-target';
5
+ import type { PopoverClosingEventArgs } from './popover-closing-event-args';
6
+ import type { PopoverShowOn } from './popover-show-on';
7
+ /** Props of `Popover`. Each one is also a settable property; a function is followed. */
8
+ export interface PopoverProps extends ControlProps {
9
+ /** The element or component it opens next to. */
10
+ target?: Bind<TooltipTarget | null | undefined>;
11
+ /** A title in the header. The same property as `text`. */
12
+ title?: Bind<string>;
13
+ /** What screen readers call it when it has no title. */
14
+ label?: Bind<string>;
15
+ /** Content from code, after the JSX children. */
16
+ content?: Bind<ComponentBase | null | undefined>;
17
+ /** Default `'click'`. */
18
+ showOn?: Bind<PopoverShowOn>;
19
+ /** Default `'bottom'`. It opens on the other side when there is no room. */
20
+ placement?: Bind<PopupPlacement>;
21
+ /** An arrow towards the target, where the design language draws one. Default `true`. */
22
+ arrow?: Bind<boolean>;
23
+ /** A close button in the header. Default `false`. */
24
+ showClose?: Bind<boolean>;
25
+ /** A width of its own (a CSS length, or pixels); without one it takes its content's. */
26
+ width?: Bind<string | number | null>;
27
+ /** Closes on a press outside it and its target. Default `true`. */
28
+ closeOnOutside?: Bind<boolean>;
29
+ /** Milliseconds the pointer rests on the target before it opens (`showOn: 'hover'`). Default 300. */
30
+ delay?: Bind<number>;
31
+ /** Milliseconds it stays after the pointer leaves both, so the pointer can move onto it. Default 200. */
32
+ hideDelay?: Bind<number>;
33
+ /** Open or not; `x-model` binds it two-way. */
34
+ value?: Bind<boolean>;
35
+ onOpened?: () => void;
36
+ /** About to close; cancelable. */
37
+ onClosing?: (e: PopoverClosingEventArgs) => void;
38
+ onClosed?: (reason: unknown) => void;
39
+ }
@@ -0,0 +1,2 @@
1
+ /** What opens a popover: a press on its target, the pointer resting on it (and keyboard focus), or only code. */
2
+ export type PopoverShowOn = 'click' | 'hover' | 'manual';
@@ -0,0 +1,109 @@
1
+ import { Component, Emitter, type Bind, type Event as MotifEvent, type IBaseProp } from "@motifx/core";
2
+ import { Control } from "../../core/control";
3
+ import { ResizeWatch } from "../../core/resize-watch";
4
+ import { Spinner } from "../progress/Spinner";
5
+ import type { PullDownEventArgs } from "./pull-down-event-args";
6
+ import type { ReachBottomEventArgs } from "./reach-bottom-event-args";
7
+ import type { ScrollEventArgs } from "./scroll-event-args";
8
+ import type { ScrollViewBars } from "./scroll-view-bars";
9
+ import type { ScrollViewDirection } from "./scroll-view-direction";
10
+ import type { ScrollViewProps } from "./scroll-view-props";
11
+ interface Pull {
12
+ pointerId: number;
13
+ startY: number;
14
+ distance: number;
15
+ taken: boolean;
16
+ }
17
+ /**
18
+ * Content that scrolls in a box of its own, with the scrollbars shown as told (`showScrollbar`), a pull from the top
19
+ * that asks for what is new (`pullToRefresh`, `onPullDown`) and a reach near the end that asks for more
20
+ * (`loadOnReachBottom`, `onReachBottom`). `scrollTo`, `scrollBy` and `scrollToElement` move it from code.
21
+ *
22
+ * @example
23
+ * <ScrollView style="block-size: 20rem" pullToRefresh onPullDown={e => (e.promise = this.reload())} loadOnReachBottom onReachBottom={e => (e.promise = this.loadMore())}>
24
+ * {this.rows.map(row => <Row key={row.id} row={row} />)}
25
+ * </ScrollView>
26
+ */
27
+ export declare class ScrollView extends Control<HTMLDivElement, ScrollViewProps> {
28
+ content: Component<HTMLDivElement>;
29
+ pullPanel: Component<HTMLDivElement>;
30
+ pullSpinner: Spinner;
31
+ pullText: Component<HTMLSpanElement>;
32
+ bottomPanel: Component<HTMLDivElement>;
33
+ bottomSpinner: Spinner;
34
+ bottomText: Component<HTMLSpanElement>;
35
+ pull: Pull | null;
36
+ refreshing: boolean;
37
+ loading: boolean;
38
+ ended: boolean;
39
+ scrollTimer: ReturnType<typeof setTimeout> | null;
40
+ sizes: ResizeWatch;
41
+ refreshCount: number;
42
+ pulled: Emitter<PullDownEventArgs>;
43
+ reached: Emitter<ReachBottomEventArgs>;
44
+ scrolled: Emitter<ScrollEventArgs>;
45
+ stops: (() => void)[];
46
+ constructor(props?: IBaseProp<ScrollViewProps>);
47
+ get direction(): ScrollViewDirection;
48
+ set direction(value: Bind<ScrollViewDirection>);
49
+ get showScrollbar(): ScrollViewBars;
50
+ set showScrollbar(value: Bind<ScrollViewBars>);
51
+ get pullToRefresh(): boolean;
52
+ set pullToRefresh(value: Bind<boolean>);
53
+ get loadOnReachBottom(): boolean;
54
+ set loadOnReachBottom(value: Bind<boolean>);
55
+ get reachBottomOffset(): number;
56
+ set reachBottomOffset(value: Bind<number>);
57
+ get pullDownText(): string;
58
+ set pullDownText(value: Bind<string>);
59
+ get releaseText(): string;
60
+ set releaseText(value: Bind<string>);
61
+ get refreshingText(): string;
62
+ set refreshingText(value: Bind<string>);
63
+ get reachBottomText(): string;
64
+ set reachBottomText(value: Bind<string>);
65
+ get label(): string;
66
+ set label(value: Bind<string>);
67
+ get onPullDown(): MotifEvent<PullDownEventArgs>;
68
+ get onReachBottom(): MotifEvent<ReachBottomEventArgs>;
69
+ get onScrolled(): MotifEvent<ScrollEventArgs>;
70
+ /** Where the content stands. */
71
+ get scrollTop(): number;
72
+ get scrollLeft(): number;
73
+ /** A refresh (a pull) is going on. */
74
+ get isRefreshing(): boolean;
75
+ /** More is being loaded (a reach near the end). */
76
+ get isLoading(): boolean;
77
+ /** Scrolls to a position: `{ top, left }`, or a top. */
78
+ scrollTo(where: number | {
79
+ top?: number;
80
+ left?: number;
81
+ }, smooth?: boolean): void;
82
+ scrollBy(by: {
83
+ top?: number;
84
+ left?: number;
85
+ }, smooth?: boolean): void;
86
+ /** Brings an element of the content into view. */
87
+ scrollToElement(target: Element | {
88
+ element: Element;
89
+ }, smooth?: boolean): void;
90
+ /** Starts a refresh as a pull would: the panel shows, `onPullDown` is asked. */
91
+ refresh(): void;
92
+ /** Ends a refresh: the panel goes back. */
93
+ release(): void;
94
+ /** Asks for more now, as a reach near the end would. */
95
+ loadMore(): boolean;
96
+ /** Looks at the position again (the content changed): near the end, more is asked for. */
97
+ update(): void;
98
+ pullHeight(): number;
99
+ drawTexts(): void;
100
+ handleScroll(): void;
101
+ onMounted(): void;
102
+ check(): void;
103
+ pointerDown(e: PointerEvent): void;
104
+ pointerMove(e: PointerEvent): void;
105
+ pointerUp(e: PointerEvent): void;
106
+ stopPull(): void;
107
+ touchMove(e: TouchEvent): void;
108
+ }
109
+ export {};
@@ -0,0 +1,7 @@
1
+ export { ScrollView } from './ScrollView';
2
+ export type { ScrollViewProps } from './scroll-view-props';
3
+ export type { ScrollViewDirection } from './scroll-view-direction';
4
+ export type { ScrollViewBars } from './scroll-view-bars';
5
+ export type { PullDownEventArgs } from './pull-down-event-args';
6
+ export type { ReachBottomEventArgs } from './reach-bottom-event-args';
7
+ export type { ScrollEventArgs } from './scroll-event-args';
@@ -0,0 +1,9 @@
1
+ import type { ScrollView } from './ScrollView';
2
+ /** The content was pulled down and let go: load what is new, then `release()` (or set `promise`) and the indicator goes. */
3
+ export interface PullDownEventArgs {
4
+ /** Ends the refresh. */
5
+ release: () => void;
6
+ /** Set it to wait: the refresh ends when it settles. */
7
+ promise?: Promise<unknown>;
8
+ source: ScrollView;
9
+ }
@@ -0,0 +1,9 @@
1
+ import type { ScrollView } from './ScrollView';
2
+ /** The content was scrolled near its end: load more, then `release()` (or set `promise`) and the indicator goes. */
3
+ export interface ReachBottomEventArgs {
4
+ /** Ends the loading; `done = true` says there is no more and the view stops asking. */
5
+ release: (done?: boolean) => void;
6
+ /** Set it to wait: the loading ends when it settles. */
7
+ promise?: Promise<unknown>;
8
+ source: ScrollView;
9
+ }
@@ -0,0 +1,7 @@
1
+ import type { ScrollView } from './ScrollView';
2
+ /** The content moved: where it stands now. */
3
+ export interface ScrollEventArgs {
4
+ top: number;
5
+ left: number;
6
+ source: ScrollView;
7
+ }
@@ -0,0 +1,2 @@
1
+ /** When the scrollbars show: while scrolling, while the pointer is over the view, always, or never. */
2
+ export type ScrollViewBars = 'onScroll' | 'onHover' | 'always' | 'never';
@@ -0,0 +1,2 @@
1
+ /** Which way the content scrolls. */
2
+ export type ScrollViewDirection = 'vertical' | 'horizontal' | 'both';
@@ -0,0 +1,31 @@
1
+ import type { Bind } from '@motifx/core';
2
+ import type { ControlProps } from '../../core/control';
3
+ import type { PullDownEventArgs } from './pull-down-event-args';
4
+ import type { ReachBottomEventArgs } from './reach-bottom-event-args';
5
+ import type { ScrollEventArgs } from './scroll-event-args';
6
+ import type { ScrollViewBars } from './scroll-view-bars';
7
+ import type { ScrollViewDirection } from './scroll-view-direction';
8
+ /** Props of `ScrollView`. Each one is also a settable property; a function is followed. */
9
+ export interface ScrollViewProps extends ControlProps {
10
+ /** Default `'vertical'`. */
11
+ direction?: Bind<ScrollViewDirection>;
12
+ /** When the scrollbars show. Default `'onScroll'`. */
13
+ showScrollbar?: Bind<ScrollViewBars>;
14
+ /** Pulling the content down from the top asks `onPullDown` for what is new. Default `false`. */
15
+ pullToRefresh?: Bind<boolean>;
16
+ /** Scrolling near the end asks `onReachBottom` for more. Default `false`. */
17
+ loadOnReachBottom?: Bind<boolean>;
18
+ /** Pixels from the end at which `onReachBottom` is asked. Default `100`. */
19
+ reachBottomOffset?: Bind<number>;
20
+ /** The texts of the pull-down panel; the kit's when not given. */
21
+ pullDownText?: Bind<string>;
22
+ releaseText?: Bind<string>;
23
+ refreshingText?: Bind<string>;
24
+ /** The text under the content while more is loading; the kit's "Loading…" when not given. */
25
+ reachBottomText?: Bind<string>;
26
+ /** What screen readers call the scrolling region. */
27
+ label?: Bind<string>;
28
+ onPullDown?: (e: PullDownEventArgs) => void;
29
+ onReachBottom?: (e: ReachBottomEventArgs) => void;
30
+ onScrolled?: (e: ScrollEventArgs) => void;
31
+ }
@@ -0,0 +1,106 @@
1
+ import { Component, Emitter, type Bind, type ComponentBase, type Event as MotifEvent, type IBaseProp } from "@motifx/core";
2
+ import { Control } from "../../core/control";
3
+ import { DragGhost } from "../../parts/drag/DragGhost";
4
+ import type { SortableDragEventArgs } from "./sortable-drag-event-args";
5
+ import type { SortableDropEventArgs } from "./sortable-drop-event-args";
6
+ import type { SortableOrientation } from "./sortable-orientation";
7
+ import type { SortableProps } from "./sortable-props";
8
+ interface Session {
9
+ pointerId: number;
10
+ touch: boolean;
11
+ startX: number;
12
+ startY: number;
13
+ x: number;
14
+ y: number;
15
+ item: unknown;
16
+ element: HTMLElement;
17
+ fromIndex: number;
18
+ started: boolean;
19
+ to: Sortable<unknown> | null;
20
+ toIndex: number;
21
+ refused: boolean;
22
+ timer: ReturnType<typeof setTimeout> | null;
23
+ frame: number;
24
+ }
25
+ /**
26
+ * Items the user puts in order by dragging them, with the pointer or a finger (a long press), or with the keys
27
+ * (Ctrl + an arrow moves the focused item a place); sortables of one `group` take each other's items. The items
28
+ * are the JSX children, or `items` drawn with `itemTemplate`. A drop moves the item's element and tells
29
+ * `onReorder` (`onRemove` and `onAdd` across sortables) with the indexes: your data is yours to reorder.
30
+ *
31
+ * @example
32
+ * <Sortable label="Steps" onReorder={e => this.steps.splice(e.toIndex, 0, ...this.steps.splice(e.fromIndex, 1))}>
33
+ * {this.steps.map(step => <StepRow key={step.id} step={step} />)}
34
+ * </Sortable>
35
+ * <Sortable items={() => this.todo} itemTemplate={item => new TodoRow({ item })} group="tasks" onAdd={…} onRemove={…} />
36
+ */
37
+ export declare class Sortable<T = unknown> extends Control<HTMLDivElement, SortableProps<T>> {
38
+ dragStarting: Emitter<SortableDragEventArgs<T>>;
39
+ dragChanging: Emitter<SortableDragEventArgs<T>>;
40
+ dragEnding: Emitter<SortableDragEventArgs<T>>;
41
+ reordered: Emitter<SortableDropEventArgs<T>>;
42
+ added: Emitter<SortableDropEventArgs<T>>;
43
+ removed: Emitter<SortableDropEventArgs<T>>;
44
+ rows: Map<unknown, ComponentBase<any, any>>;
45
+ stopItems: (() => void) | null;
46
+ session: Session | null;
47
+ stops: (() => void)[];
48
+ line: Component<HTMLSpanElement>;
49
+ live: Component<HTMLSpanElement>;
50
+ ghost: DragGhost;
51
+ focusedAt: number;
52
+ constructor(props?: IBaseProp<SortableProps<T>>);
53
+ get items(): readonly T[];
54
+ set items(value: Bind<readonly T[]>);
55
+ get itemTemplate(): ((item: T, index: number) => ComponentBase) | undefined;
56
+ set itemTemplate(value: ((item: T, index: number) => ComponentBase) | undefined);
57
+ get handle(): string | null;
58
+ set handle(value: Bind<string | null>);
59
+ get group(): string | null;
60
+ set group(value: Bind<string | null>);
61
+ get allowReordering(): boolean;
62
+ set allowReordering(value: Bind<boolean>);
63
+ get orientation(): SortableOrientation;
64
+ set orientation(value: Bind<SortableOrientation>);
65
+ get label(): string;
66
+ set label(value: Bind<string>);
67
+ get onDragStarting(): MotifEvent<SortableDragEventArgs<T>>;
68
+ get onDragChanging(): MotifEvent<SortableDragEventArgs<T>>;
69
+ get onDragEnding(): MotifEvent<SortableDragEventArgs<T>>;
70
+ get onReorder(): MotifEvent<SortableDropEventArgs<T>>;
71
+ get onAdd(): MotifEvent<SortableDropEventArgs<T>>;
72
+ get onRemove(): MotifEvent<SortableDropEventArgs<T>>;
73
+ /** The items' elements, in order. */
74
+ get elements(): readonly HTMLElement[];
75
+ /** Whether an item is being dragged. */
76
+ get isDragging(): boolean;
77
+ /** Moves the item at `fromIndex` to `toIndex` as a drop would, and tells `onReorder`; `false` when nothing moved. */
78
+ move(fromIndex: number, toIndex: number, event?: Event): boolean;
79
+ onBuilt(): void;
80
+ /** Reads the items again after they were changed in place. */
81
+ refresh(): void;
82
+ itemElements(): HTMLElement[];
83
+ itemOf(el: HTMLElement): T;
84
+ renderItems(): void;
85
+ drawRows(items: T[]): void;
86
+ plainRow(item: T): ComponentBase;
87
+ drawItems(): void;
88
+ focusableOf(el: HTMLElement): HTMLElement | null;
89
+ drawStops(): void;
90
+ place(el: HTMLElement, toIndex: number): void;
91
+ announce(toIndex: number): void;
92
+ keyDown(e: KeyboardEvent): void;
93
+ pointerDown(e: PointerEvent): void;
94
+ pointerMove(e: PointerEvent): void;
95
+ pointerUp(e: PointerEvent): void;
96
+ args(s: Session, event?: Event): SortableDragEventArgs<T>;
97
+ start(e: PointerEvent): boolean;
98
+ track(e: PointerEvent): void;
99
+ takes(from: Sortable<unknown>): boolean;
100
+ indexAt(x: number, y: number, dragged: HTMLElement): number;
101
+ showLine(index: number, dragged: HTMLElement): void;
102
+ autoScroll(): void;
103
+ end(e: Event | null, drop: boolean): void;
104
+ drop(s: Session, to: Sortable<unknown>, event?: Event): void;
105
+ }
106
+ export {};
@@ -0,0 +1,5 @@
1
+ export { Sortable } from './Sortable';
2
+ export type { SortableProps } from './sortable-props';
3
+ export type { SortableOrientation } from './sortable-orientation';
4
+ export type { SortableDragEventArgs } from './sortable-drag-event-args';
5
+ export type { SortableDropEventArgs } from './sortable-drop-event-args';
@@ -0,0 +1,15 @@
1
+ import type { EventArgs } from '@motifx/core';
2
+ import type { Sortable } from './Sortable';
3
+ /** A drag in a sortable: the item, where it comes from and where it would go. `cancel = true` refuses. */
4
+ export interface SortableDragEventArgs<T = unknown> extends EventArgs {
5
+ /** The item as given, or the component when the children are the items. */
6
+ item: T;
7
+ fromIndex: number;
8
+ /** Where it would land in `to`; -1 while nowhere. */
9
+ toIndex: number;
10
+ from: Sortable<T>;
11
+ /** The sortable under the pointer; `null` while nowhere. */
12
+ to: Sortable<T> | null;
13
+ source: Sortable<T>;
14
+ event?: Event;
15
+ }
@@ -0,0 +1,11 @@
1
+ import type { Sortable } from './Sortable';
2
+ /** An item was dropped: moved within a sortable (`onReorder`), taken out of one (`onRemove`) or into another (`onAdd`). */
3
+ export interface SortableDropEventArgs<T = unknown> {
4
+ item: T;
5
+ fromIndex: number;
6
+ toIndex: number;
7
+ from: Sortable<T>;
8
+ to: Sortable<T>;
9
+ source: Sortable<T>;
10
+ event?: Event;
11
+ }
@@ -0,0 +1,2 @@
1
+ /** How the items lie: one under the other, or side by side (the drop line and the move keys follow). */
2
+ export type SortableOrientation = 'vertical' | 'horizontal';
@@ -0,0 +1,34 @@
1
+ import type { Bind, ComponentBase } from '@motifx/core';
2
+ import type { ControlProps } from '../../core/control';
3
+ import type { SortableDragEventArgs } from './sortable-drag-event-args';
4
+ import type { SortableDropEventArgs } from './sortable-drop-event-args';
5
+ import type { SortableOrientation } from './sortable-orientation';
6
+ /** Props of `Sortable`. Each one is also a settable property; a function is followed. */
7
+ export interface SortableProps<T = unknown> extends ControlProps {
8
+ /** The items, drawn with `itemTemplate`; without them the JSX children are the items. */
9
+ items?: Bind<readonly T[]>;
10
+ /** Makes the component of an item. A function, so it is not bound like the other props. Default: the item's text. */
11
+ itemTemplate?: (item: T, index: number) => ComponentBase;
12
+ /** A selector inside an item that takes the drag (and the keys); without one the whole item does. */
13
+ handle?: Bind<string | null>;
14
+ /** Sortables of one group take each other's items. */
15
+ group?: Bind<string | null>;
16
+ /** The items can be moved. Default `true`. */
17
+ allowReordering?: Bind<boolean>;
18
+ /** Default `'vertical'`. */
19
+ orientation?: Bind<SortableOrientation>;
20
+ /** What screen readers call the list. */
21
+ label?: Bind<string>;
22
+ /** A drag is about to start; cancelable. */
23
+ onDragStarting?: (e: SortableDragEventArgs<T>) => void;
24
+ /** The place it would land changed; cancelable (the place is refused). */
25
+ onDragChanging?: (e: SortableDragEventArgs<T>) => void;
26
+ /** The drag is about to end; cancelable. */
27
+ onDragEnding?: (e: SortableDragEventArgs<T>) => void;
28
+ /** An item moved within this sortable (by a drop or the keys). */
29
+ onReorder?: (e: SortableDropEventArgs<T>) => void;
30
+ /** An item came in from another sortable of the group. */
31
+ onAdd?: (e: SortableDropEventArgs<T>) => void;
32
+ /** An item went to another sortable of the group. */
33
+ onRemove?: (e: SortableDropEventArgs<T>) => void;
34
+ }