@apolitical/component-library 4.1.4 → 4.1.6-SW.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/cards/cards.types.d.ts +2 -0
- package/communities/community-details/community-details.d.ts +3 -1
- package/communities/join-button/join-button.d.ts +5 -1
- package/form/components/character-limit/character-limit.d.ts +8 -0
- package/form/components/character-limit/character-limit.helpers.d.ts +5 -0
- package/form/components/character-limit/index.d.ts +2 -0
- package/form/components/form/form.types.d.ts +23 -21
- package/form/components/index.d.ts +1 -0
- package/form/components/rich-text-editor/components/toolbar/toolbar.data.d.ts +1 -1
- package/form/components/rich-text-editor/helpers/ast-types/ast-types.d.ts +65 -47
- package/form/components/rich-text-editor/helpers/handle-text/handle-text.d.ts +3 -0
- package/form/components/rich-text-editor/helpers/handle-text/index.d.ts +1 -0
- package/form/components/rich-text-editor/helpers/hot-keys/hot-keys.config.d.ts +4 -0
- package/form/components/rich-text-editor/helpers/hot-keys/hot-keys.d.ts +3 -4
- package/form/components/rich-text-editor/helpers/hot-keys/index.d.ts +2 -1
- package/form/components/rich-text-editor/helpers/index.d.ts +1 -0
- package/form/components/rich-text-editor/helpers/transform/transform.d.ts +2 -1
- package/form/components/rich-text-editor/hooks/use-selected-link/use-selected-link.d.ts +1 -0
- package/form/components/rich-text-editor/rich-text-editor.d.ts +3 -1
- package/form/components/rich-text-editor/rich-text-editor.types.d.ts +29 -6
- package/general/buttons/button/button.d.ts +3 -4
- package/helpers/dates.d.ts +1 -0
- package/helpers/intl.d.ts +6 -0
- package/index.js +59 -59
- package/index.mjs +7073 -6955
- package/package.json +1 -1
- package/style.css +1 -1
- package/styles/variables/colors/theme/_discussion.scss +1 -0
- package/styles/variables/colors/theme/_text.scss +1 -0
- package/text/content-type-label/content-type-label.types.d.ts +1 -1
- package/text/pill/pill.d.ts +4 -2
package/cards/cards.types.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { IJoinButtonProps } from './../join-button';
|
|
|
3
3
|
interface Props extends IJoinButtonProps {
|
|
4
4
|
/** If the user is a member of the community */
|
|
5
5
|
isMember?: boolean;
|
|
6
|
+
/** If the community is open */
|
|
7
|
+
isOpen?: boolean;
|
|
6
8
|
/** The slug for the community */
|
|
7
9
|
slug: string;
|
|
8
10
|
/** Details about members in the community */
|
|
@@ -19,5 +21,5 @@ interface Props extends IJoinButtonProps {
|
|
|
19
21
|
/** Additional classes */
|
|
20
22
|
className?: string;
|
|
21
23
|
}
|
|
22
|
-
declare const CommunityDetails: ({ className, isMember, slug, members: { number: membersCount, data: membersData }, functions: { invite, ...membershipFunctions }, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare const CommunityDetails: ({ className, isMember, isOpen, slug, members: { number: membersCount, data: membersData }, functions: { invite, ...membershipFunctions }, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
23
25
|
export default CommunityDetails;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
export interface IJoinButtonProps {
|
|
2
2
|
/** If the user is a member of the community */
|
|
3
3
|
isMember?: boolean;
|
|
4
|
+
/** If the community is open */
|
|
5
|
+
isOpen?: boolean;
|
|
4
6
|
/** If the button should use the short version of the text */
|
|
5
7
|
isShort?: boolean;
|
|
8
|
+
/** If the button is disabled */
|
|
9
|
+
disabled?: boolean;
|
|
6
10
|
/** The function to call when the user clicks the button */
|
|
7
11
|
functions?: {
|
|
8
12
|
/** The function to request to join */
|
|
@@ -13,5 +17,5 @@ export interface IJoinButtonProps {
|
|
|
13
17
|
/** The language to use */
|
|
14
18
|
locale?: string;
|
|
15
19
|
}
|
|
16
|
-
declare const JoinButton: ({ isMember: userIsMember, isShort, functions: { join, leave }, }: IJoinButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare const JoinButton: ({ isMember: userIsMember, isOpen, isShort, disabled, functions: { join, leave }, }: IJoinButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
21
|
export default JoinButton;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
/** The limit of characters allowed in the field */
|
|
3
|
+
limit: number;
|
|
4
|
+
/** The number of characters in the field value */
|
|
5
|
+
valueLength: number;
|
|
6
|
+
};
|
|
7
|
+
declare const CharacterLimit: ({ limit, valueLength }: Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export default CharacterLimit;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FieldOnChange, IFieldFunctions } from '../../../form/components/form/form.types';
|
|
2
|
+
export declare const getValueLength: (value: string | number | boolean | null | undefined) => number;
|
|
3
|
+
export declare const getCharacterLimitProps: (limit: number, onChange?: FieldOnChange | null) => {
|
|
4
|
+
[key: string]: number | IFieldFunctions;
|
|
5
|
+
};
|
|
@@ -59,6 +59,28 @@ export interface IFieldValidation {
|
|
|
59
59
|
condition: FieldValidationConditions;
|
|
60
60
|
error?: string;
|
|
61
61
|
}
|
|
62
|
+
export type FieldOnChange = (arg1: FormValues, arg2?: ({ type, payload, }: {
|
|
63
|
+
type: string;
|
|
64
|
+
payload?: {
|
|
65
|
+
[key: string]: string | boolean;
|
|
66
|
+
};
|
|
67
|
+
}) => void) => void;
|
|
68
|
+
export interface IFieldFunctions {
|
|
69
|
+
/** The function to call when the field changes */
|
|
70
|
+
onChange: FieldOnChange;
|
|
71
|
+
/** The function to call when the field is submitted */
|
|
72
|
+
onMultiSelectSubmit?: (arg1: FormValues) => void;
|
|
73
|
+
/** The function to call when the field is blurred */
|
|
74
|
+
onBlur?: () => void;
|
|
75
|
+
/** The function to call when the field is focused */
|
|
76
|
+
onFocus?: () => void;
|
|
77
|
+
/** The function to call when a key is pressed */
|
|
78
|
+
onKeyInput?: <T>(arg1: FormValues) => Promise<T>;
|
|
79
|
+
/** The function to call when a key is pressed */
|
|
80
|
+
onKeyDown?: (e: React.KeyboardEvent<HTMLElement>) => void;
|
|
81
|
+
/** The function to call when the form is submitted from a field */
|
|
82
|
+
submitForm?: (arg: IFormValues) => void;
|
|
83
|
+
}
|
|
62
84
|
export interface IField {
|
|
63
85
|
/** Optional ID of the element which describes this field, for screen readers */
|
|
64
86
|
'aria-describedby'?: string;
|
|
@@ -83,27 +105,7 @@ export interface IField {
|
|
|
83
105
|
/** What element to render the field as, defaulting to `input` */
|
|
84
106
|
element?: string;
|
|
85
107
|
/** The functions being passed to the field */
|
|
86
|
-
functions?:
|
|
87
|
-
/** The function to call when the field changes */
|
|
88
|
-
onChange: (arg1: FormValues, arg2?: ({ type, payload, }: {
|
|
89
|
-
type: string;
|
|
90
|
-
payload?: {
|
|
91
|
-
[key: string]: string | boolean;
|
|
92
|
-
};
|
|
93
|
-
}) => void) => void;
|
|
94
|
-
/** The function to call when the field is submitted */
|
|
95
|
-
onMultiSelectSubmit?: (arg1: FormValues) => void;
|
|
96
|
-
/** The function to call when the field is blurred */
|
|
97
|
-
onBlur?: () => void;
|
|
98
|
-
/** The function to call when the field is focused */
|
|
99
|
-
onFocus?: () => void;
|
|
100
|
-
/** The function to call when a key is pressed */
|
|
101
|
-
onKeyInput?: <T>(arg1: FormValues) => Promise<T>;
|
|
102
|
-
/** The function to call when a key is pressed */
|
|
103
|
-
onKeyDown?: (e: React.KeyboardEvent<HTMLElement>) => void;
|
|
104
|
-
/** The function to call when the form is submitted from a field */
|
|
105
|
-
submitForm?: (arg: IFormValues) => void;
|
|
106
|
-
};
|
|
108
|
+
functions?: IFieldFunctions;
|
|
107
109
|
/** The Google Tag Manager data to be passed to the field */
|
|
108
110
|
gtm?: {
|
|
109
111
|
/** The context of the event for GTM */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { BlockOptionType, MarkOptionType } from '
|
|
1
|
+
import { BlockOptionType, MarkOptionType } from './../../rich-text-editor.types';
|
|
2
2
|
export declare const marks: MarkOptionType[];
|
|
3
3
|
export declare const blocks: BlockOptionType[];
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { Formatting, Marks } from './../../rich-text-editor.types';
|
|
1
2
|
export interface NodeTypes {
|
|
2
|
-
paragraph: string;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
link: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
heading: {
|
|
3
|
+
[Formatting.paragraph]: string;
|
|
4
|
+
[Formatting.blockquote]: string;
|
|
5
|
+
[Formatting.codeblock]: string;
|
|
6
|
+
[Formatting.link]: string;
|
|
7
|
+
[Formatting.ul]: string;
|
|
8
|
+
[Formatting.ol]: string;
|
|
9
|
+
[Formatting.li]: string;
|
|
10
|
+
[Formatting.heading]: {
|
|
10
11
|
1: string;
|
|
11
12
|
2: string;
|
|
12
13
|
3: string;
|
|
@@ -14,21 +15,38 @@ export interface NodeTypes {
|
|
|
14
15
|
5: string;
|
|
15
16
|
6: string;
|
|
16
17
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
image: string;
|
|
18
|
+
[Marks.emphasis]: string;
|
|
19
|
+
[Marks.strong]: string;
|
|
20
|
+
[Marks.delete]: string;
|
|
21
|
+
[Marks.code]: string;
|
|
22
|
+
[Formatting.hr]: string;
|
|
23
|
+
[Formatting.image]: string;
|
|
23
24
|
}
|
|
24
|
-
export
|
|
25
|
+
export declare enum MdastNodes {
|
|
26
|
+
paragraph = "paragraph",
|
|
27
|
+
heading = "heading",
|
|
28
|
+
list = "list",
|
|
29
|
+
listItem = "listItem",
|
|
30
|
+
link = "link",
|
|
31
|
+
image = "image",
|
|
32
|
+
blockquote = "blockquote",
|
|
33
|
+
code = "code",
|
|
34
|
+
html = "html",
|
|
35
|
+
emphasis = "emphasis",
|
|
36
|
+
strong = "strong",
|
|
37
|
+
delete = "delete",
|
|
38
|
+
inlineCode = "inlineCode",
|
|
39
|
+
thematicBreak = "thematicBreak",
|
|
40
|
+
text = "text"
|
|
41
|
+
}
|
|
42
|
+
export type MdastNodeType = MdastNodes.paragraph | MdastNodes.heading | MdastNodes.list | MdastNodes.listItem | MdastNodes.link | MdastNodes.image | MdastNodes.blockquote | MdastNodes.code | MdastNodes.html | MdastNodes.emphasis | MdastNodes.strong | MdastNodes.delete | MdastNodes.inlineCode | MdastNodes.thematicBreak | MdastNodes.text;
|
|
25
43
|
export declare const defaultNodeTypes: NodeTypes;
|
|
26
44
|
export interface LeafType {
|
|
27
45
|
text: string;
|
|
28
|
-
|
|
29
|
-
bold?: boolean;
|
|
30
|
-
italic?: boolean;
|
|
31
|
-
code?: boolean;
|
|
46
|
+
[Formatting.strikethrough]?: boolean;
|
|
47
|
+
[Formatting.bold]?: boolean;
|
|
48
|
+
[Formatting.italic]?: boolean;
|
|
49
|
+
[Formatting.code]?: boolean;
|
|
32
50
|
parentType?: string;
|
|
33
51
|
}
|
|
34
52
|
export interface BlockType {
|
|
@@ -41,14 +59,14 @@ export interface BlockType {
|
|
|
41
59
|
children: Array<BlockType | LeafType>;
|
|
42
60
|
}
|
|
43
61
|
export interface InputNodeTypes {
|
|
44
|
-
paragraph: string;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
link: string;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
heading: {
|
|
62
|
+
[Formatting.paragraph]: string;
|
|
63
|
+
[Formatting.blockquote]: string;
|
|
64
|
+
[Formatting.codeblock]: string;
|
|
65
|
+
[Formatting.link]: string;
|
|
66
|
+
[Formatting.ul]: string;
|
|
67
|
+
[Formatting.ol]: string;
|
|
68
|
+
[Formatting.li]: string;
|
|
69
|
+
[Formatting.heading]: {
|
|
52
70
|
1: string;
|
|
53
71
|
2: string;
|
|
54
72
|
3: string;
|
|
@@ -56,12 +74,12 @@ export interface InputNodeTypes {
|
|
|
56
74
|
5: string;
|
|
57
75
|
6: string;
|
|
58
76
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
image: string;
|
|
77
|
+
[Marks.emphasis]: string;
|
|
78
|
+
[Marks.strong]: string;
|
|
79
|
+
[Marks.delete]: string;
|
|
80
|
+
[Marks.code]: string;
|
|
81
|
+
[Formatting.hr]: string;
|
|
82
|
+
[Formatting.image]: string;
|
|
65
83
|
}
|
|
66
84
|
type RecursivePartial<T> = {
|
|
67
85
|
[P in keyof T]?: RecursivePartial<T[P]>;
|
|
@@ -91,65 +109,65 @@ export type TextNode = {
|
|
|
91
109
|
text?: string | undefined;
|
|
92
110
|
};
|
|
93
111
|
export type CodeBlockNode<T extends InputNodeTypes> = {
|
|
94
|
-
type: T[
|
|
112
|
+
type: T[Formatting.codeblock];
|
|
95
113
|
language: string | undefined;
|
|
96
114
|
children: Array<TextNode>;
|
|
97
115
|
};
|
|
98
116
|
export type HeadingNode<T extends InputNodeTypes> = {
|
|
99
|
-
type: T[
|
|
117
|
+
type: T[Formatting.heading][1] | T[Formatting.heading][2] | T[Formatting.heading][3] | T[Formatting.heading][4] | T[Formatting.heading][5] | T[Formatting.heading][6];
|
|
100
118
|
children: Array<DeserializedNode<T>>;
|
|
101
119
|
};
|
|
102
120
|
export type ListNode<T extends InputNodeTypes> = {
|
|
103
|
-
type: T[
|
|
121
|
+
type: T[Formatting.ol] | T[Formatting.ul];
|
|
104
122
|
children: Array<DeserializedNode<T>>;
|
|
105
123
|
};
|
|
106
124
|
export type ListItemNode<T extends InputNodeTypes> = {
|
|
107
|
-
type: T[
|
|
125
|
+
type: T[Formatting.li];
|
|
108
126
|
children: Array<DeserializedNode<T>>;
|
|
109
127
|
};
|
|
110
128
|
export type ParagraphNode<T extends InputNodeTypes> = {
|
|
111
|
-
type: T[
|
|
129
|
+
type: T[Formatting.paragraph];
|
|
112
130
|
break?: true;
|
|
113
131
|
children: Array<DeserializedNode<T>>;
|
|
114
132
|
};
|
|
115
133
|
export type LinkNode<T extends InputNodeTypes> = {
|
|
116
|
-
type: T[
|
|
134
|
+
type: T[Formatting.link];
|
|
117
135
|
children: Array<DeserializedNode<T>>;
|
|
118
136
|
[urlKey: string]: string | undefined | Array<DeserializedNode<T>>;
|
|
119
137
|
};
|
|
120
138
|
export type ImageNode<T extends InputNodeTypes> = {
|
|
121
|
-
type: T[
|
|
139
|
+
type: T[Formatting.image];
|
|
122
140
|
children: Array<DeserializedNode<T>>;
|
|
123
141
|
[sourceOrCaptionKey: string]: string | undefined | Array<DeserializedNode<T>>;
|
|
124
142
|
};
|
|
125
143
|
export type BlockQuoteNode<T extends InputNodeTypes> = {
|
|
126
|
-
type: T[
|
|
144
|
+
type: T[Formatting.blockquote];
|
|
127
145
|
children: Array<DeserializedNode<T>>;
|
|
128
146
|
};
|
|
129
147
|
export type InlineCodeMarkNode<T extends InputNodeTypes> = {
|
|
130
|
-
type: T[
|
|
148
|
+
type: T[Marks.code];
|
|
131
149
|
children: Array<TextNode>;
|
|
132
150
|
language: string | undefined;
|
|
133
151
|
};
|
|
134
152
|
export type ThematicBreakNode<T extends InputNodeTypes> = {
|
|
135
|
-
type: T[
|
|
153
|
+
type: T[Formatting.hr];
|
|
136
154
|
children: Array<DeserializedNode<T>>;
|
|
137
155
|
};
|
|
138
156
|
export type ItalicNode<T extends InputNodeTypes> = {
|
|
139
|
-
[K in T[
|
|
157
|
+
[K in T[Marks.emphasis]]: true;
|
|
140
158
|
} & {
|
|
141
159
|
children: TextNode;
|
|
142
160
|
};
|
|
143
161
|
export type BoldNode = {
|
|
144
|
-
bold: true;
|
|
162
|
+
[Formatting.bold]: true;
|
|
145
163
|
children: TextNode;
|
|
146
164
|
};
|
|
147
165
|
export type StrikeThoughNode = {
|
|
148
|
-
|
|
166
|
+
[Formatting.strikethrough]: true;
|
|
149
167
|
children: TextNode;
|
|
150
168
|
};
|
|
151
169
|
export type InlineCodeNode = {
|
|
152
|
-
code: true;
|
|
170
|
+
[Formatting.code]: true;
|
|
153
171
|
text: string | undefined;
|
|
154
172
|
};
|
|
155
173
|
export type DeserializedNode<T extends InputNodeTypes> = CodeBlockNode<T> | HeadingNode<T> | ListNode<T> | ListItemNode<T> | ParagraphNode<T> | LinkNode<T> | ImageNode<T> | BlockQuoteNode<T> | InlineCodeMarkNode<T> | ThematicBreakNode<T> | ItalicNode<T> | BoldNode | StrikeThoughNode | InlineCodeNode | TextNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './handle-text';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export default HOTKEYS;
|
|
1
|
+
import { Dispatch } from 'react';
|
|
2
|
+
import { BaseEditor } from 'slate';
|
|
3
|
+
export declare const handleHotKeys: (e: React.KeyboardEvent<HTMLDivElement> | React.KeyboardEvent<HTMLTextAreaElement>, editor: BaseEditor, dispatch: Dispatch<any>, reportError: (message: string) => void) => void;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './hot-keys';
|
|
2
|
+
export { default as HOTKEYS } from './hot-keys.config';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { Formatting } from './../../rich-text-editor.types';
|
|
1
2
|
import { BlockQuoteNode, CodeBlockNode, HeadingNode, ImageNode, InputNodeTypes, ItalicNode, LinkNode, ListItemNode, ListNode, MdastNode, OptionType, ParagraphNode, ThematicBreakNode } from './../ast-types';
|
|
2
3
|
export default function transform<T extends InputNodeTypes>(node: MdastNode, opts?: OptionType<T>): CodeBlockNode<T> | HeadingNode<T> | ListNode<T> | ListItemNode<T> | ParagraphNode<T> | LinkNode<T> | ImageNode<T> | BlockQuoteNode<T> | ThematicBreakNode<T> | ItalicNode<T> | {
|
|
3
|
-
type:
|
|
4
|
+
type: Formatting;
|
|
4
5
|
children: {
|
|
5
6
|
text: string;
|
|
6
7
|
}[];
|
|
@@ -6,6 +6,8 @@ interface Props {
|
|
|
6
6
|
value?: string;
|
|
7
7
|
/** The placeholder text of the rich text editor */
|
|
8
8
|
placeholder?: string;
|
|
9
|
+
/** The maximum length of the rich text editor */
|
|
10
|
+
maxLength?: number;
|
|
9
11
|
/** Optional functions */
|
|
10
12
|
functions?: {
|
|
11
13
|
/** An optional event handler, called when the rich text editor is changed */
|
|
@@ -20,5 +22,5 @@ interface Props {
|
|
|
20
22
|
/** Optional aria error message */
|
|
21
23
|
'aria-errormessage'?: string;
|
|
22
24
|
}
|
|
23
|
-
declare const RichTextEditor: ({ id, value, placeholder, functions, autoFocus, ...props }: Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
25
|
+
declare const RichTextEditor: ({ id, value, placeholder, maxLength, functions, autoFocus, ...props }: Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
24
26
|
export default RichTextEditor;
|
|
@@ -1,24 +1,47 @@
|
|
|
1
1
|
import { BaseElement, BaseText, Descendant } from 'slate';
|
|
2
|
+
export declare enum Formatting {
|
|
3
|
+
blockquote = "block_quote",
|
|
4
|
+
bold = "bold",
|
|
5
|
+
code = "code",
|
|
6
|
+
codeblock = "code_block",
|
|
7
|
+
heading = "heading",
|
|
8
|
+
hr = "thematic_break",
|
|
9
|
+
image = "image",
|
|
10
|
+
italic = "italic",
|
|
11
|
+
li = "list_item",
|
|
12
|
+
link = "link",
|
|
13
|
+
ol = "ol_list",
|
|
14
|
+
paragraph = "paragraph",
|
|
15
|
+
ul = "ul_list",
|
|
16
|
+
strikethrough = "strikeThrough",
|
|
17
|
+
span = "span"
|
|
18
|
+
}
|
|
19
|
+
export declare enum Marks {
|
|
20
|
+
delete = "delete_mark",
|
|
21
|
+
emphasis = "emphasis_mark",
|
|
22
|
+
code = "inline_code_mark",
|
|
23
|
+
strong = "strong_mark"
|
|
24
|
+
}
|
|
2
25
|
export interface BaseProps {
|
|
3
26
|
className?: string;
|
|
4
27
|
[key: string]: unknown;
|
|
5
28
|
}
|
|
6
|
-
export type BlockOptionType =
|
|
29
|
+
export type BlockOptionType = Formatting.blockquote | Formatting.link | Formatting.li | Formatting.ol | Formatting.ul | Formatting.paragraph | Formatting.span;
|
|
7
30
|
export interface TypeElement extends BaseElement {
|
|
8
31
|
type: BlockOptionType;
|
|
9
32
|
}
|
|
10
|
-
export type MarkOptionType =
|
|
33
|
+
export type MarkOptionType = Formatting.bold | Formatting.italic | Formatting.strikethrough;
|
|
11
34
|
export interface TypeText extends BaseText {
|
|
12
|
-
bold?: boolean;
|
|
13
|
-
italic?: boolean;
|
|
14
|
-
|
|
35
|
+
[Formatting.bold]?: boolean;
|
|
36
|
+
[Formatting.italic]?: boolean;
|
|
37
|
+
[Formatting.strikethrough]?: boolean;
|
|
15
38
|
}
|
|
16
39
|
export type OptionTypes = {
|
|
17
40
|
format: BlockOptionType | MarkOptionType;
|
|
18
41
|
hasDivider?: boolean;
|
|
19
42
|
};
|
|
20
43
|
export type LinkElement = {
|
|
21
|
-
type:
|
|
44
|
+
type: Formatting.link;
|
|
22
45
|
link: string;
|
|
23
46
|
children: Descendant[];
|
|
24
47
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import addClasses from 'classnames';
|
|
3
2
|
export type ButtonIconType = false | string | {
|
|
4
3
|
icon: string;
|
|
5
4
|
position?: 'left' | 'right';
|
|
@@ -42,6 +41,8 @@ export interface ButtonPropsType {
|
|
|
42
41
|
disabled?: boolean | {
|
|
43
42
|
isClickable: boolean;
|
|
44
43
|
};
|
|
44
|
+
/** An optional tooltip for the button. This will only apply when disabled is true */
|
|
45
|
+
tooltip?: string;
|
|
45
46
|
/** This is an optional way to pass in text which is only for screen readers
|
|
46
47
|
* It's rendered on the page (so the page is still functional without CSS, unlike ARIA labels) but hidden
|
|
47
48
|
* with CSS, for cases where the whole button should be an icon
|
|
@@ -66,7 +67,5 @@ export interface ButtonPropsType {
|
|
|
66
67
|
/** The test ID for Jest tests */
|
|
67
68
|
'data-testid'?: string;
|
|
68
69
|
}
|
|
69
|
-
declare const Button: ({ variant, size, styling, icon, href, element, onClick, className, disabled, screenreaderText, children, ...rest }: ButtonPropsType) =>
|
|
70
|
-
[key: string]: string | boolean | addClasses.ArgumentArray | (() => void) | ((e: React.KeyboardEvent<HTMLElement>) => void) | ((e: React.MouseEvent<HTMLElement>) => void) | React.RefObject<HTMLButtonElement>;
|
|
71
|
-
}, Element>;
|
|
70
|
+
declare const Button: ({ variant, size, styling, icon, href, element, onClick, className, disabled, tooltip, screenreaderText, children, ...rest }: ButtonPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
72
71
|
export default Button;
|
package/helpers/dates.d.ts
CHANGED
|
@@ -25,4 +25,5 @@ export declare const getShortDateHowLongAgo: IGetShortDateHowLongAgo;
|
|
|
25
25
|
export declare const getDateWithDelta: IGetDateWithDelta;
|
|
26
26
|
export declare const dateToUTC: (date?: Date) => Date;
|
|
27
27
|
export declare const dateWithin: (dateInPast: DateType, number: number, unit: 'seconds' | 'minutes' | 'hours') => boolean;
|
|
28
|
+
export declare const isDateWithinXDays: (dateInPast: DateType, days: number) => boolean;
|
|
28
29
|
export {};
|
package/helpers/intl.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export declare const checkIntlPathExists: (path: string, language?: {
|
|
|
51
51
|
joinCommunityButton_member_aria: string;
|
|
52
52
|
joinCommunityButton_leave: string;
|
|
53
53
|
joinCommunityButton_leaving: string;
|
|
54
|
+
joinCommunityButton_closed_tooltip: string;
|
|
54
55
|
member_apolitical: string;
|
|
55
56
|
member_community: string;
|
|
56
57
|
membersList: string;
|
|
@@ -181,6 +182,8 @@ export declare const checkIntlPathExists: (path: string, language?: {
|
|
|
181
182
|
emailHelperTextBox_error_noFunction: string;
|
|
182
183
|
form_fieldWrapper_required: string;
|
|
183
184
|
form_fieldWrapper_characterLimit: string;
|
|
185
|
+
form_fieldWrapper_characterLimit_aria_default: string;
|
|
186
|
+
form_fieldWrapper_characterLimit_aria_over: string;
|
|
184
187
|
form_error_generalError: string;
|
|
185
188
|
form_error_required: string;
|
|
186
189
|
form_error_numbers: string;
|
|
@@ -226,6 +229,9 @@ export declare const checkIntlPathExists: (path: string, language?: {
|
|
|
226
229
|
richTextEditor_italic: string;
|
|
227
230
|
richTextEditor_strikeThrough: string;
|
|
228
231
|
richTextEditor_link: string;
|
|
232
|
+
richTextEditor_link_text: string;
|
|
233
|
+
richTextEditor_link_text_aria: string;
|
|
234
|
+
richTextEditor_link_url: string;
|
|
229
235
|
richTextEditor_link_placeholder: string;
|
|
230
236
|
richTextEditor_link_error_required: string;
|
|
231
237
|
richTextEditor_link_open: string;
|