@ndla/primitives 1.0.0-alpha.0 → 1.0.2-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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "schemaVersion": "0.42.0",
2
+ "schemaVersion": "0.44.0",
3
3
  "styles": {
4
4
  "atomic": [
5
5
  "display]___[value:flex",
@@ -81,6 +81,7 @@
81
81
  "paddingInline]___[value:xsmall",
82
82
  "border]___[value:1px solid",
83
83
  "width]___[value:fit-content",
84
+ "color]___[value:text.default",
84
85
  "backgroundColor]___[value:surface.brand.1.subtle",
85
86
  "borderColor]___[value:surface.brand.1.strong",
86
87
  "backgroundColor]___[value:surface.brand.2.moderate",
@@ -156,7 +157,6 @@
156
157
  "outlineOffset]___[value:4xsmall]___[cond:_focus",
157
158
  "outlineColor]___[value:stroke.default]___[cond:_focus",
158
159
  "borderRadius]___[value:xsmall]___[cond:_focus",
159
- "color]___[value:text.default",
160
160
  "gap]___[value:4xsmall",
161
161
  "background]___[value:surface.actionSubtle",
162
162
  "outlineColor]___[value:stroke.subtle",
@@ -297,6 +297,7 @@
297
297
  "paddingBlockStart]___[value:small",
298
298
  "paddingBlockEnd]___[value:medium",
299
299
  "padding]___[value:medium",
300
+ "clear]___[value:both",
300
301
  "padding]___[value:medium]___[cond:_open",
301
302
  "marginBlockEnd]___[value:-xxsmall]___[cond:_open<___>& summary",
302
303
  "margin]___[value:-medium",
@@ -581,7 +582,32 @@
581
582
  "--arrow-size]___[value:spacing.xxsmall",
582
583
  "--arrow-background]___[value:colors.surface.action",
583
584
  "height]___[value:200px",
584
- "objectFit]___[value:cover"
585
+ "objectFit]___[value:cover",
586
+ "transitionProperty]___[value:background-color, border-color",
587
+ "transitionDuration]___[value:superFast",
588
+ "transitionTimingFunction]___[value:ease-in-out",
589
+ "background]___[value:surface.brand.1.subtle]___[cond:_hover",
590
+ "background]___[value:surface.brand.1.subtle]___[cond:_highlighted",
591
+ "borderBlock]___[value:1px solid",
592
+ "borderColor]___[value:stroke.hover]___[cond:_highlighted",
593
+ "borderTop]___[value:1px solid",
594
+ "borderTopColor]___[value:stroke.subtle",
595
+ "borderBottom]___[value:1px solid",
596
+ "borderBottomColor]___[value:transparent",
597
+ "marginTop]___[value:-1px",
598
+ "borderTopColor]___[value:transparent]___[cond:_first",
599
+ "borderTopColor]___[value:stroke.hover]___[cond:_first<___>_hover",
600
+ "borderTopColor]___[value:stroke.hover]___[cond:_first<___>_highlighted",
601
+ "borderBottomColor]___[value:stroke.subtle]___[cond:_last",
602
+ "borderTopColor]___[value:stroke.hover]___[cond:&:hover + &",
603
+ "borderTopColor]___[value:stroke.hover]___[cond:&[data-highlighted] + &",
604
+ "borderBottomColor]___[value:transparent]___[cond:_hover",
605
+ "borderTopColor]___[value:stroke.hover]___[cond:_hover",
606
+ "borderBottomColor]___[value:stroke.hover]___[cond:_hover<___>_last",
607
+ "borderTopColor]___[value:stroke.hover]___[cond:_highlighted",
608
+ "borderBottomColor]___[value:stroke.hover]___[cond:_highlighted<___>_last",
609
+ "height]___[value:40px",
610
+ "width]___[value:56px"
585
611
  ],
586
612
  "recipes": {}
587
613
  }
package/dist/styles.css CHANGED
@@ -182,6 +182,10 @@
182
182
  width: fit-content;
183
183
  }
184
184
 
185
+ .c_text\.default {
186
+ color: var(--colors-text-default);
187
+ }
188
+
185
189
  .bd-s_4px_solid {
186
190
  border-inline-start: 4px solid;
187
191
  }
@@ -292,10 +296,6 @@
292
296
  gap: var(--spacing-xxsmall);
293
297
  }
294
298
 
295
- .c_text\.default {
296
- color: var(--colors-text-default);
297
- }
298
-
299
299
  .gap_4xsmall {
300
300
  gap: var(--spacing-4xsmall);
301
301
  }
@@ -508,6 +508,10 @@
508
508
  padding: var(--spacing-medium);
509
509
  }
510
510
 
511
+ .clear_both {
512
+ clear: both;
513
+ }
514
+
511
515
  .m_-medium {
512
516
  margin: calc(var(--spacing-medium) * -1);
513
517
  }
@@ -873,6 +877,26 @@
873
877
  object-fit: cover;
874
878
  }
875
879
 
880
+ .bd-y_1px_solid {
881
+ border-block: 1px solid;
882
+ }
883
+
884
+ .bd-t_1px_solid {
885
+ border-top: 1px solid;
886
+ }
887
+
888
+ .bd-b_1px_solid {
889
+ border-bottom: 1px solid;
890
+ }
891
+
892
+ .h_40px {
893
+ height: 40px;
894
+ }
895
+
896
+ .w_56px {
897
+ width: 56px;
898
+ }
899
+
876
900
  .flex-d_column {
877
901
  flex-direction: column;
878
902
  }
