@kolkrabbi/kol-component 0.42.0 → 0.43.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolkrabbi/kol-component",
3
- "version": "0.42.0",
3
+ "version": "0.43.0",
4
4
  "description": "KOL design-system components — atoms through organisms, emitting canonical kol-* classes. Pairs with @kolkrabbi/kol-theme for styling.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -0,0 +1,51 @@
1
+ /**
2
+ * AudioPlayer — the interactive audio atom: one native <audio> with the UA's
3
+ * own control strip, and an optional label line above it.
4
+ *
5
+ * WHY IT EXISTS. Audio was the one media kind the design system had nothing for,
6
+ * so every consumer hand-rolled a bare `<audio controls>` and inherited whatever
7
+ * the browser painted. The MediaLibrary widening (kol-component 0.39.0) made
8
+ * audio objects arrive — 116 sound files in `kol-vault-media` alone — and left
9
+ * minting this as the open taxonomy call; this is that call made: an ATOM,
10
+ * beside HlsVideo.
11
+ *
12
+ * THE CONTRAST WITH HlsVideo, which is the thing to read before touching either.
13
+ * Same tier, same shape — one native media element, all layout via `className`,
14
+ * no composition — and **inverted intent**. HlsVideo is deliberately inert:
15
+ * `pointer-events: none`, `controls={false}`, plus the hardening set (no PiP, no
16
+ * download, no fullscreen, no remote playback, no context menu). It is
17
+ * decorative. This atom exists **to be operated**, so none of that hardening
18
+ * crosses over, and `controls` is not a prop — an audio player without controls
19
+ * is not a variant, it is a different component.
20
+ *
21
+ * The native strip is UA-painted and not themeable past `color-scheme`. Do not
22
+ * reach for pseudo-element hacks; a branded transport would be a separate
23
+ * `AudioTransport` molecule built on this atom.
24
+ *
25
+ * Layout is the call site's: the padding, the centring and the width that lived
26
+ * in the consumer source are all call-site concerns and none of them are baked
27
+ * in here.
28
+ *
29
+ * @param {string} src audio URL; renders nothing when absent (the guard
30
+ * style the other media atoms use)
31
+ * @param {string} [label] line above the player; the element is omitted entirely
32
+ * when absent. Authored casing — no text-transform
33
+ * @param {'none'|'metadata'|'auto'} [preload='metadata'] native preload hint
34
+ * @param {string} [className] all layout/sizing (consumer-supplied)
35
+ */
36
+ export default function AudioPlayer({
37
+ src,
38
+ label,
39
+ preload = 'metadata',
40
+ className = '',
41
+ ...props
42
+ }) {
43
+ if (!src) return null
44
+
45
+ return (
46
+ <figure className={`kol-audio-player flex flex-col gap-3 ${className}`.trim()}>
47
+ {label && <figcaption className="kol-mono-12 text-fg-48">{label}</figcaption>}
48
+ <audio src={src} preload={preload} controls className="w-full" {...props} />
49
+ </figure>
50
+ )
51
+ }
package/src/index.js CHANGED
@@ -33,6 +33,10 @@ export { default as ExitPreview } from './utilities/ExitPreview.jsx'
33
33
  export { default as Figure } from './atoms/Figure.jsx'
34
34
  export { default as FullscreenOverlay } from './utilities/FullscreenOverlay.jsx'
35
35
  export { default as HlsVideo } from './atoms/HlsVideo.jsx'
36
+ /* AudioPlayer — HlsVideo's opposite number: same tier and shape, inverted
37
+ * intent (built to be operated, not decorative). See its header before editing
38
+ * either one. */
39
+ export { default as AudioPlayer } from './atoms/AudioPlayer.jsx'
36
40
  export { default as Input } from './atoms/Input.jsx'
37
41
  export { default as Label } from './atoms/Label.jsx'
38
42
  export { default as LabeledControl } from './molecules/LabeledControl.jsx'