Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.0.0 #781

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
43b5208
chore(react): refactor generate-react-exports (#725)
AykutSarac Oct 27, 2023
fd32b93
feat(icon): new icons added (#735)
buseselvi Nov 2, 2023
43d6b0d
fix(select): select check additional count event loop (#743)
AykutSarac Nov 23, 2023
cb12aa6
feat: notification component (#741)
ogunb Nov 30, 2023
b251702
fix(theme): add missing font weights (#740)
Enes5519 Nov 30, 2023
caf155e
feat(select): implement select all (#746)
ogunb Dec 15, 2023
ecc8a30
fix(select): change select all default behaviour to off (#750)
leventozen Dec 15, 2023
1d5f767
feat(select): add search feature for select (#759)
erbilnas Jan 11, 2024
1b5a10e
fix(select): Using label and placeholder on non label-fixed select br…
fatihhayri Jan 11, 2024
a99ff41
feat: add info color and implement it on alert and notification (#761)
ogunb Jan 11, 2024
2304485
fix(select): return single value for single select (#677)
AykutSarac Jan 11, 2024
170b707
feat(switch): add bl-switch label (#754)
0o001 Jan 11, 2024
63915ca
fix(dropdown): dropdown group borders are not visible (#589)
muratcorlu Jan 11, 2024
9e2d0ba
fix(select): label property added to bl-select-option to fix #764 (#766)
omrumbakitemiz Jan 12, 2024
008dd81
feat(icon): new icons added (#769)
buseselvi Jan 15, 2024
e032b7a
fix(select): add string to boolean converter for related prop (#775)
erbilnas Jan 18, 2024
2768426
fix(pagination): fix the event of the single select
Jan 23, 2024
8ded452
Merge pull request #777 from Trendyol/fix/776-pagination-select
erbilnas Jan 23, 2024
793143a
feat: major version release (#782)
leventozen Jan 25, 2024
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
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"trailingComma": "es5",
"useTabs": false,
"importOrder": [
"^react",
"^lit",
"<THIRD_PARTY_MODULES>",
"^[./]",
Expand Down
55 changes: 28 additions & 27 deletions commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
extends: ["@commitlint/config-conventional"],
rules: {
'scope-enum': [
"scope-enum": [
2,
'always',
"always",
[
'storybook',
'design',
'react',
'deps',
'deps-dev',
"storybook",
"design",
"react",
"deps",
"deps-dev",
// Components as scopes listed below
'button',
'icon',
'input',
'badge',
'tab',
'tooltip',
'progress-indicator',
'checkbox-group',
'checkbox',
'alert',
'select',
'pagination',
'radio',
'dialog',
'drawer',
'dropdown',
'switch',
'textarea',
'popover',
"button",
"icon",
"input",
"badge",
"tab",
"tooltip",
"progress-indicator",
"checkbox-group",
"checkbox",
"alert",
"select",
"pagination",
"radio",
"dialog",
"drawer",
"dropdown",
"switch",
"textarea",
"popover",
"notification",
],
],
},
Expand Down
5 changes: 5 additions & 0 deletions docs/design-system/colors.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ Baklava uses a list of defined color with some default values.
subtitle="Warning Color"
colors={{ '': 'var(--bl-color-warning)', '--highlight': 'var(--bl-color-warning-highlight)', '--contrast': 'var(--bl-color-warning-contrast)' }}
/>
<ColorItem
title="--bl-color-info"
subtitle="Info Color"
colors={{ '': 'var(--bl-color-info)', '--highlight': 'var(--bl-color-info-highlight)', '--contrast': 'var(--bl-color-info-contrast)' }}
/>
<ColorItem
title="--bl-color-neutral"
subtitle="Neutral Colors"
Expand Down
50 changes: 43 additions & 7 deletions docs/design-system/typography.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,32 @@ A display fonts is a font that is intended for use at large sizes for headings.

Heading fonts are used as larger, higher impact text, such as in a title or section header.

#### Heading 1

| Variable | Styles | Example |
|:---------|:-------|:-------:|
| `--bl-font-heading-1-regular`| Weight: 400 / Regular <br/> Size: 32px / 2rem <br/> Height: 36px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-heading-1-regular)' }}>Heading 1 Regular</h1> |
| `--bl-font-heading-1-medium` | Weight: 500 / Medium <br/> Size: 32px / 2rem <br/> Height: 36px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-heading-1-medium)' }}>Heading 1 Medium</h1> |
| `--bl-font-heading-1-semibold` | Weight: 600 / Semibold <br/> Size: 32px / 2rem <br/> Height: 36px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-heading-1-semibold)' }}>Heading 1 Semibold</h1> |
| `--bl-font-heading-1-bold` | Weight: 700 / Bold <br/> Size: 32px / 2rem <br/> Height: 36px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-heading-1-bold)' }}>Heading 1 Bold</h1> |

#### Heading 2

| Variable | Styles | Example |
|:---------|:-------|:-------:|
| `--bl-font-heading-2-regular`| Weight: 400 / Regular <br/> Size: 28px / 1.75rem <br/> Height: 32px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-heading-2-regular)' }}>Heading 2 Regular</h1> |
| `--bl-font-heading-2-medium` | Weight: 500 / Medium <br/> Size: 28px / 1.75rem <br/> Height: 32px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-heading-2-medium)' }}>Heading 2 Medium</h1> |
| `--bl-font-heading-2-semibold` | Weight: 600 / Semibold <br/> Size: 28px / 1.75rem <br/> Height: 32px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-heading-2-semibold)' }}>Heading 2 Semibold</h1> |
| `--bl-font-heading-2-bold` | Weight: 700 / Bold <br/> Size: 28px / 1.75rem <br/> Height: 32px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-heading-2-bold)' }}>Heading 2 Bold</h1> |

#### Heading 3

| Variable | Styles | Example |
|:---------|:-------|:-------:|
| `--bl-font-heading-1` | Weight: 300 / Light <br/> Size: 32px / 2rem <br/> Height: 36px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-heading-1)' }}>Heading 1</h1> |
| `--bl-font-heading-2` | Weight: 400 / Regular <br/> Size: 28px / 1.75rem <br/> Height: 32px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-heading-2)' }}>Heading 2</h1> |
| `--bl-font-heading-3` | Weight: 400 / Regular <br/> Size: 24px / 1.5rem <br/> Height: 28px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-heading-3)' }}>Heading 3</h1> |
| `--bl-font-heading-3-regular`| Weight: 400 / Regular <br/> Size: 24px / 1.5rem <br/> Height: 28px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-heading-3-regular)' }}>Heading 3 Regular</h1> |
| `--bl-font-heading-3-medium` | Weight: 500 / Medium <br/> Size: 24px / 1.5rem <br/> Height: 28px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-heading-3-medium)' }}>Heading 3 Medium</h1> |
| `--bl-font-heading-3-semibold` | Weight: 600 / Semibold <br/> Size: 24px / 1.5rem <br/> Height: 28px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-heading-3-semibold)' }}>Heading 3 Semibold</h1> |
| `--bl-font-heading-3-bold` | Weight: 700 / Bold <br/> Size: 24px / 1.5rem <br/> Height: 28px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-heading-3-bold)' }}>Heading 3 Bold</h1> |

## Sub Titles

Expand All @@ -54,7 +75,7 @@ Subtitles are smaller than headlines. They are typically reserved for medium-emp

| Variable | Styles | Example |
|:---------|:-------|:-------:|
| `--bl-font-title-2-regula` | Weight: 400 / Regular <br/> Size: 16px / 1rem <br/> Height: 20px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-title-2-regular)' }}>Sub Title 2 Regular</h1> |
| `--bl-font-title-2-regular` | Weight: 400 / Regular <br/> Size: 16px / 1rem <br/> Height: 20px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-title-2-regular)' }}>Sub Title 2 Regular</h1> |
| `--bl-font-title-2-medium` | Weight: 500 / Medium <br/> Size: 16px / 1rem <br/> Height: 20px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-title-2-medium)' }}>Sub Title 2 Medium</h1> |
| `--bl-font-title-2-semibold` | Weight: 600 / Semibold <br/> Size: 16px / 1rem <br/> Height: 20px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-title-2-semibold)' }}>Sub Title 2 Semibold</h1> |
| `--bl-font-title-2-bold` | Weight: 700 / Bold <br/> Size: 16px / 1rem <br/> Height: 20px (font size + `bl-size-3xs`) | <h1 style={{ font: 'var(--bl-font-title-2-bold)' }}>Sub Title 2 Bold</h1> |
Expand Down Expand Up @@ -82,11 +103,26 @@ Subtitles are smaller than headlines. They are typically reserved for medium-emp

