@betterinternship/components 3.2.6 → 3.2.8

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.
@@ -33,6 +33,11 @@ type FilterMenuCommon = {
33
33
  /** Shows a clear action (popover footer and sheet footer). */
34
34
  onClear?: () => void;
35
35
  clearLabel?: string;
36
+ /**
37
+ * How the popover's clear looks: a small link (default), or a quiet
38
+ * full-width button with an ✕, e.g. to match a neighbouring picker.
39
+ */
40
+ clearVariant?: "link" | "button";
36
41
  size?: "xs" | "sm" | "md";
37
42
  align?: "start" | "center" | "end";
38
43
  className?: string;
@@ -33,7 +33,7 @@ function CheckboxList({ items, className, "aria-label": label, }) {
33
33
  * secondary style), or ready-made `items` with your own `trigger`.
34
34
  */
35
35
  function FilterMenu(props) {
36
- const { label, trigger: customTrigger, title: titleProp, onClear, clearLabel = "Clear", size = "sm", align = "start", className, contentClassName, } = props;
36
+ const { label, trigger: customTrigger, title: titleProp, onClear, clearLabel = "Clear", clearVariant = "link", size = "sm", align = "start", className, contentClassName, } = props;
37
37
  const isMobile = useMobile();
38
38
  const [open, setOpen] = React.useState(false);
39
39
  const closeRef = React.useRef(null);
@@ -73,7 +73,7 @@ function FilterMenu(props) {
73
73
  event.preventDefault();
74
74
  closeRef.current?.focus();
75
75
  }, className: "flex flex-col gap-0 p-0 pb-[max(0.75rem,env(safe-area-inset-bottom))]", children: [jsxs("div", { className: "flex shrink-0 items-center justify-between gap-4 px-4 pb-1 pt-4", children: [jsx(SheetTitle, { className: "text-base font-semibold text-foreground", children: title }), jsx("button", { ref: closeRef, type: "button", "aria-label": "Close", className: "-mr-3 flex h-11 w-11 shrink-0 cursor-pointer items-center justify-center rounded-control-lg text-muted-foreground hover:bg-muted", onClick: () => setOpen(false), children: jsx(X, { className: "h-5 w-5", "aria-hidden": "true" }) })] }), jsx("div", { className: "min-h-0 flex-1 overflow-y-auto overscroll-contain px-2", children: list }), jsxs("div", { className: "flex shrink-0 gap-2 border-t border-border px-4 pt-3", children: [clearInSheet && (jsx(Button, { type: "button", variant: "ghost", scheme: "neutral", className: "flex-1", onClick: clearInSheet, children: clearLabel })), jsx(Button, { type: "button", variant: "outline", className: "flex-1", onClick: () => setOpen(false), children: "Done" })] })] }) })] }));
76
- return (jsxs(Popover, { open: open, onOpenChange: setOpen, children: [jsx(PopoverTrigger, { asChild: true, children: trigger }), jsxs(PopoverContent, { align: align, className: cn("w-56 p-0", contentClassName), children: [list, onClear && (jsx("div", { className: "border-t border-border p-option-inset", children: jsx(Button, { type: "button", variant: "link", scheme: "primary", size: "xs", onClick: onClear, children: clearLabel }) }))] })] }));
76
+ return (jsxs(Popover, { open: open, onOpenChange: setOpen, children: [jsx(PopoverTrigger, { asChild: true, children: trigger }), jsxs(PopoverContent, { align: align, className: cn("w-56 p-0", contentClassName), children: [list, onClear && (jsx("div", { className: "border-t border-border p-option-inset", children: clearVariant === "button" ? (jsxs(Button, { type: "button", variant: "ghost", scheme: "neutral", size: "sm", className: "w-full", onClick: onClear, children: [jsx(X, { size: 16, "aria-hidden": "true" }), clearLabel] })) : (jsx(Button, { type: "button", variant: "link", scheme: "primary", size: "xs", onClick: onClear, children: clearLabel })) }))] })] }));
77
77
  }
78
78
 
79
79
  export { CheckboxList, FilterMenu, optionListClassName, optionRowClassName };
