@lanfermann/ui 0.5.0 → 0.7.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/components/accordion/accordion.d.ts +11 -3
- package/dist/components/accordion/accordion.js +15 -10
- package/dist/components/action-bar/action-bar.d.ts +60 -0
- package/dist/components/action-bar/action-bar.js +117 -0
- package/dist/components/alert/alert.d.ts +1 -1
- package/dist/components/alert/alert.js +3 -17
- package/dist/components/alert-dialog/alert-dialog.d.ts +1 -1
- package/dist/components/app-shell/app-shell.d.ts +33 -0
- package/dist/components/app-shell/app-shell.js +93 -0
- package/dist/components/attachment/attachment.d.ts +51 -0
- package/dist/components/attachment/attachment.js +255 -0
- package/dist/components/attachment/kinds.d.ts +7 -0
- package/dist/components/attachment/kinds.js +142 -0
- package/dist/components/avatar/avatar.d.ts +14 -4
- package/dist/components/avatar/avatar.js +57 -13
- package/dist/components/avatar-group/avatar-group.d.ts +33 -0
- package/dist/components/avatar-group/avatar-group.js +110 -0
- package/dist/components/avatar-group/people.d.ts +12 -0
- package/dist/components/avatar-group/people.js +24 -0
- package/dist/components/badge/badge.d.ts +9 -3
- package/dist/components/badge/badge.js +21 -6
- package/dist/components/banner/banner.d.ts +39 -0
- package/dist/components/banner/banner.js +149 -0
- package/dist/components/button-group/button-group-variants.d.ts +4 -3
- package/dist/components/button-group/button-group-variants.js +13 -12
- package/dist/components/button-group/button-group.d.ts +3 -3
- package/dist/components/button-group/button-group.js +3 -3
- package/dist/components/card/card.d.ts +20 -4
- package/dist/components/card/card.js +32 -6
- package/dist/components/checkbox-card/checkbox-card.d.ts +21 -0
- package/dist/components/checkbox-card/checkbox-card.js +50 -0
- package/dist/components/chip/chip-group.d.ts +15 -0
- package/dist/components/chip/chip-group.js +44 -0
- package/dist/components/chip/chip-variants.d.ts +6 -0
- package/dist/components/chip/chip-variants.js +28 -0
- package/dist/components/chip/chip.d.ts +39 -0
- package/dist/components/chip/chip.js +71 -0
- package/dist/components/code-block/code-copy.d.ts +3 -11
- package/dist/components/code-block/code-copy.js +15 -62
- package/dist/components/code-block/code-keys.js +10 -22
- package/dist/components/collapsible/collapsible.js +7 -3
- package/dist/components/combobox/combobox.d.ts +53 -3
- package/dist/components/combobox/combobox.js +204 -20
- package/dist/components/command/command.d.ts +131 -0
- package/dist/components/command/command.js +335 -0
- package/dist/components/consent/consent-card.js +365 -0
- package/dist/components/consent/consent-embed.d.ts +21 -0
- package/dist/components/consent/consent-embed.js +111 -0
- package/dist/components/consent/consent-labels.d.ts +70 -0
- package/dist/components/consent/consent-labels.js +61 -0
- package/dist/components/consent/consent-record.d.ts +95 -0
- package/dist/components/consent/consent-record.js +112 -0
- package/dist/components/consent/consent-store.d.ts +26 -0
- package/dist/components/consent/consent-store.js +240 -0
- package/dist/components/consent/consent.d.ts +86 -0
- package/dist/components/consent/consent.js +306 -0
- package/dist/components/container/container.d.ts +1 -1
- package/dist/components/context-menu/context-menu.d.ts +23 -0
- package/dist/components/context-menu/context-menu.js +50 -0
- package/dist/components/conversation/conversation.d.ts +45 -0
- package/dist/components/conversation/conversation.js +295 -0
- package/dist/components/conversation/stick.js +23 -0
- package/dist/components/copy-button/copy-button.d.ts +50 -0
- package/dist/components/copy-button/copy-button.js +65 -0
- package/dist/components/copy-page/copy-page.d.ts +4 -4
- package/dist/components/copy-page/copy-page.js +16 -36
- package/dist/components/copy-pill/copy-pill.js +1 -1
- package/dist/components/description-list/description-list.d.ts +32 -0
- package/dist/components/description-list/description-list.js +51 -0
- package/dist/components/empty/empty.d.ts +38 -0
- package/dist/components/empty/empty.js +57 -0
- package/dist/components/field/field.js +1 -1
- package/dist/components/file-upload/file-upload.d.ts +96 -0
- package/dist/components/file-upload/file-upload.js +347 -0
- package/dist/components/file-upload/files.d.ts +39 -0
- package/dist/components/file-upload/files.js +74 -0
- package/dist/components/grow/grow.d.ts +15 -3
- package/dist/components/grow/grow.js +24 -9
- package/dist/components/heading/heading.d.ts +1 -1
- package/dist/components/icon/icon.d.ts +1 -1
- package/dist/components/input/input.js +1 -1
- package/dist/components/menu/menu.d.ts +20 -8
- package/dist/components/menu/menu.js +51 -29
- package/dist/components/message/message.d.ts +81 -0
- package/dist/components/message/message.js +208 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts +7 -1
- package/dist/components/navigation-menu/navigation-menu.js +11 -4
- package/dist/components/otp-field/otp-field.d.ts +37 -0
- package/dist/components/otp-field/otp-field.js +161 -0
- package/dist/components/pagination/pagination.d.ts +50 -0
- package/dist/components/pagination/pagination.js +188 -0
- package/dist/components/prompt-input/keys.js +15 -0
- package/dist/components/prompt-input/prompt-input.d.ts +89 -0
- package/dist/components/prompt-input/prompt-input.js +331 -0
- package/dist/components/radio-card/radio-card.d.ts +23 -0
- package/dist/components/radio-card/radio-card.js +49 -0
- package/dist/components/rolling-number/rolling-number.d.ts +30 -0
- package/dist/components/rolling-number/rolling-number.js +149 -0
- package/dist/components/seam/seam.d.ts +1 -1
- package/dist/components/secret-field/secret-field.d.ts +53 -0
- package/dist/components/secret-field/secret-field.js +121 -0
- package/dist/components/section/section.d.ts +1 -1
- package/dist/components/segmented-control/segmented-control.js +29 -16
- package/dist/components/select/select.d.ts +5 -4
- package/dist/components/select/select.js +16 -11
- package/dist/components/shortcut/shortcut.d.ts +46 -0
- package/dist/components/shortcut/shortcut.js +87 -0
- package/dist/components/sidebar/sidebar-context.js +16 -0
- package/dist/components/sidebar/sidebar.d.ts +161 -0
- package/dist/components/sidebar/sidebar.js +588 -0
- package/dist/components/site-header/site-header.js +1 -1
- package/dist/components/skeleton/loaded.d.ts +21 -0
- package/dist/components/skeleton/loaded.js +57 -0
- package/dist/components/skeleton/skeleton.d.ts +43 -0
- package/dist/components/skeleton/skeleton.js +48 -0
- package/dist/components/sources/source-list.d.ts +17 -0
- package/dist/components/sources/source-list.js +26 -0
- package/dist/components/sources/sources.d.ts +45 -0
- package/dist/components/sources/sources.js +167 -0
- package/dist/components/stat/stat.d.ts +59 -0
- package/dist/components/stat/stat.js +112 -0
- package/dist/components/steps/steps.d.ts +57 -0
- package/dist/components/steps/steps.js +134 -0
- package/dist/components/table/table.d.ts +18 -9
- package/dist/components/table/table.js +21 -13
- package/dist/components/text/text.d.ts +1 -1
- package/dist/components/theme-switch/theme-switch.js +1 -1
- package/dist/components/time-field/time-field.js +7 -6
- package/dist/components/timeline/timeline.d.ts +45 -0
- package/dist/components/timeline/timeline.js +86 -0
- package/dist/components/toast/toast.js +10 -26
- package/dist/components/toggle/toggle.d.ts +27 -0
- package/dist/components/toggle/toggle.js +61 -0
- package/dist/components/toggle-group/toggle-group.d.ts +27 -0
- package/dist/components/toggle-group/toggle-group.js +38 -0
- package/dist/components/toolbar/toolbar-context.js +12 -0
- package/dist/components/toolbar/toolbar.d.ts +52 -0
- package/dist/components/toolbar/toolbar.js +105 -0
- package/dist/components/trace/trace.d.ts +2 -1
- package/dist/components/trace/trace.js +15 -27
- package/dist/index.d.ts +46 -3
- package/dist/index.js +44 -3
- package/dist/internal/arriving-pieces.js +56 -0
- package/dist/internal/arriving.js +171 -0
- package/dist/internal/avatar-cut.d.ts +15 -0
- package/dist/internal/avatar-cut.js +83 -0
- package/dist/internal/choice-card.d.ts +15 -0
- package/dist/internal/choice-card.js +81 -0
- package/dist/internal/clipboard.js +37 -0
- package/dist/internal/copy.js +58 -0
- package/dist/internal/disclosure.js +15 -3
- package/dist/internal/field.js +24 -4
- package/dist/internal/glyphs.js +26 -1
- package/dist/internal/key-tip.js +18 -0
- package/dist/internal/list-mark.js +39 -0
- package/dist/internal/live-list.js +41 -0
- package/dist/internal/number-places.js +157 -0
- package/dist/internal/picker-sheet.js +1 -1
- package/dist/internal/presence-dot.js +24 -0
- package/dist/internal/presence.js +104 -0
- package/dist/internal/rail-mark.d.ts +3 -0
- package/dist/internal/rail-mark.js +33 -0
- package/dist/internal/rule.js +2 -1
- package/dist/internal/status-icon.js +22 -0
- package/dist/internal/tile.js +23 -0
- package/dist/internal/travelling-mark.js +204 -0
- package/dist/lib/cn.js +10 -0
- package/dist/lib/shortcut.d.ts +11 -0
- package/dist/lib/shortcut.js +165 -0
- package/package.json +1 -1
- package/src/styles/accordion.css +176 -0
- package/src/styles/action-bar.css +28 -0
- package/src/styles/assistant.css +83 -0
- package/src/styles/avatar.css +24 -0
- package/src/styles/consent.css +65 -0
- package/src/styles/copy.css +12 -11
- package/src/styles/depth.css +120 -4
- package/src/styles/marks.css +20 -2
- package/src/styles/motion.css +3 -0
- package/src/styles/rail.css +49 -0
- package/src/styles/rolling-number.css +94 -0
- package/src/styles/segmented.css +14 -7
- package/src/styles/steps.css +98 -0
- package/src/styles/timeline.css +48 -0
- package/src/styles/travel.css +36 -0
- package/src/styles.css +10 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/components/chip/chip-variants.ts
|
|
2
|
+
/**
|
|
3
|
+
* The look of a chip as class names, for the two places that draw one: `Chip`, and the field of
|
|
4
|
+
* a multi-select, whose chips are Base UI's own parts. Server-safe, like `buttonVariants`.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* As wide as its text. Where a chip may be too long for its row, give it a `max-w-*`: the text
|
|
8
|
+
* then ends in an ellipsis.
|
|
9
|
+
*/
|
|
10
|
+
const chipShape = "inline-flex h-[1.375rem] w-max items-center gap-1 rounded-sm px-2 align-middle text-sm font-medium whitespace-nowrap";
|
|
11
|
+
/** `plug`: raised, a small fitting. `flat`: a quiet wash with a faint edge, like a `Badge`. */
|
|
12
|
+
const chipFace = {
|
|
13
|
+
plug: "bg-raised depth-plug text-fg",
|
|
14
|
+
flat: "bg-surface-quiet text-fg-body inset-ring inset-ring-current/15 forced-colors:outline"
|
|
15
|
+
};
|
|
16
|
+
const chipDisabledLook = "data-disabled:bg-disabled data-disabled:depth-flat data-disabled:text-on-disabled";
|
|
17
|
+
/**
|
|
18
|
+
* In a row that is live it seats into its place once that has begun to open, and leaves by
|
|
19
|
+
* fading before the place closes: an exit does not scale back.
|
|
20
|
+
*/
|
|
21
|
+
const chipMotion = ["transition-[opacity,scale] delay-75 spring-seat in-data-live:starting:scale-90 in-data-live:starting:opacity-0", "in-data-leaving:opacity-0 in-data-leaving:delay-0 in-data-leaving:spring-leave"].join(" ");
|
|
22
|
+
/** The key that takes the chip away: 18px in the chip, a finger's target around it. */
|
|
23
|
+
const chipRemoveKey = [
|
|
24
|
+
"touch-target relative flex size-[1.125rem] shrink-0 items-center justify-center rounded-xs text-fg-muted select-none",
|
|
25
|
+
"hover:bg-hover hover:text-fg",
|
|
26
|
+
"focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-accent"
|
|
27
|
+
].join(" ");
|
|
28
|
+
export { chipDisabledLook, chipFace, chipMotion, chipRemoveKey, chipShape };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { IconSvgElement } from "../icon/icon.js";
|
|
2
|
+
import { ChipVariant } from "./chip-variants.js";
|
|
3
|
+
import { ComponentProps, ReactNode } from "react";
|
|
4
|
+
export type ChipProps = Omit<ComponentProps<"span">, "children"> & {
|
|
5
|
+
/** What the chip stands for, in a word or two: "Bezahlt", "Schreinerei Huber". */
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/** A 12px symbol before the text. */
|
|
8
|
+
icon?: IconSvgElement;
|
|
9
|
+
/**
|
|
10
|
+
* Something drawn before the text in place of `icon`: a mark that changes (a file on its way),
|
|
11
|
+
* a small picture. As tall as the chip's text at most.
|
|
12
|
+
*/
|
|
13
|
+
lead?: ReactNode;
|
|
14
|
+
/** With it the chip carries a key that takes it away. Remove it from your list here. */
|
|
15
|
+
onRemove?: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* What the key that takes the chip away is called, as one verb. The chip's own text is said
|
|
18
|
+
* before it: "Bezahlt entfernen".
|
|
19
|
+
*/
|
|
20
|
+
removeLabel?: string;
|
|
21
|
+
/** It cannot be taken away right now, and lies flat. */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* `plug` (the default): raised, a small fitting. `flat`: a quiet wash with a faint edge, the
|
|
25
|
+
* way a `Badge` is drawn, for a row where raised chips would be too much.
|
|
26
|
+
*/
|
|
27
|
+
variant?: ChipVariant;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Something that was chosen and can be taken away again: a filter that is applied, a value in
|
|
31
|
+
* a field, a recipient. It is a small fitting seated in its surroundings, a plug: raised, with
|
|
32
|
+
* an edge, but without a shadow of its own. A state that is only read ("Bezahlt" on a row) is
|
|
33
|
+
* a `Badge`, which is flat.
|
|
34
|
+
*
|
|
35
|
+
* Give it `onRemove` and it carries a key that takes it away. Put the chips of a row into a
|
|
36
|
+
* `ChipGroup`: there a chip that leaves fades while the row closes its place, one that joins
|
|
37
|
+
* opens its place first, and the keyboard focus goes to the chip beside the one that left.
|
|
38
|
+
*/
|
|
39
|
+
export declare function Chip({ icon, lead, onRemove, removeLabel, disabled, variant, className, children, ...props }: ChipProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Icon } from "../icon/icon.js";
|
|
2
|
+
import { CloseGlyph } from "../../internal/glyphs.js";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import { chipDisabledLook, chipFace, chipMotion, chipRemoveKey, chipShape } from "./chip-variants.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { useId } from "react";
|
|
7
|
+
// src/components/chip/chip.tsx
|
|
8
|
+
/** The key of the chip beside this one, the next if there is one, that can take the focus. */
|
|
9
|
+
function keyBeside(key) {
|
|
10
|
+
const place = key.closest("[data-slot=\"chip-place\"]");
|
|
11
|
+
const find = (step) => {
|
|
12
|
+
for (let other = place?.[step]; other; other = other[step]) {
|
|
13
|
+
const found = other.matches("[data-leaving]") ? null : other.querySelector("[data-slot=\"chip-remove\"]");
|
|
14
|
+
if (found) return found;
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
};
|
|
18
|
+
return find("nextElementSibling") ?? find("previousElementSibling");
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Something that was chosen and can be taken away again: a filter that is applied, a value in
|
|
22
|
+
* a field, a recipient. It is a small fitting seated in its surroundings, a plug: raised, with
|
|
23
|
+
* an edge, but without a shadow of its own. A state that is only read ("Bezahlt" on a row) is
|
|
24
|
+
* a `Badge`, which is flat.
|
|
25
|
+
*
|
|
26
|
+
* Give it `onRemove` and it carries a key that takes it away. Put the chips of a row into a
|
|
27
|
+
* `ChipGroup`: there a chip that leaves fades while the row closes its place, one that joins
|
|
28
|
+
* opens its place first, and the keyboard focus goes to the chip beside the one that left.
|
|
29
|
+
*/
|
|
30
|
+
function Chip({ icon, lead, onRemove, removeLabel = "Entfernen", disabled = false, variant = "plug", className, children, ...props }) {
|
|
31
|
+
const labelId = useId();
|
|
32
|
+
const removeId = useId();
|
|
33
|
+
const removable = onRemove !== void 0 && !disabled;
|
|
34
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
35
|
+
"data-slot": "chip",
|
|
36
|
+
"data-variant": variant,
|
|
37
|
+
"data-disabled": disabled ? "" : void 0,
|
|
38
|
+
className: cn(chipShape, chipFace[variant], chipDisabledLook, chipMotion, removable && "pr-0.5", className),
|
|
39
|
+
...props,
|
|
40
|
+
children: [
|
|
41
|
+
lead ?? (icon && /* @__PURE__ */ jsx(Icon, {
|
|
42
|
+
icon,
|
|
43
|
+
size: 12,
|
|
44
|
+
className: "-ml-0.5 text-fg-muted"
|
|
45
|
+
})),
|
|
46
|
+
/* @__PURE__ */ jsx("span", {
|
|
47
|
+
id: labelId,
|
|
48
|
+
"data-slot": "chip-label",
|
|
49
|
+
className: "truncate",
|
|
50
|
+
children
|
|
51
|
+
}),
|
|
52
|
+
removable && /* @__PURE__ */ jsx("button", {
|
|
53
|
+
type: "button",
|
|
54
|
+
id: removeId,
|
|
55
|
+
"data-slot": "chip-remove",
|
|
56
|
+
"aria-label": removeLabel,
|
|
57
|
+
"aria-labelledby": `${labelId} ${removeId}`,
|
|
58
|
+
onClick: (event) => {
|
|
59
|
+
if (event.currentTarget === document.activeElement) keyBeside(event.currentTarget)?.focus();
|
|
60
|
+
onRemove();
|
|
61
|
+
},
|
|
62
|
+
className: chipRemoveKey,
|
|
63
|
+
children: /* @__PURE__ */ jsx(CloseGlyph, {
|
|
64
|
+
width: 8,
|
|
65
|
+
height: 8
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
export { Chip };
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
+
import { CopyButtonLabels } from "../copy-button/copy-button.js";
|
|
1
2
|
import "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
copyLabel?: string;
|
|
5
|
-
/** The tooltip once the code is on the clipboard. */
|
|
6
|
-
copiedLabel?: string;
|
|
7
|
-
/** Read out once the code is on the clipboard: a full sentence. */
|
|
8
|
-
copiedMessage?: string;
|
|
9
|
-
/** Read out and shown when the clipboard refused; the code is then selected instead. */
|
|
10
|
-
failedLabel?: string;
|
|
11
|
-
failedMessage?: string;
|
|
12
|
-
};
|
|
3
|
+
/** The words of the copy key of a code block. */
|
|
4
|
+
export type CodeCopyLabels = CopyButtonLabels;
|
|
@@ -1,71 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { Icon } from "../icon/icon.js";
|
|
4
|
-
import { Tooltip, TooltipContent, TooltipTrigger } from "../tooltip/tooltip.js";
|
|
5
|
-
import { TickGlyph } from "../../internal/glyphs.js";
|
|
2
|
+
import { CopyButton } from "../copy-button/copy-button.js";
|
|
6
3
|
import { cn } from "../../lib/cn.js";
|
|
7
|
-
import { jsx
|
|
8
|
-
import { Copy01Icon } from "@hugeicons/core-free-icons";
|
|
9
|
-
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
5
|
// src/components/code-block/code-copy.tsx
|
|
11
|
-
/** How long the tick stands before the copy symbol comes back. */
|
|
12
|
-
const SHOWN_MS = 1600;
|
|
13
6
|
/**
|
|
14
|
-
* The copy
|
|
15
|
-
*
|
|
16
|
-
* symbol seats back. If the browser refuses the clipboard, the code is selected instead.
|
|
7
|
+
* The copy key of a code block: a small `CopyButton` worded for code. It takes its five labels
|
|
8
|
+
* by name, because a block hands it all of its key options at once.
|
|
17
9
|
*/
|
|
18
|
-
function CodeCopy({ text, codeRef, copyLabel = "Code kopieren", copiedLabel
|
|
19
|
-
|
|
20
|
-
const timer = useRef(void 0);
|
|
21
|
-
useEffect(() => () => clearTimeout(timer.current), []);
|
|
22
|
-
async function copy() {
|
|
23
|
-
clearTimeout(timer.current);
|
|
24
|
-
try {
|
|
25
|
-
await navigator.clipboard.writeText(text);
|
|
26
|
-
setState("copied");
|
|
27
|
-
} catch {
|
|
28
|
-
const code = codeRef.current;
|
|
29
|
-
if (code) window.getSelection()?.selectAllChildren(code);
|
|
30
|
-
setState("failed");
|
|
31
|
-
}
|
|
32
|
-
timer.current = setTimeout(() => setState("idle"), SHOWN_MS);
|
|
33
|
-
}
|
|
34
|
-
const copied = state === "copied";
|
|
35
|
-
const word = state === "failed" ? failedLabel : copiedLabel;
|
|
36
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
10
|
+
function CodeCopy({ text, codeRef, copyLabel = "Code kopieren", copiedLabel, copiedMessage = "Der Code wurde kopiert.", failedLabel, failedMessage = "Der Code wurde nicht kopiert. Er ist markiert und kann mit ⌘C kopiert werden.", className }) {
|
|
11
|
+
return /* @__PURE__ */ jsx(CopyButton, {
|
|
37
12
|
"data-slot": "code-copy",
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
className: "text-fg-muted hover:text-fg",
|
|
48
|
-
children: /* @__PURE__ */ jsxs("span", {
|
|
49
|
-
"data-slot": "code-copy-marks",
|
|
50
|
-
"data-copied": copied ? "" : void 0,
|
|
51
|
-
className: "grid place-items-center *:col-start-1 *:row-start-1",
|
|
52
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
53
|
-
"data-slot": "code-copy-symbol",
|
|
54
|
-
icon: Copy01Icon,
|
|
55
|
-
size: 14
|
|
56
|
-
}), /* @__PURE__ */ jsx(TickGlyph, {
|
|
57
|
-
"data-slot": "code-copy-tick",
|
|
58
|
-
width: 14,
|
|
59
|
-
height: 14,
|
|
60
|
-
strokeWidth: 1.5
|
|
61
|
-
})]
|
|
62
|
-
})
|
|
63
|
-
})
|
|
64
|
-
}), /* @__PURE__ */ jsx(TooltipContent, { children: state === "idle" ? copyLabel : word })] }), /* @__PURE__ */ jsx("span", {
|
|
65
|
-
role: "status",
|
|
66
|
-
className: "sr-only",
|
|
67
|
-
children: state === "copied" ? copiedMessage : state === "failed" ? failedMessage : ""
|
|
68
|
-
})]
|
|
13
|
+
size: "sm",
|
|
14
|
+
text,
|
|
15
|
+
selectTarget: codeRef,
|
|
16
|
+
copyLabel,
|
|
17
|
+
copiedLabel,
|
|
18
|
+
copiedMessage,
|
|
19
|
+
failedLabel,
|
|
20
|
+
failedMessage,
|
|
21
|
+
className: cn("flex", className)
|
|
69
22
|
});
|
|
70
23
|
}
|
|
71
24
|
export { CodeCopy };
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Button } from "../button/button.js";
|
|
3
3
|
import { Icon } from "../icon/icon.js";
|
|
4
|
+
import { Toggle } from "../toggle/toggle.js";
|
|
4
5
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../tooltip/tooltip.js";
|
|
5
|
-
import {
|
|
6
|
+
import { COPY_SHOWN_MS, CopyMarks } from "../../internal/copy.js";
|
|
6
7
|
import { cn } from "../../lib/cn.js";
|
|
7
8
|
import { CodeCopy } from "./code-copy.js";
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
import { Download01Icon, TextWrapIcon } from "@hugeicons/core-free-icons";
|
|
10
10
|
import { useEffect, useRef, useState } from "react";
|
|
11
|
+
import { Download01Icon, TextWrapIcon } from "@hugeicons/core-free-icons";
|
|
11
12
|
// src/components/code-block/code-keys.tsx
|
|
12
|
-
/** How long the tick stands before the symbol comes back (as in `CodeCopy`). */
|
|
13
|
-
const SHOWN_MS = 1600;
|
|
14
13
|
/**
|
|
15
14
|
* The keys of a block of code, at the end of its header or in its top corner: line wrap, the
|
|
16
15
|
* download, and last the copy, which every block has and which so keeps its place.
|
|
@@ -20,15 +19,14 @@ function CodeKeys({ text, codeRef, fileName = "code.txt", download, downloadLabe
|
|
|
20
19
|
"data-slot": "code-keys",
|
|
21
20
|
className: cn("flex items-center gap-0.5", className),
|
|
22
21
|
children: [
|
|
23
|
-
wrapToggle && /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: /* @__PURE__ */ jsx(
|
|
22
|
+
wrapToggle && /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: /* @__PURE__ */ jsx(Toggle, {
|
|
24
23
|
iconOnly: true,
|
|
25
24
|
size: "sm",
|
|
26
25
|
variant: "quiet",
|
|
27
26
|
"aria-label": wrapLabel,
|
|
28
|
-
"aria-pressed": wrapped,
|
|
29
27
|
"data-slot": "code-wrap",
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
pressed: wrapped,
|
|
29
|
+
onPressedChange: onWrappedChange,
|
|
32
30
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
33
31
|
icon: TextWrapIcon,
|
|
34
32
|
size: 14
|
|
@@ -68,7 +66,7 @@ function CodeDownload({ text, fileName, downloadLabel = "Herunterladen", downloa
|
|
|
68
66
|
setTimeout(() => URL.revokeObjectURL(url), 0);
|
|
69
67
|
clearTimeout(timer.current);
|
|
70
68
|
setDone(true);
|
|
71
|
-
timer.current = setTimeout(() => setDone(false),
|
|
69
|
+
timer.current = setTimeout(() => setDone(false), COPY_SHOWN_MS);
|
|
72
70
|
}
|
|
73
71
|
return /* @__PURE__ */ jsxs("div", {
|
|
74
72
|
"data-slot": "code-download",
|
|
@@ -82,19 +80,9 @@ function CodeDownload({ text, fileName, downloadLabel = "Herunterladen", downloa
|
|
|
82
80
|
"aria-label": downloadLabel,
|
|
83
81
|
onClick: save,
|
|
84
82
|
className: "text-fg-muted hover:text-fg",
|
|
85
|
-
children: /* @__PURE__ */
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
89
|
-
"data-slot": "code-copy-symbol",
|
|
90
|
-
icon: Download01Icon,
|
|
91
|
-
size: 14
|
|
92
|
-
}), /* @__PURE__ */ jsx(TickGlyph, {
|
|
93
|
-
"data-slot": "code-copy-tick",
|
|
94
|
-
width: 14,
|
|
95
|
-
height: 14,
|
|
96
|
-
strokeWidth: 1.5
|
|
97
|
-
})]
|
|
83
|
+
children: /* @__PURE__ */ jsx(CopyMarks, {
|
|
84
|
+
copied: done,
|
|
85
|
+
icon: Download01Icon
|
|
98
86
|
})
|
|
99
87
|
})
|
|
100
88
|
}), /* @__PURE__ */ jsx(TooltipContent, { children: done ? downloadedLabel : downloadLabel })] }), /* @__PURE__ */ jsx("span", {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { disclosureChevron, disclosurePanel } from "../../internal/disclosure.js";
|
|
2
|
+
import { disclosureChevron, disclosurePanel, disclosureUnfold } from "../../internal/disclosure.js";
|
|
3
3
|
import { ChevronRightGlyph } from "../../internal/glyphs.js";
|
|
4
4
|
import { cn, mergeClassName } from "../../lib/cn.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -34,7 +34,7 @@ function CollapsibleTrigger({ className, children, ...props }) {
|
|
|
34
34
|
...props,
|
|
35
35
|
children: [/* @__PURE__ */ jsx(ChevronRightGlyph, {
|
|
36
36
|
"data-slot": "collapsible-chevron",
|
|
37
|
-
className: cn(disclosureChevron, "-ml-1 group-data-panel-open:rotate-90")
|
|
37
|
+
className: cn(disclosureChevron, "-ml-1 [--lean:var(--motion-lean)_0] group-data-panel-open:rotate-90 group-data-panel-open:[--lean:0_var(--motion-lean)]")
|
|
38
38
|
}), children]
|
|
39
39
|
});
|
|
40
40
|
}
|
|
@@ -42,7 +42,11 @@ function CollapsibleTrigger({ className, children, ...props }) {
|
|
|
42
42
|
function CollapsiblePanel({ className, children, ...props }) {
|
|
43
43
|
return /* @__PURE__ */ jsx(Collapsible$1.Panel, {
|
|
44
44
|
"data-slot": "collapsible-panel",
|
|
45
|
-
className: mergeClassName([
|
|
45
|
+
className: mergeClassName([
|
|
46
|
+
"-mx-1 h-(--collapsible-panel-height) self-stretch",
|
|
47
|
+
disclosurePanel,
|
|
48
|
+
disclosureUnfold
|
|
49
|
+
], className),
|
|
46
50
|
...props,
|
|
47
51
|
children: /* @__PURE__ */ jsx("div", {
|
|
48
52
|
"data-slot": "collapsible-panel-content",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChipVariant } from "../chip/chip-variants.js";
|
|
1
2
|
import { IconSvgElement } from "../icon/icon.js";
|
|
2
3
|
import { FieldSize } from "../../internal/field.js";
|
|
3
4
|
import { ReactNode } from "react";
|
|
@@ -18,7 +19,17 @@ export type ComboboxOptionGroup<Value = string> = {
|
|
|
18
19
|
value: string;
|
|
19
20
|
items: ReadonlyArray<ComboboxOption<Value>>;
|
|
20
21
|
};
|
|
21
|
-
export type ComboboxProps<
|
|
22
|
+
export type ComboboxProps<Value, Multiple extends boolean | undefined = false, Item = Value> = Combobox$1.Root.Props<Value, Multiple, Item> & {
|
|
23
|
+
/**
|
|
24
|
+
* Lets the reader make a value that is not in the list. While what they typed matches no
|
|
25
|
+
* option's name exactly, a last row offers to create it; choosing that row calls this with
|
|
26
|
+
* the typed text. Add the new option to your `items` and return it: it is chosen at once.
|
|
27
|
+
* Needs a flat list of options and a controlled `value`.
|
|
28
|
+
*/
|
|
29
|
+
onCreate?: (label: string) => Value | undefined;
|
|
30
|
+
/** What the row that creates says: „Dringend“ anlegen. */
|
|
31
|
+
createLabel?: (label: string) => ReactNode;
|
|
32
|
+
};
|
|
22
33
|
/**
|
|
23
34
|
* A select you can type into: for lists too long to scan (a customer out of two hundred), where
|
|
24
35
|
* people know what they are looking for. Typing filters the list; only an entry of the list can
|
|
@@ -28,11 +39,15 @@ export type ComboboxProps<Option> = Combobox$1.Root.Props<Option, false>;
|
|
|
28
39
|
* object, is the value: `defaultValue={items[0]}`, `onValueChange={(option) => …}`. In a form
|
|
29
40
|
* its `value` is what is submitted.
|
|
30
41
|
*
|
|
42
|
+
* With `multiple` the value is a list of options and the field is a `ComboboxChips`: every
|
|
43
|
+
* chosen option is a chip in it. The list then stays open after a choice, so several can be
|
|
44
|
+
* taken in a row, and each is submitted under the field's name.
|
|
45
|
+
*
|
|
31
46
|
* Typing ignores case and accents: "gart" finds "Gärtnerei" and "cafe" finds "Café". Pass
|
|
32
47
|
* `locale` (`"de-DE"`) so that does not depend on the machine. The first match is highlighted
|
|
33
48
|
* while typing, so Enter takes it.
|
|
34
49
|
*/
|
|
35
|
-
export declare function Combobox<
|
|
50
|
+
export declare function Combobox<Value, Multiple extends boolean | undefined = false, Item = Value>({ autoHighlight, filter, locale, items, multiple, onCreate, createLabel, inputValue, defaultInputValue, onInputValueChange, onValueChange, onOpenChange, ...props }: ComboboxProps<Value, Multiple, Item>): import("react").JSX.Element;
|
|
36
51
|
export type ComboboxInputProps = Omit<Combobox$1.Input.Props, "className" | "size"> & {
|
|
37
52
|
/** The size of the field, from the density. */
|
|
38
53
|
size?: FieldSize;
|
|
@@ -49,6 +64,39 @@ export type ComboboxInputProps = Omit<Combobox$1.Input.Props, "className" | "siz
|
|
|
49
64
|
* placeholder is an example ("z. B. Schreinerei Huber"), not a label.
|
|
50
65
|
*/
|
|
51
66
|
export declare function ComboboxInput({ className, size, clearLabel, openLabel, ...props }: ComboboxInputProps): import("react").JSX.Element;
|
|
67
|
+
export type ComboboxChipsProps = Omit<Combobox$1.Input.Props, "className" | "size"> & {
|
|
68
|
+
/** The size of the field, from the density. */
|
|
69
|
+
size?: FieldSize;
|
|
70
|
+
/** Classes for the field as a whole, e.g. its width. */
|
|
71
|
+
className?: string;
|
|
72
|
+
/**
|
|
73
|
+
* `flat` (the default): the chips are drawn like a `Badge`, quiet in the field. `plug`: raised
|
|
74
|
+
* plugs seated in it, like a `Chip` on its own, where the values are the field's point (the
|
|
75
|
+
* recipients of a message).
|
|
76
|
+
*/
|
|
77
|
+
chipVariant?: ChipVariant;
|
|
78
|
+
/** The name of the row of chips, for assistive tech. */
|
|
79
|
+
chipsLabel?: string;
|
|
80
|
+
/** The verb of the key that takes a chip away. The chip's text is said before it. */
|
|
81
|
+
removeLabel?: string;
|
|
82
|
+
/** Said with the input once something is chosen: how many, and how to reach them. */
|
|
83
|
+
chipsHint?: (count: number) => string;
|
|
84
|
+
/** The accessible name of the button that clears every choice. */
|
|
85
|
+
clearLabel?: string;
|
|
86
|
+
/** The accessible name of the button that opens the list. */
|
|
87
|
+
openLabel?: string;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* The field of a `Combobox multiple`: every chosen option is a chip in it, and the input stands
|
|
91
|
+
* after the last one. Backspace in the empty input takes the last chip, Arrow left walks into
|
|
92
|
+
* the chips, and each chip has a key that takes it away.
|
|
93
|
+
*
|
|
94
|
+
* A chip that joins seats into its place, one that leaves fades while its neighbours close up,
|
|
95
|
+
* and when the chips need another line the field eases to its new height, so what stands below
|
|
96
|
+
* is pushed and does not jump. Give it a name with a `FieldLabel` or an `aria-label`; the
|
|
97
|
+
* placeholder is an example and shows only while nothing is chosen.
|
|
98
|
+
*/
|
|
99
|
+
export declare function ComboboxChips({ className, size, chipVariant, chipsLabel, removeLabel, chipsHint, clearLabel, openLabel, ...props }: ComboboxChipsProps): import("react").JSX.Element;
|
|
52
100
|
export type ComboboxContentProps = Omit<Combobox$1.Popup.Props, "children"> & Pick<Combobox$1.Positioner.Props, "side" | "align" | "sideOffset" | "alignOffset"> & {
|
|
53
101
|
/**
|
|
54
102
|
* Said when nothing matches what was typed. Name what was looked for ("Kein Kunde
|
|
@@ -73,7 +121,9 @@ export type ComboboxItemProps = Combobox$1.Item.Props & {
|
|
|
73
121
|
};
|
|
74
122
|
/**
|
|
75
123
|
* One row. Pass the option as `value`; its label, icon and detail are shown unless you give
|
|
76
|
-
* children or props of your own.
|
|
124
|
+
* children or props of your own. As in a `Select`, the chosen row carries its mark at the right
|
|
125
|
+
* end (the disc, or the tick where several can be chosen), or stands on the tint where the rows
|
|
126
|
+
* have a detail; chosen rows that touch are one shape.
|
|
77
127
|
*/
|
|
78
128
|
export declare function ComboboxItem({ className, children, icon, detail, value, ...props }: ComboboxItemProps): import("react").JSX.Element;
|
|
79
129
|
/** A group of rows. Pass the group's `items`, then a `ComboboxGroupLabel` and a `ComboboxCollection`. */
|