@glimstone/react 4.4.1 → 4.5.1
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 +2 -1
- package/dist/AboutCard.d.ts +1 -1
- package/dist/AboutCard.js +3 -2
- package/dist/Accordion.d.ts +15 -0
- package/dist/Accordion.js +23 -0
- package/dist/AngleSlider.d.ts +10 -0
- package/dist/AngleSlider.js +19 -0
- package/dist/Avatar.d.ts +11 -0
- package/dist/Avatar.js +11 -0
- package/dist/Badge.d.ts +1 -1
- package/dist/Badge.js +1 -1
- package/dist/Carousel.d.ts +18 -0
- package/dist/Carousel.js +27 -0
- package/dist/Checkbox.js +1 -1
- package/dist/Collapsible.d.ts +12 -0
- package/dist/Collapsible.js +21 -0
- package/dist/ContextMenu.d.ts +3 -1
- package/dist/ContextMenu.js +11 -3
- package/dist/CryptoDonateDialog.d.ts +2 -28
- package/dist/DatePicker.d.ts +16 -0
- package/dist/DatePicker.js +39 -0
- package/dist/DropdownListbox.d.ts +1 -1
- package/dist/DropdownListbox.js +11 -4
- package/dist/FileUpload.d.ts +15 -0
- package/dist/FileUpload.js +23 -0
- package/dist/FloatingPanel.d.ts +14 -0
- package/dist/FloatingPanel.js +25 -0
- package/dist/Fortress.d.ts +2 -13
- package/dist/HoverCard.d.ts +12 -0
- package/dist/HoverCard.js +20 -0
- package/dist/InfoBubble.js +1 -1
- package/dist/InstanceCard.d.ts +2 -4
- package/dist/Marquee.d.ts +16 -0
- package/dist/Marquee.js +23 -0
- package/dist/MenuBar.d.ts +2 -4
- package/dist/MenuBar.js +10 -10
- package/dist/Meter.js +1 -1
- package/dist/Pagination.d.ts +14 -0
- package/dist/Pagination.js +26 -0
- package/dist/PathField.js +2 -2
- package/dist/PinInput.d.ts +21 -0
- package/dist/PinInput.js +27 -0
- package/dist/Rating.d.ts +15 -0
- package/dist/Rating.js +24 -0
- package/dist/ScrollArea.d.ts +9 -0
- package/dist/ScrollArea.js +11 -0
- package/dist/Select.js +10 -2
- package/dist/SidebarRow.d.ts +2 -6
- package/dist/SignInCard.d.ts +2 -9
- package/dist/SignInCard.js +3 -0
- package/dist/SignaturePad.d.ts +11 -0
- package/dist/SignaturePad.js +27 -0
- package/dist/SkeletonRow.js +1 -1
- package/dist/Splitter.d.ts +14 -0
- package/dist/Splitter.js +22 -0
- package/dist/Steps.d.ts +17 -0
- package/dist/Steps.js +32 -0
- package/dist/TagsInput.d.ts +15 -0
- package/dist/TagsInput.js +32 -0
- package/dist/Timer.d.ts +15 -0
- package/dist/Timer.js +14 -0
- package/dist/Toast.d.ts +2 -7
- package/dist/Tour.d.ts +10 -0
- package/dist/Tour.js +30 -0
- package/dist/engines.d.ts +11 -0
- package/dist/engines.js +43 -0
- package/dist/glyphs.d.ts +8 -0
- package/dist/glyphs.js +8 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/usePaypalButtons.d.ts +8 -7
- package/package.json +28 -7
package/dist/Toast.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type ToastAction, type ToastSeverity } from "@glimstone/core";
|
|
1
|
+
import { type ToastAction, type ToastSeverity, type ToastViewportEntry } from "@glimstone/core";
|
|
2
|
+
export type { ToastViewportEntry } from "@glimstone/core";
|
|
2
3
|
export interface ToastCardProps {
|
|
3
4
|
id: string;
|
|
4
5
|
message: string;
|
|
@@ -14,12 +15,6 @@ export interface ToastCardProps {
|
|
|
14
15
|
onBlur: (id: string) => void;
|
|
15
16
|
}
|
|
16
17
|
export declare function ToastCard({ id, message, severity, action, dismissLabel, onDismiss, onMouseEnter, onMouseLeave, onFocus, onBlur, }: ToastCardProps): import("react").JSX.Element;
|
|
17
|
-
export interface ToastViewportEntry {
|
|
18
|
-
id: string;
|
|
19
|
-
message: string;
|
|
20
|
-
severity: ToastSeverity;
|
|
21
|
-
action?: ToastAction;
|
|
22
|
-
}
|
|
23
18
|
export interface ToastViewportProps {
|
|
24
19
|
toasts: ToastViewportEntry[];
|
|
25
20
|
dismissLabel: string;
|
package/dist/Tour.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type TourStep, type TourText } from "@glimstone/core";
|
|
2
|
+
export type { TourStep, TourText } from "@glimstone/core";
|
|
3
|
+
export interface TourProps {
|
|
4
|
+
steps: readonly TourStep[];
|
|
5
|
+
/** Turning it on starts the tour at its first step. It turns off once the tour ends. */
|
|
6
|
+
open: boolean;
|
|
7
|
+
onOpenChange: (open: boolean) => void;
|
|
8
|
+
text?: Partial<TourText>;
|
|
9
|
+
}
|
|
10
|
+
export declare function Tour({ steps, open, onOpenChange, text }: TourProps): import("react").JSX.Element;
|
package/dist/Tour.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useId } from "react";
|
|
3
|
+
import * as tour from "@zag-js/tour";
|
|
4
|
+
import { normalizeProps, Portal, useMachine } from "@zag-js/react";
|
|
5
|
+
import { TOUR_TEXT, pageDir, portalTarget, tourSteps } from "@glimstone/core";
|
|
6
|
+
import { Badge } from "./Badge.js";
|
|
7
|
+
import { Button } from "./Button.js";
|
|
8
|
+
import { IconBack, IconCheck, IconForward } from "./glyphs.js";
|
|
9
|
+
export function Tour({ steps, open, onOpenChange, text }) {
|
|
10
|
+
const words = { ...TOUR_TEXT, ...text };
|
|
11
|
+
const service = useMachine(tour.machine, {
|
|
12
|
+
id: useId(),
|
|
13
|
+
dir: pageDir(),
|
|
14
|
+
steps: tourSteps(steps),
|
|
15
|
+
onStatusChange: (d) => {
|
|
16
|
+
if (d.status === "dismissed" || d.status === "completed" || d.status === "skipped") {
|
|
17
|
+
onOpenChange(false);
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
const api = tour.connect(service, normalizeProps);
|
|
22
|
+
// The machine ends a tour through its close trigger. Next on the last step
|
|
23
|
+
// would only stay where it is.
|
|
24
|
+
const end = () => api.getCloseTriggerProps().onClick();
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (open && !api.open)
|
|
27
|
+
api.start();
|
|
28
|
+
}, [open]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
29
|
+
return (_jsx(Portal, { container: { current: portalTarget() }, children: api.open && api.step && (_jsxs("div", { "data-glim": "Tour", className: "glim-tour-layer", children: [_jsx("div", { ...api.getBackdropProps(), className: "glim-tour-backdrop" }), _jsx("div", { ...api.getSpotlightProps(), className: "glim-tour-spotlight" }), _jsx("div", { ...api.getPositionerProps(), className: "glim-tour-positioner", children: _jsxs("div", { ...api.getContentProps(), className: "glim-tour", children: [_jsx("h2", { ...api.getTitleProps(), className: "glim-panel-heading", children: _jsx(Badge, { tone: "heading", size: "heading", wrap: true, children: api.step.title }) }), _jsx("p", { ...api.getDescriptionProps(), className: "glim-tour-text", children: api.step.description }), _jsxs("div", { className: "glim-tour-foot", children: [_jsx("span", { ...api.getProgressTextProps(), className: "glim-tour-progress glim-num", children: words.progress(api.stepIndex + 1, api.totalSteps) }), _jsx(Button, { label: words.back, labelKey: null, glyph: _jsx(IconBack, {}), disabled: !api.hasPrevStep, onClick: api.prev }), api.lastStep ? (_jsx(Button, { label: words.close, labelKey: null, glyph: _jsx(IconCheck, {}), tone: "accent", onClick: end })) : (_jsx(Button, { label: words.next, labelKey: null, glyph: _jsx(IconForward, {}), tone: "accent", onClick: api.next }))] })] }) })] })) }));
|
|
30
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Density, type Motion, type RainbowState, type Shape } from "@glimstone/core";
|
|
2
|
+
/** The rainbow state. Setting it applies the new state to the document. */
|
|
3
|
+
export declare function useRainbow(): [RainbowState, (next: RainbowState) => void];
|
|
4
|
+
/** The custom properties that put an element at a rainbow position. */
|
|
5
|
+
export declare function useHue(index: number | undefined): Record<string, string> | undefined;
|
|
6
|
+
export declare function useShape(): [Shape, (next: Shape) => void];
|
|
7
|
+
export declare function useMotion(): [Motion, (next: Motion) => void];
|
|
8
|
+
/** The row density of lists and tables. */
|
|
9
|
+
export declare function useDensity(): [Density, (next: Density) => void];
|
|
10
|
+
/** The accent the user chose, or "" for the default. */
|
|
11
|
+
export declare function useAccent(): [string, (hex: string) => void];
|
package/dist/engines.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useCallback, useMemo, useSyncExternalStore } from "react";
|
|
2
|
+
import { applyAccent, applyDensity, applyMotion, applyRainbow, applyShape, DEFAULT_DENSITY, DEFAULT_MOTION, DEFAULT_SHAPE, hueVars, rainbowState, subscribeRainbow, } from "@glimstone/core";
|
|
3
|
+
// The colour, shape, motion and density engines as hooks, the twins of the Vue
|
|
4
|
+
// composables. Each value belongs to the document, not a component, so every
|
|
5
|
+
// hook follows the document and writes back through the core, in the
|
|
6
|
+
// [value, set] shape of useState.
|
|
7
|
+
/** The rainbow state. Setting it applies the new state to the document. */
|
|
8
|
+
export function useRainbow() {
|
|
9
|
+
return [useSyncExternalStore(subscribeRainbow, rainbowState), applyRainbow];
|
|
10
|
+
}
|
|
11
|
+
/** The custom properties that put an element at a rainbow position. */
|
|
12
|
+
export function useHue(index) {
|
|
13
|
+
return useMemo(() => (index === undefined ? undefined : hueVars(index)), [index]);
|
|
14
|
+
}
|
|
15
|
+
// Shape, motion, density and accent live on the root element only, so a reader watches
|
|
16
|
+
// the attribute rather than waiting for a call that told it.
|
|
17
|
+
function useRoot(attribute, read) {
|
|
18
|
+
const subscribe = useCallback((changed) => {
|
|
19
|
+
const observer = new MutationObserver(changed);
|
|
20
|
+
observer.observe(document.documentElement, { attributes: true, attributeFilter: [attribute] });
|
|
21
|
+
return () => observer.disconnect();
|
|
22
|
+
}, [attribute]);
|
|
23
|
+
return useSyncExternalStore(subscribe, read);
|
|
24
|
+
}
|
|
25
|
+
const readShape = () => document.documentElement.getAttribute("data-shape") ?? DEFAULT_SHAPE;
|
|
26
|
+
const readMotion = () => document.documentElement.getAttribute("data-motion") ?? DEFAULT_MOTION;
|
|
27
|
+
const readDensity = () => document.documentElement.getAttribute("data-density") ?? DEFAULT_DENSITY;
|
|
28
|
+
const readAccent = () => document.documentElement.style.getPropertyValue("--accent");
|
|
29
|
+
export function useShape() {
|
|
30
|
+
return [useRoot("data-shape", readShape), applyShape];
|
|
31
|
+
}
|
|
32
|
+
export function useMotion() {
|
|
33
|
+
return [useRoot("data-motion", readMotion), applyMotion];
|
|
34
|
+
}
|
|
35
|
+
/** The row density of lists and tables. */
|
|
36
|
+
export function useDensity() {
|
|
37
|
+
return [useRoot("data-density", readDensity), applyDensity];
|
|
38
|
+
}
|
|
39
|
+
/** The accent the user chose, or "" for the default. */
|
|
40
|
+
export function useAccent() {
|
|
41
|
+
return [useRoot("style", readAccent), setAccent];
|
|
42
|
+
}
|
|
43
|
+
const setAccent = (hex) => applyAccent(hex || undefined);
|
package/dist/glyphs.d.ts
CHANGED
|
@@ -25,3 +25,11 @@ export declare const IconWindowRestore: () => import("react").JSX.Element;
|
|
|
25
25
|
export declare const IconEye: () => import("react").JSX.Element;
|
|
26
26
|
export declare const IconEyeOff: () => import("react").JSX.Element;
|
|
27
27
|
export declare const IconCopy: () => import("react").JSX.Element;
|
|
28
|
+
export declare const IconBack: () => import("react").JSX.Element;
|
|
29
|
+
export declare const IconForward: () => import("react").JSX.Element;
|
|
30
|
+
export declare const IconUpload: () => import("react").JSX.Element;
|
|
31
|
+
export declare const IconCalendar: () => import("react").JSX.Element;
|
|
32
|
+
export declare const IconStar: () => import("react").JSX.Element;
|
|
33
|
+
export declare const IconPlay: () => import("react").JSX.Element;
|
|
34
|
+
export declare const IconPause: () => import("react").JSX.Element;
|
|
35
|
+
export declare const IconResetArrow: () => import("react").JSX.Element;
|
package/dist/glyphs.js
CHANGED
|
@@ -33,3 +33,11 @@ export const IconWindowRestore = () => _jsx(MarkSvg, { mark: MARKS.windowRestore
|
|
|
33
33
|
export const IconEye = () => _jsx(MarkSvg, { mark: MARKS.eye, className: "glim-mark" });
|
|
34
34
|
export const IconEyeOff = () => _jsx(MarkSvg, { mark: MARKS.eyeOff, className: "glim-mark" });
|
|
35
35
|
export const IconCopy = () => _jsx(MarkSvg, { mark: MARKS.copy, className: "glim-mark" });
|
|
36
|
+
export const IconBack = () => _jsx(MarkSvg, { mark: MARKS.back, className: "glim-mark" });
|
|
37
|
+
export const IconForward = () => _jsx(MarkSvg, { mark: MARKS.forward, className: "glim-mark" });
|
|
38
|
+
export const IconUpload = () => _jsx(MarkSvg, { mark: MARKS.upload, className: "glim-mark" });
|
|
39
|
+
export const IconCalendar = () => _jsx(MarkSvg, { mark: MARKS.calendar, className: "glim-mark" });
|
|
40
|
+
export const IconStar = () => _jsx(MarkSvg, { mark: MARKS.star, className: "glim-mark" });
|
|
41
|
+
export const IconPlay = () => _jsx(MarkSvg, { mark: MARKS.play, className: "glim-mark" });
|
|
42
|
+
export const IconPause = () => _jsx(MarkSvg, { mark: MARKS.pause, className: "glim-mark" });
|
|
43
|
+
export const IconResetArrow = () => _jsx(MarkSvg, { mark: MARKS.resetArrow, className: "glim-mark" });
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from "./CopyField.tsx";
|
|
|
12
12
|
export * from "./CryptoDonateDialog.tsx";
|
|
13
13
|
export * from "./DropdownListbox.tsx";
|
|
14
14
|
export * from "./EmptyState.tsx";
|
|
15
|
+
export * from "./engines.ts";
|
|
15
16
|
export * from "./FieldError.tsx";
|
|
16
17
|
export * from "./FieldRow.tsx";
|
|
17
18
|
export * from "./FieldRowGroup.tsx";
|
|
@@ -62,4 +63,4 @@ export * from "./useLabelMode.ts";
|
|
|
62
63
|
export * from "./usePaypalButtons.ts";
|
|
63
64
|
export * from "./useTipBubble.tsx";
|
|
64
65
|
export type { ToastAction } from "@glimstone/core";
|
|
65
|
-
export { GLIMSTONE_VERSION } from "@glimstone/core";
|
|
66
|
+
export { GLIMSTONE_RELEASE_URL, GLIMSTONE_REPO, GLIMSTONE_VERSION } from "@glimstone/core";
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export * from "./CopyField.js";
|
|
|
12
12
|
export * from "./CryptoDonateDialog.js";
|
|
13
13
|
export * from "./DropdownListbox.js";
|
|
14
14
|
export * from "./EmptyState.js";
|
|
15
|
+
export * from "./engines.js";
|
|
15
16
|
export * from "./FieldError.js";
|
|
16
17
|
export * from "./FieldRow.js";
|
|
17
18
|
export * from "./FieldRowGroup.js";
|
|
@@ -61,4 +62,4 @@ export * from "./useDragArmed.js";
|
|
|
61
62
|
export * from "./useLabelMode.js";
|
|
62
63
|
export * from "./usePaypalButtons.js";
|
|
63
64
|
export * from "./useTipBubble.js";
|
|
64
|
-
export { GLIMSTONE_VERSION } from "@glimstone/core";
|
|
65
|
+
export { GLIMSTONE_RELEASE_URL, GLIMSTONE_REPO, GLIMSTONE_VERSION } from "@glimstone/core";
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { type GiveFrequency, type PaypalConfig } from "@glimstone/core";
|
|
2
|
-
|
|
3
|
-
* Renders PayPal's two buttons into the returned ref, and again whenever the
|
|
4
|
-
* frequency changes, since a subscription needs the other SDK namespace. The
|
|
5
|
-
* amount is read at click time, so picking another amount reloads nothing.
|
|
6
|
-
*/
|
|
7
|
-
export declare function usePaypalButtons({ config, frequency, amount, description, onDone, onError, }: {
|
|
2
|
+
export interface PaypalButtonsOptions {
|
|
8
3
|
config: PaypalConfig;
|
|
9
4
|
frequency: GiveFrequency;
|
|
10
5
|
/** The amount to charge, or null while the typed amount is not valid. */
|
|
@@ -12,4 +7,10 @@ export declare function usePaypalButtons({ config, frequency, amount, descriptio
|
|
|
12
7
|
description: string;
|
|
13
8
|
onDone: () => void;
|
|
14
9
|
onError: () => void;
|
|
15
|
-
}
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Renders PayPal's two buttons into the returned ref, and again whenever the
|
|
13
|
+
* frequency changes, since a subscription needs the other SDK namespace. The
|
|
14
|
+
* amount is read at click time, so picking another amount reloads nothing.
|
|
15
|
+
*/
|
|
16
|
+
export declare function usePaypalButtons({ config, frequency, amount, description, onDone, onError, }: PaypalButtonsOptions): import("react").RefObject<HTMLDivElement | null>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glimstone/react",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.1",
|
|
4
4
|
"description": "GlimStone's components for React",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": { "type": "git", "url": "git+https://github.com/junkerderprovinz/glimstone.git", "directory": "packages/react" },
|
|
@@ -16,14 +16,35 @@
|
|
|
16
16
|
"build": "tsc -p tsconfig.build.json"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@glimstone/core": "4.
|
|
19
|
+
"@glimstone/core": "4.5.1"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@
|
|
23
|
-
"@zag-js/
|
|
24
|
-
"@zag-js/
|
|
25
|
-
"@zag-js/
|
|
26
|
-
"@zag-js/
|
|
22
|
+
"@internationalized/date": "^3.12.4",
|
|
23
|
+
"@zag-js/accordion": "^1.48.0",
|
|
24
|
+
"@zag-js/angle-slider": "^1.48.0",
|
|
25
|
+
"@zag-js/avatar": "^1.48.0",
|
|
26
|
+
"@zag-js/carousel": "^1.48.0",
|
|
27
|
+
"@zag-js/collapsible": "^1.48.0",
|
|
28
|
+
"@zag-js/combobox": "^1.48.0",
|
|
29
|
+
"@zag-js/date-picker": "^1.48.0",
|
|
30
|
+
"@zag-js/file-upload": "^1.48.0",
|
|
31
|
+
"@zag-js/floating-panel": "^1.48.0",
|
|
32
|
+
"@zag-js/hover-card": "^1.48.0",
|
|
33
|
+
"@zag-js/marquee": "^1.48.0",
|
|
34
|
+
"@zag-js/menu": "^1.48.0",
|
|
35
|
+
"@zag-js/pagination": "^1.48.0",
|
|
36
|
+
"@zag-js/pin-input": "^1.48.0",
|
|
37
|
+
"@zag-js/rating-group": "^1.48.0",
|
|
38
|
+
"@zag-js/react": "^1.48.0",
|
|
39
|
+
"@zag-js/scroll-area": "^1.48.0",
|
|
40
|
+
"@zag-js/select": "^1.48.0",
|
|
41
|
+
"@zag-js/signature-pad": "^1.48.0",
|
|
42
|
+
"@zag-js/slider": "^1.48.0",
|
|
43
|
+
"@zag-js/splitter": "^1.48.0",
|
|
44
|
+
"@zag-js/steps": "^1.48.0",
|
|
45
|
+
"@zag-js/tags-input": "^1.48.0",
|
|
46
|
+
"@zag-js/timer": "^1.48.0",
|
|
47
|
+
"@zag-js/tour": "^1.48.0",
|
|
27
48
|
"react": "^19.0.0",
|
|
28
49
|
"react-dom": "^19.0.0"
|
|
29
50
|
}
|