Skip to content

Commit

Permalink
Merge pull request #7 from mezh-hq/development
Browse files Browse the repository at this point in the history
Fixes styling conflicts with other design systems
  • Loading branch information
Akalanka47000 authored Jul 31, 2024
2 parents d9a59a7 + 8d914f7 commit f2e753f
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 16 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Changelog

# v2.0.0 [2024-07-31]

## Patch with Breaking Changes

### Fixes
- Styling conflicts with other design systems by scoping the Tailwind base styles

### Breaking Changes
- Wraps the toolkit with a div with the class name "stk-core" to enable scoping of the toolkit styles. An additional property is added to the style prop under `core` to allow customization of the core div.

---

# v1.0.0 [2024-06-18]

## Initial Stable Release
Binary file modified bun.lockb
Binary file not shown.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mezh-hq/react-seat-toolkit",
"version": "1.3.8",
"version": "2.0.0-blizzard.2",
"description": "React UI library to design and render seat layouts",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
Expand Down Expand Up @@ -28,7 +28,7 @@
"build:types": "bunx tsc --project ./tsconfig.declaration.json && tsc-alias --project ./tsconfig.declaration.json && cd dist && ls -d */ | grep -Ev 'actions|types' | xargs rm -rf && cp ./index.d.ts ./index.slim.d.ts",
"bump-version": "bunx --bun automatic-versioning --disable-auto-sync --recursive $(if [ \"$TAG\" != \"latest\" ]; then echo --prerelease; fi) --prerelease-branch=development --prerelease-tag=$TAG --name=@mezh-hq/react-seat-toolkit --ignore-prefixes=ci",
"format": "bunx prettier --write --cache \"**/*.{js,jsx,ts,tsx,md,css,yml}\"",
"lint": "bun run --bun eslint . --ext js,jsx,ts,tsx,mdx --ignore-path .gitignore --fix --cache --report-unused-disable-directives",
"lint": "bun run --bun eslint . --ext js,jsx,ts,tsx --ignore-path .gitignore --fix --cache --report-unused-disable-directives",
"storybook": "NODE_ENV=storybook storybook dev -p 6006",
"build-storybook": "storybook build",
"postbuild": "bun build:types && bun build:css",
Expand Down Expand Up @@ -116,8 +116,9 @@
"sonner": "1.5.0",
"storybook": "7.3.2",
"storybook-addon-deep-controls": "0.2.1",
"tailwindcss": "3.4.1",
"tailwindcss": "3.4.6",
"tailwindcss-animate": "1.0.6",
"tailwindcss-scoped-preflight": "3.4.3",
"tsc-alias": "1.8.8",
"vite": "4.5.2"
},
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/breakpoint.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
import { screens } from "../../tailwind.config";
import { screens } from "../utils/tailwind";

const calculateBreakpoints = () =>
Object.entries(screens).reduce((acc, [key, value]) => {
Expand Down
8 changes: 7 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Provider } from "react-redux";
import { twMerge } from "tailwind-merge";
import { default as Core, TooltipProvider } from "@/components";
import { store } from "@/store";
import { type ISTKProps } from "./types";
Expand All @@ -11,7 +12,12 @@ export const SeatToolkit = (props: ISTKProps) => {
return (
<Provider store={store}>
<TooltipProvider>
<Core {...props} />
<div
className={twMerge("stk-core h-full w-full", props.styles?.core?.container?.className)}
style={props.styles?.core?.container?.properties}
>
<Core {...props} />
</div>
</TooltipProvider>
</Provider>
);
Expand Down
1 change: 1 addition & 0 deletions src/styles/storybook.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ body,
#storybook-root {
min-height: 100% !important;
height: 100% !important;
font-family: "Inter", sans-serif !important;
}
body {
margin-right: 0px !important;
Expand Down
1 change: 1 addition & 0 deletions src/types/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export interface IStyles {
};
};
core?: {
container?: IStyle;
button?: IStyle;
};
}
1 change: 1 addition & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ids, selectors } from "@/constants";
export * from "./d3";
export * from "./transformer";
export * from "./workspace";
export * from "./tailwind";

export const fallible = (fn: Function) => {
try {
Expand Down
9 changes: 9 additions & 0 deletions src/utils/tailwind.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const screens = {
xs: "400px",
xsm: "450px",
sm: "640px",
md: "768px",
lg: "1024px",
xl: "1280px",
xxl: "1536px"
};
19 changes: 8 additions & 11 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
import animate from "tailwindcss-animate";

export const screens = {
xs: "400px",
xsm: "450px",
sm: "640px",
md: "768px",
lg: "1024px",
xl: "1280px",
xxl: "1536px"
};
import { isolateInsideOfContainer, scopedPreflightStyles } from "tailwindcss-scoped-preflight";
import { screens } from "./src/utils/tailwind";

/** @type {import('tailwindcss').Config} */
export default {
Expand All @@ -26,5 +18,10 @@ export default {
}
}
},
plugins: [animate]
plugins: [
animate,
scopedPreflightStyles({
isolationStrategy: isolateInsideOfContainer(".stk-core")
})
]
};

0 comments on commit f2e753f

Please sign in to comment.