@ravileal/ui 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.
Files changed (56) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +241 -2
  3. package/dist/components/Alert.d.ts +14 -0
  4. package/dist/components/Avatar.d.ts +11 -0
  5. package/dist/components/Badge.d.ts +23 -0
  6. package/dist/components/Button.d.ts +20 -0
  7. package/dist/components/Card.d.ts +36 -0
  8. package/dist/components/Checkbox.d.ts +7 -0
  9. package/dist/components/ColorPicker.d.ts +33 -0
  10. package/dist/components/Combobox.d.ts +23 -0
  11. package/dist/components/ConfirmModal.d.ts +14 -0
  12. package/dist/components/CopyValue.d.ts +31 -0
  13. package/dist/components/DataTable.d.ts +27 -0
  14. package/dist/components/DatePicker.d.ts +33 -0
  15. package/dist/components/Drawer.d.ts +16 -0
  16. package/dist/components/Dropdown.d.ts +51 -0
  17. package/dist/components/DropdownMenu.d.ts +26 -0
  18. package/dist/components/EmptyState.d.ts +10 -0
  19. package/dist/components/FileUpload.d.ts +14 -0
  20. package/dist/components/FormField.d.ts +24 -0
  21. package/dist/components/InlineEditorCard.d.ts +19 -0
  22. package/dist/components/ListScreen.d.ts +48 -0
  23. package/dist/components/Modal.d.ts +22 -0
  24. package/dist/components/MonthSelector.d.ts +24 -0
  25. package/dist/components/NumberStepper.d.ts +16 -0
  26. package/dist/components/PageHeader.d.ts +11 -0
  27. package/dist/components/Portal.d.ts +11 -0
  28. package/dist/components/ProgressBar.d.ts +13 -0
  29. package/dist/components/Radio.d.ts +5 -0
  30. package/dist/components/RowActions.d.ts +17 -0
  31. package/dist/components/ScreenSkeleton.d.ts +26 -0
  32. package/dist/components/SearchInput.d.ts +13 -0
  33. package/dist/components/SegmentedControl.d.ts +16 -0
  34. package/dist/components/Skeleton.d.ts +14 -0
  35. package/dist/components/Slider.d.ts +17 -0
  36. package/dist/components/Spinner.d.ts +8 -0
  37. package/dist/components/Switch.d.ts +15 -0
  38. package/dist/components/Tabs.d.ts +15 -0
  39. package/dist/components/TextInput.d.ts +13 -0
  40. package/dist/components/Textarea.d.ts +6 -0
  41. package/dist/components/Toast.d.ts +21 -0
  42. package/dist/components/Tooltip.d.ts +22 -0
  43. package/dist/components/VisuallyHidden.d.ts +6 -0
  44. package/dist/index.d.ts +82 -0
  45. package/dist/index.js +3253 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/internal/ScreenCaptureOverlay.d.ts +16 -0
  48. package/dist/internal/clipboard.d.ts +11 -0
  49. package/dist/internal/color.utils.d.ts +21 -0
  50. package/dist/internal/screen-color-picker.d.ts +12 -0
  51. package/dist/internal/tone.d.ts +1 -0
  52. package/dist/internal/useFocusTrap.d.ts +7 -0
  53. package/dist/internal/useIsomorphicLayoutEffect.d.ts +6 -0
  54. package/dist/internal/usePopover.d.ts +30 -0
  55. package/dist/styles.css +1702 -0
  56. package/package.json +105 -4
