@fpkit/acss 3.1.0 → 3.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/libs/{chunk-2NRIP6RB.cjs → chunk-2C3YLBWP.cjs} +3 -3
- package/libs/{chunk-NWJDAHP6.cjs → chunk-2GJHKWEK.cjs} +3 -3
- package/libs/{chunk-FVROL3V5.js → chunk-2JCDEC32.js} +3 -3
- package/libs/{chunk-IRLFZ3OL.js → chunk-3XJC4XUG.js} +2 -2
- package/libs/{chunk-23ANBDCR.js → chunk-4I5MF54P.js} +3 -3
- package/libs/chunk-4I5MF54P.js.map +1 -0
- package/libs/chunk-5CJPTDK3.cjs +31 -0
- package/libs/chunk-5CJPTDK3.cjs.map +1 -0
- package/libs/{chunk-E4OSROCA.cjs → chunk-5QSNJQVH.cjs} +3 -3
- package/libs/{chunk-O3JIHC5M.cjs → chunk-6BUJZ4DJ.cjs} +3 -3
- package/libs/{chunk-WXBFBWYF.cjs → chunk-AFINOD2L.cjs} +3 -3
- package/libs/{chunk-HRRHPLER.js → chunk-AWZLSWDO.js} +2 -2
- package/libs/chunk-DDSXKOUB.js +7 -0
- package/libs/chunk-DDSXKOUB.js.map +1 -0
- package/libs/{chunk-CWRNJA4P.js → chunk-DIJBIOFE.js} +3 -3
- package/libs/chunk-EJ6KYBFE.cjs +13 -0
- package/libs/chunk-EJ6KYBFE.cjs.map +1 -0
- package/libs/{chunk-GUJSMQ3V.cjs → chunk-EKJYOCLY.cjs} +3 -3
- package/libs/{chunk-X5RKCLDC.cjs → chunk-F64GE6RG.cjs} +4 -4
- package/libs/chunk-FMIM3332.js +8 -0
- package/libs/chunk-FMIM3332.js.map +1 -0
- package/libs/{chunk-5RAWNUVD.js → chunk-IBUTNPTQ.js} +2 -2
- package/libs/chunk-IWP4VJEP.cjs +18 -0
- package/libs/chunk-IWP4VJEP.cjs.map +1 -0
- package/libs/{chunk-ZFJ4U45S.js → chunk-KDMX3FAW.js} +2 -2
- package/libs/{chunk-DYFAUAB7.cjs → chunk-LXODKKA3.cjs} +4 -4
- package/libs/chunk-M7JLT62Q.js +9 -0
- package/libs/chunk-M7JLT62Q.js.map +1 -0
- package/libs/{chunk-IQ76HGVP.js → chunk-MBWI67UT.js} +2 -2
- package/libs/{chunk-O5XAJ7BY.cjs → chunk-NCGVF2QS.cjs} +4 -4
- package/libs/{chunk-W2UIN7EV.cjs → chunk-NPWHQVYB.cjs} +3 -3
- package/libs/{chunk-G55UJ53G.cjs → chunk-NZVSXRTB.cjs} +3 -3
- package/libs/chunk-NZVSXRTB.cjs.map +1 -0
- package/libs/{chunk-43TK2ICH.js → chunk-PMWL5XZ4.js} +3 -3
- package/libs/{chunk-KVKQLRJG.js → chunk-TF3GQKOY.js} +2 -2
- package/libs/chunk-TNEJXNZA.cjs +22 -0
- package/libs/chunk-TNEJXNZA.cjs.map +1 -0
- package/libs/{chunk-IEB64SWY.js → chunk-U5VA34SU.js} +2 -2
- package/libs/chunk-UGMP72J2.js +8 -0
- package/libs/chunk-UGMP72J2.js.map +1 -0
- package/libs/{chunk-MGPWZRBX.cjs → chunk-URBGDUFN.cjs} +6 -6
- package/libs/{chunk-QKHPHMG2.js → chunk-ZF6Y7W57.js} +5 -5
- package/libs/component-props-50e69975.d.ts +66 -0
- package/libs/components/box/box.css +1 -0
- package/libs/components/box/box.css.map +1 -0
- package/libs/components/box/box.min.css +3 -0
- package/libs/components/breadcrumbs/breadcrumb.cjs +6 -6
- package/libs/components/breadcrumbs/breadcrumb.js +3 -3
- package/libs/components/button.cjs +4 -4
- package/libs/components/button.d.cts +10 -3
- package/libs/components/button.d.ts +10 -3
- package/libs/components/button.js +2 -2
- package/libs/components/card.cjs +7 -7
- package/libs/components/card.d.cts +13 -85
- package/libs/components/card.d.ts +13 -85
- package/libs/components/card.js +2 -2
- package/libs/components/cards/card.css +1 -1
- package/libs/components/cards/card.css.map +1 -1
- package/libs/components/cards/card.min.css +2 -2
- package/libs/components/cluster/cluster.css +1 -0
- package/libs/components/cluster/cluster.css.map +1 -0
- package/libs/components/cluster/cluster.min.css +3 -0
- package/libs/components/dialog/dialog.cjs +7 -7
- package/libs/components/dialog/dialog.js +5 -5
- package/libs/components/form/fields.cjs +4 -4
- package/libs/components/form/fields.js +2 -2
- package/libs/components/form/textarea.cjs +4 -4
- package/libs/components/form/textarea.js +2 -2
- package/libs/components/grid/grid.css +1 -0
- package/libs/components/grid/grid.css.map +1 -0
- package/libs/components/grid/grid.min.css +3 -0
- package/libs/components/heading/heading.cjs +3 -3
- package/libs/components/heading/heading.js +2 -2
- package/libs/components/icons/icon.cjs +4 -4
- package/libs/components/icons/icon.d.cts +2 -2
- package/libs/components/icons/icon.d.ts +2 -2
- package/libs/components/icons/icon.js +2 -2
- package/libs/components/link/link.cjs +6 -6
- package/libs/components/link/link.js +2 -2
- package/libs/components/list/list.cjs +5 -5
- package/libs/components/list/list.js +2 -2
- package/libs/components/modal.cjs +4 -4
- package/libs/components/modal.d.cts +1 -1
- package/libs/components/modal.d.ts +1 -1
- package/libs/components/modal.js +3 -3
- package/libs/components/nav/nav.cjs +7 -7
- package/libs/components/nav/nav.js +3 -3
- 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/stack/stack.css +1 -0
- package/libs/components/stack/stack.css.map +1 -0
- package/libs/components/stack/stack.min.css +3 -0
- package/libs/components/tables/table.cjs +4 -4
- package/libs/components/tables/table.d.cts +2 -2
- package/libs/components/tables/table.d.ts +2 -2
- package/libs/components/tables/table.js +1 -1
- package/libs/components/text/text.cjs +5 -5
- package/libs/components/text/text.js +2 -2
- package/libs/hooks.cjs +4 -4
- package/libs/hooks.js +3 -3
- package/libs/{icons-287fce3a.d.ts → icons-df8e744f.d.ts} +1 -1
- package/libs/icons.cjs +3 -3
- package/libs/icons.d.cts +2 -2
- package/libs/icons.d.ts +2 -2
- package/libs/icons.js +2 -2
- package/libs/index.cjs +74 -73
- 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 +925 -6
- package/libs/index.d.ts +925 -6
- package/libs/index.js +30 -30
- package/libs/index.js.map +1 -1
- package/package.json +2 -2
- package/src/App.tsx +1 -3
- package/src/components/alert/STYLES.mdx +790 -0
- package/src/components/badge/STYLES.mdx +610 -0
- package/src/components/box/README.mdx +401 -0
- package/src/components/box/STYLES.mdx +360 -0
- package/src/components/box/box.scss +245 -0
- package/src/components/box/box.stories.tsx +395 -0
- package/src/components/box/box.test.tsx +425 -0
- package/src/components/box/box.tsx +170 -0
- package/src/components/box/box.types.ts +166 -0
- package/src/components/breadcrumbs/STYLES.mdx +99 -0
- package/src/components/breadcrumbs/bc-item.tsx +0 -1
- package/src/components/buttons/STYLES.mdx +766 -0
- package/src/components/cards/STYLES.mdx +835 -0
- package/src/components/cards/card.scss +29 -21
- package/src/components/cards/card.tsx +13 -3
- package/src/components/cards/card.types.ts +13 -0
- package/src/components/cluster/README.mdx +595 -0
- package/src/components/cluster/STYLES.mdx +626 -0
- package/src/components/cluster/cluster.scss +86 -0
- package/src/components/cluster/cluster.stories.tsx +385 -0
- package/src/components/cluster/cluster.test.tsx +655 -0
- package/src/components/cluster/cluster.tsx +94 -0
- package/src/components/cluster/cluster.types.ts +75 -0
- package/src/components/details/STYLES.mdx +445 -0
- package/src/components/dialog/STYLES.mdx +888 -0
- package/src/components/flexbox/STYLES.mdx +857 -0
- package/src/components/flexbox/flex.stories.tsx +842 -141
- package/src/components/flexbox/flex.types.ts +25 -6
- package/src/components/form/STYLES.mdx +821 -0
- package/src/components/grid/README.mdx +709 -0
- package/src/components/grid/STYLES.mdx +785 -0
- package/src/components/grid/grid.scss +287 -0
- package/src/components/grid/grid.stories.tsx +486 -0
- package/src/components/grid/grid.test.tsx +981 -0
- package/src/components/grid/grid.tsx +222 -0
- package/src/components/grid/grid.types.ts +344 -0
- package/src/components/icons/STYLES.mdx +56 -0
- package/src/components/icons/components/arrow-right.tsx +0 -5
- package/src/components/images/STYLES.mdx +75 -0
- package/src/components/kit.tsx +8 -4
- package/src/components/layout/STYLES.mdx +556 -0
- package/src/components/link/STYLES.mdx +75 -0
- package/src/components/list/STYLES.mdx +631 -0
- package/src/components/nav/STYLES.mdx +460 -0
- package/src/components/popover/popover.tsx +1 -1
- package/src/components/progress/STYLES.mdx +64 -0
- package/src/components/stack/README.mdx +400 -0
- package/src/components/stack/STYLES.mdx +414 -0
- package/src/components/stack/stack.scss +109 -0
- package/src/components/stack/stack.stories.tsx +559 -0
- package/src/components/stack/stack.test.tsx +426 -0
- package/src/components/stack/stack.tsx +141 -0
- package/src/components/stack/stack.types.ts +133 -0
- package/src/components/tables/table-elements.tsx +1 -1
- package/src/components/tables/table.tsx +2 -2
- package/src/components/tag/STYLES.mdx +105 -0
- package/src/components/text-to-speech/STYLES.mdx +80 -0
- package/src/components/text-to-speech/TextToSpeech.tsx +0 -4
- package/src/components/text-to-speech/useTextToSpeech.tsx +2 -6
- package/src/components/ui.tsx +3 -3
- package/src/decorators/instructions.tsx +22 -18
- package/src/hooks/popover/popover.tsx +1 -1
- package/src/index.scss +5 -1
- package/src/index.ts +305 -12
- package/src/sass/GLOBALS-STYLES.md +631 -0
- package/src/sass/_globals.scss +45 -24
- package/src/styles/box/box.css +220 -0
- package/src/styles/box/box.css.map +1 -0
- package/src/styles/cards/card.css +22 -17
- package/src/styles/cards/card.css.map +1 -1
- package/src/styles/cluster/cluster.css +71 -0
- package/src/styles/cluster/cluster.css.map +1 -0
- package/src/styles/grid/grid.css +238 -0
- package/src/styles/grid/grid.css.map +1 -0
- package/src/styles/index.css +667 -49
- package/src/styles/index.css.map +1 -1
- package/src/styles/stack/stack.css +86 -0
- package/src/styles/stack/stack.css.map +1 -0
- package/src/types/component-props.ts +42 -13
- package/src/types/layout-primitives.ts +48 -0
- package/src/types/shared.ts +10 -26
- 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-ENTCUJ3A.cjs +0 -13
- package/libs/chunk-ENTCUJ3A.cjs.map +0 -1
- package/libs/chunk-G55UJ53G.cjs.map +0 -1
- package/libs/chunk-HHLNOC5T.js +0 -7
- package/libs/chunk-HHLNOC5T.js.map +0 -1
- package/libs/chunk-KK47SYZI.js +0 -8
- package/libs/chunk-KK47SYZI.js.map +0 -1
- package/libs/chunk-US2I5GI7.cjs +0 -22
- package/libs/chunk-US2I5GI7.cjs.map +0 -1
- package/libs/chunk-W5TKWBFC.cjs +0 -18
- package/libs/chunk-W5TKWBFC.cjs.map +0 -1
- package/libs/chunk-Y2PFDELK.js +0 -8
- package/libs/chunk-Y2PFDELK.js.map +0 -1
- package/libs/component-props-67d978a2.d.ts +0 -38
- /package/libs/{chunk-2NRIP6RB.cjs.map → chunk-2C3YLBWP.cjs.map} +0 -0
- /package/libs/{chunk-NWJDAHP6.cjs.map → chunk-2GJHKWEK.cjs.map} +0 -0
- /package/libs/{chunk-FVROL3V5.js.map → chunk-2JCDEC32.js.map} +0 -0
- /package/libs/{chunk-IRLFZ3OL.js.map → chunk-3XJC4XUG.js.map} +0 -0
- /package/libs/{chunk-E4OSROCA.cjs.map → chunk-5QSNJQVH.cjs.map} +0 -0
- /package/libs/{chunk-O3JIHC5M.cjs.map → chunk-6BUJZ4DJ.cjs.map} +0 -0
- /package/libs/{chunk-WXBFBWYF.cjs.map → chunk-AFINOD2L.cjs.map} +0 -0
- /package/libs/{chunk-HRRHPLER.js.map → chunk-AWZLSWDO.js.map} +0 -0
- /package/libs/{chunk-CWRNJA4P.js.map → chunk-DIJBIOFE.js.map} +0 -0
- /package/libs/{chunk-GUJSMQ3V.cjs.map → chunk-EKJYOCLY.cjs.map} +0 -0
- /package/libs/{chunk-X5RKCLDC.cjs.map → chunk-F64GE6RG.cjs.map} +0 -0
- /package/libs/{chunk-5RAWNUVD.js.map → chunk-IBUTNPTQ.js.map} +0 -0
- /package/libs/{chunk-ZFJ4U45S.js.map → chunk-KDMX3FAW.js.map} +0 -0
- /package/libs/{chunk-DYFAUAB7.cjs.map → chunk-LXODKKA3.cjs.map} +0 -0
- /package/libs/{chunk-IQ76HGVP.js.map → chunk-MBWI67UT.js.map} +0 -0
- /package/libs/{chunk-O5XAJ7BY.cjs.map → chunk-NCGVF2QS.cjs.map} +0 -0
- /package/libs/{chunk-W2UIN7EV.cjs.map → chunk-NPWHQVYB.cjs.map} +0 -0
- /package/libs/{chunk-43TK2ICH.js.map → chunk-PMWL5XZ4.js.map} +0 -0
- /package/libs/{chunk-KVKQLRJG.js.map → chunk-TF3GQKOY.js.map} +0 -0
- /package/libs/{chunk-IEB64SWY.js.map → chunk-U5VA34SU.js.map} +0 -0
- /package/libs/{chunk-MGPWZRBX.cjs.map → chunk-URBGDUFN.cjs.map} +0 -0
- /package/libs/{chunk-QKHPHMG2.js.map → chunk-ZF6Y7W57.js.map} +0 -0
|
@@ -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}>
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Meta } from "@storybook/addon-docs/blocks";
|
|
2
|
+
|
|
3
|
+
<Meta title="FP.REACT Components/Tag/Styles" />
|
|
4
|
+
|
|
5
|
+
# Tag Styles
|
|
6
|
+
|
|
7
|
+
Status indicator tag styling with semantic variants and WCAG 2.1 AA compliance.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
The fpkit tag system provides visual status indicators using role-based
|
|
12
|
+
selectors with support for alpha, beta, stable, and production variants.
|
|
13
|
+
|
|
14
|
+
### Key Features
|
|
15
|
+
|
|
16
|
+
- **Four semantic variants** - Alpha, beta, stable, production
|
|
17
|
+
- **Visual indicators** - Icons beyond color for accessibility
|
|
18
|
+
- **WCAG compliant** - Color contrast meets AA standards
|
|
19
|
+
- **Pill shape** - Fully rounded borders
|
|
20
|
+
- **CSS custom properties** - Full theming control
|
|
21
|
+
- **Rem-based sizing** - All measurements use rem units (1rem = 16px)
|
|
22
|
+
|
|
23
|
+
## CSS Custom Properties
|
|
24
|
+
|
|
25
|
+
```css
|
|
26
|
+
[data-tag] {
|
|
27
|
+
/* Variant colors */
|
|
28
|
+
--beta: #fbbf24; /* Amber */
|
|
29
|
+
--stable: #0f7c3e; /* Dark green */
|
|
30
|
+
--production: #1e3a8a; /* Dark blue */
|
|
31
|
+
|
|
32
|
+
/* Tag styling */
|
|
33
|
+
--tag-padding-inline: 0.7rem; /* 11.2px */
|
|
34
|
+
--tag-padding-block: 0.2rem; /* 3.2px */
|
|
35
|
+
--tag-fs: 0.8rem; /* 12.8px */
|
|
36
|
+
--tag-radius: 99rem; /* Pill shape */
|
|
37
|
+
--tag-bg: lightgray;
|
|
38
|
+
--tag-fw: 500;
|
|
39
|
+
--tag-color: currentColor;
|
|
40
|
+
--tag-display: inline-block;
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Tag Variants
|
|
45
|
+
|
|
46
|
+
### Alpha Tag
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<span data-tag="alpha">Alpha</span>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Displays:** ⚠ Alpha (amber background, warning symbol)
|
|
53
|
+
|
|
54
|
+
### Beta Tag
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<span data-tag="beta">Beta</span>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Displays:** ⚠ Beta (amber background, warning symbol)
|
|
61
|
+
|
|
62
|
+
### Stable Tag
|
|
63
|
+
|
|
64
|
+
```html
|
|
65
|
+
<span data-tag="stable">Stable</span>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Displays:** ✓ Stable (green background, checkmark symbol)
|
|
69
|
+
|
|
70
|
+
### Production Tag
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<span data-tag="production">Production</span>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Displays:** ● Production (blue background, live indicator)
|
|
77
|
+
|
|
78
|
+
## Real-World Examples
|
|
79
|
+
|
|
80
|
+
### Feature Status
|
|
81
|
+
|
|
82
|
+
```html
|
|
83
|
+
<h3>
|
|
84
|
+
New Dashboard
|
|
85
|
+
<span data-tag="beta">Beta</span>
|
|
86
|
+
</h3>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### API Endpoint Status
|
|
90
|
+
|
|
91
|
+
```html
|
|
92
|
+
<code>/api/users</code> <span data-tag="stable">Stable</span>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Environment Indicator
|
|
96
|
+
|
|
97
|
+
```html
|
|
98
|
+
<span data-tag="production">Production Environment</span>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Related Resources
|
|
102
|
+
|
|
103
|
+
- **React Component** - See README for React Tag component API
|
|
104
|
+
- **WCAG 2.1: Color Contrast** -
|
|
105
|
+
https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Meta } from "@storybook/addon-docs/blocks";
|
|
2
|
+
|
|
3
|
+
<Meta title="FP.REACT Components/Text-to-Speech/Styles" />
|
|
4
|
+
|
|
5
|
+
# Text-to-Speech Styles
|
|
6
|
+
|
|
7
|
+
Text-to-speech control styling with button and display components using CSS
|
|
8
|
+
custom properties.
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
The fpkit text-to-speech (TTS) system provides styling for TTS control panels
|
|
13
|
+
with play/pause buttons and text display areas.
|
|
14
|
+
|
|
15
|
+
### Key Features
|
|
16
|
+
|
|
17
|
+
- **Flexbox layout** - Centered controls and text
|
|
18
|
+
- **Pill-shaped container** - Rounded borders
|
|
19
|
+
- **Button styling** - Integrated button controls
|
|
20
|
+
- **CSS custom properties** - Full theming control
|
|
21
|
+
- **Rem-based sizing** - All measurements use rem units (1rem = 16px)
|
|
22
|
+
|
|
23
|
+
## CSS Custom Properties
|
|
24
|
+
|
|
25
|
+
```css
|
|
26
|
+
[data-tts] {
|
|
27
|
+
/* Layout */
|
|
28
|
+
--tts-gap: 0.5rem; /* 8px */
|
|
29
|
+
--tts-align-items: center;
|
|
30
|
+
--tts-justify-content: center;
|
|
31
|
+
|
|
32
|
+
/* Colors */
|
|
33
|
+
--tts-bg: #fff;
|
|
34
|
+
--tts-border-color: currentColor;
|
|
35
|
+
|
|
36
|
+
/* Borders */
|
|
37
|
+
--tts-border-width: 0.125rem; /* 2px */
|
|
38
|
+
--tts-border-style: solid;
|
|
39
|
+
--tts-radius: 99rem; /* Pill shape */
|
|
40
|
+
|
|
41
|
+
/* Spacing */
|
|
42
|
+
--tts-padding: 0.5rem; /* 8px */
|
|
43
|
+
|
|
44
|
+
/* Dimensions */
|
|
45
|
+
--tts-min-width: 20.3125rem; /* 325px */
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Basic Structure
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<div data-tts>
|
|
53
|
+
<button data-btn="tts-btn" aria-label="Play">▶</button>
|
|
54
|
+
<span>Text to be spoken</span>
|
|
55
|
+
<button data-btn="tts-btn" aria-label="Pause">⏸</button>
|
|
56
|
+
</div>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Real-World Example
|
|
60
|
+
|
|
61
|
+
### Article Reader
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
<article>
|
|
65
|
+
<h2>Article Title</h2>
|
|
66
|
+
|
|
67
|
+
<div data-tts>
|
|
68
|
+
<button data-btn="tts-btn" aria-label="Read article aloud">🔊</button>
|
|
69
|
+
<span>Listen to this article</span>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<p>Article content...</p>
|
|
73
|
+
</article>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Related Resources
|
|
77
|
+
|
|
78
|
+
- **React Component** - See README for React TTS component API
|
|
79
|
+
- **Web Speech API** -
|
|
80
|
+
https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API
|
|
@@ -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
|
|
package/src/components/ui.tsx
CHANGED
|
@@ -307,15 +307,15 @@ type UIComponent = (<C extends React.ElementType = "div">(
|
|
|
307
307
|
*/
|
|
308
308
|
const UI: UIComponent = React.forwardRef(
|
|
309
309
|
<C extends React.ElementType>(
|
|
310
|
-
{ as, styles, classes, children, defaultStyles, ...props }: UIProps<C>,
|
|
310
|
+
{ as, styles, style, classes, children, defaultStyles, ...props }: UIProps<C>,
|
|
311
311
|
ref?: PolymorphicRef<C>
|
|
312
312
|
) => {
|
|
313
313
|
const Component = as ?? "div";
|
|
314
314
|
|
|
315
|
-
const styleObj: React.CSSProperties = { ...defaultStyles, ...styles };
|
|
315
|
+
const styleObj: React.CSSProperties = { ...defaultStyles, ...styles, ...style };
|
|
316
316
|
|
|
317
317
|
return (
|
|
318
|
-
<Component ref={ref} style={styleObj} className={classes}
|
|
318
|
+
<Component {...props} ref={ref} style={styleObj} className={classes}>
|
|
319
319
|
{children}
|
|
320
320
|
</Component>
|
|
321
321
|
);
|
|
@@ -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
|
@@ -13,8 +13,12 @@
|
|
|
13
13
|
@use "./components/details/details.scss";
|
|
14
14
|
@use "./components/link/link.scss";
|
|
15
15
|
@use "./components/layout/landmarks.scss";
|
|
16
|
+
@use "./components/box/box.scss";
|
|
17
|
+
@use "./components/stack/stack.scss";
|
|
18
|
+
@use "./components/cluster/cluster.scss";
|
|
19
|
+
@use "./components/grid/grid.scss";
|
|
16
20
|
@use "./components/dialog/dialog.scss";
|
|
17
|
-
@use "./sass/_grid.scss";
|
|
21
|
+
@use "./sass/_grid.scss" as grid-legacy;
|
|
18
22
|
@use "./components/badge/badge.scss";
|
|
19
23
|
@use "./components/nav/nav.scss";
|
|
20
24
|
@use "./components/form/form.scss";
|