@linzjs/windows 1.4.4 → 1.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{src → dist}/modal/Modal.tsx +1 -1
- package/{src → dist}/panel/Panel.tsx +3 -3
- package/package.json +5 -2
- package/.eslintrc.cjs +0 -103
- package/.github/dependabot.yml +0 -12
- package/.github/pull_request_template.md +0 -29
- package/.github/workflows/chromatic.yml +0 -23
- package/.github/workflows/deploy-storybook.yml +0 -86
- package/.prettierrc.cjs +0 -12
- package/.storybook/main.ts +0 -37
- package/.storybook/preview.ts +0 -15
- package/.stylelintrc.json +0 -68
- package/config/jest/babelTransform.cjs +0 -29
- package/config/jest/cssTransform.cjs +0 -14
- package/config/jest/fileTransform.cjs +0 -38
- package/config/jest/setup.js +0 -2
- package/empty.js +0 -1
- package/jest.config.cjs +0 -19
- package/rollup.config.cjs +0 -37
- package/src/panel/generateId.test.ts +0 -9
- package/src/setupTests.ts +0 -5
- package/src/stories/Introduction.mdx +0 -18
- package/src/stories/Introduction.stories.tsx +0 -8
- package/src/stories/modal/Modal.mdx +0 -26
- package/src/stories/modal/Modal.stories.tsx +0 -27
- package/src/stories/modal/PrefabModal.mdx +0 -26
- package/src/stories/modal/PrefabModal.stories.tsx +0 -27
- package/src/stories/modal/PrefabModal.tsx +0 -63
- package/src/stories/modal/TestModal.scss +0 -16
- package/src/stories/modal/TestModal.tsx +0 -55
- package/src/stories/panel/PanelButtons/ShowPanel.mdx +0 -21
- package/src/stories/panel/PanelButtons/ShowPanel.stories.tsx +0 -27
- package/src/stories/panel/PanelButtons/ShowPanel.tsx +0 -88
- package/src/stories/panel/ShowPanel/ShowPanel.mdx +0 -20
- package/src/stories/panel/ShowPanel/ShowPanel.stories.tsx +0 -27
- package/src/stories/panel/ShowPanel/ShowPanel.tsx +0 -68
- package/src/stories/panel/ShowPanelDocking/ShowPanel.mdx +0 -20
- package/src/stories/panel/ShowPanelDocking/ShowPanel.stories.tsx +0 -27
- package/src/stories/panel/ShowPanelDocking/ShowPanel.tsx +0 -61
- package/src/stories/panel/ShowPanelResizingAgGrid/ShowPanelResizingAgGrid.mdx +0 -21
- package/src/stories/panel/ShowPanelResizingAgGrid/ShowPanelResizingAgGrid.stories.tsx +0 -27
- package/src/stories/panel/ShowPanelResizingAgGrid/ShowPanelResizingStepAgGrid.tsx +0 -162
- package/src/stories/panel/ShowTabbedPanel/ShowPanel.mdx +0 -20
- package/src/stories/panel/ShowTabbedPanel/ShowPanel.stories.tsx +0 -27
- package/src/stories/panel/ShowTabbedPanel/ShowPanel.tsx +0 -73
- package/src/stories/panel/story.scss +0 -14
- package/src/stories/support.js +0 -16
- package/src/util/useInterval.test.tsx +0 -26
- package/tsconfig.json +0 -37
- /package/{src → dist}/index.ts +0 -0
- /package/{src → dist}/modal/ModalContext.scss +0 -0
- /package/{src → dist}/modal/ModalContext.tsx +0 -0
- /package/{src → dist}/modal/ModalContextProvider.tsx +0 -0
- /package/{src → dist}/modal/ModalInstanceContext.ts +0 -0
- /package/{src → dist}/modal/PrefabModal.scss +0 -0
- /package/{src → dist}/modal/PrefabModal.tsx +0 -0
- /package/{src → dist}/modal/index.ts +0 -0
- /package/{src → dist}/modal/useShowModal.ts +0 -0
- /package/{src → dist}/panel/OpenPanelButton.tsx +0 -0
- /package/{src → dist}/panel/OpenPanelIcon.scss +0 -0
- /package/{src → dist}/panel/OpenPanelIcon.tsx +0 -0
- /package/{src → dist}/panel/Panel.scss +0 -0
- /package/{src → dist}/panel/PanelBlue.scss +0 -0
- /package/{src → dist}/panel/PanelContext.ts +0 -0
- /package/{src → dist}/panel/PanelDock.tsx +0 -0
- /package/{src → dist}/panel/PanelHeader.tsx +0 -0
- /package/{src → dist}/panel/PanelHeaderButton.tsx +0 -0
- /package/{src → dist}/panel/PanelInstanceContext.ts +0 -0
- /package/{src → dist}/panel/PanelInstanceContextProvider.tsx +0 -0
- /package/{src → dist}/panel/PanelsContext.tsx +0 -0
- /package/{src → dist}/panel/PanelsContextProvider.tsx +0 -0
- /package/{src → dist}/panel/PopoutWindow.tsx +0 -0
- /package/{src → dist}/panel/generateId.ts +0 -0
- /package/{src → dist}/panel/handleStyleSheetsChanges.ts +0 -0
- /package/{src → dist}/panel/index.ts +0 -0
- /package/{src → dist}/util/useInterval.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ModalInstanceContext } from "./ModalInstanceContext";
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import { delay } from "lodash-es";
|
|
4
|
-
import { PropsWithChildren, ReactElement, useContext, useEffect, useRef } from "react";
|
|
4
|
+
import React, { PropsWithChildren, ReactElement, useContext, useEffect, useRef } from "react";
|
|
5
5
|
|
|
6
6
|
export interface ModalProps {
|
|
7
7
|
className?: string;
|
|
@@ -7,8 +7,8 @@ import { PanelInstanceContext, PanelSize } from "./PanelInstanceContext";
|
|
|
7
7
|
import { PanelPosition, PanelsContext } from "./PanelsContext";
|
|
8
8
|
import { PopoutWindow } from "./PopoutWindow";
|
|
9
9
|
import clsx from "clsx";
|
|
10
|
-
import { ReactElement, ReactNode, useContext, useEffect, useState } from "react";
|
|
11
|
-
import
|
|
10
|
+
import React, { ReactElement, ReactNode, useContext, useEffect, useState } from "react";
|
|
11
|
+
import { createPortal } from "react-dom";
|
|
12
12
|
import { Rnd } from "react-rnd";
|
|
13
13
|
|
|
14
14
|
export interface PanelProps {
|
|
@@ -50,7 +50,7 @@ export const Panel = ({
|
|
|
50
50
|
return (
|
|
51
51
|
<PanelContext.Provider value={{ resizePanel }}>
|
|
52
52
|
{dockElement && dockElement.isConnected ? (
|
|
53
|
-
|
|
53
|
+
createPortal(children, dockElement)
|
|
54
54
|
) : panelPoppedOut ? (
|
|
55
55
|
<PopoutWindow name={uniqueId} title={title} size={panelSize}>
|
|
56
56
|
<div
|
package/package.json
CHANGED
|
@@ -12,14 +12,17 @@
|
|
|
12
12
|
"panel",
|
|
13
13
|
"popout"
|
|
14
14
|
],
|
|
15
|
-
"main": "./
|
|
16
|
-
"version": "1.4.
|
|
15
|
+
"main": "./dist/index.ts",
|
|
16
|
+
"version": "1.4.6",
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"@linzjs/lui": "^17",
|
|
19
19
|
"lodash-es": ">=4",
|
|
20
20
|
"react": ">=17",
|
|
21
21
|
"react-dom": ">=17"
|
|
22
22
|
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
23
26
|
"type": "module",
|
|
24
27
|
"publishConfig": {
|
|
25
28
|
"access": "public"
|
package/.eslintrc.cjs
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
// This config will run in a way that fails a build
|
|
2
|
-
module.exports = {
|
|
3
|
-
env: {
|
|
4
|
-
commonjs: true,
|
|
5
|
-
es2020: true,
|
|
6
|
-
node: true
|
|
7
|
-
},
|
|
8
|
-
plugins: ["react", "react-hooks", "jest", "jsx-a11y", "testing-library"],
|
|
9
|
-
settings: {
|
|
10
|
-
react: {
|
|
11
|
-
version: "detect"
|
|
12
|
-
},
|
|
13
|
-
jest: {
|
|
14
|
-
version: 26
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
parserOptions: {
|
|
18
|
-
ecmaVersion: 2020,
|
|
19
|
-
sourceType: "module"
|
|
20
|
-
},
|
|
21
|
-
extends: ["eslint:recommended", "plugin:react/recommended", "plugin:react-hooks/recommended", "plugin:jest/recommended", "plugin:jest/style", "plugin:testing-library/react", "plugin:prettier/recommended", "plugin:storybook/recommended"],
|
|
22
|
-
ignorePatterns: ["react-app-env.d.ts"],
|
|
23
|
-
rules: {
|
|
24
|
-
// testing-library - to fix
|
|
25
|
-
"testing-library/no-dom-import": "off",
|
|
26
|
-
// Fix these
|
|
27
|
-
"jest/no-conditional-expect": "off",
|
|
28
|
-
"jest/no-standalone-expect": "off",
|
|
29
|
-
"jest/valid-expect": "off",
|
|
30
|
-
"jest/prefer-to-be": "error",
|
|
31
|
-
"testing-library/no-unnecessary-act": "off",
|
|
32
|
-
"testing-library/prefer-presence-queries": "off",
|
|
33
|
-
"testing-library/no-wait-for-multiple-assertions": "off",
|
|
34
|
-
"testing-library/no-render-in-setup": "off",
|
|
35
|
-
"testing-library/no-node-access": "off",
|
|
36
|
-
"testing-library/prefer-screen-queries": "off",
|
|
37
|
-
"testing-library/prefer-find-by": "off",
|
|
38
|
-
"testing-library/prefer-query-by-disappearance": "off",
|
|
39
|
-
"testing-library/no-debugging-utils": "warn",
|
|
40
|
-
"testing-library/render-result-naming-convention": "off",
|
|
41
|
-
// customized rules
|
|
42
|
-
"react/no-unescaped-entities": ["error", {
|
|
43
|
-
forbid: [">", '"', "}"]
|
|
44
|
-
}],
|
|
45
|
-
// ' is ok, don't want to escape this
|
|
46
|
-
"react/react-in-jsx-scope": "off",
|
|
47
|
-
// TS config takes care of this
|
|
48
|
-
"linebreak-style": ["error", "unix"],
|
|
49
|
-
// prevent crlf from getting pushed
|
|
50
|
-
"react/prop-types": "off",
|
|
51
|
-
// Doesn't seem pick up React.FC<Props> typing
|
|
52
|
-
"no-console": ["error", {
|
|
53
|
-
allow: ["warn", "error"]
|
|
54
|
-
}],
|
|
55
|
-
// error on push/codacy
|
|
56
|
-
"jest/no-disabled-tests": "warn",
|
|
57
|
-
// we have some disabled tests
|
|
58
|
-
"no-unused-vars": "off",
|
|
59
|
-
// duplicate of typescript rule
|
|
60
|
-
"react/jsx-no-target-blank": "off",
|
|
61
|
-
"jest/expect-expect": "off",
|
|
62
|
-
// sometimes the assertions are in other functions called from a test
|
|
63
|
-
|
|
64
|
-
"react-hooks/rules-of-hooks": "error",
|
|
65
|
-
"react-hooks/exhaustive-deps": ["warn", {
|
|
66
|
-
additionalHooks: "(useWorkflowEffect|useWorkflowSidePanelHook)"
|
|
67
|
-
}]
|
|
68
|
-
},
|
|
69
|
-
overrides: [{
|
|
70
|
-
/** Overrides for typescript */
|
|
71
|
-
files: ["**/*.ts", "**/*.tsx"],
|
|
72
|
-
plugins: ["@typescript-eslint"],
|
|
73
|
-
parser: "@typescript-eslint/parser",
|
|
74
|
-
parserOptions: {
|
|
75
|
-
project: "./tsconfig.json",
|
|
76
|
-
tsconfigRootDir: __dirname
|
|
77
|
-
},
|
|
78
|
-
extends: ["plugin:@typescript-eslint/recommended"],
|
|
79
|
-
rules: {
|
|
80
|
-
"@typescript-eslint/await-thenable": "error",
|
|
81
|
-
"@typescript-eslint/no-unnecessary-type-constraint": "off",
|
|
82
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
|
83
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
84
|
-
"@typescript-eslint/no-empty-function": ["warn", {
|
|
85
|
-
allow: ["arrowFunctions"]
|
|
86
|
-
}],
|
|
87
|
-
"@typescript-eslint/no-unused-vars": ["error", {
|
|
88
|
-
argsIgnorePattern: "^_"
|
|
89
|
-
}],
|
|
90
|
-
// prepend var with _ (e.g.. _myVar) to ignore this pattern
|
|
91
|
-
"@typescript-eslint/no-use-before-define": "off",
|
|
92
|
-
// We will want to use before define to keep exports at the top
|
|
93
|
-
"@typescript-eslint/ban-ts-comment": "off",
|
|
94
|
-
// We use explicit overrides
|
|
95
|
-
"@typescript-eslint/naming-convention": "off" // React's convention is to use CamelCase for component file names
|
|
96
|
-
}
|
|
97
|
-
}, {
|
|
98
|
-
files: ["*.test.js", "*.test.ts", "*.test.tsx", "scripts/*"],
|
|
99
|
-
rules: {
|
|
100
|
-
"no-console": "off"
|
|
101
|
-
}
|
|
102
|
-
}]
|
|
103
|
-
};
|
package/.github/dependabot.yml
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# Basic dependabot.yml file with
|
|
2
|
-
# minimum configuration for two package managers
|
|
3
|
-
|
|
4
|
-
version: 2
|
|
5
|
-
updates:
|
|
6
|
-
# Enable version updates for npm
|
|
7
|
-
- package-ecosystem: 'npm'
|
|
8
|
-
# Look for `package.json` and `lock` files in the `root` directory
|
|
9
|
-
directory: '/'
|
|
10
|
-
# Check the npm registry for updates every day (weekdays)
|
|
11
|
-
schedule:
|
|
12
|
-
interval: 'daily'
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
DESCRIPTION of the task, STORY/TASK number and link if applicable (e.g. SURVEY-100)
|
|
2
|
-
|
|
3
|
-
Author Checklist
|
|
4
|
-
|
|
5
|
-
- [ ] appropriate description or links provided to provide context on the PR
|
|
6
|
-
- [ ] self reviewed, seems easy to understand and follow
|
|
7
|
-
- [ ] reasonable code test coverage
|
|
8
|
-
- [ ] change is documented in Storybook and/or markdown files
|
|
9
|
-
|
|
10
|
-
Reviewer Checklist
|
|
11
|
-
|
|
12
|
-
- Follows convention
|
|
13
|
-
- Does what the author says it will do
|
|
14
|
-
- Does not appear to cause side effects and breaking changes
|
|
15
|
-
- if it does cause breaking changes, those are appropriately referenced
|
|
16
|
-
|
|
17
|
-
Post merge
|
|
18
|
-
|
|
19
|
-
- [ ] Post about the change in #lui-cop
|
|
20
|
-
|
|
21
|
-
Conventional Commit Cheat Sheet:
|
|
22
|
-
**build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
|
|
23
|
-
**ci**: Changes to our CI configuration files and scripts (example scopes: Circle, BrowserStack, SauceLabs)
|
|
24
|
-
**docs**: Documentation only changes
|
|
25
|
-
**feat**: A new feature
|
|
26
|
-
**fix**: A bug fix
|
|
27
|
-
**perf**: A code change that improves performance
|
|
28
|
-
**refactor**: A code change that neither fixes a bug nor adds a feature
|
|
29
|
-
**test**: Adding missing tests or correcting existing tests
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
name: 'Chromatic'
|
|
2
|
-
on: push
|
|
3
|
-
|
|
4
|
-
jobs:
|
|
5
|
-
chromatic-deployment:
|
|
6
|
-
runs-on: ubuntu-latest
|
|
7
|
-
steps:
|
|
8
|
-
- uses: actions/checkout@v1
|
|
9
|
-
- name: Install dependencies
|
|
10
|
-
run: npm i --legacy-peer-deps && npm run build-storybook
|
|
11
|
-
- name: Publish to non-master non-beta to Chromatic
|
|
12
|
-
if: github.ref != 'refs/heads/master' && github.ref != 'refs/heads/beta'
|
|
13
|
-
uses: chromaui/action@v1
|
|
14
|
-
with:
|
|
15
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
|
16
|
-
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
|
|
17
|
-
- name: Publish Chromatic and auto accept changes for master and beta
|
|
18
|
-
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta'
|
|
19
|
-
uses: chromaui/action@v1
|
|
20
|
-
with:
|
|
21
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
|
22
|
-
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
|
|
23
|
-
autoAcceptChanges: true # 👈 Option to accept all changes
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
on: [push]
|
|
3
|
-
jobs:
|
|
4
|
-
build:
|
|
5
|
-
runs-on: ubuntu-latest
|
|
6
|
-
|
|
7
|
-
steps:
|
|
8
|
-
- name: Begin CI...
|
|
9
|
-
uses: actions/checkout@v2
|
|
10
|
-
with:
|
|
11
|
-
persist-credentials: false
|
|
12
|
-
|
|
13
|
-
- name: Use Node 16
|
|
14
|
-
uses: actions/setup-node@v2
|
|
15
|
-
with:
|
|
16
|
-
node-version: 16.x
|
|
17
|
-
|
|
18
|
-
- name: Install dependencies
|
|
19
|
-
run: npm ci --legacy-peer-deps
|
|
20
|
-
|
|
21
|
-
- name: Test
|
|
22
|
-
run: npm run test --ci --coverage --maxWorkers=2
|
|
23
|
-
|
|
24
|
-
- name: Build
|
|
25
|
-
run: npm run build
|
|
26
|
-
|
|
27
|
-
- name: Release
|
|
28
|
-
if: github.ref == 'refs/heads/master'
|
|
29
|
-
run: npx semantic-release
|
|
30
|
-
env:
|
|
31
|
-
GH_TOKEN: ${{secrets.STEP_ENABLEMENT_SERVICE_PAT}}
|
|
32
|
-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
33
|
-
NPM_TOKEN: ${{secrets.NPM_AUTH_TOKEN_LINZJS}}
|
|
34
|
-
|
|
35
|
-
publish-beta-npm:
|
|
36
|
-
if: startsWith(github.ref, 'refs/heads/beta')
|
|
37
|
-
needs: build
|
|
38
|
-
runs-on: ubuntu-latest
|
|
39
|
-
steps:
|
|
40
|
-
- uses: actions/checkout@v2
|
|
41
|
-
with:
|
|
42
|
-
token: ${{secrets.STEP_ENABLEMENT_SERVICE_PAT}}
|
|
43
|
-
|
|
44
|
-
- uses: actions/setup-node@v2
|
|
45
|
-
with:
|
|
46
|
-
node-version: 16
|
|
47
|
-
registry-url: https://registry.npmjs.org/
|
|
48
|
-
|
|
49
|
-
- name: Install dependencies
|
|
50
|
-
run: npm ci --legacy-peer-deps
|
|
51
|
-
|
|
52
|
-
- name: Build
|
|
53
|
-
run: npm run build
|
|
54
|
-
|
|
55
|
-
- run: npm version prerelease -m "%s [skip ci]" && git push
|
|
56
|
-
env:
|
|
57
|
-
GIT_AUTHOR_EMAIL: STEPEnablementService@linz.govt.nz
|
|
58
|
-
GIT_AUTHOR_NAME: STEP Enablement Service
|
|
59
|
-
GIT_COMMITTER_EMAIL: STEPEnablementService@linz.govt.nz
|
|
60
|
-
GIT_COMMITTER_NAME: STEP Enablement Service
|
|
61
|
-
|
|
62
|
-
- run: npm publish --access public --tag beta
|
|
63
|
-
env:
|
|
64
|
-
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN_LINZJS}}
|
|
65
|
-
|
|
66
|
-
publish-storybook:
|
|
67
|
-
if: github.ref == 'refs/heads/master'
|
|
68
|
-
needs: build
|
|
69
|
-
runs-on: ubuntu-latest
|
|
70
|
-
steps:
|
|
71
|
-
|
|
72
|
-
- uses: actions/checkout@v2
|
|
73
|
-
|
|
74
|
-
- uses: actions/setup-node@v2
|
|
75
|
-
with:
|
|
76
|
-
node-version: 16
|
|
77
|
-
|
|
78
|
-
- name: Install dependencies
|
|
79
|
-
run: npm ci --legacy-peer-deps
|
|
80
|
-
|
|
81
|
-
- name: Build
|
|
82
|
-
run: npm run build
|
|
83
|
-
|
|
84
|
-
- run: npm run deploy-storybook -- --ci
|
|
85
|
-
env:
|
|
86
|
-
GH_TOKEN: github-actions:${{secrets.GITHUB_TOKEN}}
|
package/.prettierrc.cjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
semi: true,
|
|
3
|
-
trailingComma: "all",
|
|
4
|
-
printWidth: 120,
|
|
5
|
-
useTabs: false,
|
|
6
|
-
tabWidth: 2,
|
|
7
|
-
singleQuote: false,
|
|
8
|
-
endOfLine: "lf",
|
|
9
|
-
importOrder: [".(css|scss)$", "<THIRD_PARTY_MODULES>", "^@linzjs/(.*)$", "^@step-ag-grid"],
|
|
10
|
-
importOrderSeparation: true,
|
|
11
|
-
importOrderSortSpecifiers: true,
|
|
12
|
-
};
|
package/.storybook/main.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { NodeGlobalsPolyfillPlugin } from "@esbuild-plugins/node-globals-polyfill";
|
|
2
|
-
import { NodeModulesPolyfillPlugin } from "@esbuild-plugins/node-modules-polyfill";
|
|
3
|
-
import type { StorybookConfig } from "@storybook/react-vite";
|
|
4
|
-
import { mergeConfig } from "vite";
|
|
5
|
-
|
|
6
|
-
const config: StorybookConfig = {
|
|
7
|
-
stories: ["../src/**/Introduction.mdx", "../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
|
|
8
|
-
addons: ["@storybook/addon-links", "@storybook/addon-essentials", "@storybook/addon-interactions"],
|
|
9
|
-
framework: {
|
|
10
|
-
name: "@storybook/react-vite",
|
|
11
|
-
options: {},
|
|
12
|
-
},
|
|
13
|
-
docs: {
|
|
14
|
-
autodocs: "tag",
|
|
15
|
-
},
|
|
16
|
-
viteFinal: async (config) => {
|
|
17
|
-
return mergeConfig(config, {
|
|
18
|
-
optimizeDeps: {
|
|
19
|
-
esbuildOptions: {
|
|
20
|
-
// Node.js global to browser globalThis
|
|
21
|
-
define: {
|
|
22
|
-
global: "globalThis",
|
|
23
|
-
},
|
|
24
|
-
// Enable esbuild polyfill plugins
|
|
25
|
-
plugins: [
|
|
26
|
-
NodeGlobalsPolyfillPlugin({
|
|
27
|
-
buffer: true,
|
|
28
|
-
process: true,
|
|
29
|
-
}),
|
|
30
|
-
NodeModulesPolyfillPlugin(),
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
export default config;
|
package/.storybook/preview.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Preview } from "@storybook/react";
|
|
2
|
-
|
|
3
|
-
const preview: Preview = {
|
|
4
|
-
parameters: {
|
|
5
|
-
actions: { argTypesRegex: "^on[A-Z].*" },
|
|
6
|
-
controls: {
|
|
7
|
-
matchers: {
|
|
8
|
-
color: /(background|color)$/i,
|
|
9
|
-
date: /Date$/,
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default preview;
|
package/.stylelintrc.json
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["stylelint-config-standard", "stylelint-config-prettier", "stylelint-config-recommended-scss"],
|
|
3
|
-
"plugins": ["stylelint-scss"],
|
|
4
|
-
"customSyntax": "postcss-scss",
|
|
5
|
-
"rules": {
|
|
6
|
-
"at-rule-no-unknown": null,
|
|
7
|
-
"at-rule-empty-line-before": null,
|
|
8
|
-
"block-closing-brace-newline-before": "always-multi-line",
|
|
9
|
-
"block-closing-brace-newline-after": [
|
|
10
|
-
"always-multi-line",
|
|
11
|
-
{
|
|
12
|
-
"ignoreAtRules": ["if", "else"]
|
|
13
|
-
}
|
|
14
|
-
],
|
|
15
|
-
"block-opening-brace-space-before": "always",
|
|
16
|
-
"block-opening-brace-space-after": "always-single-line",
|
|
17
|
-
"color-hex-case": null,
|
|
18
|
-
"color-hex-length": null,
|
|
19
|
-
"declaration-empty-line-before": null,
|
|
20
|
-
"declaration-block-single-line-max-declarations": 2,
|
|
21
|
-
"declaration-block-semicolon-newline-after": "always-multi-line",
|
|
22
|
-
"declaration-block-semicolon-space-after": "always-single-line",
|
|
23
|
-
"declaration-block-semicolon-space-before": "never",
|
|
24
|
-
"function-parentheses-space-inside": "never-single-line",
|
|
25
|
-
"function-max-empty-lines": 1,
|
|
26
|
-
"length-zero-no-unit": null,
|
|
27
|
-
"max-empty-lines": [
|
|
28
|
-
2,
|
|
29
|
-
{
|
|
30
|
-
"ignore": ["comments"]
|
|
31
|
-
}
|
|
32
|
-
],
|
|
33
|
-
"no-duplicate-selectors": null,
|
|
34
|
-
"no-invalid-position-at-import-rule": null,
|
|
35
|
-
"rule-empty-line-before": [
|
|
36
|
-
"always-multi-line",
|
|
37
|
-
{
|
|
38
|
-
"except": ["after-single-line-comment", "first-nested"],
|
|
39
|
-
"ignore": ["after-comment", "first-nested"]
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
"selector-list-comma-newline-after": "always-multi-line",
|
|
43
|
-
"selector-pseudo-element-colon-notation": "double",
|
|
44
|
-
"value-list-max-empty-lines": 1,
|
|
45
|
-
|
|
46
|
-
"scss/at-rule-no-unknown": true,
|
|
47
|
-
"scss/at-else-closing-brace-newline-after": "always-last-in-chain",
|
|
48
|
-
"scss/at-else-if-parentheses-space-before": "always",
|
|
49
|
-
"scss/no-duplicate-dollar-variables": [
|
|
50
|
-
true,
|
|
51
|
-
{
|
|
52
|
-
"ignoreInsideAtRules": ["if", "else", "mixin", "function", "while"]
|
|
53
|
-
}
|
|
54
|
-
],
|
|
55
|
-
"scss/at-function-parentheses-space-before": "never",
|
|
56
|
-
"scss/at-if-closing-brace-newline-after": "always-last-in-chain",
|
|
57
|
-
"scss/at-mixin-argumentless-call-parentheses": "always",
|
|
58
|
-
"scss/at-mixin-parentheses-space-before": "never",
|
|
59
|
-
"scss/dollar-variable-colon-space-after": "at-least-one-space",
|
|
60
|
-
"scss/dollar-variable-colon-newline-after": "always-multi-line",
|
|
61
|
-
"scss/dollar-variable-no-missing-interpolation": true,
|
|
62
|
-
"scss/double-slash-comment-whitespace-inside": "always",
|
|
63
|
-
"scss/declaration-nested-properties-no-divided-groups": true,
|
|
64
|
-
"scss/operator-no-unspaced": true,
|
|
65
|
-
"scss/selector-no-redundant-nesting-selector": true,
|
|
66
|
-
"selector-class-pattern": "^[a-zA-Z-_]+$"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const babelJest = require("babel-jest");
|
|
4
|
-
|
|
5
|
-
const hasJsxRuntime = (() => {
|
|
6
|
-
if (process.env.DISABLE_NEW_JSX_TRANSFORM === "true") {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
try {
|
|
11
|
-
require.resolve("react/jsx-runtime");
|
|
12
|
-
return true;
|
|
13
|
-
} catch (e) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
})();
|
|
17
|
-
|
|
18
|
-
module.exports = babelJest.default.createTransformer({
|
|
19
|
-
presets: [
|
|
20
|
-
[
|
|
21
|
-
require.resolve("babel-preset-react-app"),
|
|
22
|
-
{
|
|
23
|
-
runtime: hasJsxRuntime ? "automatic" : "classic",
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
],
|
|
27
|
-
babelrc: false,
|
|
28
|
-
configFile: false,
|
|
29
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
// This is a custom Jest transformer turning style imports into empty objects.
|
|
4
|
-
// http://facebook.github.io/jest/docs/en/webpack.html
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
process() {
|
|
8
|
-
return "module.exports = {};";
|
|
9
|
-
},
|
|
10
|
-
getCacheKey() {
|
|
11
|
-
// The output is always the same.
|
|
12
|
-
return "cssTransform";
|
|
13
|
-
},
|
|
14
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const path = require("path");
|
|
4
|
-
const lodash = require("lodash");
|
|
5
|
-
|
|
6
|
-
// This is a custom Jest transformer turning file imports into filenames.
|
|
7
|
-
// http://facebook.github.io/jest/docs/en/webpack.html
|
|
8
|
-
|
|
9
|
-
module.exports = {
|
|
10
|
-
process(src, filename) {
|
|
11
|
-
const assetFilename = JSON.stringify(path.basename(filename));
|
|
12
|
-
|
|
13
|
-
if (filename.match(/\.svg$/)) {
|
|
14
|
-
// Based on how SVGR generates a component name:
|
|
15
|
-
// https://github.com/smooth-code/svgr/blob/01b194cf967347d43d4cbe6b434404731b87cf27/packages/core/src/state.js#L6
|
|
16
|
-
const pascalCaseFilename = lodash.upperFirst(lodash.camelCase(path.parse(filename).name));
|
|
17
|
-
const componentName = `Svg${pascalCaseFilename}`;
|
|
18
|
-
return `const React = require('react');
|
|
19
|
-
module.exports = {
|
|
20
|
-
__esModule: true,
|
|
21
|
-
default: ${assetFilename},
|
|
22
|
-
ReactComponent: React.forwardRef(function ${componentName}(props, ref) {
|
|
23
|
-
return {
|
|
24
|
-
$$typeof: Symbol.for('react.element'),
|
|
25
|
-
type: 'svg',
|
|
26
|
-
ref: ref,
|
|
27
|
-
key: null,
|
|
28
|
-
props: Object.assign({}, props, {
|
|
29
|
-
children: ${assetFilename}
|
|
30
|
-
})
|
|
31
|
-
};
|
|
32
|
-
}),
|
|
33
|
-
};`;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return `module.exports = ${assetFilename};`;
|
|
37
|
-
},
|
|
38
|
-
};
|
package/config/jest/setup.js
DELETED
package/empty.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/jest.config.cjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
roots: ["<rootDir>/src"],
|
|
3
|
-
collectCoverageFrom: ["src/**/*.{js,jsx,ts,tsx}", "!src/**/*.d.ts"],
|
|
4
|
-
setupFiles: ["react-app-polyfill/jsdom"],
|
|
5
|
-
setupFilesAfterEnv: ["jest-expect-message"],
|
|
6
|
-
testMatch: ["<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"],
|
|
7
|
-
testEnvironment: "jsdom",
|
|
8
|
-
transform: {
|
|
9
|
-
"^.+\\.(js|jsx|mjs|cjs|ts|tsx)$": "<rootDir>/config/jest/babelTransform.cjs",
|
|
10
|
-
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.cjs",
|
|
11
|
-
"^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)": "<rootDir>/config/jest/fileTransform.cjs",
|
|
12
|
-
},
|
|
13
|
-
transformIgnorePatterns: ["node_modules/(?!(ol|@geoblocks/ol-maplibre-layer|geotiff|quick-lru)|lodash-es|lodash|escape-string-regexp|matcher/)"],
|
|
14
|
-
moduleNameMapper: {
|
|
15
|
-
"^@components/(.*)$": "<rootDir>/src/components/$1",
|
|
16
|
-
},
|
|
17
|
-
resetMocks: true,
|
|
18
|
-
coverageReporters: ["text", "cobertura"],
|
|
19
|
-
};
|
package/rollup.config.cjs
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
const copy = require("rollup-plugin-copy");
|
|
2
|
-
|
|
3
|
-
const outputDir = "dist";
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
input: "./empty.js",
|
|
7
|
-
plugins: [
|
|
8
|
-
copy({
|
|
9
|
-
targets: [
|
|
10
|
-
{
|
|
11
|
-
src: ["src/modal/*", "!**/*.test.ts*"],
|
|
12
|
-
dest: outputDir,
|
|
13
|
-
expandDirectories: true,
|
|
14
|
-
onlyFiles: true,
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
src: ["src/panel/*", "!**/*.test.ts*"],
|
|
18
|
-
dest: outputDir,
|
|
19
|
-
expandDirectories: true,
|
|
20
|
-
onlyFiles: true,
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
src: ["src/util/*", "!**/*.test.ts*"],
|
|
24
|
-
dest: outputDir,
|
|
25
|
-
expandDirectories: true,
|
|
26
|
-
onlyFiles: true,
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
src: ["src/index.ts"],
|
|
30
|
-
dest: outputDir,
|
|
31
|
-
onlyFiles: true,
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
flatten: false,
|
|
35
|
-
}),
|
|
36
|
-
],
|
|
37
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { makePopoutId } from "./generateId";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The only valid characters for an @emotion key are lower case chars or '-'.
|
|
5
|
-
* We need to replace any char that is not valid with a substitute.
|
|
6
|
-
*/
|
|
7
|
-
test("makePopoutId", () => {
|
|
8
|
-
expect(makePopoutId("Hello-59.!---&$*(--")).toBe("hello-five-nine-");
|
|
9
|
-
});
|
package/src/setupTests.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# @linzjs/windows
|
|
2
|
-
|
|
3
|
-
[](https://github.com/semantic-release/semantic-release)
|
|
4
|
-
|
|
5
|
-
> Reusable promise based windowing component for LINZ / Toitū te whenua.
|
|
6
|
-
|
|
7
|
-
Rect state based modals/windows are painful because they require:
|
|
8
|
-
- shared states for open/closed.
|
|
9
|
-
- callbacks/states for return values.
|
|
10
|
-
- inline modal/window includes, which prevent you from closing the invoking component before the modal/window has
|
|
11
|
-
completed.
|
|
12
|
-
|
|
13
|
-
This module gives you promise based modals/windows which don't require all the state
|
|
14
|
-
based boiler-plate / inline-components.
|
|
15
|
-
|
|
16
|
-
## Features
|
|
17
|
-
- Async HTML dialog based Modals.
|
|
18
|
-
- Draggable and resizeable, pop-in/out Windows.
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {getBlocks, blockToString} from "../support.js";
|
|
2
|
-
import {Meta, Source, Story} from "@storybook/blocks";
|
|
3
|
-
import * as ModalStories from "./Modal.stories"
|
|
4
|
-
|
|
5
|
-
import myModule from './TestModal?raw';
|
|
6
|
-
|
|
7
|
-
<Meta name="Show" of={ModalStories}/>
|
|
8
|
-
# Show Modal
|
|
9
|
-
## Example
|
|
10
|
-
Click to show the modal:
|
|
11
|
-
<Story of={ModalStories.ShowModal}/>
|
|
12
|
-
|
|
13
|
-
## Code
|
|
14
|
-
<br/>
|
|
15
|
-
{getBlocks(myModule).map((block) => (
|
|
16
|
-
<>
|
|
17
|
-
<h3>{block.split("\n")[0]}</h3>
|
|
18
|
-
<Source code={blockToString(block)} language="typescript" />
|
|
19
|
-
</>
|
|
20
|
-
))}
|
|
21
|
-
|
|
22
|
-
### Example: Mocking Modal response
|
|
23
|
-
|
|
24
|
-
<Source code={"{ /* Responds with the value 1 */ }\n<ModalContext.Provider value={showModal: async() => 1}>\n" +
|
|
25
|
-
"... Component under test ...\n" +
|
|
26
|
-
"</ModalContext.Provider>\n"} language="typescript"/>
|