diff --git a/.gitignore b/.gitignore index 252f1f5..9402427 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,324 @@ backlog.yml Lottie Structure.txt LottieSchema.json .hintrc + + + +# Component Modules built for local dev using lerna should be ignored +AboutUs +Accordion +AdvancedColorPicker +Alert +AlertStackManager +AlphabetFilter +Anchor +AppAndToolsSelector +Application +ArIconsViewer +ArViz +ArmcoIamProvider +Badge +Banner +Benefits +Blog +Brands +Breadcrumb +Breadcrumbs +BrowserIncompatibility +BubbleChart +BubbleViz +Button +Card +Careers +Carousel +CategoryFilter +Checkbox +Chunk +ColorPicker +ColorPickerConfig +ColorSelector +Component_404 +Contact +Content +ContextMenu +Cookies +CronTab +Cta +Dashboard +DateInput +DetailsPanel +Dialog +Download +Draggable +Drawer +Dropdown +Droppable +DroppableContainer +EcommOrders +EcommProducts +Empty +ErrorBoundary +FacetedFilter +Faq +Features +Filters +FlexTools +Footer +Form +Gallery +Graph +GraphTiles +Header +Hero +HowItWorks +HttpCode +Image +InlineMenu +InstaPhotos +Integrations +Label +LabelValue +LayoutGenerator +LearnLink +Link +List +ListItem +Loader +LoginProvider +LogoClouds +Main +Mask +MenuButton +Modal +Newsletter +Notification +Notifications +NumericStepper +Pagination +Password +PickerRange +Picklist +Pill +Pillbox +Popover +PopoverV1 +PopoverV2 +Portal +Portfolio +Pricing +ProductDescriptionTile +ProductInfo +ProgressIndicator +ProgressStepper +ProgressiveBarChart +Projects +Radio +RepeatRenderer +Reviews +ScrollPagination +SearchField +SecondaryNavigation +Segment +SegmentedControl +Select +SelectionPill +Services +SidePanel +SignInUp +Slider +Snackbar +Splitter +Stats +Steps +StuffleIamProvider +Suggestions +Swiper +Tab +TabBar +Table +Tag +Tags +Team +Testimonials +Text +TextArea +TextInput +Thumbs +Tiles +TimeEntry +Toast +Toggle +Toolbar +Tooltip +TransferShuttle +TreeList +TreeViz +TypeAhead +UserOptions +Users +Widget +Wizard +WizardModal +animations +ass +cssClasses +index +Waiting for the debugger to disconnect... +Debugger attached. +AboutUs +Accordion +AdvancedColorPicker +Alert +AlertStackManager +AlphabetFilter +Anchor +AppAndToolsSelector +Application +ArIconsViewer +ArViz +ArmcoIamProvider +Badge +Banner +Benefits +Blog +Brands +Breadcrumb +Breadcrumbs +BrowserIncompatibility +BubbleChart +BubbleViz +Button +Card +Careers +Carousel +CategoryFilter +Checkbox +Chunk +ColorPicker +ColorPickerConfig +ColorSelector +Component_404 +Contact +Content +ContextMenu +Cookies +CronTab +Cta +Dashboard +DateInput +DetailsPanel +Dialog +Download +Draggable +Drawer +Dropdown +Droppable +DroppableContainer +EcommOrders +EcommProducts +Empty +ErrorBoundary +FacetedFilter +Faq +Features +Filters +FlexTools +Footer +Form +Gallery +Graph +GraphTiles +Header +Hero +HowItWorks +HttpCode +Image +InlineMenu +InstaPhotos +Integrations +Label +LabelValue +LayoutGenerator +LearnLink +Link +List +ListItem +Loader +LoginProvider +LogoClouds +Main +Mask +MenuButton +Modal +Newsletter +Notification +Notifications +NumericStepper +Pagination +Password +PickerRange +Picklist +Pill +Pillbox +Popover +PopoverV1 +PopoverV2 +Portal +Portfolio +Pricing +ProductDescriptionTile +ProductInfo +ProgressIndicator +ProgressStepper +ProgressiveBarChart +Projects +Radio +RepeatRenderer +Reviews +ScrollPagination +SearchField +SecondaryNavigation +Segment +SegmentedControl +Select +SelectionPill +Services +SidePanel +SignInUp +Slider +Snackbar +Splitter +Stats +Steps +StuffleIamProvider +Suggestions +Swiper +Tab +TabBar +Table +Tag +Tags +Team +Testimonials +Text +TextArea +TextInput +Thumbs +Tiles +TimeEntry +Toast +Toggle +Toolbar +Tooltip +TransferShuttle +TreeList +TypeAhead +UserOptions +Users +Widget +Wizard +WizardModal +animations +ass +cssClasses +index diff --git a/TreeViz/package.json b/TreeViz/package.json new file mode 100644 index 0000000..3084904 --- /dev/null +++ b/TreeViz/package.json @@ -0,0 +1,6 @@ +{ + "name": "@armco/components/TreeViz", + "main": "../build/cjs/TreeViz.js", + "module": "../build/es/TreeViz.js", + "types": "../build/types/TreeViz.d.ts" +} \ No newline at end of file diff --git a/build-tools/build.sh b/build-tools/build.sh index 0daf942..d41d929 100755 --- a/build-tools/build.sh +++ b/build-tools/build.sh @@ -3,10 +3,34 @@ # Get the directory of the current script SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -rm -rf build -npx tsc -vite build +# Default values +DEV_FLAG="" +# Parse arguments +for arg in "$@" +do + case $arg in + --dev) + DEV_FLAG="--dev" + shift # Remove --dev from processing + ;; + esac +done + +echo "[BUILD:SH] Dev flag is: $DEV_FLAG" +echo "[BUILD:SH] Removing build if exists" +rm -rf build +echo "[BUILD:SH] Checking TS Types" +npx tsc +echo "[BUILD:SH] Initiating build..." +# Conditionally use vite-dev.config.ts if --dev flag is present +if [ "$DEV_FLAG" == "--dev" ]; then + vite build --config vite-dev.config.ts +else + vite build +fi + +echo "[BUILD:SH] Running post processor scripts..." # Run Post processors: Update style imports in .js files, create component modules -node "$SCRIPT_DIR/post-processor.js" build/cjs -node "$SCRIPT_DIR/post-processor.js" build/es +node "$SCRIPT_DIR/post-processor.js" build/cjs $DEV_FLAG +node "$SCRIPT_DIR/post-processor.js" build/es $DEV_FLAG diff --git a/build-tools/generate-module.js b/build-tools/generate-module.js index 97e5d5e..0c13dc5 100644 --- a/build-tools/generate-module.js +++ b/build-tools/generate-module.js @@ -5,17 +5,17 @@ import { fileURLToPath } from "url" const __filename = fileURLToPath(import.meta.url) const __dirname = dirname(__filename) -async function generateModule(fileName, parentDir) { - if (fileName.indexOf("-chunk") === -1) { +async function generateModule(fileName, isDev) { + if (fileName.indexOf("-chunk") === -1 && !fileName.endsWith(".map")) { const dir = fileName.slice(0, -3) const name = `@armco/components/${dir}` const packageJsonContent = { name, - main: `../cjs/${dir}.js`, - module: `../es/${dir}.js`, - types: `../types/${dir}.d.ts`, + main: `../${isDev ? "build/" : ""}cjs/${dir}.js`, + module: `../${isDev ? "build/" : ""}es/${dir}.js`, + types: `../${isDev ? "build/" : ""}types/${dir}.d.ts`, } - const dirPath = resolve(__dirname, `../build/${dir}`) + const dirPath = resolve(__dirname, `../${isDev ? "" : "build/"}${dir}`) try { await fs.mkdir(dirPath, { recursive: true }) await fs.writeFile( diff --git a/build-tools/post-processor.js b/build-tools/post-processor.js index f856cab..064e193 100644 --- a/build-tools/post-processor.js +++ b/build-tools/post-processor.js @@ -1,13 +1,13 @@ import { readdir } from "fs/promises" import generateModule from "./generate-module.js" -async function postProcessor(dir) { +async function postProcessor(dir, isDev) { try { const files = await readdir(dir) await Promise.all( files.map(async (file) => { // await fixStyles(file, dir) - await generateModule(file, dir) + await generateModule(file, isDev) }), ) } catch (error) { @@ -17,7 +17,7 @@ async function postProcessor(dir) { const targetDir = process.argv[2] if (targetDir) { - postProcessor(targetDir) + postProcessor(targetDir, process.argv.includes("--dev")) } else { console.error("Please provide the build directory to run post processor on.") process.exit(1) diff --git a/package.json b/package.json index 87dd232..5664d9c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@armco/shared-components", "description": "React Component Lib of independent components that can be utilised by sophisticated ones in @armco/components", - "version": "0.0.53", + "version": "0.0.57", "type": "module", "author": "Armco (@restruct-corporate-advantage)", "types": "build/types/index.d.ts", @@ -9,6 +9,7 @@ "module": "build/es/index.js", "scripts": { "build": "./build-tools/build.sh", + "build:sm": "./build-tools/build.sh --dev", "plop": "plop component", "format": "prettier --write .", "lint": "eslint .", @@ -18,92 +19,34 @@ "publish:local": "./publish-local.sh" }, "dependencies": { - "@armco/configs": "^0.0.6", - "@armco/icon": "^0.0.5", - "@armco/utils": "^0.0.16", - "@popperjs/core": "^2.11.8", + "@armco/configs": "^0.0.11", + "@armco/utils": "^0.0.29", + "@armco/icon": "^0.0.10", + "@tanstack/react-table": "^8.21.2", "bootstrap": "^5.3.0", - "classnames": "^2.3.2", - "d3": "^7.9.0", - "highcharts": "^11.2.0", - "highcharts-react-official": "^3.2.1", - "highlight.js": "^11.8.0", - "js-cookie": "^3.0.5", - "moment": "^2.29.4", "react-app-polyfill": "^3.0.0", - "react-bootstrap": "^2.7.4", "react-dev-utils": "^12.0.1", + "react": ">=16.8.0", + "react-bootstrap": "^2.7.4", "react-dnd": ">=16.0.0", "react-dnd-html5-backend": ">=16.0.0", "react-dnd-touch-backend": ">=16.0.0", + "react-dom": "^18.2.0", "react-draggable": "^4.4.6", - "react-redux": "^8.0.1", + "resize-observer-polyfill": "^1.5.1", "react-resizable": "^3.0.5", "react-router-dom": "^6.13.0", - "react-table": "^7.8.0", - "resize-observer-polyfill": "^1.5.1", - "svgpath": "^2.6.0", "uuid": "^9.0.0" }, "devDependencies": { - "@armco/types": "^0.0.11", - "@babel/preset-env": "^7.24.5", - "@babel/preset-react": "^7.24.1", - "@babel/preset-typescript": "^7.24.1", - "@testing-library/dom": "^9.2.0", - "@testing-library/jest-dom": "^5.11.4", - "@testing-library/react": "^14.0.0", - "@testing-library/user-event": "^14.2.5", - "@types/bootstrap": "^5.2.6", - "@types/d3": "^7.4.0", - "@types/js-cookie": "^3.0.3", - "@types/node": "^22.5.5", - "@types/react": "^18.0.15", - "@types/react-dom": "^18.2.18", - "@types/react-resizable": "^3.0.7", - "@types/react-table": "^7.7.19", - "@types/testing-library__jest-dom": "^5.14.5", - "@types/uuid": "^9.0.2", - "@vitejs/plugin-react": "^4.3.1", - "chalk": "^5.3.0", - "cherry-pick": "^0.5.0", - "cpy-cli": "^5.0.0", - "eslint": "^8.0.0", - "eslint-config-react-app": "^7.0.1", - "eslint-plugin-prettier": "^4.2.1", - "eslint-plugin-storybook": "^0.6.12", - "execa": "^8.0.1", - "fs-extra": "^11.2.0", - "glob": "^10.4.5", - "jest": "^29.7.0", - "jest-environment-jsdom": "^29.7.0", - "jsdom": "^21.1.0", - "plop": "^3.1.2", - "prettier": "^2.7.1", - "prettier-config-nick": "^1.0.2", - "prop-types": "^15.8.1", - "react": "^18.3.1", - "react-dom": "^18.3.1", - "rollup-plugin-visualizer": "^5.12.0", - "sass-embedded": "^1.79.3", - "storybook": "^7.0.23", - "ts-jest": "^29.2.3", - "ts-node": "^10.9.2", - "typescript": "^5.0.2", - "vite": "^5.4.7", - "vite-plugin-css-injected-by-js": "^3.5.1", - "vite-plugin-dts": "^4.2.1", - "vite-plugin-lib-inject-css": "^2.1.1", - "vite-plugin-svgr": "^4.2.0", - "vitest": "^2.1.1" + "@armco/types": "^0.0.18" }, "peerDependencies": { - "react": ">=16.8.0", - "react-dnd": ">=16.0.0", - "react-dnd-html5-backend": ">=16.0.0", - "react-dnd-touch-backend": ">=16.0.0", - "react-redux": "^8.0.1", - "react-router-dom": "^6.13.0" + "d3": "^7.9.0", + "highcharts": "^12.1.2", + "highcharts-react-official": "^3.2.1", + "highlight.js": "^11.8.0", + "moment": "^2.29.4", }, "eslintConfig": { "extends": [ diff --git a/plopfile.cjs b/plopfile.cjs index 030074f..5241dc9 100644 --- a/plopfile.cjs +++ b/plopfile.cjs @@ -11,251 +11,26 @@ module.exports = (plop) => { actions: [ { type: "add", - path: "src/app/components/{{pascalCase name}}/{{pascalCase name}}.tsx", + path: "src/{{pascalCase name}}.tsx", templateFile: "plop-templates/Component/Component.tsx.hbs", }, { type: "add", - path: "src/app/components/{{pascalCase name}}/{{pascalCase name}}.test.ts", - templateFile: "plop-templates/Component/Component.test.ts.hbs", - }, - { - type: "add", - path: "src/app/components/{{pascalCase name}}/{{pascalCase name}}.component.scss", + path: "src/{{pascalCase name}}.component.scss", templateFile: "plop-templates/Component/Component.component.scss.hbs", }, { type: "add", - path: "src/app/components/{{pascalCase name}}/index.ts", - templateFile: "plop-templates/Component/index.ts.hbs", - }, - { - type: "add", - path: "src/app/components/index.ts", + path: "src/index.ts", templateFile: "plop-templates/injectable-index.ts.hbs", skipIfExists: true, }, { type: "append", - path: "src/app/components/index.ts", + path: "src/index.ts", pattern: `/* PLOP_INJECT_IMPORT */`, - template: `import {{pascalCase name}} from "./{{pascalCase name}}"`, - }, - { - type: "append", - path: "src/app/components/index.ts", - pattern: `/* PLOP_INJECT_EXPORT */`, - template: ` {{pascalCase name}},`, - }, - { - type: "append", - path: "src/app/components/index.ts", - pattern: `/* PLOP_INJECT_TYPE_IMPORT */`, - template: ` {{pascalCase name}}Props,`, - }, - { - type: "append", - path: "src/app/components/index.ts", - pattern: `/* PLOP_INJECT_TYPE_EXPORT */`, - template: ` type {{pascalCase name}}Props,`, - }, - { - type: "append", - path: "src/app/types/components.interface.ts", - pattern: `/* PLOP_INJECT_INTERFACE */`, - template: `export interface {{pascalCase name}}Props extends BaseProps {\n}\n`, - }, - ], - }) - plop.setGenerator("atom", { - description: "Create a component", - prompts: [ - { - type: "input", - name: "name", - message: "What is your component name?", - }, - ], - actions: [ - { - type: "add", - path: "src/app/components/{{pascalCase name}}/{{pascalCase name}}.tsx", - templateFile: "plop-templates/Component/Component.tsx.hbs", - }, - { - type: "add", - path: "src/app/components/{{pascalCase name}}/{{pascalCase name}}.test.ts", - templateFile: "plop-templates/Component/Component.test.ts.hbs", - }, - { - type: "add", - path: "src/app/components/{{pascalCase name}}/{{pascalCase name}}.component.scss", - templateFile: "plop-templates/Component/Component.component.scss.hbs", - }, - { - type: "add", - path: "src/app/components/{{pascalCase name}}/index.ts", - templateFile: "plop-templates/Component/index.ts.hbs", - }, - { - type: "add", - path: "src/app/components/index.ts", - templateFile: "plop-templates/injectable-index.ts.hbs", - skipIfExists: true, - }, - { - type: "append", - path: "src/app/components/index.ts", - pattern: `/* PLOP_INJECT_IMPORT */`, - template: `import {{pascalCase name}} from "./{{pascalCase name}}"`, - }, - { - type: "append", - path: "src/app/components/index.ts", - pattern: `/* PLOP_INJECT_EXPORT */`, - template: ` {{pascalCase name}},`, - }, - { - type: "append", - path: "src/app/components/index.ts", - pattern: `/* PLOP_INJECT_TYPE_IMPORT */`, - template: ` {{pascalCase name}}Props,`, - }, - { - type: "append", - path: "src/app/components/index.ts", - pattern: `/* PLOP_INJECT_TYPE_EXPORT */`, - template: ` type {{pascalCase name}}Props,`, - }, - { - type: "append", - path: "src/app/types/components.interface.ts", - pattern: `/* PLOP_INJECT_INTERFACE */`, - template: `export interface {{pascalCase name}}Props extends BaseProps {\n}\n`, - }, - ], - }) - plop.setGenerator("molecule", { - description: "Create a rich component", - prompts: [ - { - type: "input", - name: "name", - message: "What is your component name?", - }, - ], - actions: [ - { - type: "add", - path: "src/app/components/{{pascalCase name}}/{{pascalCase name}}.tsx", - templateFile: "plop-templates/Component/Component.tsx.hbs", - }, - { - type: "add", - path: "src/app/components/{{pascalCase name}}/{{pascalCase name}}.test.ts", - templateFile: "plop-templates/Component/Component.test.ts.hbs", - }, - { - type: "add", - path: "src/app/components/{{pascalCase name}}/{{pascalCase name}}.component.scss", - templateFile: "plop-templates/Component/Component.component.scss.hbs", - }, - { - type: "add", - path: "src/app/components/{{pascalCase name}}/index.ts", - templateFile: "plop-templates/Component/index.ts.hbs", - }, - { - type: "add", - path: "src/app/components/index.ts", - templateFile: "plop-templates/injectable-index.ts.hbs", - skipIfExists: true, - }, - { - type: "append", - path: "src/app/components/index.ts", - pattern: `/* PLOP_INJECT_IMPORT */`, - template: `import {{pascalCase name}} from "./{{pascalCase name}}"`, - }, - { - type: "append", - path: "src/app/components/index.ts", - pattern: `/* PLOP_INJECT_EXPORT */`, - template: ` {{pascalCase name}},`, - }, - { - type: "append", - path: "src/app/components/index.ts", - pattern: `/* PLOP_INJECT_TYPE_IMPORT */`, - template: ` {{pascalCase name}}Props,`, - }, - { - type: "append", - path: "src/app/components/index.ts", - pattern: `/* PLOP_INJECT_TYPE_EXPORT */`, - template: ` type {{pascalCase name}}Props,`, - }, - { - type: "append", - path: "src/app/types/components.interface.ts", - pattern: `/* PLOP_INJECT_INTERFACE */`, - template: `export interface {{pascalCase name}}Props extends BaseProps {\n}\n`, - }, - ], - }) - plop.setGenerator("page", { - description: "Create a page", - prompts: [ - { - type: "input", - name: "name", - message: "What is your page name?", - }, - ], - actions: [ - { - type: "add", - path: "src/app/pages/{{pascalCase name}}/{{pascalCase name}}.tsx", - templateFile: "plop-templates/Page/Page.tsx.hbs", - }, - { - type: "add", - path: "src/app/pages/{{pascalCase name}}/{{pascalCase name}}.test.ts", - templateFile: "plop-templates/Page/Page.test.ts.hbs", - }, - { - type: "add", - path: "src/app/pages/{{pascalCase name}}/{{pascalCase name}}.page.scss", - templateFile: "plop-templates/Page/Page.page.scss.hbs", - }, - { - type: "add", - path: "src/app/pages/{{pascalCase name}}/index.ts", - templateFile: "plop-templates/Page/index.ts.hbs", - }, - { - type: "add", - path: "src/app/pages/{{pascalCase name}}/{{pascalCase name}}.slice.ts", - templateFile: "plop-templates/Page/Page.slice.ts.hbs", - }, - { - type: "add", - path: "src/app/pages/index.ts", - templateFile: "plop-templates/injectable-index.ts.hbs", - skipIfExists: true, - }, - { - type: "append", - path: "src/app/pages/index.ts", - pattern: `/* PLOP_INJECT_IMPORT */`, - template: `import {{pascalCase name}} from "./{{pascalCase name}}"`, - }, - { - type: "append", - path: "src/app/pages/index.ts", - pattern: `/* PLOP_INJECT_EXPORT */`, - template: ` {{pascalCase name}},`, - }, + template: `export { default as {{pascalCase name}} } from "./{{pascalCase name}}"`, + } ], }) } diff --git a/src/AdvancedColorPicker.tsx b/src/AdvancedColorPicker.tsx index 2757440..344ac50 100755 --- a/src/AdvancedColorPicker.tsx +++ b/src/AdvancedColorPicker.tsx @@ -29,12 +29,12 @@ const AdvancedColorPicker = (props: AdvancedColorPickerProps): JSX.Element => { saturation !== undefined && lightness !== undefined ? "hsl(" + - Math.round(hue * 255) + - ", " + - Math.round(saturation * 100) + - "%, " + - Math.round(lightness * 100) + - "%)" + Math.round(hue * 255) + + ", " + + Math.round(saturation * 100) + + "%, " + + Math.round(lightness * 100) + + "%)" : "" } @@ -45,7 +45,11 @@ const AdvancedColorPicker = (props: AdvancedColorPickerProps): JSX.Element => { )} {`colormap-${id}`} diff --git a/src/AppAndToolsSelector.tsx b/src/AppAndToolsSelector.tsx index 5ad73c6..ecdca3b 100755 --- a/src/AppAndToolsSelector.tsx +++ b/src/AppAndToolsSelector.tsx @@ -26,10 +26,12 @@ const AppTile = (props: AppTileProps) => { size: "2rem", colors: { fillColor: theme === ArThemes.LIGHT1 ? "#777" : "#bbb", + strokeColor: theme === ArThemes.LIGHT1 ? "#777" : "#bbb", hoverFillColor: theme === ArThemes.LIGHT1 ? "black" : "white", }, }} icon={icon} + fillPath /> {label} diff --git a/src/ArIconsViewer.component.scss b/src/ArIconsViewer.component.scss index 34c825f..3653f42 100755 --- a/src/ArIconsViewer.component.scss +++ b/src/ArIconsViewer.component.scss @@ -1,5 +1,6 @@ .ar-ArIconsViewer { grid-template-columns: minmax(10rem, 1fr); + color: #0b8dfa; .ar-ScrollPagination__items-container.compact, .ar-ScrollPagination__items-container.comfy { .ar-ArIconsViewer__icon-container:hover { diff --git a/src/ArIconsViewer.tsx b/src/ArIconsViewer.tsx index 0663d55..2f77d0f 100755 --- a/src/ArIconsViewer.tsx +++ b/src/ArIconsViewer.tsx @@ -21,7 +21,7 @@ import Tooltip from "./Tooltip" import "./ArIconsViewer.component.scss" const pageApi = - STATIC_HOST[process.env.NODE_ENV as "development" | "production"] + + STATIC_HOST[process.env.NODE_ENV] + ENDPOINTS.STATIC.ICON.ROOT + ENDPOINTS.STATIC.ICON.PAGE diff --git a/src/BrowserIncompatibility.tsx b/src/BrowserIncompatibility.tsx index 2b2f3b7..aa86d87 100755 --- a/src/BrowserIncompatibility.tsx +++ b/src/BrowserIncompatibility.tsx @@ -1,6 +1,7 @@ import { v4 as uuid } from "uuid" import { ArThemes, BrowserIncompatibilityProps } from "@armco/types" import { copyToClipboard } from "@armco/utils/helper" +import { useTheme } from "@armco/utils/hooks" import Icon from "@armco/icon" import Alert from "./Alert" import Link from "./Link" @@ -9,7 +10,8 @@ import "./BrowserIncompatibility.component.scss" const BrowserIncompatibility = ( props: BrowserIncompatibilityProps, ): JSX.Element => { - const { applicationName, moreLink, theme } = props + const { applicationName, moreLink } = props + const { theme } = useTheme() const demoDummyLink = "https://notabuck.com/armco-design-system/docs/devices" const demoAppName = '"My Awesome App"' const helpLink = moreLink || demoDummyLink diff --git a/src/BubbleChart.tsx b/src/BubbleChart.tsx index 491ca5c..5c30367 100755 --- a/src/BubbleChart.tsx +++ b/src/BubbleChart.tsx @@ -1,11 +1,9 @@ import { useEffect, useRef } from "react" import Highcharts from "highcharts" -import HighchartsMore from "highcharts/highcharts-more" +import "highcharts/highcharts-more" import { BubbleChartProps, ObjectType } from "@armco/types" import "./BubbleChart.component.scss" -HighchartsMore(Highcharts) - const BubbleChart = (props: BubbleChartProps): JSX.Element => { const { clickHandler, data } = props const chartRef = useRef(null) diff --git a/src/Button.tsx b/src/Button.tsx index 5498166..d212498 100755 --- a/src/Button.tsx +++ b/src/Button.tsx @@ -13,7 +13,6 @@ const Button = (props: ButtonProps) => { const { classes, color, - containerClasses, contentClasses, contentStyles, content, @@ -45,7 +44,7 @@ const Button = (props: ButtonProps) => { variant === ArButtonVariants.LINK || variant === ArButtonVariants.LINKHOVEREFFECT ) { - setColor = "black" + setColor = theme === ArThemes.DARK1 ? "white" : "black" } else if (variant === ArButtonVariants.SECONDARY) { setColor = hovered ? theme === ArThemes.DARK1 @@ -81,7 +80,9 @@ const Button = (props: ButtonProps) => { {...rest} > {preIcon && ( - + { (!preIcon && !postIcon ? "Button" : "")} {postIcon && ( - + { item && ( Children.toArray( - (item as React.ReactElement).props.children, + ( + (item as React.ReactElement).props as { + children: ReactNode + } + ).children, ) as ReactNode[] ).find( (children) => (children as React.ReactElement).type === "img", diff --git a/src/Draggable.tsx b/src/Draggable.tsx index d9f5984..d6dc004 100755 --- a/src/Draggable.tsx +++ b/src/Draggable.tsx @@ -9,6 +9,7 @@ import { } from "react" import { findDOMNode } from "react-dom" import { useDrag } from "react-dnd" +import { getEmptyImage } from "react-dnd-html5-backend" import { ArDndItemTypes, DraggableProps } from "@armco/types" import "./Draggable.component.scss" @@ -22,7 +23,7 @@ const Draggable = forwardRef((props: DraggableProps, ref) => { const { canDrag, children, - demo, + hideDefaultPreview, itemData, itemType = ArDndItemTypes.GENERIC, style, @@ -30,12 +31,11 @@ const Draggable = forwardRef((props: DraggableProps, ref) => { const localRef = useRef(null) ref = ref || localRef - const useChildren = demo ? children || dummyChildren : children let firstChild - if (typeof useChildren === "string") { - firstChild = {useChildren} + if (typeof children === "string") { + firstChild = {children} } else { - const childrenArray = Children.toArray(useChildren) + const childrenArray = Children.toArray(children) firstChild = childrenArray[0] // Warn if more than one child is passed if (childrenArray.length > 1) { @@ -45,7 +45,7 @@ const Draggable = forwardRef((props: DraggableProps, ref) => { } } - const [{ isDragging }, drag] = useDrag( + const [{ isDragging }, drag, preview] = useDrag( () => ({ type: itemType, item: itemData, @@ -64,6 +64,12 @@ const Draggable = forwardRef((props: DraggableProps, ref) => { } }, [drag]) + useEffect(() => { + if (hideDefaultPreview && preview) { + preview(getEmptyImage(), { captureDraggingState: true }) + } +}, [hideDefaultPreview, preview]) + const { style: childStyles, className: childClasses, diff --git a/src/Drawer.component.scss b/src/Drawer.component.scss index 81aa012..87c84dd 100755 --- a/src/Drawer.component.scss +++ b/src/Drawer.component.scss @@ -1,5 +1,12 @@ .ar-Drawer { border-right: 1px solid var(--ar-color-layout-border); + + .ar_Drawer__content { + height: 100%; + } + &.has-title .ar-Drawer__content { + height: calc(100% - 0.875rem - 2rem - 1px) // -font-size - padding - border + } &.collapsed { .ar-Drawer__expander { right: 1rem; diff --git a/src/Drawer.tsx b/src/Drawer.tsx index 4a857cc..8148824 100755 --- a/src/Drawer.tsx +++ b/src/Drawer.tsx @@ -9,7 +9,7 @@ const isMobile = checkMobile() let clickedSelf: boolean const Drawer = (props: DrawerProps): JSX.Element => { - const { children, classes, isCollapsible } = props + const { children, classes, contentClasses, isCollapsible, title } = props const drawerRef = useRef(null) const { drawerState, setDrawerState } = useDrawerState() const { theme } = useTheme() @@ -25,9 +25,11 @@ const Drawer = (props: DrawerProps): JSX.Element => { return ( ) } diff --git a/src/Dropdown.tsx b/src/Dropdown.tsx index d35ec2e..41ec15f 100755 --- a/src/Dropdown.tsx +++ b/src/Dropdown.tsx @@ -165,7 +165,9 @@ const Dropdown = (props: DropdownProps): JSX.Element => { ) const assistiveContentRender = assistiveContent ? ( - "content" in assistiveContent && "onClick" in assistiveContent ? ( + typeof assistiveContent === "object" && + "content" in assistiveContent && + "onClick" in assistiveContent ? (