@servicetitan/navigation 13.0.0-canary.256.b43c6d7.0 → 13.0.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.
Files changed (116) hide show
  1. package/dist/components/counter-tag.d.ts +1 -1
  2. package/dist/components/counter-tag.d.ts.map +1 -1
  3. package/dist/components/counter-tag.js.map +1 -1
  4. package/dist/components/profile-dropdown/interface.d.ts +55 -0
  5. package/dist/components/profile-dropdown/interface.d.ts.map +1 -0
  6. package/dist/components/profile-dropdown/interface.js +3 -0
  7. package/dist/components/profile-dropdown/interface.js.map +1 -0
  8. package/dist/components/profile-dropdown/profile-dropdown-legacy.stories.d.ts +5 -1
  9. package/dist/components/profile-dropdown/profile-dropdown-legacy.stories.d.ts.map +1 -1
  10. package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts +5 -1
  11. package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts.map +1 -1
  12. package/dist/components/profile-dropdown/profile-dropdown.d.ts +9 -79
  13. package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
  14. package/dist/components/profile-dropdown/profile-dropdown.js +17 -14
  15. package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
  16. package/dist/components/profile-dropdown/profile-dropdown.stories.d.ts +5 -1
  17. package/dist/components/profile-dropdown/profile-dropdown.stories.d.ts.map +1 -1
  18. package/dist/components/titan-layout/interface-internal.d.ts +12 -0
  19. package/dist/components/titan-layout/interface-internal.d.ts.map +1 -1
  20. package/dist/components/titan-layout/interface-internal.js.map +1 -1
  21. package/dist/components/titan-layout/interface.d.ts +60 -4
  22. package/dist/components/titan-layout/interface.d.ts.map +1 -1
  23. package/dist/components/titan-layout/interface.js.map +1 -1
  24. package/dist/components/titan-layout/layout-header-dark.d.ts.map +1 -1
  25. package/dist/components/titan-layout/layout-header-dark.js +24 -12
  26. package/dist/components/titan-layout/layout-header-dark.js.map +1 -1
  27. package/dist/components/titan-layout/layout-header-links-internal.d.ts +22 -3
  28. package/dist/components/titan-layout/layout-header-links-internal.d.ts.map +1 -1
  29. package/dist/components/titan-layout/layout-header-links-internal.js +15 -18
  30. package/dist/components/titan-layout/layout-header-links-internal.js.map +1 -1
  31. package/dist/components/titan-layout/layout-header-links.d.ts +2 -3
  32. package/dist/components/titan-layout/layout-header-links.d.ts.map +1 -1
  33. package/dist/components/titan-layout/layout-header-links.js +25 -5
  34. package/dist/components/titan-layout/layout-header-links.js.map +1 -1
  35. package/dist/components/titan-layout/layout-header.d.ts +2 -0
  36. package/dist/components/titan-layout/layout-header.d.ts.map +1 -1
  37. package/dist/components/titan-layout/layout-header.js +25 -16
  38. package/dist/components/titan-layout/layout-header.js.map +1 -1
  39. package/dist/components/titan-layout/layout-header.module.less +37 -1
  40. package/dist/components/titan-layout/layout-header.module.less.d.ts +3 -0
  41. package/dist/components/titan-layout/layout-profile.d.ts +8 -5
  42. package/dist/components/titan-layout/layout-profile.d.ts.map +1 -1
  43. package/dist/components/titan-layout/layout-profile.js +29 -21
  44. package/dist/components/titan-layout/layout-profile.js.map +1 -1
  45. package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts +48 -24
  46. package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts.map +1 -1
  47. package/dist/components/titan-layout/layout-sidebar-links-internal.js +62 -51
  48. package/dist/components/titan-layout/layout-sidebar-links-internal.js.map +1 -1
  49. package/dist/components/titan-layout/layout-sidebar-links.d.ts +2 -2
  50. package/dist/components/titan-layout/layout-sidebar-links.d.ts.map +1 -1
  51. package/dist/components/titan-layout/layout-sidebar-links.js +27 -14
  52. package/dist/components/titan-layout/layout-sidebar-links.js.map +1 -1
  53. package/dist/components/titan-layout/layout-sidebar.d.ts +1 -1
  54. package/dist/components/titan-layout/layout-sidebar.d.ts.map +1 -1
  55. package/dist/components/titan-layout/layout-sidebar.js +81 -104
  56. package/dist/components/titan-layout/layout-sidebar.js.map +1 -1
  57. package/dist/components/titan-layout/layout-sidebar.module.less +74 -22
  58. package/dist/components/titan-layout/titan-layout-default.stories.d.ts +16 -0
  59. package/dist/components/titan-layout/titan-layout-default.stories.d.ts.map +1 -0
  60. package/dist/components/titan-layout/titan-layout-legacy.stories.d.ts +10 -0
  61. package/dist/components/titan-layout/titan-layout-legacy.stories.d.ts.map +1 -0
  62. package/dist/components/titan-layout/titan-layout-stacked.stories.d.ts +10 -0
  63. package/dist/components/titan-layout/titan-layout-stacked.stories.d.ts.map +1 -0
  64. package/dist/components/titan-layout/titan-layout.d.ts +28 -1
  65. package/dist/components/titan-layout/titan-layout.d.ts.map +1 -1
  66. package/dist/components/titan-layout/titan-layout.js +30 -11
  67. package/dist/components/titan-layout/titan-layout.js.map +1 -1
  68. package/dist/index.d.ts +0 -1
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js.map +1 -1
  71. package/dist/test/data.d.ts +0 -22
  72. package/dist/test/data.d.ts.map +1 -1
  73. package/dist/test/data.js +0 -197
  74. package/dist/test/data.js.map +1 -1
  75. package/dist/test/titan-layout.d.ts +16 -0
  76. package/dist/test/titan-layout.d.ts.map +1 -0
  77. package/dist/test/titan-layout.js +21 -0
  78. package/dist/test/titan-layout.js.map +1 -0
  79. package/dist/utils/navigation.d.ts +1 -4
  80. package/dist/utils/navigation.d.ts.map +1 -1
  81. package/dist/utils/navigation.js.map +1 -1
  82. package/package.json +4 -4
  83. package/src/components/counter-tag.tsx +1 -1
  84. package/src/components/profile-dropdown/interface.ts +47 -0
  85. package/src/components/profile-dropdown/profile-dropdown-legacy.stories.tsx +3 -3
  86. package/src/components/profile-dropdown/profile-dropdown-stacked.stories.tsx +3 -3
  87. package/src/components/profile-dropdown/profile-dropdown.stories.tsx +39 -39
  88. package/src/components/profile-dropdown/profile-dropdown.tsx +37 -104
  89. package/src/components/titan-layout/interface-internal.ts +13 -0
  90. package/src/components/titan-layout/interface.ts +64 -7
  91. package/src/components/titan-layout/layout-header-dark.tsx +21 -5
  92. package/src/components/titan-layout/layout-header-links-internal.tsx +41 -54
  93. package/src/components/titan-layout/layout-header-links.tsx +64 -8
  94. package/src/components/titan-layout/layout-header.module.less +37 -1
  95. package/src/components/titan-layout/layout-header.module.less.d.ts +3 -0
  96. package/src/components/titan-layout/layout-header.tsx +26 -13
  97. package/src/components/titan-layout/layout-profile.tsx +51 -28
  98. package/src/components/titan-layout/layout-sidebar-links-internal.tsx +155 -102
  99. package/src/components/titan-layout/layout-sidebar-links.tsx +45 -12
  100. package/src/components/titan-layout/layout-sidebar.module.less +74 -22
  101. package/src/components/titan-layout/layout-sidebar.tsx +55 -80
  102. package/src/components/titan-layout/{titan-layout.stories.tsx → titan-layout-default.stories.tsx} +100 -84
  103. package/src/components/titan-layout/titan-layout-legacy.stories.tsx +24 -0
  104. package/src/components/titan-layout/titan-layout-stacked.stories.tsx +30 -0
  105. package/src/components/titan-layout/titan-layout.tsx +67 -12
  106. package/src/index.ts +0 -1
  107. package/src/test/data.tsx +0 -165
  108. package/src/test/titan-layout.tsx +34 -0
  109. package/src/utils/navigation.ts +1 -6
  110. package/dist/components/titan-layout/titan-layout.stories.d.ts +0 -29
  111. package/dist/components/titan-layout/titan-layout.stories.d.ts.map +0 -1
  112. package/dist/utils/navigation-legacy.d.ts +0 -88
  113. package/dist/utils/navigation-legacy.d.ts.map +0 -1
  114. package/dist/utils/navigation-legacy.js +0 -3
  115. package/dist/utils/navigation-legacy.js.map +0 -1
  116. package/src/utils/navigation-legacy.ts +0 -106
