@canonical/react-ds-core 0.10.0-experimental.5 → 0.10.0-experimental.6

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.
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./styles.css";
3
+ const componentCssClassName = "ds section";
4
+ /**
5
+ * The `<Section>` component groups related content.
6
+ * Sections can have varying visual spacing levels to organize information according to an information hierarchy.
7
+ *
8
+ * @implements syntax:core:component:section:1.0.0
9
+ */
10
+ const Section = ({ className, children, spacing, bordered = false, ...props }) => {
11
+ return (_jsx("section", { className: [
12
+ componentCssClassName,
13
+ bordered && "bordered",
14
+ spacing,
15
+ className,
16
+ ]
17
+ .filter(Boolean)
18
+ .join(" "), ...props, children: children }));
19
+ };
20
+ export default Section;
21
+ //# sourceMappingURL=Section.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Section.js","sourceRoot":"","sources":["../../../../src/ui/Section/Section.tsx"],"names":[],"mappings":";AAIA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,OAAO,GAAG,CAAC,EACf,SAAS,EACT,QAAQ,EACR,OAAO,EACP,QAAQ,GAAG,KAAK,EAChB,GAAG,KAAK,EACK,EAAsB,EAAE;IACrC,OAAO,CACL,kBACE,SAAS,EAAE;YACT,qBAAqB;YACrB,QAAQ,IAAI,UAAU;YACtB,OAAO;YACP,SAAS;SACV;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,KACR,KAAK,YAER,QAAQ,GACD,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,2 @@
1
+ export const SECTION_SPACING = ["shallow", "deep", "hero"];
2
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/ui/Section/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ /* @canonical/generator-ds 0.10.0-experimental.2 */
2
+ export { default as Section } from "./Section.js";
3
+ export * from "./types.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/Section/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AAEnD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,cAAc,YAAY,CAAC"}
@@ -0,0 +1,50 @@
1
+ /* @canonical/generator-ds 0.10.0-experimental.2 */
2
+
3
+ .ds.section {
4
+ --section-padding-bottom: var(--section-padding-bottom-spacing-default);
5
+
6
+ /*
7
+ Section top padding is the sum of padding applied by two props - `spacing` and `bordered`.
8
+ We namespace each padding type, then add them together in the final padding-top declaration.
9
+ */
10
+ --section-padding-top-spacing: var(--section-padding-top-spacing-default);
11
+ --section-padding-top-bordered: var(--section-padding-top-bordered-default);
12
+
13
+ &.bordered {
14
+ /* Top padding subtracts border height */
15
+ --section-padding-top-bordered: var(--section-padding-top-bordered-true);
16
+ border-top-color: var(--section-border-start-color);
17
+ border-top-style: var(--section-border-start-style);
18
+ border-top-width: var(--section-border-start-width);
19
+ }
20
+
21
+ /*
22
+ Spacing variants
23
+ Note that top padding is only defined for the hero variant in our core setup.
24
+ The top padding is still bound here in case users customize their tokens.
25
+ */
26
+ &.shallow {
27
+ --section-padding-bottom: var(--section-padding-bottom-spacing-shallow);
28
+ --section-padding-top-spacing: var(--section-padding-top-spacing-shallow);
29
+ }
30
+
31
+ &.deep {
32
+ --section-padding-bottom: var(--section-padding-bottom-spacing-deep);
33
+ --section-padding-top-spacing: var(--section-padding-top-spacing-deep);
34
+ /* TODO add responsiveness https://github.com/canonical/vanilla-framework/blob/6af35433368f82d76d8deb7effebca47b434ee76/scss/_patterns_section.scss#L16-L18 */
35
+ }
36
+
37
+ &.hero {
38
+ --section-padding-bottom: var(--section-padding-bottom-spacing-hero);
39
+ --section-padding-top-spacing: var(--section-padding-top-spacing-hero);
40
+
41
+ /* TODO add responsiveness https://github.com/canonical/vanilla-framework/blob/6af35433368f82d76d8deb7effebca47b434ee76/scss/_patterns_section.scss#L32-L34 */
42
+ }
43
+
44
+ padding-bottom: var(--section-padding-bottom);
45
+ /* Padding-top is applied by both the `spacing` prop and the `bordered` props */
46
+ padding-top: calc(
47
+ var(--section-padding-top-spacing) +
48
+ var(--section-padding-top-bordered)
49
+ );
50
+ }
@@ -0,0 +1,3 @@
1
+ /* @canonical/generator-ds 0.10.0-experimental.2 */
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ui/Section/types.ts"],"names":[],"mappings":"AAAA,mDAAmD"}
@@ -5,6 +5,7 @@ export * from "./Chip/index.js";
5
5
  export * from "./Icon/index.js";
