{"version":3,"names":["dynamic","createMemo","createSignal","omit","userRef","readOption","mergeRootProps","resolveClassStyle","VISUALLY_HIDDEN_STYLE","createProgress","ProgressRootContext","ProgressRoot","props","c","value","min","max","format","locale","getAriaValueText","status","formattedValue","state","labelId","setLabelId","undefined","ownedWrite","contextValue","userClassStyle","userProps","internalSlot","aria-labelledby","aria-valuetext","ariaValueText","data-indeterminate","data-progressing","data-complete","merged","root","Tag","as","children"],"sources":["progress-root.tsx"],"sourcesContent":["import type { JSX, ValidComponent } from \"@solidjs/web\";\nimport { dynamic } from \"@solidjs/web\";\nimport { createMemo, createSignal, omit } from \"solid-js\";\nimport { userRef } from \"../../internals/compose-refs\";\nimport { type MaybeAccessor, readOption } from \"../../internals/maybe-accessor\";\nimport { mergeRootProps } from \"../../internals/merge-root-props\";\nimport { resolveClassStyle } from \"../../internals/resolve-class-style\";\nimport type { BaseUIComponentProps } from \"../../internals/types\";\nimport { VISUALLY_HIDDEN_STYLE } from \"../../internals/visually-hidden-style\";\nimport { createProgress } from \"../create-progress.tsx\";\nimport {\n\tProgressRootContext,\n\ttype ProgressRootContextValue,\n\ttype ProgressRootState,\n\ttype ProgressStatus,\n} from \"../progress-root-context.ts\";\n\nexport type { ProgressRootState, ProgressStatus };\n\nexport interface ProgressRootProps\n\textends Omit<\n\t\tBaseUIComponentProps<\"div\", ProgressRootState>,\n\t\t| \"role\"\n\t\t| \"aria-valuemax\"\n\t\t| \"aria-valuemin\"\n\t\t| \"aria-valuenow\"\n\t\t| \"aria-labelledby\"\n\t> {\n\t/**\n\t * Tag/component to render. Defaults to `\"div\"`. Replaces the\n\t * pre-spike `render` prop (axis G).\n\t */\n\tas?: ValidComponent;\n\t\"aria-valuetext\"?: string | undefined;\n\tformat?: MaybeAccessor<Intl.NumberFormatOptions | undefined>;\n\tgetAriaValueText?:\n\t\t| ((formattedValue: string | null, value: number | null) => string)\n\t\t| undefined;\n\tlocale?: MaybeAccessor<Intl.LocalesArgument | undefined>;\n\tmax?: MaybeAccessor<number | undefined>;\n\tmin?: MaybeAccessor<number | undefined>;\n\tvalue: MaybeAccessor<number | null>;\n}\n\n/**\n * Groups all parts of the progress bar and provides the task completion\n * status to screen readers. Renders a `<div>` (or `as` override).\n *\n * §1 wave 2: replaces `renderElement` with `dynamic(() => props.as ?? \"div\")`.\n * The slot factory `createProgress().root()` carries `role=\"progressbar\"` and\n * the `aria-valuemin`/`aria-valuemax`/`aria-valuenow`/`aria-valuetext`\n * getters; status data-attrs (`data-indeterminate` / `data-progressing` /\n * `data-complete`) and `aria-labelledby` are emitted as inline reactive\n * getters on the wrapper's internal slot bag.\n */\nexport function ProgressRoot(props: ProgressRootProps): JSX.Element {\n\tconst c = createProgress({\n\t\tvalue: () => readOption(props.value),\n\t\tmin: () => readOption(props.min),\n\t\tmax: () => readOption(props.max),\n\t\tformat: () => readOption(props.format),\n\t\tlocale: () => readOption(props.locale),\n\t\t// Getter, not an eager read: createProgress reads this inside its\n\t\t// `ariaValueText` memo (tracked), and an eager `props` read here is\n\t\t// untracked in the component body (`[STRICT_READ_UNTRACKED]`).\n\t\tget getAriaValueText() {\n\t\t\treturn props.getAriaValueText;\n\t\t},\n\t});\n\tconst value = c.value;\n\tconst min = c.min;\n\tconst max = c.max;\n\tconst status = c.status;\n\tconst formattedValue = c.formattedValue;\n\n\tconst state = createMemo((): ProgressRootState => ({ status: status() }));\n\n\tconst [labelId, setLabelId] = createSignal<string | undefined>(undefined, {\n\t\townedWrite: true,\n\t});\n\n\tconst contextValue: ProgressRootContextValue = {\n\t\tformattedValue,\n\t\tmax,\n\t\tmin,\n\t\tvalue,\n\t\tstate,\n\t\tstatus,\n\t\tsetLabelId,\n\t\tlabelId,\n\t};\n\n\t// Resolve `class`/`style` so function values (stateful styling) are invoked\n\t// with the progress state instead of being spread to the DOM raw (which\n\t// would drop the class entirely).\n\tconst userClassStyle = resolveClassStyle(props, () => state());\n\tconst userProps = omit(\n\t\tprops,\n\t\t\"as\",\n\t\t\"children\",\n\t\t\"class\",\n\t\t\"style\",\n\t\t\"attrs\",\n\t\t\"format\",\n\t\t\"getAriaValueText\",\n\t\t\"locale\",\n\t\t\"max\",\n\t\t\"min\",\n\t\t\"value\",\n\t\t\"aria-valuetext\",\n\t);\n\n\tconst internalSlot = {\n\t\tget \"aria-labelledby\"(): string {\n\t\t\t// Emit empty string instead of undefined when no label is registered\n\t\t\t// so the key stays in `ownKeys` from render 1 and Solid's spread\n\t\t\t// effect sets up the reactive binding for late-mounting labels.\n\t\t\treturn labelId() ?? \"\";\n\t\t},\n\t\tget \"aria-valuetext\"(): string {\n\t\t\treturn props[\"aria-valuetext\"] ?? c.ariaValueText();\n\t\t},\n\t\tget \"data-indeterminate\"(): \"\" | undefined {\n\t\t\treturn status() === \"indeterminate\" ? \"\" : undefined;\n\t\t},\n\t\tget \"data-progressing\"(): \"\" | undefined {\n\t\t\treturn status() === \"progressing\" ? \"\" : undefined;\n\t\t},\n\t\tget \"data-complete\"(): \"\" | undefined {\n\t\t\treturn status() === \"complete\" ? \"\" : undefined;\n\t\t},\n\t};\n\n\tlet merged: Record<string, unknown> = mergeRootProps(c.root(), internalSlot);\n\tmerged = mergeRootProps(merged, userClassStyle);\n\tmerged = mergeRootProps(merged, userProps);\n\n\tconst Tag = dynamic(() => props.as ?? \"div\");\n\treturn (\n\t\t<Tag {...merged} ref={userRef(props)}>\n\t\t\t<ProgressRootContext value={contextValue}>\n\t\t\t\t{props.children}\n\t\t\t\t<span role=\"presentation\" style={{ ...VISUALLY_HIDDEN_STYLE }}>\n\t\t\t\t\t{/* force NVDA to read the label https://github.com/mui/base-ui/issues/4184 */}\n\t\t\t\t\tx\n\t\t\t\t</span>\n\t\t\t</ProgressRootContext>\n\t\t</Tag>\n\t);\n}\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,cAAc;AACtC,SAASC,UAAU,EAAEC,YAAY,EAAEC,IAAI,QAAQ,UAAU;AACzD,SAASC,OAAO,QAAQ,8BAA8B;AACtD,SAA6BC,UAAU,QAAQ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