mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
docs(site): complete menu radio group references with demos and options hooks (#1807)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
82b9e43bb5
commit
a9a09a7e52
+21
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Data attributes fixture for part-scoped attrs files.
|
||||
*
|
||||
* Exercises: extra data-attrs files ({component}-{x}-data-attrs.ts) declare
|
||||
* their target parts with a @parts JSDoc tag on the exported const. Listed
|
||||
* parts get the attrs merged into whatever they already have — plain attach
|
||||
* (label) and merge with attrs inherited via the stateAttrMap heuristic
|
||||
* (fill). This header's own raw "@parts" mention is a deliberate hazard:
|
||||
* the builder must bind to the tag in the JSDoc block closest to the export,
|
||||
* not the first match anywhere in the file.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Data attributes set on caption-like parts.
|
||||
*
|
||||
* @parts label, fill
|
||||
*/
|
||||
export const GaugeLabelDataAttrs = {
|
||||
/** Present when the value is emphasized. */
|
||||
emphasized: 'data-emphasized',
|
||||
} as const;
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
export { usePlayer } from './player/context';
|
||||
export { createPlayer } from './player/create-player';
|
||||
export { useRateOptions } from './ui/rate-options';
|
||||
export { createSelector } from './utils/external';
|
||||
export { mergeProps } from './utils/merge-props';
|
||||
export { useFormat } from './utils/use-format';
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// Resolves to a directory with no index.ts — discovery must skip it, not crash.
|
||||
export { useLegacyRate } from './legacy';
|
||||
export {
|
||||
type RateOption,
|
||||
type RateOptionsProps,
|
||||
type RateOptionsResult,
|
||||
useRateOptions,
|
||||
} from './use-rate-options';
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// Compiled-only module (no TypeScript source): exercises discovery skipping
|
||||
// a re-export specifier that resolves to a directory without index.ts/.tsx.
|
||||
export function useLegacyRate() {
|
||||
return 1;
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
export interface RateOptionsProps {
|
||||
/** Custom formatter for visible rate labels. */
|
||||
formatRate?: ((rate: number) => string) | undefined;
|
||||
/** Whether rate selection is disabled. */
|
||||
disabled?: boolean | undefined;
|
||||
}
|
||||
|
||||
export interface RateOption {
|
||||
rate: number;
|
||||
label: string;
|
||||
disabled: boolean;
|
||||
}
|
||||
|
||||
export interface RateOptionsResult {
|
||||
rate: number;
|
||||
options: RateOption[];
|
||||
setRate: (rate: number) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create rate menu options from the player rate state. Returns `null` when
|
||||
* the rate feature is not configured.
|
||||
*
|
||||
* @param props - Optional `formatRate` and `disabled` overrides.
|
||||
*/
|
||||
export function useRateOptions(props?: RateOptionsProps): RateOptionsResult | null {
|
||||
return props?.disabled ? null : { rate: 1, options: [], setRate: () => {} };
|
||||
}
|
||||
|
||||
export namespace useRateOptions {
|
||||
export type Props = RateOptionsProps;
|
||||
export type Result = RateOptionsResult;
|
||||
export type Option = RateOption;
|
||||
}
|
||||
|
||||
/** Internal helper — matches the use* convention but is never re-exported to the entry point. */
|
||||
export function useRateInternals(): number {
|
||||
return 1;
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export { createContext as createSelector } from 'react';
|
||||
Reference in New Issue
Block a user