المكوّنات · بطاقة هدف ادّخار
بطاقة هدف ادّخار
المتبقّي والمدّة المتوقّعة محسوبان من الوتيرة الشهرية
9 تصاميم من هذه العائلة
<div class="ap apcg"><div class="ph">
<div class="sb"><span class="tm num"></span>
<span class="r" aria-hidden="true"><span>▲</span><span>◗</span><span class="bt num"></span></span></div>
<div class="scr"><div class="body">
<article class="gl">
<div class="ringwrap">
<svg viewBox="0 0 80 80" aria-hidden="true"><circle class="bg" cx="40" cy="40" r="34"></circle>
<circle class="fg" cx="40" cy="40" r="34"></circle></svg>
<div class="mid"><b class="pc num"></b><span data-ar="من الهدف" data-en="of goal">من الهدف</span></div>
</div>
<b class="nm" data-ar="رحلة الصيف" data-en="Summer trip">رحلة الصيف</b>
<div class="row"><span class="sv num"></span><span class="of num"></span></div>
<div class="facts">
<div><i data-ar="المتبقّي" data-en="Remaining">المتبقّي</i><b class="rm num"></b></div>
<div><i data-ar="الوتيرة الشهرية" data-en="Monthly rate">الوتيرة الشهرية</i><b class="rt2 num"></b></div>
<div><i data-ar="الاكتمال المتوقّع" data-en="Expected by">الاكتمال المتوقّع</i><b class="wh num"></b></div>
</div>
<button class="add tap" data-ar="أضف إيداعًا" data-en="Add deposit">أضف إيداعًا</button>
</article>
</div></div>
<div class="safe"></div>
</div></div>
/* pt-scoped */
/* appcard-goal — تطبيق ادّخار */
.apcg{width:100%;height:100%;display:flex;align-items:center;
justify-content:center;padding:6px;font-size:10px;color:var(--pt-text-secondary);
overflow:hidden}
.apcg .ph{position:relative;width:198px;height:100%;max-height:224px;display:flex;
flex-direction:column;overflow:hidden;background:var(--pt-bg-base);
border:1px solid var(--pt-border-default);border-radius:20px;
box-shadow:var(--pt-shadow-3)}
/* شريط الحالة — ليس تزيينًا: يثبت أعلى الشاشة فلا يبدأ المحتوى عند الحافّة */
.apcg .sb{flex:none;display:flex;align-items:center;justify-content:space-between;
padding:5px 12px 2px;font-size:7px;color:var(--pt-text-muted);
font-variant-numeric:tabular-nums}
.apcg .sb .r{display:flex;gap:3px}
.apcg .scr{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}
.apcg .body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;
-webkit-overflow-scrolling:touch}
.apcg .body::-webkit-scrollbar{width:0}
/* المنطقة الآمنة السفلية — شريط الإيماءات يأكل ما تحته */
.apcg .safe{flex:none;height:9px;display:grid;place-items:center}
.apcg .safe::after{content:'';width:52px;height:3px;border-radius:99px;
background:var(--pt-border-strong)}
.apcg h6{margin:0;font-size:10px;color:var(--pt-text-primary);font-weight:600;line-height:1.4}
.apcg p{margin:0;font-size:8px;color:var(--pt-text-muted);line-height:1.65}
.apcg .num{font-variant-numeric:tabular-nums}
.apcg button{font:inherit;cursor:pointer;
transition:background var(--pt-motion-duration-fast) var(--pt-motion-easing-standard),
color var(--pt-motion-duration-fast) var(--pt-motion-easing-standard),
transform var(--pt-motion-duration-fast) var(--pt-motion-easing-standard)}
.apcg button:focus-visible, .apcg a:focus-visible, .apcg input:focus-visible{
outline:2px solid var(--pt-focus-ring);outline-offset:-1px}
/* هدف اللمس: 44 بكسلًا على الشاشات اللمسية، ومساحة نقر ممتدّة على غيرها */
@media(pointer:coarse){.apcg .tap{min-width:44px;min-height:44px}
}
.apcg .tap{position:relative}
.apcg .tap::before{content:'';position:absolute;inset:-6px}
@media(prefers-reduced-motion:reduce){.apcg *{transition:none!important;animation:none!important}
}
.apcg .body{padding:9px 12px;display:flex;align-items:center}
.apcg .gl{width:100%;display:flex;flex-direction:column;align-items:center;gap:6px;
padding:11px;border-radius:16px;background:var(--pt-surface);
border:1px solid var(--pt-border-subtle)}
.apcg .ringwrap{position:relative;width:80px;height:80px;display:grid;place-items:center}
.apcg svg{position:absolute;inset:0;transform:rotate(-90deg)}
.apcg circle{fill:none;stroke-width:6;stroke-linecap:round}
.apcg .bg{stroke:var(--pt-bg-inset)}
.apcg .fg{stroke:var(--pt-accent);
transition:stroke-dashoffset var(--pt-motion-duration-slow) var(--pt-motion-easing-standard)}
.apcg .mid{display:flex;flex-direction:column;align-items:center}
.apcg .pc{font-size:17px;color:var(--pt-text-primary);font-weight:700;line-height:1}
.apcg .mid span{font-size:6px;color:var(--pt-text-muted)}
.apcg .nm{font-size:10px;color:var(--pt-text-primary)}
.apcg .row{display:flex;align-items:baseline;gap:5px}
.apcg .sv{font-size:13px;color:var(--pt-accent);font-weight:700}
.apcg .of{font-size:8px;color:var(--pt-text-muted)}
.apcg .facts{display:grid;grid-template-columns:repeat(3,1fr);gap:5px;width:100%;
text-align:center;padding-top:7px;border-top:1px solid var(--pt-border-subtle)}
.apcg .facts i{display:block;font-style:normal;font-size:6px;color:var(--pt-text-muted)}
.apcg .facts b{font-size:8.5px;color:var(--pt-text-primary);font-variant-numeric:tabular-nums}
.apcg .add{width:100%;padding:8px;border-radius:10px;border:0;background:var(--pt-accent);
color:var(--pt-color-ink-900);font-size:9px;font-weight:700}
/* يعمل داخل إطار معزول — لا يعتمد على شيء خارجه */
/* pt-remount — يعاد التركيب عند تبديل اللغة */
(function () {
var host = document.querySelector('.apcg');
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 money = function (usd, d) {
return ar ? n(usd * 3.75, d) + ' ر.س' : '$' + n(usd, d);
};
var set = function (sel, txt) {
var el = root.querySelector(sel); if (el) el.textContent = txt; return el;
};
/* الساعة بأرقام لاتينية دائمًا — قرار موحّد في المشروع كلّه */
(function clock() {
var t = root.querySelector('.tm');
if (!t) return;
function tick() {
var d = new Date();
t.textContent = String(d.getHours()).padStart(2, '0') + ':' +
String(d.getMinutes()).padStart(2, '0');
setTimeout(tick, 20000);
}
tick();
})();
var bt = root.querySelector('.bt');
if (bt) bt.textContent = '84%';
/* اهتزاز خفيف حيث يوجد — تأكيد لمسيّ لا يعتمد عليه شيء */
var buzz = function (ms) { try { if (navigator.vibrate) navigator.vibrate(ms || 8); } catch (e) {} };
var GOAL = 3200, RATE = 380; /* بالدولار */
var saved = 1840;
var fg = root.querySelector('.fg');
var R = fg.r.baseVal.value, C = 2 * Math.PI * R;
fg.style.strokeDasharray = C;
function paint() {
var p = Math.min(100, saved / GOAL * 100);
fg.style.strokeDashoffset = C * (1 - p / 100);
set('.pc', Math.round(p) + '%');
set('.sv', money(saved));
set('.of', (ar ? 'من ' : 'of ') + money(GOAL));
var left = Math.max(0, GOAL - saved);
set('.rm', money(left));
set('.rt2', money(RATE) + (ar ? ' /شهر' : ' /mo'));
/* التاريخ المتوقّع من الوتيرة: الحلقة تجيب «كم بقي» ولا تجيب «متى» —
وهي السؤال الحقيقي عند المدّخر. */
var months = Math.ceil(left / RATE);
var when = new Date(); when.setMonth(when.getMonth() + months);
set('.wh', left === 0 ? (ar ? 'اكتمل' : 'Done')
: when.toLocaleDateString(ar ? 'ar-SA-u-nu-latn' : 'en-GB',
{ month: 'short', year: 'numeric' }));
}
root.querySelector('.add').addEventListener('click', function () {
saved = Math.min(GOAL, saved + RATE);
buzz(); paint();
});
requestAnimationFrame(paint);
}
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(); });
})();
# Savings Goal Card
**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:** Savings Goal Card — Remaining amount and expected date derived from the monthly rate
**Why this component matters:** Project the finish date from the actual monthly rate: a progress ring alone answers “how far” but never “when”, which is the question the saver actually has.
**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.