@ni/ok-components 1.7.0 → 1.8.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.
@@ -67,6 +67,124 @@
67
67
  }
68
68
  ]
69
69
  },
70
+ {
71
+ "kind": "javascript-module",
72
+ "path": "src/fv/accordion-item/index.ts",
73
+ "declarations": [
74
+ {
75
+ "kind": "class",
76
+ "description": "An accordion item component that can be expanded or collapsed to\nshow or hide its content.",
77
+ "name": "FvAccordionItem",
78
+ "members": [
79
+ {
80
+ "kind": "field",
81
+ "name": "header",
82
+ "type": {
83
+ "text": "string"
84
+ },
85
+ "privacy": "public",
86
+ "default": "''"
87
+ },
88
+ {
89
+ "kind": "field",
90
+ "name": "expanded",
91
+ "type": {
92
+ "text": "boolean"
93
+ },
94
+ "privacy": "public",
95
+ "default": "false"
96
+ },
97
+ {
98
+ "kind": "field",
99
+ "name": "appearance",
100
+ "type": {
101
+ "text": "FvAccordionItemAppearance"
102
+ },
103
+ "privacy": "public"
104
+ }
105
+ ],
106
+ "attributes": [
107
+ {
108
+ "name": "header",
109
+ "type": {
110
+ "text": "string"
111
+ },
112
+ "default": "''",
113
+ "fieldName": "header"
114
+ },
115
+ {
116
+ "name": "expanded",
117
+ "type": {
118
+ "text": "boolean"
119
+ },
120
+ "default": "false",
121
+ "fieldName": "expanded"
122
+ },
123
+ {
124
+ "name": "appearance",
125
+ "type": {
126
+ "text": "FvAccordionItemAppearance"
127
+ },
128
+ "fieldName": "appearance"
129
+ }
130
+ ],
131
+ "superclass": {
132
+ "name": "FoundationElement",
133
+ "package": "@ni/fast-foundation"
134
+ }
135
+ },
136
+ {
137
+ "kind": "variable",
138
+ "name": "fvAccordionItemTag",
139
+ "type": {
140
+ "text": "string"
141
+ },
142
+ "default": "'ok-fv-accordion-item'"
143
+ }
144
+ ],
145
+ "exports": [
146
+ {
147
+ "kind": "js",
148
+ "name": "FvAccordionItem",
149
+ "declaration": {
150
+ "name": "FvAccordionItem",
151
+ "module": "src/fv/accordion-item/index.ts"
152
+ }
153
+ },
154
+ {
155
+ "kind": "js",
156
+ "name": "fvAccordionItemTag",
157
+ "declaration": {
158
+ "name": "fvAccordionItemTag",
159
+ "module": "src/fv/accordion-item/index.ts"
160
+ }
161
+ }
162
+ ]
163
+ },
164
+ {
165
+ "kind": "javascript-module",
166
+ "path": "src/fv/accordion-item/types.ts",
167
+ "declarations": [
168
+ {
169
+ "kind": "variable",
170
+ "name": "FvAccordionItemAppearance",
171
+ "type": {
172
+ "text": "{\n outline: 'outline',\n ghost: 'ghost',\n block: 'block'\n}"
173
+ },
174
+ "default": "{ outline: 'outline', ghost: 'ghost', block: 'block' }"
175
+ }
176
+ ],
177
+ "exports": [
178
+ {
179
+ "kind": "js",
180
+ "name": "FvAccordionItemAppearance",
181
+ "declaration": {
182
+ "name": "FvAccordionItemAppearance",
183
+ "module": "src/fv/accordion-item/types.ts"
184
+ }
185
+ }
186
+ ]
187
+ },
70
188
  {
71
189
  "kind": "javascript-module",
72
190
  "path": "src/fv/card/index.ts",
@@ -690,124 +808,6 @@
690
808
  "declarations": [],
691
809
  "exports": []
692
810
  },
