@fanvue/ui 3.53.0 → 3.54.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/cjs/components/AudioPlayer/AudioPlayer.cjs +4 -2
- package/dist/cjs/components/AudioPlayer/AudioPlayer.cjs.map +1 -1
- package/dist/cjs/components/Badge/Badge.cjs +7 -6
- package/dist/cjs/components/Badge/Badge.cjs.map +1 -1
- package/dist/cjs/components/Button/Button.cjs +2 -1
- package/dist/cjs/components/Button/Button.cjs.map +1 -1
- package/dist/cjs/components/Card/Card.cjs +1 -1
- package/dist/cjs/components/Card/Card.cjs.map +1 -1
- package/dist/cjs/components/ChatMessage/ChatMessage.cjs +3 -1
- package/dist/cjs/components/ChatMessage/ChatMessage.cjs.map +1 -1
- package/dist/cjs/components/Chip/Chip.cjs +10 -9
- package/dist/cjs/components/Chip/Chip.cjs.map +1 -1
- package/dist/cjs/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/cjs/components/DatePicker/DatePicker.cjs.map +1 -1
- package/dist/cjs/components/DatePicker/DateRangePanel.cjs +143 -0
- package/dist/cjs/components/DatePicker/DateRangePanel.cjs.map +1 -0
- package/dist/cjs/components/DatePicker/DateRangePicker.cjs +33 -0
- package/dist/cjs/components/DatePicker/DateRangePicker.cjs.map +1 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs +1 -1
- package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs.map +1 -1
- package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs +3 -3
- package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs.map +1 -1
- package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs +1 -1
- package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs.map +1 -1
- package/dist/cjs/components/FilterMenu/FilterMenu.cjs +45 -0
- package/dist/cjs/components/FilterMenu/FilterMenu.cjs.map +1 -0
- package/dist/cjs/components/IconButton/IconButton.cjs +2 -1
- package/dist/cjs/components/IconButton/IconButton.cjs.map +1 -1
- package/dist/cjs/components/Icons/ReorganiseIcon.cjs +65 -0
- package/dist/cjs/components/Icons/ReorganiseIcon.cjs.map +1 -0
- package/dist/cjs/components/Pagination/Pagination.cjs +3 -2
- package/dist/cjs/components/Pagination/Pagination.cjs.map +1 -1
- package/dist/cjs/components/Select/Select.cjs +20 -11
- package/dist/cjs/components/Select/Select.cjs.map +1 -1
- package/dist/cjs/components/Table/Table.cjs +59 -34
- package/dist/cjs/components/Table/Table.cjs.map +1 -1
- package/dist/cjs/components/Table/TableToolbarSearchFilters.cjs +152 -0
- package/dist/cjs/components/Table/TableToolbarSearchFilters.cjs.map +1 -0
- package/dist/cjs/components/Table/useFittingCount.cjs +51 -0
- package/dist/cjs/components/Table/useFittingCount.cjs.map +1 -0
- package/dist/cjs/date-picker.cjs +4 -0
- package/dist/cjs/date-picker.cjs.map +1 -1
- package/dist/cjs/index.cjs +4 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/components/AudioPlayer/AudioPlayer.mjs +4 -2
- package/dist/components/AudioPlayer/AudioPlayer.mjs.map +1 -1
- package/dist/components/Badge/Badge.mjs +7 -6
- package/dist/components/Badge/Badge.mjs.map +1 -1
- package/dist/components/Button/Button.mjs +2 -1
- package/dist/components/Button/Button.mjs.map +1 -1
- package/dist/components/Card/Card.mjs +1 -1
- package/dist/components/Card/Card.mjs.map +1 -1
- package/dist/components/ChatMessage/ChatMessage.mjs +3 -1
- package/dist/components/ChatMessage/ChatMessage.mjs.map +1 -1
- package/dist/components/Chip/Chip.mjs +10 -9
- package/dist/components/Chip/Chip.mjs.map +1 -1
- package/dist/components/DatePicker/DatePicker.mjs +1 -1
- package/dist/components/DatePicker/DatePicker.mjs.map +1 -1
- package/dist/components/DatePicker/DateRangePanel.mjs +126 -0
- package/dist/components/DatePicker/DateRangePanel.mjs.map +1 -0
- package/dist/components/DatePicker/DateRangePicker.mjs +33 -0
- package/dist/components/DatePicker/DateRangePicker.mjs.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenuItem.mjs +1 -1
- package/dist/components/DropdownMenu/DropdownMenuItem.mjs.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenuRoot.mjs +3 -3
- package/dist/components/DropdownMenu/DropdownMenuRoot.mjs.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs +1 -1
- package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs.map +1 -1
- package/dist/components/FilterMenu/FilterMenu.mjs +28 -0
- package/dist/components/FilterMenu/FilterMenu.mjs.map +1 -0
- package/dist/components/IconButton/IconButton.mjs +2 -1
- package/dist/components/IconButton/IconButton.mjs.map +1 -1
- package/dist/components/Icons/ReorganiseIcon.mjs +48 -0
- package/dist/components/Icons/ReorganiseIcon.mjs.map +1 -0
- package/dist/components/Pagination/Pagination.mjs +3 -2
- package/dist/components/Pagination/Pagination.mjs.map +1 -1
- package/dist/components/Select/Select.mjs +20 -11
- package/dist/components/Select/Select.mjs.map +1 -1
- package/dist/components/Table/Table.mjs +59 -34
- package/dist/components/Table/Table.mjs.map +1 -1
- package/dist/components/Table/TableToolbarSearchFilters.mjs +135 -0
- package/dist/components/Table/TableToolbarSearchFilters.mjs.map +1 -0
- package/dist/components/Table/useFittingCount.mjs +34 -0
- package/dist/components/Table/useFittingCount.mjs.map +1 -0
- package/dist/date-picker.d.ts +100 -0
- package/dist/date-picker.mjs +5 -1
- package/dist/date-picker.mjs.map +1 -1
- package/dist/index.d.ts +104 -9
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +1 -1
- package/dist/styles/base.css +43 -0
- package/dist/styles/theme.css +25 -25
- package/package.json +1 -1
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../../utils/cn.mjs";
|
|
5
|
+
import { Popover, PopoverTrigger, PopoverContent } from "../Popover/Popover.mjs";
|
|
6
|
+
import { Tag } from "../Tag/Tag.mjs";
|
|
7
|
+
import { useFittingCount } from "./useFittingCount.mjs";
|
|
8
|
+
function SearchFilter({
|
|
9
|
+
filter,
|
|
10
|
+
className
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ jsxs(
|
|
13
|
+
Tag,
|
|
14
|
+
{
|
|
15
|
+
className: cn("shrink-0", className),
|
|
16
|
+
onRemove: filter.onRemove,
|
|
17
|
+
removeLabel: filter.removeLabel,
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ jsx("span", { className: "text-content-secondary", children: filter.name }),
|
|
20
|
+
" ",
|
|
21
|
+
filter.value
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
function SearchFilters({
|
|
27
|
+
filters,
|
|
28
|
+
formatHiddenFilters,
|
|
29
|
+
children
|
|
30
|
+
}) {
|
|
31
|
+
if (!filters) return children;
|
|
32
|
+
return /* @__PURE__ */ jsx(SearchFiltersSlot, { filters, formatHiddenFilters, children });
|
|
33
|
+
}
|
|
34
|
+
function SearchFiltersSlot({ filters, formatHiddenFilters, children }) {
|
|
35
|
+
const wrapperRef = React.useRef(null);
|
|
36
|
+
const rulerRef = React.useRef(null);
|
|
37
|
+
const refocusInput = React.useRef(false);
|
|
38
|
+
const fittingCount = useFittingCount(rulerRef, filters.length);
|
|
39
|
+
const visibleCount = Math.min(fittingCount ?? filters.length, filters.length);
|
|
40
|
+
const hiddenCount = filters.length - visibleCount;
|
|
41
|
+
React.useEffect(() => {
|
|
42
|
+
if (hiddenCount === 0 && refocusInput.current) {
|
|
43
|
+
refocusInput.current = false;
|
|
44
|
+
wrapperRef.current?.querySelector("input")?.focus();
|
|
45
|
+
}
|
|
46
|
+
}, [hiddenCount]);
|
|
47
|
+
return /* @__PURE__ */ jsxs("div", { ref: wrapperRef, className: "relative flex min-w-0 flex-1 items-center gap-2", children: [
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
ref: rulerRef,
|
|
52
|
+
"aria-hidden": true,
|
|
53
|
+
inert: true,
|
|
54
|
+
className: "pointer-events-none invisible absolute top-0 right-26 left-0 hidden h-0 overflow-hidden md:block",
|
|
55
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex w-max items-center gap-2", children: [
|
|
56
|
+
filters.map((filter) => /* @__PURE__ */ jsx(SearchFilter, { filter }, filter.id)),
|
|
57
|
+
/* @__PURE__ */ jsx(Tag, { children: `+${Math.max(filters.length - 1, 1)}` })
|
|
58
|
+
] })
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
filters.length > 0 && /* @__PURE__ */ jsxs("div", { className: "hidden min-w-0 items-center gap-2 md:flex", children: [
|
|
62
|
+
filters.slice(0, visibleCount).map((filter) => /* @__PURE__ */ jsx(SearchFilter, { filter }, filter.id)),
|
|
63
|
+
hiddenCount > 0 && /* @__PURE__ */ jsx(
|
|
64
|
+
HiddenFilters,
|
|
65
|
+
{
|
|
66
|
+
filters: filters.slice(visibleCount),
|
|
67
|
+
label: formatHiddenFilters?.(hiddenCount),
|
|
68
|
+
refocusInput
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
] }),
|
|
72
|
+
children
|
|
73
|
+
] });
|
|
74
|
+
}
|
|
75
|
+
function HiddenFilters({
|
|
76
|
+
filters,
|
|
77
|
+
label,
|
|
78
|
+
refocusInput
|
|
79
|
+
}) {
|
|
80
|
+
return /* @__PURE__ */ jsxs(
|
|
81
|
+
Popover,
|
|
82
|
+
{
|
|
83
|
+
onOpenChange: (open) => {
|
|
84
|
+
if (!open) refocusInput.current = false;
|
|
85
|
+
},
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
88
|
+
"button",
|
|
89
|
+
{
|
|
90
|
+
type: "button",
|
|
91
|
+
"aria-label": label,
|
|
92
|
+
className: "relative isolate inline-flex shrink-0 cursor-pointer rounded-2xs border-none bg-transparent p-0 outline-hidden before:pointer-events-none before:absolute before:inset-0 before:-z-10 before:rounded-[inherit] before:bg-tag-hover-overlay before:opacity-0 hover:before:opacity-100 focus-visible:shadow-focus-ring",
|
|
93
|
+
children: /* @__PURE__ */ jsx(Tag, { "aria-hidden": label ? true : void 0, children: `+${filters.length}` })
|
|
94
|
+
}
|
|
95
|
+
) }),
|
|
96
|
+
/* @__PURE__ */ jsx(
|
|
97
|
+
PopoverContent,
|
|
98
|
+
{
|
|
99
|
+
"aria-label": label ?? `+${filters.length}`,
|
|
100
|
+
className: "flex flex-col items-start gap-2",
|
|
101
|
+
children: filters.map((filter) => /* @__PURE__ */ jsx(
|
|
102
|
+
SearchFilter,
|
|
103
|
+
{
|
|
104
|
+
filter: {
|
|
105
|
+
...filter,
|
|
106
|
+
onRemove: () => {
|
|
107
|
+
refocusInput.current = true;
|
|
108
|
+
filter.onRemove();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
filter.id
|
|
113
|
+
))
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
function ClearSearchFilters({ label, onClick }) {
|
|
121
|
+
return /* @__PURE__ */ jsx(
|
|
122
|
+
"button",
|
|
123
|
+
{
|
|
124
|
+
type: "button",
|
|
125
|
+
onClick,
|
|
126
|
+
className: "typography-description-12px-regular hidden h-6 shrink-0 cursor-pointer items-center whitespace-nowrap rounded-xs border-none bg-transparent p-0 text-content-secondary outline-none hover:text-content-primary focus-visible:shadow-focus-ring md:inline-flex",
|
|
127
|
+
children: label
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
export {
|
|
132
|
+
ClearSearchFilters,
|
|
133
|
+
SearchFilters
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=TableToolbarSearchFilters.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableToolbarSearchFilters.mjs","sources":["../../../src/components/Table/TableToolbarSearchFilters.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../Popover/Popover\";\nimport { Tag } from \"../Tag/Tag\";\nimport { useFittingCount } from \"./useFittingCount\";\n\n/** An applied filter shown inside a `TableToolbarSearch`, e.g. \"Platform is Instagram\". */\nexport interface TableToolbarSearchFilter {\n /** Stable key for the filter. */\n id: string;\n /** Secondary text, e.g. \"Platform is\". */\n name: string;\n /** Primary text, e.g. \"Instagram, YouTube\". */\n value: string;\n /** Called when the filter's × button is pressed. */\n onRemove: () => void;\n /** Accessible name of the × button, as one translated string such as \"Remove Platform filter\". */\n removeLabel: string;\n}\n\nfunction SearchFilter({\n filter,\n className,\n}: {\n filter: TableToolbarSearchFilter;\n className?: string;\n}) {\n return (\n <Tag\n className={cn(\"shrink-0\", className)}\n onRemove={filter.onRemove}\n removeLabel={filter.removeLabel}\n >\n <span className=\"text-content-secondary\">{filter.name}</span> {filter.value}\n </Tag>\n );\n}\n\n/**\n * Wraps the search input of a `TableToolbarSearch` and puts the applied filters before it. Without\n * `filters` it renders the input alone.\n */\nexport function SearchFilters({\n filters,\n formatHiddenFilters,\n children,\n}: {\n filters?: readonly TableToolbarSearchFilter[];\n formatHiddenFilters?: (count: number) => string;\n children: React.ReactNode;\n}) {\n if (!filters) return children;\n return (\n <SearchFiltersSlot filters={filters} formatHiddenFilters={formatHiddenFilters}>\n {children}\n </SearchFiltersSlot>\n );\n}\n\ninterface SearchFiltersSlotProps {\n filters: readonly TableToolbarSearchFilter[];\n formatHiddenFilters?: (count: number) => string;\n children: React.ReactNode;\n}\n\n/**\n * The input keeps at least 96px. A filter is shown whole or counted in the \"+N\" tag, never cut, so\n * when none fits only \"+N\" shows. \"+N\" opens a popover listing the hidden filters. The ruler's `right-26` is the input's `min-w-24`, set in\n * `TableToolbarSearch`, plus the wrapper's `gap-2`: change them together.\n */\nfunction SearchFiltersSlot({ filters, formatHiddenFilters, children }: SearchFiltersSlotProps) {\n const wrapperRef = React.useRef<HTMLDivElement>(null);\n const rulerRef = React.useRef<HTMLDivElement>(null);\n const refocusInput = React.useRef(false);\n const fittingCount = useFittingCount(rulerRef, filters.length);\n const visibleCount = Math.min(fittingCount ?? filters.length, filters.length);\n const hiddenCount = filters.length - visibleCount;\n\n React.useEffect(() => {\n if (hiddenCount === 0 && refocusInput.current) {\n refocusInput.current = false;\n wrapperRef.current?.querySelector(\"input\")?.focus();\n }\n }, [hiddenCount]);\n\n return (\n <div ref={wrapperRef} className=\"relative flex min-w-0 flex-1 items-center gap-2\">\n <div\n ref={rulerRef}\n aria-hidden\n inert\n className=\"pointer-events-none invisible absolute top-0 right-26 left-0 hidden h-0 overflow-hidden md:block\"\n >\n <div className=\"flex w-max items-center gap-2\">\n {filters.map((filter) => (\n <SearchFilter key={filter.id} filter={filter} />\n ))}\n <Tag>{`+${Math.max(filters.length - 1, 1)}`}</Tag>\n </div>\n </div>\n {filters.length > 0 && (\n <div className=\"hidden min-w-0 items-center gap-2 md:flex\">\n {filters.slice(0, visibleCount).map((filter) => (\n <SearchFilter key={filter.id} filter={filter} />\n ))}\n {hiddenCount > 0 && (\n <HiddenFilters\n filters={filters.slice(visibleCount)}\n label={formatHiddenFilters?.(hiddenCount)}\n refocusInput={refocusInput}\n />\n )}\n </div>\n )}\n {children}\n </div>\n );\n}\n\nfunction HiddenFilters({\n filters,\n label,\n refocusInput,\n}: {\n filters: readonly TableToolbarSearchFilter[];\n label?: string;\n refocusInput: React.MutableRefObject<boolean>;\n}) {\n return (\n <Popover\n onOpenChange={(open) => {\n if (!open) refocusInput.current = false;\n }}\n >\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n aria-label={label}\n className=\"relative isolate inline-flex shrink-0 cursor-pointer rounded-2xs border-none bg-transparent p-0 outline-hidden before:pointer-events-none before:absolute before:inset-0 before:-z-10 before:rounded-[inherit] before:bg-tag-hover-overlay before:opacity-0 hover:before:opacity-100 focus-visible:shadow-focus-ring\"\n >\n <Tag aria-hidden={label ? true : undefined}>{`+${filters.length}`}</Tag>\n </button>\n </PopoverTrigger>\n <PopoverContent\n aria-label={label ?? `+${filters.length}`}\n className=\"flex flex-col items-start gap-2\"\n >\n {filters.map((filter) => (\n <SearchFilter\n key={filter.id}\n filter={{\n ...filter,\n onRemove: () => {\n refocusInput.current = true;\n filter.onRemove();\n },\n }}\n />\n ))}\n </PopoverContent>\n </Popover>\n );\n}\n\n/** The \"Clear all\" text action after the search input, hidden below `md` like the filters. */\nexport function ClearSearchFilters({ label, onClick }: { label: string; onClick: () => void }) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className=\"typography-description-12px-regular hidden h-6 shrink-0 cursor-pointer items-center whitespace-nowrap rounded-xs border-none bg-transparent p-0 text-content-secondary outline-none hover:text-content-primary focus-visible:shadow-focus-ring md:inline-flex\"\n >\n {label}\n </button>\n );\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
function countFitting(available, items, indicator) {
|
|
4
|
+
const last = items.at(-1);
|
|
5
|
+
if (available.width <= 0 || !last || !indicator) return null;
|
|
6
|
+
if (last.right - available.left <= available.width) return items.length;
|
|
7
|
+
const reserved = indicator.left - last.right + indicator.width;
|
|
8
|
+
return items.findIndex((item) => item.right - available.left + reserved > available.width);
|
|
9
|
+
}
|
|
10
|
+
function useFittingCount(rulerRef, itemCount) {
|
|
11
|
+
const [count, setCount] = React.useState(null);
|
|
12
|
+
const evaluate = React.useCallback(() => {
|
|
13
|
+
const ruler = rulerRef.current;
|
|
14
|
+
const replica = ruler?.firstElementChild;
|
|
15
|
+
if (!ruler || !replica) return;
|
|
16
|
+
const rects = Array.from(replica.children, (child) => child.getBoundingClientRect());
|
|
17
|
+
setCount(countFitting(ruler.getBoundingClientRect(), rects.slice(0, itemCount), rects.at(-1)));
|
|
18
|
+
}, [rulerRef, itemCount]);
|
|
19
|
+
React.useLayoutEffect(evaluate);
|
|
20
|
+
React.useEffect(() => {
|
|
21
|
+
const ruler = rulerRef.current;
|
|
22
|
+
const replica = ruler?.firstElementChild;
|
|
23
|
+
if (!ruler || !replica) return;
|
|
24
|
+
const observer = new ResizeObserver(evaluate);
|
|
25
|
+
observer.observe(ruler);
|
|
26
|
+
observer.observe(replica);
|
|
27
|
+
return () => observer.disconnect();
|
|
28
|
+
}, [rulerRef, evaluate]);
|
|
29
|
+
return count;
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
useFittingCount
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=useFittingCount.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFittingCount.mjs","sources":["../../../src/components/Table/useFittingCount.ts"],"sourcesContent":["import * as React from \"react\";\n\nfunction countFitting(available: DOMRect, items: DOMRect[], indicator?: DOMRect): number | null {\n const last = items.at(-1);\n if (available.width <= 0 || !last || !indicator) return null;\n if (last.right - available.left <= available.width) return items.length;\n const reserved = indicator.left - last.right + indicator.width;\n return items.findIndex((item) => item.right - available.left + reserved > available.width);\n}\n\n/**\n * Returns how many leading items fit in a row, or `null` while the row cannot be measured (SSR,\n * jsdom, `display: none`), in which case the caller shows them all.\n *\n * `rulerRef` is an invisible element as wide as the space the items may take. Its only child is a\n * replica row holding every item at its natural width, followed by the widest overflow indicator\n * (\"+N\"). Because the replica always holds every item, the count it yields never changes the\n * widths that decided it, so showing or hiding the indicator cannot cause another update. The\n * indicator's width is reserved unless every item fits. The count is 0 when not even the first\n * item fits beside the indicator.\n */\nexport function useFittingCount(\n rulerRef: React.RefObject<HTMLElement | null>,\n itemCount: number,\n): number | null {\n const [count, setCount] = React.useState<number | null>(null);\n\n const evaluate = React.useCallback(() => {\n const ruler = rulerRef.current;\n const replica = ruler?.firstElementChild;\n if (!ruler || !replica) return;\n const rects = Array.from(replica.children, (child) => child.getBoundingClientRect());\n setCount(countFitting(ruler.getBoundingClientRect(), rects.slice(0, itemCount), rects.at(-1)));\n }, [rulerRef, itemCount]);\n\n React.useLayoutEffect(evaluate);\n\n React.useEffect(() => {\n const ruler = rulerRef.current;\n const replica = ruler?.firstElementChild;\n if (!ruler || !replica) return;\n const observer = new ResizeObserver(evaluate);\n observer.observe(ruler);\n observer.observe(replica);\n return () => observer.disconnect();\n }, [rulerRef, evaluate]);\n\n return count;\n}\n"],"names":[],"mappings":";;AAEA,SAAS,aAAa,WAAoB,OAAkB,WAAoC;AAC9F,QAAM,OAAO,MAAM,GAAG,EAAE;AACxB,MAAI,UAAU,SAAS,KAAK,CAAC,QAAQ,CAAC,UAAW,QAAO;AACxD,MAAI,KAAK,QAAQ,UAAU,QAAQ,UAAU,cAAc,MAAM;AACjE,QAAM,WAAW,UAAU,OAAO,KAAK,QAAQ,UAAU;AACzD,SAAO,MAAM,UAAU,CAAC,SAAS,KAAK,QAAQ,UAAU,OAAO,WAAW,UAAU,KAAK;AAC3F;AAaO,SAAS,gBACd,UACA,WACe;AACf,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAwB,IAAI;AAE5D,QAAM,WAAW,MAAM,YAAY,MAAM;AACvC,UAAM,QAAQ,SAAS;AACvB,UAAM,UAAU,OAAO;AACvB,QAAI,CAAC,SAAS,CAAC,QAAS;AACxB,UAAM,QAAQ,MAAM,KAAK,QAAQ,UAAU,CAAC,UAAU,MAAM,uBAAuB;AACnF,aAAS,aAAa,MAAM,sBAAA,GAAyB,MAAM,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,EAAE,CAAC,CAAC;AAAA,EAC/F,GAAG,CAAC,UAAU,SAAS,CAAC;AAExB,QAAM,gBAAgB,QAAQ;AAE9B,QAAM,UAAU,MAAM;AACpB,UAAM,QAAQ,SAAS;AACvB,UAAM,UAAU,OAAO;AACvB,QAAI,CAAC,SAAS,CAAC,QAAS;AACxB,UAAM,WAAW,IAAI,eAAe,QAAQ;AAC5C,aAAS,QAAQ,KAAK;AACtB,aAAS,QAAQ,OAAO;AACxB,WAAO,MAAM,SAAS,WAAA;AAAA,EACxB,GAAG,CAAC,UAAU,QAAQ,CAAC;AAEvB,SAAO;AACT;"}
|
package/dist/date-picker.d.ts
CHANGED
|
@@ -59,6 +59,106 @@ export declare type DatePickerVariant = "single" | "double";
|
|
|
59
59
|
|
|
60
60
|
export { DateRange }
|
|
61
61
|
|
|
62
|
+
/** Calendar options forwarded to the custom range calendar. */
|
|
63
|
+
declare type DateRangeCalendarProps = Pick<DayPickerProps, "disabled" | "startMonth" | "endMonth" | "weekStartsOn" | "locale">;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* A list of date range presets, with a "Custom range" row that swaps to a one-month calendar when
|
|
67
|
+
* `customRangeLabel` is given. A pointer click, Space or Enter on a row picks it. A preset applies
|
|
68
|
+
* at once, and a custom range applies on Apply, with Cancel returning to the list. It always opens
|
|
69
|
+
* on the list, even when a custom range is applied, so a preset stays reachable. The arrow keys
|
|
70
|
+
* only move focus between rows and never pick one, so a keyboard user can reach a row without
|
|
71
|
+
* applying it. It renders no popover, so it can sit inside a popover or a phone sheet. The caller
|
|
72
|
+
* maps preset ids to dates.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* <DateRangePanel
|
|
77
|
+
* aria-label="Date range"
|
|
78
|
+
* presets={[{ id: "7d", label: "Last 7 days" }]}
|
|
79
|
+
* customRangeLabel="Custom range"
|
|
80
|
+
* value={value}
|
|
81
|
+
* onValueChange={setValue}
|
|
82
|
+
* />
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export declare const DateRangePanel: ForwardRefExoticComponent<DateRangePanelProps & RefAttributes<HTMLDivElement>>;
|
|
86
|
+
|
|
87
|
+
/** Props for {@link DateRangePanel}. */
|
|
88
|
+
export declare interface DateRangePanelProps {
|
|
89
|
+
/** Preset rows, in display order. */
|
|
90
|
+
presets: readonly DateRangePreset[];
|
|
91
|
+
/** Label of the last row, which opens the calendar. Omit to offer presets only. Translated by the caller. */
|
|
92
|
+
customRangeLabel?: string;
|
|
93
|
+
/** The applied selection. A custom value checks the Custom range row. Picking that row opens the calendar on the applied range. */
|
|
94
|
+
value: DateRangeValue;
|
|
95
|
+
/**
|
|
96
|
+
* Called with `{ type: "preset", presetId }` as soon as a preset row is picked by click, Space or
|
|
97
|
+
* Enter, including the current one, and with `{ type: "custom", range }` when Apply is clicked.
|
|
98
|
+
* Arrow keys move focus without calling it.
|
|
99
|
+
*/
|
|
100
|
+
onValueChange: (value: DateRangeValue) => void;
|
|
101
|
+
/** Label of the Apply button. @default "Apply" */
|
|
102
|
+
applyLabel?: string;
|
|
103
|
+
/** Label of the Cancel button. @default "Cancel" */
|
|
104
|
+
cancelLabel?: string;
|
|
105
|
+
/** Called after Cancel drops the draft range and the panel returns to the preset list. */
|
|
106
|
+
onCancel?: () => void;
|
|
107
|
+
/** Bounds, locale and first weekday for the calendar. */
|
|
108
|
+
calendarProps?: DateRangeCalendarProps;
|
|
109
|
+
/** Accessible name of the preset list. Translated by the caller. */
|
|
110
|
+
"aria-label": string;
|
|
111
|
+
/** Additional CSS class name for the root element. */
|
|
112
|
+
className?: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* A {@link DateRangePanel} in a popover under a caller-supplied trigger. The popover closes after
|
|
117
|
+
* a preset pick, Apply and Cancel. Closing it any other way drops an unapplied range.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```tsx
|
|
121
|
+
* <DateRangePicker
|
|
122
|
+
* aria-label="Date range"
|
|
123
|
+
* presets={presets}
|
|
124
|
+
* customRangeLabel="Custom range"
|
|
125
|
+
* value={value}
|
|
126
|
+
* onValueChange={setValue}
|
|
127
|
+
* >
|
|
128
|
+
* <TableToolbarAction icon={<ChevronDownIcon />}>Date</TableToolbarAction>
|
|
129
|
+
* </DateRangePicker>
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
export declare const DateRangePicker: ForwardRefExoticComponent<DateRangePickerProps & RefAttributes<HTMLDivElement>>;
|
|
133
|
+
|
|
134
|
+
/** Props for {@link DateRangePicker}. */
|
|
135
|
+
export declare interface DateRangePickerProps extends Omit<DateRangePanelProps, "className"> {
|
|
136
|
+
/** The trigger element, rendered as the popover trigger. It shows no value, so the caller owns its label. */
|
|
137
|
+
children: React.ReactElement;
|
|
138
|
+
/** Accessible name of the popover dialog and of the preset list inside it. Translated by the caller. */
|
|
139
|
+
"aria-label": string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** A named preset the caller maps to a date range. The kit does no date maths. */
|
|
143
|
+
export declare interface DateRangePreset {
|
|
144
|
+
/** Stable identifier emitted in `{ type: "preset", presetId }`. */
|
|
145
|
+
id: string;
|
|
146
|
+
/** Visible, already translated label. */
|
|
147
|
+
label: string;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** The applied selection: one of the caller's presets, or an explicit custom range. */
|
|
151
|
+
export declare type DateRangeValue = {
|
|
152
|
+
type: "preset";
|
|
153
|
+
presetId: string;
|
|
154
|
+
} | {
|
|
155
|
+
type: "custom";
|
|
156
|
+
range: {
|
|
157
|
+
from: Date;
|
|
158
|
+
to: Date;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
|
|
62
162
|
/**
|
|
63
163
|
* Like `Omit`, but preserves discriminated unions.
|
|
64
164
|
*
|
package/dist/date-picker.mjs
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { DatePicker } from "./components/DatePicker/DatePicker.mjs";
|
|
3
|
+
import { DateRangePanel } from "./components/DatePicker/DateRangePanel.mjs";
|
|
4
|
+
import { DateRangePicker } from "./components/DatePicker/DateRangePicker.mjs";
|
|
3
5
|
export {
|
|
4
|
-
DatePicker
|
|
6
|
+
DatePicker,
|
|
7
|
+
DateRangePanel,
|
|
8
|
+
DateRangePicker
|
|
5
9
|
};
|
|
6
10
|
//# sourceMappingURL=date-picker.mjs.map
|
package/dist/date-picker.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"date-picker.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2050,8 +2050,8 @@ export declare interface ChipProps extends React_2.HTMLAttributes<HTMLElement> {
|
|
|
2050
2050
|
*/
|
|
2051
2051
|
dotted?: boolean;
|
|
2052
2052
|
/**
|
|
2053
|
-
* Draws the unselected state as a 1px `
|
|
2054
|
-
* transparent background instead of
|
|
2053
|
+
* Draws the unselected state as a 1px `neutral-alphas-100` outline over a
|
|
2054
|
+
* transparent background instead of the solid chip fill. This is the
|
|
2055
2055
|
* Figma `V2 Insights Chips` treatment, used where chips sit over a chart and a
|
|
2056
2056
|
* row of solid fills would compete with the plotted series. The selected state
|
|
2057
2057
|
* is unaffected — it stays filled — as are the `dark` and `dotted` variants.
|
|
@@ -3716,6 +3716,48 @@ export declare interface FanFollowerCountProps extends React_2.HTMLAttributes<HT
|
|
|
3716
3716
|
subsLabel?: string;
|
|
3717
3717
|
}
|
|
3718
3718
|
|
|
3719
|
+
/**
|
|
3720
|
+
* A menu of options under a trigger you supply, where several can be ticked. Each tick calls
|
|
3721
|
+
* `onValueChange` at once and the menu stays open, so several can be ticked in one go. It holds no
|
|
3722
|
+
* state: pass `value` back in. The ref goes to the menu content.
|
|
3723
|
+
*
|
|
3724
|
+
* Keyboard support comes from the menu: arrow keys move, Space or Enter ticks, typing jumps to a
|
|
3725
|
+
* label, Escape closes.
|
|
3726
|
+
*
|
|
3727
|
+
* @example
|
|
3728
|
+
* ```tsx
|
|
3729
|
+
* <FilterMenu options={platforms} value={selected} onValueChange={setSelected}>
|
|
3730
|
+
* <TableToolbarAction icon={<ChevronDownIcon size={16} />} active={selected.length > 0}>
|
|
3731
|
+
* Platform
|
|
3732
|
+
* </TableToolbarAction>
|
|
3733
|
+
* </FilterMenu>
|
|
3734
|
+
* ```
|
|
3735
|
+
*/
|
|
3736
|
+
export declare const FilterMenu: (<V extends string>(props: FilterMenuProps<V> & React_2.RefAttributes<HTMLDivElement>) => React_2.ReactElement | null) & {
|
|
3737
|
+
displayName?: string;
|
|
3738
|
+
};
|
|
3739
|
+
|
|
3740
|
+
/** One choice in a {@link FilterMenu}. */
|
|
3741
|
+
export declare interface FilterMenuOption<V extends string = string> {
|
|
3742
|
+
/** Value reported through `onValueChange`. */
|
|
3743
|
+
value: V;
|
|
3744
|
+
/** Visible label. */
|
|
3745
|
+
label: string;
|
|
3746
|
+
}
|
|
3747
|
+
|
|
3748
|
+
export declare interface FilterMenuProps<V extends string = string> {
|
|
3749
|
+
/** The trigger element, e.g. a `TableToolbarAction`. It must forward its ref and spread props. */
|
|
3750
|
+
children: React_2.ReactElement;
|
|
3751
|
+
/** The choices, in display order. */
|
|
3752
|
+
options: readonly FilterMenuOption<V>[];
|
|
3753
|
+
/** The ticked values. */
|
|
3754
|
+
value: readonly V[];
|
|
3755
|
+
/** Called with the new ticked values each time an option is ticked or unticked. */
|
|
3756
|
+
onValueChange: (value: V[]) => void;
|
|
3757
|
+
/** Props for the menu content, such as `align` or `aria-label`. @default { align: "start" } */
|
|
3758
|
+
contentProps?: Omit<DropdownMenuContentProps, "children">;
|
|
3759
|
+
}
|
|
3760
|
+
|
|
3719
3761
|
/**
|
|
3720
3762
|
* Flag icon. Renders at sizes 16, 24, or 32 px with outlined and filled variants.
|
|
3721
3763
|
*
|
|
@@ -5520,6 +5562,19 @@ export declare const RefreshArrowIcon: React_2.ForwardRefExoticComponent<BaseIco
|
|
|
5520
5562
|
/** Props for {@link RefreshArrowIcon}. See {@link BaseIconProps} for the shared shape. */
|
|
5521
5563
|
export declare type RefreshArrowIconProps = BaseIconProps;
|
|
5522
5564
|
|
|
5565
|
+
/**
|
|
5566
|
+
* Reorganise icon. Renders at sizes 16, 24, or 32 px with outlined and filled variants.
|
|
5567
|
+
*
|
|
5568
|
+
* @example
|
|
5569
|
+
* ```tsx
|
|
5570
|
+
* <ReorganiseIcon size={24} filled />
|
|
5571
|
+
* ```
|
|
5572
|
+
*/
|
|
5573
|
+
export declare const ReorganiseIcon: React_2.ForwardRefExoticComponent<BaseIconProps & React_2.RefAttributes<SVGSVGElement>>;
|
|
5574
|
+
|
|
5575
|
+
/** Props for {@link ReorganiseIcon}. See {@link BaseIconProps} for the shared shape. */
|
|
5576
|
+
export declare type ReorganiseIconProps = BaseIconProps;
|
|
5577
|
+
|
|
5523
5578
|
/**
|
|
5524
5579
|
* Repeat icon. Renders at sizes 16, 24, or 32 px.
|
|
5525
5580
|
*
|
|
@@ -5887,8 +5942,9 @@ export declare type SelectGroupProps = React_2.ComponentPropsWithoutRef<typeof S
|
|
|
5887
5942
|
* and the standard hover / selected / disabled states. The selected row rests on
|
|
5888
5943
|
* `Buttons/Navigation/Hover` with a semibold label and a trailing check; hovering
|
|
5889
5944
|
* it shows `Interaction/Hover` like any other row. Under the v2 palette the fill is
|
|
5890
|
-
* inverted, with inverted content, and a highlighted
|
|
5891
|
-
*
|
|
5945
|
+
* inverted, with inverted content, and a highlighted selected row moves to `Menu Item
|
|
5946
|
+
* Selected Hover`. Under the v2 palette the list opens with the selected row on its own
|
|
5947
|
+
* fill: the hover fill waits until the person moves the pointer or presses a key. Rows do not shrink, so a
|
|
5892
5948
|
* two-line row stays whole when the list scrolls.
|
|
5893
5949
|
*
|
|
5894
5950
|
* @example
|
|
@@ -7029,17 +7085,19 @@ export declare const TableToolbar: React_2.ForwardRefExoticComponent<TableToolba
|
|
|
7029
7085
|
|
|
7030
7086
|
/**
|
|
7031
7087
|
* Labelled control for {@link TableToolbar}: 12px label followed by a 16px
|
|
7032
|
-
* icon
|
|
7033
|
-
*
|
|
7034
|
-
*
|
|
7035
|
-
*
|
|
7088
|
+
* icon, with 8px of padding either side. It rests on secondary text, fills with
|
|
7089
|
+
* `Interaction/Hover` on hover and while `active`, and with `Neutral Alphas/100`
|
|
7090
|
+
* while the menu or popover it triggers is open (`data-state="open"`). Below
|
|
7091
|
+
* the `md` breakpoint only the icon shows, and the label stays as the
|
|
7092
|
+
* accessible name, so a full bar still fits a phone. Works as a plain button or
|
|
7093
|
+
* as a `DropdownMenuTrigger` or `PopoverTrigger` child.
|
|
7036
7094
|
*/
|
|
7037
7095
|
export declare const TableToolbarAction: React_2.ForwardRefExoticComponent<TableToolbarActionProps & React_2.RefAttributes<HTMLButtonElement>>;
|
|
7038
7096
|
|
|
7039
7097
|
export declare interface TableToolbarActionProps extends React_2.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
7040
7098
|
/** 16px icon after the label. @default up/down arrows, for a menu trigger showing its current value */
|
|
7041
7099
|
icon?: React_2.ReactNode;
|
|
7042
|
-
/**
|
|
7100
|
+
/** Marks a toggle or filter as on: primary text on the `Interaction/Hover` fill. @default false */
|
|
7043
7101
|
active?: boolean;
|
|
7044
7102
|
}
|
|
7045
7103
|
|
|
@@ -7061,9 +7119,29 @@ export declare interface TableToolbarProps extends React_2.HTMLAttributes<HTMLDi
|
|
|
7061
7119
|
/**
|
|
7062
7120
|
* Borderless search field for the left slot of {@link TableToolbar}:
|
|
7063
7121
|
* 16px search icon, 12px text and a clear button once there is a query.
|
|
7122
|
+
*
|
|
7123
|
+
* Pass `filters` to show the applied filters before the input from the `md`
|
|
7124
|
+
* breakpoint up, each with a × button, and `onClearFilters` for a "Clear all"
|
|
7125
|
+
* action after it. The ones that do not fit collapse into a "+N" tag, so the
|
|
7126
|
+
* toolbar never grows. Keep `filters` defined (an empty array when none apply)
|
|
7127
|
+
* so the input is not remounted as filters come and go.
|
|
7064
7128
|
*/
|
|
7065
7129
|
export declare const TableToolbarSearch: React_2.ForwardRefExoticComponent<TableToolbarSearchProps & React_2.RefAttributes<HTMLInputElement>>;
|
|
7066
7130
|
|
|
7131
|
+
/** An applied filter shown inside a `TableToolbarSearch`, e.g. "Platform is Instagram". */
|
|
7132
|
+
export declare interface TableToolbarSearchFilter {
|
|
7133
|
+
/** Stable key for the filter. */
|
|
7134
|
+
id: string;
|
|
7135
|
+
/** Secondary text, e.g. "Platform is". */
|
|
7136
|
+
name: string;
|
|
7137
|
+
/** Primary text, e.g. "Instagram, YouTube". */
|
|
7138
|
+
value: string;
|
|
7139
|
+
/** Called when the filter's × button is pressed. */
|
|
7140
|
+
onRemove: () => void;
|
|
7141
|
+
/** Accessible name of the × button, as one translated string such as "Remove Platform filter". */
|
|
7142
|
+
removeLabel: string;
|
|
7143
|
+
}
|
|
7144
|
+
|
|
7067
7145
|
export declare interface TableToolbarSearchProps extends Omit<React_2.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "type"> {
|
|
7068
7146
|
/** Current query. */
|
|
7069
7147
|
value: string;
|
|
@@ -7071,6 +7149,23 @@ export declare interface TableToolbarSearchProps extends Omit<React_2.InputHTMLA
|
|
|
7071
7149
|
onValueChange: (value: string) => void;
|
|
7072
7150
|
/** Accessible name of the clear button. */
|
|
7073
7151
|
clearLabel: string;
|
|
7152
|
+
/**
|
|
7153
|
+
* Applied filters, shown between the search icon and the input from the `md` breakpoint up. Array
|
|
7154
|
+
* order is the priority: the leading filters that fit are shown and the rest collapse into a "+N"
|
|
7155
|
+
* tag. Keep it defined (an empty array when none apply) so the input is not remounted as filters
|
|
7156
|
+
* come and go.
|
|
7157
|
+
*/
|
|
7158
|
+
filters?: readonly TableToolbarSearchFilter[];
|
|
7159
|
+
/**
|
|
7160
|
+
* Accessible text of the "+N" tag, e.g. `(count) => \`${count} more filters\``. Pass it whenever
|
|
7161
|
+
* `filters` is passed, so the hidden count is announced in words. Without it the tag is read as
|
|
7162
|
+
* its visible text.
|
|
7163
|
+
*/
|
|
7164
|
+
formatHiddenFilters?: (count: number) => string;
|
|
7165
|
+
/** Label of the "Clear all" action. It shows only with `onClearFilters` and an applied filter. */
|
|
7166
|
+
clearFiltersLabel?: string;
|
|
7167
|
+
/** Called when "Clear all" is pressed. It shows only with `clearFiltersLabel` and an applied filter. */
|
|
7168
|
+
onClearFilters?: () => void;
|
|
7074
7169
|
}
|
|
7075
7170
|
|
|
7076
7171
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -41,6 +41,7 @@ import { Divider } from "./components/Divider/Divider.mjs";
|
|
|
41
41
|
import { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerTitle, DrawerTrigger } from "./components/Drawer/Drawer.mjs";
|
|
42
42
|
import { EmptyState } from "./components/EmptyState/EmptyState.mjs";
|
|
43
43
|
import { FanFollowerCount } from "./components/FanFollowerCount/FanFollowerCount.mjs";
|
|
44
|
+
import { FilterMenu } from "./components/FilterMenu/FilterMenu.mjs";
|
|
44
45
|
import { FloatingActionButton } from "./components/FloatingActionButton/FloatingActionButton.mjs";
|
|
45
46
|
import { IconButton } from "./components/IconButton/IconButton.mjs";
|
|
46
47
|
import { AddCircleIcon } from "./components/Icons/AddCircleIcon.mjs";
|
|
@@ -170,6 +171,7 @@ import { ProgrammingArrowIcon } from "./components/Icons/ProgrammingArrowIcon.mj
|
|
|
170
171
|
import { QueueIcon } from "./components/Icons/QueueIcon.mjs";
|
|
171
172
|
import { ReceiveMoneyIcon } from "./components/Icons/ReceiveMoneyIcon.mjs";
|
|
172
173
|
import { RefreshArrowIcon } from "./components/Icons/RefreshArrowIcon.mjs";
|
|
174
|
+
import { ReorganiseIcon } from "./components/Icons/ReorganiseIcon.mjs";
|
|
173
175
|
import { RepeatIcon } from "./components/Icons/RepeatIcon.mjs";
|
|
174
176
|
import { Reply2Icon } from "./components/Icons/Reply2Icon.mjs";
|
|
175
177
|
import { ReplyIcon } from "./components/Icons/ReplyIcon.mjs";
|
|
@@ -450,6 +452,7 @@ export {
|
|
|
450
452
|
EyeSlashIcon,
|
|
451
453
|
FacebookIcon,
|
|
452
454
|
FanFollowerCount,
|
|
455
|
+
FilterMenu,
|
|
453
456
|
FlagIcon,
|
|
454
457
|
FlameIcon,
|
|
455
458
|
FlashIcon,
|
|
@@ -542,6 +545,7 @@ export {
|
|
|
542
545
|
RatingSummary,
|
|
543
546
|
ReceiveMoneyIcon,
|
|
544
547
|
RefreshArrowIcon,
|
|
548
|
+
ReorganiseIcon,
|
|
545
549
|
RepeatIcon,
|
|
546
550
|
Reply2Icon,
|
|
547
551
|
ReplyIcon,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/styles/base.css
CHANGED
|
@@ -573,3 +573,46 @@
|
|
|
573
573
|
--fv-upsell-glow: var(--fv-upsell-glow-on-dark);
|
|
574
574
|
--fv-upsell-glow-negative: var(--fv-upsell-glow-on-light);
|
|
575
575
|
}
|
|
576
|
+
|
|
577
|
+
/*
|
|
578
|
+
* The v2 card edge. In the v2 light palette white cards sit on a #f4f4f4 page,
|
|
579
|
+
* so a flat 1px border reads as a hard line. Primary cards (and any surface that
|
|
580
|
+
* opts in) take this edge with a soft shadow (`theme-v2:shadow-sm`); dark mode
|
|
581
|
+
* separates them by colour alone and keeps the plain border.
|
|
582
|
+
*
|
|
583
|
+
* The edge is a 1px stroke that darkens toward the bottom, blackalpha-50 to
|
|
584
|
+
* blackalpha-100: the border is removed and a masked ring on the card's outer
|
|
585
|
+
* edge takes its place, so nothing shows between the stroke and the shadow. The
|
|
586
|
+
* ring is a mask, not a background layer, so the card keeps whatever fill it is
|
|
587
|
+
* given. A browser without mask compositing keeps the plain border, since an
|
|
588
|
+
* unmasked ring would tint the whole card.
|
|
589
|
+
*/
|
|
590
|
+
@utility card-edge-v2 {
|
|
591
|
+
@supports (mask-composite: exclude) or (-webkit-mask-composite: xor) {
|
|
592
|
+
.theme-v2 &:not(:where(.dark, .dark *, .theme-v2-dark, .theme-v2-dark *)) {
|
|
593
|
+
border-width: 0;
|
|
594
|
+
|
|
595
|
+
&::before {
|
|
596
|
+
content: "";
|
|
597
|
+
position: absolute;
|
|
598
|
+
inset: 0;
|
|
599
|
+
z-index: 1;
|
|
600
|
+
padding: 1px;
|
|
601
|
+
border-radius: inherit;
|
|
602
|
+
background: linear-gradient(
|
|
603
|
+
to bottom,
|
|
604
|
+
var(--primitives-color-blackalpha-50),
|
|
605
|
+
var(--primitives-color-blackalpha-100)
|
|
606
|
+
);
|
|
607
|
+
-webkit-mask:
|
|
608
|
+
linear-gradient(#000 0 0) content-box,
|
|
609
|
+
linear-gradient(#000 0 0);
|
|
610
|
+
-webkit-mask-composite: xor;
|
|
611
|
+
mask:
|
|
612
|
+
linear-gradient(#000 0 0) content-box exclude,
|
|
613
|
+
linear-gradient(#000 0 0);
|
|
614
|
+
pointer-events: none;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|