@tangible/ui 0.2.38 → 0.2.39
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/components/Notice/Notice.d.ts +13 -0
- package/components/Notice/Notice.js +10 -2
- package/figma-tokens.json +1 -1
- package/icons/icons.svg +1 -1
- package/icons/sprite-version.js +1 -1
- package/icons/sprite.php +1 -1
- package/package.json +1 -1
- package/skills/building-with-tui/SKILL.md +4 -0
- package/styles/all.css +1 -1
- package/styles/all.expanded.css +41 -20
- package/styles/all.expanded.unlayered.css +41 -20
- package/styles/all.unlayered.css +1 -1
- package/styles/app.css +2 -0
- package/styles/components/notice.scss +34 -0
- package/styles/components/table.scss +39 -24
- package/tui-manifest.json +11 -2
|
@@ -9,6 +9,19 @@ export type NoticeExitAnimation = 'collapse' | 'fade' | 'none';
|
|
|
9
9
|
type CommonProps = {
|
|
10
10
|
/** Inline layout: icon/title on left, content center, actions right */
|
|
11
11
|
inline?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Inline layout only: how the Head and Body sit on the row's cross axis.
|
|
14
|
+
* `center` (default) centres them; `start` top-aligns them and centres a
|
|
15
|
+
* lone Head icon on the Body's first line, for a multi-line Body (a bold
|
|
16
|
+
* title over a detail line). The Foot stays centred either way.
|
|
17
|
+
* Published as `data-align`, not an is-align class (it would collide with the flex utility).
|
|
18
|
+
* Ignored (with a dev warning) without `inline`, and below the 400px
|
|
19
|
+
* container width, where inline Notices fall back to stacked. No `end`:
|
|
20
|
+
* nothing needs a bottom-aligned row, and `start`'s first-line rule has no
|
|
21
|
+
* `end` counterpart.
|
|
22
|
+
* @default 'center'
|
|
23
|
+
*/
|
|
24
|
+
align?: 'center' | 'start';
|
|
12
25
|
/** Add box shadow */
|
|
13
26
|
elevated?: boolean;
|
|
14
27
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { isDev } from '../../utils/is-dev.js';
|
|
2
3
|
import React, { forwardRef, useId, useMemo, useState, useRef, useImperativeHandle, useCallback, useEffect, useLayoutEffect, useContext, createContext } from 'react';
|
|
3
4
|
import { cx } from '../../utils/cx.js';
|
|
4
5
|
import { IconButtonCore } from '../IconButton/IconButtonCore.js';
|
|
@@ -10,9 +11,16 @@ function prefersReducedMotion() {
|
|
|
10
11
|
return false;
|
|
11
12
|
return window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;
|
|
12
13
|
}
|
|
13
|
-
export const Notice = forwardRef(function Notice({ as = 'section', inline, elevated, interactive, disabled, stripe, size, className, style, onClick, theme = 'info', announce = 'off', 'aria-label': ariaLabel, dismissible, onDismiss, dismissLabel = 'Dismiss', dismissedMessage = 'Notification dismissed', exitAnimation = 'none', focusable, children, ...rest }, ref) {
|
|
14
|
+
export const Notice = forwardRef(function Notice({ as = 'section', inline, align = 'center', elevated, interactive, disabled, stripe, size, className, style, onClick, theme = 'info', announce = 'off', 'aria-label': ariaLabel, dismissible, onDismiss, dismissLabel = 'Dismiss', dismissedMessage = 'Notification dismissed', exitAnimation = 'none', focusable, children, ...rest }, ref) {
|
|
14
15
|
const Tag = as;
|
|
15
16
|
const innerRef = useRef(null);
|
|
17
|
+
const warnedAlign = useRef(false);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (isDev() && align !== 'center' && !inline && !warnedAlign.current) {
|
|
20
|
+
warnedAlign.current = true;
|
|
21
|
+
console.warn('[Notice] `align` only applies to an inline Notice; add `inline` or drop `align`.');
|
|
22
|
+
}
|
|
23
|
+
}, [align, inline]);
|
|
16
24
|
const [isExiting, setIsExiting] = useState(false);
|
|
17
25
|
const [exitType, setExitType] = useState(null);
|
|
18
26
|
const exitResolveRef = useRef(null);
|
|
@@ -135,7 +143,7 @@ export const Notice = forwardRef(function Notice({ as = 'section', inline, eleva
|
|
|
135
143
|
}, disabled: disabled || isExiting }));
|
|
136
144
|
// Determine tabIndex: clickable gets 0, focusable gets -1, otherwise none
|
|
137
145
|
const computedTabIndex = isClickable ? 0 : (focusable ? -1 : undefined);
|
|
138
|
-
return (_jsx(NoticeContext.Provider, { value: contextValue, children: _jsxs(Tag, { ref: innerRef, className: classes, style: style, "aria-disabled": disabled || undefined, role: computedRole, "aria-labelledby": computedLabelledBy, "aria-label": computedAriaLabel, "aria-atomic": liveRole ? true : undefined, tabIndex: computedTabIndex, onClick: disabled ? undefined : onClick, onKeyDown: isClickable ? handleKeyDown : undefined, ...rest, children: [_jsx("div", { className: "tui-notice__inner", children: children }), dismissButton] }) }));
|
|
146
|
+
return (_jsx(NoticeContext.Provider, { value: contextValue, children: _jsxs(Tag, { ref: innerRef, className: classes, style: style, "aria-disabled": disabled || undefined, "data-align": inline && align === 'start' ? 'start' : undefined, role: computedRole, "aria-labelledby": computedLabelledBy, "aria-label": computedAriaLabel, "aria-atomic": liveRole ? true : undefined, tabIndex: computedTabIndex, onClick: disabled ? undefined : onClick, onKeyDown: isClickable ? handleKeyDown : undefined, ...rest, children: [_jsx("div", { className: "tui-notice__inner", children: children }), dismissButton] }) }));
|
|
139
147
|
});
|
|
140
148
|
// Notice.Head renders icon and title (consumers can add custom actions via children)
|
|
141
149
|
function NoticeHead({ className, icon, title, titleAs = 'h3', children, ...rest }) {
|
package/figma-tokens.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.2.
|
|
2
|
+
"version": "0.2.39",
|
|
3
3
|
"source": "publish/styles/all.expanded.css",
|
|
4
4
|
"prefix": "tui-",
|
|
5
5
|
"note": "Layer 1 primitives only. Component API tokens (--tui-{component}-*) are never defined in CSS — they exist only as fallback reads — so they have no Figma representation. CONTRACT: consumers read TUI defaults from this file at build time (variables[].cssVar, the \"Light\"/\"Dark\" mode names, and alias chains into TUI/Primitives). Renaming a cssVar or a mode is a breaking change to those consumers even when the CSS value is unchanged — a rename silently becomes an undefined default downstream — so treat it as at least a minor bump and call it out in the CHANGELOG.",
|
package/icons/icons.svg
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" data-tui-icon-sprite="all" data-tui-icon-sprite-version="0.2.
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" data-tui-icon-sprite="all" data-tui-icon-sprite-version="0.2.39" aria-hidden="true" focusable="false" style="position:absolute;width:0;height:0;overflow:hidden">
|
|
2
2
|
<symbol id="tui-cred-badge-check" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M10.893 4.558a1.377 1.377 0 0 1 2.214 0c.381.515 1.068.7 1.656.444a1.377 1.377 0 0 1 1.917 1.106c.072.637.575 1.14 1.212 1.213a1.377 1.377 0 0 1 1.106 1.916 1.38 1.38 0 0 0 .444 1.656c.744.55.744 1.663 0 2.214a1.38 1.38 0 0 0-.444 1.656 1.377 1.377 0 0 1-1.106 1.917 1.38 1.38 0 0 0-1.212 1.212 1.377 1.377 0 0 1-1.917 1.106 1.38 1.38 0 0 0-1.656.444 1.377 1.377 0 0 1-2.214 0 1.38 1.38 0 0 0-1.656-.444 1.377 1.377 0 0 1-1.916-1.106 1.38 1.38 0 0 0-1.213-1.212 1.377 1.377 0 0 1-1.106-1.917 1.38 1.38 0 0 0-.444-1.656 1.377 1.377 0 0 1 0-2.214c.515-.381.7-1.068.444-1.656a1.377 1.377 0 0 1 1.106-1.916 1.38 1.38 0 0 0 1.213-1.213 1.377 1.377 0 0 1 1.916-1.106 1.38 1.38 0 0 0 1.656-.444m5.193 5.91a.75.75 0 0 0-1.172-.936l-3.531 4.414-1.914-1.532a.75.75 0 1 0-.937 1.172l3.085 2.468z" clip-rule="evenodd"/></symbol>
|
|
3
3
|
<symbol id="tui-cred-badge-ribbon" viewBox="0 0 24 24"><path d="M11.032 3.488a1.205 1.205 0 0 1 1.936 0c.334.451.935.612 1.45.388a1.205 1.205 0 0 1 1.677.969c.063.557.503.997 1.06 1.06.805.092 1.291.935.969 1.678a1.204 1.204 0 0 0 .388 1.449c.65.481.65 1.455 0 1.936a1.205 1.205 0 0 0-.388 1.45 1.205 1.205 0 0 1-.969 1.677 1.204 1.204 0 0 0-1.06 1.06 1.205 1.205 0 0 1-1.678.969 1.205 1.205 0 0 0-1.449.388c-.481.65-1.455.65-1.936 0a1.204 1.204 0 0 0-1.45-.388 1.205 1.205 0 0 1-1.677-.969 1.205 1.205 0 0 0-1.06-1.06 1.205 1.205 0 0 1-.969-1.678 1.205 1.205 0 0 0-.388-1.449 1.205 1.205 0 0 1 0-1.936c.451-.334.612-.935.388-1.45a1.205 1.205 0 0 1 .969-1.677 1.205 1.205 0 0 0 1.06-1.06 1.205 1.205 0 0 1 1.678-.969 1.205 1.205 0 0 0 1.449-.388M8 17.482c.442.175.953.185 1.437-.025a.88.88 0 0 1 1.054.282 1.877 1.877 0 0 0 3.018 0 .88.88 0 0 1 1.054-.282c.484.21.995.2 1.437.025V21l-4-2.286L8 21z"/></symbol>
|
|
4
4
|
<symbol id="tui-cred-badge" viewBox="0 0 24 24"><path d="M13.107 4.558a1.377 1.377 0 0 0-2.214 0c-.381.515-1.068.7-1.656.444a1.377 1.377 0 0 0-1.916 1.106 1.38 1.38 0 0 1-1.213 1.213 1.377 1.377 0 0 0-1.106 1.916 1.38 1.38 0 0 1-.444 1.656 1.377 1.377 0 0 0 0 2.214c.515.381.7 1.068.444 1.656a1.377 1.377 0 0 0 1.106 1.917c.637.072 1.14.575 1.213 1.212a1.377 1.377 0 0 0 1.916 1.106 1.38 1.38 0 0 1 1.656.444c.55.744 1.663.744 2.214 0a1.38 1.38 0 0 1 1.656-.444 1.377 1.377 0 0 0 1.917-1.106 1.38 1.38 0 0 1 1.212-1.212 1.377 1.377 0 0 0 1.106-1.917 1.38 1.38 0 0 1 .444-1.656 1.377 1.377 0 0 0 0-2.214 1.38 1.38 0 0 1-.444-1.656 1.377 1.377 0 0 0-1.106-1.916 1.38 1.38 0 0 1-1.212-1.213 1.377 1.377 0 0 0-1.917-1.106 1.38 1.38 0 0 1-1.656-.444"/></symbol>
|
package/icons/sprite-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SPRITE_VERSION = '0.2.
|
|
1
|
+
export const SPRITE_VERSION = '0.2.39';
|
package/icons/sprite.php
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
// Replaced with the package version at build time.
|
|
24
|
-
$GLOBALS['tangible_ui_icon_sprite_copies'][__DIR__] = '0.2.
|
|
24
|
+
$GLOBALS['tangible_ui_icon_sprite_copies'][__DIR__] = '0.2.39';
|
|
25
25
|
|
|
26
26
|
if (!function_exists('tangible_ui_print_icon_sprite')) {
|
|
27
27
|
/**
|
package/package.json
CHANGED
|
@@ -494,6 +494,10 @@ API the sanctioned escape hatch is to **swizzle** — copy the component source
|
|
|
494
494
|
*between* slots (a slot's bottom padding when another follows it). A lone `Card.Body` is both
|
|
495
495
|
first and last, so padding alone sizes it. To make a compact card with Head + Body + Foot, set
|
|
496
496
|
both.
|
|
497
|
+
- **Inline Foot width.** In `mode="inline"` the Foot's flex basis defaults to 500px
|
|
498
|
+
(`--tui-card-foot-basis`), room for a row of actions. A Foot holding one small button still
|
|
499
|
+
reserves it, so set `--tui-card-foot-basis: max-content` on those cards. The same applies to
|
|
500
|
+
Notice's inline Foot (`--tui-notice-foot-basis`).
|
|
497
501
|
- **`tuiCard` is a public container name.** Card is `container-type: inline-size;
|
|
498
502
|
container-name: tuiCard`, so content inside can respond to the card's own width:
|
|
499
503
|
`@container tuiCard (max-width: 36rem) { .my-link { margin-inline-start: 0; } }`. Name it
|