Skip to content

Commit 4d44ee1

Browse files
juliacanzaniclaude
andcommitted
Notice: Default to stripe + inline, adopt core WP notice palette via semantic tokens
Forward stripe/inline props to TUI Notice (previously swallowed) with both defaulting to true, matching wp-admin notice anatomy. In the WP theme, the core admin notice palette (WP 7.0 tint + stripe pairs) is expressed through the TUI semantic feedback scales (success/warning/danger base + subtlest) so chips, buttons and notices all align. Info notices keep core's plain-surface background via a notice-level override. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 612bfa2 commit 4d44ee1

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

assets/src/components/base/notice/Notice.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ export interface FieldsNoticeProps {
1010
type?: 'success' | 'error' | 'warning' | 'info'
1111
onDismiss?: () => void
1212
className?: string
13+
/**
14+
* Stripe + inline default to true: the primary consumer is wp-admin,
15+
* where notices are a colored edge stripe with inline content.
16+
*/
17+
stripe?: boolean
18+
inline?: boolean
1319
}
1420

1521
const typeToTheme: Record<string, TuiNoticeTheme> = {
@@ -20,7 +26,7 @@ const typeToTheme: Record<string, TuiNoticeTheme> = {
2026
}
2127

2228
const Notice = forwardRef<HTMLElement, FieldsNoticeProps>(function Notice(
23-
{ message, type, onDismiss, className },
29+
{ message, type, onDismiss, className, stripe = true, inline = true },
2430
ref
2531
) {
2632
const theme = type ? (typeToTheme[type] ?? 'info') : undefined
@@ -30,6 +36,8 @@ const Notice = forwardRef<HTMLElement, FieldsNoticeProps>(function Notice(
3036
<TuiNotice
3137
ref={ref as never}
3238
theme={theme}
39+
stripe={stripe}
40+
inline={inline}
3341
dismissible={!!onDismiss}
3442
onDismiss={onDismiss}
3543
className={classes}

assets/src/themes/wp.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
--tui-color-divider: #e0e0e0;
2222

2323
--tui-focus-ring-color: var(--wp-admin-theme-color, #135e96);
24+
25+
/* Feedback scales — core wp-admin palette (WP 7.0 common.css notice values) */
26+
--tui-theme-success-base: #4ab866;
27+
--tui-theme-success-subtlest: #eff9f1;
28+
--tui-theme-warning-base: #f0b849;
29+
--tui-theme-warning-subtlest: #fef8ee;
30+
--tui-theme-danger-base: #cc1818;
31+
--tui-theme-danger-subtlest: #fcf0f0;
2432
}
2533

2634
@mixin wp-tokens-dark {
@@ -84,6 +92,15 @@
8492
@include wp-tokens-dark;
8593
}
8694

95+
/*
96+
* Notices: tints and stripes derive from the semantic theme scales above.
97+
* Core keeps info notices on a plain surface rather than a tint — preserve
98+
* that; bg-surface adapts per color mode so no dark override is needed.
99+
*/
100+
.tf-context-wp .tui-interface .tui-notice.is-theme-info {
101+
--tui-notice-bg: var(--tui-color-bg-surface);
102+
}
103+
87104
:where(.tf-context-wp .tui-interface) :is(label, .tui-label) {
88105
font-weight: normal;
89106
font-size: calc(13 * var(--tui-fontSize-multiplier, calc(1rem / 16)));

0 commit comments

Comments
 (0)