693
- {
694
- "kind": "javascript-module",
695
- "path": "src/fv/accordion-item/index.ts",
696
- "declarations": [
697
- {
698
- "kind": "class",
699
- "description": "An accordion item component that can be expanded or collapsed to\nshow or hide its content.",
700
- "name": "FvAccordionItem",
701
- "members": [
702
- {
703
- "kind": "field",
704
- "name": "header",
705
- "type": {
706
- "text": "string"
707
- },
708
- "privacy": "public",
709
- "default": "''"
710
- },
711
- {
712
- "kind": "field",
713
- "name": "expanded",
714
- "type": {
715
- "text": "boolean"
716
- },
717
- "privacy": "public",
718
- "default": "false"
719
- },
720
- {
721
- "kind": "field",
722
- "name": "appearance",
723
- "type": {
724
- "text": "FvAccordionItemAppearance"
725
- },
726
- "privacy": "public"
727
- }
728
- ],
729
- "attributes": [
730
- {
731
- "name": "header",
732
- "type": {
733
- "text": "string"
734
- },
735
- "default": "''",
736
- "fieldName": "header"
737
- },
738
- {
739
- "name": "expanded",
740
- "type": {
741
- "text": "boolean"
742
- },
743
- "default": "false",
744
- "fieldName": "expanded"
745
- },
746
- {
747
- "name": "appearance",
748
- "type": {
749
- "text": "FvAccordionItemAppearance"
750
- },
751
- "fieldName": "appearance"
752
- }
753
- ],
754
- "superclass": {
755
- "name": "FoundationElement",
756
- "package": "@ni/fast-foundation"
757
- }
758
- },
759
- {
760
- "kind": "variable",
761
- "name": "fvAccordionItemTag",
762
- "type": {
763
- "text": "string"
764
- },
765
- "default": "'ok-fv-accordion-item'"
766
- }
767
- ],
768
- "exports": [
769
- {
770
- "kind": "js",
771
- "name": "FvAccordionItem",
772
- "declaration": {
773
- "name": "FvAccordionItem",
774
- "module": "src/fv/accordion-item/index.ts"
775
- }
776
- },
777
- {
778
- "kind": "js",
779
- "name": "fvAccordionItemTag",
780
- "declaration": {
781
- "name": "fvAccordionItemTag",
782
- "module": "src/fv/accordion-item/index.ts"
783
- }
784
- }
785
- ]
786
- },
787
- {
788
- "kind": "javascript-module",
789
- "path": "src/fv/accordion-item/types.ts",
790
- "declarations": [
791
- {
792
- "kind": "variable",
793
- "name": "FvAccordionItemAppearance",
794
- "type": {
795
- "text": "{\n outline: 'outline',\n ghost: 'ghost',\n block: 'block'\n}"
796
- },
797
- "default": "{ outline: 'outline', ghost: 'ghost', block: 'block' }"
798
- }
799
- ],
800
- "exports": [
801
- {
802
- "kind": "js",
803
- "name": "FvAccordionItemAppearance",
804
- "declaration": {
805
- "name": "FvAccordionItemAppearance",
806
- "module": "src/fv/accordion-item/types.ts"
807
- }
808
- }
809
- ]
810
- },
811
811
  {
812
812
  "kind": "javascript-module",
813
813
  "path": "src/fv/master-detail-list/index.ts",
@@ -1750,6 +1750,14 @@
1750
1750
  "privacy": "public",
1751
1751
  "default": "false"
1752
1752
  },
1753
+ {
1754
+ "kind": "field",
1755
+ "name": "size",
1756
+ "type": {
1757
+ "text": "FvSummaryPanelSizeType"
1758
+ },
1759
+ "privacy": "public"
1760
+ },
1753
1761
  {
1754
1762
  "kind": "field",
1755
1763
  "name": "editItemsButtonLabel",
@@ -1759,9 +1767,39 @@
1759
1767
  "privacy": "public",
1760
1768
  "default": "'Configure'"
1761
1769
  },
