@dashforge/tw 1.2.0 → 1.4.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.
@@ -0,0 +1,27 @@
1
+ import type { ImageProps } from './image.types.js';
2
+ /**
3
+ * Dashforge TW `<Image>` — a declarative, robust wrapper over the
4
+ * native `<img>`. Zero eval, no data fetching: it renders a URL you
5
+ * give it, and adds the three things a bare `<img>` lacks.
6
+ *
7
+ * 1. **No layout shift** — pass `aspectRatio` (or `width` + `height`)
8
+ * and the box is reserved before the image loads (CSS
9
+ * `aspect-ratio`, no JS measurement).
10
+ * 2. **Loading skeleton** — a `<Skeleton>` fills the reserved box
11
+ * while the image loads, and is skipped for already-cached images
12
+ * so there is no flash.
13
+ * 3. **Graceful error** — on load failure a muted fallback replaces
14
+ * the broken-image glyph (`fallback` to customise).
15
+ *
16
+ * Lazy by default (`loading="lazy"`). Any native `<img>` attribute not
17
+ * named here (`srcSet`, `sizes`, `decoding`, …) is forwarded to the
18
+ * underlying element. The ref points at the `<img>`.
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * <Image src="/hero.jpg" alt="Team at work" aspectRatio={16 / 9} rounded="lg" />
23
+ * <Image src={avatarUrl} alt="Jane Doe" width={48} height={48} rounded="full" />
24
+ * ```
25
+ */
26
+ export declare const Image: import("react").ForwardRefExoticComponent<ImageProps & import("react").RefAttributes<HTMLImageElement>>;
27
+ //# sourceMappingURL=Image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../../src/components/Image/Image.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA8BnD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,KAAK,yGAiJjB,CAAC"}
@@ -0,0 +1,126 @@
1
+ import type { ImgHTMLAttributes, ReactNode } from 'react';
2
+ import type { AccessRequirement } from '@dashforge/rbac';
3
+ import type { Engine } from '@dashforge/ui-core';
4
+ import type { ImageVariants } from './image.variants.js';
5
+ /**
6
+ * Subset of `<Image>` props theme-configurable via
7
+ * `theme.components.Image.defaults` (Option C).
8
+ */
9
+ export type ImageVariantProps = Pick<ImageVariants, 'fit' | 'rounded'>;
10
+ declare module '@dashforge/tw-tokens' {
11
+ interface TWComponentDefaults {
12
+ Image?: {
13
+ defaults?: Partial<ImageVariantProps>;
14
+ slotProps?: ImageSlotProps;
15
+ };
16
+ }
17
+ }
18
+ export interface ImageSlotProps {
19
+ /** Wrapper element override. */
20
+ root?: {
21
+ className?: string;
22
+ };
23
+ /** `<img>` element override. */
24
+ img?: {
25
+ className?: string;
26
+ };
27
+ /** Loading-skeleton overlay override. */
28
+ skeleton?: {
29
+ className?: string;
30
+ };
31
+ /** Error-fallback overlay override. */
32
+ fallback?: {
33
+ className?: string;
34
+ };
35
+ }
36
+ /**
37
+ * Props for `<Image>`.
38
+ *
39
+ * A thin, declarative wrapper over the native `<img>` — zero eval, no
40
+ * data fetching — with the robustness a native `<img>` lacks:
41
+ *
42
+ * 1. **No layout shift.** Give `aspectRatio` (or `width` + `height`)
43
+ * and the box is reserved before the image loads (CSS
44
+ * `aspect-ratio`, no JS measurement).
45
+ * 2. **Loading skeleton.** While the image loads, a `<Skeleton>` fills
46
+ * the reserved box. It is skipped automatically for already-cached
47
+ * images (no flash).
48
+ * 3. **Graceful error.** On load failure a muted fallback replaces the
49
+ * broken-image glyph — pass your own via `fallback`.
50
+ * 4. **Lazy by default** (`loading="lazy"`).
51
+ *
52
+ * Any native `<img>` attribute not listed here (`srcSet`, `sizes`,
53
+ * `crossOrigin`, `referrerPolicy`, `decoding`, …) is forwarded to the
54
+ * underlying element.
55
+ *
56
+ * Note on privacy: an external `src` is fetched by the browser from
57
+ * that host (egress). Self-host the asset (same-origin / your CDN) to
58
+ * keep it inside your boundary.
59
+ *
60
+ * @example
61
+ * ```tsx
62
+ * <Image src="/hero.jpg" alt="Team at work" aspectRatio={16 / 9} rounded="lg" />
63
+ * <Image src={avatarUrl} alt="Jane Doe" width={48} height={48} rounded="full" />
64
+ * <Image src={maybeBroken} alt="Product" aspectRatio={1} fallback={<MyPlaceholder />} />
65
+ * ```
66
+ */
67
+ export interface ImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'className'> {
68
+ /** Image source URL. Same-origin / data: keeps it inside your boundary; an external host is egress. */
69
+ src: string;
70
+ /**
71
+ * Alternative text (accessibility). Describe what the image conveys;
72
+ * use `alt=""` for purely decorative images so assistive tech skips it.
73
+ */
74
+ alt: string;
75
+ /**
76
+ * Locks the box shape before load to prevent layout shift — a number
77
+ * (`16 / 9`, `1`) or a CSS `aspect-ratio` string (`'16 / 9'`). When
78
+ * set, the image fills the box via `object-fit`.
79
+ */
80
+ aspectRatio?: number | string;
81
+ /**
82
+ * How the image fills its box — CSS `object-fit`.
83
+ * @default 'cover'
84
+ */
85
+ fit?: ImageVariants['fit'];
86
+ /**
87
+ * Corner radius token, clipped via `overflow-hidden`.
88
+ * @default 'none'
89
+ */
90
+ rounded?: ImageVariants['rounded'];
91
+ /**
92
+ * Native lazy/eager loading. Lazy defers off-screen images.
93
+ * @default 'lazy'
94
+ */
95
+ loading?: 'lazy' | 'eager';
96
+ /**
97
+ * Show a `<Skeleton>` while the image loads. Requires a reserved box
98
+ * (`aspectRatio`, or both `width` and `height`) — without one there
99
+ * is no space to paint it, so it is skipped.
100
+ * @default true
101
+ */
102
+ showSkeleton?: boolean;
103
+ /**
104
+ * Content shown when the image fails to load. Defaults to a muted
105
+ * surface with a broken-image glyph.
106
+ */
107
+ fallback?: ReactNode;
108
+ /**
109
+ * RBAC access requirement. When the current user is unauthorized:
110
+ * `onUnauthorized: 'hide'` → the image does not render; `'disable'` /
111
+ * `'readonly'` → it renders dimmed and non-interactive (an image has no
112
+ * true disabled state). Resolved against the nearest `RbacProvider`.
113
+ */
114
+ access?: AccessRequirement;
115
+ /**
116
+ * Reactive visibility predicate evaluated against the form engine — the
117
+ * image renders only when it returns `true` (e.g. show a preview once a
118
+ * file field has a value). No-op outside a `<DashForm>`.
119
+ */
120
+ visibleWhen?: (engine: Engine) => boolean;
121
+ /** Root-level Tailwind override (wins via `tailwind-merge`). */
122
+ sx?: string;
123
+ /** Per-slot overrides. */
124
+ slotProps?: ImageSlotProps;
125
+ }
126
+ //# sourceMappingURL=image.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Image/image.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,aAAa,EAAE,KAAK,GAAG,SAAS,CAAC,CAAC;AAEvE,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,mBAAmB;QAC3B,KAAK,CAAC,EAAE;YACN,QAAQ,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;YACtC,SAAS,CAAC,EAAE,cAAc,CAAC;SAC5B,CAAC;KACH;CACF;AAED,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9B,gCAAgC;IAChC,GAAG,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7B,yCAAyC;IACzC,QAAQ,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClC,uCAAuC;IACvC,QAAQ,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,WAAW,CAAC;IAC9E,uGAAuG;IACvG,GAAG,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE9B;;;OAGG;IACH,GAAG,CAAC,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;IAE3B;;;OAGG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IAEnC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAE3B;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAE3B;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IAE1C,gEAAgE;IAChE,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,0BAA0B;IAC1B,SAAS,CAAC,EAAE,cAAc,CAAC;CAC5B"}
@@ -0,0 +1,149 @@
1
+ import { type VariantProps } from 'tailwind-variants';
2
+ /**
3
+ * `<Image>` variant recipe.
4
+ *
5
+ * Slots:
6
+ * - `root` — positioned wrapper. Holds the `<img>` plus the
7
+ * loading skeleton / error-fallback overlays, and owns
8
+ * the corner radius + overflow clipping. `relative` so
9
+ * the overlays can be `absolute inset-0`.
10
+ * - `img` — the `<img>` element. `object-*` (the `fit` axis)
11
+ * lives here; `block w-full h-full` so it fills the
12
+ * reserved box when an aspect ratio / dimensions are
13
+ * given.
14
+ * - `skeleton` — the loading placeholder overlay (a `<Skeleton>`
15
+ * stretched over the reserved box).
16
+ * - `fallback` — the broken-image overlay shown after `onError`.
17
+ *
18
+ * Variant axes:
19
+ * - `fit` — CSS `object-fit`. `cover` (default) crops to fill,
20
+ * `contain` letterboxes, etc.
21
+ * - `rounded` — corner radius token, applied to `root` (which clips
22
+ * the image via `overflow-hidden`).
23
+ *
24
+ * Neutral fallback surface auto-inverts through the dashforge preset's
25
+ * CSS-variable layer (no explicit `dark:`).
26
+ */
27
+ export declare const imageVariants: import("tailwind-variants").TVReturnType<{
28
+ fit: {
29
+ cover: {
30
+ img: string;
31
+ };
32
+ contain: {
33
+ img: string;
34
+ };
35
+ fill: {
36
+ img: string;
37
+ };
38
+ none: {
39
+ img: string;
40
+ };
41
+ 'scale-down': {
42
+ img: string;
43
+ };
44
+ };
45
+ rounded: {
46
+ none: {
47
+ root: string;
48
+ };
49
+ sm: {
50
+ root: string;
51
+ };
52
+ md: {
53
+ root: string;
54
+ };
55
+ lg: {
56
+ root: string;
57
+ };
58
+ full: {
59
+ root: string;
60
+ };
61
+ };
62
+ }, {
63
+ root: string[];
64
+ img: string[];
65
+ skeleton: string[];
66
+ fallback: string[];
67
+ }, undefined, {
68
+ fit: {
69
+ cover: {
70
+ img: string;
71
+ };
72
+ contain: {
73
+ img: string;
74
+ };
75
+ fill: {
76
+ img: string;
77
+ };
78
+ none: {
79
+ img: string;
80
+ };
81
+ 'scale-down': {
82
+ img: string;
83
+ };
84
+ };
85
+ rounded: {
86
+ none: {
87
+ root: string;
88
+ };
89
+ sm: {
90
+ root: string;
91
+ };
92
+ md: {
93
+ root: string;
94
+ };
95
+ lg: {
96
+ root: string;
97
+ };
98
+ full: {
99
+ root: string;
100
+ };
101
+ };
102
+ }, {
103
+ root: string[];
104
+ img: string[];
105
+ skeleton: string[];
106
+ fallback: string[];
107
+ }, import("tailwind-variants").TVReturnType<{
108
+ fit: {
109
+ cover: {
110
+ img: string;
111
+ };
112
+ contain: {
113
+ img: string;
114
+ };
115
+ fill: {
116
+ img: string;
117
+ };
118
+ none: {
119
+ img: string;
120
+ };
121
+ 'scale-down': {
122
+ img: string;
123
+ };
124
+ };
125
+ rounded: {
126
+ none: {
127
+ root: string;
128
+ };
129
+ sm: {
130
+ root: string;
131
+ };
132
+ md: {
133
+ root: string;
134
+ };
135
+ lg: {
136
+ root: string;
137
+ };
138
+ full: {
139
+ root: string;
140
+ };
141
+ };
142
+ }, {
143
+ root: string[];
144
+ img: string[];
145
+ skeleton: string[];
146
+ fallback: string[];
147
+ }, undefined, unknown, unknown, undefined>>;
148
+ export type ImageVariants = VariantProps<typeof imageVariants>;
149
+ //# sourceMappingURL=image.variants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.variants.d.ts","sourceRoot":"","sources":["../../../../src/components/Image/image.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAoCxB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -191,6 +191,11 @@ interface SliderCommonProps {
191
191
  * `defaultValue` are `number`; `onChange` / `onCommit` receive `number`.
