@imfusion/web-ui 0.11.1-dev.49.gcda1589f → 0.11.1-dev.52.g8c3c8d4b
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/CHANGELOG.md +10 -2
- package/dist/components/avatar/avatar.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +13 -4
- package/dist/utils/email.d.ts +4 -1
- package/dist/utils/initials.d.ts +4 -0
- package/package.json +1 -1
- package/src/docgen/doc.gen.json +1 -1
- package/src/llms/skills/imf-web-ui-conventions/topics/library-boundary.md +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -53,9 +53,15 @@
|
|
|
53
53
|
- Focus ring tokens: `--imf-ui-focus-ring-width`, `--imf-ui-focus-ring-color`, and two offsets for a ring outside the
|
|
54
54
|
element or inside it (`-offset`, `-offset-inset`).
|
|
55
55
|
([WEBSDK-274](https://imfusion.atlassian.net/browse/WEBSDK-274)) — Nikolaus Brunner <brunner@imfusion.com>
|
|
56
|
+
- `initialsFromName` gives one or two initials from a display name for `Avatar.Fallback`: `Mona Keller` gives `MK`, a single
|
|
57
|
+
word gives its first two letters, and an empty name gives `?`. [Avatar](src/components/avatar/avatar.mdx) — Nikolaus
|
|
58
|
+
Brunner <brunner@imfusion.com>
|
|
56
59
|
|
|
57
60
|
### Changed
|
|
58
61
|
|
|
62
|
+
- `initialsFromEmail` gives the first two letters of a single-segment local part, `jkeller@…` gives `JK`, and `?` for an
|
|
63
|
+
empty one, the same rule as `initialsFromName`. [Avatar](src/components/avatar/avatar.mdx) — Nikolaus Brunner
|
|
64
|
+
<brunner@imfusion.com>
|
|
59
65
|
- `Input`, `Field.Control`, `NumberField`, `Select`, `Combobox`, and `Autocomplete` show focus by turning their 1px border
|
|
60
66
|
primary, with no outline. [Input](src/components/input/input.mdx) — Nikolaus Brunner <brunner@imfusion.com>
|
|
61
67
|
- `Drawer` draws no border by default; `borderColor` adds one, such as `borderColor="primary"` for the previous look.
|
|
@@ -91,13 +97,15 @@
|
|
|
91
97
|
lazily, and only the largest paint gets `fetchpriority="high"`.
|
|
92
98
|
- The `imf-web-ui-conventions` `components` topic names the landmarks `AppShell` renders and asks for one `Typo.H1` per
|
|
93
99
|
page, `Button` for actions, and `Link` for destinations.
|
|
100
|
+
- The `imf-web-ui-conventions` `library-boundary` topic reports a native element or local function that duplicates a Web
|
|
101
|
+
UI component, part, or helper such as `initialsFromName`.
|
|
94
102
|
- `web-ui-dev-new-component`, `web-ui-dev-update-component`, and `web-ui-dev-design-component` draft on the shared
|
|
95
103
|
Web UI Component Drafts canvas: a block per component on its Storybook group's page, one row per fidelity rung.
|
|
96
104
|
- `web-ui-dev-new-component` and `web-ui-dev-update-component` wait for the user to approve the design on the canvas
|
|
97
105
|
before writing the plan.
|
|
98
106
|
- Agents verify visual work on their own Storybook, started with `npm run dev`, against the approved canvas design.
|
|
99
|
-
- `web-ui-dev-teardown-worktree` lands local base-branch commits together with the worktree branch, and
|
|
100
|
-
|
|
107
|
+
- `web-ui-dev-teardown-worktree` lands local base-branch commits together with the worktree branch, and a branch with
|
|
108
|
+
an open Bitbucket pull request merges in Bitbucket with `bkt pr merge`.
|
|
101
109
|
- `web-ui-dev-new-component` and `web-ui-dev-update-component` open a drafts-canvas block with an API table and short
|
|
102
110
|
usage snippets.
|
|
103
111
|
- The `imf-web-ui-conventions` `styling` topic shows a container setting a custom property that its child reads with
|
|
@@ -23,7 +23,7 @@ declare namespace Root {
|
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Avatar.Fallback — the initials the consumer passes, one or two letters. Without children it shows a person glyph.
|
|
26
|
-
* It derives nothing from a name or email.
|
|
26
|
+
* It derives nothing from a name or email; `initialsFromName` and `initialsFromEmail` do.
|
|
27
27
|
*/
|
|
28
28
|
declare function Fallback({ children, ...props }: React.ComponentProps<typeof AvatarPrimitive.Fallback>): import("react/jsx-runtime").JSX.Element;
|
|
29
29
|
declare namespace Fallback {
|
package/dist/index.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ export { minWidth } from './breakpoints';
|
|
|
57
57
|
export type { BreakpointName } from './breakpoints';
|
|
58
58
|
export { cva, cx } from 'class-variance-authority';
|
|
59
59
|
export { initialsFromEmail, splitEmail } from './utils/email';
|
|
60
|
+
export { initialsFromName } from './utils/initials';
|
|
60
61
|
export { withBreakHints } from './utils/break-hints';
|
|
61
62
|
export { config } from './config';
|
|
62
63
|
export type { ColorScheme, ColorSchemePreference } from './types/theme';
|
package/dist/index.js
CHANGED
|
@@ -5754,16 +5754,25 @@ function cp({ children: e, icons: t, colorScheme: n }) {
|
|
|
5754
5754
|
});
|
|
5755
5755
|
}
|
|
5756
5756
|
//#endregion
|
|
5757
|
-
//#region src/utils/
|
|
5757
|
+
//#region src/utils/initials.ts
|
|
5758
5758
|
function lp(e) {
|
|
5759
|
+
let t = e.filter(Boolean);
|
|
5760
|
+
return t.length === 0 ? "?" : t.length === 1 ? t[0].slice(0, 2).toLocaleUpperCase() : t.slice(0, 2).map((e) => e.charAt(0)).join("").toLocaleUpperCase();
|
|
5761
|
+
}
|
|
5762
|
+
function up(e) {
|
|
5763
|
+
return lp(e.trim().split(/\s+/));
|
|
5764
|
+
}
|
|
5765
|
+
//#endregion
|
|
5766
|
+
//#region src/utils/email.ts
|
|
5767
|
+
function dp(e) {
|
|
5759
5768
|
let t = e.lastIndexOf("@");
|
|
5760
5769
|
return t <= 0 || t === e.length - 1 ? { local: e } : {
|
|
5761
5770
|
local: e.slice(0, t),
|
|
5762
5771
|
domain: e.slice(t + 1)
|
|
5763
5772
|
};
|
|
5764
5773
|
}
|
|
5765
|
-
function
|
|
5766
|
-
return lp(e).local.split(/[._-]+/)
|
|
5774
|
+
function fp(e) {
|
|
5775
|
+
return lp(dp(e).local.split(/[._-]+/));
|
|
5767
5776
|
}
|
|
5768
5777
|
//#endregion
|
|
5769
|
-
export { eu as AccountCard, tc as AppShell, mn as Autocomplete, Kl as Avatar, ge as Button, di as Callout, bi as Card, Hn as Checkbox, fu as Chip, vt as ChipLink, be as Code, hu as Collapsible, or as ColorSchemeToggle, cr as Combobox, g as ComponentCategories, St as CopyButton, Fc as Dialog, ls as Drawer, Hr as Field, ii as Fieldset, Pa as FileDropZone, s as Icon, _e as IconButton, Ws as ImFusionLogo, eo as Input, _ as Kbd, zs as Logo, wu as Meter, xd as NavigationMenu, no as NumberField, pl as Popover, Zs as ProductLogo, Ai as Progress, Bl as Prose, Et as RichLink, De as Row, ke as ScrollArea, xo as Select, Ve as Separator, wd as Skeleton, Ie as Slider, Rd as Spinner, Ee as Stack, Re as Switch, pf as TabNav, Bd as Table, Be as Tabs, as as Textarea, yf as Toast, ue as Toggle, de as ToggleGroup, Wf as Tooltip, Ui as Typo, cp as WebUIProvider, uu as accountCardMeta, Pc as appShellMeta, Vn as autocompleteMeta, du as avatarMeta, ve as buttonMeta, yi as calloutMeta, ki as cardMeta, Gn as checkboxMeta, yt as chipLinkMeta, pu as chipMeta, Ce as codeMeta, Su as collapsibleMeta, sr as colorSchemeToggleMeta, Br as comboboxMeta, qn as config, Ct as copyButtonMeta, Ue as cva, We as cx, fl as dialogMeta, Ls as drawerMeta, ni as fieldMeta, li as fieldsetMeta, Za as fileDropZoneMeta, ye as iconButtonMeta, p as iconMeta,
|
|
5778
|
+
export { eu as AccountCard, tc as AppShell, mn as Autocomplete, Kl as Avatar, ge as Button, di as Callout, bi as Card, Hn as Checkbox, fu as Chip, vt as ChipLink, be as Code, hu as Collapsible, or as ColorSchemeToggle, cr as Combobox, g as ComponentCategories, St as CopyButton, Fc as Dialog, ls as Drawer, Hr as Field, ii as Fieldset, Pa as FileDropZone, s as Icon, _e as IconButton, Ws as ImFusionLogo, eo as Input, _ as Kbd, zs as Logo, wu as Meter, xd as NavigationMenu, no as NumberField, pl as Popover, Zs as ProductLogo, Ai as Progress, Bl as Prose, Et as RichLink, De as Row, ke as ScrollArea, xo as Select, Ve as Separator, wd as Skeleton, Ie as Slider, Rd as Spinner, Ee as Stack, Re as Switch, pf as TabNav, Bd as Table, Be as Tabs, as as Textarea, yf as Toast, ue as Toggle, de as ToggleGroup, Wf as Tooltip, Ui as Typo, cp as WebUIProvider, uu as accountCardMeta, Pc as appShellMeta, Vn as autocompleteMeta, du as avatarMeta, ve as buttonMeta, yi as calloutMeta, ki as cardMeta, Gn as checkboxMeta, yt as chipLinkMeta, pu as chipMeta, Ce as codeMeta, Su as collapsibleMeta, sr as colorSchemeToggleMeta, Br as comboboxMeta, qn as config, Ct as copyButtonMeta, Ue as cva, We as cx, fl as dialogMeta, Ls as drawerMeta, ni as fieldMeta, li as fieldsetMeta, Za as fileDropZoneMeta, ye as iconButtonMeta, p as iconMeta, fp as initialsFromEmail, up as initialsFromName, to as inputMeta, le as kbdMeta, Bs as logoMeta, Fu as meterMeta, cs as minWidth, Sd as navigationMenuMeta, bo as numberFieldMeta, Rl as popoverMeta, Vi as progressMeta, Vl as proseMeta, Dt as richLinkMeta, Hl as rowMeta, Ul as scrollAreaMeta, ts as selectMeta, Wl as separatorMeta, jd as skeletonMeta, ns as sliderMeta, zd as spinnerMeta, dp as splitEmail, Hi as stackMeta, rs as switchMeta, _f as tabNavMeta, df as tableMeta, vf as tabsMeta, os as textareaMeta, Uf as toastMeta, Te as toggleGroupMeta, we as toggleMeta, op as tooltipMeta, ca as typoMeta, xe as useClipboard, rr as useColorScheme, Qs as useDisclosure, ec as useMediaQuery, Ql as withBreakHints };
|
package/dist/utils/email.d.ts
CHANGED
|
@@ -3,5 +3,8 @@ export declare function splitEmail(email: string): {
|
|
|
3
3
|
local: string;
|
|
4
4
|
domain?: string;
|
|
5
5
|
};
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* One or two initials from the email's local part, split at dots, dashes, and underscores: `m.rossi@…` gives `MR`,
|
|
8
|
+
* `jkeller@…` gives `JK`.
|
|
9
|
+
*/
|
|
7
10
|
export declare function initialsFromEmail(email: string): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** One or two letters from words: the first letter of the first two, or the first two letters of a single word. */
|
|
2
|
+
export declare function initialsFromWords(words: string[]): string;
|
|
3
|
+
/** One or two initials from a display name, split at whitespace: `Mona Keller` gives `MK`, `Bob` gives `BO`. */
|
|
4
|
+
export declare function initialsFromName(name: string): string;
|
package/package.json
CHANGED
package/src/docgen/doc.gen.json
CHANGED
|
@@ -1507,7 +1507,7 @@
|
|
|
1507
1507
|
"subComponents": [
|
|
1508
1508
|
{
|
|
1509
1509
|
"name": "Avatar.Fallback",
|
|
1510
|
-
"description": "Avatar.Fallback — the initials the consumer passes, one or two letters. Without children it shows a person glyph.\nIt derives nothing from a name or email.",
|
|
1510
|
+
"description": "Avatar.Fallback — the initials the consumer passes, one or two letters. Without children it shows a person glyph.\nIt derives nothing from a name or email; `initialsFromName` and `initialsFromEmail` do.",
|
|
1511
1511
|
"props": [
|
|
1512
1512
|
{
|
|
1513
1513
|
"name": "className",
|
|
@@ -7,6 +7,9 @@ integration seams.
|
|
|
7
7
|
|
|
8
8
|
- Do not import Base UI or another implementation package directly, including its stylesheet.
|
|
9
9
|
- If Web UI is missing a component or part, report the gap instead of reaching around it.
|
|
10
|
+
- Use what Web UI already ships before building your own: a component, a part, or a helper such as `initialsFromName`. A
|
|
11
|
+
native element or local function that duplicates one, such as a `div role="separator"` or a hand-written initials function,
|
|
12
|
+
is a finding.
|
|
10
13
|
- Import glyphs from `@imfusion/web-ui/icons` and render them with `Icon`.
|
|
11
14
|
|
|
12
15
|
## Stand in for a missing component
|