@maropost-ui/liquidsky-ui 1.0.0-alpha.1 → 1.0.0-alpha.2

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.
Files changed (45) hide show
  1. package/README.md +16 -1
  2. package/dist/components/TheHeader/types.d.ts +30 -0
  3. package/dist/components/index.d.ts +3 -0
  4. package/dist/components/vuetify-wrappers/index.d.ts +37 -0
  5. package/dist/components/vuetify-wrappers/useWrapperDefaults.d.ts +2 -0
  6. package/dist/components/vuetify-wrappers/wrapWithMpTest.d.ts +9 -0
  7. package/dist/composables/index.d.ts +2 -0
  8. package/dist/composables/useHotkeys.d.ts +36 -0
  9. package/dist/composables/useMpTestId.d.ts +7 -11
  10. package/dist/directives/MpTest.d.ts +36 -14
  11. package/dist/directives/index.d.ts +1 -0
  12. package/dist/directives/mpTestComponentDefaults.d.ts +546 -0
  13. package/dist/directives/mpTestConfig.d.ts +31 -0
  14. package/dist/index.css +1 -1
  15. package/dist/index.d.ts +3 -1
  16. package/dist/index.js +22681 -20628
  17. package/dist/lib/davinci-orb/mark.d.ts +13 -0
  18. package/dist/types/AlertModalProps.d.ts +1 -2
  19. package/dist/types/AppClipboardProps.d.ts +1 -2
  20. package/dist/types/AppConfirmationDialogProps.d.ts +1 -2
  21. package/dist/types/AppDataTableProps.d.ts +1 -2
  22. package/dist/types/AppDialogWrapperProps.d.ts +1 -2
  23. package/dist/types/AppDrawerWrapperProps.d.ts +1 -2
  24. package/dist/types/AppDropdownProps.d.ts +1 -2
  25. package/dist/types/AppMultiCellValueProps.d.ts +1 -2
  26. package/dist/types/AppSnackbarProps.d.ts +1 -2
  27. package/dist/types/AppSplitButtonProps.d.ts +1 -2
  28. package/dist/types/AppStepperProps.d.ts +1 -2
  29. package/dist/types/AppTableActionMenuProps.d.ts +1 -2
  30. package/dist/types/AppsDropdownProps.d.ts +1 -2
  31. package/dist/types/MpNotificationsMenuProps.d.ts +38 -0
  32. package/dist/types/MpTestIdProps.d.ts +6 -2
  33. package/dist/types/NotificationIconProps.d.ts +1 -2
  34. package/dist/types/SearchBarProps.d.ts +1 -2
  35. package/dist/types/SlVueTreeNextProps.d.ts +1 -2
  36. package/dist/types/TheNavigationProps.d.ts +1 -2
  37. package/dist/types/TheNotificationDrawerProps.d.ts +1 -2
  38. package/dist/types/TheOnboardingScreenChecklistsProps.d.ts +1 -2
  39. package/dist/types/TheTimezoneProps.d.ts +1 -2
  40. package/dist/types/TheUserDropdownProps.d.ts +36 -0
  41. package/dist/types/index.d.ts +1 -0
  42. package/dist/types/router.d.ts +1 -2
  43. package/dist/utils/index.d.ts +1 -0
  44. package/dist/utils/mpTestAttrs.d.ts +22 -0
  45. package/package.json +1 -1
package/README.md CHANGED
@@ -40,6 +40,22 @@ import { AppBreadcrumb, TheThemeSwitcher } from '@maropost-ui/liquidsky-ui'
40
40
 
41
41
  Theme lives in `TheUserDropdown`: click **Theme** for Classic / Marobase. Light / Dark sun–moon controls appear on the right only for Marobase. Persist key is `liquidsky-theme`.
42
42
 
43
+ ## Test identifiers (`v-mp-test`)
44
+
45
+ Default `data-testid`s **per component** (root + built-in actions) live in source:
46
+
47
+ - [`src/directives/mpTestComponentDefaults.ts`](src/directives/mpTestComponentDefaults.ts) — `MP_TEST_COMPONENT_DEFAULTS`
48
+ - [`src/directives/mpTestConfig.ts`](src/directives/mpTestConfig.ts) — `MP_TEST_IDS` string constants
49
+
50
+ ```ts
51
+ import { MP_TEST_COMPONENT_DEFAULTS, MP_TEST_IDS } from '@maropost-ui/liquidsky-ui'
52
+
53
+ MP_TEST_COMPONENT_DEFAULTS.AppDialogWrapper.ids
54
+ // → [{ role: 'root', id: 'mp-dialog' }, { role: 'cancel', … }, { role: 'save', … }]
55
+ ```
56
+
57
+ Storybook: **Directives → MpTest** (catalog of defaults).
58
+
43
59
  ------------------------------------------------------------------------
