@apolitical/component-library 6.0.5 → 6.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apolitical/component-library",
3
- "version": "6.0.5",
3
+ "version": "6.1.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -0,0 +1 @@
1
+ export * from './poll';
@@ -0,0 +1 @@
1
+ export * from './poll-option';
@@ -0,0 +1 @@
1
+ export { default as PollOption, type IPollOptionProps } from './poll-option';
@@ -0,0 +1,18 @@
1
+ import type { IUserContext } from '../../../../context';
2
+ import type { IPollOption } from '../../poll.types';
3
+ export interface IPollOptionProps {
4
+ user: IUserContext;
5
+ option: IPollOption;
6
+ optionIndex: number;
7
+ totalPollVotes?: number;
8
+ allowMultipleVotes?: boolean;
9
+ showResults?: boolean;
10
+ hasVotedOnPoll?: boolean;
11
+ isTabbable?: boolean;
12
+ functions?: {
13
+ createVote: (option: IPollOption) => void;
14
+ setTabbableOption: (index: number) => void;
15
+ };
16
+ }
17
+ declare const PollOption: ({ user, option, optionIndex, totalPollVotes, allowMultipleVotes, showResults, hasVotedOnPoll, isTabbable, functions, }: IPollOptionProps) => import("react/jsx-runtime").JSX.Element;
18
+ export default PollOption;
@@ -0,0 +1,3 @@
1
+ export type { IPollOption, IPollUserVote } from './poll.types';
2
+ export { ResultsVisibility } from './poll.enums';
3
+ export { default as Poll, type IPollProps } from './poll';
@@ -0,0 +1,18 @@
1
+ import type { IPollOption } from './poll.types';
2
+ import { ResultsVisibility } from './poll.enums';
3
+ export interface IPollProps {
4
+ title: string;
5
+ options: IPollOption[];
6
+ settings?: {
7
+ showRemoveVote?: boolean;
8
+ allowMultipleVotes?: boolean;
9
+ hideParticipants?: boolean;
10
+ resultsVisibility?: ResultsVisibility;
11
+ };
12
+ functions: {
13
+ createVote: (optionId: string) => void;
14
+ removeVote: (voteId: string) => void;
15
+ };
16
+ }
17
+ declare const Poll: ({ title, options, settings, functions }: IPollProps) => import("react/jsx-runtime").JSX.Element;
18
+ export default Poll;
@@ -0,0 +1,4 @@
1
+ export declare enum ResultsVisibility {
2
+ Always = "always",
3
+ AfterVoting = "after-voting"
4
+ }
@@ -0,0 +1,9 @@
1
+ import { IPollOption } from './poll.types';
2
+ export declare const getFirstTabbableOption: (options: IPollOption[], allowMultipleVotes: boolean, userId?: string) => number;
3
+ export declare const getNextOrPrevElementAndIndexWithoutClass: (element: Element | null | undefined, className: string, direction: 'next' | 'prev', currentIndex?: number) => {
4
+ nextElement: null;
5
+ nextIndex: number;
6
+ } | {
7
+ nextElement: Element;
8
+ nextIndex: number;
9
+ };
@@ -0,0 +1,58 @@
1
+ export declare const actorMocks: {
2
+ me: {
3
+ created_at: string;
4
+ updated_at: string;
5
+ id: string;
6
+ image: {
7
+ thumbnail: string;
8
+ };
9
+ data: {
10
+ jobTitle: string;
11
+ location: {
12
+ code: string;
13
+ country: string;
14
+ en: string;
15
+ id: string;
16
+ };
17
+ name: string;
18
+ organization: string;
19
+ };
20
+ };
21
+ otherUser: {
22
+ created_at: string;
23
+ updated_at: string;
24
+ id: string;
25
+ data: {
26
+ jobTitle: string;
27
+ location: {
28
+ code: string;
29
+ country: string;
30
+ en: string;
31
+ id: string;
32
+ };
33
+ name: string;
34
+ organization: string;
35
+ };
36
+ };
37
+ };
38
+ export declare const loggedInUser: {
39
+ isLoading: boolean;
40
+ id: string;
41
+ name: string;
42
+ image: {
43
+ thumbnail: string;
44
+ };
45
+ jobTitle: string;
46
+ location: {
47
+ country: string;
48
+ };
49
+ };
50
+ export declare const optionsMock: {
51
+ id: string;
52
+ label: string;
53
+ numVotes: number;
54
+ hasUserVoted: boolean;
55
+ }[];
56
+ export declare const voteMock: {
57
+ id: string;
58
+ };
@@ -0,0 +1,10 @@
1
+ export interface IPollOption {
2
+ id: string;
3
+ label: string;
4
+ numVotes: number;
5
+ hasUserVoted: boolean;
6
+ userVote?: IPollUserVote;
7
+ }
8
+ export interface IPollUserVote {
9
+ id: string;
10
+ }