@sanity-labs/ui-poc 0.0.1-alpha.1 → 0.0.1-alpha.3
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/components.css +3 -8
- package/dist/index.d.ts +202 -7
- package/dist/index.js +284 -23
- package/dist/index.js.map +1 -1
- package/dist/styles.css +700 -737
- package/dist/utilities.css +717 -27
- package/package.json +2 -2
- package/src/components/card/Card.tsx +20 -0
- package/src/components/card/card.css +4 -0
- package/src/components/card/card.props.ts +19 -5
- package/src/components/heading/Heading.tsx +39 -0
- package/src/components/heading/heading.props.ts +24 -0
- package/src/components/index.css +1 -0
- package/src/css/utilities/generic/text-trim.css +16 -15
- package/src/css/utilities/tokenized/radius.css +10 -8
- package/src/index.ts +2 -0
- package/src/styles.css +7797 -0
- package/src/types/Density.ts +1 -1
- package/src/types/FontWeight.ts +1 -1
- package/src/types/Heading.ts +5 -0
- package/src/types/Overflow.ts +1 -1
- package/src/types/Position.ts +1 -1
- package/src/types/PropDef.ts +19 -4
- package/src/types/Radius.ts +1 -1
- package/src/types/Text.ts +1 -1
- package/src/types/TextAlign.ts +1 -1
- package/src/types/Tone.ts +9 -1
- package/src/utils/getProps.test.ts +21 -8
- package/src/utils/getProps.ts +18 -1
package/dist/components.css
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import {JSX} from 'react/jsx-runtime'
|
|
2
2
|
import {default as React_2} from 'react'
|
|
3
3
|
|
|
4
|
+
declare const ALIGN_ITEMS: readonly ['baseline', 'center', 'flex-end', 'flex-start', 'stretch']
|
|
5
|
+
|
|
6
|
+
declare type AlignItems = (typeof ALIGN_ITEMS)[number]
|
|
7
|
+
|
|
4
8
|
declare type BorderProps = {
|
|
5
9
|
/** CSS **border** property */
|
|
6
10
|
border?: Responsive<boolean>
|
|
@@ -17,9 +21,10 @@ declare type BorderProps = {
|
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
/** @public */
|
|
20
|
-
export declare function Box<T extends React_2.ElementType = 'div'>(
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
export declare function Box<T extends React_2.ElementType = 'div'>({
|
|
25
|
+
display,
|
|
26
|
+
...props
|
|
27
|
+
}: BoxProps<T> & Omit<React_2.ComponentPropsWithRef<T>, keyof BoxProps<T>>): JSX.Element
|
|
23
28
|
|
|
24
29
|
/** @public */
|
|
25
30
|
export declare interface BoxProps<T extends React_2.ElementType> extends LayoutProps {
|
|
@@ -29,10 +34,51 @@ export declare interface BoxProps<T extends React_2.ElementType> extends LayoutP
|
|
|
29
34
|
display?: Responsive<DisplayBlock>
|
|
30
35
|
}
|
|
31
36
|
|
|
37
|
+
/** @public */
|
|
38
|
+
export declare function Card<T extends React_2.ElementType = 'div'>({
|
|
39
|
+
density,
|
|
40
|
+
...props
|
|
41
|
+
}: CardProps<T> & Omit<React_2.ComponentPropsWithRef<T>, keyof CardProps<T>>): JSX.Element
|
|
42
|
+
|
|
43
|
+
/** @public */
|
|
44
|
+
declare interface CardProps<T extends React.ElementType> extends MarginProps {
|
|
45
|
+
/** Element to render */
|
|
46
|
+
as?: T
|
|
47
|
+
/** CSS **display** property */
|
|
48
|
+
display?: Responsive<DisplayBlock>
|
|
49
|
+
/** Composite prop for setting padding and border radius */
|
|
50
|
+
density?: Responsive<Density>
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare const DENSITY: readonly ['compact', 'regular', 'loose']
|
|
54
|
+
|
|
55
|
+
declare type Density = (typeof DENSITY)[number]
|
|
56
|
+
|
|
32
57
|
declare const DISPLAY_BLOCK: readonly ['block', 'inline-block', 'none']
|
|
33
58
|
|
|
59
|
+
declare const DISPLAY_FLEX: readonly ['flex', 'inline-flex', 'none']
|
|
60
|
+
|
|
61
|
+
declare const DISPLAY_GRID: readonly ['grid', 'inline-grid', 'none']
|
|
62
|
+
|
|
34
63
|
declare type DisplayBlock = (typeof DISPLAY_BLOCK)[number]
|
|
35
64
|
|
|
65
|
+
declare type DisplayFlex = (typeof DISPLAY_FLEX)[number]
|
|
66
|
+
|
|
67
|
+
declare type DisplayGrid = (typeof DISPLAY_GRID)[number]
|
|
68
|
+
|
|
69
|
+
/** @public */
|
|
70
|
+
export declare function Divider(): JSX.Element
|
|
71
|
+
|
|
72
|
+
/** @public */
|
|
73
|
+
export declare function Flex<T extends React_2.ElementType = 'div'>({
|
|
74
|
+
display,
|
|
75
|
+
...props
|
|
76
|
+
}: FlexProps<T> & Omit<React_2.ComponentPropsWithRef<T>, keyof FlexProps<T>>): JSX.Element
|
|
77
|
+
|
|
78
|
+
declare const FLEX_DIRECTION: readonly ['row', 'row-reverse', 'column', 'column-reverse']
|
|
79
|
+
|
|
80
|
+
declare const FLEX_WRAP: readonly ['wrap', 'wrap-reverse', 'nowrap']
|
|
81
|
+
|
|
36
82
|
declare type FlexChildProps = {
|
|
37
83
|
/** CSS **flex-basis** property */
|
|
38
84
|
flexBasis?: Responsive<string>
|
|
@@ -42,6 +88,53 @@ declare type FlexChildProps = {
|
|
|
42
88
|
flexShrink?: Responsive<number>
|
|
43
89
|
}
|
|
44
90
|
|
|
91
|
+
declare type FlexDirection = (typeof FLEX_DIRECTION)[number]
|
|
92
|
+
|
|
93
|
+
declare type FlexParentProps = {
|
|
94
|
+
/** CSS **align-items** property */
|
|
95
|
+
alignItems?: Responsive<AlignItems>
|
|
96
|
+
/** CSS **justify-content** property */
|
|
97
|
+
justifyContent?: Responsive<JustifyContent>
|
|
98
|
+
/** CSS **flex-direction** property */
|
|
99
|
+
flexDirection?: Responsive<FlexDirection>
|
|
100
|
+
/** CSS **flex-wrap** property */
|
|
101
|
+
flexWrap?: Responsive<FlexWrap>
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** @public */
|
|
105
|
+
export declare interface FlexProps<T extends React_2.ElementType>
|
|
106
|
+
extends FlexParentProps, GapProps, LayoutProps {
|
|
107
|
+
/** Element to render */
|
|
108
|
+
as?: T
|
|
109
|
+
/** CSS **display** property */
|
|
110
|
+
display?: Responsive<DisplayFlex>
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
declare type FlexWrap = (typeof FLEX_WRAP)[number]
|
|
114
|
+
|
|
115
|
+
declare const FONT_WEIGHT: readonly ['regular', 'medium', 'semibold', 'bold']
|
|
116
|
+
|
|
117
|
+
declare type FontWeight = (typeof FONT_WEIGHT)[number]
|
|
118
|
+
|
|
119
|
+
declare type GapProps = {
|
|
120
|
+
/** CSS **gap** property */
|
|
121
|
+
gap?: Responsive<Space>
|
|
122
|
+
/** CSS **row-gap** property */
|
|
123
|
+
rowGap?: Responsive<Space>
|
|
124
|
+
/** CSS **column-gap** property */
|
|
125
|
+
columnGap?: Responsive<Space>
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** @public */
|
|
129
|
+
export declare function Grid<T extends React_2.ElementType = 'div'>({
|
|
130
|
+
display,
|
|
131
|
+
...props
|
|
132
|
+
}: GridProps<T> & Omit<React_2.ComponentPropsWithRef<T>, keyof GridProps<T>>): JSX.Element
|
|
133
|
+
|
|
134
|
+
declare const GRID_AUTO_FLOW: readonly ['row', 'column', 'row dense', 'column dense', 'dense']
|
|
135
|
+
|
|
136
|
+
declare type GridAutoFlow = (typeof GRID_AUTO_FLOW)[number]
|
|
137
|
+
|
|
45
138
|
declare type GridChildProps = {
|
|
46
139
|
/** CSS **grid-column** property */
|
|
47
140
|
gridColumn?: Responsive<string>
|
|
@@ -57,6 +150,51 @@ declare type GridChildProps = {
|
|
|
57
150
|
gridRowEnd?: Responsive<string>
|
|
58
151
|
}
|
|
59
152
|
|
|
153
|
+
declare type GridParentProps = {
|
|
154
|
+
/** CSS **grid-auto-flow** property */
|
|
155
|
+
gridAutoFlow?: Responsive<GridAutoFlow>
|
|
156
|
+
/** CSS **grid-auto-columns** property */
|
|
157
|
+
gridAutoColumns?: Responsive<string>
|
|
158
|
+
/** CSS **grid-auto-row** property */
|
|
159
|
+
gridAutoRows?: Responsive<string>
|
|
160
|
+
/** CSS **grid-template-columns** property */
|
|
161
|
+
gridTemplateColumns?: Responsive<string>
|
|
162
|
+
/** CSS **grid-template-rows** property */
|
|
163
|
+
gridTemplateRows?: Responsive<string>
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** @public */
|
|
167
|
+
export declare interface GridProps<T extends React_2.ElementType>
|
|
168
|
+
extends GridParentProps, GapProps, LayoutProps {
|
|
169
|
+
/** Element to render */
|
|
170
|
+
as?: T
|
|
171
|
+
/** CSS **display** property */
|
|
172
|
+
display?: Responsive<DisplayGrid>
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** @public */
|
|
176
|
+
export declare function Heading<T extends React_2.ElementType = 'h1'>({
|
|
177
|
+
size,
|
|
178
|
+
weight,
|
|
179
|
+
...props
|
|
180
|
+
}: HeadingProps & Omit<React_2.ComponentPropsWithRef<T>, keyof HeadingProps>): JSX.Element
|
|
181
|
+
|
|
182
|
+
declare const HEADING_SIZE: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
183
|
+
|
|
184
|
+
declare const HEADING_TAG: readonly ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']
|
|
185
|
+
|
|
186
|
+
/** @public */
|
|
187
|
+
declare interface HeadingProps extends TypographyProps {
|
|
188
|
+
/** Element to render */
|
|
189
|
+
as?: HeadingTag
|
|
190
|
+
/** CSS **font-size** property */
|
|
191
|
+
size?: HeadingSize
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
declare type HeadingSize = (typeof HEADING_SIZE)[number]
|
|
195
|
+
|
|
196
|
+
declare type HeadingTag = (typeof HEADING_TAG)[number]
|
|
197
|
+
|
|
60
198
|
declare type HeightProps = {
|
|
61
199
|
/** CSS **height** property */
|
|
62
200
|
height?: Responsive<string>
|
|
@@ -66,6 +204,17 @@ declare type HeightProps = {
|
|
|
66
204
|
maxHeight?: Responsive<string>
|
|
67
205
|
}
|
|
68
206
|
|
|
207
|
+
declare const JUSTIFY_CONTENT: readonly [
|
|
208
|
+
'flex-start',
|
|
209
|
+
'flex-end',
|
|
210
|
+
'center',
|
|
211
|
+
'space-between',
|
|
212
|
+
'space-around',
|
|
213
|
+
'space-evenly',
|
|
214
|
+
]
|
|
215
|
+
|
|
216
|
+
declare type JustifyContent = (typeof JUSTIFY_CONTENT)[number]
|
|
217
|
+
|
|
69
218
|
declare interface LayoutProps
|
|
70
219
|
extends
|
|
71
220
|
ToneProps,
|
|
@@ -96,7 +245,7 @@ declare type MarginProps = {
|
|
|
96
245
|
marginLeft?: Responsive<SpaceAuto>
|
|
97
246
|
}
|
|
98
247
|
|
|
99
|
-
declare const OVERFLOW:
|
|
248
|
+
declare const OVERFLOW: readonly ['visible', 'hidden', 'auto', 'scroll', 'clip']
|
|
100
249
|
|
|
101
250
|
declare type Overflow = (typeof OVERFLOW)[number]
|
|
102
251
|
|
|
@@ -126,7 +275,7 @@ declare interface PaddingProps {
|
|
|
126
275
|
paddingLeft?: Responsive<Space>
|
|
127
276
|
}
|
|
128
277
|
|
|
129
|
-
declare const POSITION:
|
|
278
|
+
declare const POSITION: readonly ['absolute', 'fixed', 'relative', 'static', 'sticky']
|
|
130
279
|
|
|
131
280
|
declare type Position = (typeof POSITION)[number]
|
|
132
281
|
|
|
@@ -143,9 +292,11 @@ declare type PositionProps = {
|
|
|
143
292
|
bottom?: Responsive<SpaceAuto>
|
|
144
293
|
/** CSS **left** property */
|
|
145
294
|
left?: Responsive<SpaceAuto>
|
|
295
|
+
/** CSS **z-index** property */
|
|
296
|
+
zIndex?: Responsive<number>
|
|
146
297
|
}
|
|
147
298
|
|
|
148
|
-
declare const RADIUS:
|
|
299
|
+
declare const RADIUS: readonly [0, 1, 2, 3, 4, 5, 6, 'full']
|
|
149
300
|
|
|
150
301
|
declare type Radius = (typeof RADIUS)[number]
|
|
151
302
|
|
|
@@ -182,7 +333,38 @@ declare const SPACE_AUTO: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'auto']
|
|
|
182
333
|
|
|
183
334
|
declare type SpaceAuto = (typeof SPACE_AUTO)[number]
|
|
184
335
|
|
|
185
|
-
|
|
336
|
+
/** @public */
|
|
337
|
+
declare function Text_2<T extends React_2.ElementType = 'p'>({
|
|
338
|
+
size,
|
|
339
|
+
...props
|
|
340
|
+
}: TextProps<T> & Omit<React_2.ComponentPropsWithRef<T>, keyof TextProps<T>>): JSX.Element
|
|
341
|
+
export {Text_2 as Text}
|
|
342
|
+
|
|
343
|
+
declare const TEXT_ALIGN: readonly ['left', 'center', 'right', 'justify']
|
|
344
|
+
|
|
345
|
+
declare const TEXT_SIZE: readonly [0, 1, 2, 3, 4]
|
|
346
|
+
|
|
347
|
+
declare type TextAlign = (typeof TEXT_ALIGN)[number]
|
|
348
|
+
|
|
349
|
+
/** @public */
|
|
350
|
+
export declare interface TextProps<T extends React_2.ElementType> extends TypographyProps {
|
|
351
|
+
/** Element to render */
|
|
352
|
+
as?: T
|
|
353
|
+
/** CSS **font-size** property */
|
|
354
|
+
size?: TextSize
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
declare type TextSize = (typeof TEXT_SIZE)[number]
|
|
358
|
+
|
|
359
|
+
declare const TONE: readonly [
|
|
360
|
+
'default',
|
|
361
|
+
'neutral',
|
|
362
|
+
'primary',
|
|
363
|
+
'suggest',
|
|
364
|
+
'positive',
|
|
365
|
+
'caution',
|
|
366
|
+
'critical',
|
|
367
|
+
]
|
|
186
368
|
|
|
187
369
|
declare type Tone = (typeof TONE)[number]
|
|
188
370
|
|
|
@@ -191,6 +373,19 @@ declare type ToneProps = {
|
|
|
191
373
|
tone?: Responsive<Tone>
|
|
192
374
|
}
|
|
193
375
|
|
|
376
|
+
declare interface TypographyProps extends MarginProps {
|
|
377
|
+
/** CSS **text-align** property */
|
|
378
|
+
align?: TextAlign
|
|
379
|
+
/** CSS **-webkit-line-clamp** property */
|
|
380
|
+
lineClamp?: number
|
|
381
|
+
/** CSS **color** property */
|
|
382
|
+
muted?: boolean
|
|
383
|
+
/** CSS **text-box-trim** property */
|
|
384
|
+
trim?: boolean
|
|
385
|
+
/** CSS **font-weight** property */
|
|
386
|
+
weight?: FontWeight
|
|
387
|
+
}
|
|
388
|
+
|
|
194
389
|
declare type WidthProps = {
|
|
195
390
|
/** CSS **width** property */
|
|
196
391
|
width?: Responsive<string>
|
package/dist/index.js
CHANGED
|
@@ -212,8 +212,21 @@ const RADIUS = [0, 1, 2, 3, 4, 5, 6, "full"], borderProps = {
|
|
|
212
212
|
type: "union",
|
|
213
213
|
className: "left",
|
|
214
214
|
values: SPACE_AUTO
|
|
215
|
+
},
|
|
216
|
+
zIndex: {
|
|
217
|
+
type: "number",
|
|
218
|
+
className: "z-index",
|
|
219
|
+
variable: "--z-index"
|
|
215
220
|
}
|
|
216
|
-
}, TONE = [
|
|
221
|
+
}, TONE = [
|
|
222
|
+
"default",
|
|
223
|
+
"neutral",
|
|
224
|
+
"primary",
|
|
225
|
+
"suggest",
|
|
226
|
+
"positive",
|
|
227
|
+
"caution",
|
|
228
|
+
"critical"
|
|
229
|
+
], toneProps = {
|
|
217
230
|
tone: {
|
|
218
231
|
type: "union",
|
|
219
232
|
className: "tone",
|
|
@@ -246,27 +259,29 @@ const RADIUS = [0, 1, 2, 3, 4, 5, 6, "full"], borderProps = {
|
|
|
246
259
|
...overflowProps,
|
|
247
260
|
...flexChildProps,
|
|
248
261
|
...gridChildProps
|
|
249
|
-
}, DISPLAY_BLOCK = ["block", "inline-block", "none"], PREFIX = "sui", BREAKPOINTS_LENGTH = 7;
|
|
250
|
-
function getProps(
|
|
251
|
-
let className =
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
262
|
+
}, DISPLAY_BLOCK = ["block", "inline-block", "none"], DISPLAY_FLEX = ["flex", "inline-flex", "none"], DISPLAY_GRID = ["grid", "inline-grid", "none"], PREFIX = "sui", BREAKPOINTS_LENGTH = 7;
|
|
263
|
+
function getProps(componentProps, propDefs) {
|
|
264
|
+
let className = componentProps?.className || "", style = componentProps?.style || {};
|
|
265
|
+
const restProps = {};
|
|
266
|
+
for (const key in componentProps) {
|
|
267
|
+
if (!propDefs?.[key] || !("className" in propDefs[key]) && !("composition" in propDefs[key])) {
|
|
268
|
+
restProps[key] = componentProps[key];
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
if (Array.isArray(componentProps[key]))
|
|
272
|
+
for (let i = 0, len = Math.min(componentProps[key].length, BREAKPOINTS_LENGTH); i < len; i++)
|
|
273
|
+
className = classNames(className, getClassName(componentProps[key][i], propDefs[key], i)), style = { ...style, ...getStyle(componentProps[key][i], propDefs[key], i) };
|
|
274
|
+
else
|
|
275
|
+
className = classNames(className, getClassName(componentProps[key], propDefs[key])), style = { ...style, ...getStyle(componentProps[key], propDefs[key]) };
|
|
276
|
+
}
|
|
277
|
+
return { ...restProps, className, style };
|
|
263
278
|
}
|
|
264
|
-
function getClassName(prop,
|
|
265
|
-
return
|
|
279
|
+
function getClassName(prop, propDef, bp) {
|
|
280
|
+
return propDef.type === "composite" && propDef.composition[prop] ? bp ? propDef.composition[prop].split(" ").map((className) => `${className}-bp-${bp}`).join(" ") : propDef.composition[prop] : propDef.type === "union" && propDef.values?.includes(prop) ? `${PREFIX}-${propDef.className}${typeof prop == "string" ? `-${prop}` : prop}${bp ? `-bp-${bp}` : ""}` : propDef.type === "string" || propDef.type === "number" ? `${PREFIX}-${propDef.className}${bp ? `-bp-${bp}` : ""}` : propDef.type === "boolean" ? `${PREFIX}-${prop ? propDef.className : propDef.inverse}${bp ? `-bp-${bp}` : ""}` : "";
|
|
266
281
|
}
|
|
267
|
-
function getStyle(prop,
|
|
268
|
-
return
|
|
269
|
-
[`${
|
|
282
|
+
function getStyle(prop, propDef, bp) {
|
|
283
|
+
return propDef.type === "string" || propDef.type === "number" ? {
|
|
284
|
+
[`${propDef.variable}${bp ? `-bp-${bp}` : ""}`]: prop
|
|
270
285
|
} : {};
|
|
271
286
|
}
|
|
272
287
|
const boxProps = {
|
|
@@ -280,11 +295,257 @@ const boxProps = {
|
|
|
280
295
|
},
|
|
281
296
|
...layoutProps
|
|
282
297
|
};
|
|
283
|
-
function Box(
|
|
284
|
-
|
|
298
|
+
function Box({
|
|
299
|
+
display = "block",
|
|
300
|
+
...props
|
|
301
|
+
}) {
|
|
302
|
+
const { as, children, className, style, ...rest } = getProps({ display, ...props }, boxProps);
|
|
285
303
|
return /* @__PURE__ */ jsx(as || "div", { className: classNames("sui-Box", className), style, "data-ui": "Box", ...rest, children });
|
|
286
304
|
}
|
|
305
|
+
const cardProps = {
|
|
306
|
+
as: {
|
|
307
|
+
type: "string"
|
|
308
|
+
},
|
|
309
|
+
display: {
|
|
310
|
+
type: "union",
|
|
311
|
+
className: "display",
|
|
312
|
+
values: DISPLAY_BLOCK
|
|
313
|
+
},
|
|
314
|
+
density: {
|
|
315
|
+
type: "composite",
|
|
316
|
+
composition: {
|
|
317
|
+
compact: "sui-p3 sui-radius2",
|
|
318
|
+
regular: "sui-p4 sui-radius3",
|
|
319
|
+
loose: "sui-p5 sui-radius4"
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
...marginProps
|
|
323
|
+
};
|
|
324
|
+
function Card({
|
|
325
|
+
density = "regular",
|
|
326
|
+
...props
|
|
327
|
+
}) {
|
|
328
|
+
const { as, children, className, style, ...rest } = getProps({ density, ...props }, cardProps);
|
|
329
|
+
return /* @__PURE__ */ jsx(as || "div", { className: classNames("sui-Card", className), style, "data-ui": "Card", ...rest, children });
|
|
330
|
+
}
|
|
331
|
+
function Divider() {
|
|
332
|
+
return /* @__PURE__ */ jsx(
|
|
333
|
+
"hr",
|
|
334
|
+
{
|
|
335
|
+
className: "sui-Divider sui-border-bottom-none sui-border-left-none sui-border-right-none sui-border-top",
|
|
336
|
+
"data-ui": "Divider"
|
|
337
|
+
}
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
const ALIGN_ITEMS = ["baseline", "center", "flex-end", "flex-start", "stretch"], JUSTIFY_CONTENT = [
|
|
341
|
+
"flex-start",
|
|
342
|
+
"flex-end",
|
|
343
|
+
"center",
|
|
344
|
+
"space-between",
|
|
345
|
+
"space-around",
|
|
346
|
+
"space-evenly"
|
|
347
|
+
], FLEX_DIRECTION = ["row", "row-reverse", "column", "column-reverse"], FLEX_WRAP = ["wrap", "wrap-reverse", "nowrap"], flexParentProps = {
|
|
348
|
+
alignItems: {
|
|
349
|
+
type: "union",
|
|
350
|
+
className: "align-items",
|
|
351
|
+
values: ALIGN_ITEMS
|
|
352
|
+
},
|
|
353
|
+
justifyContent: {
|
|
354
|
+
type: "union",
|
|
355
|
+
className: "justify-content",
|
|
356
|
+
values: JUSTIFY_CONTENT
|
|
357
|
+
},
|
|
358
|
+
flexDirection: {
|
|
359
|
+
type: "union",
|
|
360
|
+
className: "flex-direction",
|
|
361
|
+
values: FLEX_DIRECTION
|
|
362
|
+
},
|
|
363
|
+
flexWrap: {
|
|
364
|
+
type: "union",
|
|
365
|
+
className: "flex-wrap",
|
|
366
|
+
values: FLEX_WRAP
|
|
367
|
+
}
|
|
368
|
+
}, gapProps = {
|
|
369
|
+
gap: {
|
|
370
|
+
type: "union",
|
|
371
|
+
className: "gap",
|
|
372
|
+
values: SPACE
|
|
373
|
+
},
|
|
374
|
+
rowGap: {
|
|
375
|
+
type: "union",
|
|
376
|
+
className: "row-gap",
|
|
377
|
+
values: SPACE
|
|
378
|
+
},
|
|
379
|
+
columnGap: {
|
|
380
|
+
type: "union",
|
|
381
|
+
className: "column-gap",
|
|
382
|
+
values: SPACE
|
|
383
|
+
}
|
|
384
|
+
}, flexProps = {
|
|
385
|
+
as: {
|
|
386
|
+
type: "string"
|
|
387
|
+
},
|
|
388
|
+
display: {
|
|
389
|
+
type: "union",
|
|
390
|
+
className: "display",
|
|
391
|
+
values: DISPLAY_FLEX
|
|
392
|
+
},
|
|
393
|
+
...flexParentProps,
|
|
394
|
+
...gapProps,
|
|
395
|
+
...layoutProps
|
|
396
|
+
};
|
|
397
|
+
function Flex({
|
|
398
|
+
display = "flex",
|
|
399
|
+
...props
|
|
400
|
+
}) {
|
|
401
|
+
const { as, children, className, style, ...rest } = getProps({ display, ...props }, flexProps);
|
|
402
|
+
return /* @__PURE__ */ jsx(as || "div", { className: classNames("sui-Flex", className), style, "data-ui": "Flex", ...rest, children });
|
|
403
|
+
}
|
|
404
|
+
const GRID_AUTO_FLOW = ["row", "column", "row dense", "column dense", "dense"], gridParentProps = {
|
|
405
|
+
gridAutoFlow: {
|
|
406
|
+
type: "union",
|
|
407
|
+
className: "grid-auto-flow",
|
|
408
|
+
values: GRID_AUTO_FLOW
|
|
409
|
+
},
|
|
410
|
+
gridAutoColumns: {
|
|
411
|
+
type: "string",
|
|
412
|
+
className: "grid-auto-columns",
|
|
413
|
+
variable: "--grid-auto-columns"
|
|
414
|
+
},
|
|
415
|
+
gridAutoRows: {
|
|
416
|
+
type: "string",
|
|
417
|
+
className: "grid-auto-rows",
|
|
418
|
+
variable: "--grid-auto-rows"
|
|
419
|
+
},
|
|
420
|
+
gridTemplateColumns: {
|
|
421
|
+
type: "string",
|
|
422
|
+
className: "grid-template-columns",
|
|
423
|
+
variable: "--grid-template-columns"
|
|
424
|
+
},
|
|
425
|
+
gridTemplateRows: {
|
|
426
|
+
type: "string",
|
|
427
|
+
className: "grid-template-rows",
|
|
428
|
+
variable: "--grid-template-rows"
|
|
429
|
+
}
|
|
430
|
+
}, gridProps = {
|
|
431
|
+
as: {
|
|
432
|
+
type: "string"
|
|
433
|
+
},
|
|
434
|
+
display: {
|
|
435
|
+
type: "union",
|
|
436
|
+
className: "display",
|
|
437
|
+
values: DISPLAY_GRID
|
|
438
|
+
},
|
|
439
|
+
...gridParentProps,
|
|
440
|
+
...gapProps,
|
|
441
|
+
...layoutProps
|
|
442
|
+
};
|
|
443
|
+
function Grid({
|
|
444
|
+
display = "grid",
|
|
445
|
+
...props
|
|
446
|
+
}) {
|
|
447
|
+
const { as, children, className, style, ...rest } = getProps({ display, ...props }, gridProps);
|
|
448
|
+
return /* @__PURE__ */ jsx(as || "div", { className: classNames("sui-Grid", className), style, "data-ui": "Grid", ...rest, children });
|
|
449
|
+
}
|
|
450
|
+
const FONT_WEIGHT = ["regular", "medium", "semibold", "bold"], TEXT_ALIGN = ["left", "center", "right", "justify"], typographyProps = {
|
|
451
|
+
align: {
|
|
452
|
+
type: "union",
|
|
453
|
+
className: "text",
|
|
454
|
+
values: TEXT_ALIGN
|
|
455
|
+
},
|
|
456
|
+
lineClamp: {
|
|
457
|
+
type: "number",
|
|
458
|
+
className: "line-clamp",
|
|
459
|
+
variable: "--line-clamp"
|
|
460
|
+
},
|
|
461
|
+
muted: {
|
|
462
|
+
type: "boolean",
|
|
463
|
+
className: "text-muted",
|
|
464
|
+
inverse: "text-default"
|
|
465
|
+
},
|
|
466
|
+
trim: {
|
|
467
|
+
type: "boolean",
|
|
468
|
+
className: "text-trim",
|
|
469
|
+
inverse: "text-trim-none"
|
|
470
|
+
},
|
|
471
|
+
weight: {
|
|
472
|
+
type: "union",
|
|
473
|
+
className: "weight",
|
|
474
|
+
values: FONT_WEIGHT
|
|
475
|
+
},
|
|
476
|
+
...marginProps
|
|
477
|
+
}, HEADING_TAG = ["h1", "h2", "h3", "h4", "h5", "h6"], HEADING_SIZE = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], headingProps = {
|
|
478
|
+
as: {
|
|
479
|
+
type: "union",
|
|
480
|
+
values: HEADING_TAG
|
|
481
|
+
},
|
|
482
|
+
size: {
|
|
483
|
+
type: "union",
|
|
484
|
+
className: "text-heading",
|
|
485
|
+
values: HEADING_SIZE
|
|
486
|
+
},
|
|
487
|
+
...typographyProps
|
|
488
|
+
};
|
|
489
|
+
function Heading({
|
|
490
|
+
size = 2,
|
|
491
|
+
weight = "bold",
|
|
492
|
+
...props
|
|
493
|
+
}) {
|
|
494
|
+
const { as, children, className, style, ...rest } = getProps({ size, weight, ...props }, headingProps), Component = as || "h1";
|
|
495
|
+
return props.lineClamp && props.trim ? /* @__PURE__ */ jsx(
|
|
496
|
+
Component,
|
|
497
|
+
{
|
|
498
|
+
className: classNames("sui-Heading", className?.replace("sui-line-clamp", "")),
|
|
499
|
+
style,
|
|
500
|
+
"data-ui": "Heading",
|
|
501
|
+
...rest,
|
|
502
|
+
children: /* @__PURE__ */ jsx("span", { className: "sui-line-clamp", children })
|
|
503
|
+
}
|
|
504
|
+
) : /* @__PURE__ */ jsx(
|
|
505
|
+
Component,
|
|
506
|
+
{
|
|
507
|
+
className: classNames("sui-Heading", className),
|
|
508
|
+
style,
|
|
509
|
+
"data-ui": "Heading",
|
|
510
|
+
...rest,
|
|
511
|
+
children
|
|
512
|
+
}
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
const TEXT_SIZE = [0, 1, 2, 3, 4], textProps = {
|
|
516
|
+
as: {
|
|
517
|
+
type: "string"
|
|
518
|
+
},
|
|
519
|
+
size: {
|
|
520
|
+
type: "union",
|
|
521
|
+
className: "text-body",
|
|
522
|
+
values: TEXT_SIZE
|
|
523
|
+
},
|
|
524
|
+
...typographyProps
|
|
525
|
+
};
|
|
526
|
+
function Text({
|
|
527
|
+
size = 2,
|
|
528
|
+
...props
|
|
529
|
+
}) {
|
|
530
|
+
const { as, children, className, style, ...rest } = getProps({ size, ...props }, textProps), Component = as || "p";
|
|
531
|
+
return props.lineClamp && props.trim ? /* @__PURE__ */ jsx(
|
|
532
|
+
Component,
|
|
533
|
+
{
|
|
534
|
+
className: classNames("sui-Text", className?.replace("sui-line-clamp", "")),
|
|
535
|
+
style,
|
|
536
|
+
"data-ui": "Text",
|
|
537
|
+
...rest,
|
|
538
|
+
children: /* @__PURE__ */ jsx("span", { className: "sui-line-clamp", children })
|
|
539
|
+
}
|
|
540
|
+
) : /* @__PURE__ */ jsx(Component, { className: classNames("sui-Text", className), style, "data-ui": "Text", ...rest, children });
|
|
541
|
+
}
|
|
287
542
|
export {
|
|
288
|
-
Box
|
|
543
|
+
Box,
|
|
544
|
+
Card,
|
|
545
|
+
Divider,
|
|
546
|
+
Flex,
|
|
547
|
+
Grid,
|
|
548
|
+
Heading,
|
|
549
|
+
Text
|
|
289
550
|
};
|
|
290
551
|
//# sourceMappingURL=index.js.map
|