myoperator-ui 0.0.74 → 0.0.75
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/index.js +170 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3059,6 +3059,176 @@ export {
|
|
|
3059
3059
|
accordionTriggerVariants,
|
|
3060
3060
|
accordionContentVariants,
|
|
3061
3061
|
}
|
|
3062
|
+
`, prefix)
|
|
3063
|
+
}
|
|
3064
|
+
]
|
|
3065
|
+
},
|
|
3066
|
+
"page-header": {
|
|
3067
|
+
name: "page-header",
|
|
3068
|
+
description: "A page header component with icon, title, description, and action buttons",
|
|
3069
|
+
dependencies: [
|
|
3070
|
+
"class-variance-authority",
|
|
3071
|
+
"clsx",
|
|
3072
|
+
"tailwind-merge",
|
|
3073
|
+
"lucide-react"
|
|
3074
|
+
],
|
|
3075
|
+
files: [
|
|
3076
|
+
{
|
|
3077
|
+
name: "page-header.tsx",
|
|
3078
|
+
content: prefixTailwindClasses(`import * as React from "react"
|
|
3079
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
3080
|
+
import { ArrowLeft } from "lucide-react"
|
|
3081
|
+
|
|
3082
|
+
import { cn } from "../../lib/utils"
|
|
3083
|
+
|
|
3084
|
+
/**
|
|
3085
|
+
* PageHeader variants for layout styles.
|
|
3086
|
+
*/
|
|
3087
|
+
const pageHeaderVariants = cva(
|
|
3088
|
+
"flex items-center w-full bg-white",
|
|
3089
|
+
{
|
|
3090
|
+
variants: {},
|
|
3091
|
+
defaultVariants: {},
|
|
3092
|
+
}
|
|
3093
|
+
)
|
|
3094
|
+
|
|
3095
|
+
/**
|
|
3096
|
+
* Page header component for displaying page titles with optional icons and actions.
|
|
3097
|
+
*
|
|
3098
|
+
* @example
|
|
3099
|
+
* \`\`\`tsx
|
|
3100
|
+
* // Simple header with icon
|
|
3101
|
+
* <PageHeader
|
|
3102
|
+
* icon={<WebhookIcon />}
|
|
3103
|
+
* title="Webhooks"
|
|
3104
|
+
* description="Manage your webhook integrations"
|
|
3105
|
+
* />
|
|
3106
|
+
*
|
|
3107
|
+
* // Header with actions
|
|
3108
|
+
* <PageHeader
|
|
3109
|
+
* icon={<WebhookIcon />}
|
|
3110
|
+
* title="Webhooks"
|
|
3111
|
+
* description="Manage your webhook integrations"
|
|
3112
|
+
* actions={<Button>Add Webhook</Button>}
|
|
3113
|
+
* />
|
|
3114
|
+
*
|
|
3115
|
+
* // Header with back button
|
|
3116
|
+
* <PageHeader
|
|
3117
|
+
* showBackButton
|
|
3118
|
+
* onBackClick={() => navigate(-1)}
|
|
3119
|
+
* title="Edit Webhook"
|
|
3120
|
+
* description="Modify webhook settings"
|
|
3121
|
+
* actions={<><Button variant="outline">Cancel</Button><Button>Save</Button></>}
|
|
3122
|
+
* />
|
|
3123
|
+
* \`\`\`
|
|
3124
|
+
*/
|
|
3125
|
+
export interface PageHeaderProps
|
|
3126
|
+
extends React.HTMLAttributes<HTMLDivElement>,
|
|
3127
|
+
VariantProps<typeof pageHeaderVariants> {
|
|
3128
|
+
/** Page title (required) */
|
|
3129
|
+
title: string
|
|
3130
|
+
/** Optional description/subtitle displayed below the title */
|
|
3131
|
+
description?: string
|
|
3132
|
+
/** Icon displayed on the left side (hidden when showBackButton is true) */
|
|
3133
|
+
icon?: React.ReactNode
|
|
3134
|
+
/** Shows back arrow button instead of icon */
|
|
3135
|
+
showBackButton?: boolean
|
|
3136
|
+
/** Callback when back button is clicked */
|
|
3137
|
+
onBackClick?: () => void
|
|
3138
|
+
/** Optional info icon displayed next to the title (e.g., tooltip trigger) */
|
|
3139
|
+
infoIcon?: React.ReactNode
|
|
3140
|
+
/** Action buttons/elements rendered on the right side */
|
|
3141
|
+
actions?: React.ReactNode
|
|
3142
|
+
}
|
|
3143
|
+
|
|
3144
|
+
const PageHeader = React.forwardRef<HTMLDivElement, PageHeaderProps>(
|
|
3145
|
+
({
|
|
3146
|
+
className,
|
|
3147
|
+
variant,
|
|
3148
|
+
title,
|
|
3149
|
+
description,
|
|
3150
|
+
icon,
|
|
3151
|
+
showBackButton = false,
|
|
3152
|
+
onBackClick,
|
|
3153
|
+
infoIcon,
|
|
3154
|
+
actions,
|
|
3155
|
+
...props
|
|
3156
|
+
}, ref) => {
|
|
3157
|
+
// Determine what to show on the left: back button, icon, or nothing
|
|
3158
|
+
const renderLeftElement = () => {
|
|
3159
|
+
if (showBackButton) {
|
|
3160
|
+
return (
|
|
3161
|
+
<button
|
|
3162
|
+
type="button"
|
|
3163
|
+
onClick={onBackClick}
|
|
3164
|
+
className="flex items-center justify-center w-10 h-10 rounded hover:bg-[#F3F4F6] transition-colors text-[#333333]"
|
|
3165
|
+
aria-label="Go back"
|
|
3166
|
+
>
|
|
3167
|
+
<ArrowLeft className="w-5 h-5" />
|
|
3168
|
+
</button>
|
|
3169
|
+
)
|
|
3170
|
+
}
|
|
3171
|
+
if (icon) {
|
|
3172
|
+
return (
|
|
3173
|
+
<div className="flex items-center justify-center w-10 h-10 [&_svg]:w-6 [&_svg]:h-6 text-[#6B7280]">
|
|
3174
|
+
{icon}
|
|
3175
|
+
</div>
|
|
3176
|
+
)
|
|
3177
|
+
}
|
|
3178
|
+
return null
|
|
3179
|
+
}
|
|
3180
|
+
|
|
3181
|
+
const leftElement = renderLeftElement()
|
|
3182
|
+
|
|
3183
|
+
return (
|
|
3184
|
+
<div
|
|
3185
|
+
ref={ref}
|
|
3186
|
+
className={cn(
|
|
3187
|
+
pageHeaderVariants({ variant }),
|
|
3188
|
+
"h-[76px] px-4",
|
|
3189
|
+
className
|
|
3190
|
+
)}
|
|
3191
|
+
{...props}
|
|
3192
|
+
>
|
|
3193
|
+
{/* Left Section: Icon or Back Button */}
|
|
3194
|
+
{leftElement && (
|
|
3195
|
+
<div className="flex-shrink-0 mr-4">
|
|
3196
|
+
{leftElement}
|
|
3197
|
+
</div>
|
|
3198
|
+
)}
|
|
3199
|
+
|
|
3200
|
+
{/* Content Section: Title + Description */}
|
|
3201
|
+
<div className="flex-1 min-w-0">
|
|
3202
|
+
<div className="flex items-center gap-2">
|
|
3203
|
+
<h1 className="text-base font-semibold text-[#333333] truncate">
|
|
3204
|
+
{title}
|
|
3205
|
+
</h1>
|
|
3206
|
+
{infoIcon && (
|
|
3207
|
+
<span className="flex-shrink-0 [&_svg]:w-4 [&_svg]:h-4 text-[#6B7280]">
|
|
3208
|
+
{infoIcon}
|
|
3209
|
+
</span>
|
|
3210
|
+
)}
|
|
3211
|
+
</div>
|
|
3212
|
+
{description && (
|
|
3213
|
+
<p className="text-sm text-[#333333] font-normal mt-1 truncate">
|
|
3214
|
+
{description}
|
|
3215
|
+
</p>
|
|
3216
|
+
)}
|
|
3217
|
+
</div>
|
|
3218
|
+
|
|
3219
|
+
{/* Actions Section */}
|
|
3220
|
+
{actions && (
|
|
3221
|
+
<div className="flex-shrink-0 flex items-center gap-2 ml-4">
|
|
3222
|
+
{actions}
|
|
3223
|
+
</div>
|
|
3224
|
+
)}
|
|
3225
|
+
</div>
|
|
3226
|
+
)
|
|
3227
|
+
}
|
|
3228
|
+
)
|
|
3229
|
+
PageHeader.displayName = "PageHeader"
|
|
3230
|
+
|
|
3231
|
+
export { PageHeader, pageHeaderVariants }
|
|
3062
3232
|
`, prefix)
|
|
3063
3233
|
}
|
|
3064
3234
|
]
|