@jupytergis/base 0.5.0 → 0.6.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/lib/annotations/components/Annotation.d.ts +2 -2
- package/lib/annotations/components/Annotation.js +3 -3
- package/lib/annotations/components/AnnotationFloater.d.ts +1 -1
- package/lib/annotations/components/AnnotationFloater.js +2 -2
- package/lib/annotations/components/Message.d.ts +2 -1
- package/lib/annotations/components/Message.js +3 -3
- package/lib/annotations/model.js +5 -5
- package/lib/commands/BaseCommandIDs.d.ts +32 -0
- package/lib/commands/BaseCommandIDs.js +43 -0
- package/lib/{commands.d.ts → commands/index.d.ts} +1 -1
- package/lib/{commands.js → commands/index.js} +59 -99
- package/lib/console/consoleview.d.ts +3 -3
- package/lib/console/consoleview.js +5 -5
- package/lib/constants.d.ts +2 -36
- package/lib/constants.js +5 -47
- package/lib/dialogs/ProcessingFormDialog.d.ts +4 -4
- package/lib/dialogs/ProcessingFormDialog.js +9 -11
- package/lib/dialogs/layerBrowserDialog.d.ts +1 -1
- package/lib/dialogs/layerBrowserDialog.js +7 -7
- package/lib/dialogs/layerCreationFormDialog.d.ts +4 -4
- package/lib/dialogs/layerCreationFormDialog.js +6 -6
- package/lib/dialogs/symbology/components/color_ramp/CanvasSelectComponent.d.ts +1 -1
- package/lib/dialogs/symbology/components/color_ramp/CanvasSelectComponent.js +3 -3
- package/lib/dialogs/symbology/components/color_ramp/ColorRamp.d.ts +3 -2
- package/lib/dialogs/symbology/components/color_ramp/ColorRamp.js +6 -7
- package/lib/dialogs/symbology/components/color_ramp/ColorRampEntry.d.ts +1 -1
- package/lib/dialogs/symbology/components/color_ramp/ColorRampEntry.js +1 -1
- package/lib/dialogs/symbology/components/color_ramp/ModeSelectRow.d.ts +1 -1
- package/lib/dialogs/symbology/components/color_ramp/ModeSelectRow.js +1 -1
- package/lib/dialogs/symbology/components/color_stops/StopContainer.d.ts +2 -2
- package/lib/dialogs/symbology/components/color_stops/StopContainer.js +4 -4
- package/lib/dialogs/symbology/components/color_stops/StopRow.d.ts +3 -3
- package/lib/dialogs/symbology/components/color_stops/StopRow.js +2 -2
- package/lib/dialogs/symbology/hooks/useGetBandInfo.js +5 -5
- package/lib/dialogs/symbology/hooks/useGetProperties.d.ts +1 -1
- package/lib/dialogs/symbology/hooks/useGetProperties.js +4 -4
- package/lib/dialogs/symbology/symbologyDialog.d.ts +8 -0
- package/lib/dialogs/symbology/symbologyDialog.js +1 -1
- package/lib/dialogs/symbology/symbologyUtils.js +38 -31
- package/lib/dialogs/symbology/tiff_layer/TiffRendering.d.ts +2 -2
- package/lib/dialogs/symbology/tiff_layer/TiffRendering.js +2 -2
- package/lib/dialogs/symbology/tiff_layer/components/BandRow.d.ts +2 -2
- package/lib/dialogs/symbology/tiff_layer/components/BandRow.js +4 -4
- package/lib/dialogs/symbology/tiff_layer/types/MultibandColor.d.ts +2 -2
- package/lib/dialogs/symbology/tiff_layer/types/MultibandColor.js +30 -20
- package/lib/dialogs/symbology/tiff_layer/types/SingleBandPseudoColor.d.ts +2 -2
- package/lib/dialogs/symbology/tiff_layer/types/SingleBandPseudoColor.js +23 -21
- package/lib/dialogs/symbology/vector_layer/VectorRendering.d.ts +2 -2
- package/lib/dialogs/symbology/vector_layer/VectorRendering.js +81 -39
- package/lib/dialogs/symbology/vector_layer/components/ValueSelect.d.ts +1 -1
- package/lib/dialogs/symbology/vector_layer/components/ValueSelect.js +1 -1
- package/lib/dialogs/symbology/vector_layer/types/Canonical.d.ts +4 -0
- package/lib/dialogs/symbology/vector_layer/types/Canonical.js +66 -0
- package/lib/dialogs/symbology/vector_layer/types/Categorized.d.ts +2 -2
- package/lib/dialogs/symbology/vector_layer/types/Categorized.js +142 -47
- package/lib/dialogs/symbology/vector_layer/types/Graduated.d.ts +2 -2
- package/lib/dialogs/symbology/vector_layer/types/Graduated.js +193 -99
- package/lib/dialogs/symbology/vector_layer/types/Heatmap.d.ts +2 -2
- package/lib/dialogs/symbology/vector_layer/types/Heatmap.js +7 -6
- package/lib/dialogs/symbology/vector_layer/types/SimpleSymbol.d.ts +2 -2
- package/lib/dialogs/symbology/vector_layer/types/SimpleSymbol.js +33 -30
- package/lib/formbuilder/creationform.js +3 -3
- package/lib/formbuilder/editform.js +3 -3
- package/lib/formbuilder/formselectors.d.ts +1 -1
- package/lib/formbuilder/formselectors.js +2 -2
- package/lib/formbuilder/objectform/baseform.d.ts +5 -4
- package/lib/formbuilder/objectform/baseform.js +16 -14
- package/lib/formbuilder/objectform/fileselectorwidget.d.ts +1 -1
- package/lib/formbuilder/objectform/fileselectorwidget.js +5 -5
- package/lib/formbuilder/objectform/layer/heatmapLayerForm.js +2 -2
- package/lib/formbuilder/objectform/layer/hillshadeLayerForm.js +1 -1
- package/lib/formbuilder/objectform/layer/layerform.d.ts +1 -1
- package/lib/formbuilder/objectform/layer/layerform.js +3 -2
- package/lib/formbuilder/objectform/process/dissolveProcessForm.d.ts +1 -1
- package/lib/formbuilder/objectform/process/dissolveProcessForm.js +5 -5
- package/lib/formbuilder/objectform/source/geojsonsource.js +4 -4
- package/lib/formbuilder/objectform/source/geotiffsource.js +4 -4
- package/lib/formbuilder/objectform/source/pathbasedsource.js +6 -6
- package/lib/formbuilder/objectform/source/sourceform.d.ts +1 -1
- package/lib/formbuilder/objectform/source/sourceform.js +1 -1
- package/lib/formbuilder/objectform/source/tilesourceform.js +3 -3
- package/lib/gdal.js +2 -2
- package/lib/icons.js +29 -29
- package/lib/index.d.ts +4 -3
- package/lib/index.js +4 -3
- package/lib/mainview/CollaboratorPointers.d.ts +1 -1
- package/lib/mainview/CollaboratorPointers.js +5 -5
- package/lib/mainview/FollowIndicator.d.ts +2 -2
- package/lib/mainview/FollowIndicator.js +3 -3
- package/lib/mainview/TemporalSlider.d.ts +1 -1
- package/lib/mainview/TemporalSlider.js +7 -7
- package/lib/mainview/mainView.d.ts +4 -2
- package/lib/mainview/mainView.js +232 -137
- package/lib/menus.d.ts +1 -1
- package/lib/menus.js +7 -7
- package/lib/panelview/annotationPanel.d.ts +2 -2
- package/lib/panelview/annotationPanel.js +1 -1
- package/lib/panelview/components/filter-panel/Filter.d.ts +2 -2
- package/lib/panelview/components/filter-panel/Filter.js +5 -5
- package/lib/panelview/components/filter-panel/FilterRow.d.ts +2 -2
- package/lib/panelview/components/identify-panel/IdentifyPanel.d.ts +1 -1
- package/lib/panelview/components/identify-panel/IdentifyPanel.js +5 -5
- package/lib/panelview/components/layers.d.ts +1 -1
- package/lib/panelview/components/layers.js +12 -12
- package/lib/panelview/leftpanel.d.ts +4 -2
- package/lib/panelview/leftpanel.js +24 -6
- package/lib/panelview/model.d.ts +1 -1
- package/lib/panelview/objectproperties.d.ts +1 -1
- package/lib/panelview/objectproperties.js +3 -3
- package/lib/panelview/rightpanel.d.ts +2 -1
- package/lib/panelview/rightpanel.js +13 -5
- package/lib/{processing.d.ts → processing/index.d.ts} +4 -4
- package/lib/{processing.js → processing/index.js} +19 -24
- package/lib/processing/processingCommands.d.ts +6 -0
- package/lib/processing/processingCommands.js +47 -0
- package/lib/processing/processingFormToParam.d.ts +2 -0
- package/lib/processing/processingFormToParam.js +15 -0
- package/lib/shared/components/Badge.d.ts +7 -0
- package/lib/shared/components/Badge.js +20 -0
- package/lib/shared/components/Button.d.ts +9 -0
- package/lib/shared/components/Button.js +21 -0
- package/lib/shared/components/Calendar.d.ts +47 -0
- package/lib/shared/components/Calendar.js +184 -0
- package/lib/shared/components/Checkbox.d.ts +4 -0
- package/lib/shared/components/Checkbox.js +25 -0
- package/lib/shared/components/DropdownMenu.d.ts +27 -0
- package/lib/shared/components/DropdownMenu.js +92 -0
- package/lib/shared/components/Pagination.d.ts +25 -0
- package/lib/shared/components/Pagination.js +68 -0
- package/lib/shared/components/Popover.d.ts +7 -0
- package/lib/shared/components/Popover.js +32 -0
- package/lib/shared/components/Tabs.d.ts +7 -0
- package/lib/shared/components/Tabs.js +31 -0
- package/lib/shared/components/ToggleGroup.d.ts +12 -0
- package/lib/shared/components/ToggleGroup.js +52 -0
- package/lib/shared/components/loading.d.ts +12 -0
- package/lib/shared/components/loading.js +6 -0
- package/lib/shared/components/utils.d.ts +2 -0
- package/lib/shared/components/utils.js +4 -0
- package/lib/shared/hooks/useIsFirstRender.d.ts +2 -0
- package/lib/shared/hooks/useIsFirstRender.js +10 -0
- package/lib/stacBrowser/StacBrowser.d.ts +7 -0
- package/lib/stacBrowser/StacBrowser.js +16 -0
- package/lib/stacBrowser/StacPanel.d.ts +14 -0
- package/lib/stacBrowser/StacPanel.js +16 -0
- package/lib/stacBrowser/components/StacFilterSection.d.ts +23 -0
- package/lib/stacBrowser/components/StacFilterSection.js +59 -0
- package/lib/stacBrowser/components/StacPanelFilters.d.ts +14 -0
- package/lib/stacBrowser/components/StacPanelFilters.js +81 -0
- package/lib/stacBrowser/components/StacPanelResults.d.ts +13 -0
- package/lib/stacBrowser/components/StacPanelResults.js +48 -0
- package/lib/stacBrowser/components/StacPanelView.d.ts +7 -0
- package/lib/stacBrowser/components/StacPanelView.js +20 -0
- package/lib/stacBrowser/constants.d.ts +25 -0
- package/lib/stacBrowser/constants.js +197 -0
- package/lib/stacBrowser/hooks/useStacSearch.d.ts +30 -0
- package/lib/stacBrowser/hooks/useStacSearch.js +221 -0
- package/lib/stacBrowser/index.d.ts +1 -0
- package/lib/stacBrowser/index.js +1 -0
- package/lib/stacBrowser/types/types.d.ts +124 -0
- package/lib/stacBrowser/types/types.js +1 -0
- package/lib/statusbar/StatusBar.d.ts +1 -1
- package/lib/statusbar/StatusBar.js +3 -3
- package/lib/toolbar/index.d.ts +0 -1
- package/lib/toolbar/index.js +0 -1
- package/lib/toolbar/widget.d.ts +1 -0
- package/lib/toolbar/widget.js +37 -16
- package/lib/tools.d.ts +29 -4
- package/lib/tools.js +74 -69
- package/lib/types.d.ts +2 -0
- package/lib/widget.d.ts +1 -1
- package/lib/widget.js +5 -5
- package/package.json +22 -8
- package/style/base.css +26 -0
- package/style/layerBrowser.css +10 -0
- package/style/shared/badge.css +61 -0
- package/style/shared/button.css +169 -0
- package/style/shared/calendar.css +274 -0
- package/style/shared/checkbox.css +28 -0
- package/style/shared/dropdownMenu.css +240 -0
- package/style/shared/pagination.css +167 -0
- package/style/shared/popover.css +53 -0
- package/style/shared/tabs.css +57 -0
- package/style/shared/toggle.css +85 -0
- package/style/stacBrowser.css +91 -0
- package/style/symbologyDialog.css +0 -7
- package/lib/mainview/spinner.d.ts +0 -6
- package/lib/mainview/spinner.js +0 -5
- package/lib/toolbar/usertoolbaritem.d.ts +0 -19
- package/lib/toolbar/usertoolbaritem.js +0 -59
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ProcessingMerge, ProcessingLogicType, } from '@jupytergis/schema';
|
|
2
|
+
import { selectedLayerIsOfType, processSelectedLayer } from './index';
|
|
3
|
+
export function replaceInSql(sql, keyToVal, layerName) {
|
|
4
|
+
const replaceTemplateString = (args) => args.template.replace(RegExp(`{${args.variableName}}`, 'g'), args.value);
|
|
5
|
+
let out = replaceTemplateString({
|
|
6
|
+
variableName: 'layerName',
|
|
7
|
+
template: sql,
|
|
8
|
+
value: layerName,
|
|
9
|
+
});
|
|
10
|
+
for (const [key, value] of Object.entries(keyToVal)) {
|
|
11
|
+
out = replaceTemplateString({
|
|
12
|
+
variableName: key,
|
|
13
|
+
template: out,
|
|
14
|
+
value: value,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return out;
|
|
18
|
+
}
|
|
19
|
+
export function addProcessingCommands(app, commands, tracker, trans, formSchemaRegistry) {
|
|
20
|
+
for (const processingElement of ProcessingMerge) {
|
|
21
|
+
if (processingElement.type === ProcessingLogicType.vector) {
|
|
22
|
+
commands.addCommand(processingElement.name, {
|
|
23
|
+
label: trans.__(processingElement.label),
|
|
24
|
+
isEnabled: () => selectedLayerIsOfType(['VectorLayer'], tracker),
|
|
25
|
+
execute: async () => {
|
|
26
|
+
await processSelectedLayer(tracker, formSchemaRegistry, processingElement.description, {
|
|
27
|
+
sqlQueryFn: (layerName, keyToVal) => replaceInSql(processingElement.operations.sql, keyToVal, layerName),
|
|
28
|
+
gdalFunction: processingElement.operations.gdalFunction,
|
|
29
|
+
options: (sqlQuery) => [
|
|
30
|
+
'-f',
|
|
31
|
+
'GeoJSON',
|
|
32
|
+
'-dialect',
|
|
33
|
+
'SQLITE',
|
|
34
|
+
'-sql',
|
|
35
|
+
sqlQuery,
|
|
36
|
+
'output.geojson',
|
|
37
|
+
],
|
|
38
|
+
}, app);
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
console.error('Unsupported process type');
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { processingList, ProcessingMerge, } from '@jupytergis/schema';
|
|
2
|
+
export function processingFormToParam(formValues, processingType) {
|
|
3
|
+
if (!processingList.includes(processingType)) {
|
|
4
|
+
console.error(`Unsupported processing type: ${processingType}`);
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
const processingElement = ProcessingMerge.find(e => e.description === processingType);
|
|
8
|
+
const params = processingElement.operationParams;
|
|
9
|
+
const out = {};
|
|
10
|
+
for (let i = 0; i < params.length; i++) {
|
|
11
|
+
const param = params[i];
|
|
12
|
+
out[param] = formValues[param];
|
|
13
|
+
}
|
|
14
|
+
return out;
|
|
15
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface IBadgeProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
variant?: 'destructive' | 'outline' | 'secondary';
|
|
4
|
+
size?: 'sm' | 'lg' | 'icon';
|
|
5
|
+
}
|
|
6
|
+
declare function Badge({ variant, className, ...props }: IBadgeProps): React.JSX.Element;
|
|
7
|
+
export default Badge;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import * as React from 'react';
|
|
13
|
+
import { cn } from './utils';
|
|
14
|
+
function Badge(_a) {
|
|
15
|
+
var { variant, className } = _a, props = __rest(_a, ["variant", "className"]);
|
|
16
|
+
return (
|
|
17
|
+
// @ts-expect-error lol
|
|
18
|
+
React.createElement("div", Object.assign({ "data-variant": variant, className: cn('jgis-badge', className) }, props)));
|
|
19
|
+
}
|
|
20
|
+
export default Badge;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface IButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
asChild?: boolean;
|
|
4
|
+
variant?: 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link' | 'icon';
|
|
5
|
+
size?: 'sm' | 'lg' | 'icon' | 'icon-sm';
|
|
6
|
+
}
|
|
7
|
+
declare const Button: React.ForwardRefExoticComponent<IButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
export { Button };
|
|
9
|
+
export type { IButtonProps as ButtonProps };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { cn } from './utils';
|
|
15
|
+
const Button = React.forwardRef((_a, ref) => {
|
|
16
|
+
var { variant, className, size, asChild = false } = _a, props = __rest(_a, ["variant", "className", "size", "asChild"]);
|
|
17
|
+
const Comp = asChild ? Slot : 'button';
|
|
18
|
+
return (React.createElement(Comp, Object.assign({ "data-size": size, "data-variant": variant, className: cn('jgis-button', className), ref: ref }, props)));
|
|
19
|
+
});
|
|
20
|
+
Button.displayName = 'Button';
|
|
21
|
+
export { Button };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type DayPickerProps } from 'react-day-picker';
|
|
3
|
+
export type CalendarProps = DayPickerProps & {
|
|
4
|
+
/**
|
|
5
|
+
* In the year view, the number of years to display at once.
|
|
6
|
+
* @default 12
|
|
7
|
+
*/
|
|
8
|
+
yearRange?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Wether to show the year switcher in the caption.
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
showYearSwitcher?: boolean;
|
|
14
|
+
monthsClassName?: string;
|
|
15
|
+
monthCaptionClassName?: string;
|
|
16
|
+
weekdaysClassName?: string;
|
|
17
|
+
weekdayClassName?: string;
|
|
18
|
+
monthClassName?: string;
|
|
19
|
+
captionClassName?: string;
|
|
20
|
+
captionLabelClassName?: string;
|
|
21
|
+
buttonNextClassName?: string;
|
|
22
|
+
buttonPreviousClassName?: string;
|
|
23
|
+
navClassName?: string;
|
|
24
|
+
monthGridClassName?: string;
|
|
25
|
+
weekClassName?: string;
|
|
26
|
+
dayClassName?: string;
|
|
27
|
+
dayButtonClassName?: string;
|
|
28
|
+
rangeStartClassName?: string;
|
|
29
|
+
rangeEndClassName?: string;
|
|
30
|
+
selectedClassName?: string;
|
|
31
|
+
todayClassName?: string;
|
|
32
|
+
outsideClassName?: string;
|
|
33
|
+
disabledClassName?: string;
|
|
34
|
+
rangeMiddleClassName?: string;
|
|
35
|
+
hiddenClassName?: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* A custom calendar component built on top of react-day-picker.
|
|
39
|
+
* @param props The props for the calendar.
|
|
40
|
+
* @default yearRange 12
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
declare function Calendar({ className, showOutsideDays, showYearSwitcher, yearRange, numberOfMonths, components, ...props }: CalendarProps): React.JSX.Element;
|
|
44
|
+
declare namespace Calendar {
|
|
45
|
+
var displayName: string;
|
|
46
|
+
}
|
|
47
|
+
export { Calendar };
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { differenceInCalendarDays } from 'date-fns';
|
|
14
|
+
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
15
|
+
import * as React from 'react';
|
|
16
|
+
import { DayPicker, labelNext, labelPrevious, useDayPicker, } from 'react-day-picker';
|
|
17
|
+
import { Button } from './Button';
|
|
18
|
+
import { cn } from './utils';
|
|
19
|
+
/**
|
|
20
|
+
* A custom calendar component built on top of react-day-picker.
|
|
21
|
+
* @param props The props for the calendar.
|
|
22
|
+
* @default yearRange 12
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
function Calendar(_a) {
|
|
26
|
+
var { className, showOutsideDays = true, showYearSwitcher = true, yearRange = 12, numberOfMonths, components } = _a, props = __rest(_a, ["className", "showOutsideDays", "showYearSwitcher", "yearRange", "numberOfMonths", "components"]);
|
|
27
|
+
const [navView, setNavView] = React.useState('days');
|
|
28
|
+
const [displayYears, setDisplayYears] = React.useState(React.useMemo(() => {
|
|
29
|
+
const currentYear = new Date().getFullYear();
|
|
30
|
+
return {
|
|
31
|
+
from: currentYear - Math.floor(yearRange / 2 - 1),
|
|
32
|
+
to: currentYear + Math.ceil(yearRange / 2),
|
|
33
|
+
};
|
|
34
|
+
}, [yearRange]));
|
|
35
|
+
const { onNextClick, onPrevClick, startMonth, endMonth } = props;
|
|
36
|
+
const columnsDisplayed = navView === 'years' ? 1 : numberOfMonths;
|
|
37
|
+
const _monthsClassName = cn('jgis-calendar-months', props.monthsClassName);
|
|
38
|
+
const _monthCaptionClassName = cn('jgis-calendar-month-caption', props.monthCaptionClassName);
|
|
39
|
+
const _weekdaysClassName = cn('jgis-calendar-weekdays', props.weekdaysClassName);
|
|
40
|
+
const _weekdayClassName = cn('jgis-calendar-weekday', props.weekdayClassName);
|
|
41
|
+
const _monthClassName = cn('jgis-calendar-month', props.monthClassName);
|
|
42
|
+
const _captionClassName = cn('jgis-calendar-month-caption', props.captionClassName);
|
|
43
|
+
const _captionLabelClassName = cn('jgis-calendar-caption-label', props.captionLabelClassName);
|
|
44
|
+
const _buttonNextClassName = cn('jgis-calendar-button-next', props.buttonNextClassName);
|
|
45
|
+
const _buttonPreviousClassName = cn('jgis-calendar-button-previous', props.buttonPreviousClassName);
|
|
46
|
+
const _navClassName = cn('jgis-calendar-nav', props.navClassName);
|
|
47
|
+
const _monthGridClassName = cn('jgis-calendar-month-grid', props.monthGridClassName);
|
|
48
|
+
const _weekClassName = cn('jgis-calendar-week', props.weekClassName);
|
|
49
|
+
const _dayClassName = cn('jgis-calendar-day', props.dayClassName);
|
|
50
|
+
const _dayButtonClassName = cn('jgis-calendar-day-button', props.dayButtonClassName);
|
|
51
|
+
const _rangeStartClassName = cn('jgis-calendar-day-button range-start', props.rangeStartClassName);
|
|
52
|
+
const _rangeEndClassName = cn('jgis-calendar-day-button range-end', props.rangeEndClassName);
|
|
53
|
+
const _rangeMiddleClassName = cn('jgis-calendar-range-middle', props.rangeMiddleClassName);
|
|
54
|
+
const _selectedClassName = cn('jgis-calendar-day-selected', props.selectedClassName);
|
|
55
|
+
// const _todayClassName = cn('jgis-calendar-day-today', props.todayClassName);
|
|
56
|
+
const _outsideClassName = cn('jgis-calendar-day-outside', props.outsideClassName);
|
|
57
|
+
const _disabledClassName = cn('jgis-calendar-day-disabled', props.disabledClassName);
|
|
58
|
+
const _hiddenClassName = cn('jgis-calendar-hidden', props.hiddenClassName);
|
|
59
|
+
return (React.createElement(DayPicker, Object.assign({ showOutsideDays: showOutsideDays, className: cn('jgis-calendar-container', className), style: {
|
|
60
|
+
width: 248.8 * (columnsDisplayed !== null && columnsDisplayed !== void 0 ? columnsDisplayed : 1) + 'px',
|
|
61
|
+
}, classNames: {
|
|
62
|
+
months: _monthsClassName,
|
|
63
|
+
month_caption: _monthCaptionClassName,
|
|
64
|
+
weekdays: _weekdaysClassName,
|
|
65
|
+
weekday: _weekdayClassName,
|
|
66
|
+
month: _monthClassName,
|
|
67
|
+
caption: _captionClassName,
|
|
68
|
+
caption_label: _captionLabelClassName,
|
|
69
|
+
button_next: _buttonNextClassName,
|
|
70
|
+
button_previous: _buttonPreviousClassName,
|
|
71
|
+
nav: _navClassName,
|
|
72
|
+
month_grid: _monthGridClassName,
|
|
73
|
+
week: _weekClassName,
|
|
74
|
+
day: _dayClassName,
|
|
75
|
+
day_button: _dayButtonClassName,
|
|
76
|
+
range_start: _rangeStartClassName,
|
|
77
|
+
range_middle: _rangeMiddleClassName,
|
|
78
|
+
range_end: _rangeEndClassName,
|
|
79
|
+
selected: _selectedClassName,
|
|
80
|
+
// today: _todayClassName,
|
|
81
|
+
outside: _outsideClassName,
|
|
82
|
+
disabled: _disabledClassName,
|
|
83
|
+
hidden: _hiddenClassName,
|
|
84
|
+
}, components: Object.assign({ Chevron: ({ orientation }) => {
|
|
85
|
+
const Icon = orientation === 'left' ? ChevronLeft : ChevronRight;
|
|
86
|
+
return React.createElement(Icon, { className: "h-4 w-4" });
|
|
87
|
+
}, Nav: ({ className }) => (React.createElement(Nav, { className: className, displayYears: displayYears, navView: navView, setDisplayYears: setDisplayYears, startMonth: startMonth, endMonth: endMonth, onPrevClick: onPrevClick, onNextClick: onNextClick })), CaptionLabel: props => (React.createElement(CaptionLabel, Object.assign({ showYearSwitcher: showYearSwitcher, navView: navView, setNavView: setNavView, displayYears: displayYears }, props))), MonthGrid: (_a) => {
|
|
88
|
+
var { className, children } = _a, props = __rest(_a, ["className", "children"]);
|
|
89
|
+
return (React.createElement(MonthGrid, Object.assign({ children: children, className: className, displayYears: displayYears, startMonth: startMonth, endMonth: endMonth, navView: navView, setNavView: setNavView }, props)));
|
|
90
|
+
} }, components), numberOfMonths: columnsDisplayed, timeZone: "UTC" }, props)));
|
|
91
|
+
}
|
|
92
|
+
Calendar.displayName = 'Calendar';
|
|
93
|
+
function Nav({ className, navView, startMonth, endMonth, displayYears, setDisplayYears, onPrevClick, onNextClick, }) {
|
|
94
|
+
const { nextMonth, previousMonth, goToMonth } = useDayPicker();
|
|
95
|
+
const isPreviousDisabled = (() => {
|
|
96
|
+
if (navView === 'years') {
|
|
97
|
+
return ((startMonth &&
|
|
98
|
+
differenceInCalendarDays(new Date(displayYears.from - 1, 0, 1), startMonth) < 0) ||
|
|
99
|
+
(endMonth &&
|
|
100
|
+
differenceInCalendarDays(new Date(displayYears.from - 1, 0, 1), endMonth) > 0));
|
|
101
|
+
}
|
|
102
|
+
return !previousMonth;
|
|
103
|
+
})();
|
|
104
|
+
const isNextDisabled = (() => {
|
|
105
|
+
if (navView === 'years') {
|
|
106
|
+
return ((startMonth &&
|
|
107
|
+
differenceInCalendarDays(new Date(displayYears.to + 1, 0, 1), startMonth) < 0) ||
|
|
108
|
+
(endMonth &&
|
|
109
|
+
differenceInCalendarDays(new Date(displayYears.to + 1, 0, 1), endMonth) > 0));
|
|
110
|
+
}
|
|
111
|
+
return !nextMonth;
|
|
112
|
+
})();
|
|
113
|
+
const handlePreviousClick = React.useCallback(() => {
|
|
114
|
+
if (!previousMonth) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (navView === 'years') {
|
|
118
|
+
setDisplayYears(prev => ({
|
|
119
|
+
from: prev.from - (prev.to - prev.from + 1),
|
|
120
|
+
to: prev.to - (prev.to - prev.from + 1),
|
|
121
|
+
}));
|
|
122
|
+
onPrevClick === null || onPrevClick === void 0 ? void 0 : onPrevClick(new Date(displayYears.from - (displayYears.to - displayYears.from), 0, 1));
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
goToMonth(previousMonth);
|
|
126
|
+
onPrevClick === null || onPrevClick === void 0 ? void 0 : onPrevClick(previousMonth);
|
|
127
|
+
}, [previousMonth, goToMonth]);
|
|
128
|
+
const handleNextClick = React.useCallback(() => {
|
|
129
|
+
if (!nextMonth) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (navView === 'years') {
|
|
133
|
+
setDisplayYears(prev => ({
|
|
134
|
+
from: prev.from + (prev.to - prev.from + 1),
|
|
135
|
+
to: prev.to + (prev.to - prev.from + 1),
|
|
136
|
+
}));
|
|
137
|
+
onNextClick === null || onNextClick === void 0 ? void 0 : onNextClick(new Date(displayYears.from + (displayYears.to - displayYears.from), 0, 1));
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
goToMonth(nextMonth);
|
|
141
|
+
onNextClick === null || onNextClick === void 0 ? void 0 : onNextClick(nextMonth);
|
|
142
|
+
}, [goToMonth, nextMonth]);
|
|
143
|
+
return (React.createElement("nav", { className: cn('jgis-calendar-nav', className) },
|
|
144
|
+
React.createElement(Button, { variant: "ghost", className: "jgis-calendar-button-previous", type: "button", tabIndex: isPreviousDisabled ? undefined : -1, disabled: isPreviousDisabled, "aria-label": navView === 'years'
|
|
145
|
+
? `Go to the previous ${displayYears.to - displayYears.from + 1} years`
|
|
146
|
+
: labelPrevious(previousMonth), onClick: handlePreviousClick },
|
|
147
|
+
React.createElement(ChevronLeft, { className: "h-4 w-4" })),
|
|
148
|
+
React.createElement(Button, { variant: "ghost", className: "jgis-calendar-button-next", type: "button", tabIndex: isNextDisabled ? undefined : -1, disabled: isNextDisabled, "aria-label": navView === 'years'
|
|
149
|
+
? `Go to the next ${displayYears.to - displayYears.from + 1} years`
|
|
150
|
+
: labelNext(nextMonth), onClick: handleNextClick },
|
|
151
|
+
React.createElement(ChevronRight, { className: "h-4 w-4" }))));
|
|
152
|
+
}
|
|
153
|
+
function CaptionLabel(_a) {
|
|
154
|
+
var { children, showYearSwitcher, navView, setNavView, displayYears } = _a, props = __rest(_a, ["children", "showYearSwitcher", "navView", "setNavView", "displayYears"]);
|
|
155
|
+
if (!showYearSwitcher) {
|
|
156
|
+
return React.createElement("span", Object.assign({}, props), children);
|
|
157
|
+
}
|
|
158
|
+
return (React.createElement(Button, { className: "jgis-calendar-caption-button", variant: "ghost", size: "sm", onClick: () => setNavView(prev => (prev === 'days' ? 'years' : 'days')) }, navView === 'days'
|
|
159
|
+
? children
|
|
160
|
+
: displayYears.from + ' - ' + displayYears.to));
|
|
161
|
+
}
|
|
162
|
+
function MonthGrid(_a) {
|
|
163
|
+
var { className, children, displayYears, startMonth, endMonth, navView, setNavView } = _a, props = __rest(_a, ["className", "children", "displayYears", "startMonth", "endMonth", "navView", "setNavView"]);
|
|
164
|
+
if (navView === 'years') {
|
|
165
|
+
return (React.createElement(YearGrid, Object.assign({ displayYears: displayYears, startMonth: startMonth, endMonth: endMonth, setNavView: setNavView, navView: navView, className: className }, props)));
|
|
166
|
+
}
|
|
167
|
+
return (React.createElement("table", Object.assign({ className: className }, props), children));
|
|
168
|
+
}
|
|
169
|
+
function YearGrid(_a) {
|
|
170
|
+
var { className, displayYears, startMonth, endMonth, setNavView, navView } = _a, props = __rest(_a, ["className", "displayYears", "startMonth", "endMonth", "setNavView", "navView"]);
|
|
171
|
+
const { goToMonth, selected } = useDayPicker();
|
|
172
|
+
return (React.createElement("div", Object.assign({ className: cn('jgis-calendar-year-grid', className) }, props), Array.from({ length: displayYears.to - displayYears.from + 1 }, (_, i) => {
|
|
173
|
+
const isBefore = differenceInCalendarDays(new Date(displayYears.from + i, 11, 31), startMonth) < 0;
|
|
174
|
+
const isAfter = differenceInCalendarDays(new Date(displayYears.from + i, 0, 0), endMonth) > 0;
|
|
175
|
+
const isDisabled = isBefore || isAfter;
|
|
176
|
+
return (React.createElement(Button, { key: i, className: cn('jgis-calendar-year-button', displayYears.from + i === new Date().getFullYear() &&
|
|
177
|
+
'jgis-calendar-year-button-current', isDisabled && 'jgis-calendar-year-button-disabled'), variant: "ghost", onClick: () => {
|
|
178
|
+
var _a;
|
|
179
|
+
setNavView('days');
|
|
180
|
+
goToMonth(new Date(displayYears.from + i, (_a = selected === null || selected === void 0 ? void 0 : selected.getMonth()) !== null && _a !== void 0 ? _a : 0));
|
|
181
|
+
}, disabled: navView === 'years' ? isDisabled : undefined }, displayYears.from + i));
|
|
182
|
+
})));
|
|
183
|
+
}
|
|
184
|
+
export { Calendar };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
4
|
+
export default Checkbox;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
13
|
+
import { Check } from 'lucide-react';
|
|
14
|
+
import * as React from 'react';
|
|
15
|
+
const Checkbox = React.forwardRef((_a, ref) => {
|
|
16
|
+
var props = __rest(_a, []);
|
|
17
|
+
return (React.createElement(CheckboxPrimitive.Root, Object.assign({ ref: ref, className: 'jgis-checkbox' }, props),
|
|
18
|
+
React.createElement(CheckboxPrimitive.Indicator, { className: 'jgis-checkbox-indicator' },
|
|
19
|
+
React.createElement(Check, { style: {
|
|
20
|
+
height: '1rem',
|
|
21
|
+
width: '1rem',
|
|
22
|
+
} }))));
|
|
23
|
+
});
|
|
24
|
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
25
|
+
export default Checkbox;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare const DropdownMenu: React.FC<DropdownMenuPrimitive.DropdownMenuProps>;
|
|
4
|
+
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
declare const DropdownMenuGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
declare const DropdownMenuPortal: React.FC<DropdownMenuPrimitive.DropdownMenuPortalProps>;
|
|
7
|
+
declare const DropdownMenuSub: React.FC<DropdownMenuPrimitive.DropdownMenuSubProps>;
|
|
8
|
+
declare const DropdownMenuRadioGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const DropdownMenuSubTrigger: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
10
|
+
inset?: boolean;
|
|
11
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
declare const DropdownMenuSubContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
declare const DropdownMenuContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
declare const DropdownMenuItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
15
|
+
inset?: boolean;
|
|
16
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
declare const DropdownMenuCheckboxItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
declare const DropdownMenuRadioItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuRadioItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
declare const DropdownMenuLabel: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
20
|
+
inset?: boolean;
|
|
21
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
declare const DropdownMenuSeparator: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
23
|
+
declare const DropdownMenuShortcut: {
|
|
24
|
+
({ ...props }: React.HTMLAttributes<HTMLSpanElement>): React.JSX.Element;
|
|
25
|
+
displayName: string;
|
|
26
|
+
};
|
|
27
|
+
export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuGroup, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup, };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
13
|
+
import { Check, ChevronRight, Circle } from 'lucide-react';
|
|
14
|
+
import * as React from 'react';
|
|
15
|
+
const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
16
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
17
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
18
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
19
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
20
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
21
|
+
const DropdownMenuSubTrigger = React.forwardRef((_a, ref) => {
|
|
22
|
+
var { inset, children } = _a, props = __rest(_a, ["inset", "children"]);
|
|
23
|
+
return (React.createElement(DropdownMenuPrimitive.SubTrigger, Object.assign({ ref: ref, className: 'jgis-dropdown-menu-sub-trigger', style: {
|
|
24
|
+
paddingLeft: inset ? '2rem' : '0.5rem',
|
|
25
|
+
} }, props),
|
|
26
|
+
children,
|
|
27
|
+
React.createElement(ChevronRight, { className: "jgis-dropdown-menu-icon" })));
|
|
28
|
+
});
|
|
29
|
+
DropdownMenuSubTrigger.displayName =
|
|
30
|
+
DropdownMenuPrimitive.SubTrigger.displayName;
|
|
31
|
+
const DropdownMenuSubContent = React.forwardRef((_a, ref) => {
|
|
32
|
+
var props = __rest(_a, []);
|
|
33
|
+
return (React.createElement(DropdownMenuPrimitive.SubContent, Object.assign({ ref: ref, className: 'jgis-dropdown-menu-sub-content' }, props)));
|
|
34
|
+
});
|
|
35
|
+
DropdownMenuSubContent.displayName =
|
|
36
|
+
DropdownMenuPrimitive.SubContent.displayName;
|
|
37
|
+
const DropdownMenuContent = React.forwardRef((_a, ref) => {
|
|
38
|
+
var { sideOffset = 4 } = _a, props = __rest(_a, ["sideOffset"]);
|
|
39
|
+
return (React.createElement(DropdownMenuPrimitive.Portal, { container: document.querySelector('#main') },
|
|
40
|
+
React.createElement(DropdownMenuPrimitive.Content, Object.assign({ ref: ref, sideOffset: sideOffset, className: 'jgis-dropdown-menu-content' }, props))));
|
|
41
|
+
});
|
|
42
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
43
|
+
const DropdownMenuItem = React.forwardRef((_a, ref) => {
|
|
44
|
+
var { inset } = _a, props = __rest(_a, ["inset"]);
|
|
45
|
+
return (React.createElement(DropdownMenuPrimitive.Item, Object.assign({ ref: ref, className: 'jgis-dropdown-menu-item', style: {
|
|
46
|
+
paddingLeft: inset ? '2rem' : '0.5rem',
|
|
47
|
+
} }, props)));
|
|
48
|
+
});
|
|
49
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
50
|
+
const DropdownMenuCheckboxItem = React.forwardRef((_a, ref) => {
|
|
51
|
+
var { children, checked } = _a, props = __rest(_a, ["children", "checked"]);
|
|
52
|
+
return (React.createElement(DropdownMenuPrimitive.CheckboxItem, Object.assign({ ref: ref, className: 'jgis-dropdown-menu-checkbox-item', checked: checked }, props),
|
|
53
|
+
React.createElement("span", { className: 'jgis-dropdown-menu-checkbox-item-span' },
|
|
54
|
+
React.createElement(DropdownMenuPrimitive.ItemIndicator, null,
|
|
55
|
+
React.createElement(Check, { style: {
|
|
56
|
+
height: '1rem',
|
|
57
|
+
width: '1rem',
|
|
58
|
+
} }))),
|
|
59
|
+
children));
|
|
60
|
+
});
|
|
61
|
+
DropdownMenuCheckboxItem.displayName =
|
|
62
|
+
DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
63
|
+
const DropdownMenuRadioItem = React.forwardRef((_a, ref) => {
|
|
64
|
+
var { children } = _a, props = __rest(_a, ["children"]);
|
|
65
|
+
return (React.createElement(DropdownMenuPrimitive.RadioItem, Object.assign({ ref: ref, className: 'jgis-dropdown-menu-radio-item' }, props),
|
|
66
|
+
React.createElement("span", { className: 'jgis-dropdown-menu-radio-item-span' },
|
|
67
|
+
React.createElement(DropdownMenuPrimitive.ItemIndicator, null,
|
|
68
|
+
React.createElement(Circle, { color: "currentColor", style: {
|
|
69
|
+
height: '0.5rem',
|
|
70
|
+
width: '0.5rem',
|
|
71
|
+
} }))),
|
|
72
|
+
children));
|
|
73
|
+
});
|
|
74
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
75
|
+
const DropdownMenuLabel = React.forwardRef((_a, ref) => {
|
|
76
|
+
var { inset } = _a, props = __rest(_a, ["inset"]);
|
|
77
|
+
return (React.createElement(DropdownMenuPrimitive.Label, Object.assign({ ref: ref, className: 'jgis-dropdown-menu-label', style: {
|
|
78
|
+
paddingLeft: inset ? '2rem' : '0.5rem',
|
|
79
|
+
} }, props)));
|
|
80
|
+
});
|
|
81
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
82
|
+
const DropdownMenuSeparator = React.forwardRef((_a, ref) => {
|
|
83
|
+
var props = __rest(_a, []);
|
|
84
|
+
return (React.createElement(DropdownMenuPrimitive.Separator, Object.assign({ ref: ref, className: 'jgis-dropdown-menu-separator' }, props)));
|
|
85
|
+
});
|
|
86
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
87
|
+
const DropdownMenuShortcut = (_a) => {
|
|
88
|
+
var props = __rest(_a, []);
|
|
89
|
+
return React.createElement("span", Object.assign({ className: 'jgis-dropdown-menu-shortcut' }, props));
|
|
90
|
+
};
|
|
91
|
+
DropdownMenuShortcut.displayName = 'DropdownMenuShortcut';
|
|
92
|
+
export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuGroup, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup, };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ButtonProps } from './Button';
|
|
3
|
+
declare const Pagination: React.FC<React.ComponentProps<'nav'>>;
|
|
4
|
+
declare const PaginationContent: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref"> & React.RefAttributes<HTMLUListElement>>;
|
|
5
|
+
declare const PaginationItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
6
|
+
type PaginationLinkProps = {
|
|
7
|
+
isActive?: boolean;
|
|
8
|
+
} & Pick<ButtonProps, 'size'> & React.ComponentProps<'button'>;
|
|
9
|
+
declare const PaginationLink: {
|
|
10
|
+
({ isActive, size, ...props }: PaginationLinkProps): React.JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
declare const PaginationPrevious: {
|
|
14
|
+
({ ...props }: React.ComponentProps<typeof PaginationLink>): React.JSX.Element;
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
|
17
|
+
declare const PaginationNext: {
|
|
18
|
+
({ ...props }: React.ComponentProps<typeof PaginationLink>): React.JSX.Element;
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|
|
21
|
+
declare const PaginationEllipsis: {
|
|
22
|
+
({ ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
23
|
+
displayName: string;
|
|
24
|
+
};
|
|
25
|
+
export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { ChevronLeft, ChevronRight, MoreHorizontal } from 'lucide-react';
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { Button } from './Button';
|
|
15
|
+
const Pagination = (_a) => {
|
|
16
|
+
var props = __rest(_a, []);
|
|
17
|
+
return (React.createElement("nav", Object.assign({ role: "navigation", "aria-label": "pagination", className: 'jgis-pagination' }, props)));
|
|
18
|
+
};
|
|
19
|
+
Pagination.displayName = 'Pagination';
|
|
20
|
+
const PaginationContent = React.forwardRef((_a, ref) => {
|
|
21
|
+
var props = __rest(_a, []);
|
|
22
|
+
return (React.createElement("ul", Object.assign({ ref: ref, className: 'jgis-pagination-content' }, props)));
|
|
23
|
+
});
|
|
24
|
+
PaginationContent.displayName = 'PaginationContent';
|
|
25
|
+
const PaginationItem = React.forwardRef((_a, ref) => {
|
|
26
|
+
var props = __rest(_a, []);
|
|
27
|
+
return React.createElement("li", Object.assign({ ref: ref, className: "" }, props));
|
|
28
|
+
});
|
|
29
|
+
PaginationItem.displayName = 'PaginationItem';
|
|
30
|
+
const PaginationLink = (_a) => {
|
|
31
|
+
var { isActive, size = 'icon' } = _a, props = __rest(_a, ["isActive", "size"]);
|
|
32
|
+
return (React.createElement(Button, Object.assign({ "aria-current": isActive ? 'page' : undefined, "data-variant": isActive ? 'outline' : 'ghost', "data-size": size, className: 'jgis-pagination-link' }, props)));
|
|
33
|
+
};
|
|
34
|
+
PaginationLink.displayName = 'PaginationLink';
|
|
35
|
+
// size is 'default' from both next and previous
|
|
36
|
+
const PaginationPrevious = (_a) => {
|
|
37
|
+
var props = __rest(_a, []);
|
|
38
|
+
return (React.createElement(PaginationLink, Object.assign({ "aria-label": "Go to previous page", className: 'jgis-pagination-previous' }, props),
|
|
39
|
+
React.createElement(ChevronLeft, { style: {
|
|
40
|
+
height: '1rem',
|
|
41
|
+
width: '1rem',
|
|
42
|
+
flexShrink: 0,
|
|
43
|
+
} }),
|
|
44
|
+
React.createElement("span", null, "Prev")));
|
|
45
|
+
};
|
|
46
|
+
PaginationPrevious.displayName = 'PaginationPrevious';
|
|
47
|
+
const PaginationNext = (_a) => {
|
|
48
|
+
var props = __rest(_a, []);
|
|
49
|
+
return (React.createElement(PaginationLink, Object.assign({ "aria-label": "Go to next page", className: 'jgis-pagination-next' }, props),
|
|
50
|
+
React.createElement("span", null, "Next"),
|
|
51
|
+
React.createElement(ChevronRight, { style: {
|
|
52
|
+
height: '1rem',
|
|
53
|
+
width: '1rem',
|
|
54
|
+
flexShrink: 0,
|
|
55
|
+
} })));
|
|
56
|
+
};
|
|
57
|
+
PaginationNext.displayName = 'PaginationNext';
|
|
58
|
+
const PaginationEllipsis = (_a) => {
|
|
59
|
+
var props = __rest(_a, []);
|
|
60
|
+
return (React.createElement("span", Object.assign({ "aria-hidden": true, className: 'jgis-pagination-ellipsis' }, props),
|
|
61
|
+
React.createElement(MoreHorizontal, { style: {
|
|
62
|
+
height: '1rem',
|
|
63
|
+
width: '1rem',
|
|
64
|
+
} }),
|
|
65
|
+
React.createElement("span", { className: "sr-only" }, "More pages")));
|
|
66
|
+
};
|
|
67
|
+
PaginationEllipsis.displayName = 'PaginationEllipsis';
|
|
68
|
+
export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare const Popover: React.FC<React.ComponentProps<typeof PopoverPrimitive.Root>>;
|
|
4
|
+
declare const PopoverTrigger: React.FC<React.ComponentProps<typeof PopoverPrimitive.Trigger>>;
|
|
5
|
+
declare const PopoverContent: React.FC<React.ComponentProps<typeof PopoverPrimitive.Content>>;
|
|
6
|
+
declare const PopoverAnchor: React.FC<React.ComponentProps<typeof PopoverPrimitive.Anchor>>;
|
|
7
|
+
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger };
|