slack-blocks-to-jsx 0.1.6 → 0.1.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.
package/dist/index.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ import { ReactNode } from 'react';
2
+
1
3
  type Element = ButtonElement | CheckboxesElement | DatePickerElement | DateTimePickerElement | EmailInputElement | ImageElement | MultiStaticSelectElement | MultiExternalSelectElement | MultiUsersSelectElement | MultiConversationsSelectElement | MultiChannelsSelectElement | NumberInputElement | OverflowMenuElement | PlainTextInputElement | RadioButtonsElement | StaticSelectElement | ExternalSelectElement | UsersSelectElement | ConversationsSelectElement | ChannelsSelectElement | TimePickerElement | UrlTextInputElement;
2
4
  type ButtonElement = {
3
5
  type: "button";
@@ -697,6 +699,87 @@ type FilterObject = {
697
699
  exclude_bot_users?: boolean;
698
700
  };
699
701
 
702
+ type RichTextList = {
703
+ type: "rich_text_list";
704
+ style: "bullet" | "ordered";
705
+ /**
706
+ * The number of spaces to indent this block. It must be a number between 0 and 8.
707
+ */
708
+ indent?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
709
+ offset?: number;
710
+ /**
711
+ * 0 or 1 (default 0) - if 1, a border is drawn on the left side of the block.
712
+ */
713
+ border?: 0 | 1;
714
+ elements: RichTextSection[];
715
+ };
716
+ type RichTextPreformatted = {
717
+ type: "rich_text_preformatted";
718
+ elements: RichTextSectionElement[];
719
+ /**
720
+ * 0 or 1 (default 0) - if 1, a border is drawn on the left side of the block.
721
+ */
722
+ border?: 0 | 1;
723
+ };
724
+ type RichTextQuote = {
725
+ type: "rich_text_quote";
726
+ elements: RichTextSectionElement[];
727
+ /**
728
+ * 0 or 1 (default 0) - if 1, a border is drawn on the left side of the block.
729
+ */
730
+ border?: 0 | 1;
731
+ };
732
+ type RichTextSection = {
733
+ type: "rich_text_section";
734
+ elements: RichTextSectionElement[];
735
+ };
736
+ type RichTextBlockElement = RichTextList | RichTextPreformatted | RichTextQuote | RichTextSection;
737
+ type RichTextSectionElement = RichTextSectionText | RichTextSectionChannel | RichTextSectionUser | RichTextSectionEmoji | RichTextSectionLink | RichTextSectionUsergroup | RichTextSectionBroadcast;
738
+ type RichTextSectionText = {
739
+ type: "text";
740
+ text: string;
741
+ style?: RichTextSectionElementStyleWithCode;
742
+ };
743
+ type RichTextSectionChannel = {
744
+ type: "channel";
745
+ channel_id: string;
746
+ style?: RichTextSectionElementStyleWithCode;
747
+ };
748
+ type RichTextSectionUser = {
749
+ type: "user";
750
+ user_id: string;
751
+ style?: RichTextSectionElementStyleWithCode;
752
+ };
753
+ type RichTextSectionEmoji = {
754
+ type: "emoji";
755
+ name: string;
756
+ skin_tone?: number;
757
+ unicode?: string;
758
+ style?: RichTextSectionElementStyleWithCode;
759
+ };
760
+ type RichTextSectionLink = {
761
+ type: "link";
762
+ url: string;
763
+ text: string;
764
+ style?: RichTextSectionElementStyleWithCode;
765
+ };
766
+ type RichTextSectionUsergroup = {
767
+ type: "usergroup";
768
+ usergroup_id: string;
769
+ style?: RichTextSectionElementStyleWithCode;
770
+ };
771
+ type RichTextSectionBroadcast = {
772
+ type: "broadcast";
773
+ range: "channel" | "here" | "everyone";
774
+ style?: RichTextSectionElementStyleWithCode;
775
+ };
776
+ type RichTextSectionElementStyleWithCode = {
777
+ code?: boolean;
778
+ bold?: boolean;
779
+ italic?: boolean;
780
+ strike?: boolean;
781
+ };
782
+
700
783
  type Block = ActionsBlock | ContextBlock | DividerBlock | FileBlock | HeaderBlock | ImageBlock | InputBlock | SectionBlock | VideoBlock | RichTextBlock;
701
784
  type ActionsBlock = {
702
785
  /**
@@ -974,7 +1057,47 @@ type RichTextBlock = {
974
1057
  * A ***rich_text*** block is a formatted, structured representation of text. It is the output of the Slack client's WYSIWYG composer, so all messages sent by end-users will have this format. You can use this block to create your own formatted text in Block Kit Builder or include user-defined formatted text in your Block Kit payload. You might encounter ***rich_text*** blocks in message payloads coming from our APIs, as a built-in type in the next-generation Slack platform, or as output of the ***rich_text_input*** block.
975
1058
  */
976
1059
  type: "rich_text";
1060
+ /**
1061
+ * A string acting as a unique identifier for a block. If not specified, one will be generated. Maximum length for this field is 255 characters. ***block_id*** should be unique for each message and each iteration of a message. If a message is updated, use a new ***block_id***.
1062
+ */
1063
+ block_id?: string;
1064
+ /**
1065
+ * An array of rich text objects - rich_text_section, rich_text_list, rich_text_preformatted, and rich_text_quote. See your specific desired element below for more details.
1066
+ */
1067
+ elements: RichTextBlockElement[];
1068
+ };
1069
+
1070
+ type User = {
1071
+ id: string;
1072
+ name: string;
1073
+ };
1074
+ type Channel = {
1075
+ id: string;
1076
+ name: string;
1077
+ };
1078
+ type Hooks = {
1079
+ user?: (data: User) => ReactNode;
1080
+ channel?: (data: Channel) => ReactNode;
1081
+ atChannel?: () => ReactNode;
1082
+ atEveryone?: () => ReactNode;
1083
+ atHere?: () => ReactNode;
1084
+ usergroup?: (data: Channel) => ReactNode;
1085
+ date?: (data: {
1086
+ timestamp: string;
1087
+ format: string;
1088
+ link?: string | undefined;
1089
+ fallback: string;
1090
+ }) => ReactNode;
1091
+ };
1092
+ type Data = {
1093
+ users: User[];
1094
+ channels: Channel[];
1095
+ hooks: Hooks;
1096
+ setUsers: (users: User[]) => void;
1097
+ setChannels: (channels: Channel[]) => void;
1098
+ setHooks: (hooks: Hooks) => void;
977
1099
  };
1100
+ type GlobalStore = Data;
978
1101
 
979
1102
  type Props = {
980
1103
  /**
@@ -993,15 +1116,10 @@ type Props = {
993
1116
  style?: React.CSSProperties;
994
1117
  unstyled?: boolean;
995
1118
  data?: {
996
- users?: {
997
- id: string;
998
- name: string;
999
- }[];
1000
- channels?: {
1001
- id: string;
1002
- name: string;
1003
- }[];
1119
+ users?: GlobalStore["users"];
1120
+ channels?: GlobalStore["channels"];
1004
1121
  };
1122
+ hooks?: GlobalStore["hooks"];
1005
1123
  };
1006
1124
  declare const Message: (props: Props) => JSX.Element;
1007
1125
 
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { ReactNode } from 'react';
2
+
1
3
  type Element = ButtonElement | CheckboxesElement | DatePickerElement | DateTimePickerElement | EmailInputElement | ImageElement | MultiStaticSelectElement | MultiExternalSelectElement | MultiUsersSelectElement | MultiConversationsSelectElement | MultiChannelsSelectElement | NumberInputElement | OverflowMenuElement | PlainTextInputElement | RadioButtonsElement | StaticSelectElement | ExternalSelectElement | UsersSelectElement | ConversationsSelectElement | ChannelsSelectElement | TimePickerElement | UrlTextInputElement;
2
4
  type ButtonElement = {
3
5
  type: "button";
@@ -697,6 +699,87 @@ type FilterObject = {
697
699
  exclude_bot_users?: boolean;
698
700
  };
699
701
 
702
+ type RichTextList = {
703
+ type: "rich_text_list";
704
+ style: "bullet" | "ordered";
705
+ /**
706
+ * The number of spaces to indent this block. It must be a number between 0 and 8.
707
+ */
708
+ indent?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
709
+ offset?: number;
710
+ /**
711
+ * 0 or 1 (default 0) - if 1, a border is drawn on the left side of the block.
712
+ */
713
+ border?: 0 | 1;
714
+ elements: RichTextSection[];
715
+ };
716
+ type RichTextPreformatted = {
717
+ type: "rich_text_preformatted";
718
+ elements: RichTextSectionElement[];
719
+ /**
720
+ * 0 or 1 (default 0) - if 1, a border is drawn on the left side of the block.
721
+ */
722
+ border?: 0 | 1;
723
+ };
724
+ type RichTextQuote = {
725
+ type: "rich_text_quote";
726
+ elements: RichTextSectionElement[];
727
+ /**
728
+ * 0 or 1 (default 0) - if 1, a border is drawn on the left side of the block.
729
+ */
730
+ border?: 0 | 1;
731
+ };
732
+ type RichTextSection = {
733
+ type: "rich_text_section";
734
+ elements: RichTextSectionElement[];
735
+ };
736
+ type RichTextBlockElement = RichTextList | RichTextPreformatted | RichTextQuote | RichTextSection;
737
+ type RichTextSectionElement = RichTextSectionText | RichTextSectionChannel | RichTextSectionUser | RichTextSectionEmoji | RichTextSectionLink | RichTextSectionUsergroup | RichTextSectionBroadcast;
738
+ type RichTextSectionText = {
739
+ type: "text";
740
+ text: string;
741
+ style?: RichTextSectionElementStyleWithCode;
742
+ };
743
+ type RichTextSectionChannel = {
744
+ type: "channel";
745
+ channel_id: string;
746
+ style?: RichTextSectionElementStyleWithCode;
747
+ };
748
+ type RichTextSectionUser = {
749
+ type: "user";
750
+ user_id: string;
751
+ style?: RichTextSectionElementStyleWithCode;
752
+ };
753
+ type RichTextSectionEmoji = {
754
+ type: "emoji";
755
+ name: string;
756
+ skin_tone?: number;
757
+ unicode?: string;
758
+ style?: RichTextSectionElementStyleWithCode;
759
+ };
760
+ type RichTextSectionLink = {
761
+ type: "link";
762
+ url: string;
763
+ text: string;
764
+ style?: RichTextSectionElementStyleWithCode;
765
+ };
766
+ type RichTextSectionUsergroup = {
767
+ type: "usergroup";
768
+ usergroup_id: string;
769
+ style?: RichTextSectionElementStyleWithCode;
770
+ };
771
+ type RichTextSectionBroadcast = {
772
+ type: "broadcast";
773
+ range: "channel" | "here" | "everyone";
774
+ style?: RichTextSectionElementStyleWithCode;
775
+ };
776
+ type RichTextSectionElementStyleWithCode = {
777
+ code?: boolean;
778
+ bold?: boolean;
779
+ italic?: boolean;
780
+ strike?: boolean;
781
+ };
782
+
700
783
  type Block = ActionsBlock | ContextBlock | DividerBlock | FileBlock | HeaderBlock | ImageBlock | InputBlock | SectionBlock | VideoBlock | RichTextBlock;
701
784
  type ActionsBlock = {
702
785
  /**
@@ -974,7 +1057,47 @@ type RichTextBlock = {
974
1057
  * A ***rich_text*** block is a formatted, structured representation of text. It is the output of the Slack client's WYSIWYG composer, so all messages sent by end-users will have this format. You can use this block to create your own formatted text in Block Kit Builder or include user-defined formatted text in your Block Kit payload. You might encounter ***rich_text*** blocks in message payloads coming from our APIs, as a built-in type in the next-generation Slack platform, or as output of the ***rich_text_input*** block.
975
1058
  */
976
1059
  type: "rich_text";
1060
+ /**
1061
+ * A string acting as a unique identifier for a block. If not specified, one will be generated. Maximum length for this field is 255 characters. ***block_id*** should be unique for each message and each iteration of a message. If a message is updated, use a new ***block_id***.
1062
+ */
1063
+ block_id?: string;
1064
+ /**
1065
+ * An array of rich text objects - rich_text_section, rich_text_list, rich_text_preformatted, and rich_text_quote. See your specific desired element below for more details.
1066
+ */
1067
+ elements: RichTextBlockElement[];
1068
+ };
1069
+
1070
+ type User = {
1071
+ id: string;
1072
+ name: string;
1073
+ };
1074
+ type Channel = {
1075
+ id: string;
1076
+ name: string;
1077
+ };
1078
+ type Hooks = {
1079
+ user?: (data: User) => ReactNode;
1080
+ channel?: (data: Channel) => ReactNode;
1081
+ atChannel?: () => ReactNode;
1082
+ atEveryone?: () => ReactNode;
1083
+ atHere?: () => ReactNode;
1084
+ usergroup?: (data: Channel) => ReactNode;
1085
+ date?: (data: {
1086
+ timestamp: string;
1087
+ format: string;
1088
+ link?: string | undefined;
1089
+ fallback: string;
1090
+ }) => ReactNode;
1091
+ };
1092
+ type Data = {
1093
+ users: User[];
1094
+ channels: Channel[];
1095
+ hooks: Hooks;
1096
+ setUsers: (users: User[]) => void;
1097
+ setChannels: (channels: Channel[]) => void;
1098
+ setHooks: (hooks: Hooks) => void;
977
1099
  };
1100
+ type GlobalStore = Data;
978
1101
 
979
1102
  type Props = {
980
1103
  /**
@@ -993,15 +1116,10 @@ type Props = {
993
1116
  style?: React.CSSProperties;
994
1117
  unstyled?: boolean;
995
1118
  data?: {
996
- users?: {
997
- id: string;
998
- name: string;
999
- }[];
1000
- channels?: {
1001
- id: string;
1002
- name: string;
1003
- }[];
1119
+ users?: GlobalStore["users"];
1120
+ channels?: GlobalStore["channels"];
1004
1121
  };
1122
+ hooks?: GlobalStore["hooks"];
1005
1123
  };
1006
1124
  declare const Message: (props: Props) => JSX.Element;
1007
1125