@ndla/ui 56.0.160-alpha.0 → 56.0.163-alpha.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/panda.buildinfo.json +4 -8
- package/dist/styles.css +6 -22
- package/es/Grid/Grid.mjs +19 -11
- package/es/Grid/Grid.mjs.map +1 -1
- package/es/index.mjs +2 -3
- package/lib/Gloss/Gloss.d.ts +2 -2
- package/lib/Grid/Grid.d.ts +17 -5
- package/lib/Grid/Grid.js +19 -10
- package/lib/Grid/Grid.js.map +1 -1
- package/lib/index.d.ts +2 -3
- package/lib/index.js +1 -2
- package/package.json +11 -11
- package/src/Concept/Concept.stories.tsx +1 -0
- package/src/ContactBlock/ContactBlock.stories.tsx +1 -0
- package/src/Embed/AudioEmbed.stories.tsx +1 -0
- package/src/Embed/ConceptEmbed.stories.tsx +1 -0
- package/src/Embed/ExternalEmbed.stories.tsx +1 -0
- package/src/Embed/IframeEmbed.stories.tsx +1 -0
- package/src/Embed/ImageEmbed.stories.tsx +1 -0
- package/src/Grid/Grid.stories.tsx +35 -7
- package/src/Grid/Grid.tsx +32 -19
- package/src/Pitch/Pitch.stories.tsx +3 -3
- package/src/index.ts +2 -3
- package/es/Grid/GridParallaxItem.mjs +0 -21
- package/es/Grid/GridParallaxItem.mjs.map +0 -1
- package/lib/Grid/GridParallaxItem.d.ts +0 -9
- package/lib/Grid/GridParallaxItem.js +0 -29
- package/lib/Grid/GridParallaxItem.js.map +0 -1
- package/src/Grid/GridParallaxItem.tsx +0 -26
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"schemaVersion": "1.
|
|
2
|
+
"schemaVersion": "1.7.0",
|
|
3
3
|
"styles": {
|
|
4
4
|
"atomic": [
|
|
5
5
|
"background]___[value:background.default",
|
|
@@ -294,10 +294,9 @@
|
|
|
294
294
|
"fontStyle]___[value:italic",
|
|
295
295
|
"gridRowGap]___[value:large",
|
|
296
296
|
"gridColumnGap]___[value:medium",
|
|
297
|
-
"backgroundColor]___[value:background.subtle",
|
|
298
297
|
"gridTemplateColumns]___[value:repeat(2, minmax(0, 1fr))",
|
|
299
|
-
"height]___[value:100%]___[cond:&
|
|
300
|
-
"marginTop]___[value:auto]___[cond:&
|
|
298
|
+
"height]___[value:100%]___[cond:& div[data-embed-type='pitch']",
|
|
299
|
+
"marginTop]___[value:auto]___[cond:& div[data-embed-type='pitch']<___>& > :last-child",
|
|
301
300
|
"gridTemplateColumns]___[value:repeat(1, minmax(0, 1fr))]___[cond:tabletDown",
|
|
302
301
|
"gridTemplateColumns]___[value:repeat(2, minmax(0, 1fr))]___[cond:tabletToDesktop",
|
|
303
302
|
"display]___[value:flex]___[cond:tabletToDesktop<___>& > div:nth-child(3):last-child",
|
|
@@ -307,11 +306,8 @@
|
|
|
307
306
|
"gridColumn]___[value:span 2]___[cond:tabletToDesktop<___>& > div:nth-child(3):last-child",
|
|
308
307
|
"gridTemplateColumns]___[value:repeat(3, minmax(0, 1fr))]___[cond:desktop",
|
|
309
308
|
"gridTemplateColumns]___[value:repeat(4, minmax(0, 1fr))]___[cond:desktop",
|
|
310
|
-
"backgroundColor]___[value:surface.default",
|
|
311
|
-
"backgroundColor]___[value:transparent",
|
|
312
309
|
"borderColor]___[value:surface.brand.2",
|
|
313
|
-
"
|
|
314
|
-
"position]___[value:sticky]___[cond:& > div",
|
|
310
|
+
"outline]___[value:1px solid",
|
|
315
311
|
"paddingBlock]___[value:xxlarge]___[cond:&:not(:has(> img))",
|
|
316
312
|
"width]___[value:surface.3xsmall",
|
|
317
313
|
"textStyle]___[value:heading.large",
|
package/dist/styles.css
CHANGED
|
@@ -316,6 +316,10 @@
|
|
|
316
316
|
border-color: var(--colors-surface-brand-2);
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
+
.ring_1px_solid {
|
|
320
|
+
outline: 1px solid;
|
|
321
|
+
}
|
|
322
|
+
|
|
319
323
|
.bd-c_stroke\.error {
|
|
320
324
|
border-color: var(--colors-stroke-error);
|
|
321
325
|
}
|
|
@@ -587,22 +591,10 @@
|
|
|
587
591
|
grid-column-gap: var(--spacing-medium);
|
|
588
592
|
}
|
|
589
593
|
|
|
590
|
-
.bg-c_background\.subtle {
|
|
591
|
-
background-color: var(--colors-background-subtle);
|
|
592
|
-
}
|
|
593
|
-
|
|
594
594
|
.grid-tc_repeat\(2\,_minmax\(0\,_1fr\)\) {
|
|
595
595
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
596
596
|
}
|
|
597
597
|
|
|
598
|
-
.bg-c_surface\.default {
|
|
599
|
-
background-color: var(--colors-surface-default);
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
.bg-c_transparent {
|
|
603
|
-
background-color: transparent;
|
|
604
|
-
}
|
|
605
|
-
|
|
606
598
|
.c_text\.subtle {
|
|
607
599
|
color: var(--colors-text-subtle);
|
|
608
600
|
}
|
|
@@ -1007,10 +999,6 @@
|
|
|
1007
999
|
z-index: 0;
|
|
1008
1000
|
}
|
|
1009
1001
|
|
|
1010
|
-
.\[\&_\>_div\]\:pos_sticky > div {
|
|
1011
|
-
position: sticky;
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
1002
|
.\[\&_\[data-forward\]\]\:trs-prop_width\,_height [data-forward] {
|
|
1015
1003
|
--transition-prop: width, height;
|
|
1016
1004
|
transition-property: width, height;
|
|
@@ -1078,14 +1066,10 @@
|
|
|
1078
1066
|
min-height: var(--sizes-surface-3xsmall);
|
|
1079
1067
|
}
|
|
1080
1068
|
|
|
1081
|
-
.\[\&
|
|
1069
|
+
.\[\&_div\[data-embed-type\=\'pitch\'\]\]\:h_100\% div[data-embed-type='pitch'] {
|
|
1082
1070
|
height: 100%;
|
|
1083
1071
|
}
|
|
1084
1072
|
|
|
1085
|
-
.\[\&_\>_div\]\:top_var\(--masthead-height\,_0px\) > div {
|
|
1086
|
-
top: var(--masthead-height, 0px);
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
1073
|
.focusWithin\:td_none:focus-within {
|
|
1090
1074
|
text-decoration: none;
|
|
1091
1075
|
}
|
|
@@ -1151,7 +1135,7 @@
|
|
|
1151
1135
|
font-weight: var(--font-weights-bold);
|
|
1152
1136
|
}
|
|
1153
1137
|
|
|
1154
|
-
.\[\&
|
|
1138
|
+
.\[\&_div\[data-embed-type\=\'pitch\'\]\]\:\[\&_\>_\:last-child\]\:mt_auto div[data-embed-type='pitch'] > :last-child {
|
|
1155
1139
|
margin-top: auto;
|
|
1156
1140
|
}
|
|
1157
1141
|
|
package/es/Grid/Grid.mjs
CHANGED
|
@@ -11,10 +11,9 @@ const GridContainer = styled("div", {
|
|
|
11
11
|
gridRowGap: "large",
|
|
12
12
|
gridColumnGap: "medium",
|
|
13
13
|
width: "100%",
|
|
14
|
-
backgroundColor: "background.subtle",
|
|
15
14
|
minWidth: "surface.xxsmall",
|
|
16
15
|
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
|
|
17
|
-
"&
|
|
16
|
+
"& div[data-embed-type='pitch']": {
|
|
18
17
|
height: "100%",
|
|
19
18
|
"& > :last-child": { marginTop: "auto" }
|
|
20
19
|
},
|
|
@@ -37,11 +36,6 @@ const GridContainer = styled("div", {
|
|
|
37
36
|
"3": { desktop: { gridTemplateColumns: "repeat(3, minmax(0, 1fr))" } },
|
|
38
37
|
"4": { desktop: { gridTemplateColumns: "repeat(4, minmax(0, 1fr))" } }
|
|
39
38
|
},
|
|
40
|
-
background: {
|
|
41
|
-
white: { backgroundColor: "surface.default" },
|
|
42
|
-
transparent: { backgroundColor: "transparent" },
|
|
43
|
-
gray: { backgroundColor: "background.subtle" }
|
|
44
|
-
},
|
|
45
39
|
border: { lightBlue: {
|
|
46
40
|
padding: "xsmall",
|
|
47
41
|
border: "1px solid",
|
|
@@ -49,18 +43,32 @@ const GridContainer = styled("div", {
|
|
|
49
43
|
} }
|
|
50
44
|
}
|
|
51
45
|
});
|
|
52
|
-
const
|
|
46
|
+
const StyledGridItem = styled("div", {
|
|
47
|
+
base: {},
|
|
48
|
+
variants: { border: { true: {
|
|
49
|
+
outline: "1px solid",
|
|
50
|
+
borderColor: "stroke.default"
|
|
51
|
+
} } }
|
|
52
|
+
});
|
|
53
|
+
const Grid = ({ columns, border, children, ...rest }) => {
|
|
53
54
|
const amountOfColumns = children?.length === 3 ? "3" : columns;
|
|
54
55
|
return /* @__PURE__ */ jsx(GridContainer, {
|
|
55
56
|
"data-embed-type": "grid",
|
|
56
|
-
border
|
|
57
|
+
border,
|
|
57
58
|
columns: amountOfColumns,
|
|
58
|
-
|
|
59
|
+
...rest,
|
|
60
|
+
children
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const GridItem = ({ border, children, ...rest }) => {
|
|
64
|
+
return /* @__PURE__ */ jsx(StyledGridItem, {
|
|
65
|
+
"data-embed-type": "grid-item",
|
|
66
|
+
border,
|
|
59
67
|
...rest,
|
|
60
68
|
children
|
|
61
69
|
});
|
|
62
70
|
};
|
|
63
71
|
|
|
64
72
|
//#endregion
|
|
65
|
-
export { Grid };
|
|
73
|
+
export { Grid, GridItem };
|
|
66
74
|
//# sourceMappingURL=Grid.mjs.map
|
package/es/Grid/Grid.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grid.mjs","names":[],"sources":["../../src/Grid/Grid.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ComponentProps, type ReactNode } from \"react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nconst GridContainer = styled(\"div\", {\n base: {\n display: \"grid\",\n justifyContent: \"center\",\n borderRadius: \"xsmall\",\n gridRowGap: \"large\",\n gridColumnGap: \"medium\",\n width: \"100%\",\n
|
|
1
|
+
{"version":3,"file":"Grid.mjs","names":[],"sources":["../../src/Grid/Grid.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ComponentProps, type ReactNode } from \"react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledVariantProps } from \"@ndla/styled-system/types\";\n\nconst GridContainer = styled(\"div\", {\n base: {\n display: \"grid\",\n justifyContent: \"center\",\n borderRadius: \"xsmall\",\n gridRowGap: \"large\",\n gridColumnGap: \"medium\",\n width: \"100%\",\n minWidth: \"surface.xxsmall\",\n gridTemplateColumns: \"repeat(2, minmax(0, 1fr))\",\n\n \"& div[data-embed-type='pitch']\": {\n height: \"100%\",\n \"& > :last-child\": {\n marginTop: \"auto\",\n },\n },\n tabletDown: {\n gridTemplateColumns: \"repeat(1, minmax(0, 1fr))\",\n },\n tabletToDesktop: {\n gridTemplateColumns: \"repeat(2, minmax(0, 1fr))\",\n \"& > div:nth-child(3):last-child\": {\n display: \"flex\",\n flexFlow: \"column\",\n justifyContent: \"center\",\n alignItems: \"center\",\n gridColumn: \"span 2\",\n },\n },\n },\n variants: {\n columns: {\n \"2\": {},\n \"2x2\": {},\n \"3\": { desktop: { gridTemplateColumns: \"repeat(3, minmax(0, 1fr))\" } },\n \"4\": { desktop: { gridTemplateColumns: \"repeat(4, minmax(0, 1fr))\" } },\n },\n border: {\n lightBlue: {\n padding: \"xsmall\",\n border: \"1px solid\",\n borderColor: \"surface.brand.2\",\n },\n },\n },\n});\n\nconst StyledGridItem = styled(\"div\", {\n base: {},\n variants: {\n border: {\n true: {\n outline: \"1px solid\",\n borderColor: \"stroke.default\",\n },\n },\n },\n});\n\ntype GridVariantProps = NonNullable<StyledVariantProps<typeof GridContainer>>;\n\nexport interface GridProps extends ComponentProps<\"div\">, GridVariantProps {\n children?: ReactNode[];\n columns: NonNullable<GridVariantProps[\"columns\"]>;\n}\n\ntype GridItemVariantProps = NonNullable<StyledVariantProps<typeof StyledGridItem>>;\n\nexport interface GridItemProps extends ComponentProps<\"div\">, GridItemVariantProps {}\n\nexport const Grid = ({ columns, border, children, ...rest }: GridProps) => {\n const amountOfColumns = children?.length === 3 ? \"3\" : columns;\n\n return (\n <GridContainer data-embed-type=\"grid\" border={border} columns={amountOfColumns} {...rest}>\n {children}\n </GridContainer>\n );\n};\n\nexport const GridItem = ({ border, children, ...rest }: GridItemProps) => {\n return (\n <StyledGridItem data-embed-type=\"grid-item\" border={border} {...rest}>\n {children}\n </StyledGridItem>\n );\n};\n"],"mappings":";;;;;AAYA,MAAM,gBAAgB,OAAO,OAAO;CAClC,MAAM;EACJ,SAAS;EACT,gBAAgB;EAChB,cAAc;EACd,YAAY;EACZ,eAAe;EACf,OAAO;EACP,UAAU;EACV,qBAAqB;EAErB,kCAAkC;GAChC,QAAQ;GACR,mBAAmB,EACjB,WAAW,QACZ;GACF;EACD,YAAY,EACV,qBAAqB,6BACtB;EACD,iBAAiB;GACf,qBAAqB;GACrB,mCAAmC;IACjC,SAAS;IACT,UAAU;IACV,gBAAgB;IAChB,YAAY;IACZ,YAAY;IACb;GACF;EACF;CACD,UAAU;EACR,SAAS;GACP,KAAK,EAAE;GACP,OAAO,EAAE;GACT,KAAK,EAAE,SAAS,EAAE,qBAAqB,6BAA6B,EAAE;GACtE,KAAK,EAAE,SAAS,EAAE,qBAAqB,6BAA6B,EAAE;GACvE;EACD,QAAQ,EACN,WAAW;GACT,SAAS;GACT,QAAQ;GACR,aAAa;GACd,EACF;EACF;CACF,CAAC;AAEF,MAAM,iBAAiB,OAAO,OAAO;CACnC,MAAM,EAAE;CACR,UAAU,EACR,QAAQ,EACN,MAAM;EACJ,SAAS;EACT,aAAa;EACd,EACF,EACF;CACF,CAAC;AAaF,MAAa,QAAQ,EAAE,SAAS,QAAQ,UAAU,GAAG,WAAsB;CACzE,MAAM,kBAAkB,UAAU,WAAW,IAAI,MAAM;AAEvD,QACE,oBAAC;EAAc,mBAAgB;EAAe;EAAQ,SAAS;EAAiB,GAAI;EACjF;GACa;;AAIpB,MAAa,YAAY,EAAE,QAAQ,UAAU,GAAG,WAA0B;AACxE,QACE,oBAAC;EAAe,mBAAgB;EAAoB;EAAQ,GAAI;EAC7D;GACc"}
|
package/es/index.mjs
CHANGED
|
@@ -55,10 +55,9 @@ import { Pitch } from "./Pitch/Pitch.mjs";
|
|
|
55
55
|
import { KeyFigure } from "./KeyFigure/KeyFigure.mjs";
|
|
56
56
|
import { ContactBlock, contactBlockBackgrounds } from "./ContactBlock/ContactBlock.mjs";
|
|
57
57
|
import { CampaignBlock } from "./CampaignBlock/CampaignBlock.mjs";
|
|
58
|
-
import { Grid } from "./Grid/Grid.mjs";
|
|
59
|
-
import { GridParallaxItem } from "./Grid/GridParallaxItem.mjs";
|
|
58
|
+
import { Grid, GridItem } from "./Grid/Grid.mjs";
|
|
60
59
|
import { LinkBlock } from "./LinkBlock/LinkBlock.mjs";
|
|
61
60
|
import { LinkBlockSection } from "./LinkBlock/LinkBlockSection.mjs";
|
|
62
61
|
import { ZendeskButton } from "./ZendeskButton/ZendeskButton.mjs";
|
|
63
62
|
|
|
64
|
-
export { Article, ArticleByline, ArticleBylineAccordionItem, ArticleContent, ArticleFootNotes, ArticleFooter, ArticleHGroup, ArticleHeader, ArticleTitle, ArticleWrapper, AudioEmbed, AudioPlayer, BadgesContainer, BlockConcept, Breadcrumb, BrightcoveEmbed, CampaignBlock, CodeBlock, CodeEmbed, Concept, ConceptEmbed, ConceptInlineTriggerButton, ContactBlock, ContentLinkEmbed, ContentTypeBadge, CopyParagraphButton, CopyrightEmbed, EmbedByline, EmbedWrapper, ExternalEmbed, FactBox, File, FileListElement, FileListEmbed, FileListItem, FileListWrapper, FootnoteEmbed, Gloss, GlossExample, Grid,
|
|
63
|
+
export { Article, ArticleByline, ArticleBylineAccordionItem, ArticleContent, ArticleFootNotes, ArticleFooter, ArticleHGroup, ArticleHeader, ArticleTitle, ArticleWrapper, AudioEmbed, AudioPlayer, BadgesContainer, BlockConcept, Breadcrumb, BrightcoveEmbed, CampaignBlock, CodeBlock, CodeEmbed, Concept, ConceptEmbed, ConceptInlineTriggerButton, ContactBlock, ContentLinkEmbed, ContentTypeBadge, CopyParagraphButton, CopyrightEmbed, EmbedByline, EmbedWrapper, ExternalEmbed, FactBox, File, FileListElement, FileListEmbed, FileListItem, FileListWrapper, FootnoteEmbed, Gloss, GlossExample, Grid, GridItem, H5pEmbed, HomeBreadcrumb, IframeEmbed, ImageEmbed, InlineConcept, InlineTriggerButton, KeyFigure, LicenseLink, LinkBlock, LinkBlockSection, PdfFile, Pitch, RelatedArticle, RelatedArticleList, RelatedContentEmbed, ResourceBox, TagSelectorClearTrigger, TagSelectorControl, TagSelectorInput, TagSelectorInputBase, TagSelectorItemInput, TagSelectorLabel, TagSelectorRoot, TagSelectorTrigger, UnknownEmbed, UuDisclaimerEmbed, ZendeskButton, codeLanguageOptions, constants, contactBlockBackgrounds, contentTypeMapping, contentTypeToBadgeVariantMap, contentTypes, formatNestedMessages, getCrop, getFocalPoint, getPossiblyRelativeUrl, licenseAttributes, messages_en_default as messagesEN, messages_nb_default as messagesNB, messages_nn_default as messagesNN, messages_se_default as messagesSE, resourceEmbedTypeMapping, subjectCategories, subjectTypes, useAudioSearchTranslations, useComboboxTranslations, useDatePickerTranslations, useImageSearchTranslations, usePaginationTranslations, useTagSelectorTranslations, useTagsInputTranslations, useVideoSearchTranslations, wordClass };
|
package/lib/Gloss/Gloss.d.ts
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { StyledVariantProps } from "@ndla/styled-system/types";
|
|
9
9
|
import type { ConceptTitleDTO, GlossDataDTO } from "@ndla/types-backend/concept-api";
|
|
10
|
-
declare const StyledAccordionItem: import("@ndla/styled-system/types").StyledComponent<import("react").ComponentClass<import("@ndla/styled-system/types").JsxHTMLProps<import("@ark-ui/react").AccordionItemProps & import("react").RefAttributes<HTMLDivElement> & import("@ndla/styled-system/jsx").UnstyledProps, import("@ndla/styled-system/types").JsxStyleProps>, any>, {
|
|
10
|
+
declare const StyledAccordionItem: import("@ndla/styled-system/types").StyledComponent<import("react").ComponentClass<import("@ndla/styled-system/types").JsxHTMLProps<import("@ark-ui/react").AccordionItemProps & import("react").RefAttributes<HTMLDivElement> & import("@ndla/styled-system/jsx").UnstyledProps & import("@ndla/styled-system/types").AsProps, import("@ndla/styled-system/types").JsxStyleProps>, any>, {
|
|
11
11
|
variant?: "simple" | "bordered" | undefined;
|
|
12
|
-
}> | import("@ndla/styled-system/types").StyledComponent<import("react").FunctionComponent<import("@ndla/styled-system/types").JsxHTMLProps<import("@ark-ui/react").AccordionItemProps & import("react").RefAttributes<HTMLDivElement> & import("@ndla/styled-system/jsx").UnstyledProps, import("@ndla/styled-system/types").JsxStyleProps>>, {
|
|
12
|
+
}> | import("@ndla/styled-system/types").StyledComponent<import("react").FunctionComponent<import("@ndla/styled-system/types").JsxHTMLProps<import("@ark-ui/react").AccordionItemProps & import("react").RefAttributes<HTMLDivElement> & import("@ndla/styled-system/jsx").UnstyledProps & import("@ndla/styled-system/types").AsProps, import("@ndla/styled-system/types").JsxStyleProps>>, {
|
|
13
13
|
variant?: "simple" | "bordered" | undefined;
|
|
14
14
|
}>;
|
|
15
15
|
type GlossVariantProps = StyledVariantProps<typeof StyledAccordionItem>;
|
package/lib/Grid/Grid.d.ts
CHANGED
|
@@ -6,10 +6,22 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
import { type ComponentProps, type ReactNode } from "react";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
import type { StyledVariantProps } from "@ndla/styled-system/types";
|
|
10
|
+
declare const GridContainer: import("@ndla/styled-system/types").StyledComponent<"div", {
|
|
11
|
+
columns?: "2" | "3" | "4" | "2x2" | undefined;
|
|
12
|
+
border?: "lightBlue" | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
declare const StyledGridItem: import("@ndla/styled-system/types").StyledComponent<"div", {
|
|
15
|
+
border?: boolean | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
type GridVariantProps = NonNullable<StyledVariantProps<typeof GridContainer>>;
|
|
18
|
+
export interface GridProps extends ComponentProps<"div">, GridVariantProps {
|
|
13
19
|
children?: ReactNode[];
|
|
20
|
+
columns: NonNullable<GridVariantProps["columns"]>;
|
|
14
21
|
}
|
|
15
|
-
|
|
22
|
+
type GridItemVariantProps = NonNullable<StyledVariantProps<typeof StyledGridItem>>;
|
|
23
|
+
export interface GridItemProps extends ComponentProps<"div">, GridItemVariantProps {
|
|
24
|
+
}
|
|
25
|
+
export declare const Grid: ({ columns, border, children, ...rest }: GridProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export declare const GridItem: ({ border, children, ...rest }: GridItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export {};
|
package/lib/Grid/Grid.js
CHANGED
|
@@ -19,10 +19,9 @@ const GridContainer = (0, __ndla_styled_system_jsx.styled)("div", {
|
|
|
19
19
|
gridRowGap: "large",
|
|
20
20
|
gridColumnGap: "medium",
|
|
21
21
|
width: "100%",
|
|
22
|
-
backgroundColor: "background.subtle",
|
|
23
22
|
minWidth: "surface.xxsmall",
|
|
24
23
|
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
|
|
25
|
-
"&
|
|
24
|
+
"& div[data-embed-type='pitch']": {
|
|
26
25
|
height: "100%",
|
|
27
26
|
"& > :last-child": { marginTop: "auto" }
|
|
28
27
|
},
|
|
@@ -45,11 +44,6 @@ const GridContainer = (0, __ndla_styled_system_jsx.styled)("div", {
|
|
|
45
44
|
"3": { desktop: { gridTemplateColumns: "repeat(3, minmax(0, 1fr))" } },
|
|
46
45
|
"4": { desktop: { gridTemplateColumns: "repeat(4, minmax(0, 1fr))" } }
|
|
47
46
|
},
|
|
48
|
-
background: {
|
|
49
|
-
white: { backgroundColor: "surface.default" },
|
|
50
|
-
transparent: { backgroundColor: "transparent" },
|
|
51
|
-
gray: { backgroundColor: "background.subtle" }
|
|
52
|
-
},
|
|
53
47
|
border: { lightBlue: {
|
|
54
48
|
padding: "xsmall",
|
|
55
49
|
border: "1px solid",
|
|
@@ -57,13 +51,27 @@ const GridContainer = (0, __ndla_styled_system_jsx.styled)("div", {
|
|
|
57
51
|
} }
|
|
58
52
|
}
|
|
59
53
|
});
|
|
60
|
-
const
|
|
54
|
+
const StyledGridItem = (0, __ndla_styled_system_jsx.styled)("div", {
|
|
55
|
+
base: {},
|
|
56
|
+
variants: { border: { true: {
|
|
57
|
+
outline: "1px solid",
|
|
58
|
+
borderColor: "stroke.default"
|
|
59
|
+
} } }
|
|
60
|
+
});
|
|
61
|
+
const Grid = ({ columns, border, children, ...rest }) => {
|
|
61
62
|
const amountOfColumns = children?.length === 3 ? "3" : columns;
|
|
62
63
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GridContainer, {
|
|
63
64
|
"data-embed-type": "grid",
|
|
64
|
-
border
|
|
65
|
+
border,
|
|
65
66
|
columns: amountOfColumns,
|
|
66
|
-
|
|
67
|
+
...rest,
|
|
68
|
+
children
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
const GridItem = ({ border, children, ...rest }) => {
|
|
72
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledGridItem, {
|
|
73
|
+
"data-embed-type": "grid-item",
|
|
74
|
+
border,
|
|
67
75
|
...rest,
|
|
68
76
|
children
|
|
69
77
|
});
|
|
@@ -71,4 +79,5 @@ const Grid = ({ columns, border, children, background = "gray", ...rest }) => {
|
|
|
71
79
|
|
|
72
80
|
//#endregion
|
|
73
81
|
exports.Grid = Grid;
|
|
82
|
+
exports.GridItem = GridItem;
|
|
74
83
|
//# sourceMappingURL=Grid.js.map
|
package/lib/Grid/Grid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grid.js","names":[],"sources":["../../src/Grid/Grid.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ComponentProps, type ReactNode } from \"react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nconst GridContainer = styled(\"div\", {\n base: {\n display: \"grid\",\n justifyContent: \"center\",\n borderRadius: \"xsmall\",\n gridRowGap: \"large\",\n gridColumnGap: \"medium\",\n width: \"100%\",\n
|
|
1
|
+
{"version":3,"file":"Grid.js","names":[],"sources":["../../src/Grid/Grid.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ComponentProps, type ReactNode } from \"react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledVariantProps } from \"@ndla/styled-system/types\";\n\nconst GridContainer = styled(\"div\", {\n base: {\n display: \"grid\",\n justifyContent: \"center\",\n borderRadius: \"xsmall\",\n gridRowGap: \"large\",\n gridColumnGap: \"medium\",\n width: \"100%\",\n minWidth: \"surface.xxsmall\",\n gridTemplateColumns: \"repeat(2, minmax(0, 1fr))\",\n\n \"& div[data-embed-type='pitch']\": {\n height: \"100%\",\n \"& > :last-child\": {\n marginTop: \"auto\",\n },\n },\n tabletDown: {\n gridTemplateColumns: \"repeat(1, minmax(0, 1fr))\",\n },\n tabletToDesktop: {\n gridTemplateColumns: \"repeat(2, minmax(0, 1fr))\",\n \"& > div:nth-child(3):last-child\": {\n display: \"flex\",\n flexFlow: \"column\",\n justifyContent: \"center\",\n alignItems: \"center\",\n gridColumn: \"span 2\",\n },\n },\n },\n variants: {\n columns: {\n \"2\": {},\n \"2x2\": {},\n \"3\": { desktop: { gridTemplateColumns: \"repeat(3, minmax(0, 1fr))\" } },\n \"4\": { desktop: { gridTemplateColumns: \"repeat(4, minmax(0, 1fr))\" } },\n },\n border: {\n lightBlue: {\n padding: \"xsmall\",\n border: \"1px solid\",\n borderColor: \"surface.brand.2\",\n },\n },\n },\n});\n\nconst StyledGridItem = styled(\"div\", {\n base: {},\n variants: {\n border: {\n true: {\n outline: \"1px solid\",\n borderColor: \"stroke.default\",\n },\n },\n },\n});\n\ntype GridVariantProps = NonNullable<StyledVariantProps<typeof GridContainer>>;\n\nexport interface GridProps extends ComponentProps<\"div\">, GridVariantProps {\n children?: ReactNode[];\n columns: NonNullable<GridVariantProps[\"columns\"]>;\n}\n\ntype GridItemVariantProps = NonNullable<StyledVariantProps<typeof StyledGridItem>>;\n\nexport interface GridItemProps extends ComponentProps<\"div\">, GridItemVariantProps {}\n\nexport const Grid = ({ columns, border, children, ...rest }: GridProps) => {\n const amountOfColumns = children?.length === 3 ? \"3\" : columns;\n\n return (\n <GridContainer data-embed-type=\"grid\" border={border} columns={amountOfColumns} {...rest}>\n {children}\n </GridContainer>\n );\n};\n\nexport const GridItem = ({ border, children, ...rest }: GridItemProps) => {\n return (\n <StyledGridItem data-embed-type=\"grid-item\" border={border} {...rest}>\n {children}\n </StyledGridItem>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,qDAAuB,OAAO;CAClC,MAAM;EACJ,SAAS;EACT,gBAAgB;EAChB,cAAc;EACd,YAAY;EACZ,eAAe;EACf,OAAO;EACP,UAAU;EACV,qBAAqB;EAErB,kCAAkC;GAChC,QAAQ;GACR,mBAAmB,EACjB,WAAW,QACZ;GACF;EACD,YAAY,EACV,qBAAqB,6BACtB;EACD,iBAAiB;GACf,qBAAqB;GACrB,mCAAmC;IACjC,SAAS;IACT,UAAU;IACV,gBAAgB;IAChB,YAAY;IACZ,YAAY;IACb;GACF;EACF;CACD,UAAU;EACR,SAAS;GACP,KAAK,EAAE;GACP,OAAO,EAAE;GACT,KAAK,EAAE,SAAS,EAAE,qBAAqB,6BAA6B,EAAE;GACtE,KAAK,EAAE,SAAS,EAAE,qBAAqB,6BAA6B,EAAE;GACvE;EACD,QAAQ,EACN,WAAW;GACT,SAAS;GACT,QAAQ;GACR,aAAa;GACd,EACF;EACF;CACF,CAAC;AAEF,MAAM,sDAAwB,OAAO;CACnC,MAAM,EAAE;CACR,UAAU,EACR,QAAQ,EACN,MAAM;EACJ,SAAS;EACT,aAAa;EACd,EACF,EACF;CACF,CAAC;AAaF,MAAa,QAAQ,EAAE,SAAS,QAAQ,UAAU,GAAG,WAAsB;CACzE,MAAM,kBAAkB,UAAU,WAAW,IAAI,MAAM;AAEvD,QACE,2CAAC;EAAc,mBAAgB;EAAe;EAAQ,SAAS;EAAiB,GAAI;EACjF;GACa;;AAIpB,MAAa,YAAY,EAAE,QAAQ,UAAU,GAAG,WAA0B;AACxE,QACE,2CAAC;EAAe,mBAAgB;EAAoB;EAAQ,GAAI;EAC7D;GACc"}
|
package/lib/index.d.ts
CHANGED
|
@@ -63,9 +63,8 @@ export { KeyFigure } from "./KeyFigure/KeyFigure";
|
|
|
63
63
|
export { ContactBlock, contactBlockBackgrounds } from "./ContactBlock/ContactBlock";
|
|
64
64
|
export type { ContactBlockBackground } from "./ContactBlock/ContactBlock";
|
|
65
65
|
export { CampaignBlock } from "./CampaignBlock/CampaignBlock";
|
|
66
|
-
export { Grid } from "./Grid/Grid";
|
|
67
|
-
export {
|
|
68
|
-
export type { GridProps as GridType } from "./Grid/Grid";
|
|
66
|
+
export { Grid, GridItem } from "./Grid/Grid";
|
|
67
|
+
export type { GridProps as GridType, GridItemProps } from "./Grid/Grid";
|
|
69
68
|
export { Gloss } from "./Gloss/Gloss";
|
|
70
69
|
export { GlossExample } from "./Gloss/GlossExample";
|
|
71
70
|
export { LinkBlock } from "./LinkBlock/LinkBlock";
|
package/lib/index.js
CHANGED
|
@@ -56,7 +56,6 @@ const require_KeyFigure = require('./KeyFigure/KeyFigure.js');
|
|
|
56
56
|
const require_ContactBlock = require('./ContactBlock/ContactBlock.js');
|
|
57
57
|
const require_CampaignBlock = require('./CampaignBlock/CampaignBlock.js');
|
|
58
58
|
const require_Grid = require('./Grid/Grid.js');
|
|
59
|
-
const require_GridParallaxItem = require('./Grid/GridParallaxItem.js');
|
|
60
59
|
const require_LinkBlock = require('./LinkBlock/LinkBlock.js');
|
|
61
60
|
const require_LinkBlockSection = require('./LinkBlock/LinkBlockSection.js');
|
|
62
61
|
const require_ZendeskButton = require('./ZendeskButton/ZendeskButton.js');
|
|
@@ -101,7 +100,7 @@ exports.FootnoteEmbed = require_FootnoteEmbed.FootnoteEmbed;
|
|
|
101
100
|
exports.Gloss = require_Gloss.Gloss;
|
|
102
101
|
exports.GlossExample = require_GlossExample.GlossExample;
|
|
103
102
|
exports.Grid = require_Grid.Grid;
|
|
104
|
-
exports.
|
|
103
|
+
exports.GridItem = require_Grid.GridItem;
|
|
105
104
|
exports.H5pEmbed = require_H5pEmbed.H5pEmbed;
|
|
106
105
|
exports.HomeBreadcrumb = require_HomeBreadcrumb.HomeBreadcrumb;
|
|
107
106
|
exports.IframeEmbed = require_IframeEmbed.IframeEmbed;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "56.0.
|
|
4
|
+
"version": "56.0.163-alpha.0",
|
|
5
5
|
"description": "UI component library for NDLA",
|
|
6
6
|
"license": "GPL-3.0",
|
|
7
7
|
"exports": {
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@ark-ui/react": "^5.25.0",
|
|
40
40
|
"@ndla/core": "^6.0.6-alpha.0",
|
|
41
|
-
"@ndla/icons": "^8.0.
|
|
42
|
-
"@ndla/licenses": "^10.0.
|
|
43
|
-
"@ndla/primitives": "^1.0.
|
|
44
|
-
"@ndla/safelink": "^7.0.
|
|
45
|
-
"@ndla/styled-system": "^0.0.
|
|
41
|
+
"@ndla/icons": "^8.0.75-alpha.0",
|
|
42
|
+
"@ndla/licenses": "^10.0.8-alpha.0",
|
|
43
|
+
"@ndla/primitives": "^1.0.114-alpha.0",
|
|
44
|
+
"@ndla/safelink": "^7.0.117-alpha.0",
|
|
45
|
+
"@ndla/styled-system": "^0.0.46",
|
|
46
46
|
"@ndla/util": "^5.0.17-alpha.0",
|
|
47
47
|
"html-react-parser": "^5.2.8"
|
|
48
48
|
},
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
"react-router": ">= 7.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@ndla/preset-panda": "^0.0.
|
|
58
|
-
"@ndla/types-backend": "^1.0.
|
|
59
|
-
"@ndla/types-embed": "^5.0.
|
|
60
|
-
"@pandacss/dev": "^1.
|
|
57
|
+
"@ndla/preset-panda": "^0.0.68",
|
|
58
|
+
"@ndla/types-backend": "^1.0.89",
|
|
59
|
+
"@ndla/types-embed": "^5.0.20-alpha.0",
|
|
60
|
+
"@pandacss/dev": "^1.7.0"
|
|
61
61
|
},
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "c0f8b4abd2b55f334932d50dfcbff0b00294e571"
|
|
66
66
|
}
|
|
@@ -25,6 +25,7 @@ const visualElementData: ConceptData["visualElement"] = {
|
|
|
25
25
|
},
|
|
26
26
|
data: {
|
|
27
27
|
id: "61181",
|
|
28
|
+
inactive: false,
|
|
28
29
|
metaUrl: "https://api.test.ndla.no/image-api/v3/images/61181",
|
|
29
30
|
title: {
|
|
30
31
|
title: "\nHigh angle view of teenage girl with tousled dyed hair dancing at skateboard park\n",
|
|
@@ -124,6 +124,7 @@ const podcastSuccessData: AudioMeta = {
|
|
|
124
124
|
updated: "2022-03-26T07:49:09Z",
|
|
125
125
|
imageMeta: {
|
|
126
126
|
id: "60913",
|
|
127
|
+
inactive: false,
|
|
127
128
|
metaUrl: "https://api.test.ndla.no/image-api/v3/images/60913",
|
|
128
129
|
title: {
|
|
129
130
|
title: "Podkastserie: Lytt deg gjennom mediefaget (samme på bm og nn)",
|
|
@@ -29,6 +29,7 @@ const embedData: ImageEmbedData = {
|
|
|
29
29
|
|
|
30
30
|
const metaData: ImageMetaInformationV3DTO = {
|
|
31
31
|
id: "61181",
|
|
32
|
+
inactive: false,
|
|
32
33
|
metaUrl: "https://api.test.ndla.no/image-api/v3/images/61181",
|
|
33
34
|
title: {
|
|
34
35
|
title: "\nHigh angle view of teenage girl with tousled dyed hair dancing at skateboard park\n",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import type { Meta, StoryFn } from "@storybook/react";
|
|
10
10
|
import { PageContent } from "@ndla/primitives";
|
|
11
11
|
import { ArticleContent, ArticleWrapper } from "@ndla/ui";
|
|
12
|
-
import { Grid } from "./Grid";
|
|
12
|
+
import { Grid, GridItem } from "./Grid";
|
|
13
13
|
import { Plain } from "../KeyFigure/KeyFigure.stories";
|
|
14
14
|
import { Default as PitchStory } from "../Pitch/Pitch.stories";
|
|
15
15
|
|
|
@@ -23,8 +23,6 @@ export default {
|
|
|
23
23
|
},
|
|
24
24
|
args: {
|
|
25
25
|
columns: "3",
|
|
26
|
-
border: "none",
|
|
27
|
-
background: "gray",
|
|
28
26
|
},
|
|
29
27
|
decorators: [
|
|
30
28
|
(Story) => (
|
|
@@ -51,9 +49,9 @@ export const GridKeyPerformanceStory: StoryFn<typeof Grid> = ({ ...args }) => {
|
|
|
51
49
|
const items = new Array(columns).fill(0).map((_, idx) => {
|
|
52
50
|
const args = keyFigureArgs[idx % keyFigureArgs.length];
|
|
53
51
|
return (
|
|
54
|
-
<
|
|
52
|
+
<GridItem key={idx} data-type="grid-cell">
|
|
55
53
|
<Plain key={idx} {...args} />
|
|
56
|
-
</
|
|
54
|
+
</GridItem>
|
|
57
55
|
);
|
|
58
56
|
});
|
|
59
57
|
return <Grid {...args}>{items}</Grid>;
|
|
@@ -62,7 +60,7 @@ export const GridKeyPerformanceStory: StoryFn<typeof Grid> = ({ ...args }) => {
|
|
|
62
60
|
export const GridPitchStory: StoryFn<typeof Grid> = ({ ...args }) => {
|
|
63
61
|
const columns = args.columns === "2x2" ? 4 : parseInt(args.columns);
|
|
64
62
|
const items = new Array(columns).fill(
|
|
65
|
-
<
|
|
63
|
+
<GridItem data-type="grid-cell">
|
|
66
64
|
<PitchStory
|
|
67
65
|
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
|
|
68
66
|
metaImage={PitchStory.args?.metaImage!}
|
|
@@ -72,7 +70,37 @@ export const GridPitchStory: StoryFn<typeof Grid> = ({ ...args }) => {
|
|
|
72
70
|
url={PitchStory.args?.url!}
|
|
73
71
|
description={PitchStory.args?.description}
|
|
74
72
|
/>
|
|
75
|
-
</
|
|
73
|
+
</GridItem>,
|
|
76
74
|
);
|
|
77
75
|
return <Grid {...args}>{items}</Grid>;
|
|
78
76
|
};
|
|
77
|
+
|
|
78
|
+
export const GridItemsWithBorders: StoryFn<typeof Grid> = ({ ...args }) => {
|
|
79
|
+
const columns = args.columns === "2x2" ? 4 : parseInt(args.columns);
|
|
80
|
+
const items = new Array(columns).fill(0).map((_, idx) => {
|
|
81
|
+
const args = keyFigureArgs[idx % keyFigureArgs.length];
|
|
82
|
+
return (
|
|
83
|
+
<GridItem key={idx} data-type="grid-cell" border={idx % 2 === 0}>
|
|
84
|
+
<Plain key={idx} {...args} />
|
|
85
|
+
</GridItem>
|
|
86
|
+
);
|
|
87
|
+
});
|
|
88
|
+
return <Grid {...args}>{items}</Grid>;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const GridItemsWithBordersInsideGridWithBorder: StoryFn<typeof Grid> = ({ ...args }) => {
|
|
92
|
+
const columns = args.columns === "2x2" ? 4 : parseInt(args.columns);
|
|
93
|
+
const items = new Array(columns).fill(0).map((_, idx) => {
|
|
94
|
+
const args = keyFigureArgs[idx % keyFigureArgs.length];
|
|
95
|
+
return (
|
|
96
|
+
<GridItem key={idx} data-type="grid-cell" border={true}>
|
|
97
|
+
<Plain key={idx} {...args} />
|
|
98
|
+
</GridItem>
|
|
99
|
+
);
|
|
100
|
+
});
|
|
101
|
+
return (
|
|
102
|
+
<Grid {...args} border="lightBlue">
|
|
103
|
+
{items}
|
|
104
|
+
</Grid>
|
|
105
|
+
);
|
|
106
|
+
};
|
package/src/Grid/Grid.tsx
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { type ComponentProps, type ReactNode } from "react";
|
|
10
10
|
import { styled } from "@ndla/styled-system/jsx";
|
|
11
|
+
import type { StyledVariantProps } from "@ndla/styled-system/types";
|
|
11
12
|
|
|
12
13
|
const GridContainer = styled("div", {
|
|
13
14
|
base: {
|
|
@@ -17,11 +18,10 @@ const GridContainer = styled("div", {
|
|
|
17
18
|
gridRowGap: "large",
|
|
18
19
|
gridColumnGap: "medium",
|
|
19
20
|
width: "100%",
|
|
20
|
-
backgroundColor: "background.subtle",
|
|
21
21
|
minWidth: "surface.xxsmall",
|
|
22
22
|
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
|
|
23
23
|
|
|
24
|
-
"&
|
|
24
|
+
"& div[data-embed-type='pitch']": {
|
|
25
25
|
height: "100%",
|
|
26
26
|
"& > :last-child": {
|
|
27
27
|
marginTop: "auto",
|
|
@@ -48,11 +48,6 @@ const GridContainer = styled("div", {
|
|
|
48
48
|
"3": { desktop: { gridTemplateColumns: "repeat(3, minmax(0, 1fr))" } },
|
|
49
49
|
"4": { desktop: { gridTemplateColumns: "repeat(4, minmax(0, 1fr))" } },
|
|
50
50
|
},
|
|
51
|
-
background: {
|
|
52
|
-
white: { backgroundColor: "surface.default" },
|
|
53
|
-
transparent: { backgroundColor: "transparent" },
|
|
54
|
-
gray: { backgroundColor: "background.subtle" },
|
|
55
|
-
},
|
|
56
51
|
border: {
|
|
57
52
|
lightBlue: {
|
|
58
53
|
padding: "xsmall",
|
|
@@ -63,25 +58,43 @@ const GridContainer = styled("div", {
|
|
|
63
58
|
},
|
|
64
59
|
});
|
|
65
60
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
const StyledGridItem = styled("div", {
|
|
62
|
+
base: {},
|
|
63
|
+
variants: {
|
|
64
|
+
border: {
|
|
65
|
+
true: {
|
|
66
|
+
outline: "1px solid",
|
|
67
|
+
borderColor: "stroke.default",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
type GridVariantProps = NonNullable<StyledVariantProps<typeof GridContainer>>;
|
|
74
|
+
|
|
75
|
+
export interface GridProps extends ComponentProps<"div">, GridVariantProps {
|
|
70
76
|
children?: ReactNode[];
|
|
77
|
+
columns: NonNullable<GridVariantProps["columns"]>;
|
|
71
78
|
}
|
|
72
79
|
|
|
73
|
-
|
|
80
|
+
type GridItemVariantProps = NonNullable<StyledVariantProps<typeof StyledGridItem>>;
|
|
81
|
+
|
|
82
|
+
export interface GridItemProps extends ComponentProps<"div">, GridItemVariantProps {}
|
|
83
|
+
|
|
84
|
+
export const Grid = ({ columns, border, children, ...rest }: GridProps) => {
|
|
74
85
|
const amountOfColumns = children?.length === 3 ? "3" : columns;
|
|
75
86
|
|
|
76
87
|
return (
|
|
77
|
-
<GridContainer
|
|
78
|
-
data-embed-type="grid"
|
|
79
|
-
border={border === "none" ? undefined : border}
|
|
80
|
-
columns={amountOfColumns}
|
|
81
|
-
background={background}
|
|
82
|
-
{...rest}
|
|
83
|
-
>
|
|
88
|
+
<GridContainer data-embed-type="grid" border={border} columns={amountOfColumns} {...rest}>
|
|
84
89
|
{children}
|
|
85
90
|
</GridContainer>
|
|
86
91
|
);
|
|
87
92
|
};
|
|
93
|
+
|
|
94
|
+
export const GridItem = ({ border, children, ...rest }: GridItemProps) => {
|
|
95
|
+
return (
|
|
96
|
+
<StyledGridItem data-embed-type="grid-item" border={border} {...rest}>
|
|
97
|
+
{children}
|
|
98
|
+
</StyledGridItem>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
@@ -43,11 +43,11 @@ export default {
|
|
|
43
43
|
|
|
44
44
|
export const Default = ({ ...args }: Props) => {
|
|
45
45
|
return (
|
|
46
|
-
<Grid columns="2"
|
|
47
|
-
<div data-type="grid-cell"
|
|
46
|
+
<Grid columns="2">
|
|
47
|
+
<div data-type="grid-cell">
|
|
48
48
|
<Pitch {...args} />
|
|
49
49
|
</div>
|
|
50
|
-
<div data-type="grid-cell"
|
|
50
|
+
<div data-type="grid-cell">
|
|
51
51
|
<Pitch {...args} description="Kortere beskrivelse" />
|
|
52
52
|
</div>
|
|
53
53
|
</Grid>
|
package/src/index.ts
CHANGED
|
@@ -109,9 +109,8 @@ export { KeyFigure } from "./KeyFigure/KeyFigure";
|
|
|
109
109
|
export { ContactBlock, contactBlockBackgrounds } from "./ContactBlock/ContactBlock";
|
|
110
110
|
export type { ContactBlockBackground } from "./ContactBlock/ContactBlock";
|
|
111
111
|
export { CampaignBlock } from "./CampaignBlock/CampaignBlock";
|
|
112
|
-
export { Grid } from "./Grid/Grid";
|
|
113
|
-
export {
|
|
114
|
-
export type { GridProps as GridType } from "./Grid/Grid";
|
|
112
|
+
export { Grid, GridItem } from "./Grid/Grid";
|
|
113
|
+
export type { GridProps as GridType, GridItemProps } from "./Grid/Grid";
|
|
115
114
|
|
|
116
115
|
export { Gloss } from "./Gloss/Gloss";
|
|
117
116
|
export { GlossExample } from "./Gloss/GlossExample";
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import "react";
|
|
2
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
5
|
-
//#region src/Grid/GridParallaxItem.tsx
|
|
6
|
-
const StyledGridParallaxItem = styled("div", { base: {
|
|
7
|
-
position: "relative",
|
|
8
|
-
"& > div": {
|
|
9
|
-
top: "var(--masthead-height, 0px)",
|
|
10
|
-
position: "sticky"
|
|
11
|
-
}
|
|
12
|
-
} });
|
|
13
|
-
const GridParallaxItem = ({ children, ...rest }) => /* @__PURE__ */ jsx(StyledGridParallaxItem, {
|
|
14
|
-
...rest,
|
|
15
|
-
"data-embed-type": "grid-parallax",
|
|
16
|
-
children: /* @__PURE__ */ jsx("div", { children })
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
export { GridParallaxItem };
|
|
21
|
-
//# sourceMappingURL=GridParallaxItem.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GridParallaxItem.mjs","names":[],"sources":["../../src/Grid/GridParallaxItem.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type HTMLAttributes } from \"react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nconst StyledGridParallaxItem = styled(\"div\", {\n base: {\n position: \"relative\",\n \"& > div\": {\n top: \"var(--masthead-height, 0px)\",\n position: \"sticky\",\n },\n },\n});\n\nexport const GridParallaxItem = ({ children, ...rest }: HTMLAttributes<HTMLDivElement>) => (\n <StyledGridParallaxItem {...rest} data-embed-type=\"grid-parallax\">\n <div>{children}</div>\n </StyledGridParallaxItem>\n);\n"],"mappings":";;;;;AAWA,MAAM,yBAAyB,OAAO,OAAO,EAC3C,MAAM;CACJ,UAAU;CACV,WAAW;EACT,KAAK;EACL,UAAU;EACX;CACF,EACF,CAAC;AAEF,MAAa,oBAAoB,EAAE,UAAU,GAAG,WAC9C,oBAAC;CAAuB,GAAI;CAAM,mBAAgB;WAChD,oBAAC,SAAK,WAAe;EACE"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2024-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
import { type HTMLAttributes } from "react";
|
|
9
|
-
export declare const GridParallaxItem: ({ children, ...rest }: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
-
let react = require("react");
|
|
3
|
-
let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
|
|
4
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
-
|
|
6
|
-
//#region src/Grid/GridParallaxItem.tsx
|
|
7
|
-
/**
|
|
8
|
-
* Copyright (c) 2024-present, NDLA.
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
|
-
const StyledGridParallaxItem = (0, __ndla_styled_system_jsx.styled)("div", { base: {
|
|
15
|
-
position: "relative",
|
|
16
|
-
"& > div": {
|
|
17
|
-
top: "var(--masthead-height, 0px)",
|
|
18
|
-
position: "sticky"
|
|
19
|
-
}
|
|
20
|
-
} });
|
|
21
|
-
const GridParallaxItem = ({ children, ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledGridParallaxItem, {
|
|
22
|
-
...rest,
|
|
23
|
-
"data-embed-type": "grid-parallax",
|
|
24
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children })
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
exports.GridParallaxItem = GridParallaxItem;
|
|
29
|
-
//# sourceMappingURL=GridParallaxItem.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GridParallaxItem.js","names":[],"sources":["../../src/Grid/GridParallaxItem.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type HTMLAttributes } from \"react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nconst StyledGridParallaxItem = styled(\"div\", {\n base: {\n position: \"relative\",\n \"& > div\": {\n top: \"var(--masthead-height, 0px)\",\n position: \"sticky\",\n },\n },\n});\n\nexport const GridParallaxItem = ({ children, ...rest }: HTMLAttributes<HTMLDivElement>) => (\n <StyledGridParallaxItem {...rest} data-embed-type=\"grid-parallax\">\n <div>{children}</div>\n </StyledGridParallaxItem>\n);\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAM,8DAAgC,OAAO,EAC3C,MAAM;CACJ,UAAU;CACV,WAAW;EACT,KAAK;EACL,UAAU;EACX;CACF,EACF,CAAC;AAEF,MAAa,oBAAoB,EAAE,UAAU,GAAG,WAC9C,2CAAC;CAAuB,GAAI;CAAM,mBAAgB;WAChD,2CAAC,SAAK,WAAe;EACE"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2024-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { type HTMLAttributes } from "react";
|
|
10
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
11
|
-
|
|
12
|
-
const StyledGridParallaxItem = styled("div", {
|
|
13
|
-
base: {
|
|
14
|
-
position: "relative",
|
|
15
|
-
"& > div": {
|
|
16
|
-
top: "var(--masthead-height, 0px)",
|
|
17
|
-
position: "sticky",
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
export const GridParallaxItem = ({ children, ...rest }: HTMLAttributes<HTMLDivElement>) => (
|
|
23
|
-
<StyledGridParallaxItem {...rest} data-embed-type="grid-parallax">
|
|
24
|
-
<div>{children}</div>
|
|
25
|
-
</StyledGridParallaxItem>
|
|
26
|
-
);
|