@processdynamics/components 0.1.4 → 0.1.5
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/README.md +10 -7
- package/dist/index.cjs +133 -74
- package/dist/index.d.cts +21 -14
- package/dist/index.d.ts +21 -14
- package/dist/index.js +125 -66
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -57,7 +57,7 @@ The story tests don't check styling. For visual changes, open the story in a bro
|
|
|
57
57
|
|
|
58
58
|
### DatePicker
|
|
59
59
|
|
|
60
|
-
A single date picker. A
|
|
60
|
+
A single date picker. A text field takes a typed date, and a calendar button beside it opens a calendar in a popover. Both change the same date.
|
|
61
61
|
|
|
62
62
|
```tsx
|
|
63
63
|
"use client";
|
|
@@ -73,15 +73,18 @@ export function Example() {
|
|
|
73
73
|
|
|
74
74
|
| Prop | Type | Description |
|
|
75
75
|
| --- | --- | --- |
|
|
76
|
-
| `date` | `Date \| null` | The selected date. Optional. The component is controlled, so update it from `onSelect` or the
|
|
77
|
-
| `onSelect` | `(date: Date) => void` | Required. Called with the chosen day,
|
|
76
|
+
| `date` | `Date \| null` | The selected date. Optional. The component is controlled, so update it from `onSelect` or the date won't change. |
|
|
77
|
+
| `onSelect` | `(date: Date) => void` | Required. Called with the chosen day, from the calendar or from a typed date. |
|
|
78
|
+
| `dateFormat` | `string` | A date-fns format string for showing and typing the date. Optional, defaults to `dd/MM/yyyy`. The placeholder is this in lower case. |
|
|
78
79
|
|
|
79
80
|
Behaviour to know about:
|
|
80
81
|
|
|
81
|
-
- The
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
82
|
+
- The field and the calendar button fill the width of their container, so size it with a wrapper.
|
|
83
|
+
- A typed date is read when the user presses Enter or leaves the field. Text that is not a real date, or a year under 1000 such as `2/11/26`, is ignored and the field goes back to the last good date. Enter doesn't submit a surrounding form.
|
|
84
|
+
- Picking a day in the calendar fills the field and closes the popover.
|
|
85
|
+
- The calendar opens on the month of `date`, or the current month when there is none. With no date, today is highlighted as the selection while the field stays empty.
|
|
86
|
+
- A date can be changed but not cleared. Emptying the field puts the last date back.
|
|
87
|
+
- The field's accessible name is "Date" and the button's is "Open calendar". With two pickers on one page, wrap each in a labelled group.
|
|
85
88
|
- The popover is modal on purpose, so it works inside a vaul drawer.
|
|
86
89
|
|
|
87
90
|
The full docs page, with live controls and stories, is in Storybook under Components, then DatePicker.
|
package/dist/index.cjs
CHANGED
|
@@ -313,71 +313,130 @@ function PopoverContent({
|
|
|
313
313
|
}
|
|
314
314
|
) });
|
|
315
315
|
}
|
|
316
|
+
function PopoverAnchor({
|
|
317
|
+
...props
|
|
318
|
+
}) {
|
|
319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_radix_ui2.Popover.Anchor, { "data-slot": "popover-anchor", ...props });
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// src/components/ui/input.tsx
|
|
323
|
+
var import_cn4 = require("cn");
|
|
324
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
325
|
+
function Input({ className, type, ...props }) {
|
|
326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
327
|
+
"input",
|
|
328
|
+
{
|
|
329
|
+
type,
|
|
330
|
+
"data-slot": "input",
|
|
331
|
+
className: (0, import_cn4.cn)(
|
|
332
|
+
"h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
333
|
+
className
|
|
334
|
+
),
|
|
335
|
+
...props
|
|
336
|
+
}
|
|
337
|
+
);
|
|
338
|
+
}
|
|
316
339
|
|
|
317
340
|
// src/components/datePicker/DatePicker.tsx
|
|
318
341
|
var import_date_fns = require("date-fns");
|
|
319
342
|
var import_react = require("react");
|
|
320
|
-
var
|
|
321
|
-
var
|
|
343
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
344
|
+
var DEFAULT_DATE_FORMAT = "dd/MM/yyyy";
|
|
345
|
+
var MIN_TYPED_YEAR = 1e3;
|
|
346
|
+
var parseTypedDate = (text, dateFormat) => {
|
|
347
|
+
const parsed = (0, import_date_fns.parse)(text.trim(), dateFormat, /* @__PURE__ */ new Date());
|
|
348
|
+
if (!(0, import_date_fns.isValid)(parsed) || parsed.getFullYear() < MIN_TYPED_YEAR) return null;
|
|
349
|
+
return parsed;
|
|
350
|
+
};
|
|
351
|
+
var formatDate = (date, dateFormat) => date ? (0, import_date_fns.format)(date, dateFormat) : "";
|
|
352
|
+
var DatePicker = ({
|
|
353
|
+
onSelect,
|
|
354
|
+
date,
|
|
355
|
+
dateFormat = DEFAULT_DATE_FORMAT
|
|
356
|
+
}) => {
|
|
322
357
|
const [isOpen, setIsOpen] = (0, import_react.useState)(false);
|
|
323
|
-
const
|
|
358
|
+
const [typedText, setTypedText] = (0, import_react.useState)(formatDate(date, dateFormat));
|
|
359
|
+
const [shownDate, setShownDate] = (0, import_react.useState)(date);
|
|
360
|
+
if (date?.getTime() !== shownDate?.getTime()) {
|
|
361
|
+
setShownDate(date);
|
|
362
|
+
setTypedText(formatDate(date, dateFormat));
|
|
363
|
+
}
|
|
364
|
+
const handleCalendarSelect = (selectedDate) => {
|
|
365
|
+
setTypedText(formatDate(selectedDate, dateFormat));
|
|
324
366
|
onSelect(selectedDate);
|
|
325
367
|
setIsOpen(false);
|
|
326
368
|
};
|
|
369
|
+
const commitTypedText = () => {
|
|
370
|
+
const parsedDate = parseTypedDate(typedText, dateFormat);
|
|
371
|
+
if (!parsedDate) {
|
|
372
|
+
setTypedText(formatDate(date, dateFormat));
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
setTypedText(formatDate(parsedDate, dateFormat));
|
|
376
|
+
if (!date || !(0, import_date_fns.isSameDay)(parsedDate, date)) onSelect(parsedDate);
|
|
377
|
+
};
|
|
327
378
|
return (
|
|
328
379
|
// Modal so the calendar re-enables pointer events for itself. Inside a vaul
|
|
329
380
|
// drawer the popover is portaled outside the drawer, and vaul bundles its
|
|
330
381
|
// own copy of Radix's layer package, so a non-modal popover inherits the
|
|
331
382
|
// drawer's pointer-events: none and its day buttons never receive clicks.
|
|
332
|
-
/* @__PURE__ */ (0,
|
|
333
|
-
/* @__PURE__ */ (0,
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
383
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Popover, { modal: true, open: isOpen, onOpenChange: setIsOpen, children: [
|
|
384
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PopoverAnchor, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex w-full gap-2", children: [
|
|
385
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
386
|
+
Input,
|
|
387
|
+
{
|
|
388
|
+
value: typedText,
|
|
389
|
+
onChange: (event) => setTypedText(event.target.value),
|
|
390
|
+
onBlur: commitTypedText,
|
|
391
|
+
onKeyDown: (event) => {
|
|
392
|
+
if (event.key !== "Enter") return;
|
|
393
|
+
event.preventDefault();
|
|
394
|
+
commitTypedText();
|
|
395
|
+
},
|
|
396
|
+
placeholder: dateFormat.toLowerCase(),
|
|
397
|
+
autoComplete: "off",
|
|
398
|
+
"aria-label": "Date"
|
|
399
|
+
}
|
|
400
|
+
),
|
|
401
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
402
|
+
Button,
|
|
403
|
+
{
|
|
404
|
+
type: "button",
|
|
405
|
+
variant: "outline",
|
|
406
|
+
size: "icon",
|
|
407
|
+
"aria-label": "Open calendar",
|
|
408
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.CalendarIcon, {})
|
|
409
|
+
}
|
|
410
|
+
) })
|
|
411
|
+
] }) }),
|
|
412
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
413
|
+
Calendar,
|
|
347
414
|
{
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
classNames: { root: "w-full" },
|
|
354
|
-
mode: "single",
|
|
355
|
-
required: true,
|
|
356
|
-
selected: date ?? /* @__PURE__ */ new Date(),
|
|
357
|
-
onSelect: handleSelect,
|
|
358
|
-
defaultMonth: date ?? /* @__PURE__ */ new Date()
|
|
359
|
-
}
|
|
360
|
-
)
|
|
415
|
+
mode: "single",
|
|
416
|
+
required: true,
|
|
417
|
+
selected: date ?? /* @__PURE__ */ new Date(),
|
|
418
|
+
onSelect: handleCalendarSelect,
|
|
419
|
+
defaultMonth: date ?? /* @__PURE__ */ new Date()
|
|
361
420
|
}
|
|
362
|
-
)
|
|
421
|
+
) })
|
|
363
422
|
] })
|
|
364
423
|
);
|
|
365
424
|
};
|
|
366
425
|
|
|
367
426
|
// src/components/ui/card.tsx
|
|
368
|
-
var
|
|
369
|
-
var
|
|
427
|
+
var import_cn5 = require("cn");
|
|
428
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
370
429
|
function Card({
|
|
371
430
|
className,
|
|
372
431
|
size = "default",
|
|
373
432
|
...props
|
|
374
433
|
}) {
|
|
375
|
-
return /* @__PURE__ */ (0,
|
|
434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
376
435
|
"div",
|
|
377
436
|
{
|
|
378
437
|
"data-slot": "card",
|
|
379
438
|
"data-size": size,
|
|
380
|
-
className: (0,
|
|
439
|
+
className: (0, import_cn5.cn)(
|
|
381
440
|
"group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
|
|
382
441
|
className
|
|
383
442
|
),
|
|
@@ -386,28 +445,28 @@ function Card({
|
|
|
386
445
|
);
|
|
387
446
|
}
|
|
388
447
|
function CardContent({ className, ...props }) {
|
|
389
|
-
return /* @__PURE__ */ (0,
|
|
448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
390
449
|
"div",
|
|
391
450
|
{
|
|
392
451
|
"data-slot": "card-content",
|
|
393
|
-
className: (0,
|
|
452
|
+
className: (0, import_cn5.cn)("px-(--card-spacing)", className),
|
|
394
453
|
...props
|
|
395
454
|
}
|
|
396
455
|
);
|
|
397
456
|
}
|
|
398
457
|
|
|
399
458
|
// src/lib/utils.ts
|
|
400
|
-
var
|
|
459
|
+
var import_cn6 = require("cn");
|
|
401
460
|
|
|
402
461
|
// src/components/jobCard/JobCardBannerBar.tsx
|
|
403
|
-
var
|
|
404
|
-
var JobCardBannerBar = ({ banner }) => /* @__PURE__ */ (0,
|
|
462
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
463
|
+
var JobCardBannerBar = ({ banner }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mt-3 flex items-center gap-2 rounded border border-blue-300 bg-blue-50 px-3 py-1.5 text-xs text-gray-600 shadow [&>svg]:h-4 [&>svg]:w-4", children: [
|
|
405
464
|
banner.icon,
|
|
406
465
|
banner.label
|
|
407
466
|
] });
|
|
408
467
|
|
|
409
468
|
// src/components/jobCard/JobCardParts.tsx
|
|
410
|
-
var
|
|
469
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
411
470
|
var DEFAULT_STAGE_COLOR = "#6b7280";
|
|
412
471
|
var BADGE_COLOR_CLASSES = {
|
|
413
472
|
gray: "bg-gray-300",
|
|
@@ -418,45 +477,45 @@ var BADGE_COLOR_CLASSES = {
|
|
|
418
477
|
blue: "bg-blue-300",
|
|
419
478
|
purple: "bg-purple-300"
|
|
420
479
|
};
|
|
421
|
-
var JobCardHeading = ({ title, stage, leadingContent }) => /* @__PURE__ */ (0,
|
|
422
|
-
/* @__PURE__ */ (0,
|
|
480
|
+
var JobCardHeading = ({ title, stage, leadingContent }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex items-center gap-2 mb-1", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex justify-between w-full", children: [
|
|
481
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "flex items-center gap-2 font-bold text-base", children: [
|
|
423
482
|
leadingContent,
|
|
424
483
|
title
|
|
425
484
|
] }),
|
|
426
|
-
stage && /* @__PURE__ */ (0,
|
|
427
|
-
/* @__PURE__ */ (0,
|
|
485
|
+
stage && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
486
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
428
487
|
"span",
|
|
429
488
|
{
|
|
430
489
|
className: "w-2 h-2 rounded-full",
|
|
431
490
|
style: { backgroundColor: stage.color ?? DEFAULT_STAGE_COLOR }
|
|
432
491
|
}
|
|
433
492
|
),
|
|
434
|
-
/* @__PURE__ */ (0,
|
|
493
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-gray-900", children: stage.label })
|
|
435
494
|
] })
|
|
436
495
|
] }) });
|
|
437
|
-
var JobCardDetails = ({ details }) => /* @__PURE__ */ (0,
|
|
438
|
-
var JobCardCallouts = ({ callouts }) => /* @__PURE__ */ (0,
|
|
496
|
+
var JobCardDetails = ({ details }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex flex-col gap-1", children: details.map((detail, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-xs text-gray-500", children: detail }, `${index}-${detail}`)) });
|
|
497
|
+
var JobCardCallouts = ({ callouts }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex justify-between w-full", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-xs my-1 w-full space-y-1", children: callouts.map((callout, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
439
498
|
"div",
|
|
440
499
|
{
|
|
441
500
|
className: "flex gap-2 items-center border p-2 rounded bg-white shadow",
|
|
442
|
-
children: /* @__PURE__ */ (0,
|
|
501
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: callout })
|
|
443
502
|
},
|
|
444
503
|
`${index}-${callout}`
|
|
445
504
|
)) }) });
|
|
446
505
|
var JobCardSummary = ({
|
|
447
506
|
job,
|
|
448
507
|
leadingContent
|
|
449
|
-
}) => /* @__PURE__ */ (0,
|
|
450
|
-
/* @__PURE__ */ (0,
|
|
451
|
-
job.subtitle && /* @__PURE__ */ (0,
|
|
452
|
-
job.details && job.details.length > 0 && /* @__PURE__ */ (0,
|
|
453
|
-
job.description && /* @__PURE__ */ (0,
|
|
454
|
-
job.callouts && job.callouts.length > 0 && /* @__PURE__ */ (0,
|
|
508
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "w-full", children: [
|
|
509
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(JobCardHeading, { title: job.title, stage: job.stage, leadingContent }),
|
|
510
|
+
job.subtitle && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-[13px] text-gray-600 mb-1", children: job.subtitle }),
|
|
511
|
+
job.details && job.details.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(JobCardDetails, { details: job.details }),
|
|
512
|
+
job.description && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-sm text-gray-700 italic mt-1", children: job.description }),
|
|
513
|
+
job.callouts && job.callouts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(JobCardCallouts, { callouts: job.callouts })
|
|
455
514
|
] });
|
|
456
515
|
var JobCardBadgeBlock = ({
|
|
457
516
|
badge,
|
|
458
517
|
hasPills
|
|
459
|
-
}) => /* @__PURE__ */ (0,
|
|
518
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `flex pr-4 w-20 ${hasPills ? "border-r" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
460
519
|
"span",
|
|
461
520
|
{
|
|
462
521
|
className: `flex items-center shadow border rounded px-4 py-1 text-center text-wrap ${BADGE_COLOR_CLASSES[badge.color]} ${hasPills ? "border-r" : ""}`,
|
|
@@ -465,7 +524,7 @@ var JobCardBadgeBlock = ({
|
|
|
465
524
|
) });
|
|
466
525
|
|
|
467
526
|
// src/components/jobCard/JobCardPills.tsx
|
|
468
|
-
var
|
|
527
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
469
528
|
var PILL_BASE = "flex items-center gap-1 h-5 rounded-full text-center text-[10px] md:text-xs [&>svg]:w-3 [&>svg]:h-3";
|
|
470
529
|
var PILL_TONE_CLASSES = {
|
|
471
530
|
critical: "px-3 bg-red-500 text-white font-bold shadow-md shadow-red-900/70",
|
|
@@ -479,27 +538,27 @@ var PILL_TONE_CLASSES = {
|
|
|
479
538
|
outline: "px-3 border border-gray-300 bg-white text-gray-600",
|
|
480
539
|
dashed: "px-3 border border-dashed border-gray-400 bg-white text-gray-600"
|
|
481
540
|
};
|
|
482
|
-
var JobCardPillItem = ({ pill }) => /* @__PURE__ */ (0,
|
|
541
|
+
var JobCardPillItem = ({ pill }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: `${PILL_BASE} ${PILL_TONE_CLASSES[pill.tone]}`, children: [
|
|
483
542
|
pill.icon,
|
|
484
543
|
pill.label
|
|
485
544
|
] });
|
|
486
545
|
var JobCardPillList = ({ pills }) => {
|
|
487
546
|
const priorityPills = pills.filter((pill) => pill.priority);
|
|
488
547
|
const otherPills = pills.filter((pill) => !pill.priority);
|
|
489
|
-
return /* @__PURE__ */ (0,
|
|
490
|
-
priorityPills.length > 0 && /* @__PURE__ */ (0,
|
|
548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex gap-2 flex-wrap", children: [
|
|
549
|
+
priorityPills.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
491
550
|
"div",
|
|
492
551
|
{
|
|
493
552
|
className: `flex gap-2 w-full ${otherPills.length > 0 ? "pb-2 border-b" : ""}`,
|
|
494
|
-
children: priorityPills.map((pill) => /* @__PURE__ */ (0,
|
|
553
|
+
children: priorityPills.map((pill) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(JobCardPillItem, { pill }, pill.label))
|
|
495
554
|
}
|
|
496
555
|
),
|
|
497
|
-
otherPills.map((pill) => /* @__PURE__ */ (0,
|
|
556
|
+
otherPills.map((pill) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(JobCardPillItem, { pill }, pill.label))
|
|
498
557
|
] });
|
|
499
558
|
};
|
|
500
559
|
|
|
501
560
|
// src/components/jobCard/JobCard.tsx
|
|
502
|
-
var
|
|
561
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
503
562
|
var CARD_TONE_CLASSES = {
|
|
504
563
|
success: "border-green-400 bg-green-50",
|
|
505
564
|
warning: "border-orange-400 bg-orange-50",
|
|
@@ -515,11 +574,11 @@ var JobCard = ({
|
|
|
515
574
|
className
|
|
516
575
|
}) => {
|
|
517
576
|
const hasPills = Boolean(job.pills && job.pills.length > 0);
|
|
518
|
-
return /* @__PURE__ */ (0,
|
|
577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
519
578
|
Card,
|
|
520
579
|
{
|
|
521
580
|
onClick,
|
|
522
|
-
className: (0,
|
|
581
|
+
className: (0, import_cn6.cn)(
|
|
523
582
|
// The shadcn Card adds vertical padding, a gap, bigger corners and a
|
|
524
583
|
// ring. The card's own padding is set on CardContent below, so those
|
|
525
584
|
// are cancelled here to keep the original, tighter layout.
|
|
@@ -529,14 +588,14 @@ var JobCard = ({
|
|
|
529
588
|
CARD_TONE_CLASSES[job.tone ?? "neutral"],
|
|
530
589
|
className
|
|
531
590
|
),
|
|
532
|
-
children: /* @__PURE__ */ (0,
|
|
533
|
-
/* @__PURE__ */ (0,
|
|
534
|
-
(job.badge || hasPills) && /* @__PURE__ */ (0,
|
|
535
|
-
job.badge && /* @__PURE__ */ (0,
|
|
536
|
-
hasPills && /* @__PURE__ */ (0,
|
|
591
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(CardContent, { className: "p-3.5", children: [
|
|
592
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex justify-between items-start mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(JobCardSummary, { job, leadingContent }) }),
|
|
593
|
+
(job.badge || hasPills) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex gap-2 text-xs", children: [
|
|
594
|
+
job.badge && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(JobCardBadgeBlock, { badge: job.badge, hasPills }),
|
|
595
|
+
hasPills && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(JobCardPillList, { pills: job.pills ?? [] })
|
|
537
596
|
] }),
|
|
538
|
-
job.banner && /* @__PURE__ */ (0,
|
|
539
|
-
action && /* @__PURE__ */ (0,
|
|
597
|
+
job.banner && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(JobCardBannerBar, { banner: job.banner }),
|
|
598
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
540
599
|
Button,
|
|
541
600
|
{
|
|
542
601
|
onClick: (event) => {
|
|
@@ -549,7 +608,7 @@ var JobCard = ({
|
|
|
549
608
|
children: action.label
|
|
550
609
|
}
|
|
551
610
|
),
|
|
552
|
-
/* @__PURE__ */ (0,
|
|
611
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { children: expandedContent })
|
|
553
612
|
] })
|
|
554
613
|
}
|
|
555
614
|
);
|
package/dist/index.d.cts
CHANGED
|
@@ -3,33 +3,40 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
|
|
4
4
|
interface IDatePicker {
|
|
5
5
|
/**
|
|
6
|
-
* Called with the chosen day when the user picks one
|
|
7
|
-
*
|
|
8
|
-
* without a pick
|
|
6
|
+
* Called with the chosen day when the user picks one in the calendar, or
|
|
7
|
+
* types a real date and presses Enter or leaves the field. It is not called
|
|
8
|
+
* when the popover is dismissed without a pick, or for text that is not a
|
|
9
|
+
* real date.
|
|
9
10
|
*/
|
|
10
11
|
onSelect: (date: Date) => void;
|
|
11
12
|
/**
|
|
12
|
-
* The selected date. The component is controlled: it never
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* The selected date. The component is controlled: it never decides the date
|
|
14
|
+
* itself, so update this from `onSelect` or the date will not change. Leave
|
|
15
|
+
* it empty (`undefined` or `null`) to show the placeholder.
|
|
15
16
|
*/
|
|
16
17
|
date?: Date | null;
|
|
18
|
+
/**
|
|
19
|
+
* How the date is shown and typed, as a date-fns format string. Defaults to
|
|
20
|
+
* `dd/MM/yyyy`. The placeholder is this in lower case.
|
|
21
|
+
*/
|
|
22
|
+
dateFormat?: string;
|
|
17
23
|
}
|
|
18
24
|
/**
|
|
19
|
-
* A single date picker. A
|
|
20
|
-
*
|
|
25
|
+
* A single date picker. A text field takes a typed date, and a calendar button
|
|
26
|
+
* beside it opens a calendar in a popover. Both change the same date.
|
|
21
27
|
*
|
|
22
|
-
* - The
|
|
23
|
-
*
|
|
24
|
-
* - The date is shown
|
|
25
|
-
*
|
|
28
|
+
* - The field and the button fill the width of their container, so size it by
|
|
29
|
+
* wrapping it in an element with a width.
|
|
30
|
+
* - The date is shown as `dd/MM/yyyy` unless `dateFormat` says otherwise.
|
|
31
|
+
* - A typed date is read when the user presses Enter or leaves the field. If it
|
|
32
|
+
* is not a real date, the field goes back to the last good date.
|
|
26
33
|
* - The calendar opens on the month of `date`, or on the current month when
|
|
27
34
|
* there is no date. With no date, today is highlighted as the selection.
|
|
28
35
|
* - A date can be changed but not cleared, because the calendar is in
|
|
29
|
-
* required single mode.
|
|
36
|
+
* required single mode and an emptied field goes back to the last date.
|
|
30
37
|
* - The popover is modal on purpose, so it still works inside a vaul drawer.
|
|
31
38
|
*/
|
|
32
|
-
declare const DatePicker: ({ onSelect, date }: IDatePicker) => react.JSX.Element;
|
|
39
|
+
declare const DatePicker: ({ onSelect, date, dateFormat, }: IDatePicker) => react.JSX.Element;
|
|
33
40
|
|
|
34
41
|
/**
|
|
35
42
|
* How the whole card is coloured. `success` is green, `warning` orange,
|
package/dist/index.d.ts
CHANGED
|
@@ -3,33 +3,40 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
|
|
4
4
|
interface IDatePicker {
|
|
5
5
|
/**
|
|
6
|
-
* Called with the chosen day when the user picks one
|
|
7
|
-
*
|
|
8
|
-
* without a pick
|
|
6
|
+
* Called with the chosen day when the user picks one in the calendar, or
|
|
7
|
+
* types a real date and presses Enter or leaves the field. It is not called
|
|
8
|
+
* when the popover is dismissed without a pick, or for text that is not a
|
|
9
|
+
* real date.
|
|
9
10
|
*/
|
|
10
11
|
onSelect: (date: Date) => void;
|
|
11
12
|
/**
|
|
12
|
-
* The selected date. The component is controlled: it never
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* The selected date. The component is controlled: it never decides the date
|
|
14
|
+
* itself, so update this from `onSelect` or the date will not change. Leave
|
|
15
|
+
* it empty (`undefined` or `null`) to show the placeholder.
|
|
15
16
|
*/
|
|
16
17
|
date?: Date | null;
|
|
18
|
+
/**
|
|
19
|
+
* How the date is shown and typed, as a date-fns format string. Defaults to
|
|
20
|
+
* `dd/MM/yyyy`. The placeholder is this in lower case.
|
|
21
|
+
*/
|
|
22
|
+
dateFormat?: string;
|
|
17
23
|
}
|
|
18
24
|
/**
|
|
19
|
-
* A single date picker. A
|
|
20
|
-
*
|
|
25
|
+
* A single date picker. A text field takes a typed date, and a calendar button
|
|
26
|
+
* beside it opens a calendar in a popover. Both change the same date.
|
|
21
27
|
*
|
|
22
|
-
* - The
|
|
23
|
-
*
|
|
24
|
-
* - The date is shown
|
|
25
|
-
*
|
|
28
|
+
* - The field and the button fill the width of their container, so size it by
|
|
29
|
+
* wrapping it in an element with a width.
|
|
30
|
+
* - The date is shown as `dd/MM/yyyy` unless `dateFormat` says otherwise.
|
|
31
|
+
* - A typed date is read when the user presses Enter or leaves the field. If it
|
|
32
|
+
* is not a real date, the field goes back to the last good date.
|
|
26
33
|
* - The calendar opens on the month of `date`, or on the current month when
|
|
27
34
|
* there is no date. With no date, today is highlighted as the selection.
|
|
28
35
|
* - A date can be changed but not cleared, because the calendar is in
|
|
29
|
-
* required single mode.
|
|
36
|
+
* required single mode and an emptied field goes back to the last date.
|
|
30
37
|
* - The popover is modal on purpose, so it still works inside a vaul drawer.
|
|
31
38
|
*/
|
|
32
|
-
declare const DatePicker: ({ onSelect, date }: IDatePicker) => react.JSX.Element;
|
|
39
|
+
declare const DatePicker: ({ onSelect, date, dateFormat, }: IDatePicker) => react.JSX.Element;
|
|
33
40
|
|
|
34
41
|
/**
|
|
35
42
|
* How the whole card is coloured. `success` is green, `warning` orange,
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/components/datePicker/DatePicker.tsx
|
|
4
|
-
import {
|
|
4
|
+
import { CalendarIcon } from "lucide-react";
|
|
5
5
|
|
|
6
6
|
// src/components/ui/calendar.tsx
|
|
7
7
|
import * as React from "react";
|
|
@@ -280,71 +280,130 @@ function PopoverContent({
|
|
|
280
280
|
}
|
|
281
281
|
) });
|
|
282
282
|
}
|
|
283
|
+
function PopoverAnchor({
|
|
284
|
+
...props
|
|
285
|
+
}) {
|
|
286
|
+
return /* @__PURE__ */ jsx3(PopoverPrimitive.Anchor, { "data-slot": "popover-anchor", ...props });
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// src/components/ui/input.tsx
|
|
290
|
+
import { cn as cn4 } from "cn";
|
|
291
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
292
|
+
function Input({ className, type, ...props }) {
|
|
293
|
+
return /* @__PURE__ */ jsx4(
|
|
294
|
+
"input",
|
|
295
|
+
{
|
|
296
|
+
type,
|
|
297
|
+
"data-slot": "input",
|
|
298
|
+
className: cn4(
|
|
299
|
+
"h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
300
|
+
className
|
|
301
|
+
),
|
|
302
|
+
...props
|
|
303
|
+
}
|
|
304
|
+
);
|
|
305
|
+
}
|
|
283
306
|
|
|
284
307
|
// src/components/datePicker/DatePicker.tsx
|
|
285
|
-
import { format } from "date-fns";
|
|
308
|
+
import { format, isSameDay, isValid, parse } from "date-fns";
|
|
286
309
|
import { useState } from "react";
|
|
287
|
-
import { jsx as
|
|
288
|
-
var
|
|
310
|
+
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
311
|
+
var DEFAULT_DATE_FORMAT = "dd/MM/yyyy";
|
|
312
|
+
var MIN_TYPED_YEAR = 1e3;
|
|
313
|
+
var parseTypedDate = (text, dateFormat) => {
|
|
314
|
+
const parsed = parse(text.trim(), dateFormat, /* @__PURE__ */ new Date());
|
|
315
|
+
if (!isValid(parsed) || parsed.getFullYear() < MIN_TYPED_YEAR) return null;
|
|
316
|
+
return parsed;
|
|
317
|
+
};
|
|
318
|
+
var formatDate = (date, dateFormat) => date ? format(date, dateFormat) : "";
|
|
319
|
+
var DatePicker = ({
|
|
320
|
+
onSelect,
|
|
321
|
+
date,
|
|
322
|
+
dateFormat = DEFAULT_DATE_FORMAT
|
|
323
|
+
}) => {
|
|
289
324
|
const [isOpen, setIsOpen] = useState(false);
|
|
290
|
-
const
|
|
325
|
+
const [typedText, setTypedText] = useState(formatDate(date, dateFormat));
|
|
326
|
+
const [shownDate, setShownDate] = useState(date);
|
|
327
|
+
if (date?.getTime() !== shownDate?.getTime()) {
|
|
328
|
+
setShownDate(date);
|
|
329
|
+
setTypedText(formatDate(date, dateFormat));
|
|
330
|
+
}
|
|
331
|
+
const handleCalendarSelect = (selectedDate) => {
|
|
332
|
+
setTypedText(formatDate(selectedDate, dateFormat));
|
|
291
333
|
onSelect(selectedDate);
|
|
292
334
|
setIsOpen(false);
|
|
293
335
|
};
|
|
336
|
+
const commitTypedText = () => {
|
|
337
|
+
const parsedDate = parseTypedDate(typedText, dateFormat);
|
|
338
|
+
if (!parsedDate) {
|
|
339
|
+
setTypedText(formatDate(date, dateFormat));
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
setTypedText(formatDate(parsedDate, dateFormat));
|
|
343
|
+
if (!date || !isSameDay(parsedDate, date)) onSelect(parsedDate);
|
|
344
|
+
};
|
|
294
345
|
return (
|
|
295
346
|
// Modal so the calendar re-enables pointer events for itself. Inside a vaul
|
|
296
347
|
// drawer the popover is portaled outside the drawer, and vaul bundles its
|
|
297
348
|
// own copy of Radix's layer package, so a non-modal popover inherits the
|
|
298
349
|
// drawer's pointer-events: none and its day buttons never receive clicks.
|
|
299
350
|
/* @__PURE__ */ jsxs(Popover, { modal: true, open: isOpen, onOpenChange: setIsOpen, children: [
|
|
300
|
-
/* @__PURE__ */
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
351
|
+
/* @__PURE__ */ jsx5(PopoverAnchor, { asChild: true, children: /* @__PURE__ */ jsxs("div", { className: "flex w-full gap-2", children: [
|
|
352
|
+
/* @__PURE__ */ jsx5(
|
|
353
|
+
Input,
|
|
354
|
+
{
|
|
355
|
+
value: typedText,
|
|
356
|
+
onChange: (event) => setTypedText(event.target.value),
|
|
357
|
+
onBlur: commitTypedText,
|
|
358
|
+
onKeyDown: (event) => {
|
|
359
|
+
if (event.key !== "Enter") return;
|
|
360
|
+
event.preventDefault();
|
|
361
|
+
commitTypedText();
|
|
362
|
+
},
|
|
363
|
+
placeholder: dateFormat.toLowerCase(),
|
|
364
|
+
autoComplete: "off",
|
|
365
|
+
"aria-label": "Date"
|
|
366
|
+
}
|
|
367
|
+
),
|
|
368
|
+
/* @__PURE__ */ jsx5(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx5(
|
|
369
|
+
Button,
|
|
370
|
+
{
|
|
371
|
+
type: "button",
|
|
372
|
+
variant: "outline",
|
|
373
|
+
size: "icon",
|
|
374
|
+
"aria-label": "Open calendar",
|
|
375
|
+
children: /* @__PURE__ */ jsx5(CalendarIcon, {})
|
|
376
|
+
}
|
|
377
|
+
) })
|
|
378
|
+
] }) }),
|
|
379
|
+
/* @__PURE__ */ jsx5(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx5(
|
|
380
|
+
Calendar,
|
|
314
381
|
{
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
classNames: { root: "w-full" },
|
|
321
|
-
mode: "single",
|
|
322
|
-
required: true,
|
|
323
|
-
selected: date ?? /* @__PURE__ */ new Date(),
|
|
324
|
-
onSelect: handleSelect,
|
|
325
|
-
defaultMonth: date ?? /* @__PURE__ */ new Date()
|
|
326
|
-
}
|
|
327
|
-
)
|
|
382
|
+
mode: "single",
|
|
383
|
+
required: true,
|
|
384
|
+
selected: date ?? /* @__PURE__ */ new Date(),
|
|
385
|
+
onSelect: handleCalendarSelect,
|
|
386
|
+
defaultMonth: date ?? /* @__PURE__ */ new Date()
|
|
328
387
|
}
|
|
329
|
-
)
|
|
388
|
+
) })
|
|
330
389
|
] })
|
|
331
390
|
);
|
|
332
391
|
};
|
|
333
392
|
|
|
334
393
|
// src/components/ui/card.tsx
|
|
335
|
-
import { cn as
|
|
336
|
-
import { jsx as
|
|
394
|
+
import { cn as cn5 } from "cn";
|
|
395
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
337
396
|
function Card({
|
|
338
397
|
className,
|
|
339
398
|
size = "default",
|
|
340
399
|
...props
|
|
341
400
|
}) {
|
|
342
|
-
return /* @__PURE__ */
|
|
401
|
+
return /* @__PURE__ */ jsx6(
|
|
343
402
|
"div",
|
|
344
403
|
{
|
|
345
404
|
"data-slot": "card",
|
|
346
405
|
"data-size": size,
|
|
347
|
-
className:
|
|
406
|
+
className: cn5(
|
|
348
407
|
"group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
|
|
349
408
|
className
|
|
350
409
|
),
|
|
@@ -353,18 +412,18 @@ function Card({
|
|
|
353
412
|
);
|
|
354
413
|
}
|
|
355
414
|
function CardContent({ className, ...props }) {
|
|
356
|
-
return /* @__PURE__ */
|
|
415
|
+
return /* @__PURE__ */ jsx6(
|
|
357
416
|
"div",
|
|
358
417
|
{
|
|
359
418
|
"data-slot": "card-content",
|
|
360
|
-
className:
|
|
419
|
+
className: cn5("px-(--card-spacing)", className),
|
|
361
420
|
...props
|
|
362
421
|
}
|
|
363
422
|
);
|
|
364
423
|
}
|
|
365
424
|
|
|
366
425
|
// src/lib/utils.ts
|
|
367
|
-
import { cn as
|
|
426
|
+
import { cn as cn6 } from "cn";
|
|
368
427
|
|
|
369
428
|
// src/components/jobCard/JobCardBannerBar.tsx
|
|
370
429
|
import { jsxs as jsxs2 } from "react/jsx-runtime";
|
|
@@ -374,7 +433,7 @@ var JobCardBannerBar = ({ banner }) => /* @__PURE__ */ jsxs2("div", { className:
|
|
|
374
433
|
] });
|
|
375
434
|
|
|
376
435
|
// src/components/jobCard/JobCardParts.tsx
|
|
377
|
-
import { jsx as
|
|
436
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
378
437
|
var DEFAULT_STAGE_COLOR = "#6b7280";
|
|
379
438
|
var BADGE_COLOR_CLASSES = {
|
|
380
439
|
gray: "bg-gray-300",
|
|
@@ -385,28 +444,28 @@ var BADGE_COLOR_CLASSES = {
|
|
|
385
444
|
blue: "bg-blue-300",
|
|
386
445
|
purple: "bg-purple-300"
|
|
387
446
|
};
|
|
388
|
-
var JobCardHeading = ({ title, stage, leadingContent }) => /* @__PURE__ */
|
|
447
|
+
var JobCardHeading = ({ title, stage, leadingContent }) => /* @__PURE__ */ jsx7("div", { className: "flex items-center gap-2 mb-1", children: /* @__PURE__ */ jsxs3("div", { className: "flex justify-between w-full", children: [
|
|
389
448
|
/* @__PURE__ */ jsxs3("span", { className: "flex items-center gap-2 font-bold text-base", children: [
|
|
390
449
|
leadingContent,
|
|
391
450
|
title
|
|
392
451
|
] }),
|
|
393
452
|
stage && /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
394
|
-
/* @__PURE__ */
|
|
453
|
+
/* @__PURE__ */ jsx7(
|
|
395
454
|
"span",
|
|
396
455
|
{
|
|
397
456
|
className: "w-2 h-2 rounded-full",
|
|
398
457
|
style: { backgroundColor: stage.color ?? DEFAULT_STAGE_COLOR }
|
|
399
458
|
}
|
|
400
459
|
),
|
|
401
|
-
/* @__PURE__ */
|
|
460
|
+
/* @__PURE__ */ jsx7("span", { className: "text-gray-900", children: stage.label })
|
|
402
461
|
] })
|
|
403
462
|
] }) });
|
|
404
|
-
var JobCardDetails = ({ details }) => /* @__PURE__ */
|
|
405
|
-
var JobCardCallouts = ({ callouts }) => /* @__PURE__ */
|
|
463
|
+
var JobCardDetails = ({ details }) => /* @__PURE__ */ jsx7("div", { className: "flex flex-col gap-1", children: details.map((detail, index) => /* @__PURE__ */ jsx7("div", { className: "text-xs text-gray-500", children: detail }, `${index}-${detail}`)) });
|
|
464
|
+
var JobCardCallouts = ({ callouts }) => /* @__PURE__ */ jsx7("div", { className: "flex justify-between w-full", children: /* @__PURE__ */ jsx7("div", { className: "text-xs my-1 w-full space-y-1", children: callouts.map((callout, index) => /* @__PURE__ */ jsx7(
|
|
406
465
|
"div",
|
|
407
466
|
{
|
|
408
467
|
className: "flex gap-2 items-center border p-2 rounded bg-white shadow",
|
|
409
|
-
children: /* @__PURE__ */
|
|
468
|
+
children: /* @__PURE__ */ jsx7("span", { children: callout })
|
|
410
469
|
},
|
|
411
470
|
`${index}-${callout}`
|
|
412
471
|
)) }) });
|
|
@@ -414,16 +473,16 @@ var JobCardSummary = ({
|
|
|
414
473
|
job,
|
|
415
474
|
leadingContent
|
|
416
475
|
}) => /* @__PURE__ */ jsxs3("div", { className: "w-full", children: [
|
|
417
|
-
/* @__PURE__ */
|
|
418
|
-
job.subtitle && /* @__PURE__ */
|
|
419
|
-
job.details && job.details.length > 0 && /* @__PURE__ */
|
|
420
|
-
job.description && /* @__PURE__ */
|
|
421
|
-
job.callouts && job.callouts.length > 0 && /* @__PURE__ */
|
|
476
|
+
/* @__PURE__ */ jsx7(JobCardHeading, { title: job.title, stage: job.stage, leadingContent }),
|
|
477
|
+
job.subtitle && /* @__PURE__ */ jsx7("div", { className: "text-[13px] text-gray-600 mb-1", children: job.subtitle }),
|
|
478
|
+
job.details && job.details.length > 0 && /* @__PURE__ */ jsx7(JobCardDetails, { details: job.details }),
|
|
479
|
+
job.description && /* @__PURE__ */ jsx7("div", { className: "text-sm text-gray-700 italic mt-1", children: job.description }),
|
|
480
|
+
job.callouts && job.callouts.length > 0 && /* @__PURE__ */ jsx7(JobCardCallouts, { callouts: job.callouts })
|
|
422
481
|
] });
|
|
423
482
|
var JobCardBadgeBlock = ({
|
|
424
483
|
badge,
|
|
425
484
|
hasPills
|
|
426
|
-
}) => /* @__PURE__ */
|
|
485
|
+
}) => /* @__PURE__ */ jsx7("div", { className: `flex pr-4 w-20 ${hasPills ? "border-r" : ""}`, children: /* @__PURE__ */ jsx7(
|
|
427
486
|
"span",
|
|
428
487
|
{
|
|
429
488
|
className: `flex items-center shadow border rounded px-4 py-1 text-center text-wrap ${BADGE_COLOR_CLASSES[badge.color]} ${hasPills ? "border-r" : ""}`,
|
|
@@ -432,7 +491,7 @@ var JobCardBadgeBlock = ({
|
|
|
432
491
|
) });
|
|
433
492
|
|
|
434
493
|
// src/components/jobCard/JobCardPills.tsx
|
|
435
|
-
import { jsx as
|
|
494
|
+
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
436
495
|
var PILL_BASE = "flex items-center gap-1 h-5 rounded-full text-center text-[10px] md:text-xs [&>svg]:w-3 [&>svg]:h-3";
|
|
437
496
|
var PILL_TONE_CLASSES = {
|
|
438
497
|
critical: "px-3 bg-red-500 text-white font-bold shadow-md shadow-red-900/70",
|
|
@@ -454,19 +513,19 @@ var JobCardPillList = ({ pills }) => {
|
|
|
454
513
|
const priorityPills = pills.filter((pill) => pill.priority);
|
|
455
514
|
const otherPills = pills.filter((pill) => !pill.priority);
|
|
456
515
|
return /* @__PURE__ */ jsxs4("div", { className: "flex gap-2 flex-wrap", children: [
|
|
457
|
-
priorityPills.length > 0 && /* @__PURE__ */
|
|
516
|
+
priorityPills.length > 0 && /* @__PURE__ */ jsx8(
|
|
458
517
|
"div",
|
|
459
518
|
{
|
|
460
519
|
className: `flex gap-2 w-full ${otherPills.length > 0 ? "pb-2 border-b" : ""}`,
|
|
461
|
-
children: priorityPills.map((pill) => /* @__PURE__ */
|
|
520
|
+
children: priorityPills.map((pill) => /* @__PURE__ */ jsx8(JobCardPillItem, { pill }, pill.label))
|
|
462
521
|
}
|
|
463
522
|
),
|
|
464
|
-
otherPills.map((pill) => /* @__PURE__ */
|
|
523
|
+
otherPills.map((pill) => /* @__PURE__ */ jsx8(JobCardPillItem, { pill }, pill.label))
|
|
465
524
|
] });
|
|
466
525
|
};
|
|
467
526
|
|
|
468
527
|
// src/components/jobCard/JobCard.tsx
|
|
469
|
-
import { jsx as
|
|
528
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
470
529
|
var CARD_TONE_CLASSES = {
|
|
471
530
|
success: "border-green-400 bg-green-50",
|
|
472
531
|
warning: "border-orange-400 bg-orange-50",
|
|
@@ -482,11 +541,11 @@ var JobCard = ({
|
|
|
482
541
|
className
|
|
483
542
|
}) => {
|
|
484
543
|
const hasPills = Boolean(job.pills && job.pills.length > 0);
|
|
485
|
-
return /* @__PURE__ */
|
|
544
|
+
return /* @__PURE__ */ jsx9(
|
|
486
545
|
Card,
|
|
487
546
|
{
|
|
488
547
|
onClick,
|
|
489
|
-
className:
|
|
548
|
+
className: cn6(
|
|
490
549
|
// The shadcn Card adds vertical padding, a gap, bigger corners and a
|
|
491
550
|
// ring. The card's own padding is set on CardContent below, so those
|
|
492
551
|
// are cancelled here to keep the original, tighter layout.
|
|
@@ -497,13 +556,13 @@ var JobCard = ({
|
|
|
497
556
|
className
|
|
498
557
|
),
|
|
499
558
|
children: /* @__PURE__ */ jsxs5(CardContent, { className: "p-3.5", children: [
|
|
500
|
-
/* @__PURE__ */
|
|
559
|
+
/* @__PURE__ */ jsx9("div", { className: "flex justify-between items-start mb-2", children: /* @__PURE__ */ jsx9(JobCardSummary, { job, leadingContent }) }),
|
|
501
560
|
(job.badge || hasPills) && /* @__PURE__ */ jsxs5("div", { className: "flex gap-2 text-xs", children: [
|
|
502
|
-
job.badge && /* @__PURE__ */
|
|
503
|
-
hasPills && /* @__PURE__ */
|
|
561
|
+
job.badge && /* @__PURE__ */ jsx9(JobCardBadgeBlock, { badge: job.badge, hasPills }),
|
|
562
|
+
hasPills && /* @__PURE__ */ jsx9(JobCardPillList, { pills: job.pills ?? [] })
|
|
504
563
|
] }),
|
|
505
|
-
job.banner && /* @__PURE__ */
|
|
506
|
-
action && /* @__PURE__ */
|
|
564
|
+
job.banner && /* @__PURE__ */ jsx9(JobCardBannerBar, { banner: job.banner }),
|
|
565
|
+
action && /* @__PURE__ */ jsx9(
|
|
507
566
|
Button,
|
|
508
567
|
{
|
|
509
568
|
onClick: (event) => {
|
|
@@ -516,7 +575,7 @@ var JobCard = ({
|
|
|
516
575
|
children: action.label
|
|
517
576
|
}
|
|
518
577
|
),
|
|
519
|
-
/* @__PURE__ */
|
|
578
|
+
/* @__PURE__ */ jsx9("div", { children: expandedContent })
|
|
520
579
|
] })
|
|
521
580
|
}
|
|
522
581
|
);
|