Body text typically used for long-form writing as it works well for small text sizes.

#### Body Text 1

| Variable | Styles | Example |
|:---------|:-------|:-------:|
| `--bl-font-body-text-1-regular` | Weight: 400 / Regular <br/> Size: 16px / 1rem <br/> Height: 18px (font size + `bl-size-4xs`) | <h1 style={{ font: 'var(--bl-font-body-text-1-regular)' }}>Form Body Text 1 Regular</h1> |
| `--bl-font-body-text-1-medium` | Weight: 500 / Medium <br/> Size: 16px / 1rem <br/> Height: 18px (font size + `bl-size-4xs`) | <h1 style={{ font: 'var(--bl-font-body-text-1-medium)' }}>Form Body Text 1 Medium</h1> |

#### Body Text 2

| Variable | Styles | Example |
|:---------|:-------|:-------:|
| `--bl-font-body-text-2-regular` | Weight: 400 / Regular <br/> Size: 14px / 0.875rem <br/> Height: 16px (font size + `bl-size-4xs`) | <h1 style={{ font: 'var(--bl-font-body-text-2-regular)' }}>Form Body Text 2 Regular</h1> |
| `--bl-font-body-text-2-medium` | Weight: 500 / Medium <br/> Size: 14px / 0.875rem <br/> Height: 16px (font size + `bl-size-4xs`) | <h1 style={{ font: 'var(--bl-font-body-text-2-medium)' }}>Form Body Text 2 Medium</h1> |

