@salmonui/overlays 0.0.0-stage → 0.2.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 (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +44 -2
  3. package/dist/dialog/AlertDialog.d.ts +62 -0
  4. package/dist/dialog/AlertDialog.d.ts.map +1 -0
  5. package/dist/dialog/AlertDialog.js +100 -0
  6. package/dist/dialog/AlertDialog.js.map +1 -0
  7. package/dist/dialog/Dialog.d.ts +15 -0
  8. package/dist/dialog/Dialog.d.ts.map +1 -0
  9. package/dist/dialog/Dialog.js +17 -0
  10. package/dist/dialog/Dialog.js.map +1 -0
  11. package/dist/dialog.css +656 -0
  12. package/dist/dialog.d.ts +6 -0
  13. package/dist/dialog.d.ts.map +1 -0
  14. package/dist/dialog.js +13 -0
  15. package/dist/dialog.js.map +1 -0
  16. package/dist/drawer/Drawer.d.ts +23 -0
  17. package/dist/drawer/Drawer.d.ts.map +1 -0
  18. package/dist/drawer/Drawer.js +11 -0
  19. package/dist/drawer/Drawer.js.map +1 -0
  20. package/dist/drawer.css +247 -0
  21. package/dist/drawer.d.ts +5 -0
  22. package/dist/drawer.d.ts.map +1 -0
  23. package/dist/drawer.js +11 -0
  24. package/dist/drawer.js.map +1 -0
  25. package/dist/internal/placement.d.ts +18 -0
  26. package/dist/internal/placement.d.ts.map +1 -0
  27. package/dist/internal/placement.js +19 -0
  28. package/dist/internal/placement.js.map +1 -0
  29. package/dist/popover/Popover.d.ts +99 -0
  30. package/dist/popover/Popover.d.ts.map +1 -0
  31. package/dist/popover/Popover.js +140 -0
  32. package/dist/popover/Popover.js.map +1 -0
  33. package/dist/popover.css +116 -0
  34. package/dist/popover.d.ts +3 -0
  35. package/dist/popover.d.ts.map +1 -0
  36. package/dist/popover.js +9 -0
  37. package/dist/popover.js.map +1 -0
  38. package/dist/styles.css +870 -0
  39. package/dist/tooltip/Tooltip.d.ts +87 -0
  40. package/dist/tooltip/Tooltip.d.ts.map +1 -0
  41. package/dist/tooltip/Tooltip.js +183 -0
  42. package/dist/tooltip/Tooltip.js.map +1 -0
  43. package/dist/tooltip.css +57 -0
  44. package/dist/tooltip.d.ts +3 -0
  45. package/dist/tooltip.d.ts.map +1 -0
  46. package/dist/tooltip.js +8 -0
  47. package/dist/tooltip.js.map +1 -0
  48. package/package.json +57 -4
@@ -0,0 +1,87 @@
1
+ import { type CSSProperties, type FocusEvent, type HTMLAttributes, type PointerEvent as ReactPointerEvent, type ReactElement, type ReactNode, type Ref } from 'react';
2
+ import { type OverlayOffset, type OverlayPlacement } from '../internal/placement.js';
3
+ export type TooltipPlacement = OverlayPlacement;
4
+ export type TooltipOffset = OverlayOffset;
5
+ export type TooltipOpenChangeReason = 'hover' | 'focus' | 'blur' | 'leave' | 'escape' | 'press';
6
+ /** Second argument of `onOpenChange`: frozen, allocated only when a callback is bound. */
7
+ export interface TooltipOpenChangeEvent {
8
+ readonly reason: TooltipOpenChangeReason;
9
+ readonly source: 'pointer' | 'keyboard';
10
+ }
11
+ export interface TooltipProviderProps {
12
+ readonly children?: ReactNode;
13
+ /** Open delay in ms for every tooltip inside. Default 600. */
14
+ readonly delay?: number | undefined;
15
+ /** Close delay in ms. Default 100. */
16
+ readonly closeDelay?: number | undefined;
17
+ /** After a tooltip closes, the next one opens without delay for this many ms. Default 300. */
18
+ readonly skipDelay?: number | undefined;
19
+ }
20
+ /** Shares `delay` / `closeDelay` and the skip-delay window between tooltips (moving between triggers opens instantly). */
21
+ export declare function TooltipProvider(props: TooltipProviderProps): ReactElement;
22
+ /** Props `Tooltip` computes for the trigger (spread them in `render`). */
23
+ export interface TooltipTriggerProps {
24
+ readonly 'aria-describedby'?: string | undefined;
25
+ readonly onPointerEnter: (event: ReactPointerEvent<HTMLElement>) => void;
26
+ readonly onPointerLeave: (event: ReactPointerEvent<HTMLElement>) => void;
27
+ readonly onPointerMove?: ((event: ReactPointerEvent<HTMLElement>) => void) | undefined;
28
+ readonly onPointerDown: (event: ReactPointerEvent<HTMLElement>) => void;
29
+ readonly onFocus: (event: FocusEvent<HTMLElement>) => void;
30
+ readonly onBlur: (event: FocusEvent<HTMLElement>) => void;
31
+ readonly ref: (el: HTMLElement | null) => void;
32
+ }
33
+ export type TooltipPart = 'content' | 'arrow';
34
+ /** `contentProps`: DOM attributes of the content element, `data-*` attributes included. */
35
+ export type TooltipContentProps = Omit<HTMLAttributes<HTMLDivElement>, 'id' | 'role'> & {
36
+ readonly [attribute: `data-${string}`]: string | number | boolean | undefined;
37
+ };
38
+ export interface TooltipProps {
39
+ /** Tooltip text or nodes (no interactive content: use `Popover`). Rendered only while open. */
40
+ readonly content: ReactNode;
41
+ /** The trigger, wrapped in a `display: contents` span; the first element child is the anchor and gets `aria-describedby`. */
42
+ readonly children?: ReactNode;
43
+ /** Renders the trigger element itself with the computed props (no wrapper span). Wins over `children`. */
44
+ readonly render?: ((props: TooltipTriggerProps) => ReactElement) | undefined;
45
+ readonly open?: boolean | undefined;
46
+ readonly defaultOpen?: boolean | undefined;
47
+ readonly onOpenChange?: ((open: boolean, event: TooltipOpenChangeEvent) => void) | undefined;
48
+ /** After the content is shown / removed. */
49
+ readonly onAfterOpen?: (() => void) | undefined;
50
+ readonly onAfterClose?: (() => void) | undefined;
51
+ /** Logical placement resolved against `dir`. Default `'top'`. */
52
+ readonly placement?: TooltipPlacement | undefined;
53
+ /** Gap to the anchor in px (default 6) or `{ mainAxis, crossAxis }`. */
54
+ readonly offset?: TooltipOffset | undefined;
55
+ /** Arrow pointing at the anchor. Default true. */
56
+ readonly arrow?: boolean | undefined;
57
+ /** Element whose box limits flip and shift. Default the viewport. */
58
+ readonly collisionBoundary?: Element | null | undefined;
59
+ /** Portal target (the tooltip is in the top layer where the Popover API exists). Default `document.body`. */
60
+ readonly container?: Element | null | undefined;
61
+ /** Open delay in ms (default from `Tooltip.Provider`, else 600). */
62
+ readonly delay?: number | undefined;
63
+ /** Close delay in ms (default from `Tooltip.Provider`, else 100). */
64
+ readonly closeDelay?: number | undefined;
65
+ /** Follows the pointer over the trigger (CSS translate written per frame, never React state). */
66
+ readonly followCursor?: boolean | undefined;
67
+ /** Never opens. */
68
+ readonly disabled?: boolean | undefined;
69
+ /** Extra attributes for the content element, `data-*` included (`id` is reserved for `aria-describedby`). */
70
+ readonly contentProps?: TooltipContentProps | undefined;
71
+ readonly className?: string | undefined;
72
+ readonly style?: CSSProperties | undefined;
73
+ readonly classNames?: Partial<Record<TooltipPart, string>> | undefined;
74
+ readonly styles?: Partial<Record<TooltipPart, CSSProperties>> | undefined;
75
+ /** The content element (`role="tooltip"`). */
76
+ readonly ref?: Ref<HTMLDivElement> | undefined;
77
+ }
78
+ /**
79
+ * Tooltip. Styling hooks: `.salmon-tooltip` (content, `data-side`,
80
+ * `data-placement`), `.salmon-tooltip-arrow`, `.salmon-tooltip-trigger`
81
+ * (the `display: contents` wrapper).
82
+ */
83
+ export declare function Tooltip(props: TooltipProps): ReactElement;
84
+ export declare namespace Tooltip {
85
+ export { TooltipProvider as Provider };
86
+ }
87
+ //# sourceMappingURL=Tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/tooltip/Tooltip.tsx"],"names":[],"mappings":"AAWA,OAAO,EAQL,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,YAAY,IAAI,iBAAiB,EACtC,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,GAAG,EACT,MAAM,OAAO,CAAC;AAIf,OAAO,EAA4B,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG/G,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAChD,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC;AAC1C,MAAM,MAAM,uBAAuB,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;A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@@
1
+ 'use client';
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ // Tooltip (APG Tooltip): opens on hover
4
+ // and keyboard focus, closes on Escape, blur and pointer leave (after
5
+ // `closeDelay`), stays open while its content is hovered (WCAG 1.4.13),
6
+ // never on touch. Content renders only while open (client only); the
7
+ // trigger's `aria-describedby` is set only while open, so server and client
8
+ // markup match. Lean by design (4 KB budget): positioning and top layer
9
+ // (`popover="hint"`) come from the overlay primitives; no dismiss stack or
10
+ // focus scope, and the one Escape listener exists only while open.
11
+ import { createContext, use, useEffect, useId, useLayoutEffect, useRef, useState, } from 'react';
12
+ import { createPortal } from 'react-dom';
13
+ import { useControllableState } from '@salmonui/core/internal/controllable';
14
+ import { themeScopeOf, useHydrated, useOverlayPosition, usePortalTarget, useTopLayer } from '@salmonui/core/internal/overlay';
15
+ import { splitOffset, toPlacement } from '../internal/placement.js';
16
+ import { pointRect } from '@salmonui/core/internal/position';
17
+ const TimingContext = createContext(null);
18
+ /** Shares `delay` / `closeDelay` and the skip-delay window between tooltips (moving between triggers opens instantly). */
19
+ export function TooltipProvider(props) {
20
+ const shared = useState(() => ({ at: -Infinity, close: null }))[0];
21
+ const value = { delay: props.delay ?? 600, closeDelay: props.closeDelay ?? 100, skipDelay: props.skipDelay ?? 300, shared };
22
+ return _jsx(TimingContext, { value: value, children: props.children });
23
+ }
24
+ const cx = (base, extra) => (extra ? `${base} ${extra}` : base);
25
+ /**
26
+ * Tooltip. Styling hooks: `.salmon-tooltip` (content, `data-side`,
27
+ * `data-placement`), `.salmon-tooltip-arrow`, `.salmon-tooltip-trigger`
28
+ * (the `display: contents` wrapper).
29
+ */
30
+ export function Tooltip(props) {
31
+ const { open: openProp, defaultOpen, onOpenChange, onAfterOpen, onAfterClose, disabled, render, children, followCursor } = props;
32
+ const provider = use(TimingContext);
33
+ // Without a provider each tooltip keeps its own box (no module-level state).
34
+ const own = useState(() => ({ at: -Infinity, close: null }))[0];
35
+ const shared = provider?.shared ?? own;
36
+ const delay = props.delay ?? provider?.delay ?? 600;
37
+ const closeDelay = props.closeDelay ?? provider?.closeDelay ?? 100;
38
+ const skipDelay = provider?.skipDelay ?? 0;
39
+ const notify = onOpenChange && ((next, reason, source) => onOpenChange(next, Object.freeze({ reason, source })));
40
+ const [openState, setOpen] = useControllableState(openProp, defaultOpen ?? false, notify, 'Tooltip open');
41
+ const hydrated = useHydrated();
42
+ const open = openState && hydrated && !disabled;
43
+ const id = useId();
44
+ // Transients: timers, the trigger element, the pointer point. Never state.
45
+ const live = useState(() => ({ timer: 0, trigger: null, point: null, place: () => { } }))[0];
46
+ const clear = () => {
47
+ globalThis.clearTimeout(live.timer);
48
+ live.timer = 0;
49
+ };
50
+ const schedule = (next, ms, reason, source) => {
51
+ clear();
52
+ const run = () => {
53
+ live.timer = 0;
54
+ if (next) {
55
+ if (shared.close !== close)
56
+ shared.close?.();
57
+ shared.close = close;
58
+ }
59
+ else {
60
+ if (shared.close === close)
61
+ shared.close = null;
62
+ shared.at = performance.now();
63
+ }
64
+ setOpen(next, reason, source);
65
+ };
66
+ if (ms <= 0)
67
+ run();
68
+ else
69
+ live.timer = globalThis.setTimeout(run, ms);
70
+ };
71
+ const openDelay = () => (performance.now() - shared.at < skipDelay ? 0 : delay);
72
+ // Stable per instance: lets a sibling tooltip of the provider close this one.
73
+ const close = useState(() => () => schedule(false, 0, 'leave', 'pointer'))[0];
74
+ useEffect(() => clear, []); // eslint-disable-line react-hooks/exhaustive-deps
75
+ // After-open / after-close notifications (not on mount).
76
+ const was = useRef(open);
77
+ useEffect(() => {
78
+ if (was.current === open)
79
+ return;
80
+ was.current = open;
81
+ (open ? onAfterOpen : onAfterClose)?.();
82
+ });
83
+ // Escape closes the tooltip only (capture, so a surrounding dialog keeps its state); installed only while open.
84
+ useEffect(() => {
85
+ if (!open)
86
+ return;
87
+ const doc = live.trigger?.ownerDocument ?? globalThis.document;
88
+ const onKey = (event) => {
89
+ if (event.key !== 'Escape' || event.isComposing)
90
+ return;
91
+ event.preventDefault();
92
+ event.stopPropagation();
93
+ schedule(false, 0, 'escape', 'keyboard');
94
+ };
95
+ doc.addEventListener('keydown', onKey, true);
96
+ return () => doc.removeEventListener('keydown', onKey, true);
97
+ });
98
+ const triggerProps = {
99
+ 'aria-describedby': open ? id : undefined,
100
+ ref: (el) => {
101
+ live.trigger = el;
102
+ },
103
+ onPointerEnter: (event) => {
104
+ if (disabled || event.pointerType === 'touch')
105
+ return;
106
+ if (followCursor)
107
+ live.point = pointRect(event.clientX, event.clientY);
108
+ schedule(true, openDelay(), 'hover', 'pointer');
109
+ },
110
+ onPointerMove: followCursor
111
+ ? (event) => {
112
+ live.point = pointRect(event.clientX, event.clientY);
113
+ live.place();
114
+ }
115
+ : undefined,
116
+ onPointerLeave: (event) => {
117
+ if (event.pointerType === 'touch')
118
+ return;
119
+ // Leaving an open tooltip starts the provider's skip window, so the next trigger opens at once.
120
+ if (open)
121
+ shared.at = performance.now() + closeDelay;
122
+ schedule(false, closeDelay, 'leave', 'pointer');
123
+ },
124
+ onPointerDown: () => {
125
+ if (open || live.timer)
126
+ schedule(false, 0, 'press', 'pointer');
127
+ },
128
+ onFocus: (event) => {
129
+ // Keyboard focus only (APG): a pointer focus is covered by hover.
130
+ if (!disabled && event.target.matches?.(':focus-visible'))
131
+ schedule(true, 0, 'focus', 'keyboard');
132
+ },
133
+ onBlur: () => schedule(false, 0, 'blur', 'keyboard'),
134
+ };
135
+ let trigger;
136
+ if (render)
137
+ trigger = render(triggerProps);
138
+ else {
139
+ const { ref, 'aria-describedby': _d, ...handlers } = triggerProps;
140
+ trigger = (_jsx("span", { className: "salmon-tooltip-trigger", style: { display: 'contents' }, ...handlers, ref: (el) => ref(el?.firstElementChild ?? null), children: children }));
141
+ }
142
+ return (_jsxs(_Fragment, { children: [trigger, open ? _jsx(TooltipContent, { ...props, id: id, live: live, onEnter: clear, onLeave: () => schedule(false, closeDelay, 'leave', 'pointer'), describe: !render }) : null] }));
143
+ }
144
+ function TooltipContent(props) {
145
+ const { id, live, content, className, style, classNames, styles, contentProps, ref, arrow } = props;
146
+ const own = useRef(null);
147
+ const { main, cross } = splitOffset(props.offset, 6);
148
+ useTopLayer(own, true, 'hint');
149
+ const place = useOverlayPosition(own, () => (props.followCursor && live.point) || live.trigger, {
150
+ placement: toPlacement(props.placement, 'top'),
151
+ offset: main,
152
+ crossOffset: cross,
153
+ collisionBoundary: props.collisionBoundary,
154
+ });
155
+ useLayoutEffect(() => {
156
+ live.place = place;
157
+ });
158
+ useLayoutEffect(() => {
159
+ const el = props.describe ? live.trigger : null;
160
+ if (!el)
161
+ return;
162
+ const before = el.getAttribute('aria-describedby');
163
+ el.setAttribute('aria-describedby', before ? `${before} ${id}` : id);
164
+ return () => {
165
+ if (before)
166
+ el.setAttribute('aria-describedby', before);
167
+ else
168
+ el.removeAttribute('aria-describedby');
169
+ };
170
+ }, [id, live, props.describe]);
171
+ const target = usePortalTarget(() => props.container ?? themeScopeOf(live.trigger));
172
+ if (!target)
173
+ return null;
174
+ return createPortal(_jsxs("div", { ...contentProps, ref: (el) => {
175
+ own.current = el;
176
+ if (typeof ref === 'function')
177
+ ref(el);
178
+ else if (ref)
179
+ ref.current = el;
180
+ }, id: id, role: "tooltip", className: cx(cx('salmon-tooltip', className), classNames?.content), style: { position: 'fixed', top: 0, left: 0, margin: 0, ...style, ...styles?.content }, "data-arrow": arrow === false ? undefined : '', onPointerEnter: props.onEnter, onPointerLeave: props.onLeave, children: [content, arrow === false ? null : _jsx("span", { className: cx('salmon-tooltip-arrow', classNames?.arrow), style: styles?.arrow, "aria-hidden": "true" })] }), target);
181
+ }
182
+ Tooltip.Provider = TooltipProvider;
183
+ //# sourceMappingURL=Tooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../src/tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,wCAAwC;AACxC,sEAAsE;AACtE,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AAE,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,iBAAc,MAAM,GAAG,IACjI,EACN,MAAM,CACP,CAAC;AACJ,CAAC;AAED,OAAO,CAAC,QAAQ,GAAG,eAAe,CAAC"}
@@ -0,0 +1,57 @@
1
+ @layer salmon.a;
2
+ @layer salmon.a {
3
+ /* @salmonui/react/tooltip: Tooltip content and arrow. Self-contained; logical properties
4
+ except where the resolved physical side (`data-side`) positions the arrow. */
5
+
6
+ .salmon-tooltip {
7
+ box-sizing: border-box;
8
+ inset: 0 auto auto 0;
9
+ z-index: 1100;
10
+ max-inline-size: min(280px, calc(100vw - 16px));
11
+ padding-block: var(--salmon-space-2);
12
+ padding-inline: var(--salmon-space-3);
13
+ overflow: visible;
14
+ font-family: var(--salmon-font-sans);
15
+ font-size: var(--salmon-font-size-sm);
16
+ line-height: var(--salmon-line-height-tight);
17
+ color: var(--salmon-surface-base);
18
+ background: var(--salmon-text-primary);
19
+ border: 0;
20
+ border-radius: var(--salmon-radius-md);
21
+ overflow-wrap: break-word;
22
+ opacity: 1;
23
+ transition: opacity 100ms ease-out;
24
+ }
25
+
26
+ .salmon-tooltip:not([data-placed]) {
27
+ visibility: hidden;
28
+ }
29
+
30
+ @starting-style {
31
+ .salmon-tooltip[data-placed] {
32
+ opacity: 0;
33
+ }
34
+ }
35
+
36
+ .salmon-tooltip-arrow {
37
+ position: absolute;
38
+ inline-size: 8px;
39
+ block-size: 8px;
40
+ background: inherit;
41
+ transform: rotate(45deg);
42
+ pointer-events: none;
43
+ }
44
+
45
+ /* Physical on purpose: data-side and --salmon-overlay-arrow are physical (already mirrored for dir). */
46
+ .salmon-tooltip[data-side='top'] > .salmon-tooltip-arrow { bottom: -4px; left: calc(var(--salmon-overlay-arrow, 50%) - 4px); }
47
+ .salmon-tooltip[data-side='bottom'] > .salmon-tooltip-arrow { top: -4px; left: calc(var(--salmon-overlay-arrow, 50%) - 4px); }
48
+ .salmon-tooltip[data-side='left'] > .salmon-tooltip-arrow { right: -4px; top: calc(var(--salmon-overlay-arrow, 50%) - 4px); }
49
+ .salmon-tooltip[data-side='right'] > .salmon-tooltip-arrow { left: -4px; top: calc(var(--salmon-overlay-arrow, 50%) - 4px); }
50
+
51
+ @media (prefers-reduced-motion: reduce) {
52
+ .salmon-tooltip {
53
+ transition: none;
54
+ }
55
+ }
56
+
57
+ }
@@ -0,0 +1,3 @@
1
+ export { Tooltip, TooltipProvider } from './tooltip/Tooltip.js';
2
+ export type { TooltipProps, TooltipProviderProps, TooltipTriggerProps, TooltipContentProps, TooltipPart, TooltipPlacement, TooltipOffset, TooltipOpenChangeEvent, TooltipOpenChangeReason } from './tooltip/Tooltip.js';
3
+ //# sourceMappingURL=tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../src/tooltip.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAChE,YAAY,EAAE,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,WAAW,EAAE,gBAAgB,EAAE,aAAa,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,8 @@
1
+ 'use client';
2
+ import { expectStylesheet } from '@salmonui/core/internal/dev';
3
+ // `@salmonui/overlays/tooltip`: Tooltip and Tooltip.Provider. Render-safe: the trigger renders on the server; the content
4
+ // mounts only while open, after hydration.
5
+ export { Tooltip, TooltipProvider } from './tooltip/Tooltip.js';
6
+ if (process.env.NODE_ENV !== 'production')
7
+ expectStylesheet('@salmonui/overlays/tooltip', 'salmon-tooltip');
8
+ //# sourceMappingURL=tooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../src/tooltip.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,0HAA0H;AAC1H,2CAA2C;AAC3C,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAMhE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;IAAE,gBAAgB,CAAC,4BAA4B,EAAE,gBAAgB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,59 @@
1
1
  {
2
2
  "name": "@salmonui/overlays",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "description": "Dialog, AlertDialog, Drawer, Popover and Tooltip for Salmon UI.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/hy-ong/salmonui.git",
9
+ "directory": "packages/overlays"
10
+ },
11
+ "homepage": "https://salmonui.dev",
12
+ "bugs": {
13
+ "url": "https://github.com/hy-ong/salmonui/issues"
14
+ },
15
+ "type": "module",
16
+ "sideEffects": [
17
+ "**/*.css"
18
+ ],
19
+ "exports": {
20
+ "./dialog": {
21
+ "types": "./dist/dialog.d.ts",
22
+ "import": "./dist/dialog.js"
23
+ },
24
+ "./drawer": {
25
+ "types": "./dist/drawer.d.ts",
26
+ "import": "./dist/drawer.js"
27
+ },
28
+ "./popover": {
29
+ "types": "./dist/popover.d.ts",
30
+ "import": "./dist/popover.js"
31
+ },
32
+ "./tooltip": {
33
+ "types": "./dist/tooltip.d.ts",
34
+ "import": "./dist/tooltip.js"
35
+ },
36
+ "./dialog/styles.css": "./dist/dialog.css",
37
+ "./drawer/styles.css": "./dist/drawer.css",
38
+ "./popover/styles.css": "./dist/popover.css",
39
+ "./tooltip/styles.css": "./dist/tooltip.css",
40
+ "./styles.css": "./dist/styles.css",
41
+ "./package.json": "./package.json"
42
+ },
43
+ "files": [
44
+ "dist",
45
+ "README.md",
46
+ "LICENSE"
47
+ ],
48
+ "dependencies": {
49
+ "@salmonui/core": "0.2.0",
50
+ "@salmonui/buttons": "0.2.0"
51
+ },
52
+ "peerDependencies": {
53
+ "react": ">=19",
54
+ "react-dom": ">=19"
55
+ },
56
+ "engines": {
57
+ "node": ">=22"
58
+ }
59
+ }