@design-system-rte/core 0.21.0 → 1.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # @design-system-rte/core
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - aa4024c: ## Changes
8
+ - (Core) add Nunito font to serve to react and angular package
9
+
10
+ - ddb8b02: ## Changes
11
+ - (Core) add elevation mixins
12
+
13
+ ## 1.0.0
14
+
15
+ ### Major Changes
16
+
17
+ - adc4eb6: ## Changes
18
+ - (Public Release) Public Release
19
+
20
+ ### Minor Changes
21
+
22
+ - 90fd2b4: ## Changes
23
+ - (Toast) extract getToastPriority logic to core + use computed to display actionButton + add custom icon to input
24
+ - (Toast) add angular component
25
+ - (Toast) add spacing from viewport + handle warning case in priority + add leftIcon and action button display boolean
26
+ - (Toast) add priority queue management
27
+ - (Toast) add basic react component
28
+
29
+ - 1b87a18: ## Changes
30
+ - (Button) set correct position to badge
31
+ - (Button) add badge
32
+
33
+ - f3d1179: ## Changes
34
+ - (Banner) remove show icon props + remove top and left radius corner
35
+ - (Banner) update design
36
+
3
37
  ## 0.21.0
4
38
 
5
39
  ### Minor Changes
@@ -1,2 +1,4 @@
1
1
  export type Position = "auto" | "top" | "bottom" | "left" | "right";
2
2
  export type Alignment = "start" | "center" | "end";
3
+ export type Theme = "bleu_iceberg" | "violet" | "vert_foret";
4
+ export type Mode = "light" | "dark";
@@ -4,12 +4,11 @@ export interface BannerProps {
4
4
  position?: BannerPosition;
5
5
  title?: string;
6
6
  closable?: boolean;
7
- showIcon?: boolean;
8
7
  onClose?: () => void;
9
8
  actionCallback?: () => void;
10
9
  actionLabel?: string;
11
10
  isOpen?: boolean;
12
11
  }
13
12
 
14
- export type BannerType = "default" | "alert";
13
+ export type BannerType = "info" | "error" | "success" | "warning";
15
14
  export type BannerPosition = "overlay" | "push";
@@ -7,4 +7,8 @@ export interface ButtonProps {
7
7
  size?: import("./common/common-button").ButtonSize;
8
8
  disabled?: boolean;
9
9
  iconPosition?: ButtonIconPosition;
10
+ badgeContent?: import("../../badge/badge.interface").BadgeContent;
11
+ badgeCount?: import("../../badge/badge.interface").BadgeCount;
12
+ badgeType?: import("../../badge/badge.interface").BadgeType;
13
+ badgeIcon?: import("../../badge/badge.interface").BadgeProps["icon"];
10
14
  }
@@ -1,7 +1,15 @@
1
+ import { BadgeSize } from "../../badge/badge.interface";
2
+
1
3
  import { ButtonSize } from "./common-button";
2
4
 