#### Body Text 3

| Variable | Styles | Example |
|:---------|:-------|:-------:|
| `--bl-font-body-text-1` | Weight: 400 / Regular <br/> Size: 16px / 1rem <br/> Height: 18px (font size + `bl-size-4xs`) | <h1 style={{ font: 'var(--bl-font-body-text-1)' }}>Form Body Text 1</h1> |
| `--bl-font-body-text-2` | Weight: 400 / Regular <br/> Size: 14px / 0.875rem <br/> Height: 16px (font size + `bl-size-4xs`) | <h1 style={{ font: 'var(--bl-font-body-text-2)' }}>Form Body Text 2</h1> |
| `--bl-font-body-text-3` | Weight: 400 / Regular <br/> Size: 12px / 0.75rem <br/> Height: 14px (font size + `bl-size-4xs`)| <h1 style={{ font: 'var(--bl-font-body-text-3)' }}>Form Body Text 3</h1> |
| `--bl-font-body-text-3-regular` | Weight: 400 / Regular <br/> Size: 12px / 0.75rem <br/> Height: 14px (font size + `bl-size-4xs`) | <h1 style={{ font: 'var(--bl-font-body-text-3-regular)' }}>Form Body Text 3 Regular</h1> |
| `--bl-font-body-text-3-medium` | Weight: 500 / Medium <br/> Size: 12px / 0.75rem <br/> Height: 14px (font size + `bl-size-4xs`) | <h1 style={{ font: 'var(--bl-font-body-text-3-medium)' }}>Form Body Text 3 Medium</h1> |


## Captions
Expand Down
38 changes: 28 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"serve": "node scripts/build.js --serve",
"storybook:dev": "storybook dev -p 1994",
"lint": "npm-run-all -s lint:*",
"lint:tsc": "tsc --noEmit",
"lint:tsc": "tsc --noEmit --project ./tsconfig.json",
"lint:eslint": "eslint src",
"lint:style": "stylelint src/**/*.css",
"lint:prettier": "prettier --check src",
Expand Down Expand Up @@ -89,7 +89,7 @@
"@storybook/addon-mdx-gfm": "^7.4.3",
"@storybook/addon-viewport": "^7.4.3",
"@storybook/jest": "^0.2.2",
"@storybook/testing-library": "^0.2.0",
"@storybook/testing-library": "^0.2.2",
"@storybook/web-components": "7.4.3",
"@storybook/web-components-vite": "^7.4.3",
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
Expand Down
53 changes: 27 additions & 26 deletions scripts/generate-react-exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { pascalCase } from "pascal-case";
import path from "path";
import { format } from "prettier";
import { fileURLToPath } from "url";

import prettierConfig from "../.prettierrc.json" assert { type: "json" };
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

Expand All @@ -24,43 +24,41 @@ const baklavaReactFileParts = [];

