@krizaka/ui 2.3.0 → 2.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.
- package/README.md +16 -1
- package/dist/audio-player.d.ts +113 -0
- package/dist/audio-player.js +207 -0
- package/dist/audio-player.js.map +1 -0
- package/dist/chunk-2USC2YT6.js +17 -0
- package/dist/chunk-2USC2YT6.js.map +1 -0
- package/dist/chunk-EUPTXKH7.js +95 -0
- package/dist/chunk-EUPTXKH7.js.map +1 -0
- package/dist/chunk-RUPRYJ45.js +82 -0
- package/dist/chunk-RUPRYJ45.js.map +1 -0
- package/dist/chunk-XUMJA5ZI.js +283 -0
- package/dist/chunk-XUMJA5ZI.js.map +1 -0
- package/dist/chunk-YH4LMWRU.js +92 -0
- package/dist/chunk-YH4LMWRU.js.map +1 -0
- package/dist/chunk-YX6CNVJA.js +94 -0
- package/dist/chunk-YX6CNVJA.js.map +1 -0
- package/dist/chunk-ZIXB33X7.js +95 -0
- package/dist/chunk-ZIXB33X7.js.map +1 -0
- package/dist/combobox.d.ts +188 -0
- package/dist/combobox.js +16 -0
- package/dist/combobox.js.map +1 -0
- package/dist/data-table.d.ts +246 -0
- package/dist/data-table.js +290 -0
- package/dist/data-table.js.map +1 -0
- package/dist/date-picker.d.ts +288 -0
- package/dist/date-picker.js +364 -0
- package/dist/date-picker.js.map +1 -0
- package/dist/file-upload.d.ts +238 -0
- package/dist/file-upload.js +437 -0
- package/dist/file-upload.js.map +1 -0
- package/dist/filter-bar.d.ts +139 -0
- package/dist/filter-bar.js +155 -0
- package/dist/filter-bar.js.map +1 -0
- package/dist/image-cropper.d.ts +115 -0
- package/dist/image-cropper.js +166 -0
- package/dist/image-cropper.js.map +1 -0
- package/dist/index.js.map +1 -1
- package/dist/media-capture.d.ts +155 -0
- package/dist/media-capture.js +242 -0
- package/dist/media-capture.js.map +1 -0
- package/dist/native/media-capture.d.ts +49 -0
- package/dist/native/media-capture.js +113 -0
- package/dist/native/media-capture.js.map +1 -0
- package/dist/native/video-player.d.ts +50 -0
- package/dist/native/video-player.js +69 -0
- package/dist/native/video-player.js.map +1 -0
- package/dist/native.d.ts +66 -2
- package/dist/native.js +166 -68
- package/dist/native.js.map +1 -1
- package/dist/pagination.d.ts +141 -0
- package/dist/pagination.js +165 -0
- package/dist/pagination.js.map +1 -0
- package/dist/search-field.d.ts +100 -0
- package/dist/search-field.js +167 -0
- package/dist/search-field.js.map +1 -0
- package/dist/tag-input.d.ts +44 -0
- package/dist/tag-input.js +67 -0
- package/dist/tag-input.js.map +1 -0
- package/dist/video-player.d.ts +204 -0
- package/dist/video-player.js +371 -0
- package/dist/video-player.js.map +1 -0
- package/dist/video-trimmer.d.ts +142 -0
- package/dist/video-trimmer.js +193 -0
- package/dist/video-trimmer.js.map +1 -0
- package/package.json +232 -4
- package/registry/alert.json +1 -1
- package/registry/audio-player.json +282 -0
- package/registry/avatar.json +1 -1
- package/registry/badge.json +1 -1
- package/registry/button.json +1 -1
- package/registry/card.json +1 -1
- package/registry/checkbox.json +1 -1
- package/registry/chip-link.json +1 -1
- package/registry/chip.json +1 -1
- package/registry/combobox.json +475 -0
- package/registry/command.json +1 -1
- package/registry/confirm-button.json +1 -1
- package/registry/countdown.json +1 -1
- package/registry/data-table.json +500 -0
- package/registry/date-picker.json +978 -0
- package/registry/dialog.json +1 -1
- package/registry/dropdown-menu.json +1 -1
- package/registry/empty-state.json +1 -1
- package/registry/examples/audio-player/podcast.d.ts +4 -0
- package/registry/examples/audio-player/podcast.js +22 -0
- package/registry/examples/audio-player/podcast.tsx +19 -0
- package/registry/examples/audio-player/voice-note.d.ts +4 -0
- package/registry/examples/audio-player/voice-note.js +12 -0
- package/registry/examples/audio-player/voice-note.tsx +12 -0
- package/registry/examples/combobox/async.d.ts +4 -0
- package/registry/examples/combobox/async.js +23 -0
- package/registry/examples/combobox/async.tsx +22 -0
- package/registry/examples/combobox/creatable.d.ts +4 -0
- package/registry/examples/combobox/creatable.js +32 -0
- package/registry/examples/combobox/creatable.tsx +28 -0
- package/registry/examples/combobox/invalid.d.ts +4 -0
- package/registry/examples/combobox/invalid.js +23 -0
- package/registry/examples/combobox/invalid.tsx +17 -0
- package/registry/examples/combobox/multiple.d.ts +4 -0
- package/registry/examples/combobox/multiple.js +29 -0
- package/registry/examples/combobox/multiple.tsx +26 -0
- package/registry/examples/data-table/cards.d.ts +4 -0
- package/registry/examples/data-table/cards.js +21 -0
- package/registry/examples/data-table/cards.tsx +20 -0
- package/registry/examples/data-table/empty.d.ts +4 -0
- package/registry/examples/data-table/empty.js +26 -0
- package/registry/examples/data-table/empty.tsx +21 -0
- package/registry/examples/data-table/error.d.ts +4 -0
- package/registry/examples/data-table/error.js +28 -0
- package/registry/examples/data-table/error.tsx +29 -0
- package/registry/examples/data-table/jobs.d.ts +4 -0
- package/registry/examples/data-table/jobs.js +37 -0
- package/registry/examples/data-table/jobs.tsx +36 -0
- package/registry/examples/data-table/loading.d.ts +4 -0
- package/registry/examples/data-table/loading.js +16 -0
- package/registry/examples/data-table/loading.tsx +12 -0
- package/registry/examples/data-table/virtualized.d.ts +4 -0
- package/registry/examples/data-table/virtualized.js +21 -0
- package/registry/examples/data-table/virtualized.tsx +20 -0
- package/registry/examples/date-picker/calendar.d.ts +4 -0
- package/registry/examples/date-picker/calendar.js +14 -0
- package/registry/examples/date-picker/calendar.tsx +16 -0
- package/registry/examples/date-picker/french.d.ts +4 -0
- package/registry/examples/date-picker/french.js +20 -0
- package/registry/examples/date-picker/french.tsx +14 -0
- package/registry/examples/date-picker/open.d.ts +4 -0
- package/registry/examples/date-picker/open.js +11 -0
- package/registry/examples/date-picker/open.tsx +8 -0
- package/registry/examples/date-picker/range.d.ts +4 -0
- package/registry/examples/date-picker/range.js +29 -0
- package/registry/examples/date-picker/range.tsx +25 -0
- package/registry/examples/date-picker/schedule.d.ts +4 -0
- package/registry/examples/date-picker/schedule.js +26 -0
- package/registry/examples/date-picker/schedule.tsx +22 -0
- package/registry/examples/file-upload/images.d.ts +4 -0
- package/registry/examples/file-upload/images.js +32 -0
- package/registry/examples/file-upload/images.tsx +25 -0
- package/registry/examples/file-upload/states.d.ts +4 -0
- package/registry/examples/file-upload/states.js +28 -0
- package/registry/examples/file-upload/states.tsx +23 -0
- package/registry/examples/file-upload/tus.d.ts +4 -0
- package/registry/examples/file-upload/tus.js +23 -0
- package/registry/examples/file-upload/tus.tsx +26 -0
- package/registry/examples/file-upload/video.d.ts +4 -0
- package/registry/examples/file-upload/video.js +39 -0
- package/registry/examples/file-upload/video.tsx +36 -0
- package/registry/examples/filter-bar/address.d.ts +4 -0
- package/registry/examples/filter-bar/address.js +29 -0
- package/registry/examples/filter-bar/address.tsx +27 -0
- package/registry/examples/filter-bar/jobs.d.ts +4 -0
- package/registry/examples/filter-bar/jobs.js +37 -0
- package/registry/examples/filter-bar/jobs.tsx +37 -0
- package/registry/examples/filter-bar/menu.d.ts +4 -0
- package/registry/examples/filter-bar/menu.js +27 -0
- package/registry/examples/filter-bar/menu.tsx +23 -0
- package/registry/examples/image-cropper/avatar.d.ts +4 -0
- package/registry/examples/image-cropper/avatar.js +13 -0
- package/registry/examples/image-cropper/avatar.tsx +14 -0
- package/registry/examples/image-cropper/banner.d.ts +4 -0
- package/registry/examples/image-cropper/banner.js +11 -0
- package/registry/examples/image-cropper/banner.tsx +10 -0
- package/registry/examples/image-cropper/vertical-video.d.ts +4 -0
- package/registry/examples/image-cropper/vertical-video.js +12 -0
- package/registry/examples/image-cropper/vertical-video.tsx +16 -0
- package/registry/examples/media-capture/clip.d.ts +4 -0
- package/registry/examples/media-capture/clip.js +20 -0
- package/registry/examples/media-capture/clip.tsx +18 -0
- package/registry/examples/media-capture/native/photo.d.ts +4 -0
- package/registry/examples/media-capture/native/photo.dark.png +0 -0
- package/registry/examples/media-capture/native/photo.js +27 -0
- package/registry/examples/media-capture/native/photo.light.png +0 -0
- package/registry/examples/media-capture/native/photo.tsx +20 -0
- package/registry/examples/media-capture/profile-photo.d.ts +4 -0
- package/registry/examples/media-capture/profile-photo.js +24 -0
- package/registry/examples/media-capture/profile-photo.tsx +20 -0
- package/registry/examples/pagination/cursor.d.ts +4 -0
- package/registry/examples/pagination/cursor.js +24 -0
- package/registry/examples/pagination/cursor.tsx +20 -0
- package/registry/examples/pagination/links.d.ts +4 -0
- package/registry/examples/pagination/links.js +11 -0
- package/registry/examples/pagination/links.tsx +6 -0
- package/registry/examples/pagination/native/cursor.d.ts +4 -0
- package/registry/examples/pagination/native/cursor.dark.png +0 -0
- package/registry/examples/pagination/native/cursor.js +19 -0
- package/registry/examples/pagination/native/cursor.light.png +0 -0
- package/registry/examples/pagination/native/cursor.tsx +13 -0
- package/registry/examples/pagination/native/pages.d.ts +4 -0
- package/registry/examples/pagination/native/pages.dark.png +0 -0
- package/registry/examples/pagination/native/pages.js +21 -0
- package/registry/examples/pagination/native/pages.light.png +0 -0
- package/registry/examples/pagination/native/pages.tsx +14 -0
- package/registry/examples/pagination/results.d.ts +4 -0
- package/registry/examples/pagination/results.js +23 -0
- package/registry/examples/pagination/results.tsx +19 -0
- package/registry/examples/pagination/table-footer.d.ts +4 -0
- package/registry/examples/pagination/table-footer.js +31 -0
- package/registry/examples/pagination/table-footer.tsx +27 -0
- package/registry/examples/search-field/global.d.ts +4 -0
- package/registry/examples/search-field/global.js +19 -0
- package/registry/examples/search-field/global.tsx +15 -0
- package/registry/examples/search-field/native/default.d.ts +4 -0
- package/registry/examples/search-field/native/default.dark.png +0 -0
- package/registry/examples/search-field/native/default.js +13 -0
- package/registry/examples/search-field/native/default.light.png +0 -0
- package/registry/examples/search-field/native/default.tsx +7 -0
- package/registry/examples/search-field/suggestions.d.ts +4 -0
- package/registry/examples/search-field/suggestions.js +30 -0
- package/registry/examples/search-field/suggestions.tsx +27 -0
- package/registry/examples/search-field/toolbar.d.ts +4 -0
- package/registry/examples/search-field/toolbar.js +17 -0
- package/registry/examples/search-field/toolbar.tsx +21 -0
- package/registry/examples/tag-input/recipients.d.ts +4 -0
- package/registry/examples/tag-input/recipients.js +23 -0
- package/registry/examples/tag-input/recipients.tsx +20 -0
- package/registry/examples/tag-input/video-tags.d.ts +4 -0
- package/registry/examples/tag-input/video-tags.js +26 -0
- package/registry/examples/tag-input/video-tags.tsx +22 -0
- package/registry/examples/video-player/default.d.ts +4 -0
- package/registry/examples/video-player/default.js +12 -0
- package/registry/examples/video-player/default.tsx +8 -0
- package/registry/examples/video-player/gated.d.ts +4 -0
- package/registry/examples/video-player/gated.js +26 -0
- package/registry/examples/video-player/gated.tsx +23 -0
- package/registry/examples/video-player/native/default.d.ts +4 -0
- package/registry/examples/video-player/native/default.dark.png +0 -0
- package/registry/examples/video-player/native/default.js +18 -0
- package/registry/examples/video-player/native/default.light.png +0 -0
- package/registry/examples/video-player/native/default.tsx +12 -0
- package/registry/examples/video-player/signed-source.d.ts +4 -0
- package/registry/examples/video-player/signed-source.js +16 -0
- package/registry/examples/video-player/signed-source.tsx +15 -0
- package/registry/examples/video-player/vertical.d.ts +4 -0
- package/registry/examples/video-player/vertical.js +12 -0
- package/registry/examples/video-player/vertical.tsx +12 -0
- package/registry/examples/video-trimmer/custom.d.ts +4 -0
- package/registry/examples/video-trimmer/custom.js +24 -0
- package/registry/examples/video-trimmer/custom.tsx +26 -0
- package/registry/examples/video-trimmer/filmstrip.d.ts +4 -0
- package/registry/examples/video-trimmer/filmstrip.js +15 -0
- package/registry/examples/video-trimmer/filmstrip.tsx +13 -0
- package/registry/examples/video-trimmer/playhead.d.ts +4 -0
- package/registry/examples/video-trimmer/playhead.js +15 -0
- package/registry/examples/video-trimmer/playhead.tsx +13 -0
- package/registry/field.json +1 -1
- package/registry/file-upload.json +471 -0
- package/registry/filter-bar.json +347 -0
- package/registry/glow-card.json +1 -1
- package/registry/image-cropper.json +313 -0
- package/registry/index.json +255 -1
- package/registry/iso.json +1 -1
- package/registry/kbd.json +1 -1
- package/registry/loader.json +1 -1
- package/registry/marquee.json +1 -1
- package/registry/mascots.json +1 -1
- package/registry/media-capture.json +347 -0
- package/registry/meter.json +3 -3
- package/registry/nav-bar.json +1 -1
- package/registry/number-ticker.json +1 -1
- package/registry/page-header.json +1 -1
- package/registry/pagination.json +475 -0
- package/registry/popover.json +1 -1
- package/registry/progress.json +5 -5
- package/registry/radio-group.json +1 -1
- package/registry/search-field.json +436 -0
- package/registry/section-backdrop.json +1 -1
- package/registry/separator.json +1 -1
- package/registry/skeleton.json +1 -1
- package/registry/slider.json +1 -1
- package/registry/slot.json +1 -1
- package/registry/spinner.json +1 -1
- package/registry/stat.json +1 -1
- package/registry/stepper.json +1 -1
- package/registry/switch.json +1 -1
- package/registry/tabs.json +1 -1
- package/registry/tag-input.json +363 -0
- package/registry/theme.json +1 -1
- package/registry/toast.json +1 -1
- package/registry/tooltip.json +1 -1
- package/registry/video-player.json +598 -0
- package/registry/video-trimmer.json +385 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ComboboxLabels } from './combobox.js';
|
|
3
|
+
import 'tailwind-variants';
|
|
4
|
+
|
|
5
|
+
type TagInputProps = {
|
|
6
|
+
/** The visible label, passed translated (also the accessible name). */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Hides the label visually, keeping it as the accessible name. */
|
|
9
|
+
hideLabel?: boolean;
|
|
10
|
+
/** The tags (controlled). */
|
|
11
|
+
value?: readonly string[];
|
|
12
|
+
/** The tags at first, uncontrolled. */
|
|
13
|
+
defaultValue?: readonly string[];
|
|
14
|
+
/** Called with every tag after a change. */
|
|
15
|
+
onValueChange?: (tags: string[]) => void;
|
|
16
|
+
/** Words offered as the person types (their own history, a curated list). */
|
|
17
|
+
suggestions?: readonly string[];
|
|
18
|
+
/** Cleans a word before it is added (`(t) => t.toLowerCase().replace(/^#/, "")`). An empty result is ignored. */
|
|
19
|
+
normalize?: (tag: string) => string;
|
|
20
|
+
/** Refuses a word: return the reason (passed translated), shown and read as the field's error; `null` accepts it. */
|
|
21
|
+
validate?: (tag: string, tags: readonly string[]) => string | null;
|
|
22
|
+
/** Most tags; the field stops offering more past it. */
|
|
23
|
+
max?: number;
|
|
24
|
+
/** Keys that add the word, besides Enter. Default `[","]`. */
|
|
25
|
+
separators?: readonly string[];
|
|
26
|
+
/** The input's placeholder, passed translated. */
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
/** A help text under the field ("Up to 10 tags, separated by commas"). */
|
|
29
|
+
hint?: string;
|
|
30
|
+
/** An error from the app (a server refusal); `validate`'s own errors show here too. */
|
|
31
|
+
error?: string;
|
|
32
|
+
/** Not available. */
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/** The name of the hidden inputs, for a plain `<form>` post (one per tag). */
|
|
35
|
+
name?: string;
|
|
36
|
+
/** The words of the field, passed translated; English by default. */
|
|
37
|
+
labels?: Partial<Pick<ComboboxLabels, "create" | "remove" | "empty" | "results" | "toggle">>;
|
|
38
|
+
/** Classes merged on the root. */
|
|
39
|
+
className?: string;
|
|
40
|
+
};
|
|
41
|
+
/** Words as removable chips — tags, keywords, e-mail recipients — with suggestions, cleaning and validation. */
|
|
42
|
+
declare function TagInput({ value, defaultValue, onValueChange, suggestions, normalize, validate, max, separators, error, labels, ...props }: TagInputProps): React.JSX.Element;
|
|
43
|
+
|
|
44
|
+
export { TagInput, type TagInputProps };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
Combobox
|
|
4
|
+
} from "./chunk-XUMJA5ZI.js";
|
|
5
|
+
import "./chunk-YH4LMWRU.js";
|
|
6
|
+
import "./chunk-ZIXB33X7.js";
|
|
7
|
+
import {
|
|
8
|
+
useControllable
|
|
9
|
+
} from "./chunk-EUPTXKH7.js";
|
|
10
|
+
import "./chunk-YX6CNVJA.js";
|
|
11
|
+
|
|
12
|
+
// src/tag-input/tag-input.tsx
|
|
13
|
+
import * as React from "react";
|
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
|
15
|
+
var toOption = (tag) => ({ value: tag, label: tag });
|
|
16
|
+
function TagInput({
|
|
17
|
+
value,
|
|
18
|
+
defaultValue = [],
|
|
19
|
+
onValueChange,
|
|
20
|
+
suggestions = [],
|
|
21
|
+
normalize = (tag) => tag.trim(),
|
|
22
|
+
validate,
|
|
23
|
+
max,
|
|
24
|
+
separators = [","],
|
|
25
|
+
error,
|
|
26
|
+
labels,
|
|
27
|
+
...props
|
|
28
|
+
}) {
|
|
29
|
+
const [tags, setTags] = useControllable(value, defaultValue, onValueChange);
|
|
30
|
+
const [refusal, setRefusal] = React.useState(null);
|
|
31
|
+
const change = (options) => {
|
|
32
|
+
const next = [];
|
|
33
|
+
for (const option of options) {
|
|
34
|
+
const tag = normalize(option.value);
|
|
35
|
+
if (!tag || next.includes(tag)) continue;
|
|
36
|
+
if (!tags.includes(tag)) {
|
|
37
|
+
const reason = validate?.(tag, next) ?? null;
|
|
38
|
+
if (reason) {
|
|
39
|
+
setRefusal(reason);
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
next.push(tag);
|
|
44
|
+
}
|
|
45
|
+
if (next.length >= options.length || options.length < tags.length) setRefusal(null);
|
|
46
|
+
setTags(next);
|
|
47
|
+
};
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
|
+
Combobox,
|
|
50
|
+
{
|
|
51
|
+
...props,
|
|
52
|
+
multiple: true,
|
|
53
|
+
creatable: true,
|
|
54
|
+
separators,
|
|
55
|
+
maxSelected: max,
|
|
56
|
+
value: tags.map(toOption),
|
|
57
|
+
onValueChange: change,
|
|
58
|
+
options: suggestions.map(toOption),
|
|
59
|
+
error: refusal ?? error,
|
|
60
|
+
labels: { empty: "", results: () => "", ...labels }
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
export {
|
|
65
|
+
TagInput
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=tag-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tag-input/tag-input.tsx"],"sourcesContent":["// Client. Free words as chips — the multiple, creatable `Combobox` on strings: Enter or a separator adds the word,\n// a paste of \"a, b, c\" adds three, Backspace on an empty input removes the last, suggestions complete as you type.\n// `normalize` cleans a word (lower case, no `#`), `validate` refuses one with a reason read aloud.\nimport * as React from \"react\";\n\nimport { Combobox, type ComboboxLabels, type ComboboxOption } from \"../combobox\";\nimport { useControllable } from \"../media\";\n\nexport type TagInputProps = {\n /** The visible label, passed translated (also the accessible name). */\n label: string;\n /** Hides the label visually, keeping it as the accessible name. */\n hideLabel?: boolean;\n /** The tags (controlled). */\n value?: readonly string[];\n /** The tags at first, uncontrolled. */\n defaultValue?: readonly string[];\n /** Called with every tag after a change. */\n onValueChange?: (tags: string[]) => void;\n /** Words offered as the person types (their own history, a curated list). */\n suggestions?: readonly string[];\n /** Cleans a word before it is added (`(t) => t.toLowerCase().replace(/^#/, \"\")`). An empty result is ignored. */\n normalize?: (tag: string) => string;\n /** Refuses a word: return the reason (passed translated), shown and read as the field's error; `null` accepts it. */\n validate?: (tag: string, tags: readonly string[]) => string | null;\n /** Most tags; the field stops offering more past it. */\n max?: number;\n /** Keys that add the word, besides Enter. Default `[\",\"]`. */\n separators?: readonly string[];\n /** The input's placeholder, passed translated. */\n placeholder?: string;\n /** A help text under the field (\"Up to 10 tags, separated by commas\"). */\n hint?: string;\n /** An error from the app (a server refusal); `validate`'s own errors show here too. */\n error?: string;\n /** Not available. */\n disabled?: boolean;\n /** The name of the hidden inputs, for a plain `<form>` post (one per tag). */\n name?: string;\n /** The words of the field, passed translated; English by default. */\n labels?: Partial<Pick<ComboboxLabels, \"create\" | \"remove\" | \"empty\" | \"results\" | \"toggle\">>;\n /** Classes merged on the root. */\n className?: string;\n};\n\nconst toOption = (tag: string): ComboboxOption => ({ value: tag, label: tag });\n\n/** Words as removable chips — tags, keywords, e-mail recipients — with suggestions, cleaning and validation. */\nexport function TagInput({\n value,\n defaultValue = [],\n onValueChange,\n suggestions = [],\n normalize = (tag) => tag.trim(),\n validate,\n max,\n separators = [\",\"],\n error,\n labels,\n ...props\n}: TagInputProps) {\n const [tags, setTags] = useControllable<readonly string[]>(value, defaultValue, onValueChange as (next: readonly string[]) => void);\n const [refusal, setRefusal] = React.useState<string | null>(null);\n\n const change = (options: ComboboxOption[]) => {\n const next: string[] = [];\n for (const option of options) {\n const tag = normalize(option.value);\n if (!tag || next.includes(tag)) continue;\n if (!tags.includes(tag)) {\n const reason = validate?.(tag, next) ?? null;\n if (reason) {\n setRefusal(reason);\n continue;\n }\n }\n next.push(tag);\n }\n if (next.length >= options.length || options.length < tags.length) setRefusal(null);\n setTags(next);\n };\n\n return (\n <Combobox\n {...props}\n multiple\n creatable\n separators={separators}\n maxSelected={max}\n value={tags.map(toOption)}\n onValueChange={change}\n options={suggestions.map(toOption)}\n error={refusal ?? error}\n labels={{ empty: \"\", results: () => \"\", ...labels }}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;AAGA,YAAY,WAAW;AAgFnB;AAtCJ,IAAM,WAAW,CAAC,SAAiC,EAAE,OAAO,KAAK,OAAO,IAAI;AAGrE,SAAS,SAAS;AAAA,EACvB;AAAA,EACA,eAAe,CAAC;AAAA,EAChB;AAAA,EACA,cAAc,CAAC;AAAA,EACf,YAAY,CAAC,QAAQ,IAAI,KAAK;AAAA,EAC9B;AAAA,EACA;AAAA,EACA,aAAa,CAAC,GAAG;AAAA,EACjB;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAkB;AAChB,QAAM,CAAC,MAAM,OAAO,IAAI,gBAAmC,OAAO,cAAc,aAAkD;AAClI,QAAM,CAAC,SAAS,UAAU,IAAU,eAAwB,IAAI;AAEhE,QAAM,SAAS,CAAC,YAA8B;AAC5C,UAAM,OAAiB,CAAC;AACxB,eAAW,UAAU,SAAS;AAC5B,YAAM,MAAM,UAAU,OAAO,KAAK;AAClC,UAAI,CAAC,OAAO,KAAK,SAAS,GAAG,EAAG;AAChC,UAAI,CAAC,KAAK,SAAS,GAAG,GAAG;AACvB,cAAM,SAAS,WAAW,KAAK,IAAI,KAAK;AACxC,YAAI,QAAQ;AACV,qBAAW,MAAM;AACjB;AAAA,QACF;AAAA,MACF;AACA,WAAK,KAAK,GAAG;AAAA,IACf;AACA,QAAI,KAAK,UAAU,QAAQ,UAAU,QAAQ,SAAS,KAAK,OAAQ,YAAW,IAAI;AAClF,YAAQ,IAAI;AAAA,EACd;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,UAAQ;AAAA,MACR,WAAS;AAAA,MACT;AAAA,MACA,aAAa;AAAA,MACb,OAAO,KAAK,IAAI,QAAQ;AAAA,MACxB,eAAe;AAAA,MACf,SAAS,YAAY,IAAI,QAAQ;AAAA,MACjC,OAAO,WAAW;AAAA,MAClB,QAAQ,EAAE,OAAO,IAAI,SAAS,MAAM,IAAI,GAAG,OAAO;AAAA;AAAA,EACpD;AAEJ;","names":[]}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
declare const videoPlayer: tailwind_variants.TVReturnType<{
|
|
5
|
+
[key: string]: {
|
|
6
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
7
|
+
big?: tailwind_variants.ClassValue;
|
|
8
|
+
root?: tailwind_variants.ClassValue;
|
|
9
|
+
button?: tailwind_variants.ClassValue;
|
|
10
|
+
time?: tailwind_variants.ClassValue;
|
|
11
|
+
video?: tailwind_variants.ClassValue;
|
|
12
|
+
row?: tailwind_variants.ClassValue;
|
|
13
|
+
status?: tailwind_variants.ClassValue;
|
|
14
|
+
poster?: tailwind_variants.ClassValue;
|
|
15
|
+
volume?: tailwind_variants.ClassValue;
|
|
16
|
+
spinner?: tailwind_variants.ClassValue;
|
|
17
|
+
overlay?: tailwind_variants.ClassValue;
|
|
18
|
+
bar?: tailwind_variants.ClassValue;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
} | {
|
|
22
|
+
[x: string]: {
|
|
23
|
+
[x: string]: tailwind_variants.ClassValue | {
|
|
24
|
+
big?: tailwind_variants.ClassValue;
|
|
25
|
+
root?: tailwind_variants.ClassValue;
|
|
26
|
+
button?: tailwind_variants.ClassValue;
|
|
27
|
+
time?: tailwind_variants.ClassValue;
|
|
28
|
+
video?: tailwind_variants.ClassValue;
|
|
29
|
+
row?: tailwind_variants.ClassValue;
|
|
30
|
+
status?: tailwind_variants.ClassValue;
|
|
31
|
+
poster?: tailwind_variants.ClassValue;
|
|
32
|
+
volume?: tailwind_variants.ClassValue;
|
|
33
|
+
spinner?: tailwind_variants.ClassValue;
|
|
34
|
+
overlay?: tailwind_variants.ClassValue;
|
|
35
|
+
bar?: tailwind_variants.ClassValue;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
} | {}, {
|
|
39
|
+
root: string;
|
|
40
|
+
video: string;
|
|
41
|
+
poster: string;
|
|
42
|
+
big: string;
|
|
43
|
+
bar: string;
|
|
44
|
+
row: string;
|
|
45
|
+
button: string;
|
|
46
|
+
time: string;
|
|
47
|
+
volume: string;
|
|
48
|
+
status: string;
|
|
49
|
+
spinner: string;
|
|
50
|
+
overlay: string;
|
|
51
|
+
}, undefined, {
|
|
52
|
+
[key: string]: {
|
|
53
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
54
|
+
big?: tailwind_variants.ClassValue;
|
|
55
|
+
root?: tailwind_variants.ClassValue;
|
|
56
|
+
button?: tailwind_variants.ClassValue;
|
|
57
|
+
time?: tailwind_variants.ClassValue;
|
|
58
|
+
video?: tailwind_variants.ClassValue;
|
|
59
|
+
row?: tailwind_variants.ClassValue;
|
|
60
|
+
status?: tailwind_variants.ClassValue;
|
|
61
|
+
poster?: tailwind_variants.ClassValue;
|
|
62
|
+
volume?: tailwind_variants.ClassValue;
|
|
63
|
+
spinner?: tailwind_variants.ClassValue;
|
|
64
|
+
overlay?: tailwind_variants.ClassValue;
|
|
65
|
+
bar?: tailwind_variants.ClassValue;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
} | {}, {
|
|
69
|
+
root: string;
|
|
70
|
+
video: string;
|
|
71
|
+
poster: string;
|
|
72
|
+
big: string;
|
|
73
|
+
bar: string;
|
|
74
|
+
row: string;
|
|
75
|
+
button: string;
|
|
76
|
+
time: string;
|
|
77
|
+
volume: string;
|
|
78
|
+
status: string;
|
|
79
|
+
spinner: string;
|
|
80
|
+
overlay: string;
|
|
81
|
+
}, tailwind_variants.TVReturnTypeLike<unknown, {
|
|
82
|
+
root: string;
|
|
83
|
+
video: string;
|
|
84
|
+
poster: string;
|
|
85
|
+
big: string;
|
|
86
|
+
bar: string;
|
|
87
|
+
row: string;
|
|
88
|
+
button: string;
|
|
89
|
+
time: string;
|
|
90
|
+
volume: string;
|
|
91
|
+
status: string;
|
|
92
|
+
spinner: string;
|
|
93
|
+
overlay: string;
|
|
94
|
+
}>>;
|
|
95
|
+
/** What `loadHls` resolves to: the module of hls.js (only the members the player uses are typed). */
|
|
96
|
+
type HlsModule = {
|
|
97
|
+
default: {
|
|
98
|
+
new (config?: Record<string, unknown>): {
|
|
99
|
+
loadSource(url: string): void;
|
|
100
|
+
attachMedia(media: HTMLMediaElement): void;
|
|
101
|
+
destroy(): void;
|
|
102
|
+
startLoad(): void;
|
|
103
|
+
recoverMediaError(): void;
|
|
104
|
+
on(event: string, listener: (event: string, data: {
|
|
105
|
+
fatal?: boolean;
|
|
106
|
+
type?: string;
|
|
107
|
+
}) => void): void;
|
|
108
|
+
};
|
|
109
|
+
isSupported(): boolean;
|
|
110
|
+
Events: {
|
|
111
|
+
ERROR: string;
|
|
112
|
+
};
|
|
113
|
+
ErrorTypes: {
|
|
114
|
+
NETWORK_ERROR: string;
|
|
115
|
+
MEDIA_ERROR: string;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
type VideoTrack = {
|
|
120
|
+
/** The WebVTT file. */
|
|
121
|
+
src: string;
|
|
122
|
+
/** Its language, BCP 47 (`"fr"`). */
|
|
123
|
+
srcLang: string;
|
|
124
|
+
/** Its name in the menu ("Français"), passed translated. */
|
|
125
|
+
label: string;
|
|
126
|
+
/** `subtitles` (default) or `captions` (with the sounds, for deaf viewers). */
|
|
127
|
+
kind?: "subtitles" | "captions";
|
|
128
|
+
/** Shown from the start. */
|
|
129
|
+
default?: boolean;
|
|
130
|
+
};
|
|
131
|
+
type VideoPlayerLabels = {
|
|
132
|
+
play: string;
|
|
133
|
+
pause: string;
|
|
134
|
+
mute: string;
|
|
135
|
+
unmute: string;
|
|
136
|
+
volume: string;
|
|
137
|
+
seek: string;
|
|
138
|
+
/** The speed button: `(rate) => "Speed " + rate + "×"`. */
|
|
139
|
+
speed: (rate: number) => string;
|
|
140
|
+
/** The captions button: `(track) => "Subtitles: " + (track ?? "off")`, the track's label or `null` when off. */
|
|
141
|
+
captions: (track: string | null) => string;
|
|
142
|
+
fullscreen: string;
|
|
143
|
+
exitFullscreen: string;
|
|
144
|
+
pictureInPicture: string;
|
|
145
|
+
/** Read while the video waits for data. */
|
|
146
|
+
loading: string;
|
|
147
|
+
/** The video cannot play. */
|
|
148
|
+
error: string;
|
|
149
|
+
/** Tries again (resolves a signed `src` again). */
|
|
150
|
+
retry: string;
|
|
151
|
+
/** The seek slider's value: `(time, duration) => "1:05 of 3:20"`. */
|
|
152
|
+
time: (time: string, duration: string) => string;
|
|
153
|
+
};
|
|
154
|
+
declare const videoPlayerLabels: VideoPlayerLabels;
|
|
155
|
+
type VideoPlayerProps = {
|
|
156
|
+
/** The address of the video (MP4, WebM, or an HLS `.m3u8`), or a function that resolves a signed one when needed. */
|
|
157
|
+
src: string | (() => Promise<string>);
|
|
158
|
+
/** `auto` (default): HLS when the address ends in `.m3u8`. */
|
|
159
|
+
type?: "auto" | "hls" | "file";
|
|
160
|
+
/** Loads hls.js when the browser cannot play HLS itself: `() => import("hls.js")`. Without it, HLS needs Safari. */
|
|
161
|
+
loadHls?: () => Promise<HlsModule>;
|
|
162
|
+
/** The accessible name of the player ("Video: Sunset over Montréal"), passed translated. */
|
|
163
|
+
title: string;
|
|
164
|
+
/** The picture shown before playback. */
|
|
165
|
+
poster?: string;
|
|
166
|
+
/** Starts playing, muted (browsers refuse sound without a gesture) — not under reduced motion. */
|
|
167
|
+
autoPlay?: boolean;
|
|
168
|
+
/** Starts muted. */
|
|
169
|
+
muted?: boolean;
|
|
170
|
+
/** Plays again from the start at the end. */
|
|
171
|
+
loop?: boolean;
|
|
172
|
+
/** How much to fetch before playback: `none` (a list of many videos), `metadata` (default), `auto`. */
|
|
173
|
+
preload?: "none" | "metadata" | "auto";
|
|
174
|
+
/** Subtitles or captions (WebVTT): the C key and a button cycle through them. */
|
|
175
|
+
tracks?: readonly VideoTrack[];
|
|
176
|
+
/** The speeds offered by the speed button. Default `[0.5, 1, 1.25, 1.5, 2]`. */
|
|
177
|
+
playbackRates?: readonly number[];
|
|
178
|
+
/** Pauses when less than a quarter of the player is on screen. Default `true`. */
|
|
179
|
+
pauseWhenHidden?: boolean;
|
|
180
|
+
/** Shows the controls (default). `false`: a bare video (a background loop) — give it no sound. */
|
|
181
|
+
controls?: boolean;
|
|
182
|
+
/** Covers the video and hides the controls: a gate (sign in, unlock, age check) drawn by the app. */
|
|
183
|
+
overlay?: React.ReactNode;
|
|
184
|
+
/** The width / height ratio of the frame. Default `"16 / 9"`; `"9 / 16"` for a vertical video. */
|
|
185
|
+
aspectRatio?: string;
|
|
186
|
+
/** Called when playback starts. */
|
|
187
|
+
onPlay?: () => void;
|
|
188
|
+
/** Called when playback pauses. */
|
|
189
|
+
onPause?: () => void;
|
|
190
|
+
/** Called at the end. */
|
|
191
|
+
onEnded?: () => void;
|
|
192
|
+
/** Called as the time moves, in seconds (a few times a second). */
|
|
193
|
+
onTimeUpdate?: (time: number) => void;
|
|
194
|
+
/** Called when the video cannot play (a network failure, an expired address). */
|
|
195
|
+
onError?: (error: unknown) => void;
|
|
196
|
+
/** The words, passed translated; English by default. */
|
|
197
|
+
labels?: Partial<VideoPlayerLabels>;
|
|
198
|
+
/** Classes merged on the root. */
|
|
199
|
+
className?: string;
|
|
200
|
+
};
|
|
201
|
+
/** A video player with accessible controls, HLS on demand, signed sources, subtitles, speed, full screen. */
|
|
202
|
+
declare function VideoPlayer({ src, type, loadHls, title, poster, autoPlay, muted: initiallyMuted, loop, preload, tracks, playbackRates, pauseWhenHidden, controls, overlay, aspectRatio, onPlay, onPause, onEnded, onTimeUpdate, onError, labels: given, className, }: VideoPlayerProps): React.JSX.Element;
|
|
203
|
+
|
|
204
|
+
export { type HlsModule, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, type VideoTrack, videoPlayer, videoPlayerLabels };
|