@fpkit/acss 3.7.0 → 3.9.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/components/form/checkbox.css +1 -0
- package/libs/components/form/checkbox.css.map +1 -0
- package/libs/components/form/checkbox.min.css +3 -0
- package/libs/components/form/form.css +1 -1
- package/libs/components/form/form.css.map +1 -1
- package/libs/components/form/form.min.css +2 -2
- package/libs/index.cjs +26 -25
- 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 +207 -2
- package/libs/index.d.ts +207 -2
- package/libs/index.js +5 -4
- package/libs/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/form/README.mdx +173 -146
- package/src/components/form/checkbox.scss +129 -0
- package/src/components/form/checkbox.tsx +302 -0
- package/src/components/form/form.scss +59 -20
- package/src/components/form/form.types.ts +6 -0
- package/src/components/form/input.stories.tsx +258 -1
- package/src/index.scss +1 -0
- package/src/index.ts +13 -1
- package/src/sass/_columns.scss +13 -9
- package/src/styles/checkbox/checkbox.css.map +1 -0
- package/src/styles/form/checkbox.css +97 -0
- package/src/styles/form/checkbox.css.map +1 -0
- package/src/styles/form/form.css +138 -22
- package/src/styles/form/form.css.map +1 -1
- package/src/styles/index.css +138 -22
- package/src/styles/index.css.map +1 -1
package/libs/index.d.cts
CHANGED
|
@@ -5,6 +5,8 @@ import { I as IconProps } from './icons-df8e744f.js';
|
|
|
5
5
|
export { a as Icon, b as IconProps } from './icons-df8e744f.js';
|
|
6
6
|
export { default as Field, FieldProps } from './components/form/fields.cjs';
|
|
7
7
|
export { default as Input } from './components/form/inputs.cjs';
|
|
8
|
+
import { I as InputProps } from './form.types-d25ebfac.js';
|
|
9
|
+
export { T as TextareaProps } from './form.types-d25ebfac.js';
|
|
8
10
|
export { _ as Link, L as LinkProps, _ as To } from './link-59ad884f.js';
|
|
9
11
|
export { default as List } from './components/list/list.cjs';
|
|
10
12
|
export { Modal, ModalProps } from './components/modal.cjs';
|
|
@@ -18,7 +20,6 @@ export { default as Text, TextProps } from './components/text/text.cjs';
|
|
|
18
20
|
export { b as Heading, H as HeadingLevel, T as Title, a as TitleProps } from './heading-81eef89a.js';
|
|
19
21
|
export { default as Textarea } from './components/form/textarea.cjs';
|
|
20
22
|
export { default as Breadcrumb, BreadcrumbProps, CustomRoute, useBreadcrumbSegments } from './components/breadcrumbs/breadcrumb.cjs';
|
|
21
|
-
export { I as InputProps, T as TextareaProps } from './form.types-d25ebfac.js';
|
|
22
23
|
export { L as ListItemProps, a as ListProps } from './list.types-d26de310.js';
|
|
23
24
|
|
|
24
25
|
/**
|
|
@@ -176,6 +177,210 @@ type AlertProps = {
|
|
|
176
177
|
} & Omit<React$1.HTMLAttributes<HTMLDivElement>, "title" | "children">;
|
|
177
178
|
declare const Alert: React$1.FC<AlertProps>;
|
|
178
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Props for the Checkbox component
|
|
182
|
+
*
|
|
183
|
+
* A simplified, checkbox-specific interface that wraps the Input component.
|
|
184
|
+
* Provides a boolean onChange API and automatic label association.
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```tsx
|
|
188
|
+
* // Controlled mode
|
|
189
|
+
* <Checkbox
|
|
190
|
+
* id="terms"
|
|
191
|
+
* label="I accept the terms"
|
|
192
|
+
* checked={accepted}
|
|
193
|
+
* onChange={setAccepted}
|
|
194
|
+
* required
|
|
195
|
+
* />
|
|
196
|
+
* ```
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```tsx
|
|
200
|
+
* // Uncontrolled mode with default
|
|
201
|
+
* <Checkbox
|
|
202
|
+
* id="newsletter"
|
|
203
|
+
* label="Subscribe to newsletter"
|
|
204
|
+
* defaultChecked={true}
|
|
205
|
+
* />
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
interface CheckboxProps extends Omit<InputProps, 'type' | 'value' | 'onChange' | 'defaultValue' | 'placeholder'> {
|
|
209
|
+
/**
|
|
210
|
+
* Unique identifier for the checkbox input.
|
|
211
|
+
* Required for proper label association via htmlFor attribute.
|
|
212
|
+
*
|
|
213
|
+
* @required
|
|
214
|
+
* @see {@link https://www.w3.org/WAI/WCAG21/Understanding/name-role-value.html|WCAG 4.1.2 Name, Role, Value}
|
|
215
|
+
*/
|
|
216
|
+
id: string;
|
|
217
|
+
/**
|
|
218
|
+
* Label text or React node displayed next to the checkbox.
|
|
219
|
+
* Automatically associated with the checkbox via htmlFor.
|
|
220
|
+
*
|
|
221
|
+
* @required
|
|
222
|
+
* @see {@link https://www.w3.org/WAI/WCAG21/Understanding/labels-or-instructions.html|WCAG 3.3.2 Labels or Instructions}
|
|
223
|
+
*/
|
|
224
|
+
label: React$1.ReactNode;
|
|
225
|
+
/**
|
|
226
|
+
* Controlled mode: Current checked state.
|
|
227
|
+
* When provided, component becomes controlled and requires onChange handler.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```tsx
|
|
231
|
+
* const [checked, setChecked] = useState(false);
|
|
232
|
+
* <Checkbox id="opt" label="Option" checked={checked} onChange={setChecked} />
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
checked?: boolean;
|
|
236
|
+
/**
|
|
237
|
+
* Uncontrolled mode: Initial checked state.
|
|
238
|
+
* Use this for forms where React doesn't need to track the checkbox state.
|
|
239
|
+
*
|
|
240
|
+
* @default false
|
|
241
|
+
* @example
|
|
242
|
+
* ```tsx
|
|
243
|
+
* <Checkbox id="opt" label="Option" defaultChecked={true} />
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
defaultChecked?: boolean;
|
|
247
|
+
/**
|
|
248
|
+
* Form submission value when checkbox is checked.
|
|
249
|
+
* This is the value submitted with the form when the checkbox is checked.
|
|
250
|
+
*
|
|
251
|
+
* @default "on"
|
|
252
|
+
*/
|
|
253
|
+
value?: string;
|
|
254
|
+
/**
|
|
255
|
+
* Change handler with simplified boolean API.
|
|
256
|
+
* Receives true when checked, false when unchecked.
|
|
257
|
+
*
|
|
258
|
+
* @param checked - The new checked state
|
|
259
|
+
* @example
|
|
260
|
+
* ```tsx
|
|
261
|
+
* <Checkbox
|
|
262
|
+
* id="opt"
|
|
263
|
+
* label="Option"
|
|
264
|
+
* onChange={(checked) => console.log('Checked:', checked)}
|
|
265
|
+
* />
|
|
266
|
+
* ```
|
|
267
|
+
*/
|
|
268
|
+
onChange?: (checked: boolean) => void;
|
|
269
|
+
/**
|
|
270
|
+
* Optional custom CSS classes for the wrapper div.
|
|
271
|
+
* Applied alongside automatic checkbox wrapper styling.
|
|
272
|
+
*/
|
|
273
|
+
classes?: string;
|
|
274
|
+
/**
|
|
275
|
+
* Optional custom CSS classes for the input element.
|
|
276
|
+
*
|
|
277
|
+
* @default "checkbox-input"
|
|
278
|
+
*/
|
|
279
|
+
inputClasses?: string;
|
|
280
|
+
/**
|
|
281
|
+
* CSS custom properties for theming.
|
|
282
|
+
*
|
|
283
|
+
* Available variables:
|
|
284
|
+
* - --checkbox-gap: Space between checkbox and label (default: 0.5rem)
|
|
285
|
+
* - --checkbox-disabled-opacity: Opacity for disabled state (default: 0.6)
|
|
286
|
+
* - --checkbox-disabled-color: Label color when disabled (default: #6b7280)
|
|
287
|
+
* - --checkbox-label-fs: Label font size (default: 1rem)
|
|
288
|
+
* - --checkbox-label-lh: Label line height (default: 1.5)
|
|
289
|
+
* - --color-required: Required indicator color (default: #dc2626)
|
|
290
|
+
* - --checkbox-focus-ring-color: Focus ring color (default: #2563eb)
|
|
291
|
+
* - --checkbox-focus-ring-width: Focus ring width (default: 0.125rem)
|
|
292
|
+
* - --checkbox-focus-ring-offset: Focus ring offset (default: 0.125rem)
|
|
293
|
+
* - --checkbox-hover-label-color: Label color on hover
|
|
294
|
+
* - --checkbox-error-label-color: Label color when invalid (default: #dc2626)
|
|
295
|
+
* - --checkbox-valid-label-color: Label color when valid (default: #16a34a)
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```tsx
|
|
299
|
+
* <Checkbox
|
|
300
|
+
* id="custom"
|
|
301
|
+
* label="Custom styled"
|
|
302
|
+
* styles={{
|
|
303
|
+
* '--checkbox-gap': '1rem',
|
|
304
|
+
* '--checkbox-focus-ring-color': '#ff0000'
|
|
305
|
+
* }}
|
|
306
|
+
* />
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
309
|
+
styles?: React$1.CSSProperties;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Checkbox - Accessible checkbox input with automatic label association
|
|
313
|
+
*
|
|
314
|
+
* A thin wrapper around the Input component that provides a checkbox-specific API
|
|
315
|
+
* with simplified boolean onChange and automatic label rendering. Leverages all
|
|
316
|
+
* validation, disabled state, and ARIA logic from the base Input component.
|
|
317
|
+
*
|
|
318
|
+
* **Key Features:**
|
|
319
|
+
* - ✅ Boolean onChange API (`onChange={(checked) => ...}`)
|
|
320
|
+
* - ✅ Automatic label association via htmlFor
|
|
321
|
+
* - ✅ WCAG 2.1 AA compliant (uses aria-disabled pattern)
|
|
322
|
+
* - ✅ Supports both controlled and uncontrolled modes
|
|
323
|
+
* - ✅ Required indicator with asterisk
|
|
324
|
+
* - ✅ Validation states (invalid, valid, none)
|
|
325
|
+
* - ✅ Error messages and hint text via Input component
|
|
326
|
+
* - ✅ Customizable via CSS custom properties
|
|
327
|
+
* - ✅ Keyboard accessible (Space to toggle)
|
|
328
|
+
* - ✅ Focus-visible indicators
|
|
329
|
+
* - ✅ High contrast mode support
|
|
330
|
+
*
|
|
331
|
+
* @component
|
|
332
|
+
* @example
|
|
333
|
+
* ```tsx
|
|
334
|
+
* // Basic checkbox
|
|
335
|
+
* <Checkbox id="terms" label="I accept the terms and conditions" />
|
|
336
|
+
* ```
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* ```tsx
|
|
340
|
+
* // Controlled checkbox with validation
|
|
341
|
+
* const [agreed, setAgreed] = useState(false);
|
|
342
|
+
* <Checkbox
|
|
343
|
+
* id="terms"
|
|
344
|
+
* label="I accept the terms"
|
|
345
|
+
* checked={agreed}
|
|
346
|
+
* onChange={setAgreed}
|
|
347
|
+
* required
|
|
348
|
+
* validationState={agreed ? "valid" : "invalid"}
|
|
349
|
+
* errorMessage={!agreed ? "You must accept the terms" : undefined}
|
|
350
|
+
* />
|
|
351
|
+
* ```
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* ```tsx
|
|
355
|
+
* // Disabled checkbox
|
|
356
|
+
* <Checkbox
|
|
357
|
+
* id="disabled"
|
|
358
|
+
* label="Disabled option"
|
|
359
|
+
* disabled
|
|
360
|
+
* defaultChecked
|
|
361
|
+
* />
|
|
362
|
+
* ```
|
|
363
|
+
*
|
|
364
|
+
* @example
|
|
365
|
+
* ```tsx
|
|
366
|
+
* // Custom styling
|
|
367
|
+
* <Checkbox
|
|
368
|
+
* id="custom"
|
|
369
|
+
* label="Large checkbox"
|
|
370
|
+
* styles={{ '--checkbox-gap': '1rem' }}
|
|
371
|
+
* />
|
|
372
|
+
* ```
|
|
373
|
+
*
|
|
374
|
+
* @param {CheckboxProps} props - Component props
|
|
375
|
+
* @param {React.Ref<HTMLInputElement>} ref - Forwarded ref to the input element
|
|
376
|
+
* @returns {JSX.Element} Checkbox wrapper with input and label
|
|
377
|
+
*
|
|
378
|
+
* @see {@link https://www.w3.org/WAI/WCAG21/Understanding/name-role-value.html|WCAG 4.1.2 Name, Role, Value}
|
|
379
|
+
* @see {@link https://www.w3.org/WAI/WCAG21/Understanding/focus-visible.html|WCAG 2.4.7 Focus Visible}
|
|
380
|
+
* @see {@link https://www.w3.org/WAI/WCAG21/Understanding/error-identification.html|WCAG 3.3.1 Error Identification}
|
|
381
|
+
*/
|
|
382
|
+
declare const Checkbox: React$1.ForwardRefExoticComponent<CheckboxProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
383
|
+
|
|
179
384
|
/**
|
|
180
385
|
* Props for the Img component.
|
|
181
386
|
*
|
|
@@ -2546,4 +2751,4 @@ type FPComponent = {
|
|
|
2546
2751
|
*/
|
|
2547
2752
|
declare const FP: FPComponent;
|
|
2548
2753
|
|
|
2549
|
-
export { Alert, AlertProps, Article, Aside, Badge, BadgeProps, Box, BoxProps, Caption, Cluster, ClusterProps, Col, ColProps, ComponentProps$1 as ComponentProps, Details, FP, Flex, FlexAlign, FlexAlignContent, FlexAlignSelf, FlexContainerElement, FlexDirection, FlexGap, FlexItemElement, FlexItemProps, FlexJustify, FlexProps, FlexSpacerProps, FlexVariant, FlexWrap, Footer, GridWithItem as Grid, GridItem, GridItemProps, GridProps, Header, Img, ImgProps, Landmarks, Main, ResponsiveFlexProps, Row, RowProps, Section, Stack, StackProps, Table, Tag, TagProps, TagVariant, Tbody, Td, TextToSpeech, Thead, Tr, UI };
|
|
2754
|
+
export { Alert, AlertProps, Article, Aside, Badge, BadgeProps, Box, BoxProps, Caption, Checkbox, CheckboxProps, Cluster, ClusterProps, Col, ColProps, ComponentProps$1 as ComponentProps, Details, FP, Flex, FlexAlign, FlexAlignContent, FlexAlignSelf, FlexContainerElement, FlexDirection, FlexGap, FlexItemElement, FlexItemProps, FlexJustify, FlexProps, FlexSpacerProps, FlexVariant, FlexWrap, Footer, GridWithItem as Grid, GridItem, GridItemProps, GridProps, Header, Img, ImgProps, InputProps, Landmarks, Main, ResponsiveFlexProps, Row, RowProps, Section, Stack, StackProps, Table, Tag, TagProps, TagVariant, Tbody, Td, TextToSpeech, Thead, Tr, UI };
|
package/libs/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { I as IconProps } from './icons-df8e744f.js';
|
|
|
5
5
|
export { a as Icon, b as IconProps } from './icons-df8e744f.js';
|
|
6
6
|
export { default as Field, FieldProps } from './components/form/fields.js';
|
|
7
7
|
export { default as Input } from './components/form/inputs.js';
|
|
8
|
+
import { I as InputProps } from './form.types-d25ebfac.js';
|
|
9
|
+
export { T as TextareaProps } from './form.types-d25ebfac.js';
|
|
8
10
|
export { _ as Link, L as LinkProps, _ as To } from './link-59ad884f.js';
|
|
9
11
|
export { default as List } from './components/list/list.js';
|
|
10
12
|
export { Modal, ModalProps } from './components/modal.js';
|
|
@@ -18,7 +20,6 @@ export { default as Text, TextProps } from './components/text/text.js';
|
|
|
18
20
|
export { b as Heading, H as HeadingLevel, T as Title, a as TitleProps } from './heading-81eef89a.js';
|
|
19
21
|
export { default as Textarea } from './components/form/textarea.js';
|
|
20
22
|
export { default as Breadcrumb, BreadcrumbProps, CustomRoute, useBreadcrumbSegments } from './components/breadcrumbs/breadcrumb.js';
|
|
21
|
-
export { I as InputProps, T as TextareaProps } from './form.types-d25ebfac.js';
|
|
22
23
|
export { L as ListItemProps, a as ListProps } from './list.types-d26de310.js';
|
|
23
24
|
|
|
24
25
|
/**
|
|
@@ -176,6 +177,210 @@ type AlertProps = {
|
|
|
176
177
|
} & Omit<React$1.HTMLAttributes<HTMLDivElement>, "title" | "children">;
|
|
177
178
|
declare const Alert: React$1.FC<AlertProps>;
|
|
178
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Props for the Checkbox component
|
|
182
|
+
*
|
|
183
|
+
* A simplified, checkbox-specific interface that wraps the Input component.
|
|
184
|
+
* Provides a boolean onChange API and automatic label association.
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```tsx
|
|
188
|
+
* // Controlled mode
|
|
189
|
+
* <Checkbox
|
|
190
|
+
* id="terms"
|
|
191
|
+
* label="I accept the terms"
|
|
192
|
+
* checked={accepted}
|
|
193
|
+
* onChange={setAccepted}
|
|
194
|
+
* required
|
|
195
|
+
* />
|
|
196
|
+
* ```
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```tsx
|
|
200
|
+
* // Uncontrolled mode with default
|
|
201
|
+
* <Checkbox
|
|
202
|
+
* id="newsletter"
|
|
203
|
+
* label="Subscribe to newsletter"
|
|
204
|
+
* defaultChecked={true}
|
|
205
|
+
* />
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
interface CheckboxProps extends Omit<InputProps, 'type' | 'value' | 'onChange' | 'defaultValue' | 'placeholder'> {
|
|
209
|
+
/**
|
|
210
|
+
* Unique identifier for the checkbox input.
|
|
211
|
+
* Required for proper label association via htmlFor attribute.
|
|
212
|
+
*
|
|
213
|
+
* @required
|
|
214
|
+
* @see {@link https://www.w3.org/WAI/WCAG21/Understanding/name-role-value.html|WCAG 4.1.2 Name, Role, Value}
|
|
215
|
+
*/
|
|
216
|
+
id: string;
|
|
217
|
+
/**
|
|
218
|
+
* Label text or React node displayed next to the checkbox.
|
|
219
|
+
* Automatically associated with the checkbox via htmlFor.
|
|
220
|
+
*
|
|
221
|
+
* @required
|
|
222
|
+
* @see {@link https://www.w3.org/WAI/WCAG21/Understanding/labels-or-instructions.html|WCAG 3.3.2 Labels or Instructions}
|
|
223
|
+
*/
|
|
224
|
+
label: React$1.ReactNode;
|
|
225
|
+
/**
|
|
226
|
+
* Controlled mode: Current checked state.
|
|
227
|
+
* When provided, component becomes controlled and requires onChange handler.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```tsx
|
|
231
|
+
* const [checked, setChecked] = useState(false);
|
|
232
|
+
* <Checkbox id="opt" label="Option" checked={checked} onChange={setChecked} />
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
checked?: boolean;
|
|
236
|
+
/**
|
|
237
|
+
* Uncontrolled mode: Initial checked state.
|
|
238
|
+
* Use this for forms where React doesn't need to track the checkbox state.
|
|
239
|
+
*
|
|
240
|
+
* @default false
|
|
241
|
+
* @example
|
|
242
|
+
* ```tsx
|
|
243
|
+
* <Checkbox id="opt" label="Option" defaultChecked={true} />
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
defaultChecked?: boolean;
|
|
247
|
+
/**
|
|
248
|
+
* Form submission value when checkbox is checked.
|
|
249
|
+
* This is the value submitted with the form when the checkbox is checked.
|
|
250
|
+
*
|
|
251
|
+
* @default "on"
|
|
252
|
+
*/
|
|
253
|
+
value?: string;
|
|
254
|
+
/**
|
|
255
|
+
* Change handler with simplified boolean API.
|
|
256
|
+
* Receives true when checked, false when unchecked.
|
|
257
|
+
*
|
|
258
|
+
* @param checked - The new checked state
|
|
259
|
+
* @example
|
|
260
|
+
* ```tsx
|
|
261
|
+
* <Checkbox
|
|
262
|
+
* id="opt"
|
|
263
|
+
* label="Option"
|
|
264
|
+
* onChange={(checked) => console.log('Checked:', checked)}
|
|
265
|
+
* />
|
|
266
|
+
* ```
|
|
267
|
+
*/
|
|
268
|
+
onChange?: (checked: boolean) => void;
|
|
269
|
+
/**
|
|
270
|
+
* Optional custom CSS classes for the wrapper div.
|
|
271
|
+
* Applied alongside automatic checkbox wrapper styling.
|
|
272
|
+
*/
|
|
273
|
+
classes?: string;
|
|
274
|
+
/**
|
|
275
|
+
* Optional custom CSS classes for the input element.
|
|
276
|
+
*
|
|
277
|
+
* @default "checkbox-input"
|
|
278
|
+
*/
|
|
279
|
+
inputClasses?: string;
|
|
280
|
+
/**
|
|
281
|
+
* CSS custom properties for theming.
|
|
282
|
+
*
|
|
283
|
+
* Available variables:
|
|
284
|
+
* - --checkbox-gap: Space between checkbox and label (default: 0.5rem)
|
|
285
|
+
* - --checkbox-disabled-opacity: Opacity for disabled state (default: 0.6)
|
|
286
|
+
* - --checkbox-disabled-color: Label color when disabled (default: #6b7280)
|
|
287
|
+
* - --checkbox-label-fs: Label font size (default: 1rem)
|
|
288
|
+
* - --checkbox-label-lh: Label line height (default: 1.5)
|
|
289
|
+
* - --color-required: Required indicator color (default: #dc2626)
|
|
290
|
+
* - --checkbox-focus-ring-color: Focus ring color (default: #2563eb)
|
|
291
|
+
* - --checkbox-focus-ring-width: Focus ring width (default: 0.125rem)
|
|
292
|
+
* - --checkbox-focus-ring-offset: Focus ring offset (default: 0.125rem)
|
|
293
|
+
* - --checkbox-hover-label-color: Label color on hover
|
|
294
|
+
* - --checkbox-error-label-color: Label color when invalid (default: #dc2626)
|
|
295
|
+
* - --checkbox-valid-label-color: Label color when valid (default: #16a34a)
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```tsx
|
|
299
|
+
* <Checkbox
|
|
300
|
+
* id="custom"
|
|
301
|
+
* label="Custom styled"
|
|
302
|
+
* styles={{
|
|
303
|
+
* '--checkbox-gap': '1rem',
|
|
304
|
+
* '--checkbox-focus-ring-color': '#ff0000'
|
|
305
|
+
* }}
|
|
306
|
+
* />
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
309
|
+
styles?: React$1.CSSProperties;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Checkbox - Accessible checkbox input with automatic label association
|
|
313
|
+
*
|
|
314
|
+
* A thin wrapper around the Input component that provides a checkbox-specific API
|
|
315
|
+
* with simplified boolean onChange and automatic label rendering. Leverages all
|
|
316
|
+
* validation, disabled state, and ARIA logic from the base Input component.
|
|
317
|
+
*
|
|
318
|
+
* **Key Features:**
|
|
319
|
+
* - ✅ Boolean onChange API (`onChange={(checked) => ...}`)
|
|
320
|
+
* - ✅ Automatic label association via htmlFor
|
|
321
|
+
* - ✅ WCAG 2.1 AA compliant (uses aria-disabled pattern)
|
|
322
|
+
* - ✅ Supports both controlled and uncontrolled modes
|
|
323
|
+
* - ✅ Required indicator with asterisk
|
|
324
|
+
* - ✅ Validation states (invalid, valid, none)
|
|
325
|
+
* - ✅ Error messages and hint text via Input component
|
|
326
|
+
* - ✅ Customizable via CSS custom properties
|
|
327
|
+
* - ✅ Keyboard accessible (Space to toggle)
|
|
328
|
+
* - ✅ Focus-visible indicators
|
|
329
|
+
* - ✅ High contrast mode support
|
|
330
|
+
*
|
|
331
|
+
* @component
|
|
332
|
+
* @example
|
|
333
|
+
* ```tsx
|
|
334
|
+
* // Basic checkbox
|
|
335
|
+
* <Checkbox id="terms" label="I accept the terms and conditions" />
|
|
336
|
+
* ```
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* ```tsx
|
|
340
|
+
* // Controlled checkbox with validation
|
|
341
|
+
* const [agreed, setAgreed] = useState(false);
|
|
342
|
+
* <Checkbox
|
|
343
|
+
* id="terms"
|
|
344
|
+
* label="I accept the terms"
|
|
345
|
+
* checked={agreed}
|
|
346
|
+
* onChange={setAgreed}
|
|
347
|
+
* required
|
|
348
|
+
* validationState={agreed ? "valid" : "invalid"}
|
|
349
|
+
* errorMessage={!agreed ? "You must accept the terms" : undefined}
|
|
350
|
+
* />
|
|
351
|
+
* ```
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* ```tsx
|
|
355
|
+
* // Disabled checkbox
|
|
356
|
+
* <Checkbox
|
|
357
|
+
* id="disabled"
|
|
358
|
+
* label="Disabled option"
|
|
359
|
+
* disabled
|
|
360
|
+
* defaultChecked
|
|
361
|
+
* />
|
|
362
|
+
* ```
|
|
363
|
+
*
|
|
364
|
+
* @example
|
|
365
|
+
* ```tsx
|
|
366
|
+
* // Custom styling
|
|
367
|
+
* <Checkbox
|
|
368
|
+
* id="custom"
|
|
369
|
+
* label="Large checkbox"
|
|
370
|
+
* styles={{ '--checkbox-gap': '1rem' }}
|
|
371
|
+
* />
|
|
372
|
+
* ```
|
|
373
|
+
*
|
|
374
|
+
* @param {CheckboxProps} props - Component props
|
|
375
|
+
* @param {React.Ref<HTMLInputElement>} ref - Forwarded ref to the input element
|
|
376
|
+
* @returns {JSX.Element} Checkbox wrapper with input and label
|
|
377
|
+
*
|
|
378
|
+
* @see {@link https://www.w3.org/WAI/WCAG21/Understanding/name-role-value.html|WCAG 4.1.2 Name, Role, Value}
|
|
379
|
+
* @see {@link https://www.w3.org/WAI/WCAG21/Understanding/focus-visible.html|WCAG 2.4.7 Focus Visible}
|
|
380
|
+
* @see {@link https://www.w3.org/WAI/WCAG21/Understanding/error-identification.html|WCAG 3.3.1 Error Identification}
|
|
381
|
+
*/
|
|
382
|
+
declare const Checkbox: React$1.ForwardRefExoticComponent<CheckboxProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
383
|
+
|
|
179
384
|
/**
|
|
180
385
|
* Props for the Img component.
|
|
181
386
|
*
|
|
@@ -2546,4 +2751,4 @@ type FPComponent = {
|
|
|
2546
2751
|
*/
|
|
2547
2752
|
declare const FP: FPComponent;
|
|
2548
2753
|
|
|
2549
|
-
export { Alert, AlertProps, Article, Aside, Badge, BadgeProps, Box, BoxProps, Caption, Cluster, ClusterProps, Col, ColProps, ComponentProps$1 as ComponentProps, Details, FP, Flex, FlexAlign, FlexAlignContent, FlexAlignSelf, FlexContainerElement, FlexDirection, FlexGap, FlexItemElement, FlexItemProps, FlexJustify, FlexProps, FlexSpacerProps, FlexVariant, FlexWrap, Footer, GridWithItem as Grid, GridItem, GridItemProps, GridProps, Header, Img, ImgProps, Landmarks, Main, ResponsiveFlexProps, Row, RowProps, Section, Stack, StackProps, Table, Tag, TagProps, TagVariant, Tbody, Td, TextToSpeech, Thead, Tr, UI };
|
|
2754
|
+
export { Alert, AlertProps, Article, Aside, Badge, BadgeProps, Box, BoxProps, Caption, Checkbox, CheckboxProps, Cluster, ClusterProps, Col, ColProps, ComponentProps$1 as ComponentProps, Details, FP, Flex, FlexAlign, FlexAlignContent, FlexAlignSelf, FlexContainerElement, FlexDirection, FlexGap, FlexItemElement, FlexItemProps, FlexJustify, FlexProps, FlexSpacerProps, FlexVariant, FlexWrap, Footer, GridWithItem as Grid, GridItem, GridItemProps, GridProps, Header, Img, ImgProps, InputProps, Landmarks, Main, ResponsiveFlexProps, Row, RowProps, Section, Stack, StackProps, Table, Tag, TagProps, TagVariant, Tbody, Td, TextToSpeech, Thead, Tr, UI };
|
package/libs/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export { d as Card, b as CardContent, c as CardFooter, a as CardTitle } from './
|
|
|
16
16
|
export { a as Modal } from './chunk-PMWL5XZ4.js';
|
|
17
17
|
import { b } from './chunk-TF3GQKOY.js';
|
|
18
18
|
export { a as Button } from './chunk-TF3GQKOY.js';
|
|
19
|
+
import { a as a$1 } from './chunk-F5EYMVQM.js';
|
|
19
20
|
export { a as Input } from './chunk-F5EYMVQM.js';
|
|
20
21
|
export { a as FP } from './chunk-6SAHIYCZ.js';
|
|
21
22
|
import './chunk-BFK62VX5.js';
|
|
@@ -23,9 +24,9 @@ import './chunk-75QHTLFO.js';
|
|
|
23
24
|
export { d as Link, d as To } from './chunk-IBUTNPTQ.js';
|
|
24
25
|
import { a } from './chunk-DDSXKOUB.js';
|
|
25
26
|
export { a as UI } from './chunk-DDSXKOUB.js';
|
|
26
|
-
import
|
|
27
|
+
import C, { useCallback, useMemo, useState, useEffect } from 'react';
|
|
27
28
|
|
|
28
|
-
var
|
|
29
|
+
var _e={default:"",info:"Information: ",success:"Success: ",warning:"Warning: ",error:"Error: "},O=({severity:e})=>{let t=_e[e];return t?C.createElement("span",{className:"sr-only"},t):null};var qe=(e,t)=>({info:C.createElement(b$1.InfoSolid,{...t}),success:C.createElement(b$1.SuccessSolid,{...t}),warning:C.createElement(b$1.WarnSolid,{...t}),error:C.createElement(b$1.AlertSolid,{...t}),default:C.createElement(b$1.AlertSquareSolid,{...t})})[e],_=({severity:e,iconProps:t,hideIcon:o})=>{if(o)return null;let s=qe(e,t);return C.createElement(a,{"aria-hidden":"true",className:"alert-icon"},s)};var q=({title:e,titleLevel:t})=>{if(!e)return null;let o=t?`h${t}`:"strong";return C.createElement(a,{as:o,className:"alert-title"},e)};var W=({children:e,contentType:t})=>t==="node"?C.createElement(C.Fragment,null,e):C.createElement(a,{as:"p"},e);var K=({actions:e})=>e?C.createElement(a,{as:"div",className:"alert-actions"},e):null;var oe=C.memo(({onDismiss:e,iconSize:t=16})=>C.createElement(b,{type:"button",onClick:e,"aria-label":"Close alert",className:"alert-dismiss","data-btn":"icon sm"},C.createElement(b$1,null,C.createElement(b$1.Close,{size:t})))),se=oe;oe.displayName="DismissButton";var Ke={default:"polite",info:"polite",success:"polite",warning:"polite",error:"assertive"},R=C.forwardRef(({severity:e,variant:t,isVisible:o,dismissible:s,onDismiss:r,onInteractionStart:i,onInteractionEnd:a$1,autoFocus:l,title:c,titleLevel:y,children:u,contentType:f,actions:S,hideIcon:g,iconProps:v,...m},x)=>C.createElement(a,{as:"div",ref:x,role:"alert","aria-live":Ke[e],"aria-atomic":"true",className:`alert alert-${e}`,"data-alert":e,"data-visible":o,"data-variant":t,tabIndex:l?-1:void 0,onMouseEnter:i,onMouseLeave:a$1,onFocus:i,onBlur:a$1,...m},C.createElement(O,{severity:e}),C.createElement(_,{severity:e,iconProps:v,hideIcon:g}),C.createElement(a,{as:"div",className:"alert-message"},C.createElement(q,{title:c,titleLevel:y}),C.createElement(W,{contentType:f},u),C.createElement(K,{actions:S})),s&&C.createElement(se,{onDismiss:r})));R.displayName="AlertView";var Xe=({open:e,onDismiss:t,dismissible:o,autoHideDuration:s,pauseOnHover:r,autoFocus:i,alertRef:a})=>{let[l,c]=C.useState(e),[y,u]=C.useState(e),[f,S]=C.useState(!1),g=C.useCallback(()=>{c(!1),setTimeout(()=>{u(!1),t?.();},300);},[t]);C.useEffect(()=>{e?(u(!0),c(!0)):c(!1);},[e]),C.useEffect(()=>{if(!s||!l||f)return;let x=setTimeout(()=>{g();},s);return ()=>clearTimeout(x)},[s,l,f,g]),C.useEffect(()=>{if(!o||!l)return;let x=h=>{h.key==="Escape"&&g();};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[o,l,g]),C.useEffect(()=>{i&&l&&a.current&&a.current.focus();},[i,l,a]);let v=C.useCallback(()=>{r&&s&&S(!0);},[r,s]),m=C.useCallback(()=>{r&&s&&S(!1);},[r,s]);return {isVisible:l,shouldRender:y,handleDismiss:g,handleInteractionStart:v,handleInteractionEnd:m}},re=({open:e,severity:t="default",children:o,title:s,dismissible:r=!1,onDismiss:i,iconSize:a,iconProps:l,hideIcon:c,autoHideDuration:y,pauseOnHover:u=!0,titleLevel:f=3,actions:S,autoFocus:g=!1,variant:v="outlined",contentType:m="text",...x})=>{let h=C.useRef(null),{isVisible:p,shouldRender:d,handleDismiss:k,handleInteractionStart:I,handleInteractionEnd:U}=Xe({open:e,onDismiss:i,dismissible:r,autoHideDuration:y,pauseOnHover:u,autoFocus:g,alertRef:h});if(!d)return null;let A={size:a||16,...l};return C.createElement(R,{ref:h,severity:t,variant:v,isVisible:p,dismissible:r,onDismiss:k,onInteractionStart:I,onInteractionEnd:U,autoFocus:g,title:s,titleLevel:f,contentType:m,actions:S,hideIcon:c,iconProps:A,...x},o)};re.displayName="Alert";var ne=C.forwardRef(({id:e,label:t,checked:o,defaultChecked:s,value:r="on",onChange:i,classes:a,inputClasses:l,styles:c,name:y,disabled:u,required:f,validationState:S,errorMessage:g,hintText:v,onBlur:m,onFocus:x,autoFocus:h,...p},d)=>{let k=C.useCallback(ke=>{i?.(ke.target.checked);},[i]),I=o!==void 0,U=I?{checked:o}:{},A=!I&&s!==void 0?{defaultChecked:s}:{},j=C.useRef(I);return C.useEffect(()=>{process.env.NODE_ENV==="development"&&(j.current!==I&&console.warn(`Checkbox with id="${e}" is changing from ${j.current?"controlled":"uncontrolled"} to ${I?"controlled":"uncontrolled"}. This is likely a bug. Decide between using "checked" (controlled) or "defaultChecked" (uncontrolled) and stick with it.`),j.current=I);},[I,e]),C.createElement("div",{className:a,style:c},C.createElement(a$1,{ref:d,type:"checkbox",id:e,name:y,value:r,...U,...A,classes:l||"checkbox-input",disabled:u,required:f,validationState:S,errorMessage:g,hintText:v,onChange:k,onBlur:m,onFocus:x,autoFocus:h,...p}),C.createElement("label",{htmlFor:e,className:"checkbox-label"},t,f&&C.createElement("span",{className:"checkbox-required","aria-label":"required"}," *")))});ne.displayName="Checkbox";var ie=({src:e="//",alt:t,width:o=480,height:s,styles:r,loading:i="lazy",placeholder:a$1,fetchpriority:l="low",decoding:c="auto",srcSet:y,sizes:u,onError:f,onLoad:S,...g})=>{let v=useMemo(()=>{let p=typeof o=="number"?o:480,d=typeof s=="number"?s:Math.round(p*.75),k=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${p} ${d}">
|
|
29
30
|
<defs>
|
|
30
31
|
<linearGradient id="grad-${p}-${d}" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
31
32
|
<stop offset="0%" style="stop-color:#6366f1;stop-opacity:1" />
|
|
@@ -37,8 +38,8 @@ var He={default:"",info:"Information: ",success:"Success: ",warning:"Warning: ",
|
|
|
37
38
|
<circle cx="${p*.15}" cy="${d*.2}" r="${Math.min(p,d)*.08}" fill="rgba(255,255,255,0.2)"/>
|
|
38
39
|
<path d="M0,${d*.75} Q${p*.25},${d*.65} ${p*.5},${d*.75} T${p},${d*.75} L${p},${d} L0,${d} Z" fill="rgba(0,0,0,0.15)"/>
|
|
39
40
|
<text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" font-family="system-ui,-apple-system,sans-serif" font-size="${Math.max(16,Math.min(p,d)*.05)}" font-weight="500" fill="rgba(255,255,255,0.9)">${p}\xD7${d}</text>
|
|
40
|
-
</svg>`;return `data:image/svg+xml,${encodeURIComponent(U)}`},[o,s]),m=a$1??I;return P.createElement(a,{as:"img",src:e,alt:t,width:o,height:s||"auto",loading:i,style:r,srcSet:y,sizes:u,onError:p=>{f&&f(p),p.defaultPrevented||p.currentTarget.src!==m&&(p.currentTarget.src=m);},onLoad:p=>{S?.(p);},decoding:c,...g,...l&&{fetchpriority:l}})};oe.displayName="Img";var se=e=>{let[t,o]=useState([]),[s,r]=useState(e),[i,a]=useState(!1),[l,c]=useState(!1);return useEffect(()=>{let m=()=>{let x=window.speechSynthesis.getVoices();o(x);let h=x.find(p=>p.name==="Google US English");if(h)r(h);else {let p=x.find(d=>d.lang.startsWith("en-"));p&&r(p);}};return m(),window.speechSynthesis.onvoiceschanged=m,()=>{window.speechSynthesis.onvoiceschanged=null;}},[]),{speak:(m,x={},h)=>{let p=new SpeechSynthesisUtterance(m);p.lang=x.lang??"en-US",p.pitch=x.pitch??1,p.rate=x.rate??1,p.voice=s??x.voice??null,p.onend=()=>{a(!1),c(!1),h&&h();},"speechSynthesis"in window?(window.speechSynthesis.speak(p),a(!0),c(!1)):a(!1);},pause:()=>{i&&!l&&(window.speechSynthesis.pause(),c(!0));},resume:()=>{i&&l&&(window.speechSynthesis.resume(),c(!1));},cancel:()=>{i&&(window.speechSynthesis.cancel(),a(!1),c(!1));},isSpeaking:i,isPaused:l,availableVoices:t,changeVoice:m=>{r(m);},currentVoice:s,getAvailableLanguages:()=>[...new Set(t.map(m=>m.lang))]}};var qe=({children:e,onClick:t})=>P.createElement(a,{as:"button",type:"button",className:"tts-border","data-btn":"sm text pill",onClick:t},e),k=P.memo(qe),W=({label:e,isSpeaking:t,isPaused:o,onSpeak:s,onPause:r,onResume:i,onCancel:a$1})=>P.createElement(a,{as:"div","data-tts":!0},e&&P.createElement("p",null,e),!t&&P.createElement(k,{"aria-label":"Speak",onClick:s},P.createElement(b$1.PlaySolid,{size:16})),t&&!o&&P.createElement(k,{"aria-label":"Pause",onClick:r},P.createElement(b$1.PauseSolid,{size:16})),o&&P.createElement(k,{"aria-label":"Resume",onClick:i},P.createElement(b$1.ResumeSolid,{size:16})),P.createElement(k,{"aria-label":"Stop",onClick:a$1},P.createElement(b$1.StopSolid,{size:16})));W.displayName="TextToSpeechControls";W.TTSButton=k;var re=W;var ne=({initialText:e="",showTextInput:t=!1,voice:o,pitch:s=1,rate:r=1,label:i,onEnd:a})=>{let{speak:l,pause:c,resume:y,cancel:u,isSpeaking:f,isPaused:S}=se(),[g,I]=useState(e);useEffect(()=>{I(e);},[e]);let m=()=>{g.trim()!==""&&l(g,{voice:o,pitch:s,rate:r},h);},x=p=>{I(p.target.value);},h=()=>{a&&a();};return P.createElement(P.Fragment,null,t&&P.createElement(b$2,{value:g,onChange:x}),P.createElement(re,{label:i,isSpeaking:f,isPaused:S,onSpeak:m,onPause:c,onResume:y,onCancel:u}))};ne.displayName="TextToSpeechComponent";var $=e=>P.createElement(P.Fragment,null,e),Ze=({id:e,children:t,headerBackground:o,styles:s,classes:r,...i})=>P.createElement(a,{as:"header",id:e,styles:s,className:r,...i},o,P.createElement(a,{as:"section"},t)),et=({id:e,children:t,styles:o,classes:s,...r})=>P.createElement(a,{as:"main",id:e,styles:o,...r,className:s},t),tt=({id:e,classes:t,children:o,styles:s={},...r})=>P.createElement(a,{as:"footer",id:e,className:t,styles:s,...r},P.createElement(a,{as:"section"},o||"Copyright \xA9 2022")),ot=({id:e,children:t,styles:o={},classes:s,...r})=>P.createElement(a,{as:"aside",id:e,styles:o,className:s,...r},P.createElement(a,{as:"section"},t)),st=({id:e,children:t,styles:o,classes:s,...r})=>P.createElement(a,{as:"section",id:e,styles:o,className:s,...r},t),rt=({id:e,children:t,styles:o,classes:s,...r})=>P.createElement(a,{as:"article",id:e,styles:o,className:s,...r},t);$.displayName="Landmarks";$.Header=Ze;$.Main=et;$.Footer=tt;$.Aside=ot;$.Section=st;$.Article=rt;var ae=P.forwardRef(({padding:e,paddingInline:t,paddingBlock:o,margin:s,marginInline:r,marginBlock:i,width:a$1,maxWidth:l,radius:c,as:y="div",className:u,classes:f,children:S,...g},I)=>{let m=[];e&&m.push(`box-padding-${e}`),t&&m.push(`box-padding-inline-${t}`),o&&m.push(`box-padding-block-${o}`),s&&m.push(`box-margin-${s}`),r&&m.push(`box-margin-inline-${r}`),i&&m.push(`box-margin-block-${i}`),a$1&&m.push(`box-width-${a$1}`),l&&m.push(`box-max-width-${l}`),c&&m.push(`box-radius-${c}`);let x=[...m,u,f].filter(Boolean).join(" ");return P.createElement(a,{as:y,ref:I,classes:x||void 0,...g},S)});ae.displayName="Box";var pe=P.forwardRef(({gap:e,direction:t="vertical",align:o,justify:s,wrap:r,as:i="div",className:a$1,classes:l,children:c,...y},u)=>{let f=["stack"];t==="horizontal"?f.push("stack-horizontal"):f.push("stack-vertical"),e&&f.push(`stack-gap-${e}`),o&&f.push(`stack-align-${o}`),s&&f.push(`stack-justify-${s}`),r&&f.push(`stack-${r}`);let S=[...f,a$1,l].filter(Boolean).join(" ");return P.createElement(a,{as:i,ref:u,classes:S,...y},c)});pe.displayName="Stack";var fe=P.forwardRef(({gap:e,justify:t,align:o,as:s="div",className:r,classes:i,children:a$1,...l},c)=>{let y=["cluster"];e&&y.push(`cluster-gap-${e}`),t&&y.push(`cluster-justify-${t}`),o&&y.push(`cluster-align-${o}`);let u=[...y,r,i].filter(Boolean).join(" ");return P.createElement(a,{as:s,ref:c,classes:u,...l},a$1)});fe.displayName="Cluster";var me=P.forwardRef(({columns:e,auto:t,minColumnWidth:o,gap:s,gapX:r,gapY:i,justifyItems:a$1,alignItems:l,as:c="div",className:y,classes:u,children:f,style:S,styles:g,...I},m)=>{let x=["grid"];e&&x.push(`grid-cols-${e}`),t&&x.push(`grid-auto-${t}`),s&&x.push(`grid-gap-${s}`),r&&x.push(`grid-gap-x-${r}`),i&&x.push(`grid-gap-y-${i}`),a$1&&x.push(`grid-justify-items-${a$1}`),l&&x.push(`grid-align-items-${l}`);let h=[...x,y,u].filter(Boolean).join(" "),p={...S||{},...g||{}};return t&&o&&(p.gridTemplateColumns=`repeat(auto-${t}, minmax(${o}, 1fr))`),P.createElement(a,{as:c,ref:m,classes:h,style:Object.keys(p).length>0?p:void 0,...I},f)});me.displayName="Grid";var K=P.forwardRef(({span:e,rowSpan:t,as:o="div",className:s,classes:r,children:i,...a$1},l)=>{let c=[];e&&c.push(`grid-col-span-${e}`),t&&c.push(`grid-row-span-${t}`);let y=[...c,s,r].filter(Boolean).join(" ");return P.createElement(a,{as:o,ref:l,classes:y,...a$1},i)});K.displayName="GridItem";var de=me;de.Item=K;var nt=de;var xe=P.forwardRef(({gap:e,justify:t,align:o,wrap:s,alwaysProportional:r=!1,as:i="div",className:a$1,classes:l,children:c,...y},u)=>{process.env.NODE_ENV==="development"&&r&&console.warn('[fpkit] Row: alwaysProportional is deprecated and will be removed in v5.0.0. Use responsive column utilities instead: className="col-sm-6 col-md-4"');let f=["col-row"];e&&f.push(`col-row-gap-${e}`),t&&f.push(`col-row-justify-${t}`),o&&f.push(`col-row-align-${o}`),s&&s!=="wrap"&&f.push(`col-row-${s}`),r&&f.push("col-row-proportional");let S=[...f,a$1,l].filter(Boolean).join(" ");return P.createElement(a,{as:i,ref:u,classes:S,...y},c)});xe.displayName="Row";var he=P.forwardRef(({span:e,offset:t,order:o,auto:s=!1,as:r="div",className:i,classes:a$1,children:l,...c},y)=>{let u=[];s?u.push("col-auto"):e==="flex"?u.push("col-flex"):e&&u.push(`col-${e}`),t!==void 0&&u.push(`col-offset-${t}`),o!==void 0&&u.push(`col-order-${o}`);let f=[...u,i,a$1].filter(Boolean).join(" ");return P.createElement(a,{as:r,ref:y,classes:f,...c},l)});he.displayName="Col";var N=(e,t="")=>{let o=[];if(e.direction){let s={row:"flex-row","row-reverse":"flex-row-reverse",column:"flex-col","column-reverse":"flex-col-reverse"};o.push(`${t}${s[e.direction]}`);}if(e.wrap){let s={wrap:"flex-wrap",nowrap:"flex-nowrap","wrap-reverse":"flex-wrap-reverse"};o.push(`${t}${s[e.wrap]}`);}if(e.gap&&o.push(`${t}gap-${e.gap}`),e.rowGap&&o.push(`${t}row-gap-${e.rowGap}`),e.colGap&&o.push(`${t}col-gap-${e.colGap}`),e.justify){let s={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};o.push(`${t}${s[e.justify]}`);}if(e.align){let s={start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"};o.push(`${t}${s[e.align]}`);}if(e.alignContent){let s={start:"content-start",end:"content-end",center:"content-center",between:"content-between",around:"content-around",evenly:"content-evenly",stretch:"content-stretch"};o.push(`${t}${s[e.alignContent]}`);}return o},ge=P.forwardRef((e,t)=>{let{variant:o,inline:s=!1,as:r="div",className:i="",styles:a$1,children:l,sm:c,md:y,lg:u,xl:f,direction:S,wrap:g,gap:I,rowGap:m,colGap:x,justify:h,align:p,alignContent:d,...U}=e,b=[];if(b.push(s?"flex-inline":"flex"),o){let D={center:"flex-center",between:"flex-between",around:"flex-around",stack:"flex-stack",spread:"flex-spread"};b.push(D[o]);}b.push(...N({direction:S,wrap:g,gap:I,rowGap:m,colGap:x,justify:h,align:p,alignContent:d})),c&&b.push(...N(c,"sm:")),y&&b.push(...N(y,"md:")),u&&b.push(...N(u,"lg:")),f&&b.push(...N(f,"xl:"));let G=[...b,i].filter(Boolean).join(" ");return P.createElement(a,{as:r,ref:t,classes:G,styles:a$1,...U},l)});ge.displayName="Flex";var Se=P.forwardRef((e,t)=>{let{grow:o,shrink:s,basis:r,flex:i,alignSelf:a$1,order:l,as:c="div",className:y="",styles:u,children:f,sm:S,md:g,lg:I,xl:m,...x}=e,h=[];if(i){let d={1:"flex-1",auto:"flex-auto",initial:"flex-initial",none:"flex-none"};h.push(d[i]);}if(o!==void 0&&h.push(`flex-grow-${o}`),s!==void 0&&h.push(`flex-shrink-${s}`),r){let d={auto:"flex-basis-auto",0:"flex-basis-0",full:"flex-basis-full"};h.push(d[r]);}if(a$1){let d={auto:"self-auto",start:"self-start",end:"self-end",center:"self-center",baseline:"self-baseline",stretch:"self-stretch"};h.push(d[a$1]);}if(l){let d={first:"order-first",last:"order-last",none:"order-none"};h.push(d[l]);}if(S?.flex){let d={1:"flex-1",auto:"flex-auto",none:"flex-none"};h.push(`sm:${d[S.flex]}`);}if(g?.flex){let d={1:"flex-1",auto:"flex-auto",none:"flex-none"};h.push(`md:${d[g.flex]}`);}if(I?.flex){let d={1:"flex-1",auto:"flex-auto",none:"flex-none"};h.push(`lg:${d[I.flex]}`);}if(m?.flex){let d={1:"flex-1",auto:"flex-auto",none:"flex-none"};h.push(`xl:${d[m.flex]}`);}let p=[...h,y].filter(Boolean).join(" ");return P.createElement(a,{as:c,ref:t,classes:p,styles:u,...x},f)});Se.displayName="Flex.Item";var Ie=P.forwardRef((e,t)=>{let{as:o="div",className:s="",styles:r,...i}=e,a$1=["flex-1",s].filter(Boolean).join(" ");return P.createElement(a,{as:o,ref:t,classes:a$1,styles:r,...i})});Ie.displayName="Flex.Spacer";var X=ge;X.Item=Se;X.Spacer=Ie;var it=X;var Pe=({id:e,styles:t,classes:o,children:s,variant:r,...i})=>P.createElement(a,{as:"sup",id:e,styles:t,className:o,"data-badge":r||void 0,role:"status",...i},P.createElement(a,{as:"span"},s));Pe.displayName="Badge";var lt=({elm:e="span",role:t="note",variant:o,children:s,styles:r,...i})=>P.createElement(a,{as:e,role:t,"data-tag":o||void 0,styles:r,...i},s);lt.displayName="Tag";var pt=P.forwardRef(({summary:e,icon:t,styles:o,classes:s,ariaLabel:r,name:i,open:a$1,onPointerDown:l,onToggle:c,children:y,...u},f)=>{let S=useCallback(I=>{l?.(I);},[l]),g=useCallback(I=>{c?.(I);},[c]);return P.createElement(a,{as:"details",styles:o,classes:s,onToggle:g,ref:f,open:a$1,"aria-label":r,name:i,...u},P.createElement(a,{as:"summary",onPointerDown:S},t,e),P.createElement(a,{as:"section"},y))});pt.displayName="Details";
|
|
41
|
+
</svg>`;return `data:image/svg+xml,${encodeURIComponent(k)}`},[o,s]),m=a$1??v;return C.createElement(a,{as:"img",src:e,alt:t,width:o,height:s||"auto",loading:i,style:r,srcSet:y,sizes:u,onError:p=>{f&&f(p),p.defaultPrevented||p.currentTarget.src!==m&&(p.currentTarget.src=m);},onLoad:p=>{S?.(p);},decoding:c,...g,...l&&{fetchpriority:l}})};ie.displayName="Img";var ae=e=>{let[t,o]=useState([]),[s,r]=useState(e),[i,a]=useState(!1),[l,c]=useState(!1);return useEffect(()=>{let m=()=>{let x=window.speechSynthesis.getVoices();o(x);let h=x.find(p=>p.name==="Google US English");if(h)r(h);else {let p=x.find(d=>d.lang.startsWith("en-"));p&&r(p);}};return m(),window.speechSynthesis.onvoiceschanged=m,()=>{window.speechSynthesis.onvoiceschanged=null;}},[]),{speak:(m,x={},h)=>{let p=new SpeechSynthesisUtterance(m);p.lang=x.lang??"en-US",p.pitch=x.pitch??1,p.rate=x.rate??1,p.voice=s??x.voice??null,p.onend=()=>{a(!1),c(!1),h&&h();},"speechSynthesis"in window?(window.speechSynthesis.speak(p),a(!0),c(!1)):a(!1);},pause:()=>{i&&!l&&(window.speechSynthesis.pause(),c(!0));},resume:()=>{i&&l&&(window.speechSynthesis.resume(),c(!1));},cancel:()=>{i&&(window.speechSynthesis.cancel(),a(!1),c(!1));},isSpeaking:i,isPaused:l,availableVoices:t,changeVoice:m=>{r(m);},currentVoice:s,getAvailableLanguages:()=>[...new Set(t.map(m=>m.lang))]}};var et=({children:e,onClick:t})=>C.createElement(a,{as:"button",type:"button",className:"tts-border","data-btn":"sm text pill",onClick:t},e),M=C.memo(et),X=({label:e,isSpeaking:t,isPaused:o,onSpeak:s,onPause:r,onResume:i,onCancel:a$1})=>C.createElement(a,{as:"div","data-tts":!0},e&&C.createElement("p",null,e),!t&&C.createElement(M,{"aria-label":"Speak",onClick:s},C.createElement(b$1.PlaySolid,{size:16})),t&&!o&&C.createElement(M,{"aria-label":"Pause",onClick:r},C.createElement(b$1.PauseSolid,{size:16})),o&&C.createElement(M,{"aria-label":"Resume",onClick:i},C.createElement(b$1.ResumeSolid,{size:16})),C.createElement(M,{"aria-label":"Stop",onClick:a$1},C.createElement(b$1.StopSolid,{size:16})));X.displayName="TextToSpeechControls";X.TTSButton=M;var le=X;var pe=({initialText:e="",showTextInput:t=!1,voice:o,pitch:s=1,rate:r=1,label:i,onEnd:a})=>{let{speak:l,pause:c,resume:y,cancel:u,isSpeaking:f,isPaused:S}=ae(),[g,v]=useState(e);useEffect(()=>{v(e);},[e]);let m=()=>{g.trim()!==""&&l(g,{voice:o,pitch:s,rate:r},h);},x=p=>{v(p.target.value);},h=()=>{a&&a();};return C.createElement(C.Fragment,null,t&&C.createElement(b$2,{value:g,onChange:x}),C.createElement(le,{label:i,isSpeaking:f,isPaused:S,onSpeak:m,onPause:c,onResume:y,onCancel:u}))};pe.displayName="TextToSpeechComponent";var E=e=>C.createElement(C.Fragment,null,e),st=({id:e,children:t,headerBackground:o,styles:s,classes:r,...i})=>C.createElement(a,{as:"header",id:e,styles:s,className:r,...i},o,C.createElement(a,{as:"section"},t)),rt=({id:e,children:t,styles:o,classes:s,...r})=>C.createElement(a,{as:"main",id:e,styles:o,...r,className:s},t),nt=({id:e,classes:t,children:o,styles:s={},...r})=>C.createElement(a,{as:"footer",id:e,className:t,styles:s,...r},C.createElement(a,{as:"section"},o||"Copyright \xA9 2022")),it=({id:e,children:t,styles:o={},classes:s,...r})=>C.createElement(a,{as:"aside",id:e,styles:o,className:s,...r},C.createElement(a,{as:"section"},t)),at=({id:e,children:t,styles:o,classes:s,...r})=>C.createElement(a,{as:"section",id:e,styles:o,className:s,...r},t),lt=({id:e,children:t,styles:o,classes:s,...r})=>C.createElement(a,{as:"article",id:e,styles:o,className:s,...r},t);E.displayName="Landmarks";E.Header=st;E.Main=rt;E.Footer=nt;E.Aside=it;E.Section=at;E.Article=lt;var fe=C.forwardRef(({padding:e,paddingInline:t,paddingBlock:o,margin:s,marginInline:r,marginBlock:i,width:a$1,maxWidth:l,radius:c,as:y="div",className:u,classes:f,children:S,...g},v)=>{let m=[];e&&m.push(`box-padding-${e}`),t&&m.push(`box-padding-inline-${t}`),o&&m.push(`box-padding-block-${o}`),s&&m.push(`box-margin-${s}`),r&&m.push(`box-margin-inline-${r}`),i&&m.push(`box-margin-block-${i}`),a$1&&m.push(`box-width-${a$1}`),l&&m.push(`box-max-width-${l}`),c&&m.push(`box-radius-${c}`);let x=[...m,u,f].filter(Boolean).join(" ");return C.createElement(a,{as:y,ref:v,classes:x||void 0,...g},S)});fe.displayName="Box";var de=C.forwardRef(({gap:e,direction:t="vertical",align:o,justify:s,wrap:r,as:i="div",className:a$1,classes:l,children:c,...y},u)=>{let f=["stack"];t==="horizontal"?f.push("stack-horizontal"):f.push("stack-vertical"),e&&f.push(`stack-gap-${e}`),o&&f.push(`stack-align-${o}`),s&&f.push(`stack-justify-${s}`),r&&f.push(`stack-${r}`);let S=[...f,a$1,l].filter(Boolean).join(" ");return C.createElement(a,{as:i,ref:u,classes:S,...y},c)});de.displayName="Stack";var xe=C.forwardRef(({gap:e,justify:t,align:o,as:s="div",className:r,classes:i,children:a$1,...l},c)=>{let y=["cluster"];e&&y.push(`cluster-gap-${e}`),t&&y.push(`cluster-justify-${t}`),o&&y.push(`cluster-align-${o}`);let u=[...y,r,i].filter(Boolean).join(" ");return C.createElement(a,{as:s,ref:c,classes:u,...l},a$1)});xe.displayName="Cluster";var ye=C.forwardRef(({columns:e,auto:t,minColumnWidth:o,gap:s,gapX:r,gapY:i,justifyItems:a$1,alignItems:l,as:c="div",className:y,classes:u,children:f,style:S,styles:g,...v},m)=>{let x=["grid"];e&&x.push(`grid-cols-${e}`),t&&x.push(`grid-auto-${t}`),s&&x.push(`grid-gap-${s}`),r&&x.push(`grid-gap-x-${r}`),i&&x.push(`grid-gap-y-${i}`),a$1&&x.push(`grid-justify-items-${a$1}`),l&&x.push(`grid-align-items-${l}`);let h=[...x,y,u].filter(Boolean).join(" "),p={...S||{},...g||{}};return t&&o&&(p.gridTemplateColumns=`repeat(auto-${t}, minmax(${o}, 1fr))`),C.createElement(a,{as:c,ref:m,classes:h,style:Object.keys(p).length>0?p:void 0,...v},f)});ye.displayName="Grid";var Q=C.forwardRef(({span:e,rowSpan:t,as:o="div",className:s,classes:r,children:i,...a$1},l)=>{let c=[];e&&c.push(`grid-col-span-${e}`),t&&c.push(`grid-row-span-${t}`);let y=[...c,s,r].filter(Boolean).join(" ");return C.createElement(a,{as:o,ref:l,classes:y,...a$1},i)});Q.displayName="GridItem";var he=ye;he.Item=Q;var pt=he;var Se=C.forwardRef(({gap:e,justify:t,align:o,wrap:s,alwaysProportional:r=!1,as:i="div",className:a$1,classes:l,children:c,...y},u)=>{process.env.NODE_ENV==="development"&&r&&console.warn('[fpkit] Row: alwaysProportional is deprecated and will be removed in v5.0.0. Use responsive column utilities instead: className="col-sm-6 col-md-4"');let f=["col-row"];e&&f.push(`col-row-gap-${e}`),t&&f.push(`col-row-justify-${t}`),o&&f.push(`col-row-align-${o}`),s&&s!=="wrap"&&f.push(`col-row-${s}`),r&&f.push("col-row-proportional");let S=[...f,a$1,l].filter(Boolean).join(" ");return C.createElement(a,{as:i,ref:u,classes:S,...y},c)});Se.displayName="Row";var Ie=C.forwardRef(({span:e,offset:t,order:o,auto:s=!1,as:r="div",className:i,classes:a$1,children:l,...c},y)=>{let u=[];s?u.push("col-auto"):e==="flex"?u.push("col-flex"):e&&u.push(`col-${e}`),t!==void 0&&u.push(`col-offset-${t}`),o!==void 0&&u.push(`col-order-${o}`);let f=[...u,i,a$1].filter(Boolean).join(" ");return C.createElement(a,{as:r,ref:y,classes:f,...c},l)});Ie.displayName="Col";var B=(e,t="")=>{let o=[];if(e.direction){let s={row:"flex-row","row-reverse":"flex-row-reverse",column:"flex-col","column-reverse":"flex-col-reverse"};o.push(`${t}${s[e.direction]}`);}if(e.wrap){let s={wrap:"flex-wrap",nowrap:"flex-nowrap","wrap-reverse":"flex-wrap-reverse"};o.push(`${t}${s[e.wrap]}`);}if(e.gap&&o.push(`${t}gap-${e.gap}`),e.rowGap&&o.push(`${t}row-gap-${e.rowGap}`),e.colGap&&o.push(`${t}col-gap-${e.colGap}`),e.justify){let s={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};o.push(`${t}${s[e.justify]}`);}if(e.align){let s={start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"};o.push(`${t}${s[e.align]}`);}if(e.alignContent){let s={start:"content-start",end:"content-end",center:"content-center",between:"content-between",around:"content-around",evenly:"content-evenly",stretch:"content-stretch"};o.push(`${t}${s[e.alignContent]}`);}return o},Pe=C.forwardRef((e,t)=>{let{variant:o,inline:s=!1,as:r="div",className:i="",styles:a$1,children:l,sm:c,md:y,lg:u,xl:f,direction:S,wrap:g,gap:v,rowGap:m,colGap:x,justify:h,align:p,alignContent:d,...k}=e,I=[];if(I.push(s?"flex-inline":"flex"),o){let A={center:"flex-center",between:"flex-between",around:"flex-around",stack:"flex-stack",spread:"flex-spread"};I.push(A[o]);}I.push(...B({direction:S,wrap:g,gap:v,rowGap:m,colGap:x,justify:h,align:p,alignContent:d})),c&&I.push(...B(c,"sm:")),y&&I.push(...B(y,"md:")),u&&I.push(...B(u,"lg:")),f&&I.push(...B(f,"xl:"));let U=[...I,i].filter(Boolean).join(" ");return C.createElement(a,{as:r,ref:t,classes:U,styles:a$1,...k},l)});Pe.displayName="Flex";var Ce=C.forwardRef((e,t)=>{let{grow:o,shrink:s,basis:r,flex:i,alignSelf:a$1,order:l,as:c="div",className:y="",styles:u,children:f,sm:S,md:g,lg:v,xl:m,...x}=e,h=[];if(i){let d={1:"flex-1",auto:"flex-auto",initial:"flex-initial",none:"flex-none"};h.push(d[i]);}if(o!==void 0&&h.push(`flex-grow-${o}`),s!==void 0&&h.push(`flex-shrink-${s}`),r){let d={auto:"flex-basis-auto",0:"flex-basis-0",full:"flex-basis-full"};h.push(d[r]);}if(a$1){let d={auto:"self-auto",start:"self-start",end:"self-end",center:"self-center",baseline:"self-baseline",stretch:"self-stretch"};h.push(d[a$1]);}if(l){let d={first:"order-first",last:"order-last",none:"order-none"};h.push(d[l]);}if(S?.flex){let d={1:"flex-1",auto:"flex-auto",none:"flex-none"};h.push(`sm:${d[S.flex]}`);}if(g?.flex){let d={1:"flex-1",auto:"flex-auto",none:"flex-none"};h.push(`md:${d[g.flex]}`);}if(v?.flex){let d={1:"flex-1",auto:"flex-auto",none:"flex-none"};h.push(`lg:${d[v.flex]}`);}if(m?.flex){let d={1:"flex-1",auto:"flex-auto",none:"flex-none"};h.push(`xl:${d[m.flex]}`);}let p=[...h,y].filter(Boolean).join(" ");return C.createElement(a,{as:c,ref:t,classes:p,styles:u,...x},f)});Ce.displayName="Flex.Item";var be=C.forwardRef((e,t)=>{let{as:o="div",className:s="",styles:r,...i}=e,a$1=["flex-1",s].filter(Boolean).join(" ");return C.createElement(a,{as:o,ref:t,classes:a$1,styles:r,...i})});be.displayName="Flex.Spacer";var Y=Pe;Y.Item=Ce;Y.Spacer=be;var ct=Y;var we=({id:e,styles:t,classes:o,children:s,variant:r,...i})=>C.createElement(a,{as:"sup",id:e,styles:t,className:o,"data-badge":r||void 0,role:"status",...i},C.createElement(a,{as:"span"},s));we.displayName="Badge";var mt=({elm:e="span",role:t="note",variant:o,children:s,styles:r,...i})=>C.createElement(a,{as:e,role:t,"data-tag":o||void 0,styles:r,...i},s);mt.displayName="Tag";var dt=C.forwardRef(({summary:e,icon:t,styles:o,classes:s,ariaLabel:r,name:i,open:a$1,onPointerDown:l,onToggle:c,children:y,...u},f)=>{let S=useCallback(v=>{l?.(v);},[l]),g=useCallback(v=>{c?.(v);},[c]);return C.createElement(a,{as:"details",styles:o,classes:s,onToggle:g,ref:f,open:a$1,"aria-label":r,name:i,...u},C.createElement(a,{as:"summary",onPointerDown:S},t,e),C.createElement(a,{as:"section"},y))});dt.displayName="Details";
|
|
41
42
|
|
|
42
|
-
export {
|
|
43
|
+
export { re as Alert, lt as Article, it as Aside, we as Badge, fe as Box, ne as Checkbox, xe as Cluster, Ie as Col, dt as Details, ct as Flex, nt as Footer, pt as Grid, Q as GridItem, st as Header, ie as Img, E as Landmarks, rt as Main, Se as Row, at as Section, de as Stack, mt as Tag, pe as TextToSpeech };
|
|
43
44
|
//# sourceMappingURL=out.js.map
|
|
44
45
|
//# sourceMappingURL=index.js.map
|