diff --git a/angular.json b/angular.json index b01aed2..1757d2b 100644 --- a/angular.json +++ b/angular.json @@ -46,7 +46,8 @@ "browserTarget": "lfx-component-lib:build", "compodoc": true, "compodocArgs": ["-e", "json", "-d", "projects/lfx-component-lib"], - "port": 6006 + "port": 6006, + "styles": ["projects/lfx-component-lib/src/lib/styles/index.scss"] } }, "build-storybook": { diff --git a/package.json b/package.json index 5e0f6f3..62c72b9 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,10 @@ "scripts": { "ng": "ng", "build-palette": "ts-node -O '{\"module\": \"commonjs\"}' ./scripts/build-palette.ts", - "build-colors": "ts-node -O '{\"module\": \"commonjs\"}' ./scripts/build-colors.ts", "build-constants": "ts-node -O '{\"module\": \"commonjs\"}' ./scripts/build-constants.ts", "start": "ng serve", "increase-patch": "npm version patch --prefix projects/lfx-component-lib", - "prebuild": "npm run increase-patch && npm run build-constants && npm run build-colors", + "prebuild": "npm run increase-patch && npm run build-constants", "build": "ng build", "postbuild": "npm run build --prefix projects/lfx-component-lib", "watch": "ng build --watch --configuration development", diff --git a/projects/lfx-component-lib/.storybook/main.ts b/projects/lfx-component-lib/.storybook/main.ts index a50f5c3..f34ddc3 100644 --- a/projects/lfx-component-lib/.storybook/main.ts +++ b/projects/lfx-component-lib/.storybook/main.ts @@ -8,7 +8,8 @@ const config: StorybookConfig = { '@storybook/addon-essentials', '@chromatic-com/storybook', '@storybook/addon-interactions', - '@storybook/addon-designs' + '@storybook/addon-designs', + '@storybook/addon-docs', ], framework: { name: '@storybook/angular', diff --git a/projects/lfx-component-lib/.storybook/preview.ts b/projects/lfx-component-lib/.storybook/preview.ts index 1c15e8d..8ec716e 100644 --- a/projects/lfx-component-lib/.storybook/preview.ts +++ b/projects/lfx-component-lib/.storybook/preview.ts @@ -1,6 +1,6 @@ -import type { Preview } from "@storybook/angular"; -import { setCompodocJson } from "@storybook/addon-docs/angular"; -import docJson from "../documentation.json"; +import type { Preview } from '@storybook/angular'; +import { setCompodocJson } from '@storybook/addon-docs/angular'; +import docJson from '../documentation.json'; setCompodocJson(docJson); diff --git a/projects/lfx-component-lib/documentation.json b/projects/lfx-component-lib/documentation.json index d7421f4..68c3636 100644 --- a/projects/lfx-component-lib/documentation.json +++ b/projects/lfx-component-lib/documentation.json @@ -10,6 +10,46 @@ "modules": [], "miscellaneous": { "variables": [ + { + "name": "AllColors", + "ctype": "miscellaneous", + "subtype": "variable", + "file": "projects/lfx-component-lib/src/lib/themes/text-colors.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "type": "Story", + "defaultValue": "{\n render: () => ({\n template: `\n
This is a paragraph of body text.
\nThis is a paragraph of body text.
\n This is a link textThis is a paragraph of body text.
\n This is small text (body2).\n `,\n }),\n}" + }, + { + "name": "BodyText", + "ctype": "miscellaneous", + "subtype": "variable", + "file": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "type": "Story", + "defaultValue": "{\n render: () => ({\n template: `\nThis is a paragraph of body text. It uses Open Sans, sans-serif font with a size of 0.875rem (14px) and line height of 1rem (16px).
\n `,\n }),\n}" + }, + { + "name": "DefaultText", + "ctype": "miscellaneous", + "subtype": "variable", + "file": "projects/lfx-component-lib/src/lib/themes/text-colors.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "type": "Story", + "defaultValue": "{\n render: () => ({\n template: `\nThis is a paragraph of body text.
\n `,\n }),\n}" + }, { "name": "Error", "ctype": "miscellaneous", @@ -20,6 +60,126 @@ "type": "Story", "defaultValue": "{\n args: {\n type: 'error' as IType,\n },\n parameters: {\n design: {\n type: \"figspec\",\n url: \"https://www.figma.com/design/nj8rOxBtzQCa7KrvBxF4aF/Coherence-Design-System?node-id=772-5210&t=zfHib1d5XSXabYJp-4\",\n },\n },\n play: async ( {canvasElement} ) => {\n const element = getElement(canvasElement);\n await expect(element.classList).toContain('error');\n }\n}" }, + { + "name": "Heading1", + "ctype": "miscellaneous", + "subtype": "variable", + "file": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "type": "Story", + "defaultValue": "{\n render: () => ({\n template: `\nIt uses Roboto Slab, sans-serif font with a size of 1.375rem (22px) and line height of 1.625rem (26px).
\n `,\n }),\n}" + }, + { + "name": "Heading2", + "ctype": "miscellaneous", + "subtype": "variable", + "file": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "type": "Story", + "defaultValue": "{\n render: () => ({\n template: `\nIt uses Roboto Slab, sans-serif font with a size of 1.125rem (18px) and line height of 1.375rem (22px).
\n `,\n }),\n}" + }, + { + "name": "Heading3", + "ctype": "miscellaneous", + "subtype": "variable", + "file": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "type": "Story", + "defaultValue": "{\n render: () => ({\n template: `\nIt uses Open Sans, sans-serif font with a size of 1rem (16px) and line height of 1.125rem (18px).
\n `,\n }),\n}" + }, + { + "name": "Heading4", + "ctype": "miscellaneous", + "subtype": "variable", + "file": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "type": "Story", + "defaultValue": "{\n render: () => ({\n template: `\nIt uses Open Sans, sans-serif font with a size of 0.875rem (14px) and line height of 1rem (16px).
\n `,\n }),\n}" + }, + { + "name": "Heading5", + "ctype": "miscellaneous", + "subtype": "variable", + "file": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "type": "Story", + "defaultValue": "{\n render: () => ({\n template: `\nIt uses Open Sans, sans-serif font with a size of 0.75rem (12px) and line height of 0.875rem (14px).
\n `,\n }),\n}" + }, + { + "name": "LinkText", + "ctype": "miscellaneous", + "subtype": "variable", + "file": "projects/lfx-component-lib/src/lib/themes/text-colors.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "type": "Story", + "defaultValue": "{\n render: () => ({\n template: `\n This is a link textThis is a paragraph of body text
\n `,\n }),\n}" + }, { "name": "Section", "ctype": "miscellaneous", @@ -70,6 +240,16 @@ "type": "Story", "defaultValue": "{\n render: (args: any) => ({\n template: `Section content here
\nSection content here
\nSection content here
\nThis is a paragraph of body text.
\nThis is a paragraph of body text.
\n This is a link textThis is a paragraph of body text.
\n `,\n }),\n}" + }, + { + "name": "LinkText", + "ctype": "miscellaneous", + "subtype": "variable", + "file": "projects/lfx-component-lib/src/lib/themes/text-colors.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "type": "Story", + "defaultValue": "{\n render: () => ({\n template: `\n This is a link textThis is a paragraph of body text
\n `,\n }),\n}" + } + ], + "projects/lfx-component-lib/src/lib/themes/typography.stories.ts": [ + { + "name": "AllTypography", + "ctype": "miscellaneous", + "subtype": "variable", + "file": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "type": "Story", + "defaultValue": "{\n render: () => ({\n template: `\nThis is a paragraph of body text.
\n This is small text (body2).\n `,\n }),\n}" + }, + { + "name": "BodyText", + "ctype": "miscellaneous", + "subtype": "variable", + "file": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "type": "Story", + "defaultValue": "{\n render: () => ({\n template: `\nThis is a paragraph of body text. It uses Open Sans, sans-serif font with a size of 0.875rem (14px) and line height of 1rem (16px).
\n `,\n }),\n}" + }, + { + "name": "Heading1", + "ctype": "miscellaneous", + "subtype": "variable", + "file": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "type": "Story", + "defaultValue": "{\n render: () => ({\n template: `\nIt uses Roboto Slab, sans-serif font with a size of 1.375rem (22px) and line height of 1.625rem (26px).
\n `,\n }),\n}" + }, + { + "name": "Heading2", + "ctype": "miscellaneous", + "subtype": "variable", + "file": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "type": "Story", + "defaultValue": "{\n render: () => ({\n template: `\nIt uses Roboto Slab, sans-serif font with a size of 1.125rem (18px) and line height of 1.375rem (22px).
\n `,\n }),\n}" + }, + { + "name": "Heading3", + "ctype": "miscellaneous", + "subtype": "variable", + "file": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "type": "Story", + "defaultValue": "{\n render: () => ({\n template: `\nIt uses Open Sans, sans-serif font with a size of 1rem (16px) and line height of 1.125rem (18px).
\n `,\n }),\n}" + }, + { + "name": "Heading4", + "ctype": "miscellaneous", + "subtype": "variable", + "file": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "type": "Story", + "defaultValue": "{\n render: () => ({\n template: `\nIt uses Open Sans, sans-serif font with a size of 0.875rem (14px) and line height of 1rem (16px).
\n `,\n }),\n}" + }, + { + "name": "Heading5", + "ctype": "miscellaneous", + "subtype": "variable", + "file": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "type": "Story", + "defaultValue": "{\n render: () => ({\n template: `\nIt uses Open Sans, sans-serif font with a size of 0.75rem (12px) and line height of 0.875rem (14px).
\n `,\n }),\n}" + }, + { + "name": "meta", + "ctype": "miscellaneous", + "subtype": "variable", + "file": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "type": "Meta", + "defaultValue": "{\n title: 'LFX Components/Themes/Typography',\n tags: ['autodocs'],\n}" + }, + { + "name": "SmallText", + "ctype": "miscellaneous", + "subtype": "variable", + "file": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "type": "Story", + "defaultValue": "{\n render: () => ({\n template: `\n This is small text, also known as body2 in Figma. It uses Open Sans, sans-serif font with a size of 0.875rem (14px).\n `,\n }),\n}" + } + ], "projects/lfx-component-lib/src/lib/containers/toast/__docs__/toast.stories.ts": [ { "name": "Error", @@ -270,6 +656,32 @@ }, "groupedEnumerations": {}, "groupedTypeAliases": { + "projects/lfx-component-lib/src/lib/themes/text-colors.stories.ts": [ + { + "name": "Story", + "ctype": "miscellaneous", + "subtype": "typealias", + "rawtype": "StoryObj", + "file": "projects/lfx-component-lib/src/lib/themes/text-colors.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "description": "", + "kind": 183 + } + ], + "projects/lfx-component-lib/src/lib/themes/typography.stories.ts": [ + { + "name": "Story", + "ctype": "miscellaneous", + "subtype": "typealias", + "rawtype": "StoryObj", + "file": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "deprecated": false, + "deprecationMessage": "", + "description": "", + "kind": 183 + } + ], "projects/lfx-component-lib/src/lib/containers/sections/__docs__/sections.stories.ts": [ { "name": "Story", @@ -392,6 +804,186 @@ "coveragePercent": 0, "coverageCount": "0/1", "status": "low" + }, + { + "filePath": "projects/lfx-component-lib/src/lib/themes/text-colors.stories.ts", + "type": "variable", + "linktype": "miscellaneous", + "linksubtype": "variable", + "name": "AllColors", + "coveragePercent": 0, + "coverageCount": "0/1", + "status": "low" + }, + { + "filePath": "projects/lfx-component-lib/src/lib/themes/text-colors.stories.ts", + "type": "variable", + "linktype": "miscellaneous", + "linksubtype": "variable", + "name": "DefaultText", + "coveragePercent": 0, + "coverageCount": "0/1", + "status": "low" + }, + { + "filePath": "projects/lfx-component-lib/src/lib/themes/text-colors.stories.ts", + "type": "variable", + "linktype": "miscellaneous", + "linksubtype": "variable", + "name": "LinkText", + "coveragePercent": 0, + "coverageCount": "0/1", + "status": "low" + }, + { + "filePath": "projects/lfx-component-lib/src/lib/themes/text-colors.stories.ts", + "type": "variable", + "linktype": "miscellaneous", + "linksubtype": "variable", + "name": "MessageError", + "coveragePercent": 0, + "coverageCount": "0/1", + "status": "low" + }, + { + "filePath": "projects/lfx-component-lib/src/lib/themes/text-colors.stories.ts", + "type": "variable", + "linktype": "miscellaneous", + "linksubtype": "variable", + "name": "MessageNotice", + "coveragePercent": 0, + "coverageCount": "0/1", + "status": "low" + }, + { + "filePath": "projects/lfx-component-lib/src/lib/themes/text-colors.stories.ts", + "type": "variable", + "linktype": "miscellaneous", + "linksubtype": "variable", + "name": "MessageSuccess", + "coveragePercent": 0, + "coverageCount": "0/1", + "status": "low" + }, + { + "filePath": "projects/lfx-component-lib/src/lib/themes/text-colors.stories.ts", + "type": "variable", + "linktype": "miscellaneous", + "linksubtype": "variable", + "name": "MessageWarning", + "coveragePercent": 0, + "coverageCount": "0/1", + "status": "low" + }, + { + "filePath": "projects/lfx-component-lib/src/lib/themes/text-colors.stories.ts", + "type": "variable", + "linktype": "miscellaneous", + "linksubtype": "variable", + "name": "meta", + "coveragePercent": 0, + "coverageCount": "0/1", + "status": "low" + }, + { + "filePath": "projects/lfx-component-lib/src/lib/themes/text-colors.stories.ts", + "type": "variable", + "linktype": "miscellaneous", + "linksubtype": "variable", + "name": "SecondaryText", + "coveragePercent": 0, + "coverageCount": "0/1", + "status": "low" + }, + { + "filePath": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "type": "variable", + "linktype": "miscellaneous", + "linksubtype": "variable", + "name": "AllTypography", + "coveragePercent": 0, + "coverageCount": "0/1", + "status": "low" + }, + { + "filePath": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "type": "variable", + "linktype": "miscellaneous", + "linksubtype": "variable", + "name": "BodyText", + "coveragePercent": 0, + "coverageCount": "0/1", + "status": "low" + }, + { + "filePath": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "type": "variable", + "linktype": "miscellaneous", + "linksubtype": "variable", + "name": "Heading1", + "coveragePercent": 0, + "coverageCount": "0/1", + "status": "low" + }, + { + "filePath": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "type": "variable", + "linktype": "miscellaneous", + "linksubtype": "variable", + "name": "Heading2", + "coveragePercent": 0, + "coverageCount": "0/1", + "status": "low" + }, + { + "filePath": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "type": "variable", + "linktype": "miscellaneous", + "linksubtype": "variable", + "name": "Heading3", + "coveragePercent": 0, + "coverageCount": "0/1", + "status": "low" + }, + { + "filePath": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "type": "variable", + "linktype": "miscellaneous", + "linksubtype": "variable", + "name": "Heading4", + "coveragePercent": 0, + "coverageCount": "0/1", + "status": "low" + }, + { + "filePath": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "type": "variable", + "linktype": "miscellaneous", + "linksubtype": "variable", + "name": "Heading5", + "coveragePercent": 0, + "coverageCount": "0/1", + "status": "low" + }, + { + "filePath": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "type": "variable", + "linktype": "miscellaneous", + "linksubtype": "variable", + "name": "meta", + "coveragePercent": 0, + "coverageCount": "0/1", + "status": "low" + }, + { + "filePath": "projects/lfx-component-lib/src/lib/themes/typography.stories.ts", + "type": "variable", + "linktype": "miscellaneous", + "linksubtype": "variable", + "name": "SmallText", + "coveragePercent": 0, + "coverageCount": "0/1", + "status": "low" } ] } diff --git a/projects/lfx-component-lib/src/lib/styles/colors.scss b/projects/lfx-component-lib/src/lib/styles/colors.scss index 1bf13ba..43b0a54 100644 --- a/projects/lfx-component-lib/src/lib/styles/colors.scss +++ b/projects/lfx-component-lib/src/lib/styles/colors.scss @@ -3,14 +3,74 @@ * SPDX-License-Identifier: MIT */ -body { - color: #282e32; +@import "./constants.scss"; + +// default text colors +*, +.text-primary { + color: $grey-1000; +} + +.text-secondary { + color: #808b91; } +// background colors .primary { - color: #282e32; + color: $blue-500; } .secondary { - color: #808b91; + color: $blue-50; +} + +a, +.link-text { + cursor: pointer; + color: $blue-500; + &:hover { + color: $blue-700; + } + &:active { + color: $blue-800; + } +} + +.message { + &.notice { + color: $blue-500; + } + &.warning { + color: $orange-500; + } + &.success { + color: $green-500; + } + &.error { + color: $red-500; + } +} + +// background colors +.bg-primary { + background-color: $blue-500; +} + +.bg-secondary { + background-color: $blue-50; +} + +.bg-message { + &.notice { + background-color: $blue-50; + } + &.warning { + background-color: $orange-50; + } + &.success { + background-color: $green-50; + } + &.error { + background-color: $red-50; + } } diff --git a/projects/lfx-component-lib/src/lib/styles/index.scss b/projects/lfx-component-lib/src/lib/styles/index.scss new file mode 100644 index 0000000..9ac731d --- /dev/null +++ b/projects/lfx-component-lib/src/lib/styles/index.scss @@ -0,0 +1,2 @@ +@import "./colors.scss"; +@import "./typography.scss"; diff --git a/projects/lfx-component-lib/src/lib/themes/color-palette.mdx b/projects/lfx-component-lib/src/lib/themes/color-palette.mdx new file mode 100644 index 0000000..7206bc9 --- /dev/null +++ b/projects/lfx-component-lib/src/lib/themes/color-palette.mdx @@ -0,0 +1,142 @@ +import { Meta, ColorPalette, ColorItem } from "@storybook/blocks"; +import colors from "../configs/color-palette.json"; + + + +# Color Palette + +Our design system's color palette helps maintain consistent styling across the application. + +This is a paragraph of body text.
+ `, + }), +}; + +export const SecondaryText: Story = { + render: () => ({ + template: ` +This is a paragraph of body text
+ `, + }), +}; + +export const LinkText: Story = { + render: () => ({ + template: ` + This is a link textThis is a paragraph of body text.
+This is a paragraph of body text.
+ This is a link text