mirror of
https://github.com/zulip/zulip.git
synced 2026-06-30 21:11:04 +08:00
This commit moves the ComponentIntent type to types.ts since it is common across all the components, and also moves the ActionButton type from banners.ts to buttons.ts since it is specific to the button component. On top of that, the commit also updates the type declarations to be based off of array declarations to make it easier to modify them programmatically.
30 lines
739 B
TypeScript
30 lines
739 B
TypeScript
import {z} from "zod";
|
|
|
|
// TODO/typescript: Move this to server_events
|
|
export const topic_link_schema = z.object({
|
|
text: z.string(),
|
|
url: z.string(),
|
|
});
|
|
|
|
export type TopicLink = z.infer<typeof topic_link_schema>;
|
|
|
|
export type HTMLSelectOneElement = HTMLSelectElement & {type: "select-one"};
|
|
|
|
export const anonymous_group_schema = z.object({
|
|
direct_subgroups: z.array(z.number()),
|
|
direct_members: z.array(z.number()),
|
|
});
|
|
|
|
export const group_setting_value_schema = z.union([z.number(), anonymous_group_schema]);
|
|
|
|
export const COMPONENT_INTENT_VALUES = [
|
|
"neutral",
|
|
"brand",
|
|
"info",
|
|
"success",
|
|
"warning",
|
|
"danger",
|
|
] as const;
|
|
|
|
export type ComponentIntent = (typeof COMPONENT_INTENT_VALUES)[number];
|