@fpkit/acss 3.0.0 → 3.1.1
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/libs/{chunk-23ANBDCR.js → chunk-4I5MF54P.js} +3 -3
- package/libs/chunk-4I5MF54P.js.map +1 -0
- package/libs/chunk-5RAWNUVD.js +8 -0
- package/libs/chunk-5RAWNUVD.js.map +1 -0
- package/libs/{chunk-D2PSO7MU.js → chunk-CWRNJA4P.js} +2 -2
- package/libs/{chunk-C622WBGW.cjs → chunk-DYFAUAB7.cjs} +3 -3
- package/libs/{chunk-MGPWZRBX.cjs → chunk-EE3ZWSBY.cjs} +3 -3
- package/libs/chunk-FMIM3332.js +8 -0
- package/libs/chunk-FMIM3332.js.map +1 -0
- package/libs/chunk-L6PRDL6F.cjs +31 -0
- package/libs/chunk-L6PRDL6F.cjs.map +1 -0
- package/libs/chunk-MPTMPBFT.js +9 -0
- package/libs/chunk-MPTMPBFT.js.map +1 -0
- package/libs/chunk-NWJDAHP6.cjs +17 -0
- package/libs/chunk-NWJDAHP6.cjs.map +1 -0
- package/libs/{chunk-G55UJ53G.cjs → chunk-NZVSXRTB.cjs} +3 -3
- package/libs/chunk-NZVSXRTB.cjs.map +1 -0
- package/libs/chunk-TNEJXNZA.cjs +22 -0
- package/libs/chunk-TNEJXNZA.cjs.map +1 -0
- package/libs/{chunk-QKHPHMG2.js → chunk-TPIB3RQP.js} +2 -2
- package/libs/components/breadcrumbs/breadcrumb.cjs +5 -5
- package/libs/components/breadcrumbs/breadcrumb.js +2 -2
- package/libs/components/dialog/dialog.cjs +4 -4
- package/libs/components/dialog/dialog.js +2 -2
- package/libs/components/flexbox/flex.css +1 -0
- package/libs/components/flexbox/flex.css.map +1 -0
- package/libs/components/flexbox/flex.min.css +3 -0
- package/libs/components/icons/icon.cjs +3 -3
- package/libs/components/icons/icon.js +1 -1
- package/libs/components/link/link.cjs +5 -5
- package/libs/components/link/link.css +1 -1
- package/libs/components/link/link.css.map +1 -1
- package/libs/components/link/link.js +1 -1
- package/libs/components/link/link.min.css +2 -2
- package/libs/components/popover/popover.cjs +4 -4
- package/libs/components/popover/popover.d.cts +1 -1
- package/libs/components/popover/popover.d.ts +1 -1
- package/libs/components/popover/popover.js +1 -1
- package/libs/components/tables/table.cjs +4 -4
- package/libs/components/tables/table.d.cts +1 -1
- package/libs/components/tables/table.d.ts +1 -1
- package/libs/components/tables/table.js +1 -1
- package/libs/hooks.cjs +3 -3
- package/libs/hooks.js +2 -2
- package/libs/icons.cjs +2 -2
- package/libs/icons.js +1 -1
- package/libs/index.cjs +43 -42
- package/libs/index.cjs.map +1 -1
- package/libs/index.css +1 -1
- package/libs/index.css.map +1 -1
- package/libs/index.d.cts +243 -52
- package/libs/index.d.ts +243 -52
- package/libs/index.js +16 -16
- package/libs/index.js.map +1 -1
- package/package.json +2 -2
- package/src/App.tsx +1 -3
- package/src/components/breadcrumbs/bc-item.tsx +0 -1
- package/src/components/flexbox/README.mdx +996 -0
- package/src/components/flexbox/STYLES.mdx +857 -0
- package/src/components/flexbox/flex.scss +847 -0
- package/src/components/flexbox/flex.stories.tsx +1934 -0
- package/src/components/flexbox/flex.test.tsx +689 -0
- package/src/components/flexbox/flex.tsx +484 -0
- package/src/components/flexbox/flex.types.ts +243 -0
- package/src/components/icons/components/arrow-right.tsx +0 -5
- package/src/components/kit.tsx +8 -4
- package/src/components/link/link.tsx +1 -1
- package/src/components/popover/popover.tsx +1 -1
- package/src/components/tables/table-elements.tsx +1 -1
- package/src/components/tables/table.tsx +2 -2
- package/src/components/text-to-speech/TextToSpeech.tsx +0 -4
- package/src/components/text-to-speech/useTextToSpeech.tsx +2 -6
- package/src/decorators/instructions.tsx +22 -18
- package/src/hooks/popover/popover.tsx +1 -1
- package/src/index.scss +1 -0
- package/src/index.ts +17 -0
- package/src/styles/flexbox/flex.css +736 -0
- package/src/styles/flexbox/flex.css.map +1 -0
- package/src/styles/index.css +735 -1
- package/src/styles/index.css.map +1 -1
- package/src/styles/link/link.css +1 -1
- package/src/types/component-props.ts +1 -0
- package/libs/chunk-23ANBDCR.js.map +0 -1
- package/libs/chunk-5QD3DWFI.js +0 -9
- package/libs/chunk-5QD3DWFI.js.map +0 -1
- package/libs/chunk-6WTC4JXH.cjs +0 -31
- package/libs/chunk-6WTC4JXH.cjs.map +0 -1
- package/libs/chunk-G55UJ53G.cjs.map +0 -1
- package/libs/chunk-KG4GHIQJ.js +0 -8
- package/libs/chunk-KG4GHIQJ.js.map +0 -1
- package/libs/chunk-US2I5GI7.cjs +0 -22
- package/libs/chunk-US2I5GI7.cjs.map +0 -1
- package/libs/chunk-Y2PFDELK.js +0 -8
- package/libs/chunk-Y2PFDELK.js.map +0 -1
- package/libs/chunk-ZOBAJTNE.cjs +0 -17
- package/libs/chunk-ZOBAJTNE.cjs.map +0 -1
- package/libs/components/alert/alert.min.min.css +0 -2
- package/libs/components/badge/badge.min.min.css +0 -2
- package/libs/components/breadcrumbs/breadcrumb.min.min.css +0 -2
- package/libs/components/buttons/button.min.min.css +0 -2
- package/libs/components/cards/card-style.min.min.css +0 -2
- package/libs/components/cards/card.min.min.css +0 -2
- package/libs/components/details/details.min.min.css +0 -2
- package/libs/components/dialog/dialog.min.min.css +0 -2
- package/libs/components/form/form.min.min.css +0 -2
- package/libs/components/icons/icon.min.min.css +0 -2
- package/libs/components/images/img.min.min.css +0 -2
- package/libs/components/layout/landmarks.min.min.css +0 -2
- package/libs/components/link/link.min.min.css +0 -2
- package/libs/components/list/list.min.min.css +0 -2
- package/libs/components/nav/nav.min.min.css +0 -2
- package/libs/components/progress/progress.min.min.css +0 -2
- package/libs/components/styles/index.min.min.css +0 -2
- package/libs/components/tag/tag.min.min.css +0 -2
- package/libs/components/text-to-speech/text-to-speech.min.min.css +0 -2
- /package/libs/{chunk-D2PSO7MU.js.map → chunk-CWRNJA4P.js.map} +0 -0
- /package/libs/{chunk-C622WBGW.cjs.map → chunk-DYFAUAB7.cjs.map} +0 -0
- /package/libs/{chunk-MGPWZRBX.cjs.map → chunk-EE3ZWSBY.cjs.map} +0 -0
- /package/libs/{chunk-QKHPHMG2.js.map → chunk-TPIB3RQP.js.map} +0 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for Flex container components
|
|
3
|
+
* Supports responsive flexbox layouts with CSS custom properties
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Valid HTML elements for Flex container
|
|
8
|
+
* Restricted to semantic container elements only
|
|
9
|
+
*/
|
|
10
|
+
export type FlexContainerElement =
|
|
11
|
+
| "div"
|
|
12
|
+
| "section"
|
|
13
|
+
| "article"
|
|
14
|
+
| "aside"
|
|
15
|
+
| "main"
|
|
16
|
+
| "header"
|
|
17
|
+
| "footer"
|
|
18
|
+
| "nav"
|
|
19
|
+
| "ul"
|
|
20
|
+
| "ol"
|
|
21
|
+
| "dl"
|
|
22
|
+
| "li"
|
|
23
|
+
| "form"
|
|
24
|
+
| "fieldset";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Valid HTML elements for Flex.Item
|
|
28
|
+
* Includes list item elements in addition to container elements
|
|
29
|
+
*/
|
|
30
|
+
export type FlexItemElement = FlexContainerElement | "li" | "dt" | "dd";
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Flex container direction
|
|
34
|
+
*/
|
|
35
|
+
export type FlexDirection = "row" | "row-reverse" | "column" | "column-reverse";
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Flex wrap behavior
|
|
39
|
+
*/
|
|
40
|
+
export type FlexWrap = "wrap" | "nowrap" | "wrap-reverse";
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Flex justify-content alignment
|
|
44
|
+
*/
|
|
45
|
+
export type FlexJustify =
|
|
46
|
+
| "start"
|
|
47
|
+
| "end"
|
|
48
|
+
| "center"
|
|
49
|
+
| "between"
|
|
50
|
+
| "around"
|
|
51
|
+
| "evenly";
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Flex align-items alignment
|
|
55
|
+
*/
|
|
56
|
+
export type FlexAlign = "start" | "end" | "center" | "baseline" | "stretch";
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Flex align-content alignment (multi-line)
|
|
60
|
+
*/
|
|
61
|
+
export type FlexAlignContent =
|
|
62
|
+
| "start"
|
|
63
|
+
| "end"
|
|
64
|
+
| "center"
|
|
65
|
+
| "between"
|
|
66
|
+
| "around"
|
|
67
|
+
| "evenly"
|
|
68
|
+
| "stretch";
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Flex align-self alignment (individual items)
|
|
72
|
+
*/
|
|
73
|
+
export type FlexAlignSelf =
|
|
74
|
+
| "auto"
|
|
75
|
+
| "start"
|
|
76
|
+
| "end"
|
|
77
|
+
| "center"
|
|
78
|
+
| "baseline"
|
|
79
|
+
| "stretch";
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Gap size options
|
|
83
|
+
*/
|
|
84
|
+
export type FlexGap = "0" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Preset flex layout variants
|
|
88
|
+
*/
|
|
89
|
+
export type FlexVariant = "center" | "between" | "around" | "stack" | "spread";
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Responsive flex properties for breakpoints
|
|
93
|
+
*/
|
|
94
|
+
export interface ResponsiveFlexProps {
|
|
95
|
+
/** Flex direction */
|
|
96
|
+
direction?: FlexDirection;
|
|
97
|
+
/** Flex wrap behavior */
|
|
98
|
+
wrap?: FlexWrap;
|
|
99
|
+
/** Gap between flex items */
|
|
100
|
+
gap?: FlexGap;
|
|
101
|
+
/** Row gap (vertical spacing) */
|
|
102
|
+
rowGap?: FlexGap;
|
|
103
|
+
/** Column gap (horizontal spacing) */
|
|
104
|
+
colGap?: FlexGap;
|
|
105
|
+
/** Justify content (main axis alignment) */
|
|
106
|
+
justify?: FlexJustify;
|
|
107
|
+
/** Align items (cross axis alignment) */
|
|
108
|
+
align?: FlexAlign;
|
|
109
|
+
/** Align content (multi-line alignment) */
|
|
110
|
+
alignContent?: FlexAlignContent;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Base Flex component props
|
|
115
|
+
*
|
|
116
|
+
* ## Semantic Elements Only
|
|
117
|
+
* The `as` prop is restricted to semantic container elements to ensure
|
|
118
|
+
* proper HTML structure and accessibility. Use only block-level container
|
|
119
|
+
* elements like div, section, article, or form elements.
|
|
120
|
+
*
|
|
121
|
+
* **Allowed elements**: div, section, article, aside, main, header, footer,
|
|
122
|
+
* nav, ul, ol, dl, form, fieldset
|
|
123
|
+
*
|
|
124
|
+
* **Not allowed**: span, a, button, input, or other inline/interactive elements
|
|
125
|
+
*/
|
|
126
|
+
export interface FlexProps
|
|
127
|
+
extends ResponsiveFlexProps,
|
|
128
|
+
Omit<React.HTMLAttributes<HTMLElement>, "className"> {
|
|
129
|
+
/** Preset layout variant */
|
|
130
|
+
variant?: FlexVariant;
|
|
131
|
+
/** Use inline-flex instead of flex */
|
|
132
|
+
inline?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Element type to render as
|
|
135
|
+
* @remarks Restricted to semantic container elements only for proper HTML structure
|
|
136
|
+
*/
|
|
137
|
+
as?: FlexContainerElement;
|
|
138
|
+
/** Additional CSS class names */
|
|
139
|
+
className?: string;
|
|
140
|
+
/** Inline styles and CSS custom properties */
|
|
141
|
+
styles?: React.CSSProperties;
|
|
142
|
+
/** Children elements */
|
|
143
|
+
children?: React.ReactNode;
|
|
144
|
+
/** Responsive props for small screens (≥30rem / 480px) */
|
|
145
|
+
sm?: ResponsiveFlexProps;
|
|
146
|
+
/** Responsive props for medium screens (≥48rem / 768px) */
|
|
147
|
+
md?: ResponsiveFlexProps;
|
|
148
|
+
/** Responsive props for large screens (≥62rem / 992px) */
|
|
149
|
+
lg?: ResponsiveFlexProps;
|
|
150
|
+
/** Responsive props for extra large screens (≥80rem / 1280px) */
|
|
151
|
+
xl?: ResponsiveFlexProps;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Flex.Item component props
|
|
156
|
+
*
|
|
157
|
+
* ## Semantic Elements
|
|
158
|
+
* The `as` prop accepts container elements plus list item elements (li, dt, dd)
|
|
159
|
+
* to support semantic list structures within flex containers.
|
|
160
|
+
*
|
|
161
|
+
* **Allowed elements**: div, section, article, aside, main, header, footer,
|
|
162
|
+
* nav, ul, ol, dl, form, fieldset, li, dt, dd
|
|
163
|
+
*/
|
|
164
|
+
export interface FlexItemProps
|
|
165
|
+
extends Omit<React.HTMLAttributes<HTMLElement>, "className"> {
|
|
166
|
+
/** Flex grow factor */
|
|
167
|
+
grow?: 0 | 1;
|
|
168
|
+
/** Flex shrink factor */
|
|
169
|
+
shrink?: 0 | 1;
|
|
170
|
+
/** Flex basis */
|
|
171
|
+
basis?: "auto" | "0" | "full";
|
|
172
|
+
/** Flex shorthand: '1' | 'auto' | 'initial' | 'none' */
|
|
173
|
+
flex?: "1" | "auto" | "initial" | "none";
|
|
174
|
+
/** Align self (overrides parent align-items) */
|
|
175
|
+
alignSelf?: FlexAlignSelf;
|
|
176
|
+
/** Order of the flex item */
|
|
177
|
+
order?: "first" | "last" | "none";
|
|
178
|
+
/**
|
|
179
|
+
* Element type to render as
|
|
180
|
+
* @remarks Includes list item elements (li, dt, dd) in addition to container elements
|
|
181
|
+
*/
|
|
182
|
+
as?: FlexItemElement;
|
|
183
|
+
/** Additional CSS class names */
|
|
184
|
+
className?: string;
|
|
185
|
+
/** Inline styles and CSS custom properties */
|
|
186
|
+
styles?: React.CSSProperties;
|
|
187
|
+
/** Children elements */
|
|
188
|
+
children?: React.ReactNode;
|
|
189
|
+
/** Responsive props for small screens (≥30rem / 480px) */
|
|
190
|
+
sm?: {
|
|
191
|
+
flex?: "1" | "auto" | "none";
|
|
192
|
+
};
|
|
193
|
+
/** Responsive props for medium screens (≥48rem / 768px) */
|
|
194
|
+
md?: {
|
|
195
|
+
flex?: "1" | "auto" | "none";
|
|
196
|
+
};
|
|
197
|
+
/** Responsive props for large screens (≥62rem / 992px) */
|
|
198
|
+
lg?: {
|
|
199
|
+
flex?: "1" | "auto" | "none";
|
|
200
|
+
};
|
|
201
|
+
/** Responsive props for extra large screens (≥80rem / 1280px) */
|
|
202
|
+
xl?: {
|
|
203
|
+
flex?: "1" | "auto" | "none";
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Flex.Spacer component props
|
|
209
|
+
* Creates an auto-expanding spacer element (flex: 1)
|
|
210
|
+
*
|
|
211
|
+
* ## Semantic Elements Only
|
|
212
|
+
* The `as` prop is restricted to container elements. Spacers are purely
|
|
213
|
+
* presentational and should use non-semantic containers like div.
|
|
214
|
+
*
|
|
215
|
+
* **Allowed elements**: div, section, article, aside, main, header, footer,
|
|
216
|
+
* nav, ul, ol, dl, form, fieldset
|
|
217
|
+
*/
|
|
218
|
+
export interface FlexSpacerProps
|
|
219
|
+
extends Omit<React.HTMLAttributes<HTMLElement>, "className"> {
|
|
220
|
+
/**
|
|
221
|
+
* Element type to render as
|
|
222
|
+
* @remarks Restricted to container elements. Default is 'div'.
|
|
223
|
+
*/
|
|
224
|
+
as?: FlexContainerElement;
|
|
225
|
+
/** Additional CSS class names */
|
|
226
|
+
className?: string;
|
|
227
|
+
/** Inline styles and CSS custom properties */
|
|
228
|
+
styles?: React.CSSProperties;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Combined Flex component type with sub-components
|
|
233
|
+
*/
|
|
234
|
+
export type FlexComponent = React.ForwardRefExoticComponent<
|
|
235
|
+
FlexProps & React.RefAttributes<HTMLElement>
|
|
236
|
+
> & {
|
|
237
|
+
Item: React.ForwardRefExoticComponent<
|
|
238
|
+
FlexItemProps & React.RefAttributes<HTMLElement>
|
|
239
|
+
>;
|
|
240
|
+
Spacer: React.ForwardRefExoticComponent<
|
|
241
|
+
FlexSpacerProps & React.RefAttributes<HTMLElement>
|
|
242
|
+
>;
|
|
243
|
+
};
|
package/src/components/kit.tsx
CHANGED
|
@@ -20,13 +20,13 @@ type PropsToOmit<C extends React.ElementType, P> = keyof (AsProp<C> & P)
|
|
|
20
20
|
|
|
21
21
|
type PolymorphicComponentProp<
|
|
22
22
|
C extends React.ElementType,
|
|
23
|
-
Props =
|
|
23
|
+
Props = object,
|
|
24
24
|
> = React.PropsWithChildren<Props & AsProp<C>> &
|
|
25
25
|
Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>
|
|
26
26
|
|
|
27
27
|
type PolymorphicComponentPropWithRef<
|
|
28
28
|
C extends React.ElementType,
|
|
29
|
-
Props =
|
|
29
|
+
Props = object,
|
|
30
30
|
> = PolymorphicComponentProp<C, Props> & { ref?: PolymorphicRef<C> }
|
|
31
31
|
|
|
32
32
|
type TextProps<C extends React.ElementType> = PolymorphicComponentPropWithRef<
|
|
@@ -36,9 +36,9 @@ type TextProps<C extends React.ElementType> = PolymorphicComponentPropWithRef<
|
|
|
36
36
|
|
|
37
37
|
type TextComponent = <C extends React.ElementType = 'span'>(
|
|
38
38
|
props: TextProps<C>,
|
|
39
|
-
) => React.ReactElement |
|
|
39
|
+
) => React.ReactElement | null
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
const TextRef = React.forwardRef(
|
|
42
42
|
<C extends React.ElementType = 'span'>(
|
|
43
43
|
{ as, color, children }: TextProps<C>,
|
|
44
44
|
ref?: PolymorphicRef<C>,
|
|
@@ -54,3 +54,7 @@ export const Text: TextComponent = React.forwardRef(
|
|
|
54
54
|
)
|
|
55
55
|
},
|
|
56
56
|
)
|
|
57
|
+
|
|
58
|
+
TextRef.displayName = 'Text'
|
|
59
|
+
|
|
60
|
+
export const Text = TextRef as unknown as TextComponent
|
|
@@ -35,7 +35,7 @@ export const Td = ({ children, ...props }: ComponentProps) => (
|
|
|
35
35
|
</FP>
|
|
36
36
|
)
|
|
37
37
|
|
|
38
|
-
export const Table = ({ id,
|
|
38
|
+
export const Table = ({ id, children, ...props }: ComponentProps) => {
|
|
39
39
|
return (
|
|
40
40
|
<FP
|
|
41
41
|
as="section"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Table, Caption, Thead, Tbody,
|
|
1
|
+
import { Table, Caption, Thead, Tbody, Tr } from './table-elements'
|
|
2
2
|
import { ComponentProps } from '../../types'
|
|
3
3
|
|
|
4
4
|
import React from 'react'
|
|
@@ -24,7 +24,7 @@ export const RenderHead = (data: []) => {
|
|
|
24
24
|
/**
|
|
25
25
|
* Render the table body `tr`, `td` with the data provided
|
|
26
26
|
*/
|
|
27
|
-
export const RenderBody = (data:
|
|
27
|
+
export const RenderBody = (data: Record<string, unknown>[]) => {
|
|
28
28
|
const rec = data.map((item, index) => {
|
|
29
29
|
return (
|
|
30
30
|
<tr key={index}>
|
|
@@ -37,7 +37,6 @@ export const TextToSpeech: React.FC<TextToSpeechComponentProps> = ({
|
|
|
37
37
|
voice,
|
|
38
38
|
pitch = 1,
|
|
39
39
|
rate = 1,
|
|
40
|
-
language,
|
|
41
40
|
label,
|
|
42
41
|
onEnd,
|
|
43
42
|
}) => {
|
|
@@ -48,11 +47,8 @@ export const TextToSpeech: React.FC<TextToSpeechComponentProps> = ({
|
|
|
48
47
|
cancel,
|
|
49
48
|
isSpeaking,
|
|
50
49
|
isPaused,
|
|
51
|
-
getAvailableLanguages,
|
|
52
|
-
availableVoices,
|
|
53
50
|
} = useTextToSpeech()
|
|
54
51
|
const [text, setText] = useState<string>(initialText)
|
|
55
|
-
console.log(getAvailableLanguages())
|
|
56
52
|
|
|
57
53
|
useEffect(() => {
|
|
58
54
|
setText(initialText)
|
|
@@ -32,9 +32,6 @@ export const useTextToSpeech = (initialVoice?: SpeechSynthesisVoice) => {
|
|
|
32
32
|
|
|
33
33
|
const [isSpeaking, setIsSpeaking] = useState<boolean>(false)
|
|
34
34
|
const [isPaused, setIsPaused] = useState<boolean>(false)
|
|
35
|
-
const [utterance, setUtterance] = useState<SpeechSynthesisUtterance | null>(
|
|
36
|
-
null,
|
|
37
|
-
)
|
|
38
35
|
|
|
39
36
|
useEffect(() => {
|
|
40
37
|
const updateVoices = () => {
|
|
@@ -103,12 +100,11 @@ export const useTextToSpeech = (initialVoice?: SpeechSynthesisVoice) => {
|
|
|
103
100
|
|
|
104
101
|
if ('speechSynthesis' in window) {
|
|
105
102
|
window.speechSynthesis.speak(utterance)
|
|
106
|
-
setUtterance(utterance)
|
|
107
103
|
setIsSpeaking(true)
|
|
108
104
|
setIsPaused(false)
|
|
109
105
|
} else {
|
|
110
|
-
|
|
111
|
-
|
|
106
|
+
// Speech synthesis not supported - silently skip
|
|
107
|
+
setIsSpeaking(false)
|
|
112
108
|
}
|
|
113
109
|
}
|
|
114
110
|
|
|
@@ -21,24 +21,28 @@ import UI from "#components/ui";
|
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
export const WithInstructions =
|
|
24
|
-
(instructions?: React.ReactNode, title?: string) =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
(instructions?: React.ReactNode, title?: string) => {
|
|
25
|
+
const DecoratorComponent = (Story: StoryFn) => {
|
|
26
|
+
return (
|
|
27
|
+
<UI
|
|
28
|
+
style={{
|
|
29
|
+
paddingBlock: "2rem",
|
|
30
|
+
display: "flex",
|
|
31
|
+
flexDirection: "column",
|
|
32
|
+
gap: "3rem",
|
|
33
|
+
width: "max(320px, 90%)",
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
<Story />
|
|
37
|
+
<div style={{ paddingInline: "1rem" }}>
|
|
38
|
+
<h3>{title || "Story Instructions"}</h3>
|
|
39
|
+
{instructions}
|
|
40
|
+
</div>
|
|
41
|
+
</UI>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
DecoratorComponent.displayName = 'WithInstructionsDecorator';
|
|
45
|
+
return DecoratorComponent;
|
|
42
46
|
};
|
|
43
47
|
|
|
44
48
|
export default WithInstructions;
|
|
@@ -28,7 +28,7 @@ export type PopoverProps = {
|
|
|
28
28
|
*
|
|
29
29
|
* Transforms and opacity animate the popover enter/exit.
|
|
30
30
|
*/
|
|
31
|
-
export const Popover = ({ children
|
|
31
|
+
export const Popover = ({ children }: PopoverProps) => {
|
|
32
32
|
const hoverRef = React.useRef(null)
|
|
33
33
|
const popOverRef = React.useRef(null)
|
|
34
34
|
const { isVisible, popoverPosition, handlePointerEvent, handlePointerLeave } =
|
package/src/index.scss
CHANGED
package/src/index.ts
CHANGED
|
@@ -34,6 +34,23 @@ export { TextToSpeech } from "./components/text-to-speech/TextToSpeech";
|
|
|
34
34
|
|
|
35
35
|
// Layout components
|
|
36
36
|
export * from "./components/layout/landmarks";
|
|
37
|
+
export { default as Flex } from "./components/flexbox/flex";
|
|
38
|
+
export type {
|
|
39
|
+
FlexProps,
|
|
40
|
+
FlexItemProps,
|
|
41
|
+
FlexSpacerProps,
|
|
42
|
+
FlexContainerElement,
|
|
43
|
+
FlexItemElement,
|
|
44
|
+
FlexDirection,
|
|
45
|
+
FlexWrap,
|
|
46
|
+
FlexJustify,
|
|
47
|
+
FlexAlign,
|
|
48
|
+
FlexAlignContent,
|
|
49
|
+
FlexAlignSelf,
|
|
50
|
+
FlexGap,
|
|
51
|
+
FlexVariant,
|
|
52
|
+
ResponsiveFlexProps,
|
|
53
|
+
} from "./components/flexbox/flex.types";
|
|
37
54
|
|
|
38
55
|
// Navigation components
|
|
39
56
|
export * from "./components/nav/nav";
|