@juv/codego-react-ui 3.5.4 → 3.5.6
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 +47 -0
- package/dist/index.cjs +27 -3
- package/dist/index.d.cts +39 -3
- package/dist/index.d.ts +39 -3
- package/dist/index.global.js +22 -3
- package/dist/index.js +22 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -739,6 +739,53 @@ function AnnouncementsPage() {
|
|
|
739
739
|
|
|
740
740
|
---
|
|
741
741
|
|
|
742
|
+
## Laravel Response Decryption
|
|
743
|
+
|
|
744
|
+
Use `decryptResponse` to decrypt Laravel-encrypted API responses (AES-256-CBC).
|
|
745
|
+
|
|
746
|
+
### Setup
|
|
747
|
+
|
|
748
|
+
Add your Laravel `APP_KEY` to `.env`:
|
|
749
|
+
|
|
750
|
+
```env
|
|
751
|
+
VITE_LARAVEL_KEY=base64:your_laravel_app_key_here
|
|
752
|
+
```
|
|
753
|
+
|
|
754
|
+
### Usage
|
|
755
|
+
|
|
756
|
+
```tsx
|
|
757
|
+
import { api, decryptResponse } from "@juv/codego-react-ui"
|
|
758
|
+
|
|
759
|
+
type Certificate = { id: number; name: string }
|
|
760
|
+
|
|
761
|
+
const fetchCertificates = async () => {
|
|
762
|
+
const data = await api.get<string>('/certificate')
|
|
763
|
+
const decoded = decryptResponse<Certificate[]>(data)
|
|
764
|
+
console.log(decoded)
|
|
765
|
+
}
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
> `api.get` should be typed as `string` since the raw response is an encrypted payload. `decryptResponse` reads `VITE_LARAVEL_KEY` automatically.
|
|
769
|
+
|
|
770
|
+
You can also pass the key explicitly:
|
|
771
|
+
|
|
772
|
+
```tsx
|
|
773
|
+
const decoded = decryptResponse<Certificate[]>(data, "base64:your_key_here")
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
### API
|
|
777
|
+
|
|
778
|
+
| Export | Description |
|
|
779
|
+
|---|---|
|
|
780
|
+
| `decryptResponse(response, key?)` | Decrypts a Laravel-encrypted string or `{ data: string }` object. |
|
|
781
|
+
| `decryptLaravelPayload(payload, key?)` | Low-level decryption of a raw encrypted payload string. |
|
|
782
|
+
| `getLaravelSecretKey()` | Reads the key from `VITE_LARAVEL_KEY`, `REACT_APP_LARAVEL_KEY`, or `window.__LARAVEL_KEY__`. |
|
|
783
|
+
| `parseLaravelKey(secretKey)` | Parses a `base64:...` or raw key string into a `CryptoJS.WordArray`. |
|
|
784
|
+
| `parseLaravelEncryptedPayload(payload)` | Parses a base64-encoded Laravel encrypted payload into `{ iv, value, mac }`. |
|
|
785
|
+
| `LaravelEncryptedPayload` | Type for the parsed payload object. |
|
|
786
|
+
|
|
787
|
+
---
|
|
788
|
+
|
|
742
789
|
## Run Locally
|
|
743
790
|
|
|
744
791
|
**Prerequisites:** Node.js
|
package/dist/index.cjs
CHANGED
|
@@ -127,6 +127,11 @@ __export(index_exports, {
|
|
|
127
127
|
Wizard: () => Wizard,
|
|
128
128
|
api: () => api,
|
|
129
129
|
createStore: () => createStore,
|
|
130
|
+
decryptLaravelPayload: () => decryptLaravelPayload,
|
|
131
|
+
decryptResponse: () => decryptResponse,
|
|
132
|
+
getLaravelSecretKey: () => getLaravelSecretKey,
|
|
133
|
+
parseLaravelEncryptedPayload: () => parseLaravelEncryptedPayload,
|
|
134
|
+
parseLaravelKey: () => parseLaravelKey,
|
|
130
135
|
useServerBulletin: () => useServerBulletin,
|
|
131
136
|
useServerDataGrid: () => useServerDataGrid,
|
|
132
137
|
useServerTable: () => useServerTable,
|
|
@@ -2155,7 +2160,7 @@ function useServerBulletin({
|
|
|
2155
2160
|
reload: () => setTick((t) => t + 1)
|
|
2156
2161
|
};
|
|
2157
2162
|
}
|
|
2158
|
-
function BulletinPreview({ item, onClose, onEdit, onDelete, onView, customActions }) {
|
|
2163
|
+
function BulletinPreview({ item, onClose, onEdit, onDelete, onView, customActions, headerAction, footerAction }) {
|
|
2159
2164
|
const priority = item.priority ? PRIORITY_CONFIG[item.priority] : null;
|
|
2160
2165
|
return (0, import_react_dom.createPortal)(
|
|
2161
2166
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
@@ -2174,7 +2179,8 @@ function BulletinPreview({ item, onClose, onEdit, onDelete, onView, customAction
|
|
|
2174
2179
|
" Pinned"
|
|
2175
2180
|
] }),
|
|
2176
2181
|
priority && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: priority.badge, size: "sm", icon: priority.icon ?? void 0, children: priority.label }),
|
|
2177
|
-
item.category && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: "outline", size: "sm", children: item.category })
|
|
2182
|
+
item.category && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: "outline", size: "sm", children: item.category }),
|
|
2183
|
+
headerAction
|
|
2178
2184
|
] }),
|
|
2179
2185
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
2180
2186
|
onEdit && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
@@ -2273,6 +2279,7 @@ function BulletinPreview({ item, onClose, onEdit, onDelete, onView, customAction
|
|
|
2273
2279
|
] })
|
|
2274
2280
|
] }) }),
|
|
2275
2281
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2282
|
+
footerAction,
|
|
2276
2283
|
onEdit && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
2277
2284
|
"button",
|
|
2278
2285
|
{
|
|
@@ -2667,6 +2674,9 @@ function BulletinBoard({
|
|
|
2667
2674
|
deleteBaseUrl,
|
|
2668
2675
|
deleteIdKey = "id",
|
|
2669
2676
|
serverPagination,
|
|
2677
|
+
footerAction,
|
|
2678
|
+
headerPreviewAction,
|
|
2679
|
+
footerPreviewAction,
|
|
2670
2680
|
className
|
|
2671
2681
|
}) {
|
|
2672
2682
|
const [previewItem, setPreviewItem] = React10.useState(null);
|
|
@@ -2751,6 +2761,7 @@ function BulletinBoard({
|
|
|
2751
2761
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.Pin, { className: "h-8 w-8 opacity-20" }),
|
|
2752
2762
|
emptyMessage
|
|
2753
2763
|
] }) : layout === "list" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-col gap-3", children: filtered.map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BulletinCard, { item, variant, layout: "list", onClick: handleCardClick }, item.id)) }) : layout === "masonry" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn("gap-4", COLS_CLASS[columns]), style: { display: "grid", gridTemplateRows: "masonry" }, children: filtered.map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BulletinCard, { item, variant, layout: "masonry", onClick: handleCardClick }, item.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn("grid gap-4", COLS_CLASS[columns]), children: filtered.map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BulletinCard, { item, variant, layout: "grid", onClick: handleCardClick }, item.id)) }),
|
|
2764
|
+
footerAction && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: footerAction }),
|
|
2754
2765
|
serverPagination && (() => {
|
|
2755
2766
|
const { pagination, currentPage: cp, goToPage } = serverPagination;
|
|
2756
2767
|
const totalPages = pagination.last_page ?? Math.ceil(pagination.total / pagination.per_page);
|
|
@@ -2827,7 +2838,9 @@ function BulletinBoard({
|
|
|
2827
2838
|
setDeleteItem(item);
|
|
2828
2839
|
} : onDelete ? (item) => {
|
|
2829
2840
|
onDelete(item);
|
|
2830
|
-
} : void 0
|
|
2841
|
+
} : void 0,
|
|
2842
|
+
footerAction: footerPreviewAction,
|
|
2843
|
+
headerAction: headerPreviewAction
|
|
2831
2844
|
}
|
|
2832
2845
|
),
|
|
2833
2846
|
editItem && editBaseUrl && editFields && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
@@ -13821,6 +13834,12 @@ function createStore(initialValue, sessionName, expireInterval) {
|
|
|
13821
13834
|
};
|
|
13822
13835
|
return { store, getStore };
|
|
13823
13836
|
}
|
|
13837
|
+
|
|
13838
|
+
// src/core/decryption/decode.ts
|
|
13839
|
+
function decryptResponse(response, key) {
|
|
13840
|
+
const payload = typeof response === "string" ? response : response.data;
|
|
13841
|
+
return decryptLaravelPayload(payload, key);
|
|
13842
|
+
}
|
|
13824
13843
|
// Annotate the CommonJS export names for ESM import in node:
|
|
13825
13844
|
0 && (module.exports = {
|
|
13826
13845
|
Accordion,
|
|
@@ -13921,6 +13940,11 @@ function createStore(initialValue, sessionName, expireInterval) {
|
|
|
13921
13940
|
Wizard,
|
|
13922
13941
|
api,
|
|
13923
13942
|
createStore,
|
|
13943
|
+
decryptLaravelPayload,
|
|
13944
|
+
decryptResponse,
|
|
13945
|
+
getLaravelSecretKey,
|
|
13946
|
+
parseLaravelEncryptedPayload,
|
|
13947
|
+
parseLaravelKey,
|
|
13924
13948
|
useServerBulletin,
|
|
13925
13949
|
useServerDataGrid,
|
|
13926
13950
|
useServerTable,
|
package/dist/index.d.cts
CHANGED
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
import { AxiosRequestConfig } from 'axios';
|
|
5
5
|
import { UseBoundStore, StoreApi } from 'zustand';
|
|
6
|
+
import CryptoJS from 'crypto-js';
|
|
6
7
|
|
|
7
8
|
type AuthView = "login" | "register" | "resetPassword";
|
|
8
9
|
interface AuthField {
|
|
@@ -838,8 +839,12 @@ interface BulletinPreviewProps {
|
|
|
838
839
|
onView?: (item: BulletinItem) => void;
|
|
839
840
|
/** Custom actions to add to the preview header */
|
|
840
841
|
customActions?: BulletinAction[];
|
|
842
|
+
/** Extra React elements rendered in the preview modal header's left area */
|
|
843
|
+
headerAction?: React.ReactNode;
|
|
844
|
+
/** Extra React elements rendered in the preview modal footer's action area */
|
|
845
|
+
footerAction?: React.ReactNode;
|
|
841
846
|
}
|
|
842
|
-
declare function BulletinPreview({ item, onClose, onEdit, onDelete, onView, customActions }: BulletinPreviewProps): React.ReactPortal;
|
|
847
|
+
declare function BulletinPreview({ item, onClose, onEdit, onDelete, onView, customActions, headerAction, footerAction }: BulletinPreviewProps): React.ReactPortal;
|
|
843
848
|
interface BulletinEditField {
|
|
844
849
|
key: keyof BulletinItem | string;
|
|
845
850
|
label: string;
|
|
@@ -898,10 +903,16 @@ interface BulletinBoardProps {
|
|
|
898
903
|
serverPagination?: BulletinServerPaginationProp | null;
|
|
899
904
|
/** Fired when a post card is clicked (ignored when preview=true). */
|
|
900
905
|
onItemClick?: (item: BulletinItem) => void;
|
|
906
|
+
/** Extra React elements rendered below the board content (above pagination). */
|
|
907
|
+
footerAction?: React.ReactNode;
|
|
908
|
+
/** Extra React elements rendered in the preview modal header's left area. */
|
|
909
|
+
headerPreviewAction?: React.ReactNode;
|
|
910
|
+
/** Extra React elements rendered in the preview modal footer's action area. */
|
|
911
|
+
footerPreviewAction?: React.ReactNode;
|
|
901
912
|
/** Additional CSS classes on the outer wrapper. */
|
|
902
913
|
className?: string;
|
|
903
914
|
}
|
|
904
|
-
declare function BulletinBoard({ items, layout, columns, variant, searchable, filterable, categories: categoriesProp, title, headerAction, showHeader, emptyMessage, loading, loadingCount, onItemClick, onView, onEdit, onDelete, preview, editBaseUrl, editMethod, editIdKey, editFields, deleteBaseUrl, deleteIdKey, serverPagination, className, }: BulletinBoardProps): react_jsx_runtime.JSX.Element;
|
|
915
|
+
declare function BulletinBoard({ items, layout, columns, variant, searchable, filterable, categories: categoriesProp, title, headerAction, showHeader, emptyMessage, loading, loadingCount, onItemClick, onView, onEdit, onDelete, preview, editBaseUrl, editMethod, editIdKey, editFields, deleteBaseUrl, deleteIdKey, serverPagination, footerAction, headerPreviewAction, footerPreviewAction, className, }: BulletinBoardProps): react_jsx_runtime.JSX.Element;
|
|
905
916
|
|
|
906
917
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
907
918
|
variant?: "primary" | "secondary" | "outline" | "ghost" | "link" | "danger" | "success" | "destructive";
|
|
@@ -2561,4 +2572,29 @@ type StoreWrapper<T extends object> = {
|
|
|
2561
2572
|
*/
|
|
2562
2573
|
declare function createStore<T extends object>(initialValue: T, sessionName: string, expireInterval?: number): StoreWrapper<T>;
|
|
2563
2574
|
|
|
2564
|
-
|
|
2575
|
+
type LaravelEncryptedPayload = {
|
|
2576
|
+
iv: string;
|
|
2577
|
+
value: string;
|
|
2578
|
+
mac: string;
|
|
2579
|
+
tag?: string;
|
|
2580
|
+
};
|
|
2581
|
+
declare function getLaravelSecretKey(): string;
|
|
2582
|
+
declare function parseLaravelKey(secretKey: string): CryptoJS.lib.WordArray;
|
|
2583
|
+
declare function parseLaravelEncryptedPayload(payload: string): LaravelEncryptedPayload;
|
|
2584
|
+
declare function decryptLaravelPayload<T>(payload: string, secretKey?: string): T;
|
|
2585
|
+
|
|
2586
|
+
/**
|
|
2587
|
+
* Decrypt a Laravel-encrypted API response.
|
|
2588
|
+
*
|
|
2589
|
+
* Accepts either:
|
|
2590
|
+
* - a raw encrypted string (the full response body)
|
|
2591
|
+
* - an object with an `data` key holding the encrypted string
|
|
2592
|
+
*
|
|
2593
|
+
* @param response Raw encrypted string or `{ data: string }` object
|
|
2594
|
+
* @param key Optional Laravel APP_KEY (base64:… or raw). Falls back to VITE_LARAVEL_KEY.
|
|
2595
|
+
*/
|
|
2596
|
+
declare function decryptResponse<T = unknown>(response: string | {
|
|
2597
|
+
data: string;
|
|
2598
|
+
}, key?: string): T;
|
|
2599
|
+
|
|
2600
|
+
export { Accordion, type AccordionItem, type AccordionProps, type AccordionVariant, type ActionField, type ActionFieldType, type AuthField, type AuthVariant, type AuthView, Authentication, type AuthenticationProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, type BulletinAction, BulletinBoard, type BulletinBoardProps, type BulletinColumns, type BulletinEditField, type BulletinItem, type BulletinLayout, BulletinPreview, type BulletinPreviewProps, type BulletinPriority, type BulletinServerPaginationProp, type BulletinVariant, Button, type ButtonProps, COLOR_PALETTE, Calendar, CalendarDateRangePicker, type CalendarDateRangePickerProps, type CalendarDateRangeVariant, type CalendarEvent, type CalendarProps, type CalendarView, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChartDataPoint, ChartWidget, type ChartWidgetProps, Checkbox, type CheckboxProps, CircularProgress, type CircularProgressProps, type ClusterVariant, CodegoApiProvider, ColorPicker, type ColorPickerProps, type Column, Combobox, type ComboboxOption, type ComboboxProps, type CommandItem, CommandPalette, type CommandPaletteProps, ComposableWidget, type ComposableWidgetProps, type ConfirmVariant, ContextMenu, type ContextMenuItem, type ContextMenuProps, DataGrid, type DataGridColumn, type DataGridProps, DatePickerPopup, type DateRange, DateRangePicker, type DateRangePickerProps, type DefaultActionsConfig, DocsLayout, Drawer, type DrawerProps, type DrawerSide, Dropdown, DropdownItem, DropdownLabel, type DropdownProps, DropdownSeparator, EVENT_COLORS, type FileTypeValidation, FileUpload, type FileUploadProps, type FlexAlign, type FlexDirection, type FlexGap, FlexItem, type FlexItemProps, type FlexJustify, FlexLayout, type FlexLayoutProps, type FlexWrap, type FlyToOptions, type FormField, type FormFieldType, type GridAlign, type GridCols, type GridGap, GridItem, type GridItemProps, GridLayout, type GridLayoutProps, GroupNavigation, type GroupNavigationProps, type ImageEditorMode, type ImageEditorOptions, Input, type InputProps, KanbanBoard, type KanbanBoardProps, type KanbanCard, type KanbanColumn, Label, type LaravelEncryptedPayload, LeafletMap, type LeafletMapProps, LeftSidebar, type LeftSidebarProps, type MapLibreClusterVariant, MapLibreMap, type MapLibreMarker, type MapLibreProps, type MapLibreRoute, type MapLibreRouteType, type MapLibreStyle, type MapMarker, type MapRoute, type MarkerColor, type MetricItem, MetricRow, type MetricRowProps, Modal, ModalConfirmation, type ModalConfirmationProps, type ModalProps, ModalUnchange, type ModalUnchangeProps, ModalWithForms, type ModalWithFormsProps, type NavGroup, type NavItem, Navigation, type NavigationProps, NotificationBanner, type NotificationBannerProps, type NotificationItem, NotificationPanel, type NotificationPanelProps, type NotificationVariant, OtpInput, type OtpInputProps, Pagination, type PaginationProps, Panel, type PanelProps, PanelSettings, type PanelSettingsProps, type PanelSettingsTab, PanelSidebarGroup, PanelSidebarItem, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressProps, type ProgressSize, type ProgressVariant, type PropRow, PropsTable, RadioGroup, type RadioGroupProps, type RadioOption, type RadioSize, type RadioVariant, RangeSlider, type RangeSliderProps, Repeater, type RepeaterProps, type RequestConfig, ResizablePanels, type ResizablePanelsProps, RichTextEditor, type RichTextEditorProps, RightSidebar, type RightSidebarProps, type RouteType, ScrollArea, type ScrollAreaProps, Section, SectionBlock, type SectionProps, type SectionVariant, Select, type SelectOption, type SelectProps, type SemanticColor, type ServerDataGridProp, type ServerPagination, type ServerPaginationLink, type ServerPaginationProp, type ServerTableResponse, Skeleton, Slider, type SliderProps, type SortDir, StatCard, type StatCardProps, type StatTrend, StatsWidget, type StatsWidgetProps, type Step, type StepStatus, Stepper, type StepperProps, type TabItem, type TabSize, type TabVariant, Table, TableOfContents, type TableProps, TableWidget, type TableWidgetProps, Tabs, type TabsProps, TagInput, type TagInputProps, Textarea, type TextareaProps, type ThemeColors, ThemeProvider, type ThemeSettings, Timeline, type TimelineItem, type TimelineProps, type TimelineVariant, type ToastItem, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, type TocItem, TocProvider, ToggleSwitch, type ToggleSwitchProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, type TreeNode, TreeView, type TreeViewProps, type TrendDir, type UseServerBulletinOptions, type UseServerBulletinReturn, type UseServerDataGridOptions, type UseServerDataGridReturn, type UseServerTableOptions, type UseServerTableReturn, Widget, type WidgetProps, Wizard, type WizardActionProps, type WizardLayout, type WizardProps, type WizardSize, type WizardStep, type WizardVariant, api, createStore, decryptLaravelPayload, decryptResponse, getLaravelSecretKey, parseLaravelEncryptedPayload, parseLaravelKey, useServerBulletin, useServerDataGrid, useServerTable, useTheme, useToast, useToc };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
import { AxiosRequestConfig } from 'axios';
|
|
5
5
|
import { UseBoundStore, StoreApi } from 'zustand';
|
|
6
|
+
import CryptoJS from 'crypto-js';
|
|
6
7
|
|
|
7
8
|
type AuthView = "login" | "register" | "resetPassword";
|
|
8
9
|
interface AuthField {
|
|
@@ -838,8 +839,12 @@ interface BulletinPreviewProps {
|
|
|
838
839
|
onView?: (item: BulletinItem) => void;
|
|
839
840
|
/** Custom actions to add to the preview header */
|
|
840
841
|
customActions?: BulletinAction[];
|
|
842
|
+
/** Extra React elements rendered in the preview modal header's left area */
|
|
843
|
+
headerAction?: React.ReactNode;
|
|
844
|
+
/** Extra React elements rendered in the preview modal footer's action area */
|
|
845
|
+
footerAction?: React.ReactNode;
|
|
841
846
|
}
|
|
842
|
-
declare function BulletinPreview({ item, onClose, onEdit, onDelete, onView, customActions }: BulletinPreviewProps): React.ReactPortal;
|
|
847
|
+
declare function BulletinPreview({ item, onClose, onEdit, onDelete, onView, customActions, headerAction, footerAction }: BulletinPreviewProps): React.ReactPortal;
|
|
843
848
|
interface BulletinEditField {
|
|
844
849
|
key: keyof BulletinItem | string;
|
|
845
850
|
label: string;
|
|
@@ -898,10 +903,16 @@ interface BulletinBoardProps {
|
|
|
898
903
|
serverPagination?: BulletinServerPaginationProp | null;
|
|
899
904
|
/** Fired when a post card is clicked (ignored when preview=true). */
|
|
900
905
|
onItemClick?: (item: BulletinItem) => void;
|
|
906
|
+
/** Extra React elements rendered below the board content (above pagination). */
|
|
907
|
+
footerAction?: React.ReactNode;
|
|
908
|
+
/** Extra React elements rendered in the preview modal header's left area. */
|
|
909
|
+
headerPreviewAction?: React.ReactNode;
|
|
910
|
+
/** Extra React elements rendered in the preview modal footer's action area. */
|
|
911
|
+
footerPreviewAction?: React.ReactNode;
|
|
901
912
|
/** Additional CSS classes on the outer wrapper. */
|
|
902
913
|
className?: string;
|
|
903
914
|
}
|
|
904
|
-
declare function BulletinBoard({ items, layout, columns, variant, searchable, filterable, categories: categoriesProp, title, headerAction, showHeader, emptyMessage, loading, loadingCount, onItemClick, onView, onEdit, onDelete, preview, editBaseUrl, editMethod, editIdKey, editFields, deleteBaseUrl, deleteIdKey, serverPagination, className, }: BulletinBoardProps): react_jsx_runtime.JSX.Element;
|
|
915
|
+
declare function BulletinBoard({ items, layout, columns, variant, searchable, filterable, categories: categoriesProp, title, headerAction, showHeader, emptyMessage, loading, loadingCount, onItemClick, onView, onEdit, onDelete, preview, editBaseUrl, editMethod, editIdKey, editFields, deleteBaseUrl, deleteIdKey, serverPagination, footerAction, headerPreviewAction, footerPreviewAction, className, }: BulletinBoardProps): react_jsx_runtime.JSX.Element;
|
|
905
916
|
|
|
906
917
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
907
918
|
variant?: "primary" | "secondary" | "outline" | "ghost" | "link" | "danger" | "success" | "destructive";
|
|
@@ -2561,4 +2572,29 @@ type StoreWrapper<T extends object> = {
|
|
|
2561
2572
|
*/
|
|
2562
2573
|
declare function createStore<T extends object>(initialValue: T, sessionName: string, expireInterval?: number): StoreWrapper<T>;
|
|
2563
2574
|
|
|
2564
|
-
|
|
2575
|
+
type LaravelEncryptedPayload = {
|
|
2576
|
+
iv: string;
|
|
2577
|
+
value: string;
|
|
2578
|
+
mac: string;
|
|
2579
|
+
tag?: string;
|
|
2580
|
+
};
|
|
2581
|
+
declare function getLaravelSecretKey(): string;
|
|
2582
|
+
declare function parseLaravelKey(secretKey: string): CryptoJS.lib.WordArray;
|
|
2583
|
+
declare function parseLaravelEncryptedPayload(payload: string): LaravelEncryptedPayload;
|
|
2584
|
+
declare function decryptLaravelPayload<T>(payload: string, secretKey?: string): T;
|
|
2585
|
+
|
|
2586
|
+
/**
|
|
2587
|
+
* Decrypt a Laravel-encrypted API response.
|
|
2588
|
+
*
|
|
2589
|
+
* Accepts either:
|
|
2590
|
+
* - a raw encrypted string (the full response body)
|
|
2591
|
+
* - an object with an `data` key holding the encrypted string
|
|
2592
|
+
*
|
|
2593
|
+
* @param response Raw encrypted string or `{ data: string }` object
|
|
2594
|
+
* @param key Optional Laravel APP_KEY (base64:… or raw). Falls back to VITE_LARAVEL_KEY.
|
|
2595
|
+
*/
|
|
2596
|
+
declare function decryptResponse<T = unknown>(response: string | {
|
|
2597
|
+
data: string;
|
|
2598
|
+
}, key?: string): T;
|
|
2599
|
+
|
|
2600
|
+
export { Accordion, type AccordionItem, type AccordionProps, type AccordionVariant, type ActionField, type ActionFieldType, type AuthField, type AuthVariant, type AuthView, Authentication, type AuthenticationProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, type BulletinAction, BulletinBoard, type BulletinBoardProps, type BulletinColumns, type BulletinEditField, type BulletinItem, type BulletinLayout, BulletinPreview, type BulletinPreviewProps, type BulletinPriority, type BulletinServerPaginationProp, type BulletinVariant, Button, type ButtonProps, COLOR_PALETTE, Calendar, CalendarDateRangePicker, type CalendarDateRangePickerProps, type CalendarDateRangeVariant, type CalendarEvent, type CalendarProps, type CalendarView, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChartDataPoint, ChartWidget, type ChartWidgetProps, Checkbox, type CheckboxProps, CircularProgress, type CircularProgressProps, type ClusterVariant, CodegoApiProvider, ColorPicker, type ColorPickerProps, type Column, Combobox, type ComboboxOption, type ComboboxProps, type CommandItem, CommandPalette, type CommandPaletteProps, ComposableWidget, type ComposableWidgetProps, type ConfirmVariant, ContextMenu, type ContextMenuItem, type ContextMenuProps, DataGrid, type DataGridColumn, type DataGridProps, DatePickerPopup, type DateRange, DateRangePicker, type DateRangePickerProps, type DefaultActionsConfig, DocsLayout, Drawer, type DrawerProps, type DrawerSide, Dropdown, DropdownItem, DropdownLabel, type DropdownProps, DropdownSeparator, EVENT_COLORS, type FileTypeValidation, FileUpload, type FileUploadProps, type FlexAlign, type FlexDirection, type FlexGap, FlexItem, type FlexItemProps, type FlexJustify, FlexLayout, type FlexLayoutProps, type FlexWrap, type FlyToOptions, type FormField, type FormFieldType, type GridAlign, type GridCols, type GridGap, GridItem, type GridItemProps, GridLayout, type GridLayoutProps, GroupNavigation, type GroupNavigationProps, type ImageEditorMode, type ImageEditorOptions, Input, type InputProps, KanbanBoard, type KanbanBoardProps, type KanbanCard, type KanbanColumn, Label, type LaravelEncryptedPayload, LeafletMap, type LeafletMapProps, LeftSidebar, type LeftSidebarProps, type MapLibreClusterVariant, MapLibreMap, type MapLibreMarker, type MapLibreProps, type MapLibreRoute, type MapLibreRouteType, type MapLibreStyle, type MapMarker, type MapRoute, type MarkerColor, type MetricItem, MetricRow, type MetricRowProps, Modal, ModalConfirmation, type ModalConfirmationProps, type ModalProps, ModalUnchange, type ModalUnchangeProps, ModalWithForms, type ModalWithFormsProps, type NavGroup, type NavItem, Navigation, type NavigationProps, NotificationBanner, type NotificationBannerProps, type NotificationItem, NotificationPanel, type NotificationPanelProps, type NotificationVariant, OtpInput, type OtpInputProps, Pagination, type PaginationProps, Panel, type PanelProps, PanelSettings, type PanelSettingsProps, type PanelSettingsTab, PanelSidebarGroup, PanelSidebarItem, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressProps, type ProgressSize, type ProgressVariant, type PropRow, PropsTable, RadioGroup, type RadioGroupProps, type RadioOption, type RadioSize, type RadioVariant, RangeSlider, type RangeSliderProps, Repeater, type RepeaterProps, type RequestConfig, ResizablePanels, type ResizablePanelsProps, RichTextEditor, type RichTextEditorProps, RightSidebar, type RightSidebarProps, type RouteType, ScrollArea, type ScrollAreaProps, Section, SectionBlock, type SectionProps, type SectionVariant, Select, type SelectOption, type SelectProps, type SemanticColor, type ServerDataGridProp, type ServerPagination, type ServerPaginationLink, type ServerPaginationProp, type ServerTableResponse, Skeleton, Slider, type SliderProps, type SortDir, StatCard, type StatCardProps, type StatTrend, StatsWidget, type StatsWidgetProps, type Step, type StepStatus, Stepper, type StepperProps, type TabItem, type TabSize, type TabVariant, Table, TableOfContents, type TableProps, TableWidget, type TableWidgetProps, Tabs, type TabsProps, TagInput, type TagInputProps, Textarea, type TextareaProps, type ThemeColors, ThemeProvider, type ThemeSettings, Timeline, type TimelineItem, type TimelineProps, type TimelineVariant, type ToastItem, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, type TocItem, TocProvider, ToggleSwitch, type ToggleSwitchProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, type TreeNode, TreeView, type TreeViewProps, type TrendDir, type UseServerBulletinOptions, type UseServerBulletinReturn, type UseServerDataGridOptions, type UseServerDataGridReturn, type UseServerTableOptions, type UseServerTableReturn, Widget, type WidgetProps, Wizard, type WizardActionProps, type WizardLayout, type WizardProps, type WizardSize, type WizardStep, type WizardVariant, api, createStore, decryptLaravelPayload, decryptResponse, getLaravelSecretKey, parseLaravelEncryptedPayload, parseLaravelKey, useServerBulletin, useServerDataGrid, useServerTable, useTheme, useToast, useToc };
|
package/dist/index.global.js
CHANGED
|
@@ -53730,6 +53730,11 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
53730
53730
|
Wizard: () => Wizard,
|
|
53731
53731
|
api: () => api,
|
|
53732
53732
|
createStore: () => createStore2,
|
|
53733
|
+
decryptLaravelPayload: () => decryptLaravelPayload,
|
|
53734
|
+
decryptResponse: () => decryptResponse,
|
|
53735
|
+
getLaravelSecretKey: () => getLaravelSecretKey,
|
|
53736
|
+
parseLaravelEncryptedPayload: () => parseLaravelEncryptedPayload,
|
|
53737
|
+
parseLaravelKey: () => parseLaravelKey,
|
|
53733
53738
|
useServerBulletin: () => useServerBulletin,
|
|
53734
53739
|
useServerDataGrid: () => useServerDataGrid,
|
|
53735
53740
|
useServerTable: () => useServerTable,
|
|
@@ -65325,7 +65330,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
65325
65330
|
reload: () => setTick((t) => t + 1)
|
|
65326
65331
|
};
|
|
65327
65332
|
}
|
|
65328
|
-
function BulletinPreview({ item, onClose, onEdit, onDelete, onView, customActions }) {
|
|
65333
|
+
function BulletinPreview({ item, onClose, onEdit, onDelete, onView, customActions, headerAction, footerAction }) {
|
|
65329
65334
|
const priority = item.priority ? PRIORITY_CONFIG[item.priority] : null;
|
|
65330
65335
|
return (0, import_react_dom.createPortal)(
|
|
65331
65336
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
@@ -65344,7 +65349,8 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
65344
65349
|
" Pinned"
|
|
65345
65350
|
] }),
|
|
65346
65351
|
priority && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: priority.badge, size: "sm", icon: priority.icon ?? void 0, children: priority.label }),
|
|
65347
|
-
item.category && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: "outline", size: "sm", children: item.category })
|
|
65352
|
+
item.category && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: "outline", size: "sm", children: item.category }),
|
|
65353
|
+
headerAction
|
|
65348
65354
|
] }),
|
|
65349
65355
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
65350
65356
|
onEdit && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
@@ -65443,6 +65449,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
65443
65449
|
] })
|
|
65444
65450
|
] }) }),
|
|
65445
65451
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
65452
|
+
footerAction,
|
|
65446
65453
|
onEdit && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
65447
65454
|
"button",
|
|
65448
65455
|
{
|
|
@@ -65837,6 +65844,9 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
65837
65844
|
deleteBaseUrl,
|
|
65838
65845
|
deleteIdKey = "id",
|
|
65839
65846
|
serverPagination,
|
|
65847
|
+
footerAction,
|
|
65848
|
+
headerPreviewAction,
|
|
65849
|
+
footerPreviewAction,
|
|
65840
65850
|
className
|
|
65841
65851
|
}) {
|
|
65842
65852
|
const [previewItem, setPreviewItem] = React10.useState(null);
|
|
@@ -65921,6 +65931,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
65921
65931
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Pin, { className: "h-8 w-8 opacity-20" }),
|
|
65922
65932
|
emptyMessage
|
|
65923
65933
|
] }) : layout === "list" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-col gap-3", children: filtered.map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BulletinCard, { item, variant, layout: "list", onClick: handleCardClick }, item.id)) }) : layout === "masonry" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn("gap-4", COLS_CLASS[columns]), style: { display: "grid", gridTemplateRows: "masonry" }, children: filtered.map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BulletinCard, { item, variant, layout: "masonry", onClick: handleCardClick }, item.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn("grid gap-4", COLS_CLASS[columns]), children: filtered.map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BulletinCard, { item, variant, layout: "grid", onClick: handleCardClick }, item.id)) }),
|
|
65934
|
+
footerAction && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: footerAction }),
|
|
65924
65935
|
serverPagination && (() => {
|
|
65925
65936
|
const { pagination, currentPage: cp, goToPage } = serverPagination;
|
|
65926
65937
|
const totalPages = pagination.last_page ?? Math.ceil(pagination.total / pagination.per_page);
|
|
@@ -65997,7 +66008,9 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
65997
66008
|
setDeleteItem(item);
|
|
65998
66009
|
} : onDelete ? (item) => {
|
|
65999
66010
|
onDelete(item);
|
|
66000
|
-
} : void 0
|
|
66011
|
+
} : void 0,
|
|
66012
|
+
footerAction: footerPreviewAction,
|
|
66013
|
+
headerAction: headerPreviewAction
|
|
66001
66014
|
}
|
|
66002
66015
|
),
|
|
66003
66016
|
editItem && editBaseUrl && editFields && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
@@ -77628,6 +77641,12 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
77628
77641
|
};
|
|
77629
77642
|
return { store, getStore };
|
|
77630
77643
|
}
|
|
77644
|
+
|
|
77645
|
+
// src/core/decryption/decode.ts
|
|
77646
|
+
function decryptResponse(response, key) {
|
|
77647
|
+
const payload = typeof response === "string" ? response : response.data;
|
|
77648
|
+
return decryptLaravelPayload(payload, key);
|
|
77649
|
+
}
|
|
77631
77650
|
return __toCommonJS(index_exports);
|
|
77632
77651
|
})();
|
|
77633
77652
|
/*! Bundled license information:
|
package/dist/index.js
CHANGED
|
@@ -2034,7 +2034,7 @@ function useServerBulletin({
|
|
|
2034
2034
|
reload: () => setTick((t) => t + 1)
|
|
2035
2035
|
};
|
|
2036
2036
|
}
|
|
2037
|
-
function BulletinPreview({ item, onClose, onEdit, onDelete, onView, customActions }) {
|
|
2037
|
+
function BulletinPreview({ item, onClose, onEdit, onDelete, onView, customActions, headerAction, footerAction }) {
|
|
2038
2038
|
const priority = item.priority ? PRIORITY_CONFIG[item.priority] : null;
|
|
2039
2039
|
return createPortal2(
|
|
2040
2040
|
/* @__PURE__ */ jsx12(
|
|
@@ -2053,7 +2053,8 @@ function BulletinPreview({ item, onClose, onEdit, onDelete, onView, customAction
|
|
|
2053
2053
|
" Pinned"
|
|
2054
2054
|
] }),
|
|
2055
2055
|
priority && /* @__PURE__ */ jsx12(Badge, { variant: priority.badge, size: "sm", icon: priority.icon ?? void 0, children: priority.label }),
|
|
2056
|
-
item.category && /* @__PURE__ */ jsx12(Badge, { variant: "outline", size: "sm", children: item.category })
|
|
2056
|
+
item.category && /* @__PURE__ */ jsx12(Badge, { variant: "outline", size: "sm", children: item.category }),
|
|
2057
|
+
headerAction
|
|
2057
2058
|
] }),
|
|
2058
2059
|
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
2059
2060
|
onEdit && /* @__PURE__ */ jsx12(
|
|
@@ -2152,6 +2153,7 @@ function BulletinPreview({ item, onClose, onEdit, onDelete, onView, customAction
|
|
|
2152
2153
|
] })
|
|
2153
2154
|
] }) }),
|
|
2154
2155
|
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
2156
|
+
footerAction,
|
|
2155
2157
|
onEdit && /* @__PURE__ */ jsxs10(
|
|
2156
2158
|
"button",
|
|
2157
2159
|
{
|
|
@@ -2546,6 +2548,9 @@ function BulletinBoard({
|
|
|
2546
2548
|
deleteBaseUrl,
|
|
2547
2549
|
deleteIdKey = "id",
|
|
2548
2550
|
serverPagination,
|
|
2551
|
+
footerAction,
|
|
2552
|
+
headerPreviewAction,
|
|
2553
|
+
footerPreviewAction,
|
|
2549
2554
|
className
|
|
2550
2555
|
}) {
|
|
2551
2556
|
const [previewItem, setPreviewItem] = React10.useState(null);
|
|
@@ -2630,6 +2635,7 @@ function BulletinBoard({
|
|
|
2630
2635
|
/* @__PURE__ */ jsx12(Pin, { className: "h-8 w-8 opacity-20" }),
|
|
2631
2636
|
emptyMessage
|
|
2632
2637
|
] }) : layout === "list" ? /* @__PURE__ */ jsx12("div", { className: "flex flex-col gap-3", children: filtered.map((item) => /* @__PURE__ */ jsx12(BulletinCard, { item, variant, layout: "list", onClick: handleCardClick }, item.id)) }) : layout === "masonry" ? /* @__PURE__ */ jsx12("div", { className: cn("gap-4", COLS_CLASS[columns]), style: { display: "grid", gridTemplateRows: "masonry" }, children: filtered.map((item) => /* @__PURE__ */ jsx12(BulletinCard, { item, variant, layout: "masonry", onClick: handleCardClick }, item.id)) }) : /* @__PURE__ */ jsx12("div", { className: cn("grid gap-4", COLS_CLASS[columns]), children: filtered.map((item) => /* @__PURE__ */ jsx12(BulletinCard, { item, variant, layout: "grid", onClick: handleCardClick }, item.id)) }),
|
|
2638
|
+
footerAction && /* @__PURE__ */ jsx12("div", { children: footerAction }),
|
|
2633
2639
|
serverPagination && (() => {
|
|
2634
2640
|
const { pagination, currentPage: cp, goToPage } = serverPagination;
|
|
2635
2641
|
const totalPages = pagination.last_page ?? Math.ceil(pagination.total / pagination.per_page);
|
|
@@ -2706,7 +2712,9 @@ function BulletinBoard({
|
|
|
2706
2712
|
setDeleteItem(item);
|
|
2707
2713
|
} : onDelete ? (item) => {
|
|
2708
2714
|
onDelete(item);
|
|
2709
|
-
} : void 0
|
|
2715
|
+
} : void 0,
|
|
2716
|
+
footerAction: footerPreviewAction,
|
|
2717
|
+
headerAction: headerPreviewAction
|
|
2710
2718
|
}
|
|
2711
2719
|
),
|
|
2712
2720
|
editItem && editBaseUrl && editFields && /* @__PURE__ */ jsx12(
|
|
@@ -13700,6 +13708,12 @@ function createStore(initialValue, sessionName, expireInterval) {
|
|
|
13700
13708
|
};
|
|
13701
13709
|
return { store, getStore };
|
|
13702
13710
|
}
|
|
13711
|
+
|
|
13712
|
+
// src/core/decryption/decode.ts
|
|
13713
|
+
function decryptResponse(response, key) {
|
|
13714
|
+
const payload = typeof response === "string" ? response : response.data;
|
|
13715
|
+
return decryptLaravelPayload(payload, key);
|
|
13716
|
+
}
|
|
13703
13717
|
export {
|
|
13704
13718
|
Accordion,
|
|
13705
13719
|
Authentication,
|
|
@@ -13799,6 +13813,11 @@ export {
|
|
|
13799
13813
|
Wizard,
|
|
13800
13814
|
api,
|
|
13801
13815
|
createStore,
|
|
13816
|
+
decryptLaravelPayload,
|
|
13817
|
+
decryptResponse,
|
|
13818
|
+
getLaravelSecretKey,
|
|
13819
|
+
parseLaravelEncryptedPayload,
|
|
13820
|
+
parseLaravelKey,
|
|
13802
13821
|
useServerBulletin,
|
|
13803
13822
|
useServerDataGrid,
|
|
13804
13823
|
useServerTable,
|