@arc-ui/components 10.8.0 → 11.0.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/dist/Align/{index.d.ts → Align.cjs.d.ts} +0 -0
- package/dist/Align/Align.cjs.js +33 -0
- package/dist/Align/Align.esm.d.ts +25 -0
- package/dist/Align/{index.js → Align.esm.js} +3 -3
- package/dist/Align/package.json +7 -0
- package/dist/Base/{index.d.ts → Base.cjs.d.ts} +0 -0
- package/dist/Base/Base.cjs.js +23 -0
- package/dist/Base/Base.esm.d.ts +16 -0
- package/dist/Base/{index.js → Base.esm.js} +1 -1
- package/dist/Base/package.json +7 -0
- package/dist/BrandLogo/BrandLogo.cjs.d.ts +1 -0
- package/dist/BrandLogo/BrandLogo.cjs.js +14 -0
- package/dist/BrandLogo/BrandLogo.esm.d.ts +1 -0
- package/dist/BrandLogo/BrandLogo.esm.js +6 -0
- package/dist/BrandLogo/package.json +7 -0
- package/dist/Breadcrumbs/{index.d.ts → Breadcrumbs.cjs.d.ts} +0 -0
- package/dist/Breadcrumbs/Breadcrumbs.cjs.js +650 -0
- package/dist/Breadcrumbs/Breadcrumbs.esm.d.ts +61 -0
- package/dist/Breadcrumbs/{index.js → Breadcrumbs.esm.js} +9 -9
- package/dist/Breadcrumbs/package.json +7 -0
- package/dist/Button/Button.cjs.d.ts +1 -0
- package/dist/Button/Button.cjs.js +16 -0
- package/dist/Button/Button.esm.d.ts +1 -0
- package/dist/Button/Button.esm.js +8 -0
- package/dist/Button/package.json +7 -0
- package/dist/Card/{index.d.ts → Card.cjs.d.ts} +0 -0
- package/dist/Card/Card.cjs.js +126 -0
- package/dist/Card/Card.esm.d.ts +130 -0
- package/dist/Card/{index.js → Card.esm.js} +10 -10
- package/dist/Card/package.json +7 -0
- package/dist/Checkbox/{index.d.ts → Checkbox.cjs.d.ts} +0 -0
- package/dist/Checkbox/Checkbox.cjs.js +78 -0
- package/dist/Checkbox/Checkbox.esm.d.ts +59 -0
- package/dist/Checkbox/Checkbox.esm.js +70 -0
- package/dist/Checkbox/package.json +7 -0
- package/dist/Clock/{index.d.ts → Clock.cjs.d.ts} +0 -0
- package/dist/Clock/Clock.cjs.js +43 -0
- package/dist/Clock/Clock.esm.d.ts +15 -0
- package/dist/Clock/{index.js → Clock.esm.js} +1 -1
- package/dist/Clock/package.json +7 -0
- package/dist/Columns/{index.d.ts → Columns.cjs.d.ts} +0 -0
- package/dist/Columns/Columns.cjs.js +59 -0
- package/dist/Columns/Columns.esm.d.ts +76 -0
- package/dist/Columns/{index.js → Columns.esm.js} +3 -3
- package/dist/Columns/package.json +7 -0
- package/dist/Curve/Curve.cjs.d.ts +1 -0
- package/dist/Curve/Curve.cjs.js +13 -0
- package/dist/Curve/Curve.esm.d.ts +1 -0
- package/dist/Curve/Curve.esm.js +5 -0
- package/dist/Curve/package.json +7 -0
- package/dist/Disclosure/{index.d.ts → Disclosure.cjs.d.ts} +1 -1
- package/dist/Disclosure/Disclosure.cjs.js +36 -0
- package/dist/Disclosure/Disclosure.esm.d.ts +31 -0
- package/dist/Disclosure/{index.js → Disclosure.esm.js} +8 -5
- package/dist/Disclosure/package.json +7 -0
- package/dist/Elevation/{index.d.ts → Elevation.cjs.d.ts} +0 -0
- package/dist/Elevation/Elevation.cjs.js +25 -0
- package/dist/Elevation/Elevation.esm.d.ts +16 -0
- package/dist/Elevation/{index.js → Elevation.esm.js} +2 -2
- package/dist/Elevation/package.json +7 -0
- package/dist/FormControl/FormControl.cjs.d.ts +1 -0
- package/dist/FormControl/FormControl.cjs.js +14 -0
- package/dist/FormControl/FormControl.esm.d.ts +1 -0
- package/dist/FormControl/FormControl.esm.js +5 -0
- package/dist/FormControl/package.json +7 -0
- package/dist/Group/{index.d.ts → Group.cjs.d.ts} +0 -0
- package/dist/Group/Group.cjs.js +50 -0
- package/dist/Group/Group.esm.d.ts +46 -0
- package/dist/Group/{index.js → Group.esm.js} +3 -3
- package/dist/Group/package.json +7 -0
- package/dist/Heading/Heading.cjs.d.ts +1 -0
- package/dist/Heading/Heading.cjs.js +14 -0
- package/dist/Heading/Heading.esm.d.ts +1 -0
- package/dist/Heading/Heading.esm.js +6 -0
- package/dist/Heading/package.json +7 -0
- package/dist/Icon/Icon.cjs.d.ts +1 -0
- package/dist/Icon/Icon.cjs.js +14 -0
- package/dist/Icon/Icon.esm.d.ts +1 -0
- package/dist/Icon/Icon.esm.js +6 -0
- package/dist/Icon/package.json +7 -0
- package/dist/Image/Image.cjs.d.ts +1 -0
- package/dist/Image/Image.cjs.js +13 -0
- package/dist/Image/Image.esm.d.ts +1 -0
- package/dist/Image/Image.esm.js +5 -0
- package/dist/Image/package.json +7 -0
- package/dist/Markup/{index.d.ts → Markup.cjs.d.ts} +0 -0
- package/dist/Markup/Markup.cjs.js +27 -0
- package/dist/Markup/Markup.esm.d.ts +16 -0
- package/dist/Markup/{index.js → Markup.esm.js} +3 -3
- package/dist/Markup/package.json +7 -0
- package/dist/Poster/{index.d.ts → Poster.cjs.d.ts} +2 -2
- package/dist/Poster/Poster.cjs.js +52 -0
- package/dist/Poster/Poster.esm.d.ts +81 -0
- package/dist/Poster/{index.js → Poster.esm.js} +5 -5
- package/dist/Poster/package.json +7 -0
- package/dist/RadioGroup/{index.d.ts → RadioGroup.cjs.d.ts} +1 -1
- package/dist/RadioGroup/RadioGroup.cjs.js +72 -0
- package/dist/RadioGroup/RadioGroup.esm.d.ts +85 -0
- package/dist/RadioGroup/{index.js → RadioGroup.esm.js} +4 -4
- package/dist/RadioGroup/package.json +7 -0
- package/dist/Rule/{index.d.ts → Rule.cjs.d.ts} +0 -0
- package/dist/Rule/Rule.cjs.js +25 -0
- package/dist/Rule/Rule.esm.d.ts +8 -0
- package/dist/Rule/{index.js → Rule.esm.js} +3 -3
- package/dist/Rule/package.json +7 -0
- package/dist/Section/Section.cjs.d.ts +1 -0
- package/dist/Section/Section.cjs.js +12 -0
- package/dist/Section/Section.esm.d.ts +1 -0
- package/dist/Section/Section.esm.js +4 -0
- package/dist/Section/package.json +7 -0
- package/dist/SiteFooter/{index.d.ts → SiteFooter.cjs.d.ts} +0 -0
- package/dist/SiteFooter/SiteFooter.cjs.js +99 -0
- package/dist/SiteFooter/SiteFooter.esm.d.ts +64 -0
- package/dist/SiteFooter/{index.js → SiteFooter.esm.js} +12 -10
- package/dist/SiteFooter/package.json +7 -0
- package/dist/SiteHeader/{index.d.ts → SiteHeader.cjs.d.ts} +1 -1
- package/dist/SiteHeader/SiteHeader.cjs.js +669 -0
- package/dist/SiteHeader/SiteHeader.esm.d.ts +252 -0
- package/dist/SiteHeader/{index.js → SiteHeader.esm.js} +39 -17
- package/dist/SiteHeader/package.json +7 -0
- package/dist/Surface/{index.d.ts → Surface.cjs.d.ts} +1 -1
- package/dist/Surface/Surface.cjs.js +15 -0
- package/dist/Surface/Surface.esm.d.ts +1 -0
- package/dist/Surface/Surface.esm.js +4 -0
- package/dist/Surface/package.json +7 -0
- package/dist/Text/Text.cjs.d.ts +1 -0
- package/dist/Text/Text.cjs.js +14 -0
- package/dist/Text/Text.esm.d.ts +1 -0
- package/dist/Text/Text.esm.js +6 -0
- package/dist/Text/package.json +7 -0
- package/dist/TextInput/{index.d.ts → TextInput.cjs.d.ts} +1 -1
- package/dist/TextInput/TextInput.cjs.js +64 -0
- package/dist/TextInput/TextInput.esm.d.ts +71 -0
- package/dist/TextInput/{index.js → TextInput.esm.js} +4 -4
- package/dist/TextInput/package.json +7 -0
- package/dist/UniversalHeader/{index.d.ts → UniversalHeader.cjs.d.ts} +0 -0
- package/dist/UniversalHeader/UniversalHeader.cjs.js +38 -0
- package/dist/UniversalHeader/UniversalHeader.esm.d.ts +26 -0
- package/dist/UniversalHeader/{index.js → UniversalHeader.esm.js} +3 -3
- package/dist/UniversalHeader/package.json +7 -0
- package/dist/VerticalSpace/{index.d.ts → VerticalSpace.cjs.d.ts} +0 -0
- package/dist/VerticalSpace/VerticalSpace.cjs.js +27 -0
- package/dist/VerticalSpace/VerticalSpace.esm.d.ts +18 -0
- package/dist/VerticalSpace/{index.js → VerticalSpace.esm.js} +2 -2
- package/dist/VerticalSpace/package.json +7 -0
- package/dist/VisuallyHidden/{index.d.ts → VisuallyHidden.cjs.d.ts} +0 -0
- package/dist/VisuallyHidden/VisuallyHidden.cjs.js +19 -0
- package/dist/VisuallyHidden/VisuallyHidden.esm.d.ts +12 -0
- package/dist/VisuallyHidden/{index.js → VisuallyHidden.esm.js} +0 -0
- package/dist/VisuallyHidden/package.json +7 -0
- package/dist/_shared/{BrandLogo-6cc8202e.d.ts → cjs/BrandLogo-3c6102ef.d.ts} +0 -0
- package/dist/_shared/cjs/BrandLogo-3c6102ef.js +31 -0
- package/dist/_shared/cjs/BtIconChevronDown2Px-8fb4e2eb.js +29 -0
- package/dist/_shared/cjs/BtIconChevronRight2Px-a8e40136.js +50 -0
- package/dist/_shared/cjs/BtIconChevronRightMid-5a38d855.js +31 -0
- package/dist/_shared/{Button-2fcbd4ed.d.ts → cjs/Button-b3a69953.d.ts} +3 -3
- package/dist/_shared/cjs/Button-b3a69953.js +80 -0
- package/dist/_shared/{Curve-5f476d0b.d.ts → cjs/Curve-e72ce25b.d.ts} +1 -1
- package/dist/_shared/cjs/Curve-e72ce25b.js +30 -0
- package/dist/_shared/{FormControl-9dc9ecc3.d.ts → cjs/FormControl-a1b7421b.d.ts} +0 -0
- package/dist/_shared/cjs/FormControl-a1b7421b.js +115 -0
- package/dist/_shared/{Heading-8c640dd1.d.ts → cjs/Heading-cc38c3ec.d.ts} +0 -0
- package/dist/_shared/cjs/Heading-cc38c3ec.js +41 -0
- package/dist/_shared/{Icon-b053f03d.d.ts → cjs/Icon-719d13d4.d.ts} +6 -6
- package/dist/_shared/cjs/Icon-719d13d4.js +52 -0
- package/dist/_shared/{Image-a3225049.d.ts → cjs/Image-fe760a06.d.ts} +0 -0
- package/dist/_shared/cjs/Image-fe760a06.js +45 -0
- package/dist/_shared/{Section-927988cb.d.ts → cjs/Section-780f2377.d.ts} +0 -0
- package/dist/_shared/cjs/Section-780f2377.js +23 -0
- package/dist/_shared/{Surface-3fe44a2a.d.ts → cjs/Surface-d6b8010e.d.ts} +0 -0
- package/dist/_shared/cjs/Surface-d6b8010e.js +58 -0
- package/dist/_shared/{Text-1c43d82b.d.ts → cjs/Text-1d3844be.d.ts} +0 -0
- package/dist/_shared/cjs/Text-1d3844be.js +32 -0
- package/dist/_shared/cjs/arc-icon-17594b2f.d.ts +4 -0
- package/dist/_shared/{handle-link-click-35e09d0c.d.ts → cjs/handle-link-click-17a44cf4.d.ts} +0 -0
- package/dist/_shared/cjs/handle-link-click-17a44cf4.js +15 -0
- package/dist/_shared/cjs/index-45bfb67b.js +63 -0
- package/dist/_shared/{index-e3c83626.d.ts → cjs/index-78b35bc1.d.ts} +0 -0
- package/dist/_shared/cjs/index-78b35bc1.js +215 -0
- package/dist/_shared/{index-9483ad5f.d.ts → cjs/index-9483ad5f.d.ts} +2 -2
- package/dist/_shared/cjs/index-c81c9401.d.ts +4 -0
- package/dist/_shared/{use-media-query-f11805d4.d.ts → cjs/index.es-77def0c9.d.ts} +0 -0
- package/dist/_shared/cjs/index.es-77def0c9.js +50 -0
- package/dist/_shared/{suffix-modifier-2a93822c.d.ts → cjs/suffix-modifier-edf7851e.d.ts} +0 -0
- package/dist/_shared/cjs/suffix-modifier-edf7851e.js +19 -0
- package/dist/_shared/esm/BrandLogo-ea3dd0e6.d.ts +26 -0
- package/dist/_shared/{BrandLogo-6cc8202e.js → esm/BrandLogo-ea3dd0e6.js} +4 -4
- package/dist/_shared/esm/BtIconChevronDown2Px-4abd079b.js +23 -0
- package/dist/_shared/esm/BtIconChevronRight2Px-a5cc1d05.js +43 -0
- package/dist/_shared/esm/BtIconChevronRightMid-386cf272.js +25 -0
- package/dist/_shared/esm/Button-5ff56a7b.d.ts +98 -0
- package/dist/_shared/esm/Button-5ff56a7b.js +74 -0
- package/dist/_shared/esm/Curve-cfdca379.d.ts +32 -0
- package/dist/_shared/{Curve-5f476d0b.js → esm/Curve-cfdca379.js} +3 -3
- package/dist/_shared/esm/FormControl-feedc495.d.ts +70 -0
- package/dist/_shared/{FormControl-9dc9ecc3.js → esm/FormControl-feedc495.js} +43 -11
- package/dist/_shared/esm/Heading-183be76c.d.ts +46 -0
- package/dist/_shared/{Heading-8c640dd1.js → esm/Heading-183be76c.js} +4 -4
- package/dist/_shared/esm/Icon-76d0d8c0.d.ts +34 -0
- package/dist/_shared/esm/Icon-76d0d8c0.js +46 -0
- package/dist/_shared/esm/Image-7e4948f6.d.ts +94 -0
- package/dist/_shared/{Image-a3225049.js → esm/Image-7e4948f6.js} +3 -3
- package/dist/_shared/esm/Section-f1256c87.d.ts +21 -0
- package/dist/_shared/{Section-927988cb.js → esm/Section-f1256c87.js} +2 -2
- package/dist/_shared/esm/Surface-d515d212.d.ts +50 -0
- package/dist/_shared/{Surface-3fe44a2a.js → esm/Surface-d515d212.js} +2 -2
- package/dist/_shared/esm/Text-d8988620.d.ts +34 -0
- package/dist/_shared/{Text-1c43d82b.js → esm/Text-d8988620.js} +4 -4
- package/dist/_shared/esm/arc-icon-17594b2f.d.ts +4 -0
- package/dist/_shared/esm/handle-link-click-f64f55a2.d.ts +7 -0
- package/dist/_shared/{handle-link-click-35e09d0c.js → esm/handle-link-click-f64f55a2.js} +0 -0
- package/dist/_shared/esm/index-229fc864.d.ts +2 -0
- package/dist/_shared/{index-e3c83626.js → esm/index-229fc864.js} +0 -0
- package/dist/_shared/{index-56d9df62.js → esm/index-2ae58626.js} +0 -0
- package/dist/_shared/esm/index-9483ad5f.d.ts +14 -0
- package/dist/_shared/esm/index-c81c9401.d.ts +4 -0
- package/dist/_shared/esm/index.es-00cb3bcb.d.ts +19 -0
- package/dist/_shared/{use-media-query-f11805d4.js → esm/index.es-00cb3bcb.js} +8 -1
- package/dist/_shared/esm/suffix-modifier-f5e28822.d.ts +10 -0
- package/dist/_shared/{suffix-modifier-2a93822c.js → esm/suffix-modifier-f5e28822.js} +1 -1
- package/dist/index.es.js +454 -528
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +311 -385
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/components/Button/Button.d.ts +3 -3
- package/dist/types/components/Icon/Icon.d.ts +6 -6
- package/dist/types/types/arc-icon.d.ts +2 -0
- package/package.json +4 -3
- package/dist/BrandLogo/index.d.ts +0 -1
- package/dist/BrandLogo/index.js +0 -6
- package/dist/Button/index.d.ts +0 -1
- package/dist/Button/index.js +0 -8
- package/dist/Checkbox/index.js +0 -46
- package/dist/Curve/index.d.ts +0 -1
- package/dist/Curve/index.js +0 -5
- package/dist/FormControl/index.d.ts +0 -1
- package/dist/FormControl/index.js +0 -5
- package/dist/Heading/index.d.ts +0 -1
- package/dist/Heading/index.js +0 -6
- package/dist/Icon/index.d.ts +0 -1
- package/dist/Icon/index.js +0 -7
- package/dist/Image/index.d.ts +0 -1
- package/dist/Image/index.js +0 -5
- package/dist/Section/index.d.ts +0 -1
- package/dist/Section/index.js +0 -4
- package/dist/Surface/index.js +0 -4
- package/dist/Text/index.d.ts +0 -1
- package/dist/Text/index.js +0 -6
- package/dist/_shared/Button-2fcbd4ed.js +0 -51
- package/dist/_shared/Icon-b053f03d.js +0 -27
- package/dist/_shared/index-c81c9401.d.ts +0 -4
- package/dist/_shared/index.es-ff960629.js +0 -286
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FC, ReactNode, ReactElement } from "react";
|
|
3
|
+
import { subBrands } from "../_shared/esm/BrandLogo-ea3dd0e6";
|
|
4
|
+
declare const Column: FC<ColumnProps>;
|
|
5
|
+
interface ColumnProps {
|
|
6
|
+
/**
|
|
7
|
+
* Contents of the Column. Must be SiteHeader.ItemGroup components.
|
|
8
|
+
*/
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare const Item: FC<ItemProps>;
|
|
12
|
+
interface ItemProps {
|
|
13
|
+
/**
|
|
14
|
+
* Contents of the Item. Usually text to be displayed in the Item link.
|
|
15
|
+
*/
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* A URL to link to when the Item is clicked or touched.
|
|
19
|
+
*/
|
|
20
|
+
href: string;
|
|
21
|
+
/**
|
|
22
|
+
* Should the Item be emphasised?
|
|
23
|
+
*/
|
|
24
|
+
isEmphasised?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* On click handler.
|
|
27
|
+
*/
|
|
28
|
+
onClick?: () => void;
|
|
29
|
+
}
|
|
30
|
+
declare const ItemGroup: FC<ItemGroupProps>;
|
|
31
|
+
interface ItemGroupProps {
|
|
32
|
+
/**
|
|
33
|
+
* Contents of the ItemGroup. Must be Item components.
|
|
34
|
+
*/
|
|
35
|
+
children: ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* A top-level URL for the ItemGroup to link to.
|
|
38
|
+
*/
|
|
39
|
+
href?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Title text to be displayed in the ItemGroup summary.
|
|
42
|
+
*/
|
|
43
|
+
title?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Text to display in top-level link inside the ItemGroup in narrow viewports.
|
|
46
|
+
* Only applies if `href` is present. If not provided, top-level link text
|
|
47
|
+
* will be automatically generated from `title`.
|
|
48
|
+
*/
|
|
49
|
+
viewAllTitle?: string;
|
|
50
|
+
/**
|
|
51
|
+
* On click handler.
|
|
52
|
+
*/
|
|
53
|
+
onClick?: () => void;
|
|
54
|
+
}
|
|
55
|
+
declare const NavItem: FC<NavItemProps>;
|
|
56
|
+
interface NavItemProps {
|
|
57
|
+
/**
|
|
58
|
+
* Contents of the NavItem. Must be SiteHeader.ItemGroup or
|
|
59
|
+
* SiteHeader.Column components.
|
|
60
|
+
*/
|
|
61
|
+
children?: ReactNode;
|
|
62
|
+
/**
|
|
63
|
+
* A top-level URL for the NavItem to link to.
|
|
64
|
+
*
|
|
65
|
+
* When `children` are not present, the URL to link to when the NavItem is
|
|
66
|
+
* clicked or touched.
|
|
67
|
+
*
|
|
68
|
+
* When `children` are present, the URL to link to when a top-level link
|
|
69
|
+
* inside the NavItem panel is clicked or touched.
|
|
70
|
+
*/
|
|
71
|
+
href?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Should the NavItem be highlighted as the current item/page? Only applies if
|
|
74
|
+
* `children` are not present (and `href` is present).
|
|
75
|
+
*/
|
|
76
|
+
isCurrent?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Content to display in the NavItem panel promo area.
|
|
79
|
+
*/
|
|
80
|
+
promo?: ReactNode;
|
|
81
|
+
/**
|
|
82
|
+
* Top-level text to display in the NavItem.
|
|
83
|
+
*/
|
|
84
|
+
title: string;
|
|
85
|
+
/**
|
|
86
|
+
* Text to display in top-level link inside the NavItem panel. Only
|
|
87
|
+
* applies if both `children` are present and `href` is true. If not
|
|
88
|
+
* provided, top-level link text will be automatically generated from `title`.
|
|
89
|
+
*/
|
|
90
|
+
viewAllTitle?: string;
|
|
91
|
+
/**
|
|
92
|
+
* On click handler.
|
|
93
|
+
*/
|
|
94
|
+
onClick?: () => void;
|
|
95
|
+
}
|
|
96
|
+
declare const NavItemWithSubNav: FC<NavItemWithSubNavProps>;
|
|
97
|
+
interface NavItemWithSubNavProps {
|
|
98
|
+
/**
|
|
99
|
+
* The URL to link to when a top-level link inside the NavItemWithSubNav panel
|
|
100
|
+
* is clicked or touched.
|
|
101
|
+
*/
|
|
102
|
+
href?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Content to be displayed in the first slot of the NavItemWithSubNav. Must be
|
|
105
|
+
* a single SiteHeader.SubNavItem component.
|
|
106
|
+
*/
|
|
107
|
+
slot1: ReactElement;
|
|
108
|
+
/**
|
|
109
|
+
* Content to be displayed in the second slot of the NavItemWithSubNav. Must
|
|
110
|
+
* be a single SiteHeader.SubNavItem component.
|
|
111
|
+
*/
|
|
112
|
+
slot2: ReactNode;
|
|
113
|
+
/**
|
|
114
|
+
* Content to be displayed in the third slot of the NavItemWithSubNav. Must be
|
|
115
|
+
* a single SiteHeader.SubNavItem component.
|
|
116
|
+
*/
|
|
117
|
+
slot3?: ReactNode;
|
|
118
|
+
/**
|
|
119
|
+
* Title text to display inside the NavItemWithSubNav panel.
|
|
120
|
+
*/
|
|
121
|
+
subTitle?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Top-level text to display in the NavItemWithSubNav.
|
|
124
|
+
*/
|
|
125
|
+
title: string;
|
|
126
|
+
/**
|
|
127
|
+
* Text to display in top-level link inside the NavItemWithSubNav panel. Only
|
|
128
|
+
* applies if `href` is true. If not provided, text will be automatically
|
|
129
|
+
* generated from `title`.
|
|
130
|
+
*/
|
|
131
|
+
viewAllTitle?: string;
|
|
132
|
+
/**
|
|
133
|
+
* view all click handler.
|
|
134
|
+
*/
|
|
135
|
+
onViewAllClick?: () => void;
|
|
136
|
+
}
|
|
137
|
+
declare const SubNavItem: FC<SubNavItemProps>;
|
|
138
|
+
interface SubNavItemProps {
|
|
139
|
+
/**
|
|
140
|
+
* Contents of the SubNavItem. Must be SiteHeader.ItemGroup or
|
|
141
|
+
* SiteHeader.Column components.
|
|
142
|
+
*/
|
|
143
|
+
children?: ReactNode;
|
|
144
|
+
/**
|
|
145
|
+
* Should the SubNavItem be the default open item in a
|
|
146
|
+
* SiteHeader.NavItemWithSubNav? If not specified, the default open item will
|
|
147
|
+
* be set automatically.
|
|
148
|
+
*/
|
|
149
|
+
isDefaultItem?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Optionally shift the SubNavItem-link upwards (in "desktop" viewports only)
|
|
152
|
+
* to close off any empty space between items due to content size.
|
|
153
|
+
*/
|
|
154
|
+
offsetXL?: "24" | "48";
|
|
155
|
+
/**
|
|
156
|
+
* Content to display in the SubNavItem panel promo area.
|
|
157
|
+
*/
|
|
158
|
+
promo?: ReactNode;
|
|
159
|
+
/**
|
|
160
|
+
* A URL to link to when the SubNavItem is clicked or touched. Only applies if
|
|
161
|
+
* `children` are not present.
|
|
162
|
+
*/
|
|
163
|
+
href?: string;
|
|
164
|
+
/**
|
|
165
|
+
* Optional subtitle text for the SubNavItem.
|
|
166
|
+
*/
|
|
167
|
+
subTitle?: string;
|
|
168
|
+
/**
|
|
169
|
+
* Title text for the SubNavItem.
|
|
170
|
+
*/
|
|
171
|
+
title: string;
|
|
172
|
+
/**
|
|
173
|
+
* Text to display in top-level link inside the SubNavItem panel. Only
|
|
174
|
+
* applies if both `children` are present and `href` is true. If not
|
|
175
|
+
* provided, top-level link text will be automatically generated from `title`.
|
|
176
|
+
*/
|
|
177
|
+
viewAllTitle?: string;
|
|
178
|
+
/**
|
|
179
|
+
* On click handler.
|
|
180
|
+
*/
|
|
181
|
+
onClick?: () => void;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Use `SiteHeader` to display brand logo and navigation at the top of a page.
|
|
185
|
+
*/
|
|
186
|
+
declare const SiteHeader: FC<SiteHeaderProps> & {
|
|
187
|
+
Column: typeof Column;
|
|
188
|
+
Item: typeof Item;
|
|
189
|
+
ItemGroup: typeof ItemGroup;
|
|
190
|
+
NavItem: typeof NavItem;
|
|
191
|
+
NavItemWithSubNav: typeof NavItemWithSubNav;
|
|
192
|
+
SubNavItem: typeof SubNavItem;
|
|
193
|
+
};
|
|
194
|
+
interface SiteHeaderProps {
|
|
195
|
+
/**
|
|
196
|
+
* Contents of the SiteHeader. Must be SiteHeader.NavItem or
|
|
197
|
+
* SiteHeader.NavItemWithSubNav components.
|
|
198
|
+
*/
|
|
199
|
+
children?: ReactNode;
|
|
200
|
+
/**
|
|
201
|
+
* Basket component for the SiteHeader.
|
|
202
|
+
*/
|
|
203
|
+
basket?: ReactNode;
|
|
204
|
+
/**
|
|
205
|
+
* Should account login links be included in the SiteHeader?
|
|
206
|
+
*/
|
|
207
|
+
hasLogin?: boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Should the SiteHeader have a transparent background?
|
|
210
|
+
*/
|
|
211
|
+
isTransparent?: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* A URL to link to when SiteHeader logo is clicked or touched.
|
|
214
|
+
*/
|
|
215
|
+
loginHref?: string;
|
|
216
|
+
/**
|
|
217
|
+
* A Function to run to when SiteHeader logo is clicked or touched.
|
|
218
|
+
*/
|
|
219
|
+
logoOnClick?: () => void;
|
|
220
|
+
/**
|
|
221
|
+
* A Function to run to when SiteHeader login links are clicked or touched.
|
|
222
|
+
*/
|
|
223
|
+
loginOnClick?: () => void;
|
|
224
|
+
/**
|
|
225
|
+
* Text to display in SiteHeader login links.
|
|
226
|
+
*/
|
|
227
|
+
loginTitle?: string;
|
|
228
|
+
/**
|
|
229
|
+
* A URL to link to when the SiteHeader brand logo link is clicked or touched.
|
|
230
|
+
*/
|
|
231
|
+
logoHref?: string;
|
|
232
|
+
/**
|
|
233
|
+
* Accessible text for the SiteHeader brand logo link.
|
|
234
|
+
*/
|
|
235
|
+
logoLabel?: string;
|
|
236
|
+
/**
|
|
237
|
+
* Search component for the SiteHeader.
|
|
238
|
+
*/
|
|
239
|
+
search?: ReactNode;
|
|
240
|
+
/**
|
|
241
|
+
* Optional sub-brand variant. Only applies to BT.
|
|
242
|
+
*/
|
|
243
|
+
subBrand?: typeof subBrands[number];
|
|
244
|
+
}
|
|
245
|
+
declare const SiteHeaderRehydrator: {
|
|
246
|
+
(el: HTMLDivElement, hydrate: any): Promise<JSX.Element>;
|
|
247
|
+
ItemGroupRehydrator: (el: HTMLLIElement, hydrate: any) => Promise<JSX.Element>;
|
|
248
|
+
NavItemRehydrator: (el: HTMLLIElement, hydrate: any) => Promise<JSX.Element>;
|
|
249
|
+
NavItemWithSubNavRehydrator: (el: HTMLLIElement, hydrate: any) => Promise<JSX.Element>;
|
|
250
|
+
SubNavItemRehydrator: (el: HTMLDivElement, hydrate: any) => Promise<JSX.Element>;
|
|
251
|
+
};
|
|
252
|
+
export { SiteHeader, SiteHeaderRehydrator };
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { _ as __rest, a as __assign, f as filterDataAttrs, d as __awaiter, e as __generator } from '../_shared/index-
|
|
2
|
-
import { a as ArcBreakpointL } from '../_shared/index.es-
|
|
3
|
-
import { c as classNames } from '../_shared/index-
|
|
1
|
+
import { _ as __rest, a as __assign, f as filterDataAttrs, d as __awaiter, e as __generator } from '../_shared/esm/index-229fc864.js';
|
|
2
|
+
import { u as useMediaQuery, a as ArcBreakpointL } from '../_shared/esm/index.es-00cb3bcb.js';
|
|
3
|
+
import { c as classNames } from '../_shared/esm/index-2ae58626.js';
|
|
4
4
|
import React, { useState, useEffect, Fragment, useContext, useRef, createContext } from 'react';
|
|
5
|
-
import { B as BrandLogo } from '../_shared/BrandLogo-
|
|
6
|
-
import { B as Button } from '../_shared/Button-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { h as handleLinkClick } from '../_shared/handle-link-click-
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import '../_shared/
|
|
5
|
+
import { B as BrandLogo } from '../_shared/esm/BrandLogo-ea3dd0e6.js';
|
|
6
|
+
import { B as Button } from '../_shared/esm/Button-5ff56a7b.js';
|
|
7
|
+
import { S as Surface } from '../_shared/esm/Surface-d515d212.js';
|
|
8
|
+
import { B as BtIconChevronDown2Px_2 } from '../_shared/esm/BtIconChevronDown2Px-4abd079b.js';
|
|
9
|
+
import { h as handleLinkClick } from '../_shared/esm/handle-link-click-f64f55a2.js';
|
|
10
|
+
import { a as BtIconChevronRight2Px_2, B as BtIconChevronLeft2Px_2 } from '../_shared/esm/BtIconChevronRight2Px-a5cc1d05.js';
|
|
11
|
+
import { s as suffixModifier } from '../_shared/esm/suffix-modifier-f5e28822.js';
|
|
12
|
+
import { T as Text } from '../_shared/esm/Text-d8988620.js';
|
|
13
|
+
import '../_shared/esm/BtIconChevronRightMid-386cf272.js';
|
|
14
|
+
import '../_shared/esm/Icon-76d0d8c0.js';
|
|
13
15
|
|
|
14
16
|
var Item = function (_a) {
|
|
15
17
|
var _b;
|
|
@@ -18,7 +20,10 @@ var Item = function (_a) {
|
|
|
18
20
|
_b["arc-SiteHeaderItem"] = true,
|
|
19
21
|
_b["arc-SiteHeaderItem--emphasised"] = isEmphasised,
|
|
20
22
|
_b)) }, filterDataAttrs(props)),
|
|
21
|
-
React.createElement("a", { onClick: handleLinkClick({ handler: onClick }), className: "arc-SiteHeaderItem-link", href: href },
|
|
23
|
+
React.createElement("a", { onClick: handleLinkClick({ handler: onClick }), className: "arc-SiteHeaderItem-link", href: href },
|
|
24
|
+
isEmphasised && (React.createElement("span", { className: "arc-SiteHeaderItem-linkIcon" },
|
|
25
|
+
React.createElement(BtIconChevronRight2Px_2, null))),
|
|
26
|
+
children)));
|
|
22
27
|
};
|
|
23
28
|
|
|
24
29
|
var ItemGroup = function (_a) {
|
|
@@ -44,7 +49,10 @@ var ItemGroup = function (_a) {
|
|
|
44
49
|
React.createElement(ElementType, __assign({ className: "arc-SiteHeaderItemGroup-details", open: Boolean(title && isMinWidthArcBreakpointL) }, filterDataAttrs(props)),
|
|
45
50
|
title ? (React.createElement("summary", { className: "arc-SiteHeaderItemGroup-summary", tabIndex: isMinWidthArcBreakpointL ? -1 : 0 }, href ? (React.createElement("a", { onClick: handleLinkClick({
|
|
46
51
|
handler: onClick
|
|
47
|
-
}), className: "arc-SiteHeaderItemGroup-title", href: href, tabIndex: !hasClientSideJavaScript || isMinWidthArcBreakpointL ? 0 : -1 },
|
|
52
|
+
}), className: "arc-SiteHeaderItemGroup-title", href: href, tabIndex: !hasClientSideJavaScript || isMinWidthArcBreakpointL ? 0 : -1 },
|
|
53
|
+
title,
|
|
54
|
+
React.createElement("span", { className: "arc-SiteHeaderItemGroup-titleIcon" },
|
|
55
|
+
React.createElement(BtIconChevronDown2Px_2, null)))) : (React.createElement("div", { className: "arc-SiteHeaderItemGroup-title" }, title)))) : null,
|
|
48
56
|
React.createElement("ul", { className: "arc-SiteHeaderItemGroup-items" },
|
|
49
57
|
children,
|
|
50
58
|
href && title ? (React.createElement("li", { className: "arc-SiteHeaderItem arc-SiteHeaderItem--viewAll" },
|
|
@@ -101,6 +109,8 @@ var BackButton = function (_a) {
|
|
|
101
109
|
return (React.createElement("button", { className: "arc-SiteHeaderBackButton", onClick: function () {
|
|
102
110
|
setOpen(false);
|
|
103
111
|
} },
|
|
112
|
+
React.createElement("span", { className: "arc-SiteHeaderBackButton-icon" },
|
|
113
|
+
React.createElement(BtIconChevronLeft2Px_2, null)),
|
|
104
114
|
React.createElement("span", { className: "arc-SiteHeaderBackButton-text" }, "Back")));
|
|
105
115
|
};
|
|
106
116
|
|
|
@@ -181,7 +191,10 @@ var Panel = function (_a) {
|
|
|
181
191
|
};
|
|
182
192
|
var ViewAll = function (_a) {
|
|
183
193
|
var href = _a.href, title = _a.title, onClick = _a.onClick;
|
|
184
|
-
return (React.createElement("a", { onClick: handleLinkClick({ handler: onClick }), className: "arc-SiteHeaderPanel-viewAll", href: href },
|
|
194
|
+
return (React.createElement("a", { onClick: handleLinkClick({ handler: onClick }), className: "arc-SiteHeaderPanel-viewAll", href: href },
|
|
195
|
+
title,
|
|
196
|
+
React.createElement("span", { className: "arc-SiteHeaderPanel-viewAllIcon" },
|
|
197
|
+
React.createElement(BtIconChevronRight2Px_2, null))));
|
|
185
198
|
};
|
|
186
199
|
ViewAll.displayName = "Panel.ViewAll";
|
|
187
200
|
Panel.ViewAll = ViewAll;
|
|
@@ -191,6 +204,7 @@ var NavItem = function (_a) {
|
|
|
191
204
|
var children = _a.children, href = _a.href, isCurrent = _a.isCurrent, onClick = _a.onClick, promo = _a.promo, title = _a.title, viewAllTitle = _a.viewAllTitle, props = __rest(_a, ["children", "href", "isCurrent", "onClick", "promo", "title", "viewAllTitle"]);
|
|
192
205
|
var navItem = useRef();
|
|
193
206
|
var _d = useState(false), panelOpen = _d[0], setPanelOpen = _d[1];
|
|
207
|
+
var isMinWidthArcBreakpointL = useMediaQuery("(min-width: ".concat(ArcBreakpointL, "px)"));
|
|
194
208
|
useEffect(function () {
|
|
195
209
|
React.Children.map(children, function (item) {
|
|
196
210
|
if (item &&
|
|
@@ -213,7 +227,9 @@ var NavItem = function (_a) {
|
|
|
213
227
|
_c)), onClick: function (e) {
|
|
214
228
|
e.preventDefault();
|
|
215
229
|
setPanelOpen(!panelOpen);
|
|
216
|
-
} },
|
|
230
|
+
} },
|
|
231
|
+
React.createElement("span", null, title),
|
|
232
|
+
React.createElement("span", { className: "arc-SiteHeaderNavItem-linkIcon" }, isMinWidthArcBreakpointL ? (React.createElement(BtIconChevronDown2Px_2, null)) : (React.createElement(BtIconChevronRight2Px_2, null)))),
|
|
217
233
|
React.createElement(Panel, { navItemRef: navItem, open: panelOpen, promo: promo, setOpen: setPanelOpen, viewAll: href ? (React.createElement(Panel.ViewAll, { href: href, onClick: onClick, title: viewAllTitle || "View all ".concat(title.toLowerCase()) })) : (undefined) }, children)))));
|
|
218
234
|
};
|
|
219
235
|
|
|
@@ -297,7 +313,10 @@ var SubNavItem = function (_a) {
|
|
|
297
313
|
_c["arc-SiteHeaderSubNavItem-link--itemHasChildren"] = children,
|
|
298
314
|
_c)), onClick: function () {
|
|
299
315
|
setPanelOpen(true);
|
|
300
|
-
} },
|
|
316
|
+
} },
|
|
317
|
+
linkTitle,
|
|
318
|
+
children && (React.createElement("span", { className: "arc-SiteHeaderSubNavItem-linkIcon" },
|
|
319
|
+
React.createElement(BtIconChevronRight2Px_2, null)))),
|
|
301
320
|
React.createElement(Panel, { navItemRef: navItem, open: panelOpen, setOpen: setPanelOpen, subNavItemRef: subNavItem, subNavLink: "arc-SiteHeaderSubNavItem-link", promo: promo, title: React.createElement("span", null,
|
|
302
321
|
title,
|
|
303
322
|
subTitle && (React.createElement(Text, { size: "xs", tone: "supporting" }, subTitle))), viewAll: href ? (React.createElement(Panel.ViewAll, { href: href, onClick: onClick, title: viewAllTitle || "View all ".concat(title.toLowerCase()) })) : (undefined) }, children)))));
|
|
@@ -368,6 +387,7 @@ var NavItemWithSubNav = function (_a) {
|
|
|
368
387
|
var navItem = useRef();
|
|
369
388
|
var _e = useState(true), defaultItem = _e[0], setDefaultItem = _e[1];
|
|
370
389
|
var _f = useState(false), panelOpen = _f[0], setPanelOpen = _f[1];
|
|
390
|
+
var isMinWidthArcBreakpointL = useMediaQuery("(min-width: ".concat(ArcBreakpointL, "px)"));
|
|
371
391
|
useEffect(function () {
|
|
372
392
|
React.Children.map(slot1, function (item) {
|
|
373
393
|
if (item && item.type !== SubNavItem && item.type !== Fragment) {
|
|
@@ -405,7 +425,9 @@ var NavItemWithSubNav = function (_a) {
|
|
|
405
425
|
_c)), onClick: function (e) {
|
|
406
426
|
e.preventDefault();
|
|
407
427
|
setPanelOpen(!panelOpen);
|
|
408
|
-
} },
|
|
428
|
+
} },
|
|
429
|
+
title,
|
|
430
|
+
React.createElement("span", { className: "arc-SiteHeaderNavItem-linkIcon" }, isMinWidthArcBreakpointL ? (React.createElement(BtIconChevronDown2Px_2, null)) : (React.createElement(BtIconChevronRight2Px_2, null)))),
|
|
409
431
|
React.createElement(Panel, { navItemRef: navItem, open: panelOpen, setOpen: setPanelOpen, title: subTitle, viewAll: href ? (React.createElement(Panel.ViewAll, { href: href, onClick: onViewAllClick, title: viewAllTitle || "View all ".concat(title.toLowerCase()) })) : (undefined), withSubNav: true },
|
|
410
432
|
defaultItem
|
|
411
433
|
? React.cloneElement(slot1, { isDefaultItem: defaultItem })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Surface, SurfaceContext, backgrounds, backgroundsBT } from "../_shared/Surface-
|
|
1
|
+
export { Surface, SurfaceContext, backgrounds, backgroundsBT } from "../_shared/cjs/Surface-d6b8010e";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var Surface = require('../_shared/cjs/Surface-d6b8010e.js');
|
|
6
|
+
require('../_shared/cjs/index-78b35bc1.js');
|
|
7
|
+
require('../_shared/cjs/index-45bfb67b.js');
|
|
8
|
+
require('react');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.Surface = Surface.Surface;
|
|
13
|
+
exports.SurfaceContext = Surface.Context;
|
|
14
|
+
exports.backgrounds = Surface.backgrounds;
|
|
15
|
+
exports.backgroundsBT = Surface.backgroundsBT;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Surface, SurfaceContext, backgrounds, backgroundsBT } from "../_shared/esm/Surface-d515d212";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Text } from "../_shared/cjs/Text-1d3844be";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var Text = require('../_shared/cjs/Text-1d3844be.js');
|
|
6
|
+
require('../_shared/cjs/index-78b35bc1.js');
|
|
7
|
+
require('../_shared/cjs/index-45bfb67b.js');
|
|
8
|
+
require('react');
|
|
9
|
+
require('../_shared/cjs/suffix-modifier-edf7851e.js');
|
|
10
|
+
require('../_shared/cjs/Surface-d6b8010e.js');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.Text = Text.Text;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Text } from "../_shared/esm/Text-d8988620";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { T as Text } from '../_shared/esm/Text-d8988620.js';
|
|
2
|
+
import '../_shared/esm/index-229fc864.js';
|
|
3
|
+
import '../_shared/esm/index-2ae58626.js';
|
|
4
|
+
import 'react';
|
|
5
|
+
import '../_shared/esm/suffix-modifier-f5e28822.js';
|
|
6
|
+
import '../_shared/esm/Surface-d515d212.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { FC } from "react";
|
|
4
|
-
import { FormControlProps } from "../_shared/FormControl-
|
|
4
|
+
import { FormControlProps } from "../_shared/cjs/FormControl-a1b7421b";
|
|
5
5
|
type EventType = React.ChangeEvent<HTMLInputElement>;
|
|
6
6
|
/**
|
|
7
7
|
* Use `TextInput` to allow custom user text entry with a keyboard.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var index = require('../_shared/cjs/index-78b35bc1.js');
|
|
6
|
+
var index$1 = require('../_shared/cjs/index-45bfb67b.js');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var FormControl = require('../_shared/cjs/FormControl-a1b7421b.js');
|
|
9
|
+
var Surface = require('../_shared/cjs/Surface-d6b8010e.js');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
+
|
|
13
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Infer the correct inputMode, pattern and type if specifying a `number` type.
|
|
17
|
+
*/
|
|
18
|
+
var useNumericInput = function (props) {
|
|
19
|
+
var type = props.type === "number" ? "text" : props.type;
|
|
20
|
+
var inputMode = props.inputMode;
|
|
21
|
+
if (!props.inputMode) {
|
|
22
|
+
if (props.type === "email") {
|
|
23
|
+
inputMode = "email";
|
|
24
|
+
}
|
|
25
|
+
else if (props.type === "number") {
|
|
26
|
+
inputMode = "numeric";
|
|
27
|
+
}
|
|
28
|
+
else if (props.type === "tel") {
|
|
29
|
+
inputMode = "tel";
|
|
30
|
+
}
|
|
31
|
+
else if (props.type === "url") {
|
|
32
|
+
inputMode = "url";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
var pattern = props.pattern;
|
|
36
|
+
if (!props.pattern && props.type === "number") {
|
|
37
|
+
pattern = "[0-9]*";
|
|
38
|
+
}
|
|
39
|
+
return { inputMode: inputMode, pattern: pattern, type: type };
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Use `TextInput` to allow custom user text entry with a keyboard.
|
|
44
|
+
*/
|
|
45
|
+
var TextInput = React.forwardRef(function (_a, ref) {
|
|
46
|
+
var _b = _a.defaultValue, defaultValue = _b === void 0 ? "" : _b, errorMessage = _a.errorMessage, helper = _a.helper, id = _a.id, inputMode = _a.inputMode, _c = _a.isDisabled, isDisabled = _c === void 0 ? false : _c, _d = _a.isReadOnly, isReadOnly = _d === void 0 ? false : _d, _e = _a.isRequired, isRequired = _e === void 0 ? false : _e, label = _a.label, _f = _a.labelSize, labelSize = _f === void 0 ? "l" : _f, maxLength = _a.maxLength, minLength = _a.minLength, name = _a.name, onBlur = _a.onBlur, onChange = _a.onChange, pattern = _a.pattern, _g = _a.type, type = _g === void 0 ? "text" : _g, value = _a.value, props = index.__rest(_a, ["defaultValue", "errorMessage", "helper", "id", "inputMode", "isDisabled", "isReadOnly", "isRequired", "label", "labelSize", "maxLength", "minLength", "name", "onBlur", "onChange", "pattern", "type", "value"]);
|
|
47
|
+
var surface = React.useContext(Surface.Context).surface;
|
|
48
|
+
var inferredInputProps = useNumericInput({ inputMode: inputMode, pattern: pattern, type: type });
|
|
49
|
+
// Although this is used within FormControlWrapper, it's deterministic so we can call it here too
|
|
50
|
+
var ariaDescribedby = FormControl.useAriaDescribedby({
|
|
51
|
+
errorMessage: errorMessage,
|
|
52
|
+
id: id,
|
|
53
|
+
helper: helper
|
|
54
|
+
}).ariaDescribedby;
|
|
55
|
+
return (React__default["default"].createElement("div", index.__assign({ className: index$1.classNames({
|
|
56
|
+
"arc-TextInput": true,
|
|
57
|
+
"arc-TextInput--invalid": errorMessage,
|
|
58
|
+
"arc-TextInput--onDarkSurface": surface === "dark"
|
|
59
|
+
}) }, index.filterDataAttrs(props)),
|
|
60
|
+
React__default["default"].createElement(FormControl.FormControl, { errorMessage: errorMessage, helper: helper, htmlFor: id, label: label, labelSize: labelSize, requirementStatus: isRequired ? "required" : "optional" },
|
|
61
|
+
React__default["default"].createElement("input", index.__assign({ "aria-describedby": ariaDescribedby, "aria-invalid": errorMessage ? "true" : "false", className: "arc-TextInput-input", defaultValue: typeof value !== "undefined" ? undefined : defaultValue, disabled: isDisabled, id: id, maxLength: maxLength, minLength: minLength, name: name, onChange: onChange, onBlur: onBlur, readOnly: isReadOnly, ref: ref, required: isRequired, value: typeof value !== "undefined" ? value : undefined }, inferredInputProps)))));
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
exports.TextInput = TextInput;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { FC } from "react";
|
|
4
|
+
import { FormControlProps } from "../_shared/esm/FormControl-feedc495";
|
|
5
|
+
type EventType = React.ChangeEvent<HTMLInputElement>;
|
|
6
|
+
/**
|
|
7
|
+
* Use `TextInput` to allow custom user text entry with a keyboard.
|
|
8
|
+
*/
|
|
9
|
+
declare const TextInput: FC<TextInputProps>;
|
|
10
|
+
interface TextInputProps extends Omit<FormControlProps, "children" | "elementType" | "htmlFor" | "requirementStatus"> {
|
|
11
|
+
/**
|
|
12
|
+
* Uncontrolled default value of the TextInput. If the TextInput is controlled
|
|
13
|
+
* via `value`/`onChange`, `defaultValue` will be ignored.
|
|
14
|
+
*/
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
/**
|
|
17
|
+
* ID for the TextInput.
|
|
18
|
+
*/
|
|
19
|
+
id: string;
|
|
20
|
+
/**
|
|
21
|
+
* Mode for the input. If not defined, inferred by type.
|
|
22
|
+
*/
|
|
23
|
+
inputMode?: "email" | "numeric" | "tel" | "url";
|
|
24
|
+
/**
|
|
25
|
+
* Should the control be disabled?
|
|
26
|
+
*/
|
|
27
|
+
isDisabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Should the control be read-only?
|
|
30
|
+
*/
|
|
31
|
+
isReadOnly?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Should the control be required?
|
|
34
|
+
*/
|
|
35
|
+
isRequired?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Maximum number of characters.
|
|
38
|
+
*/
|
|
39
|
+
maxLength?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Minimum number of characters.
|
|
42
|
+
*/
|
|
43
|
+
minLength?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Name of the input.
|
|
46
|
+
*/
|
|
47
|
+
name?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Function to call when the TextInput loses focus.
|
|
50
|
+
*/
|
|
51
|
+
onBlur?: (e: EventType) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Callback function commonly used to update the TextInput's controlled
|
|
54
|
+
* `value`, for example `e => setValue(e.target.value)`.
|
|
55
|
+
*/
|
|
56
|
+
onChange?: (e: EventType) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Validation regex pattern.
|
|
59
|
+
*/
|
|
60
|
+
pattern?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Type for the input. `number` will be changed to `text` and set the `numeric` inputMode.
|
|
63
|
+
*/
|
|
64
|
+
type?: "email" | "number" | "password" | "tel" | "text" | "url";
|
|
65
|
+
/**
|
|
66
|
+
* Current value of the TextInput. Must be controlled via an
|
|
67
|
+
* `onChange` callback function. Otherwise, use `defaultValue` (or `isReadOnly`).
|
|
68
|
+
*/
|
|
69
|
+
value?: string;
|
|
70
|
+
}
|
|
71
|
+
export { TextInput };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { _ as __rest, a as __assign, f as filterDataAttrs } from '../_shared/index-
|
|
2
|
-
import { c as classNames } from '../_shared/index-
|
|
1
|
+
import { _ as __rest, a as __assign, f as filterDataAttrs } from '../_shared/esm/index-229fc864.js';
|
|
2
|
+
import { c as classNames } from '../_shared/esm/index-2ae58626.js';
|
|
3
3
|
import React, { forwardRef, useContext } from 'react';
|
|
4
|
-
import { u as useAriaDescribedby, F as FormControl } from '../_shared/FormControl-
|
|
5
|
-
import { C as Context } from '../_shared/Surface-
|
|
4
|
+
import { u as useAriaDescribedby, F as FormControl } from '../_shared/esm/FormControl-feedc495.js';
|
|
5
|
+
import { C as Context } from '../_shared/esm/Surface-d515d212.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Infer the correct inputMode, pattern and type if specifying a `number` type.
|
|
File without changes
|