ppij-design-system 0.0.0-stage → 0.3.0
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/dist/banners.d.ts +31 -0
- package/dist/banners.js +18 -0
- package/dist/card-themes.d.ts +14 -0
- package/dist/card-themes.js +325 -0
- package/dist/components/account-menu.d.ts +24 -0
- package/dist/components/account-menu.js +13 -0
- package/dist/components/admin-drawer.d.ts +40 -0
- package/dist/components/admin-drawer.js +35 -0
- package/dist/components/alert-dialog.d.ts +16 -0
- package/dist/components/alert-dialog.js +39 -0
- package/dist/components/alert.d.ts +11 -0
- package/dist/components/alert.js +29 -0
- package/dist/components/avatar.d.ts +11 -0
- package/dist/components/avatar.js +22 -0
- package/dist/components/badge.d.ts +9 -0
- package/dist/components/badge.js +27 -0
- package/dist/components/banner-carousel.d.ts +14 -0
- package/dist/components/banner-carousel.js +90 -0
- package/dist/components/bottom-bar.d.ts +22 -0
- package/dist/components/bottom-bar.js +12 -0
- package/dist/components/button.d.ts +10 -0
- package/dist/components/button.js +37 -0
- package/dist/components/card-upload.d.ts +30 -0
- package/dist/components/card-upload.js +19 -0
- package/dist/components/card.d.ts +9 -0
- package/dist/components/card.js +24 -0
- package/dist/components/checkbox.d.ts +4 -0
- package/dist/components/checkbox.js +9 -0
- package/dist/components/data-table.d.ts +26 -0
- package/dist/components/data-table.js +17 -0
- package/dist/components/dialog.d.ts +17 -0
- package/dist/components/dialog.js +37 -0
- package/dist/components/drawer.d.ts +13 -0
- package/dist/components/drawer.js +34 -0
- package/dist/components/dropdown-menu.d.ts +25 -0
- package/dist/components/dropdown-menu.js +50 -0
- package/dist/components/editable-panel.d.ts +25 -0
- package/dist/components/editable-panel.js +18 -0
- package/dist/components/empty.d.ts +12 -0
- package/dist/components/empty.js +33 -0
- package/dist/components/file-upload.d.ts +28 -0
- package/dist/components/file-upload.js +21 -0
- package/dist/components/form-panel.d.ts +15 -0
- package/dist/components/form-panel.js +9 -0
- package/dist/components/funding-picker.d.ts +20 -0
- package/dist/components/funding-picker.js +16 -0
- package/dist/components/input.d.ts +3 -0
- package/dist/components/input.js +6 -0
- package/dist/components/invitation-card.d.ts +14 -0
- package/dist/components/invitation-card.js +13 -0
- package/dist/components/label.d.ts +4 -0
- package/dist/components/label.js +7 -0
- package/dist/components/member-card-block.d.ts +47 -0
- package/dist/components/member-card-block.js +329 -0
- package/dist/components/member-card.css +92 -0
- package/dist/components/member-card.d.ts +29 -0
- package/dist/components/member-card.js +22 -0
- package/dist/components/month-picker.d.ts +16 -0
- package/dist/components/month-picker.js +19 -0
- package/dist/components/offline-banner.d.ts +14 -0
- package/dist/components/offline-banner.js +14 -0
- package/dist/components/page-header.d.ts +14 -0
- package/dist/components/page-header.js +10 -0
- package/dist/components/phone-field.d.ts +25 -0
- package/dist/components/phone-field.js +64 -0
- package/dist/components/pill-radio.d.ts +21 -0
- package/dist/components/pill-radio.js +15 -0
- package/dist/components/portal-shell.d.ts +53 -0
- package/dist/components/portal-shell.js +19 -0
- package/dist/components/postcode-field.d.ts +26 -0
- package/dist/components/postcode-field.js +14 -0
- package/dist/components/progress.d.ts +4 -0
- package/dist/components/progress.js +8 -0
- package/dist/components/radio-group.d.ts +5 -0
- package/dist/components/radio-group.js +11 -0
- package/dist/components/review-panel.d.ts +20 -0
- package/dist/components/review-panel.js +14 -0
- package/dist/components/saving-indicator.d.ts +15 -0
- package/dist/components/saving-indicator.js +19 -0
- package/dist/components/scroll-area.d.ts +5 -0
- package/dist/components/scroll-area.js +13 -0
- package/dist/components/search-filter.d.ts +39 -0
- package/dist/components/search-filter.js +19 -0
- package/dist/components/segmented-progress.d.ts +16 -0
- package/dist/components/segmented-progress.js +12 -0
- package/dist/components/select.d.ts +15 -0
- package/dist/components/select.js +38 -0
- package/dist/components/separator.d.ts +4 -0
- package/dist/components/separator.js +7 -0
- package/dist/components/service-tiles.d.ts +26 -0
- package/dist/components/service-tiles.js +17 -0
- package/dist/components/sheet.d.ts +14 -0
- package/dist/components/sheet.js +40 -0
- package/dist/components/sidebar.d.ts +69 -0
- package/dist/components/sidebar.js +210 -0
- package/dist/components/skeleton.d.ts +11 -0
- package/dist/components/skeleton.js +11 -0
- package/dist/components/sonner.d.ts +9 -0
- package/dist/components/sonner.js +25 -0
- package/dist/components/spinner.d.ts +14 -0
- package/dist/components/spinner.js +22 -0
- package/dist/components/stat-card.d.ts +22 -0
- package/dist/components/stat-card.js +12 -0
- package/dist/components/status-card.d.ts +24 -0
- package/dist/components/status-card.js +26 -0
- package/dist/components/stepper.d.ts +25 -0
- package/dist/components/stepper.js +23 -0
- package/dist/components/submit-overlay.d.ts +16 -0
- package/dist/components/submit-overlay.js +15 -0
- package/dist/components/suggestion-sheet.d.ts +20 -0
- package/dist/components/suggestion-sheet.js +36 -0
- package/dist/components/switch.d.ts +6 -0
- package/dist/components/switch.js +8 -0
- package/dist/components/table.d.ts +10 -0
- package/dist/components/table.js +28 -0
- package/dist/components/tabs.d.ts +11 -0
- package/dist/components/tabs.js +28 -0
- package/dist/components/tag-input.d.ts +15 -0
- package/dist/components/tag-input.js +31 -0
- package/dist/components/textarea.d.ts +3 -0
- package/dist/components/textarea.js +6 -0
- package/dist/components/timeline.d.ts +18 -0
- package/dist/components/timeline.js +11 -0
- package/dist/components/todo-strip.d.ts +14 -0
- package/dist/components/todo-strip.js +11 -0
- package/dist/components/tooltip.d.ts +7 -0
- package/dist/components/tooltip.js +16 -0
- package/dist/components/top-bar.d.ts +23 -0
- package/dist/components/top-bar.js +14 -0
- package/dist/components/type-ahead.d.ts +20 -0
- package/dist/components/type-ahead.js +22 -0
- package/dist/components/unit-card.d.ts +26 -0
- package/dist/components/unit-card.js +18 -0
- package/dist/components/view-toggle.d.ts +20 -0
- package/dist/components/view-toggle.js +15 -0
- package/dist/components/wizard-footer.d.ts +24 -0
- package/dist/components/wizard-footer.js +17 -0
- package/dist/components/wizard-header.d.ts +29 -0
- package/dist/components/wizard-header.js +18 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +11 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +70 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +5 -0
- package/dist/sample-banners.d.ts +8 -0
- package/dist/sample-banners.js +28 -0
- package/dist/tokens.css +119 -0
- package/dist/tokens.json +50 -0
- package/package.json +60 -4
- package/README.md +0 -3
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type SuggestKind = "institution" | "major" | "minat" | "funding";
|
|
2
|
+
export interface SuggestionSheetProps {
|
|
3
|
+
kind: SuggestKind | null;
|
|
4
|
+
onDismiss: () => void;
|
|
5
|
+
name: string;
|
|
6
|
+
onNameChange: (name: string) => void;
|
|
7
|
+
onConfirm: () => void;
|
|
8
|
+
error?: string;
|
|
9
|
+
/** For institution suggestions the wizard shows the chosen prefecture as context. */
|
|
10
|
+
prefectureLabel?: string;
|
|
11
|
+
locale?: "id" | "en";
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The use-and-suggest sheet (WIZ106-13), extracted from the wizard
|
|
15
|
+
* SuggestionSheet on AdminDrawer: a TypeAhead "not in the list"
|
|
16
|
+
* action opens it with the typed text pre-filled; "Gunakan &
|
|
17
|
+
* sarankan" commits, and cancel, Escape, backdrop, and close never
|
|
18
|
+
* commit. The parent owns the name, the error, and the commit.
|
|
19
|
+
*/
|
|
20
|
+
export declare function SuggestionSheet({ kind, onDismiss, name, onNameChange, onConfirm, error, prefectureLabel, locale, }: SuggestionSheetProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AdminDrawer } from "./admin-drawer";
|
|
3
|
+
import { Button } from "./button";
|
|
4
|
+
import { Input } from "./input";
|
|
5
|
+
import { Label } from "./label";
|
|
6
|
+
const TITLES = {
|
|
7
|
+
institution: ["Sarankan institusi", "Suggest an institution"],
|
|
8
|
+
major: ["Sarankan jurusan", "Suggest a major"],
|
|
9
|
+
minat: ["Sarankan minat", "Suggest an interest"],
|
|
10
|
+
funding: ["Sarankan sumber dana", "Suggest a funding source"],
|
|
11
|
+
};
|
|
12
|
+
const NAME_LABELS = {
|
|
13
|
+
institution: ["Nama institusi", "Institution name"],
|
|
14
|
+
major: ["Nama jurusan", "Major name"],
|
|
15
|
+
minat: ["Nama minat", "Interest name"],
|
|
16
|
+
funding: ["Nama sumber dana", "Funding source name"],
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The use-and-suggest sheet (WIZ106-13), extracted from the wizard
|
|
20
|
+
* SuggestionSheet on AdminDrawer: a TypeAhead "not in the list"
|
|
21
|
+
* action opens it with the typed text pre-filled; "Gunakan &
|
|
22
|
+
* sarankan" commits, and cancel, Escape, backdrop, and close never
|
|
23
|
+
* commit. The parent owns the name, the error, and the commit.
|
|
24
|
+
*/
|
|
25
|
+
export function SuggestionSheet({ kind, onDismiss, name, onNameChange, onConfirm, error, prefectureLabel, locale = "id", }) {
|
|
26
|
+
const en = locale === "en";
|
|
27
|
+
return (_jsx(AdminDrawer, { open: kind !== null, onOpenChange: (open) => {
|
|
28
|
+
if (!open)
|
|
29
|
+
onDismiss();
|
|
30
|
+
}, locale: locale, title: kind ? (en ? TITLES[kind][1] : TITLES[kind][0]) : "", description: en ? "The name is queued for admin review; your registration can continue meanwhile." : "Nama diusulkan untuk ditinjau pengurus; pendaftaran tetap bisa dilanjutkan.", footer: _jsx(Button, { type: "submit", form: "ds-suggestion-form", children: en ? "Use & suggest" : "Gunakan & sarankan" }), children: _jsxs("form", { id: "ds-suggestion-form", className: "grid gap-4", onSubmit: (event) => {
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
onConfirm();
|
|
33
|
+
}, children: [_jsxs("div", { className: "grid gap-2", children: [_jsx(Label, { htmlFor: "ds-suggestion-name", children: kind ? (en ? NAME_LABELS[kind][1] : NAME_LABELS[kind][0]) : "" }), _jsx(Input, { id: "ds-suggestion-name", value: name, onChange: (event) => onNameChange(event.target.value), "aria-invalid": Boolean(error) || undefined, autoComplete: "off" })] }), kind === "institution" ? (_jsxs("p", { className: "text-sm text-brand-muted", children: [en ? "Prefecture" : "Prefektur", ": ", prefectureLabel ?? "—"] })) : null, error ? (_jsx("p", { role: "alert", className: "text-sm text-destructive", children: error })) : null, _jsx("p", { className: "text-sm leading-6 text-brand-muted", children: en
|
|
34
|
+
? "Your answer is used right away so registration can continue, and the name is proposed for the catalogue for admin review."
|
|
35
|
+
: "Jawaban ini langsung dipakai agar pendaftaran bisa lanjut, dan nama diusulkan ke katalog untuk ditinjau pengurus nasional." })] }) }));
|
|
36
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Switch as SwitchPrimitive } from "radix-ui";
|
|
3
|
+
declare function Switch({ className, size, ...props }: React.ComponentProps<typeof SwitchPrimitive.Root> & {
|
|
4
|
+
size?: "sm" | "default";
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
export { Switch };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Switch as SwitchPrimitive } from "radix-ui";
|
|
4
|
+
import { cn } from "../lib/utils";
|
|
5
|
+
function Switch({ className, size = "default", ...props }) {
|
|
6
|
+
return (_jsx(SwitchPrimitive.Root, { "data-slot": "switch", "data-size": size, className: cn("peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input", className), ...props, children: _jsx(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: cn("pointer-events-none block rounded-full bg-background shadow-xs ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0") }) }));
|
|
7
|
+
}
|
|
8
|
+
export { Switch };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function Table({ className, ...props }: React.ComponentProps<"table">): React.JSX.Element;
|
|
3
|
+
declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): React.JSX.Element;
|
|
4
|
+
declare function TableBody({ className, ...props }: React.ComponentProps<"tbody">): React.JSX.Element;
|
|
5
|
+
declare function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">): React.JSX.Element;
|
|
6
|
+
declare function TableRow({ className, ...props }: React.ComponentProps<"tr">): React.JSX.Element;
|
|
7
|
+
declare function TableHead({ className, ...props }: React.ComponentProps<"th">): React.JSX.Element;
|
|
8
|
+
declare function TableCell({ className, ...props }: React.ComponentProps<"td">): React.JSX.Element;
|
|
9
|
+
declare function TableCaption({ className, ...props }: React.ComponentProps<"caption">): React.JSX.Element;
|
|
10
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
function Table({ className, ...props }) {
|
|
5
|
+
return (_jsx("div", { "data-slot": "table-container", className: "relative w-full overflow-x-auto", children: _jsx("table", { "data-slot": "table", className: cn("w-full caption-bottom text-sm", className), ...props }) }));
|
|
6
|
+
}
|
|
7
|
+
function TableHeader({ className, ...props }) {
|
|
8
|
+
return (_jsx("thead", { "data-slot": "table-header", className: cn("[&_tr]:border-b", className), ...props }));
|
|
9
|
+
}
|
|
10
|
+
function TableBody({ className, ...props }) {
|
|
11
|
+
return (_jsx("tbody", { "data-slot": "table-body", className: cn("[&_tr:last-child]:border-0", className), ...props }));
|
|
12
|
+
}
|
|
13
|
+
function TableFooter({ className, ...props }) {
|
|
14
|
+
return (_jsx("tfoot", { "data-slot": "table-footer", className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className), ...props }));
|
|
15
|
+
}
|
|
16
|
+
function TableRow({ className, ...props }) {
|
|
17
|
+
return (_jsx("tr", { "data-slot": "table-row", className: cn("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted", className), ...props }));
|
|
18
|
+
}
|
|
19
|
+
function TableHead({ className, ...props }) {
|
|
20
|
+
return (_jsx("th", { "data-slot": "table-head", className: cn("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props }));
|
|
21
|
+
}
|
|
22
|
+
function TableCell({ className, ...props }) {
|
|
23
|
+
return (_jsx("td", { "data-slot": "table-cell", className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props }));
|
|
24
|
+
}
|
|
25
|
+
function TableCaption({ className, ...props }) {
|
|
26
|
+
return (_jsx("caption", { "data-slot": "table-caption", className: cn("mt-4 text-sm text-muted-foreground", className), ...props }));
|
|
27
|
+
}
|
|
28
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
4
|
+
declare function Tabs({ className, orientation, ...props }: React.ComponentProps<typeof TabsPrimitive.Root>): React.JSX.Element;
|
|
5
|
+
declare const tabsListVariants: (props?: ({
|
|
6
|
+
variant?: "default" | "line" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
declare function TabsList({ className, variant, ...props }: React.ComponentProps<typeof TabsPrimitive.List> & VariantProps<typeof tabsListVariants>): React.JSX.Element;
|
|
9
|
+
declare function TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Trigger>): React.JSX.Element;
|
|
10
|
+
declare function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Content>): React.JSX.Element;
|
|
11
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
5
|
+
function Tabs({ className, orientation = "horizontal", ...props }) {
|
|
6
|
+
return (_jsx(TabsPrimitive.Root, { "data-slot": "tabs", "data-orientation": orientation, orientation: orientation, className: cn("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col", className), ...props }));
|
|
7
|
+
}
|
|
8
|
+
const tabsListVariants = cva("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none", {
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "bg-muted",
|
|
12
|
+
line: "gap-1 bg-transparent",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
variant: "default",
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
function TabsList({ className, variant = "default", ...props }) {
|
|
20
|
+
return (_jsx(TabsPrimitive.List, { "data-slot": "tabs-list", "data-variant": variant, className: cn(tabsListVariants({ variant }), className), ...props }));
|
|
21
|
+
}
|
|
22
|
+
function TabsTrigger({ className, ...props }) {
|
|
23
|
+
return (_jsx(TabsPrimitive.Trigger, { "data-slot": "tabs-trigger", className: cn("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent", "data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground", "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100", className), ...props }));
|
|
24
|
+
}
|
|
25
|
+
function TabsContent({ className, ...props }) {
|
|
26
|
+
return (_jsx(TabsPrimitive.Content, { "data-slot": "tabs-content", className: cn("flex-1 outline-none", className), ...props }));
|
|
27
|
+
}
|
|
28
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface TagInputProps {
|
|
3
|
+
values: string[];
|
|
4
|
+
onChange: (values: string[]) => void;
|
|
5
|
+
/** Curated suggestions shown as pills under the field; clicking adds the tag. */
|
|
6
|
+
suggestions?: string[];
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Multi-value field for interests and skills: chosen values sit as
|
|
12
|
+
* removable chips inside the field, typing plus Enter adds a new one,
|
|
13
|
+
* and curated suggestions under the field add with one tap.
|
|
14
|
+
*/
|
|
15
|
+
export declare function TagInput({ values, onChange, suggestions, placeholder, className }: TagInputProps): React.JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { IconX, IconPlus } from "@tabler/icons-react";
|
|
4
|
+
import { cn } from "../lib/utils";
|
|
5
|
+
import { Badge } from "./badge";
|
|
6
|
+
/**
|
|
7
|
+
* Multi-value field for interests and skills: chosen values sit as
|
|
8
|
+
* removable chips inside the field, typing plus Enter adds a new one,
|
|
9
|
+
* and curated suggestions under the field add with one tap.
|
|
10
|
+
*/
|
|
11
|
+
export function TagInput({ values, onChange, suggestions = [], placeholder, className }) {
|
|
12
|
+
const [draft, setDraft] = React.useState("");
|
|
13
|
+
const add = (raw) => {
|
|
14
|
+
const value = raw.trim();
|
|
15
|
+
if (value === "" || values.some((v) => v.toLowerCase() === value.toLowerCase()))
|
|
16
|
+
return;
|
|
17
|
+
onChange([...values, value]);
|
|
18
|
+
setDraft("");
|
|
19
|
+
};
|
|
20
|
+
const remove = (value) => onChange(values.filter((v) => v !== value));
|
|
21
|
+
const available = suggestions.filter((s) => !values.some((v) => v.toLowerCase() === s.toLowerCase()));
|
|
22
|
+
return (_jsxs("div", { className: cn("grid gap-2", className), children: [_jsxs("div", { className: "flex min-h-9 flex-wrap items-center gap-1.5 rounded-md border border-input bg-card px-2 py-1.5 shadow-xs focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50", children: [values.map((value) => (_jsxs(Badge, { variant: "secondary", className: "gap-1 pr-1", children: [_jsx("span", { children: value }), _jsx("button", { type: "button", onClick: () => remove(value), "aria-label": "Hapus " + value, className: "flex size-4 items-center justify-center rounded-full outline-none hover:bg-background/60 focus-visible:ring-2 focus-visible:ring-ring", children: _jsx(IconX, { className: "size-3" }) })] }, value))), _jsx("input", { value: draft, onChange: (event) => setDraft(event.target.value), onKeyDown: (event) => {
|
|
23
|
+
if (event.key === "Enter" || event.key === ",") {
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
add(draft);
|
|
26
|
+
}
|
|
27
|
+
if (event.key === "Backspace" && draft === "" && values.length > 0) {
|
|
28
|
+
remove(values[values.length - 1]);
|
|
29
|
+
}
|
|
30
|
+
}, onBlur: () => add(draft), placeholder: values.length === 0 ? placeholder : undefined, className: "min-w-28 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground", "aria-label": placeholder ?? "Tambah nilai" })] }), available.length > 0 && (_jsx("div", { className: "flex flex-wrap gap-1.5", children: available.map((suggestion) => (_jsxs("button", { type: "button", onClick: () => add(suggestion), className: "inline-flex items-center gap-1 rounded-full border bg-card px-2.5 py-1 text-xs font-medium text-muted-foreground outline-none transition-colors hover:border-brand-red/50 hover:text-brand-ink focus-visible:ring-2 focus-visible:ring-ring", children: [_jsx(IconPlus, { className: "size-3" }), suggestion] }, suggestion))) }))] }));
|
|
31
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../lib/utils";
|
|
3
|
+
function Textarea({ className, ...props }) {
|
|
4
|
+
return (_jsx("textarea", { "data-slot": "textarea", className: cn("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-card px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm", className), ...props }));
|
|
5
|
+
}
|
|
6
|
+
export { Textarea };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface TimelineItem {
|
|
3
|
+
title: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
/** When it happened or will happen, already formatted by the page. */
|
|
6
|
+
time?: string;
|
|
7
|
+
state: "complete" | "current" | "upcoming";
|
|
8
|
+
}
|
|
9
|
+
export interface TimelineProps {
|
|
10
|
+
items: TimelineItem[];
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A vertical history: what happened, in order, with the current point
|
|
15
|
+
* marked. Used for profile history and verification status, where the
|
|
16
|
+
* person asks one question: where is my process now.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Timeline({ items, className }: TimelineProps): React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { IconCheck } from "@tabler/icons-react";
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
/**
|
|
5
|
+
* A vertical history: what happened, in order, with the current point
|
|
6
|
+
* marked. Used for profile history and verification status, where the
|
|
7
|
+
* person asks one question: where is my process now.
|
|
8
|
+
*/
|
|
9
|
+
export function Timeline({ items, className }) {
|
|
10
|
+
return (_jsx("ol", { className: cn("grid", className), children: items.map((item, index) => (_jsxs("li", { className: "relative flex gap-3 pb-6 last:pb-0", children: [index < items.length - 1 && (_jsx("span", { "aria-hidden": true, className: cn("absolute top-6 left-[11px] h-[calc(100%-24px)] w-px", item.state === "complete" ? "bg-brand-red" : "bg-border") })), _jsxs("span", { className: cn("relative z-10 flex size-6 shrink-0 items-center justify-center rounded-full border", item.state === "complete" && "border-brand-red bg-brand-red text-white", item.state === "current" && "border-brand-red bg-card ring-4 ring-brand-red/15", item.state === "upcoming" && "border-border bg-card"), children: [item.state === "complete" && _jsx(IconCheck, { className: "size-3.5" }), item.state === "current" && _jsx("span", { className: "size-2 rounded-full bg-brand-red" }), item.state === "upcoming" && _jsx("span", { className: "size-2 rounded-full bg-border" })] }), _jsxs("div", { className: "grid gap-0.5 pt-0.5", children: [_jsx("span", { className: cn("text-sm", item.state === "upcoming" ? "text-muted-foreground" : "font-medium text-brand-ink"), children: item.title }), item.description && _jsx("span", { className: "text-sm text-muted-foreground", children: item.description }), item.time && _jsx("span", { className: "text-xs text-muted-foreground", children: item.time })] })] }, item.title + index))) }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface TodoStripProps {
|
|
2
|
+
heading: string;
|
|
3
|
+
label: string;
|
|
4
|
+
href: string;
|
|
5
|
+
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The Beranda "next steps" strip, extracted exactly from
|
|
9
|
+
* ppij-identity-sso Beranda.tsx (the optional_todo element): a
|
|
10
|
+
* full-width link card spanning both columns. Real copy:
|
|
11
|
+
* heading "Langkah berikutnya", label "Tambahkan minat Anda
|
|
12
|
+
* (opsional)", linking to the profile's interests section.
|
|
13
|
+
*/
|
|
14
|
+
export declare function TodoStrip({ heading, label, href, onClick }: TodoStripProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The Beranda "next steps" strip, extracted exactly from
|
|
4
|
+
* ppij-identity-sso Beranda.tsx (the optional_todo element): a
|
|
5
|
+
* full-width link card spanning both columns. Real copy:
|
|
6
|
+
* heading "Langkah berikutnya", label "Tambahkan minat Anda
|
|
7
|
+
* (opsional)", linking to the profile's interests section.
|
|
8
|
+
*/
|
|
9
|
+
export function TodoStrip({ heading, label, href, onClick }) {
|
|
10
|
+
return (_jsxs("a", { href: href, onClick: onClick, className: "flex min-h-11 items-center justify-between gap-3 rounded-xl border border-brand-border bg-card px-4 py-3 text-brand-ink hover:border-brand-red focus-visible:outline-2 focus-visible:outline-brand-red md:col-span-2", children: [_jsxs("span", { children: [_jsx("span", { className: "block text-xs font-semibold tracking-wide text-brand-muted uppercase", children: heading }), _jsx("span", { className: "block font-semibold", children: label })] }), _jsx("span", { className: "text-sm font-semibold text-brand-red", "aria-hidden": "true", children: "\u203A" })] }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
3
|
+
declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): React.JSX.Element;
|
|
4
|
+
declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): React.JSX.Element;
|
|
5
|
+
declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): React.JSX.Element;
|
|
6
|
+
declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>): React.JSX.Element;
|
|
7
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../lib/utils";
|
|
3
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
4
|
+
function TooltipProvider({ delayDuration = 0, ...props }) {
|
|
5
|
+
return (_jsx(TooltipPrimitive.Provider, { "data-slot": "tooltip-provider", delayDuration: delayDuration, ...props }));
|
|
6
|
+
}
|
|
7
|
+
function Tooltip({ ...props }) {
|
|
8
|
+
return _jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props });
|
|
9
|
+
}
|
|
10
|
+
function TooltipTrigger({ ...props }) {
|
|
11
|
+
return _jsx(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
12
|
+
}
|
|
13
|
+
function TooltipContent({ className, sideOffset = 0, children, ...props }) {
|
|
14
|
+
return (_jsx(TooltipPrimitive.Portal, { children: _jsxs(TooltipPrimitive.Content, { "data-slot": "tooltip-content", sideOffset: sideOffset, className: cn("z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95", className), ...props, children: [children, _jsx(TooltipPrimitive.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" })] }) }));
|
|
15
|
+
}
|
|
16
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface TopBarLink {
|
|
3
|
+
label: string;
|
|
4
|
+
href: string;
|
|
5
|
+
current?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface TopBarProps {
|
|
8
|
+
/** Brand lockup node, usually the logo plus wordmark or the wordmark alone. */
|
|
9
|
+
brand: React.ReactNode;
|
|
10
|
+
brandHref?: string;
|
|
11
|
+
links?: TopBarLink[];
|
|
12
|
+
/** Right side nodes: language text action, sign-in button, bell, avatar. */
|
|
13
|
+
actions?: React.ReactNode;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Top navigation bar pattern for the public site and the portal.
|
|
18
|
+
* Brand left, section links in the middle, quiet actions right.
|
|
19
|
+
* The language switch stays a quiet text action, never boxed codes.
|
|
20
|
+
* On narrow screens the links hide and the caller provides a menu
|
|
21
|
+
* through the actions slot.
|
|
22
|
+
*/
|
|
23
|
+
export declare function TopBar({ brand, brandHref, links, actions, className }: TopBarProps): React.JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../lib/utils";
|
|
3
|
+
/**
|
|
4
|
+
* Top navigation bar pattern for the public site and the portal.
|
|
5
|
+
* Brand left, section links in the middle, quiet actions right.
|
|
6
|
+
* The language switch stays a quiet text action, never boxed codes.
|
|
7
|
+
* On narrow screens the links hide and the caller provides a menu
|
|
8
|
+
* through the actions slot.
|
|
9
|
+
*/
|
|
10
|
+
export function TopBar({ brand, brandHref = "/", links = [], actions, className }) {
|
|
11
|
+
return (_jsx("header", { "data-slot": "top-bar", className: cn("w-full border-b border-brand-border bg-white", className), children: _jsxs("div", { className: "mx-auto flex h-14 max-w-6xl items-center gap-4 px-4 sm:px-6", children: [_jsx("a", { href: brandHref, className: "flex shrink-0 items-center gap-2 text-brand-ink no-underline", children: brand }), links.length > 0 ? (_jsx("nav", { "aria-label": "Utama", className: "ml-2 hidden items-center gap-1 md:flex", children: links.map((link) => (_jsx("a", { href: link.href, "aria-current": link.current ? "page" : undefined, className: cn("rounded-md px-3 py-2 text-sm no-underline", link.current
|
|
12
|
+
? "font-semibold text-brand-red"
|
|
13
|
+
: "text-brand-ink hover:bg-brand-bg hover:text-brand-red"), children: link.label }, link.label + link.href))) })) : null, actions ? _jsx("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: actions }) : null] }) }));
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface TypeAheadProps {
|
|
3
|
+
/** Current text in the field; the chosen option once picked. */
|
|
4
|
+
value: string;
|
|
5
|
+
onChange: (value: string) => void;
|
|
6
|
+
/** Called when the person picks a suggestion. */
|
|
7
|
+
onSelect?: (value: string) => void;
|
|
8
|
+
/** Suggestion source; filtered by the current text inside the component. */
|
|
9
|
+
options: string[];
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
id?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A text field with suggestions: the person types, matching options
|
|
16
|
+
* appear under the field, and picking one fills the field. Free text
|
|
17
|
+
* stays allowed; the page decides whether the value must come from the
|
|
18
|
+
* list. Used for institutions, majors, and cities in the wizard.
|
|
19
|
+
*/
|
|
20
|
+
export declare function TypeAhead({ value, onChange, onSelect, options, placeholder, id, className }: TypeAheadProps): React.JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { IconChevronDown } from "@tabler/icons-react";
|
|
4
|
+
import { cn } from "../lib/utils";
|
|
5
|
+
import { Input } from "./input";
|
|
6
|
+
/**
|
|
7
|
+
* A text field with suggestions: the person types, matching options
|
|
8
|
+
* appear under the field, and picking one fills the field. Free text
|
|
9
|
+
* stays allowed; the page decides whether the value must come from the
|
|
10
|
+
* list. Used for institutions, majors, and cities in the wizard.
|
|
11
|
+
*/
|
|
12
|
+
export function TypeAhead({ value, onChange, onSelect, options, placeholder, id, className }) {
|
|
13
|
+
const [open, setOpen] = React.useState(false);
|
|
14
|
+
const matches = options.filter((option) => option.toLowerCase().includes(value.toLowerCase()) && option !== value).slice(0, 8);
|
|
15
|
+
const showList = open && value.trim() !== "" && matches.length > 0;
|
|
16
|
+
return (_jsxs("div", { className: cn("relative", className), children: [_jsx(Input, { id: id, value: value, placeholder: placeholder, autoComplete: "off", onChange: (event) => { onChange(event.target.value); setOpen(true); }, onFocus: () => setOpen(true), onBlur: () => setTimeout(() => setOpen(false), 120), className: "pr-9" }), _jsx(IconChevronDown, { className: "pointer-events-none absolute top-1/2 right-3 size-4 -translate-y-1/2 text-muted-foreground" }), showList && (_jsx("ul", { className: "absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-md border bg-popover p-1 shadow-md", role: "listbox", "aria-label": "Saran", children: matches.map((option) => (_jsx("li", { children: _jsx("button", { type: "button", role: "option", "aria-selected": "false", className: "w-full rounded-sm px-2 py-1.5 text-left text-sm outline-none hover:bg-accent focus-visible:bg-accent", onMouseDown: (event) => {
|
|
17
|
+
event.preventDefault();
|
|
18
|
+
onChange(option);
|
|
19
|
+
onSelect?.(option);
|
|
20
|
+
setOpen(false);
|
|
21
|
+
}, children: option }) }, option))) }))] }));
|
|
22
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface UnitCardProps {
|
|
3
|
+
/** Unit name, for example "Okayama". */
|
|
4
|
+
name: string;
|
|
5
|
+
/** Unit kind shown as a quiet badge, for example "Komsat" or "Wilayah". */
|
|
6
|
+
kind: string;
|
|
7
|
+
/** Number of members in the unit. */
|
|
8
|
+
memberCount: number;
|
|
9
|
+
/** Name of the person who leads the unit. */
|
|
10
|
+
leadName?: string;
|
|
11
|
+
/** Status label, for example "Aktif". */
|
|
12
|
+
statusLabel: string;
|
|
13
|
+
/** Status badge tone. */
|
|
14
|
+
statusVariant?: "default" | "success" | "warning" | "secondary";
|
|
15
|
+
/** Where the card leads. When set, the whole card is a link. */
|
|
16
|
+
href?: string;
|
|
17
|
+
/** Extra actions rendered at the card foot, for example an Edit button. */
|
|
18
|
+
actions?: React.ReactNode;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* One organisational unit (komsat, wilayah) as a card: identity first,
|
|
23
|
+
* member count and lead as quiet facts, status as a badge beside the
|
|
24
|
+
* name. Presentation only; membership and permissions stay in the app.
|
|
25
|
+
*/
|
|
26
|
+
export declare function UnitCard({ name, kind, memberCount, leadName, statusLabel, statusVariant, href, actions, className, }: UnitCardProps): React.JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { IconUsers, IconChevronRight } from "@tabler/icons-react";
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
import { Card } from "./card";
|
|
5
|
+
import { Badge } from "./badge";
|
|
6
|
+
/**
|
|
7
|
+
* One organisational unit (komsat, wilayah) as a card: identity first,
|
|
8
|
+
* member count and lead as quiet facts, status as a badge beside the
|
|
9
|
+
* name. Presentation only; membership and permissions stay in the app.
|
|
10
|
+
*/
|
|
11
|
+
export function UnitCard({ name, kind, memberCount, leadName, statusLabel, statusVariant = "success", href, actions, className, }) {
|
|
12
|
+
const body = (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsxs("div", { className: "grid gap-1", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("span", { className: "text-base font-semibold text-brand-ink", children: name }), _jsx(Badge, { variant: "secondary", children: kind })] }), _jsx("span", { className: "text-sm text-muted-foreground", children: leadName ? "Ketua: " + leadName : "Belum ada ketua" })] }), _jsx(Badge, { variant: statusVariant, children: statusLabel })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("span", { className: "inline-flex items-center gap-1.5 text-sm text-muted-foreground", children: [_jsx(IconUsers, { className: "size-4" }), memberCount, " anggota"] }), href ? (_jsx(IconChevronRight, { className: "size-4 text-muted-foreground" })) : (actions)] })] }));
|
|
13
|
+
const classes = cn("grid gap-4 p-5", className);
|
|
14
|
+
if (href) {
|
|
15
|
+
return (_jsx(Card, { className: cn(classes, "transition-colors hover:border-brand-red/40"), children: _jsx("a", { href: href, className: "grid gap-4 no-underline outline-none focus-visible:ring-2 focus-visible:ring-ring", children: body }) }));
|
|
16
|
+
}
|
|
17
|
+
return _jsx(Card, { className: classes, children: body });
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ViewToggleOption {
|
|
3
|
+
label: string;
|
|
4
|
+
href: string;
|
|
5
|
+
current?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface ViewToggleProps {
|
|
8
|
+
options: ViewToggleOption[];
|
|
9
|
+
ariaLabel: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Segmented toggle, generalized from the portal ViewSwitch: a quiet
|
|
14
|
+
* grey track holds the segments; the current side is a white segment
|
|
15
|
+
* with ink text and a small shadow, the other side is muted text.
|
|
16
|
+
* Red is reserved for primary actions and focus, never for navigation
|
|
17
|
+
* state. Navigation arrives as props (labels and hrefs); role and
|
|
18
|
+
* visibility rules stay in the application.
|
|
19
|
+
*/
|
|
20
|
+
export declare function ViewToggle({ options, ariaLabel, className }: ViewToggleProps): React.JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../lib/utils";
|
|
3
|
+
/**
|
|
4
|
+
* Segmented toggle, generalized from the portal ViewSwitch: a quiet
|
|
5
|
+
* grey track holds the segments; the current side is a white segment
|
|
6
|
+
* with ink text and a small shadow, the other side is muted text.
|
|
7
|
+
* Red is reserved for primary actions and focus, never for navigation
|
|
8
|
+
* state. Navigation arrives as props (labels and hrefs); role and
|
|
9
|
+
* visibility rules stay in the application.
|
|
10
|
+
*/
|
|
11
|
+
export function ViewToggle({ options, ariaLabel, className }) {
|
|
12
|
+
return (_jsx("div", { className: className, children: _jsx("div", { role: "group", "aria-label": ariaLabel, className: "inline-flex items-center gap-1 rounded-full bg-secondary p-1", children: options.map((option) => (_jsx("a", { href: option.href, "aria-current": option.current ? "page" : undefined, className: cn("flex h-10 min-w-24 items-center justify-center rounded-full px-4 text-sm no-underline focus-visible:outline-2 focus-visible:outline-brand-red", option.current
|
|
13
|
+
? "bg-card font-semibold text-brand-ink shadow-sm"
|
|
14
|
+
: "text-muted-foreground hover:text-brand-ink"), children: option.label }, option.label + option.href))) }) }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface WizardFooterProps {
|
|
2
|
+
onBack: () => void;
|
|
3
|
+
onContinue: () => void;
|
|
4
|
+
backLabel?: string;
|
|
5
|
+
continueLabel?: string;
|
|
6
|
+
backDisabled?: boolean;
|
|
7
|
+
continueDisabled?: boolean;
|
|
8
|
+
/** While continuing submits: spinner plus loadingLabel inside the primary button. */
|
|
9
|
+
continueLoading?: boolean;
|
|
10
|
+
loadingLabel?: string;
|
|
11
|
+
/** The final submit carries no arrow. */
|
|
12
|
+
showArrow?: boolean;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The wizard's fixed bottom navigation bar, extracted from
|
|
17
|
+
* Wizard.tsx: two equal buttons (Kembali outline, Lanjut primary)
|
|
18
|
+
* in a white bar pinned to the viewport bottom. Named exception to
|
|
19
|
+
* the default button size: a fixed navigation bar is a navigation
|
|
20
|
+
* target, so its buttons are field height (44px) and text-base,
|
|
21
|
+
* like the portal bottom nav. The loading state follows the rule:
|
|
22
|
+
* spinner inside the primary button.
|
|
23
|
+
*/
|
|
24
|
+
export declare function WizardFooter({ onBack, onContinue, backLabel, continueLabel, backDisabled, continueDisabled, continueLoading, loadingLabel, showArrow, className, }: WizardFooterProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { IconArrowLeft, IconArrowRight } from "@tabler/icons-react";
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
import { Button } from "./button";
|
|
5
|
+
import { Spinner } from "./spinner";
|
|
6
|
+
/**
|
|
7
|
+
* The wizard's fixed bottom navigation bar, extracted from
|
|
8
|
+
* Wizard.tsx: two equal buttons (Kembali outline, Lanjut primary)
|
|
9
|
+
* in a white bar pinned to the viewport bottom. Named exception to
|
|
10
|
+
* the default button size: a fixed navigation bar is a navigation
|
|
11
|
+
* target, so its buttons are field height (44px) and text-base,
|
|
12
|
+
* like the portal bottom nav. The loading state follows the rule:
|
|
13
|
+
* spinner inside the primary button.
|
|
14
|
+
*/
|
|
15
|
+
export function WizardFooter({ onBack, onContinue, backLabel = "Kembali", continueLabel = "Lanjut", backDisabled = false, continueDisabled = false, continueLoading = false, loadingLabel = "Mengirim…", showArrow = true, className, }) {
|
|
16
|
+
return (_jsx("div", { className: cn("fixed inset-x-0 bottom-0 z-30 border-t border-border bg-card", className), children: _jsxs("div", { className: "mx-auto flex max-w-2xl gap-3 px-4 py-3", children: [_jsxs(Button, { type: "button", variant: "outline", onClick: onBack, disabled: backDisabled, className: "min-h-11 flex-1 text-base font-semibold", children: [_jsx(IconArrowLeft, { size: 18, "aria-hidden": "true" }), backLabel] }), _jsx(Button, { type: "submit", onClick: onContinue, disabled: continueDisabled || continueLoading, "aria-busy": continueLoading, className: "min-h-11 flex-1 text-base font-semibold", children: continueLoading ? (_jsxs(_Fragment, { children: [_jsx(Spinner, { size: "sm", decorative: true }), _jsx("span", { children: loadingLabel })] })) : (_jsxs(_Fragment, { children: [continueLabel, showArrow && _jsx(IconArrowRight, { size: 18, "aria-hidden": "true" })] })) })] }) }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type SavingStatus } from "./saving-indicator";
|
|
2
|
+
export interface WizardLanguage {
|
|
3
|
+
label: string;
|
|
4
|
+
current?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface WizardHeaderProps {
|
|
7
|
+
/** Counter text, for example "Langkah 3 dari 7". */
|
|
8
|
+
stepText: string;
|
|
9
|
+
/** Step title shown after the counter on sm and wider. */
|
|
10
|
+
title: string;
|
|
11
|
+
current: number;
|
|
12
|
+
total: number;
|
|
13
|
+
progressLabel: string;
|
|
14
|
+
savingStatus: SavingStatus;
|
|
15
|
+
locale?: "id" | "en";
|
|
16
|
+
languages: WizardLanguage[];
|
|
17
|
+
languageLabel?: string;
|
|
18
|
+
onLanguageSelect?: (language: WizardLanguage) => void;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The wizard's sticky sub-header (WIZ106-09), extracted from
|
|
23
|
+
* Wizard.tsx: step counter with the step title, the draft
|
|
24
|
+
* SavingIndicator and the language menu on the right, and the
|
|
25
|
+
* segmented progress below. It sits under the portal header inside
|
|
26
|
+
* the shell content; the consumer supplies the horizontal bleed
|
|
27
|
+
* (for example -mx-4) its layout needs.
|
|
28
|
+
*/
|
|
29
|
+
export declare function WizardHeader({ stepText, title, current, total, progressLabel, savingStatus, locale, languages, languageLabel, onLanguageSelect, className, }: WizardHeaderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { IconCheck, IconLanguage } from "@tabler/icons-react";
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
import { Button } from "./button";
|
|
5
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "./dropdown-menu";
|
|
6
|
+
import { SavingIndicator } from "./saving-indicator";
|
|
7
|
+
import { SegmentedProgress } from "./segmented-progress";
|
|
8
|
+
/**
|
|
9
|
+
* The wizard's sticky sub-header (WIZ106-09), extracted from
|
|
10
|
+
* Wizard.tsx: step counter with the step title, the draft
|
|
11
|
+
* SavingIndicator and the language menu on the right, and the
|
|
12
|
+
* segmented progress below. It sits under the portal header inside
|
|
13
|
+
* the shell content; the consumer supplies the horizontal bleed
|
|
14
|
+
* (for example -mx-4) its layout needs.
|
|
15
|
+
*/
|
|
16
|
+
export function WizardHeader({ stepText, title, current, total, progressLabel, savingStatus, locale = "id", languages, languageLabel = "Pilih bahasa", onLanguageSelect, className, }) {
|
|
17
|
+
return (_jsxs("div", { className: cn("sticky top-0 z-40 border-b border-border bg-card px-4 py-3", className), children: [_jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsxs("p", { className: "min-w-0 text-sm leading-5 font-medium text-brand-ink", "aria-live": "polite", children: [stepText, _jsxs("span", { className: "hidden sm:inline", children: [" \u2014 ", title] })] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [_jsx(SavingIndicator, { status: savingStatus, locale: locale }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { type: "button", variant: "ghost", size: "icon", "aria-label": languageLabel, children: _jsx(IconLanguage, {}) }) }), _jsx(DropdownMenuContent, { align: "end", children: languages.map((language) => (_jsxs(DropdownMenuItem, { onSelect: () => onLanguageSelect?.(language), children: [_jsx("span", { className: "flex-1", children: language.label }), language.current && _jsx(IconCheck, { className: "size-4 text-brand-red", "aria-hidden": "true" })] }, language.label))) })] })] })] }), _jsx(SegmentedProgress, { current: current, total: total, label: progressLabel, className: "mt-3" })] }));
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useIsMobile(): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const MOBILE_BREAKPOINT = 768;
|
|
3
|
+
const MOBILE_QUERY = `(max-width: ${MOBILE_BREAKPOINT - 1}px)`;
|
|
4
|
+
function subscribeMobile(onChange) {
|
|
5
|
+
const mql = window.matchMedia(MOBILE_QUERY);
|
|
6
|
+
mql.addEventListener("change", onChange);
|
|
7
|
+
return () => mql.removeEventListener("change", onChange);
|
|
8
|
+
}
|
|
9
|
+
export function useIsMobile() {
|
|
10
|
+
return React.useSyncExternalStore(subscribeMobile, () => window.matchMedia(MOBILE_QUERY).matches, () => false);
|
|
11
|
+
}
|