@faast-app/ui 0.8.0 → 0.9.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/components/Badge.d.ts +30 -3
- package/dist/components/Badge.js +7 -2
- package/dist/components/BarraFlotante.d.ts +72 -0
- package/dist/components/BarraFlotante.js +190 -0
- package/dist/components/Button.d.ts +14 -3
- package/dist/components/Button.js +4 -4
- package/dist/components/FormField.d.ts +13 -1
- package/dist/components/FormField.js +4 -2
- package/dist/components/Glass.d.ts +22 -0
- package/dist/components/Glass.js +18 -0
- package/dist/components/Icon.d.ts +1 -1
- package/dist/components/Icon.js +15 -1
- package/dist/components/Input.d.ts +12 -0
- package/dist/components/Input.js +6 -6
- package/dist/components/Stepper.d.ts +12 -1
- package/dist/components/Stepper.js +3 -2
- package/dist/components/SummaryCard.d.ts +90 -0
- package/dist/components/SummaryCard.js +85 -0
- package/dist/components/Toast.d.ts +50 -4
- package/dist/components/Toast.js +21 -10
- package/dist/index.d.ts +14 -6
- package/dist/index.js +4 -0
- package/dist/kit/catalogo.html +1043 -5
- package/dist/kit/faast-kit.css +967 -3
- package/dist/kit/markup.json +92 -1
- package/dist/styles.css +932 -2
- package/dist/utils/barraOverflow.d.ts +18 -0
- package/dist/utils/barraOverflow.js +25 -0
- package/package.json +3 -3
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface BarraOverflowInput {
|
|
2
|
+
/** Natural width in px of each module, in order. */
|
|
3
|
+
widths: readonly number[];
|
|
4
|
+
/** Width in px available for the module list. */
|
|
5
|
+
available: number;
|
|
6
|
+
/** Gap in px between two items. */
|
|
7
|
+
gap: number;
|
|
8
|
+
/** Width in px of the "Más (n)" button. */
|
|
9
|
+
moreWidth: number;
|
|
10
|
+
/** Index of the current module (it never moves to "Más"), or -1. */
|
|
11
|
+
activeIndex: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Which modules do not fit and pass to the "Más (n)" menu. Items leave from the END of the list;
|
|
15
|
+
* the current module never leaves. Returns the indexes (ascending) of the modules that move.
|
|
16
|
+
* When everything fits it returns an empty array and "Más" is not shown.
|
|
17
|
+
*/
|
|
18
|
+
export declare function computeBarraOverflow({ widths, available, gap, moreWidth, activeIndex, }: BarraOverflowInput): number[];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which modules do not fit and pass to the "Más (n)" menu. Items leave from the END of the list;
|
|
3
|
+
* the current module never leaves. Returns the indexes (ascending) of the modules that move.
|
|
4
|
+
* When everything fits it returns an empty array and "Más" is not shown.
|
|
5
|
+
*/
|
|
6
|
+
export function computeBarraOverflow({ widths, available, gap, moreWidth, activeIndex, }) {
|
|
7
|
+
const total = (indexes) => indexes.reduce((sum, i, k) => sum + (widths[i] ?? 0) + (k > 0 ? gap : 0), 0);
|
|
8
|
+
const visible = widths.map((_, i) => i);
|
|
9
|
+
if (total(visible) <= available)
|
|
10
|
+
return [];
|
|
11
|
+
const hidden = [];
|
|
12
|
+
while (total(visible) + gap + moreWidth > available) {
|
|
13
|
+
let last = -1;
|
|
14
|
+
for (let j = visible.length - 1; j >= 0; j--) {
|
|
15
|
+
if (visible[j] !== activeIndex) {
|
|
16
|
+
last = j;
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (last < 0)
|
|
21
|
+
break;
|
|
22
|
+
hidden.push(visible.splice(last, 1)[0]);
|
|
23
|
+
}
|
|
24
|
+
return hidden.sort((a, b) => a - b);
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faast-app/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "FaaST accessible React UI components built on @faast-app/tokens and @faast-app/themes.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"react-dom": "19.3.1"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@faast-app/themes": "^0.
|
|
42
|
-
"@faast-app/tokens": "^0.
|
|
41
|
+
"@faast-app/themes": "^0.9.0",
|
|
42
|
+
"@faast-app/tokens": "^0.9.0",
|
|
43
43
|
"lucide-react": "1.58.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|