@@ -1 +1 @@
1
- {"version":3,"file":"option-list.js","sources":["../../src/components/option-list.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { ChevronDown, X } from \"lucide-react\";\n\nimport { cn } from \"@/utils\";\nimport { useMobile } from \"@/hooks/use-mobile\";\nimport { Button } from \"./button\";\nimport { Checkbox } from \"./checkbox\";\nimport { FilterChip } from \"./filter-chip\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\nimport { Sheet, SheetContent, SheetTitle } from \"./sheet\";\n\n/*\n * The shared look for every list of options (menus, selects, dropdowns,\n * autocomplete, filter menus): the list is inset from its container's edge,\n * and each row is its own rounded box with a little space between rows, so\n * hover and selection read as distinct pills rather than full-bleed stripes.\n */\n\n/** Padding + row gap for a list of options inside a popover or sheet. */\nexport const optionListClassName = \"flex flex-col gap-option-gap p-option-inset\";\n\n/** One option row. Pair with a hover/focus or selected state as needed. */\nexport const optionRowClassName =\n \"relative flex min-h-option-row w-full cursor-pointer select-none items-center gap-3 rounded-control-sm px-option-x py-2 text-left text-sm text-foreground outline-none transition-colors duration-state hover:bg-muted focus-visible:bg-muted motion-reduce:transition-none max-md:min-h-11\";\n\nexport type CheckboxListItem = {\n label: React.ReactNode;\n checked: boolean;\n onCheckedChange: (checked: boolean) => void;\n /** Indents the row under a group heading row. */\n indent?: boolean;\n /** Bolder label, e.g. a group's \"All …\" row. */\n strong?: boolean;\n disabled?: boolean;\n};\n\n/** A list of checkbox rows in the shared option style. */\nexport function CheckboxList({\n items,\n className,\n \"aria-label\": label,\n}: {\n items: CheckboxListItem[];\n className?: string;\n \"aria-label\"?: string;\n}) {\n return (\n <ul\n aria-label={label}\n className={cn(\"m-0 list-none\", optionListClassName, className)}\n >\n {items.map((item, index) => (\n <li key={index}>\n <label\n className={cn(\n optionRowClassName,\n item.indent && \"pl-8\",\n item.strong && \"font-medium\",\n item.disabled && \"pointer-events-none opacity-50\",\n )}\n >\n <Checkbox\n checked={item.checked}\n disabled={item.disabled}\n onCheckedChange={(checked) =>\n item.onCheckedChange(checked === true)\n }\n />\n <span className=\"min-w-0 flex-1\">{item.label}</span>\n </label>\n </li>\n ))}\n </ul>\n );\n}\n\nexport type FilterMenuOption = { label: React.ReactNode; value: string };\n\ntype FilterMenuCommon = {\n /** The chip's label (and the sheet title when it's text). */\n label?: React.ReactNode;\n /** Replaces the default chip, e.g. a labelled field button. */\n trigger?: React.ReactElement<React.HTMLAttributes<HTMLElement>>;\n /** Sheet title / list name when `label` isn't plain text. */\n title?: string;\n /** Shows a clear action (popover footer and sheet footer). */\n onClear?: () => void;\n clearLabel?: string;\n size?: \"xs\" | \"sm\" | \"md\";\n align?: \"start\" | \"center\" | \"end\";\n className?: string;\n contentClassName?: string;\n};\n\n/** Simple filters: options in, selected values out. */\ntype FilterMenuOptionsProps = FilterMenuCommon & {\n options: FilterMenuOption[];\n /** The selected option values. */\n value: string[];\n onValueChange: (value: string[]) => void;\n items?: never;\n};\n\n/** Lists with their own rules (groups, indents): the rows themselves. */\ntype FilterMenuItemsProps = FilterMenuCommon & {\n items: CheckboxListItem[];\n options?: never;\n value?: never;\n onValueChange?: never;\n};\n\nexport type FilterMenuProps = FilterMenuOptionsProps | FilterMenuItemsProps;\n\n/**\n * A checklist behind a trigger: a dropdown on desktop and a bottom sheet\n * (with Clear and Done) on phones. Each tick applies immediately.\n *\n * Feed it either `options` + `value` + `onValueChange` (simple filters; the\n * default trigger is a FilterChip showing the count in the selected,\n * secondary style), or ready-made `items` with your own `trigger`.\n */\nexport function FilterMenu(props: FilterMenuProps) {\n const {\n label,\n trigger: customTrigger,\n title: titleProp,\n onClear,\n clearLabel = \"Clear\",\n size = \"sm\",\n align = \"start\",\n className,\n contentClassName,\n } = props;\n const isMobile = useMobile();\n const [open, setOpen] = React.useState(false);\n const closeRef = React.useRef<HTMLButtonElement>(null);\n\n // Both ways in become the same rows.\n const items: CheckboxListItem[] =\n props.items ??\n props.options.map((option) => ({\n label: option.label,\n checked: props.value.includes(option.value),\n onCheckedChange: (on) =>\n props.onValueChange(\n on\n ? [...props.value, option.value]\n : props.value.filter((item) => item !== option.value),\n ),\n }));\n const count = props.items\n ? props.items.filter((item) => item.checked).length\n : props.value.length;\n const title = titleProp ?? (typeof label === \"string\" ? label : \"Filter\");\n // The sheet always offers Clear while something's on; the popover only\n // when the caller asks for it.\n const clearInSheet =\n onClear ??\n (!props.items && count > 0 ? () => props.onValueChange([]) : undefined);\n\n const triggerProps = {\n \"aria-haspopup\": \"dialog\" as const,\n \"aria-expanded\": open,\n onClick: isMobile ? () => setOpen(true) : undefined,\n };\n const trigger = customTrigger ? (\n React.cloneElement(customTrigger, {\n ...triggerProps,\n onClick: (event: React.MouseEvent<HTMLElement>) => {\n customTrigger.props.onClick?.(event);\n triggerProps.onClick?.();\n },\n })\n ) : (\n <FilterChip\n size={size}\n selected={count > 0}\n count={count || undefined}\n className={className}\n {...triggerProps}\n >\n {label}\n <ChevronDown size={14} aria-hidden=\"true\" className=\"-mr-1\" />\n </FilterChip>\n );\n\n const list = <CheckboxList aria-label={title} items={items} />;\n\n // Phones: a bottom sheet, like Autocomplete and Select.\n if (isMobile)\n return (\n <>\n {trigger}\n <Sheet open={open} onOpenChange={setOpen}>\n <SheetContent\n side=\"bottom\"\n showCloseButton={false}\n overlayClassName=\"z-[1090] bg-black/25 backdrop-blur-[1px]\"\n aria-describedby={undefined}\n onOpenAutoFocus={(event) => {\n event.preventDefault();\n closeRef.current?.focus();\n }}\n className=\"flex flex-col gap-0 p-0 pb-[max(0.75rem,env(safe-area-inset-bottom))]\"\n >\n <div className=\"flex shrink-0 items-center justify-between gap-4 px-4 pb-1 pt-4\">\n <SheetTitle className=\"text-base font-semibold text-foreground\">\n {title}\n </SheetTitle>\n <button\n ref={closeRef}\n type=\"button\"\n aria-label=\"Close\"\n className=\"-mr-3 flex h-11 w-11 shrink-0 cursor-pointer items-center justify-center rounded-control-lg text-muted-foreground hover:bg-muted\"\n onClick={() => setOpen(false)}\n >\n <X className=\"h-5 w-5\" aria-hidden=\"true\" />\n </button>\n </div>\n <div className=\"min-h-0 flex-1 overflow-y-auto overscroll-contain px-2\">\n {list}\n </div>\n <div className=\"flex shrink-0 gap-2 border-t border-border px-4 pt-3\">\n {clearInSheet && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n scheme=\"neutral\"\n className=\"flex-1\"\n onClick={clearInSheet}\n >\n {clearLabel}\n </Button>\n )}\n {/* Outline, like Autocomplete's: ticks already applied, so\n Done only closes the sheet. */}\n <Button\n type=\"button\"\n variant=\"outline\"\n className=\"flex-1\"\n onClick={() => setOpen(false)}\n >\n Done\n </Button>\n </div>\n </SheetContent>\n </Sheet>\n </>\n );\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>{trigger}</PopoverTrigger>\n <PopoverContent\n align={align}\n className={cn(\"w-56 p-0\", contentClassName)}\n >\n {list}\n {onClear && (\n <div className=\"border-t border-border p-option-inset\">\n <Button\n type=\"button\"\n variant=\"link\"\n scheme=\"primary\"\n size=\"xs\"\n onClick={onClear}\n >\n {clearLabel}\n </Button>\n </div>\n )}\n </PopoverContent>\n </Popover>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAaA;;;;;AAKG;AAEH;AACO;AAEP;AACO;AAcP;AACM;;AAqCN;AAuCA;;;;;;;AAOG;AACG;AACJ;AAWA;AACA;;;AAIA;;;;;;AASU;AAEP;AACH;AACE;AACA;AACF;;;;;AAOA;AACE;AACA;AACA;;AAEF;AAEI;AACA;;AAEE;;;;;AAmBN;AACE;;AAWU;AACF;AAgDV;AAwBF;;"}
1
+ {"version":3,"file":"option-list.js","sources":["../../src/components/option-list.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { ChevronDown, X } from \"lucide-react\";\n\nimport { cn } from \"@/utils\";\nimport { useMobile } from \"@/hooks/use-mobile\";\nimport { Button } from \"./button\";\nimport { Checkbox } from \"./checkbox\";\nimport { FilterChip } from \"./filter-chip\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\nimport { Sheet, SheetContent, SheetTitle } from \"./sheet\";\n\n/*\n * The shared look for every list of options (menus, selects, dropdowns,\n * autocomplete, filter menus): the list is inset from its container's edge,\n * and each row is its own rounded box with a little space between rows, so\n * hover and selection read as distinct pills rather than full-bleed stripes.\n */\n\n/** Padding + row gap for a list of options inside a popover or sheet. */\nexport const optionListClassName = \"flex flex-col gap-option-gap p-option-inset\";\n\n/** One option row. Pair with a hover/focus or selected state as needed. */\nexport const optionRowClassName =\n \"relative flex min-h-option-row w-full cursor-pointer select-none items-center gap-3 rounded-control-sm px-option-x py-2 text-left text-sm text-foreground outline-none transition-colors duration-state hover:bg-muted focus-visible:bg-muted motion-reduce:transition-none max-md:min-h-11\";\n\nexport type CheckboxListItem = {\n label: React.ReactNode;\n checked: boolean;\n onCheckedChange: (checked: boolean) => void;\n /** Indents the row under a group heading row. */\n indent?: boolean;\n /** Bolder label, e.g. a group's \"All …\" row. */\n strong?: boolean;\n disabled?: boolean;\n};\n\n/** A list of checkbox rows in the shared option style. */\nexport function CheckboxList({\n items,\n className,\n \"aria-label\": label,\n}: {\n items: CheckboxListItem[];\n className?: string;\n \"aria-label\"?: string;\n}) {\n return (\n <ul\n aria-label={label}\n className={cn(\"m-0 list-none\", optionListClassName, className)}\n >\n {items.map((item, index) => (\n <li key={index}>\n <label\n className={cn(\n optionRowClassName,\n item.indent && \"pl-8\",\n item.strong && \"font-medium\",\n item.disabled && \"pointer-events-none opacity-50\",\n )}\n >\n <Checkbox\n checked={item.checked}\n disabled={item.disabled}\n onCheckedChange={(checked) =>\n item.onCheckedChange(checked === true)\n }\n />\n <span className=\"min-w-0 flex-1\">{item.label}</span>\n </label>\n </li>\n ))}\n </ul>\n );\n}\n\nexport type FilterMenuOption = { label: React.ReactNode; value: string };\n\ntype FilterMenuCommon = {\n /** The chip's label (and the sheet title when it's text). */\n label?: React.ReactNode;\n /** Replaces the default chip, e.g. a labelled field button. */\n trigger?: React.ReactElement<React.HTMLAttributes<HTMLElement>>;\n /** Sheet title / list name when `label` isn't plain text. */\n title?: string;\n /** Shows a clear action (popover footer and sheet footer). */\n onClear?: () => void;\n clearLabel?: string;\n /**\n * How the popover's clear looks: a small link (default), or a quiet\n * full-width button with an ✕, e.g. to match a neighbouring picker.\n */\n clearVariant?: \"link\" | \"button\";\n size?: \"xs\" | \"sm\" | \"md\";\n align?: \"start\" | \"center\" | \"end\";\n className?: string;\n contentClassName?: string;\n};\n\n/** Simple filters: options in, selected values out. */\ntype FilterMenuOptionsProps = FilterMenuCommon & {\n options: FilterMenuOption[];\n /** The selected option values. */\n value: string[];\n onValueChange: (value: string[]) => void;\n items?: never;\n};\n\n/** Lists with their own rules (groups, indents): the rows themselves. */\ntype FilterMenuItemsProps = FilterMenuCommon & {\n items: CheckboxListItem[];\n options?: never;\n value?: never;\n onValueChange?: never;\n};\n\nexport type FilterMenuProps = FilterMenuOptionsProps | FilterMenuItemsProps;\n\n/**\n * A checklist behind a trigger: a dropdown on desktop and a bottom sheet\n * (with Clear and Done) on phones. Each tick applies immediately.\n *\n * Feed it either `options` + `value` + `onValueChange` (simple filters; the\n * default trigger is a FilterChip showing the count in the selected,\n * secondary style), or ready-made `items` with your own `trigger`.\n */\nexport function FilterMenu(props: FilterMenuProps) {\n const {\n label,\n trigger: customTrigger,\n title: titleProp,\n onClear,\n clearLabel = \"Clear\",\n clearVariant = \"link\",\n size = \"sm\",\n align = \"start\",\n className,\n contentClassName,\n } = props;\n const isMobile = useMobile();\n const [open, setOpen] = React.useState(false);\n const closeRef = React.useRef<HTMLButtonElement>(null);\n\n // Both ways in become the same rows.\n const items: CheckboxListItem[] =\n props.items ??\n props.options.map((option) => ({\n label: option.label,\n checked: props.value.includes(option.value),\n onCheckedChange: (on) =>\n props.onValueChange(\n on\n ? [...props.value, option.value]\n : props.value.filter((item) => item !== option.value),\n ),\n }));\n const count = props.items\n ? props.items.filter((item) => item.checked).length\n : props.value.length;\n const title = titleProp ?? (typeof label === \"string\" ? label : \"Filter\");\n // The sheet always offers Clear while something's on; the popover only\n // when the caller asks for it.\n const clearInSheet =\n onClear ??\n (!props.items && count > 0 ? () => props.onValueChange([]) : undefined);\n\n const triggerProps = {\n \"aria-haspopup\": \"dialog\" as const,\n \"aria-expanded\": open,\n onClick: isMobile ? () => setOpen(true) : undefined,\n };\n const trigger = customTrigger ? (\n React.cloneElement(customTrigger, {\n ...triggerProps,\n onClick: (event: React.MouseEvent<HTMLElement>) => {\n customTrigger.props.onClick?.(event);\n triggerProps.onClick?.();\n },\n })\n ) : (\n <FilterChip\n size={size}\n selected={count > 0}\n count={count || undefined}\n className={className}\n {...triggerProps}\n >\n {label}\n <ChevronDown size={14} aria-hidden=\"true\" className=\"-mr-1\" />\n </FilterChip>\n );\n\n const list = <CheckboxList aria-label={title} items={items} />;\n\n // Phones: a bottom sheet, like Autocomplete and Select.\n if (isMobile)\n return (\n <>\n {trigger}\n <Sheet open={open} onOpenChange={setOpen}>\n <SheetContent\n side=\"bottom\"\n showCloseButton={false}\n overlayClassName=\"z-[1090] bg-black/25 backdrop-blur-[1px]\"\n aria-describedby={undefined}\n onOpenAutoFocus={(event) => {\n event.preventDefault();\n closeRef.current?.focus();\n }}\n className=\"flex flex-col gap-0 p-0 pb-[max(0.75rem,env(safe-area-inset-bottom))]\"\n >\n <div className=\"flex shrink-0 items-center justify-between gap-4 px-4 pb-1 pt-4\">\n <SheetTitle className=\"text-base font-semibold text-foreground\">\n {title}\n </SheetTitle>\n <button\n ref={closeRef}\n type=\"button\"\n aria-label=\"Close\"\n className=\"-mr-3 flex h-11 w-11 shrink-0 cursor-pointer items-center justify-center rounded-control-lg text-muted-foreground hover:bg-muted\"\n onClick={() => setOpen(false)}\n >\n <X className=\"h-5 w-5\" aria-hidden=\"true\" />\n </button>\n </div>\n <div className=\"min-h-0 flex-1 overflow-y-auto overscroll-contain px-2\">\n {list}\n </div>\n <div className=\"flex shrink-0 gap-2 border-t border-border px-4 pt-3\">\n {clearInSheet && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n scheme=\"neutral\"\n className=\"flex-1\"\n onClick={clearInSheet}\n >\n {clearLabel}\n </Button>\n )}\n {/* Outline, like Autocomplete's: ticks already applied, so\n Done only closes the sheet. */}\n <Button\n type=\"button\"\n variant=\"outline\"\n className=\"flex-1\"\n onClick={() => setOpen(false)}\n >\n Done\n </Button>\n </div>\n </SheetContent>\n </Sheet>\n </>\n );\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>{trigger}</PopoverTrigger>\n <PopoverContent\n align={align}\n className={cn(\"w-56 p-0\", contentClassName)}\n >\n {list}\n {onClear && (\n <div className=\"border-t border-border p-option-inset\">\n {clearVariant === \"button\" ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n scheme=\"neutral\"\n size=\"sm\"\n className=\"w-full\"\n onClick={onClear}\n >\n <X size={16} aria-hidden=\"true\" />\n {clearLabel}\n </Button>\n ) : (\n <Button\n type=\"button\"\n variant=\"link\"\n scheme=\"primary\"\n size=\"xs\"\n onClick={onClear}\n >\n {clearLabel}\n </Button>\n )}\n </div>\n )}\n </PopoverContent>\n </Popover>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAaA;;;;;AAKG;AAEH;AACO;AAEP;AACO;AAcP;AACM;;AAqCN;AA4CA;;;;;;;AAOG;AACG;AACJ;AAYA;AACA;;;AAIA;;;;;;AASU;AAEP;AACH;AACE;AACA;AACF;;;;;AAOA;AACE;AACA;AACA;;AAEF;AAEI;AACA;;AAEE;;;;;AAmBN;AACE;;AAWU;AACF;AAgDV;AAsCF;;"}
@@ -14,7 +14,7 @@ const TimelineItem = ({ number, status, title, subtitle, isLast = false, childre
14
14
  const isCheckmark = status === 'done' || number === -1;
15
15
  const isWaiting = status === 'waiting' && !isCheckmark;
16
16
  const isExclamation = fromMe;
17
- return (jsxs("div", { className: cn('relative flex items-start gap-3', !isLast && 'pb-6', className), children: [jsxs("div", { className: "relative flex w-7 shrink-0 self-stretch justify-center", children: [isCheckmark ? (jsx("div", { className: "relative z-10 flex size-7 shrink-0 items-center justify-center rounded-full bg-supportive-soft text-supportive-strong", children: jsx(CheckIcon, { className: "size-4", strokeWidth: 2.75, "aria-hidden": "true" }) })) : isWaiting ? (jsx("div", { className: "relative z-10 flex size-7 shrink-0 items-center justify-center rounded-full bg-warning-soft text-warning-strong", children: jsx(ClockIcon, { className: "size-4.5 translate-x-[0.5px]", strokeWidth: 2.5, "aria-hidden": "true" }) })) : isExclamation ? (jsx("div", { className: "relative z-10 flex size-7 shrink-0 items-center justify-center rounded-full bg-primary-selected text-primary", children: jsx(MailWarningIcon, { className: "size-4", strokeWidth: 2.5, "aria-hidden": "true" }) })) : (jsx("div", { className: "relative z-10 flex size-7 shrink-0 items-center justify-center rounded-full border border-input bg-muted text-xs font-semibold text-muted-foreground", children: number })), !isLast && jsx("div", { "aria-hidden": "true", className: "absolute -bottom-5 top-8 w-px bg-border" })] }), jsxs("div", { className: "flex min-w-0 flex-1 flex-wrap items-start justify-between gap-x-3 gap-y-2", children: [jsxs("div", { className: "min-w-0 flex-1", children: [jsxs("div", { className: "flex min-h-7 flex-wrap items-center gap-2", children: [fromMe ? (jsx("div", { className: "text-sm font-semibold text-primary", children: title })) : (jsx("div", { className: "text-sm font-medium text-foreground", children: title })), isMe && (
17
+ return (jsxs("div", { className: cn('relative flex items-start gap-3', !isLast && 'pb-6', className), children: [jsxs("div", { className: "relative flex w-7 shrink-0 self-stretch justify-center", children: [isCheckmark ? (jsx("div", { className: "relative z-10 flex size-7 shrink-0 items-center justify-center rounded-full bg-supportive-soft text-supportive-strong", children: jsx(CheckIcon, { className: "size-4", strokeWidth: 2.75, "aria-hidden": "true" }) })) : isWaiting ? (jsx("div", { className: "relative z-10 flex size-7 shrink-0 items-center justify-center rounded-full bg-warning-soft text-warning-strong", children: jsx(ClockIcon, { className: "size-4.5 translate-x-[0.5px]", strokeWidth: 2.5, "aria-hidden": "true" }) })) : isExclamation ? (jsx("div", { className: "relative z-10 flex size-7 shrink-0 items-center justify-center rounded-full bg-primary-selected text-primary", children: jsx(MailWarningIcon, { className: "size-4", strokeWidth: 2.5, "aria-hidden": "true" }) })) : (jsx("div", { className: "relative z-10 flex size-7 shrink-0 items-center justify-center rounded-full border border-input bg-muted text-xs font-semibold text-muted-foreground", children: number })), !isLast && jsx("div", { "aria-hidden": "true", className: "absolute -bottom-5 top-8 w-px bg-border" })] }), jsxs("div", { className: "flex min-w-0 flex-1 flex-wrap items-start justify-between gap-x-3 gap-y-2", children: [jsxs("div", { className: "min-w-0 flex-1 basis-48", children: [jsxs("div", { className: "flex min-h-7 flex-wrap items-center gap-2", children: [fromMe ? (jsx("div", { className: "text-sm font-semibold text-primary", children: title })) : (jsx("div", { className: "text-sm font-medium text-foreground", children: title })), isMe && (
18
18
  // The waiting clock's colours (warning-soft, -strong), semibold.
19
19
  jsx(Badge, { variant: "soft", type: "warning", className: "font-semibold", children: "You" }))] }), subtitle && (jsx("div", { className: "text-sm leading-snug text-muted-foreground", children: subtitle }))] }), children && jsx("div", { className: "flex min-h-7 shrink-0 items-center", children: children })] })] }));
20
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"timeline.js","sources":["../../src/components/timeline.tsx"],"sourcesContent":["import React from \"react\";\nimport { CheckIcon, ClockIcon, MailWarningIcon } from \"lucide-react\";\nimport { Badge } from './badge';\nimport { cn } from '@/utils';\n\nexport const Timeline = ({ children, className }: { children: React.ReactNode; className?: string }) => {\n return <div className={cn('w-full', className)}>{children}</div>;\n};\n\ninterface TimelineItemProps {\n number: number;\n /**\n * The step's state, shown in its circle: `done` is the green check (as\n * `number={-1}`), `waiting` a yellow clock for the step it's currently\n * waiting on. Otherwise the step's number.\n */\n status?: 'done' | 'waiting';\n title: string | React.ReactNode;\n subtitle?: React.ReactNode;\n isLast?: boolean;\n children?: React.ReactNode;\n fromMe?: boolean;\n isMe?: boolean;\n className?: string;\n}\n\nexport const TimelineItem = ({\n number,\n status,\n title,\n subtitle,\n isLast = false,\n children,\n fromMe,\n isMe,\n className,\n}: TimelineItemProps) => {\n // Marked steps are soft, like the badges: done and waiting take the\n // \"Completed\" / \"Waiting for recipients\" colours (-soft tint, -strong\n // icon), \"from me\" the primary-selected tint; no ring.\n // 28px circles, icons at a heavier stroke so they hold up in the tint.\n const isCheckmark = status === 'done' || number === -1;\n const isWaiting = status === 'waiting' && !isCheckmark;\n const isExclamation = fromMe;\n\n return (\n <div className={cn('relative flex items-start gap-3', !isLast && 'pb-6', className)}>\n <div className=\"relative flex w-7 shrink-0 self-stretch justify-center\">\n {isCheckmark ? (\n <div className=\"relative z-10 flex size-7 shrink-0 items-center justify-center rounded-full bg-supportive-soft text-supportive-strong\">\n <CheckIcon className=\"size-4\" strokeWidth={2.75} aria-hidden=\"true\" />\n </div>\n ) : isWaiting ? (\n <div className=\"relative z-10 flex size-7 shrink-0 items-center justify-center rounded-full bg-warning-soft text-warning-strong\">\n {/* A size up from the check, and half a pixel right: the clock's\n lopsided hands (up and to the right) read as off-centre\n though the glyph is geometrically centred. */}\n <ClockIcon className=\"size-4.5 translate-x-[0.5px]\" strokeWidth={2.5} aria-hidden=\"true\" />\n </div>\n ) : isExclamation ? (\n <div className=\"relative z-10 flex size-7 shrink-0 items-center justify-center rounded-full bg-primary-selected text-primary\">\n <MailWarningIcon className=\"size-4\" strokeWidth={2.5} aria-hidden=\"true\" />\n </div>\n ) : (\n <div className=\"relative z-10 flex size-7 shrink-0 items-center justify-center rounded-full border border-input bg-muted text-xs font-semibold text-muted-foreground\">\n {number}\n </div>\n )}\n {!isLast && <div aria-hidden=\"true\" className=\"absolute -bottom-5 top-8 w-px bg-border\" />}\n </div>\n\n {/* Content */}\n <div className=\"flex min-w-0 flex-1 flex-wrap items-start justify-between gap-x-3 gap-y-2\">\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex min-h-7 flex-wrap items-center gap-2\">\n {fromMe ? (\n <div className=\"text-sm font-semibold text-primary\">{title}</div>\n ) : (\n <div className=\"text-sm font-medium text-foreground\">{title}</div>\n )}\n {isMe && (\n // The waiting clock's colours (warning-soft, -strong), semibold.\n <Badge variant=\"soft\" type=\"warning\" className=\"font-semibold\">\n You\n </Badge>\n )}\n </div>\n {/* Snug under the title: a one-line detail (an email, a name), not\n prose, so it shouldn't float with prose leading. */}\n {subtitle && (\n <div className=\"text-sm leading-snug text-muted-foreground\">{subtitle}</div>\n )}\n </div>\n {children && <div className=\"flex min-h-7 shrink-0 items-center\">{children}</div>}\n </div>\n </div>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;AAKO,MAAM,QAAQ,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAqD,KAAI;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,EAAc,MAAM,GAAG,EAAA,CACvE,KAENA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,sJAAsJ,YAClK,MAAM,EAAA,CACH,CACP,EACA,CAAC,MAAM,IAAIA,4BAAiB,MAAM,EAAC,SAAS,EAAC,yCAAyC,GAAG,CAAA,EAAA,CACtF,EAGNC,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,2EAA2E,EAAA,QAAA,EAAA,CACxFA,cAAK,SAAS,EAAC,gBAAgB,EAAA,QAAA,EAAA,CAC7BA,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,2CAA2C,EAAA,QAAA,EAAA,CACvD,MAAM,IACLD,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,oCAAoC,YAAE,KAAK,EAAA,CAAO,KAEjEA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,qCAAqC,EAAA,QAAA,EAAE,KAAK,GAAO,CACnE,EACA,IAAI;;AAEH,oCAAAA,GAAA,CAAC,KAAK,EAAA,EAAC,OAAO,EAAC,MAAM,EAAC,IAAI,EAAC,SAAS,EAAC,SAAS,EAAC,eAAe,EAAA,QAAA,EAAA,KAAA,EAAA,CAEtD,CACT,IACG,EAGL,QAAQ,KACPA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,4CAA4C,EAAA,QAAA,EAAE,QAAQ,GAAO,CAC7E,CAAA,EAAA,CACG,EACL,QAAQ,IAAIA,aAAK,SAAS,EAAC,oCAAoC,EAAA,QAAA,EAAE,QAAQ,GAAO,CAAA,EAAA,CAC7E,CAAA,EAAA,CACF;AAEV;;;;"}
1
+ {"version":3,"file":"timeline.js","sources":["../../src/components/timeline.tsx"],"sourcesContent":["import React from \"react\";\nimport { CheckIcon, ClockIcon, MailWarningIcon } from \"lucide-react\";\nimport { Badge } from './badge';\nimport { cn } from '@/utils';\n\nexport const Timeline = ({ children, className }: { children: React.ReactNode; className?: string }) => {\n return <div className={cn('w-full', className)}>{children}</div>;\n};\n\ninterface TimelineItemProps {\n number: number;\n /**\n * The step's state, shown in its circle: `done` is the green check (as\n * `number={-1}`), `waiting` a yellow clock for the step it's currently\n * waiting on. Otherwise the step's number.\n */\n status?: 'done' | 'waiting';\n title: string | React.ReactNode;\n subtitle?: React.ReactNode;\n isLast?: boolean;\n children?: React.ReactNode;\n fromMe?: boolean;\n isMe?: boolean;\n className?: string;\n}\n\nexport const TimelineItem = ({\n number,\n status,\n title,\n subtitle,\n isLast = false,\n children,\n fromMe,\n isMe,\n className,\n}: TimelineItemProps) => {\n // Marked steps are soft, like the badges: done and waiting take the\n // \"Completed\" / \"Waiting for recipients\" colours (-soft tint, -strong\n // icon), \"from me\" the primary-selected tint; no ring.\n // 28px circles, icons at a heavier stroke so they hold up in the tint.\n const isCheckmark = status === 'done' || number === -1;\n const isWaiting = status === 'waiting' && !isCheckmark;\n const isExclamation = fromMe;\n\n return (\n <div className={cn('relative flex items-start gap-3', !isLast && 'pb-6', className)}>\n <div className=\"relative flex w-7 shrink-0 self-stretch justify-center\">\n {isCheckmark ? (\n <div className=\"relative z-10 flex size-7 shrink-0 items-center justify-center rounded-full bg-supportive-soft text-supportive-strong\">\n <CheckIcon className=\"size-4\" strokeWidth={2.75} aria-hidden=\"true\" />\n </div>\n ) : isWaiting ? (\n <div className=\"relative z-10 flex size-7 shrink-0 items-center justify-center rounded-full bg-warning-soft text-warning-strong\">\n {/* A size up from the check, and half a pixel right: the clock's\n lopsided hands (up and to the right) read as off-centre\n though the glyph is geometrically centred. */}\n <ClockIcon className=\"size-4.5 translate-x-[0.5px]\" strokeWidth={2.5} aria-hidden=\"true\" />\n </div>\n ) : isExclamation ? (\n <div className=\"relative z-10 flex size-7 shrink-0 items-center justify-center rounded-full bg-primary-selected text-primary\">\n <MailWarningIcon className=\"size-4\" strokeWidth={2.5} aria-hidden=\"true\" />\n </div>\n ) : (\n <div className=\"relative z-10 flex size-7 shrink-0 items-center justify-center rounded-full border border-input bg-muted text-xs font-semibold text-muted-foreground\">\n {number}\n </div>\n )}\n {!isLast && <div aria-hidden=\"true\" className=\"absolute -bottom-5 top-8 w-px bg-border\" />}\n </div>\n\n {/* Content */}\n <div className=\"flex min-w-0 flex-1 flex-wrap items-start justify-between gap-x-3 gap-y-2\">\n {/* At least 12rem for the title and subtitle: on narrow screens the\n right slot (children) wraps below instead of squeezing the title\n into a sliver. */}\n <div className=\"min-w-0 flex-1 basis-48\">\n <div className=\"flex min-h-7 flex-wrap items-center gap-2\">\n {fromMe ? (\n <div className=\"text-sm font-semibold text-primary\">{title}</div>\n ) : (\n <div className=\"text-sm font-medium text-foreground\">{title}</div>\n )}\n {isMe && (\n // The waiting clock's colours (warning-soft, -strong), semibold.\n <Badge variant=\"soft\" type=\"warning\" className=\"font-semibold\">\n You\n </Badge>\n )}\n </div>\n {/* Snug under the title: a one-line detail (an email, a name), not\n prose, so it shouldn't float with prose leading. */}\n {subtitle && (\n <div className=\"text-sm leading-snug text-muted-foreground\">{subtitle}</div>\n )}\n </div>\n {children && <div className=\"flex min-h-7 shrink-0 items-center\">{children}</div>}\n </div>\n </div>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;AAKO,MAAM,QAAQ,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAqD,KAAI;AACrG,IAAA,OAAOA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAO;AAClE;AAmBO,MAAM,YAAY,GAAG,CAAC,EAC3B,MAAM,EACN,MAAM,EACN,KAAK,EACL,QAAQ,EACR,MAAM,GAAG,KAAK,EACd,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,SAAS,GACS,KAAI;;;;;IAKtB,MAAM,WAAW,GAAG,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,EAAE;IACtD,MAAM,SAAS,GAAG,MAAM,KAAK,SAAS,IAAI,CAAC,WAA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