@accelint/design-toolkit 9.4.0 → 9.5.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/catalog-info.yaml +2 -2
- package/dist/components/accordion/group.d.ts +2 -2
- package/dist/components/accordion/header.d.ts +2 -2
- package/dist/components/accordion/index.d.ts +2 -2
- package/dist/components/accordion/panel.d.ts +2 -2
- package/dist/components/accordion/styles.module.css +1 -1
- package/dist/components/accordion/trigger.d.ts +2 -2
- package/dist/components/action-bar/index.d.ts +2 -2
- package/dist/components/audio/index.d.ts +104 -0
- package/dist/components/audio/index.js +242 -0
- package/dist/components/audio/index.js.map +1 -0
- package/dist/components/audio/styles.module.css +77 -0
- package/dist/components/audio/types.d.ts +45 -0
- package/dist/components/audio/types.js +12 -0
- package/dist/components/avatar/context.d.ts +4 -4
- package/dist/components/avatar/index.d.ts +2 -2
- package/dist/components/badge/context.d.ts +4 -4
- package/dist/components/badge/index.d.ts +2 -2
- package/dist/components/breadcrumbs/index.d.ts +2 -2
- package/dist/components/breadcrumbs/item.d.ts +2 -2
- package/dist/components/breadcrumbs/styles.module.css +1 -0
- package/dist/components/button/__internal__/clear.js +42 -0
- package/dist/components/button/__internal__/clear.js.map +1 -0
- package/dist/components/button/__internal__/styles.module.css +23 -0
- package/dist/components/button/context.d.ts +8 -8
- package/dist/components/button/index.d.ts +2 -2
- package/dist/components/button/link.d.ts +2 -2
- package/dist/components/button/styles.module.css +1 -1
- package/dist/components/button/toggle.d.ts +2 -2
- package/dist/components/checkbox/context.d.ts +3 -3
- package/dist/components/checkbox/group.d.ts +2 -2
- package/dist/components/checkbox/index.d.ts +2 -2
- package/dist/components/chip/context.d.ts +4 -4
- package/dist/components/chip/deletable.d.ts +2 -2
- package/dist/components/chip/index.d.ts +2 -2
- package/dist/components/chip/list.d.ts +4 -4
- package/dist/components/chip/selectable.d.ts +2 -2
- package/dist/components/chip/styles.module.css +2 -2
- package/dist/components/classification-badge/context.d.ts +4 -4
- package/dist/components/classification-badge/index.d.ts +2 -2
- package/dist/components/classification-banner/context.d.ts +4 -4
- package/dist/components/classification-banner/index.d.ts +2 -2
- package/dist/components/clock/index.d.ts +2 -2
- package/dist/components/clock/index.js +1 -0
- package/dist/components/clock/index.js.map +1 -1
- package/dist/components/color-picker/index.d.ts +2 -2
- package/dist/components/combobox-field/context.d.ts +4 -4
- package/dist/components/combobox-field/index.d.ts +2 -2
- package/dist/components/combobox-field/index.js +42 -14
- package/dist/components/combobox-field/index.js.map +1 -1
- package/dist/components/combobox-field/styles.module.css +15 -3
- package/dist/components/combobox-field/types.d.ts +4 -0
- package/dist/components/coordinate-field/context.d.ts +6 -6
- package/dist/components/coordinate-field/index.d.ts +2 -2
- package/dist/components/coordinate-field/index.js +2 -2
- package/dist/components/coordinate-field/index.js.map +1 -1
- package/dist/components/coordinate-field/segment-configs.js +1 -1
- package/dist/components/coordinate-field/segment-configs.js.map +1 -1
- package/dist/components/coordinate-field/segment.d.ts +2 -2
- package/dist/components/coordinate-field/segment.js +8 -8
- package/dist/components/coordinate-field/segment.js.map +1 -1
- package/dist/components/coordinate-field/styles.module.css +7 -3
- package/dist/components/date-field/index.d.ts +2 -2
- package/dist/components/deferred-collection/index.d.ts +2 -2
- package/dist/components/details-list/context.d.ts +4 -4
- package/dist/components/details-list/index.d.ts +2 -2
- package/dist/components/details-list/label.d.ts +2 -2
- package/dist/components/details-list/value.d.ts +2 -2
- package/dist/components/dialog/content.d.ts +2 -2
- package/dist/components/dialog/context.d.ts +2 -2
- package/dist/components/dialog/footer.d.ts +2 -2
- package/dist/components/dialog/index.d.ts +2 -2
- package/dist/components/dialog/title.d.ts +2 -2
- package/dist/components/divider/context.d.ts +4 -4
- package/dist/components/divider/index.d.ts +2 -2
- package/dist/components/drawer/back.d.ts +2 -2
- package/dist/components/drawer/close.d.ts +2 -2
- package/dist/components/drawer/content.d.ts +2 -2
- package/dist/components/drawer/context.d.ts +2 -2
- package/dist/components/drawer/footer.d.ts +2 -2
- package/dist/components/drawer/header-title.d.ts +2 -2
- package/dist/components/drawer/header.d.ts +2 -2
- package/dist/components/drawer/header.js +1 -1
- package/dist/components/drawer/index.d.ts +2 -2
- package/dist/components/drawer/layout-main.d.ts +2 -2
- package/dist/components/drawer/layout.d.ts +2 -2
- package/dist/components/drawer/menu-item.d.ts +2 -2
- package/dist/components/drawer/menu.d.ts +2 -2
- package/dist/components/drawer/panel.d.ts +2 -2
- package/dist/components/drawer/trigger.d.ts +2 -2
- package/dist/components/drawer/view.d.ts +2 -2
- package/dist/components/flashcard/index.d.ts +9 -9
- package/dist/components/hero/context.d.ts +2 -2
- package/dist/components/hero/index.d.ts +2 -2
- package/dist/components/hero/subtitle.d.ts +2 -2
- package/dist/components/hero/title.d.ts +2 -2
- package/dist/components/hotkey/context.d.ts +4 -4
- package/dist/components/hotkey/index.d.ts +2 -2
- package/dist/components/hotkey/set.d.ts +2 -2
- package/dist/components/icon/context.d.ts +4 -4
- package/dist/components/icon/index.d.ts +2 -2
- package/dist/components/input/context.d.ts +2 -2
- package/dist/components/input/index.d.ts +2 -2
- package/dist/components/input/index.js +10 -14
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/kanban/card-body.d.ts +2 -2
- package/dist/components/kanban/card-header-actions.d.ts +2 -2
- package/dist/components/kanban/card-header-title.d.ts +2 -2
- package/dist/components/kanban/card-header.d.ts +2 -2
- package/dist/components/kanban/card.d.ts +2 -2
- package/dist/components/kanban/column-actions.d.ts +2 -2
- package/dist/components/kanban/column-container.d.ts +2 -2
- package/dist/components/kanban/column-content.d.ts +2 -2
- package/dist/components/kanban/column-header-actions.d.ts +2 -2
- package/dist/components/kanban/column-header-drag-handle.d.ts +2 -2
- package/dist/components/kanban/column-header-title.d.ts +2 -2
- package/dist/components/kanban/column-header.d.ts +2 -2
- package/dist/components/kanban/column.d.ts +2 -2
- package/dist/components/kanban/context.d.ts +2 -2
- package/dist/components/kanban/header-actions.d.ts +2 -2
- package/dist/components/kanban/header-search.d.ts +2 -2
- package/dist/components/kanban/header-title.d.ts +2 -2
- package/dist/components/kanban/header.d.ts +2 -2
- package/dist/components/kanban/kanban.d.ts +4 -4
- package/dist/components/kanban/styles.module.css +1 -1
- package/dist/components/label/context.d.ts +4 -4
- package/dist/components/label/index.d.ts +2 -2
- package/dist/components/lines/index.d.ts +2 -2
- package/dist/components/link/context.d.ts +2 -2
- package/dist/components/link/index.d.ts +2 -2
- package/dist/components/list/context.d.ts +2 -2
- package/dist/components/list/index.d.ts +2 -2
- package/dist/components/list/item-content.d.ts +2 -2
- package/dist/components/list/item-description.d.ts +2 -2
- package/dist/components/list/item-title.d.ts +2 -2
- package/dist/components/list/item.d.ts +2 -2
- package/dist/components/list/styles.module.css +1 -1
- package/dist/components/media-controls/context.d.ts +66 -0
- package/dist/components/media-controls/context.js +77 -0
- package/dist/components/media-controls/context.js.map +1 -0
- package/dist/components/media-controls/index.d.ts +68 -0
- package/dist/components/media-controls/index.js +78 -0
- package/dist/components/media-controls/index.js.map +1 -0
- package/dist/components/media-controls/mute-button.d.ts +47 -0
- package/dist/components/media-controls/mute-button.js +73 -0
- package/dist/components/media-controls/mute-button.js.map +1 -0
- package/dist/components/media-controls/play-button.d.ts +47 -0
- package/dist/components/media-controls/play-button.js +71 -0
- package/dist/components/media-controls/play-button.js.map +1 -0
- package/dist/components/media-controls/playback-rate.d.ts +58 -0
- package/dist/components/media-controls/playback-rate.js +114 -0
- package/dist/components/media-controls/playback-rate.js.map +1 -0
- package/dist/components/media-controls/seek-button.d.ts +60 -0
- package/dist/components/media-controls/seek-button.js +116 -0
- package/dist/components/media-controls/seek-button.js.map +1 -0
- package/dist/components/media-controls/styles.module.css +145 -0
- package/dist/components/media-controls/time-display.d.ts +69 -0
- package/dist/components/media-controls/time-display.js +95 -0
- package/dist/components/media-controls/time-display.js.map +1 -0
- package/dist/components/media-controls/time-range.d.ts +46 -0
- package/dist/components/media-controls/time-range.js +63 -0
- package/dist/components/media-controls/time-range.js.map +1 -0
- package/dist/components/media-controls/types.d.ts +122 -0
- package/dist/components/media-controls/types.js +12 -0
- package/dist/components/media-controls/volume-slider.d.ts +54 -0
- package/dist/components/media-controls/volume-slider.js +70 -0
- package/dist/components/media-controls/volume-slider.js.map +1 -0
- package/dist/components/menu/context.d.ts +2 -2
- package/dist/components/menu/index.d.ts +2 -2
- package/dist/components/menu/item-description.d.ts +2 -2
- package/dist/components/menu/item-label.d.ts +2 -2
- package/dist/components/menu/item.d.ts +2 -2
- package/dist/components/menu/section.d.ts +2 -2
- package/dist/components/menu/separator.d.ts +2 -2
- package/dist/components/menu/styles.module.css +1 -1
- package/dist/components/menu/submenu.d.ts +2 -2
- package/dist/components/notice/index.d.ts +2 -2
- package/dist/components/notice/list.d.ts +2 -2
- package/dist/components/notice/notice-icon.d.ts +2 -2
- package/dist/components/options/context.d.ts +2 -2
- package/dist/components/options/index.d.ts +2 -2
- package/dist/components/options/item-content.d.ts +2 -2
- package/dist/components/options/item-description.d.ts +2 -2
- package/dist/components/options/item-label.d.ts +2 -2
- package/dist/components/options/item.d.ts +2 -2
- package/dist/components/options/section.d.ts +2 -2
- package/dist/components/options/styles.module.css +1 -1
- package/dist/components/pagination/context.d.ts +2 -2
- package/dist/components/pagination/index.d.ts +2 -2
- package/dist/components/pagination/next.d.ts +2 -2
- package/dist/components/pagination/pages.d.ts +2 -2
- package/dist/components/pagination/prev.d.ts +2 -2
- package/dist/components/popover/content.d.ts +2 -2
- package/dist/components/popover/footer.d.ts +2 -2
- package/dist/components/popover/index.d.ts +2 -2
- package/dist/components/popover/title.d.ts +2 -2
- package/dist/components/popover/trigger.d.ts +2 -2
- package/dist/components/query-builder/action-element.d.ts +2 -2
- package/dist/components/query-builder/actions.d.ts +4 -4
- package/dist/components/query-builder/combinator-selector.d.ts +2 -2
- package/dist/components/query-builder/combinator-selector.js +5 -4
- package/dist/components/query-builder/combinator-selector.js.map +1 -1
- package/dist/components/query-builder/index.d.ts +2 -2
- package/dist/components/query-builder/rule-group.d.ts +4 -4
- package/dist/components/query-builder/rule.d.ts +2 -2
- package/dist/components/query-builder/value-editor.d.ts +2 -2
- package/dist/components/query-builder/value-selector.d.ts +2 -2
- package/dist/components/radio/context.d.ts +2 -2
- package/dist/components/radio/group.d.ts +2 -2
- package/dist/components/radio/index.d.ts +2 -2
- package/dist/components/search-field/context.d.ts +4 -4
- package/dist/components/search-field/index.d.ts +2 -2
- package/dist/components/select-field/context.d.ts +4 -4
- package/dist/components/select-field/index.d.ts +2 -2
- package/dist/components/sidenav/avatar.d.ts +2 -2
- package/dist/components/sidenav/content.d.ts +2 -2
- package/dist/components/sidenav/context.d.ts +2 -2
- package/dist/components/sidenav/footer.d.ts +2 -2
- package/dist/components/sidenav/header.d.ts +2 -2
- package/dist/components/sidenav/index.d.ts +2 -2
- package/dist/components/sidenav/item.d.ts +2 -2
- package/dist/components/sidenav/link.d.ts +2 -2
- package/dist/components/sidenav/menu-item.d.ts +2 -2
- package/dist/components/sidenav/menu.d.ts +2 -2
- package/dist/components/sidenav/trigger.d.ts +2 -2
- package/dist/components/skeleton/index.d.ts +2 -2
- package/dist/components/slider/index.d.ts +2 -2
- package/dist/components/status-indicator/index.d.ts +41 -0
- package/dist/components/status-indicator/index.js +49 -0
- package/dist/components/status-indicator/index.js.map +1 -0
- package/dist/components/status-indicator/styles.module.css +34 -0
- package/dist/components/status-indicator/types.d.ts +21 -0
- package/dist/components/status-indicator/types.js +12 -0
- package/dist/components/switch/context.d.ts +2 -2
- package/dist/components/switch/index.d.ts +2 -2
- package/dist/components/table/body.d.ts +2 -2
- package/dist/components/table/cell.d.ts +2 -2
- package/dist/components/table/context.d.ts +2 -2
- package/dist/components/table/header-cell.d.ts +2 -2
- package/dist/components/table/header.d.ts +2 -2
- package/dist/components/table/index.d.ts +2 -2
- package/dist/components/table/row.d.ts +2 -2
- package/dist/components/tabs/context.d.ts +4 -4
- package/dist/components/tabs/index.d.ts +2 -2
- package/dist/components/tabs/list.d.ts +2 -2
- package/dist/components/tabs/panel.d.ts +2 -2
- package/dist/components/tabs/tab.d.ts +2 -2
- package/dist/components/text-area-field/context.d.ts +4 -4
- package/dist/components/text-area-field/index.d.ts +2 -2
- package/dist/components/text-field/context.d.ts +4 -4
- package/dist/components/text-field/index.d.ts +2 -2
- package/dist/components/time-field/index.d.ts +2 -2
- package/dist/components/tooltip/context.d.ts +2 -2
- package/dist/components/tooltip/index.d.ts +2 -2
- package/dist/components/tooltip/styles.module.css +1 -1
- package/dist/components/tooltip/trigger.d.ts +2 -2
- package/dist/components/tree/context.d.ts +3 -3
- package/dist/components/tree/index.d.ts +2 -2
- package/dist/components/tree/item-actions.d.ts +2 -2
- package/dist/components/tree/item-content.d.ts +2 -2
- package/dist/components/tree/item-description.d.ts +2 -2
- package/dist/components/tree/item-label.d.ts +2 -2
- package/dist/components/tree/item-prefix-icon.d.ts +2 -2
- package/dist/components/tree/item.d.ts +2 -2
- package/dist/components/tree/lines.d.ts +2 -2
- package/dist/components/tree/styles.module.css +1 -1
- package/dist/components/view-stack/context.d.ts +2 -2
- package/dist/components/view-stack/index.d.ts +2 -2
- package/dist/components/view-stack/trigger.d.ts +2 -2
- package/dist/components/view-stack/view.d.ts +2 -2
- package/dist/index.d.ts +15 -1
- package/dist/index.js +12 -1
- package/dist/providers/portal.d.ts +2 -2
- package/dist/providers/theme-provider.d.ts +2 -2
- package/package.json +20 -5
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
'use client';
|
|
15
|
+
|
|
16
|
+
import { MediaControlsProvider, useMediaProviderGuard } from "./context.js";
|
|
17
|
+
import "client-only";
|
|
18
|
+
import { clsx } from "@accelint/design-foundation/lib/utils";
|
|
19
|
+
import { jsx } from "react/jsx-runtime";
|
|
20
|
+
import styles from "./styles.module.css";
|
|
21
|
+
|
|
22
|
+
//#region src/components/media-controls/index.tsx
|
|
23
|
+
/**
|
|
24
|
+
* A container for media playback controls.
|
|
25
|
+
*
|
|
26
|
+
* Composes media control sub-components into a cohesive control bar.
|
|
27
|
+
* Must be used within a MediaProvider context from media-chrome.
|
|
28
|
+
*
|
|
29
|
+
* @param props - The component props.
|
|
30
|
+
* @param props.className - CSS class name for the container.
|
|
31
|
+
* @param props.classNames - Class names for sub-elements.
|
|
32
|
+
* @param props.children - Media control components to render.
|
|
33
|
+
* @param props.isDisabled - Disables all child controls via context.
|
|
34
|
+
* @returns The rendered media controls container.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <MediaProvider>
|
|
39
|
+
* <MediaControls>
|
|
40
|
+
* <PlayButton />
|
|
41
|
+
* <TimeDisplay mode="current" />
|
|
42
|
+
* <TimeRange />
|
|
43
|
+
* <MuteButton />
|
|
44
|
+
* <VolumeSlider />
|
|
45
|
+
* </MediaControls>
|
|
46
|
+
* </MediaProvider>
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* // Audio player with seek controls
|
|
52
|
+
* <MediaProvider>
|
|
53
|
+
* <MediaControls>
|
|
54
|
+
* <SeekButton direction="backward" seekOffset={15} />
|
|
55
|
+
* <PlayButton />
|
|
56
|
+
* <SeekButton direction="forward" seekOffset={15} />
|
|
57
|
+
* <TimeDisplay mode="current" />
|
|
58
|
+
* <PlaybackRateButton rates={[0.5, 1, 1.5, 2]} />
|
|
59
|
+
* </MediaControls>
|
|
60
|
+
* </MediaProvider>
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
function MediaControls({ className, classNames, children, isDisabled = false, ...rest }) {
|
|
64
|
+
useMediaProviderGuard();
|
|
65
|
+
return /* @__PURE__ */ jsx(MediaControlsProvider, {
|
|
66
|
+
isDisabled,
|
|
67
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
68
|
+
...rest,
|
|
69
|
+
className: clsx("group/media-controls", styles.mediaControls, className, classNames?.container),
|
|
70
|
+
"data-disabled": isDisabled || void 0,
|
|
71
|
+
children
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
export { MediaControls };
|
|
78
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/media-controls/index.tsx"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n'use client';\n\nimport 'client-only';\nimport { clsx } from '@accelint/design-foundation/lib/utils';\nimport { MediaControlsProvider, useMediaProviderGuard } from './context';\nimport styles from './styles.module.css';\nimport type { MediaControlsProps } from './types';\n\n/**\n * A container for media playback controls.\n *\n * Composes media control sub-components into a cohesive control bar.\n * Must be used within a MediaProvider context from media-chrome.\n *\n * @param props - The component props.\n * @param props.className - CSS class name for the container.\n * @param props.classNames - Class names for sub-elements.\n * @param props.children - Media control components to render.\n * @param props.isDisabled - Disables all child controls via context.\n * @returns The rendered media controls container.\n *\n * @example\n * ```tsx\n * <MediaProvider>\n * <MediaControls>\n * <PlayButton />\n * <TimeDisplay mode=\"current\" />\n * <TimeRange />\n * <MuteButton />\n * <VolumeSlider />\n * </MediaControls>\n * </MediaProvider>\n * ```\n *\n * @example\n * ```tsx\n * // Audio player with seek controls\n * <MediaProvider>\n * <MediaControls>\n * <SeekButton direction=\"backward\" seekOffset={15} />\n * <PlayButton />\n * <SeekButton direction=\"forward\" seekOffset={15} />\n * <TimeDisplay mode=\"current\" />\n * <PlaybackRateButton rates={[0.5, 1, 1.5, 2]} />\n * </MediaControls>\n * </MediaProvider>\n * ```\n */\nexport function MediaControls({\n className,\n classNames,\n children,\n isDisabled = false,\n ...rest\n}: MediaControlsProps) {\n useMediaProviderGuard();\n\n return (\n <MediaControlsProvider isDisabled={isDisabled}>\n <div\n {...rest}\n className={clsx(\n 'group/media-controls',\n styles.mediaControls,\n className,\n classNames?.container,\n )}\n data-disabled={isDisabled || undefined}\n >\n {children}\n </div>\n </MediaControlsProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,SAAgB,cAAc,EAC5B,WACA,YACA,UACA,aAAa,OACb,GAAG,QACkB;AACrB,wBAAuB;AAEvB,QACE,oBAAC;EAAkC;YACjC,oBAAC;GACC,GAAI;GACJ,WAAW,KACT,wBACA,OAAO,eACP,WACA,YAAY,UACb;GACD,iBAAe,cAAc;GAE5B;IACG;GACgB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { MuteButtonProps } from "./types.js";
|
|
14
|
+
import "client-only";
|
|
15
|
+
import * as react_jsx_runtime63 from "react/jsx-runtime";
|
|
16
|
+
|
|
17
|
+
//#region src/components/media-controls/mute-button.d.ts
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A media control button for mute/unmute functionality.
|
|
21
|
+
*
|
|
22
|
+
* Integrates with media-chrome's media store to control media volume muting.
|
|
23
|
+
* Automatically shows the appropriate icon based on the current mute state.
|
|
24
|
+
*
|
|
25
|
+
* @param props - The button props.
|
|
26
|
+
* @param props.className - CSS class name for the button.
|
|
27
|
+
* @param props.isDisabled - Whether the button is disabled.
|
|
28
|
+
* @param props.ref - Ref to the button element.
|
|
29
|
+
* @returns The rendered mute/unmute button.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* // Basic usage within MediaProvider
|
|
34
|
+
* <MediaProvider>
|
|
35
|
+
* <MuteButton />
|
|
36
|
+
* </MediaProvider>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare function MuteButton({
|
|
40
|
+
className,
|
|
41
|
+
isDisabled: isDisabledProp,
|
|
42
|
+
ref,
|
|
43
|
+
...rest
|
|
44
|
+
}: MuteButtonProps): react_jsx_runtime63.JSX.Element;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { MuteButton };
|
|
47
|
+
//# sourceMappingURL=mute-button.d.ts.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
'use client';
|
|
15
|
+
|
|
16
|
+
import { Icon } from "../icon/index.js";
|
|
17
|
+
import { Button } from "../button/index.js";
|
|
18
|
+
import { useMediaControlsDisabled } from "./context.js";
|
|
19
|
+
import "client-only";
|
|
20
|
+
import { useCallback } from "react";
|
|
21
|
+
import { jsx } from "react/jsx-runtime";
|
|
22
|
+
import { MediaActionTypes, VolumeLevels, useMediaDispatch, useMediaSelector } from "media-chrome/react/media-store";
|
|
23
|
+
import { SoundAudible, SoundMute } from "@accelint/icons";
|
|
24
|
+
|
|
25
|
+
//#region src/components/media-controls/mute-button.tsx
|
|
26
|
+
/**
|
|
27
|
+
* A media control button for mute/unmute functionality.
|
|
28
|
+
*
|
|
29
|
+
* Integrates with media-chrome's media store to control media volume muting.
|
|
30
|
+
* Automatically shows the appropriate icon based on the current mute state.
|
|
31
|
+
*
|
|
32
|
+
* @param props - The button props.
|
|
33
|
+
* @param props.className - CSS class name for the button.
|
|
34
|
+
* @param props.isDisabled - Whether the button is disabled.
|
|
35
|
+
* @param props.ref - Ref to the button element.
|
|
36
|
+
* @returns The rendered mute/unmute button.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* // Basic usage within MediaProvider
|
|
41
|
+
* <MediaProvider>
|
|
42
|
+
* <MuteButton />
|
|
43
|
+
* </MediaProvider>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
function MuteButton({ className, isDisabled: isDisabledProp, ref, ...rest }) {
|
|
47
|
+
const dispatch = useMediaDispatch();
|
|
48
|
+
const mediaMuted = useMediaSelector((state) => state.mediaMuted);
|
|
49
|
+
const mediaVolumeLevel = useMediaSelector((state) => state.mediaVolumeLevel);
|
|
50
|
+
const isDisabled = useMediaControlsDisabled(isDisabledProp);
|
|
51
|
+
const isEffectivelyMuted = mediaVolumeLevel === VolumeLevels.OFF;
|
|
52
|
+
const handleClick = useCallback(() => {
|
|
53
|
+
dispatch({ type: mediaMuted ? MediaActionTypes.MEDIA_UNMUTE_REQUEST : MediaActionTypes.MEDIA_MUTE_REQUEST });
|
|
54
|
+
}, [dispatch, mediaMuted]);
|
|
55
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
56
|
+
...rest,
|
|
57
|
+
ref,
|
|
58
|
+
className,
|
|
59
|
+
variant: "icon",
|
|
60
|
+
size: "medium",
|
|
61
|
+
isDisabled,
|
|
62
|
+
onPress: handleClick,
|
|
63
|
+
"aria-label": isEffectivelyMuted ? "Unmute" : "Mute",
|
|
64
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
65
|
+
size: "medium",
|
|
66
|
+
children: isEffectivelyMuted ? /* @__PURE__ */ jsx(SoundMute, {}) : /* @__PURE__ */ jsx(SoundAudible, {})
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
export { MuteButton };
|
|
73
|
+
//# sourceMappingURL=mute-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mute-button.js","names":[],"sources":["../../../src/components/media-controls/mute-button.tsx"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n'use client';\n\nimport 'client-only';\nimport { SoundAudible, SoundMute } from '@accelint/icons';\nimport {\n MediaActionTypes,\n useMediaDispatch,\n useMediaSelector,\n VolumeLevels,\n} from 'media-chrome/react/media-store';\nimport { useCallback } from 'react';\nimport { Button } from '../button';\nimport { Icon } from '../icon';\nimport { useMediaControlsDisabled } from './context';\nimport type { MuteButtonProps } from './types';\n\n/**\n * A media control button for mute/unmute functionality.\n *\n * Integrates with media-chrome's media store to control media volume muting.\n * Automatically shows the appropriate icon based on the current mute state.\n *\n * @param props - The button props.\n * @param props.className - CSS class name for the button.\n * @param props.isDisabled - Whether the button is disabled.\n * @param props.ref - Ref to the button element.\n * @returns The rendered mute/unmute button.\n *\n * @example\n * ```tsx\n * // Basic usage within MediaProvider\n * <MediaProvider>\n * <MuteButton />\n * </MediaProvider>\n * ```\n */\nexport function MuteButton({\n className,\n isDisabled: isDisabledProp,\n ref,\n ...rest\n}: MuteButtonProps) {\n const dispatch = useMediaDispatch();\n const mediaMuted = useMediaSelector((state) => state.mediaMuted);\n const mediaVolumeLevel = useMediaSelector((state) => state.mediaVolumeLevel);\n const isDisabled = useMediaControlsDisabled(isDisabledProp);\n\n // Effective muted state: true when volume is off (either muted or volume=0)\n const isEffectivelyMuted = mediaVolumeLevel === VolumeLevels.OFF;\n\n const handleClick = useCallback(() => {\n const type = mediaMuted\n ? MediaActionTypes.MEDIA_UNMUTE_REQUEST\n : MediaActionTypes.MEDIA_MUTE_REQUEST;\n dispatch({ type });\n }, [dispatch, mediaMuted]);\n\n return (\n <Button\n {...rest}\n ref={ref}\n className={className}\n variant='icon'\n size='medium'\n isDisabled={isDisabled}\n onPress={handleClick}\n aria-label={isEffectivelyMuted ? 'Unmute' : 'Mute'}\n >\n <Icon size='medium'>\n {isEffectivelyMuted ? <SoundMute /> : <SoundAudible />}\n </Icon>\n </Button>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAgB,WAAW,EACzB,WACA,YAAY,gBACZ,KACA,GAAG,QACe;CAClB,MAAM,WAAW,kBAAkB;CACnC,MAAM,aAAa,kBAAkB,UAAU,MAAM,WAAW;CAChE,MAAM,mBAAmB,kBAAkB,UAAU,MAAM,iBAAiB;CAC5E,MAAM,aAAa,yBAAyB,eAAe;CAG3D,MAAM,qBAAqB,qBAAqB,aAAa;CAE7D,MAAM,cAAc,kBAAkB;AAIpC,WAAS,EAAE,MAHE,aACT,iBAAiB,uBACjB,iBAAiB,oBACJ,CAAC;IACjB,CAAC,UAAU,WAAW,CAAC;AAE1B,QACE,oBAAC;EACC,GAAI;EACC;EACM;EACX,SAAQ;EACR,MAAK;EACO;EACZ,SAAS;EACT,cAAY,qBAAqB,WAAW;YAE5C,oBAAC;GAAK,MAAK;aACR,qBAAqB,oBAAC,cAAY,GAAG,oBAAC,iBAAe;IACjD;GACA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { PlayButtonProps } from "./types.js";
|
|
14
|
+
import "client-only";
|
|
15
|
+
import * as react_jsx_runtime66 from "react/jsx-runtime";
|
|
16
|
+
|
|
17
|
+
//#region src/components/media-controls/play-button.d.ts
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A media control button for play/pause functionality.
|
|
21
|
+
*
|
|
22
|
+
* Integrates with media-chrome's media store to control media playback.
|
|
23
|
+
* Automatically shows the appropriate icon based on the current playback state.
|
|
24
|
+
*
|
|
25
|
+
* @param props - The button props.
|
|
26
|
+
* @param props.className - CSS class name for the button.
|
|
27
|
+
* @param props.isDisabled - Whether the button is disabled.
|
|
28
|
+
* @param props.ref - Ref to the button element.
|
|
29
|
+
* @returns The rendered play/pause button.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* // Basic usage within MediaProvider
|
|
34
|
+
* <MediaProvider>
|
|
35
|
+
* <PlayButton />
|
|
36
|
+
* </MediaProvider>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare function PlayButton({
|
|
40
|
+
className,
|
|
41
|
+
isDisabled: isDisabledProp,
|
|
42
|
+
ref,
|
|
43
|
+
...rest
|
|
44
|
+
}: PlayButtonProps): react_jsx_runtime66.JSX.Element;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { PlayButton };
|
|
47
|
+
//# sourceMappingURL=play-button.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
'use client';
|
|
15
|
+
|
|
16
|
+
import { Icon } from "../icon/index.js";
|
|
17
|
+
import { Button } from "../button/index.js";
|
|
18
|
+
import { useMediaControlsDisabled } from "./context.js";
|
|
19
|
+
import "client-only";
|
|
20
|
+
import { useCallback } from "react";
|
|
21
|
+
import { jsx } from "react/jsx-runtime";
|
|
22
|
+
import { MediaActionTypes, useMediaDispatch, useMediaSelector } from "media-chrome/react/media-store";
|
|
23
|
+
import { Pause, Play } from "@accelint/icons";
|
|
24
|
+
|
|
25
|
+
//#region src/components/media-controls/play-button.tsx
|
|
26
|
+
/**
|
|
27
|
+
* A media control button for play/pause functionality.
|
|
28
|
+
*
|
|
29
|
+
* Integrates with media-chrome's media store to control media playback.
|
|
30
|
+
* Automatically shows the appropriate icon based on the current playback state.
|
|
31
|
+
*
|
|
32
|
+
* @param props - The button props.
|
|
33
|
+
* @param props.className - CSS class name for the button.
|
|
34
|
+
* @param props.isDisabled - Whether the button is disabled.
|
|
35
|
+
* @param props.ref - Ref to the button element.
|
|
36
|
+
* @returns The rendered play/pause button.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* // Basic usage within MediaProvider
|
|
41
|
+
* <MediaProvider>
|
|
42
|
+
* <PlayButton />
|
|
43
|
+
* </MediaProvider>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
function PlayButton({ className, isDisabled: isDisabledProp, ref, ...rest }) {
|
|
47
|
+
const dispatch = useMediaDispatch();
|
|
48
|
+
const mediaPaused = useMediaSelector((state) => state.mediaPaused);
|
|
49
|
+
const isDisabled = useMediaControlsDisabled(isDisabledProp);
|
|
50
|
+
const handleClick = useCallback(() => {
|
|
51
|
+
dispatch({ type: mediaPaused ? MediaActionTypes.MEDIA_PLAY_REQUEST : MediaActionTypes.MEDIA_PAUSE_REQUEST });
|
|
52
|
+
}, [dispatch, mediaPaused]);
|
|
53
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
54
|
+
...rest,
|
|
55
|
+
ref,
|
|
56
|
+
className,
|
|
57
|
+
variant: "icon",
|
|
58
|
+
size: "medium",
|
|
59
|
+
isDisabled,
|
|
60
|
+
onPress: handleClick,
|
|
61
|
+
"aria-label": mediaPaused ? "Play" : "Pause",
|
|
62
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
63
|
+
size: "medium",
|
|
64
|
+
children: mediaPaused ? /* @__PURE__ */ jsx(Play, {}) : /* @__PURE__ */ jsx(Pause, {})
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
export { PlayButton };
|
|
71
|
+
//# sourceMappingURL=play-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"play-button.js","names":[],"sources":["../../../src/components/media-controls/play-button.tsx"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n'use client';\n\nimport 'client-only';\nimport { Pause, Play } from '@accelint/icons';\nimport {\n MediaActionTypes,\n useMediaDispatch,\n useMediaSelector,\n} from 'media-chrome/react/media-store';\nimport { useCallback } from 'react';\nimport { Button } from '../button';\nimport { Icon } from '../icon';\nimport { useMediaControlsDisabled } from './context';\nimport type { PlayButtonProps } from './types';\n\n/**\n * A media control button for play/pause functionality.\n *\n * Integrates with media-chrome's media store to control media playback.\n * Automatically shows the appropriate icon based on the current playback state.\n *\n * @param props - The button props.\n * @param props.className - CSS class name for the button.\n * @param props.isDisabled - Whether the button is disabled.\n * @param props.ref - Ref to the button element.\n * @returns The rendered play/pause button.\n *\n * @example\n * ```tsx\n * // Basic usage within MediaProvider\n * <MediaProvider>\n * <PlayButton />\n * </MediaProvider>\n * ```\n */\nexport function PlayButton({\n className,\n isDisabled: isDisabledProp,\n ref,\n ...rest\n}: PlayButtonProps) {\n const dispatch = useMediaDispatch();\n const mediaPaused = useMediaSelector((state) => state.mediaPaused);\n const isDisabled = useMediaControlsDisabled(isDisabledProp);\n\n const handleClick = useCallback(() => {\n const type = mediaPaused\n ? MediaActionTypes.MEDIA_PLAY_REQUEST\n : MediaActionTypes.MEDIA_PAUSE_REQUEST;\n dispatch({ type });\n }, [dispatch, mediaPaused]);\n\n return (\n <Button\n {...rest}\n ref={ref}\n className={className}\n variant='icon'\n size='medium'\n isDisabled={isDisabled}\n onPress={handleClick}\n aria-label={mediaPaused ? 'Play' : 'Pause'}\n >\n <Icon size='medium'>{mediaPaused ? <Play /> : <Pause />}</Icon>\n </Button>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,SAAgB,WAAW,EACzB,WACA,YAAY,gBACZ,KACA,GAAG,QACe;CAClB,MAAM,WAAW,kBAAkB;CACnC,MAAM,cAAc,kBAAkB,UAAU,MAAM,YAAY;CAClE,MAAM,aAAa,yBAAyB,eAAe;CAE3D,MAAM,cAAc,kBAAkB;AAIpC,WAAS,EAAE,MAHE,cACT,iBAAiB,qBACjB,iBAAiB,qBACJ,CAAC;IACjB,CAAC,UAAU,YAAY,CAAC;AAE3B,QACE,oBAAC;EACC,GAAI;EACC;EACM;EACX,SAAQ;EACR,MAAK;EACO;EACZ,SAAS;EACT,cAAY,cAAc,SAAS;YAEnC,oBAAC;GAAK,MAAK;aAAU,cAAc,oBAAC,SAAO,GAAG,oBAAC,UAAQ;IAAQ;GACxD"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { PlaybackRateButtonProps } from "./types.js";
|
|
14
|
+
import "client-only";
|
|
15
|
+
import * as react_jsx_runtime67 from "react/jsx-runtime";
|
|
16
|
+
|
|
17
|
+
//#region src/components/media-controls/playback-rate.d.ts
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A media control button for changing playback speed.
|
|
21
|
+
*
|
|
22
|
+
* Integrates with media-chrome's media store to control playback rate.
|
|
23
|
+
* Cycles through available playback rates on each click.
|
|
24
|
+
* Shows the current playback rate as text (e.g., '1x', '2x').
|
|
25
|
+
* Invalid rates (negative, zero, NaN, Infinity) are automatically filtered out.
|
|
26
|
+
* If all provided rates are invalid, falls back to default rates [1, 2, 3].
|
|
27
|
+
*
|
|
28
|
+
* @param props - The button props.
|
|
29
|
+
* @param props.className - CSS class name for the button.
|
|
30
|
+
* @param props.rates - Array of playback rates to cycle through (default: [1, 2, 3]). Only positive finite numbers are accepted.
|
|
31
|
+
* @param props.isDisabled - Whether the button is disabled.
|
|
32
|
+
* @param props.ref - Ref to the button element.
|
|
33
|
+
* @returns The rendered playback rate button.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* // Basic usage within MediaProvider
|
|
38
|
+
* <MediaProvider>
|
|
39
|
+
* <PlaybackRateButton />
|
|
40
|
+
* </MediaProvider>
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* // With custom rates
|
|
46
|
+
* <PlaybackRateButton rates={[0.5, 1, 1.5, 2]} />
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
declare function PlaybackRateButton({
|
|
50
|
+
className,
|
|
51
|
+
rates,
|
|
52
|
+
isDisabled: isDisabledProp,
|
|
53
|
+
ref,
|
|
54
|
+
...rest
|
|
55
|
+
}: PlaybackRateButtonProps): react_jsx_runtime67.JSX.Element;
|
|
56
|
+
//#endregion
|
|
57
|
+
export { PlaybackRateButton };
|
|
58
|
+
//# sourceMappingURL=playback-rate.d.ts.map
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
'use client';
|
|
15
|
+
|
|
16
|
+
import { Button } from "../button/index.js";
|
|
17
|
+
import { useMediaControlsDisabled } from "./context.js";
|
|
18
|
+
import "client-only";
|
|
19
|
+
import { useCallback } from "react";
|
|
20
|
+
import { clsx } from "@accelint/design-foundation/lib/utils";
|
|
21
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
+
import { getLogger } from "@accelint/logger/default";
|
|
23
|
+
import { MediaActionTypes, useMediaDispatch, useMediaSelector } from "media-chrome/react/media-store";
|
|
24
|
+
import styles from "./styles.module.css";
|
|
25
|
+
|
|
26
|
+
//#region src/components/media-controls/playback-rate.tsx
|
|
27
|
+
const logger = getLogger({
|
|
28
|
+
enabled: process.env.NODE_ENV === "development",
|
|
29
|
+
level: "warn",
|
|
30
|
+
prefix: "[PlaybackRateButton]",
|
|
31
|
+
pretty: true
|
|
32
|
+
});
|
|
33
|
+
/** Default playback rate options: normal, 2x, and 3x speed. */
|
|
34
|
+
const DEFAULT_RATES = [
|
|
35
|
+
1,
|
|
36
|
+
2,
|
|
37
|
+
3
|
|
38
|
+
];
|
|
39
|
+
/**
|
|
40
|
+
* Filters to only positive finite numbers.
|
|
41
|
+
*
|
|
42
|
+
* @param rates - Array of rate values to filter.
|
|
43
|
+
* @returns Array containing only positive finite rates.
|
|
44
|
+
*/
|
|
45
|
+
const filterValidRates = (rates) => rates.filter((r) => Number.isFinite(r) && r > 0);
|
|
46
|
+
/**
|
|
47
|
+
* A media control button for changing playback speed.
|
|
48
|
+
*
|
|
49
|
+
* Integrates with media-chrome's media store to control playback rate.
|
|
50
|
+
* Cycles through available playback rates on each click.
|
|
51
|
+
* Shows the current playback rate as text (e.g., '1x', '2x').
|
|
52
|
+
* Invalid rates (negative, zero, NaN, Infinity) are automatically filtered out.
|
|
53
|
+
* If all provided rates are invalid, falls back to default rates [1, 2, 3].
|
|
54
|
+
*
|
|
55
|
+
* @param props - The button props.
|
|
56
|
+
* @param props.className - CSS class name for the button.
|
|
57
|
+
* @param props.rates - Array of playback rates to cycle through (default: [1, 2, 3]). Only positive finite numbers are accepted.
|
|
58
|
+
* @param props.isDisabled - Whether the button is disabled.
|
|
59
|
+
* @param props.ref - Ref to the button element.
|
|
60
|
+
* @returns The rendered playback rate button.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```tsx
|
|
64
|
+
* // Basic usage within MediaProvider
|
|
65
|
+
* <MediaProvider>
|
|
66
|
+
* <PlaybackRateButton />
|
|
67
|
+
* </MediaProvider>
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```tsx
|
|
72
|
+
* // With custom rates
|
|
73
|
+
* <PlaybackRateButton rates={[0.5, 1, 1.5, 2]} />
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
function PlaybackRateButton({ className, rates = DEFAULT_RATES, isDisabled: isDisabledProp, ref, ...rest }) {
|
|
77
|
+
const dispatch = useMediaDispatch();
|
|
78
|
+
const mediaPlaybackRate = useMediaSelector((state) => state.mediaPlaybackRate ?? 1);
|
|
79
|
+
const isDisabled = useMediaControlsDisabled(isDisabledProp);
|
|
80
|
+
const validRates = filterValidRates(rates);
|
|
81
|
+
const safeRates = validRates.length > 0 ? validRates : DEFAULT_RATES;
|
|
82
|
+
if (validRates.length === 0 && rates.length > 0) logger.warn(`Invalid rates provided, using defaults [${DEFAULT_RATES.join(", ")}].`);
|
|
83
|
+
const displayRate = Number.isFinite(mediaPlaybackRate) && mediaPlaybackRate > 0 ? mediaPlaybackRate : safeRates[0];
|
|
84
|
+
const handleClick = useCallback(() => {
|
|
85
|
+
const nextIndex = (safeRates.indexOf(mediaPlaybackRate) + 1) % safeRates.length;
|
|
86
|
+
dispatch({
|
|
87
|
+
type: MediaActionTypes.MEDIA_PLAYBACK_RATE_REQUEST,
|
|
88
|
+
detail: safeRates[nextIndex]
|
|
89
|
+
});
|
|
90
|
+
}, [
|
|
91
|
+
dispatch,
|
|
92
|
+
mediaPlaybackRate,
|
|
93
|
+
safeRates
|
|
94
|
+
]);
|
|
95
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
96
|
+
...rest,
|
|
97
|
+
ref,
|
|
98
|
+
className: clsx(styles.playbackRate, className),
|
|
99
|
+
variant: "icon",
|
|
100
|
+
size: "medium",
|
|
101
|
+
isDisabled,
|
|
102
|
+
onPress: handleClick,
|
|
103
|
+
"aria-label": `Playback rate ${displayRate}x`,
|
|
104
|
+
"data-testid": "playback-rate",
|
|
105
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
106
|
+
className: styles.playbackRateText,
|
|
107
|
+
children: [displayRate, "x"]
|
|
108
|
+
})
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
//#endregion
|
|
113
|
+
export { PlaybackRateButton };
|
|
114
|
+
//# sourceMappingURL=playback-rate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playback-rate.js","names":[],"sources":["../../../src/components/media-controls/playback-rate.tsx"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n'use client';\n\nimport 'client-only';\nimport { clsx } from '@accelint/design-foundation/lib/utils';\nimport { getLogger } from '@accelint/logger/default';\nimport {\n MediaActionTypes,\n useMediaDispatch,\n useMediaSelector,\n} from 'media-chrome/react/media-store';\nimport { useCallback } from 'react';\nimport { Button } from '../button';\nimport { useMediaControlsDisabled } from './context';\nimport styles from './styles.module.css';\nimport type { PlaybackRateButtonProps } from './types';\n\nconst logger = getLogger({\n enabled: process.env.NODE_ENV === 'development',\n level: 'warn',\n prefix: '[PlaybackRateButton]',\n pretty: true,\n});\n\n/** Default playback rate options: normal, 2x, and 3x speed. */\nconst DEFAULT_RATES = [1, 2, 3];\n\n/**\n * Filters to only positive finite numbers.\n *\n * @param rates - Array of rate values to filter.\n * @returns Array containing only positive finite rates.\n */\nconst filterValidRates = (rates: number[]) =>\n rates.filter((r) => Number.isFinite(r) && r > 0);\n\n/**\n * A media control button for changing playback speed.\n *\n * Integrates with media-chrome's media store to control playback rate.\n * Cycles through available playback rates on each click.\n * Shows the current playback rate as text (e.g., '1x', '2x').\n * Invalid rates (negative, zero, NaN, Infinity) are automatically filtered out.\n * If all provided rates are invalid, falls back to default rates [1, 2, 3].\n *\n * @param props - The button props.\n * @param props.className - CSS class name for the button.\n * @param props.rates - Array of playback rates to cycle through (default: [1, 2, 3]). Only positive finite numbers are accepted.\n * @param props.isDisabled - Whether the button is disabled.\n * @param props.ref - Ref to the button element.\n * @returns The rendered playback rate button.\n *\n * @example\n * ```tsx\n * // Basic usage within MediaProvider\n * <MediaProvider>\n * <PlaybackRateButton />\n * </MediaProvider>\n * ```\n *\n * @example\n * ```tsx\n * // With custom rates\n * <PlaybackRateButton rates={[0.5, 1, 1.5, 2]} />\n * ```\n */\nexport function PlaybackRateButton({\n className,\n rates = DEFAULT_RATES,\n isDisabled: isDisabledProp,\n ref,\n ...rest\n}: PlaybackRateButtonProps) {\n const dispatch = useMediaDispatch();\n const mediaPlaybackRate = useMediaSelector(\n (state) => state.mediaPlaybackRate ?? 1,\n );\n const isDisabled = useMediaControlsDisabled(isDisabledProp);\n\n const validRates = filterValidRates(rates);\n const safeRates = validRates.length > 0 ? validRates : DEFAULT_RATES;\n\n if (validRates.length === 0 && rates.length > 0) {\n logger.warn(\n `Invalid rates provided, using defaults [${DEFAULT_RATES.join(', ')}].`,\n );\n }\n\n const displayRate =\n Number.isFinite(mediaPlaybackRate) && mediaPlaybackRate > 0\n ? mediaPlaybackRate\n : safeRates[0];\n\n const handleClick = useCallback(() => {\n const currentIndex = safeRates.indexOf(mediaPlaybackRate);\n const nextIndex = (currentIndex + 1) % safeRates.length;\n dispatch({\n type: MediaActionTypes.MEDIA_PLAYBACK_RATE_REQUEST,\n detail: safeRates[nextIndex],\n });\n }, [dispatch, mediaPlaybackRate, safeRates]);\n\n return (\n <Button\n {...rest}\n ref={ref}\n className={clsx(styles.playbackRate, className)}\n variant='icon'\n size='medium'\n isDisabled={isDisabled}\n onPress={handleClick}\n aria-label={`Playback rate ${displayRate}x`}\n data-testid='playback-rate'\n >\n <span className={styles.playbackRateText}>{displayRate}x</span>\n </Button>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,SAAS,UAAU;CACvB,SAAS,QAAQ,IAAI,aAAa;CAClC,OAAO;CACP,QAAQ;CACR,QAAQ;CACT,CAAC;;AAGF,MAAM,gBAAgB;CAAC;CAAG;CAAG;CAAE;;;;;;;AAQ/B,MAAM,oBAAoB,UACxB,MAAM,QAAQ,MAAM,OAAO,SAAS,EAAE,IAAI,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgClD,SAAgB,mBAAmB,EACjC,WACA,QAAQ,eACR,YAAY,gBACZ,KACA,GAAG,QACuB;CAC1B,MAAM,WAAW,kBAAkB;CACnC,MAAM,oBAAoB,kBACvB,UAAU,MAAM,qBAAqB,EACvC;CACD,MAAM,aAAa,yBAAyB,eAAe;CAE3D,MAAM,aAAa,iBAAiB,MAAM;CAC1C,MAAM,YAAY,WAAW,SAAS,IAAI,aAAa;AAEvD,KAAI,WAAW,WAAW,KAAK,MAAM,SAAS,EAC5C,QAAO,KACL,2CAA2C,cAAc,KAAK,KAAK,CAAC,IACrE;CAGH,MAAM,cACJ,OAAO,SAAS,kBAAkB,IAAI,oBAAoB,IACtD,oBACA,UAAU;CAEhB,MAAM,cAAc,kBAAkB;EAEpC,MAAM,aADe,UAAU,QAAQ,kBAAkB,GACvB,KAAK,UAAU;AACjD,WAAS;GACP,MAAM,iBAAiB;GACvB,QAAQ,UAAU;GACnB,CAAC;IACD;EAAC;EAAU;EAAmB;EAAU,CAAC;AAE5C,QACE,oBAAC;EACC,GAAI;EACC;EACL,WAAW,KAAK,OAAO,cAAc,UAAU;EAC/C,SAAQ;EACR,MAAK;EACO;EACZ,SAAS;EACT,cAAY,iBAAiB,YAAY;EACzC,eAAY;YAEZ,qBAAC;GAAK,WAAW,OAAO;cAAmB,aAAY;IAAQ;GACxD"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { SeekButtonProps } from "./types.js";
|
|
14
|
+
import "client-only";
|
|
15
|
+
import * as react_jsx_runtime70 from "react/jsx-runtime";
|
|
16
|
+
|
|
17
|
+
//#region src/components/media-controls/seek-button.d.ts
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A media control button for seeking forward or backward.
|
|
21
|
+
*
|
|
22
|
+
* Integrates with media-chrome's media store to seek the media playback position.
|
|
23
|
+
* Can be configured to seek forward or backward with a customizable time offset.
|
|
24
|
+
* Invalid seekOffset values (negative, zero, NaN, Infinity) automatically fall back
|
|
25
|
+
* to the default of 10 seconds.
|
|
26
|
+
*
|
|
27
|
+
* @param props - The button props.
|
|
28
|
+
* @param props.className - CSS class name for the button.
|
|
29
|
+
* @param props.direction - Direction to seek ('forward' or 'backward').
|
|
30
|
+
* @param props.seekOffset - Number of seconds to seek (default: 10). Must be a positive finite number.
|
|
31
|
+
* @param props.isDisabled - Whether the button is disabled.
|
|
32
|
+
* @param props.ref - Ref to the button element.
|
|
33
|
+
* @returns The rendered seek button.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* // Basic usage within MediaProvider
|
|
38
|
+
* <MediaProvider>
|
|
39
|
+
* <SeekButton direction="backward" />
|
|
40
|
+
* <SeekButton direction="forward" />
|
|
41
|
+
* </MediaProvider>
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```tsx
|
|
46
|
+
* // With custom seek offset (30 seconds)
|
|
47
|
+
* <SeekButton direction="forward" seekOffset={30} />
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
declare function SeekButton({
|
|
51
|
+
className,
|
|
52
|
+
direction,
|
|
53
|
+
seekOffset: seekOffsetProp,
|
|
54
|
+
isDisabled: isDisabledProp,
|
|
55
|
+
ref,
|
|
56
|
+
...rest
|
|
57
|
+
}: SeekButtonProps): react_jsx_runtime70.JSX.Element;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { SeekButton };
|
|
60
|
+
//# sourceMappingURL=seek-button.d.ts.map
|