@sybilion/uilib 1.4.11 → 1.4.13

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 (47) hide show
  1. package/dist/esm/components/ui/Button/Button.styl.js +1 -1
  2. package/dist/esm/components/ui/Chat/ChatSheet/ChatSheet.js +2 -2
  3. package/dist/esm/components/ui/Page/PageHeader/PageHeader.js +2 -2
  4. package/dist/esm/components/ui/Page/PageHeader/PageHeader.styl.js +2 -2
  5. package/dist/esm/components/ui/Renamer/Renamer.js +4 -4
  6. package/dist/esm/components/ui/Renamer/Renamer.styl.js +2 -2
  7. package/dist/esm/components/ui/Sidebar/Sidebar.js +20 -7
  8. package/dist/esm/components/ui/Sidebar/Sidebar.styl.js +2 -2
  9. package/dist/esm/components/ui/SmartTextTruncate/SmartTextTruncate.js +260 -67
  10. package/dist/esm/components/ui/SmartTextTruncate/SmartTextTruncate.styl.js +7 -0
  11. package/dist/esm/components/widgets/DriversComparisonChart/DriversComparisonChart.js +21 -5
  12. package/dist/esm/components/widgets/PerformanceChart/PerformanceChart.js +10 -3
  13. package/dist/esm/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.js +5 -5
  14. package/dist/esm/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.styl.js +2 -2
  15. package/dist/esm/index.js +1 -1
  16. package/dist/esm/types/src/components/ui/Chat/ChatSheet/ChatSheet.d.ts +2 -1
  17. package/dist/esm/types/src/components/ui/Page/PageHeader/PageHeader.d.ts +2 -1
  18. package/dist/esm/types/src/components/ui/Sidebar/Sidebar.d.ts +7 -2
  19. package/dist/esm/types/src/components/ui/SmartTextTruncate/SmartTextTruncate.d.ts +5 -3
  20. package/dist/esm/types/src/components/ui/SmartTextTruncate/index.d.ts +1 -1
  21. package/dist/esm/types/src/components/widgets/DriversComparisonChart/DriversComparisonChart.d.ts +3 -1
  22. package/dist/esm/types/src/components/widgets/PerformanceChart/PerformanceChart.d.ts +4 -1
  23. package/package.json +1 -1
  24. package/src/components/ui/Button/Button.styl +5 -10
  25. package/src/components/ui/Chat/ChatSheet/ChatSheet.tsx +5 -2
  26. package/src/components/ui/Page/PageHeader/PageHeader.styl +5 -0
  27. package/src/components/ui/Page/PageHeader/PageHeader.styl.d.ts +1 -0
  28. package/src/components/ui/Page/PageHeader/PageHeader.tsx +8 -1
  29. package/src/components/ui/Renamer/Renamer.styl +19 -4
  30. package/src/components/ui/Renamer/Renamer.tsx +8 -9
  31. package/src/components/ui/Sidebar/Sidebar.styl +61 -51
  32. package/src/components/ui/Sidebar/Sidebar.styl.d.ts +4 -0
  33. package/src/components/ui/Sidebar/Sidebar.tsx +66 -6
  34. package/src/components/ui/SmartTextTruncate/SmartTextTruncate.styl +34 -0
  35. package/src/components/ui/SmartTextTruncate/SmartTextTruncate.styl.d.ts +10 -0
  36. package/src/components/ui/SmartTextTruncate/SmartTextTruncate.tsx +335 -81
  37. package/src/components/ui/SmartTextTruncate/index.ts +5 -1
  38. package/src/components/widgets/DriversComparisonChart/DriversComparisonChart.tsx +53 -20
  39. package/src/components/widgets/PerformanceChart/PerformanceChart.tsx +21 -2
  40. package/src/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.styl +0 -24
  41. package/src/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.styl.d.ts +0 -2
  42. package/src/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.tsx +5 -11
  43. package/src/docs/components/DocsSidebar/DocsSidebar.tsx +3 -17
  44. package/src/docs/pages/SidebarDatasetsItemsGroupedPage.tsx +4 -1
  45. package/src/docs/pages/SmartTextTruncatePage.styl +22 -0
  46. package/src/docs/pages/SmartTextTruncatePage.styl.d.ts +2 -0
  47. package/src/docs/pages/SmartTextTruncatePage.tsx +21 -1
@@ -10,7 +10,7 @@ import {
10
10
  SidebarMenuSubItem,
11
11
  } from '#uilib/components/ui/Sidebar/Sidebar';
12
12
  import { SmartTextTruncate } from '#uilib/components/ui/SmartTextTruncate';
13
- import { ChevronDown, ChevronRight, PackageOpen } from 'lucide-react';
13
+ import { PackageOpen } from 'lucide-react';
14
14
 
15
15
  import S from './SidebarDatasetsItemsGrouped.styl';
