Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d469b29
[CCUBE-1703][WL] update dependencies
ngweili Mar 26, 2025
bce2745
[CCUBE-1703][WL] use v3 stylesheets
ngweili Mar 26, 2025
e441880
[CCUBE-1703][WL] switch to v2 tokens
ngweili Mar 26, 2025
eb435fe
[CCUBE-1703][WL] migrate theme usage
ngweili Apr 1, 2025
b867729
[CCUBE-1703][WL] use v3 colour tokens
ngweili Apr 1, 2025
4525e8e
[CCUBE-1703][WL] use v3 typography tokens
ngweili Apr 1, 2025
8087b67
[CCUBE-1703][WL] use v3 font token
ngweili Apr 2, 2025
9b6757b
[CCUBE-1703][WL] use v3 media query token
ngweili Apr 3, 2025
315ba68
[CCUBE-1703][WL] rest of the v3 token switch
ngweili Apr 3, 2025
e6ff62b
[CCUBE-1703][WL] fix radio items type conflict
ngweili Apr 10, 2025
36b3a04
[CCUBE-1703][WL] fix broken test cases
ngweili Apr 14, 2025
3054efb
[CCUBE-1703][WL] temporary fix to base generated schema desktop columns
ngweili Apr 14, 2025
2e0ee9b
[CCUBE-1703][WL] introduce custom 2xl screen size
ngweili Apr 20, 2025
fb080a0
[CCUBE-1703][WL] remove unused media queries
ngweili Apr 20, 2025
1d5bdeb
[CCUBE-1703][WL] fix typography usage
ngweili Apr 20, 2025
39e64ea
[CCUBE-1703][WL] fix resolve error
ngweili Apr 20, 2025
51ff874
[CCUBE-1703][WL] migrate to v3 border tokens
ngweili Apr 21, 2025
0321aae
[CCUBE-1703][WL] migrate to v3 radius token
ngweili Apr 21, 2025
6bed99e
[CCUBE-1703][WL] migrate to v3 motion tokens
ngweili Apr 21, 2025
ce17d31
[CCUBE-1703][WL] downgrade react-hook-form to fix read only errors an…
ngweili Apr 23, 2025
a091827
[CCUBE-1703][WL] use background-color to avoid interfering with dashe…
ngweili Apr 24, 2025
92ffdc8
[CCUBE-1703][WL] fix border radius styles
ngweili Apr 24, 2025
7712712
[CCUBE-1703][WL] further fixes to use background-color to avoid inter…
ngweili Apr 25, 2025
0c0efac
[CCUBE-1703][WL] apply the correct radius tokens
ngweili Apr 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
/>
<link
rel="stylesheet"
href="https://assets.life.gov.sg/react-design-system/v2/css/main.css"
href="https://assets.life.gov.sg/react-design-system/v3/css/main.css"
/>
<link
rel="stylesheet"
href="https://assets.life.gov.sg/react-design-system/v3/css/open-sans.css"
/>