@@ -57,16 +57,48 @@ export type TitanLayoutProps = Omit<ComponentPropsWithoutRef<'div'>, 'children'
57
57
  /** logo props */
58
58
  logo?: TitanLayoutLogoProps;
59
59
 
60
+ /** layout state */
60
61
  state?: TitanLayoutState;
62
+ /** layout state change handler */
61
63
  onStateChange?: (state: TitanLayoutState) => void;
62
64
 
65
+ /** content header content */
63
66
  header?: ReactElement;
67
+
68
+ /** layout header content (center) */
64
69
  top?: ReactElement;
70
+
71
+ /** top links for side navigation */
65
72
  sideTop?: ReactElement[];
73
+
74
+ /**
75
+ * profile element for layout
76
+ * @see ProfileDropdown
77
+ */
66
78
  profile?: ReactElement;
79
+
80
+ /**
81
+ * extra links for layout header
82
+ * shown in side nav footer on mobile
83
+ */
67
84
  extraLinks?: ReactElement;
85
+
86
+ /**
87
+ * fixed extra links for layout header
88
+ * shown in header on mobile as well
89
+ */
68
90
  extraLinksTop?: ReactElement;
91
+
92
+ /**
93
+ * text shown in layout's header
94
+ * shown in side nav footer on mobile
95
+ */
69
96
  extraText?: string;