@@ -1172,6 +1196,33 @@
1172
1196
  right: var(--spacing-xxsmall);
1173
1197
  }
1174
1198
 
1199
+ .trs-prop_background-color\,_border-color {
1200
+ --transition-prop: background-color, border-color;
1201
+ transition-property: background-color, border-color;
1202
+ }
1203
+
1204
+ .trs-dur_superFast {
1205
+ --transition-duration: var(--durations-super-fast);
1206
+ transition-duration: var(--durations-super-fast);
1207
+ }
1208
+
1209
+ .trs-tmf_ease-in-out {
1210
+ --transition-easing: ease-in-out;
1211
+ transition-timing-function: ease-in-out;
1212
+ }
1213
+
1214
+ .bd-t-c_stroke\.subtle {
1215
+ border-top-color: var(--colors-stroke-subtle);
1216
+ }
1217
+
1218
+ .bd-b-c_transparent {
1219
+ border-bottom-color: transparent;
1220
+ }
1221
+
1222
+ .mt_-1px {
1223
+ margin-top: -1px;
1224
+ }
1225
+
1175
1226
  .disabled\:cursor_not-allowed:is(:disabled, [disabled], [data-disabled], [aria-disabled='true']) {
1176
1227
  cursor: not-allowed;
1177
1228
  }
@@ -1566,6 +1617,10 @@
1566
1617
  display: inline-block;
1567
1618
  }
1568
1619
 
1620
+ .highlighted\:bg_surface\.brand\.1\.subtle[data-highlighted] {
1621
+ background: var(--colors-surface-brand-1-subtle);
1622
+ }
1623
+
1569
1624
  .closed\:trs-prop_background\,_border-color\,_border\,_border-radius:is([closed], [data-closed], [data-state="closed"]) {
1570
1625
  --transition-prop: background, border-color, border, border-radius;
1571
1626
  transition-property: background, border-color, border, border-radius;
@@ -1718,6 +1773,26 @@
1718
1773
  outline-color: var(--colors-stroke-hover);
1719
1774
  }
1720
1775
 
1776
+ .highlighted\:bd-c_stroke\.hover[data-highlighted] {
1777
+ border-color: var(--colors-stroke-hover);
1778
+ }
1779
+
1780
+ .first\:bd-t-c_transparent:first-child {
1781
+ border-top-color: transparent;
1782
+ }
1783
+
1784
+ .last\:bd-b-c_stroke\.subtle:last-child {
1785
+ border-bottom-color: var(--colors-stroke-subtle);
1786
+ }
1787
+
1788
+ :is(.\[\&\[data-highlighted\]_\+_\&\]\:bd-t-c_stroke\.hover)[data-highlighted] + :is(.\[\&\[data-highlighted\]_\+_\&\]\:bd-t-c_stroke\.hover) {
1789
+ border-top-color: var(--colors-stroke-hover);
1790
+ }
1791
+
1792
+ .highlighted\:bd-t-c_stroke\.hover[data-highlighted] {
1793
+ border-top-color: var(--colors-stroke-hover);
1794
+ }
1795
+
1721
1796
  .focusWithin\:ring-o_-1px:focus-within {
1722
1797
  outline-offset: -1px;
1723
1798
  }
@@ -1932,6 +2007,10 @@
1932
2007
  transform: translateX(20%);
1933
2008
  }
1934
2009
 
2010
+ .hover\:bg_surface\.brand\.1\.subtle:is(:hover, [data-hover]) {
2011
+ background: var(--colors-surface-brand-1-subtle);
2012
+ }
2013
+
1935
2014
  .hover\:bd-c_stroke\.hover:is(:hover, [data-hover]) {
1936
2015
  border-color: var(--colors-stroke-hover);
1937
2016
  }
@@ -1944,6 +2023,18 @@
1944
2023
  background-color: var(--colors-surface-action-subtle-hover);
1945
2024
  }
1946
2025
 
2026
+ .\[\&\:hover_\+_\&\]\:bd-t-c_stroke\.hover:hover + .\[\&\:hover_\+_\&\]\:bd-t-c_stroke\.hover {
2027
+ border-top-color: var(--colors-stroke-hover);
2028
+ }
2029
+
2030
+ .hover\:bd-b-c_transparent:is(:hover, [data-hover]) {
2031
+ border-bottom-color: transparent;
2032
+ }
2033
+
2034
+ .hover\:bd-t-c_stroke\.hover:is(:hover, [data-hover]) {
2035
+ border-top-color: var(--colors-stroke-hover);
2036
+ }
2037
+
1947
2038
  .active\:c_text\.onAction:is(:active, [data-active]) {
1948
2039
  color: var(--colors-text-on-action);
1949
2040
  }
@@ -2222,6 +2313,18 @@
2222
2313
  top: var(--top);
2223
2314
  }
2224
2315
 
