@capra/core 1.5.2 → 1.6.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/index.cjs +27 -24
- package/dist/index.mjs +27 -24
- package/dist/style.css +62 -32
- package/docs/conventions--docs.md +186 -0
- package/docs/core-alert--design.md +110 -0
- package/docs/core-alert--usage.md +13 -0
- package/docs/core-anchor--design.md +39 -0
- package/docs/core-anchor--usage.md +39 -0
- package/docs/core-autocompletefield--design.md +91 -0
- package/docs/core-autocompletefield--usage.md +18 -0
- package/docs/core-badge--design.md +70 -0
- package/docs/core-badge--usage.md +13 -0
- package/docs/core-breadcrumbs--design.md +65 -0
- package/docs/core-breadcrumbs--usage.md +16 -0
- package/docs/core-button--design.md +97 -0
- package/docs/core-button--usage.md +17 -0
- package/docs/core-buttonlink--design.md +7 -0
- package/docs/core-buttonlink--usage.md +24 -0
- package/docs/core-card--design.md +100 -0
- package/docs/core-card--usage.md +5 -0
- package/docs/core-checkbox--design.md +66 -0
- package/docs/core-checkbox--usage.md +34 -0
- package/docs/core-collapse--design.md +28 -0
- package/docs/core-collapse--usage.md +20 -0
- package/docs/core-datepickerfield--design.md +71 -0
- package/docs/core-datepickerfield--usage.md +57 -0
- package/docs/core-daterangepickerfield--design.md +76 -0
- package/docs/core-daterangepickerfield--usage.md +62 -0
- package/docs/core-divider--design.md +35 -0
- package/docs/core-divider--usage.md +8 -0
- package/docs/core-drawer--design.md +87 -0
- package/docs/core-drawer--usage.md +9 -0
- package/docs/core-emptystate--design.md +45 -0
- package/docs/core-emptystate--usage.md +13 -0
- package/docs/core-helpertext--design.md +30 -0
- package/docs/core-helpertext--usage.md +11 -0
- package/docs/core-iconbutton--design.md +87 -0
- package/docs/core-iconbutton--usage.md +15 -0
- package/docs/core-inputrow--design.md +85 -0
- package/docs/core-inputrow--usage.md +6 -0
- package/docs/core-label--design.md +27 -0
- package/docs/core-label--usage.md +17 -0
- package/docs/core-link--design.md +58 -0
- package/docs/core-link--usage.md +16 -0
- package/docs/core-listitem--design.md +70 -0
- package/docs/core-listitem--usage.md +6 -0
- package/docs/core-menu--design.md +106 -0
- package/docs/core-menu--usage.md +16 -0
- package/docs/core-modal--design.md +39 -0
- package/docs/core-modal--usage.md +11 -0
- package/docs/core-numberfield--design.md +12 -0
- package/docs/core-numberfield--usage.md +14 -0
- package/docs/core-pagination--design.md +30 -0
- package/docs/core-pagination--usage.md +13 -0
- package/docs/core-passwordfield--design.md +7 -0
- package/docs/core-passwordfield--usage.md +3 -0
- package/docs/core-pill--design.md +94 -0
- package/docs/core-pill--usage.md +10 -0
- package/docs/core-popover--design.md +25 -0
- package/docs/core-popover--usage.md +8 -0
- package/docs/core-radio--design.md +39 -0
- package/docs/core-radio--usage.md +8 -0
- package/docs/core-radiogroup--design.md +5 -0
- package/docs/core-radiogroup--usage.md +12 -0
- package/docs/core-radiotile--design.md +5 -0
- package/docs/core-radiotile--usage.md +10 -0
- package/docs/core-ribbon--design.md +39 -0
- package/docs/core-ribbon--usage.md +12 -0
- package/docs/core-skeleton--design.md +88 -0
- package/docs/core-skeleton--usage.md +13 -0
- package/docs/core-skeletongroup--design.md +50 -0
- package/docs/core-skeletongroup--usage.md +10 -0
- package/docs/core-spinner--design.md +99 -0
- package/docs/core-spinner--usage.md +11 -0
- package/docs/core-switch--design.md +145 -0
- package/docs/core-switch--usage.md +8 -0
- package/docs/core-tabnav--design.md +77 -0
- package/docs/core-tabnav--usage.md +63 -0
- package/docs/core-tag--design.md +21 -0
- package/docs/core-tag--usage.md +11 -0
- package/docs/core-text--design.md +32 -0
- package/docs/core-text--usage.md +10 -0
- package/docs/core-textarea--design.md +74 -0
- package/docs/core-textarea--usage.md +18 -0
- package/docs/core-textfield--design.md +81 -0
- package/docs/core-textfield--usage.md +12 -0
- package/docs/core-textinput--design.md +72 -0
- package/docs/core-textinput--usage.md +19 -0
- package/docs/core-toast--design.md +100 -0
- package/docs/core-toast--usage.md +11 -0
- package/docs/core-tooltip--design.md +61 -0
- package/docs/core-tooltip--usage.md +48 -0
- package/docs/core-topnav--design.md +75 -0
- package/docs/core-topnav--usage.md +6 -0
- package/docs/core-verticalnavigation--design.md +31 -0
- package/docs/core-verticalnavigation--usage.md +17 -0
- package/docs/core-visuallyhidden--design.md +87 -0
- package/docs/core-visuallyhidden--usage.md +35 -0
- package/docs/history-changelogs-capra-core--docs.md +49 -0
- package/docs/index.md +110 -0
- package/docs/using-capra--docs.md +39 -0
- package/package.json +7 -6
package/dist/index.cjs
CHANGED
|
@@ -270,12 +270,12 @@ Label$1.displayName = "Label";
|
|
|
270
270
|
//#endregion
|
|
271
271
|
//#region src/components/TextInput/TextInput.module.css
|
|
272
272
|
var TextInput_module_default = {
|
|
273
|
-
"errorIndicator": "capra-TextInput-module-
|
|
274
|
-
"input": "capra-TextInput-module-
|
|
275
|
-
"leadingSlot": "capra-TextInput-module-
|
|
276
|
-
"trailingSlot": "capra-TextInput-module-
|
|
277
|
-
"warningIndicator": "capra-TextInput-module-
|
|
278
|
-
"wrapper": "capra-TextInput-module-
|
|
273
|
+
"errorIndicator": "capra-TextInput-module-pTHfnG-errorIndicator",
|
|
274
|
+
"input": "capra-TextInput-module-pTHfnG-input",
|
|
275
|
+
"leadingSlot": "capra-TextInput-module-pTHfnG-leadingSlot",
|
|
276
|
+
"trailingSlot": "capra-TextInput-module-pTHfnG-trailingSlot",
|
|
277
|
+
"warningIndicator": "capra-TextInput-module-pTHfnG-warningIndicator",
|
|
278
|
+
"wrapper": "capra-TextInput-module-pTHfnG-wrapper"
|
|
279
279
|
};
|
|
280
280
|
//#endregion
|
|
281
281
|
//#region src/components/TextInput/TextInput.tsx
|
|
@@ -2733,23 +2733,23 @@ TextArea.displayName = "TextArea";
|
|
|
2733
2733
|
//#endregion
|
|
2734
2734
|
//#region src/components/Modal/Modal.module.css
|
|
2735
2735
|
var Modal_module_default = {
|
|
2736
|
-
"confirmationActions": "capra-Modal-module-
|
|
2737
|
-
"confirmationBody": "capra-Modal-module-
|
|
2738
|
-
"confirmationIcon": "capra-Modal-module-
|
|
2739
|
-
"confirmationLayout": "capra-Modal-module-
|
|
2740
|
-
"confirmationMessage": "capra-Modal-module-
|
|
2741
|
-
"confirmationSurface": "capra-Modal-module-
|
|
2742
|
-
"content": "capra-Modal-module-
|
|
2743
|
-
"contentShow": "capra-Modal-module-
|
|
2744
|
-
"expandedFooterLayout": "capra-Modal-module-
|
|
2745
|
-
"expandedTitleLayout": "capra-Modal-module-
|
|
2746
|
-
"footer": "capra-Modal-module-
|
|
2747
|
-
"footerActions": "capra-Modal-module-
|
|
2748
|
-
"header": "capra-Modal-module-
|
|
2749
|
-
"headerLeading": "capra-Modal-module-
|
|
2750
|
-
"overlay": "capra-Modal-module-
|
|
2751
|
-
"overlayShow": "capra-Modal-module-
|
|
2752
|
-
"surface": "capra-Modal-module-
|
|
2736
|
+
"confirmationActions": "capra-Modal-module-j-u8iq-confirmationActions",
|
|
2737
|
+
"confirmationBody": "capra-Modal-module-j-u8iq-confirmationBody",
|
|
2738
|
+
"confirmationIcon": "capra-Modal-module-j-u8iq-confirmationIcon",
|
|
2739
|
+
"confirmationLayout": "capra-Modal-module-j-u8iq-confirmationLayout",
|
|
2740
|
+
"confirmationMessage": "capra-Modal-module-j-u8iq-confirmationMessage",
|
|
2741
|
+
"confirmationSurface": "capra-Modal-module-j-u8iq-confirmationSurface",
|
|
2742
|
+
"content": "capra-Modal-module-j-u8iq-content",
|
|
2743
|
+
"contentShow": "capra-Modal-module-j-u8iq-contentShow",
|
|
2744
|
+
"expandedFooterLayout": "capra-Modal-module-j-u8iq-expandedFooterLayout",
|
|
2745
|
+
"expandedTitleLayout": "capra-Modal-module-j-u8iq-expandedTitleLayout",
|
|
2746
|
+
"footer": "capra-Modal-module-j-u8iq-footer",
|
|
2747
|
+
"footerActions": "capra-Modal-module-j-u8iq-footerActions",
|
|
2748
|
+
"header": "capra-Modal-module-j-u8iq-header",
|
|
2749
|
+
"headerLeading": "capra-Modal-module-j-u8iq-headerLeading",
|
|
2750
|
+
"overlay": "capra-Modal-module-j-u8iq-overlay",
|
|
2751
|
+
"overlayShow": "capra-Modal-module-j-u8iq-overlayShow",
|
|
2752
|
+
"surface": "capra-Modal-module-j-u8iq-surface"
|
|
2753
2753
|
};
|
|
2754
2754
|
//#endregion
|
|
2755
2755
|
//#region src/components/Text/Heading.tsx
|
|
@@ -3427,9 +3427,12 @@ var EmptyState_module_default = {
|
|
|
3427
3427
|
};
|
|
3428
3428
|
//#endregion
|
|
3429
3429
|
//#region src/components/EmptyState/EmptyState.tsx
|
|
3430
|
+
const NOOP_IMAGE = () => null;
|
|
3430
3431
|
function lazyLoad(importFn) {
|
|
3431
3432
|
return react.default.lazy(() => importFn().then((m) => {
|
|
3432
|
-
|
|
3433
|
+
const componentName = Object.getOwnPropertyNames(m).find((name) => name.match(/^[A-Z]/));
|
|
3434
|
+
if (!componentName) return { default: NOOP_IMAGE };
|
|
3435
|
+
return { default: m[componentName] };
|
|
3433
3436
|
}));
|
|
3434
3437
|
}
|
|
3435
3438
|
const ILLUSTRATIONS = {
|
package/dist/index.mjs
CHANGED
|
@@ -246,12 +246,12 @@ Label$1.displayName = "Label";
|
|
|
246
246
|
//#endregion
|
|
247
247
|
//#region src/components/TextInput/TextInput.module.css
|
|
248
248
|
var TextInput_module_default = {
|
|
249
|
-
"errorIndicator": "capra-TextInput-module-
|
|
250
|
-
"input": "capra-TextInput-module-
|
|
251
|
-
"leadingSlot": "capra-TextInput-module-
|
|
252
|
-
"trailingSlot": "capra-TextInput-module-
|
|
253
|
-
"warningIndicator": "capra-TextInput-module-
|
|
254
|
-
"wrapper": "capra-TextInput-module-
|
|
249
|
+
"errorIndicator": "capra-TextInput-module-pTHfnG-errorIndicator",
|
|
250
|
+
"input": "capra-TextInput-module-pTHfnG-input",
|
|
251
|
+
"leadingSlot": "capra-TextInput-module-pTHfnG-leadingSlot",
|
|
252
|
+
"trailingSlot": "capra-TextInput-module-pTHfnG-trailingSlot",
|
|
253
|
+
"warningIndicator": "capra-TextInput-module-pTHfnG-warningIndicator",
|
|
254
|
+
"wrapper": "capra-TextInput-module-pTHfnG-wrapper"
|
|
255
255
|
};
|
|
256
256
|
//#endregion
|
|
257
257
|
//#region src/components/TextInput/TextInput.tsx
|
|
@@ -2709,23 +2709,23 @@ TextArea.displayName = "TextArea";
|
|
|
2709
2709
|
//#endregion
|
|
2710
2710
|
//#region src/components/Modal/Modal.module.css
|
|
2711
2711
|
var Modal_module_default = {
|
|
2712
|
-
"confirmationActions": "capra-Modal-module-
|
|
2713
|
-
"confirmationBody": "capra-Modal-module-
|
|
2714
|
-
"confirmationIcon": "capra-Modal-module-
|
|
2715
|
-
"confirmationLayout": "capra-Modal-module-
|
|
2716
|
-
"confirmationMessage": "capra-Modal-module-
|
|
2717
|
-
"confirmationSurface": "capra-Modal-module-
|
|
2718
|
-
"content": "capra-Modal-module-
|
|
2719
|
-
"contentShow": "capra-Modal-module-
|
|
2720
|
-
"expandedFooterLayout": "capra-Modal-module-
|
|
2721
|
-
"expandedTitleLayout": "capra-Modal-module-
|
|
2722
|
-
"footer": "capra-Modal-module-
|
|
2723
|
-
"footerActions": "capra-Modal-module-
|
|
2724
|
-
"header": "capra-Modal-module-
|
|
2725
|
-
"headerLeading": "capra-Modal-module-
|
|
2726
|
-
"overlay": "capra-Modal-module-
|
|
2727
|
-
"overlayShow": "capra-Modal-module-
|
|
2728
|
-
"surface": "capra-Modal-module-
|
|
2712
|
+
"confirmationActions": "capra-Modal-module-j-u8iq-confirmationActions",
|
|
2713
|
+
"confirmationBody": "capra-Modal-module-j-u8iq-confirmationBody",
|
|
2714
|
+
"confirmationIcon": "capra-Modal-module-j-u8iq-confirmationIcon",
|
|
2715
|
+
"confirmationLayout": "capra-Modal-module-j-u8iq-confirmationLayout",
|
|
2716
|
+
"confirmationMessage": "capra-Modal-module-j-u8iq-confirmationMessage",
|
|
2717
|
+
"confirmationSurface": "capra-Modal-module-j-u8iq-confirmationSurface",
|
|
2718
|
+
"content": "capra-Modal-module-j-u8iq-content",
|
|
2719
|
+
"contentShow": "capra-Modal-module-j-u8iq-contentShow",
|
|
2720
|
+
"expandedFooterLayout": "capra-Modal-module-j-u8iq-expandedFooterLayout",
|
|
2721
|
+
"expandedTitleLayout": "capra-Modal-module-j-u8iq-expandedTitleLayout",
|
|
2722
|
+
"footer": "capra-Modal-module-j-u8iq-footer",
|
|
2723
|
+
"footerActions": "capra-Modal-module-j-u8iq-footerActions",
|
|
2724
|
+
"header": "capra-Modal-module-j-u8iq-header",
|
|
2725
|
+
"headerLeading": "capra-Modal-module-j-u8iq-headerLeading",
|
|
2726
|
+
"overlay": "capra-Modal-module-j-u8iq-overlay",
|
|
2727
|
+
"overlayShow": "capra-Modal-module-j-u8iq-overlayShow",
|
|
2728
|
+
"surface": "capra-Modal-module-j-u8iq-surface"
|
|
2729
2729
|
};
|
|
2730
2730
|
//#endregion
|
|
2731
2731
|
//#region src/components/Text/Heading.tsx
|
|
@@ -3403,9 +3403,12 @@ var EmptyState_module_default = {
|
|
|
3403
3403
|
};
|
|
3404
3404
|
//#endregion
|
|
3405
3405
|
//#region src/components/EmptyState/EmptyState.tsx
|
|
3406
|
+
const NOOP_IMAGE = () => null;
|
|
3406
3407
|
function lazyLoad(importFn) {
|
|
3407
3408
|
return React.lazy(() => importFn().then((m) => {
|
|
3408
|
-
|
|
3409
|
+
const componentName = Object.getOwnPropertyNames(m).find((name) => name.match(/^[A-Z]/));
|
|
3410
|
+
if (!componentName) return { default: NOOP_IMAGE };
|
|
3411
|
+
return { default: m[componentName] };
|
|
3409
3412
|
}));
|
|
3410
3413
|
}
|
|
3411
3414
|
const ILLUSTRATIONS = {
|
package/dist/style.css
CHANGED
|
@@ -342,7 +342,7 @@
|
|
|
342
342
|
position: absolute;
|
|
343
343
|
overflow: hidden;
|
|
344
344
|
}
|
|
345
|
-
.capra-TextInput-module-
|
|
345
|
+
.capra-TextInput-module-pTHfnG-wrapper {
|
|
346
346
|
border: var(--cds2-border-default);
|
|
347
347
|
border-color: var(--cds2-temporary-input-border-primary);
|
|
348
348
|
border-radius: var(--cds2-radius-md);
|
|
@@ -371,7 +371,7 @@
|
|
|
371
371
|
border-color: var(--cds2-temporary-input-border-disabled);
|
|
372
372
|
color: var(--cds2-temporary-input-foreground-disabled);
|
|
373
373
|
|
|
374
|
-
& .capra-TextInput-module-
|
|
374
|
+
& .capra-TextInput-module-pTHfnG-leadingSlot, & .capra-TextInput-module-pTHfnG-trailingSlot {
|
|
375
375
|
color: var(--cds2-temporary-input-foreground-disabled);
|
|
376
376
|
}
|
|
377
377
|
}
|
|
@@ -379,7 +379,7 @@
|
|
|
379
379
|
&:has( > input:read-only) {
|
|
380
380
|
cursor: default;
|
|
381
381
|
|
|
382
|
-
& .capra-TextInput-module-
|
|
382
|
+
& .capra-TextInput-module-pTHfnG-input {
|
|
383
383
|
cursor: default;
|
|
384
384
|
}
|
|
385
385
|
}
|
|
@@ -387,12 +387,12 @@
|
|
|
387
387
|
&:has( > input:disabled) {
|
|
388
388
|
cursor: not-allowed;
|
|
389
389
|
|
|
390
|
-
& .capra-TextInput-module-
|
|
390
|
+
& .capra-TextInput-module-pTHfnG-input {
|
|
391
391
|
cursor: not-allowed;
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
394
|
|
|
395
|
-
& .capra-TextInput-module-
|
|
395
|
+
& .capra-TextInput-module-pTHfnG-input {
|
|
396
396
|
min-width: 0;
|
|
397
397
|
color: inherit;
|
|
398
398
|
font: inherit;
|
|
@@ -408,26 +408,56 @@
|
|
|
408
408
|
}
|
|
409
409
|
|
|
410
410
|
&[data-size="sm"] {
|
|
411
|
-
padding-inline: var(--cds2-spacing-md);
|
|
412
411
|
gap: var(--cds2-spacing-sm);
|
|
413
412
|
|
|
414
|
-
|
|
413
|
+
&:not(:has(.capra-TextInput-module-pTHfnG-leadingSlot)) .capra-TextInput-module-pTHfnG-input {
|
|
414
|
+
padding-inline-start: var(--cds2-spacing-md);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
&:not(:has(.capra-TextInput-module-pTHfnG-trailingSlot)) .capra-TextInput-module-pTHfnG-input {
|
|
418
|
+
padding-inline-end: var(--cds2-spacing-md);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
& .capra-TextInput-module-pTHfnG-input {
|
|
415
422
|
height: calc(var(--cds2-dimension-component-sm) - 2px);
|
|
416
423
|
font: var(--cds2-typography-body-sm-normal);
|
|
417
424
|
}
|
|
425
|
+
|
|
426
|
+
& .capra-TextInput-module-pTHfnG-leadingSlot {
|
|
427
|
+
padding-inline-start: var(--cds2-spacing-md);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
& .capra-TextInput-module-pTHfnG-trailingSlot {
|
|
431
|
+
padding-inline-end: var(--cds2-spacing-md);
|
|
432
|
+
}
|
|
418
433
|
}
|
|
419
434
|
|
|
420
435
|
&[data-size="md"] {
|
|
421
|
-
padding-inline: var(--cds2-spacing-md);
|
|
422
436
|
gap: var(--cds2-spacing-md);
|
|
423
437
|
|
|
424
|
-
|
|
438
|
+
&:not(:has(.capra-TextInput-module-pTHfnG-leadingSlot)) .capra-TextInput-module-pTHfnG-input {
|
|
439
|
+
padding-inline-start: var(--cds2-spacing-md);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
&:not(:has(.capra-TextInput-module-pTHfnG-trailingSlot)) .capra-TextInput-module-pTHfnG-input {
|
|
443
|
+
padding-inline-end: var(--cds2-spacing-md);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
& .capra-TextInput-module-pTHfnG-input {
|
|
425
447
|
height: calc(var(--cds2-dimension-component-md) - 2px);
|
|
426
448
|
font: var(--cds2-typography-body-md-normal);
|
|
427
449
|
}
|
|
450
|
+
|
|
451
|
+
& .capra-TextInput-module-pTHfnG-leadingSlot {
|
|
452
|
+
padding-inline-start: var(--cds2-spacing-md);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
& .capra-TextInput-module-pTHfnG-trailingSlot {
|
|
456
|
+
padding-inline-end: var(--cds2-spacing-md);
|
|
457
|
+
}
|
|
428
458
|
}
|
|
429
459
|
|
|
430
|
-
& .capra-TextInput-module-
|
|
460
|
+
& .capra-TextInput-module-pTHfnG-leadingSlot, & .capra-TextInput-module-pTHfnG-trailingSlot {
|
|
431
461
|
align-items: center;
|
|
432
462
|
gap: var(--cds2-spacing-xs);
|
|
433
463
|
color: var(--cds2-color-foreground-subtle);
|
|
@@ -435,7 +465,7 @@
|
|
|
435
465
|
display: inline-flex;
|
|
436
466
|
}
|
|
437
467
|
|
|
438
|
-
& .capra-TextInput-module-
|
|
468
|
+
& .capra-TextInput-module-pTHfnG-errorIndicator {
|
|
439
469
|
color: var(--cds2-color-foreground-danger-default);
|
|
440
470
|
flex-shrink: 0;
|
|
441
471
|
justify-content: center;
|
|
@@ -443,7 +473,7 @@
|
|
|
443
473
|
display: inline-flex;
|
|
444
474
|
}
|
|
445
475
|
|
|
446
|
-
& .capra-TextInput-module-
|
|
476
|
+
& .capra-TextInput-module-pTHfnG-warningIndicator {
|
|
447
477
|
color: var(--cds2-color-foreground-warning-default);
|
|
448
478
|
flex-shrink: 0;
|
|
449
479
|
justify-content: center;
|
|
@@ -2232,15 +2262,15 @@ input:disabled + .capra-Radio-module-ZI7rzq-inner:after {
|
|
|
2232
2262
|
color: var(--cds2-color-foreground-warning-default);
|
|
2233
2263
|
}
|
|
2234
2264
|
}
|
|
2235
|
-
.capra-Modal-module-
|
|
2265
|
+
.capra-Modal-module-j-u8iq-overlay {
|
|
2236
2266
|
background-color: var(--cds2-color-background-scrim);
|
|
2237
|
-
animation: capra-Modal-module-
|
|
2238
|
-
z-index:
|
|
2267
|
+
animation: capra-Modal-module-j-u8iq-overlayShow var(--cds2-motion-duration-medium-1) var(--cds2-motion-easing-standard);
|
|
2268
|
+
z-index: 10000;
|
|
2239
2269
|
position: fixed;
|
|
2240
2270
|
inset: 0;
|
|
2241
2271
|
}
|
|
2242
2272
|
|
|
2243
|
-
.capra-Modal-module-
|
|
2273
|
+
.capra-Modal-module-j-u8iq-surface {
|
|
2244
2274
|
background-color: var(--cds2-color-background-panel-solid);
|
|
2245
2275
|
border-radius: var(--cds2-radius-lg);
|
|
2246
2276
|
border: var(--cds2-border-default);
|
|
@@ -2248,7 +2278,7 @@ input:disabled + .capra-Radio-module-ZI7rzq-inner:after {
|
|
|
2248
2278
|
box-shadow: var(--cds2-shadow-high-down);
|
|
2249
2279
|
max-width: 100%;
|
|
2250
2280
|
max-height: min(80vh, 100vh - 48px);
|
|
2251
|
-
animation: capra-Modal-module-
|
|
2281
|
+
animation: capra-Modal-module-j-u8iq-contentShow var(--cds2-motion-duration-medium-1) var(--cds2-motion-easing-standard);
|
|
2252
2282
|
flex-direction: column;
|
|
2253
2283
|
padding: 0;
|
|
2254
2284
|
display: flex;
|
|
@@ -2271,7 +2301,7 @@ input:disabled + .capra-Radio-module-ZI7rzq-inner:after {
|
|
|
2271
2301
|
}
|
|
2272
2302
|
}
|
|
2273
2303
|
|
|
2274
|
-
.capra-Modal-module-
|
|
2304
|
+
.capra-Modal-module-j-u8iq-header {
|
|
2275
2305
|
padding: var(--cds2-spacing-md) var(--cds2-spacing-lg);
|
|
2276
2306
|
border-bottom: var(--cds2-border-default);
|
|
2277
2307
|
border-color: var(--cds2-color-border-neutral-subtle);
|
|
@@ -2282,21 +2312,21 @@ input:disabled + .capra-Radio-module-ZI7rzq-inner:after {
|
|
|
2282
2312
|
display: flex;
|
|
2283
2313
|
}
|
|
2284
2314
|
|
|
2285
|
-
.capra-Modal-module-
|
|
2315
|
+
.capra-Modal-module-j-u8iq-headerLeading {
|
|
2286
2316
|
align-items: center;
|
|
2287
2317
|
gap: var(--cds2-spacing-md);
|
|
2288
2318
|
flex: 1;
|
|
2289
2319
|
display: flex;
|
|
2290
2320
|
}
|
|
2291
2321
|
|
|
2292
|
-
.capra-Modal-module-
|
|
2322
|
+
.capra-Modal-module-j-u8iq-expandedTitleLayout {
|
|
2293
2323
|
align-items: center;
|
|
2294
2324
|
gap: var(--cds2-spacing-md);
|
|
2295
2325
|
flex-direction: row;
|
|
2296
2326
|
display: flex;
|
|
2297
2327
|
}
|
|
2298
2328
|
|
|
2299
|
-
.capra-Modal-module-
|
|
2329
|
+
.capra-Modal-module-j-u8iq-content {
|
|
2300
2330
|
padding: var(--cds2-spacing-lg);
|
|
2301
2331
|
flex-direction: column;
|
|
2302
2332
|
flex: 1;
|
|
@@ -2304,14 +2334,14 @@ input:disabled + .capra-Radio-module-ZI7rzq-inner:after {
|
|
|
2304
2334
|
overflow-y: auto;
|
|
2305
2335
|
}
|
|
2306
2336
|
|
|
2307
|
-
.capra-Modal-module-
|
|
2337
|
+
.capra-Modal-module-j-u8iq-footer {
|
|
2308
2338
|
padding: var(--cds2-spacing-md) var(--cds2-spacing-lg);
|
|
2309
2339
|
border-top: var(--cds2-border-default);
|
|
2310
2340
|
border-color: var(--cds2-color-border-neutral-subtle);
|
|
2311
2341
|
background-color: var(--cds2-color-background-neutral-subtle);
|
|
2312
2342
|
}
|
|
2313
2343
|
|
|
2314
|
-
.capra-Modal-module-
|
|
2344
|
+
.capra-Modal-module-j-u8iq-expandedFooterLayout {
|
|
2315
2345
|
justify-content: space-between;
|
|
2316
2346
|
align-items: center;
|
|
2317
2347
|
gap: var(--cds2-spacing-md);
|
|
@@ -2319,7 +2349,7 @@ input:disabled + .capra-Radio-module-ZI7rzq-inner:after {
|
|
|
2319
2349
|
display: flex;
|
|
2320
2350
|
}
|
|
2321
2351
|
|
|
2322
|
-
.capra-Modal-module-
|
|
2352
|
+
.capra-Modal-module-j-u8iq-footerActions {
|
|
2323
2353
|
justify-content: flex-end;
|
|
2324
2354
|
align-items: center;
|
|
2325
2355
|
gap: var(--cds2-spacing-md);
|
|
@@ -2328,20 +2358,20 @@ input:disabled + .capra-Radio-module-ZI7rzq-inner:after {
|
|
|
2328
2358
|
display: flex;
|
|
2329
2359
|
}
|
|
2330
2360
|
|
|
2331
|
-
.capra-Modal-module-
|
|
2361
|
+
.capra-Modal-module-j-u8iq-confirmationSurface {
|
|
2332
2362
|
border-radius: var(--cds2-radius-md);
|
|
2333
2363
|
width: min(400px, 100vw - 48px);
|
|
2334
2364
|
box-shadow: var(--cds2-shadow-high-down);
|
|
2335
2365
|
padding: var(--cds2-spacing-2xl) var(--cds2-spacing-2xl) var(--cds2-spacing-xl);
|
|
2336
2366
|
}
|
|
2337
2367
|
|
|
2338
|
-
.capra-Modal-module-
|
|
2368
|
+
.capra-Modal-module-j-u8iq-confirmationLayout {
|
|
2339
2369
|
align-items: flex-start;
|
|
2340
2370
|
gap: var(--cds2-spacing-lg);
|
|
2341
2371
|
display: flex;
|
|
2342
2372
|
}
|
|
2343
2373
|
|
|
2344
|
-
.capra-Modal-module-
|
|
2374
|
+
.capra-Modal-module-j-u8iq-confirmationIcon {
|
|
2345
2375
|
width: var(--cds2-dimension-component-sm);
|
|
2346
2376
|
height: var(--cds2-dimension-component-sm);
|
|
2347
2377
|
flex-shrink: 0;
|
|
@@ -2370,19 +2400,19 @@ input:disabled + .capra-Radio-module-ZI7rzq-inner:after {
|
|
|
2370
2400
|
}
|
|
2371
2401
|
}
|
|
2372
2402
|
|
|
2373
|
-
.capra-Modal-module-
|
|
2403
|
+
.capra-Modal-module-j-u8iq-confirmationBody {
|
|
2374
2404
|
gap: var(--cds2-spacing-md);
|
|
2375
2405
|
flex-direction: column;
|
|
2376
2406
|
flex: 1;
|
|
2377
2407
|
display: flex;
|
|
2378
2408
|
}
|
|
2379
2409
|
|
|
2380
|
-
.capra-Modal-module-
|
|
2410
|
+
.capra-Modal-module-j-u8iq-confirmationMessage {
|
|
2381
2411
|
font: var(--cds2-typography-body-md-normal);
|
|
2382
2412
|
margin: 0;
|
|
2383
2413
|
}
|
|
2384
2414
|
|
|
2385
|
-
.capra-Modal-module-
|
|
2415
|
+
.capra-Modal-module-j-u8iq-confirmationActions {
|
|
2386
2416
|
justify-content: flex-end;
|
|
2387
2417
|
gap: var(--cds2-spacing-md);
|
|
2388
2418
|
width: 100%;
|
|
@@ -2390,7 +2420,7 @@ input:disabled + .capra-Radio-module-ZI7rzq-inner:after {
|
|
|
2390
2420
|
display: flex;
|
|
2391
2421
|
}
|
|
2392
2422
|
|
|
2393
|
-
@keyframes capra-Modal-module-
|
|
2423
|
+
@keyframes capra-Modal-module-j-u8iq-overlayShow {
|
|
2394
2424
|
from {
|
|
2395
2425
|
opacity: 0;
|
|
2396
2426
|
}
|
|
@@ -2400,7 +2430,7 @@ input:disabled + .capra-Radio-module-ZI7rzq-inner:after {
|
|
|
2400
2430
|
}
|
|
2401
2431
|
}
|
|
2402
2432
|
|
|
2403
|
-
@keyframes capra-Modal-module-
|
|
2433
|
+
@keyframes capra-Modal-module-j-u8iq-contentShow {
|
|
2404
2434
|
from {
|
|
2405
2435
|
opacity: 0;
|
|
2406
2436
|
transform: translate(-50%, -20px) scale(.96);
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Conventions
|
|
2
|
+
|
|
3
|
+
When building and consuming Capra components, we follow specific conventions to maintain a healthy codebase.
|
|
4
|
+
|
|
5
|
+
### Semantic Properties
|
|
6
|
+
|
|
7
|
+
Certain properties of Capra components have well-defined, consistent uses.
|
|
8
|
+
|
|
9
|
+
| Prop | Purpose | Possible Values |
|
|
10
|
+
| ------------ | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------- |
|
|
11
|
+
| `appearance` | Change the colors of a component using semantic intent, e.g. a danger `Button` when deleting | `default`, `info`, `danger`, `warning`, `success`, `highlight` |
|
|
12
|
+
| `color` | Change the color of a component to a specific color, e.g. a teal `Ribbon` | Component-specific |
|
|
13
|
+
| `layout` | Alter the component's layout, e.g. a horizontal input field with label | Component-specific |
|
|
14
|
+
| `size` | Specify the size of the component | `xs`, `sm`, `md`, `lg`, `xl` |
|
|
15
|
+
| `variant` | Specify a different visual treatment for the component, e.g. a dot `Badge` vs. a counter `Badge` | Component-specific |
|
|
16
|
+
|
|
17
|
+
For props where the possible values are pre-defined, a component may utilize the full set or a subset of the possible values.
|
|
18
|
+
|
|
19
|
+
### Styling Overrides
|
|
20
|
+
|
|
21
|
+
Capra components are built according to our design system specifications. They should rarely need to be styled differently than what is provided out-of-the-box. In the event custom styling is required, we provide a consistent escape hatch across all of our components for passing a CSS class name: `FORCE__className`.
|
|
22
|
+
|
|
23
|
+
In your application, you can apply a style override like this:
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { Text } from '@capra/core';
|
|
27
|
+
import styles from './Component.modules.css';
|
|
28
|
+
|
|
29
|
+
export function Component(props) {
|
|
30
|
+
return <Text FORCE__className={styles.text}>Hello world</Text>;
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Note that using this prop should be a rarity. Adding styles here is also somewhat brittle. While we do provide this escape hatch, we make no guarantees that the styles applied will apply correctly across version updates, e.g. a style override targeting a specific HTML structure within a Capra component breaks because the component was refactored to use a different HTML structure. The inner workings of Capra components are implementation details and this escape hatch gives one access to those implementation details. Please use it responsibly.
|
|
35
|
+
|
|
36
|
+
## Client-side Routing
|
|
37
|
+
|
|
38
|
+
Capra components such as `Link` and `ButtonLink` render links that perform navigation when the user interacts with them. Each component that supports link behavior accepts an `href` prop, which is passed to the underlying `<a>` element.
|
|
39
|
+
|
|
40
|
+
By default, links perform native browser navigation when they are interacted with. However, Capra supports overriding this behavior using a client-side router of your choice. Set this up once in the root of your app, and any Capra link component will automatically navigate using your router.
|
|
41
|
+
|
|
42
|
+
Note that external links to different origins will not trigger client side routing, and will use native browser navigation. Additionally, if the link has a target other than `"_self"`, uses the `download` attribute, or the user presses modifier keys such as `Command` or `Alt` to change the default behavior, browser native navigation will occur instead of client side routing.
|
|
43
|
+
|
|
44
|
+
### `RouterProvider`
|
|
45
|
+
|
|
46
|
+
The `RouterProvider` component accepts two props: `navigate` and `useHref`. `navigate` should be set to a function received from your router for performing a client side navigation programmatically. `useHref` is an optional prop that converts a router-specific href to a native HTML href, e.g. prepending a base path. The following example shows the general pattern. Framework-specific examples are shown below.
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import {RouterProvider} from '@capra/core';
|
|
50
|
+
import {useNavigate, useHref} from 'your-router';
|
|
51
|
+
|
|
52
|
+
function App() {
|
|
53
|
+
const navigate = useNavigate();
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<RouterProvider navigate={navigate} useHref={useHref}>
|
|
57
|
+
{/* ... */}
|
|
58
|
+
</RouterProvider>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Router Options
|
|
64
|
+
|
|
65
|
+
All Capra link components accept a `routerOptions` prop, which is an object that is passed through to the client side router's `navigate` function as the second argument. This can be used to control any router-specific behaviors, such as scrolling, replacing instead of pushing to the history, etc.
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
<Link href="/login" routerOptions={{replace: true}}>{/* ...*/}</Link>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
When using TypeScript, you can configure the `RouterConfig` type globally so that all link components have auto complete and type safety using a type provided by your router.
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import type {RouterOptions} from 'your-router';
|
|
75
|
+
|
|
76
|
+
declare module '@capra/core' {
|
|
77
|
+
interface RouterConfig {
|
|
78
|
+
routerOptions: RouterOptions
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### React Router
|
|
84
|
+
|
|
85
|
+
The [useNavigate](https://reactrouter.com/en/main/hooks/use-navigate) hook from `react-router-dom` returns a `navigate` function you can pass to `RouterProvider`. The [useHref](https://reactrouter.com/en/main/hooks/use-href) hook can also be provided if you're using React Router's `basename` option. Ensure that the component that calls `useNavigate` and renders `RouterProvider` is inside the router component (e.g. `BrowserRouter`) so that it has access to React Router's internal context. The React Router `<Routes>` element should also be defined inside Capra's `<RouterProvider>` so that links inside the rendered routes have access to the router.
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
import {BrowserRouter, useNavigate, useHref, type NavigateOptions} from 'react-router-dom';
|
|
89
|
+
import {RouterProvider} from '@capra/core';
|
|
90
|
+
|
|
91
|
+
declare module '@capra/core' {
|
|
92
|
+
interface RouterConfig {
|
|
93
|
+
routerOptions: NavigateOptions
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function App() {
|
|
98
|
+
const navigate = useNavigate();
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<RouterProvider navigate={navigate} useHref={useHref}>
|
|
102
|
+
{/* Your app here... */}
|
|
103
|
+
<Routes>
|
|
104
|
+
<Route path="/" element={<HomePage />} />
|
|
105
|
+
{/* ... */}
|
|
106
|
+
</Routes>
|
|
107
|
+
</RouterProvider>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
<BrowserRouter>
|
|
112
|
+
<App />
|
|
113
|
+
</BrowserRouter>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Next.js App Router
|
|
117
|
+
|
|
118
|
+
The [useRouter](https://nextjs.org/docs/app/api-reference/functions/use-router) hook from `next/navigation` returns a router object that can be used to perform navigation. `RouterProvider` should be rendered from a client component at the root of each page or layout that includes Capra links. You can create a new client component for this, or combine it with other top-level providers as described in the [Next.js docs](https://nextjs.org/docs/app/building-your-application/rendering/composition-patterns#using-context-providers).
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
// app/provider.tsx
|
|
122
|
+
"use client";
|
|
123
|
+
|
|
124
|
+
import {useRouter} from 'next/navigation';
|
|
125
|
+
import {RouterProvider} from '@capra/core';
|
|
126
|
+
|
|
127
|
+
declare module '@capra/core' {
|
|
128
|
+
interface RouterConfig {
|
|
129
|
+
routerOptions: NonNullable<Parameters<ReturnType<typeof useRouter>['push']>[1]>
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function ClientProviders({children}) {
|
|
134
|
+
const router = useRouter();
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<RouterProvider navigate={router.push}>
|
|
138
|
+
{children}
|
|
139
|
+
</RouterProvider>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Then, in your page or layout server component, wrap your app in the `ClientProviders` component that you defined.
|
|
145
|
+
|
|
146
|
+
```tsx
|
|
147
|
+
// app/layout.tsx
|
|
148
|
+
import {ClientProviders} from './provider';
|
|
149
|
+
|
|
150
|
+
export default function RootLayout({children}) {
|
|
151
|
+
return (
|
|
152
|
+
<html>
|
|
153
|
+
<body>
|
|
154
|
+
<ClientProviders>{children}</ClientProviders>
|
|
155
|
+
</body>
|
|
156
|
+
</html>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Next.js Pages Router
|
|
162
|
+
|
|
163
|
+
The [useRouter](https://nextjs.org/docs/pages/api-reference/functions/use-router) hook from `next/router` returns a router object that can be used to perform navigation. `RouterProvider` should be rendered at the root of each page that includes Capra links, or in `pages/_app.tsx` to add it to all pages.
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
// pages/_app.tsx
|
|
167
|
+
import type { AppProps } from 'next/app';
|
|
168
|
+
import {useRouter, type NextRouter} from 'next/router';
|
|
169
|
+
import {RouterProvider} from '@capra/core';
|
|
170
|
+
|
|
171
|
+
declare module '@capra/core' {
|
|
172
|
+
interface RouterConfig {
|
|
173
|
+
routerOptions: NonNullable<Parameters<NextRouter['push']>[2]>
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export default function MyApp({Component, pageProps}: AppProps) {
|
|
178
|
+
const router = useRouter();
|
|
179
|
+
|
|
180
|
+
return (
|
|
181
|
+
<RouterProvider navigate={(href, opts) => router.push(href, undefined, opts)}>
|
|
182
|
+
<Component {...pageProps} />
|
|
183
|
+
</RouterProvider>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
```
|