@hgdc/ui 0.40.0 → 0.41.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/dist/choice-cards.d.ts +28 -0
- package/dist/choice-cards.js +18 -0
- package/dist/steps.d.ts +18 -0
- package/dist/steps.js +16 -0
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type ChoiceCardsProps<T extends string> = {
|
|
2
|
+
value: T | null;
|
|
3
|
+
onValueChange: (value: T) => void;
|
|
4
|
+
options: Array<{
|
|
5
|
+
value: T;
|
|
6
|
+
title: string;
|
|
7
|
+
/** Une ligne sous le titre : ce que recouvre le choix. */
|
|
8
|
+
description?: string;
|
|
9
|
+
/** Logo ou icône, 24 px environ. */
|
|
10
|
+
icon?: React.ReactNode;
|
|
11
|
+
}>;
|
|
12
|
+
/** Nom du groupe pour les technologies d'assistance. */
|
|
13
|
+
label: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Un choix parmi quelques options riches, présentées en tuiles : l'outil à brancher, un
|
|
18
|
+
* modèle de départ. Deux colonnes sur téléphone, trois au-delà ; chaque tuile garde une cible
|
|
19
|
+
* de 44 px au moins. Sémantique de groupe radio : les flèches passent d'une tuile à l'autre,
|
|
20
|
+
* Tab sort du groupe.
|
|
21
|
+
*
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <ChoiceCards label="Outil" value={tool} onValueChange={setTool}
|
|
24
|
+
* options={[{ value: "grafana", title: "Grafana", description: "Contact point Webhook" }]} />
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function ChoiceCards<T extends string>({ value, onValueChange, options, label, className, }: ChoiceCardsProps<T>): React.JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Radio as RadioPrimitive } from "@base-ui/react/radio";
|
|
3
|
+
import { RadioGroup as RadioGroupPrimitive } from "@base-ui/react/radio-group";
|
|
4
|
+
import { cn } from "./cn.js";
|
|
5
|
+
/**
|
|
6
|
+
* Un choix parmi quelques options riches, présentées en tuiles : l'outil à brancher, un
|
|
7
|
+
* modèle de départ. Deux colonnes sur téléphone, trois au-delà ; chaque tuile garde une cible
|
|
8
|
+
* de 44 px au moins. Sémantique de groupe radio : les flèches passent d'une tuile à l'autre,
|
|
9
|
+
* Tab sort du groupe.
|
|
10
|
+
*
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <ChoiceCards label="Outil" value={tool} onValueChange={setTool}
|
|
13
|
+
* options={[{ value: "grafana", title: "Grafana", description: "Contact point Webhook" }]} />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export function ChoiceCards({ value, onValueChange, options, label, className, }) {
|
|
17
|
+
return (_jsx(RadioGroupPrimitive, { "data-slot": "choice-cards", "aria-label": label, value: value, onValueChange: (next) => onValueChange(next), className: cn("grid grid-cols-2 gap-2 sm:grid-cols-3 sm:gap-3", className), children: options.map((option) => (_jsxs(RadioPrimitive.Root, { value: option.value, "aria-label": option.description ? `${option.title}, ${option.description}` : option.title, className: cn("flex min-h-11 flex-col items-start gap-2 rounded-2xl border border-border bg-card p-3 text-left sm:p-4", "transition-[border-color,box-shadow,background-color] duration-(--duration-fast) ease-out outline-none", "hover:border-foreground/40 focus-visible:ring-3 focus-visible:ring-ring/50", "data-checked:border-primary data-checked:bg-primary/5 data-checked:ring-1 data-checked:ring-primary", "data-disabled:cursor-not-allowed data-disabled:opacity-50"), children: [option.icon ? (_jsx("span", { "aria-hidden": true, className: "grid size-8 place-items-center text-foreground", children: option.icon })) : null, _jsx("span", { className: "text-sm font-medium text-pretty", children: option.title }), option.description ? (_jsx("span", { className: "text-xs text-pretty text-muted-foreground", children: option.description })) : null] }, option.value))) }));
|
|
18
|
+
}
|
package/dist/steps.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marche à suivre numérotée, courte (3 à 5 étapes) : brancher un outil, configurer un DNS.
|
|
3
|
+
* Une étape = une phrase d'action ; le détail facultatif passe dessous, en plus petit.
|
|
4
|
+
*
|
|
5
|
+
* ```tsx
|
|
6
|
+
* <Steps items={[
|
|
7
|
+
* { title: "Dans Grafana, ouvre Alerting puis Contact points." },
|
|
8
|
+
* { title: "Ajoute un contact point Webhook et colle l'adresse.", detail: <Snippet value={url} /> },
|
|
9
|
+
* ]} />
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function Steps({ items, className, }: {
|
|
13
|
+
items: Array<{
|
|
14
|
+
title: React.ReactNode;
|
|
15
|
+
detail?: React.ReactNode;
|
|
16
|
+
}>;
|
|
17
|
+
className?: string;
|
|
18
|
+
}): React.JSX.Element;
|
package/dist/steps.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "./cn.js";
|
|
3
|
+
/**
|
|
4
|
+
* Marche à suivre numérotée, courte (3 à 5 étapes) : brancher un outil, configurer un DNS.
|
|
5
|
+
* Une étape = une phrase d'action ; le détail facultatif passe dessous, en plus petit.
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Steps items={[
|
|
9
|
+
* { title: "Dans Grafana, ouvre Alerting puis Contact points." },
|
|
10
|
+
* { title: "Ajoute un contact point Webhook et colle l'adresse.", detail: <Snippet value={url} /> },
|
|
11
|
+
* ]} />
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export function Steps({ items, className, }) {
|
|
15
|
+
return (_jsx("ol", { "data-slot": "steps", className: cn("space-y-4", className), children: items.map((item, index) => (_jsxs("li", { className: "flex gap-3", children: [_jsx("span", { "aria-hidden": true, className: "grid size-6 shrink-0 place-items-center rounded-full bg-muted text-xs font-semibold tabular-nums", children: index + 1 }), _jsxs("div", { className: "min-w-0 flex-1 space-y-2 pt-0.5", children: [_jsx("p", { className: "text-sm text-pretty", children: item.title }), item.detail ? _jsx("div", { className: "text-sm text-muted-foreground", children: item.detail }) : null] })] }, index))) }));
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hgdc/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "Interface de la H Collection : jetons de la DA, thèmes, polices et composants.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://github.com/hugogebel-boop/hgdc-kit/tree/main/packages/ui#readme",
|