@accelint/design-toolkit 9.4.1 → 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/segment.d.ts +2 -2
- 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 +3 -3
- 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/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 +2 -2
- 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 +4 -4
- 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 +23 -8
|
@@ -0,0 +1,66 @@
|
|
|
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 { MediaControlsContextValue } from "./types.js";
|
|
14
|
+
import "client-only";
|
|
15
|
+
import * as react13 from "react";
|
|
16
|
+
import { PropsWithChildren } from "react";
|
|
17
|
+
import * as react_jsx_runtime61 from "react/jsx-runtime";
|
|
18
|
+
|
|
19
|
+
//#region src/components/media-controls/context.d.ts
|
|
20
|
+
/**
|
|
21
|
+
* Context for MediaControls component.
|
|
22
|
+
*
|
|
23
|
+
* Provides shared configuration values (isDisabled) to all child controls.
|
|
24
|
+
*/
|
|
25
|
+
declare const MediaControlsContext: react13.Context<MediaControlsContextValue>;
|
|
26
|
+
/**
|
|
27
|
+
* Validates that media-chrome's MediaProvider is present.
|
|
28
|
+
*
|
|
29
|
+
* @throws {Error} Throws if called outside a MediaProvider context.
|
|
30
|
+
*/
|
|
31
|
+
declare function useMediaProviderGuard(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Resolves disabled state from prop or context.
|
|
34
|
+
*
|
|
35
|
+
* Returns true if either the prop or context indicates disabled.
|
|
36
|
+
* A parent context disabling controls cannot be overridden by children.
|
|
37
|
+
*
|
|
38
|
+
* @param propIsDisabled - The disabled prop value.
|
|
39
|
+
* @returns The resolved disabled state.
|
|
40
|
+
*/
|
|
41
|
+
declare function useMediaControlsDisabled(propIsDisabled?: boolean): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Provider for MediaControls component.
|
|
44
|
+
*
|
|
45
|
+
* Provides shared configuration to all media control children.
|
|
46
|
+
*
|
|
47
|
+
* @param props - The provider props.
|
|
48
|
+
* @param props.children - Child components to receive context.
|
|
49
|
+
* @param props.isDisabled - Whether controls are disabled.
|
|
50
|
+
* @returns The context provider wrapping children.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* <MediaControlsProvider isDisabled={false}>
|
|
55
|
+
* <PlayButton />
|
|
56
|
+
* <MuteButton />
|
|
57
|
+
* </MediaControlsProvider>
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
declare function MediaControlsProvider({
|
|
61
|
+
children,
|
|
62
|
+
isDisabled
|
|
63
|
+
}: PropsWithChildren<Partial<MediaControlsContextValue>>): react_jsx_runtime61.JSX.Element;
|
|
64
|
+
//#endregion
|
|
65
|
+
export { MediaControlsContext, MediaControlsProvider, useMediaControlsDisabled, useMediaProviderGuard };
|
|
66
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
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 "client-only";
|
|
17
|
+
import { createContext, useContext, useMemo } from "react";
|
|
18
|
+
import { jsx } from "react/jsx-runtime";
|
|
19
|
+
import { useMediaStore } from "media-chrome/react/media-store";
|
|
20
|
+
|
|
21
|
+
//#region src/components/media-controls/context.tsx
|
|
22
|
+
/**
|
|
23
|
+
* Context for MediaControls component.
|
|
24
|
+
*
|
|
25
|
+
* Provides shared configuration values (isDisabled) to all child controls.
|
|
26
|
+
*/
|
|
27
|
+
const MediaControlsContext = createContext({ isDisabled: false });
|
|
28
|
+
/**
|
|
29
|
+
* Validates that media-chrome's MediaProvider is present.
|
|
30
|
+
*
|
|
31
|
+
* @throws {Error} Throws if called outside a MediaProvider context.
|
|
32
|
+
*/
|
|
33
|
+
function useMediaProviderGuard() {
|
|
34
|
+
if (!useMediaStore()) throw new Error("MediaControls must be used within a MediaProvider from media-chrome.");
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Resolves disabled state from prop or context.
|
|
38
|
+
*
|
|
39
|
+
* Returns true if either the prop or context indicates disabled.
|
|
40
|
+
* A parent context disabling controls cannot be overridden by children.
|
|
41
|
+
*
|
|
42
|
+
* @param propIsDisabled - The disabled prop value.
|
|
43
|
+
* @returns The resolved disabled state.
|
|
44
|
+
*/
|
|
45
|
+
function useMediaControlsDisabled(propIsDisabled) {
|
|
46
|
+
const context = useContext(MediaControlsContext);
|
|
47
|
+
return Boolean(propIsDisabled || context.isDisabled);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Provider for MediaControls component.
|
|
51
|
+
*
|
|
52
|
+
* Provides shared configuration to all media control children.
|
|
53
|
+
*
|
|
54
|
+
* @param props - The provider props.
|
|
55
|
+
* @param props.children - Child components to receive context.
|
|
56
|
+
* @param props.isDisabled - Whether controls are disabled.
|
|
57
|
+
* @returns The context provider wrapping children.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* <MediaControlsProvider isDisabled={false}>
|
|
62
|
+
* <PlayButton />
|
|
63
|
+
* <MuteButton />
|
|
64
|
+
* </MediaControlsProvider>
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
function MediaControlsProvider({ children, isDisabled = false }) {
|
|
68
|
+
const value = useMemo(() => ({ isDisabled }), [isDisabled]);
|
|
69
|
+
return /* @__PURE__ */ jsx(MediaControlsContext.Provider, {
|
|
70
|
+
value,
|
|
71
|
+
children
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
export { MediaControlsContext, MediaControlsProvider, useMediaControlsDisabled, useMediaProviderGuard };
|
|
77
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","names":[],"sources":["../../../src/components/media-controls/context.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 { useMediaStore } from 'media-chrome/react/media-store';\nimport {\n createContext,\n type PropsWithChildren,\n useContext,\n useMemo,\n} from 'react';\nimport type { MediaControlsContextValue } from './types';\n\n/**\n * Context for MediaControls component.\n *\n * Provides shared configuration values (isDisabled) to all child controls.\n */\nexport const MediaControlsContext = createContext<MediaControlsContextValue>({\n isDisabled: false,\n});\n\n/**\n * Validates that media-chrome's MediaProvider is present.\n *\n * @throws {Error} Throws if called outside a MediaProvider context.\n */\nexport function useMediaProviderGuard(): void {\n const store = useMediaStore();\n if (!store) {\n throw new Error(\n 'MediaControls must be used within a MediaProvider from media-chrome.',\n );\n }\n}\n\n/**\n * Resolves disabled state from prop or context.\n *\n * Returns true if either the prop or context indicates disabled.\n * A parent context disabling controls cannot be overridden by children.\n *\n * @param propIsDisabled - The disabled prop value.\n * @returns The resolved disabled state.\n */\nexport function useMediaControlsDisabled(propIsDisabled?: boolean): boolean {\n const context = useContext(MediaControlsContext);\n return Boolean(propIsDisabled || context.isDisabled);\n}\n\n/**\n * Provider for MediaControls component.\n *\n * Provides shared configuration to all media control children.\n *\n * @param props - The provider props.\n * @param props.children - Child components to receive context.\n * @param props.isDisabled - Whether controls are disabled.\n * @returns The context provider wrapping children.\n *\n * @example\n * ```tsx\n * <MediaControlsProvider isDisabled={false}>\n * <PlayButton />\n * <MuteButton />\n * </MediaControlsProvider>\n * ```\n */\nexport function MediaControlsProvider({\n children,\n isDisabled = false,\n}: PropsWithChildren<Partial<MediaControlsContextValue>>) {\n const value = useMemo(() => ({ isDisabled }), [isDisabled]);\n\n return (\n <MediaControlsContext.Provider value={value}>\n {children}\n </MediaControlsContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,uBAAuB,cAAyC,EAC3E,YAAY,OACb,CAAC;;;;;;AAOF,SAAgB,wBAA8B;AAE5C,KAAI,CADU,eAAe,CAE3B,OAAM,IAAI,MACR,uEACD;;;;;;;;;;;AAaL,SAAgB,yBAAyB,gBAAmC;CAC1E,MAAM,UAAU,WAAW,qBAAqB;AAChD,QAAO,QAAQ,kBAAkB,QAAQ,WAAW;;;;;;;;;;;;;;;;;;;;AAqBtD,SAAgB,sBAAsB,EACpC,UACA,aAAa,SAC2C;CACxD,MAAM,QAAQ,eAAe,EAAE,YAAY,GAAG,CAAC,WAAW,CAAC;AAE3D,QACE,oBAAC,qBAAqB;EAAgB;EACnC;GAC6B"}
|
|
@@ -0,0 +1,68 @@
|
|
|
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 { MediaControlsProps } from "./types.js";
|
|
14
|
+
import "client-only";
|
|
15
|
+
import * as react_jsx_runtime62 from "react/jsx-runtime";
|
|
16
|
+
|
|
17
|
+
//#region src/components/media-controls/index.d.ts
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A container for media playback controls.
|
|
21
|
+
*
|
|
22
|
+
* Composes media control sub-components into a cohesive control bar.
|
|
23
|
+
* Must be used within a MediaProvider context from media-chrome.
|
|
24
|
+
*
|
|
25
|
+
* @param props - The component props.
|
|
26
|
+
* @param props.className - CSS class name for the container.
|
|
27
|
+
* @param props.classNames - Class names for sub-elements.
|
|
28
|
+
* @param props.children - Media control components to render.
|
|
29
|
+
* @param props.isDisabled - Disables all child controls via context.
|
|
30
|
+
* @returns The rendered media controls container.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <MediaProvider>
|
|
35
|
+
* <MediaControls>
|
|
36
|
+
* <PlayButton />
|
|
37
|
+
* <TimeDisplay mode="current" />
|
|
38
|
+
* <TimeRange />
|
|
39
|
+
* <MuteButton />
|
|
40
|
+
* <VolumeSlider />
|
|
41
|
+
* </MediaControls>
|
|
42
|
+
* </MediaProvider>
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* // Audio player with seek controls
|
|
48
|
+
* <MediaProvider>
|
|
49
|
+
* <MediaControls>
|
|
50
|
+
* <SeekButton direction="backward" seekOffset={15} />
|
|
51
|
+
* <PlayButton />
|
|
52
|
+
* <SeekButton direction="forward" seekOffset={15} />
|
|
53
|
+
* <TimeDisplay mode="current" />
|
|
54
|
+
* <PlaybackRateButton rates={[0.5, 1, 1.5, 2]} />
|
|
55
|
+
* </MediaControls>
|
|
56
|
+
* </MediaProvider>
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
declare function MediaControls({
|
|
60
|
+
className,
|
|
61
|
+
classNames,
|
|
62
|
+
children,
|
|
63
|
+
isDisabled,
|
|
64
|
+
...rest
|
|
65
|
+
}: MediaControlsProps): react_jsx_runtime62.JSX.Element;
|
|
66
|
+
//#endregion
|
|
67
|
+
export { MediaControls };
|
|
68
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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
|