@tryghost/shade 0.1.0-alpha.15 → 0.1.0-alpha.17
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/es/components/patterns/filter-bar.js +4 -6
- package/es/components/patterns/filter-bar.js.map +1 -1
- package/es/components/patterns/filters.js +14 -17
- package/es/components/patterns/filters.js.map +1 -1
- package/es/components/patterns/image-upload.js +1 -3
- package/es/components/patterns/image-upload.js.map +1 -1
- package/es/components/patterns/page-header.js +16 -42
- package/es/components/patterns/page-header.js.map +1 -1
- package/es/components/patterns/share-modal.js +3 -15
- package/es/components/patterns/share-modal.js.map +1 -1
- package/es/components/ui/alert-dialog.js +2 -4
- package/es/components/ui/alert-dialog.js.map +1 -1
- package/es/components/ui/button-variants.js +1 -32
- package/es/components/ui/button-variants.js.map +1 -1
- package/es/components/ui/button.js +1 -2
- package/es/components/ui/button.js.map +1 -1
- package/es/components/ui/calendar.js +1 -3
- package/es/components/ui/calendar.js.map +1 -1
- package/es/components/ui/copy-field.js +1 -3
- package/es/components/ui/copy-field.js.map +1 -1
- package/es/components/ui/data-list.js +1 -3
- package/es/components/ui/data-list.js.map +1 -1
- package/es/components/ui/dropzone-variants.js +1 -3
- package/es/components/ui/dropzone-variants.js.map +1 -1
- package/es/components/ui/dropzone.js +2 -2
- package/es/components/ui/dropzone.js.map +1 -1
- package/es/components/ui/image-overlay-button.js +2 -2
- package/es/components/ui/image-overlay-button.js.map +1 -1
- package/es/components/ui/input-group.js +2 -5
- package/es/components/ui/input-group.js.map +1 -1
- package/es/components/ui/navbar.js +1 -3
- package/es/components/ui/navbar.js.map +1 -1
- package/es/components/ui/select-variants.js +1 -9
- package/es/components/ui/select-variants.js.map +1 -1
- package/es/components/ui/select.js +1 -4
- package/es/components/ui/select.js.map +1 -1
- package/es/components/ui/simple-pagination.js +4 -7
- package/es/components/ui/simple-pagination.js.map +1 -1
- package/es/components/ui/toggle-group.js +1 -3
- package/es/components/ui/toggle-group.js.map +1 -1
- package/es/components/ui/toggle-variants.js +1 -7
- package/es/components/ui/toggle-variants.js.map +1 -1
- package/es/components/ui/toggle.js +1 -2
- package/es/components/ui/toggle.js.map +1 -1
- package/es/components/ui/tooltip.js +8 -17
- package/es/components/ui/tooltip.js.map +1 -1
- package/es/providers/header-tooltip-provider.js +1 -4
- package/es/providers/header-tooltip-provider.js.map +1 -1
- package/es/providers/shade-context.js +1 -1
- package/es/providers/shade-context.js.map +1 -1
- package/es/providers/shade-provider.js +3 -3
- package/es/providers/shade-provider.js.map +1 -1
- package/es/shade-app.js +3 -3
- package/es/shade-app.js.map +1 -1
- package/es/shade-scope.js +2 -2
- package/es/shade-scope.js.map +1 -1
- package/es/tokens.js +0 -8
- package/es/tokens.js.map +1 -1
- package/package.json +2 -2
- package/tailwind.theme.css +0 -8
- package/theme-variables.css +3 -11
- package/types/components/patterns/filter-bar.d.ts.map +1 -1
- package/types/components/patterns/filters.d.ts +1 -4
- package/types/components/patterns/filters.d.ts.map +1 -1
- package/types/components/patterns/image-upload.d.ts.map +1 -1
- package/types/components/patterns/page-header.d.ts +4 -10
- package/types/components/patterns/page-header.d.ts.map +1 -1
- package/types/components/patterns/share-modal.d.ts.map +1 -1
- package/types/components/ui/button-variants.d.ts +0 -1
- package/types/components/ui/button-variants.d.ts.map +1 -1
- package/types/components/ui/button.d.ts +1 -1
- package/types/components/ui/button.d.ts.map +1 -1
- package/types/components/ui/copy-field.d.ts.map +1 -1
- package/types/components/ui/data-list.d.ts.map +1 -1
- package/types/components/ui/dropzone-variants.d.ts +1 -1
- package/types/components/ui/dropzone-variants.d.ts.map +1 -1
- package/types/components/ui/image-overlay-button.d.ts +1 -1
- package/types/components/ui/image-overlay-button.d.ts.map +1 -1
- package/types/components/ui/input-group.d.ts.map +1 -1
- package/types/components/ui/navbar.d.ts.map +1 -1
- package/types/components/ui/select-variants.d.ts +0 -1
- package/types/components/ui/select-variants.d.ts.map +1 -1
- package/types/components/ui/select.d.ts +1 -1
- package/types/components/ui/select.d.ts.map +1 -1
- package/types/components/ui/simple-pagination.d.ts.map +1 -1
- package/types/components/ui/toggle-group.d.ts +4 -6
- package/types/components/ui/toggle-group.d.ts.map +1 -1
- package/types/components/ui/toggle-variants.d.ts +0 -1
- package/types/components/ui/toggle-variants.d.ts.map +1 -1
- package/types/components/ui/toggle.d.ts +2 -3
- package/types/components/ui/toggle.d.ts.map +1 -1
- package/types/components/ui/tooltip.d.ts.map +1 -1
- package/types/providers/header-tooltip-provider.d.ts.map +1 -1
- package/types/providers/shade-context.d.ts +2 -1
- package/types/providers/shade-context.d.ts.map +1 -1
- package/types/providers/shade-provider.d.ts +1 -1
- package/types/providers/shade-provider.d.ts.map +1 -1
- package/types/shade-app.d.ts +5 -2
- package/types/shade-app.d.ts.map +1 -1
- package/types/tokens.d.ts +1 -1
- package/types/tokens.d.ts.map +1 -1
|
@@ -21,13 +21,13 @@ import { jsx } from "react/jsx-runtime";
|
|
|
21
21
|
* </FilterBar>
|
|
22
22
|
*/
|
|
23
23
|
function FilterBarRoot({ className, children }) {
|
|
24
|
-
const { controlShape
|
|
24
|
+
const { controlShape } = useShade();
|
|
25
25
|
if (React.Children.count(children) === 0) return null;
|
|
26
26
|
return /* @__PURE__ */ jsx(FilterBarContext.Provider, {
|
|
27
27
|
value: true,
|
|
28
28
|
children: /* @__PURE__ */ jsx(Inline, {
|
|
29
29
|
align: "start",
|
|
30
|
-
className: cn("relative w-full [&>[data-slot=filter-bar-actions]]:static",
|
|
30
|
+
className: cn("relative w-full [&>[data-slot=filter-bar-actions]]:static", "-mt-1 rounded-control bg-filter-bar-background p-2 [&_[data-slot=filter-item]>*]:bg-background! [&_[data-slot=filter-item]>*:hover]:bg-filter-bar-item-hover! [&_[data-slot=filter-item]>*[data-state=open]]:bg-filter-bar-item-hover! [&_[data-slot=filters-add]]:bg-transparent! [&_[data-slot=filters-add]:hover]:bg-tab-active!", className),
|
|
31
31
|
"data-control-shape": controlShape,
|
|
32
32
|
"data-slot": "filter-bar",
|
|
33
33
|
gap: "sm",
|
|
@@ -46,12 +46,10 @@ var FilterBarActions = React.forwardRef(({ className, gap = "sm", ...props }, re
|
|
|
46
46
|
FilterBarActions.displayName = "FilterBar.Actions";
|
|
47
47
|
var FilterBarAction = React.forwardRef(({ className, size, variant, ...props }, ref) => {
|
|
48
48
|
const isInFilterBar = useFilterBarContext();
|
|
49
|
-
const { isAdmin7 } = useShade();
|
|
50
|
-
const usePillFilterBarStyle = isInFilterBar && isAdmin7;
|
|
51
49
|
return /* @__PURE__ */ jsx(Button, {
|
|
52
50
|
ref,
|
|
53
|
-
className: cn(
|
|
54
|
-
size: size ?? (
|
|
51
|
+
className: cn(isInFilterBar && variant === "outline" && "bg-background", isInFilterBar && variant === "ghost" && "hover:bg-tab-active enabled:active:bg-tab-active", className),
|
|
52
|
+
size: size ?? (isInFilterBar ? "sm" : void 0),
|
|
55
53
|
variant,
|
|
56
54
|
...props
|
|
57
55
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-bar.js","names":[],"sources":["../../../src/components/patterns/filter-bar.tsx"],"sourcesContent":["import React from 'react';\nimport { Button, type ButtonProps } from '@/components/ui/button';\nimport { Inline, type InlineProps } from '@/components/primitives/inline';\nimport { FilterBarContext, useFilterBarContext } from '@/components/patterns/filter-bar-context';\nimport { cn } from '@/lib/utils';\nimport { useShade } from '@/providers/shade-context';\n\ntype FilterBarProps = React.PropsWithChildren & {\n className?: string;\n};\n\n/**\n * FilterBar is a full-width horizontal row for active filters and related\n * controls (clear, save view, etc.). It renders null when it has no children,\n * so consumers can always mount it without conditional wrapping.\n *\n * Typical usage:\n * <FilterBar>\n * <Filters ... />\n * <FilterBar.Actions>\n * <FilterBar.Action variant=\"ghost\">Clear</FilterBar.Action>\n * <FilterBar.Action variant=\"outline\">Save view</FilterBar.Action>\n * </FilterBar.Actions>\n * </FilterBar>\n */\nfunction FilterBarRoot({ className, children }: FilterBarProps) {\n const { controlShape
|
|
1
|
+
{"version":3,"file":"filter-bar.js","names":[],"sources":["../../../src/components/patterns/filter-bar.tsx"],"sourcesContent":["import React from 'react';\nimport { Button, type ButtonProps } from '@/components/ui/button';\nimport { Inline, type InlineProps } from '@/components/primitives/inline';\nimport { FilterBarContext, useFilterBarContext } from '@/components/patterns/filter-bar-context';\nimport { cn } from '@/lib/utils';\nimport { useShade } from '@/providers/shade-context';\n\ntype FilterBarProps = React.PropsWithChildren & {\n className?: string;\n};\n\n/**\n * FilterBar is a full-width horizontal row for active filters and related\n * controls (clear, save view, etc.). It renders null when it has no children,\n * so consumers can always mount it without conditional wrapping.\n *\n * Typical usage:\n * <FilterBar>\n * <Filters ... />\n * <FilterBar.Actions>\n * <FilterBar.Action variant=\"ghost\">Clear</FilterBar.Action>\n * <FilterBar.Action variant=\"outline\">Save view</FilterBar.Action>\n * </FilterBar.Actions>\n * </FilterBar>\n */\nfunction FilterBarRoot({ className, children }: FilterBarProps) {\n const { controlShape } = useShade();\n\n if (React.Children.count(children) === 0) {\n return null;\n }\n\n return (\n <FilterBarContext.Provider value={true}>\n <Inline\n align=\"start\"\n className={cn(\n 'relative w-full [&>[data-slot=filter-bar-actions]]:static',\n '-mt-1 rounded-control bg-filter-bar-background p-2 [&_[data-slot=filter-item]>*]:bg-background! [&_[data-slot=filter-item]>*:hover]:bg-filter-bar-item-hover! [&_[data-slot=filter-item]>*[data-state=open]]:bg-filter-bar-item-hover! [&_[data-slot=filters-add]]:bg-transparent! [&_[data-slot=filters-add]:hover]:bg-tab-active!',\n className,\n )}\n data-control-shape={controlShape}\n data-slot=\"filter-bar\"\n gap=\"sm\"\n justify=\"between\"\n >\n {children}\n </Inline>\n </FilterBarContext.Provider>\n );\n}\n\nconst FilterBarActions = React.forwardRef<HTMLElement, InlineProps>(\n ({ className, gap = 'sm', ...props }, ref) => (\n <Inline\n ref={ref}\n className={cn('shrink-0 sm:absolute sm:top-0 sm:right-0', className)}\n data-slot=\"filter-bar-actions\"\n gap={gap}\n {...props}\n />\n ),\n);\nFilterBarActions.displayName = 'FilterBar.Actions';\n\nconst FilterBarAction = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, size, variant, ...props }, ref) => {\n const isInFilterBar = useFilterBarContext();\n\n return (\n <Button\n ref={ref}\n className={cn(\n isInFilterBar && variant === 'outline' && 'bg-background',\n isInFilterBar &&\n variant === 'ghost' &&\n 'hover:bg-tab-active enabled:active:bg-tab-active',\n className,\n )}\n size={size ?? (isInFilterBar ? 'sm' : undefined)}\n variant={variant}\n {...props}\n />\n );\n },\n);\nFilterBarAction.displayName = 'FilterBar.Action';\n\nconst FilterBar = Object.assign(FilterBarRoot, {\n Actions: FilterBarActions,\n Action: FilterBarAction,\n});\n\nexport { FilterBar };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAS,cAAc,EAAE,WAAW,YAA4B;CAC9D,MAAM,EAAE,iBAAiB,SAAS;CAElC,IAAI,MAAM,SAAS,MAAM,QAAQ,MAAM,GACrC,OAAO;CAGT,OACE,oBAAC,iBAAiB,UAAlB;EAA2B,OAAO;YAChC,oBAAC,QAAD;GACE,OAAM;GACN,WAAW,GACT,6DACA,uUACA,SACF;GACA,sBAAoB;GACpB,aAAU;GACV,KAAI;GACJ,SAAQ;GAEP;EACK,CAAA;CACiB,CAAA;AAE/B;AAEA,IAAM,mBAAmB,MAAM,YAC5B,EAAE,WAAW,MAAM,MAAM,GAAG,SAAS,QACpC,oBAAC,QAAD;CACO;CACL,WAAW,GAAG,4CAA4C,SAAS;CACnE,aAAU;CACL;CACL,GAAI;AACL,CAAA,CAEL;AACA,iBAAiB,cAAc;AAE/B,IAAM,kBAAkB,MAAM,YAC3B,EAAE,WAAW,MAAM,SAAS,GAAG,SAAS,QAAQ;CAC/C,MAAM,gBAAgB,oBAAoB;CAE1C,OACE,oBAAC,QAAD;EACO;EACL,WAAW,GACT,iBAAiB,YAAY,aAAa,iBAC1C,iBACE,YAAY,WACZ,oDACF,SACF;EACA,MAAM,SAAS,gBAAgB,OAAO,KAAA;EAC7B;EACT,GAAI;CACL,CAAA;AAEL,CACF;AACA,gBAAgB,cAAc;AAE9B,IAAM,YAAY,OAAO,OAAO,eAAe;CAC7C,SAAS;CACT,QAAQ;AACV,CAAC"}
|
|
@@ -11,7 +11,7 @@ import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, Command
|
|
|
11
11
|
import { MultiSelectCombobox } from "../ui/multi-select-combobox.js";
|
|
12
12
|
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover.js";
|
|
13
13
|
import { Switch } from "../ui/switch.js";
|
|
14
|
-
import { AlertCircle, Calendar, Check,
|
|
14
|
+
import { AlertCircle, Calendar, Check, FunnelPlus, ListFilterPlus, Loader2, Plus, X } from "lucide-react";
|
|
15
15
|
import { createContext, forwardRef, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
16
16
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
17
17
|
import { cva } from "class-variance-authority";
|
|
@@ -1448,10 +1448,9 @@ var FiltersContent = ({ filters, fields, onChange }) => {
|
|
|
1448
1448
|
};
|
|
1449
1449
|
var FilterAddButton = forwardRef(({ className, label, icon, ...props }, ref) => {
|
|
1450
1450
|
const context = useFilterContext();
|
|
1451
|
-
const { controlShape
|
|
1451
|
+
const { controlShape } = useShade();
|
|
1452
1452
|
const isInFilterBar = useFilterBarContext();
|
|
1453
|
-
const
|
|
1454
|
-
const iconOnly = isPillFilterBar && context.hasFilters;
|
|
1453
|
+
const iconOnly = isInFilterBar && context.hasFilters;
|
|
1455
1454
|
const buttonLabel = label ?? context.addButtonText ?? context.i18n.addFilter;
|
|
1456
1455
|
return /* @__PURE__ */ jsxs("button", {
|
|
1457
1456
|
ref,
|
|
@@ -1461,7 +1460,7 @@ var FilterAddButton = forwardRef(({ className, label, icon, ...props }, ref) =>
|
|
|
1461
1460
|
size: context.size,
|
|
1462
1461
|
cursorPointer: context.cursorPointer,
|
|
1463
1462
|
radius: context.controlRadius
|
|
1464
|
-
}),
|
|
1463
|
+
}), isInFilterBar && "h-7 text-sm! [&_svg]:size-3", !isInFilterBar && "font-medium", iconOnly ? "aspect-square border-0 !px-0 shadow-none" : context.addButtonVariant === "ghost" || context.addButtonVariant === "secondary" ? "border-0 px-3 shadow-none active:shadow-none" : "border-0 px-3 shadow-control-outline active:shadow-control-outline-pressed", context.addButtonClassName, className),
|
|
1465
1464
|
"data-control-shape": controlShape,
|
|
1466
1465
|
"data-slot": "filters-add",
|
|
1467
1466
|
title: context.i18n.addFilterTitle,
|
|
@@ -1471,28 +1470,26 @@ var FilterAddButton = forwardRef(({ className, label, icon, ...props }, ref) =>
|
|
|
1471
1470
|
});
|
|
1472
1471
|
});
|
|
1473
1472
|
FilterAddButton.displayName = "FilterAddButton";
|
|
1474
|
-
var FiltersTrigger = forwardRef(({
|
|
1473
|
+
var FiltersTrigger = forwardRef(({ fallbackStyle = "list", className, ...props }, ref) => {
|
|
1475
1474
|
const { hasFilters, keyboardShortcut } = useFilterContext();
|
|
1476
|
-
|
|
1477
|
-
if (isAdmin7 && !hasFilters) return /* @__PURE__ */ jsx(PageHeader.FilterTrigger, {
|
|
1475
|
+
if (!hasFilters) return /* @__PURE__ */ jsx(PageHeader.FilterTrigger, {
|
|
1478
1476
|
ref,
|
|
1479
1477
|
className,
|
|
1480
1478
|
shortcut: keyboardShortcut?.toUpperCase(),
|
|
1481
1479
|
...props
|
|
1482
1480
|
});
|
|
1483
|
-
const iconStyle =
|
|
1484
|
-
const Icon = iconStyle === "list" ? hasFilters ? ListFilterPlus : ListFilter : hasFilters || fallbackStyle === "funnel-plus" ? FunnelPlus : Funnel;
|
|
1481
|
+
const iconStyle = fallbackStyle === "funnel-plus" ? "funnel-plus" : "list";
|
|
1485
1482
|
return /* @__PURE__ */ jsx(FilterAddButton, {
|
|
1486
1483
|
ref,
|
|
1487
|
-
className
|
|
1488
|
-
icon: /* @__PURE__ */ jsx(
|
|
1489
|
-
label:
|
|
1484
|
+
className,
|
|
1485
|
+
icon: /* @__PURE__ */ jsx(iconStyle === "list" ? ListFilterPlus : FunnelPlus, { className: iconStyle === "list" ? "size-4" : void 0 }),
|
|
1486
|
+
label: "Add filter",
|
|
1490
1487
|
...props
|
|
1491
1488
|
});
|
|
1492
1489
|
});
|
|
1493
1490
|
FiltersTrigger.displayName = "Filters.Trigger";
|
|
1494
1491
|
function Filters({ filters, fields, onChange, className, showAddButton = true, addButtonText, addButtonIcon, addButtonClassName, addButtonVariant, addButton, showClearButton = false, clearButtonText, clearButtonIcon, clearButtonClassName, clearButton, onClear, variant = "outline", size = "md", radius, i18n, showSearchInput = true, cursorPointer = true, trigger, allowMultiple = true, popoverContentClassName, popoverAlign = "start", keyboardShortcut, onActiveFieldChange }) {
|
|
1495
|
-
const { controlShape
|
|
1492
|
+
const { controlShape } = useShade();
|
|
1496
1493
|
const [addFilterOpen, setAddFilterOpen] = useState(false);
|
|
1497
1494
|
const [selectedFieldKeyForOptions, setSelectedFieldKeyForOptions] = useState(null);
|
|
1498
1495
|
const [tempSelectedValues, setTempSelectedValues] = useState([]);
|
|
@@ -1500,7 +1497,7 @@ function Filters({ filters, fields, onChange, className, showAddButton = true, a
|
|
|
1500
1497
|
const [fieldSearch, setFieldSearch] = useState("");
|
|
1501
1498
|
const [expandedGroups, setExpandedGroups] = useState(/* @__PURE__ */ new Set());
|
|
1502
1499
|
const filterRadius = radius ?? "md";
|
|
1503
|
-
const controlRadius = radius ??
|
|
1500
|
+
const controlRadius = radius ?? "full";
|
|
1504
1501
|
useEffect(() => {
|
|
1505
1502
|
onActiveFieldChange?.(selectedFieldKeyForOptions);
|
|
1506
1503
|
}, [selectedFieldKeyForOptions, onActiveFieldChange]);
|
|
@@ -1693,7 +1690,7 @@ function Filters({ filters, fields, onChange, className, showAddButton = true, a
|
|
|
1693
1690
|
const field = fieldsMap[filter.field];
|
|
1694
1691
|
if (!field) return null;
|
|
1695
1692
|
return /* @__PURE__ */ jsxs("div", {
|
|
1696
|
-
className: cn(filterItemVariants({ variant }),
|
|
1693
|
+
className: cn(filterItemVariants({ variant }), "text-sm [--control-height:calc(var(--spacing)*7)] [&_*]:text-sm!"),
|
|
1697
1694
|
"data-slot": "filter-item",
|
|
1698
1695
|
children: [
|
|
1699
1696
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -1796,7 +1793,7 @@ function Filters({ filters, fields, onChange, className, showAddButton = true, a
|
|
|
1796
1793
|
size,
|
|
1797
1794
|
cursorPointer,
|
|
1798
1795
|
radius: controlRadius
|
|
1799
|
-
}),
|
|
1796
|
+
}), "h-7 text-sm! [&_svg]:size-3", "border-0 bg-transparent hover:bg-transparent hover:text-foreground", "px-3 shadow-control-outline active:shadow-control-outline-pressed", "sm:absolute sm:top-0 sm:right-0", clearButtonClassName),
|
|
1800
1797
|
"data-control-shape": controlShape,
|
|
1801
1798
|
type: "button",
|
|
1802
1799
|
onClick: () => {
|