@processdynamics/components 0.1.1 → 0.1.3
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 +68 -0
- package/dist/index.cjs +191 -2
- package/dist/index.d.cts +131 -1
- package/dist/index.d.ts +131 -1
- package/dist/index.js +189 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -86,12 +86,80 @@ Behaviour to know about:
|
|
|
86
86
|
|
|
87
87
|
The full docs page, with live controls and stories, is in Storybook under Components, then DatePicker.
|
|
88
88
|
|
|
89
|
+
### JobCard
|
|
90
|
+
|
|
91
|
+
A card for one job: a title, and optionally a stage, subtitle, detail lines, description, callouts, badge, pills and a banner. It only displays what it is given, so it has no idea what a job is in any particular app. The using app turns its own job into a `JobCardData` and decides every word, colour and date format, which is what lets one card serve different projects.
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import { Flag } from "lucide-react";
|
|
95
|
+
import { JobCard, type JobCardData } from "@processdynamics/components";
|
|
96
|
+
|
|
97
|
+
const job: JobCardData = {
|
|
98
|
+
title: "PO-1001",
|
|
99
|
+
subtitle: "Acme Co",
|
|
100
|
+
tone: "warning",
|
|
101
|
+
stage: { label: "In progress", color: "#d97706" },
|
|
102
|
+
details: ["Created: 29 Oct 2026"],
|
|
103
|
+
badge: { label: "Gold", color: "yellow" },
|
|
104
|
+
pills: [
|
|
105
|
+
{ label: "Flagged", tone: "warning", icon: <Flag />, priority: true },
|
|
106
|
+
{ label: "Internal", tone: "blue" },
|
|
107
|
+
],
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
<JobCard
|
|
111
|
+
job={job}
|
|
112
|
+
onClick={() => openJob()}
|
|
113
|
+
action={{ label: "Send back", onClick: sendBack }}
|
|
114
|
+
/>;
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Write one small function in the app that maps its job (and anything derived from it, such as an age or a stage) to `JobCardData`. Keep the app's rules there: the card never imports the app's types, helpers or data hooks.
|
|
118
|
+
|
|
119
|
+
A worked example of that function is in `src/adapters/jobCard/exampleOrder/`, with stories under Adapters, then Job card, then Example order, in Storybook. It uses a made-up order type, and covers an age rule that stops the clock, stage colours, priority pills, formatted dates, a banner that pluralises, and a restricted "summary" view made just by leaving fields out. Copy the pattern, not the file. It isn't part of the published package, and each app keeps its own adapter next to its own types and helpers.
|
|
120
|
+
|
|
121
|
+
| Prop | Type | Description |
|
|
122
|
+
| --- | --- | --- |
|
|
123
|
+
| `job` | `JobCardData` | Required. What to show, already decided. |
|
|
124
|
+
| `onClick` | `() => void` | Called when the card is clicked. Without it the card isn't clickable. |
|
|
125
|
+
| `action` | `{ label, onClick, disabled? }` | A full width button at the bottom. Clicking it doesn't also call `onClick`. |
|
|
126
|
+
| `leadingContent` | `ReactNode` | Content before the title, for example a checkbox. |
|
|
127
|
+
| `expandedContent` | `ReactNode` | Extra content at the very bottom. |
|
|
128
|
+
| `className` | `string` | Extra classes for the card. |
|
|
129
|
+
|
|
130
|
+
The fields of `JobCardData`, all optional except `title`:
|
|
131
|
+
|
|
132
|
+
| Field | Description |
|
|
133
|
+
| --- | --- |
|
|
134
|
+
| `title` | The heading, for example a PO number. |
|
|
135
|
+
| `subtitle` | A line under the heading. |
|
|
136
|
+
| `stage` | `{ label, color? }`: shown top right beside a dot in any CSS colour. |
|
|
137
|
+
| `tone` | The card colour: `success` (green), `warning` (orange), `danger` (red) or `neutral` (grey, the default). |
|
|
138
|
+
| `details` | Short grey lines, one per entry. |
|
|
139
|
+
| `description` | Shown in italics. |
|
|
140
|
+
| `callouts` | Bordered boxes of text, one per entry. |
|
|
141
|
+
| `badge` | `{ label, color }`: a colour block beside the pills. |
|
|
142
|
+
| `pills` | `{ label, tone, icon?, priority? }[]`. Labels must be unique. |
|
|
143
|
+
| `banner` | `{ label, icon? }`: a pale blue notice bar across the bottom. |
|
|
144
|
+
|
|
145
|
+
Behaviour to know about:
|
|
146
|
+
|
|
147
|
+
- Leave a field out and its part of the card disappears.
|
|
148
|
+
- Pills marked `priority` lead, and a rule splits them from the others. With only priority pills there is no rule.
|
|
149
|
+
- Pill tones are `critical`, `warning`, `danger`, the soft tints `red`, `orange`, `green`, `blue` and `purple`, and the outlines `outline` and `dashed`. An icon can be any small svg, such as a lucide icon.
|
|
150
|
+
- The colour comes from `tone` only. The card colours and pill tints are fixed palette colours, because the shadcn theme has no success or warning colours to map them to.
|
|
151
|
+
|
|
152
|
+
The full docs page, with every prop and a story for each part, is in Storybook under Components, then JobCard.
|
|
153
|
+
|
|
89
154
|
## Project layout
|
|
90
155
|
|
|
91
156
|
```
|
|
92
157
|
.storybook/ Storybook config (main.ts registers the Tailwind Vite plugin)
|
|
93
158
|
src/
|
|
94
159
|
app/ Next host app and globals.css (theme tokens)
|
|
160
|
+
adapters/
|
|
161
|
+
jobCard/ adapters for the JobCard, one folder each (not published)
|
|
162
|
+
exampleOrder/ a neutral example of turning an app's job into JobCardData
|
|
95
163
|
components/
|
|
96
164
|
<name>/ one folder per component: Component.tsx and its stories
|
|
97
165
|
ui/ shadcn parts: button, calendar, popover
|
package/dist/index.cjs
CHANGED
|
@@ -31,7 +31,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
// src/components/index.ts
|
|
32
32
|
var index_exports = {};
|
|
33
33
|
__export(index_exports, {
|
|
34
|
-
DatePicker: () => DatePicker
|
|
34
|
+
DatePicker: () => DatePicker,
|
|
35
|
+
JobCard: () => JobCard
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(index_exports);
|
|
37
38
|
|
|
@@ -362,7 +363,195 @@ var DatePicker = ({ onSelect, date }) => {
|
|
|
362
363
|
] })
|
|
363
364
|
);
|
|
364
365
|
};
|
|
366
|
+
|
|
367
|
+
// src/components/ui/card.tsx
|
|
368
|
+
var import_cn4 = require("cn");
|
|
369
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
370
|
+
function Card({
|
|
371
|
+
className,
|
|
372
|
+
size = "default",
|
|
373
|
+
...props
|
|
374
|
+
}) {
|
|
375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
376
|
+
"div",
|
|
377
|
+
{
|
|
378
|
+
"data-slot": "card",
|
|
379
|
+
"data-size": size,
|
|
380
|
+
className: (0, import_cn4.cn)(
|
|
381
|
+
"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
|
+
className
|
|
383
|
+
),
|
|
384
|
+
...props
|
|
385
|
+
}
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
function CardContent({ className, ...props }) {
|
|
389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
390
|
+
"div",
|
|
391
|
+
{
|
|
392
|
+
"data-slot": "card-content",
|
|
393
|
+
className: (0, import_cn4.cn)("px-(--card-spacing)", className),
|
|
394
|
+
...props
|
|
395
|
+
}
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// src/lib/utils.ts
|
|
400
|
+
var import_cn5 = require("cn");
|
|
401
|
+
|
|
402
|
+
// src/components/jobCard/JobCardBannerBar.tsx
|
|
403
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
404
|
+
var JobCardBannerBar = ({ banner }) => /* @__PURE__ */ (0, import_jsx_runtime6.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
|
+
banner.icon,
|
|
406
|
+
banner.label
|
|
407
|
+
] });
|
|
408
|
+
|
|
409
|
+
// src/components/jobCard/JobCardParts.tsx
|
|
410
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
411
|
+
var DEFAULT_STAGE_COLOR = "#6b7280";
|
|
412
|
+
var BADGE_COLOR_CLASSES = {
|
|
413
|
+
gray: "bg-gray-300",
|
|
414
|
+
yellow: "bg-yellow-300",
|
|
415
|
+
red: "bg-red-300",
|
|
416
|
+
orange: "bg-orange-300",
|
|
417
|
+
green: "bg-green-300",
|
|
418
|
+
blue: "bg-blue-300",
|
|
419
|
+
purple: "bg-purple-300"
|
|
420
|
+
};
|
|
421
|
+
var JobCardHeading = ({ title, stage, leadingContent }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center gap-2 mb-1", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex justify-between w-full", children: [
|
|
422
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "flex items-center gap-2 font-bold text-base", children: [
|
|
423
|
+
leadingContent,
|
|
424
|
+
title
|
|
425
|
+
] }),
|
|
426
|
+
stage && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
427
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
428
|
+
"span",
|
|
429
|
+
{
|
|
430
|
+
className: "w-2 h-2 rounded-full",
|
|
431
|
+
style: { backgroundColor: stage.color ?? DEFAULT_STAGE_COLOR }
|
|
432
|
+
}
|
|
433
|
+
),
|
|
434
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-gray-900", children: stage.label })
|
|
435
|
+
] })
|
|
436
|
+
] }) });
|
|
437
|
+
var JobCardDetails = ({ details }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex flex-col gap-1", children: details.map((detail, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-xs text-gray-500", children: detail }, `${index}-${detail}`)) });
|
|
438
|
+
var JobCardCallouts = ({ callouts }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex justify-between w-full", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-xs my-1 w-full space-y-1", children: callouts.map((callout, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
439
|
+
"div",
|
|
440
|
+
{
|
|
441
|
+
className: "flex gap-2 items-center border p-2 rounded bg-white shadow",
|
|
442
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: callout })
|
|
443
|
+
},
|
|
444
|
+
`${index}-${callout}`
|
|
445
|
+
)) }) });
|
|
446
|
+
var JobCardSummary = ({
|
|
447
|
+
job,
|
|
448
|
+
leadingContent
|
|
449
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w-full", children: [
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(JobCardHeading, { title: job.title, stage: job.stage, leadingContent }),
|
|
451
|
+
job.subtitle && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-[13px] text-gray-600 mb-1", children: job.subtitle }),
|
|
452
|
+
job.details && job.details.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(JobCardDetails, { details: job.details }),
|
|
453
|
+
job.description && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-sm text-gray-700 italic mt-1", children: job.description }),
|
|
454
|
+
job.callouts && job.callouts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(JobCardCallouts, { callouts: job.callouts })
|
|
455
|
+
] });
|
|
456
|
+
var JobCardBadgeBlock = ({
|
|
457
|
+
badge,
|
|
458
|
+
hasPills
|
|
459
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `flex pr-4 w-20 ${hasPills ? "border-r" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
460
|
+
"span",
|
|
461
|
+
{
|
|
462
|
+
className: `flex items-center shadow border rounded px-4 py-1 text-center text-wrap ${BADGE_COLOR_CLASSES[badge.color]} ${hasPills ? "border-r" : ""}`,
|
|
463
|
+
children: badge.label
|
|
464
|
+
}
|
|
465
|
+
) });
|
|
466
|
+
|
|
467
|
+
// src/components/jobCard/JobCardPills.tsx
|
|
468
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
469
|
+
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
|
+
var PILL_TONE_CLASSES = {
|
|
471
|
+
critical: "px-3 bg-red-500 text-white font-bold shadow-md shadow-red-900/70",
|
|
472
|
+
warning: "px-3 bg-yellow-300 text-gray-900 font-bold shadow-md shadow-yellow-800/70",
|
|
473
|
+
danger: "px-4 border bg-red-400 text-white shadow",
|
|
474
|
+
red: "px-4 border bg-red-200 shadow",
|
|
475
|
+
orange: "px-4 border bg-orange-200 shadow",
|
|
476
|
+
green: "px-4 border bg-green-200 shadow",
|
|
477
|
+
blue: "px-4 border bg-blue-200 shadow",
|
|
478
|
+
purple: "px-4 border bg-purple-200 shadow",
|
|
479
|
+
outline: "px-3 border border-gray-300 bg-white text-gray-600",
|
|
480
|
+
dashed: "px-3 border border-dashed border-gray-400 bg-white text-gray-600"
|
|
481
|
+
};
|
|
482
|
+
var JobCardPillItem = ({ pill }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: `${PILL_BASE} ${PILL_TONE_CLASSES[pill.tone]}`, children: [
|
|
483
|
+
pill.icon,
|
|
484
|
+
pill.label
|
|
485
|
+
] });
|
|
486
|
+
var JobCardPillList = ({ pills }) => {
|
|
487
|
+
const priorityPills = pills.filter((pill) => pill.priority);
|
|
488
|
+
const otherPills = pills.filter((pill) => !pill.priority);
|
|
489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex gap-2 flex-wrap", children: [
|
|
490
|
+
priorityPills.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
491
|
+
"div",
|
|
492
|
+
{
|
|
493
|
+
className: `flex gap-2 w-full ${otherPills.length > 0 ? "pb-2 border-b" : ""}`,
|
|
494
|
+
children: priorityPills.map((pill) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(JobCardPillItem, { pill }, pill.label))
|
|
495
|
+
}
|
|
496
|
+
),
|
|
497
|
+
otherPills.map((pill) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(JobCardPillItem, { pill }, pill.label))
|
|
498
|
+
] });
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
// src/components/jobCard/JobCard.tsx
|
|
502
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
503
|
+
var CARD_TONE_CLASSES = {
|
|
504
|
+
success: "border-green-400 bg-green-50",
|
|
505
|
+
warning: "border-orange-400 bg-orange-50",
|
|
506
|
+
danger: "border-red-400 bg-red-50",
|
|
507
|
+
neutral: "border-gray-300 bg-gray-50"
|
|
508
|
+
};
|
|
509
|
+
var JobCard = ({
|
|
510
|
+
job,
|
|
511
|
+
onClick,
|
|
512
|
+
action,
|
|
513
|
+
leadingContent,
|
|
514
|
+
expandedContent,
|
|
515
|
+
className
|
|
516
|
+
}) => {
|
|
517
|
+
const hasPills = Boolean(job.pills && job.pills.length > 0);
|
|
518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
519
|
+
Card,
|
|
520
|
+
{
|
|
521
|
+
onClick,
|
|
522
|
+
className: (0, import_cn5.cn)(
|
|
523
|
+
"border-2 mb-2.5 active:scale-[0.98] transition-all hover:opacity-90",
|
|
524
|
+
onClick && "cursor-pointer",
|
|
525
|
+
CARD_TONE_CLASSES[job.tone ?? "neutral"],
|
|
526
|
+
className
|
|
527
|
+
),
|
|
528
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(CardContent, { className: "p-3.5", children: [
|
|
529
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex justify-between items-start mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(JobCardSummary, { job, leadingContent }) }),
|
|
530
|
+
(job.badge || hasPills) && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex gap-2 text-xs", children: [
|
|
531
|
+
job.badge && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(JobCardBadgeBlock, { badge: job.badge, hasPills }),
|
|
532
|
+
hasPills && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(JobCardPillList, { pills: job.pills ?? [] })
|
|
533
|
+
] }),
|
|
534
|
+
job.banner && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(JobCardBannerBar, { banner: job.banner }),
|
|
535
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
536
|
+
Button,
|
|
537
|
+
{
|
|
538
|
+
onClick: (event) => {
|
|
539
|
+
event.stopPropagation();
|
|
540
|
+
action.onClick();
|
|
541
|
+
},
|
|
542
|
+
className: "w-full mt-3 bg-white border border-gray-300 text-gray-700 rounded-lg py-2.5 text-sm font-normal hover:bg-gray-50",
|
|
543
|
+
variant: "outline",
|
|
544
|
+
disabled: action.disabled,
|
|
545
|
+
children: action.label
|
|
546
|
+
}
|
|
547
|
+
),
|
|
548
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: expandedContent })
|
|
549
|
+
] })
|
|
550
|
+
}
|
|
551
|
+
);
|
|
552
|
+
};
|
|
365
553
|
// Annotate the CommonJS export names for ESM import in node:
|
|
366
554
|
0 && (module.exports = {
|
|
367
|
-
DatePicker
|
|
555
|
+
DatePicker,
|
|
556
|
+
JobCard
|
|
368
557
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
2
3
|
|
|
3
4
|
interface IDatePicker {
|
|
4
5
|
/**
|
|
@@ -30,4 +31,133 @@ interface IDatePicker {
|
|
|
30
31
|
*/
|
|
31
32
|
declare const DatePicker: ({ onSelect, date }: IDatePicker) => react.JSX.Element;
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
/**
|
|
35
|
+
* How the whole card is coloured. `success` is green, `warning` orange,
|
|
36
|
+
* `danger` red and `neutral` grey. What each one means is up to the using app,
|
|
37
|
+
* for example an age or a status.
|
|
38
|
+
*/
|
|
39
|
+
type JobCardTone = "success" | "warning" | "danger" | "neutral";
|
|
40
|
+
/** The colours a badge can be. */
|
|
41
|
+
type JobCardColor = "gray" | "yellow" | "red" | "orange" | "green" | "blue" | "purple";
|
|
42
|
+
/**
|
|
43
|
+
* How a pill looks.
|
|
44
|
+
*
|
|
45
|
+
* - `critical`: solid red, bold, with a shadow. For the most urgent flag.
|
|
46
|
+
* - `warning`: solid yellow, bold, with a shadow. For a second priority flag.
|
|
47
|
+
* - `danger`: solid red, not bold.
|
|
48
|
+
* - `red`, `orange`, `green`, `blue`, `purple`: a soft tint.
|
|
49
|
+
* - `outline`: a plain grey outline.
|
|
50
|
+
* - `dashed`: a dashed outline, for something not final yet.
|
|
51
|
+
*/
|
|
52
|
+
type JobCardPillTone = "critical" | "warning" | "danger" | "red" | "orange" | "green" | "blue" | "purple" | "outline" | "dashed";
|
|
53
|
+
/** Where a job is in its life, shown top right of the card beside a coloured dot. */
|
|
54
|
+
interface JobCardStage {
|
|
55
|
+
/** The words shown, for example "In progress". */
|
|
56
|
+
label: string;
|
|
57
|
+
/** Any CSS colour for the dot. Defaults to grey. */
|
|
58
|
+
color?: string;
|
|
59
|
+
}
|
|
60
|
+
/** A block of colour to the left of the pills, for example a category. */
|
|
61
|
+
interface JobCardBadge {
|
|
62
|
+
/** The words shown. */
|
|
63
|
+
label: string;
|
|
64
|
+
/** The badge colour. */
|
|
65
|
+
color: JobCardColor;
|
|
66
|
+
}
|
|
67
|
+
/** A small rounded label, for example a flag or a requirement. */
|
|
68
|
+
interface JobCardPill {
|
|
69
|
+
/** The words shown. Also used as the React key, so keep them unique. */
|
|
70
|
+
label: string;
|
|
71
|
+
/** How the pill looks. */
|
|
72
|
+
tone: JobCardPillTone;
|
|
73
|
+
/** An icon before the label. Any 12 pixel svg, for example a lucide icon. */
|
|
74
|
+
icon?: ReactNode;
|
|
75
|
+
/**
|
|
76
|
+
* Priority pills lead, and are split from the others by a horizontal rule, so
|
|
77
|
+
* they read as a separate group.
|
|
78
|
+
*/
|
|
79
|
+
priority?: boolean;
|
|
80
|
+
}
|
|
81
|
+
/** A pale blue notice bar across the bottom of the card. */
|
|
82
|
+
interface JobCardBanner {
|
|
83
|
+
/** The words shown. */
|
|
84
|
+
label: string;
|
|
85
|
+
/** An icon before the label. Any 16 pixel svg, for example a lucide icon. */
|
|
86
|
+
icon?: ReactNode;
|
|
87
|
+
}
|
|
88
|
+
/** A full width button at the bottom of the card. */
|
|
89
|
+
interface JobCardAction {
|
|
90
|
+
/** The button text. */
|
|
91
|
+
label: string;
|
|
92
|
+
/** Called when the button is clicked. It doesn't also trigger the card's `onClick`. */
|
|
93
|
+
onClick: () => void;
|
|
94
|
+
/** Disables the button, for example while it is saving. */
|
|
95
|
+
disabled?: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Everything a JobCard shows, already decided. The card works out nothing: the
|
|
99
|
+
* using app turns its own job into this, so the card never needs to know the
|
|
100
|
+
* app's types, rules, wording or date formats.
|
|
101
|
+
*/
|
|
102
|
+
interface JobCardData {
|
|
103
|
+
/** The card's heading, for example a PO number. */
|
|
104
|
+
title: string;
|
|
105
|
+
/** A line under the heading, for example the customer. */
|
|
106
|
+
subtitle?: string;
|
|
107
|
+
/** Where the job is. Leave out to hide it. */
|
|
108
|
+
stage?: JobCardStage;
|
|
109
|
+
/** The card colour. Defaults to `neutral`. */
|
|
110
|
+
tone?: JobCardTone;
|
|
111
|
+
/** Short grey lines under the subtitle, for example "Created by: Sam Jones". */
|
|
112
|
+
details?: string[];
|
|
113
|
+
/** A description of the work, shown in italics. */
|
|
114
|
+
description?: string;
|
|
115
|
+
/** Bordered boxes of text under the description, one line each. */
|
|
116
|
+
callouts?: string[];
|
|
117
|
+
/** A colour block beside the pills. */
|
|
118
|
+
badge?: JobCardBadge;
|
|
119
|
+
/** Status pills. */
|
|
120
|
+
pills?: JobCardPill[];
|
|
121
|
+
/** A bar across the bottom of the card. */
|
|
122
|
+
banner?: JobCardBanner;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface JobCardProps {
|
|
126
|
+
/**
|
|
127
|
+
* What to show, already decided. The card works out nothing, so turn the
|
|
128
|
+
* app's own job into this before passing it in.
|
|
129
|
+
*/
|
|
130
|
+
job: JobCardData;
|
|
131
|
+
/**
|
|
132
|
+
* Called when the card is clicked. Without it the card isn't clickable and
|
|
133
|
+
* doesn't show a pointer.
|
|
134
|
+
*/
|
|
135
|
+
onClick?: () => void;
|
|
136
|
+
/**
|
|
137
|
+
* A full width button at the bottom of the card. Clicking it doesn't also
|
|
138
|
+
* call `onClick`.
|
|
139
|
+
*/
|
|
140
|
+
action?: JobCardAction;
|
|
141
|
+
/** Content before the title, for example a checkbox. */
|
|
142
|
+
leadingContent?: ReactNode;
|
|
143
|
+
/** Extra content at the very bottom of the card. */
|
|
144
|
+
expandedContent?: ReactNode;
|
|
145
|
+
/** Extra classes for the card, for example to change its margin. */
|
|
146
|
+
className?: string;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* A card for one job: a title, an optional stage, subtitle, detail lines,
|
|
150
|
+
* description, badge, pills and a banner, coloured by a tone.
|
|
151
|
+
*
|
|
152
|
+
* It only displays what it is given, so it has no idea what a job is in any
|
|
153
|
+
* particular app. The using app decides every word and colour, which is what
|
|
154
|
+
* lets one card serve different projects.
|
|
155
|
+
*
|
|
156
|
+
* - Leave a field out and its part of the card disappears.
|
|
157
|
+
* - Pills marked `priority` lead, split from the others by a rule.
|
|
158
|
+
* - The colour comes from `job.tone` only.
|
|
159
|
+
*/
|
|
160
|
+
declare const JobCard: ({ job, onClick, action, leadingContent, expandedContent, className, }: JobCardProps) => react.JSX.Element;
|
|
161
|
+
|
|
162
|
+
export { DatePicker, JobCard };
|
|
163
|
+
export type { JobCardAction, JobCardBadge, JobCardBanner, JobCardColor, JobCardData, JobCardPill, JobCardPillTone, JobCardProps, JobCardStage, JobCardTone };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
2
3
|
|
|
3
4
|
interface IDatePicker {
|
|
4
5
|
/**
|
|
@@ -30,4 +31,133 @@ interface IDatePicker {
|
|
|
30
31
|
*/
|
|
31
32
|
declare const DatePicker: ({ onSelect, date }: IDatePicker) => react.JSX.Element;
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
/**
|
|
35
|
+
* How the whole card is coloured. `success` is green, `warning` orange,
|
|
36
|
+
* `danger` red and `neutral` grey. What each one means is up to the using app,
|
|
37
|
+
* for example an age or a status.
|
|
38
|
+
*/
|
|
39
|
+
type JobCardTone = "success" | "warning" | "danger" | "neutral";
|
|
40
|
+
/** The colours a badge can be. */
|
|
41
|
+
type JobCardColor = "gray" | "yellow" | "red" | "orange" | "green" | "blue" | "purple";
|
|
42
|
+
/**
|
|
43
|
+
* How a pill looks.
|
|
44
|
+
*
|
|
45
|
+
* - `critical`: solid red, bold, with a shadow. For the most urgent flag.
|
|
46
|
+
* - `warning`: solid yellow, bold, with a shadow. For a second priority flag.
|
|
47
|
+
* - `danger`: solid red, not bold.
|
|
48
|
+
* - `red`, `orange`, `green`, `blue`, `purple`: a soft tint.
|
|
49
|
+
* - `outline`: a plain grey outline.
|
|
50
|
+
* - `dashed`: a dashed outline, for something not final yet.
|
|
51
|
+
*/
|
|
52
|
+
type JobCardPillTone = "critical" | "warning" | "danger" | "red" | "orange" | "green" | "blue" | "purple" | "outline" | "dashed";
|
|
53
|
+
/** Where a job is in its life, shown top right of the card beside a coloured dot. */
|
|
54
|
+
interface JobCardStage {
|
|
55
|
+
/** The words shown, for example "In progress". */
|
|
56
|
+
label: string;
|
|
57
|
+
/** Any CSS colour for the dot. Defaults to grey. */
|
|
58
|
+
color?: string;
|
|
59
|
+
}
|
|
60
|
+
/** A block of colour to the left of the pills, for example a category. */
|
|
61
|
+
interface JobCardBadge {
|
|
62
|
+
/** The words shown. */
|
|
63
|
+
label: string;
|
|
64
|
+
/** The badge colour. */
|
|
65
|
+
color: JobCardColor;
|
|
66
|
+
}
|
|
67
|
+
/** A small rounded label, for example a flag or a requirement. */
|
|
68
|
+
interface JobCardPill {
|
|
69
|
+
/** The words shown. Also used as the React key, so keep them unique. */
|
|
70
|
+
label: string;
|
|
71
|
+
/** How the pill looks. */
|
|
72
|
+
tone: JobCardPillTone;
|
|
73
|
+
/** An icon before the label. Any 12 pixel svg, for example a lucide icon. */
|
|
74
|
+
icon?: ReactNode;
|
|
75
|
+
/**
|
|
76
|
+
* Priority pills lead, and are split from the others by a horizontal rule, so
|
|
77
|
+
* they read as a separate group.
|
|
78
|
+
*/
|
|
79
|
+
priority?: boolean;
|
|
80
|
+
}
|
|
81
|
+
/** A pale blue notice bar across the bottom of the card. */
|
|
82
|
+
interface JobCardBanner {
|
|
83
|
+
/** The words shown. */
|
|
84
|
+
label: string;
|
|
85
|
+
/** An icon before the label. Any 16 pixel svg, for example a lucide icon. */
|
|
86
|
+
icon?: ReactNode;
|
|
87
|
+
}
|
|
88
|
+
/** A full width button at the bottom of the card. */
|
|
89
|
+
interface JobCardAction {
|
|
90
|
+
/** The button text. */
|
|
91
|
+
label: string;
|
|
92
|
+
/** Called when the button is clicked. It doesn't also trigger the card's `onClick`. */
|
|
93
|
+
onClick: () => void;
|
|
94
|
+
/** Disables the button, for example while it is saving. */
|
|
95
|
+
disabled?: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Everything a JobCard shows, already decided. The card works out nothing: the
|
|
99
|
+
* using app turns its own job into this, so the card never needs to know the
|
|
100
|
+
* app's types, rules, wording or date formats.
|
|
101
|
+
*/
|
|
102
|
+
interface JobCardData {
|
|
103
|
+
/** The card's heading, for example a PO number. */
|
|
104
|
+
title: string;
|
|
105
|
+
/** A line under the heading, for example the customer. */
|
|
106
|
+
subtitle?: string;
|
|
107
|
+
/** Where the job is. Leave out to hide it. */
|
|
108
|
+
stage?: JobCardStage;
|
|
109
|
+
/** The card colour. Defaults to `neutral`. */
|
|
110
|
+
tone?: JobCardTone;
|
|
111
|
+
/** Short grey lines under the subtitle, for example "Created by: Sam Jones". */
|
|
112
|
+
details?: string[];
|
|
113
|
+
/** A description of the work, shown in italics. */
|
|
114
|
+
description?: string;
|
|
115
|
+
/** Bordered boxes of text under the description, one line each. */
|
|
116
|
+
callouts?: string[];
|
|
117
|
+
/** A colour block beside the pills. */
|
|
118
|
+
badge?: JobCardBadge;
|
|
119
|
+
/** Status pills. */
|
|
120
|
+
pills?: JobCardPill[];
|
|
121
|
+
/** A bar across the bottom of the card. */
|
|
122
|
+
banner?: JobCardBanner;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface JobCardProps {
|
|
126
|
+
/**
|
|
127
|
+
* What to show, already decided. The card works out nothing, so turn the
|
|
128
|
+
* app's own job into this before passing it in.
|
|
129
|
+
*/
|
|
130
|
+
job: JobCardData;
|
|
131
|
+
/**
|
|
132
|
+
* Called when the card is clicked. Without it the card isn't clickable and
|
|
133
|
+
* doesn't show a pointer.
|
|
134
|
+
*/
|
|
135
|
+
onClick?: () => void;
|
|
136
|
+
/**
|
|
137
|
+
* A full width button at the bottom of the card. Clicking it doesn't also
|
|
138
|
+
* call `onClick`.
|
|
139
|
+
*/
|
|
140
|
+
action?: JobCardAction;
|
|
141
|
+
/** Content before the title, for example a checkbox. */
|
|
142
|
+
leadingContent?: ReactNode;
|
|
143
|
+
/** Extra content at the very bottom of the card. */
|
|
144
|
+
expandedContent?: ReactNode;
|
|
145
|
+
/** Extra classes for the card, for example to change its margin. */
|
|
146
|
+
className?: string;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* A card for one job: a title, an optional stage, subtitle, detail lines,
|
|
150
|
+
* description, badge, pills and a banner, coloured by a tone.
|
|
151
|
+
*
|
|
152
|
+
* It only displays what it is given, so it has no idea what a job is in any
|
|
153
|
+
* particular app. The using app decides every word and colour, which is what
|
|
154
|
+
* lets one card serve different projects.
|
|
155
|
+
*
|
|
156
|
+
* - Leave a field out and its part of the card disappears.
|
|
157
|
+
* - Pills marked `priority` lead, split from the others by a rule.
|
|
158
|
+
* - The colour comes from `job.tone` only.
|
|
159
|
+
*/
|
|
160
|
+
declare const JobCard: ({ job, onClick, action, leadingContent, expandedContent, className, }: JobCardProps) => react.JSX.Element;
|
|
161
|
+
|
|
162
|
+
export { DatePicker, JobCard };
|
|
163
|
+
export type { JobCardAction, JobCardBadge, JobCardBanner, JobCardColor, JobCardData, JobCardPill, JobCardPillTone, JobCardProps, JobCardStage, JobCardTone };
|
package/dist/index.js
CHANGED
|
@@ -330,6 +330,194 @@ var DatePicker = ({ onSelect, date }) => {
|
|
|
330
330
|
] })
|
|
331
331
|
);
|
|
332
332
|
};
|
|
333
|
+
|
|
334
|
+
// src/components/ui/card.tsx
|
|
335
|
+
import { cn as cn4 } from "cn";
|
|
336
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
337
|
+
function Card({
|
|
338
|
+
className,
|
|
339
|
+
size = "default",
|
|
340
|
+
...props
|
|
341
|
+
}) {
|
|
342
|
+
return /* @__PURE__ */ jsx5(
|
|
343
|
+
"div",
|
|
344
|
+
{
|
|
345
|
+
"data-slot": "card",
|
|
346
|
+
"data-size": size,
|
|
347
|
+
className: cn4(
|
|
348
|
+
"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
|
+
className
|
|
350
|
+
),
|
|
351
|
+
...props
|
|
352
|
+
}
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
function CardContent({ className, ...props }) {
|
|
356
|
+
return /* @__PURE__ */ jsx5(
|
|
357
|
+
"div",
|
|
358
|
+
{
|
|
359
|
+
"data-slot": "card-content",
|
|
360
|
+
className: cn4("px-(--card-spacing)", className),
|
|
361
|
+
...props
|
|
362
|
+
}
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// src/lib/utils.ts
|
|
367
|
+
import { cn as cn5 } from "cn";
|
|
368
|
+
|
|
369
|
+
// src/components/jobCard/JobCardBannerBar.tsx
|
|
370
|
+
import { jsxs as jsxs2 } from "react/jsx-runtime";
|
|
371
|
+
var JobCardBannerBar = ({ banner }) => /* @__PURE__ */ jsxs2("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: [
|
|
372
|
+
banner.icon,
|
|
373
|
+
banner.label
|
|
374
|
+
] });
|
|
375
|
+
|
|
376
|
+
// src/components/jobCard/JobCardParts.tsx
|
|
377
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
378
|
+
var DEFAULT_STAGE_COLOR = "#6b7280";
|
|
379
|
+
var BADGE_COLOR_CLASSES = {
|
|
380
|
+
gray: "bg-gray-300",
|
|
381
|
+
yellow: "bg-yellow-300",
|
|
382
|
+
red: "bg-red-300",
|
|
383
|
+
orange: "bg-orange-300",
|
|
384
|
+
green: "bg-green-300",
|
|
385
|
+
blue: "bg-blue-300",
|
|
386
|
+
purple: "bg-purple-300"
|
|
387
|
+
};
|
|
388
|
+
var JobCardHeading = ({ title, stage, leadingContent }) => /* @__PURE__ */ jsx6("div", { className: "flex items-center gap-2 mb-1", children: /* @__PURE__ */ jsxs3("div", { className: "flex justify-between w-full", children: [
|
|
389
|
+
/* @__PURE__ */ jsxs3("span", { className: "flex items-center gap-2 font-bold text-base", children: [
|
|
390
|
+
leadingContent,
|
|
391
|
+
title
|
|
392
|
+
] }),
|
|
393
|
+
stage && /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
394
|
+
/* @__PURE__ */ jsx6(
|
|
395
|
+
"span",
|
|
396
|
+
{
|
|
397
|
+
className: "w-2 h-2 rounded-full",
|
|
398
|
+
style: { backgroundColor: stage.color ?? DEFAULT_STAGE_COLOR }
|
|
399
|
+
}
|
|
400
|
+
),
|
|
401
|
+
/* @__PURE__ */ jsx6("span", { className: "text-gray-900", children: stage.label })
|
|
402
|
+
] })
|
|
403
|
+
] }) });
|
|
404
|
+
var JobCardDetails = ({ details }) => /* @__PURE__ */ jsx6("div", { className: "flex flex-col gap-1", children: details.map((detail, index) => /* @__PURE__ */ jsx6("div", { className: "text-xs text-gray-500", children: detail }, `${index}-${detail}`)) });
|
|
405
|
+
var JobCardCallouts = ({ callouts }) => /* @__PURE__ */ jsx6("div", { className: "flex justify-between w-full", children: /* @__PURE__ */ jsx6("div", { className: "text-xs my-1 w-full space-y-1", children: callouts.map((callout, index) => /* @__PURE__ */ jsx6(
|
|
406
|
+
"div",
|
|
407
|
+
{
|
|
408
|
+
className: "flex gap-2 items-center border p-2 rounded bg-white shadow",
|
|
409
|
+
children: /* @__PURE__ */ jsx6("span", { children: callout })
|
|
410
|
+
},
|
|
411
|
+
`${index}-${callout}`
|
|
412
|
+
)) }) });
|
|
413
|
+
var JobCardSummary = ({
|
|
414
|
+
job,
|
|
415
|
+
leadingContent
|
|
416
|
+
}) => /* @__PURE__ */ jsxs3("div", { className: "w-full", children: [
|
|
417
|
+
/* @__PURE__ */ jsx6(JobCardHeading, { title: job.title, stage: job.stage, leadingContent }),
|
|
418
|
+
job.subtitle && /* @__PURE__ */ jsx6("div", { className: "text-[13px] text-gray-600 mb-1", children: job.subtitle }),
|
|
419
|
+
job.details && job.details.length > 0 && /* @__PURE__ */ jsx6(JobCardDetails, { details: job.details }),
|
|
420
|
+
job.description && /* @__PURE__ */ jsx6("div", { className: "text-sm text-gray-700 italic mt-1", children: job.description }),
|
|
421
|
+
job.callouts && job.callouts.length > 0 && /* @__PURE__ */ jsx6(JobCardCallouts, { callouts: job.callouts })
|
|
422
|
+
] });
|
|
423
|
+
var JobCardBadgeBlock = ({
|
|
424
|
+
badge,
|
|
425
|
+
hasPills
|
|
426
|
+
}) => /* @__PURE__ */ jsx6("div", { className: `flex pr-4 w-20 ${hasPills ? "border-r" : ""}`, children: /* @__PURE__ */ jsx6(
|
|
427
|
+
"span",
|
|
428
|
+
{
|
|
429
|
+
className: `flex items-center shadow border rounded px-4 py-1 text-center text-wrap ${BADGE_COLOR_CLASSES[badge.color]} ${hasPills ? "border-r" : ""}`,
|
|
430
|
+
children: badge.label
|
|
431
|
+
}
|
|
432
|
+
) });
|
|
433
|
+
|
|
434
|
+
// src/components/jobCard/JobCardPills.tsx
|
|
435
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
436
|
+
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
|
+
var PILL_TONE_CLASSES = {
|
|
438
|
+
critical: "px-3 bg-red-500 text-white font-bold shadow-md shadow-red-900/70",
|
|
439
|
+
warning: "px-3 bg-yellow-300 text-gray-900 font-bold shadow-md shadow-yellow-800/70",
|
|
440
|
+
danger: "px-4 border bg-red-400 text-white shadow",
|
|
441
|
+
red: "px-4 border bg-red-200 shadow",
|
|
442
|
+
orange: "px-4 border bg-orange-200 shadow",
|
|
443
|
+
green: "px-4 border bg-green-200 shadow",
|
|
444
|
+
blue: "px-4 border bg-blue-200 shadow",
|
|
445
|
+
purple: "px-4 border bg-purple-200 shadow",
|
|
446
|
+
outline: "px-3 border border-gray-300 bg-white text-gray-600",
|
|
447
|
+
dashed: "px-3 border border-dashed border-gray-400 bg-white text-gray-600"
|
|
448
|
+
};
|
|
449
|
+
var JobCardPillItem = ({ pill }) => /* @__PURE__ */ jsxs4("span", { className: `${PILL_BASE} ${PILL_TONE_CLASSES[pill.tone]}`, children: [
|
|
450
|
+
pill.icon,
|
|
451
|
+
pill.label
|
|
452
|
+
] });
|
|
453
|
+
var JobCardPillList = ({ pills }) => {
|
|
454
|
+
const priorityPills = pills.filter((pill) => pill.priority);
|
|
455
|
+
const otherPills = pills.filter((pill) => !pill.priority);
|
|
456
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex gap-2 flex-wrap", children: [
|
|
457
|
+
priorityPills.length > 0 && /* @__PURE__ */ jsx7(
|
|
458
|
+
"div",
|
|
459
|
+
{
|
|
460
|
+
className: `flex gap-2 w-full ${otherPills.length > 0 ? "pb-2 border-b" : ""}`,
|
|
461
|
+
children: priorityPills.map((pill) => /* @__PURE__ */ jsx7(JobCardPillItem, { pill }, pill.label))
|
|
462
|
+
}
|
|
463
|
+
),
|
|
464
|
+
otherPills.map((pill) => /* @__PURE__ */ jsx7(JobCardPillItem, { pill }, pill.label))
|
|
465
|
+
] });
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
// src/components/jobCard/JobCard.tsx
|
|
469
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
470
|
+
var CARD_TONE_CLASSES = {
|
|
471
|
+
success: "border-green-400 bg-green-50",
|
|
472
|
+
warning: "border-orange-400 bg-orange-50",
|
|
473
|
+
danger: "border-red-400 bg-red-50",
|
|
474
|
+
neutral: "border-gray-300 bg-gray-50"
|
|
475
|
+
};
|
|
476
|
+
var JobCard = ({
|
|
477
|
+
job,
|
|
478
|
+
onClick,
|
|
479
|
+
action,
|
|
480
|
+
leadingContent,
|
|
481
|
+
expandedContent,
|
|
482
|
+
className
|
|
483
|
+
}) => {
|
|
484
|
+
const hasPills = Boolean(job.pills && job.pills.length > 0);
|
|
485
|
+
return /* @__PURE__ */ jsx8(
|
|
486
|
+
Card,
|
|
487
|
+
{
|
|
488
|
+
onClick,
|
|
489
|
+
className: cn5(
|
|
490
|
+
"border-2 mb-2.5 active:scale-[0.98] transition-all hover:opacity-90",
|
|
491
|
+
onClick && "cursor-pointer",
|
|
492
|
+
CARD_TONE_CLASSES[job.tone ?? "neutral"],
|
|
493
|
+
className
|
|
494
|
+
),
|
|
495
|
+
children: /* @__PURE__ */ jsxs5(CardContent, { className: "p-3.5", children: [
|
|
496
|
+
/* @__PURE__ */ jsx8("div", { className: "flex justify-between items-start mb-2", children: /* @__PURE__ */ jsx8(JobCardSummary, { job, leadingContent }) }),
|
|
497
|
+
(job.badge || hasPills) && /* @__PURE__ */ jsxs5("div", { className: "flex gap-2 text-xs", children: [
|
|
498
|
+
job.badge && /* @__PURE__ */ jsx8(JobCardBadgeBlock, { badge: job.badge, hasPills }),
|
|
499
|
+
hasPills && /* @__PURE__ */ jsx8(JobCardPillList, { pills: job.pills ?? [] })
|
|
500
|
+
] }),
|
|
501
|
+
job.banner && /* @__PURE__ */ jsx8(JobCardBannerBar, { banner: job.banner }),
|
|
502
|
+
action && /* @__PURE__ */ jsx8(
|
|
503
|
+
Button,
|
|
504
|
+
{
|
|
505
|
+
onClick: (event) => {
|
|
506
|
+
event.stopPropagation();
|
|
507
|
+
action.onClick();
|
|
508
|
+
},
|
|
509
|
+
className: "w-full mt-3 bg-white border border-gray-300 text-gray-700 rounded-lg py-2.5 text-sm font-normal hover:bg-gray-50",
|
|
510
|
+
variant: "outline",
|
|
511
|
+
disabled: action.disabled,
|
|
512
|
+
children: action.label
|
|
513
|
+
}
|
|
514
|
+
),
|
|
515
|
+
/* @__PURE__ */ jsx8("div", { children: expandedContent })
|
|
516
|
+
] })
|
|
517
|
+
}
|
|
518
|
+
);
|
|
519
|
+
};
|
|
333
520
|
export {
|
|
334
|
-
DatePicker
|
|
521
|
+
DatePicker,
|
|
522
|
+
JobCard
|
|
335
523
|
};
|