@selfhelp/shared 1.18.0 → 1.20.0
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/CHANGELOG.md +36 -0
- package/dist/index.d.mts +152 -3
- package/dist/index.d.ts +152 -3
- package/dist/index.js +187 -0
- package/dist/index.mjs +167 -0
- package/dist/plugin-sdk/index.d.mts +1 -1
- package/dist/plugin-sdk/index.d.ts +1 -1
- package/dist/registry/index.d.mts +2 -2
- package/dist/registry/index.d.ts +2 -2
- package/dist/{styles.registry-CANYbEa5.d.ts → styles.registry-DEDEZ8l3.d.ts} +22 -0
- package/dist/{styles.registry-6UBNKpyL.d.mts → styles.registry-DHM4M77N.d.mts} +22 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/navigation/__tests__/navigation.test.ts +106 -0
- package/src/navigation/index.ts +12 -0
- package/src/navigation/menuVisibility.ts +38 -0
- package/src/navigation/mobileIcons.ts +86 -0
- package/src/navigation/navRender.ts +132 -0
- package/src/types/pages.ts +39 -0
- package/src/types/styles/forms.ts +22 -0
- package/src/utils/__tests__/transformPageData.test.ts +23 -0
- package/src/utils/transformPageData.ts +17 -0
package/dist/index.js
CHANGED
|
@@ -41,12 +41,21 @@ __export(index_exports, {
|
|
|
41
41
|
COLOR_PALETTE: () => COLOR_PALETTE,
|
|
42
42
|
COLOR_SCALES: () => COLOR_SCALES,
|
|
43
43
|
CONTAINER_SIZE_PX: () => CONTAINER_SIZE_PX,
|
|
44
|
+
DEFAULT_MOBILE_GLOBAL_NAV_RENDER: () => DEFAULT_MOBILE_GLOBAL_NAV_RENDER,
|
|
45
|
+
DEFAULT_MOBILE_ICON: () => DEFAULT_MOBILE_ICON,
|
|
46
|
+
DEFAULT_MOBILE_NAV_RENDER: () => DEFAULT_MOBILE_NAV_RENDER,
|
|
47
|
+
DEFAULT_WEB_GLOBAL_NAV_RENDER: () => DEFAULT_WEB_GLOBAL_NAV_RENDER,
|
|
48
|
+
DEFAULT_WEB_NAV_RENDER: () => DEFAULT_WEB_NAV_RENDER,
|
|
44
49
|
ENDPOINTS: () => ENDPOINTS,
|
|
45
50
|
FONT_SIZE_PX: () => FONT_SIZE_PX,
|
|
46
51
|
FULL_RADIUS_PX: () => FULL_RADIUS_PX,
|
|
47
52
|
HEADER_CLIENT_TYPE: () => HEADER_CLIENT_TYPE,
|
|
48
53
|
LINE_HEIGHT: () => LINE_HEIGHT,
|
|
49
54
|
LITERAL_CLASSES: () => LITERAL_CLASSES,
|
|
55
|
+
MOBILE_ICON_NAMES: () => MOBILE_ICON_NAMES,
|
|
56
|
+
MOBILE_ICON_SET: () => MOBILE_ICON_SET,
|
|
57
|
+
MOBILE_NAV_RENDER_OPTIONS: () => MOBILE_NAV_RENDER_OPTIONS,
|
|
58
|
+
MOBILE_NAV_RENDER_VALUES: () => MOBILE_NAV_RENDER_VALUES,
|
|
50
59
|
MOBILE_PREVIEW_ENDPOINTS: () => MOBILE_PREVIEW_ENDPOINTS,
|
|
51
60
|
PERMISSIONS: () => PERMISSIONS,
|
|
52
61
|
PREVIEW_BRIDGE_MESSAGE: () => PREVIEW_BRIDGE_MESSAGE,
|
|
@@ -60,6 +69,8 @@ __export(index_exports, {
|
|
|
60
69
|
SPACING_VALUES: () => SPACING_VALUES,
|
|
61
70
|
STYLE_REGISTRY: () => STYLE_REGISTRY,
|
|
62
71
|
SYSTEM_ENDPOINTS: () => SYSTEM_ENDPOINTS,
|
|
72
|
+
WEB_NAV_RENDER_OPTIONS: () => WEB_NAV_RENDER_OPTIONS,
|
|
73
|
+
WEB_NAV_RENDER_VALUES: () => WEB_NAV_RENDER_VALUES,
|
|
63
74
|
_resetPluginStyleRegistry: () => _resetPluginStyleRegistry,
|
|
64
75
|
arePreviewPreferencesEqual: () => arePreviewPreferencesEqual,
|
|
65
76
|
buildConditionContext: () => buildConditionContext,
|
|
@@ -69,6 +80,7 @@ __export(index_exports, {
|
|
|
69
80
|
evaluateCondition: () => evaluateCondition,
|
|
70
81
|
extendStyleRegistry: () => extendStyleRegistry,
|
|
71
82
|
findRemap: () => findRemap,
|
|
83
|
+
getMenuVisibleChildren: () => getMenuVisibleChildren,
|
|
72
84
|
getMergedStyleRegistry: () => getMergedStyleRegistry,
|
|
73
85
|
getPluginStyleRegistry: () => getPluginStyleRegistry,
|
|
74
86
|
getRegistryEntry: () => getRegistryEntry,
|
|
@@ -79,11 +91,16 @@ __export(index_exports, {
|
|
|
79
91
|
gridSpanToReactNativeColumn: () => gridSpanToReactNativeColumn,
|
|
80
92
|
hasInlineFormatting: () => hasInlineFormatting,
|
|
81
93
|
isKnownStyleName: () => isKnownStyleName,
|
|
94
|
+
isMenuVisible: () => isMenuVisible,
|
|
95
|
+
isMobileIconName: () => isMobileIconName,
|
|
96
|
+
isMobileNavRender: () => isMobileNavRender,
|
|
97
|
+
isNavigationPage: () => isNavigationPage,
|
|
82
98
|
isPreviewBridgeMessage: () => isPreviewBridgeMessage,
|
|
83
99
|
isRegisteredStyleName: () => isRegisteredStyleName,
|
|
84
100
|
isStyleAllowedOnPage: () => isStyleAllowedOnPage,
|
|
85
101
|
isStylePlacementAllowed: () => isStylePlacementAllowed,
|
|
86
102
|
isStyleSupportedOnPlatform: () => isStyleSupportedOnPlatform,
|
|
103
|
+
isWebNavRender: () => isWebNavRender,
|
|
87
104
|
mapAccordionVariantToHeroUiVariant: () => mapAccordionVariantToHeroUiVariant,
|
|
88
105
|
mapChipVariantToHeroUiVariant: () => mapChipVariantToHeroUiVariant,
|
|
89
106
|
mapDividerVariantToReactNative: () => mapDividerVariantToReactNative,
|
|
@@ -105,10 +122,13 @@ __export(index_exports, {
|
|
|
105
122
|
resolveAssetSources: () => resolveAssetSources,
|
|
106
123
|
resolveAssetUrl: () => resolveAssetUrl,
|
|
107
124
|
resolveMantineVariant: () => resolveMantineVariant,
|
|
125
|
+
resolveMobileIcon: () => resolveMobileIcon,
|
|
126
|
+
resolveMobileNavRender: () => resolveMobileNavRender,
|
|
108
127
|
resolveSharedStyle: () => resolveSharedStyle,
|
|
109
128
|
resolveSharedStyleForMobile: () => resolveSharedStyleForMobile,
|
|
110
129
|
resolveSharedStyleForWeb: () => resolveSharedStyleForWeb,
|
|
111
130
|
resolveSharedStyleProps: () => resolveSharedStyleProps,
|
|
131
|
+
resolveWebNavRender: () => resolveWebNavRender,
|
|
112
132
|
setToStylePlatform: () => setToStylePlatform,
|
|
113
133
|
sharedTailwindExtend: () => sharedTailwindExtend,
|
|
114
134
|
sharedTailwindPreset: () => sharedTailwindPreset,
|
|
@@ -1524,6 +1544,149 @@ function stripHtmlToText(value) {
|
|
|
1524
1544
|
return out.replace(/\s+/g, " ").trim();
|
|
1525
1545
|
}
|
|
1526
1546
|
|
|
1547
|
+
// src/navigation/navRender.ts
|
|
1548
|
+
var WEB_NAV_RENDER_VALUES = [
|
|
1549
|
+
"header-dropdown",
|
|
1550
|
+
"tabs",
|
|
1551
|
+
"sidebar-drawer",
|
|
1552
|
+
"hero-cards"
|
|
1553
|
+
];
|
|
1554
|
+
var MOBILE_NAV_RENDER_VALUES = [
|
|
1555
|
+
"segmented-tabs",
|
|
1556
|
+
"bottom-tabs",
|
|
1557
|
+
"drawer",
|
|
1558
|
+
"hero-cards"
|
|
1559
|
+
];
|
|
1560
|
+
var DEFAULT_WEB_NAV_RENDER = "tabs";
|
|
1561
|
+
var DEFAULT_MOBILE_NAV_RENDER = "segmented-tabs";
|
|
1562
|
+
var DEFAULT_WEB_GLOBAL_NAV_RENDER = "header-dropdown";
|
|
1563
|
+
var DEFAULT_MOBILE_GLOBAL_NAV_RENDER = "bottom-tabs";
|
|
1564
|
+
var WEB_NAV_RENDER_OPTIONS = [
|
|
1565
|
+
{
|
|
1566
|
+
value: "header-dropdown",
|
|
1567
|
+
label: "Header dropdown",
|
|
1568
|
+
description: "Classic top menu; child pages appear in a dropdown. Best for the global website menu."
|
|
1569
|
+
},
|
|
1570
|
+
{
|
|
1571
|
+
value: "tabs",
|
|
1572
|
+
label: "Tabs",
|
|
1573
|
+
description: "Show child pages as horizontal tabs. Best for a navigation page with a few children."
|
|
1574
|
+
},
|
|
1575
|
+
{
|
|
1576
|
+
value: "sidebar-drawer",
|
|
1577
|
+
label: "Sidebar drawer",
|
|
1578
|
+
description: "Side drawer / hamburger menu. Best for large or deep navigation."
|
|
1579
|
+
},
|
|
1580
|
+
{
|
|
1581
|
+
value: "hero-cards",
|
|
1582
|
+
label: "Hero cards",
|
|
1583
|
+
description: "Dashboard-style card grid. Best for landing pages and CMS app dashboards."
|
|
1584
|
+
}
|
|
1585
|
+
];
|
|
1586
|
+
var MOBILE_NAV_RENDER_OPTIONS = [
|
|
1587
|
+
{
|
|
1588
|
+
value: "segmented-tabs",
|
|
1589
|
+
label: "Segmented tabs",
|
|
1590
|
+
description: "Top segmented control for first-level children. Best for a few child pages."
|
|
1591
|
+
},
|
|
1592
|
+
{
|
|
1593
|
+
value: "bottom-tabs",
|
|
1594
|
+
label: "Bottom tabs",
|
|
1595
|
+
description: "Bottom tab bar for 3\u20135 main app-like destinations."
|
|
1596
|
+
},
|
|
1597
|
+
{
|
|
1598
|
+
value: "drawer",
|
|
1599
|
+
label: "Drawer",
|
|
1600
|
+
description: "Hamburger / side drawer for larger navigation."
|
|
1601
|
+
},
|
|
1602
|
+
{
|
|
1603
|
+
value: "hero-cards",
|
|
1604
|
+
label: "Hero cards",
|
|
1605
|
+
description: "Card grid for dashboards and CMS app pages."
|
|
1606
|
+
}
|
|
1607
|
+
];
|
|
1608
|
+
function isWebNavRender(value) {
|
|
1609
|
+
return typeof value === "string" && WEB_NAV_RENDER_VALUES.includes(value);
|
|
1610
|
+
}
|
|
1611
|
+
function isMobileNavRender(value) {
|
|
1612
|
+
return typeof value === "string" && MOBILE_NAV_RENDER_VALUES.includes(value);
|
|
1613
|
+
}
|
|
1614
|
+
function resolveWebNavRender(value, fallback = DEFAULT_WEB_NAV_RENDER) {
|
|
1615
|
+
return isWebNavRender(value) ? value : fallback;
|
|
1616
|
+
}
|
|
1617
|
+
function resolveMobileNavRender(value, fallback = DEFAULT_MOBILE_NAV_RENDER) {
|
|
1618
|
+
return isMobileNavRender(value) ? value : fallback;
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
// src/navigation/mobileIcons.ts
|
|
1622
|
+
var MOBILE_ICON_SET = [
|
|
1623
|
+
{ name: "House", label: "Home" },
|
|
1624
|
+
{ name: "LayoutDashboard", label: "Dashboard" },
|
|
1625
|
+
{ name: "User", label: "User" },
|
|
1626
|
+
{ name: "Users", label: "Users / Team" },
|
|
1627
|
+
{ name: "Settings", label: "Settings" },
|
|
1628
|
+
{ name: "FileText", label: "Document" },
|
|
1629
|
+
{ name: "Files", label: "Files" },
|
|
1630
|
+
{ name: "Folder", label: "Folder" },
|
|
1631
|
+
{ name: "Info", label: "Info" },
|
|
1632
|
+
{ name: "CircleQuestionMark", label: "Help" },
|
|
1633
|
+
{ name: "Mail", label: "Mail" },
|
|
1634
|
+
{ name: "Phone", label: "Phone" },
|
|
1635
|
+
{ name: "Calendar", label: "Calendar" },
|
|
1636
|
+
{ name: "Bell", label: "Notifications" },
|
|
1637
|
+
{ name: "Search", label: "Search" },
|
|
1638
|
+
{ name: "Star", label: "Star" },
|
|
1639
|
+
{ name: "Heart", label: "Heart" },
|
|
1640
|
+
{ name: "Bookmark", label: "Bookmark" },
|
|
1641
|
+
{ name: "Map", label: "Map" },
|
|
1642
|
+
{ name: "MapPin", label: "Location" },
|
|
1643
|
+
{ name: "Image", label: "Image" },
|
|
1644
|
+
{ name: "Video", label: "Video" },
|
|
1645
|
+
{ name: "Music", label: "Music" },
|
|
1646
|
+
{ name: "ShoppingCart", label: "Shopping cart" },
|
|
1647
|
+
{ name: "CreditCard", label: "Payment" },
|
|
1648
|
+
{ name: "ChartBar", label: "Bar chart" },
|
|
1649
|
+
{ name: "ChartPie", label: "Pie chart" },
|
|
1650
|
+
{ name: "Activity", label: "Activity" },
|
|
1651
|
+
{ name: "Shield", label: "Shield" },
|
|
1652
|
+
{ name: "Lock", label: "Lock" },
|
|
1653
|
+
{ name: "Globe", label: "Globe" },
|
|
1654
|
+
{ name: "Compass", label: "Compass" },
|
|
1655
|
+
{ name: "Flag", label: "Flag" },
|
|
1656
|
+
{ name: "Award", label: "Award" },
|
|
1657
|
+
{ name: "Briefcase", label: "Work" },
|
|
1658
|
+
{ name: "Building", label: "Building" },
|
|
1659
|
+
{ name: "BookOpen", label: "Book" },
|
|
1660
|
+
{ name: "MessageSquare", label: "Messages" },
|
|
1661
|
+
{ name: "ClipboardList", label: "Tasks" },
|
|
1662
|
+
{ name: "CircleCheck", label: "Check" },
|
|
1663
|
+
{ name: "List", label: "List" },
|
|
1664
|
+
{ name: "LayoutGrid", label: "Grid" },
|
|
1665
|
+
{ name: "Menu", label: "Menu" },
|
|
1666
|
+
{ name: "Database", label: "Data" }
|
|
1667
|
+
];
|
|
1668
|
+
var MOBILE_ICON_NAMES = MOBILE_ICON_SET.map((entry) => entry.name);
|
|
1669
|
+
var DEFAULT_MOBILE_ICON = "Circle";
|
|
1670
|
+
function isMobileIconName(value) {
|
|
1671
|
+
return typeof value === "string" && MOBILE_ICON_NAMES.includes(value);
|
|
1672
|
+
}
|
|
1673
|
+
function resolveMobileIcon(value) {
|
|
1674
|
+
return isMobileIconName(value) ? value : DEFAULT_MOBILE_ICON;
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
// src/navigation/menuVisibility.ts
|
|
1678
|
+
function isMenuVisible(page) {
|
|
1679
|
+
if (page.is_headless) return false;
|
|
1680
|
+
return page.navPosition !== null && page.navPosition !== void 0;
|
|
1681
|
+
}
|
|
1682
|
+
function getMenuVisibleChildren(page) {
|
|
1683
|
+
const children = page.children ?? [];
|
|
1684
|
+
return children.filter(isMenuVisible).sort((a, b) => (a.navPosition ?? 0) - (b.navPosition ?? 0));
|
|
1685
|
+
}
|
|
1686
|
+
function isNavigationPage(page) {
|
|
1687
|
+
return getMenuVisibleChildren(page).length > 0;
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1527
1690
|
// src/utils/spacing.ts
|
|
1528
1691
|
var ALLOWED_KEYS = ["mt", "mb", "ms", "me", "pt", "pb", "ps", "pe"];
|
|
1529
1692
|
function parseSpacing(raw) {
|
|
@@ -1576,6 +1739,10 @@ function transformPageData(apiPage) {
|
|
|
1576
1739
|
is_system: apiPage.is_system !== void 0 ? toBool(apiPage.is_system) : void 0,
|
|
1577
1740
|
title: apiPage.title ?? null,
|
|
1578
1741
|
description: apiPage.description ?? null,
|
|
1742
|
+
icon: apiPage.icon ?? null,
|
|
1743
|
+
mobile_icon: apiPage.mobile_icon ?? null,
|
|
1744
|
+
web_nav_render: apiPage.web_nav_render ?? null,
|
|
1745
|
+
mobile_nav_render: apiPage.mobile_nav_render ?? null,
|
|
1579
1746
|
children: apiPage.children?.map(transformPageData) ?? [],
|
|
1580
1747
|
id_users: apiPage.id_users,
|
|
1581
1748
|
id_pages: apiPage.id_pages ?? id,
|
|
@@ -1604,12 +1771,21 @@ function transformPagesData(pages) {
|
|
|
1604
1771
|
COLOR_PALETTE,
|
|
1605
1772
|
COLOR_SCALES,
|
|
1606
1773
|
CONTAINER_SIZE_PX,
|
|
1774
|
+
DEFAULT_MOBILE_GLOBAL_NAV_RENDER,
|
|
1775
|
+
DEFAULT_MOBILE_ICON,
|
|
1776
|
+
DEFAULT_MOBILE_NAV_RENDER,
|
|
1777
|
+
DEFAULT_WEB_GLOBAL_NAV_RENDER,
|
|
1778
|
+
DEFAULT_WEB_NAV_RENDER,
|
|
1607
1779
|
ENDPOINTS,
|
|
1608
1780
|
FONT_SIZE_PX,
|
|
1609
1781
|
FULL_RADIUS_PX,
|
|
1610
1782
|
HEADER_CLIENT_TYPE,
|
|
1611
1783
|
LINE_HEIGHT,
|
|
1612
1784
|
LITERAL_CLASSES,
|
|
1785
|
+
MOBILE_ICON_NAMES,
|
|
1786
|
+
MOBILE_ICON_SET,
|
|
1787
|
+
MOBILE_NAV_RENDER_OPTIONS,
|
|
1788
|
+
MOBILE_NAV_RENDER_VALUES,
|
|
1613
1789
|
MOBILE_PREVIEW_ENDPOINTS,
|
|
1614
1790
|
PERMISSIONS,
|
|
1615
1791
|
PREVIEW_BRIDGE_MESSAGE,
|
|
@@ -1623,6 +1799,8 @@ function transformPagesData(pages) {
|
|
|
1623
1799
|
SPACING_VALUES,
|
|
1624
1800
|
STYLE_REGISTRY,
|
|
1625
1801
|
SYSTEM_ENDPOINTS,
|
|
1802
|
+
WEB_NAV_RENDER_OPTIONS,
|
|
1803
|
+
WEB_NAV_RENDER_VALUES,
|
|
1626
1804
|
_resetPluginStyleRegistry,
|
|
1627
1805
|
arePreviewPreferencesEqual,
|
|
1628
1806
|
buildConditionContext,
|
|
@@ -1632,6 +1810,7 @@ function transformPagesData(pages) {
|
|
|
1632
1810
|
evaluateCondition,
|
|
1633
1811
|
extendStyleRegistry,
|
|
1634
1812
|
findRemap,
|
|
1813
|
+
getMenuVisibleChildren,
|
|
1635
1814
|
getMergedStyleRegistry,
|
|
1636
1815
|
getPluginStyleRegistry,
|
|
1637
1816
|
getRegistryEntry,
|
|
@@ -1642,11 +1821,16 @@ function transformPagesData(pages) {
|
|
|
1642
1821
|
gridSpanToReactNativeColumn,
|
|
1643
1822
|
hasInlineFormatting,
|
|
1644
1823
|
isKnownStyleName,
|
|
1824
|
+
isMenuVisible,
|
|
1825
|
+
isMobileIconName,
|
|
1826
|
+
isMobileNavRender,
|
|
1827
|
+
isNavigationPage,
|
|
1645
1828
|
isPreviewBridgeMessage,
|
|
1646
1829
|
isRegisteredStyleName,
|
|
1647
1830
|
isStyleAllowedOnPage,
|
|
1648
1831
|
isStylePlacementAllowed,
|
|
1649
1832
|
isStyleSupportedOnPlatform,
|
|
1833
|
+
isWebNavRender,
|
|
1650
1834
|
mapAccordionVariantToHeroUiVariant,
|
|
1651
1835
|
mapChipVariantToHeroUiVariant,
|
|
1652
1836
|
mapDividerVariantToReactNative,
|
|
@@ -1668,10 +1852,13 @@ function transformPagesData(pages) {
|
|
|
1668
1852
|
resolveAssetSources,
|
|
1669
1853
|
resolveAssetUrl,
|
|
1670
1854
|
resolveMantineVariant,
|
|
1855
|
+
resolveMobileIcon,
|
|
1856
|
+
resolveMobileNavRender,
|
|
1671
1857
|
resolveSharedStyle,
|
|
1672
1858
|
resolveSharedStyleForMobile,
|
|
1673
1859
|
resolveSharedStyleForWeb,
|
|
1674
1860
|
resolveSharedStyleProps,
|
|
1861
|
+
resolveWebNavRender,
|
|
1675
1862
|
setToStylePlatform,
|
|
1676
1863
|
sharedTailwindExtend,
|
|
1677
1864
|
sharedTailwindPreset,
|
package/dist/index.mjs
CHANGED
|
@@ -1397,6 +1397,149 @@ function stripHtmlToText(value) {
|
|
|
1397
1397
|
return out.replace(/\s+/g, " ").trim();
|
|
1398
1398
|
}
|
|
1399
1399
|
|
|
1400
|
+
// src/navigation/navRender.ts
|
|
1401
|
+
var WEB_NAV_RENDER_VALUES = [
|
|
1402
|
+
"header-dropdown",
|
|
1403
|
+
"tabs",
|
|
1404
|
+
"sidebar-drawer",
|
|
1405
|
+
"hero-cards"
|
|
1406
|
+
];
|
|
1407
|
+
var MOBILE_NAV_RENDER_VALUES = [
|
|
1408
|
+
"segmented-tabs",
|
|
1409
|
+
"bottom-tabs",
|
|
1410
|
+
"drawer",
|
|
1411
|
+
"hero-cards"
|
|
1412
|
+
];
|
|
1413
|
+
var DEFAULT_WEB_NAV_RENDER = "tabs";
|
|
1414
|
+
var DEFAULT_MOBILE_NAV_RENDER = "segmented-tabs";
|
|
1415
|
+
var DEFAULT_WEB_GLOBAL_NAV_RENDER = "header-dropdown";
|
|
1416
|
+
var DEFAULT_MOBILE_GLOBAL_NAV_RENDER = "bottom-tabs";
|
|
1417
|
+
var WEB_NAV_RENDER_OPTIONS = [
|
|
1418
|
+
{
|
|
1419
|
+
value: "header-dropdown",
|
|
1420
|
+
label: "Header dropdown",
|
|
1421
|
+
description: "Classic top menu; child pages appear in a dropdown. Best for the global website menu."
|
|
1422
|
+
},
|
|
1423
|
+
{
|
|
1424
|
+
value: "tabs",
|
|
1425
|
+
label: "Tabs",
|
|
1426
|
+
description: "Show child pages as horizontal tabs. Best for a navigation page with a few children."
|
|
1427
|
+
},
|
|
1428
|
+
{
|
|
1429
|
+
value: "sidebar-drawer",
|
|
1430
|
+
label: "Sidebar drawer",
|
|
1431
|
+
description: "Side drawer / hamburger menu. Best for large or deep navigation."
|
|
1432
|
+
},
|
|
1433
|
+
{
|
|
1434
|
+
value: "hero-cards",
|
|
1435
|
+
label: "Hero cards",
|
|
1436
|
+
description: "Dashboard-style card grid. Best for landing pages and CMS app dashboards."
|
|
1437
|
+
}
|
|
1438
|
+
];
|
|
1439
|
+
var MOBILE_NAV_RENDER_OPTIONS = [
|
|
1440
|
+
{
|
|
1441
|
+
value: "segmented-tabs",
|
|
1442
|
+
label: "Segmented tabs",
|
|
1443
|
+
description: "Top segmented control for first-level children. Best for a few child pages."
|
|
1444
|
+
},
|
|
1445
|
+
{
|
|
1446
|
+
value: "bottom-tabs",
|
|
1447
|
+
label: "Bottom tabs",
|
|
1448
|
+
description: "Bottom tab bar for 3\u20135 main app-like destinations."
|
|
1449
|
+
},
|
|
1450
|
+
{
|
|
1451
|
+
value: "drawer",
|
|
1452
|
+
label: "Drawer",
|
|
1453
|
+
description: "Hamburger / side drawer for larger navigation."
|
|
1454
|
+
},
|
|
1455
|
+
{
|
|
1456
|
+
value: "hero-cards",
|
|
1457
|
+
label: "Hero cards",
|
|
1458
|
+
description: "Card grid for dashboards and CMS app pages."
|
|
1459
|
+
}
|
|
1460
|
+
];
|
|
1461
|
+
function isWebNavRender(value) {
|
|
1462
|
+
return typeof value === "string" && WEB_NAV_RENDER_VALUES.includes(value);
|
|
1463
|
+
}
|
|
1464
|
+
function isMobileNavRender(value) {
|
|
1465
|
+
return typeof value === "string" && MOBILE_NAV_RENDER_VALUES.includes(value);
|
|
1466
|
+
}
|
|
1467
|
+
function resolveWebNavRender(value, fallback = DEFAULT_WEB_NAV_RENDER) {
|
|
1468
|
+
return isWebNavRender(value) ? value : fallback;
|
|
1469
|
+
}
|
|
1470
|
+
function resolveMobileNavRender(value, fallback = DEFAULT_MOBILE_NAV_RENDER) {
|
|
1471
|
+
return isMobileNavRender(value) ? value : fallback;
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
// src/navigation/mobileIcons.ts
|
|
1475
|
+
var MOBILE_ICON_SET = [
|
|
1476
|
+
{ name: "House", label: "Home" },
|
|
1477
|
+
{ name: "LayoutDashboard", label: "Dashboard" },
|
|
1478
|
+
{ name: "User", label: "User" },
|
|
1479
|
+
{ name: "Users", label: "Users / Team" },
|
|
1480
|
+
{ name: "Settings", label: "Settings" },
|
|
1481
|
+
{ name: "FileText", label: "Document" },
|
|
1482
|
+
{ name: "Files", label: "Files" },
|
|
1483
|
+
{ name: "Folder", label: "Folder" },
|
|
1484
|
+
{ name: "Info", label: "Info" },
|
|
1485
|
+
{ name: "CircleQuestionMark", label: "Help" },
|
|
1486
|
+
{ name: "Mail", label: "Mail" },
|
|
1487
|
+
{ name: "Phone", label: "Phone" },
|
|
1488
|
+
{ name: "Calendar", label: "Calendar" },
|
|
1489
|
+
{ name: "Bell", label: "Notifications" },
|
|
1490
|
+
{ name: "Search", label: "Search" },
|
|
1491
|
+
{ name: "Star", label: "Star" },
|
|
1492
|
+
{ name: "Heart", label: "Heart" },
|
|
1493
|
+
{ name: "Bookmark", label: "Bookmark" },
|
|
1494
|
+
{ name: "Map", label: "Map" },
|
|
1495
|
+
{ name: "MapPin", label: "Location" },
|
|
1496
|
+
{ name: "Image", label: "Image" },
|
|
1497
|
+
{ name: "Video", label: "Video" },
|
|
1498
|
+
{ name: "Music", label: "Music" },
|
|
1499
|
+
{ name: "ShoppingCart", label: "Shopping cart" },
|
|
1500
|
+
{ name: "CreditCard", label: "Payment" },
|
|
1501
|
+
{ name: "ChartBar", label: "Bar chart" },
|
|
1502
|
+
{ name: "ChartPie", label: "Pie chart" },
|
|
1503
|
+
{ name: "Activity", label: "Activity" },
|
|
1504
|
+
{ name: "Shield", label: "Shield" },
|
|
1505
|
+
{ name: "Lock", label: "Lock" },
|
|
1506
|
+
{ name: "Globe", label: "Globe" },
|
|
1507
|
+
{ name: "Compass", label: "Compass" },
|
|
1508
|
+
{ name: "Flag", label: "Flag" },
|
|
1509
|
+
{ name: "Award", label: "Award" },
|
|
1510
|
+
{ name: "Briefcase", label: "Work" },
|
|
1511
|
+
{ name: "Building", label: "Building" },
|
|
1512
|
+
{ name: "BookOpen", label: "Book" },
|
|
1513
|
+
{ name: "MessageSquare", label: "Messages" },
|
|
1514
|
+
{ name: "ClipboardList", label: "Tasks" },
|
|
1515
|
+
{ name: "CircleCheck", label: "Check" },
|
|
1516
|
+
{ name: "List", label: "List" },
|
|
1517
|
+
{ name: "LayoutGrid", label: "Grid" },
|
|
1518
|
+
{ name: "Menu", label: "Menu" },
|
|
1519
|
+
{ name: "Database", label: "Data" }
|
|
1520
|
+
];
|
|
1521
|
+
var MOBILE_ICON_NAMES = MOBILE_ICON_SET.map((entry) => entry.name);
|
|
1522
|
+
var DEFAULT_MOBILE_ICON = "Circle";
|
|
1523
|
+
function isMobileIconName(value) {
|
|
1524
|
+
return typeof value === "string" && MOBILE_ICON_NAMES.includes(value);
|
|
1525
|
+
}
|
|
1526
|
+
function resolveMobileIcon(value) {
|
|
1527
|
+
return isMobileIconName(value) ? value : DEFAULT_MOBILE_ICON;
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
// src/navigation/menuVisibility.ts
|
|
1531
|
+
function isMenuVisible(page) {
|
|
1532
|
+
if (page.is_headless) return false;
|
|
1533
|
+
return page.navPosition !== null && page.navPosition !== void 0;
|
|
1534
|
+
}
|
|
1535
|
+
function getMenuVisibleChildren(page) {
|
|
1536
|
+
const children = page.children ?? [];
|
|
1537
|
+
return children.filter(isMenuVisible).sort((a, b) => (a.navPosition ?? 0) - (b.navPosition ?? 0));
|
|
1538
|
+
}
|
|
1539
|
+
function isNavigationPage(page) {
|
|
1540
|
+
return getMenuVisibleChildren(page).length > 0;
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1400
1543
|
// src/utils/spacing.ts
|
|
1401
1544
|
var ALLOWED_KEYS = ["mt", "mb", "ms", "me", "pt", "pb", "ps", "pe"];
|
|
1402
1545
|
function parseSpacing(raw) {
|
|
@@ -1449,6 +1592,10 @@ function transformPageData(apiPage) {
|
|
|
1449
1592
|
is_system: apiPage.is_system !== void 0 ? toBool(apiPage.is_system) : void 0,
|
|
1450
1593
|
title: apiPage.title ?? null,
|
|
1451
1594
|
description: apiPage.description ?? null,
|
|
1595
|
+
icon: apiPage.icon ?? null,
|
|
1596
|
+
mobile_icon: apiPage.mobile_icon ?? null,
|
|
1597
|
+
web_nav_render: apiPage.web_nav_render ?? null,
|
|
1598
|
+
mobile_nav_render: apiPage.mobile_nav_render ?? null,
|
|
1452
1599
|
children: apiPage.children?.map(transformPageData) ?? [],
|
|
1453
1600
|
id_users: apiPage.id_users,
|
|
1454
1601
|
id_pages: apiPage.id_pages ?? id,
|
|
@@ -1476,12 +1623,21 @@ export {
|
|
|
1476
1623
|
COLOR_PALETTE,
|
|
1477
1624
|
COLOR_SCALES,
|
|
1478
1625
|
CONTAINER_SIZE_PX,
|
|
1626
|
+
DEFAULT_MOBILE_GLOBAL_NAV_RENDER,
|
|
1627
|
+
DEFAULT_MOBILE_ICON,
|
|
1628
|
+
DEFAULT_MOBILE_NAV_RENDER,
|
|
1629
|
+
DEFAULT_WEB_GLOBAL_NAV_RENDER,
|
|
1630
|
+
DEFAULT_WEB_NAV_RENDER,
|
|
1479
1631
|
ENDPOINTS,
|
|
1480
1632
|
FONT_SIZE_PX,
|
|
1481
1633
|
FULL_RADIUS_PX,
|
|
1482
1634
|
HEADER_CLIENT_TYPE,
|
|
1483
1635
|
LINE_HEIGHT,
|
|
1484
1636
|
LITERAL_CLASSES,
|
|
1637
|
+
MOBILE_ICON_NAMES,
|
|
1638
|
+
MOBILE_ICON_SET,
|
|
1639
|
+
MOBILE_NAV_RENDER_OPTIONS,
|
|
1640
|
+
MOBILE_NAV_RENDER_VALUES,
|
|
1485
1641
|
MOBILE_PREVIEW_ENDPOINTS,
|
|
1486
1642
|
PERMISSIONS,
|
|
1487
1643
|
PREVIEW_BRIDGE_MESSAGE,
|
|
@@ -1495,6 +1651,8 @@ export {
|
|
|
1495
1651
|
SPACING_VALUES,
|
|
1496
1652
|
STYLE_REGISTRY,
|
|
1497
1653
|
SYSTEM_ENDPOINTS,
|
|
1654
|
+
WEB_NAV_RENDER_OPTIONS,
|
|
1655
|
+
WEB_NAV_RENDER_VALUES,
|
|
1498
1656
|
_resetPluginStyleRegistry,
|
|
1499
1657
|
arePreviewPreferencesEqual,
|
|
1500
1658
|
buildConditionContext,
|
|
@@ -1504,6 +1662,7 @@ export {
|
|
|
1504
1662
|
evaluateCondition,
|
|
1505
1663
|
extendStyleRegistry,
|
|
1506
1664
|
findRemap,
|
|
1665
|
+
getMenuVisibleChildren,
|
|
1507
1666
|
getMergedStyleRegistry,
|
|
1508
1667
|
getPluginStyleRegistry,
|
|
1509
1668
|
getRegistryEntry,
|
|
@@ -1514,11 +1673,16 @@ export {
|
|
|
1514
1673
|
gridSpanToReactNativeColumn,
|
|
1515
1674
|
hasInlineFormatting,
|
|
1516
1675
|
isKnownStyleName,
|
|
1676
|
+
isMenuVisible,
|
|
1677
|
+
isMobileIconName,
|
|
1678
|
+
isMobileNavRender,
|
|
1679
|
+
isNavigationPage,
|
|
1517
1680
|
isPreviewBridgeMessage,
|
|
1518
1681
|
isRegisteredStyleName,
|
|
1519
1682
|
isStyleAllowedOnPage,
|
|
1520
1683
|
isStylePlacementAllowed,
|
|
1521
1684
|
isStyleSupportedOnPlatform,
|
|
1685
|
+
isWebNavRender,
|
|
1522
1686
|
mapAccordionVariantToHeroUiVariant,
|
|
1523
1687
|
mapChipVariantToHeroUiVariant,
|
|
1524
1688
|
mapDividerVariantToReactNative,
|
|
@@ -1540,10 +1704,13 @@ export {
|
|
|
1540
1704
|
resolveAssetSources,
|
|
1541
1705
|
resolveAssetUrl,
|
|
1542
1706
|
resolveMantineVariant,
|
|
1707
|
+
resolveMobileIcon,
|
|
1708
|
+
resolveMobileNavRender,
|
|
1543
1709
|
resolveSharedStyle,
|
|
1544
1710
|
resolveSharedStyleForMobile,
|
|
1545
1711
|
resolveSharedStyleForWeb,
|
|
1546
1712
|
resolveSharedStyleProps,
|
|
1713
|
+
resolveWebNavRender,
|
|
1547
1714
|
setToStylePlatform,
|
|
1548
1715
|
sharedTailwindExtend,
|
|
1549
1716
|
sharedTailwindPreset,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { I as IPluginManifest, a as IPluginManifestAdminPage, b as IPluginManifestApiRoute, c as IPluginManifestAsset, d as IPluginManifestCapability, e as IPluginManifestCompatibility, f as IPluginManifestConflict, g as IPluginManifestDataAccess, h as IPluginManifestDependency, i as IPluginManifestExternalHost, j as IPluginManifestFeatureFlag, k as IPluginManifestHealth, l as IPluginManifestLookupExtension, m as IPluginManifestMobile, n as IPluginManifestPermission, o as IPluginManifestRealtimeTopic, p as IPluginManifestScheduledJob, q as IPluginManifestSecurity, r as IPluginManifestStyle, s as IPluginManifestTrustLevel } from '../manifest-8YXAk-4o.mjs';
|
|
2
|
-
import { I as IStyleRegistryEntry } from '../styles.registry-
|
|
2
|
+
import { I as IStyleRegistryEntry } from '../styles.registry-DHM4M77N.mjs';
|
|
3
3
|
import '../common-qaDIAYS3.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { I as IPluginManifest, a as IPluginManifestAdminPage, b as IPluginManifestApiRoute, c as IPluginManifestAsset, d as IPluginManifestCapability, e as IPluginManifestCompatibility, f as IPluginManifestConflict, g as IPluginManifestDataAccess, h as IPluginManifestDependency, i as IPluginManifestExternalHost, j as IPluginManifestFeatureFlag, k as IPluginManifestHealth, l as IPluginManifestLookupExtension, m as IPluginManifestMobile, n as IPluginManifestPermission, o as IPluginManifestRealtimeTopic, p as IPluginManifestScheduledJob, q as IPluginManifestSecurity, r as IPluginManifestStyle, s as IPluginManifestTrustLevel } from '../manifest-8YXAk-4o.js';
|
|
2
|
-
import { I as IStyleRegistryEntry } from '../styles.registry-
|
|
2
|
+
import { I as IStyleRegistryEntry } from '../styles.registry-DEDEZ8l3.js';
|
|
3
3
|
import '../common-qaDIAYS3.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TStyleName, I as IStyleRegistryEntry, a as IPluginStyleRegistryEntry, b as TStylePlacement, c as TConcretePlatform, d as TStylePlatform } from '../styles.registry-
|
|
2
|
-
export { B as BASE_STYLE_REGISTRY, S as STYLE_REGISTRY, e as TStyleRegistryKey, _ as _AssertRegistryMatchesStyleName, f as _resetPluginStyleRegistry, g as extendStyleRegistry, h as getMergedStyleRegistry, i as getPluginStyleRegistry } from '../styles.registry-
|
|
1
|
+
import { T as TStyleName, I as IStyleRegistryEntry, a as IPluginStyleRegistryEntry, b as TStylePlacement, c as TConcretePlatform, d as TStylePlatform } from '../styles.registry-DHM4M77N.mjs';
|
|
2
|
+
export { B as BASE_STYLE_REGISTRY, S as STYLE_REGISTRY, e as TStyleRegistryKey, _ as _AssertRegistryMatchesStyleName, f as _resetPluginStyleRegistry, g as extendStyleRegistry, h as getMergedStyleRegistry, i as getPluginStyleRegistry } from '../styles.registry-DHM4M77N.mjs';
|
|
3
3
|
import '../common-qaDIAYS3.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/registry/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TStyleName, I as IStyleRegistryEntry, a as IPluginStyleRegistryEntry, b as TStylePlacement, c as TConcretePlatform, d as TStylePlatform } from '../styles.registry-
|
|
2
|
-
export { B as BASE_STYLE_REGISTRY, S as STYLE_REGISTRY, e as TStyleRegistryKey, _ as _AssertRegistryMatchesStyleName, f as _resetPluginStyleRegistry, g as extendStyleRegistry, h as getMergedStyleRegistry, i as getPluginStyleRegistry } from '../styles.registry-
|
|
1
|
+
import { T as TStyleName, I as IStyleRegistryEntry, a as IPluginStyleRegistryEntry, b as TStylePlacement, c as TConcretePlatform, d as TStylePlatform } from '../styles.registry-DEDEZ8l3.js';
|
|
2
|
+
export { B as BASE_STYLE_REGISTRY, S as STYLE_REGISTRY, e as TStyleRegistryKey, _ as _AssertRegistryMatchesStyleName, f as _resetPluginStyleRegistry, g as extendStyleRegistry, h as getMergedStyleRegistry, i as getPluginStyleRegistry } from '../styles.registry-DEDEZ8l3.js';
|
|
3
3
|
import '../common-qaDIAYS3.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -687,6 +687,16 @@ interface IFormStyle extends IStyleWithSpacing {
|
|
|
687
687
|
confirm_submit?: IContentField<string>;
|
|
688
688
|
/** Message shown in the confirmation dialog before submit. */
|
|
689
689
|
confirm_message?: IContentField<string>;
|
|
690
|
+
/**
|
|
691
|
+
* When '1', a successful submit closes the surrounding web modal (only has
|
|
692
|
+
* an effect when the form's page is opened with `open_in_modal`). Web-only.
|
|
693
|
+
*/
|
|
694
|
+
close_modal_on_save?: IContentField<string>;
|
|
695
|
+
/**
|
|
696
|
+
* Optional URL to navigate to after a successful submit (the parent list is
|
|
697
|
+
* refreshed). Empty = stay / close the modal. Web-only.
|
|
698
|
+
*/
|
|
699
|
+
redirect_on_save?: IContentField<string>;
|
|
690
700
|
buttons_size?: IContentField<string>;
|
|
691
701
|
buttons_radius?: IContentField<string>;
|
|
692
702
|
buttons_variant?: IContentField<string>;
|
|
@@ -1103,6 +1113,18 @@ interface IShowUserInputStyle extends IBaseStyle {
|
|
|
1103
1113
|
csv_export?: IContentField<string>;
|
|
1104
1114
|
delete_entry?: IContentField<string>;
|
|
1105
1115
|
fields_map?: IContentField<string>;
|
|
1116
|
+
/**
|
|
1117
|
+
* Optional URL of a create form. When set, the web table shows an "Add new"
|
|
1118
|
+
* button above it (e.g. opens the create form modal). Web-only.
|
|
1119
|
+
*/
|
|
1120
|
+
add_url?: IContentField<string>;
|
|
1121
|
+
/**
|
|
1122
|
+
* Optional URL template for opening a row's detail (e.g.
|
|
1123
|
+
* `/cms/team/{record_id}`). When set, each row gets an open/view action
|
|
1124
|
+
* (eye icon) with the single-brace `{record_id}` placeholder substituted by
|
|
1125
|
+
* the renderer at click time. Web-only.
|
|
1126
|
+
*/
|
|
1127
|
+
edit_url?: IContentField<string>;
|
|
1106
1128
|
delete_modal_title?: IContentField<string>;
|
|
1107
1129
|
delete_modal_body?: IContentField<string>;
|
|
1108
1130
|
spacing?: IContentField<string>;
|
|
@@ -687,6 +687,16 @@ interface IFormStyle extends IStyleWithSpacing {
|
|
|
687
687
|
confirm_submit?: IContentField<string>;
|
|
688
688
|
/** Message shown in the confirmation dialog before submit. */
|
|
689
689
|
confirm_message?: IContentField<string>;
|
|
690
|
+
/**
|
|
691
|
+
* When '1', a successful submit closes the surrounding web modal (only has
|
|
692
|
+
* an effect when the form's page is opened with `open_in_modal`). Web-only.
|
|
693
|
+
*/
|
|
694
|
+
close_modal_on_save?: IContentField<string>;
|
|
695
|
+
/**
|
|
696
|
+
* Optional URL to navigate to after a successful submit (the parent list is
|
|
697
|
+
* refreshed). Empty = stay / close the modal. Web-only.
|
|
698
|
+
*/
|
|
699
|
+
redirect_on_save?: IContentField<string>;
|
|
690
700
|
buttons_size?: IContentField<string>;
|
|
691
701
|
buttons_radius?: IContentField<string>;
|
|
692
702
|
buttons_variant?: IContentField<string>;
|
|
@@ -1103,6 +1113,18 @@ interface IShowUserInputStyle extends IBaseStyle {
|
|
|
1103
1113
|
csv_export?: IContentField<string>;
|
|
1104
1114
|
delete_entry?: IContentField<string>;
|
|
1105
1115
|
fields_map?: IContentField<string>;
|
|
1116
|
+
/**
|
|
1117
|
+
* Optional URL of a create form. When set, the web table shows an "Add new"
|
|
1118
|
+
* button above it (e.g. opens the create form modal). Web-only.
|
|
1119
|
+
*/
|
|
1120
|
+
add_url?: IContentField<string>;
|
|
1121
|
+
/**
|
|
1122
|
+
* Optional URL template for opening a row's detail (e.g.
|
|
1123
|
+
* `/cms/team/{record_id}`). When set, each row gets an open/view action
|
|
1124
|
+
* (eye icon) with the single-brace `{record_id}` placeholder substituted by
|
|
1125
|
+
* the renderer at click time. Web-only.
|
|
1126
|
+
*/
|
|
1127
|
+
edit_url?: IContentField<string>;
|
|
1106
1128
|
delete_modal_title?: IContentField<string>;
|
|
1107
1129
|
delete_modal_body?: IContentField<string>;
|
|
1108
1130
|
spacing?: IContentField<string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@selfhelp/shared",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.0",
|
|
4
4
|
"description": "Shared TypeScript package for SelfHelp web frontend and mobile app: style registry, types, API contracts, Mantine theme tokens, condition + interpolation engines, CMS class allow-list.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|