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,5 @@
'use client';
import * as React from 'react';
const FieldContext = React.createContext(undefined);
export const FieldContextProvider = FieldContext.Provider;
export const useFieldContext_unstable = ()=>React.useContext(FieldContext);

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/contexts/FieldContext.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport type { FieldContextValue } from '../Field';\n\nconst FieldContext = React.createContext<FieldContextValue | undefined>(undefined);\n\nexport const FieldContextProvider = FieldContext.Provider;\n\nexport const useFieldContext_unstable = (): FieldContextValue | undefined => React.useContext(FieldContext);\n"],"names":["React","FieldContext","createContext","undefined","FieldContextProvider","Provider","useFieldContext_unstable","useContext"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAI/B,MAAMC,eAAeD,MAAME,aAAa,CAAgCC;AAExE,OAAO,MAAMC,uBAAuBH,aAAaI,QAAQ,CAAC;AAE1D,OAAO,MAAMC,2BAA2B,IAAqCN,MAAMO,UAAU,CAACN,cAAc"}

View File

@@ -0,0 +1,3 @@
export { FieldContextProvider, useFieldContext_unstable } from './FieldContext';
export { useFieldContextValues_unstable } from './useFieldContextValues';
export { getFieldControlProps, useFieldControlProps_unstable } from './useFieldControlProps';

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/contexts/index.ts"],"sourcesContent":["export { FieldContextProvider, useFieldContext_unstable } from './FieldContext';\nexport { useFieldContextValues_unstable } from './useFieldContextValues';\nexport type { FieldControlPropsOptions } from './useFieldControlProps';\nexport { getFieldControlProps, useFieldControlProps_unstable } from './useFieldControlProps';\n"],"names":["FieldContextProvider","useFieldContext_unstable","useFieldContextValues_unstable","getFieldControlProps","useFieldControlProps_unstable"],"mappings":"AAAA,SAASA,oBAAoB,EAAEC,wBAAwB,QAAQ,iBAAiB;AAChF,SAASC,8BAA8B,QAAQ,0BAA0B;AAEzE,SAASC,oBAAoB,EAAEC,6BAA6B,QAAQ,yBAAyB"}

View File

@@ -0,0 +1,36 @@
'use client';
import * as React from 'react';
/**
* Get the context values used when rendering Field.
*/ export const useFieldContextValues_unstable = (state)=>{
var _state_label, _state_label1, _state_validationMessage, _state_hint;
const { generatedControlId, orientation, required, size, validationState } = state;
const labelFor = (_state_label = state.label) === null || _state_label === void 0 ? void 0 : _state_label.htmlFor;
const labelId = (_state_label1 = state.label) === null || _state_label1 === void 0 ? void 0 : _state_label1.id;
const validationMessageId = (_state_validationMessage = state.validationMessage) === null || _state_validationMessage === void 0 ? void 0 : _state_validationMessage.id;
const hintId = (_state_hint = state.hint) === null || _state_hint === void 0 ? void 0 : _state_hint.id;
const field = React.useMemo(()=>({
generatedControlId,
hintId,
labelFor,
labelId,
orientation,
required,
size,
validationMessageId,
validationState
}), [
generatedControlId,
hintId,
labelFor,
labelId,
orientation,
required,
size,
validationMessageId,
validationState
]);
return {
field
};
};

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/contexts/useFieldContextValues.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport type { FieldContextValue, FieldContextValues, FieldState } from '../Field';\n\n/**\n * Get the context values used when rendering Field.\n */\nexport const useFieldContextValues_unstable = (state: FieldState): FieldContextValues => {\n const { generatedControlId, orientation, required, size, validationState } = state;\n const labelFor = state.label?.htmlFor;\n const labelId = state.label?.id;\n const validationMessageId = state.validationMessage?.id;\n const hintId = state.hint?.id;\n\n const field: FieldContextValue = React.useMemo(\n () => ({\n generatedControlId,\n hintId,\n labelFor,\n labelId,\n orientation,\n required,\n size,\n validationMessageId,\n validationState,\n }),\n [generatedControlId, hintId, labelFor, labelId, orientation, required, size, validationMessageId, validationState],\n );\n\n return { field };\n};\n"],"names":["React","useFieldContextValues_unstable","state","generatedControlId","orientation","required","size","validationState","labelFor","label","htmlFor","labelId","id","validationMessageId","validationMessage","hintId","hint","field","useMemo"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAI/B;;CAEC,GACD,OAAO,MAAMC,iCAAiC,CAACC;QAE5BA,cACDA,eACYA,0BACbA;IAJf,MAAM,EAAEC,kBAAkB,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,eAAe,EAAE,GAAGL;IAC7E,MAAMM,YAAWN,eAAAA,MAAMO,KAAK,cAAXP,mCAAAA,aAAaQ,OAAO;IACrC,MAAMC,WAAUT,gBAAAA,MAAMO,KAAK,cAAXP,oCAAAA,cAAaU,EAAE;IAC/B,MAAMC,uBAAsBX,2BAAAA,MAAMY,iBAAiB,cAAvBZ,+CAAAA,yBAAyBU,EAAE;IACvD,MAAMG,UAASb,cAAAA,MAAMc,IAAI,cAAVd,kCAAAA,YAAYU,EAAE;IAE7B,MAAMK,QAA2BjB,MAAMkB,OAAO,CAC5C,IAAO,CAAA;YACLf;YACAY;YACAP;YACAG;YACAP;YACAC;YACAC;YACAO;YACAN;QACF,CAAA,GACA;QAACJ;QAAoBY;QAAQP;QAAUG;QAASP;QAAaC;QAAUC;QAAMO;QAAqBN;KAAgB;IAGpH,OAAO;QAAEU;IAAM;AACjB,EAAE"}

