panelui-web 0.0.0-stage → 0.1.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.
- package/README.md +43 -2
- package/dist/components/bar-picker/index.d.ts +61 -0
- package/dist/components/bar-picker/index.js +139 -0
- package/dist/components/command-dock/index.d.ts +118 -0
- package/dist/components/command-dock/index.js +239 -0
- package/dist/components/day-grid/index.d.ts +87 -0
- package/dist/components/day-grid/index.js +251 -0
- package/dist/components/feedback/index.d.ts +135 -0
- package/dist/components/feedback/index.js +283 -0
- package/dist/components/flow/flow-paths.d.ts +94 -0
- package/dist/components/flow/flow-paths.js +270 -0
- package/dist/components/flow/index.d.ts +235 -0
- package/dist/components/flow/index.js +597 -0
- package/dist/components/kpi/index.d.ts +211 -0
- package/dist/components/kpi/index.js +243 -0
- package/dist/components/lane-board/index.d.ts +125 -0
- package/dist/components/lane-board/index.js +691 -0
- package/dist/components/planet/index.d.ts +132 -0
- package/dist/components/planet/index.js +653 -0
- package/dist/components/planet/land.d.ts +8 -0
- package/dist/components/planet/land.js +122 -0
- package/dist/components/range-meter/index.d.ts +70 -0
- package/dist/components/range-meter/index.js +170 -0
- package/dist/components/rolling-number/index.d.ts +46 -0
- package/dist/components/rolling-number/index.js +81 -0
- package/dist/components/tilt-card/index.d.ts +60 -0
- package/dist/components/tilt-card/index.js +114 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/lib/cn.js +6 -0
- package/package.json +72 -4
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Planet — the world as dots on a globe you can turn, with things pinned to it.
|
|
3
|
+
*
|
|
4
|
+
* ```tsx
|
|
5
|
+
* <Planet defaultRotation={[78, 18]}>
|
|
6
|
+
* <Planet.Globe>
|
|
7
|
+
* <Planet.Marker lat={24.7} lng={46.7} label="Saudi Arabia" count={2} />
|
|
8
|
+
* <Planet.Marker lat={-33.9} lng={151.2} label="Australia" />
|
|
9
|
+
* </Planet.Globe>
|
|
10
|
+
* <Planet.Controls />
|
|
11
|
+
* </Planet>
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* ## Two layers
|
|
15
|
+
*
|
|
16
|
+
* The globe is a canvas and the markers are ordinary elements laid over it.
|
|
17
|
+
* The land is several thousand dots, which is a job for a canvas; a marker is
|
|
18
|
+
* a label, an avatar, maybe a link, which is a job for the DOM. Each frame the
|
|
19
|
+
* canvas is redrawn and every marker is moved to where its coordinate now is,
|
|
20
|
+
* by a transform written straight to the element. Turning the globe never
|
|
21
|
+
* re-renders React.
|
|
22
|
+
*
|
|
23
|
+
* ## Nothing is drawn that is not asked for
|
|
24
|
+
*
|
|
25
|
+
* There is no loop running while the globe is still. A drag, a press on a
|
|
26
|
+
* control, a resize or a change of theme asks for one frame, and a frame asks
|
|
27
|
+
* for another only while something is still moving.
|
|
28
|
+
*
|
|
29
|
+
* ## The land is a question, not a shape
|
|
30
|
+
*
|
|
31
|
+
* `land.ts` says, per square degree, whether it is land. A grid of points is
|
|
32
|
+
* laid over the sphere at an even spacing and the ones on land are kept, so
|
|
33
|
+
* the coastlines come out as the edge of a dot pattern. The spacing is in
|
|
34
|
+
* pixels, so a small globe and a large one are dotted equally finely and a
|
|
35
|
+
* small one is not a smear.
|
|
36
|
+
*
|
|
37
|
+
* ## It takes the text colour
|
|
38
|
+
*
|
|
39
|
+
* The dots and the shading are drawn in `currentColor`, read from the element
|
|
40
|
+
* each frame. On a dark surface the land is light and on a light one it is
|
|
41
|
+
* dark, with no colour passed in and nothing to keep in step with the theme.
|
|
42
|
+
*/
|
|
43
|
+
import { type ComponentProps, type MouseEvent, type ReactNode } from 'react';
|
|
44
|
+
/** `[longitude, latitude]` of the point facing the viewer, in degrees. */
|
|
45
|
+
export type PlanetRotation = [longitude: number, latitude: number];
|
|
46
|
+
export interface PlanetHandle {
|
|
47
|
+
/** Turn by this many degrees of longitude, and optionally latitude. */
|
|
48
|
+
rotateBy(longitude: number, latitude?: number): void;
|
|
49
|
+
/** Turn until this coordinate faces the viewer. */
|
|
50
|
+
rotateTo(rotation: PlanetRotation): void;
|
|
51
|
+
/** The coordinate facing the viewer right now. */
|
|
52
|
+
getRotation(): PlanetRotation;
|
|
53
|
+
}
|
|
54
|
+
export interface PlanetProps extends Omit<ComponentProps<'div'>, 'children'> {
|
|
55
|
+
children?: ReactNode;
|
|
56
|
+
/**
|
|
57
|
+
* The coordinate facing the viewer to begin with, as `[longitude, latitude]`
|
|
58
|
+
* in degrees. Read once: turning the globe afterwards does not change it.
|
|
59
|
+
*/
|
|
60
|
+
defaultRotation?: PlanetRotation;
|
|
61
|
+
/**
|
|
62
|
+
* Turn on its own, at this many degrees of longitude a second. `true` is 6.
|
|
63
|
+
* It stops while the pointer is over the globe, while it is being dragged,
|
|
64
|
+
* while it is off screen, and for anyone who has asked for reduced motion.
|
|
65
|
+
*/
|
|
66
|
+
autoRotate?: boolean | number;
|
|
67
|
+
/** Let the globe be dragged and turned with the arrow keys. */
|
|
68
|
+
interactive?: boolean;
|
|
69
|
+
/** Called with the coordinate facing the viewer each time the globe comes to rest. */
|
|
70
|
+
onRotationChange?: (rotation: PlanetRotation) => void;
|
|
71
|
+
}
|
|
72
|
+
export interface PlanetGlobeProps extends Omit<ComponentProps<'div'>, 'children' | 'color'> {
|
|
73
|
+
/** The markers. Anything else placed here is laid over the globe unmoved. */
|
|
74
|
+
children?: ReactNode;
|
|
75
|
+
/** Which of the theme's roles the light round the globe is drawn in. */
|
|
76
|
+
color?: PlanetMarkerColor;
|
|
77
|
+
/** What a screen reader calls the globe. */
|
|
78
|
+
label?: string;
|
|
79
|
+
}
|
|
80
|
+
declare function PlanetGlobe({ children, className, color, label, ...props }: PlanetGlobeProps): import("react").JSX.Element;
|
|
81
|
+
declare namespace PlanetGlobe {
|
|
82
|
+
var displayName: string;
|
|
83
|
+
}
|
|
84
|
+
/** Which of the theme's roles a marker's dot is drawn in. */
|
|
85
|
+
export type PlanetMarkerColor = 'primary' | 'info' | 'success' | 'warning' | 'destructive';
|
|
86
|
+
export interface PlanetMarkerProps extends Omit<ComponentProps<'div'>, 'children' | 'color' | 'onClick'> {
|
|
87
|
+
/** Degrees north of the equator. South is negative. */
|
|
88
|
+
lat: number;
|
|
89
|
+
/** Degrees east of Greenwich. West is negative. */
|
|
90
|
+
lng: number;
|
|
91
|
+
/** A caption in a tag above the pin. */
|
|
92
|
+
label?: ReactNode;
|
|
93
|
+
/** A figure after the label, in a quieter colour. */
|
|
94
|
+
count?: ReactNode;
|
|
95
|
+
/** Which of the theme's roles the dot, or the ring of a pin with children, is drawn in. */
|
|
96
|
+
color?: PlanetMarkerColor;
|
|
97
|
+
/** Spreads a fading ring from the marker, for one that wants looking at. */
|
|
98
|
+
pulse?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Called when the marker is pressed. Passing this makes the marker a
|
|
101
|
+
* button: it takes focus, and Enter or Space press it.
|
|
102
|
+
*/
|
|
103
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
104
|
+
/** Draws the marker as the one that has been picked. */
|
|
105
|
+
selected?: boolean;
|
|
106
|
+
/** What a screen reader calls a marker that can be pressed. Defaults to its label. */
|
|
107
|
+
name?: string;
|
|
108
|
+
/** Extra classes for the label. */
|
|
109
|
+
labelClassName?: string;
|
|
110
|
+
/** What is drawn at the coordinate: an avatar, an icon. A dot when left out. */
|
|
111
|
+
children?: ReactNode;
|
|
112
|
+
}
|
|
113
|
+
declare function PlanetMarker({ lat, lng, label, count, color, pulse, onClick, selected, name, className, labelClassName, children, ...props }: PlanetMarkerProps): import("react").JSX.Element;
|
|
114
|
+
declare namespace PlanetMarker {
|
|
115
|
+
var displayName: string;
|
|
116
|
+
}
|
|
117
|
+
export interface PlanetControlsProps extends Omit<ComponentProps<'div'>, 'children'> {
|
|
118
|
+
/** Degrees of longitude one press turns the globe. */
|
|
119
|
+
step?: number;
|
|
120
|
+
/** Words to show between the two arrows. Without them it is the arrows alone. */
|
|
121
|
+
children?: ReactNode;
|
|
122
|
+
}
|
|
123
|
+
declare function PlanetControls({ step, className, children, ...props }: PlanetControlsProps): import("react").JSX.Element;
|
|
124
|
+
declare namespace PlanetControls {
|
|
125
|
+
var displayName: string;
|
|
126
|
+
}
|
|
127
|
+
export declare const Planet: import("react").ForwardRefExoticComponent<Omit<PlanetProps, "ref"> & import("react").RefAttributes<PlanetHandle>> & {
|
|
128
|
+
Globe: typeof PlanetGlobe;
|
|
129
|
+
Marker: typeof PlanetMarker;
|
|
130
|
+
Controls: typeof PlanetControls;
|
|
131
|
+
};
|
|
132
|
+
export { PlanetGlobe, PlanetMarker, PlanetControls };
|