@sanity-labs/ui-poc 0.0.1-alpha.12 → 0.0.1-alpha.13
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/index.d.ts +113 -21
- package/dist/index.js +256 -41
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
- package/src/components/box/box.css +3 -4
- package/src/components/card/Card.tsx +1 -1
- package/src/components/card/card.css +2 -5
- package/src/components/card/card.props.ts +9 -0
- package/src/components/checkbox/Checkbox.tsx +1 -1
- package/src/components/checkbox/checkbox.css +9 -5
- package/src/components/code/code.css +5 -1
- package/src/components/container/container.css +3 -3
- package/src/components/flex/flex.css +3 -4
- package/src/components/grid/grid.css +3 -4
- package/src/components/h-stack/HStack.tsx +29 -0
- package/src/components/h-stack/hStack.props.ts +15 -0
- package/src/components/heading/heading.css +4 -4
- package/src/components/icon/icon.css +4 -4
- package/src/components/index.css +3 -0
- package/src/components/inline/Inline.tsx +35 -0
- package/src/components/inline/inline.css +4 -0
- package/src/components/inline/inline.props.ts +96 -0
- package/src/components/link/Link.tsx +24 -0
- package/src/components/link/link.css +12 -0
- package/src/components/link/link.props.ts +23 -0
- package/src/components/radio/Radio.tsx +1 -1
- package/src/components/radio/radio.css +4 -3
- package/src/components/skip-to-content/SkipToContent.tsx +30 -0
- package/src/components/skip-to-content/skip-to-content.css +9 -0
- package/src/components/skip-to-content/skipToContent.props.ts +24 -0
- package/src/components/switch/Switch.tsx +1 -1
- package/src/components/switch/switch.css +14 -7
- package/src/components/text/text.css +4 -4
- package/src/components/v-stack/VStack.tsx +27 -0
- package/src/components/v-stack/vStack.props.ts +15 -0
- package/src/components/visually-hidden/visually-hidden.css +1 -1
- package/src/components/visually-hidden/visuallyHidden.props.ts +6 -0
- package/src/css/classes/local/border.css +14 -10
- package/src/css/classes/local/tone.css +68 -33
- package/src/css/classes/system/gap.css +3 -0
- package/src/css/classes/system/margin.css +63 -0
- package/src/css/tokens/index.css +1 -2
- package/src/css/tokens/opacity.css +6 -0
- package/src/index.ts +5 -0
- package/src/props/flexParent.ts +1 -1
- package/src/props/gap.ts +7 -7
- package/src/props/margin.ts +15 -15
- package/src/types/Space.ts +6 -0
- package/src/types/Tone.ts +1 -9
- package/src/utils/getProps.test.ts +4 -2
- package/src/utils/getProps.ts +7 -1
- package/src/css/tokens/border.css +0 -3
- package/src/css/tokens/tone.css +0 -30
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {ComponentProps} from 'react'
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import {ComponentPropsWithRef} from 'react'
|
|
3
|
+
import {ElementType} from 'react'
|
|
4
4
|
import {JSX} from 'react/jsx-runtime'
|
|
5
5
|
import type {SVGProps} from 'react'
|
|
6
6
|
|
|
@@ -177,11 +177,11 @@ declare type FontWeight = (typeof FONT_WEIGHT)[number]
|
|
|
177
177
|
|
|
178
178
|
declare type GapProps = {
|
|
179
179
|
/** CSS **gap** property */
|
|
180
|
-
gap?: Responsive<
|
|
180
|
+
gap?: Responsive<SpaceInherit>
|
|
181
181
|
/** CSS **row-gap** property */
|
|
182
|
-
rowGap?: Responsive<
|
|
182
|
+
rowGap?: Responsive<SpaceInherit>
|
|
183
183
|
/** CSS **column-gap** property */
|
|
184
|
-
columnGap?: Responsive<
|
|
184
|
+
columnGap?: Responsive<SpaceInherit>
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
/** @public */
|
|
@@ -263,6 +263,17 @@ declare type HeightProps = {
|
|
|
263
263
|
maxHeight?: Responsive<string>
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
+
/** @public */
|
|
267
|
+
export declare function HStack<T extends ElementType = 'div'>(
|
|
268
|
+
props: HStackProps<T> & Omit<ComponentPropsWithRef<T>, keyof HStackProps<T>>,
|
|
269
|
+
): JSX.Element
|
|
270
|
+
|
|
271
|
+
/** @public */
|
|
272
|
+
declare interface HStackProps<T extends React.ElementType> extends Pick<GapProps, 'gap'> {
|
|
273
|
+
/** Element to render */
|
|
274
|
+
as?: T
|
|
275
|
+
}
|
|
276
|
+
|
|
266
277
|
/** @public */
|
|
267
278
|
export declare function Icon({icon: Component, size, ...props}: IconProps): JSX.Element
|
|
268
279
|
|
|
@@ -280,6 +291,21 @@ declare interface IconProps extends ComponentProps<'svg'>, MarginProps, ToneProp
|
|
|
280
291
|
|
|
281
292
|
declare type IconSize = (typeof ICON_SIZE)[number]
|
|
282
293
|
|
|
294
|
+
/** @deprecated Use HStack component instead */
|
|
295
|
+
/** @public */
|
|
296
|
+
export declare function Inline<T extends ElementType = 'div'>(
|
|
297
|
+
props: InlineProps<T> & Omit<ComponentPropsWithRef<T>, keyof InlineProps<T>>,
|
|
298
|
+
): JSX.Element
|
|
299
|
+
|
|
300
|
+
/** @deprecated Use HStack component instead */
|
|
301
|
+
/** @public */
|
|
302
|
+
declare interface InlineProps<T extends React.ElementType> extends PaddingProps {
|
|
303
|
+
/** Element to render */
|
|
304
|
+
as?: T
|
|
305
|
+
/** CSS **gap** property */
|
|
306
|
+
gap?: Responsive<SpaceInherit>
|
|
307
|
+
}
|
|
308
|
+
|
|
283
309
|
declare const JUSTIFY_CONTENT: readonly [
|
|
284
310
|
'flex-start',
|
|
285
311
|
'flex-end',
|
|
@@ -315,21 +341,36 @@ declare interface LayoutProps
|
|
|
315
341
|
ZIndexProps,
|
|
316
342
|
ShadowProps {}
|
|
317
343
|
|
|
344
|
+
/** @beta */
|
|
345
|
+
export declare function Link({underlined, ...props}: LinkProps): JSX.Element
|
|
346
|
+
|
|
347
|
+
/** @beta */
|
|
348
|
+
declare interface LinkProps extends React.ComponentProps<'a'> {
|
|
349
|
+
/** If true, sets `target="_blank"` and `rel="noopener noreferrer"` */
|
|
350
|
+
openInNewTab?: boolean
|
|
351
|
+
/**
|
|
352
|
+
* If true, sets `text-decoration: underline`
|
|
353
|
+
*
|
|
354
|
+
* @defaultValue true
|
|
355
|
+
*/
|
|
356
|
+
underlined?: boolean
|
|
357
|
+
}
|
|
358
|
+
|
|
318
359
|
declare type MarginProps = {
|
|
319
360
|
/** CSS **margin** property */
|
|
320
|
-
margin?: Responsive<
|
|
361
|
+
margin?: Responsive<SpaceAutoNegative>
|
|
321
362
|
/** CSS **margin-left** and **margin-right** properties */
|
|
322
|
-
marginX?: Responsive<
|
|
363
|
+
marginX?: Responsive<SpaceAutoNegative>
|
|
323
364
|
/** CSS **margin-top** and **margin-bottom** properties */
|
|
324
|
-
marginY?: Responsive<
|
|
365
|
+
marginY?: Responsive<SpaceAutoNegative>
|
|
325
366
|
/** CSS **margin-top** property */
|
|
326
|
-
marginTop?: Responsive<
|
|
367
|
+
marginTop?: Responsive<SpaceAutoNegative>
|
|
327
368
|
/** CSS **margin-right** property */
|
|
328
|
-
marginRight?: Responsive<
|
|
369
|
+
marginRight?: Responsive<SpaceAutoNegative>
|
|
329
370
|
/** CSS **margin-bottom** property */
|
|
330
|
-
marginBottom?: Responsive<
|
|
371
|
+
marginBottom?: Responsive<SpaceAutoNegative>
|
|
331
372
|
/** CSS **margin-left** property */
|
|
332
|
-
marginLeft?: Responsive<
|
|
373
|
+
marginLeft?: Responsive<SpaceAutoNegative>
|
|
333
374
|
}
|
|
334
375
|
|
|
335
376
|
declare const OVERFLOW: readonly ['visible', 'hidden', 'auto', 'scroll', 'clip']
|
|
@@ -421,14 +462,60 @@ declare type ShadowProps = {
|
|
|
421
462
|
shadow?: string
|
|
422
463
|
}
|
|
423
464
|
|
|
465
|
+
/** @beta */
|
|
466
|
+
export declare function SkipToContent(props: SkipToContentProps): JSX.Element
|
|
467
|
+
|
|
468
|
+
/** @beta */
|
|
469
|
+
declare interface SkipToContentProps extends React.ComponentProps<'a'> {
|
|
470
|
+
/**
|
|
471
|
+
* Anchor hash. The target element should be focusable or have `tabindex="-1"` applied.
|
|
472
|
+
*/
|
|
473
|
+
hash: string
|
|
474
|
+
/** Use href instead */
|
|
475
|
+
href?: never
|
|
476
|
+
/** Visible/announced label */
|
|
477
|
+
label: string
|
|
478
|
+
/** Use label instead */
|
|
479
|
+
children?: never
|
|
480
|
+
}
|
|
481
|
+
|
|
424
482
|
declare const SPACE: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
425
483
|
|
|
426
484
|
declare type Space = (typeof SPACE)[number]
|
|
427
485
|
|
|
428
486
|
declare const SPACE_AUTO: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'auto']
|
|
429
487
|
|
|
488
|
+
declare const SPACE_AUTO_NEGATIVE: readonly [
|
|
489
|
+
-9,
|
|
490
|
+
-8,
|
|
491
|
+
-7,
|
|
492
|
+
-6,
|
|
493
|
+
-5,
|
|
494
|
+
-4,
|
|
495
|
+
-3,
|
|
496
|
+
-2,
|
|
497
|
+
-1,
|
|
498
|
+
0,
|
|
499
|
+
1,
|
|
500
|
+
2,
|
|
501
|
+
3,
|
|
502
|
+
4,
|
|
503
|
+
5,
|
|
504
|
+
6,
|
|
505
|
+
7,
|
|
506
|
+
8,
|
|
507
|
+
9,
|
|
508
|
+
'auto',
|
|
509
|
+
]
|
|
510
|
+
|
|
511
|
+
declare const SPACE_INHERIT: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'inherit']
|
|
512
|
+
|
|
430
513
|
declare type SpaceAuto = (typeof SPACE_AUTO)[number]
|
|
431
514
|
|
|
515
|
+
declare type SpaceAutoNegative = (typeof SPACE_AUTO_NEGATIVE)[number]
|
|
516
|
+
|
|
517
|
+
declare type SpaceInherit = (typeof SPACE_INHERIT)[number]
|
|
518
|
+
|
|
432
519
|
/** @beta */
|
|
433
520
|
export declare function Switch(props: SwitchProps): JSX.Element
|
|
434
521
|
|
|
@@ -463,15 +550,7 @@ declare interface TextProps<T extends React.ElementType> extends TypographyProps
|
|
|
463
550
|
|
|
464
551
|
declare type TextSize = (typeof TEXT_SIZE)[number]
|
|
465
552
|
|
|
466
|
-
declare const TONE: readonly [
|
|
467
|
-
'none',
|
|
468
|
-
'neutral',
|
|
469
|
-
'primary',
|
|
470
|
-
'positive',
|
|
471
|
-
'suggest',
|
|
472
|
-
'caution',
|
|
473
|
-
'critical',
|
|
474
|
-
]
|
|
553
|
+
declare const TONE: readonly ['neutral', 'positive', 'suggest', 'caution', 'critical']
|
|
475
554
|
|
|
476
555
|
declare type Tone = (typeof TONE)[number]
|
|
477
556
|
|
|
@@ -502,6 +581,19 @@ export declare function VisuallyHidden<T extends ElementType = 'span'>(
|
|
|
502
581
|
declare interface VisuallyHiddenProps<T extends React.ElementType> {
|
|
503
582
|
/** Element to render */
|
|
504
583
|
as?: T
|
|
584
|
+
/** If true, element is visible on :focus-visible */
|
|
585
|
+
visibleOnFocus?: boolean
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/** @public */
|
|
589
|
+
export declare function VStack<T extends ElementType = 'div'>(
|
|
590
|
+
props: VStackProps<T> & Omit<ComponentPropsWithRef<T>, keyof VStackProps<T>>,
|
|
591
|
+
): JSX.Element
|
|
592
|
+
|
|
593
|
+
/** @public */
|
|
594
|
+
declare interface VStackProps<T extends React.ElementType> extends Pick<GapProps, 'gap'> {
|
|
595
|
+
/** Element to render */
|
|
596
|
+
as?: T
|
|
505
597
|
}
|
|
506
598
|
|
|
507
599
|
declare type WidthProps = {
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { RemoveIcon, CheckmarkIcon } from "@sanity/icons";
|
|
4
|
-
import { useRef, useEffect, lazy, Suspense } from "react";
|
|
4
|
+
import { useRef, useEffect, lazy, Suspense, useMemo, Children } from "react";
|
|
5
5
|
const PREFIX = "sui", BREAKPOINTS_LENGTH = 6;
|
|
6
6
|
function getProps(componentProps, propDefs) {
|
|
7
7
|
const { allComponentProps, allPropDefs } = flattenCompositeProps(componentProps, propDefs), restProps = {};
|
|
@@ -21,7 +21,17 @@ function getProps(componentProps, propDefs) {
|
|
|
21
21
|
return { ...restProps, className, style };
|
|
22
22
|
}
|
|
23
23
|
function getClassName(propValue, propDef, bp) {
|
|
24
|
-
|
|
24
|
+
if (propDef.type === "union" && propDef.values?.includes(propValue))
|
|
25
|
+
return `${PREFIX}-${propDef.className}${typeof propValue == "string" ? `-${propValue}` : propValue}${bp ? `-bp-${bp}` : ""}`;
|
|
26
|
+
if (propDef.type === "string" || propDef.type === "number")
|
|
27
|
+
return `${PREFIX}-${propDef.className}${bp ? `-bp-${bp}` : ""}`;
|
|
28
|
+
if (propDef.type === "boolean") {
|
|
29
|
+
if (propValue)
|
|
30
|
+
return `${PREFIX}-${propDef.className}${bp ? `-bp-${bp}` : ""}`;
|
|
31
|
+
if (!propValue && propDef.inverseClassName)
|
|
32
|
+
return `${PREFIX}-${propDef.inverseClassName}${bp ? `-bp-${bp}` : ""}`;
|
|
33
|
+
}
|
|
34
|
+
return "";
|
|
25
35
|
}
|
|
26
36
|
function getStyle(propValue, propDef, bp) {
|
|
27
37
|
return propDef.type === "string" || propDef.type === "number" ? {
|
|
@@ -150,41 +160,41 @@ const RADIUS = [0, 1, 2, 3, 4, 5, 6, "full"], borderProps = {
|
|
|
150
160
|
className: "max-height",
|
|
151
161
|
variable: "--max-height"
|
|
152
162
|
}
|
|
153
|
-
}, SPACE = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], SPACE_AUTO = [...SPACE, "auto"], marginProps = {
|
|
163
|
+
}, SPACE = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], SPACE_AUTO = [...SPACE, "auto"], SPACE_INHERIT = [...SPACE, "inherit"], SPACE_AUTO_NEGATIVE = [-9, -8, -7, -6, -5, -4, -3, -2, -1, ...SPACE, "auto"], marginProps = {
|
|
154
164
|
margin: {
|
|
155
165
|
type: "union",
|
|
156
166
|
className: "m",
|
|
157
|
-
values:
|
|
167
|
+
values: SPACE_AUTO_NEGATIVE
|
|
158
168
|
},
|
|
159
169
|
marginX: {
|
|
160
170
|
type: "union",
|
|
161
171
|
className: "mx",
|
|
162
|
-
values:
|
|
172
|
+
values: SPACE_AUTO_NEGATIVE
|
|
163
173
|
},
|
|
164
174
|
marginY: {
|
|
165
175
|
type: "union",
|
|
166
176
|
className: "my",
|
|
167
|
-
values:
|
|
177
|
+
values: SPACE_AUTO_NEGATIVE
|
|
168
178
|
},
|
|
169
179
|
marginTop: {
|
|
170
180
|
type: "union",
|
|
171
181
|
className: "mt",
|
|
172
|
-
values:
|
|
182
|
+
values: SPACE_AUTO_NEGATIVE
|
|
173
183
|
},
|
|
174
184
|
marginRight: {
|
|
175
185
|
type: "union",
|
|
176
186
|
className: "mr",
|
|
177
|
-
values:
|
|
187
|
+
values: SPACE_AUTO_NEGATIVE
|
|
178
188
|
},
|
|
179
189
|
marginBottom: {
|
|
180
190
|
type: "union",
|
|
181
191
|
className: "mb",
|
|
182
|
-
values:
|
|
192
|
+
values: SPACE_AUTO_NEGATIVE
|
|
183
193
|
},
|
|
184
194
|
marginLeft: {
|
|
185
195
|
type: "union",
|
|
186
196
|
className: "ml",
|
|
187
|
-
values:
|
|
197
|
+
values: SPACE_AUTO_NEGATIVE
|
|
188
198
|
}
|
|
189
199
|
}, OVERFLOW = ["visible", "hidden", "auto", "scroll", "clip"], overflowProps = {
|
|
190
200
|
overflow: {
|
|
@@ -275,15 +285,7 @@ const RADIUS = [0, 1, 2, 3, 4, 5, 6, "full"], borderProps = {
|
|
|
275
285
|
className: "shadow",
|
|
276
286
|
values: SHADOW
|
|
277
287
|
}
|
|
278
|
-
}, TONE = [
|
|
279
|
-
"none",
|
|
280
|
-
"neutral",
|
|
281
|
-
"primary",
|
|
282
|
-
"positive",
|
|
283
|
-
"suggest",
|
|
284
|
-
"caution",
|
|
285
|
-
"critical"
|
|
286
|
-
], toneProps = {
|
|
288
|
+
}, TONE = ["neutral", "positive", "suggest", "caution", "critical"], toneProps = {
|
|
287
289
|
tone: {
|
|
288
290
|
type: "union",
|
|
289
291
|
className: "tone",
|
|
@@ -342,7 +344,23 @@ function Box({
|
|
|
342
344
|
const { as, children, className, style, ...rest } = getProps({ display, ...props }, boxProps);
|
|
343
345
|
return /* @__PURE__ */ jsx(as || "div", { className: classNames("sui-Box", className), style, "data-ui": "Box", ...rest, children });
|
|
344
346
|
}
|
|
345
|
-
const
|
|
347
|
+
const gapProps = {
|
|
348
|
+
gap: {
|
|
349
|
+
type: "union",
|
|
350
|
+
className: "gap",
|
|
351
|
+
values: SPACE_INHERIT
|
|
352
|
+
},
|
|
353
|
+
rowGap: {
|
|
354
|
+
type: "union",
|
|
355
|
+
className: "row-gap",
|
|
356
|
+
values: SPACE_INHERIT
|
|
357
|
+
},
|
|
358
|
+
columnGap: {
|
|
359
|
+
type: "union",
|
|
360
|
+
className: "column-gap",
|
|
361
|
+
values: SPACE_INHERIT
|
|
362
|
+
}
|
|
363
|
+
}, DENSITY = ["compact", "regular", "loose"], cardProps = {
|
|
346
364
|
as: {
|
|
347
365
|
type: "string"
|
|
348
366
|
},
|
|
@@ -350,6 +368,14 @@ const DENSITY = ["compact", "regular", "loose"], cardProps = {
|
|
|
350
368
|
type: "composite",
|
|
351
369
|
values: DENSITY,
|
|
352
370
|
composition: {
|
|
371
|
+
gap: {
|
|
372
|
+
propDef: gapProps.gap,
|
|
373
|
+
mapping: {
|
|
374
|
+
compact: 2,
|
|
375
|
+
regular: 3,
|
|
376
|
+
loose: 4
|
|
377
|
+
}
|
|
378
|
+
},
|
|
353
379
|
padding: {
|
|
354
380
|
propDef: paddingProps.padding,
|
|
355
381
|
mapping: {
|
|
@@ -373,7 +399,7 @@ const DENSITY = ["compact", "regular", "loose"], cardProps = {
|
|
|
373
399
|
};
|
|
374
400
|
function Card({
|
|
375
401
|
density = "regular",
|
|
376
|
-
tone = "
|
|
402
|
+
tone = "neutral",
|
|
377
403
|
...props
|
|
378
404
|
}) {
|
|
379
405
|
const { as, children, className, style, ...rest } = getProps({ density, tone, ...props }, cardProps);
|
|
@@ -471,6 +497,10 @@ function Label(props) {
|
|
|
471
497
|
const visuallyHiddenProps = {
|
|
472
498
|
as: {
|
|
473
499
|
type: "string"
|
|
500
|
+
},
|
|
501
|
+
visibleOnFocus: {
|
|
502
|
+
type: "boolean",
|
|
503
|
+
className: "VisuallyHidden-Visible"
|
|
474
504
|
}
|
|
475
505
|
};
|
|
476
506
|
function VisuallyHidden(props) {
|
|
@@ -521,7 +551,7 @@ function Checkbox(props) {
|
|
|
521
551
|
Box,
|
|
522
552
|
{
|
|
523
553
|
as: "span",
|
|
524
|
-
className: "sui-CheckboxMark",
|
|
554
|
+
className: "sui-CheckboxMark sui-tone-neutral",
|
|
525
555
|
position: "relative",
|
|
526
556
|
radius: 2,
|
|
527
557
|
width: "17px",
|
|
@@ -635,25 +665,9 @@ const ALIGN_ITEMS = ["baseline", "center", "flex-end", "flex-start", "stretch"],
|
|
|
635
665
|
},
|
|
636
666
|
flexWrap: {
|
|
637
667
|
type: "union",
|
|
638
|
-
className: "flex
|
|
668
|
+
className: "flex",
|
|
639
669
|
values: FLEX_WRAP
|
|
640
670
|
}
|
|
641
|
-
}, gapProps = {
|
|
642
|
-
gap: {
|
|
643
|
-
type: "union",
|
|
644
|
-
className: "gap",
|
|
645
|
-
values: SPACE
|
|
646
|
-
},
|
|
647
|
-
rowGap: {
|
|
648
|
-
type: "union",
|
|
649
|
-
className: "row-gap",
|
|
650
|
-
values: SPACE
|
|
651
|
-
},
|
|
652
|
-
columnGap: {
|
|
653
|
-
type: "union",
|
|
654
|
-
className: "column-gap",
|
|
655
|
-
values: SPACE
|
|
656
|
-
}
|
|
657
671
|
}, flexProps = {
|
|
658
672
|
as: {
|
|
659
673
|
type: "string"
|
|
@@ -720,6 +734,29 @@ function Grid({
|
|
|
720
734
|
const { as, children, className, style, ...rest } = getProps({ display, ...props }, gridProps);
|
|
721
735
|
return /* @__PURE__ */ jsx(as || "div", { className: classNames("sui-Grid", className), style, "data-ui": "Grid", ...rest, children });
|
|
722
736
|
}
|
|
737
|
+
const hStackProps = {
|
|
738
|
+
as: {
|
|
739
|
+
type: "string"
|
|
740
|
+
},
|
|
741
|
+
gap: gapProps.gap
|
|
742
|
+
};
|
|
743
|
+
function HStack(props) {
|
|
744
|
+
const { as, children, className, style, ...rest } = getProps(props, hStackProps);
|
|
745
|
+
return /* @__PURE__ */ jsx(
|
|
746
|
+
Flex,
|
|
747
|
+
{
|
|
748
|
+
as: as || "div",
|
|
749
|
+
className: classNames("sui-HStack", className),
|
|
750
|
+
style,
|
|
751
|
+
"data-ui": "HStack",
|
|
752
|
+
display: "inline-flex",
|
|
753
|
+
alignItems: "center",
|
|
754
|
+
flexWrap: "wrap",
|
|
755
|
+
...rest,
|
|
756
|
+
children
|
|
757
|
+
}
|
|
758
|
+
);
|
|
759
|
+
}
|
|
723
760
|
const HEADING_TAG = ["h1", "h2", "h3", "h4", "h5", "h6"], HEADING_SIZE = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], headingProps = {
|
|
724
761
|
as: {
|
|
725
762
|
type: "union",
|
|
@@ -780,6 +817,130 @@ function Icon({ icon: Component, size = 2, ...props }) {
|
|
|
780
817
|
}
|
|
781
818
|
);
|
|
782
819
|
}
|
|
820
|
+
const inlineProps = {
|
|
821
|
+
as: {
|
|
822
|
+
type: "string"
|
|
823
|
+
},
|
|
824
|
+
gap: {
|
|
825
|
+
type: "composite",
|
|
826
|
+
values: SPACE,
|
|
827
|
+
composition: {
|
|
828
|
+
marginTop: {
|
|
829
|
+
propDef: marginProps.marginTop,
|
|
830
|
+
mapping: {
|
|
831
|
+
0: 0,
|
|
832
|
+
1: -1,
|
|
833
|
+
2: -2,
|
|
834
|
+
3: -3,
|
|
835
|
+
4: -4,
|
|
836
|
+
5: -5,
|
|
837
|
+
6: -6,
|
|
838
|
+
7: -7,
|
|
839
|
+
8: -8,
|
|
840
|
+
9: -9
|
|
841
|
+
}
|
|
842
|
+
},
|
|
843
|
+
marginLeft: {
|
|
844
|
+
propDef: marginProps.marginLeft,
|
|
845
|
+
mapping: {
|
|
846
|
+
0: 0,
|
|
847
|
+
1: -1,
|
|
848
|
+
2: -2,
|
|
849
|
+
3: -3,
|
|
850
|
+
4: -4,
|
|
851
|
+
5: -5,
|
|
852
|
+
6: -6,
|
|
853
|
+
7: -7,
|
|
854
|
+
8: -8,
|
|
855
|
+
9: -9
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
},
|
|
860
|
+
...paddingProps
|
|
861
|
+
}, inlineChildrenProps = {
|
|
862
|
+
gap: {
|
|
863
|
+
type: "composite",
|
|
864
|
+
values: SPACE,
|
|
865
|
+
composition: {
|
|
866
|
+
paddingTop: {
|
|
867
|
+
propDef: paddingProps.paddingTop,
|
|
868
|
+
mapping: {
|
|
869
|
+
0: 0,
|
|
870
|
+
1: 1,
|
|
871
|
+
2: 2,
|
|
872
|
+
3: 3,
|
|
873
|
+
4: 4,
|
|
874
|
+
5: 5,
|
|
875
|
+
6: 6,
|
|
876
|
+
7: 7,
|
|
877
|
+
8: 8,
|
|
878
|
+
9: 9
|
|
879
|
+
}
|
|
880
|
+
},
|
|
881
|
+
paddingLeft: {
|
|
882
|
+
propDef: paddingProps.paddingLeft,
|
|
883
|
+
mapping: {
|
|
884
|
+
0: 0,
|
|
885
|
+
1: 1,
|
|
886
|
+
2: 2,
|
|
887
|
+
3: 3,
|
|
888
|
+
4: 4,
|
|
889
|
+
5: 5,
|
|
890
|
+
6: 6,
|
|
891
|
+
7: 7,
|
|
892
|
+
8: 8,
|
|
893
|
+
9: 9
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
function Inline(props) {
|
|
900
|
+
const { as, children: childrenProp, className, style, ...rest } = getProps(props, inlineProps), { className: childrenClassName } = getProps(props, inlineChildrenProps), Component = as || "div", children = useMemo(
|
|
901
|
+
() => Children.map(
|
|
902
|
+
childrenProp,
|
|
903
|
+
(child) => child && /* @__PURE__ */ jsx("div", { className: childrenClassName, children: child })
|
|
904
|
+
),
|
|
905
|
+
[childrenProp]
|
|
906
|
+
);
|
|
907
|
+
return /* @__PURE__ */ jsx(
|
|
908
|
+
Component,
|
|
909
|
+
{
|
|
910
|
+
className: classNames("sui-Inline", className),
|
|
911
|
+
style,
|
|
912
|
+
"data-ui": "Inline",
|
|
913
|
+
...rest,
|
|
914
|
+
children
|
|
915
|
+
}
|
|
916
|
+
);
|
|
917
|
+
}
|
|
918
|
+
const linkProps = {
|
|
919
|
+
openInNewTab: {
|
|
920
|
+
type: "boolean"
|
|
921
|
+
},
|
|
922
|
+
underlined: {
|
|
923
|
+
type: "boolean",
|
|
924
|
+
className: "Link-Underlined"
|
|
925
|
+
}
|
|
926
|
+
};
|
|
927
|
+
function Link({ underlined = !0, ...props }) {
|
|
928
|
+
const { children, className, style, openInNewTab, ...rest } = getProps(
|
|
929
|
+
{ underlined, ...props },
|
|
930
|
+
linkProps
|
|
931
|
+
);
|
|
932
|
+
return /* @__PURE__ */ jsx(
|
|
933
|
+
"a",
|
|
934
|
+
{
|
|
935
|
+
className: classNames("sui-Link", className),
|
|
936
|
+
style,
|
|
937
|
+
"data-ui": "Link",
|
|
938
|
+
...openInNewTab ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
939
|
+
...rest,
|
|
940
|
+
children
|
|
941
|
+
}
|
|
942
|
+
);
|
|
943
|
+
}
|
|
783
944
|
const radioProps = {
|
|
784
945
|
label: {
|
|
785
946
|
type: "string"
|
|
@@ -801,7 +962,7 @@ function Radio(props) {
|
|
|
801
962
|
Box,
|
|
802
963
|
{
|
|
803
964
|
as: "span",
|
|
804
|
-
className: "sui-RadioMark",
|
|
965
|
+
className: "sui-RadioMark sui-tone-neutral",
|
|
805
966
|
position: "relative",
|
|
806
967
|
radius: "full",
|
|
807
968
|
width: "17px",
|
|
@@ -813,6 +974,34 @@ function Radio(props) {
|
|
|
813
974
|
}
|
|
814
975
|
);
|
|
815
976
|
}
|
|
977
|
+
const skipToContentProps = {
|
|
978
|
+
hash: {
|
|
979
|
+
type: "string"
|
|
980
|
+
},
|
|
981
|
+
label: {
|
|
982
|
+
type: "string"
|
|
983
|
+
}
|
|
984
|
+
};
|
|
985
|
+
function SkipToContent(props) {
|
|
986
|
+
const { className, hash, label, style, ...rest } = getProps(props, skipToContentProps);
|
|
987
|
+
return /* @__PURE__ */ jsx(
|
|
988
|
+
VisuallyHidden,
|
|
989
|
+
{
|
|
990
|
+
as: Link,
|
|
991
|
+
href: hash,
|
|
992
|
+
underlined: !1,
|
|
993
|
+
className: classNames(
|
|
994
|
+
"sui-SkipToContent sui-position-absolute sui-top2 sui-left2 sui-display-inline-block sui-z-index sui-py2 sui-px3 sui-radius2 sui-text-body1",
|
|
995
|
+
className
|
|
996
|
+
),
|
|
997
|
+
style,
|
|
998
|
+
"data-ui": "SkipToContent",
|
|
999
|
+
visibleOnFocus: !0,
|
|
1000
|
+
...rest,
|
|
1001
|
+
children: /* @__PURE__ */ jsx(Text, { size: 1, children: label })
|
|
1002
|
+
}
|
|
1003
|
+
);
|
|
1004
|
+
}
|
|
816
1005
|
const switchProps = {
|
|
817
1006
|
label: {
|
|
818
1007
|
type: "string"
|
|
@@ -849,7 +1038,7 @@ function Switch(props) {
|
|
|
849
1038
|
Box,
|
|
850
1039
|
{
|
|
851
1040
|
as: "span",
|
|
852
|
-
className: "sui-SwitchMark",
|
|
1041
|
+
className: "sui-SwitchMark sui-tone-neutral",
|
|
853
1042
|
position: "relative",
|
|
854
1043
|
radius: 6,
|
|
855
1044
|
width: "25px",
|
|
@@ -862,6 +1051,27 @@ function Switch(props) {
|
|
|
862
1051
|
}
|
|
863
1052
|
);
|
|
864
1053
|
}
|
|
1054
|
+
const vStackProps = {
|
|
1055
|
+
as: {
|
|
1056
|
+
type: "string"
|
|
1057
|
+
},
|
|
1058
|
+
gap: gapProps.gap
|
|
1059
|
+
};
|
|
1060
|
+
function VStack(props) {
|
|
1061
|
+
const { as, children, className, style, ...rest } = getProps(props, vStackProps);
|
|
1062
|
+
return /* @__PURE__ */ jsx(
|
|
1063
|
+
Flex,
|
|
1064
|
+
{
|
|
1065
|
+
as: as || "div",
|
|
1066
|
+
className: classNames("sui-VStack", className),
|
|
1067
|
+
style,
|
|
1068
|
+
"data-ui": "VStack",
|
|
1069
|
+
flexDirection: "column",
|
|
1070
|
+
...rest,
|
|
1071
|
+
children
|
|
1072
|
+
}
|
|
1073
|
+
);
|
|
1074
|
+
}
|
|
865
1075
|
export {
|
|
866
1076
|
Box,
|
|
867
1077
|
Card,
|
|
@@ -871,12 +1081,17 @@ export {
|
|
|
871
1081
|
Divider,
|
|
872
1082
|
Flex,
|
|
873
1083
|
Grid,
|
|
1084
|
+
HStack,
|
|
874
1085
|
Heading,
|
|
875
1086
|
Icon,
|
|
1087
|
+
Inline,
|
|
876
1088
|
Label,
|
|
1089
|
+
Link,
|
|
877
1090
|
Radio,
|
|
1091
|
+
SkipToContent,
|
|
878
1092
|
Switch,
|
|
879
1093
|
Text,
|
|
1094
|
+
VStack,
|
|
880
1095
|
VisuallyHidden
|
|
881
1096
|
};
|
|
882
1097
|
//# sourceMappingURL=index.js.map
|