192
192
  */
193
193
  export interface SliderSingleProps extends SliderCommonProps {
194
+ /**
195
+ * Discriminator — omit or set `false` for single-value mode. Selects
196
+ * the `number` value/callback shapes over the range tuple.
197
+ * @default false
198
+ */
194
199
  range?: false;
195
200
  /** Controlled value. */
196
201
  value?: number;
@@ -206,6 +211,7 @@ export interface SliderSingleProps extends SliderCommonProps {
206
211
  * what writes to the form bridge — matches MUI / Ant defaults.
207
212
  */
208
213
  onCommit?: (value: number) => void;
214
+ /** Fires when the thumb loses focus (after a commit). */
209
215
  onBlur?: () => void;
210
216
  }
211
217
  /**
@@ -213,6 +219,10 @@ export interface SliderSingleProps extends SliderCommonProps {
213
219
  * `[number, number]`; `onChange` / `onCommit` receive the tuple.
214
220
  */
215
221
  export interface SliderRangeProps extends SliderCommonProps {
222
+ /**
223
+ * Discriminator — set `true` for range mode. Selects the
224
+ * `[number, number]` tuple value/callback shapes over the single number.
225
+ */
216
226
  range: true;
217
227
  /** Controlled `[min, max]` tuple. */
218
228
  value?: readonly [number, number];
@@ -222,6 +232,7 @@ export interface SliderRangeProps extends SliderCommonProps {
222
232
  onChange?: (value: readonly [number, number]) => void;
223
233
  /** Drag-end / keyboard-step callback. Writes to the bridge. */
224
234
  onCommit?: (value: readonly [number, number]) => void;
235
+ /** Fires when a thumb loses focus (after a commit). */
225
236
  onBlur?: () => void;
226
237
  }
227
238
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"slider.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Slider/slider.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE7D;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,cAAc,EACd,MAAM,GAAG,QAAQ,GAAG,OA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M,CAAC,CAAC;IACzC,iCAAiC;IACjC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IACtD,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IACtD,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,MAAM,WAAW,GAAG,iBAAiB,GAAG,gBAAgB,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { VideoProps } from './video.types.js';
2
+ /**
3
+ * Dashforge TW `<Video>` — the moving-image twin of `<Image>`. A
4
+ * declarative, robust wrapper over the native `<video>`. Zero eval, no
5
+ * data fetching: it renders a URL you give it and adds what a bare
6
+ * `<video>` lacks.
7
+ *
8
+ * 1. **No layout shift** — pass `aspectRatio` (or `width` + `height`)
9
+ * and the box is reserved before the video loads.
10
+ * 2. **Loading skeleton** — a `<Skeleton>` fills the reserved box
11
+ * while the first frame loads; skipped when a `poster` is given
12
+ * and for already-buffered video (no flash).
13
+ * 3. **Graceful error** — on load failure a muted fallback replaces
14
+ * the player (`fallback` to customise).
15
+ *
16
+ * Controls on by default. Any native `<video>` attribute not named here
17
+ * (`autoPlay`, `loop`, `muted`, `playsInline`, `crossOrigin`, …) is
18
+ * forwarded; pass `<source>` children for multi-format delivery. The
19
+ * ref points at the `<video>`.
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * <Video src="/demo.mp4" poster="/demo.jpg" aspectRatio={16 / 9} rounded="lg" />
24
+ * <Video src="/loop.webm" aspectRatio={1} autoPlay loop muted playsInline controls={false} />
25
+ * ```
26
+ */
27
+ export declare const Video: import("react").ForwardRefExoticComponent<VideoProps & import("react").RefAttributes<HTMLVideoElement>>;
28
+ //# sourceMappingURL=Video.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Video.d.ts","sourceRoot":"","sources":["../../../../src/components/Video/Video.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA6BnD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,KAAK,yGAoJjB,CAAC"}
@@ -0,0 +1,132 @@
1
+ import type { VideoHTMLAttributes, ReactNode } from 'react';
2
+ import type { AccessRequirement } from '@dashforge/rbac';
3
+ import type { Engine } from '@dashforge/ui-core';
4
+ import type { VideoVariants } from './video.variants.js';
5
+ /**
6
+ * Subset of `<Video>` props theme-configurable via
7
+ * `theme.components.Video.defaults` (Option C).
8
+ */
9
+ export type VideoVariantProps = Pick<VideoVariants, 'fit' | 'rounded'>;
10
+ declare module '@dashforge/tw-tokens' {
11
+ interface TWComponentDefaults {
12
+ Video?: {
13
+ defaults?: Partial<VideoVariantProps>;
14
+ slotProps?: VideoSlotProps;
15
+ };
16
+ }
17
+ }
18
+ export interface VideoSlotProps {
19
+ /** Wrapper element override. */
20
+ root?: {
21
+ className?: string;
22
+ };
23
+ /** `<video>` element override. */
24
+ video?: {
25
+ className?: string;
26
+ };
27
+ /** Loading-skeleton overlay override. */
28
+ skeleton?: {
29
+ className?: string;
30
+ };
31
+ /** Error-fallback overlay override. */
32
+ fallback?: {
33
+ className?: string;
34
+ };
35
+ }
36
+ /**
37
+ * Props for `<Video>` — the moving-image twin of `<Image>`.
38
+ *
39
+ * A thin, declarative wrapper over the native `<video>` — zero eval, no
40
+ * data fetching — with the robustness a bare `<video>` lacks:
41
+ *
42
+ * 1. **No layout shift.** Give `aspectRatio` (or `width` + `height`)
43
+ * and the box is reserved before the video loads (CSS
44
+ * `aspect-ratio`, no JS measurement).
45
+ * 2. **Loading skeleton.** While the first frame loads, a `<Skeleton>`
46
+ * fills the reserved box. Skipped when a `poster` is given (the
47
+ * poster is its own loading visual) and for already-buffered video.
48
+ * 3. **Graceful error.** On load failure a muted fallback replaces the
49
+ * player — pass your own via `fallback`.
50
+ * 4. **Controls on by default** (`controls`).
51
+ *
52
+ * Any native `<video>` attribute not listed here (`crossOrigin`,
53
+ * `disablePictureInPicture`, `controlsList`, …) is forwarded to the
54
+ * underlying element. For multi-format delivery, pass `<source>`
55
+ * elements as `children` instead of `src`.
56
+ *
57
+ * Note on privacy: an external `src` is fetched by the browser from
58
+ * that host (egress). Self-host the asset (same-origin / your CDN) to
59
+ * keep it inside your boundary. Autoplay requires `muted` in most
60
+ * browsers.
61
+ *
62
+ * @example
63
+ * ```tsx
64
+ * <Video src="/demo.mp4" poster="/demo.jpg" aspectRatio={16 / 9} rounded="lg" />
65
+ * <Video src="/loop.webm" aspectRatio={1} autoPlay loop muted playsInline controls={false} />
66
+ * ```
67
+ */
68
+ export interface VideoProps extends Omit<VideoHTMLAttributes<HTMLVideoElement>, 'src' | 'className' | 'poster'> {
69
+ /** Video source URL. Same-origin / data: keeps it inside your boundary; an external host is egress. Omit and pass `<source>` children for multi-format delivery. */
70
+ src?: string;
71
+ /**
72
+ * Poster image URL shown before playback / while the first frame
73
+ * loads. Doubles as the anti-layout-shift and loading visual.
74
+ */
75
+ poster?: string;
76
+ /**
77
+ * Locks the box shape before load to prevent layout shift — a number
78
+ * (`16 / 9`, `1`) or a CSS `aspect-ratio` string (`'16 / 9'`). When
79
+ * set, the video fills the box via `object-fit`.
80
+ */
81
+ aspectRatio?: number | string;
82
+ /**
83
+ * How the video fills its box — CSS `object-fit`.
84
+ * @default 'cover'
85
+ */
86
+ fit?: VideoVariants['fit'];
87
+ /**
88
+ * Corner radius token, clipped via `overflow-hidden`.
89
+ * @default 'none'
90
+ */
91
+ rounded?: VideoVariants['rounded'];
92
+ /**
93
+ * Show the native player controls.
94
+ * @default true
95
+ */
96
+ controls?: boolean;
97
+ /**
98
+ * How much to preload. `'metadata'` fetches dimensions/duration only.
99
+ * @default 'metadata'
100
+ */
101
+ preload?: 'none' | 'metadata' | 'auto';
102
+ /**
103
+ * Show a `<Skeleton>` while the first frame loads. Requires a reserved
104
+ * box (`aspectRatio`, or both `width` and `height`) and no `poster`
105
+ * (the poster is its own loading visual), else it is skipped.
106
+ * @default true
107
+ */
108
+ showSkeleton?: boolean;
109
+ /**
110
+ * Content shown when the video fails to load. Defaults to a muted
111
+ * surface with a broken-media glyph.
112
+ */
113
+ fallback?: ReactNode;
114
+ /**
115
+ * RBAC access requirement. When the current user is unauthorized:
116
+ * `onUnauthorized: 'hide'` → the video does not render; `'disable'` /
117
+ * `'readonly'` → it renders dimmed and non-interactive (a video has no
118
+ * true disabled state). Resolved against the nearest `RbacProvider`.
119
+ */
120
+ access?: AccessRequirement;
121
+ /**
122
+ * Reactive visibility predicate evaluated against the form engine — the
123
+ * video renders only when it returns `true`. No-op outside a
124
+ * `<DashForm>`.
125
+ */
126
+ visibleWhen?: (engine: Engine) => boolean;
127
+ /** Root-level Tailwind override (wins via `tailwind-merge`). */
128
+ sx?: string;
129
+ /** Per-slot overrides. */
130
+ slotProps?: VideoSlotProps;
131
+ }
132
+ //# sourceMappingURL=video.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Video/video.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,aAAa,EAAE,KAAK,GAAG,SAAS,CAAC,CAAC;AAEvE,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,mBAAmB;QAC3B,KAAK,CAAC,EAAE;YACN,Q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