@stll/ui 0.79.0 → 0.81.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/calendar/day-calendar.d.ts +6 -1
- package/dist/calendar/day-calendar.js +77 -20
- package/dist/components/animated-count.js +5 -5
- package/dist/components/button.d.ts +7 -3
- package/dist/components/button.js +58 -9
- package/dist/components/destructive-confirm-dialog.js +1 -0
- package/dist/components/document-mark.shared.d.ts +14 -125
- package/dist/components/document-mark.shared.js +222 -37
- package/dist/components/file-input.d.ts +2 -1
- package/dist/components/file-input.js +2 -1
- package/dist/components/hex-color-picker.js +10 -11
- package/dist/components/search-field.d.ts +2 -1
- package/dist/components/search-field.js +2 -1
- package/dist/components/secret-input.d.ts +2 -1
- package/dist/components/secret-input.js +2 -1
- package/dist/components/split-button.d.ts +1 -1
- package/dist/components/split-button.js +6 -2
- package/dist/components/swap-text.js +9 -7
- package/dist/components/tooltip-trigger-helper.d.ts +3 -1
- package/dist/components/tooltip-trigger-helper.js +10 -3
- package/dist/components/tooltip.d.ts +3 -1
- package/dist/components/tooltip.js +25 -20
- package/dist/hooks/use-inline-overflow.d.ts +47 -0
- package/dist/hooks/use-inline-overflow.js +93 -0
- package/dist/icons.d.ts +2 -2
- package/dist/icons.js +2 -2
- package/dist/inspector/facet-bar.d.ts +1 -1
- package/dist/inspector/facet-bar.js +18 -53
- package/dist/lib/inline-overflow.d.ts +62 -0
- package/dist/lib/inline-overflow.js +79 -0
- package/dist/lib/matter-colors.d.ts +2 -2
- package/dist/lib/matter-colors.js +0 -1
- package/dist/review/review-decision-actions.d.ts +9 -4
- package/dist/review/review-decision-actions.js +24 -23
- package/dist/review/review-out-of-date-notice.d.ts +2 -4
- package/dist/review/review-out-of-date-notice.js +3 -3
- package/package.json +9 -1
- package/dist/inspector/facet-bar.logic.d.ts +0 -48
- package/dist/inspector/facet-bar.logic.js +0 -52
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure overflow policy for `InspectorFacetBar`: given the row's available
|
|
3
|
-
* width and each chip's natural (measured) width, decides how many chips
|
|
4
|
-
* stay visible and whether the overflow trigger renders — kept out of the
|
|
5
|
-
* component so it's unit-testable without a DOM or a `ResizeObserver`.
|
|
6
|
-
*/
|
|
7
|
-
export type FacetOverflowInput = {
|
|
8
|
-
/** Width inside the row available to the chips (the trigger's own
|
|
9
|
-
* footprint is reserved out of this by the policy, not by the caller). */
|
|
10
|
-
availableWidth: number;
|
|
11
|
-
/** Each chip's natural width, in the same order as the facets they
|
|
12
|
-
* represent. */
|
|
13
|
-
chipWidths: readonly number[];
|
|
14
|
-
/** Index into `chipWidths` of the active chip — always kept visible
|
|
15
|
-
* whenever anything is. */
|
|
16
|
-
activeIndex: number;
|
|
17
|
-
/** The overflow trigger's own footprint, reserved alongside the chips
|
|
18
|
-
* whenever not every chip fits. */
|
|
19
|
-
triggerWidth: number;
|
|
20
|
-
/** Horizontal gap between adjacent chips, and between the last chip and
|
|
21
|
-
* the trigger. */
|
|
22
|
-
gap?: number;
|
|
23
|
-
};
|
|
24
|
-
export type FacetOverflowPolicy = {
|
|
25
|
-
/** How many chips are visible. Counts a prefix of `chipWidths` in their
|
|
26
|
-
* given order when the active chip already falls inside that prefix;
|
|
27
|
-
* otherwise counts the active chip plus however many others (in order,
|
|
28
|
-
* skipping the active one) fit alongside it. `0` is the narrow-width
|
|
29
|
-
* floor: not even the active chip fits, so nothing but the trigger
|
|
30
|
-
* shows. */
|
|
31
|
-
visibleCount: number;
|
|
32
|
-
/** Whether the overflow trigger renders at all. */
|
|
33
|
-
showOverflowTrigger: boolean;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Decides the facet row's visible/overflow split.
|
|
37
|
-
*
|
|
38
|
-
* Narrow-width floor: if even the active chip cannot fit beside the
|
|
39
|
-
* trigger, showing it anyway would push the trigger past
|
|
40
|
-
* `availableWidth` — the row clips overflow, so the trigger (the only way
|
|
41
|
-
* to reach ANY facet from this row) would become unreachable. Rather than
|
|
42
|
-
* shrink the active chip below its natural width (this policy has no
|
|
43
|
-
* minimum-width input to shrink to), this drops the active chip from the
|
|
44
|
-
* visible row too and shows only the trigger: every facet, including the
|
|
45
|
-
* active one, still reaches through the overflow menu, and the trigger
|
|
46
|
-
* itself always stays on screen.
|
|
47
|
-
*/
|
|
48
|
-
export declare const resolveFacetOverflow: ({ availableWidth, chipWidths, activeIndex, triggerWidth, gap }: FacetOverflowInput) => FacetOverflowPolicy;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// src/inspector/facet-bar.logic.ts
|
|
2
|
-
const sumWithGaps = (widths, gap) => widths.reduce((sum, width, index) => sum + width + (index > 0 ? gap : 0), 0);
|
|
3
|
-
/**
|
|
4
|
-
* Decides the facet row's visible/overflow split.
|
|
5
|
-
*
|
|
6
|
-
* Narrow-width floor: if even the active chip cannot fit beside the
|
|
7
|
-
* trigger, showing it anyway would push the trigger past
|
|
8
|
-
* `availableWidth` — the row clips overflow, so the trigger (the only way
|
|
9
|
-
* to reach ANY facet from this row) would become unreachable. Rather than
|
|
10
|
-
* shrink the active chip below its natural width (this policy has no
|
|
11
|
-
* minimum-width input to shrink to), this drops the active chip from the
|
|
12
|
-
* visible row too and shows only the trigger: every facet, including the
|
|
13
|
-
* active one, still reaches through the overflow menu, and the trigger
|
|
14
|
-
* itself always stays on screen.
|
|
15
|
-
*/
|
|
16
|
-
const resolveFacetOverflow = ({ availableWidth, chipWidths, activeIndex, triggerWidth, gap = 0 }) => {
|
|
17
|
-
if (sumWithGaps(chipWidths, gap) <= availableWidth) return {
|
|
18
|
-
visibleCount: chipWidths.length,
|
|
19
|
-
showOverflowTrigger: false
|
|
20
|
-
};
|
|
21
|
-
let used = 0;
|
|
22
|
-
let count = 0;
|
|
23
|
-
for (const width of chipWidths) {
|
|
24
|
-
const add = width + (count > 0 ? gap : 0);
|
|
25
|
-
if (used + add + gap + triggerWidth > availableWidth) break;
|
|
26
|
-
used += add;
|
|
27
|
-
count += 1;
|
|
28
|
-
}
|
|
29
|
-
if (activeIndex < count) return {
|
|
30
|
-
visibleCount: count,
|
|
31
|
-
showOverflowTrigger: true
|
|
32
|
-
};
|
|
33
|
-
const activeWidth = chipWidths[activeIndex] ?? 0;
|
|
34
|
-
if (activeWidth + gap + triggerWidth > availableWidth) return {
|
|
35
|
-
visibleCount: 0,
|
|
36
|
-
showOverflowTrigger: true
|
|
37
|
-
};
|
|
38
|
-
used = activeWidth;
|
|
39
|
-
count = 0;
|
|
40
|
-
for (const [index, width] of chipWidths.entries()) {
|
|
41
|
-
if (index === activeIndex) continue;
|
|
42
|
-
const add = width + gap;
|
|
43
|
-
if (used + add + gap + triggerWidth > availableWidth) break;
|
|
44
|
-
used += add;
|
|
45
|
-
count += 1;
|
|
46
|
-
}
|
|
47
|
-
return {
|
|
48
|
-
visibleCount: count + 1,
|
|
49
|
-
showOverflowTrigger: true
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
export { resolveFacetOverflow };
|