44
60
 
45
61
  ------------------------------------------------------------------------
@@ -367,4 +383,3 @@ stories/
367
383
  ```
368
384
 
369
385
 
370
-
@@ -1,7 +1,35 @@
1
1
  import type { NotificationIconProps } from '../../types/NotificationIconProps';
2
+ import type { MpNotificationsMenuProps } from '../../types/MpNotificationsMenuProps';
3
+ import type { NotificationItem } from '../../types/TheNotificationDrawerProps';
2
4
  import type { MpTestIdProps } from '../../types/MpTestIdProps';
5
+ export type CreateNewMenuIcon = 'dashboard' | 'email-campaign' | 'segment' | 'automation' | 'contact-list';
6
+ /** A destination shown in the Marobase header's Create new menu. */
7
+ export type CreateNewMenuItem = {
8
+ /** Stable key for rendering the item. */
9
+ id: string;
10
+ title: string;
11
+ description?: string;
12
+ /** Icon rendered by the library. */
13
+ icon?: CreateNewMenuIcon;
14
+ /** Optional keyboard hint displayed at the end of the item. */
15
+ shortcut?: string;
16
+ /** Application-owned navigation or creation action. */
17
+ onClick: () => void;
18
+ };
19
+ export type MpNotificationsMenuBindings = MpNotificationsMenuProps & {
20
+ onOpen?: () => void;
21
+ onClose?: () => void;
22
+ onSeeAll?: () => void;
23
+ onMarkAllRead?: () => void;
24
+ onNotificationClick?: (notification: NotificationItem) => void;
25
+ onDownload?: (notification: NotificationItem) => void;
26
+ onRetry?: () => void;
27
+ onLoadMore?: () => void;
28
+ };
3
29
  /** Application-owned permissions and navigation for Liquidsky's header controls. */
4
30
  export type HeaderActions = {
31
+ /** Items for the Marobase Create new (+) menu. When omitted, + retains its What's new action. */
32
+ createNewItems?: CreateNewMenuItem[];
5
33
  showSettings?: boolean;
6
34
  settingsHref?: string;
7
35
  onSettingsClick?: (event: MouseEvent) => void;
@@ -35,4 +63,6 @@ export type TheHeaderProps = {
35
63
  hideAppBarNavIcon?: boolean;
36
64
  /** notification icon props e.g. { icon: "mdi-bell", color: "primary" } */
37
65
  notificationIconProps?: NotificationIconProps;
66
+ /** Marobase notification menu data, states, and application-owned action handlers. */
67
+ notificationMenuProps?: MpNotificationsMenuBindings;
38
68
  } & MpTestIdProps;
@@ -23,10 +23,12 @@ export { default as AppGridTable } from "./AppGridTable.vue";
23
23
  export { default as TheAccountDropdown } from "./TheAccountDropdown.vue";
24
24
  export { default as TheAppsDropdown } from "./TheAppsDropdown.vue";
25
25
  export { default as TheHeader } from "./TheHeader";
26
+ export type { CreateNewMenuIcon, CreateNewMenuItem, HeaderActions, MpNotificationsMenuBindings, TheHeaderProps } from './TheHeader/types';
26
27
  export { default as TheAppShell } from "./TheAppShell";
27
28
  export { default as TheNavigation } from "./TheNavigation.vue";
28
29
  export { default as TheNotificationDrawer } from "./TheNotificationDrawer.vue";
29
30
  export { default as TheNotificationIcon } from "./TheNotificationIcon.vue";
31
+ export { default as MpNotificationsMenu } from "./MpNotificationsMenu.vue";
30
32
  export { default as TheSearchBar } from "./TheSearchBar";
31
33
  export { default as TheSecondaryNavigation } from "./TheSecondaryNavigation.vue";
32
34
  export { default as MpSectionRail } from './MpSectionRail/MpSectionRail.vue';
@@ -42,6 +44,7 @@ export { default as TheOnboardingBanner } from "./TheOnboardingBanner.vue";
42
44
  export { default as TheOnboardingScreenChecklists } from "./TheOnboardingScreenChecklists.vue";
43
45
  export { default as AppButton } from "./AppButton.vue";
44
46
  export { default as AppSplitButton } from "./AppSplitButton.vue";
47
+ export { MpVBtn, MpVTextField, MpVTextarea, MpVDateInput, MpVSelect, MpVAutocomplete, MpVCheckbox, MpVCheckboxBtn, MpVSwitch, MpVRadio, MpVRadioGroup, MpVForm, MpVChip, MpVStatusChip, MpVMenu, MpVDialog, MpVTabs, MpVTab, MpVCombobox, MpVFileInput, MpVBtnToggle, MpVList, MpVListItem, MpVAlert, MpVExpansionPanels, MpVExpansionPanel, MpVPagination, MpVTooltip, MpVSnackbar, MpVNavigationDrawer, MpVDataTable, MpVDataTableServer, MpVDataTableVirtual, MpVStepper, MpVDatePicker, MpVMaskInput, wrapWithMpTest, } from "./vuetify-wrappers";
45
48
  export { default as SlVueTreeNext } from "./SlVueTreeNext.vue";
46
49
  export { default as AppStepper } from "./AppStepper/AppStepper.vue";
47
50
  export { default as AppDatePicker } from "./AppDatePicker.vue";
@@ -0,0 +1,37 @@
1
+ export { default as MpVBtn } from './MpVBtn.vue';
2
+ export { default as MpVTextField } from './MpVTextField.vue';
3
+ export { default as MpVTextarea } from './MpVTextarea.vue';
4
+ export { default as MpVDateInput } from './MpVDateInput.vue';
5
+ export { default as MpVSelect } from './MpVSelect.vue';
6
+ export { default as MpVAutocomplete } from './MpVAutocomplete.vue';
7
+ export { default as MpVCheckbox } from './MpVCheckbox.vue';
8
+ export { default as MpVCheckboxBtn } from './MpVCheckboxBtn.vue';
9
+ export { default as MpVSwitch } from './MpVSwitch.vue';
10
+ export { default as MpVRadio } from './MpVRadio.vue';
11
+ export { default as MpVRadioGroup } from './MpVRadioGroup.vue';
12
+ export { default as MpVForm } from './MpVForm.vue';
13
+ export { default as MpVChip } from './MpVChip.vue';
14
+ export { default as MpVStatusChip } from './MpVStatusChip.vue';
15
+ export { default as MpVMenu } from './MpVMenu.vue';
16
+ export { default as MpVDialog } from './MpVDialog.vue';
17
+ export { default as MpVTabs } from './MpVTabs.vue';
18
+ export { default as MpVTab } from './MpVTab.vue';
19
+ export { default as MpVCombobox } from './MpVCombobox.vue';
20
+ export { default as MpVFileInput } from './MpVFileInput.vue';
21
+ export { default as MpVBtnToggle } from './MpVBtnToggle.vue';
22
+ export { default as MpVList } from './MpVList.vue';
23
+ export { default as MpVListItem } from './MpVListItem.vue';
24
+ export { default as MpVAlert } from './MpVAlert.vue';
25
+ export { default as MpVExpansionPanels } from './MpVExpansionPanels.vue';
26
+ export { default as MpVExpansionPanel } from './MpVExpansionPanel.vue';
27
+ export { default as MpVPagination } from './MpVPagination.vue';
28
+ export { default as MpVTooltip } from './MpVTooltip.vue';
29
+ export { default as MpVSnackbar } from './MpVSnackbar.vue';
30
+ export { default as MpVNavigationDrawer } from './MpVNavigationDrawer.vue';
31
+ export { default as MpVDataTable } from './MpVDataTable.vue';
32
+ export { default as MpVDataTableServer } from './MpVDataTableServer.vue';
33
+ export { default as MpVDataTableVirtual } from './MpVDataTableVirtual.vue';
34
+ export { default as MpVStepper } from './MpVStepper.vue';
35
+ export { default as MpVDatePicker } from './MpVDatePicker.vue';
36
+ export { default as MpVMaskInput } from './MpVMaskInput.vue';
37
+ export { wrapWithMpTest } from './wrapWithMpTest';
@@ -0,0 +1,2 @@
1
+ /** Keep the inner Vuetify component in the wrapper's named defaults scope. */
2
+ export declare function useWrapperDefaults(defaultName: string): import("vue").ComputedRef<string>;
@@ -0,0 +1,9 @@
1
+ import { type Component } from 'vue';
2
+ /**
3
+ * Transparent HOC: apply a default `v-mp-test` base id to an app-provided
4
+ * Vuetify remap (e.g. Commerce `AppTextFieldInput`) without requiring the
5
+ * consuming app to import `MP_TEST_IDS` or change its wrapper.
6
+ */
7
+ export declare function wrapWithMpTest(Inner: Component, testId: string, name: string, defaultsName?: string): import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
8
+ [key: string]: any;
9
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -6,6 +6,8 @@ export { default as useValidation } from "./useValidation";
6
6
  export { default as useClipboard } from "./useClipboard";
7
7
  export { default as useDebounce } from "./useDebounce";
8
8
  export { default as useEmoji } from "./useEmoji";
9
+ export { default as useHotkeys } from "./useHotkeys";
10
+ export type { HotkeyBinding, UseHotkeysOptions } from "./useHotkeys";
9
11
  export { default as toRefs } from "./toRefs";
10
12
  export { default as useUnitConversion } from "./useUnitConversion";
11
13
  export { default as useTimezoneTime } from "./useCalculateTime";
@@ -0,0 +1,36 @@
1
+ import { type MaybeRefOrGetter } from 'vue';
2
+ export type HotkeyBinding = {
3
+ key: string;
4
+ handler: (event: KeyboardEvent) => void;
5
+ };
6
+ export type UseHotkeysOptions = {
7
+ /** Reactively enables or disables all bindings. */
8
+ enabled?: MaybeRefOrGetter<boolean>;
9
+ /** Allow shortcuts while typing in inputs, textareas, selects, or editable content. */
10
+ allowInEditable?: boolean;
11
+ /** Ignore key-repeat events. */
12
+ ignoreRepeat?: boolean;
13
+ /** Prevent the browser's default action when a binding matches. */
14
+ preventDefault?: boolean;
15
+ };
16
+ /**
17
+ * @description Listen for case-insensitive, unmodified keyboard shortcuts and fire matching handlers.
18
+ * Bindings and the enabled state may be reactive. By default, shortcuts are ignored while the
19
+ * user is typing, during IME composition, when modifier keys are held, and for repeated keydown
20
+ * events. The window listener is registered and removed with the owning component lifecycle.
21
+ *
22
+ * @example
23
+ * import { computed, ref } from 'vue'
24
+ * import { useHotkeys } from '@maropost-ui/liquidsky-ui'
25
+ *
26
+ * const menuOpen = ref(false)
27
+ * const bindings = computed(() => [
28
+ * { key: 'D', handler: () => router.push('/dashboard') },
29
+ * { key: 'E', handler: () => router.push('/campaigns/new') },
30
+ * ])
31
+ *
32
+ * useHotkeys(bindings, { enabled: menuOpen })
33
+ */
34
+ export default function useHotkeys(bindings: MaybeRefOrGetter<HotkeyBinding[]>, options?: UseHotkeysOptions): {
35
+ handleKeydown: (event: KeyboardEvent) => void;
36
+ };
@@ -1,17 +1,13 @@
1
+ import { type MpTestBindingObject } from '../directives/MpTest';
1
2
  import { type ComputedRef, type MaybeRefOrGetter } from 'vue';
2
3
  /**
3
- * Resolves a test identifier from a component default, optional override, and optional suffix.
4
- * Override (`testId`) wins over suffix (`testIdSuffix`).
4
+ * @deprecated Prefer `resolveMpTestBinding` / `v-mp-test`.
5
+ * Legacy `(defaultId, testId?, testIdSuffix?)` still supported.
5
6
  */
6
- export declare function resolveMpTestId(defaultId: string, testId?: string, testIdSuffix?: string): string;
7
+ export declare function resolveMpTestId(defaultIdOrBinding: string | MpTestBindingObject, testId?: string, testIdSuffix?: string): string;
7
8
  /**
8
- * @description
9
- * Reactive test identifier for `v-mp-test`. Pass a component default plus optional
10
- * `testId` (override) and `testIdSuffix` (extend) props.
11
- *
12
- * @example
13
- * ```ts
14
- * const mpTestId = useMpTestId(MP_TEST_IDS.button, () => props.testId, () => props.testIdSuffix)
15
- * ```
9
+ * @deprecated Prefer `v-mp-test="MP_TEST_IDS.*"` or
10
+ * `v-mp-test="{ action, module, suffix }"`. This compatibility wrapper remains
11
+ * available for themed components and consumers using the legacy test-id props.
16
12
  */
17
13
  export default function useMpTestId(defaultId: string, testId?: MaybeRefOrGetter<string | undefined>, testIdSuffix?: MaybeRefOrGetter<string | undefined>): ComputedRef<string>;
@@ -1,23 +1,45 @@
1
1
  import type { ObjectDirective } from 'vue';
2
2
  /**
3
3
  * @description
4
- * A custom Vue directive (`v-mp-test`) that applies a test identifier to an element
5
- * for Playwright (`data-testid`) and Cypress (`data-cy` / `data-test-cy`).
6
- * Attribute names are defined once in `mpTestConfig.ts`; changing that list updates every usage.
7
- * Prefer `testId` / `testIdSuffix` props on Liquidsky components so defaults can be extended or overridden.
4
+ * `v-mp-test` applies Playwright/Cypress test ids (`data-testid`, `data-cy`, …).
8
5
  *
9
- * @example Basic usage in a Vue component:
10
- * ```vue
11
- * <template>
12
- * <div v-mp-test="'checkout-summary'">Summary</div>
13
- * <AppDataTable />
14
- * <AppDataTable test-id-suffix="inventory" />
15
- * <AppDataTable test-id="inventory-table" />
16
- * </template>
17
- * ```
6
+ * Final id shape: `mp-{component}[-{action}][-{module}][-{suffix}]`
7
+ * (omit empty optional segments).
8
+ *
9
+ * Binding:
10
+ * - Component string (`MP_TEST_IDS.breadcrumb`) → **base** (`mp-breadcrumb`)
11
+ * - Object `{ action?, module?, suffix? }` → segments merged onto base
12
+ * - Consumer string → **full replace** of the entire id
13
+ * - Directive arg (`v-mp-test:mp-button`) → base when no string base yet
14
+ *
15
+ * Merge (Liquidsky default on root + parent customization):
16
+ * - `<AppBreadcrumb />` → `mp-breadcrumb`
17
+ * - `<AppBreadcrumb v-mp-test="{ action: 'click', module: 'collection', suffix: 'test' }" />`
18
+ * → `mp-breadcrumb-click-collection-test`
19
+ * - `<AppBreadcrumb v-mp-test="'testing-collection-button-click'" />`
20
+ * → `testing-collection-button-click`
18
21
  */
22
+ export type MpTestBindingObject = {
23
+ action?: string;
24
+ module?: string;
25
+ suffix?: string;
26
+ };
27
+ export type MpTestBinding = string | MpTestBindingObject | null | undefined;
28
+ type MpTestContribution = {
29
+ base?: string;
30
+ action?: string;
31
+ module?: string;
32
+ suffix?: string;
33
+ /** Plain string that replaces the entire resolved id. */
34
+ fullReplace?: string;
35
+ /** True when this contribution came from a plain string binding. */
36
+ fromString?: boolean;
37
+ };
19
38
  interface MpTestHTMLElement extends HTMLElement {
20
39
  _vMpTestValue?: string;
40
+ _vMpTestContrib?: Map<string, MpTestContribution>;
21
41
  }
22
- export declare const vMpTest: ObjectDirective<MpTestHTMLElement, unknown>;
42
+ /** Build final id from a single binding (+ optional arg default as base). */
43
+ export declare function resolveMpTestBinding(bindingValue: unknown, argDefault?: string): string;
44
+ export declare const vMpTest: ObjectDirective<MpTestHTMLElement, MpTestBinding>;
23
45
  export default vMpTest;
@@ -2,3 +2,4 @@ export { default as tooltipOverflowCheck } from './TooltipOverflowCheck';
2
2
  export { default as Clipboard } from './Clipboard';
3
3
  export { default as MpTest, vMpTest } from './MpTest';
4
4
  export { MP_TEST_ATTRIBUTES, MP_TEST_IDS } from './mpTestConfig';
5
+ export { MP_TEST_COMPONENT_DEFAULTS, type MpTestComponentDefaultEntry, type MpTestComponentDefaultGroup, type MpTestComponentName } from './mpTestComponentDefaults';