View File

@@ -0,0 +1,66 @@
'use client';
import { useFieldContext_unstable } from './FieldContext';
export function useFieldControlProps_unstable(props, options) {
return getFieldControlProps(useFieldContext_unstable(), props, options);
}
/**
* Implementation of useFieldControlProps_unstable.
* Split out so it can be used directly in renderField_unstable.
*
* @internal
*/ export function getFieldControlProps(context, props, options) {
if (!context) {
return props;
}
// Create a copy of props so we don't modify the original
props = {
...props
};
const { generatedControlId, hintId, labelFor, labelId, required, validationMessageId, validationState } = context;
if (generatedControlId) {
var _props;
var _id;
(_id = (_props = props).id) !== null && _id !== void 0 ? _id : _props.id = generatedControlId;
}
// Set aria-labelledby if the control doesn't support label.htmlFor, or if the label's htmlFor doesn't refer
// to this control (i.e. the user set this control's id prop without also setting the Field's label.htmlFor).
if (labelId && (!(options === null || options === void 0 ? void 0 : options.supportsLabelFor) || labelFor !== props.id)) {
var _props1, _arialabelledby;
var _;
(_ = (_props1 = props)[_arialabelledby = 'aria-labelledby']) !== null && _ !== void 0 ? _ : _props1[_arialabelledby] = labelId;
}
// The control is described by the validation message, or hint, or both.
// We also preserve and append any aria-describedby from props.
// For reference: https://github.com/microsoft/fluentui/pull/25580#discussion_r1017259933
if (validationMessageId || hintId) {
// NOTE: Not using ??= since we're merging and overriding the user-provided value.
props['aria-describedby'] = [
validationMessageId,
hintId,
props === null || props === void 0 ? void 0 : props['aria-describedby']
].filter(Boolean).join(' ');
}
if (validationState === 'error') {
var _props2, _ariainvalid;
var _1;
(_1 = (_props2 = props)[_ariainvalid = 'aria-invalid']) !== null && _1 !== void 0 ? _1 : _props2[_ariainvalid] = true;
}
if (required) {
if (options === null || options === void 0 ? void 0 : options.supportsRequired) {
var _props3;
var _required;
(_required = (_props3 = props).required) !== null && _required !== void 0 ? _required : _props3.required = true;
} else {
var _props4, _ariarequired;
var _2;
(_2 = (_props4 = props)[_ariarequired = 'aria-required']) !== null && _2 !== void 0 ? _2 : _props4[_ariarequired] = true;
}
}
// Include the size prop if this control supports it
if (options === null || options === void 0 ? void 0 : options.supportsSize) {
var _props5;
var _size;
(_size = (_props5 = props).size) !== null && _size !== void 0 ? _size : _props5.size = context.size;
}
return props;
}

File diff suppressed because one or more lines are too long