3
- export const buttonIconSize: Record<ButtonSize, number> = {
5
+ export const ButtonIconSize: Record<ButtonSize, number> = {
4
6
  s: 16,
5
7
  m: 20,
6
8
  l: 24,
7
9
  };
10
+
11
+ export const ButtonBadgeSizeMapping: Record<ButtonSize, BadgeSize> = {
12
+ s: "m",
13
+ m: "m",
14
+ l: "l",
15
+ };
@@ -1,4 +1,5 @@
1
- @use '@design-system-rte/core/design-tokens/main.scss' as *;
1
+ @use '../../design-tokens/tokens/_spacing.scss' as *;
2
+ @use '../../design-tokens/tokens/_layout.scss' as *;
2
3
 
3
4
  $grid-max-width-narrow: 864px;
4
5
  $grid-max-width-wide: 1296px;
@@ -1,5 +1,6 @@
1
- @use '@design-system-rte/core/design-tokens/main.scss' as *;
2
1
  @use '@design-system-rte/core/design-tokens/primitives/_colors.scss' as *;
2
+ @use '../../design-tokens/tokens/_spacing.scss' as *;
3
+ @use '../../design-tokens/tokens/_mixins.scss' as *;
3
4
 
4
5
  .sb-css-grid-container {
5
6
  background-color: $jaune-indications-200;
@@ -6,3 +6,10 @@ export const IconSize: Record<Exclude<Size, "xs">, number> = {
6
6
  l: 24,
7
7
  xl: 32,
8
8
  };
9
+
10
+ export const IconTypeMap: Record<string, string> = {
11
+ info: "info",
12
+ error: "dangerous",
13
+ success: "check-circle",
14
+ warning: "warning",
15
+ };
@@ -1,4 +1,4 @@
1
- import { IconSize } from "../../icon/icon.constants";
1
+ import { IconSize } from "@design-system-rte/core/components/icon/icon.constants";
2
2
 
3
3
  export function getNavItemLabelIconSize(isNested = false, collapsed = false): number {
4
4
  if (isNested) {
@@ -0,0 +1,9 @@
1
+ const TOAST_DURATION_SMALL = 3000;
2
+ const TOAST_DURATION_MEDIUM = 5000;
3
+ const TOAST_DURATION_LARGE = 8000;
4
+
5
+ export const ToastDurationMap = {
6
+ short: TOAST_DURATION_SMALL,
7
+ medium: TOAST_DURATION_MEDIUM,
8
+ long: TOAST_DURATION_LARGE,
9
+ };
@@ -0,0 +1,21 @@
1
+ export type ToastType = "info" | "success" | "warning" | "error" | "neutral";
2
+
3
+ export type ToastDuration = "short" | "medium" | "long";
4
+
5
+ export type ToastPlacement = "top-right" | "top-left" | "bottom-right" | "bottom-left" | "bottom-center";
6
+
7
+ export interface ToastProps {
8
+ message: string;
9
+ isOpen?: boolean;
10
+ type?: ToastType;
11
+ duration?: ToastDuration;
12
+ onClose?: () => void;
13
+ placement?: ToastPlacement;
14
+ closable?: boolean;
15
+ autoDismiss?: boolean;
16
+ iconName?: string;
17
+ showLeftIcon?: boolean;
18
+ showActionButton?: boolean;
19
+ actionButtonLabel?: string;
20
+ onActionButtonClick?: () => void;
21
+ }
@@ -0,0 +1,33 @@
1
+ export const getToastPriority = (toast: {
2
+ hasActionButton: boolean;
3
+ type: "info" | "success" | "warning" | "error" | "neutral";
4
+ }) => {
5
+ const { hasActionButton: hasButtonAction, type } = toast;
6
+ if (hasButtonAction) {
7
+ switch (type) {
8
+ case "error":
9
+ return 1;
10
+ case "warning":
11
+ return 3;
12
+ case "success":
13
+ return 5;
14
+ case "info":
15
+ return 6;
16
+ default:
17
+ return 7;
18
+ }
19
+ } else {
20
+ switch (type) {
21
+ case "error":
22
+ return 2;
23
+ case "warning":
24
+ return 4;
25
+ case "success":
26
+ return 8;
27
+ case "info":
28
+ return 9;
29
+ default:
30
+ return 10;
31
+ }
32
+ }
33
+ };
@@ -1,4 +1,4 @@
1
- import { TOOLTIP_GAP, TOOLTIP_GAP_ARROW } from "./tooltip.constants";
1
+ import { TOOLTIP_GAP, TOOLTIP_GAP_ARROW } from "@design-system-rte/core/components/tooltip/tooltip.constants";
2
2
 
3
3
  export function getTooltipGap(arrow: boolean, customGap: number = TOOLTIP_GAP): number {
4
4
  return arrow ? TOOLTIP_GAP_ARROW + customGap : customGap;
@@ -0,0 +1 @@
1
+ @font-face{font-display:swap;font-family:"Nunito";font-style:normal;font-weight:300;src:url("@design-system-rte/core/assets/fonts/nunito-light-300.woff2") format("woff2")}@font-face{font-display:swap;font-family:"Nunito";font-style:normal;font-weight:400;src:url("@design-system-rte/core/assets/fonts/nunito-regular-400.woff2") format("woff2")}@font-face{font-display:swap;font-family:"Nunito";font-style:normal;font-weight:600;src:url("@design-system-rte/core/assets/fonts/nunito-semi-bold-600.woff2") format("woff2")}@font-face{font-display:swap;font-family:"Nunito";font-style:normal;font-weight:700;src:url("@design-system-rte/core/assets/fonts/nunito-bold-700.woff2") format("woff2")}
@@ -0,0 +1,51 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+
4
+ import sass from "sass";
5
+
6
+ const outputDir = path.resolve(__dirname, "css");
7
+
8
+ if (!fs.existsSync(outputDir)) {
9
+ fs.mkdirSync(outputDir);
10
+ }
11
+
12
+ const fontFile = `
13
+ @font-face {
14
+ font-display: swap;
15
+ font-family: 'Nunito';
16
+ font-style: normal;
17
+ font-weight: 300;
18
+ src: url('@design-system-rte/core/assets/fonts/nunito-light-300.woff2') format('woff2');
19
+ }
20
+
21
+ @font-face {
22
+ font-display: swap;
23
+ font-family: 'Nunito';
24
+ font-style: normal;
25
+ font-weight: 400;
26
+ src: url('@design-system-rte/core/assets/fonts/nunito-regular-400.woff2') format('woff2');
27
+ }
28
+
29
+ @font-face {
30
+ font-display: swap;
31
+ font-family: 'Nunito';
32
+ font-style: normal;
33
+ font-weight: 600;
34
+ src: url('@design-system-rte/core/assets/fonts/nunito-semi-bold-600.woff2') format('woff2');
35
+ }
36
+
37
+ @font-face {
38
+ font-display: swap;
39
+ font-family: 'Nunito';
40
+ font-style: normal;
41
+ font-weight: 700;
42
+ src: url('@design-system-rte/core/assets/fonts/nunito-bold-700.woff2') format('woff2');
43
+ }
44
+ `;
45
+
46
+ const fontResult = sass.compileString(fontFile, {
47
+ loadPaths: [path.resolve(__dirname)],
48
+ style: "compressed",
49
+ });
50
+
51
+ fs.writeFileSync(path.join(outputDir, "rte-fonts.css"), fontResult.css);
@@ -0,0 +1,31 @@
1
+ @font-face {
2
+ font-display: swap;
3
+ font-family: 'Nunito';
4
+ font-style: normal;
5
+ font-weight: 300;
6
+ src: url('/assets/fonts/nunito-light-300.woff2') format('woff2');
7
+ }
8
+
9
+ @font-face {
10
+ font-display: swap;
11
+ font-family: 'Nunito';
12
+ font-style: normal;
13
+ font-weight: 400;
14
+ src: url('/assets/fonts/nunito-regular-400.woff2') format('woff2');
15
+ }
16
+
17
+ @font-face {
18
+ font-display: swap;
19
+ font-family: 'Nunito';
20
+ font-style: normal;
21
+ font-weight: 600;
22
+ src: url('/assets/fonts/nunito-semi-bold-600.woff2') format('woff2');
23
+ }
24
+
25
+ @font-face {
26
+ font-display: swap;
27
+ font-family: 'Nunito';
28
+ font-style: normal;
29
+ font-weight: 700;
30
+ src: url('/assets/fonts/nunito-bold-700.woff2') format('woff2');
31
+ }
@@ -1,4 +1,5 @@
1
1
  @forward "main";
2
2
  @forward "tokens/gradient";
3
3
  @forward 'primitives/colors';
4
- @forward 'tokens/zindex';
4
+ @forward 'tokens/zindex';
5
+ @forward 'tokens/shadows';
@@ -5,7 +5,4 @@
5
5
  @forward "tokens/opacity";
6
6
  @forward "tokens/mixins";
7
7
  @forward "tokens/themes";
8
- @forward "tokens/elevation";
9
-
10
- @import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:wght,FILL,GRAD@400,0,0&display=swap");
11
- @import url('https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap');
8
+ @forward "tokens/elevation";
@@ -29,6 +29,16 @@
29
29
  background: linear-gradient(0deg, var(--elevation-surface-shadow-2) 0%, var(--elevation-surface-shadow-2) 100%);
30
30
  }
31
31
 
32
+ @mixin neutral-drop-shadow-2 {
33
+ filter:
34
+ drop-shadow($shadow-2-key-position-x $shadow-2-key-position-y $shadow-2-key-blur var(--elevation-shadow-key)) drop-shadow($ambient-shadow-position-x $ambient-shadow-position-y $ambient-shadow-blur var(--elevation-shadow-ambient));
35
+ }
36
+
37
+ @mixin elevation-neutral-drop-shadow-2 {
38
+ @include neutral-drop-shadow-2;
39
+ background: linear-gradient(0deg, var(--elevation-surface-shadow-2) 0%, var(--elevation-surface-shadow-2) 100%);
40
+ }
41
+
32
42
  @mixin neutral-shadow-3 {
33
43
  box-shadow: $shadow-3-key-position-x $shadow-3-key-position-y $shadow-3-key-blur $shadow-3-key-spread var(--elevation-shadow-key),
34
44
  $ambient-shadow-position-x $ambient-shadow-position-y $ambient-shadow-blur $ambient-shadow-spread var(--elevation-shadow-ambient);
@@ -198,6 +198,24 @@
198
198
  letter-spacing: $heading-m-semibold-letter-spacing;
199
199
  }
200
200
 
201
+ @mixin typography-heading-l {
202
+ @include typography-heading;
203
+ font-family: $heading-l-semibold-font-family;
204
+ font-weight: $heading-l-semibold-font-weight;
205
+ font-size: $heading-l-semibold-font-size;
206
+ line-height: $heading-l-semibold-line-height;
207
+ letter-spacing: $heading-l-semibold-letter-spacing;
208
+ }
209
+
210
+ @mixin typography-heading-xl {
211
+ @include typography-heading;
212
+ font-family: $heading-xl-semibold-font-family;
213
+ font-weight: $heading-xl-semibold-font-weight;
214
+ font-size: $heading-xl-semibold-font-size;
215
+ line-height: $heading-xl-semibold-line-height;
216
+ letter-spacing: $heading-xl-semibold-letter-spacing;
217
+ }
218
+
201
219
  @mixin typography-checkbox-error {
202
220
  @include typography-text-s;
203
221
  font-weight: $text-s-bold-font-weight;
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@design-system-rte/core",
3
- "version": "0.21.0",
3
+ "version": "1.1.0",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "lint": "eslint .",
7
7
  "lint:fix": "eslint . --fix",
8
8
  "test": "vitest run",
9
- "build": "npm run build:css-themes",
9
+ "build": "npm run build:css-themes && npm run build:css-fonts",
10
10
  "build:css-themes": "ts-node css-theme-generator.ts",
11
+ "build:css-fonts": "ts-node css-font-generator.ts",
11
12
  "generate:tokens": "ts-node ./design-tokens/generator.ts",
12
13
  "prepublishOnly": "npm run build"
13
14
  },
Binary file