@stll/ui 0.98.0 → 0.99.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/matter-icon.d.ts +7 -3
- package/dist/components/matter-icon.js +56 -8
- package/dist/components/matter-icon.native.d.ts +3 -20
- package/dist/components/matter-icon.native.js +54 -14
- package/dist/components/matter-icon.shared.d.ts +25 -4
- package/dist/components/matter-icon.shared.js +31 -1
- package/dist/components/view-toolbar-chip-icon.d.ts +1 -0
- package/dist/components/view-toolbar-chip-icon.js +10 -0
- package/dist/components/view-toolbar-classes.d.ts +9 -4
- package/dist/components/view-toolbar-classes.js +10 -5
- package/dist/components/view-toolbar-shell.d.ts +13 -5
- package/dist/components/view-toolbar-shell.js +19 -11
- package/dist/components/view-toolbar.d.ts +5 -1
- package/dist/components/view-toolbar.js +18 -8
- package/dist/hooks/use-inline-overflow.d.ts +3 -1
- package/dist/hooks/use-inline-overflow.js +12 -6
- package/dist/kanban/subgroup-board.d.ts +3 -1
- package/dist/kanban/subgroup-board.js +22 -20
- package/dist/styles/matter-tile.css +6 -0
- package/dist/styles/theme.css +1 -0
- package/package.json +3 -2
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { MatterIconContract } from "./matter-icon.shared.js";
|
|
1
|
+
import { MatterIconContract, MatterIdentity } from "./matter-icon.shared.js";
|
|
2
|
+
import { PropsWithChildren } from "react";
|
|
3
|
+
export declare const MatterIconLocaleProvider: ({ children, locale }: PropsWithChildren<{
|
|
4
|
+
locale: string;
|
|
5
|
+
}>) => import("react").JSX.Element;
|
|
6
|
+
export declare const MatterIcon: (props: MatterIconProps) => import("react").JSX.Element;
|
|
2
7
|
type MatterIconProps = {
|
|
3
8
|
className?: string | undefined;
|
|
4
9
|
} & MatterIconContract;
|
|
5
|
-
export declare const MatterIcon: (props: MatterIconProps) => import("react").JSX.Element;
|
|
6
10
|
export declare const MattersNavIcon: ({ className }: {
|
|
7
11
|
className?: string | undefined;
|
|
8
12
|
}) => import("react").JSX.Element;
|
|
9
|
-
export {};
|
|
13
|
+
export type { MatterIdentity };
|
|
@@ -1,15 +1,63 @@
|
|
|
1
1
|
import { LayersIcon } from "../icons.js";
|
|
2
2
|
import { resolveMatterColor } from "../lib/matter-colors.js";
|
|
3
3
|
import { cn } from "../lib/utils.js";
|
|
4
|
-
import { ALL_MATTERS_STACK } from "./matter-icon.shared.js";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { ALL_MATTERS_STACK, MATTER_TILE_DARK_GROUND, MATTER_TILE_LIGHT_GROUND, matterTileBackground, matterTileLetter } from "./matter-icon.shared.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { createContext, useContext } from "react";
|
|
6
7
|
// src/components/matter-icon.tsx
|
|
8
|
+
const graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
9
|
+
const MatterIconLocaleContext = createContext(void 0);
|
|
10
|
+
const MatterIconLocaleProvider = ({ children, locale }) => /* @__PURE__ */ jsx(MatterIconLocaleContext, {
|
|
11
|
+
value: locale,
|
|
12
|
+
children
|
|
13
|
+
});
|
|
7
14
|
const MatterIcon = (props) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
const uiLocale = useContext(MatterIconLocaleContext);
|
|
16
|
+
if ("matter" in props) {
|
|
17
|
+
const { matter } = props;
|
|
18
|
+
const locale = props.locale ?? uiLocale;
|
|
19
|
+
const letter = matterTileLetter(graphemes.segment(matter.name), locale);
|
|
20
|
+
const swatch = resolveMatterColor(matter.id, matter.color);
|
|
21
|
+
const lightBackground = matterTileBackground({
|
|
22
|
+
swatch,
|
|
23
|
+
ground: MATTER_TILE_LIGHT_GROUND,
|
|
24
|
+
groundPercent: 55
|
|
25
|
+
});
|
|
26
|
+
const darkBackground = matterTileBackground({
|
|
27
|
+
swatch,
|
|
28
|
+
ground: MATTER_TILE_DARK_GROUND,
|
|
29
|
+
groundPercent: 65
|
|
30
|
+
});
|
|
31
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
32
|
+
"aria-hidden": "true",
|
|
33
|
+
className: cn("size-4", props.className),
|
|
34
|
+
"data-slot": "matter-tile",
|
|
35
|
+
lang: locale,
|
|
36
|
+
style: { color: `light-dark(var(${MATTER_TILE_DARK_GROUND}), var(${MATTER_TILE_LIGHT_GROUND}))` },
|
|
37
|
+
viewBox: "0 0 24 24",
|
|
38
|
+
children: [/* @__PURE__ */ jsx("rect", {
|
|
39
|
+
fill: `light-dark(${lightBackground}, ${darkBackground})`,
|
|
40
|
+
height: 24,
|
|
41
|
+
rx: 5,
|
|
42
|
+
width: 24
|
|
43
|
+
}), letter === null ? /* @__PURE__ */ jsx(LayersIcon, {
|
|
44
|
+
className: "size-[14px]",
|
|
45
|
+
height: 14,
|
|
46
|
+
width: 14,
|
|
47
|
+
x: 5,
|
|
48
|
+
y: 5
|
|
49
|
+
}) : /* @__PURE__ */ jsx("text", {
|
|
50
|
+
dominantBaseline: "central",
|
|
51
|
+
fill: "currentColor",
|
|
52
|
+
fontSize: 15,
|
|
53
|
+
fontWeight: 600,
|
|
54
|
+
textAnchor: "middle",
|
|
55
|
+
x: 12,
|
|
56
|
+
y: 12,
|
|
57
|
+
children: letter
|
|
58
|
+
})]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
13
61
|
if (props.variant === "all") return /* @__PURE__ */ jsx("svg", {
|
|
14
62
|
"aria-hidden": "true",
|
|
15
63
|
className: cn(props.className),
|
|
@@ -32,4 +80,4 @@ const MattersNavIcon = ({ className }) => /* @__PURE__ */ jsx(MatterIcon, {
|
|
|
32
80
|
className,
|
|
33
81
|
variant: "none"
|
|
34
82
|
});
|
|
35
|
-
export { MatterIcon, MattersNavIcon };
|
|
83
|
+
export { MatterIcon, MatterIconLocaleProvider, MattersNavIcon };
|
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
import { MatterIconContract } from "./matter-icon.shared.js";
|
|
2
|
-
|
|
3
|
-
* The shared contract, with a matter's colour optional: the app's matter
|
|
4
|
-
* records leave it out when none is stored, which the web reads as null.
|
|
5
|
-
*/
|
|
6
|
-
type MatterIconProps = ({
|
|
7
|
-
matter: {
|
|
8
|
-
id: string;
|
|
9
|
-
color?: string | null | undefined;
|
|
10
|
-
};
|
|
11
|
-
} | Exclude<MatterIconContract, {
|
|
12
|
-
matter: unknown;
|
|
13
|
-
}>) & {
|
|
1
|
+
import { MatterIconContract, MatterIdentity } from "./matter-icon.shared.js";
|
|
2
|
+
type MatterIconProps = MatterIconContract & {
|
|
14
3
|
size?: number | undefined;
|
|
15
4
|
};
|
|
16
|
-
/**
|
|
17
|
-
* The web's `MatterIcon` (./matter-icon.tsx) on a phone: lucide's layers in
|
|
18
|
-
* the matter's own colour, resolved by the web's `resolveMatterColor` (the
|
|
19
|
-
* stored colour, else a swatch hashed from the id); the muted glyph for no
|
|
20
|
-
* matter; the tri-plane stack for all of them.
|
|
21
|
-
*/
|
|
22
5
|
export declare const MatterIcon: (props: MatterIconProps) => import("react").JSX.Element;
|
|
23
|
-
export {};
|
|
6
|
+
export type { MatterIdentity };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { resolveMatterColor } from "../lib/matter-colors.js";
|
|
2
|
-
import { ALL_MATTERS_STACK } from "./matter-icon.shared.js";
|
|
2
|
+
import { ALL_MATTERS_STACK, MATTER_TILE_DARK_GROUND, MATTER_TILE_LIGHT_GROUND, matterTileLetter, mixMatterTileBackground } from "./matter-icon.shared.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Text, View, useColorScheme } from "react-native";
|
|
4
5
|
import Svg, { Path } from "react-native-svg";
|
|
5
6
|
import { useCSSVariable } from "uniwind";
|
|
6
7
|
import { LayersIcon } from "lucide-react-native";
|
|
8
|
+
import { graphemeSegments } from "unicode-segmenter/grapheme";
|
|
7
9
|
// src/components/matter-icon.native.tsx
|
|
8
10
|
/**
|
|
9
11
|
* Every palette option a matter can be painted in, as a class. uniwind keeps
|
|
@@ -45,18 +47,55 @@ const themeVariable = (css) => {
|
|
|
45
47
|
* from happening.
|
|
46
48
|
*/
|
|
47
49
|
const asColour = (value) => typeof value === "string" ? value : "currentColor";
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
50
|
+
const MatterIcon = (props) => "matter" in props ? /* @__PURE__ */ jsx(MatterTile, { ...props }) : /* @__PURE__ */ jsx(MatterLayers, { ...props });
|
|
51
|
+
const MatterTile = ({ matter, locale, size = 16 }) => {
|
|
52
|
+
const isDark = useColorScheme() === "dark";
|
|
53
|
+
const swatch = resolveMatterColor(matter.id, matter.color);
|
|
54
|
+
const variable = themeVariable(swatch);
|
|
55
|
+
const [resolved, lightGround, darkGround] = useCSSVariable([
|
|
56
|
+
variable ?? MUTED,
|
|
57
|
+
MATTER_TILE_LIGHT_GROUND,
|
|
58
|
+
MATTER_TILE_DARK_GROUND
|
|
59
|
+
]);
|
|
60
|
+
const backgroundColor = mixMatterTileBackground({
|
|
61
|
+
swatch: variable === null ? swatch : resolved,
|
|
62
|
+
ground: isDark ? darkGround : lightGround,
|
|
63
|
+
groundPercent: isDark ? 65 : 55
|
|
64
|
+
});
|
|
65
|
+
const foreground = isDark ? lightGround : darkGround;
|
|
66
|
+
const segments = typeof Intl.Segmenter === "function" ? new Intl.Segmenter(locale, { granularity: "grapheme" }).segment(matter.name) : graphemeSegments(matter.name);
|
|
67
|
+
const letter = matterTileLetter(segments, locale);
|
|
68
|
+
return /* @__PURE__ */ jsx(View, {
|
|
69
|
+
accessibilityElementsHidden: true,
|
|
70
|
+
className: "bg-matter-tile-light dark:bg-matter-tile-dark",
|
|
71
|
+
importantForAccessibility: "no-hide-descendants",
|
|
72
|
+
style: {
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
backgroundColor,
|
|
75
|
+
borderRadius: size * (5 / 24),
|
|
76
|
+
height: size,
|
|
77
|
+
justifyContent: "center",
|
|
78
|
+
width: size
|
|
79
|
+
},
|
|
80
|
+
children: letter === null ? /* @__PURE__ */ jsx(LayersIcon, {
|
|
81
|
+
color: asColour(foreground),
|
|
82
|
+
size: size * (14 / 24)
|
|
83
|
+
}) : /* @__PURE__ */ jsx(Text, {
|
|
84
|
+
allowFontScaling: false,
|
|
85
|
+
className: "text-matter-tile-dark dark:text-matter-tile-light",
|
|
86
|
+
style: {
|
|
87
|
+
color: typeof foreground === "string" ? foreground : void 0,
|
|
88
|
+
fontSize: size * (15 / 24),
|
|
89
|
+
fontWeight: "600"
|
|
90
|
+
},
|
|
91
|
+
children: letter
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
const MatterLayers = ({ size = 16, variant }) => {
|
|
96
|
+
const [muted, ...stack] = useCSSVariable([MUTED, ...ALL_MATTERS_STACK.map(({ option }) => `--color-option-${option}`)]);
|
|
97
|
+
if (variant === "all") return /* @__PURE__ */ jsx(Svg, {
|
|
98
|
+
accessible: false,
|
|
60
99
|
fill: "none",
|
|
61
100
|
height: size,
|
|
62
101
|
viewBox: "0 0 24 24",
|
|
@@ -70,7 +109,8 @@ const MatterIcon = (props) => {
|
|
|
70
109
|
}, option))
|
|
71
110
|
});
|
|
72
111
|
return /* @__PURE__ */ jsx(LayersIcon, {
|
|
73
|
-
|
|
112
|
+
accessible: false,
|
|
113
|
+
color: asColour(muted),
|
|
74
114
|
size
|
|
75
115
|
});
|
|
76
116
|
};
|
|
@@ -1,11 +1,32 @@
|
|
|
1
|
+
export type MatterIdentity = {
|
|
2
|
+
id: string;
|
|
3
|
+
color: string | null;
|
|
4
|
+
name: string;
|
|
5
|
+
};
|
|
1
6
|
export type MatterIconContract = {
|
|
2
|
-
matter:
|
|
3
|
-
|
|
4
|
-
color: string | null;
|
|
5
|
-
};
|
|
7
|
+
matter: MatterIdentity;
|
|
8
|
+
locale?: string | undefined;
|
|
6
9
|
} | {
|
|
7
10
|
variant: "none" | "all";
|
|
8
11
|
};
|
|
12
|
+
export declare const MATTER_TILE_LIGHT_GROUND_PERCENT = 55;
|
|
13
|
+
export declare const MATTER_TILE_DARK_GROUND_PERCENT = 65;
|
|
14
|
+
export declare const MATTER_TILE_LIGHT_GROUND = "--color-matter-tile-light";
|
|
15
|
+
export declare const MATTER_TILE_DARK_GROUND = "--color-matter-tile-dark";
|
|
16
|
+
export declare const matterTileBackground: ({ swatch, ground, groundPercent }: {
|
|
17
|
+
swatch: string;
|
|
18
|
+
ground: string;
|
|
19
|
+
groundPercent: number;
|
|
20
|
+
}) => string;
|
|
21
|
+
/** Native theme variables are normalized to RGB hex when resolved. */
|
|
22
|
+
export declare const mixMatterTileBackground: ({ swatch, ground, groundPercent }: {
|
|
23
|
+
swatch: number | string | undefined;
|
|
24
|
+
ground: number | string | undefined;
|
|
25
|
+
groundPercent: number;
|
|
26
|
+
}) => string | undefined;
|
|
27
|
+
export declare const matterTileLetter: (segments: Iterable<{
|
|
28
|
+
segment: string;
|
|
29
|
+
}>, locale?: string) => string | null;
|
|
9
30
|
/** The three planes of the "all matters" glyph, top to bottom, in their tints. */
|
|
10
31
|
export declare const ALL_MATTERS_STACK: readonly [{
|
|
11
32
|
readonly d: "M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z";
|
|
@@ -1,4 +1,34 @@
|
|
|
1
1
|
// src/components/matter-icon.shared.ts
|
|
2
|
+
const MATTER_TILE_LIGHT_GROUND_PERCENT = 55;
|
|
3
|
+
const MATTER_TILE_DARK_GROUND_PERCENT = 65;
|
|
4
|
+
const MATTER_TILE_LIGHT_GROUND = "--color-matter-tile-light";
|
|
5
|
+
const MATTER_TILE_DARK_GROUND = "--color-matter-tile-dark";
|
|
6
|
+
const matterTileBackground = ({ swatch, ground, groundPercent }) => `color-mix(in srgb, ${swatch}, var(${ground}) ${groundPercent}%)`;
|
|
7
|
+
const HEX_DIGITS = "0123456789abcdef";
|
|
8
|
+
const hexByte = (pair) => {
|
|
9
|
+
const lower = pair.toLowerCase();
|
|
10
|
+
return HEX_DIGITS.indexOf(lower.charAt(0)) * 16 + HEX_DIGITS.indexOf(lower.charAt(1));
|
|
11
|
+
};
|
|
12
|
+
/** Native theme variables are normalized to RGB hex when resolved. */
|
|
13
|
+
const mixMatterTileBackground = ({ swatch, ground, groundPercent }) => {
|
|
14
|
+
if (typeof ground !== "string" || !/^#[0-9a-f]{6}$/iu.test(ground)) return;
|
|
15
|
+
if (typeof swatch !== "string" || !/^#[0-9a-f]{6}$/iu.test(swatch)) return ground;
|
|
16
|
+
const groundWeight = groundPercent / 100;
|
|
17
|
+
return `#${[
|
|
18
|
+
1,
|
|
19
|
+
3,
|
|
20
|
+
5
|
|
21
|
+
].map((offset) => {
|
|
22
|
+
const source = hexByte(swatch.slice(offset, offset + 2));
|
|
23
|
+
const neutral = hexByte(ground.slice(offset, offset + 2));
|
|
24
|
+
return Math.round(source * (1 - groundWeight) + neutral * groundWeight).toString(16).padStart(2, "0");
|
|
25
|
+
}).join("")}`;
|
|
26
|
+
};
|
|
27
|
+
const LETTER_OR_DIGIT = /[\p{L}\p{Nd}]/u;
|
|
28
|
+
const matterTileLetter = (segments, locale) => {
|
|
29
|
+
for (const { segment } of segments) if (LETTER_OR_DIGIT.test(segment)) return segment.toLocaleUpperCase(locale);
|
|
30
|
+
return null;
|
|
31
|
+
};
|
|
2
32
|
/** The three planes of the "all matters" glyph, top to bottom, in their tints. */
|
|
3
33
|
const ALL_MATTERS_STACK = [
|
|
4
34
|
{
|
|
@@ -14,4 +44,4 @@ const ALL_MATTERS_STACK = [
|
|
|
14
44
|
option: "green"
|
|
15
45
|
}
|
|
16
46
|
];
|
|
17
|
-
export { ALL_MATTERS_STACK };
|
|
47
|
+
export { ALL_MATTERS_STACK, MATTER_TILE_DARK_GROUND, MATTER_TILE_DARK_GROUND_PERCENT, MATTER_TILE_LIGHT_GROUND, MATTER_TILE_LIGHT_GROUND_PERCENT, matterTileBackground, matterTileLetter, mixMatterTileBackground };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ViewToolbarChipSelectIcon: () => import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ChevronsUpDownIcon } from "../icons.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/view-toolbar-chip-icon.tsx
|
|
4
|
+
const ViewToolbarChipSelectIcon = () => /* @__PURE__ */ jsx("span", {
|
|
5
|
+
"aria-hidden": "true",
|
|
6
|
+
className: "text-muted-foreground flex",
|
|
7
|
+
"data-slot": "view-toolbar-chip-select-icon",
|
|
8
|
+
children: /* @__PURE__ */ jsx(ChevronsUpDownIcon, {})
|
|
9
|
+
});
|
|
10
|
+
export { ViewToolbarChipSelectIcon };
|
|
@@ -5,9 +5,14 @@ export declare const VIEW_FILTER_BUTTON: {
|
|
|
5
5
|
};
|
|
6
6
|
/** The glyph on the "add a filter" button. */
|
|
7
7
|
export declare const VIEW_FILTER_ICON_CLASS_NAME = "size-3.5";
|
|
8
|
-
/**
|
|
9
|
-
export declare const
|
|
10
|
-
readonly className: "gap-1.5
|
|
8
|
+
/** The primary action inside any toolbar chip. */
|
|
9
|
+
export declare const VIEW_TOOLBAR_CHIP_ACTION: {
|
|
10
|
+
readonly className: "justify-start gap-1.5";
|
|
11
11
|
readonly size: "xs";
|
|
12
|
-
readonly variant: "
|
|
12
|
+
readonly variant: "ghost";
|
|
13
|
+
};
|
|
14
|
+
/** The secondary action on a split chip. */
|
|
15
|
+
export declare const VIEW_TOOLBAR_CHIP_ICON_ACTION: {
|
|
16
|
+
readonly size: "icon-xs";
|
|
17
|
+
readonly variant: "ghost";
|
|
13
18
|
};
|
|
@@ -6,10 +6,15 @@ const VIEW_FILTER_BUTTON = {
|
|
|
6
6
|
};
|
|
7
7
|
/** The glyph on the "add a filter" button. */
|
|
8
8
|
const VIEW_FILTER_ICON_CLASS_NAME = "size-3.5";
|
|
9
|
-
/**
|
|
10
|
-
const
|
|
11
|
-
className: "gap-1.5
|
|
9
|
+
/** The primary action inside any toolbar chip. */
|
|
10
|
+
const VIEW_TOOLBAR_CHIP_ACTION = {
|
|
11
|
+
className: "justify-start gap-1.5",
|
|
12
12
|
size: "xs",
|
|
13
|
-
variant: "
|
|
13
|
+
variant: "ghost"
|
|
14
|
+
};
|
|
15
|
+
/** The secondary action on a split chip. */
|
|
16
|
+
const VIEW_TOOLBAR_CHIP_ICON_ACTION = {
|
|
17
|
+
size: "icon-xs",
|
|
18
|
+
variant: "ghost"
|
|
14
19
|
};
|
|
15
|
-
export { VIEW_FILTER_BUTTON,
|
|
20
|
+
export { VIEW_FILTER_BUTTON, VIEW_FILTER_ICON_CLASS_NAME, VIEW_TOOLBAR_CHIP_ACTION, VIEW_TOOLBAR_CHIP_ICON_ACTION };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentProps, ReactNode } from "react";
|
|
1
|
+
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* The one row that holds a view switcher and its toolbar. It never wraps: at
|
|
4
4
|
* any width the tabs and the controls share a single line, the tabs taking the
|
|
@@ -16,10 +16,18 @@ export declare const ViewChromeBar: ({ className, ...props }: ComponentProps<"di
|
|
|
16
16
|
export declare const ViewToolbarChrome: ({ className, ref, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
|
|
17
17
|
/** The face of `ViewFilterButton` (./view-toolbar.tsx), for a loading view. */
|
|
18
18
|
export declare const ViewFilterButtonFace: () => import("react").JSX.Element;
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
/** The shared border, surface and height around a toolbar chip's actions. */
|
|
20
|
+
export declare const ViewToolbarChip: ({ children }: {
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
}) => import("react").JSX.Element;
|
|
23
|
+
/** A chip's loaded dimensions before its actions and labels are ready. */
|
|
24
|
+
export declare const ViewToolbarChipFace: ({ children, className, endIcon, showSelectIcon }: {
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
className?: string;
|
|
27
|
+
endIcon?: ReactElement;
|
|
28
|
+
showSelectIcon?: boolean;
|
|
29
|
+
}) => import("react").JSX.Element;
|
|
30
|
+
/** The loading face of a filter chip. */
|
|
23
31
|
export declare const ViewFilterChipFace: ({ children }: {
|
|
24
32
|
children: ReactNode;
|
|
25
33
|
}) => import("react").JSX.Element;
|
|
@@ -4,8 +4,9 @@ import { FilterIcon } from "../icons.js";
|
|
|
4
4
|
import { SCROLL_EDGE_FADE_CLASS, fadeScrollEdges } from "../lib/scroll-edge-fade.js";
|
|
5
5
|
import { cn } from "../lib/utils.js";
|
|
6
6
|
import { ButtonFace } from "./control-face.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { ViewToolbarChipSelectIcon } from "./view-toolbar-chip-icon.js";
|
|
8
|
+
import { VIEW_FILTER_BUTTON, VIEW_FILTER_ICON_CLASS_NAME, VIEW_TOOLBAR_CHIP_ACTION, VIEW_TOOLBAR_CHIP_ICON_ACTION } from "./view-toolbar-classes.js";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
// src/components/view-toolbar-shell.tsx
|
|
10
11
|
/**
|
|
11
12
|
* The one row that holds a view switcher and its toolbar. It never wraps: at
|
|
@@ -38,14 +39,21 @@ const ViewFilterButtonFace = () => /* @__PURE__ */ jsx(ButtonFace, {
|
|
|
38
39
|
variant: VIEW_FILTER_BUTTON.variant,
|
|
39
40
|
children: /* @__PURE__ */ jsx(FilterIcon, { className: VIEW_FILTER_ICON_CLASS_NAME })
|
|
40
41
|
});
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const ViewFilterChipFace = ({ children }) => /* @__PURE__ */ jsx(ButtonFace, {
|
|
46
|
-
className: VIEW_FILTER_CHIP.className,
|
|
47
|
-
size: VIEW_FILTER_CHIP.size,
|
|
48
|
-
variant: VIEW_FILTER_CHIP.variant,
|
|
42
|
+
/** The shared border, surface and height around a toolbar chip's actions. */
|
|
43
|
+
const ViewToolbarChip = ({ children }) => /* @__PURE__ */ jsx("span", {
|
|
44
|
+
className: "bg-muted/50 inline-flex shrink-0 items-center rounded-md border",
|
|
45
|
+
"data-slot": "view-toolbar-chip",
|
|
49
46
|
children
|
|
50
47
|
});
|
|
51
|
-
|
|
48
|
+
/** A chip's loaded dimensions before its actions and labels are ready. */
|
|
49
|
+
const ViewToolbarChipFace = ({ children, className, endIcon, showSelectIcon = false }) => /* @__PURE__ */ jsxs(ViewToolbarChip, { children: [/* @__PURE__ */ jsxs(ButtonFace, {
|
|
50
|
+
...VIEW_TOOLBAR_CHIP_ACTION,
|
|
51
|
+
className: cn(VIEW_TOOLBAR_CHIP_ACTION.className, className),
|
|
52
|
+
children: [children, showSelectIcon && /* @__PURE__ */ jsx(ViewToolbarChipSelectIcon, {})]
|
|
53
|
+
}), endIcon !== void 0 && /* @__PURE__ */ jsx(ButtonFace, {
|
|
54
|
+
...VIEW_TOOLBAR_CHIP_ICON_ACTION,
|
|
55
|
+
children: endIcon
|
|
56
|
+
})] });
|
|
57
|
+
/** The loading face of a filter chip. */
|
|
58
|
+
const ViewFilterChipFace = ({ children }) => /* @__PURE__ */ jsx(ViewToolbarChipFace, { children });
|
|
59
|
+
export { ViewChromeBar, ViewFilterButtonFace, ViewFilterChipFace, ViewToolbarChip, ViewToolbarChipFace, ViewToolbarChrome };
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { Button } from "./button.js";
|
|
2
2
|
import { ComponentProps } from "react";
|
|
3
|
+
import { Select } from "@base-ui/react/select";
|
|
3
4
|
import { ViewChromeBar, ViewToolbarChrome } from "./view-toolbar-shell.js";
|
|
4
5
|
type ViewFilterButtonProps = Omit<ComponentProps<typeof Button>, "children" | "size" | "variant" | "aria-label" | "title"> & {
|
|
5
6
|
label: string;
|
|
6
7
|
};
|
|
7
8
|
export declare const ViewFilterButton: ({ label, ...props }: ViewFilterButtonProps) => import("react").JSX.Element;
|
|
8
|
-
|
|
9
|
+
type ViewToolbarChipButtonProps = Omit<ComponentProps<typeof Button>, "size" | "variant">;
|
|
10
|
+
export declare const ViewToolbarChipButton: (props: ViewToolbarChipButtonProps) => import("react").JSX.Element;
|
|
11
|
+
export declare const ViewFilterChip: (props: ViewToolbarChipButtonProps) => import("react").JSX.Element;
|
|
12
|
+
export declare const ViewToolbarSelectTrigger: ({ children, ...props }: Omit<Select.Trigger.Props, "render">) => import("react").JSX.Element;
|
|
9
13
|
export { ViewChromeBar, ViewToolbarChrome };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { FilterIcon } from "../icons.js";
|
|
2
2
|
import { cn } from "../lib/utils.js";
|
|
3
3
|
import { Button } from "./button.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { ViewToolbarChipSelectIcon } from "./view-toolbar-chip-icon.js";
|
|
5
|
+
import { VIEW_FILTER_BUTTON, VIEW_FILTER_ICON_CLASS_NAME, VIEW_TOOLBAR_CHIP_ACTION } from "./view-toolbar-classes.js";
|
|
6
|
+
import { ViewChromeBar, ViewToolbarChip, ViewToolbarChrome } from "./view-toolbar-shell.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Select } from "@base-ui/react/select";
|
|
7
9
|
// src/components/view-toolbar.tsx
|
|
8
10
|
const ViewFilterButton = ({ label, ...props }) => /* @__PURE__ */ jsx(Button, {
|
|
9
11
|
...props,
|
|
@@ -13,10 +15,18 @@ const ViewFilterButton = ({ label, ...props }) => /* @__PURE__ */ jsx(Button, {
|
|
|
13
15
|
variant: VIEW_FILTER_BUTTON.variant,
|
|
14
16
|
children: /* @__PURE__ */ jsx(FilterIcon, { className: VIEW_FILTER_ICON_CLASS_NAME })
|
|
15
17
|
});
|
|
16
|
-
const
|
|
18
|
+
const renderChipButton = ({ className, ...props }) => /* @__PURE__ */ jsx(Button, {
|
|
17
19
|
...props,
|
|
18
|
-
className: cn(
|
|
19
|
-
size:
|
|
20
|
-
variant:
|
|
20
|
+
className: cn(VIEW_TOOLBAR_CHIP_ACTION.className, className),
|
|
21
|
+
size: VIEW_TOOLBAR_CHIP_ACTION.size,
|
|
22
|
+
variant: VIEW_TOOLBAR_CHIP_ACTION.variant
|
|
21
23
|
});
|
|
22
|
-
|
|
24
|
+
const ViewToolbarChipButton = (props) => renderChipButton(props);
|
|
25
|
+
const ViewFilterChip = (props) => /* @__PURE__ */ jsx(ViewToolbarChip, { children: renderChipButton(props) });
|
|
26
|
+
const ViewToolbarSelectTrigger = ({ children, ...props }) => /* @__PURE__ */ jsx(ViewToolbarChip, { children: /* @__PURE__ */ jsxs(Select.Trigger, {
|
|
27
|
+
...props,
|
|
28
|
+
"data-slot": "select-trigger",
|
|
29
|
+
render: /* @__PURE__ */ jsx(ViewToolbarChipButton, {}),
|
|
30
|
+
children: [children, /* @__PURE__ */ jsx(ViewToolbarChipSelectIcon, {})]
|
|
31
|
+
}) });
|
|
32
|
+
export { ViewChromeBar, ViewFilterButton, ViewFilterChip, ViewToolbarChipButton, ViewToolbarChrome, ViewToolbarSelectTrigger };
|
|
@@ -8,6 +8,8 @@ export declare const INLINE_OVERFLOW_TRIGGER_ATTRIBUTE = "data-inline-overflow-t
|
|
|
8
8
|
type UseInlineOverflowOptions = {
|
|
9
9
|
/** The active item's index; the policy keeps it on screen. */
|
|
10
10
|
activeIndex: number;
|
|
11
|
+
/** A control that keeps its width beside the visible items. */
|
|
12
|
+
reservedControl?: HTMLElement | null;
|
|
11
13
|
/**
|
|
12
14
|
* Each item's key, in display order; the measuring copy of an item carries
|
|
13
15
|
* its key in `INLINE_OVERFLOW_ITEM_ATTRIBUTE`.
|
|
@@ -40,7 +42,7 @@ type UseInlineOverflowOptions = {
|
|
|
40
42
|
* update, and until that count lands the row would hold every item, the last
|
|
41
43
|
* ones clipped, for a paint or any script that reads the layout to see.
|
|
42
44
|
*/
|
|
43
|
-
export declare const useInlineOverflow: ({ activeIndex, itemKeys }: UseInlineOverflowOptions) => {
|
|
45
|
+
export declare const useInlineOverflow: ({ activeIndex, itemKeys, reservedControl }: UseInlineOverflowOptions) => {
|
|
44
46
|
/** The measured row, once mounted. */
|
|
45
47
|
container: HTMLElement | null;
|
|
46
48
|
containerRef: import("react").Dispatch<import("react").SetStateAction<HTMLElement | null>>;
|
|
@@ -46,7 +46,7 @@ const itemGap = (items) => {
|
|
|
46
46
|
* update, and until that count lands the row would hold every item, the last
|
|
47
47
|
* ones clipped, for a paint or any script that reads the layout to see.
|
|
48
48
|
*/
|
|
49
|
-
const useInlineOverflow = ({ activeIndex, itemKeys }) => {
|
|
49
|
+
const useInlineOverflow = ({ activeIndex, itemKeys, reservedControl }) => {
|
|
50
50
|
const itemCount = itemKeys.length;
|
|
51
51
|
const order = itemKeys.join(KEY_SEPARATOR);
|
|
52
52
|
const [container, setContainer] = useState(null);
|
|
@@ -60,24 +60,30 @@ const useInlineOverflow = ({ activeIndex, itemKeys }) => {
|
|
|
60
60
|
box: copy.getBoundingClientRect()
|
|
61
61
|
}));
|
|
62
62
|
const boxByKey = new Map(copies.map(({ key, box }) => [key, box]));
|
|
63
|
-
const
|
|
63
|
+
const triggerBox = measure.querySelector(`[${INLINE_OVERFLOW_TRIGGER_ATTRIBUTE}]`)?.getBoundingClientRect();
|
|
64
|
+
const itemBoxes = copies.map(({ box }) => box);
|
|
65
|
+
if (triggerBox !== void 0) itemBoxes.push(triggerBox);
|
|
66
|
+
const gap = itemGap(itemBoxes);
|
|
67
|
+
const reservedWidth = reservedControl ? reservedControl.getBoundingClientRect().width + gap : 0;
|
|
64
68
|
emit(resolveInlineOverflow({
|
|
65
69
|
activeIndex,
|
|
66
|
-
availableWidth: row.getBoundingClientRect().width,
|
|
67
|
-
gap
|
|
70
|
+
availableWidth: row.getBoundingClientRect().width - reservedWidth,
|
|
71
|
+
gap,
|
|
68
72
|
itemWidths: keys.map((key) => boxByKey.get(key)?.width ?? 0),
|
|
69
|
-
triggerWidth:
|
|
73
|
+
triggerWidth: triggerBox?.width ?? 0
|
|
70
74
|
}).visibleCount);
|
|
71
75
|
};
|
|
72
76
|
recompute();
|
|
73
77
|
const observer = new ResizeObserver(recompute);
|
|
74
78
|
observer.observe(row);
|
|
75
79
|
observer.observe(measure);
|
|
80
|
+
if (reservedControl) observer.observe(reservedControl);
|
|
76
81
|
return () => observer.disconnect();
|
|
77
82
|
}, [
|
|
78
83
|
activeIndex,
|
|
79
84
|
measure,
|
|
80
|
-
order
|
|
85
|
+
order,
|
|
86
|
+
reservedControl
|
|
81
87
|
], null);
|
|
82
88
|
return {
|
|
83
89
|
/** The measured row, once mounted. */
|
|
@@ -76,6 +76,8 @@ export type KanbanSubgroupBoardProps<TRow> = {
|
|
|
76
76
|
matrix: KanbanBoardMatrix<TRow>;
|
|
77
77
|
renderColumnHeader: (context: KanbanSubgroupColumnHeaderContext) => ReactNode;
|
|
78
78
|
renderLaneIdentity: (context: KanbanSubgroupLaneIdentityContext) => ReactNode;
|
|
79
|
+
/** An interactive lane name, rendered beside the collapse button. */
|
|
80
|
+
renderLaneReference?: ((context: KanbanSubgroupLaneIdentityContext) => ReactNode) | undefined;
|
|
79
81
|
renderCell: (context: KanbanSubgroupCellContext<TRow>) => ReactNode;
|
|
80
82
|
/**
|
|
81
83
|
* What a lane's own row says about one column: its count by default. The
|
|
@@ -150,5 +152,5 @@ export type KanbanSubgroupBoardProps<TRow> = {
|
|
|
150
152
|
* in every state; the caption line never grows past its own height, so a
|
|
151
153
|
* folded band costs no vertical space.
|
|
152
154
|
*/
|
|
153
|
-
export declare const KanbanSubgroupBoard: <TRow>({ scrollRef, matrix, renderColumnHeader, renderLaneIdentity, renderCell, renderLaneColumnSummary, renderLaneColumnAction, renderBandHeader, renderCollapsedBandCell, formatBandToggleLabel, formatCount, isLaneCollapsed, onLaneCollapsedChange, isBandCollapsed, onBandCollapsedChange, footer, className, dragOverBandId, isDragging }: KanbanSubgroupBoardProps<TRow>) => import("react").JSX.Element;
|
|
155
|
+
export declare const KanbanSubgroupBoard: <TRow>({ scrollRef, matrix, renderColumnHeader, renderLaneIdentity, renderLaneReference, renderCell, renderLaneColumnSummary, renderLaneColumnAction, renderBandHeader, renderCollapsedBandCell, formatBandToggleLabel, formatCount, isLaneCollapsed, onLaneCollapsedChange, isBandCollapsed, onBandCollapsedChange, footer, className, dragOverBandId, isDragging }: KanbanSubgroupBoardProps<TRow>) => import("react").JSX.Element;
|
|
154
156
|
export {};
|
|
@@ -32,7 +32,7 @@ const rowsIn = (cells) => cells.reduce((sum, cell) => sum + cell.rows.length, 0)
|
|
|
32
32
|
* in every state; the caption line never grows past its own height, so a
|
|
33
33
|
* folded band costs no vertical space.
|
|
34
34
|
*/
|
|
35
|
-
const KanbanSubgroupBoard = ({ scrollRef, matrix, renderColumnHeader, renderLaneIdentity, renderCell, renderLaneColumnSummary, renderLaneColumnAction, renderBandHeader, renderCollapsedBandCell, formatBandToggleLabel, formatCount = String, isLaneCollapsed, onLaneCollapsedChange, isBandCollapsed, onBandCollapsedChange, footer, className, dragOverBandId, isDragging }) => {
|
|
35
|
+
const KanbanSubgroupBoard = ({ scrollRef, matrix, renderColumnHeader, renderLaneIdentity, renderLaneReference, renderCell, renderLaneColumnSummary, renderLaneColumnAction, renderBandHeader, renderCollapsedBandCell, formatBandToggleLabel, formatCount = String, isLaneCollapsed, onLaneCollapsedChange, isBandCollapsed, onBandCollapsedChange, footer, className, dragOverBandId, isDragging }) => {
|
|
36
36
|
const [collapsedLaneValues, setCollapsedLaneValues] = useState(() => /* @__PURE__ */ new Set());
|
|
37
37
|
const [expandedEmptyLaneValues, setExpandedEmptyLaneValues] = useState(() => /* @__PURE__ */ new Set());
|
|
38
38
|
const [collapsedBandIds, setCollapsedBandIds] = useState(() => /* @__PURE__ */ new Set());
|
|
@@ -329,6 +329,14 @@ const KanbanSubgroupBoard = ({ scrollRef, matrix, renderColumnHeader, renderLane
|
|
|
329
329
|
const { group } = lane;
|
|
330
330
|
const cells = cellsByLaneValue.get(group.value) ?? [];
|
|
331
331
|
const count = rowsIn(cells);
|
|
332
|
+
const laneReference = renderLaneReference?.({
|
|
333
|
+
group,
|
|
334
|
+
count
|
|
335
|
+
}) ?? null;
|
|
336
|
+
const tally = /* @__PURE__ */ jsx("span", {
|
|
337
|
+
className: "text-muted-foreground text-xs tabular-nums",
|
|
338
|
+
children: formatCount(count)
|
|
339
|
+
});
|
|
332
340
|
const defaultCollapsed = count === 0 ? !expandedEmptyLaneValues.has(group.value) : collapsedLaneValues.has(group.value);
|
|
333
341
|
const collapsed = isLaneCollapsed ? isLaneCollapsed(group, count) : defaultCollapsed;
|
|
334
342
|
const showSummaries = collapsed && count > 0;
|
|
@@ -340,30 +348,24 @@ const KanbanSubgroupBoard = ({ scrollRef, matrix, renderColumnHeader, renderLane
|
|
|
340
348
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
341
349
|
className: cn("bg-background sticky z-10", KANBAN_STICKY_TOP_CLASS),
|
|
342
350
|
"data-kanban-lane-row": "",
|
|
343
|
-
children: [/* @__PURE__ */
|
|
344
|
-
className: cn("bg-background sticky start-0 z-10 flex w-fit items-center", "h-9"),
|
|
351
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
352
|
+
className: cn("bg-background sticky start-0 z-10 flex w-fit items-center", laneReference !== null && "max-w-full gap-2 pe-2 text-sm font-medium", "h-9"),
|
|
345
353
|
"data-kanban-lane-identity": "",
|
|
346
|
-
children: /* @__PURE__ */ jsxs("button", {
|
|
354
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
347
355
|
"aria-expanded": !collapsed,
|
|
356
|
+
"aria-label": laneReference !== null ? group.label : void 0,
|
|
348
357
|
className: cn("hover:bg-muted/60 flex items-center gap-2 rounded-lg px-2 text-start text-sm font-medium", "h-9", KANBAN_CHROME_TOGGLE_COARSE_TARGET_CLASS),
|
|
349
358
|
onClick: () => setLaneCollapsed(group, count, !collapsed),
|
|
350
359
|
type: "button",
|
|
351
|
-
children: [
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
}),
|
|
361
|
-
/* @__PURE__ */ jsx("span", {
|
|
362
|
-
className: "text-muted-foreground text-xs tabular-nums",
|
|
363
|
-
children: formatCount(count)
|
|
364
|
-
})
|
|
365
|
-
]
|
|
366
|
-
})
|
|
360
|
+
children: [/* @__PURE__ */ jsx(DirectionalIcon, {
|
|
361
|
+
className: cn("text-muted-foreground size-4 shrink-0 transition-transform", collapsed && "-rotate-90"),
|
|
362
|
+
flip: collapsed,
|
|
363
|
+
icon: ChevronDownIcon
|
|
364
|
+
}), laneReference === null && /* @__PURE__ */ jsxs(Fragment, { children: [renderLaneIdentity({
|
|
365
|
+
group,
|
|
366
|
+
count
|
|
367
|
+
}), tally] })]
|
|
368
|
+
}), laneReference !== null && /* @__PURE__ */ jsxs(Fragment, { children: [laneReference, tally] })]
|
|
367
369
|
}), showColumnRow && renderRow({
|
|
368
370
|
renderColumn: (column) => laneColumnCell({
|
|
369
371
|
group,
|
package/dist/styles/theme.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.99.0",
|
|
4
4
|
"description": "Stella's design system: bidi-aware React primitives built on Base UI, the dockable inspector pane, and the Tailwind v4 theme they are styled with.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"base-ui",
|
|
@@ -1044,7 +1044,8 @@
|
|
|
1044
1044
|
"input-otp": "^1.5.0",
|
|
1045
1045
|
"lucide-react": "1.74.0",
|
|
1046
1046
|
"tailwind-merge": "^3.7.1",
|
|
1047
|
-
"temporal-polyfill": "1.0.8"
|
|
1047
|
+
"temporal-polyfill": "1.0.8",
|
|
1048
|
+
"unicode-segmenter": "0.14.4"
|
|
1048
1049
|
},
|
|
1049
1050
|
"devDependencies": {
|
|
1050
1051
|
"@atlaskit/pragmatic-drag-and-drop": "^4.0.0",
|