<style>
Expand Down
4 changes: 2 additions & 2 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseTheme } from "@lifesg/react-design-system/theme";
import { LifeSGTheme } from "@lifesg/react-design-system/theme";
import { withThemeFromJSXProvider } from "@storybook/addon-themes";
import { INITIAL_VIEWPORTS } from "@storybook/addon-viewport";
import { ThemeProvider } from "styled-components";
Expand All @@ -7,7 +7,7 @@ const preview = {
decorators: [
withThemeFromJSXProvider({
themes: {
LifeSG: BaseTheme,
LifeSG: LifeSGTheme,
},
Provider: ThemeProvider,
}),
Expand Down
13,857 changes: 6,919 additions & 6,938 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 12 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@dnd-kit/core": "^6.0.8",
"@dnd-kit/sortable": "^7.0.2",
"@hookform/resolvers": "^3.3.4",
"react-hook-form": "^7.51.1",
"react-hook-form": "^7.54.2",
"use-immer": "^0.9.0",
"yup": "^1.4.0"
},
Expand All @@ -45,13 +45,16 @@
"@babel/preset-env": "^7.16.11",
"@babel/preset-react": "^7.16.7",
"@babel/preset-typescript": "^7.16.7",
"@lifesg/react-icons": "^1.4.0",
"@lifesg/react-design-system": "^2.7.0-canary.3",
"@lifesg/web-frontend-engine": "^1.10.3",
"@floating-ui/dom": "^1.6.13",
"@floating-ui/react": "^0.26.28",
"@lifesg/react-design-system": "^3.0.0-alpha.6",
"@lifesg/react-icons": "^1.10.0",
"@lifesg/web-frontend-engine": "^2.0.0-alpha.1",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-image": "^3.0.3",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@storybook/addon-a11y": "^7.4.6",
"@storybook/addon-actions": "^7.4.6",
"@storybook/addon-essentials": "^7.4.6",
Expand Down Expand Up @@ -91,17 +94,18 @@
"rollup": "^3.29.4",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.36.0",
"storybook": "^7.4.6",
"styled-components": "^5.3.5",
"typescript": "^4.8.2",
"typescript-eslint": "^7.1.0"
},
"peerDependencies": {
"@lifesg/react-icons": "^1.4.0",
"@lifesg/react-design-system": "^2.7.0-canary.3",
"@lifesg/web-frontend-engine": "^1.10.3",
"@floating-ui/dom": "^1.6.10",
"@floating-ui/react": "^0.26.23",
"@lifesg/react-design-system": "^3.0.0-alpha.6",
"@lifesg/react-icons": "^1.10.0",
"@lifesg/web-frontend-engine": "^2.0.0-alpha.1",
"react": "^17.0.2 || ^18.0.0",
"react-dom": "^17.0.2 || ^18.0.0",
"styled-components": "^5.3.5"
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import commonjs from "@rollup/plugin-commonjs";
import image from "@rollup/plugin-image";
import json from "@rollup/plugin-json";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import terser from "@rollup/plugin-terser";
import peerDepsExternal from "rollup-plugin-peer-deps-external";
import postcss from "rollup-plugin-postcss";
import { terser } from "rollup-plugin-terser";
import typescript from "rollup-plugin-typescript2";
import pkg from "./package.json";

Expand Down
23 changes: 15 additions & 8 deletions src/components/common/base-card/base-card.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Color } from "@lifesg/react-design-system/color";
import { Border, Colour, Radius } from "@lifesg/react-design-system/theme";
import styled, { css } from "styled-components";

