@spfx-fast/sharepoint-ui 0.4.0 → 0.4.2
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/README.md +20 -879
- package/components.json +11 -5
- package/dist/elements/persona.js +2 -1
- package/dist/elements/text.d.ts +4 -0
- package/dist/elements/text.js +12 -6
- package/dist/react.d.ts +74 -31
- package/dist/react.js +92 -54
- package/package.json +1 -1
- package/dist/react-theme-styles.d.ts +0 -2
- package/dist/react-theme-styles.js +0 -75
package/components.json
CHANGED
|
@@ -1413,6 +1413,7 @@
|
|
|
1413
1413
|
"note": "React Field composes a single native or custom form control. createFormField returns a light-DOM wrapper for framework-neutral consumers.",
|
|
1414
1414
|
"api": {
|
|
1415
1415
|
"reactSignature": "{ children, label, hint, validationMessage, validationMessageIcon, validationState, required, disabled, orientation = \"vertical\", size = \"medium\", className, style, ...props }: FieldProps",
|
|
1416
|
+
"reactRefType": "HTMLDivElement",
|
|
1416
1417
|
"callbackProps": [],
|
|
1417
1418
|
"slots": [
|
|
1418
1419
|
"label",
|
|
@@ -1817,6 +1818,7 @@
|
|
|
1817
1818
|
"note": "Uses a native HTML label to preserve browser label association and click-to-focus behavior; createLabel returns an HTMLLabelElement for non-React consumers.",
|
|
1818
1819
|
"api": {
|
|
1819
1820
|
"reactSignature": "{ htmlFor, size = \"medium\", weight = \"regular\", required = false, disabled = false, children, style, ...props }: React.LabelHTMLAttributes<HTMLLabelElement> & { size?: LabelSize; weight?: LabelWeight; required?: LabelRequired; disabled?: boolean }",
|
|
1821
|
+
"reactRefType": "HTMLLabelElement",
|
|
1820
1822
|
"callbackProps": [],
|
|
1821
1823
|
"slots": [
|
|
1822
1824
|
"default"
|
|
@@ -2673,7 +2675,8 @@
|
|
|
2673
2675
|
"category": "feedback",
|
|
2674
2676
|
"reactOnly": true,
|
|
2675
2677
|
"api": {
|
|
2676
|
-
"reactSignature": "{ children, ...props }:
|
|
2678
|
+
"reactSignature": "{ children, ...props }: DrawerFooterProps",
|
|
2679
|
+
"reactRefType": "HTMLDivElement",
|
|
2677
2680
|
"callbackProps": [],
|
|
2678
2681
|
"slots": [
|
|
2679
2682
|
"actions"
|
|
@@ -2693,7 +2696,8 @@
|
|
|
2693
2696
|
"category": "feedback",
|
|
2694
2697
|
"reactOnly": true,
|
|
2695
2698
|
"api": {
|
|
2696
|
-
"reactSignature": "{ children, ...props }:
|
|
2699
|
+
"reactSignature": "{ children, ...props }: DrawerBodyProps",
|
|
2700
|
+
"reactRefType": "HTMLDivElement",
|
|
2697
2701
|
"callbackProps": [],
|
|
2698
2702
|
"slots": [
|
|
2699
2703
|
"default"
|
|
@@ -2708,7 +2712,7 @@
|
|
|
2708
2712
|
},
|
|
2709
2713
|
{
|
|
2710
2714
|
"react": "DrawerHeaderTitle",
|
|
2711
|
-
"tag": "
|
|
2715
|
+
"tag": "fragment",
|
|
2712
2716
|
"module": "drawer",
|
|
2713
2717
|
"category": "feedback",
|
|
2714
2718
|
"reactOnly": true,
|
|
@@ -2735,7 +2739,8 @@
|
|
|
2735
2739
|
"category": "feedback",
|
|
2736
2740
|
"reactOnly": true,
|
|
2737
2741
|
"api": {
|
|
2738
|
-
"reactSignature": "{ children, label, ...props }:
|
|
2742
|
+
"reactSignature": "{ children, label, ...props }: DrawerHeaderNavigationProps",
|
|
2743
|
+
"reactRefType": "HTMLElement",
|
|
2739
2744
|
"callbackProps": [],
|
|
2740
2745
|
"slots": [
|
|
2741
2746
|
"default"
|
|
@@ -3550,7 +3555,8 @@
|
|
|
3550
3555
|
"reactOnly": true,
|
|
3551
3556
|
"category": "form-trigger",
|
|
3552
3557
|
"api": {
|
|
3553
|
-
"reactSignature": "{ children, appearance = \"outline\", size = \"medium\", disabled = false, ...props }:
|
|
3558
|
+
"reactSignature": "{ children, appearance = \"outline\", size = \"medium\", disabled = false, ...props }: TagPickerButtonProps",
|
|
3559
|
+
"reactRefType": "HTMLButtonElement",
|
|
3554
3560
|
"callbackProps": [],
|
|
3555
3561
|
"slots": [
|
|
3556
3562
|
"button"
|
package/dist/elements/persona.js
CHANGED
|
@@ -69,8 +69,9 @@ export function definePersona() {
|
|
|
69
69
|
const style = document.createElement("style");
|
|
70
70
|
style.textContent = `${base}:host{--spui-persona-avatar-size:32px;--spui-persona-gap:10px;display:inline-flex;max-width:100%;min-width:0;color:var(--spui-ui-text,var(--spui-semantic-body-text,var(--colorNeutralForeground1,#242424)));font:inherit;vertical-align:middle}.layout{display:flex;align-items:center;gap:var(--spui-persona-gap);min-width:0;max-width:100%}.avatar-wrap{position:relative;display:grid;place-items:center;flex:none;width:var(--spui-persona-avatar-size);height:var(--spui-persona-avatar-size)}.avatar-fallback{display:grid;width:100%;height:100%}.presence{position:absolute;inset-inline-end:-1px;bottom:-1px;box-sizing:border-box;width:12px;height:12px;border:2px solid var(--spui-base-surface,var(--spui-ui-surface,var(--colorNeutralBackground1,#fff)));border-radius:50%;background:var(--spui-persona-presence-color,#808080)}.presence[data-presence=available]{--spui-persona-presence-color:var(--spui-persona-presence-available,var(--spui-presence-available,var(--spui-semantic-success-text,var(--colorPaletteGreenForeground1,var(--spui-ui-success,#13a10e)))))}.presence[data-presence=busy],.presence[data-presence=do-not-disturb]{--spui-persona-presence-color:var(--spui-persona-presence-busy,var(--spui-presence-busy,var(--spui-semantic-error-text,var(--colorPaletteRedForeground1,var(--spui-ui-danger,#c50f1f)))))}.presence[data-presence=away]{--spui-persona-presence-color:var(--spui-persona-presence-away,var(--spui-presence-away,var(--spui-semantic-warning-text,var(--colorPaletteMarigoldForeground1,var(--spui-ui-warning,#835b00)))))}.presence[data-presence=offline],.presence[data-presence=unknown]{--spui-persona-presence-color:var(--spui-persona-presence-offline,var(--spui-presence-offline,var(--spui-semantic-body-subtext,var(--colorNeutralForeground3,var(--spui-ui-muted,#8a8886)))))}.presence[data-presence=do-not-disturb]{box-shadow:inset 0 0 0 2px var(--spui-base-surface,var(--spui-ui-surface,#fff))}.details{display:flex;flex-direction:column;justify-content:flex-start;min-width:0;max-width:100%;line-height:1.3}.primary,.secondary,.tertiary{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.primary{font-size:14px;font-weight:600;color:var(--spui-ui-text,var(--colorNeutralForeground1,#242424))}.secondary,.tertiary{font-size:12px;color:var(--spui-ui-muted,var(--colorNeutralForeground2,#616161))}.tertiary{font-size:11px}:host([size=extra-small]){--spui-persona-avatar-size:20px;--spui-persona-gap:6px}:host([size=small]){--spui-persona-avatar-size:28px;--spui-persona-gap:8px}:host([size=large]){--spui-persona-avatar-size:36px}:host([size=extra-large]){--spui-persona-avatar-size:40px;--spui-persona-gap:12px}:host([size=huge]){--spui-persona-avatar-size:56px;--spui-persona-gap:14px}:host([size=huge]) .primary{font-size:var(--spui-persona-huge-primary-size,20px)}:host([size=huge]) .secondary{font-size:var(--spui-persona-huge-secondary-size,16px)}:host([text-position=before]) .layout{flex-direction:row-reverse}:host([text-position=below]) .layout{flex-direction:column;align-items:center;text-align:center}:host([text-position=below]) .details{align-items:center}:host([text-position=below]){max-width:12rem}:host([text-alignment=center]) .details{justify-content:center}:host([presence-only]) .avatar-wrap{width:auto;height:auto}:host([presence-only]) .avatar-fallback, :host([presence-only]) slot[name=avatar]{display:none}:host([presence-only]) .presence{position:static;inset:auto;width:16px;height:16px;border-width:0}::slotted([slot=avatar]){display:block;max-width:100%;max-height:100%}::slotted([slot=details]){min-width:0}@media(forced-colors:active){.presence{border-color:Canvas;background:Highlight}.presence[data-presence=offline],.presence[data-presence=unknown]{background:GrayText}}`;
|
|
71
71
|
style.textContent += `::slotted([slot=primary-text]),::slotted([slot=secondary-text]),::slotted([slot=tertiary-text]),::slotted([slot=quaternary-text]){display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}::slotted([slot=primary-text]){font-size:14px;font-weight:600;color:var(--spui-ui-text,var(--colorNeutralForeground1,#242424))}::slotted([slot=secondary-text]),::slotted([slot=quaternary-text]){font-size:12px;color:var(--spui-ui-muted,var(--colorNeutralForeground2,#616161))}::slotted([slot=tertiary-text]){font-size:11px;color:var(--spui-ui-muted,var(--colorNeutralForeground2,#616161))}:host([size=huge])::slotted([slot=primary-text]){font-size:var(--spui-persona-huge-primary-size,20px)}`;
|
|
72
|
-
const layout = document.createElement("
|
|
72
|
+
const layout = document.createElement("div");
|
|
73
73
|
layout.className = "layout";
|
|
74
|
+
layout.part.add("root");
|
|
74
75
|
const avatarWrap = document.createElement("span");
|
|
75
76
|
avatarWrap.className = "avatar-wrap";
|
|
76
77
|
avatarWrap.part.add("avatar-wrap");
|
package/dist/elements/text.d.ts
CHANGED
|
@@ -2,4 +2,8 @@ export type TextSize = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 100
|
|
|
2
2
|
export type TextWeight = "regular" | "medium" | "semibold" | "bold";
|
|
3
3
|
export type TextFont = "base" | "monospace" | "numeric";
|
|
4
4
|
export type TextTag = "span" | "p" | "div" | "strong" | "b" | "em" | "i" | "small" | "code" | "pre" | "blockquote" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
5
|
+
export declare function getTextSizeStyles(size: TextSize | string): {
|
|
6
|
+
fontSize: string;
|
|
7
|
+
lineHeight: string;
|
|
8
|
+
};
|
|
5
9
|
export declare function defineText(): void;
|
package/dist/elements/text.js
CHANGED
|
@@ -14,6 +14,15 @@ const extendedSizeTokens = {
|
|
|
14
14
|
"1200": ["--spui-text-font-size-1200", "--spui-text-line-height-1200"],
|
|
15
15
|
};
|
|
16
16
|
const tags = new Set(["span", "p", "div", "strong", "b", "em", "i", "small", "code", "pre", "blockquote", "h1", "h2", "h3", "h4", "h5", "h6"]);
|
|
17
|
+
export function getTextSizeStyles(size) {
|
|
18
|
+
const [fallbackSize, fallbackLine] = sizes[size] ?? sizes["300"];
|
|
19
|
+
const fluentTokens = fluentSizeTokens[size];
|
|
20
|
+
const [fontToken, lineToken] = extendedSizeTokens[size] ?? (fluentTokens ? [`--${fluentTokens[0]}`, `--${fluentTokens[1]}`] : [`--${fluentSizeTokens["300"][0]}`, `--${fluentSizeTokens["300"][1]}`]);
|
|
21
|
+
return {
|
|
22
|
+
fontSize: `var(--spui-text-font-size,var(${fontToken},${fallbackSize}))`,
|
|
23
|
+
lineHeight: `var(--spui-text-line-height,var(${lineToken},${fallbackLine}))`,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
17
26
|
export function defineText() {
|
|
18
27
|
if (customElements.get("spui-text"))
|
|
19
28
|
return;
|
|
@@ -57,12 +66,9 @@ export function defineText() {
|
|
|
57
66
|
const content = this.shadowRoot?.querySelector(".text");
|
|
58
67
|
if (!content)
|
|
59
68
|
return;
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const [fontToken, lineToken] = extendedSizeTokens[size] ?? (fluentTokens ? [`--${fluentTokens[0]}`, `--${fluentTokens[1]}`] : [`--${fluentSizeTokens["300"][0]}`, `--${fluentSizeTokens["300"][1]}`]);
|
|
64
|
-
content.style.fontSize = `var(--spui-text-font-size,var(${fontToken},${fallbackSize}))`;
|
|
65
|
-
content.style.lineHeight = `var(--spui-text-line-height,var(${lineToken},${fallbackLine}))`;
|
|
69
|
+
const sizeStyles = getTextSizeStyles(this.getAttribute("size") ?? "300");
|
|
70
|
+
content.style.fontSize = sizeStyles.fontSize;
|
|
71
|
+
content.style.lineHeight = sizeStyles.lineHeight;
|
|
66
72
|
}
|
|
67
73
|
}
|
|
68
74
|
customElements.define("spui-text", SpuiText);
|