@apolitical/component-library 4.1.5 → 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/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/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/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 +40 -40
- package/index.mjs +5783 -5679
- 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 */
|
|
@@ -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';
|
|
@@ -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,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;
|