Private
Public Access
1
0

feat: Fluent UI Outlook Lite + connections mockup

This commit is contained in:
2026-04-14 18:52:25 +00:00
parent 1199eff6c3
commit dfa4010406
34820 changed files with 1003813 additions and 205 deletions

View File

@@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useIconState = void 0;
const contexts_1 = require("../contexts");
const shared_1 = require("./shared");
/**
* Base version of useIconState
*
* Handles:
* - a11y: aria-hidden, aria-label, role="img"
* - RTL: sets data-fui-icon-rtl attribute when flipInRtl + RTL context
* - Base: sets data-fui-icon attribute for CSS targeting
* - Fill: maps primaryFill to fill prop
*/
const useIconState = (props, options) => {
const {
// remove unwanted props to be set on the svg/html element
// eslint-disable-next-line @typescript-eslint/no-unused-vars
filled, title, primaryFill = 'currentColor', ...rest } = props;
const state = {
...rest,
fill: primaryFill,
};
const iconContext = contexts_1.useIconContext();
const isRtlFlip = (options === null || options === void 0 ? void 0 : options.flipInRtl) && (iconContext === null || iconContext === void 0 ? void 0 : iconContext.textDirection) === 'rtl';
// Data attributes for CSS targeting
state[shared_1.DATA_FUI_ICON] = '';
if (isRtlFlip) {
state[shared_1.DATA_FUI_ICON_RTL] = '';
}
if (title) {
state['aria-label'] = title;
}
if (!state['aria-label'] && !state['aria-labelledby']) {
state['aria-hidden'] = true;
}
else {
state['role'] = 'img';
}
return state;
};
exports.useIconState = useIconState;