for (const module of customElementsModules) {
const { declarations, path } = module;
const componentDeclaration = declarations.find(declaration => declaration.customElement === true);
const { events, name: componentName, tagName: fileName, jsDoc } = componentDeclaration;
const component = declarations.find(declaration => declaration.customElement === true);
const { name: componentName, tagName: fileName } = component;

const eventNames =
events?.reduce((acc, curr) => {
acc[getReactEventName(curr.name)] = curr.name;
return acc;
}, {}) || {};
const eventNames = (component.events || []).map(event => {
const reactEvent = getReactEventName(event.name);
const reactEventName = `${componentName}${reactEvent.split("onBl")[1]}`;
return `${reactEvent}: '${event.name}' as EventName<${reactEventName}>`;
}).join(',\n');

const eventTypes =
events?.map(event => {
const eventName = getReactEventName(event.name);
const eventType = cleanGenericTypes(componentDeclaration.typeParameters, event.type.text);
const predefinedEventName = `${componentName}${eventName.split("onBl")[1]}`;
component.events?.forEach(event => {
const eventName = getReactEventName(event.name);
const eventType = cleanGenericTypes(component.typeParameters, event.type.text);
const predefinedEventName = `${componentName}${eventName.split("onBl")[1]}`;

eventStatements.push(`export declare type ${predefinedEventName} = ${eventType};`);
return `${eventName}: EventName<${predefinedEventName}>`;
}) || [];
eventStatements.push(`export declare type ${predefinedEventName} = ${eventType};`);
});

const importPath = path.replace(/^src\//, "").replace(/\.ts$/, "");
const typeName = componentName + "Type";
const formattedEventTypes = eventTypes.length ? `, {${eventTypes.join(", ")}}` : "";
const componentType = `${typeName}${formattedEventTypes}`;

importStatements.push(`import type ${typeName} from "./${importPath}";`);
exportStatements.push(`export declare type ${componentName} = ${typeName}`);
importStatements.push(`export type ${componentName} = import("./${importPath}").default;`);

const jsDoc = component.jsDoc || "";

const source = `
${jsDoc || ""}
${jsDoc}
export const ${componentName} = React.lazy(() =>
customElements.whenDefined('${fileName}').then(() => ({
default: createComponent<${componentType}>({
default: createComponent({
react: React,
displayName: "${componentName}",
tagName: "${fileName}",
elementClass: customElements.get("${fileName}"),
events: ${JSON.stringify(eventNames)},
elementClass: customElements.get("${fileName}") as Constructor<${componentName}>,
events: {
${eventNames}
},
})
}))
);
Expand All @@ -76,16 +74,19 @@ function getReactEventName(baklavaEventName) {
}

function writeBaklavaReactFile(fileContentParts) {
const constructorType = `type Constructor<T> = { new (): T };`;

const content = [
`/* eslint-disable @typescript-eslint/ban-ts-comment */`,
`// @ts-nocheck`,
...importStatements,
...eventStatements,
constructorType,
...exportStatements,
...fileContentParts,
].join("\n\n");

const formattedContent = format(content, { parser: "typescript" });
const formattedContent = format(content, Object.assign(prettierConfig, { parser: "typescript" }));
const outputPath = `${__dirname}/../src/baklava-react.ts`;
fs.writeFileSync(outputPath, formattedContent);
}
Expand Down
2 changes: 2 additions & 0 deletions src/baklava.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ export { default as BlDropdown } from "./components/dropdown/bl-dropdown";
export { default as BlDropdownItem } from "./components/dropdown/item/bl-dropdown-item";
export { default as BlDropdownGroup } from "./components/dropdown/group/bl-dropdown-group";
export { default as BlSwitch } from "./components/switch/bl-switch";
export { default as BlNotification } from "./components/notification/bl-notification";
export { default as BlNotificationCard } from "./components/notification/card/bl-notification-card";
export { getIconPath, setIconPath } from "./utilities/asset-paths";
6 changes: 3 additions & 3 deletions src/components/alert/bl-alert.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

.alert {
--padding: var(--bl-size-m);
--main-color: var(--bl-color-primary);
--main-bg-color: var(--bl-color-primary-contrast);
--main-color: var(--bl-color-info);
--main-bg-color: var(--bl-color-info-contrast);

position: relative;
display: flex;
Expand All @@ -14,7 +14,7 @@
background-color: var(--main-bg-color);
color: var(--bl-color-neutral-darker);
box-shadow: inset 0 0 0 1px var(--main-color);
border-radius: var(--bl-border-radius-s);
border-radius: var(--bl-border-radius-l);
padding: calc(var(--padding) / 2) var(--padding);
padding-right: calc(var(--padding) / 2);
}
Expand Down
Loading
Loading