// =============================================================================
Expand All @@ -13,7 +13,6 @@ interface IBodyStyleProps {
// =============================================================================
export const Body = styled.div<IBodyStyleProps>`
padding: 1rem;
border-radius: 0.5rem;
cursor: pointer;
width: 100%;
position: relative;
Expand All @@ -24,19 +23,27 @@ export const Body = styled.div<IBodyStyleProps>`
${({ $focused }) =>
$focused
? css`
border: 1px solid ${Color.Primary};
background: ${Color.Accent.Light[5]};
${Border.Util.solid({
thickness: Border["width-010"],
colour: Colour["border-focus-strong"],
})};
background: ${Colour["bg-primary-subtlest"]};
`
: css`
border: 1px solid transparent;
${Border.Util.solid({
thickness: Border["width-010"],
colour: "transparent",
})};
`}

border-radius: ${Radius.md};

:hover {
border-color: ${Color.Primary};
box-shadow: 0px 2px 8px 0px ${Color.Shadow.Accent};
border-color: ${Colour["border-primary"]};
box-shadow: 0px 2px 8px 0px ${Colour["border-selected-subtle"]};
}

:focus {
outline-color: ${Color.Primary};
outline-color: ${Colour["border-primary"]};
}
`;
8 changes: 4 additions & 4 deletions src/components/common/base-card/card-icon.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Color } from "@lifesg/react-design-system/color";
import { Colour, Radius } from "@lifesg/react-design-system/theme";
import styled from "styled-components";

export const Container = styled.div`
width: 2rem;
height: 2rem;
display: grid;
place-items: center;
border-radius: 0.4rem;
background: ${Color.Accent.Light[5]};
border-radius: ${Radius.sm};
background: ${Colour["bg-primary-subtlest"]};

svg {
color: ${Color.Accent.Light[2]};
color: ${Colour["icon-primary-subtlest"]};
height: 1.5rem;
width: 1.5rem;
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/child-entry/child-entry.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Color } from "@lifesg/react-design-system/color";
import { Colour } from "@lifesg/react-design-system/theme";
import styled from "styled-components";

export const Wrapper = styled.div`
background: ${Color.Neutral[7]};
background: ${Colour["bg-strong"]};
display: flex;
flex: 1;
width: 100%;
Expand Down
57 changes: 37 additions & 20 deletions src/components/common/columns/columns.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { MediaQuery } from "@lifesg/react-design-system/media";
import { MediaQuery } from "@lifesg/react-design-system/theme";
import { FormBuilderMediaQuery } from "src/data";
import { css } from "styled-components";

// =========================================================================
Expand All @@ -7,33 +8,33 @@ import { css } from "styled-components";
const ELEMENT_CARD_SIZE_MAP = {
expanded: {
right: {
desktop4k: "4 / span 3",
desktopL: "5 / span 4",
tablet: "4 / span 3",
default: "4 / span 3",
"2xl": "5 / span 4",
xl: "4 / span 3",
},
left: {
desktop4k: "1 / span 3",
desktopL: "1 / span 4",
tablet: "1 / span 3",
default: "1 / span 3",
"2xl": "1 / span 4",
xl: "1 / span 3",
},
full: {
desktop4k: "1 / span 6",
desktopL: "1 / span 8",
tablet: "1 / span 6",
default: "1 / span 6",
"2xl": "1 / span 8",
xl: "1 / span 6",
},
},
minimised: {
right: {
desktop4k: "4 / span 3",
tablet: "4 / span 2",
default: "4 / span 3",
xl: "3 / span 2",
},
left: {
desktop4k: "1 / span 3",
tablet: "1 / span 2",
default: "1 / span 3",
xl: "1 / span 2",
},
full: {
desktop4k: "1 / span 6",
tablet: "1 / span 4",
default: "1 / span 6",
xl: "1 / span 4",
},
},
};
Expand All @@ -42,10 +43,26 @@ const ELEMENT_CARD_SIZE_MAP = {
// HELPER FUNCTIONS
// =============================================================================
const generateGridColumn = (breakpoints: { [key: string]: string }) => css`
${Object.entries(breakpoints).map(
([key, value]) =>
`${MediaQuery.MaxWidth[key]} { grid-column: ${value}; }`
)}
${Object.entries(breakpoints).map(([key, value]) => {
switch (key) {
case "2xl":
return css`
${FormBuilderMediaQuery.MaxWidth["2xl"]} {
grid-column: ${value};
}
`;
case "xl":
return css`
${MediaQuery.MaxWidth[key]} {
grid-column: ${value};
}
`;
default:
return css`
grid-column: ${value};
`;
}
})}
`;

export const generateElementCardView = (
Expand Down
6 changes: 4 additions & 2 deletions src/components/common/delete-button/delete-button.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Color } from "@lifesg/react-design-system/color";
import { Colour } from "@lifesg/react-design-system/theme";
import styled from "styled-components";

// =============================================================================
Expand All @@ -11,7 +11,9 @@ export const StyledBinButton = styled.button`
margin-top: 0.625rem;
svg {
color: ${({ disabled }) =>
disabled ? Color.Neutral[3] : Color.Accent.Light[1]};
disabled
? Colour["icon-disabled"]
: Colour["icon-primary-subtlest"]};
width: 1.625rem;
height: 1.625rem;
cursor: ${({ disabled }) => (disabled ? "not-allowed" : "pointer")};
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/icon-button/icon-button.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Color } from "@lifesg/react-design-system/color";
import { Colour } from "@lifesg/react-design-system/theme";
import styled from "styled-components";