97
+
98
+ /**
99
+ * minimal width set for content area
100
+ * used for pages that aren't adopted to mobile
101
+ */
70
102
  minContentWidth?: number;
71
103
  };
72
104
 
@@ -93,7 +125,7 @@ const useAppearance = (appearance: TitanLayoutProps['appearance']) =>
93
125
  };
94
126
  }, [appearance]);
95
127
 
96
- const TitanLayoutComponent: FC<TitanLayoutProps> = ({
128
+ function TitanLayoutComponent({
97
129
  appearance = 'anvil2',
98
130
  navVariant = 'left',
99
131
  id,
@@ -113,7 +145,7 @@ const TitanLayoutComponent: FC<TitanLayoutProps> = ({
113
145
  extraText,
114
146
  minContentWidth,
115
147
  sideTop,
116
- }) => {
148
+ }: TitanLayoutProps) {
117
149
  const breakpoint = useTitanBreakpoint();
118
150
  const context: TitanLayoutContextType = useMemo(
119
151
  () => ({
@@ -149,10 +181,18 @@ const TitanLayoutComponent: FC<TitanLayoutProps> = ({
149
181
  }
150
182
  }, [view.isAnvil1]);
151
183
 
152
- const onBurgerClick = useCallback((e: MouseEvent<never>) => {
153
- setMobileDrawerOpened(true);
154
- e.stopPropagation();
155
- }, []);
184
+ const onBurgerClick = useCallback(
185
+ (e: MouseEvent<never>) => {
186
+ if (isMobile) {
187
+ setMobileDrawerOpened(true);
188
+ } else {
189
+ onStateChange?.({ navCollapsed: !state?.navCollapsed });
190
+ }
191
+
192
+ e.stopPropagation();
193
+ },
194
+ [isMobile, state?.navCollapsed, onStateChange]
195
+ );
156
196
 
157
197
  const onBarExpandChange = useCallback(
158
198
  (expanded: boolean) => {
@@ -168,7 +208,10 @@ const TitanLayoutComponent: FC<TitanLayoutProps> = ({
168
208
  (id: string, expanded: boolean) => {
169
209
  onStateChange?.({
170
210
  navCollapsed: state?.navCollapsed ?? false,
171
- submenuExpanded: expanded ? id : undefined,
211
+ submenusExpanded: [
212
+ ...(state?.submenusExpanded ?? []).filter(i => i !== id),
213
+ ...(expanded ? [id] : []),
214
+ ],
172
215
  });
173
216
  },
174
217
  [state, onStateChange]
@@ -272,7 +315,17 @@ const TitanLayoutComponent: FC<TitanLayoutProps> = ({
272
315
  </Fragment>
273
316
  }
274
317
  isMobile={isMobile}
275
- hasNotifications={hasNotifications || hasMenuNotifications}
318
+ hasNotifications={
319
+ isMobile && (hasNotifications || hasMenuNotifications)
320
+ }
321
+ hasBurger={hasSideBar}
322
+ burgerTooltip={
323
+ isMobile
324
+ ? undefined
325
+ : state?.navCollapsed
326
+ ? 'Expand'
327
+ : 'Collapse'
328
+ }
276
329
  onBurgerClick={onBurgerClick}
277
330
  />
278
331
  ) : (
@@ -291,6 +344,7 @@ const TitanLayoutComponent: FC<TitanLayoutProps> = ({
291
344
  isMobile={isMobile}
292
345
  hasNotifications={hasNotifications || hasMenuNotifications}
293
346
  onBurgerClick={onBurgerClick}
347
+ hasBurger={isMobile}
294
348
  navigationMainItems={navigationMainItems}
295
349
  navigationOverflowItems={navigationOverflowItems}
296
350
  />
@@ -303,7 +357,7 @@ const TitanLayoutComponent: FC<TitanLayoutProps> = ({
303
357
  mobile={breakpoint.isMobile}
304
358
  barExpanded={!state?.navCollapsed}
305
359
  onBarExpandChange={onBarExpandChange}
306
- submenuExpanded={state?.submenuExpanded}
360
+ submenusExpanded={state?.submenusExpanded}
307
361
  onSubmenuExpandChange={onSubmenuExpandChange}
308
362
  drawerOpened={mobileDrawerOpened}
309
363
  onDrawerOpenChange={setMobileDrawerOpened}
@@ -319,10 +373,11 @@ const TitanLayoutComponent: FC<TitanLayoutProps> = ({
319
373
  <InternalSideNavigationTrigger
320
374
  id="--extra-text"
321
375
  title={extraText}
322
- submenuExpanded={undefined}
323
- tag={undefined}
376
+ isActive={undefined}
324
377
  icon={undefined}
325
378
  iconActive={undefined}
379
+ tag={undefined}
380
+ className={undefined}
326
381
  />
327
382
  )}
328
383
  </Fragment>
@@ -352,7 +407,7 @@ const TitanLayoutComponent: FC<TitanLayoutProps> = ({
352
407
  </LayoutPlacementContext.Provider>
353
408
  </LayoutContext.Provider>
354
409
  );
355
- };
410
+ }
356
411
 
357
412
  const TitanLayoutHeaderObserved: FC<{
358
413
  children: ReactNode;
package/src/index.ts CHANGED
@@ -5,5 +5,4 @@ export * from './components/counter-tag';
5
5
  export * from './components/titan-layout';
6
6
  export type * from './utils/navigation';
7
7
  export type { NavLinkComponentProps } from './utils/navigation-context';
8
- export type * from './utils/navigation-legacy';
9
8
  export * from './utils/use-breakpoint';
package/src/test/data.tsx CHANGED
@@ -44,7 +44,6 @@ import {
44
44
  NavigationSubmenuItemData,
45
45
  } from '../utils/navigation';
46
46
  import { NavLinkComponentProps } from '../utils/navigation-context';
47
- import { HeaderNavigationItemData } from '../utils/navigation-legacy';
48
47
  import * as Styles from './data-stories.module.less';
49
48
 
50
49
  export const NavLinkMock = forwardRef<any, NavLinkComponentProps>(
@@ -115,31 +114,6 @@ export const SearchIcon = () => (
115
114
  </svg>
116
115
  );
117
116
 
118
- const getItem = (
119
- id: string,
120
- data: Partial<HeaderNavigationItemData>
121
- ): HeaderNavigationItemData => ({
122
- id,
123
- to: '/' + id,
124
- title: id[0].toUpperCase() + id.substring(1),
125
- hint: id,
126
- icon: undefined,
127
- iconActive: undefined,
128
- ...data,
129
- submenu: data.submenu
130
- ? {
131
- ...data.submenu,
132
- groups: data.submenu.groups.map(group => ({
133
- ...group,
134
- links: group.links.map(link => ({
135
- ...link,
136
- to: `/${id}/${link.to}`,
137
- })),
138
- })),
139
- }
140
- : undefined,
141
- });
142
-
143
117
  const getNavItem = (id: string, data: Partial<NavigationItemData>): NavigationItemData => ({
144
118
  id,
145
119
  to: '/' + id,
@@ -179,145 +153,6 @@ const getGroup = (
179
153
  links,
180
154
  });
181
155
 
182
- export const items = {
183
- calendar: getItem('calendar', {
184
- iconName: 'event',
185
- icon: SvgSchedule,
186
- iconActive: SvgScheduleActive,
187
- }),
188
- schedule: getItem('schedule', {
189
- iconName: 'event',
190
- icon: SvgSchedule,
191
- iconActive: SvgScheduleActive,
192
- }),
193
- calls: getItem('calls', {
194
- iconName: 'local_phone',
195
- icon: SvgCalls,
196
- iconActive: SvgCallsActive,
197
- counter: 1234,
198
- }),
199
- dashboard: getItem('dashboard', {
200
- iconName: 'odometer',
201
- icon: SvgDashboard,
202
- iconActive: SvgDashboardActive,
203
- }),
204
- dispatch: getItem('dispatch', {
205
- iconName: 'location_disabled',
206
- icon: SvgDispatch,
207
- iconActive: SvgDispatchActive,
208
- tag: { value: 3 },
209
- }),
210
- fleet: getItem('fleet', {
211
- iconName: 'fleet-pro',
212
- icon: SvgFleetPro,
213
- iconActive: SvgFleetProActive,
214
- title: 'Fleet Pro',
215
- }),
216
- followUps: getItem('followUps', {
217
- iconName: 'flag',
218
- icon: SvgFollowUp,
219
- iconActive: SvgFollowUpActive,
220
- title: 'Follow Up',
221
- }),
222
- followUpsWithSubmenu: getItem('followUps', {
223
- iconName: 'flag',
224
- icon: SvgFollowUp,
225
- iconActive: SvgFollowUpActive,
226
- title: 'Follow Up',
227
- submenu: {
228
- groups: [
229
- getGroup('', [
230
- getSubItem('estimates', { title: 'Unsold Estimates' }),
231
- getSubItem('sold', { title: 'Sold Estimates' }),
232
- getSubItem('surveys', { title: 'Surveys' }),
233
- ]),
234
- ],
235
- },
236
- }),
237
- inventory: getItem('inventory', {
238
- iconName: 'toys',
239
- icon: SvgInventory,
240
- iconActive: SvgInventoryActive,
241
- }),
242
- purchasing: getItem('purchasing', { iconComponent: InventoryIcon }),
243
- purchasingWithSubmenu: getItem('purchasing', {
244
- iconName: 'toys',
245
- icon: SvgInventory,
246
- iconActive: SvgInventoryActive,
247
- counter: true,
248
- submenu: {
249
- groups: [
250
- getGroup('Purchase', [
251
- getSubItem('repl', { title: 'Replenishment' }),
252
- getSubItem('orders', { title: 'Purchase Orders' }),
253
- getSubItem('receipts', { title: 'Receipts' }),
254
- getSubItem('returns', { title: 'Returns' }),
255
- ]),
256
- ],
257
- },
258
- }),
259
- accounting: getItem('accounting', {
260
- iconName: 'assignment',
261
- icon: SvgAccounting,
262
- iconActive: SvgAccountingActive,
263
- counter: true,
264
- }),
265
- accountingWithSubmenu: getItem('accounting', {
266
- iconName: 'assignment',
267
- icon: SvgAccounting,
268
- iconActive: SvgAccountingActive,
269
- counter: 1,
270
- submenu: {
271
- groups: [
272
- getGroup('Accounts Receivable', [
273
- getSubItem('export', {
274
- title: 'Batch/Export Transactions',
275
- counter: true,
276
- }),
277
- getSubItem('ar', { title: 'AR Management' }),
278
- getSubItem('invoices', { title: 'Invoices', counter: 3 }),
279
- getSubItem('payments', { title: 'Customer Payments', counter: 2 }),
280
- getSubItem('deposits', { title: 'Bank Deposits' }),
281
- ]),
282
- getGroup('Accounts Payable', [getSubItem('bills', { title: 'Bills' })]),
283
- getGroup('Financing', [getSubItem('dashboard', { title: 'Dashboard' })]),
284
- getGroup('Others', [getSubItem('at', { title: 'Accounting Audit Trail' })]),
285
- ],
286
- },
287
- }),
288
- marketing: getItem('marketing', {
289
- iconName: 'bullhorn',
290
- icon: SvgMarketing,
291
- iconActive: SvgMarketingActive,
292
- }),
293
- priceBook: getItem('pricebook', {
294
- iconName: 'book',
295
- icon: SvgPriceBook,
296
- iconActive: SvgPriceBookActive,
297
- }),
298
- pointOfSale: getItem('pointOfSale', {
299
- iconName: 'cash-register',
300
- icon: SvgPos,
301
- iconActive: SvgPosActive,
302
- title: 'Point Of Sale',
303
- }),
304
- projects: getItem('projects', {
305
- iconName: 'folder_special',
306
- icon: SvgProjects,
307
- iconActive: SvgProjectsActive,
308
- }),
309
- reports: getItem('reports', {
310
- iconName: 'folder_special',
311
- icon: SvgReports,
312
- iconActive: SvgReportsActive,
313
- }),
314
- tasks: getItem('tasks', {
315
- iconName: 'format_list_bulleted',
316
- icon: SvgTasks,
317
- iconActive: SvgTasksActive,
318
- }),
319
- };
320
-
321
156
  export const navItems = {
322
157
  calendar: getNavItem('calendar', {
323
158
  icon: SvgSchedule,
@@ -0,0 +1,34 @@
1
+ import { createContext, useContext } from 'react';
2
+ import { TitanLayoutProps } from '../components/titan-layout';
3
+
4
+ export interface LayoutContentArgs {
5
+ header: boolean;
6
+ sideTop: boolean;
7
+ extraText: boolean;
8
+ search: boolean;
9
+ longContent: boolean;
10
+ wideContent: boolean;
11
+ minWidth: boolean;
12
+ emptyNav: boolean;
13
+ overflowItems: boolean;
14
+ }
15
+
16
+ export const getDefaultArgs = (): LayoutContentArgs => ({
17
+ header: true,
18
+ sideTop: true,
19
+ extraText: true,
20
+ search: true,
21
+ longContent: true,
22
+ wideContent: false,
23
+ minWidth: false,
24
+ emptyNav: false,
25
+ overflowItems: true,
26
+ });
27
+
28
+ const DefaultPropsContext = createContext<Partial<TitanLayoutProps>>({});
29
+ export const withDefaultLayoutProps = (props: Partial<TitanLayoutProps>) => (Story: any) => (
30
+ <DefaultPropsContext.Provider value={props}>
31
+ <Story />
32
+ </DefaultPropsContext.Provider>
33
+ );
34
+ export const useDefaultLayoutProps = () => useContext(DefaultPropsContext);
@@ -2,9 +2,6 @@ import { IconProps } from '@servicetitan/anvil2';
2
2
  import { CounterTagData, CounterTagValue } from './counter-tag';
3
3
 
4
4
  export interface NavigationItemData extends NavigationLinkData {
5
- /** flag if the link is not shown (based on FG and/or user permissions) */
6
- isHidden?: boolean;
7
-
8
5
  /** svg icon (anvil2) of inactive item */
9
6
  icon: IconProps['svg'] | undefined;
10
7
 
@@ -20,9 +17,6 @@ export interface NavigationItemData extends NavigationLinkData {
20
17
 
21
18
  /** optional submenu of link item */
22
19
  submenu?: NavigationSubmenuData;
23
-
24
- iconClassName?: never;
25
- iconComponent?: never;
26
20
  }
27
21
 
28
22
  export interface NavigationLinkData {
@@ -47,6 +41,7 @@ export interface NavigationSubmenuData {
47
41
  export interface NavigationSubmenuItemData extends NavigationLinkData {
48
42
  /** item tag (optional) value. shown if it is set and true or greater than 0 */
49
43
  counter?: CounterTagValue;
44
+ /** item tag (optional) value. shown if value is true or greater than 0 */
50
45
  tag?: CounterTagData;
51
46
  }
52
47
 
@@ -1,29 +0,0 @@
1
- interface LayoutContentArgs {
2
- header: boolean;
3
- sideTop: boolean;
4
- extraText: boolean;
5
- search: boolean;
6
- longContent: boolean;
7
- wideContent: boolean;
8
- minWidth: boolean;
9
- emptyNav: boolean;
10
- }
11
- declare const _default: {
12
- title: string;
13
- decorators: ((Story: any) => import("react/jsx-runtime").JSX.Element)[];
14
- parameters: {};
15
- argTypes: {};
16
- args: LayoutContentArgs;
17
- };
18
- export default _default;
19
- export declare const TitanLayoutLegacy: (args: LayoutContentArgs) => import("react/jsx-runtime").JSX.Element;
20
- export declare const TitanLayoutLegacyTopNav: (args: LayoutContentArgs) => import("react/jsx-runtime").JSX.Element;
21
- export declare const TitanLayoutLegacyTop: (args: LayoutContentArgs) => import("react/jsx-runtime").JSX.Element;
22
- export declare const TitanLayoutAnvil1: (args: LayoutContentArgs) => import("react/jsx-runtime").JSX.Element;
23
- export declare const TitanLayoutAnvil1TopNav: (args: LayoutContentArgs) => import("react/jsx-runtime").JSX.Element;
24
- export declare const TitanLayoutAnvil1Top: (args: LayoutContentArgs) => import("react/jsx-runtime").JSX.Element;
25
- export declare const TitanLayoutAnvil1TopOverflow: (args: LayoutContentArgs) => import("react/jsx-runtime").JSX.Element;
26
- export declare const TitanLayoutAnvil2: (args: LayoutContentArgs) => import("react/jsx-runtime").JSX.Element;
27
- export declare const TitanLayoutAnvil2TopNav: (args: LayoutContentArgs) => import("react/jsx-runtime").JSX.Element;
28
- export declare const TitanLayoutAnvil2Top: (args: LayoutContentArgs) => import("react/jsx-runtime").JSX.Element;
29
- //# sourceMappingURL=titan-layout.stories.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"titan-layout.stories.d.ts","sourceRoot":"","sources":["../../../src/components/titan-layout/titan-layout.stories.tsx"],"names":[],"mappings":"AA0BA,UAAU,iBAAiB;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACrB;;;;;;UAgBQ,iBAAiB;;AAd1B,wBAeE;AA0QF,eAAO,MAAM,iBAAiB,GAAI,MAAM,iBAAiB,4CASxD,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,MAAM,iBAAiB,4CAS9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,MAAM,iBAAiB,4CAS3D,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,MAAM,iBAAiB,4CAMxD,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,MAAM,iBAAiB,4CAM9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,MAAM,iBAAiB,4CAY3D,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,MAAM,iBAAiB,4CAMnE,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,MAAM,iBAAiB,4CAQxD,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,MAAM,iBAAiB,4CAQ9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,MAAM,iBAAiB,4CAQ3D,CAAC"}
@@ -1,88 +0,0 @@
1
- import { IconProps } from '@servicetitan/anvil2';
2
- import { IconPropsStrict } from '@servicetitan/design-system';
3
- import { FC, HTMLAttributeAnchorTarget } from 'react';
4
- import { CounterTagData, CounterTagValue } from './counter-tag';
5
- import { NavigationSubmenuData } from './navigation';
6
- export interface HeaderNavigationItemData extends HeaderNavigationItemLinkProps {
7
- /** link description */
8
- hint: string;
9
- /** flag if the link is not shown (based on FG and/or user permissions) */
10
- isHidden?: boolean;
11
- /** custom className (can be used for mdi icons) */
12
- iconClassName?: string;
13
- /** anvil's icon name of item */
14
- iconName?: IconPropsStrict['name'];
15
- /** svg icon (anvil2) of inactive item */
16
- icon: IconProps['svg'] | undefined;
17
- /** svg icon (anvil2) of active item */
18
- iconActive: IconProps['svg'] | undefined;
19
- /** icon component of item (<svg />) */
20
- iconComponent?: FC;
21
- /** item tag (optional). shown if it is set and true or greater than 0 */
22
- counter?: CounterTagValue;
23
- tag?: CounterTagData;
24
- /** class name of link item */
25
- className?: string;
26
- /** optional submenu of link item */
27
- submenu?: NavigationSubmenuData;
28
- }
29
- export interface HeaderNavigationItemLinkProps {
30
- /** link id */
31
- id: string;
32
- /** link href */
33
- to: string;
34
- /** link title */
35
- title: string;
36
- /** callback to return active state. By default, it compares link href with current pathname */
37
- isActive?: boolean | ((pathname: string) => boolean);
38
- }
39
- export interface HeaderNavigationTriggerPropsStrict {
40
- /** unique identifier */
41
- id: string;
42
- /** item title (used for mobile) */
43
- title: string;
44
- /** tooltip text */
45
- tooltip?: string;
46
- /** item description */
47
- hint?: string;
48
- /** container class name */
49
- className?: string;
50
- /** item label */
51
- label?: string;
52
- /** label class name */
53
- labelClassName?: string;
54
- /** isActive */
55
- isActive?: boolean;
56
- /** counter value shown for item */
57
- counter?: CounterTagValue;
58
- tag?: CounterTagData;
59
- /** counter component class name */
60
- counterClassName?: string;
61
- /** icon component class name */
62
- iconClassName?: string;
63
- /** IconComponent custom icon component */
64
- iconComponent?: FC;
65
- /** iconName name of anvil icon */
66
- iconName?: IconPropsStrict['name'];
67
- /** svg icon (anvil2) of inactive item */
68
- icon: IconProps['svg'] | undefined;
69
- /** svg icon (anvil2) of active item */
70
- iconActive?: IconProps['svg'];
71
- }
72
- export interface HeaderNavigationTriggerProps extends HeaderNavigationTriggerPropsStrict {
73
- /** unstrict props */
74
- [key: string]: any;
75
- }
76
- export interface HeaderNavigationLinkPropsStrict extends Omit<HeaderNavigationTriggerPropsStrict, 'isActive'> {
77
- /** link href */
78
- to: string;
79
- /** isActive */
80
- isActive?: boolean | ((pathname: string) => boolean);
81
- /** link html target */
82
- target?: HTMLAttributeAnchorTarget;
83
- }
84
- export interface HeaderNavigationLinkProps extends HeaderNavigationLinkPropsStrict {
85
- /** unstrict props */
86
- [key: string]: any;
87
- }
88
- //# sourceMappingURL=navigation-legacy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"navigation-legacy.d.ts","sourceRoot":"","sources":["../../src/utils/navigation-legacy.ts"],"names":[],"mappings":"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"}
@@ -1,3 +0,0 @@
1
- export { };
2
-
3
- //# sourceMappingURL=navigation-legacy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/navigation-legacy.ts"],"sourcesContent":["import { IconProps } from '@servicetitan/anvil2';\nimport { IconPropsStrict } from '@servicetitan/design-system';\nimport { FC, HTMLAttributeAnchorTarget } from 'react';\nimport { CounterTagData, CounterTagValue } from './counter-tag';\nimport { NavigationSubmenuData } from './navigation';\n\nexport interface HeaderNavigationItemData extends HeaderNavigationItemLinkProps {\n /** link description */\n hint: string;\n\n /** flag if the link is not shown (based on FG and/or user permissions) */\n isHidden?: boolean;\n\n /** custom className (can be used for mdi icons) */\n iconClassName?: string;\n\n /** anvil's icon name of item */\n iconName?: IconPropsStrict['name'];\n\n /** svg icon (anvil2) of inactive item */\n icon: IconProps['svg'] | undefined;\n\n /** svg icon (anvil2) of active item */\n iconActive: IconProps['svg'] | undefined;\n\n /** icon component of item (<svg />) */\n iconComponent?: FC;\n\n /** item tag (optional). shown if it is set and true or greater than 0 */\n counter?: CounterTagValue;\n tag?: CounterTagData;\n\n /** class name of link item */\n className?: string;\n\n /** optional submenu of link item */\n submenu?: NavigationSubmenuData;\n}\n\nexport interface HeaderNavigationItemLinkProps {\n /** link id */\n id: string;\n\n /** link href */\n to: string;\n\n /** link title */\n title: string;\n\n /** callback to return active state. By default, it compares link href with current pathname */\n isActive?: boolean | ((pathname: string) => boolean);\n}\n\nexport interface HeaderNavigationTriggerPropsStrict {\n /** unique identifier */\n id: string;\n /** item title (used for mobile) */\n title: string;\n /** tooltip text */\n tooltip?: string;\n /** item description */\n hint?: string;\n /** container class name */\n className?: string;\n /** item label */\n label?: string;\n /** label class name */\n labelClassName?: string;\n /** isActive */\n isActive?: boolean;\n /** counter value shown for item */\n counter?: CounterTagValue;\n tag?: CounterTagData;\n /** counter component class name */\n counterClassName?: string;\n /** icon component class name */\n iconClassName?: string;\n /** IconComponent custom icon component */\n iconComponent?: FC;\n /** iconName name of anvil icon */\n iconName?: IconPropsStrict['name'];\n /** svg icon (anvil2) of inactive item */\n icon: IconProps['svg'] | undefined;\n /** svg icon (anvil2) of active item */\n iconActive?: IconProps['svg'];\n}\n\nexport interface HeaderNavigationTriggerProps extends HeaderNavigationTriggerPropsStrict {\n /** unstrict props */\n [key: string]: any;\n}\n\nexport interface HeaderNavigationLinkPropsStrict\n extends Omit<HeaderNavigationTriggerPropsStrict, 'isActive'> {\n /** link href */\n to: string;\n /** isActive */\n isActive?: boolean | ((pathname: string) => boolean);\n /** link html target */\n target?: HTMLAttributeAnchorTarget;\n}\n\nexport interface HeaderNavigationLinkProps extends HeaderNavigationLinkPropsStrict {\n /** unstrict props */\n [key: string]: any;\n}\n"],"names":[],"mappings":"AAsGA,WAGC"}
@@ -1,106 +0,0 @@
1
- import { IconProps } from '@servicetitan/anvil2';
2
- import { IconPropsStrict } from '@servicetitan/design-system';
3
- import { FC, HTMLAttributeAnchorTarget } from 'react';
4
- import { CounterTagData, CounterTagValue } from './counter-tag';
5
- import { NavigationSubmenuData } from './navigation';
6
-
7
- export interface HeaderNavigationItemData extends HeaderNavigationItemLinkProps {
8
- /** link description */
9
- hint: string;
10
-
11
- /** flag if the link is not shown (based on FG and/or user permissions) */
12
- isHidden?: boolean;
13
-
14
- /** custom className (can be used for mdi icons) */
15
- iconClassName?: string;
16
-
17
- /** anvil's icon name of item */
18
- iconName?: IconPropsStrict['name'];
19
-
20
- /** svg icon (anvil2) of inactive item */
21
- icon: IconProps['svg'] | undefined;
22
-
23
- /** svg icon (anvil2) of active item */
24
- iconActive: IconProps['svg'] | undefined;
25
-
26
- /** icon component of item (<svg />) */
27
- iconComponent?: FC;
28
-
29
- /** item tag (optional). shown if it is set and true or greater than 0 */
30
- counter?: CounterTagValue;
31
- tag?: CounterTagData;
32
-
33
- /** class name of link item */
34
- className?: string;
35
-
36
- /** optional submenu of link item */
37
- submenu?: NavigationSubmenuData;
38
- }
39
-
40
- export interface HeaderNavigationItemLinkProps {
41
- /** link id */
42
- id: string;
43
-
44
- /** link href */
45
- to: string;
46
-
47
- /** link title */
48
- title: string;
49
-
50
- /** callback to return active state. By default, it compares link href with current pathname */
51
- isActive?: boolean | ((pathname: string) => boolean);
52
- }
53
-
54
- export interface HeaderNavigationTriggerPropsStrict {
55
- /** unique identifier */
56
- id: string;
57
- /** item title (used for mobile) */
58
- title: string;
59
- /** tooltip text */
60
- tooltip?: string;
61
- /** item description */
62
- hint?: string;
63
- /** container class name */
64
- className?: string;
65
- /** item label */
66
- label?: string;
67
- /** label class name */
68
- labelClassName?: string;
69
- /** isActive */
70
- isActive?: boolean;
71
- /** counter value shown for item */
72
- counter?: CounterTagValue;
73
- tag?: CounterTagData;
74
- /** counter component class name */
75
- counterClassName?: string;
76
- /** icon component class name */
77
- iconClassName?: string;
78
- /** IconComponent custom icon component */
79
- iconComponent?: FC;
80
- /** iconName name of anvil icon */
81
- iconName?: IconPropsStrict['name'];
82
- /** svg icon (anvil2) of inactive item */
83
- icon: IconProps['svg'] | undefined;
84
- /** svg icon (anvil2) of active item */
85
- iconActive?: IconProps['svg'];
86
- }
87
-
88
- export interface HeaderNavigationTriggerProps extends HeaderNavigationTriggerPropsStrict {
89
- /** unstrict props */
90
- [key: string]: any;
91
- }
92
-
93
- export interface HeaderNavigationLinkPropsStrict
94
- extends Omit<HeaderNavigationTriggerPropsStrict, 'isActive'> {
95
- /** link href */
96
- to: string;
97
- /** isActive */
98
- isActive?: boolean | ((pathname: string) => boolean);
99
- /** link html target */
100
- target?: HTMLAttributeAnchorTarget;
101
- }
102
-
103
- export interface HeaderNavigationLinkProps extends HeaderNavigationLinkPropsStrict {
104
- /** unstrict props */
105
- [key: string]: any;
106
- }