@ni/ok-components 1.10.3 → 1.11.1

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 (48) hide show
  1. package/dist/all-components-bundle.js +1125 -448
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +5885 -5585
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/custom-elements.json +1009 -0
  6. package/dist/custom-elements.md +140 -0
  7. package/dist/esm/fv/all-fv.d.ts +3 -0
  8. package/dist/esm/fv/all-fv.js +3 -0
  9. package/dist/esm/fv/all-fv.js.map +1 -1
  10. package/dist/esm/fv/bulk-edit-field/index.d.ts +40 -0
  11. package/dist/esm/fv/bulk-edit-field/index.js +120 -0
  12. package/dist/esm/fv/bulk-edit-field/index.js.map +1 -0
  13. package/dist/esm/fv/bulk-edit-field/styles.d.ts +1 -0
  14. package/dist/esm/fv/bulk-edit-field/styles.js +83 -0
  15. package/dist/esm/fv/bulk-edit-field/styles.js.map +1 -0
  16. package/dist/esm/fv/bulk-edit-field/template.d.ts +2 -0
  17. package/dist/esm/fv/bulk-edit-field/template.js +36 -0
  18. package/dist/esm/fv/bulk-edit-field/template.js.map +1 -0
  19. package/dist/esm/fv/bulk-edit-field/types.d.ts +7 -0
  20. package/dist/esm/fv/bulk-edit-field/types.js +7 -0
  21. package/dist/esm/fv/bulk-edit-field/types.js.map +1 -0
  22. package/dist/esm/fv/bulk-edit-state/index.d.ts +47 -0
  23. package/dist/esm/fv/bulk-edit-state/index.js +114 -0
  24. package/dist/esm/fv/bulk-edit-state/index.js.map +1 -0
  25. package/dist/esm/fv/edit-commit-bar/index.d.ts +32 -0
  26. package/dist/esm/fv/edit-commit-bar/index.js +92 -0
  27. package/dist/esm/fv/edit-commit-bar/index.js.map +1 -0
  28. package/dist/esm/fv/edit-commit-bar/styles.d.ts +1 -0
  29. package/dist/esm/fv/edit-commit-bar/styles.js +65 -0
  30. package/dist/esm/fv/edit-commit-bar/styles.js.map +1 -0
  31. package/dist/esm/fv/edit-commit-bar/template.d.ts +2 -0
  32. package/dist/esm/fv/edit-commit-bar/template.js +45 -0
  33. package/dist/esm/fv/edit-commit-bar/template.js.map +1 -0
  34. package/dist/esm/fv/edit-commit-bar/types.d.ts +4 -0
  35. package/dist/esm/fv/edit-commit-bar/types.js +2 -0
  36. package/dist/esm/fv/edit-commit-bar/types.js.map +1 -0
  37. package/dist/esm/fv/search-input/styles.js +4 -1
  38. package/dist/esm/fv/search-input/styles.js.map +1 -1
  39. package/dist/esm/fv/split-layout/index.d.ts +48 -0
  40. package/dist/esm/fv/split-layout/index.js +195 -0
  41. package/dist/esm/fv/split-layout/index.js.map +1 -0
  42. package/dist/esm/fv/split-layout/styles.d.ts +1 -0
  43. package/dist/esm/fv/split-layout/styles.js +42 -0
  44. package/dist/esm/fv/split-layout/styles.js.map +1 -0
  45. package/dist/esm/fv/split-layout/template.d.ts +2 -0
  46. package/dist/esm/fv/split-layout/template.js +24 -0
  47. package/dist/esm/fv/split-layout/template.js.map +1 -0
  48. package/package.json +1 -1
