@g9tm/lynxcontrols 2.5.6 → 2.5.8
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/catalog/cards/G9AppBar.md +1 -1
- package/catalog/cards/G9AppearancePage.md +17 -0
- package/catalog/cards/G9Badge.md +1 -1
- package/catalog/cards/G9Button.md +2 -2
- package/catalog/cards/G9Card.md +1 -1
- package/catalog/cards/G9CarryContexts.md +10 -0
- package/catalog/cards/G9CheckBox.md +1 -1
- package/catalog/cards/G9Chip.md +1 -1
- package/catalog/cards/G9ChipStrip.md +16 -0
- package/catalog/cards/G9CodeBlock.md +17 -0
- package/catalog/cards/G9CommandPalette.md +3 -1
- package/catalog/cards/G9ConnectionBanner.md +1 -1
- package/catalog/cards/G9ContrastPanel.md +15 -0
- package/catalog/cards/G9DashboardCustomizeSheet.md +17 -0
- package/catalog/cards/G9DashboardGrid.md +17 -0
- package/catalog/cards/G9DragList.md +4 -2
- package/catalog/cards/G9Editor.md +1 -1
- package/catalog/cards/G9ErrorBoundary.md +3 -2
- package/catalog/cards/G9FormField.md +2 -2
- package/catalog/cards/G9ListRow.md +1 -1
- package/catalog/cards/G9Menu.md +1 -1
- package/catalog/cards/G9MenuList.md +2 -0
- package/catalog/cards/G9NotificationCenter.md +17 -0
- package/catalog/cards/G9NotificationCenterPanel.md +17 -0
- package/catalog/cards/G9PathNavigator.md +13 -0
- package/catalog/cards/G9PersonalThemeSheet.md +17 -0
- package/catalog/cards/G9Popover.md +1 -1
- package/catalog/cards/G9Provider.md +1 -1
- package/catalog/cards/G9RangeSlider.md +2 -2
- package/catalog/cards/G9ReaderSheet.md +17 -0
- package/catalog/cards/G9ReaderView.md +17 -0
- package/catalog/cards/G9SafeButton.md +2 -2
- package/catalog/cards/G9SearchEntry.md +1 -1
- package/catalog/cards/G9SecretValue.md +17 -0
- package/catalog/cards/G9ShortcutList.md +4 -0
- package/catalog/cards/G9ShortcutsSheet.md +3 -1
- package/catalog/cards/G9StatusPill.md +1 -1
- package/catalog/cards/G9Stepper.md +1 -1
- package/catalog/cards/G9SwitchRow.md +1 -1
- package/catalog/cards/G9Tag.md +1 -1
- package/catalog/cards/G9TextEntry.md +1 -1
- package/catalog/cards/G9UpdateBar.md +2 -1
- package/catalog/cards/G9VirtualList.md +1 -1
- package/catalog/cards/G9WallpaperSwatch.md +16 -0
- package/catalog/cards/G9WidgetSkeleton.md +9 -0
- package/catalog/cards/G9WidgetSlot.md +13 -0
- package/catalog/cards/PopupFrame.md +2 -2
- package/catalog/catalog.json +9460 -2155
- package/catalog/index.md +20 -3
- package/dist/.tsbuildinfo +1 -1
- package/dist/appearance/appearance.css +264 -0
- package/dist/appearance/appearance.css.map +1 -0
- package/dist/appearance/appearance.d.ts +148 -0
- package/dist/appearance/appearance.d.ts.map +1 -0
- package/dist/appearance/appearance.jsx +604 -0
- package/dist/appearance/index.d.ts +2 -0
- package/dist/appearance/index.d.ts.map +1 -0
- package/dist/appearance/index.jsx +1 -0
- package/dist/base/control.d.ts +15 -0
- package/dist/base/control.d.ts.map +1 -1
- package/dist/base/control.jsx +13 -1
- package/dist/base/index.d.ts +1 -1
- package/dist/base/index.d.ts.map +1 -1
- package/dist/base/index.jsx +1 -1
- package/dist/base/selection-item.d.ts +5 -0
- package/dist/base/selection-item.d.ts.map +1 -1
- package/dist/button/button.css +4 -0
- package/dist/button/button.css.map +1 -1
- package/dist/cascade/cascade.css +2 -0
- package/dist/cascade/cascade.css.map +1 -1
- package/dist/commands/commands.css +46 -0
- package/dist/commands/commands.css.map +1 -1
- package/dist/commands/index.d.ts +2 -2
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.jsx +2 -2
- package/dist/commands/keys.d.ts +15 -1
- package/dist/commands/keys.d.ts.map +1 -1
- package/dist/commands/keys.jsx +20 -1
- package/dist/commands/palette.d.ts +73 -7
- package/dist/commands/palette.d.ts.map +1 -1
- package/dist/commands/palette.jsx +174 -20
- package/dist/dashboard/dashboard.css +101 -0
- package/dist/dashboard/dashboard.css.map +1 -0
- package/dist/dashboard/dashboard.d.ts +73 -0
- package/dist/dashboard/dashboard.d.ts.map +1 -0
- package/dist/dashboard/dashboard.jsx +297 -0
- package/dist/dashboard/index.d.ts +3 -0
- package/dist/dashboard/index.d.ts.map +1 -0
- package/dist/dashboard/index.jsx +2 -0
- package/dist/dashboard/model.d.ts +53 -0
- package/dist/dashboard/model.d.ts.map +1 -0
- package/dist/dashboard/model.jsx +76 -0
- package/dist/display/code.css +109 -0
- package/dist/display/code.css.map +1 -0
- package/dist/display/code.d.ts +43 -0
- package/dist/display/code.d.ts.map +1 -0
- package/dist/display/code.jsx +101 -0
- package/dist/display/extras.d.ts +7 -2
- package/dist/display/extras.d.ts.map +1 -1
- package/dist/display/extras.jsx +13 -4
- package/dist/display/figures.d.ts.map +1 -1
- package/dist/display/figures.jsx +10 -2
- package/dist/display/index.d.ts +1 -0
- package/dist/display/index.d.ts.map +1 -1
- package/dist/display/index.jsx +1 -0
- package/dist/display/motion-figures.css +2 -0
- package/dist/display/motion-figures.css.map +1 -1
- package/dist/display/motion-figures.d.ts.map +1 -1
- package/dist/display/motion-figures.jsx +14 -7
- package/dist/display/status.d.ts +1 -1
- package/dist/display/status.d.ts.map +1 -1
- package/dist/display/status.jsx +15 -3
- package/dist/display/theme-preview.css +4 -0
- package/dist/display/theme-preview.css.map +1 -1
- package/dist/effects/effects.d.ts.map +1 -1
- package/dist/effects/effects.jsx +8 -1
- package/dist/fields/extra-entries.css +1 -0
- package/dist/fields/extra-entries.css.map +1 -1
- package/dist/fields/extra-entries.d.ts +4 -1
- package/dist/fields/extra-entries.d.ts.map +1 -1
- package/dist/fields/extra-entries.jsx +54 -19
- package/dist/fields/fields.css +21 -0
- package/dist/fields/fields.css.map +1 -1
- package/dist/fields/outlined-field.d.ts +9 -0
- package/dist/fields/outlined-field.d.ts.map +1 -1
- package/dist/fields/outlined-field.jsx +6 -1
- package/dist/fields/pin-entry.d.ts.map +1 -1
- package/dist/fields/pin-entry.jsx +36 -3
- package/dist/fields/text-entry.d.ts +4 -0
- package/dist/fields/text-entry.d.ts.map +1 -1
- package/dist/fields/text-entry.jsx +32 -25
- package/dist/fields/use-text-input.d.ts +3 -2
- package/dist/fields/use-text-input.d.ts.map +1 -1
- package/dist/fields/use-text-input.jsx +3 -0
- package/dist/header/app-bar.d.ts +6 -0
- package/dist/header/app-bar.d.ts.map +1 -1
- package/dist/header/app-bar.jsx +22 -8
- package/dist/header/header.css +14 -0
- package/dist/header/header.css.map +1 -1
- package/dist/host/bottom-overlays.d.ts +5 -0
- package/dist/host/bottom-overlays.d.ts.map +1 -1
- package/dist/host/bottom-overlays.jsx +17 -1
- package/dist/host/carry-contexts.d.ts +28 -0
- package/dist/host/carry-contexts.d.ts.map +1 -0
- package/dist/host/carry-contexts.jsx +76 -0
- package/dist/host/host.d.ts.map +1 -1
- package/dist/host/host.jsx +5 -1
- package/dist/host/index.d.ts +2 -0
- package/dist/host/index.d.ts.map +1 -1
- package/dist/host/index.jsx +2 -0
- package/dist/icon/icon.d.ts.map +1 -1
- package/dist/icon/icon.jsx +13 -9
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/layout/containers.d.ts.map +1 -1
- package/dist/layout/containers.jsx +2 -1
- package/dist/layout/layout.css +7 -0
- package/dist/layout/layout.css.map +1 -1
- package/dist/list/gestures.d.ts +39 -6
- package/dist/list/gestures.d.ts.map +1 -1
- package/dist/list/gestures.jsx +284 -89
- package/dist/list/index.d.ts +3 -2
- package/dist/list/index.d.ts.map +1 -1
- package/dist/list/index.jsx +2 -1
- package/dist/list/keyboard.d.ts +50 -0
- package/dist/list/keyboard.d.ts.map +1 -0
- package/dist/list/keyboard.jsx +117 -0
- package/dist/list/list.css +50 -5
- package/dist/list/list.css.map +1 -1
- package/dist/list/rows.d.ts +13 -1
- package/dist/list/rows.d.ts.map +1 -1
- package/dist/list/rows.jsx +42 -23
- package/dist/list/virtual-list.d.ts +27 -1
- package/dist/list/virtual-list.d.ts.map +1 -1
- package/dist/list/virtual-list.jsx +49 -4
- package/dist/notifications/index.d.ts +3 -0
- package/dist/notifications/index.d.ts.map +1 -0
- package/dist/notifications/index.jsx +2 -0
- package/dist/notifications/model.d.ts +47 -0
- package/dist/notifications/model.d.ts.map +1 -0
- package/dist/notifications/model.jsx +51 -0
- package/dist/notifications/notification-center.d.ts +98 -0
- package/dist/notifications/notification-center.d.ts.map +1 -0
- package/dist/notifications/notification-center.jsx +424 -0
- package/dist/notifications/notifications.css +266 -0
- package/dist/notifications/notifications.css.map +1 -0
- package/dist/orb/orb.css +2 -0
- package/dist/orb/orb.css.map +1 -1
- package/dist/pickers/pickers.css +15 -0
- package/dist/pickers/pickers.css.map +1 -1
- package/dist/plus-button/plus-button.css +2 -0
- package/dist/plus-button/plus-button.css.map +1 -1
- package/dist/plus-button/plus-button.d.ts.map +1 -1
- package/dist/plus-button/plus-button.jsx +2 -1
- package/dist/popover/popover.css +23 -1
- package/dist/popover/popover.css.map +1 -1
- package/dist/popover/popover.d.ts +14 -0
- package/dist/popover/popover.d.ts.map +1 -1
- package/dist/popover/popover.jsx +73 -12
- package/dist/popover/position.d.ts +6 -2
- package/dist/popover/position.d.ts.map +1 -1
- package/dist/popover/position.jsx +15 -4
- package/dist/popup/popup.css +3 -0
- package/dist/popup/popup.css.map +1 -1
- package/dist/provider/direction-scope.d.ts +8 -0
- package/dist/provider/direction-scope.d.ts.map +1 -1
- package/dist/provider/direction-scope.jsx +13 -2
- package/dist/provider/index.d.ts +1 -1
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/provider.css +7 -0
- package/dist/provider/provider.css.map +1 -1
- package/dist/provider/provider.d.ts +6 -1
- package/dist/provider/provider.d.ts.map +1 -1
- package/dist/provider/provider.jsx +22 -2
- package/dist/provider/settings.d.ts +14 -0
- package/dist/provider/settings.d.ts.map +1 -1
- package/dist/provider/settings.jsx +4 -1
- package/dist/range-slider/index.d.ts +1 -1
- package/dist/range-slider/index.d.ts.map +1 -1
- package/dist/range-slider/range-slider.css +69 -0
- package/dist/range-slider/range-slider.css.map +1 -1
- package/dist/range-slider/range-slider.d.ts +22 -0
- package/dist/range-slider/range-slider.d.ts.map +1 -1
- package/dist/range-slider/range-slider.jsx +34 -5
- package/dist/reader/index.d.ts +2 -0
- package/dist/reader/index.d.ts.map +1 -0
- package/dist/reader/index.jsx +1 -0
- package/dist/reader/reader.css +74 -0
- package/dist/reader/reader.css.map +1 -0
- package/dist/reader/reader.d.ts +76 -0
- package/dist/reader/reader.d.ts.map +1 -0
- package/dist/reader/reader.jsx +149 -0
- package/dist/route/index.d.ts +2 -0
- package/dist/route/index.d.ts.map +1 -1
- package/dist/route/index.jsx +2 -0
- package/dist/route/path-navigator.css +42 -0
- package/dist/route/path-navigator.css.map +1 -0
- package/dist/route/path-navigator.d.ts +25 -0
- package/dist/route/path-navigator.d.ts.map +1 -0
- package/dist/route/path-navigator.jsx +98 -0
- package/dist/route/path-router.d.ts +162 -0
- package/dist/route/path-router.d.ts.map +1 -0
- package/dist/route/path-router.jsx +327 -0
- package/dist/selection/selection-sheet.d.ts.map +1 -1
- package/dist/selection/selection-sheet.jsx +23 -10
- package/dist/selection/selection.css +18 -1
- package/dist/selection/selection.css.map +1 -1
- package/dist/sheet/frame.d.ts.map +1 -1
- package/dist/sheet/frame.jsx +9 -8
- package/dist/sheet/options.d.ts +6 -1
- package/dist/sheet/options.d.ts.map +1 -1
- package/dist/sheet/options.jsx +2 -1
- package/dist/sheet/panel-frame.d.ts.map +1 -1
- package/dist/sheet/panel-frame.jsx +5 -4
- package/dist/sheet/sizing.d.ts +3 -3
- package/dist/sheet/sizing.d.ts.map +1 -1
- package/dist/sheet/sizing.jsx +1 -0
- package/dist/shell/shell.css +18 -1
- package/dist/shell/shell.css.map +1 -1
- package/dist/shell/shell.d.ts +10 -1
- package/dist/shell/shell.d.ts.map +1 -1
- package/dist/shell/shell.jsx +13 -9
- package/dist/survey/survey.css +15 -0
- package/dist/survey/survey.css.map +1 -1
- package/dist/survey/survey.d.ts +6 -0
- package/dist/survey/survey.d.ts.map +1 -1
- package/dist/survey/survey.jsx +24 -6
- package/dist/swipe/swipe.css +2 -0
- package/dist/swipe/swipe.css.map +1 -1
- package/dist/tab-bar/flat.d.ts.map +1 -1
- package/dist/tab-bar/flat.jsx +53 -38
- package/dist/tab-bar/tab-bar.css +2 -0
- package/dist/tab-bar/tab-bar.css.map +1 -1
- package/dist/tab-bar/tab-bar.d.ts.map +1 -1
- package/dist/tab-bar/tab-bar.jsx +28 -6
- package/dist/tabs/tab-view.jsx +10 -3
- package/dist/tabs/tabs.css +5 -0
- package/dist/tabs/tabs.css.map +1 -1
- package/dist/toast/index.d.ts +1 -1
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/service.d.ts.map +1 -1
- package/dist/toast/service.jsx +18 -5
- package/dist/toast/store.d.ts +22 -0
- package/dist/toast/store.d.ts.map +1 -1
- package/dist/toast/store.jsx +35 -3
- package/dist/toast/toast.css +22 -0
- package/dist/toast/toast.css.map +1 -1
- package/dist/toggle/checkbox.d.ts +5 -0
- package/dist/toggle/checkbox.d.ts.map +1 -1
- package/dist/toggle/checkbox.jsx +7 -2
- package/dist/toggle/choice.css +35 -0
- package/dist/toggle/choice.css.map +1 -1
- package/dist/toggle/choice.d.ts +45 -0
- package/dist/toggle/choice.d.ts.map +1 -1
- package/dist/toggle/choice.jsx +97 -23
- package/dist/toggle/index.d.ts +1 -1
- package/dist/toggle/index.d.ts.map +1 -1
- package/dist/toggle/index.jsx +1 -1
- package/package.json +22 -2
- package/skills/g9-lynx-app/references/catalog-index.md +24 -8
- package/skills/g9-lynx-app/references/components/appearance.md +70 -0
- package/skills/g9-lynx-app/references/components/barcode.md +1 -1
- package/skills/g9-lynx-app/references/components/button.md +4 -4
- package/skills/g9-lynx-app/references/components/calendar-1.md +205 -0
- package/skills/g9-lynx-app/references/components/calendar-2.md +36 -0
- package/skills/g9-lynx-app/references/components/canvas.md +33 -0
- package/skills/g9-lynx-app/references/components/chat-1.md +199 -0
- package/skills/g9-lynx-app/references/components/chat-2.md +119 -0
- package/skills/g9-lynx-app/references/components/commands.md +10 -2
- package/skills/g9-lynx-app/references/components/commerce.md +1 -1
- package/skills/g9-lynx-app/references/components/dashboard.md +61 -0
- package/skills/g9-lynx-app/references/components/display-1.md +22 -21
- package/skills/g9-lynx-app/references/components/display-2.md +36 -39
- package/skills/g9-lynx-app/references/components/display-3.md +41 -2
- package/skills/g9-lynx-app/references/components/fields.md +5 -5
- package/skills/g9-lynx-app/references/components/header.md +1 -1
- package/skills/g9-lynx-app/references/components/host.md +11 -0
- package/skills/g9-lynx-app/references/components/layout-1.md +1 -1
- package/skills/g9-lynx-app/references/components/list.md +7 -5
- package/skills/g9-lynx-app/references/components/map.md +19 -1
- package/skills/g9-lynx-app/references/components/media-1.md +203 -0
- package/skills/g9-lynx-app/references/components/media-2.md +66 -0
- package/skills/g9-lynx-app/references/components/notifications.md +37 -0
- package/skills/g9-lynx-app/references/components/popover.md +4 -2
- package/skills/g9-lynx-app/references/components/popup.md +2 -2
- package/skills/g9-lynx-app/references/components/projects.md +73 -0
- package/skills/g9-lynx-app/references/components/provider.md +1 -1
- package/skills/g9-lynx-app/references/components/range-slider.md +2 -2
- package/skills/g9-lynx-app/references/components/reader.md +37 -0
- package/skills/g9-lynx-app/references/components/richtext.md +54 -0
- package/skills/g9-lynx-app/references/components/route.md +14 -0
- package/skills/g9-lynx-app/references/components/shell.md +3 -2
- package/skills/g9-lynx-app/references/components/toggle.md +20 -3
- package/skills/g9-lynx-app/references/provider-and-host.md +4 -3
- package/skills/g9-lynx-app/references/components/calendar.md +0 -128
- package/skills/g9-lynx-app/references/components/chat.md +0 -98
- package/skills/g9-lynx-app/references/components/media.md +0 -115
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { type ReactNode } from '@lynx-js/react';
|
|
2
|
+
import { type G9MenuItem } from '../popover/popover.js';
|
|
3
|
+
import type { G9Placement } from '../popover/position.js';
|
|
4
|
+
import type { G9SheetOptions } from '../sheet/options.js';
|
|
5
|
+
import { type G9NotificationEntry, type G9NotificationFilter, type G9NotificationGroup } from './model.js';
|
|
6
|
+
import './notifications.css';
|
|
7
|
+
/** A snoozed entry and when it comes back (as the app says it). */
|
|
8
|
+
export interface G9SnoozedNotification {
|
|
9
|
+
readonly entry: G9NotificationEntry;
|
|
10
|
+
readonly until: string;
|
|
11
|
+
}
|
|
12
|
+
/** A snooze choice (its key reaches `onSnooze`). */
|
|
13
|
+
export interface G9SnoozeChoice {
|
|
14
|
+
readonly key: string;
|
|
15
|
+
readonly label: string;
|
|
16
|
+
}
|
|
17
|
+
/** The center's words (English by default). */
|
|
18
|
+
export interface G9NotificationCenterWords {
|
|
19
|
+
readonly title?: string;
|
|
20
|
+
readonly more?: string;
|
|
21
|
+
readonly actions?: string;
|
|
22
|
+
readonly markRead?: string;
|
|
23
|
+
readonly markGroupRead?: string;
|
|
24
|
+
readonly markAllRead?: string;
|
|
25
|
+
readonly snoozeAll?: (when: string) => string;
|
|
26
|
+
readonly showMore?: (count: string) => string;
|
|
27
|
+
readonly showLess?: string;
|
|
28
|
+
readonly snoozed?: (count: string) => string;
|
|
29
|
+
readonly backAt?: (until: string) => string;
|
|
30
|
+
readonly unsnooze?: string;
|
|
31
|
+
readonly empty?: string;
|
|
32
|
+
readonly emptyHint?: string;
|
|
33
|
+
readonly emptyFilter?: string;
|
|
34
|
+
readonly failed?: string;
|
|
35
|
+
readonly unread?: string;
|
|
36
|
+
readonly groupActions?: (title: string) => string;
|
|
37
|
+
/** Numbers as the culture writes them (default: the provider culture's digits). */
|
|
38
|
+
readonly number?: (value: number) => string;
|
|
39
|
+
}
|
|
40
|
+
/** The default snooze choices. */
|
|
41
|
+
export declare const g9SnoozeChoices: readonly G9SnoozeChoice[];
|
|
42
|
+
/** Props of {@link G9NotificationCenter}. */
|
|
43
|
+
export interface G9NotificationCenterProps {
|
|
44
|
+
readonly id?: string;
|
|
45
|
+
readonly items: readonly G9NotificationEntry[];
|
|
46
|
+
/** The chips (default one, «all»). */
|
|
47
|
+
readonly filters?: readonly G9NotificationFilter[];
|
|
48
|
+
/** The chosen filter's key (controlled); `defaultFilter` alone: the center keeps it. */
|
|
49
|
+
readonly filter?: string;
|
|
50
|
+
readonly defaultFilter?: string;
|
|
51
|
+
readonly onFilterChange?: (key: string) => void;
|
|
52
|
+
readonly snoozed?: readonly G9SnoozedNotification[];
|
|
53
|
+
readonly snoozeChoices?: readonly G9SnoozeChoice[];
|
|
54
|
+
readonly onOpen?: (entry: G9NotificationEntry) => void;
|
|
55
|
+
readonly onMarkRead?: (ids: readonly string[]) => void;
|
|
56
|
+
readonly onMarkAllRead?: () => void;
|
|
57
|
+
readonly onSnooze?: (ids: readonly string[], choice: string) => void;
|
|
58
|
+
readonly onUnsnooze?: (id: string) => void;
|
|
59
|
+
/** More entries of the header's menu (a digest setting) and what they do. */
|
|
60
|
+
readonly menuItems?: readonly G9MenuItem[];
|
|
61
|
+
readonly onMenuItem?: (key: string) => void;
|
|
62
|
+
/** Shown under the chips (the digest's settings). */
|
|
63
|
+
readonly extra?: ReactNode;
|
|
64
|
+
/** The feed failed to load (the empty state says so). */
|
|
65
|
+
readonly failed?: boolean;
|
|
66
|
+
/** `'panel'` (default): its own title and a height limit; `'sheet'`: the sheet shows the title, the menu ends the chips. */
|
|
67
|
+
readonly variant?: 'panel' | 'sheet';
|
|
68
|
+
/** The panel's height limit (dp). Default 576. */
|
|
69
|
+
readonly maxHeight?: number;
|
|
70
|
+
/** Entries of a group shown before «show more». Default 3. */
|
|
71
|
+
readonly collapseAfter?: number;
|
|
72
|
+
/** Swipe an entry: from the start marks it read, from the end snoozes it (the first choice). Default true. */
|
|
73
|
+
readonly swipe?: boolean;
|
|
74
|
+
/** J/K, Enter, S and E on a keyboard. Default false. */
|
|
75
|
+
readonly keys?: boolean;
|
|
76
|
+
/** The name of a group without a source (default the label of its filter, else its kind). */
|
|
77
|
+
readonly groupTitle?: (group: G9NotificationGroup) => string;
|
|
78
|
+
readonly words?: G9NotificationCenterWords;
|
|
79
|
+
}
|
|
80
|
+
/** The notification center's content (inside a popover, a sheet or a page). */
|
|
81
|
+
export declare function G9NotificationCenter(props: G9NotificationCenterProps): ReactNode;
|
|
82
|
+
/** Props of {@link G9NotificationCenterPanel}. */
|
|
83
|
+
export interface G9NotificationCenterPanelProps extends Omit<G9NotificationCenterProps, 'variant'> {
|
|
84
|
+
readonly open: boolean;
|
|
85
|
+
readonly onClose: () => void;
|
|
86
|
+
/** The bell the popover opens beside (wide windows). */
|
|
87
|
+
readonly anchorId?: string;
|
|
88
|
+
/** Default `'end-end'` (beside a rail's bell). */
|
|
89
|
+
readonly placement?: G9Placement;
|
|
90
|
+
/** `'auto'` (default): a popover on wide windows, a sheet on phones. */
|
|
91
|
+
readonly mode?: 'auto' | 'popover' | 'sheet';
|
|
92
|
+
/** The popover's width (dp). Default 380. */
|
|
93
|
+
readonly width?: number;
|
|
94
|
+
readonly sheetOptions?: G9SheetOptions;
|
|
95
|
+
}
|
|
96
|
+
/** The center beside its bell (a popover) on wide windows, as a sheet on phones; opening an entry closes it. */
|
|
97
|
+
export declare function G9NotificationCenterPanel(props: G9NotificationCenterPanelProps): ReactNode;
|
|
98
|
+
//# sourceMappingURL=notification-center.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-center.d.ts","sourceRoot":"","sources":["../../src/notifications/notification-center.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,gBAAgB,CAAC;AAK1D,OAAO,EAAU,KAAK,UAAU,EAAa,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAGzB,MAA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SAAS,CAAC,EAAE,WAAW,CAAC;IACjC,wEAAwE;IACxE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IAC7C,6CAA6C;IAC7C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,CAAC,EAAE,cAAc,CAAC;CACxC;AAED,gHAAgH;AAChH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,8BAA8B,GAAG,SAAS,CAqC1F"}
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { toNativeDigits } from "@g9tm/lynxcontrols-foundation";
|
|
2
|
+
import { useState } from "@lynx-js/react";
|
|
3
|
+
import { g9IdProps, g9SafeId } from "../base/control.jsx";
|
|
4
|
+
import { G9IconButton } from "../button/icon-button.jsx";
|
|
5
|
+
import { useG9Keys } from "../commands/keys.jsx";
|
|
6
|
+
import { G9Icon } from "../icon/icon.jsx";
|
|
7
|
+
import { G9Menu, G9Popover } from "../popover/popover.jsx";
|
|
8
|
+
import { useG9Culture, useG9Direction, useG9Layout } from "../provider/hooks.jsx";
|
|
9
|
+
import { G9Sheet } from "../sheet/sheet.jsx";
|
|
10
|
+
import { G9SwipeGroup, G9SwipeView } from "../swipe/swipe-view.jsx";
|
|
11
|
+
import { g9GroupNotifications, g9UnreadByFilter } from "./model.jsx";
|
|
12
|
+
import "./notifications.css";
|
|
13
|
+
const EN = {
|
|
14
|
+
title: 'Notifications',
|
|
15
|
+
more: 'More',
|
|
16
|
+
actions: 'Actions',
|
|
17
|
+
markRead: 'Mark as read',
|
|
18
|
+
markGroupRead: 'Mark group as read',
|
|
19
|
+
markAllRead: 'Mark all as read',
|
|
20
|
+
snoozeAll: (when)=>`Snooze all: ${when}`,
|
|
21
|
+
showMore: (count)=>`Show ${count} more`,
|
|
22
|
+
showLess: 'Show less',
|
|
23
|
+
snoozed: (count)=>`Snoozed (${count})`,
|
|
24
|
+
backAt: (until)=>`Back ${until}`,
|
|
25
|
+
unsnooze: 'Bring back',
|
|
26
|
+
empty: 'No notifications',
|
|
27
|
+
emptyHint: 'You are all caught up.',
|
|
28
|
+
emptyFilter: 'Nothing here',
|
|
29
|
+
failed: 'Notifications could not be loaded',
|
|
30
|
+
unread: 'Unread',
|
|
31
|
+
groupActions: (title)=>`Actions: ${title}`
|
|
32
|
+
};
|
|
33
|
+
const g9SnoozeChoices = [
|
|
34
|
+
{
|
|
35
|
+
key: 'hour',
|
|
36
|
+
label: 'In an hour'
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: 'tomorrow',
|
|
40
|
+
label: 'Tomorrow at 9:00'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
key: 'week',
|
|
44
|
+
label: 'Next week'
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
function G9NotificationCenter(props) {
|
|
48
|
+
var _props_defaultFilter, _props_filter, _filters_find, _props_snoozeChoices, _props_id, _props_collapseAfter, _props_snoozed, _props_maxHeight;
|
|
49
|
+
var _props_filters, _filters_, _filters_1;
|
|
50
|
+
const digits = useG9Culture().numberingSystem;
|
|
51
|
+
const w = {
|
|
52
|
+
...EN,
|
|
53
|
+
number: (value)=>toNativeDigits(String(value), digits),
|
|
54
|
+
...props.words
|
|
55
|
+
};
|
|
56
|
+
const rtl = 'rtl' === useG9Direction();
|
|
57
|
+
const row = rtl ? 'row-reverse' : 'row';
|
|
58
|
+
const filters = (null == (_props_filters = props.filters) ? void 0 : _props_filters.length) ? props.filters : [
|
|
59
|
+
{
|
|
60
|
+
key: 'all',
|
|
61
|
+
label: 'All'
|
|
62
|
+
}
|
|
63
|
+
];
|
|
64
|
+
const [ownFilter, setOwnFilter] = useState(null != (_props_defaultFilter = props.defaultFilter) ? _props_defaultFilter : filters[0].key);
|
|
65
|
+
const filterKey = null != (_props_filter = props.filter) ? _props_filter : ownFilter;
|
|
66
|
+
const filter = null != (_filters_find = filters.find((f)=>f.key === filterKey)) ? _filters_find : filters[0];
|
|
67
|
+
const [expanded, setExpanded] = useState({});
|
|
68
|
+
const [showSnoozed, setShowSnoozed] = useState(false);
|
|
69
|
+
const [active, setActive] = useState(-1);
|
|
70
|
+
const [menu, setMenu] = useState({
|
|
71
|
+
open: false,
|
|
72
|
+
anchorId: '',
|
|
73
|
+
items: [],
|
|
74
|
+
run: {}
|
|
75
|
+
});
|
|
76
|
+
const choices = null != (_props_snoozeChoices = props.snoozeChoices) ? _props_snoozeChoices : g9SnoozeChoices;
|
|
77
|
+
const base = null != (_props_id = props.id) ? _props_id : 'G9Notifications';
|
|
78
|
+
const sheet = 'sheet' === props.variant;
|
|
79
|
+
const collapse = Math.max(1, null != (_props_collapseAfter = props.collapseAfter) ? _props_collapseAfter : 3);
|
|
80
|
+
const groups = g9GroupNotifications(props.items, filter);
|
|
81
|
+
const counts = g9UnreadByFilter(props.items, filters);
|
|
82
|
+
const unreadAll = props.items.filter((item)=>!item.read).length;
|
|
83
|
+
const shown = (group)=>group.items.length <= collapse || expanded[group.key] ? group.items : group.items.slice(0, collapse);
|
|
84
|
+
const visible = groups.flatMap(shown);
|
|
85
|
+
const chooseFilter = (key)=>{
|
|
86
|
+
var _props_onFilterChange;
|
|
87
|
+
if (void 0 === props.filter) setOwnFilter(key);
|
|
88
|
+
null == (_props_onFilterChange = props.onFilterChange) || _props_onFilterChange.call(props, key);
|
|
89
|
+
setActive(-1);
|
|
90
|
+
};
|
|
91
|
+
const markRead = (ids)=>{
|
|
92
|
+
var _props_onMarkRead;
|
|
93
|
+
const unread = ids.filter((id)=>props.items.some((item)=>item.id === id && !item.read));
|
|
94
|
+
if (unread.length) null == (_props_onMarkRead = props.onMarkRead) || _props_onMarkRead.call(props, unread);
|
|
95
|
+
};
|
|
96
|
+
const open = (entry)=>{
|
|
97
|
+
var _props_onOpen;
|
|
98
|
+
markRead([
|
|
99
|
+
entry.id
|
|
100
|
+
]);
|
|
101
|
+
null == (_props_onOpen = props.onOpen) || _props_onOpen.call(props, entry);
|
|
102
|
+
};
|
|
103
|
+
const snooze = (ids, choice)=>{
|
|
104
|
+
var _props_onSnooze;
|
|
105
|
+
return null == (_props_onSnooze = props.onSnooze) ? void 0 : _props_onSnooze.call(props, ids, choice);
|
|
106
|
+
};
|
|
107
|
+
const showMenu = (anchorId, entries)=>setMenu({
|
|
108
|
+
open: true,
|
|
109
|
+
anchorId,
|
|
110
|
+
items: entries.map(({ run: _run, ...item })=>item),
|
|
111
|
+
run: Object.fromEntries(entries.map((e)=>[
|
|
112
|
+
e.key,
|
|
113
|
+
e.run
|
|
114
|
+
]))
|
|
115
|
+
});
|
|
116
|
+
const titleOf = (group)=>{
|
|
117
|
+
var _ref, _ref1, _group_title;
|
|
118
|
+
var _props_groupTitle, _filters_find;
|
|
119
|
+
return null != (_ref = null != (_ref1 = null != (_group_title = group.title) ? _group_title : null == (_props_groupTitle = props.groupTitle) ? void 0 : _props_groupTitle.call(props, group)) ? _ref1 : null == (_filters_find = filters.find((f)=>f.key === group.category)) ? void 0 : _filters_find.label) ? _ref : group.kind;
|
|
120
|
+
};
|
|
121
|
+
const entryId = (entry)=>`${base}_Entry_${g9SafeId(entry.id)}`;
|
|
122
|
+
useG9Keys((e)=>{
|
|
123
|
+
const key = e.key.toLowerCase();
|
|
124
|
+
if ('j' === key || 'arrowdown' === key) setActive((i)=>Math.min(visible.length - 1, i + 1));
|
|
125
|
+
else if ('k' === key || 'arrowup' === key) setActive((i)=>Math.max(0, i - 1));
|
|
126
|
+
else {
|
|
127
|
+
const entry = visible[active];
|
|
128
|
+
if (!entry) return false;
|
|
129
|
+
if ('enter' === key) open(entry);
|
|
130
|
+
else if ('s' === key && choices[0]) snooze([
|
|
131
|
+
entry.id
|
|
132
|
+
], choices[0].key);
|
|
133
|
+
else {
|
|
134
|
+
if ('e' !== key) return false;
|
|
135
|
+
markRead([
|
|
136
|
+
entry.id
|
|
137
|
+
]);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return true;
|
|
141
|
+
}, {
|
|
142
|
+
enabled: true === props.keys
|
|
143
|
+
});
|
|
144
|
+
const headerMenu = ()=>{
|
|
145
|
+
var _props_menuItems;
|
|
146
|
+
return showMenu(`${base}_More`, [
|
|
147
|
+
{
|
|
148
|
+
key: 'g9-all-read',
|
|
149
|
+
label: w.markAllRead,
|
|
150
|
+
icon: 'check',
|
|
151
|
+
disabled: 0 === unreadAll,
|
|
152
|
+
run: ()=>{
|
|
153
|
+
var _props_onMarkAllRead;
|
|
154
|
+
return null == (_props_onMarkAllRead = props.onMarkAllRead) ? void 0 : _props_onMarkAllRead.call(props);
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
...(null != (_props_menuItems = props.menuItems) ? _props_menuItems : []).map((item)=>({
|
|
158
|
+
...item,
|
|
159
|
+
run: ()=>{
|
|
160
|
+
var _props_onMenuItem;
|
|
161
|
+
return null == (_props_onMenuItem = props.onMenuItem) ? void 0 : _props_onMenuItem.call(props, item.key);
|
|
162
|
+
}
|
|
163
|
+
}))
|
|
164
|
+
]);
|
|
165
|
+
};
|
|
166
|
+
const moreButton = <G9IconButton id={`${base}_More`} emoji="⋯" size="sm" isGhost accessibilityText={w.more} onPress={headerMenu}/>;
|
|
167
|
+
const entryView = (entry)=>{
|
|
168
|
+
var _entry_icon;
|
|
169
|
+
const read = true === entry.read;
|
|
170
|
+
const highlighted = visible.indexOf(entry) === active;
|
|
171
|
+
const card = <view className={highlighted ? 'g9-ntf__entry g9-ntf__entry--active' : 'g9-ntf__entry'} style={{
|
|
172
|
+
flexDirection: row,
|
|
173
|
+
direction: 'ltr'
|
|
174
|
+
}}>
|
|
175
|
+
<view className="g9-ntf__body" style={{
|
|
176
|
+
flexDirection: row,
|
|
177
|
+
direction: 'ltr'
|
|
178
|
+
}} bindtap={()=>open(entry)} {...g9IdProps(entryId(entry))}>
|
|
179
|
+
<view className={read ? 'g9-ntf__icon' : 'g9-ntf__icon g9-ntf__icon--unread'}>
|
|
180
|
+
<G9Icon icon={null != (_entry_icon = entry.icon) ? _entry_icon : 'info'} size={16} color={read ? 'var(--g9-text-tertiary)' : 'var(--g9-primary)'}/>
|
|
181
|
+
</view>
|
|
182
|
+
<view className="g9-ntf__texts">
|
|
183
|
+
<text className={read ? 'g9-ntf__text' : 'g9-ntf__text g9-ntf__text--unread'} style={{
|
|
184
|
+
textAlign: rtl ? 'right' : 'left'
|
|
185
|
+
}}>
|
|
186
|
+
{entry.text}
|
|
187
|
+
</text>
|
|
188
|
+
{entry.time ? <text className="g9-ntf__time" style={{
|
|
189
|
+
textAlign: rtl ? 'right' : 'left'
|
|
190
|
+
}}>
|
|
191
|
+
{entry.time}
|
|
192
|
+
</text> : null}
|
|
193
|
+
</view>
|
|
194
|
+
{read ? null : <view className="g9-ntf__dot" flatten={false} accessibility-element={true} accessibility-label={w.unread}/>}
|
|
195
|
+
</view>
|
|
196
|
+
<G9IconButton id={`${entryId(entry)}_More`} emoji="⋯" size="sm" isGhost accessibilityText={w.actions} onPress={()=>showMenu(`${entryId(entry)}_More`, [
|
|
197
|
+
...choices.map((c)=>({
|
|
198
|
+
key: `snooze:${c.key}`,
|
|
199
|
+
label: c.label,
|
|
200
|
+
icon: 'clock',
|
|
201
|
+
run: ()=>snooze([
|
|
202
|
+
entry.id
|
|
203
|
+
], c.key)
|
|
204
|
+
})),
|
|
205
|
+
...read ? [] : [
|
|
206
|
+
{
|
|
207
|
+
key: 'read',
|
|
208
|
+
label: w.markRead,
|
|
209
|
+
icon: 'check',
|
|
210
|
+
separatorBefore: true,
|
|
211
|
+
run: ()=>markRead([
|
|
212
|
+
entry.id
|
|
213
|
+
])
|
|
214
|
+
}
|
|
215
|
+
]
|
|
216
|
+
])}/>
|
|
217
|
+
</view>;
|
|
218
|
+
if (false === props.swipe) return <view key={entry.id}>{card}</view>;
|
|
219
|
+
const first = choices[0];
|
|
220
|
+
return <G9SwipeView key={entry.id} itemKey={entry.id} cornerRadius={0} leftActions={read ? [] : [
|
|
221
|
+
{
|
|
222
|
+
icon: 'check',
|
|
223
|
+
text: w.markRead,
|
|
224
|
+
command: ()=>markRead([
|
|
225
|
+
entry.id
|
|
226
|
+
])
|
|
227
|
+
}
|
|
228
|
+
]} rightActions={first ? [
|
|
229
|
+
{
|
|
230
|
+
icon: 'clock',
|
|
231
|
+
text: first.label,
|
|
232
|
+
background: 'var(--g9-warning)',
|
|
233
|
+
command: ()=>snooze([
|
|
234
|
+
entry.id
|
|
235
|
+
], first.key)
|
|
236
|
+
}
|
|
237
|
+
] : []} cardBackground="var(--g9-surface)">
|
|
238
|
+
{card}
|
|
239
|
+
</G9SwipeView>;
|
|
240
|
+
};
|
|
241
|
+
const groupView = (group, index)=>{
|
|
242
|
+
if (1 === group.items.length) return <view key={group.key} className="g9-ntf__group">
|
|
243
|
+
{entryView(group.items[0])}
|
|
244
|
+
</view>;
|
|
245
|
+
const title = titleOf(group);
|
|
246
|
+
const ids = group.items.map((item)=>item.id);
|
|
247
|
+
const open = true === expanded[group.key];
|
|
248
|
+
return <view key={group.key} className={index < groups.length - 1 ? 'g9-ntf__group g9-ntf__group--line' : 'g9-ntf__group'}>
|
|
249
|
+
<view className="g9-ntf__group-head" style={{
|
|
250
|
+
flexDirection: row,
|
|
251
|
+
direction: 'ltr'
|
|
252
|
+
}}>
|
|
253
|
+
<text className="g9-ntf__group-title" text-maxline="1" style={{
|
|
254
|
+
textAlign: rtl ? 'right' : 'left'
|
|
255
|
+
}}>
|
|
256
|
+
{title}
|
|
257
|
+
</text>
|
|
258
|
+
{group.unread > 0 ? <view className="g9-ntf__badge">
|
|
259
|
+
<text className="g9-ntf__badge-text">{w.number(group.unread)}</text>
|
|
260
|
+
</view> : null}
|
|
261
|
+
<G9IconButton id={`${base}_Group_${index}`} emoji="⋯" size="sm" isGhost accessibilityText={w.groupActions(title)} onPress={()=>showMenu(`${base}_Group_${index}`, [
|
|
262
|
+
...group.unread > 0 ? [
|
|
263
|
+
{
|
|
264
|
+
key: 'read',
|
|
265
|
+
label: w.markGroupRead,
|
|
266
|
+
icon: 'check',
|
|
267
|
+
run: ()=>markRead(ids)
|
|
268
|
+
}
|
|
269
|
+
] : [],
|
|
270
|
+
...choices.map((c, at)=>({
|
|
271
|
+
key: `snooze:${c.key}`,
|
|
272
|
+
label: w.snoozeAll(c.label),
|
|
273
|
+
icon: 'clock',
|
|
274
|
+
separatorBefore: 0 === at && group.unread > 0,
|
|
275
|
+
run: ()=>snooze(ids, c.key)
|
|
276
|
+
}))
|
|
277
|
+
])}/>
|
|
278
|
+
</view>
|
|
279
|
+
{shown(group).map(entryView)}
|
|
280
|
+
{group.items.length > collapse ? <view className="g9-ntf__toggle" style={{
|
|
281
|
+
flexDirection: row,
|
|
282
|
+
direction: 'ltr'
|
|
283
|
+
}} {...g9IdProps(`${base}_Toggle_${index}`)} bindtap={()=>setExpanded({
|
|
284
|
+
...expanded,
|
|
285
|
+
[group.key]: !open
|
|
286
|
+
})}>
|
|
287
|
+
<G9Icon icon={open ? 'chevronUp' : 'chevronDown'} size={14} color="var(--g9-primary)"/>
|
|
288
|
+
<text className="g9-ntf__toggle-text">
|
|
289
|
+
{open ? w.showLess : w.showMore(w.number(group.items.length - collapse))}
|
|
290
|
+
</text>
|
|
291
|
+
</view> : null}
|
|
292
|
+
</view>;
|
|
293
|
+
};
|
|
294
|
+
const snoozed = null != (_props_snoozed = props.snoozed) ? _props_snoozed : [];
|
|
295
|
+
return <view className="g9-ntf" {...g9IdProps(props.id)} style={sheet ? {} : {
|
|
296
|
+
maxHeight: `${null != (_props_maxHeight = props.maxHeight) ? _props_maxHeight : 576}px`
|
|
297
|
+
}}>
|
|
298
|
+
{sheet ? null : <view className="g9-ntf__header" style={{
|
|
299
|
+
flexDirection: row,
|
|
300
|
+
direction: 'ltr'
|
|
301
|
+
}}>
|
|
302
|
+
<text className="g9-ntf__title" style={{
|
|
303
|
+
textAlign: rtl ? 'right' : 'left'
|
|
304
|
+
}}>
|
|
305
|
+
{unreadAll > 0 ? `${w.title} (${w.number(unreadAll)})` : w.title}
|
|
306
|
+
</text>
|
|
307
|
+
{moreButton}
|
|
308
|
+
</view>}
|
|
309
|
+
<view className="g9-ntf__filters-row" style={{
|
|
310
|
+
flexDirection: row,
|
|
311
|
+
direction: 'ltr'
|
|
312
|
+
}}>
|
|
313
|
+
<scroll-view className="g9-ntf__filters" scroll-orientation="horizontal" scroll-bar-enable={false}>
|
|
314
|
+
<view className="g9-ntf__chips" style={{
|
|
315
|
+
flexDirection: row,
|
|
316
|
+
direction: 'ltr'
|
|
317
|
+
}}>
|
|
318
|
+
{filters.map((option)=>{
|
|
319
|
+
var _counts_option_key;
|
|
320
|
+
const on = option.key === filter.key;
|
|
321
|
+
const count = null != (_counts_option_key = counts[option.key]) ? _counts_option_key : 0;
|
|
322
|
+
return <view key={option.key} className={on ? 'g9-ntf__chip g9-ntf__chip--on' : 'g9-ntf__chip'} style={{
|
|
323
|
+
flexDirection: row,
|
|
324
|
+
direction: 'ltr'
|
|
325
|
+
}} {...g9IdProps(`${base}_Filter_${g9SafeId(option.key)}`)} accessibility-element={true} accessibility-label={count > 0 ? `${option.label} ${w.number(count)}` : option.label} bindtap={()=>chooseFilter(option.key)}>
|
|
326
|
+
<text className={on ? 'g9-ntf__chip-text g9-ntf__chip-text--on' : 'g9-ntf__chip-text'}>
|
|
327
|
+
{option.label}
|
|
328
|
+
</text>
|
|
329
|
+
{count > 0 ? <text className={on ? 'g9-ntf__chip-count g9-ntf__chip-count--on' : 'g9-ntf__chip-count'}>
|
|
330
|
+
{w.number(count)}
|
|
331
|
+
</text> : null}
|
|
332
|
+
</view>;
|
|
333
|
+
})}
|
|
334
|
+
</view>
|
|
335
|
+
</scroll-view>
|
|
336
|
+
{sheet ? moreButton : null}
|
|
337
|
+
</view>
|
|
338
|
+
{props.extra ? <view className="g9-ntf__extra">{props.extra}</view> : null}
|
|
339
|
+
<scroll-view className="g9-ntf__list" scroll-orientation="vertical">
|
|
340
|
+
<G9SwipeGroup>
|
|
341
|
+
{0 === groups.length ? <view className="g9-ntf__empty">
|
|
342
|
+
<text className="g9-ntf__empty-title">
|
|
343
|
+
{props.failed ? w.failed : filter.key === (null == (_filters_ = filters[0]) ? void 0 : _filters_.key) ? w.empty : w.emptyFilter}
|
|
344
|
+
</text>
|
|
345
|
+
{!props.failed && filter.key === (null == (_filters_1 = filters[0]) ? void 0 : _filters_1.key) ? <text className="g9-ntf__empty-hint">{w.emptyHint}</text> : null}
|
|
346
|
+
</view> : groups.map(groupView)}
|
|
347
|
+
</G9SwipeGroup>
|
|
348
|
+
{snoozed.length ? <view className="g9-ntf__snoozed">
|
|
349
|
+
<view className="g9-ntf__snoozed-head" style={{
|
|
350
|
+
flexDirection: row,
|
|
351
|
+
direction: 'ltr'
|
|
352
|
+
}} {...g9IdProps(`${base}_Snoozed`)} bindtap={()=>setShowSnoozed(!showSnoozed)}>
|
|
353
|
+
<G9Icon icon="clock" size={14} color="var(--g9-text-secondary)"/>
|
|
354
|
+
<text className="g9-ntf__group-title">{w.snoozed(w.number(snoozed.length))}</text>
|
|
355
|
+
<G9Icon icon={showSnoozed ? 'chevronUp' : 'chevronDown'} size={14} color="var(--g9-text-secondary)"/>
|
|
356
|
+
</view>
|
|
357
|
+
{showSnoozed ? snoozed.map((s)=><view key={s.entry.id} className="g9-ntf__snoozed-row" style={{
|
|
358
|
+
flexDirection: row,
|
|
359
|
+
direction: 'ltr'
|
|
360
|
+
}}>
|
|
361
|
+
<view className="g9-ntf__texts">
|
|
362
|
+
<text className="g9-ntf__text" text-maxline="1" style={{
|
|
363
|
+
textAlign: rtl ? 'right' : 'left'
|
|
364
|
+
}}>
|
|
365
|
+
{s.entry.text}
|
|
366
|
+
</text>
|
|
367
|
+
<text className="g9-ntf__time" style={{
|
|
368
|
+
textAlign: rtl ? 'right' : 'left'
|
|
369
|
+
}}>
|
|
370
|
+
{w.backAt(s.until)}
|
|
371
|
+
</text>
|
|
372
|
+
</view>
|
|
373
|
+
<view className="g9-ntf__unsnooze" {...g9IdProps(`${base}_Unsnooze_${g9SafeId(s.entry.id)}`)} bindtap={()=>{
|
|
374
|
+
var _props_onUnsnooze;
|
|
375
|
+
return null == (_props_onUnsnooze = props.onUnsnooze) ? void 0 : _props_onUnsnooze.call(props, s.entry.id);
|
|
376
|
+
}}>
|
|
377
|
+
<text className="g9-ntf__toggle-text">{w.unsnooze}</text>
|
|
378
|
+
</view>
|
|
379
|
+
</view>) : null}
|
|
380
|
+
</view> : null}
|
|
381
|
+
</scroll-view>
|
|
382
|
+
<G9Menu id={`${base}_Menu`} open={menu.open} onClose={()=>setMenu((m)=>({
|
|
383
|
+
...m,
|
|
384
|
+
open: false
|
|
385
|
+
}))} anchorId={menu.anchorId} placement="bottom-end" items={menu.items} onSelect={(key)=>{
|
|
386
|
+
var _menu_run_key, _menu_run;
|
|
387
|
+
return null == (_menu_run_key = (_menu_run = menu.run)[key]) ? void 0 : _menu_run_key.call(_menu_run);
|
|
388
|
+
}}/>
|
|
389
|
+
</view>;
|
|
390
|
+
}
|
|
391
|
+
function G9NotificationCenterPanel(props) {
|
|
392
|
+
var _ref;
|
|
393
|
+
var _props_words;
|
|
394
|
+
const { wide } = useG9Layout();
|
|
395
|
+
const sheet = 'sheet' === props.mode || 'popover' !== props.mode && !wide;
|
|
396
|
+
const { open, onClose, anchorId, placement, mode: _mode, width, sheetOptions, ...center } = props;
|
|
397
|
+
const content = <G9NotificationCenter {...center} variant={sheet ? 'sheet' : 'panel'} onOpen={(entry)=>{
|
|
398
|
+
var _props_onOpen;
|
|
399
|
+
null == (_props_onOpen = props.onOpen) || _props_onOpen.call(props, entry);
|
|
400
|
+
onClose();
|
|
401
|
+
}}/>;
|
|
402
|
+
if (sheet) return <G9Sheet open={open} onOpenChange={(o)=>{
|
|
403
|
+
if (!o) onClose();
|
|
404
|
+
}} options={{
|
|
405
|
+
title: null != (_ref = null == (_props_words = props.words) ? void 0 : _props_words.title) ? _ref : EN.title,
|
|
406
|
+
states: [
|
|
407
|
+
'medium',
|
|
408
|
+
'large'
|
|
409
|
+
],
|
|
410
|
+
...sheetOptions
|
|
411
|
+
}}>
|
|
412
|
+
{content}
|
|
413
|
+
</G9Sheet>;
|
|
414
|
+
return <G9Popover open={open} onClose={onClose} {...anchorId ? {
|
|
415
|
+
anchorId
|
|
416
|
+
} : {}} placement={null != placement ? placement : 'end-end'} {...props.id ? {
|
|
417
|
+
id: `${props.id}_Popover`
|
|
418
|
+
} : {}}>
|
|
419
|
+
<view style={{
|
|
420
|
+
width: `${null != width ? width : 380}px`
|
|
421
|
+
}}>{content}</view>
|
|
422
|
+
</G9Popover>;
|
|
423
|
+
}
|
|
424
|
+
export { G9NotificationCenter, G9NotificationCenterPanel, g9SnoozeChoices };
|