2316
+ .first\:hover\:bd-t-c_stroke\.hover:first-child:is(:hover, [data-hover]) {
2317
+ border-top-color: var(--colors-stroke-hover);
2318
+ }
2319
+
2320
+ .first\:highlighted\:bd-t-c_stroke\.hover:first-child[data-highlighted] {
2321
+ border-top-color: var(--colors-stroke-hover);
2322
+ }
2323
+
2324
+ .highlighted\:last\:bd-b-c_stroke\.hover[data-highlighted]:last-child {
2325
+ border-bottom-color: var(--colors-stroke-hover);
2326
+ }
2327
+
2225
2328
  .focusWithin\:hover\:ring-c_stroke\.default:focus-within:is(:hover, [data-hover]) {
2226
2329
  outline-color: var(--colors-stroke-default);
2227
2330
  }
@@ -2250,6 +2353,10 @@
2250
2353
  border-color: var(--colors-stroke-default);
2251
2354
  }
2252
2355
 
2356
+ .hover\:last\:bd-b-c_stroke\.hover:is(:hover, [data-hover]):last-child {
2357
+ border-bottom-color: var(--colors-stroke-hover);
2358
+ }
2359
+
2253
2360
  .\[\&_\>_li\]\:\[\&_\>_ol\:not\(\[data-variant\=\'letters\'\]\)\]\:\[\&\[data-count\=\'true\'\]\]\:counter-reset_level2_var\(--start\,_0\) > li > ol:not([data-variant='letters'])[data-count='true'] {
2254
2361
  counter-reset: level2 var(--start, 0);
2255
2362
  }
package/es/Badge.js CHANGED
@@ -16,7 +16,8 @@ const badgeRecipe = cva({
16
16
  paddingInline: "xsmall",
17
17
  borderRadius: "xsmall",
18
18
  border: "1px solid",
19
- width: "fit-content"
19
+ width: "fit-content",
20
+ color: "text.default"
20
21
  },
21
22
  defaultVariants: {
22
23
  colorTheme: "neutral"
package/es/Card/Card.js CHANGED
@@ -25,6 +25,7 @@ const cardRecipe = sva({
25
25
  transitionProperty: "background, color",
26
26
  transitionTimingFunction: "default",
27
27
  background: "surface.default",
28
+ overflow: "hidden",
28
29
  _hover: {
29
30
  background: "surface.actionSubtle.hover",
30
31
  borderColor: "stroke.hover"
package/es/Dialog.js CHANGED
@@ -71,7 +71,8 @@ const dialogRecipe = sva({
71
71
  },
72
72
  defaultVariants: {
73
73
  size: "medium",
74
- position: "center"
74
+ position: "center",
75
+ variant: "dialog"
75
76
  },
76
77
  compoundVariants: [{
77
78
  variant: "drawer",
@@ -314,8 +315,12 @@ export const DialogTitle = _ref3 => {
314
315
  })
315
316
  });
316
317
  };
317
- export const DialogTrigger = Dialog.Trigger;
318
- export const DialogCloseTrigger = Dialog.CloseTrigger;
318
+ export const DialogTrigger = withContext(Dialog.Trigger, "trigger", {
319
+ baseComponent: true
320
+ });
321
+ export const DialogCloseTrigger = withContext(Dialog.CloseTrigger, "closeTrigger", {
322
+ baseComponent: true
323
+ });
319
324
  export const DialogHeader = styled("div", {
320
325
  base: {
321
326
  display: "flex",
@@ -17,6 +17,7 @@ export const ExpandableBox = styled("details", {
17
17
  borderRadius: "xsmall",
18
18
  borderColor: "stroke.subtle",
19
19
  padding: "medium",
20
+ clear: "both",
20
21
  _open: {
21
22
  padding: "medium",
22
23
  "& summary": {
package/es/Figure.js CHANGED
@@ -99,7 +99,7 @@ const StyledFigure = styled(ark.figure, {}, {
99
99
  });
100
100
  export const Figure = /*#__PURE__*/forwardRef((_ref, ref) => {
101
101
  let {
102
- size,
102
+ size = "medium",
103
103
  float,
104
104
  css: cssProp,
105
105
  ...props
@@ -15,7 +15,8 @@ const framedContentRecipe = cva({
15
15
  base: {
16
16
  padding: "medium",
17
17
  border: "1px solid",
18
- borderRadius: "small"
18
+ borderRadius: "small",
19
+ clear: "both"
19
20
  },
20
21
  variants: {
21
22
  colorTheme: {
package/es/Image.js CHANGED
@@ -77,6 +77,7 @@ export const Image = /*#__PURE__*/forwardRef((_ref3, ref) => {
77
77
  } = _ref3;
78
78
  const srcSet = srcSetProp ?? getSrcSet(src, crop, focalPoint);
79
79
  const queryString = makeSrcQueryString(fallbackWidth, crop, focalPoint);
80
+ const fallbackSrc = src ? `${src}?${queryString}` : src;
80
81
  return /*#__PURE__*/_jsxs("picture", {
81
82
  children: [contentType !== "image/gif" && /*#__PURE__*/_jsx("source", {
82
83
  type: contentType,
@@ -84,7 +85,7 @@ export const Image = /*#__PURE__*/forwardRef((_ref3, ref) => {
84
85
  sizes: sizes
85
86
  }), /*#__PURE__*/_jsx(styled.img, {
86
87
  alt: alt,
87
- src: contentType === "image/gif" ? src : `${src}?${queryString}`,
88
+ src: contentType === "image/gif" ? src : fallbackSrc,
88
89
  ...props,
89
90
  ref: ref
90
91
  })]
package/es/Label.js CHANGED
@@ -86,9 +86,17 @@ export const Label = /*#__PURE__*/forwardRef((_ref3, ref) => {
86
86
  ref: ref
87
87
  });
88
88
  });
89
- export const FieldLabel = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/_jsx(Field.Label, {
90
- asChild: true,
91
- ...props,
92
- ref: ref,
93
- children: /*#__PURE__*/_jsx(Label, {})
94
- }));
89
+ export const FieldLabel = /*#__PURE__*/forwardRef((_ref4, ref) => {
90
+ let {
91
+ children,
92
+ ...props
93
+ } = _ref4;
94
+ return /*#__PURE__*/_jsx(Field.Label, {
95
+ asChild: true,
96
+ ...props,
97
+ ref: ref,
98
+ children: /*#__PURE__*/_jsx(Label, {
99
+ children: children
100
+ })
101
+ });
102
+ });
@@ -0,0 +1,138 @@
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 { forwardRef } from "react";
10
+ import { ark } from "@ark-ui/react";
11
+ import { sva } from "@ndla/styled-system/css";
12
+ import { createStyleContext } from "../createStyleContext";
13
+ import { Image } from "../Image";
14
+ import { Heading } from "../Text";
15
+ import { jsx as _jsx } from "react/jsx-runtime";
16
+ export const listItemRecipe = sva({
17
+ slots: ["root", "title", "content", "image"],
18
+ base: {
19
+ root: {
20
+ position: "relative",
21
+ display: "flex",
22
+ gap: "xsmall",
23
+ alignItems: "center",
24
+ paddingBlock: "xsmall",
25
+ paddingInline: "xsmall",
26
+ transitionProperty: "background-color, border-color",
27
+ transitionDuration: "superFast",
28
+ transitionTimingFunction: "ease-in-out",
29
+ _hover: {
30
+ background: "surface.brand.1.subtle"
31
+ },
32
+ _highlighted: {
33
+ background: "surface.brand.1.subtle"
34
+ }
35
+ },
36
+ content: {
37
+ display: "flex",
38
+ alignItems: "flex-start",
39
+ justifyContent: "space-between",
40
+ gap: "xsmall",
41
+ width: "100%"
42
+ },
43
+ title: {
44
+ textDecoration: "underline",
45
+ _hover: {
46
+ textDecoration: "none"
47
+ }
48
+ },
49
+ image: {
50
+ height: "40px",
51
+ width: "56px",
52
+ borderRadius: "xsmall",
53
+ objectFit: "cover"
54
+ }
55
+ },
56
+ defaultVariants: {
57
+ variant: "standalone"
58
+ },
59
+ variants: {
60
+ variant: {
61
+ standalone: {
62
+ root: {
63
+ borderBlock: "1px solid",
64
+ borderColor: "stroke.subtle",
65
+ _hover: {
66
+ borderColor: "stroke.hover"
67
+ },
68
+ _highlighted: {
69
+ borderColor: "stroke.hover"
70
+ }
71
+ }
72
+ },
73
+ list: {
74
+ root: {
75
+ borderTop: "1px solid",
76
+ borderTopColor: "stroke.subtle",
77
+ borderBottom: "1px solid",
78
+ borderBottomColor: "transparent",
79
+ marginTop: "-1px",
80
+ _first: {
81
+ borderTopColor: "transparent",
82
+ _hover: {
83
+ borderTopColor: "stroke.hover"
84
+ },
85
+ _highlighted: {
86
+ borderTopColor: "stroke.hover"
87
+ }
88
+ },
89
+ _last: {
90
+ borderBottomColor: "stroke.subtle"
91
+ },
92
+ "&:hover + &": {
93
+ borderTopColor: "stroke.hover"
94
+ },
95
+ "&[data-highlighted] + &": {
96
+ borderTopColor: "stroke.hover"
97
+ },
98
+ _hover: {
99
+ borderBottomColor: "transparent",
100
+ borderTopColor: "stroke.hover",
101
+ _last: {
102
+ borderBottomColor: "stroke.hover"
103
+ }
104
+ },
105
+ _highlighted: {
106
+ borderTopColor: "stroke.hover",
107
+ _last: {
108
+ borderBottomColor: "stroke.hover"
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
115
+ });
116
+ const {
117
+ withProvider,
118
+ withContext
119
+ } = createStyleContext(listItemRecipe);
120
+ export const ListItemRoot = withProvider(ark.div, "root", {
121
+ baseComponent: true
122
+ });
123
+ const InternalListItemHeading = /*#__PURE__*/forwardRef((_ref, ref) => {
124
+ let {
125
+ textStyle = "label.medium",
126
+ ...props
127
+ } = _ref;
128
+ return /*#__PURE__*/_jsx(Heading, {
129
+ textStyle: textStyle,
130
+ ...props,
131
+ ref: ref
132
+ });
133
+ });
134
+ export const ListItemHeading = withContext(InternalListItemHeading, "title");
135
+ export const ListItemContent = withContext(ark.div, "content", {
136
+ baseComponent: true
137
+ });
138
+ export const ListItemImage = withContext(Image, "image");
package/es/RadioGroup.js CHANGED
@@ -126,6 +126,7 @@ export const InternalRadioGroupLabel = withContext(RadioGroup.Label, "label");
126
126
  export const RadioGroupLabel = /*#__PURE__*/forwardRef((_ref2, ref) => {
127
127
  let {
128
128
  textStyle = "label.large",
129
+ children,
129
130
  ...props
130
131
  } = _ref2;
131
132
  return /*#__PURE__*/_jsx(InternalRadioGroupLabel, {
@@ -133,7 +134,8 @@ export const RadioGroupLabel = /*#__PURE__*/forwardRef((_ref2, ref) => {
133
134
  ...props,
134
135
  asChild: true,
135
136
  children: /*#__PURE__*/_jsx(Label, {
136
- textStyle: textStyle
137
+ textStyle: textStyle,
138
+ children: children
137
139
  })
138
140
  });
139
141
  });
package/es/index.js CHANGED
@@ -25,6 +25,7 @@ export { Hero, HeroBackground, HeroContent } from "./Hero";
25
25
  export { Picture, Img, Image, makeSrcQueryString, getSrcSet } from "./Image";
26
26
  export { Input, FieldInput, InputContainer, TextArea, FieldTextArea } from "./Input";
27
27
  export { Label, FieldLabel, Legend, FieldsetLegend } from "./Label";
28
+ export { ListItemRoot, ListItemHeading, ListItemContent, ListItemImage } from "./ListItem/ListItem";
28
29
  export { MenuRoot, MenuContent, MenuItemGroupLabel, MenuItemGroup, MenuItem, MenuPositioner, MenuTriggerItem, MenuTrigger, MenuSeparator } from "./Menu";
29
30
  export { MessageBox } from "./MessageBox";
30
31
  export { NdlaLogoEn, NdlaLogoNb, NdlaLogoText } from "./NdlaLogo";
package/lib/Badge.js CHANGED
@@ -22,7 +22,8 @@ const badgeRecipe = (0, _css.cva)({
22
22
  paddingInline: "xsmall",
23
23
  borderRadius: "xsmall",
24
24
  border: "1px solid",
25
- width: "fit-content"
25
+ width: "fit-content",
26
+ color: "text.default"
26
27
  },
27
28
  defaultVariants: {
28
29
  colorTheme: "neutral"
package/lib/Card/Card.js CHANGED
@@ -31,6 +31,7 @@ const cardRecipe = (0, _css.sva)({
31
31
  transitionProperty: "background, color",
32
32
  transitionTimingFunction: "default",
33
33
  background: "surface.default",
34
+ overflow: "hidden",
34
35
  _hover: {
35
36
  background: "surface.actionSubtle.hover",
36
37
  borderColor: "stroke.hover"
package/lib/Dialog.d.ts CHANGED
@@ -108,8 +108,12 @@ export declare const DialogContent: import("react").ForwardRefExoticComponent<Di
108
108
  } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
109
109
  export declare const DialogDescription: ({ textStyle, children, ...rest }: Dialog.DescriptionProps & TextProps & JsxStyleProps) => import("react/jsx-runtime").JSX.Element;
110
110
  export declare const DialogTitle: ({ textStyle, children, ...rest }: Dialog.TitleProps & TextProps & JsxStyleProps) => import("react/jsx-runtime").JSX.Element;
111
- export declare const DialogTrigger: import("react").ForwardRefExoticComponent<Dialog.TriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
112
- export declare const DialogCloseTrigger: import("react").ForwardRefExoticComponent<Dialog.CloseTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
111
+ export declare const DialogTrigger: import("react").ForwardRefExoticComponent<{
112
+ consumeCss?: boolean | undefined;
113
+ } & import("@ndla/styled-system/types").WithCss & Dialog.TriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
114
+ export declare const DialogCloseTrigger: import("react").ForwardRefExoticComponent<{
115
+ consumeCss?: boolean | undefined;
116
+ } & import("@ndla/styled-system/types").WithCss & Dialog.CloseTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
113
117
  export declare const DialogHeader: import("@ndla/styled-system/types").StyledComponent<"div", {}>;
114
118
  export declare const DialogBody: import("@ndla/styled-system/types").StyledComponent<"div", {}>;
115
119
  export {};
package/lib/Dialog.js CHANGED
@@ -77,7 +77,8 @@ const dialogRecipe = (0, _css.sva)({
77
77
  },
78
78
  defaultVariants: {
79
79
  size: "medium",
80
- position: "center"
80
+ position: "center",
81
+ variant: "dialog"
81
82
  },
82
83
  compoundVariants: [{
83
84
  variant: "drawer",
@@ -323,8 +324,12 @@ const DialogTitle = _ref3 => {
323
324
  });
324
325
  };
325
326
  exports.DialogTitle = DialogTitle;
326
- const DialogTrigger = exports.DialogTrigger = _react2.Dialog.Trigger;
327
- const DialogCloseTrigger = exports.DialogCloseTrigger = _react2.Dialog.CloseTrigger;
327
+ const DialogTrigger = exports.DialogTrigger = withContext(_react2.Dialog.Trigger, "trigger", {
328
+ baseComponent: true
329
+ });
330
+ const DialogCloseTrigger = exports.DialogCloseTrigger = withContext(_react2.Dialog.CloseTrigger, "closeTrigger", {
331
+ baseComponent: true
332
+ });
328
333
  const DialogHeader = exports.DialogHeader = (0, _jsx2.styled)("div", {
329
334
  base: {
330
335
  display: "flex",
@@ -23,6 +23,7 @@ const ExpandableBox = exports.ExpandableBox = (0, _jsx.styled)("details", {
23
23
  borderRadius: "xsmall",
24
24
  borderColor: "stroke.subtle",
25
25
  padding: "medium",
26
+ clear: "both",
26
27
  _open: {
27
28
  padding: "medium",
28
29
  "& summary": {
package/lib/Figure.js CHANGED
@@ -105,7 +105,7 @@ const StyledFigure = (0, _jsx2.styled)(_react2.ark.figure, {}, {
105
105
  });
106
106
  const Figure = exports.Figure = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
107
107
  let {
108
- size,
108
+ size = "medium",
109
109
  float,
110
110
  css: cssProp,
111
111
  ...props
@@ -21,7 +21,8 @@ const framedContentRecipe = (0, _css.cva)({
21
21
  base: {
22
22
  padding: "medium",
23
23
  border: "1px solid",
24
- borderRadius: "small"
24
+ borderRadius: "small",
25
+ clear: "both"
25
26
  },
26
27
  variants: {
27
28
  colorTheme: {
package/lib/Image.js CHANGED
@@ -85,6 +85,7 @@ const Image = exports.Image = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) =
85
85
  } = _ref3;
86
86
  const srcSet = srcSetProp ?? getSrcSet(src, crop, focalPoint);
87
87
  const queryString = makeSrcQueryString(fallbackWidth, crop, focalPoint);
88
+ const fallbackSrc = src ? `${src}?${queryString}` : src;
88
89
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("picture", {
89
90
  children: [contentType !== "image/gif" && /*#__PURE__*/(0, _jsxRuntime.jsx)("source", {
90
91
  type: contentType,
@@ -92,7 +93,7 @@ const Image = exports.Image = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) =
92
93
  sizes: sizes
93
94
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsx2.styled.img, {
94
95
  alt: alt,
95
- src: contentType === "image/gif" ? src : `${src}?${queryString}`,
96
+ src: contentType === "image/gif" ? src : fallbackSrc,
96
97
  ...props,
97
98
  ref: ref
98
99
  })]
package/lib/Label.js CHANGED
@@ -92,9 +92,17 @@ const Label = exports.Label = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) =
92
92
  ref: ref
93
93
  });
94
94
  });
95
- const FieldLabel = exports.FieldLabel = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Field.Label, {
96
- asChild: true,
97
- ...props,
98
- ref: ref,
99
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Label, {})
100
- }));
95
+ const FieldLabel = exports.FieldLabel = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
96
+ let {
97
+ children,
98
+ ...props
99
+ } = _ref4;
100
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Field.Label, {
101
+ asChild: true,
102
+ ...props,
103
+ ref: ref,
104
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Label, {
105
+ children: children
106
+ })
107
+ });
108
+ });
@@ -0,0 +1,81 @@
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 HTMLArkProps } from "@ark-ui/react";
9
+ import type { JsxStyleProps, RecipeVariantProps } from "@ndla/styled-system/types";
10
+ import { type ImageProps } from "../Image";
11
+ import { type TextProps } from "../Text";
12
+ export declare const listItemRecipe: import("@ndla/styled-system/types").SlotRecipeRuntimeFn<"title" | "image" | "content" | "root", {
13
+ variant: {
14
+ standalone: {
15
+ root: {
16
+ borderBlock: "1px solid";
17
+ borderColor: "stroke.subtle";
18
+ _hover: {
19
+ borderColor: "stroke.hover";
20
+ };
21
+ _highlighted: {
22
+ borderColor: "stroke.hover";
23
+ };
24
+ };
25
+ };
26
+ list: {
27
+ root: {
28
+ borderTop: "1px solid";
29
+ borderTopColor: "stroke.subtle";
30
+ borderBottom: "1px solid";
31
+ borderBottomColor: "transparent";
32
+ marginTop: "-1px";
33
+ _first: {
34
+ borderTopColor: "transparent";
35
+ _hover: {
36
+ borderTopColor: "stroke.hover";
37
+ };
38
+ _highlighted: {
39
+ borderTopColor: "stroke.hover";
40
+ };
41
+ };
42
+ _last: {
43
+ borderBottomColor: "stroke.subtle";
44
+ };
45
+ "&:hover + &": {
46
+ borderTopColor: "stroke.hover";
47
+ };
48
+ "&[data-highlighted] + &": {
49
+ borderTopColor: "stroke.hover";
50
+ };
51
+ _hover: {
52
+ borderBottomColor: "transparent";
53
+ borderTopColor: "stroke.hover";
54
+ _last: {
55
+ borderBottomColor: "stroke.hover";
56
+ };
57
+ };
58
+ _highlighted: {
59
+ borderTopColor: "stroke.hover";
60
+ _last: {
61
+ borderBottomColor: "stroke.hover";
62
+ };
63
+ };
64
+ };
65
+ };
66
+ };
67
+ }>;
68
+ export type ListItemVariantProps = RecipeVariantProps<typeof listItemRecipe>;
69
+ export type ListItemProps = HTMLArkProps<"div"> & JsxStyleProps & ListItemVariantProps;
70
+ export declare const ListItemRoot: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
71
+ consumeCss?: boolean | undefined;
72
+ } & import("@ndla/styled-system/types").WithCss & {
73
+ variant?: "list" | "standalone" | undefined;
74
+ } & import("react").RefAttributes<HTMLDivElement>>;
75
+ export declare const ListItemHeading: import("react").ForwardRefExoticComponent<TextProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
76
+ consumeCss?: boolean | undefined;
77
+ } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLHeadingElement>>;
78
+ export declare const ListItemContent: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
79
+ consumeCss?: boolean | undefined;
80
+ } & import("@ndla/styled-system/types").WithCss & import("react").RefAttributes<HTMLDivElement>>;
81
+ export declare const ListItemImage: import("react").ForwardRefExoticComponent<Omit<ImageProps, "ref"> & import("react").RefAttributes<HTMLImageElement>>;
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.listItemRecipe = exports.ListItemRoot = exports.ListItemImage = exports.ListItemHeading = exports.ListItemContent = void 0;
7
+ var _react = require("react");
8
+ var _react2 = require("@ark-ui/react");
9
+ var _css = require("@ndla/styled-system/css");
10
+ var _createStyleContext = require("../createStyleContext");
11
+ var _Image = require("../Image");
12
+ var _Text = require("../Text");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ /**
15
+ * Copyright (c) 2024-present, NDLA.
16
+ *
17
+ * This source code is licensed under the GPLv3 license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ *
20
+ */
21
+
22
+ const listItemRecipe = exports.listItemRecipe = (0, _css.sva)({
23
+ slots: ["root", "title", "content", "image"],
24
+ base: {
25
+ root: {
26
+ position: "relative",
27
+ display: "flex",
28
+ gap: "xsmall",
29
+ alignItems: "center",
30
+ paddingBlock: "xsmall",
31
+ paddingInline: "xsmall",
32
+ transitionProperty: "background-color, border-color",
33
+ transitionDuration: "superFast",
34
+ transitionTimingFunction: "ease-in-out",
35
+ _hover: {
36
+ background: "surface.brand.1.subtle"
37
+ },
38
+ _highlighted: {
39
+ background: "surface.brand.1.subtle"
40
+ }
41
+ },
42
+ content: {
43
+ display: "flex",
44
+ alignItems: "flex-start",
45
+ justifyContent: "space-between",
46
+ gap: "xsmall",
47
+ width: "100%"
48
+ },
49
+ title: {
50
+ textDecoration: "underline",
51
+ _hover: {
52
+ textDecoration: "none"
53
+ }
54
+ },
55
+ image: {
56
+ height: "40px",
57
+ width: "56px",
58
+ borderRadius: "xsmall",
59
+ objectFit: "cover"
60
+ }
61
+ },
62
+ defaultVariants: {
63
+ variant: "standalone"
64
+ },
65
+ variants: {
66
+ variant: {
67
+ standalone: {
68
+ root: {
69
+ borderBlock: "1px solid",
70
+ borderColor: "stroke.subtle",
71
+ _hover: {
72
+ borderColor: "stroke.hover"
73
+ },
74
+ _highlighted: {
75
+ borderColor: "stroke.hover"
76
+ }
77
+ }
78
+ },
79
+ list: {
80
+ root: {
81
+ borderTop: "1px solid",
82
+ borderTopColor: "stroke.subtle",
83
+ borderBottom: "1px solid",
84
+ borderBottomColor: "transparent",
85
+ marginTop: "-1px",
86
+ _first: {
87
+ borderTopColor: "transparent",
88
+ _hover: {
89
+ borderTopColor: "stroke.hover"
90
+ },
91
+ _highlighted: {
92
+ borderTopColor: "stroke.hover"
93
+ }
94
+ },
95
+ _last: {
96
+ borderBottomColor: "stroke.subtle"
97
+ },
98
+ "&:hover + &": {
99
+ borderTopColor: "stroke.hover"
100
+ },
101
+ "&[data-highlighted] + &": {
102
+ borderTopColor: "stroke.hover"
103
+ },
104
+ _hover: {
105
+ borderBottomColor: "transparent",
106
+ borderTopColor: "stroke.hover",
107
+ _last: {
108
+ borderBottomColor: "stroke.hover"
109
+ }
110
+ },
111
+ _highlighted: {
112
+ borderTopColor: "stroke.hover",
113
+ _last: {
114
+ borderBottomColor: "stroke.hover"
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+ }
121
+ });
122
+ const {
123
+ withProvider,
124
+ withContext
125
+ } = (0, _createStyleContext.createStyleContext)(listItemRecipe);
126
+ const ListItemRoot = exports.ListItemRoot = withProvider(_react2.ark.div, "root", {
127
+ baseComponent: true
128
+ });
129
+ const InternalListItemHeading = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
130
+ let {
131
+ textStyle = "label.medium",
132
+ ...props
133
+ } = _ref;
134
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.Heading, {
135
+ textStyle: textStyle,
136
+ ...props,
137
+ ref: ref
138
+ });
139
+ });
140
+ const ListItemHeading = exports.ListItemHeading = withContext(InternalListItemHeading, "title");
141
+ const ListItemContent = exports.ListItemContent = withContext(_react2.ark.div, "content", {
142
+ baseComponent: true
143
+ });
144
+ const ListItemImage = exports.ListItemImage = withContext(_Image.Image, "image");
package/lib/Menu.d.ts CHANGED
@@ -72,7 +72,7 @@ export declare const MenuTriggerItem: import("react").ForwardRefExoticComponent<
72
72
  } & import("react").RefAttributes<HTMLDivElement>>;
73
73
  export declare const MenuTrigger: import("react").ForwardRefExoticComponent<{
74
74
  consumeCss?: boolean | undefined;
75
- } & import("@ndla/styled-system/types").WithCss & Menu.TriggerProps & import("react").RefAttributes<HTMLDivElement>>;
75
+ } & import("@ndla/styled-system/types").WithCss & Menu.TriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
76
76
  export declare const MenuSeparator: import("react").ForwardRefExoticComponent<{
77
77
  consumeCss?: boolean | undefined;
78
78
  } & import("@ndla/styled-system/types").WithCss & Menu.SeparatorProps & import("react").RefAttributes<HTMLHRElement>>;
package/lib/RadioGroup.js CHANGED
@@ -133,6 +133,7 @@ const InternalRadioGroupLabel = exports.InternalRadioGroupLabel = withContext(_r
133
133
  const RadioGroupLabel = exports.RadioGroupLabel = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
134
134
  let {
135
135
  textStyle = "label.large",
136
+ children,
136
137
  ...props
137
138
  } = _ref2;
138
139
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalRadioGroupLabel, {
@@ -140,7 +141,8 @@ const RadioGroupLabel = exports.RadioGroupLabel = /*#__PURE__*/(0, _react.forwar
140
141
  ...props,
141
142
  asChild: true,
142
143
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Label.Label, {
143
- textStyle: textStyle
144
+ textStyle: textStyle,
145
+ children: children
144
146
  })
145
147
  });
146
148
  });
package/lib/index.d.ts CHANGED
@@ -38,6 +38,8 @@ export { Picture, Img, Image, makeSrcQueryString, getSrcSet } from "./Image";
38
38
  export { Input, FieldInput, InputContainer, TextArea, FieldTextArea } from "./Input";
39
39
  export type { LabelProps, LegendProps, FieldsetLegendProps } from "./Label";
40
40
  export { Label, FieldLabel, Legend, FieldsetLegend } from "./Label";
41
+ export type { ListItemVariantProps, ListItemProps } from "./ListItem/ListItem";
42
+ export { ListItemRoot, ListItemHeading, ListItemContent, ListItemImage } from "./ListItem/ListItem";
41
43
  export type { MenuRootProps, MenuItemVariantProps, MenuItemProps } from "./Menu";
42
44
  export { MenuRoot, MenuContent, MenuItemGroupLabel, MenuItemGroup, MenuItem, MenuPositioner, MenuTriggerItem, MenuTrigger, MenuSeparator, } from "./Menu";
43
45
  export type { MessageBoxVariantProps, MessageBoxProps } from "./MessageBox";
package/lib/index.js CHANGED
@@ -417,6 +417,30 @@ Object.defineProperty(exports, "Legend", {
417
417
  return _Label.Legend;
418
418
  }
419
419
  });
420
+ Object.defineProperty(exports, "ListItemContent", {
421
+ enumerable: true,
422
+ get: function () {
423
+ return _ListItem.ListItemContent;
424
+ }
425
+ });
426
+ Object.defineProperty(exports, "ListItemHeading", {
427
+ enumerable: true,
428
+ get: function () {
429
+ return _ListItem.ListItemHeading;
430
+ }
431
+ });
432
+ Object.defineProperty(exports, "ListItemImage", {
433
+ enumerable: true,
434
+ get: function () {
435
+ return _ListItem.ListItemImage;
436
+ }
437
+ });
438
+ Object.defineProperty(exports, "ListItemRoot", {
439
+ enumerable: true,
440
+ get: function () {
441
+ return _ListItem.ListItemRoot;
442
+ }
443
+ });
420
444
  Object.defineProperty(exports, "MenuContent", {
421
445
  enumerable: true,
422
446
  get: function () {
@@ -1066,6 +1090,7 @@ var _Hero = require("./Hero");
1066
1090
  var _Image = require("./Image");
1067
1091
  var _Input = require("./Input");
1068
1092
  var _Label = require("./Label");
1093
+ var _ListItem = require("./ListItem/ListItem");
1069
1094
  var _Menu = require("./Menu");
1070
1095
  var _MessageBox = require("./MessageBox");
1071
1096
  var _NdlaLogo = require("./NdlaLogo");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/primitives",
3
- "version": "1.0.0-alpha.0",
3
+ "version": "1.0.2-alpha.0",
4
4
  "description": "Primitive components for NDLA.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -29,12 +29,12 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@ark-ui/react": "^3.6.2",
32
- "@ndla/styled-system": "^0.0.9",
32
+ "@ndla/styled-system": "^0.0.10",
33
33
  "@ndla/util": "^4.1.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@ndla/preset-panda": "^0.0.13",
37
- "@pandacss/dev": "^0.42.0"
36
+ "@ndla/preset-panda": "^0.0.14",
37
+ "@pandacss/dev": "^0.44.0"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "react": ">= 18",
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "3e0d75a9fd5cca419ac16f3933be6d905fe405c9"
46
+ "gitHead": "45fb10125bc642d020ed37c03b9492976ef7f0d6"
47
47
  }