@appkit/dek-ui 0.34.0 → 0.35.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 (35) hide show
  1. package/dist/{stories → components/Button}/Button.stories.d.ts +1 -1
  2. package/dist/{stories → components/Card}/Card.stories.d.ts +1 -1
  3. package/dist/{stories → components/CardButton}/CardButton.stories.d.ts +1 -1
  4. package/dist/{stories → components/Carousel}/Carousel.stories.d.ts +1 -1
  5. package/dist/{stories → components/ColorPicker}/ColorPicker.stories.d.ts +1 -1
  6. package/dist/{stories → components/Dropdown}/Dropdown.stories.d.ts +1 -1
  7. package/dist/{stories → components/Header}/Header.stories.d.ts +1 -1
  8. package/dist/{stories → components/IconButton}/IconButton.stories.d.ts +1 -1
  9. package/dist/{stories → components/Image}/Image.stories.d.ts +1 -1
  10. package/dist/components/ItemList/GridItemContext.d.ts +17 -0
  11. package/dist/components/ItemList/ItemList.stories.d.ts +7 -0
  12. package/dist/components/ItemList/ItemListContext.d.ts +29 -0
  13. package/dist/components/ItemList/ItemListDropZone.d.ts +11 -0
  14. package/dist/components/ItemList/ListItem.d.ts +6 -0
  15. package/dist/components/ItemList/gesture-responder/index.d.ts +86 -0
  16. package/dist/components/ItemList/gesture-responder/mouse-enabled.d.ts +1 -0
  17. package/dist/components/ItemList/grid-types.d.ts +27 -0
  18. package/dist/components/ItemList/helpers.d.ts +39 -0
  19. package/dist/components/ItemList/index.d.ts +5 -0
  20. package/dist/components/ItemList/move.d.ts +1 -0
  21. package/dist/components/ItemList/swap.d.ts +1 -0
  22. package/dist/components/ItemList/use-measure.d.ts +13 -0
  23. package/dist/{stories → components/MenuBar}/MenuBar.stories.d.ts +1 -1
  24. package/dist/{stories → components/PillButton}/PillButton.stories.d.ts +1 -1
  25. package/dist/{stories → components/ProgressBar}/ProgressBar.stories.d.ts +1 -1
  26. package/dist/{stories → components/Slider}/Slider.stories.d.ts +1 -1
  27. package/dist/{stories → components/Stack}/Stack.stories.d.ts +1 -1
  28. package/dist/{stories → components/Text}/Text.stories.d.ts +1 -1
  29. package/dist/{stories → components/Tile}/Tile.stories.d.ts +1 -1
  30. package/dist/{stories → components/TileChart}/TileChart.stories.d.ts +1 -1
  31. package/dist/{stories → components/TitleBar}/TitleBar.stories.d.ts +1 -1
  32. package/dist/{stories → components/View}/View.stories.d.ts +1 -1
  33. package/dist/index.es.js +21696 -21609
  34. package/dist/index.umd.js +108 -103
  35. package/package.json +2 -1
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import Button from '../components/Button/Button';
2
+ import Button from './Button';
3
3
  declare const meta: Meta<typeof Button>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof Button>;
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import Card from '../components/Card/Card';
2
+ import Card from './Card';
3
3
  declare const meta: Meta<typeof Card>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof Card>;
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import CardButton from '../components/CardButton/CardButton';
2
+ import CardButton from './CardButton';
3
3
  declare const meta: Meta<typeof CardButton>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof CardButton>;
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import Carousel from '../components/Carousel/Carousel';
2
+ import Carousel from './Carousel';
3
3
  declare const meta: Meta<typeof Carousel>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof Carousel>;
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import ColorPicker from '../components/ColorPicker/ColorPicker';
2
+ import ColorPicker from './ColorPicker';
3
3
  declare const meta: Meta<typeof ColorPicker>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof ColorPicker>;
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import Dropdown from '../components/Dropdown/Dropdown';
2
+ import Dropdown from './Dropdown';
3
3
  declare const meta: Meta<typeof Dropdown>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof Dropdown>;
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import Header from '../components/Header/Header';
2
+ import Header from './Header';
3
3
  declare const meta: Meta<typeof Header>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof Header>;
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import IconButton from '../components/IconButton/IconButton';
2
+ import IconButton from './IconButton';
3
3
  declare const meta: Meta<typeof IconButton>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof IconButton>;
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import Image from '../components/Image/Image';
2
+ import Image from './Image';
3
3
  declare const meta: Meta<typeof Image>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof Image>;
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import { StateType } from './gesture-responder';
3
+ import { GridSettings } from './grid-types';
4
+ export interface GridItemContextType {
5
+ top: number;
6
+ disableDrag: boolean;
7
+ endTraverse: () => void;
8
+ mountWithTraverseTarget?: [number, number];
9
+ left: number;
10
+ i: number;
11
+ onMove: (state: StateType, x: number, y: number) => void;
12
+ onEnd: (state: StateType, x: number, y: number) => void;
13
+ onStart: () => void;
14
+ grid: GridSettings;
15
+ dragging: boolean;
16
+ }
17
+ export declare const GridItemContext: React.Context<GridItemContextType | null>;
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import ListItem from './ListItem';
3
+ declare const meta: Meta<typeof ListItem>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof ListItem>;
6
+ export declare const Default: Story;
7
+ export declare const MultipleLists: Story;
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+ import { GridSettings, TraverseType } from './grid-types';
3
+ import { Bounds } from './use-measure';
4
+ interface RegisterOptions extends Bounds {
5
+ /** The number of documents in each grid */
6
+ count: number;
7
+ /** grid info (boxes per row) */
8
+ grid: GridSettings;
9
+ /** whether the dropzone is disabled for dropping */
10
+ disableDrop: boolean;
11
+ remeasure: () => void;
12
+ }
13
+ interface GridContextType {
14
+ register: (id: string, options: RegisterOptions) => void;
15
+ remove: (id: string) => void;
16
+ measureAll: () => void;
17
+ getActiveDropId: (sourceId: string, x: number, y: number) => string | null;
18
+ startTraverse: (sourceId: string, targetId: string, x: number, y: number, sourceIndex: number) => void;
19
+ traverse: TraverseType | null;
20
+ endTraverse: () => void;
21
+ onChange: (sourceId: string, sourceIndex: number, targetIndex: number, targetId?: string) => void;
22
+ }
23
+ export declare const GridContext: React.Context<GridContextType>;
24
+ interface GridContextProviderProps {
25
+ children: React.ReactNode;
26
+ onChange: (sourceId: string, sourceIndex: number, targetIndex: number, targetId?: string) => void;
27
+ }
28
+ export declare function ItemListProvider({ children, onChange, }: GridContextProviderProps): import("react/jsx-runtime").JSX.Element;
29
+ export {};
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ export interface ItemListZoneProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ boxesPerRow: number;
4
+ rowHeight: number;
5
+ id: string;
6
+ children: React.ReactNodeArray;
7
+ disableDrag?: boolean;
8
+ disableDrop?: boolean;
9
+ style?: React.CSSProperties;
10
+ }
11
+ export declare function ItemListDropZone({ id, boxesPerRow, children, style, disableDrag, disableDrop, rowHeight, ...other }: ItemListZoneProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ interface ListItemProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ children: React.ReactNode;
4
+ }
5
+ export declare function ListItem({ children, style, className, ...other }: ListItemProps): any;
6
+ export default ListItem;
@@ -0,0 +1,86 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * The responder takes its inspiration from react-native's
4
+ * pan-responder. Learn more about react-native's
5
+ * system here:
6
+ *
7
+ * https://facebook.github.io/react-native/docs/gesture-responder-system.html
8
+ *
9
+ * Basic usage:
10
+ *
11
+ * const bind = useGestureResponder({
12
+ * onStartShouldSet: () => true,
13
+ * onGrant: () => highlight(),
14
+ * onMove: () => updatePosition(),
15
+ * onRelease: () => unhighlight(),
16
+ * onTerminate: () => unhighlight()
17
+ * })
18
+ *
19
+ * The main benefit this provides is the ability to reconcile
20
+ * multiple gestures, and give priority to one.
21
+ *
22
+ * You can use a combination of useStartShouldSet, useStartShouldSetCapture,
23
+ * onMoveShouldSetCapture, and onMoveShouldSet to dictate
24
+ * which gets priority.
25
+ *
26
+ * Typically you'd want to avoid capture since it's generally
27
+ * preferable to have child elements gain touch access.
28
+ */
29
+ export type ResponderEvent = React.TouchEvent | React.MouseEvent | Event;
30
+ export type CallbackQueryType = (state: StateType, e: ResponderEvent) => boolean;
31
+ export type CallbackType = (state: StateType, e: ResponderEvent) => void;
32
+ export interface Callbacks {
33
+ onStartShouldSetCapture?: CallbackQueryType;
34
+ onStartShouldSet?: CallbackQueryType;
35
+ onMoveShouldSetCapture?: CallbackQueryType;
36
+ onMoveShouldSet?: CallbackQueryType;
37
+ onGrant?: CallbackType;
38
+ onMove?: CallbackType;
39
+ onRelease?: CallbackType;
40
+ onTerminate?: (state: StateType, e?: ResponderEvent) => void;
41
+ onTerminationRequest?: (state: StateType, e?: ResponderEvent) => boolean;
42
+ }
43
+ export interface StateType {
44
+ time: number;
45
+ xy: [number, number];
46
+ delta: [number, number];
47
+ initial: [number, number];
48
+ previous: [number, number];
49
+ direction: [number, number];
50
+ initialDirection: [number, number];
51
+ local: [number, number];
52
+ lastLocal: [number, number];
53
+ velocity: number;
54
+ distance: number;
55
+ }
56
+ interface Config {
57
+ uid?: string;
58
+ enableMouse?: boolean;
59
+ }
60
+ export interface GrantedTouch {
61
+ id: string | number;
62
+ onTerminationRequest: (e?: ResponderEvent) => boolean;
63
+ onTerminate: (e?: ResponderEvent) => void;
64
+ }
65
+ export declare function useGestureResponder(options?: Callbacks, config?: Config): {
66
+ bind: {
67
+ onMouseDown: (e: React.MouseEvent) => void;
68
+ onMouseDownCapture: (e: React.MouseEvent) => void;
69
+ onTouchStart: (e: ResponderEvent) => void;
70
+ onTouchEnd: (e: ResponderEvent) => void;
71
+ onTouchMove: (e: ResponderEvent) => void;
72
+ onTouchStartCapture: (e: ResponderEvent) => void;
73
+ onTouchMoveCapture: (e: ResponderEvent) => void;
74
+ } | {
75
+ onMouseDown?: undefined;
76
+ onMouseDownCapture?: undefined;
77
+ onTouchStart: (e: ResponderEvent) => void;
78
+ onTouchEnd: (e: ResponderEvent) => void;
79
+ onTouchMove: (e: ResponderEvent) => void;
80
+ onTouchStartCapture: (e: ResponderEvent) => void;
81
+ onTouchMoveCapture: (e: ResponderEvent) => void;
82
+ };
83
+ terminateCurrentResponder: () => void;
84
+ getCurrentResponder: () => GrantedTouch | null;
85
+ };
86
+ export {};
@@ -0,0 +1 @@
1
+ export declare function isMouseEnabled(): boolean;
@@ -0,0 +1,27 @@
1
+ /// <reference types="react" />
2
+ export interface GridSettings {
3
+ boxesPerRow: number;
4
+ rowHeight: number;
5
+ columnWidth: number;
6
+ }
7
+ export type ChildRender = (component: any, props: any, state: {
8
+ dragging: boolean;
9
+ disabled: boolean;
10
+ i: number;
11
+ grid: GridSettings;
12
+ }) => React.ReactNode;
13
+ /**
14
+ * A traverse captures information about dragging a grid item
15
+ * from one list to another.
16
+ */
17
+ export interface TraverseType {
18
+ sourceId: string;
19
+ targetId: string;
20
+ rx: number;
21
+ ry: number;
22
+ tx: number;
23
+ ty: number;
24
+ sourceIndex: number;
25
+ targetIndex: number;
26
+ execute?: boolean;
27
+ }
@@ -0,0 +1,39 @@
1
+ import { GridSettings } from "./grid-types";
2
+ /**
3
+ * Get the active drag position given its initial
4
+ * coordinates and grid meta
5
+ * @param index
6
+ * @param grid
7
+ * @param dx
8
+ * @param dy
9
+ */
10
+ export declare function getDragPosition(index: number, grid: GridSettings, dx: number, dy: number, center?: boolean): {
11
+ xy: number[];
12
+ };
13
+ /**
14
+ * Get the relative top, left position for a particular
15
+ * index in a grid
16
+ * @param i
17
+ * @param grid
18
+ * @param traverseIndex (destination for traverse)
19
+ */
20
+ export declare function getPositionForIndex(i: number, { boxesPerRow, rowHeight, columnWidth }: GridSettings, traverseIndex?: number | false | null): {
21
+ xy: number[];
22
+ };
23
+ /**
24
+ * Given relative coordinates, determine which index
25
+ * we are currently in
26
+ * @param x
27
+ * @param y
28
+ * @param param2
29
+ */
30
+ export declare function getIndexFromCoordinates(x: number, y: number, { rowHeight, boxesPerRow, columnWidth }: GridSettings, count: number): number;
31
+ /**
32
+ * Get the target index during a drag
33
+ * @param startIndex
34
+ * @param grid
35
+ * @param count
36
+ * @param dx
37
+ * @param dy
38
+ */
39
+ export declare function getTargetIndex(startIndex: number, grid: GridSettings, count: number, dx: number, dy: number): number;
@@ -0,0 +1,5 @@
1
+ export * from './ItemListContext';
2
+ export * from './ItemListDropZone';
3
+ export * from './ListItem';
4
+ export * from './move';
5
+ export * from './swap';
@@ -0,0 +1 @@
1
+ export declare function move<T>(source: Array<T>, destination: Array<T>, droppableSource: number, droppableDestination: number): T[][];
@@ -0,0 +1 @@
1
+ export declare function swap<T>(array: Array<T>, moveIndex: number, toIndex: number): T[];
@@ -0,0 +1,13 @@
1
+ import * as React from "react";
2
+ export interface Bounds {
3
+ left: number;
4
+ height: number;
5
+ top: number;
6
+ right: number;
7
+ bottom: number;
8
+ width: number;
9
+ }
10
+ export declare function useMeasure(ref: React.RefObject<HTMLDivElement | null>): {
11
+ bounds: Bounds;
12
+ remeasure: () => void;
13
+ };
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import MenuBar from '../components/MenuBar/MenuBar';
2
+ import MenuBar from './MenuBar';
3
3
  declare const meta: Meta<typeof MenuBar>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof MenuBar>;
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import PillButton from '../components/PillButton/PillButton';
2
+ import PillButton from './PillButton';
3
3
  declare const meta: Meta<typeof PillButton>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof PillButton>;
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import ProgressBar from '../components/ProgressBar/ProgressBar';
2
+ import ProgressBar from './ProgressBar';
3
3
  declare const meta: Meta<typeof ProgressBar>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof ProgressBar>;
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import Slider from '../components/Slider/Slider';
2
+ import Slider from './Slider';
3
3
  declare const meta: Meta<typeof Slider>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof Slider>;
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import Stack from '../components/Stack/Stack';
2
+ import Stack from './Stack';
3
3
  declare const meta: Meta<typeof Stack>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof Stack>;
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import Text from '../components/Text/Text';
2
+ import Text from './Text';
3
3
  declare const meta: Meta<typeof Text>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof Text>;
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import Tile from '../components/Tile/Tile';
2
+ import Tile from './Tile';
3
3
  declare const meta: Meta<typeof Tile>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof Tile>;
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import TileChart from '../components/TileChart/TileChart';
2
+ import TileChart from './TileChart';
3
3
  declare const meta: Meta<typeof TileChart>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof TileChart>;
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import TitleBar from '../components/TitleBar/TitleBar';
2
+ import TitleBar from './TitleBar';
3
3
  declare const meta: Meta<typeof TitleBar>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof TitleBar>;
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import View from '../components/View/View';
2
+ import View from './View';
3
3
  declare const meta: Meta<typeof View>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof View>;