6
6
  export * from "./Link/index.js";
7
7
  export * from "./Rule/index.js";
8
+ export * from "./Section/index.js";
8
9
  export * from "./SkipLink/index.js";
9
10
  export * from "./Tooltip/index.js";
10
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type React from "react";
2
+ import type { SectionProps } from "./types.js";
3
+ import "./styles.css";
4
+ /**
5
+ * The `<Section>` component groups related content.
6
+ * Sections can have varying visual spacing levels to organize information according to an information hierarchy.
7
+ *
8
+ * @implements syntax:core:component:section:1.0.0
9
+ */
10
+ declare const Section: ({ className, children, spacing, bordered, ...props }: SectionProps) => React.ReactElement;
11
+ export default Section;
12
+ //# sourceMappingURL=Section.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Section.d.ts","sourceRoot":"","sources":["../../../../src/ui/Section/Section.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,cAAc,CAAC;AAItB;;;;;GAKG;AACH,QAAA,MAAM,OAAO,GAAI,sDAMd,YAAY,KAAG,KAAK,CAAC,YAgBvB,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const SECTION_SPACING: string[];
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/ui/Section/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,UAA8B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as Section } from "./Section.js";
2
+ export * from "./types.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ui/Section/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,cAAc,YAAY,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { HTMLAttributes, ReactNode } from "react";
2
+ import type { SECTION_SPACING } from "./constants.js";
3
+ export type SectionSpacing = (typeof SECTION_SPACING)[number];
4
+ /**
5
+ We have used the `HTMLDivElement` as a default props base.
6
+ If your component is based on a different HTML element, please update it accordingly.
7
+ See https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API for a full list of HTML elements interfaces.
8
+ */
9
+ export interface SectionProps extends HTMLAttributes<HTMLDivElement> {
10
+ /** Additional CSS classes */
11
+ className?: string;
12
+ /** Child elements */
13
+ children: ReactNode;
14
+ /**
15
+ Spacing variant of the section
16
+ FLAG: Unique, potentially inconsistent/unstable API
17
+ */
18
+ spacing?: SectionSpacing;
19
+ /** Whether the section has a top border */
20
+ bordered?: boolean;
21
+ }
22
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ui/Section/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D;;;;EAIE;AACF,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAC,cAAc,CAAC;IAClE,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,QAAQ,EAAE,SAAS,CAAC;IACpB;;;MAGE;IACF,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
@@ -5,6 +5,7 @@ export * from "./Chip/index.js";
5
5
  export * from "./Icon/index.js";
6
6
  export * from "./Link/index.js";
7
7
  export * from "./Rule/index.js";
8
+ export * from "./Section/index.js";
8
9
  export * from "./SkipLink/index.js";
9
10
  export * from "./Tooltip/index.js";
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonical/react-ds-core",
3
- "version": "0.10.0-experimental.5",
3
+ "version": "0.10.0-experimental.6",
4
4
  "type": "module",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -38,9 +38,9 @@
38
38
  "test:vitest:watch": "vitest"
39
39
  },
40
40
  "dependencies": {
41
- "@canonical/ds-assets": "^0.10.0-experimental.5",
42
- "@canonical/storybook-config": "^0.10.0-experimental.5",
43
- "@canonical/styles": "^0.10.0-experimental.5",
41
+ "@canonical/ds-assets": "^0.10.0-experimental.6",
42
+ "@canonical/storybook-config": "^0.10.0-experimental.6",
43
+ "@canonical/styles": "^0.10.0-experimental.6",
44
44
  "@canonical/utils": "^0.10.0-experimental.4",
45
45
  "react": "^19.1.0",
46
46
  "react-dom": "^19.1.0"
@@ -66,5 +66,5 @@
66
66
  "vite-tsconfig-paths": "^5.1.4",
67
67
  "vitest": "^3.2.3"
68
68
  },
69
- "gitHead": "467161a7c642004bf423a62ca1e76e0e31f568c3"
69
+ "gitHead": "38a018056a27bd884152a00c1265b95772a8eb61"
70
70
  }