@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
package/catalog-info.yaml
CHANGED
|
@@ -12,14 +12,14 @@ metadata:
|
|
|
12
12
|
Dependencies:
|
|
13
13
|
|
|
14
14
|
accelint_biome-config@1.1.0, accelint_bus@3.0.2, accelint_core@0.5.2,
|
|
15
|
-
accelint_design-foundation@2.1.0, accelint_geo@0.5.1, accelint_icons@2.
|
|
15
|
+
accelint_design-foundation@2.1.0, accelint_geo@0.5.1, accelint_icons@2.2.0,
|
|
16
16
|
accelint_logger@0.1.5, accelint_postcss-tailwind-css-modules@1.0.1,
|
|
17
17
|
accelint_prettier-config@0.2.1, accelint_temporal@0.1.4,
|
|
18
18
|
accelint_typescript-config@0.1.4, accelint_vitest-config@0.1.6
|
|
19
19
|
annotations:
|
|
20
20
|
backstage.io/edit-url: https://github.com/gohypergiant/standard-toolkit/blob/main/packages/design-toolkit/catalog-info.yaml
|
|
21
21
|
backstage.io/techdocs-ref: dir:.
|
|
22
|
-
package/version: 9.
|
|
22
|
+
package/version: 9.5.0
|
|
23
23
|
github.com/project-slug: gohypergiant/standard-toolkit
|
|
24
24
|
links:
|
|
25
25
|
- url: https://github.com/gohypergiant/standard-toolkit/tree/main/packages/design-toolkit
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { AccordionGroupProps } from "./types.js";
|
|
14
14
|
import "client-only";
|
|
15
|
-
import * as
|
|
15
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
16
16
|
|
|
17
17
|
//#region src/components/accordion/group.d.ts
|
|
18
18
|
|
|
@@ -57,7 +57,7 @@ declare function AccordionGroup({
|
|
|
57
57
|
variant,
|
|
58
58
|
isDisabled,
|
|
59
59
|
...rest
|
|
60
|
-
}: AccordionGroupProps):
|
|
60
|
+
}: AccordionGroupProps): react_jsx_runtime2.JSX.Element;
|
|
61
61
|
//#endregion
|
|
62
62
|
export { AccordionGroup };
|
|
63
63
|
//# sourceMappingURL=group.d.ts.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { AccordionHeaderProps } from "./types.js";
|
|
14
14
|
import "client-only";
|
|
15
|
-
import * as
|
|
15
|
+
import * as react_jsx_runtime14 from "react/jsx-runtime";
|
|
16
16
|
|
|
17
17
|
//#region src/components/accordion/header.d.ts
|
|
18
18
|
|
|
@@ -44,7 +44,7 @@ declare function AccordionHeader({
|
|
|
44
44
|
ref,
|
|
45
45
|
children,
|
|
46
46
|
className
|
|
47
|
-
}: AccordionHeaderProps):
|
|
47
|
+
}: AccordionHeaderProps): react_jsx_runtime14.JSX.Element;
|
|
48
48
|
//#endregion
|
|
49
49
|
export { AccordionHeader };
|
|
50
50
|
//# sourceMappingURL=header.d.ts.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { AccordionProps } from "./types.js";
|
|
14
14
|
import "client-only";
|
|
15
|
-
import * as
|
|
15
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
16
16
|
|
|
17
17
|
//#region src/components/accordion/index.d.ts
|
|
18
18
|
|
|
@@ -75,7 +75,7 @@ import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
75
75
|
declare function Accordion({
|
|
76
76
|
ref,
|
|
77
77
|
...props
|
|
78
|
-
}: AccordionProps):
|
|
78
|
+
}: AccordionProps): react_jsx_runtime3.JSX.Element;
|
|
79
79
|
//#endregion
|
|
80
80
|
export { Accordion };
|
|
81
81
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { AccordionPanelProps } from "./types.js";
|
|
14
14
|
import "client-only";
|
|
15
|
-
import * as
|
|
15
|
+
import * as react_jsx_runtime13 from "react/jsx-runtime";
|
|
16
16
|
|
|
17
17
|
//#region src/components/accordion/panel.d.ts
|
|
18
18
|
|
|
@@ -47,7 +47,7 @@ declare function AccordionPanel({
|
|
|
47
47
|
children,
|
|
48
48
|
className,
|
|
49
49
|
...rest
|
|
50
|
-
}: AccordionPanelProps):
|
|
50
|
+
}: AccordionPanelProps): react_jsx_runtime13.JSX.Element;
|
|
51
51
|
//#endregion
|
|
52
52
|
export { AccordionPanel };
|
|
53
53
|
//# sourceMappingURL=panel.d.ts.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { AccordionTriggerProps } from "./types.js";
|
|
14
14
|
import "client-only";
|
|
15
|
-
import * as
|
|
15
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
16
16
|
|
|
17
17
|
//#region src/components/accordion/trigger.d.ts
|
|
18
18
|
|
|
@@ -42,7 +42,7 @@ declare function AccordionTrigger({
|
|
|
42
42
|
ref,
|
|
43
43
|
children,
|
|
44
44
|
classNames
|
|
45
|
-
}: AccordionTriggerProps):
|
|
45
|
+
}: AccordionTriggerProps): react_jsx_runtime0.JSX.Element;
|
|
46
46
|
//#endregion
|
|
47
47
|
export { AccordionTrigger };
|
|
48
48
|
//# sourceMappingURL=trigger.d.ts.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { ActionBarProps } from "./types.js";
|
|
14
14
|
import "client-only";
|
|
15
|
-
import * as
|
|
15
|
+
import * as react_jsx_runtime93 from "react/jsx-runtime";
|
|
16
16
|
|
|
17
17
|
//#region src/components/action-bar/index.d.ts
|
|
18
18
|
|
|
@@ -59,7 +59,7 @@ declare function ActionBar({
|
|
|
59
59
|
elevation,
|
|
60
60
|
size,
|
|
61
61
|
...rest
|
|
62
|
-
}: ActionBarProps):
|
|
62
|
+
}: ActionBarProps): react_jsx_runtime93.JSX.Element;
|
|
63
63
|
//#endregion
|
|
64
64
|
export { ActionBar };
|
|
65
65
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,104 @@
|
|
|
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 { AudioProps } from "./types.js";
|
|
14
|
+
import "client-only";
|
|
15
|
+
import * as react_jsx_runtime97 from "react/jsx-runtime";
|
|
16
|
+
|
|
17
|
+
//#region src/components/audio/index.d.ts
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A complete audio player component.
|
|
21
|
+
*
|
|
22
|
+
* Combines an HTML audio element with MediaControls to provide a fully-featured
|
|
23
|
+
* audio player with play/pause, seek, volume control, and playback rate adjustment.
|
|
24
|
+
*
|
|
25
|
+
* Uses media-chrome under the hood for state management and MediaController
|
|
26
|
+
* for the accessible media chrome elements.
|
|
27
|
+
*
|
|
28
|
+
* @param props - The component props.
|
|
29
|
+
* @param props.src - Audio source URL. Must be accessible to the browser - if loading
|
|
30
|
+
* from a different origin, ensure the server sends appropriate CORS headers
|
|
31
|
+
* (Access-Control-Allow-Origin) or use the crossOrigin prop.
|
|
32
|
+
* @param props.title - Title to display (e.g., filename).
|
|
33
|
+
* @param props.classNames - Class names for sub-elements.
|
|
34
|
+
* @param props.isDisabled - Disable all audio controls.
|
|
35
|
+
* @param props.crossOrigin - CORS setting ('anonymous' | 'use-credentials'). Required when
|
|
36
|
+
* loading audio from a different origin that requires credentials or when using canvas
|
|
37
|
+
* to analyze audio. Without proper CORS configuration, the audio may fail to load.
|
|
38
|
+
* @param props.playbackRates - Array of playback speed multipliers (default: [1, 2, 3]).
|
|
39
|
+
* Only positive finite numbers are accepted; invalid values are filtered out.
|
|
40
|
+
* @param props.children - Custom controls to render instead of the default layout.
|
|
41
|
+
* @param props.onEnded - Callback invoked when audio playback finishes.
|
|
42
|
+
* @param props.onTimeUpdate - Callback invoked during playback with current time in seconds.
|
|
43
|
+
* @param props.onError - Callback invoked when audio fails to load or encounters an error.
|
|
44
|
+
* @param props.noHotkeys - Disable all keyboard shortcuts for media control.
|
|
45
|
+
* @param props.hotkeys - Custom keyboard shortcuts configuration for media control.
|
|
46
|
+
* @param props.noVolumePref - Disable automatic saving/restoring of volume preference.
|
|
47
|
+
* @param props.noMutedPref - Disable automatic saving/restoring of muted state preference.
|
|
48
|
+
* @param props.lang - Language code for localized media control labels.
|
|
49
|
+
* @returns The rendered audio player component.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```tsx
|
|
53
|
+
* // Basic usage
|
|
54
|
+
* <Audio src="audio.mp3" title="My Audio File" />
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```tsx
|
|
59
|
+
* // With event callbacks
|
|
60
|
+
* <Audio
|
|
61
|
+
* src="audio.mp3"
|
|
62
|
+
* title="My Audio File"
|
|
63
|
+
* onPlay={() => console.log('Playing')}
|
|
64
|
+
* onPause={() => console.log('Paused')}
|
|
65
|
+
* onEnded={() => console.log('Ended')}
|
|
66
|
+
* onTimeUpdate={(time) => console.log('Current time:', time)}
|
|
67
|
+
* />
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```tsx
|
|
72
|
+
* // Custom controls layout
|
|
73
|
+
* <Audio src="audio.mp3">
|
|
74
|
+
* <PlayButton />
|
|
75
|
+
* <TimeRange />
|
|
76
|
+
* </Audio>
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```tsx
|
|
81
|
+
* // Loading audio from external origin (requires CORS)
|
|
82
|
+
* <Audio
|
|
83
|
+
* src="https://example.com/audio.mp3"
|
|
84
|
+
* crossOrigin="anonymous"
|
|
85
|
+
* onError={(error) => {
|
|
86
|
+
* // Handle CORS or loading errors
|
|
87
|
+
* console.error('Failed to load audio:', error);
|
|
88
|
+
* }}
|
|
89
|
+
* />
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
declare function Audio({
|
|
93
|
+
classNames,
|
|
94
|
+
isDisabled,
|
|
95
|
+
noHotkeys,
|
|
96
|
+
hotkeys,
|
|
97
|
+
noVolumePref,
|
|
98
|
+
noMutedPref,
|
|
99
|
+
lang,
|
|
100
|
+
...rest
|
|
101
|
+
}: AudioProps): react_jsx_runtime97.JSX.Element;
|
|
102
|
+
//#endregion
|
|
103
|
+
export { Audio };
|
|
104
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,242 @@
|
|
|
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 } from "../media-controls/context.js";
|
|
17
|
+
import { MuteButton } from "../media-controls/mute-button.js";
|
|
18
|
+
import { PlayButton } from "../media-controls/play-button.js";
|
|
19
|
+
import { PlaybackRateButton } from "../media-controls/playback-rate.js";
|
|
20
|
+
import { SeekButton } from "../media-controls/seek-button.js";
|
|
21
|
+
import { TimeDisplay } from "../media-controls/time-display.js";
|
|
22
|
+
import { TimeRange } from "../media-controls/time-range.js";
|
|
23
|
+
import { VolumeSlider } from "../media-controls/volume-slider.js";
|
|
24
|
+
import "client-only";
|
|
25
|
+
import { useEffect, useState } from "react";
|
|
26
|
+
import { clsx } from "@accelint/design-foundation/lib/utils";
|
|
27
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
28
|
+
import { getLogger } from "@accelint/logger/default";
|
|
29
|
+
import { formatError } from "media-chrome/dist/labels/labels.js";
|
|
30
|
+
import { MediaController } from "media-chrome/react";
|
|
31
|
+
import { MediaProvider, useMediaRef } from "media-chrome/react/media-store";
|
|
32
|
+
import styles from "./styles.module.css";
|
|
33
|
+
|
|
34
|
+
//#region src/components/audio/index.tsx
|
|
35
|
+
const logger = getLogger({
|
|
36
|
+
enabled: true,
|
|
37
|
+
level: "error",
|
|
38
|
+
prefix: "[Audio]",
|
|
39
|
+
pretty: true
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Internal component that renders within MediaProvider context.
|
|
43
|
+
*
|
|
44
|
+
* This component is separated from the main Audio component to allow use of
|
|
45
|
+
* media-chrome hooks (useMediaRef) that require MediaProvider context.
|
|
46
|
+
* The outer Audio component wraps everything in MediaProvider, then AudioInner
|
|
47
|
+
* handles the actual audio element and controls rendering.
|
|
48
|
+
*
|
|
49
|
+
* @param props - The component props.
|
|
50
|
+
* @param props.src - Audio source URL.
|
|
51
|
+
* @param props.title - Title to display (e.g., filename).
|
|
52
|
+
* @param props.classNames - Class names for sub-elements.
|
|
53
|
+
* @param props.children - Custom controls (replaces default layout).
|
|
54
|
+
* @param props.autoPlay - Whether to autoplay the audio.
|
|
55
|
+
* @param props.loop - Whether to loop the audio.
|
|
56
|
+
* @param props.muted - Whether the audio starts muted.
|
|
57
|
+
* @param props.preload - Audio preload strategy.
|
|
58
|
+
* @param props.crossOrigin - CORS setting for the audio element.
|
|
59
|
+
* @param props.isDisabled - Whether to disable all audio controls.
|
|
60
|
+
* @param props.onEnded - Callback when audio ends.
|
|
61
|
+
* @param props.onTimeUpdate - Callback when playback time updates.
|
|
62
|
+
* @param props.onLoadedMetadata - Callback when metadata is loaded.
|
|
63
|
+
* @param props.onPlay - Callback when audio starts playing.
|
|
64
|
+
* @param props.onPause - Callback when audio is paused.
|
|
65
|
+
* @param props.onError - Callback when an error occurs.
|
|
66
|
+
* @param props.playbackRates - Custom playback rate options.
|
|
67
|
+
* @returns The audio element with controls.
|
|
68
|
+
*/
|
|
69
|
+
function AudioInner({ src, title, children, classNames, autoPlay, loop, muted, preload = "metadata", crossOrigin, isDisabled: isDisabledProp, onEnded, onTimeUpdate, onLoadedMetadata, onPlay, onPause, onError, playbackRates }) {
|
|
70
|
+
const mediaRef = useMediaRef();
|
|
71
|
+
const [errorMessage, setErrorMessage] = useState("");
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
setErrorMessage("");
|
|
74
|
+
}, [src]);
|
|
75
|
+
const isDisabled = isDisabledProp === true || errorMessage !== "";
|
|
76
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("audio", {
|
|
77
|
+
ref: mediaRef,
|
|
78
|
+
slot: "media",
|
|
79
|
+
className: styles.audio,
|
|
80
|
+
"data-testid": "audio-element",
|
|
81
|
+
autoPlay,
|
|
82
|
+
loop,
|
|
83
|
+
muted,
|
|
84
|
+
preload,
|
|
85
|
+
crossOrigin,
|
|
86
|
+
onEnded: () => onEnded?.(),
|
|
87
|
+
onTimeUpdate: (e) => {
|
|
88
|
+
const time = e.currentTarget.currentTime;
|
|
89
|
+
if (Number.isFinite(time)) onTimeUpdate?.(time);
|
|
90
|
+
},
|
|
91
|
+
onLoadedMetadata: (e) => onLoadedMetadata?.(e),
|
|
92
|
+
onPlay: (e) => onPlay?.(e),
|
|
93
|
+
onPause: (e) => onPause?.(e),
|
|
94
|
+
onError: (e) => {
|
|
95
|
+
const mediaError = e.currentTarget.error;
|
|
96
|
+
logger.withContext({ src }).withError(mediaError).error("Failed to load audio");
|
|
97
|
+
setErrorMessage((mediaError && formatError(mediaError)?.message) ?? "Unable to load audio file");
|
|
98
|
+
if (mediaError) onError?.(mediaError);
|
|
99
|
+
},
|
|
100
|
+
children: /* @__PURE__ */ jsx("source", { src })
|
|
101
|
+
}), /* @__PURE__ */ jsx(MediaControlsProvider, {
|
|
102
|
+
isDisabled,
|
|
103
|
+
children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
104
|
+
title && /* @__PURE__ */ jsx("div", {
|
|
105
|
+
className: clsx(styles.titleRow, classNames?.title),
|
|
106
|
+
children: title
|
|
107
|
+
}),
|
|
108
|
+
errorMessage && /* @__PURE__ */ jsx("div", {
|
|
109
|
+
className: styles.errorMessage,
|
|
110
|
+
children: errorMessage
|
|
111
|
+
}),
|
|
112
|
+
/* @__PURE__ */ jsxs("div", {
|
|
113
|
+
className: clsx(styles.controls, classNames?.mediaControls),
|
|
114
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
115
|
+
className: clsx(styles.timeRow, classNames?.timeRow),
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ jsx(TimeDisplay, { mode: "current" }),
|
|
118
|
+
/* @__PURE__ */ jsx(TimeRange, {}),
|
|
119
|
+
/* @__PURE__ */ jsx(TimeDisplay, { mode: "duration" })
|
|
120
|
+
]
|
|
121
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
122
|
+
className: clsx(styles.controlsRow, classNames?.controlsRow),
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ jsx("div", {
|
|
125
|
+
className: styles.leftGroup,
|
|
126
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
127
|
+
className: styles.volumeGroup,
|
|
128
|
+
children: [/* @__PURE__ */ jsx(MuteButton, {}), /* @__PURE__ */ jsx(VolumeSlider, {})]
|
|
129
|
+
})
|
|
130
|
+
}),
|
|
131
|
+
/* @__PURE__ */ jsxs("div", {
|
|
132
|
+
className: styles.playbackGroup,
|
|
133
|
+
children: [
|
|
134
|
+
/* @__PURE__ */ jsx(SeekButton, { direction: "backward" }),
|
|
135
|
+
/* @__PURE__ */ jsx(PlayButton, {}),
|
|
136
|
+
/* @__PURE__ */ jsx(SeekButton, { direction: "forward" })
|
|
137
|
+
]
|
|
138
|
+
}),
|
|
139
|
+
/* @__PURE__ */ jsx("div", {
|
|
140
|
+
className: styles.rightGroup,
|
|
141
|
+
children: /* @__PURE__ */ jsx(PlaybackRateButton, { rates: playbackRates })
|
|
142
|
+
})
|
|
143
|
+
]
|
|
144
|
+
})]
|
|
145
|
+
})
|
|
146
|
+
] })
|
|
147
|
+
})] });
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* A complete audio player component.
|
|
151
|
+
*
|
|
152
|
+
* Combines an HTML audio element with MediaControls to provide a fully-featured
|
|
153
|
+
* audio player with play/pause, seek, volume control, and playback rate adjustment.
|
|
154
|
+
*
|
|
155
|
+
* Uses media-chrome under the hood for state management and MediaController
|
|
156
|
+
* for the accessible media chrome elements.
|
|
157
|
+
*
|
|
158
|
+
* @param props - The component props.
|
|
159
|
+
* @param props.src - Audio source URL. Must be accessible to the browser - if loading
|
|
160
|
+
* from a different origin, ensure the server sends appropriate CORS headers
|
|
161
|
+
* (Access-Control-Allow-Origin) or use the crossOrigin prop.
|
|
162
|
+
* @param props.title - Title to display (e.g., filename).
|
|
163
|
+
* @param props.classNames - Class names for sub-elements.
|
|
164
|
+
* @param props.isDisabled - Disable all audio controls.
|
|
165
|
+
* @param props.crossOrigin - CORS setting ('anonymous' | 'use-credentials'). Required when
|
|
166
|
+
* loading audio from a different origin that requires credentials or when using canvas
|
|
167
|
+
* to analyze audio. Without proper CORS configuration, the audio may fail to load.
|
|
168
|
+
* @param props.playbackRates - Array of playback speed multipliers (default: [1, 2, 3]).
|
|
169
|
+
* Only positive finite numbers are accepted; invalid values are filtered out.
|
|
170
|
+
* @param props.children - Custom controls to render instead of the default layout.
|
|
171
|
+
* @param props.onEnded - Callback invoked when audio playback finishes.
|
|
172
|
+
* @param props.onTimeUpdate - Callback invoked during playback with current time in seconds.
|
|
173
|
+
* @param props.onError - Callback invoked when audio fails to load or encounters an error.
|
|
174
|
+
* @param props.noHotkeys - Disable all keyboard shortcuts for media control.
|
|
175
|
+
* @param props.hotkeys - Custom keyboard shortcuts configuration for media control.
|
|
176
|
+
* @param props.noVolumePref - Disable automatic saving/restoring of volume preference.
|
|
177
|
+
* @param props.noMutedPref - Disable automatic saving/restoring of muted state preference.
|
|
178
|
+
* @param props.lang - Language code for localized media control labels.
|
|
179
|
+
* @returns The rendered audio player component.
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```tsx
|
|
183
|
+
* // Basic usage
|
|
184
|
+
* <Audio src="audio.mp3" title="My Audio File" />
|
|
185
|
+
* ```
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```tsx
|
|
189
|
+
* // With event callbacks
|
|
190
|
+
* <Audio
|
|
191
|
+
* src="audio.mp3"
|
|
192
|
+
* title="My Audio File"
|
|
193
|
+
* onPlay={() => console.log('Playing')}
|
|
194
|
+
* onPause={() => console.log('Paused')}
|
|
195
|
+
* onEnded={() => console.log('Ended')}
|
|
196
|
+
* onTimeUpdate={(time) => console.log('Current time:', time)}
|
|
197
|
+
* />
|
|
198
|
+
* ```
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```tsx
|
|
202
|
+
* // Custom controls layout
|
|
203
|
+
* <Audio src="audio.mp3">
|
|
204
|
+
* <PlayButton />
|
|
205
|
+
* <TimeRange />
|
|
206
|
+
* </Audio>
|
|
207
|
+
* ```
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```tsx
|
|
211
|
+
* // Loading audio from external origin (requires CORS)
|
|
212
|
+
* <Audio
|
|
213
|
+
* src="https://example.com/audio.mp3"
|
|
214
|
+
* crossOrigin="anonymous"
|
|
215
|
+
* onError={(error) => {
|
|
216
|
+
* // Handle CORS or loading errors
|
|
217
|
+
* console.error('Failed to load audio:', error);
|
|
218
|
+
* }}
|
|
219
|
+
* />
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
function Audio({ classNames, isDisabled, noHotkeys, hotkeys, noVolumePref, noMutedPref, lang, ...rest }) {
|
|
223
|
+
return /* @__PURE__ */ jsx(MediaProvider, { children: /* @__PURE__ */ jsx(MediaController, {
|
|
224
|
+
className: clsx("group/audio", styles.container, classNames?.container),
|
|
225
|
+
audio: true,
|
|
226
|
+
"data-disabled": isDisabled || void 0,
|
|
227
|
+
noHotkeys,
|
|
228
|
+
hotkeys,
|
|
229
|
+
noVolumePref,
|
|
230
|
+
noMutedPref,
|
|
231
|
+
lang,
|
|
232
|
+
children: /* @__PURE__ */ jsx(AudioInner, {
|
|
233
|
+
...rest,
|
|
234
|
+
classNames,
|
|
235
|
+
isDisabled
|
|
236
|
+
})
|
|
237
|
+
}) });
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
//#endregion
|
|
241
|
+
export { Audio };
|
|
242
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/audio/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 { getLogger } from '@accelint/logger/default';\nimport { formatError } from 'media-chrome/dist/labels/labels.js';\nimport { MediaController } from 'media-chrome/react';\nimport { MediaProvider, useMediaRef } from 'media-chrome/react/media-store';\nimport { useEffect, useState } from 'react';\nimport { MediaControlsProvider } from '../media-controls/context';\nimport { MuteButton } from '../media-controls/mute-button';\nimport { PlayButton } from '../media-controls/play-button';\nimport { PlaybackRateButton } from '../media-controls/playback-rate';\nimport { SeekButton } from '../media-controls/seek-button';\nimport { TimeDisplay } from '../media-controls/time-display';\nimport { TimeRange } from '../media-controls/time-range';\nimport { VolumeSlider } from '../media-controls/volume-slider';\nimport styles from './styles.module.css';\nimport type { AudioProps } from './types';\n\nconst logger = getLogger({\n enabled: true,\n level: 'error',\n prefix: '[Audio]',\n pretty: true,\n});\n\n/**\n * Internal component that renders within MediaProvider context.\n *\n * This component is separated from the main Audio component to allow use of\n * media-chrome hooks (useMediaRef) that require MediaProvider context.\n * The outer Audio component wraps everything in MediaProvider, then AudioInner\n * handles the actual audio element and controls rendering.\n *\n * @param props - The component props.\n * @param props.src - Audio source URL.\n * @param props.title - Title to display (e.g., filename).\n * @param props.classNames - Class names for sub-elements.\n * @param props.children - Custom controls (replaces default layout).\n * @param props.autoPlay - Whether to autoplay the audio.\n * @param props.loop - Whether to loop the audio.\n * @param props.muted - Whether the audio starts muted.\n * @param props.preload - Audio preload strategy.\n * @param props.crossOrigin - CORS setting for the audio element.\n * @param props.isDisabled - Whether to disable all audio controls.\n * @param props.onEnded - Callback when audio ends.\n * @param props.onTimeUpdate - Callback when playback time updates.\n * @param props.onLoadedMetadata - Callback when metadata is loaded.\n * @param props.onPlay - Callback when audio starts playing.\n * @param props.onPause - Callback when audio is paused.\n * @param props.onError - Callback when an error occurs.\n * @param props.playbackRates - Custom playback rate options.\n * @returns The audio element with controls.\n */\nfunction AudioInner({\n src,\n title,\n children,\n classNames,\n autoPlay,\n loop,\n muted,\n preload = 'metadata',\n crossOrigin,\n isDisabled: isDisabledProp,\n onEnded,\n onTimeUpdate,\n onLoadedMetadata,\n onPlay,\n onPause,\n onError,\n playbackRates,\n}: AudioProps) {\n const mediaRef = useMediaRef();\n const [errorMessage, setErrorMessage] = useState<string>('');\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: src is intentionally used as a trigger to reset error state when audio source changes\n useEffect(() => {\n setErrorMessage('');\n }, [src]);\n\n const hasError = errorMessage !== '';\n const isDisabled = isDisabledProp === true || hasError;\n\n return (\n <>\n <audio\n ref={mediaRef}\n slot='media'\n className={styles.audio}\n data-testid='audio-element'\n autoPlay={autoPlay}\n loop={loop}\n muted={muted}\n preload={preload}\n crossOrigin={crossOrigin}\n onEnded={() => onEnded?.()}\n onTimeUpdate={(e) => {\n const time = e.currentTarget.currentTime;\n if (Number.isFinite(time)) {\n onTimeUpdate?.(time);\n }\n }}\n onLoadedMetadata={(e) => onLoadedMetadata?.(e)}\n onPlay={(e) => onPlay?.(e)}\n onPause={(e) => onPause?.(e)}\n onError={(e) => {\n const mediaError = e.currentTarget.error;\n logger\n .withContext({ src })\n .withError(mediaError)\n .error('Failed to load audio');\n setErrorMessage(\n (mediaError && formatError(mediaError)?.message) ??\n 'Unable to load audio file',\n );\n if (mediaError) {\n onError?.(mediaError);\n }\n }}\n >\n <source src={src} />\n </audio>\n\n <MediaControlsProvider isDisabled={isDisabled}>\n {children ?? (\n <>\n {title && (\n <div className={clsx(styles.titleRow, classNames?.title)}>\n {title}\n </div>\n )}\n\n {errorMessage && (\n <div className={styles.errorMessage}>{errorMessage}</div>\n )}\n\n <div className={clsx(styles.controls, classNames?.mediaControls)}>\n <div className={clsx(styles.timeRow, classNames?.timeRow)}>\n <TimeDisplay mode='current' />\n <TimeRange />\n <TimeDisplay mode='duration' />\n </div>\n\n <div\n className={clsx(styles.controlsRow, classNames?.controlsRow)}\n >\n <div className={styles.leftGroup}>\n <div className={styles.volumeGroup}>\n <MuteButton />\n <VolumeSlider />\n </div>\n </div>\n <div className={styles.playbackGroup}>\n <SeekButton direction='backward' />\n <PlayButton />\n <SeekButton direction='forward' />\n </div>\n <div className={styles.rightGroup}>\n <PlaybackRateButton rates={playbackRates} />\n </div>\n </div>\n </div>\n </>\n )}\n </MediaControlsProvider>\n </>\n );\n}\n\n/**\n * A complete audio player component.\n *\n * Combines an HTML audio element with MediaControls to provide a fully-featured\n * audio player with play/pause, seek, volume control, and playback rate adjustment.\n *\n * Uses media-chrome under the hood for state management and MediaController\n * for the accessible media chrome elements.\n *\n * @param props - The component props.\n * @param props.src - Audio source URL. Must be accessible to the browser - if loading\n * from a different origin, ensure the server sends appropriate CORS headers\n * (Access-Control-Allow-Origin) or use the crossOrigin prop.\n * @param props.title - Title to display (e.g., filename).\n * @param props.classNames - Class names for sub-elements.\n * @param props.isDisabled - Disable all audio controls.\n * @param props.crossOrigin - CORS setting ('anonymous' | 'use-credentials'). Required when\n * loading audio from a different origin that requires credentials or when using canvas\n * to analyze audio. Without proper CORS configuration, the audio may fail to load.\n * @param props.playbackRates - Array of playback speed multipliers (default: [1, 2, 3]).\n * Only positive finite numbers are accepted; invalid values are filtered out.\n * @param props.children - Custom controls to render instead of the default layout.\n * @param props.onEnded - Callback invoked when audio playback finishes.\n * @param props.onTimeUpdate - Callback invoked during playback with current time in seconds.\n * @param props.onError - Callback invoked when audio fails to load or encounters an error.\n * @param props.noHotkeys - Disable all keyboard shortcuts for media control.\n * @param props.hotkeys - Custom keyboard shortcuts configuration for media control.\n * @param props.noVolumePref - Disable automatic saving/restoring of volume preference.\n * @param props.noMutedPref - Disable automatic saving/restoring of muted state preference.\n * @param props.lang - Language code for localized media control labels.\n * @returns The rendered audio player component.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <Audio src=\"audio.mp3\" title=\"My Audio File\" />\n * ```\n *\n * @example\n * ```tsx\n * // With event callbacks\n * <Audio\n * src=\"audio.mp3\"\n * title=\"My Audio File\"\n * onPlay={() => console.log('Playing')}\n * onPause={() => console.log('Paused')}\n * onEnded={() => console.log('Ended')}\n * onTimeUpdate={(time) => console.log('Current time:', time)}\n * />\n * ```\n *\n * @example\n * ```tsx\n * // Custom controls layout\n * <Audio src=\"audio.mp3\">\n * <PlayButton />\n * <TimeRange />\n * </Audio>\n * ```\n *\n * @example\n * ```tsx\n * // Loading audio from external origin (requires CORS)\n * <Audio\n * src=\"https://example.com/audio.mp3\"\n * crossOrigin=\"anonymous\"\n * onError={(error) => {\n * // Handle CORS or loading errors\n * console.error('Failed to load audio:', error);\n * }}\n * />\n * ```\n */\nexport function Audio({\n classNames,\n isDisabled,\n noHotkeys,\n hotkeys,\n noVolumePref,\n noMutedPref,\n lang,\n ...rest\n}: AudioProps) {\n return (\n <MediaProvider>\n <MediaController\n className={clsx('group/audio', styles.container, classNames?.container)}\n audio\n data-disabled={isDisabled || undefined}\n noHotkeys={noHotkeys}\n hotkeys={hotkeys}\n noVolumePref={noVolumePref}\n noMutedPref={noMutedPref}\n lang={lang}\n >\n <AudioInner {...rest} classNames={classNames} isDisabled={isDisabled} />\n </MediaController>\n </MediaProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,SAAS,UAAU;CACvB,SAAS;CACT,OAAO;CACP,QAAQ;CACR,QAAQ;CACT,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BF,SAAS,WAAW,EAClB,KACA,OACA,UACA,YACA,UACA,MACA,OACA,UAAU,YACV,aACA,YAAY,gBACZ,SACA,cACA,kBACA,QACA,SACA,SACA,iBACa;CACb,MAAM,WAAW,aAAa;CAC9B,MAAM,CAAC,cAAc,mBAAmB,SAAiB,GAAG;AAG5D,iBAAgB;AACd,kBAAgB,GAAG;IAClB,CAAC,IAAI,CAAC;CAGT,MAAM,aAAa,mBAAmB,QADrB,iBAAiB;AAGlC,QACE,8CACE,oBAAC;EACC,KAAK;EACL,MAAK;EACL,WAAW,OAAO;EAClB,eAAY;EACF;EACJ;EACC;EACE;EACI;EACb,eAAe,WAAW;EAC1B,eAAe,MAAM;GACnB,MAAM,OAAO,EAAE,cAAc;AAC7B,OAAI,OAAO,SAAS,KAAK,CACvB,gBAAe,KAAK;;EAGxB,mBAAmB,MAAM,mBAAmB,EAAE;EAC9C,SAAS,MAAM,SAAS,EAAE;EAC1B,UAAU,MAAM,UAAU,EAAE;EAC5B,UAAU,MAAM;GACd,MAAM,aAAa,EAAE,cAAc;AACnC,UACG,YAAY,EAAE,KAAK,CAAC,CACpB,UAAU,WAAW,CACrB,MAAM,uBAAuB;AAChC,oBACG,cAAc,YAAY,WAAW,EAAE,YACtC,4BACH;AACD,OAAI,WACF,WAAU,WAAW;;YAIzB,oBAAC,YAAY,MAAO;GACd,EAER,oBAAC;EAAkC;YAChC,YACC;GACG,SACC,oBAAC;IAAI,WAAW,KAAK,OAAO,UAAU,YAAY,MAAM;cACrD;KACG;GAGP,gBACC,oBAAC;IAAI,WAAW,OAAO;cAAe;KAAmB;GAG3D,qBAAC;IAAI,WAAW,KAAK,OAAO,UAAU,YAAY,cAAc;eAC9D,qBAAC;KAAI,WAAW,KAAK,OAAO,SAAS,YAAY,QAAQ;;MACvD,oBAAC,eAAY,MAAK,YAAY;MAC9B,oBAAC,cAAY;MACb,oBAAC,eAAY,MAAK,aAAa;;MAC3B,EAEN,qBAAC;KACC,WAAW,KAAK,OAAO,aAAa,YAAY,YAAY;;MAE5D,oBAAC;OAAI,WAAW,OAAO;iBACrB,qBAAC;QAAI,WAAW,OAAO;mBACrB,oBAAC,eAAa,EACd,oBAAC,iBAAe;SACZ;QACF;MACN,qBAAC;OAAI,WAAW,OAAO;;QACrB,oBAAC,cAAW,WAAU,aAAa;QACnC,oBAAC,eAAa;QACd,oBAAC,cAAW,WAAU,YAAY;;QAC9B;MACN,oBAAC;OAAI,WAAW,OAAO;iBACrB,oBAAC,sBAAmB,OAAO,gBAAiB;QACxC;;MACF;KACF;MACL;GAEiB,IACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EP,SAAgB,MAAM,EACpB,YACA,YACA,WACA,SACA,cACA,aACA,MACA,GAAG,QACU;AACb,QACE,oBAAC,2BACC,oBAAC;EACC,WAAW,KAAK,eAAe,OAAO,WAAW,YAAY,UAAU;EACvE;EACA,iBAAe,cAAc;EAClB;EACF;EACK;EACD;EACP;YAEN,oBAAC;GAAW,GAAI;GAAkB;GAAwB;IAAc;GACxD,GACJ"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 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
|
+
@reference '@accelint/design-foundation/styles';
|
|
14
|
+
|
|
15
|
+
@layer components.l1 {
|
|
16
|
+
.container {
|
|
17
|
+
@apply bg-surface-raised rounded-medium p-s space-y-s flex w-full flex-col;
|
|
18
|
+
min-width: 270px;
|
|
19
|
+
|
|
20
|
+
/* Media Chrome theming - maps design tokens to media-chrome CSS variables */
|
|
21
|
+
--media-primary-color: var(--fg-primary-bold);
|
|
22
|
+
--media-secondary-color: transparent;
|
|
23
|
+
--media-icon-color: var(--fg-primary-muted);
|
|
24
|
+
--media-text-color: var(--fg-accent-primary-bold);
|
|
25
|
+
--media-control-background: transparent;
|
|
26
|
+
--media-control-hover-background: transparent;
|
|
27
|
+
|
|
28
|
+
@variant disabled {
|
|
29
|
+
@apply opacity-50;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.audio {
|
|
34
|
+
@apply hidden;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.titleRow {
|
|
38
|
+
@apply fg-primary-bold text-header-l text-center;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.errorMessage {
|
|
42
|
+
@apply text-body-m fg-serious-bold text-center;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.timeRow {
|
|
46
|
+
@apply gap-s flex items-center;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.controls {
|
|
50
|
+
@apply space-y-s p-s;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.controlsRow {
|
|
54
|
+
@apply flex items-center;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.leftGroup,
|
|
58
|
+
.rightGroup {
|
|
59
|
+
@apply flex flex-1 items-center;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.leftGroup {
|
|
63
|
+
@apply justify-start;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.rightGroup {
|
|
67
|
+
@apply justify-end;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.volumeGroup {
|
|
71
|
+
@apply gap-s flex;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.playbackGroup {
|
|
75
|
+
@apply gap-xs flex items-center justify-center;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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 { ComponentProps, ComponentPropsWithRef, ReactNode } from "react";
|
|
14
|
+
import { MediaController } from "media-chrome/react";
|
|
15
|
+
|
|
16
|
+
//#region src/components/audio/types.d.ts
|
|
17
|
+
type AudioProps = Omit<ComponentPropsWithRef<'audio'>, 'children' | 'onEnded' | 'onTimeUpdate' | 'onError' | 'src' | 'className'> & Pick<ComponentProps<typeof MediaController>, 'noHotkeys' | 'hotkeys' | 'noVolumePref' | 'noMutedPref' | 'lang'> & {
|
|
18
|
+
/** Audio source URL */
|
|
19
|
+
src: string;
|
|
20
|
+
/** Title to display (e.g., filename) */
|
|
21
|
+
title?: string;
|
|
22
|
+
/** Disable all audio controls */
|
|
23
|
+
isDisabled?: boolean;
|
|
24
|
+
/** Custom controls (replaces default layout) */
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
/** Class names for sub-elements */
|
|
27
|
+
classNames?: {
|
|
28
|
+
container?: string;
|
|
29
|
+
title?: string;
|
|
30
|
+
mediaControls?: string;
|
|
31
|
+
timeRow?: string;
|
|
32
|
+
controlsRow?: string;
|
|
33
|
+
};
|
|
34
|
+
/** Callback when audio ends */
|
|
35
|
+
onEnded?: () => void;
|
|
36
|
+
/** Callback when playback time updates */
|
|
37
|
+
onTimeUpdate?: (currentTime: number) => void;
|
|
38
|
+
/** Callback when audio fails to load or encounters an error */
|
|
39
|
+
onError?: (error: MediaError) => void;
|
|
40
|
+
/** Custom playback rate options (default: [1, 2, 3]) */
|
|
41
|
+
playbackRates?: number[];
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { AudioProps };
|
|
45
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
|