slack-blocks-to-jsx 0.1.8 → 0.2.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/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
 
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;
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 | RichTextBlockElement;
4
4
  type ButtonElement = {
5
5
  type: "button";
6
6
  /**
@@ -699,87 +699,6 @@ type FilterObject = {
699
699
  exclude_bot_users?: boolean;
700
700
  };
701
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
-
783
702
  type Block = ActionsBlock | ContextBlock | DividerBlock | FileBlock | HeaderBlock | ImageBlock | InputBlock | SectionBlock | VideoBlock | RichTextBlock;
784
703
  type ActionsBlock = {
785
704
  /**
@@ -1067,6 +986,93 @@ type RichTextBlock = {
1067
986
  elements: RichTextBlockElement[];
1068
987
  };
1069
988
 
989
+ type RichTextBlockSubElement = RichTextList | RichTextPreformatted | RichTextQuote | RichTextSection;
990
+ type RichTextList = {
991
+ type: "rich_text_list";
992
+ style: "bullet" | "ordered";
993
+ /**
994
+ * The number of spaces to indent this block. It must be a number between 0 and 8.
995
+ */
996
+ indent?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
997
+ offset?: number;
998
+ /**
999
+ * 0 or 1 (default 0) - if 1, a border is drawn on the left side of the block.
1000
+ */
1001
+ border?: 0 | 1;
1002
+ elements: RichTextSection[];
1003
+ };
1004
+ type RichTextPreformatted = {
1005
+ type: "rich_text_preformatted";
1006
+ elements: RichTextSectionElement[];
1007
+ /**
1008
+ * 0 or 1 (default 0) - if 1, a border is drawn on the left side of the block.
1009
+ */
1010
+ border?: 0 | 1;
1011
+ };
1012
+ type RichTextQuote = {
1013
+ type: "rich_text_quote";
1014
+ elements: RichTextSectionElement[];
1015
+ /**
1016
+ * 0 or 1 (default 0) - if 1, a border is drawn on the left side of the block.
1017
+ */
1018
+ border?: 0 | 1;
1019
+ };
1020
+ type RichTextSection = {
1021
+ type: "rich_text_section";
1022
+ elements: RichTextSectionElement[];
1023
+ };
1024
+ type RichTextBlockElement = RichTextList | RichTextPreformatted | RichTextQuote | RichTextSection;
1025
+ type RichTextSectionElement = RichTextSectionText | RichTextSectionChannel | RichTextSectionUser | RichTextSectionEmoji | RichTextSectionLink | RichTextSectionUsergroup | RichTextSectionBroadcast;
1026
+ type RichTextSectionText = {
1027
+ type: "text";
1028
+ text: string;
1029
+ style?: RichTextSectionElementStyleCode;
1030
+ };
1031
+ type RichTextSectionChannel = {
1032
+ type: "channel";
1033
+ channel_id: string;
1034
+ style?: RichTextSectionElementStyle;
1035
+ };
1036
+ type RichTextSectionUser = {
1037
+ type: "user";
1038
+ user_id: string;
1039
+ style?: RichTextSectionElementStyle;
1040
+ };
1041
+ type RichTextSectionEmoji = {
1042
+ type: "emoji";
1043
+ name: string;
1044
+ };
1045
+ type RichTextSectionLink = {
1046
+ type: "link";
1047
+ url: string;
1048
+ text: string;
1049
+ style?: RichTextSectionElementStyleCode;
1050
+ };
1051
+ type RichTextSectionUsergroup = {
1052
+ type: "usergroup";
1053
+ usergroup_id: string;
1054
+ style?: RichTextSectionElementStyle;
1055
+ };
1056
+ type RichTextSectionBroadcast = {
1057
+ type: "broadcast";
1058
+ range: "channel" | "here" | "everyone";
1059
+ style?: RichTextSectionElementStyleCode;
1060
+ };
1061
+ type RichTextSectionElementStyle = {
1062
+ bold?: boolean;
1063
+ italic?: boolean;
1064
+ strike?: boolean;
1065
+ highlight?: boolean;
1066
+ client_highlight?: boolean;
1067
+ unlink?: boolean;
1068
+ };
1069
+ type RichTextSectionElementStyleCode = {
1070
+ code?: boolean;
1071
+ bold?: boolean;
1072
+ italic?: boolean;
1073
+ strike?: boolean;
1074
+ };
1075
+
1070
1076
  type User = {
1071
1077
  id: string;
1072
1078
  name: string;
@@ -1081,7 +1087,8 @@ type Hooks = {
1081
1087
  atChannel?: () => ReactNode;
1082
1088
  atEveryone?: () => ReactNode;
1083
1089
  atHere?: () => ReactNode;
1084
- usergroup?: (data: Channel) => ReactNode;
1090
+ usergroup?: (id: string) => ReactNode;
1091
+ emoji?: (emoji_text: string) => ReactNode;
1085
1092
  date?: (data: {
1086
1093
  timestamp: string;
1087
1094
  format: string;
@@ -1092,6 +1099,7 @@ type Hooks = {
1092
1099
  type Data = {
1093
1100
  users: User[];
1094
1101
  channels: Channel[];
1102
+ user_groups: Channel[];
1095
1103
  hooks: Hooks;
1096
1104
  setUsers: (users: User[]) => void;
1097
1105
  setChannels: (channels: Channel[]) => void;
@@ -1118,9 +1126,14 @@ type Props = {
1118
1126
  data?: {
1119
1127
  users?: GlobalStore["users"];
1120
1128
  channels?: GlobalStore["channels"];
1129
+ user_groups?: GlobalStore["user_groups"];
1121
1130
  };
1122
1131
  hooks?: GlobalStore["hooks"];
1132
+ /**
1133
+ * If true, the header and the container which wraps the message will be removed and only the slack blocks will be returned.
1134
+ */
1135
+ withoutWrapper?: boolean;
1123
1136
  };
1124
1137
  declare const Message: (props: Props) => JSX.Element;
1125
1138
 
1126
- export { ActionsBlock, Block, ButtonElement, ChannelsSelectElement, CheckboxesElement, ConfirmDialogObject, ContextBlock, ConversationsSelectElement, DatePickerElement, DateTimePickerElement, DispatchActionConfigObject, DividerBlock, Element, EmailInputElement, ExternalSelectElement, FileBlock, FilterObject, HeaderBlock, ImageBlock, ImageElement, InputBlock, Message, MultiChannelsSelectElement, MultiConversationsSelectElement, MultiExternalSelectElement, MultiStaticSelectElement, MultiUsersSelectElement, NumberInputElement, OptionGroupObject, OptionObject, OptionObjectWithoutUrl, OverflowMenuElement, PlainTextInputElement, RadioButtonsElement, RichTextBlock, SectionBlock, StaticSelectElement, Style, TextObject, TextObjectTextType, TimePickerElement, UrlTextInputElement, UsersSelectElement, VideoBlock };
1139
+ export { ActionsBlock, Block, ButtonElement, ChannelsSelectElement, CheckboxesElement, ConfirmDialogObject, ContextBlock, ConversationsSelectElement, DatePickerElement, DateTimePickerElement, DispatchActionConfigObject, DividerBlock, Element, EmailInputElement, ExternalSelectElement, FileBlock, FilterObject, HeaderBlock, ImageBlock, ImageElement, InputBlock, Message, MultiChannelsSelectElement, MultiConversationsSelectElement, MultiExternalSelectElement, MultiStaticSelectElement, MultiUsersSelectElement, NumberInputElement, OptionGroupObject, OptionObject, OptionObjectWithoutUrl, OverflowMenuElement, PlainTextInputElement, RadioButtonsElement, RichTextBlock, RichTextBlockElement, RichTextBlockSubElement, RichTextList, RichTextPreformatted, RichTextQuote, RichTextSection, RichTextSectionBroadcast, RichTextSectionChannel, RichTextSectionElement, RichTextSectionElementStyle, RichTextSectionElementStyleCode, RichTextSectionEmoji, RichTextSectionLink, RichTextSectionText, RichTextSectionUser, RichTextSectionUsergroup, SectionBlock, StaticSelectElement, Style, TextObject, TextObjectTextType, TimePickerElement, UrlTextInputElement, UsersSelectElement, VideoBlock };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
 
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;
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 | RichTextBlockElement;
4
4
  type ButtonElement = {
5
5
  type: "button";
6
6
  /**
@@ -699,87 +699,6 @@ type FilterObject = {
699
699
  exclude_bot_users?: boolean;
700
700
  };
701
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
-
783
702
  type Block = ActionsBlock | ContextBlock | DividerBlock | FileBlock | HeaderBlock | ImageBlock | InputBlock | SectionBlock | VideoBlock | RichTextBlock;
784
703
  type ActionsBlock = {
785
704
  /**
@@ -1067,6 +986,93 @@ type RichTextBlock = {
1067
986
  elements: RichTextBlockElement[];
1068
987
  };
1069
988
 
989
+ type RichTextBlockSubElement = RichTextList | RichTextPreformatted | RichTextQuote | RichTextSection;
990
+ type RichTextList = {
991
+ type: "rich_text_list";
992
+ style: "bullet" | "ordered";
993
+ /**
994
+ * The number of spaces to indent this block. It must be a number between 0 and 8.
995
+ */
996
+ indent?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
997
+ offset?: number;
998
+ /**
999
+ * 0 or 1 (default 0) - if 1, a border is drawn on the left side of the block.
1000
+ */
1001
+ border?: 0 | 1;
1002
+ elements: RichTextSection[];
1003
+ };
1004
+ type RichTextPreformatted = {
1005
+ type: "rich_text_preformatted";
1006
+ elements: RichTextSectionElement[];
1007
+ /**
1008
+ * 0 or 1 (default 0) - if 1, a border is drawn on the left side of the block.
1009
+ */
1010
+ border?: 0 | 1;
1011
+ };
1012
+ type RichTextQuote = {
1013
+ type: "rich_text_quote";
1014
+ elements: RichTextSectionElement[];
1015
+ /**
1016
+ * 0 or 1 (default 0) - if 1, a border is drawn on the left side of the block.
1017
+ */
1018
+ border?: 0 | 1;
1019
+ };
1020
+ type RichTextSection = {
1021
+ type: "rich_text_section";
1022
+ elements: RichTextSectionElement[];
1023
+ };
1024
+ type RichTextBlockElement = RichTextList | RichTextPreformatted | RichTextQuote | RichTextSection;
1025
+ type RichTextSectionElement = RichTextSectionText | RichTextSectionChannel | RichTextSectionUser | RichTextSectionEmoji | RichTextSectionLink | RichTextSectionUsergroup | RichTextSectionBroadcast;
1026
+ type RichTextSectionText = {
1027
+ type: "text";
1028
+ text: string;
1029
+ style?: RichTextSectionElementStyleCode;
1030
+ };
1031
+ type RichTextSectionChannel = {
1032
+ type: "channel";
1033
+ channel_id: string;
1034
+ style?: RichTextSectionElementStyle;
1035
+ };
1036
+ type RichTextSectionUser = {
1037
+ type: "user";
1038
+ user_id: string;
1039
+ style?: RichTextSectionElementStyle;
1040
+ };
1041
+ type RichTextSectionEmoji = {
1042
+ type: "emoji";
1043
+ name: string;
1044
+ };
1045
+ type RichTextSectionLink = {
1046
+ type: "link";
1047
+ url: string;
1048
+ text: string;
1049
+ style?: RichTextSectionElementStyleCode;
1050
+ };
1051
+ type RichTextSectionUsergroup = {
1052
+ type: "usergroup";
1053
+ usergroup_id: string;
1054
+ style?: RichTextSectionElementStyle;
1055
+ };
1056
+ type RichTextSectionBroadcast = {
1057
+ type: "broadcast";
1058
+ range: "channel" | "here" | "everyone";
1059
+ style?: RichTextSectionElementStyleCode;
1060
+ };
1061
+ type RichTextSectionElementStyle = {
1062
+ bold?: boolean;
1063
+ italic?: boolean;
1064
+ strike?: boolean;
1065
+ highlight?: boolean;
1066
+ client_highlight?: boolean;
1067
+ unlink?: boolean;
1068
+ };
1069
+ type RichTextSectionElementStyleCode = {
1070
+ code?: boolean;
1071
+ bold?: boolean;
1072
+ italic?: boolean;
1073
+ strike?: boolean;
1074
+ };
1075
+
1070
1076
  type User = {
1071
1077
  id: string;
1072
1078
  name: string;
@@ -1081,7 +1087,8 @@ type Hooks = {
1081
1087
  atChannel?: () => ReactNode;
1082
1088
  atEveryone?: () => ReactNode;
1083
1089
  atHere?: () => ReactNode;
1084
- usergroup?: (data: Channel) => ReactNode;
1090
+ usergroup?: (id: string) => ReactNode;
1091
+ emoji?: (emoji_text: string) => ReactNode;
1085
1092
  date?: (data: {
1086
1093
  timestamp: string;
1087
1094
  format: string;
@@ -1092,6 +1099,7 @@ type Hooks = {
1092
1099
  type Data = {
1093
1100
  users: User[];
1094
1101
  channels: Channel[];
1102
+ user_groups: Channel[];
1095
1103
  hooks: Hooks;
1096
1104
  setUsers: (users: User[]) => void;
1097
1105
  setChannels: (channels: Channel[]) => void;
@@ -1118,9 +1126,14 @@ type Props = {
1118
1126
  data?: {
1119
1127
  users?: GlobalStore["users"];
1120
1128
  channels?: GlobalStore["channels"];
1129
+ user_groups?: GlobalStore["user_groups"];
1121
1130
  };
1122
1131
  hooks?: GlobalStore["hooks"];
1132
+ /**
1133
+ * If true, the header and the container which wraps the message will be removed and only the slack blocks will be returned.
1134
+ */
1135
+ withoutWrapper?: boolean;
1123
1136
  };
1124
1137
  declare const Message: (props: Props) => JSX.Element;
1125
1138
 
1126
- export { ActionsBlock, Block, ButtonElement, ChannelsSelectElement, CheckboxesElement, ConfirmDialogObject, ContextBlock, ConversationsSelectElement, DatePickerElement, DateTimePickerElement, DispatchActionConfigObject, DividerBlock, Element, EmailInputElement, ExternalSelectElement, FileBlock, FilterObject, HeaderBlock, ImageBlock, ImageElement, InputBlock, Message, MultiChannelsSelectElement, MultiConversationsSelectElement, MultiExternalSelectElement, MultiStaticSelectElement, MultiUsersSelectElement, NumberInputElement, OptionGroupObject, OptionObject, OptionObjectWithoutUrl, OverflowMenuElement, PlainTextInputElement, RadioButtonsElement, RichTextBlock, SectionBlock, StaticSelectElement, Style, TextObject, TextObjectTextType, TimePickerElement, UrlTextInputElement, UsersSelectElement, VideoBlock };
1139
+ export { ActionsBlock, Block, ButtonElement, ChannelsSelectElement, CheckboxesElement, ConfirmDialogObject, ContextBlock, ConversationsSelectElement, DatePickerElement, DateTimePickerElement, DispatchActionConfigObject, DividerBlock, Element, EmailInputElement, ExternalSelectElement, FileBlock, FilterObject, HeaderBlock, ImageBlock, ImageElement, InputBlock, Message, MultiChannelsSelectElement, MultiConversationsSelectElement, MultiExternalSelectElement, MultiStaticSelectElement, MultiUsersSelectElement, NumberInputElement, OptionGroupObject, OptionObject, OptionObjectWithoutUrl, OverflowMenuElement, PlainTextInputElement, RadioButtonsElement, RichTextBlock, RichTextBlockElement, RichTextBlockSubElement, RichTextList, RichTextPreformatted, RichTextQuote, RichTextSection, RichTextSectionBroadcast, RichTextSectionChannel, RichTextSectionElement, RichTextSectionElementStyle, RichTextSectionElementStyleCode, RichTextSectionEmoji, RichTextSectionLink, RichTextSectionText, RichTextSectionUser, RichTextSectionUsergroup, SectionBlock, StaticSelectElement, Style, TextObject, TextObjectTextType, TimePickerElement, UrlTextInputElement, UsersSelectElement, VideoBlock };