1770
+ {
1771
+ "kind": "field",
1772
+ "name": "summaryItemsResizeObserver",
1773
+ "type": {
1774
+ "text": "ResizeObserver"
1775
+ },
1776
+ "privacy": "private",
1777
+ "readonly": true,
1778
+ "default": "new ResizeObserver(() => this.updateOverflow())"
1779
+ },
1762
1780
  {
1763
1781
  "kind": "method",
1764
- "name": "syncTileLegacyStyle",
1782
+ "name": "observeSummaryItems",
1783
+ "privacy": "private",
1784
+ "return": {
1785
+ "type": {
1786
+ "text": "void"
1787
+ }
1788
+ }
1789
+ },
1790
+ {
1791
+ "kind": "method",
1792
+ "name": "updateOverflow",
1793
+ "privacy": "private",
1794
+ "return": {
1795
+ "type": {
1796
+ "text": "void"
1797
+ }
1798
+ }
1799
+ },
1800
+ {
1801
+ "kind": "method",
1802
+ "name": "syncTileAttributes",
1765
1803
  "privacy": "private",
1766
1804
  "return": {
1767
1805
  "type": {
@@ -1795,6 +1833,13 @@
1795
1833
  "default": "false",
1796
1834
  "fieldName": "legacyStyle"
1797
1835
  },
1836
+ {
1837
+ "name": "size",
1838
+ "type": {
1839
+ "text": "FvSummaryPanelSizeType"
1840
+ },
1841
+ "fieldName": "size"
1842
+ },
1798
1843
  {
1799
1844
  "name": "edit-items-button-label",
1800
1845
  "type": {
@@ -1819,6 +1864,14 @@
1819
1864
  }
1820
1865
  ],
1821
1866
  "exports": [
1867
+ {
1868
+ "kind": "js",
1869
+ "name": "FvSummaryPanelSize",
1870
+ "declaration": {
1871
+ "name": "FvSummaryPanelSize",
1872
+ "module": "./types"
1873
+ }
1874
+ },
1822
1875
  {
1823
1876
  "kind": "js",
1824
1877
  "name": "FvSummaryPanel",
@@ -1837,6 +1890,30 @@
1837
1890
  }
1838
1891
  ]
1839
1892
  },
1893
+ {
1894
+ "kind": "javascript-module",
1895
+ "path": "src/fv/summary-panel/types.ts",
1896
+ "declarations": [
1897
+ {
1898
+ "kind": "variable",
1899
+ "name": "FvSummaryPanelSize",
1900
+ "type": {
1901
+ "text": "{\n default: 'default',\n compact: 'compact'\n}"
1902
+ },
1903
+ "default": "{ default: 'default', compact: 'compact' }"
1904
+ }
1905
+ ],
1906
+ "exports": [
1907
+ {
1908
+ "kind": "js",
1909
+ "name": "FvSummaryPanelSize",
1910
+ "declaration": {
1911
+ "name": "FvSummaryPanelSize",
1912
+ "module": "src/fv/summary-panel/types.ts"
1913
+ }
1914
+ }
1915
+ ]
1916
+ },
1840
1917
  {
1841
1918
  "kind": "javascript-module",
1842
1919
  "path": "src/fv/summary-panel-tile/index.ts",
@@ -1873,6 +1950,14 @@
1873
1950
  "privacy": "public",
1874
1951
  "default": "false"
1875
1952
  },
1953
+ {
1954
+ "kind": "field",
1955
+ "name": "size",
1956
+ "type": {
1957
+ "text": "FvSummaryPanelSizeType"
1958
+ },
1959
+ "privacy": "public"
1960
+ },
1876
1961
  {
1877
1962
  "kind": "field",
1878
1963
  "name": "selected",
@@ -1926,6 +2011,13 @@
1926
2011
  "default": "false",
1927
2012
  "fieldName": "legacyStyle"
1928
2013
  },
2014
+ {
2015
+ "name": "size",
2016
+ "type": {
2017
+ "text": "FvSummaryPanelSizeType"
2018
+ },
2019
+ "fieldName": "size"
2020
+ },
1929
2021
  {
1930
2022
  "name": "selected",
1931
2023
  "type": {
@@ -8,6 +8,32 @@
8
8
 
9
9
  <hr/>
10
10
 
11
+ ## class: `FvAccordionItem`
12
+
13
+ ### Superclass
14
+
15
+ | Name | Module | Package |
16
+ | ------------------- | ------ | ------------------- |
17
+ | `FoundationElement` | | @ni/fast-foundation |
18
+
19
+ ### Fields
20
+
21
+ | Name | Privacy | Type | Default | Description | Inherited From |
22
+ | ------------ | ------- | --------------------------- | ------- | ----------- | -------------- |
23
+ | `header` | public | `string` | `''` | | |
24
+ | `expanded` | public | `boolean` | `false` | | |
25
+ | `appearance` | public | `FvAccordionItemAppearance` | | | |
26
+
27
+ ### Attributes
28
+
29
+ | Name | Field | Inherited From |
30
+ | ------------ | ---------- | -------------- |
31
+ | `header` | header | |
32
+ | `expanded` | expanded | |
33
+ | `appearance` | appearance | |
34
+
35
+ <hr/>
36
+
11
37
  ## class: `FvCard`
12
38
 
13
39
  ### Superclass
@@ -110,32 +136,6 @@
110
136
 
111
137
  <hr/>
112
138
 
113
- ## class: `FvAccordionItem`
114
-
115
- ### Superclass
116
-
117
- | Name | Module | Package |
118
- | ------------------- | ------ | ------------------- |
119
- | `FoundationElement` | | @ni/fast-foundation |
120
-
121
- ### Fields
122
-
123
- | Name | Privacy | Type | Default | Description | Inherited From |
124
- | ------------ | ------- | --------------------------- | ------- | ----------- | -------------- |
125
- | `header` | public | `string` | `''` | | |
126
- | `expanded` | public | `boolean` | `false` | | |
127
- | `appearance` | public | `FvAccordionItemAppearance` | | | |
128
-
129
- ### Attributes
130
-
131
- | Name | Field | Inherited From |
132
- | ------------ | ---------- | -------------- |
133
- | `header` | header | |
134
- | `expanded` | expanded | |
135
- | `appearance` | appearance | |
136
-
137
- <hr/>
138
-
139
139
  ## class: `FvMasterDetailList`
140
140
 
141
141
  ### Superclass
@@ -318,11 +318,12 @@
318
318
 
319
319
  ### Fields
320
320
 
321
- | Name | Privacy | Type | Default | Description | Inherited From |
322
- | ---------------------- | ------- | --------- | ------------- | ----------- | -------------- |
323
- | `showEditItemsButton` | public | `boolean` | `false` | | |
324
- | `legacyStyle` | public | `boolean` | `false` | | |
325
- | `editItemsButtonLabel` | public | `string` | `'Configure'` | | |
321
+ | Name | Privacy | Type | Default | Description | Inherited From |
322
+ | ---------------------- | ------- | ------------------------ | ------------- | ----------- | -------------- |
323
+ | `showEditItemsButton` | public | `boolean` | `false` | | |
324
+ | `legacyStyle` | public | `boolean` | `false` | | |
325
+ | `size` | public | `FvSummaryPanelSizeType` | | | |
326
+ | `editItemsButtonLabel` | public | `string` | `'Configure'` | | |
326
327
 
327
328
  ### Events
328
329
 
@@ -336,6 +337,7 @@
336
337
  | ------------------------- | -------------------- | -------------- |
337
338
  | `show-edit-items-button` | showEditItemsButton | |
338
339
  | `legacy-style` | legacyStyle | |
340
+ | `size` | size | |
339
341
  | `edit-items-button-label` | editItemsButtonLabel | |
340
342
 
341
343
  <hr/>
@@ -355,6 +357,7 @@
355
357
  | `count` | public | `string` | `''` | | |
356
358
  | `label` | public | `string` | `''` | | |
357
359
  | `legacyStyle` | public | `boolean` | `false` | | |
360
+ | `size` | public | `FvSummaryPanelSizeType` | | | |
358
361
  | `selected` | public | `boolean` | `false` | | |
359
362
  | `textPosition` | public | `FvSummaryPanelTileTextPositionType` | | | |
360
363
 
@@ -365,6 +368,7 @@
365
368
  | `count` | count | |
366
369
  | `label` | label | |
367
370
  | `legacy-style` | legacyStyle | |
371
+ | `size` | size | |
368
372
  | `selected` | selected | |
369
373
  | `text-position` | textPosition | |
370
374
 
@@ -1,6 +1,8 @@
1
1
  import { FoundationElement } from '@ni/fast-foundation';
2
2
  import '@ni/nimble-components/dist/esm/button';
3
3
  import '@ni/nimble-components/dist/esm/icons/cog';
4
+ import { type FvSummaryPanelSize as FvSummaryPanelSizeType } from './types';
5
+ export { FvSummaryPanelSize } from './types';
4
6
  declare global {
5
7
  interface HTMLElementTagNameMap {
6
8
  'ok-fv-summary-panel': FvSummaryPanel;
@@ -12,15 +14,30 @@ declare global {
12
14
  export declare class FvSummaryPanel extends FoundationElement {
13
15
  showEditItemsButton: boolean;
14
16
  legacyStyle: boolean;
17
+ size: FvSummaryPanelSizeType;
18
+ /** @internal */
19
+ hasOverflow: boolean;
20
+ /** @internal */
21
+ readonly summaryItems: HTMLElement;
15
22
  editItemsButtonLabel: string;
23
+ private readonly summaryItemsResizeObserver;
24
+ constructor();
16
25
  /** @internal */
17
26
  connectedCallback(): void;
18
27
  /** @internal */
28
+ disconnectedCallback(): void;
29
+ /** @internal */
19
30
  legacyStyleChanged(): void;
20
31
  /** @internal */
32
+ sizeChanged(): void;
33
+ /** @internal */
21
34
  handleEditItemsClick(): void;
22
35
  /** @internal */
23
36
  handleItemsSlotChange(): void;
24
- private syncTileLegacyStyle;
37
+ /** @internal */
38
+ handleItemsScroll(): void;
39
+ private observeSummaryItems;
40
+ private updateOverflow;
41
+ private syncTileAttributes;
25
42
  }
26
43
  export declare const fvSummaryPanelTag = "ok-fv-summary-panel";
@@ -1,29 +1,49 @@
1
1
  import { __decorate } from "tslib";
2
- import { attr } from '@ni/fast-element';
2
+ import { attr, observable } from '@ni/fast-element';
3
3
  import { DesignSystem, FoundationElement } from '@ni/fast-foundation';
4
4
  import '@ni/nimble-components/dist/esm/button';
5
5
  import '@ni/nimble-components/dist/esm/icons/cog';
6
6
  import { styles } from './styles';
7
7
  import { template } from './template';
8
+ import { FvSummaryPanelSize } from './types';
9
+ export { FvSummaryPanelSize } from './types';
8
10
  /**
9
11
  * A layout container for summary tiles with an optional edit-items affordance.
10
12
  */
11
13
  export class FvSummaryPanel extends FoundationElement {
12
14
  constructor() {
13
- super(...arguments);
15
+ super();
14
16
  this.showEditItemsButton = false;
15
17
  this.legacyStyle = false;
18
+ this.size = FvSummaryPanelSize.default;
19
+ /** @internal */
20
+ this.hasOverflow = false;
16
21
  this.editItemsButtonLabel = 'Configure';
22
+ this.summaryItemsResizeObserver = new ResizeObserver(() => this.updateOverflow());
17
23
  }
18
24
  /** @internal */
19
25
  connectedCallback() {
20
26
  super.connectedCallback();
21
- this.syncTileLegacyStyle();
27
+ this.syncTileAttributes();
28
+ this.observeSummaryItems();
29
+ }
30
+ /** @internal */
31
+ disconnectedCallback() {
32
+ super.disconnectedCallback();
33
+ this.summaryItemsResizeObserver.disconnect();
22
34
  }
23
35
  /** @internal */
24
36
  legacyStyleChanged() {
25
37
  if (this.$fastController.isConnected) {
26
- this.syncTileLegacyStyle();
38
+ this.syncTileAttributes();
39
+ this.updateOverflow();
40
+ }
41
+ }
42
+ /** @internal */
43
+ sizeChanged() {
44
+ if (this.$fastController.isConnected) {
45
+ this.syncTileAttributes();
46
+ this.updateOverflow();
27
47
  }
28
48
  }
29
49
  /** @internal */
@@ -35,9 +55,31 @@ export class FvSummaryPanel extends FoundationElement {
35
55
  }
36
56
  /** @internal */
37
57
  handleItemsSlotChange() {
38
- this.syncTileLegacyStyle();
58
+ this.syncTileAttributes();
59
+ this.observeSummaryItems();
60
+ }
61
+ /** @internal */
62
+ handleItemsScroll() {
63
+ this.updateOverflow();
39
64
  }
40
- syncTileLegacyStyle() {
65
+ observeSummaryItems() {
66
+ this.summaryItemsResizeObserver.disconnect();
67
+ this.summaryItemsResizeObserver.observe(this.summaryItems);
68
+ for (const element of this.shadowRoot?.querySelector('slot')?.assignedElements({ flatten: true }) ?? []) {
69
+ this.summaryItemsResizeObserver.observe(element);
70
+ }
71
+ this.updateOverflow();
72
+ }
73
+ updateOverflow() {
74
+ const maxScrollDistance = this.summaryItems.scrollWidth - this.summaryItems.clientWidth;
75
+ const scrollPosition = getComputedStyle(this.summaryItems).direction === 'rtl'
76
+ ? Math.abs(this.summaryItems.scrollLeft)
77
+ : this.summaryItems.scrollLeft;
78
+ this.hasOverflow = this.size === FvSummaryPanelSize.compact
79
+ && maxScrollDistance - scrollPosition > 0;
80
+ this.summaryItems.classList.toggle('has-overflow', this.hasOverflow);
81
+ }
82
+ syncTileAttributes() {
41
83
  for (const element of this.shadowRoot?.querySelector('slot')?.assignedElements({ flatten: true }) ?? []) {
42
84
  if (element.localName !== 'ok-fv-summary-panel-tile') {
43
85
  continue;
@@ -48,6 +90,12 @@ export class FvSummaryPanel extends FoundationElement {
48
90
  else {
49
91
  element.removeAttribute('legacy-style');
50
92
  }
93
+ if (this.size === FvSummaryPanelSize.compact) {
94
+ element.setAttribute('size', FvSummaryPanelSize.compact);
95
+ }
96
+ else {
97
+ element.removeAttribute('size');
98
+ }
51
99
  }
52
100
  }
53
101
  }
@@ -57,6 +105,12 @@ __decorate([
57
105
  __decorate([
58
106
  attr({ attribute: 'legacy-style', mode: 'boolean' })
59
107
  ], FvSummaryPanel.prototype, "legacyStyle", void 0);
108
+ __decorate([
109
+ attr
110
+ ], FvSummaryPanel.prototype, "size", void 0);
111
+ __decorate([
112
+ observable
113
+ ], FvSummaryPanel.prototype, "hasOverflow", void 0);
60
114
  __decorate([
61
115
  attr({ attribute: 'edit-items-button-label' })
62
116
  ], FvSummaryPanel.prototype, "editItemsButtonLabel", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/fv/summary-panel/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,uCAAuC,CAAC;AAC/C,OAAO,0CAA0C,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQtC;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,iBAAiB;IAArD;;QAEW,wBAAmB,GAAG,KAAK,CAAC;QAG5B,gBAAW,GAAG,KAAK,CAAC;QAGpB,yBAAoB,GAAG,WAAW,CAAC;IAyC9C,CAAC;IAvCG,gBAAgB;IACA,iBAAiB;QAC7B,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC/B,CAAC;IAED,gBAAgB;IACT,kBAAkB;QACrB,IAAI,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC;YACnC,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC/B,CAAC;IACL,CAAC;IAED,gBAAgB;IACT,oBAAoB;QACvB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,YAAY,EAAE;YAC7C,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACjB,CAAC,CAAC,CAAC;IACR,CAAC;IAED,gBAAgB;IACT,qBAAqB;QACxB,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC/B,CAAC;IAEO,mBAAmB;QACvB,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;YACtG,IAAI,OAAO,CAAC,SAAS,KAAK,0BAA0B,EAAE,CAAC;gBACnD,SAAS;YACb,CAAC;YAED,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;gBACnB,OAAO,CAAC,YAAY,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;YAC7C,CAAC;iBAAM,CAAC;gBACJ,OAAO,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;YAC5C,CAAC;QACL,CAAC;IACL,CAAC;CACJ;AA/CU;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,wBAAwB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;2DAC5B;AAG5B;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;mDAC1B;AAGpB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,yBAAyB,EAAE,CAAC;4DACL;AA2C9C,MAAM,gBAAgB,GAAG,cAAc,CAAC,OAAO,CAAC;IAC5C,QAAQ,EAAE,kBAAkB;IAC5B,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC","sourcesContent":["import { attr } from '@ni/fast-element';\nimport { DesignSystem, FoundationElement } from '@ni/fast-foundation';\nimport '@ni/nimble-components/dist/esm/button';\nimport '@ni/nimble-components/dist/esm/icons/cog';\nimport { styles } from './styles';\nimport { template } from './template';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ok-fv-summary-panel': FvSummaryPanel;\n }\n}\n\n/**\n * A layout container for summary tiles with an optional edit-items affordance.\n */\nexport class FvSummaryPanel extends FoundationElement {\n @attr({ attribute: 'show-edit-items-button', mode: 'boolean' })\n public showEditItemsButton = false;\n\n @attr({ attribute: 'legacy-style', mode: 'boolean' })\n public legacyStyle = false;\n\n @attr({ attribute: 'edit-items-button-label' })\n public editItemsButtonLabel = 'Configure';\n\n /** @internal */\n public override connectedCallback(): void {\n super.connectedCallback();\n this.syncTileLegacyStyle();\n }\n\n /** @internal */\n public legacyStyleChanged(): void {\n if (this.$fastController.isConnected) {\n this.syncTileLegacyStyle();\n }\n }\n\n /** @internal */\n public handleEditItemsClick(): void {\n this.dispatchEvent(new CustomEvent('edit-items', {\n bubbles: true,\n composed: true\n }));\n }\n\n /** @internal */\n public handleItemsSlotChange(): void {\n this.syncTileLegacyStyle();\n }\n\n private syncTileLegacyStyle(): void {\n for (const element of this.shadowRoot?.querySelector('slot')?.assignedElements({ flatten: true }) ?? []) {\n if (element.localName !== 'ok-fv-summary-panel-tile') {\n continue;\n }\n\n if (this.legacyStyle) {\n element.setAttribute('legacy-style', '');\n } else {\n element.removeAttribute('legacy-style');\n }\n }\n }\n}\n\nconst okFvSummaryPanel = FvSummaryPanel.compose({\n baseName: 'fv-summary-panel',\n template,\n styles\n});\n\nDesignSystem.getOrCreate().withPrefix('ok').register(okFvSummaryPanel());\nexport const fvSummaryPanelTag = 'ok-fv-summary-panel';"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/fv/summary-panel/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,uCAAuC,CAAC;AAC/C,OAAO,0CAA0C,CAAC;AAClD,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MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC","sourcesContent":["import { attr, observable } from '@ni/fast-element';\nimport { DesignSystem, FoundationElement } from '@ni/fast-foundation';\nimport '@ni/nimble-components/dist/esm/button';\nimport '@ni/nimble-components/dist/esm/icons/cog';\nimport { styles } from './styles';\nimport { template } from './template';\nimport { FvSummaryPanelSize, type FvSummaryPanelSize as FvSummaryPanelSizeType } from './types';\n\nexport { FvSummaryPanelSize } from './types';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ok-fv-summary-panel': FvSummaryPanel;\n }\n}\n\n/**\n * A layout container for summary tiles with an optional edit-items affordance.\n */\nexport class FvSummaryPanel extends FoundationElement {\n @attr({ attribute: 'show-edit-items-button', mode: 'boolean' })\n public showEditItemsButton = false;\n\n @attr({ attribute: 'legacy-style', mode: 'boolean' })\n public legacyStyle = false;\n\n @attr\n public size: FvSummaryPanelSizeType = FvSummaryPanelSize.default;\n\n /** @internal */\n @observable\n public hasOverflow = false;\n\n /** @internal */\n public readonly summaryItems!: HTMLElement;\n\n @attr({ attribute: 'edit-items-button-label' })\n public editItemsButtonLabel = 'Configure';\n\n private readonly summaryItemsResizeObserver: ResizeObserver;\n\n public constructor() {\n super();\n this.summaryItemsResizeObserver = new ResizeObserver(() => this.updateOverflow());\n }\n\n /** @internal */\n public override connectedCallback(): void {\n super.connectedCallback();\n this.syncTileAttributes();\n this.observeSummaryItems();\n }\n\n /** @internal */\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.summaryItemsResizeObserver.disconnect();\n }\n\n /** @internal */\n public legacyStyleChanged(): void {\n if (this.$fastController.isConnected) {\n this.syncTileAttributes();\n this.updateOverflow();\n }\n }\n\n /** @internal */\n public sizeChanged(): void {\n if (this.$fastController.isConnected) {\n this.syncTileAttributes();\n this.updateOverflow();\n }\n }\n\n /** @internal */\n public handleEditItemsClick(): void {\n this.dispatchEvent(new CustomEvent('edit-items', {\n bubbles: true,\n composed: true\n }));\n }\n\n /** @internal */\n public handleItemsSlotChange(): void {\n this.syncTileAttributes();\n this.observeSummaryItems();\n }\n\n /** @internal */\n public handleItemsScroll(): void {\n this.updateOverflow();\n }\n\n private observeSummaryItems(): void {\n this.summaryItemsResizeObserver.disconnect();\n this.summaryItemsResizeObserver.observe(this.summaryItems);\n for (const element of this.shadowRoot?.querySelector('slot')?.assignedElements({ flatten: true }) ?? []) {\n this.summaryItemsResizeObserver.observe(element);\n }\n this.updateOverflow();\n }\n\n private updateOverflow(): void {\n const maxScrollDistance = this.summaryItems.scrollWidth - this.summaryItems.clientWidth;\n const scrollPosition = getComputedStyle(this.summaryItems).direction === 'rtl'\n ? Math.abs(this.summaryItems.scrollLeft)\n : this.summaryItems.scrollLeft;\n this.hasOverflow = this.size === FvSummaryPanelSize.compact\n && maxScrollDistance - scrollPosition > 0;\n this.summaryItems.classList.toggle('has-overflow', this.hasOverflow);\n }\n\n private syncTileAttributes(): void {\n for (const element of this.shadowRoot?.querySelector('slot')?.assignedElements({ flatten: true }) ?? []) {\n if (element.localName !== 'ok-fv-summary-panel-tile') {\n continue;\n }\n\n if (this.legacyStyle) {\n element.setAttribute('legacy-style', '');\n } else {\n element.removeAttribute('legacy-style');\n }\n\n if (this.size === FvSummaryPanelSize.compact) {\n element.setAttribute('size', FvSummaryPanelSize.compact);\n } else {\n element.removeAttribute('size');\n }\n }\n }\n}\n\nconst okFvSummaryPanel = FvSummaryPanel.compose({\n baseName: 'fv-summary-panel',\n template,\n styles\n});\n\nDesignSystem.getOrCreate().withPrefix('ok').register(okFvSummaryPanel());\nexport const fvSummaryPanelTag = 'ok-fv-summary-panel';"]}