المكوّنات · قسم نداء إجراء
قسم نداء إجراء
حقل واحد وزرّ واحد، والتحقّق بعد مغادرة الحقل
12 تصاميم من هذه العائلة
<div class="bk bkc"><section>
<div class="txt">
<h3 data-ar="احجز استشارتك الأولى مجّانًا" data-en="Book your first consultation free">احجز استشارتك الأولى مجّانًا</h3>
<p data-ar="نرسل لك المواعيد المتاحة خلال ساعة عمل واحدة." data-en="We send available slots within one working hour.">نرسل لك المواعيد المتاحة خلال ساعة عمل واحدة.</p>
</div>
<form class="frm" novalidate>
<label class="sr" for="cta-em" data-ar="بريدك الإلكتروني" data-en="Your email">بريدك الإلكتروني</label>
<input id="cta-em" type="email" placeholder="[email protected]" dir="ltr" autocomplete="email">
<button type="submit" data-ar="أرسل" data-en="Send">أرسل</button>
</form>
<span class="msg" role="status" aria-live="polite"></span>
</section></div>
/* pt-scoped */
/* block-cta — عيادة طبّية */
.bkc{width:100%;height:100%;display:flex;flex-direction:column;
font-size:10px;color:var(--pt-text-secondary);overflow:hidden}
.bkc h2{margin:0;font-size:19px;line-height:1.35;color:var(--pt-text-primary);
font-weight:700;letter-spacing:-.01em}
.bkc h3{margin:0;font-size:12px;line-height:1.4;color:var(--pt-text-primary);font-weight:600}
.bkc h4{margin:0;font-size:10px;color:var(--pt-text-primary);font-weight:600}
.bkc p{margin:0;font-size:9.5px;line-height:1.85;color:var(--pt-text-muted)}
.bkc .eyebrow{font-size:8px;letter-spacing:.14em;color:var(--pt-accent);font-weight:700}
.bkc .num{font-variant-numeric:tabular-nums;letter-spacing:-.01em}
.bkc button, .bkc a{font:inherit;cursor:pointer;text-decoration:none}
.bkc button:focus-visible, .bkc a:focus-visible, .bkc input:focus-visible, .bkc summary:focus-visible{outline:2px solid var(--pt-focus-ring);outline-offset:2px}
/* الأقسام تمتدّ من حافّة إلى حافّة — هذا ما يميّزها عن المكوّنات */
.bkc > section{flex:1;display:flex;flex-direction:column;justify-content:center;min-height:0}
@media(pointer:coarse){.bkc button, .bkc a{min-height:44px;display:inline-flex;
align-items:center;justify-content:center}
}
/* شخصية: صفّان، حقل ملتحم بالزرّ، انحناء كامل */
.bkc > section{align-items:center;text-align:center;gap:9px;padding:16px 30px;
background:var(--pt-bg-inset);
border-block:1px solid color-mix(in srgb,var(--pt-accent) 26%,transparent)}
.bkc .txt{display:flex;flex-direction:column;gap:3px}
.bkc .sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.bkc .frm{display:flex;width:100%;max-width:290px;
border-radius:var(--pt-radius-full);overflow:hidden;
border:1px solid var(--pt-border-default);background:var(--pt-surface)}
.bkc .frm:focus-within{border-color:var(--pt-accent)}
.bkc input{flex:1;min-width:0;border:0;background:transparent;font:inherit;font-size:9.5px;
color:var(--pt-text-primary);padding:8px 13px;outline:none}
.bkc input[aria-invalid=true]{color:var(--pt-color-danger-400)}
.bkc button{flex:none;border:0;padding:8px 17px;background:var(--pt-accent);
color:var(--pt-color-ink-900);font-size:9.5px;font-weight:700}
.bkc button:disabled{opacity:.5;cursor:not-allowed}
.bkc .msg{min-height:11px;font-size:8px;color:var(--pt-text-muted)}
.bkc .msg.ok{color:var(--pt-accent)}
.bkc .msg.bad{color:var(--pt-color-danger-400)}
/* يعمل داخل إطار معزول — لا يعتمد على شيء خارجه */
/* pt-remount — يعاد التركيب عند تبديل اللغة */
(function () {
var host = document.querySelector('.bkc');
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 frm = root.querySelector('.frm');
var em = root.querySelector('input'), btn = root.querySelector('button');
var msg = root.querySelector('.msg');
var ok = function (v) { return /^[^@\s]+@[^@\s]+\.[a-z]{2,}$/i.test(v.trim()); };
var touched = false;
function paint() {
var good = ok(em.value);
em.setAttribute('aria-invalid', String(touched && !good));
if (touched && !good) { msg.className = 'msg bad';
msg.textContent = ar ? 'صيغة البريد غير صحيحة' : 'That email looks wrong'; }
else if (msg.className !== 'msg ok') { msg.className = 'msg'; msg.textContent = ''; }
}
em.addEventListener('blur', function () { touched = true; paint(); });
em.addEventListener('input', function () { if (touched) paint(); });
frm.addEventListener('submit', function (e) {
e.preventDefault();
touched = true;
if (!ok(em.value)) { paint(); em.focus(); return; }
btn.disabled = true;
msg.className = 'msg ok';
msg.textContent = ar ? '✓ وصلنا طلبك — نراسلك خلال ساعة' : '✓ Received — we reply within the hour';
setTimeout(function () {
btn.disabled = false; em.value = ''; touched = false;
msg.className = 'msg'; msg.textContent = '';
}, 2600);
});
}
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(); });
})();
# Call-to-Action Section
**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:** Call-to-Action Section — One field, one button, and validation only after the field is left
**Why this component matters:** One field only. Every extra input in a CTA measurably reduces completion — ask for the email now and the rest after they are already committed.
**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.