@@ -0,0 +1,16 @@
1
+ export interface ScreenCapture {
2
+ dataUrl: string;
3
+ width: number;
4
+ height: number;
5
+ context: CanvasRenderingContext2D;
6
+ }
7
+ export interface ScreenCaptureOverlayProps {
8
+ capture: ScreenCapture;
9
+ labels?: {
10
+ pickFromScreen?: string;
11
+ clickToPick?: string;
12
+ };
13
+ onPick: (hex: string) => void;
14
+ onCancel: () => void;
15
+ }
16
+ export default function ScreenCaptureOverlay({ capture, labels, onPick, onCancel, }: ScreenCaptureOverlayProps): import('react').ReactPortal | null;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copies text to the clipboard with a legacy fallback.
3
+ *
4
+ * `navigator.clipboard` is unavailable on insecure origins (plain HTTP on a
5
+ * non-localhost host) and its promise can reject (permission denied, document
6
+ * not focused). The previous call sites used `writeText(...).then(...)` without
7
+ * a catch, so any failure silently swallowed the whole click feedback. This
8
+ * helper always resolves to a boolean and falls back to the deprecated
9
+ * `execCommand('copy')`, which still works without the async clipboard API.
10
+ */
11
+ export declare function copyToClipboard(text: string): Promise<boolean>;
@@ -0,0 +1,21 @@
1
+ export interface Rgb {
2
+ r: number;
3
+ g: number;
4
+ b: number;
5
+ }
6
+ export interface Hsv {
7
+ /** Hue 0-360 */
8
+ h: number;
9
+ /** Saturation 0-1 */
10
+ s: number;
11
+ /** Value/brightness 0-1 */
12
+ v: number;
13
+ }
14
+ export declare function normalizeHex(raw: string): string | null;
15
+ export declare function hexToRgb(hex: string): Rgb | null;
16
+ export declare function rgbToHex(rgb: Rgb): string;
17
+ export declare function rgbToHsv(rgb: Rgb): Hsv;
18
+ export declare function hsvToRgb(hsv: Hsv): Rgb;
19
+ export declare function hsvToHex(hsv: Hsv): string;
20
+ export declare function hexToHsv(hex: string): Hsv | null;
21
+ export declare function clamp(value: number, min: number, max: number): number;
@@ -0,0 +1,12 @@
1
+ export interface PixelPoint {
2
+ x: number;
3
+ y: number;
4
+ }
5
+ /**
6
+ * Maps a viewport pointer position to a pixel of the captured screen frame.
7
+ * The overlay renders the frozen frame stretched to the viewport, so the
8
+ * mapping is linear; values are clamped to the image bounds.
9
+ */
10
+ export declare function mapClientToPixel(clientX: number, clientY: number, viewportWidth: number, viewportHeight: number, imageWidth: number, imageHeight: number): PixelPoint;
11
+ /** Whether the browser can capture the screen for the live colour preview. */
12
+ export declare function supportsScreenPick(): boolean;
@@ -0,0 +1 @@
1
+ export type Tone = 'neutral' | 'info' | 'success' | 'warning' | 'danger' | 'accent' | 'purple';
@@ -0,0 +1,7 @@
1
+ import { RefObject } from 'react';
2
+ export declare function useFocusTrap({ active, containerRef, initialFocusRef, onEscape, }: {
3
+ active: boolean;
4
+ containerRef: RefObject<HTMLElement | null>;
5
+ initialFocusRef?: RefObject<HTMLElement | null>;
6
+ onEscape: () => void;
7
+ }): void;
@@ -0,0 +1,6 @@
1
+ import { useEffect } from 'react';
2
+ /**
3
+ * `useLayoutEffect` warns when rendered on the server. The library supports
4
+ * ReactDOMServer, so components use `useEffect` in that environment instead.
5
+ */
6
+ export declare const useIsomorphicLayoutEffect: typeof useEffect;
@@ -0,0 +1,30 @@
1
+ export interface PopoverPosition {
2
+ left: number;
3
+ top?: number;
4
+ bottom?: number;
5
+ /** Fixed menu width; omitted when the menu shrinks to its content. */
6
+ width?: number;
7
+ maxHeight: number;
8
+ }
9
+ /**
10
+ * Shared popover behavior for custom dropdowns/date pickers: anchors a portaled
11
+ * menu to its trigger, flips above when there is no room below, repositions on
12
+ * scroll/resize and closes on outside click or Escape.
13
+ */
14
+ export declare function usePopover({ maxHeight, minWidth, fitContent, onEscape, onDismiss, }: {
15
+ maxHeight: number;
16
+ minWidth?: number;
17
+ /** Let the menu shrink to its content instead of matching the trigger width. */
18
+ fitContent?: boolean;
19
+ /** Return true to handle Escape without closing the popover (e.g. collapse a submenu). */
20
+ onEscape?: () => boolean | void;
21
+ /** Called when the popover is dismissed by an outside click or Escape (before closing). */
22
+ onDismiss?: () => void;
23
+ }): {
24
+ open: boolean;
25
+ pos: PopoverPosition;
26
+ triggerRef: import('react').RefObject<HTMLButtonElement>;
27
+ menuRef: import('react').RefObject<HTMLDivElement>;
28
+ openMenu: () => void;
29
+ closeMenu: (refocus?: boolean) => void;
30
+ };