// =============================================================================
Expand All @@ -23,7 +23,7 @@ export const IconButton = styled.button<IIconButtonStyleProps>`
}

:focus {
outline-color: ${Color.Primary};
outline-color: ${Colour["border-focus-strong"]};
}

svg {
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/icon-dropdown/icon-dropdown.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Color } from "@lifesg/react-design-system/color";
import { Colour } from "@lifesg/react-design-system/theme";
import styled from "styled-components";

export const Wrapper = styled.div`
Expand All @@ -7,7 +7,7 @@ export const Wrapper = styled.div`
gap: 1rem;

svg {
color: ${Color.Accent.Light[2]};
color: ${Colour["icon-primary-subtlest"]};
height: 1.5rem;
width: 1.5rem;
}
Expand Down
11 changes: 8 additions & 3 deletions src/components/common/icon-dropdown/icon-dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Form, Text } from "@lifesg/react-design-system";
import { Form } from "@lifesg/react-design-system";
import { Typography } from "@lifesg/react-design-system/typography";
import {
EElementType,
useBuilder,
Expand Down Expand Up @@ -52,15 +53,19 @@ export const IconDropdown = ({
return (
<Wrapper>
<CardIcon elementType={option} />
<Text.Body>{ELEMENT_BUTTON_LABELS[option]}</Text.Body>
<Typography.BodyBL>
{ELEMENT_BUTTON_LABELS[option]}
</Typography.BodyBL>
</Wrapper>
);
}}
selectedOption={type}
renderListItem={(option: EElementType) => (
<Wrapper>
<CardIcon elementType={option} />
<Text.Body>{ELEMENT_BUTTON_LABELS[option]}</Text.Body>
<Typography.BodyBL>
{ELEMENT_BUTTON_LABELS[option]}
</Typography.BodyBL>
</Wrapper>
)}
onSelectOption={(option) => onChange(option)}
Expand Down
14 changes: 8 additions & 6 deletions src/components/common/modal/bulk-edit-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { yupResolver } from "@hookform/resolvers/yup";
import { Form } from "@lifesg/react-design-system/form";
import { Text } from "@lifesg/react-design-system/text";
import { Typography } from "@lifesg/react-design-system/typography";
import { Controller, FormProvider, useForm } from "react-hook-form";
import { IBulkEditModalProps } from "src/context-providers";
import { BULK_EDIT_SCHEMA, TBulkEditData } from "src/yup-schemas/bulk-edit";
Expand Down Expand Up @@ -66,19 +66,21 @@ export const BulkEditModal = ({ modal }: IProps) => {
<FormProvider {...methods}>
<form onSubmit={methods.handleSubmit(handleFormSubmit)}>
<Wrapper data-testid="bulk-edit-modal">
<Text.H3 weight={600}>Bulk Edit</Text.H3>
<Text.Body weight={400}>
<Typography.HeadingSM weight="semibold">
Bulk Edit
</Typography.HeadingSM>
<Typography.BodyBL>
To add multiple entries at once, input each item on
a new line, separating the label and value with a
bar “|”.
</Text.Body>
<Text.H6 weight={400}>
</Typography.BodyBL>
<Typography.BodySM>
Example:
<br />
Banana | banana
<br />
Green Apple | green-apple
</Text.H6>
</Typography.BodySM>
<Controller
name="items"
control={methods.control}
Expand Down
9 changes: 0 additions & 9 deletions src/components/common/modal/generic-modal.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { MediaQuery } from "@lifesg/react-design-system/media";
import { Modal } from "@lifesg/react-design-system/modal";
import styled from "styled-components";

Expand All @@ -16,18 +15,10 @@ export const ModalBox = styled(Modal.Box)`
export const ModalInner = styled.div`
margin: 4rem;
text-align: center;

${MediaQuery.MaxWidth.mobileL} {
margin: 4rem 1.25rem;
}
`;

export const GrowContainer = styled.div`
margin: auto;
padding: 5rem 1.25rem;
width: 100%;

${MediaQuery.MaxWidth.mobileL} {
padding: 1rem 1.25rem;
}
`;
Loading