@@ -0,0 +1,195 @@
1
+ import { __decorate } from "tslib";
2
+ import { attr, nullableNumberConverter, observable, volatile } from '@ni/fast-element';
3
+ import { DesignSystem, FoundationElement } from '@ni/fast-foundation';
4
+ import { styles } from './styles';
5
+ import { template } from './template';
6
+ let nextLayoutId = 0;
7
+ function takeLayoutId() {
8
+ const id = nextLayoutId;
9
+ nextLayoutId += 1;
10
+ return id;
11
+ }
12
+ /**
13
+ * A full-height, resizable two-pane layout.
14
+ */
15
+ export class FvSplitLayout extends FoundationElement {
16
+ constructor() {
17
+ super();
18
+ this.position = 60;
19
+ this.min = 35;
20
+ this.max = 75;
21
+ this.minSecondaryPixels = 300;
22
+ this.collapsed = false;
23
+ this.step = 1;
24
+ this.primaryPaneId = '';
25
+ this.secondaryPaneId = '';
26
+ /** @internal */
27
+ this.availableWidth = 0;
28
+ this.resizeObserver = new ResizeObserver(entries => {
29
+ this.availableWidth = entries[0]?.contentRect.width ?? 0;
30
+ this.constrainPosition();
31
+ });
32
+ this.requestedPosition = this.position;
33
+ this.applyingConstrainedPosition = false;
34
+ this.requestedPositionResetScheduled = false;
35
+ this.positionChangeCallbackVersion = 0;
36
+ const layoutId = takeLayoutId();
37
+ this.primaryPaneId = `ok-fv-split-layout-primary-${layoutId}`;
38
+ this.secondaryPaneId = `ok-fv-split-layout-secondary-${layoutId}`;
39
+ const positionDescriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this), 'position');
40
+ if (!positionDescriptor?.get || !positionDescriptor.set) {
41
+ return;
42
+ }
43
+ const getPosition = positionDescriptor.get.bind(this);
44
+ const setPosition = positionDescriptor.set.bind(this);
45
+ Object.defineProperty(this, 'position', {
46
+ configurable: true,
47
+ enumerable: positionDescriptor.enumerable,
48
+ get: getPosition,
49
+ set: (value) => {
50
+ const previousPosition = getPosition();
51
+ const callbackVersion = this.positionChangeCallbackVersion;
52
+ setPosition(value);
53
+ if (!this.applyingConstrainedPosition
54
+ && callbackVersion === this.positionChangeCallbackVersion
55
+ && previousPosition === getPosition()) {
56
+ this.requestedPosition = getPosition();
57
+ }
58
+ }
59
+ });
60
+ }
61
+ connectedCallback() {
62
+ super.connectedCallback();
63
+ this.resizeObserver.observe(this);
64
+ }
65
+ disconnectedCallback() {
66
+ this.resizeObserver.disconnect();
67
+ super.disconnectedCallback();
68
+ }
69
+ positionChanged() {
70
+ this.positionChangeCallbackVersion += 1;
71
+ if (!this.applyingConstrainedPosition) {
72
+ this.requestedPosition = this.position;
73
+ this.resetRequestedPositionAfterSynchronousUpdates();
74
+ }
75
+ this.constrainPosition();
76
+ }
77
+ minChanged() {
78
+ this.constrainPosition();
79
+ }
80
+ maxChanged() {
81
+ this.constrainPosition();
82
+ }
83
+ minSecondaryPixelsChanged() {
84
+ this.constrainPosition();
85
+ }
86
+ collapsedChanged() {
87
+ this.constrainPosition();
88
+ }
89
+ /** @internal */
90
+ get effectiveMin() {
91
+ const configured = Number.isFinite(this.min) ? Math.min(100, Math.max(0, this.min)) : 35;
92
+ return Math.min(configured, this.effectiveMax);
93
+ }
94
+ /** @internal */
95
+ get effectiveMax() {
96
+ const minimum = Number.isFinite(this.min) ? Math.min(100, Math.max(0, this.min)) : 35;
97
+ const configured = Number.isFinite(this.max)
98
+ ? Math.min(100, Math.max(minimum, this.max))
99
+ : Math.max(minimum, 75);
100
+ const secondaryMinimum = this.effectiveMinSecondaryPixels;
101
+ if (this.availableWidth <= 2 || secondaryMinimum <= 0) {
102
+ return configured;
103
+ }
104
+ const pixelMaximum = 100 * (1 - secondaryMinimum / (this.availableWidth - 2));
105
+ return Math.max(0, Math.min(configured, pixelMaximum));
106
+ }
107
+ /** @internal */
108
+ get gridTemplateColumns() {
109
+ const secondaryMinimum = this.effectiveMinSecondaryPixels;
110
+ return this.collapsed
111
+ ? 'minmax(0, 1fr)'
112
+ : `minmax(0, ${this.position}fr) 2px minmax(${secondaryMinimum}px, ${100 - this.position}fr)`;
113
+ }
114
+ /** @internal */
115
+ handleSplitterInput(event) {
116
+ event.stopPropagation();
117
+ this.position = event.currentTarget.position;
118
+ this.$emit('input');
119
+ return true;
120
+ }
121
+ /** @internal */
122
+ handleSplitterChange(event) {
123
+ event.stopPropagation();
124
+ this.$emit('change');
125
+ return true;
126
+ }
127
+ constrainPosition() {
128
+ if (this.collapsed) {
129
+ return;
130
+ }
131
+ const finitePosition = Number.isFinite(this.requestedPosition) ? this.requestedPosition : 60;
132
+ const constrained = Math.min(this.effectiveMax, Math.max(this.effectiveMin, finitePosition));
133
+ if (constrained !== this.position) {
134
+ this.applyingConstrainedPosition = true;
135
+ this.position = constrained;
136
+ this.applyingConstrainedPosition = false;
137
+ }
138
+ }
139
+ resetRequestedPositionAfterSynchronousUpdates() {
140
+ if (this.requestedPositionResetScheduled) {
141
+ return;
142
+ }
143
+ this.requestedPositionResetScheduled = true;
144
+ queueMicrotask(() => {
145
+ this.requestedPositionResetScheduled = false;
146
+ this.requestedPosition = this.position;
147
+ });
148
+ }
149
+ get effectiveMinSecondaryPixels() {
150
+ return Number.isFinite(this.minSecondaryPixels)
151
+ ? Math.max(0, this.minSecondaryPixels)
152
+ : 300;
153
+ }
154
+ }
155
+ __decorate([
156
+ attr({ converter: nullableNumberConverter })
157
+ ], FvSplitLayout.prototype, "position", void 0);
158
+ __decorate([
159
+ attr({ converter: nullableNumberConverter })
160
+ ], FvSplitLayout.prototype, "min", void 0);
161
+ __decorate([
162
+ attr({ converter: nullableNumberConverter })
163
+ ], FvSplitLayout.prototype, "max", void 0);
164
+ __decorate([
165
+ attr({ attribute: 'min-secondary-pixels', converter: nullableNumberConverter })
166
+ ], FvSplitLayout.prototype, "minSecondaryPixels", void 0);
167
+ __decorate([
168
+ attr({ mode: 'boolean' })
169
+ ], FvSplitLayout.prototype, "collapsed", void 0);
170
+ __decorate([
171
+ attr({ converter: nullableNumberConverter })
172
+ ], FvSplitLayout.prototype, "step", void 0);
173
+ __decorate([
174
+ attr({ attribute: 'primary-pane-id' })
175
+ ], FvSplitLayout.prototype, "primaryPaneId", void 0);
176
+ __decorate([
177
+ attr({ attribute: 'secondary-pane-id' })
178
+ ], FvSplitLayout.prototype, "secondaryPaneId", void 0);
179
+ __decorate([
180
+ observable
181
+ ], FvSplitLayout.prototype, "availableWidth", void 0);
182
+ __decorate([
183
+ volatile
184
+ ], FvSplitLayout.prototype, "effectiveMax", null);
185
+ __decorate([
186
+ volatile
187
+ ], FvSplitLayout.prototype, "gridTemplateColumns", null);
188
+ const okFvSplitLayout = FvSplitLayout.compose({
189
+ baseName: 'fv-split-layout',
190
+ template,
191
+ styles
192
+ });
193
+ DesignSystem.getOrCreate().withPrefix('ok').register(okFvSplitLayout());
194
+ export const fvSplitLayoutTag = 'ok-fv-split-layout';
195
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/fv/split-layout/index.ts"],"names":[],"mappings":";AAAA,OA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CAC7B;AAGT;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;0CAC7B;AAGT;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,sBAAsB,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;yDAChD;AAGzB;IADN,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;gDACD;AAGlB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;2CAC7B;AAGT;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;oDACb;AAGnB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;sDACb;AAIrB;IADN,UAAU;qDACe;AAqF1B;IADC,QAAQ;iDAYR;AAID;IADC,QAAQ;wDAMR;AAgDL,MAAM,eAAe,GAAG,aAAa,CAAC,OAAO,CAAC;IAC1C,QAAQ,EAAE,iBAAiB;IAC3B,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC;AACxE,MAAM,CAAC,MAAM,gBAAgB,GAAG,oBAAoB,CAAC","sourcesContent":["import { attr, nullableNumberConverter, observable, volatile } from '@ni/fast-element';\nimport { DesignSystem, FoundationElement } from '@ni/fast-foundation';\nimport { styles } from './styles';\nimport { template } from './template';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ok-fv-split-layout': FvSplitLayout;\n }\n}\n\nlet nextLayoutId = 0;\n\nfunction takeLayoutId(): number {\n const id = nextLayoutId;\n nextLayoutId += 1;\n return id;\n}\n\n/**\n * A full-height, resizable two-pane layout.\n */\nexport class FvSplitLayout extends FoundationElement {\n @attr({ converter: nullableNumberConverter })\n public position = 60;\n\n @attr({ converter: nullableNumberConverter })\n public min = 35;\n\n @attr({ converter: nullableNumberConverter })\n public max = 75;\n\n @attr({ attribute: 'min-secondary-pixels', converter: nullableNumberConverter })\n public minSecondaryPixels = 300;\n\n @attr({ mode: 'boolean' })\n public collapsed = false;\n\n @attr({ converter: nullableNumberConverter })\n public step = 1;\n\n @attr({ attribute: 'primary-pane-id' })\n public primaryPaneId = '';\n\n @attr({ attribute: 'secondary-pane-id' })\n public secondaryPaneId = '';\n\n /** @internal */\n @observable\n public availableWidth = 0;\n\n private readonly resizeObserver = new ResizeObserver(entries => {\n this.availableWidth = entries[0]?.contentRect.width ?? 0;\n this.constrainPosition();\n });\n\n private requestedPosition = this.position;\n private applyingConstrainedPosition = false;\n private requestedPositionResetScheduled = false;\n private positionChangeCallbackVersion = 0;\n\n public constructor() {\n super();\n const layoutId = takeLayoutId();\n this.primaryPaneId = `ok-fv-split-layout-primary-${layoutId}`;\n this.secondaryPaneId = `ok-fv-split-layout-secondary-${layoutId}`;\n\n const positionDescriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this), 'position');\n if (!positionDescriptor?.get || !positionDescriptor.set) {\n return;\n }\n\n const getPosition = positionDescriptor.get.bind(this) as () => number;\n const setPosition = positionDescriptor.set.bind(this) as (value: number) => void;\n Object.defineProperty(this, 'position', {\n configurable: true,\n enumerable: positionDescriptor.enumerable,\n get: getPosition,\n set: (value: number) => {\n const previousPosition = getPosition();\n const callbackVersion = this.positionChangeCallbackVersion;\n setPosition(value);\n if (!this.applyingConstrainedPosition\n && callbackVersion === this.positionChangeCallbackVersion\n && previousPosition === getPosition()) {\n this.requestedPosition = getPosition();\n }\n }\n });\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.resizeObserver.observe(this);\n }\n\n public override disconnectedCallback(): void {\n this.resizeObserver.disconnect();\n super.disconnectedCallback();\n }\n\n public positionChanged(): void {\n this.positionChangeCallbackVersion += 1;\n if (!this.applyingConstrainedPosition) {\n this.requestedPosition = this.position;\n this.resetRequestedPositionAfterSynchronousUpdates();\n }\n this.constrainPosition();\n }\n\n public minChanged(): void {\n this.constrainPosition();\n }\n\n public maxChanged(): void {\n this.constrainPosition();\n }\n\n public minSecondaryPixelsChanged(): void {\n this.constrainPosition();\n }\n\n public collapsedChanged(): void {\n this.constrainPosition();\n }\n\n /** @internal */\n public get effectiveMin(): number {\n const configured = Number.isFinite(this.min) ? Math.min(100, Math.max(0, this.min)) : 35;\n return Math.min(configured, this.effectiveMax);\n }\n\n /** @internal */\n @volatile\n public get effectiveMax(): number {\n const minimum = Number.isFinite(this.min) ? Math.min(100, Math.max(0, this.min)) : 35;\n const configured = Number.isFinite(this.max)\n ? Math.min(100, Math.max(minimum, this.max))\n : Math.max(minimum, 75);\n const secondaryMinimum = this.effectiveMinSecondaryPixels;\n if (this.availableWidth <= 2 || secondaryMinimum <= 0) {\n return configured;\n }\n const pixelMaximum = 100 * (1 - secondaryMinimum / (this.availableWidth - 2));\n return Math.max(0, Math.min(configured, pixelMaximum));\n }\n\n /** @internal */\n @volatile\n public get gridTemplateColumns(): string {\n const secondaryMinimum = this.effectiveMinSecondaryPixels;\n return this.collapsed\n ? 'minmax(0, 1fr)'\n : `minmax(0, ${this.position}fr) 2px minmax(${secondaryMinimum}px, ${100 - this.position}fr)`;\n }\n\n /** @internal */\n public handleSplitterInput(event: Event): boolean {\n event.stopPropagation();\n this.position = (event.currentTarget as HTMLElementTagNameMap['ok-fv-splitter']).position;\n this.$emit('input');\n return true;\n }\n\n /** @internal */\n public handleSplitterChange(event: Event): boolean {\n event.stopPropagation();\n this.$emit('change');\n return true;\n }\n\n private constrainPosition(): void {\n if (this.collapsed) {\n return;\n }\n const finitePosition = Number.isFinite(this.requestedPosition) ? this.requestedPosition : 60;\n const constrained = Math.min(this.effectiveMax, Math.max(this.effectiveMin, finitePosition));\n if (constrained !== this.position) {\n this.applyingConstrainedPosition = true;\n this.position = constrained;\n this.applyingConstrainedPosition = false;\n }\n }\n\n private resetRequestedPositionAfterSynchronousUpdates(): void {\n if (this.requestedPositionResetScheduled) {\n return;\n }\n this.requestedPositionResetScheduled = true;\n queueMicrotask(() => {\n this.requestedPositionResetScheduled = false;\n this.requestedPosition = this.position;\n });\n }\n\n private get effectiveMinSecondaryPixels(): number {\n return Number.isFinite(this.minSecondaryPixels)\n ? Math.max(0, this.minSecondaryPixels)\n : 300;\n }\n}\n\nconst okFvSplitLayout = FvSplitLayout.compose({\n baseName: 'fv-split-layout',\n template,\n styles\n});\n\nDesignSystem.getOrCreate().withPrefix('ok').register(okFvSplitLayout());\nexport const fvSplitLayoutTag = 'ok-fv-split-layout';\n"]}
@@ -0,0 +1 @@
1
+ export declare const styles: import("@ni/fast-element").ElementStyles;
@@ -0,0 +1,42 @@
1
+ import { css } from '@ni/fast-element';
2
+ import { display } from '../../utilities/style/display';
3
+ export const styles = css `
4
+ ${display('block')}
5
+
6
+ :host {
7
+ min-width: 0;
8
+ min-height: 0;
9
+ height: 100%;
10
+ }
11
+
12
+ .layout {
13
+ display: grid;
14
+ width: 100%;
15
+ height: 100%;
16
+ min-width: 0;
17
+ min-height: 0;
18
+ overflow: auto;
19
+ }
20
+
21
+ .pane {
22
+ min-width: 0;
23
+ min-height: 0;
24
+ height: 100%;
25
+ overflow: auto;
26
+ }
27
+
28
+ slot {
29
+ display: block;
30
+ min-width: 0;
31
+ min-height: 0;
32
+ height: 100%;
33
+ }
34
+
35
+ ::slotted([slot]) {
36
+ box-sizing: border-box;
37
+ min-width: 0;
38
+ min-height: 0;
39
+ height: 100%;
40
+ }
41
+ `;
42
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/fv/split-layout/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCrB,CAAC","sourcesContent":["import { css } from '@ni/fast-element';\nimport { display } from '../../utilities/style/display';\n\nexport const styles = css`\n ${display('block')}\n\n :host {\n min-width: 0;\n min-height: 0;\n height: 100%;\n }\n\n .layout {\n display: grid;\n width: 100%;\n height: 100%;\n min-width: 0;\n min-height: 0;\n overflow: auto;\n }\n\n .pane {\n min-width: 0;\n min-height: 0;\n height: 100%;\n overflow: auto;\n }\n\n slot {\n display: block;\n min-width: 0;\n min-height: 0;\n height: 100%;\n }\n\n ::slotted([slot]) {\n box-sizing: border-box;\n min-width: 0;\n min-height: 0;\n height: 100%;\n }\n`;\n"]}
@@ -0,0 +1,2 @@
1
+ import type { FvSplitLayout } from '.';
2
+ export declare const template: import("@ni/fast-element").ViewTemplate<FvSplitLayout, any>;
@@ -0,0 +1,24 @@
1
+ import { html, when } from '@ni/fast-element';
2
+ import { fvSplitterTag } from '../splitter';
3
+ export const template = html `
4
+ <div class="layout" style="grid-template-columns: ${x => x.gridTemplateColumns}">
5
+ <div class="pane primary" id="${x => x.primaryPaneId}">
6
+ <slot name="primary"></slot>
7
+ </div>
8
+ ${when(x => !x.collapsed, html `
9
+ <${fvSplitterTag}
10
+ position="${x => x.position}"
11
+ min="${x => x.effectiveMin}"
12
+ max="${x => x.effectiveMax}"
13
+ step="${x => x.step}"
14
+ aria-controls="${x => `${x.primaryPaneId} ${x.secondaryPaneId}`}"
15
+ @input="${(x, c) => x.handleSplitterInput(c.event)}"
16
+ @change="${(x, c) => x.handleSplitterChange(c.event)}"
17
+ ></${fvSplitterTag}>
18
+ <div class="pane secondary" id="${x => x.secondaryPaneId}">
19
+ <slot name="secondary"></slot>
20
+ </div>
21
+ `)}
22
+ </div>
23
+ `;
24
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/fv/split-layout/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAe;wDACa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAmB;wCAC1C,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa;;;UAGlD,IAAI,CACF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,EACjB,IAAI,CAAe;mBACZ,aAAa;gCACA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;2BACpB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY;2BACnB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY;4BAClB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI;qCACF,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,eAAe,EAAE;8BACrD,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAC;+BACvC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC;qBACnD,aAAa;kDACgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe;;;aAG3D,CACJ;;CAER,CAAC","sourcesContent":["import { html, when } from '@ni/fast-element';\nimport { fvSplitterTag } from '../splitter';\nimport type { FvSplitLayout } from '.';\n\nexport const template = html<FvSplitLayout>`\n <div class=\"layout\" style=\"grid-template-columns: ${x => x.gridTemplateColumns}\">\n <div class=\"pane primary\" id=\"${x => x.primaryPaneId}\">\n <slot name=\"primary\"></slot>\n </div>\n ${when(\n x => !x.collapsed,\n html<FvSplitLayout>`\n <${fvSplitterTag}\n position=\"${x => x.position}\"\n min=\"${x => x.effectiveMin}\"\n max=\"${x => x.effectiveMax}\"\n step=\"${x => x.step}\"\n aria-controls=\"${x => `${x.primaryPaneId} ${x.secondaryPaneId}`}\"\n @input=\"${(x, c) => x.handleSplitterInput(c.event)}\"\n @change=\"${(x, c) => x.handleSplitterChange(c.event)}\"\n ></${fvSplitterTag}>\n <div class=\"pane secondary\" id=\"${x => x.secondaryPaneId}\">\n <slot name=\"secondary\"></slot>\n </div>\n `\n )}\n </div>\n`;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ni/ok-components",
3
- "version": "1.10.3",
3
+ "version": "1.11.1",
4
4
  "description": "NI Ok Components",
5
5
  "scripts": {
6
6
  "build": "npm run build:components && npm run build:cem",