المكوّنات · حالة فارغة أولى
حالة فارغة أولى
فراغ مقصود: يشرح القيمة ويعطي خطوة واحدة
12 تصاميم من هذه العائلة
<div class="fb fbe"><div class="wrap">
<span class="art" aria-hidden="true">
<svg viewBox="0 0 48 40" width="48" height="40" fill="none">
<path d="M6 12h36l-4 22H10L6 12Z" stroke="currentColor" stroke-width="1.6"
stroke-linejoin="round"/>
<path d="M17 12a7 7 0 0 1 14 0" stroke="currentColor" stroke-width="1.6"/>
<circle cx="19" cy="23" r="1.6" fill="currentColor"/>
<circle cx="29" cy="23" r="1.6" fill="currentColor"/>
</svg></span>
<h4 data-ar="سلّتك فارغة" data-en="Your cart is empty">سلّتك فارغة</h4>
<p data-ar="أضف منتجًا وسيظهر هنا مع سعره والشحن المقدَّر قبل الدفع." data-en="Add a product and it appears here with its price and estimated shipping before checkout.">أضف منتجًا وسيظهر هنا مع سعره والشحن المقدَّر قبل الدفع.</p>
<button class="go" data-ar="تصفّح المنتجات" data-en="Browse products">تصفّح المنتجات</button>
</div></div>
/* pt-scoped */
/* feedback-empty — متجر إلكتروني */
.fbe{width:100%;height:100%;display:flex;flex-direction:column;
font-size:10px;color:var(--pt-text-secondary);overflow:hidden}
.fbe h4{margin:0;font-size:11px;color:var(--pt-text-primary);font-weight:600;line-height:1.5}
.fbe p{margin:0;font-size:9px;line-height:1.85;color:var(--pt-text-muted)}
.fbe .num{font-variant-numeric:tabular-nums}
.fbe button{font:inherit;cursor:pointer}
.fbe button:focus-visible, .fbe input:focus-visible, .fbe a:focus-visible{
outline:2px solid var(--pt-focus-ring);outline-offset:2px}
.fbe button:disabled{cursor:not-allowed;opacity:.45}
/* كل حالة تُعلَن لقارئ الشاشة: تغيّرٌ لا يُرى ولا يُسمَع لم يحدث */
.fbe [role=status], .fbe [role=alert]{display:block}
@media(pointer:coarse){.fbe button{min-height:44px}
}
/* شخصية: متمركز، رسم خطّي، انحناء كبير */
.fbe{align-items:center;justify-content:center;padding:14px}
.fbe .wrap{display:flex;flex-direction:column;align-items:center;text-align:center;gap:7px;
max-width:250px}
.fbe .art{color:var(--pt-border-strong)}
.fbe p{max-width:230px}
.fbe .go{margin-top:2px;padding:7px 18px;border-radius:var(--pt-radius-full);border:0;
background:var(--pt-accent);color:var(--pt-color-ink-900);font-size:9.5px;font-weight:600}
/* يعمل داخل إطار معزول — لا يعتمد على شيء خارجه */
/* pt-remount — يعاد التركيب عند تبديل اللغة */
(function () {
var host = document.querySelector('.fbe');
if (!host) return;
var snapshot = host.innerHTML;
var timers = [];
var ac = null;
/* الجسم كما كتبه المولِّد. يستقبل بدائل مظلَّلة لـ root وdocument
والمؤقّتات، فينظّف نفسه دون أن يعرف أنه قابل لإعادة التركيب. */
function run(root, document, setTimeout, setInterval) {
var ar = document.documentElement.lang !== 'en';
var n = function (v, d) { return Number(v).toLocaleString('en-US', {
minimumFractionDigits: d || 0, maximumFractionDigits: d || 0 }); };
var go = root.querySelector('.go');
go.addEventListener('click', function () {
var old = go.textContent;
go.textContent = ar ? '… جارٍ الفتح' : '… Opening';
setTimeout(function () { go.textContent = old; }, 900);
});
}
function mount() {
ac = new AbortController();
var real = window.document;
/* وسيط يمرّر كل شيء إلى المستند الحقيقي، ويعلّق كل مستمع بإشارة
تُقطع عند إعادة التركيب — فلا يبقى مستمع من نسخة ماتت. */
var doc = new Proxy(real, {
get: function (t, k) {
if (k === 'addEventListener') {
return function (type, fn, opts) {
var o = (opts && typeof opts === 'object') ? Object.assign({}, opts)
: { capture: !!opts };
o.signal = ac.signal;
return t.addEventListener(type, fn, o);
};
}
var v = t[k];
return typeof v === 'function' ? v.bind(t) : v;
}
});
function track(fn) {
return function (f, ms) { var id = fn(f, ms); timers.push(id); return id; };
}
run(host, doc, track(window.setTimeout.bind(window)),
track(window.setInterval.bind(window)));
}
function unmount() {
if (ac) ac.abort();
// المعرّفان يتشاركان فضاءً واحدًا في المتصفّح، فالإلغاء المزدوج آمن
timers.forEach(function (id) { window.clearTimeout(id); window.clearInterval(id); });
timers = [];
host.innerHTML = snapshot;
}
mount();
addEventListener('pt-lang', function () { unmount(); mount(); });
})();
# First-run Empty State
**Role:** You are an Arabic-first UI designer and front-end engineer. Read the whole
specification before writing a single line, then follow it literally. If two requirements
conflict, favour usability over visual effect.
**Goal:** First-run Empty State — A deliberate blank: explains the value and offers one step
**Why this component matters:** An empty state on first run is an onboarding surface, not an error. Say what will appear here, then give exactly one action — a second choice at this moment stalls the user.
**Direction:** Genuine RTL — not a mirrored Latin layout. Use logical properties
(`margin-inline-start`, `padding-inline`, `inset-inline-start`, `text-align: start`),
never physical ones (`margin-left`, `left`). The layout must flip with `dir` on its own,
with no duplicated rules.
**Typography:** Cairo for Arabic, IBM Plex Sans for Latin. Arabic line-height must be
`0.18` higher than the Latin equivalent — dots, hamzas and maddas need more vertical room.
Arabic font-size runs `1.06×` the Latin size at the same optical weight.
**Numerals:** Western digits in both languages (`1,234.50`). Only the currency changes:
`ر.س` **after** the number in Arabic, `$` **before** it in English. Jordanian dinar
uses **three** decimal places, not two.
**Colors:** Dark mode — background `#0D142B` · surfaces `#211F54` · borders `#545C91` · text `#918FC2`.
Accent `#ADA9E8` must never exceed 8% of the screen area.
**Language:** Bilingual — every string carries both Arabic and English, and the layout
flips with `dir` automatically.
**States:** `default` · `hover` · `focus` · `active` · `disabled` · `loading` · `error`.
Do not design the resting state alone.
**Accessibility:** Contrast ratio at least `4.5:1`, complete keyboard navigation,
visible focus rings, and honour `prefers-reduced-motion`.
**Output:** Clean HTML and CSS in two separate files. No frameworks, no libraries,
no external dependencies.