16
16
  import {
@@ -102,22 +102,16 @@ export function SidebarDatasetsItemsGrouped({
102
102
  <SidebarMenuButton
103
103
  type="button"
104
104
  isActive={parentActive}
105
+ hasSubItems
106
+ isExpanded={isExpanded}
105
107
  onClick={() => toggleGroup(groupName)}
108
+ icon={<PackageOpen strokeWidth={1.5} size={16} />}
106
109
  >
107
- <PackageOpen strokeWidth={1.5} size={16} />
108
- <SmartTextTruncate>{groupName}</SmartTextTruncate>
109
- <div className={S.chevronContainer}>
110
- {isExpanded ? (
111
- <ChevronDown size={12} />
112
- ) : (
113
- <ChevronRight size={12} />
114
- )}
115
- </div>
110
+ {groupName}
116
111
  </SidebarMenuButton>
117
112
 
118
113
  {isExpanded && (
119
114
  <SidebarMenuSub className={S.subMenuContainer}>
120
- <div className={S.subMenuBorder} />
121
115
  {groupDatasets.map(dataset => (
122
116
  <SidebarMenuSubItem
123
117
  key={dataset.id}
@@ -14,7 +14,6 @@ import {
14
14
  SidebarMenuSubItem,
15
15
  } from '#uilib/components/ui/Sidebar/Sidebar';
16
16
  import { SmartTextTruncate } from '#uilib/components/ui/SmartTextTruncate';
17
- import { ChevronDown, ChevronRight } from 'lucide-react';
18
17
 
19
18
  import { DOC_REGISTRY, DOC_SECTION_ORDER } from '../../registry';
20
19
  import S from './DocsSidebar.styl';
@@ -48,18 +47,6 @@ function entryMatchesQuery(
48
47
  );
49
48
  }
50
49
 
51
- function renderSectionChevron(isExpanded: boolean) {
52
- return (
53
- <div>
54
- {isExpanded ? (
55
- <ChevronDown size={12} strokeWidth={1.5} />
56
- ) : (
57
- <ChevronRight size={12} strokeWidth={1.5} />
58
- )}
59
- </div>
60
- );
61
- }
62
-
63
50
  export function DocsSidebar() {
64
51
  const location = useLocation();
65
52
  const bySection = entriesBySection();
@@ -134,11 +121,10 @@ export function DocsSidebar() {
134
121
  if (!isFiltering) toggleSection(section);
135
122
  }}
136
123
  isActive={sectionHasActive}
124
+ hasSubItems={filteredEntries.length > 0}
125
+ isExpanded={isExpanded}
137
126
  >
138
- <span>
139
- <SmartTextTruncate>{section}</SmartTextTruncate>
140
- </span>
141
- {isFiltering ? null : renderSectionChevron(isExpanded)}
127
+ {section}
142
128
  </SidebarMenuButton>
143
129
  {isExpanded ? (
144
130
  <SidebarMenuSub>
@@ -67,7 +67,10 @@ const MOCK_DATASETS: SidebarDatasetsItemsGroupedDataset[] = [
67
67
  sale_price: '0',
68
68
  regions: [
69
69
  { id: 3, name: 'Europe' },
70
- { id: 4, name: 'Germany' },
70
+ {
71
+ id: 4,
72
+ name: 'GermanyGermanyGermanyGermanyGermanyGermanyGermanyGermany',
73
+ },
71
74
  ],
72
75
  unit: { id: 1, name: 'MT' },
73
76
  },
@@ -1,3 +1,8 @@
1
+ .sectionLabel
2
+ margin 0 0 var(--p-2)
3
+ color var(--muted-foreground)
4
+ font-size 0.875rem
5
+
1
6
  .resizableDemo
2
7
  resize horizontal
3
8
  overflow auto
@@ -7,6 +12,23 @@
7
12
  border 1px solid var(--border)
8
13
  border-radius var(--p-2)
9
14
  padding var(--p-2)
15
+ margin-bottom var(--p-6)
16
+
17
+ .resizableListDemo
18
+ resize horizontal
19
+ overflow auto
20
+ width 280px
21
+ min-width 120px
22
+ max-width 100%
23
+ border 1px solid var(--border)
24
+ border-radius var(--p-2)
25
+ padding var(--p-2)
26
+ display flex
27
+ flex-direction column
28
+ gap var(--p-1)
29
+
30
+ &:active
31
+ border 1px solid var(--brand-color)
10
32
 
11
33
  .demoText
12
34
  display block
@@ -3,6 +3,8 @@
3
3
  interface CssExports {
4
4
  'demoText': string;
5
5
  'resizableDemo': string;
6
+ 'resizableListDemo': string;
7
+ 'sectionLabel': string;
6
8
  }
7
9
  export const cssExports: CssExports;
8
10
  export default cssExports;
@@ -10,6 +10,13 @@ import S from './SmartTextTruncatePage.styl';
10
10
  const LONG =
11
11
  'Very-long-identifier-that-might-not-fit-in-a-narrow-container-without-smart-truncation';
12
12
 
13
+ const LIST_ITEMS = Array.from({ length: 50 }, (_, index) => {
14
+ const suffix = ['Constraints', 'Ontraction', 'Market Risk', 'City Protests'][
15
+ index % 4
16
+ ];
17
+ return `Impact — Impact Report: Professional Beauty Segment Analysis ${index + 1} ${suffix} Index`;
18
+ });
19
+
13
20
  export default function SmartTextTruncatePage() {
14
21
  return (
15
22
  <>
@@ -21,9 +28,22 @@ export default function SmartTextTruncatePage() {
21
28
  />
22
29
  <DocsGuidance source={smartTextTruncateGuidance} />
23
30
  <PageContentSection>
24
- <div className={S.resizableDemo}>
31
+ <p className={S.sectionLabel}>Single item</p>
32
+ <div className={S.resizableDemo} data-smart-text-truncate-resize-root>
25
33
  <SmartTextTruncate className={S.demoText}>{LONG}</SmartTextTruncate>
26
34
  </div>
35
+
36
+ <p className={S.sectionLabel}>List stress test (50 items)</p>
37
+ <div
38
+ className={S.resizableListDemo}
39
+ data-smart-text-truncate-resize-root
40
+ >
41
+ {LIST_ITEMS.map(label => (
42
+ <SmartTextTruncate key={label} className={S.demoText}>
43
+ {label}
44
+ </SmartTextTruncate>
45
+ ))}
46
+ </div>
27
47
  </PageContentSection>
28
48
  </>
29
49
  );