@rise-x/apps-sdk 0.15.0 → 0.15.1
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/README.md +12 -0
- package/build/ui/classes.json +2 -2
- package/build/ui/components/data-table.d.ts +39 -4
- package/build/ui/components/statistic.d.ts +1 -1
- package/build/ui/demo.html +307 -184
- package/build/ui/standalone.js +43 -43
- package/build/ui/styles.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -803,6 +803,18 @@ import { MapView, mapPin } from '@rise-x/apps-sdk/ui';
|
|
|
803
803
|
`tiles` also takes a preset (`'light'`, `'dark'`, `'streets'`, `'satellite'`), a
|
|
804
804
|
custom tile layer, or `null` for no basemap at all.
|
|
805
805
|
|
|
806
|
+
The built-in presets load tile images from third-party hosts, so the host
|
|
807
|
+
page's CSP `img-src` must allow `https://*.basemaps.cartocdn.com`,
|
|
808
|
+
`https://tile.openstreetmap.org` and `https://server.arcgisonline.com`. The
|
|
809
|
+
host page's CSP controls this, so an app can't lift a block from its own
|
|
810
|
+
code. The Rise-X shell already allows the built-in preset hosts; for any
|
|
811
|
+
other host, ask Rise-X to add it. If no tile loads,
|
|
812
|
+
`MapView` warns once and removes the layer so Leaflet stops re-requesting
|
|
813
|
+
blocked tiles on every pan and zoom — use `tiles={null}` or a custom
|
|
814
|
+
`MapTileSpec` on a permitted origin instead. `mapPin()` has no `aria-label` of
|
|
815
|
+
its own; set one via `marker.getElement()` after `addTo(map)` if the marker
|
|
816
|
+
needs an accessible name (see the JSDoc on `mapPin`).
|
|
817
|
+
|
|
806
818
|
`center`/`zoom`/`bounds` set the **initial** view only — pan and zoom afterwards
|
|
807
819
|
through the instance (`map.flyTo(...)`), so a re-render never yanks the map away
|
|
808
820
|
from someone who is using it. The map fills its parent and re-fits itself
|
package/build/ui/classes.json
CHANGED
|
@@ -175,8 +175,8 @@
|
|
|
175
175
|
],
|
|
176
176
|
"classes": {
|
|
177
177
|
"flat": "inline-flex items-center gap-0.5 text-xs font-medium [&>svg]:size-3 [&>svg]:shrink-0 text-muted-foreground",
|
|
178
|
-
"
|
|
179
|
-
"
|
|
178
|
+
"down": "inline-flex items-center gap-0.5 text-xs font-medium [&>svg]:size-3 [&>svg]:shrink-0 text-error-text",
|
|
179
|
+
"up": "inline-flex items-center gap-0.5 text-xs font-medium [&>svg]:size-3 [&>svg]:shrink-0 text-success-text"
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
182
|
"node": {
|
|
@@ -14,9 +14,9 @@ export interface FacetedFilterOption extends DataTableFilterOption {
|
|
|
14
14
|
* than printed as 0. */
|
|
15
15
|
count?: number;
|
|
16
16
|
}
|
|
17
|
-
export interface FacetedFilterProps {
|
|
17
|
+
export interface FacetedFilterProps<TOption extends FacetedFilterOption = FacetedFilterOption> {
|
|
18
18
|
title: string;
|
|
19
|
-
options:
|
|
19
|
+
options: TOption[];
|
|
20
20
|
/** Applied values — a Set or an array, whichever the caller already holds. */
|
|
21
21
|
selected: Iterable<string>;
|
|
22
22
|
onSelect: (value: string, checked: boolean) => void;
|
|
@@ -26,6 +26,28 @@ export interface FacetedFilterProps {
|
|
|
26
26
|
/** Drop options whose `count` is 0 — inert when counts aren't provided.
|
|
27
27
|
* Applied values stay listed so they can be unticked. */
|
|
28
28
|
hideEmpty?: boolean;
|
|
29
|
+
/** Replaces the CONTENTS of an option row — the tick, icon, label and count.
|
|
30
|
+
* The row button itself stays ours, so roving focus, `role="option"` and
|
|
31
|
+
* `aria-selected` keep working. Keep what you render NON-INTERACTIVE: the row
|
|
32
|
+
* IS a `<button>`, so a nested button, link or Checkbox is invalid HTML and
|
|
33
|
+
* fights the row's own tab stop and click handling.
|
|
34
|
+
*
|
|
35
|
+
* The row's accessible name is CONTENT, not an override — no `aria-label`
|
|
36
|
+
* is applied, so it stays whatever the default row already gave it (label,
|
|
37
|
+
* then count) and extends naturally when you render more. That cuts both
|
|
38
|
+
* ways: put the identifying text first, and mark anything purely decorative
|
|
39
|
+
* — an avatar's initials, an icon that only repeats what the label already
|
|
40
|
+
* says — `aria-hidden`, or it reads out ahead of the label. `option.label`
|
|
41
|
+
* stays load-bearing in two more places a renderer can now visually hide:
|
|
42
|
+
* it's what search matches against, and what the trigger's selected chips
|
|
43
|
+
* print. `TOption` lets an option carry whatever a custom renderer needs
|
|
44
|
+
* (an avatar, a second line) without a lookup back to the caller's own
|
|
45
|
+
* data — see `FacetedFilter`; `DataTable`'s `filters` still type this
|
|
46
|
+
* against the base `FacetedFilterOption`. Omitted, rows render
|
|
47
|
+
* `defaultFacetedOption` below. */
|
|
48
|
+
renderOption?: (option: TOption, state: {
|
|
49
|
+
checked: boolean;
|
|
50
|
+
}) => React.ReactNode;
|
|
29
51
|
className?: string;
|
|
30
52
|
}
|
|
31
53
|
export interface DataTableFilter {
|
|
@@ -37,6 +59,11 @@ export interface DataTableFilter {
|
|
|
37
59
|
searchable?: boolean;
|
|
38
60
|
/** Drop options no visible row carries. */
|
|
39
61
|
hideEmpty?: boolean;
|
|
62
|
+
/** Custom option row contents — see `FacetedFilterProps.renderOption`.
|
|
63
|
+
* Typed against the base `FacetedFilterOption`: the generic `TOption` that
|
|
64
|
+
* lets an option carry extra fields is only available through the unbound
|
|
65
|
+
* `FacetedFilter`, not through this descriptor. */
|
|
66
|
+
renderOption?: FacetedFilterProps['renderOption'];
|
|
40
67
|
}
|
|
41
68
|
export interface DataTableProps<TData, TValue> {
|
|
42
69
|
columns: ColumnDef<TData, TValue>[];
|
|
@@ -57,21 +84,29 @@ export declare function DataTableColumnHeader<TData, TValue>({ column, title, cl
|
|
|
57
84
|
title: string;
|
|
58
85
|
className?: string;
|
|
59
86
|
}): React.JSX.Element;
|
|
87
|
+
/** The stock option row: tick, optional icon, label, right-aligned count.
|
|
88
|
+
* Exported so a `renderOption` that wants to ADD to the stock row, rather
|
|
89
|
+
* than replace it, can render this and wrap it instead of hand-copying its
|
|
90
|
+
* `size-[15px]` / `rounded-[4px]` internals. */
|
|
91
|
+
export declare function defaultFacetedOption(option: FacetedFilterOption, { checked }: {
|
|
92
|
+
checked: boolean;
|
|
93
|
+
}): React.JSX.Element;
|
|
60
94
|
/**
|
|
61
95
|
* Multi-select filter trigger + menu, with no table attached — for toolbars
|
|
62
96
|
* that filter something other than a DataTable. State is the caller's:
|
|
63
97
|
* `selected` in, `onSelect`/`onClear` out. DataTableFacetedFilter is this
|
|
64
98
|
* component wired to a TanStack column.
|
|
65
99
|
*/
|
|
66
|
-
export declare function FacetedFilter({ title, options, selected: selectedValues, onSelect, onClear, searchable, hideEmpty, className, }: FacetedFilterProps): React.JSX.Element;
|
|
100
|
+
export declare function FacetedFilter<TOption extends FacetedFilterOption = FacetedFilterOption>({ title, options, selected: selectedValues, onSelect, onClear, searchable, hideEmpty, renderOption, className, }: FacetedFilterProps<TOption>): React.JSX.Element;
|
|
67
101
|
/** FacetedFilter bound to a TanStack column: facet counts and the filter value
|
|
68
102
|
* come from the table, so the toolbar only names the column. */
|
|
69
|
-
export declare function DataTableFacetedFilter<TData>({ column, title, options, searchable, hideEmpty, }: {
|
|
103
|
+
export declare function DataTableFacetedFilter<TData>({ column, title, options, searchable, hideEmpty, renderOption, }: {
|
|
70
104
|
column: Column<TData, unknown>;
|
|
71
105
|
title: string;
|
|
72
106
|
options: DataTableFilterOption[];
|
|
73
107
|
searchable?: boolean;
|
|
74
108
|
hideEmpty?: boolean;
|
|
109
|
+
renderOption?: FacetedFilterProps['renderOption'];
|
|
75
110
|
}): React.JSX.Element;
|
|
76
111
|
/**
|
|
77
112
|
* Rise-X data table: search, faceted filters and column visibility are built
|
|
@@ -7,7 +7,7 @@ declare function StatisticValue({ className, size, ...props }: React.ComponentPr
|
|
|
7
7
|
}): React.JSX.Element;
|
|
8
8
|
declare function StatisticCaption({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
9
9
|
declare const trendVariants: (props?: ({
|
|
10
|
-
direction?: "flat" | "
|
|
10
|
+
direction?: "flat" | "down" | "up" | null | undefined;
|
|
11
11
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
12
|
declare function Trend({ className, direction, ...props }: React.ComponentProps<'span'> & VariantProps<typeof trendVariants>): React.JSX.Element;
|
|
13
13
|
declare const meterVariants: (props?: ({
|