diff --git a/.github/cla/signatures.json b/.github/cla/signatures.json index 8b90a150f6..67d475a7a3 100644 --- a/.github/cla/signatures.json +++ b/.github/cla/signatures.json @@ -15,6 +15,22 @@ "created_at": "2021-04-14T16:20:04Z", "repoId": 190729906, "pullRequestNo": 1383 + }, + { + "name": "aptkingston", + "id": 9075550, + "comment_id": 830252031, + "created_at": "2021-04-30T17:37:37Z", + "repoId": 190729906, + "pullRequestNo": 1431 + }, + { + "name": "kevmodrome", + "id": 534488, + "comment_id": 830545461, + "created_at": "2021-05-01T05:27:53Z", + "repoId": 190729906, + "pullRequestNo": 1431 } ] } \ No newline at end of file diff --git a/.prettierrc b/.prettierrc index e23b0be753..eda2e6131b 100644 --- a/.prettierrc +++ b/.prettierrc @@ -3,6 +3,8 @@ "semi": false, "singleQuote": false, "trailingComma": "es5", + "arrowParens": "avoid", + "jsxBracketSameLine": false, "plugins": ["prettier-plugin-svelte"], - "svelteSortOrder" : "scripts-markup-styles" + "svelteSortOrder" : "options-scripts-markup-styles" } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 53fbb0d221..d471924fe0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,11 +1,7 @@ { "editor.formatOnSave": true, - "eslint.format.enable": true, "editor.codeActionsOnSave": { "source.fixAll": true }, - "[svelte]": { - "editor.defaultFormatter": "JamesBirtles.svelte-vscode" - }, - "editor.defaultFormatter": "esbenp.prettier-vscode" + "editor.defaultFormatter": "svelte.svelte-vscode" } diff --git a/package.json b/package.json index a4b0993fde..171f9510f3 100644 --- a/package.json +++ b/package.json @@ -10,11 +10,11 @@ "eslint-plugin-svelte3": "^2.7.3", "kill-port": "^1.6.1", "lerna": "3.14.1", - "prettier": "^1.19.1", - "prettier-plugin-svelte": "^1.4.0", + "prettier": "^2.2.1", + "prettier-plugin-svelte": "^2.2.0", "rimraf": "^3.0.2", "rollup-plugin-replace": "^2.2.0", - "svelte": "^3.30.0" + "svelte": "^3.37.0" }, "scripts": { "bootstrap": "lerna link && lerna bootstrap", @@ -38,5 +38,12 @@ "test:e2e:ci": "lerna run cy:ci", "build:docker": "cd hosting/scripts/linux/ && ./release-to-docker-hub.sh && cd -", "build:docker:staging": "cd hosting/scripts/linux/ && ./release-to-docker-hub.sh staging && cd -" + }, + "dependencies": { + "@spectrum-css/actionbutton": "^1.0.1", + "@spectrum-css/actiongroup": "^1.0.1", + "@spectrum-css/link": "^3.1.1", + "@spectrum-css/menu": "^3.0.1", + "@spectrum-css/toast": "^3.0.1" } } diff --git a/packages/auth/src/db/utils.js b/packages/auth/src/db/utils.js index 393e03e492..105e038907 100644 --- a/packages/auth/src/db/utils.js +++ b/packages/auth/src/db/utils.js @@ -123,7 +123,7 @@ const getConfigParams = ({ type, group, user }, otherProps = {}) => { * @param {Object} scopes - the type, group and userID scopes of the configuration. * @returns The most granular configuration document based on the scope. */ -const determineScopedConfig = async function(db, { type, user, group }) { +const determineScopedConfig = async function (db, { type, user, group }) { const response = await db.allDocs( getConfigParams( { type, user, group }, diff --git a/packages/auth/src/hashing.js b/packages/auth/src/hashing.js index 65976fc1f3..7f3af2855f 100644 --- a/packages/auth/src/hashing.js +++ b/packages/auth/src/hashing.js @@ -13,6 +13,6 @@ exports.compare = async (data, encrypted) => { return bcrypt.compare(data, encrypted) } -exports.newid = function() { +exports.newid = function () { return v4().replace(/-/g, "") } diff --git a/packages/auth/src/middleware/passport/google.js b/packages/auth/src/middleware/passport/google.js index 968dfa3e93..407772ebf0 100644 --- a/packages/auth/src/middleware/passport/google.js +++ b/packages/auth/src/middleware/passport/google.js @@ -51,7 +51,7 @@ async function authenticate(token, tokenSecret, profile, done) { * from couchDB rather than environment variables, using this factory is necessary for dynamically configuring passport. * @returns Dynamically configured Passport Google Strategy */ -exports.strategyFactory = async function(config) { +exports.strategyFactory = async function (config) { try { const { clientID, clientSecret, callbackURL } = config diff --git a/packages/auth/src/middleware/passport/jwt.js b/packages/auth/src/middleware/passport/jwt.js index fdff3f3cfc..ed7d179482 100644 --- a/packages/auth/src/middleware/passport/jwt.js +++ b/packages/auth/src/middleware/passport/jwt.js @@ -3,12 +3,12 @@ const env = require("../../environment") exports.options = { secretOrKey: env.JWT_SECRET, - jwtFromRequest: function(ctx) { + jwtFromRequest: function (ctx) { return ctx.cookies.get(Cookies.Auth) }, } -exports.authenticate = async function(jwt, done) { +exports.authenticate = async function (jwt, done) { try { return done(null, jwt) } catch (err) { diff --git a/packages/auth/src/middleware/passport/local.js b/packages/auth/src/middleware/passport/local.js index 5b8bf307d7..0f5cb82606 100644 --- a/packages/auth/src/middleware/passport/local.js +++ b/packages/auth/src/middleware/passport/local.js @@ -15,7 +15,7 @@ exports.options = {} * @param {*} done - callback from passport to return user information and errors * @returns The authenticated user, or errors if they occur */ -exports.authenticate = async function(email, password, done) { +exports.authenticate = async function (email, password, done) { if (!email) return done(null, false, "Email Required.") if (!password) return done(null, false, "Password Required.") diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 7d34c5c6d7..573e115377 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -2,6 +2,7 @@ "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", "version": "1.58.13", + "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", "exports": { @@ -9,31 +10,24 @@ "import": "./dist/bbui.es.js" }, "./package.json": "./package.json", - "./dist/style.css": "./dist/style.css" + "./spectrum-icons-rollup.js": "./src/spectrum-icons-rollup.js", + "./spectrum-icons-vite.js": "./src/spectrum-icons-vite.js" }, "scripts": { - "dev:builder": "vite build", - "build": "vite build" + "build": "rollup -c" }, "devDependencies": { "@rollup/plugin-commonjs": "^16.0.0", "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^11.0.0", - "@sveltejs/vite-plugin-svelte": "^1.0.0-next.5", + "@rollup/plugin-node-resolve": "^11.2.1", "cross-env": "^7.0.2", "nollup": "^0.14.1", "postcss": "^8.2.9", - "rollup": "^2.34.0", - "rollup-plugin-copy": "^3.3.0", - "rollup-plugin-delete": "^1.2.0", - "rollup-plugin-hot": "^0.1.1", - "rollup-plugin-node-builtins": "^2.1.2", + "rollup": "^2.45.2", "rollup-plugin-postcss": "^4.0.0", - "rollup-plugin-svelte-hot": "^0.11.0", - "semantic-release": "^17.0.8", - "svelte": "^3.29.0", - "svench": "^0.0.10-7", - "vite": "^2.1.5" + "rollup-plugin-svelte": "^7.1.0", + "rollup-plugin-terser": "^7.0.2", + "svelte": "^3.37.0" }, "keywords": [ "svelte" @@ -43,11 +37,44 @@ "dist" ], "dependencies": { - "markdown-it": "^12.0.4", - "quill": "^1.3.7", - "sirv-cli": "^0.4.6", - "svelte-flatpickr": "^2.4.0", - "svelte-portal": "^1.0.0", - "turndown": "^7.0.0" + "@adobe/spectrum-css-workflow-icons": "^1.2.1", + "@spectrum-css/actionbutton": "^1.0.1", + "@spectrum-css/actiongroup": "^1.0.1", + "@spectrum-css/avatar": "^3.0.2", + "@spectrum-css/button": "^3.0.1", + "@spectrum-css/buttongroup": "^3.0.2", + "@spectrum-css/checkbox": "^3.0.2", + "@spectrum-css/dialog": "^3.0.1", + "@spectrum-css/divider": "^1.0.1", + "@spectrum-css/dropzone": "^3.0.2", + "@spectrum-css/fieldgroup": "^3.0.2", + "@spectrum-css/fieldlabel": "^3.0.1", + "@spectrum-css/icon": "^3.0.1", + "@spectrum-css/illustratedmessage": "^3.0.2", + "@spectrum-css/inputgroup": "^3.0.2", + "@spectrum-css/label": "^2.0.9", + "@spectrum-css/link": "^3.1.1", + "@spectrum-css/menu": "^3.0.1", + "@spectrum-css/modal": "^3.0.1", + "@spectrum-css/picker": "^1.0.1", + "@spectrum-css/popover": "^3.0.1", + "@spectrum-css/progressbar": "^1.0.2", + "@spectrum-css/progresscircle": "^1.0.2", + "@spectrum-css/radio": "^3.0.2", + "@spectrum-css/search": "^3.0.2", + "@spectrum-css/sidenav": "^3.0.2", + "@spectrum-css/switch": "^1.0.2", + "@spectrum-css/table": "^3.0.1", + "@spectrum-css/tabs": "^3.0.1", + "@spectrum-css/tags": "^3.0.2", + "@spectrum-css/textfield": "^3.0.1", + "@spectrum-css/toast": "^3.0.1", + "@spectrum-css/treeview": "^3.0.2", + "@spectrum-css/typography": "^3.0.1", + "@spectrum-css/underlay": "^2.0.9", + "@spectrum-css/vars": "^3.0.1", + "dayjs": "^1.10.4", + "svelte-flatpickr": "^3.1.0", + "svelte-portal": "^1.0.0" } } diff --git a/packages/bbui/rollup.config.js b/packages/bbui/rollup.config.js index 92b316cbe1..e285d548d6 100644 --- a/packages/bbui/rollup.config.js +++ b/packages/bbui/rollup.config.js @@ -1,140 +1,25 @@ -import * as path from "path" -import svelte from "rollup-plugin-svelte-hot" +import svelte from "rollup-plugin-svelte" import resolve from "@rollup/plugin-node-resolve" import commonjs from "@rollup/plugin-commonjs" import json from "@rollup/plugin-json" -import copy from "rollup-plugin-copy" -import hmr from "rollup-plugin-hot" -import del from "rollup-plugin-delete" +import { terser } from "rollup-plugin-terser" import postcss from "rollup-plugin-postcss" -import { plugin as Svench } from "svench/rollup" -import builtins from "rollup-plugin-node-builtins" -const WATCH = !!process.env.ROLLUP_WATCH -const SVENCH = !!process.env.SVENCH -const HOT = WATCH -const PRODUCTION = !WATCH - -const svench = Svench({ - // The root dir that Svench will parse and watch. - // - // NOTE Watching the root of the project, to let Svench render *.md for us. - // - // NOTE By default, `node_modules` and `.git` dirs are ignored. This can be - // customized by passing a function to `ignore` option. Default ignore is: - // - // ignore: path => /(?:^|\/)(?:node_modules|\.git)\//.test(path), - // - dir: ".", - - // Make `src` dir a section (that is, it will always be "expanded" in the - // menu). - autoSections: ["src"], - - // Use custom index.html - index: { - source: "public/index.html", +export default { + input: "src/index.js", + output: { + sourcemap: true, + format: "esm", + file: "dist/bbui.es.js", }, - - extensions: [".svench", ".svench.svelte", ".svench.svx", ".md"], - - serve: WATCH && { - host: "0.0.0.0", - port: 4242, - public: "public", - nollup: "0.0.0.0:42421", - }, -}) - -// NOTE configs are in function form to avoid instantiating plugins of the -// config that is not used for nothing (in particular, the HMR plugin launches -// a dev server on startup, this is not desired when just building for prod) -const configs = { - svench: () => ({ - input: ".svench/svench.js", - output: { - format: "es", - dir: "public/svench", - }, - plugins: [ - builtins(), - - // NOTE cleaning old builds is required to avoid serving stale static - // files from a previous build instead of in-memory files from the dev/hmr - // server - del({ - targets: "public/svench/*", - runOnce: true, - }), - - postcss({ - hot: HOT, - extract: path.resolve("public/svench/theme.css"), - sourceMap: true, - }), - - svench, - - svelte({ - dev: !PRODUCTION, - extensions: [".svelte", ".svench", ".svx", ".md"], - // Svench's "combined" preprocessor wraps both Mdsvex preprocessors - // (configured for Svench), and its own preprocessor (for static - // analysis -- eg extract source from views) - preprocess: svench.$.preprocess, - hot: HOT && { - optimistic: true, - noPreserveState: false, - }, - }), - - resolve({ browser: true }), - - commonjs(), - json(), - - HOT && - hmr({ - host: "0.0.0.0", - public: "public", - inMemory: true, - compatModuleHot: !HOT, // for terser - }), - ], - - watch: { - clearScreen: false, - // buildDelay is needed to ensure Svench's code (routes) generator will - // pick file changes before Rollup and prevent a double build (if Rollup - // first sees a change to src/Foo.svench, then to Svench's routes.js) - buildDelay: 100, - }, - }), - - lib: () => ({ - input: "src/index.js", - output: [{ file: "dist/bundle.mjs", format: "es" }], - plugins: [ - svelte({ - dev: !PRODUCTION, - extensions: [".svelte"], - emitCss: true, - }), - postcss(), - copy({ - targets: [ - { - src: ".svench/svench.css", - dest: "public", - rename: "global.css", - }, - ], - }), - resolve(), - commonjs(), - json(), - ], - }), + plugins: [ + resolve(), + commonjs(), + svelte({ + emitCss: true, + }), + postcss(), + terser(), + json(), + ], } - -export default configs[SVENCH ? "svench" : "lib"]() diff --git a/packages/bbui/src/ActionButton/ActionButton.svelte b/packages/bbui/src/ActionButton/ActionButton.svelte new file mode 100644 index 0000000000..4bb592aa26 --- /dev/null +++ b/packages/bbui/src/ActionButton/ActionButton.svelte @@ -0,0 +1,69 @@ + + + diff --git a/packages/bbui/src/ActionGroup/ActionGroup.svelte b/packages/bbui/src/ActionGroup/ActionGroup.svelte new file mode 100644 index 0000000000..43d8cd8de5 --- /dev/null +++ b/packages/bbui/src/ActionGroup/ActionGroup.svelte @@ -0,0 +1,26 @@ + + +
+ +
diff --git a/packages/bbui/src/ActionMenu/ActionMenu.svelte b/packages/bbui/src/ActionMenu/ActionMenu.svelte new file mode 100644 index 0000000000..6947e69a7e --- /dev/null +++ b/packages/bbui/src/ActionMenu/ActionMenu.svelte @@ -0,0 +1,38 @@ + + +
+ +
+ + + + + diff --git a/packages/bbui/src/Actions/click_outside.js b/packages/bbui/src/Actions/click_outside.js index 9257af5f5b..49a15d36a3 100644 --- a/packages/bbui/src/Actions/click_outside.js +++ b/packages/bbui/src/Actions/click_outside.js @@ -5,14 +5,14 @@ export default function clickOutside(element, callbackFunction) { } } - document.body.addEventListener("click", onClick, true) + document.body.addEventListener("mousedown", onClick, true) return { update(newCallbackFunction) { callbackFunction = newCallbackFunction }, destroy() { - document.body.removeEventListener("click", onClick, true) + document.body.removeEventListener("mousedown", onClick, true) }, } } diff --git a/packages/bbui/src/Actions/position_dropdown.js b/packages/bbui/src/Actions/position_dropdown.js index 9bf5a40a67..a25cc1bbd5 100644 --- a/packages/bbui/src/Actions/position_dropdown.js +++ b/packages/bbui/src/Actions/position_dropdown.js @@ -18,10 +18,10 @@ export default function positionDropdown(element, { anchor, align }) { if (spaceAbove > spaceBelow) { positionSide = "bottom" maxHeight = spaceAbove - 20 - y = window.innerHeight - spaceAbove + y = window.innerHeight - spaceAbove + 5 } else { positionSide = "top" - y = bottom + y = bottom + 5 maxHeight = spaceBelow - 20 } diff --git a/packages/bbui/src/Avatar/Avatar.svelte b/packages/bbui/src/Avatar/Avatar.svelte new file mode 100644 index 0000000000..d2aef72446 --- /dev/null +++ b/packages/bbui/src/Avatar/Avatar.svelte @@ -0,0 +1,12 @@ + + +Avatar diff --git a/packages/bbui/src/Button/Button.svelte b/packages/bbui/src/Button/Button.svelte index 5e403287e1..da4d405f02 100644 --- a/packages/bbui/src/Button/Button.svelte +++ b/packages/bbui/src/Button/Button.svelte @@ -1,212 +1,52 @@ -{#if href} - - - -{:else} - -{/if} + diff --git a/packages/bbui/src/Button/Close.svelte b/packages/bbui/src/Button/Close.svelte deleted file mode 100644 index f2b76cdb38..0000000000 --- a/packages/bbui/src/Button/Close.svelte +++ /dev/null @@ -1,59 +0,0 @@ - - - - - diff --git a/packages/bbui/src/Button/Close.svench b/packages/bbui/src/Button/Close.svench deleted file mode 100644 index 5bb7542b11..0000000000 --- a/packages/bbui/src/Button/Close.svench +++ /dev/null @@ -1,36 +0,0 @@ - - - - - -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
diff --git a/packages/bbui/src/Button/TextButton.svelte b/packages/bbui/src/Button/TextButton.svelte deleted file mode 100644 index 351a2c45bf..0000000000 --- a/packages/bbui/src/Button/TextButton.svelte +++ /dev/null @@ -1,128 +0,0 @@ - - -{#if href} - -{:else} - -{/if} - - diff --git a/packages/bbui/src/Button/TextButton.svench b/packages/bbui/src/Button/TextButton.svench deleted file mode 100644 index e3c3477805..0000000000 --- a/packages/bbui/src/Button/TextButton.svench +++ /dev/null @@ -1,69 +0,0 @@ - - - - - -
- alert('Clicked!')}> - - Add View - - alert('Clicked!')}> - - Add Column - - alert('Clicked!')}> - - Add Row - - alert('Clicked!')}> - - Disabled Text Button - - alert('Clicked!')}> - - Active Calculation - -
-
- - -
- alert('Clicked!')}> - - Add View - - alert('Clicked!')}> - - Add Column - - alert('Clicked!')}> - - Add Row - - alert('Clicked!')}> - - Delete - - alert('Clicked!')}> - - Calculate - -
-
- - -
- This is a link -
-
diff --git a/packages/bbui/src/ButtonGroup/ButtonGroup.svelte b/packages/bbui/src/ButtonGroup/ButtonGroup.svelte new file mode 100644 index 0000000000..b845a770e1 --- /dev/null +++ b/packages/bbui/src/ButtonGroup/ButtonGroup.svelte @@ -0,0 +1,19 @@ + + +
+ +
diff --git a/packages/bbui/src/ClearButton/ClearButton.svelte b/packages/bbui/src/ClearButton/ClearButton.svelte new file mode 100644 index 0000000000..5a2f6bc04c --- /dev/null +++ b/packages/bbui/src/ClearButton/ClearButton.svelte @@ -0,0 +1,19 @@ + + + diff --git a/packages/bbui/src/DatePicker/DatePicker.svelte b/packages/bbui/src/DatePicker/DatePicker.svelte deleted file mode 100644 index 2f87a48a43..0000000000 --- a/packages/bbui/src/DatePicker/DatePicker.svelte +++ /dev/null @@ -1,45 +0,0 @@ - - -
- {#if label} - - {/if} - -
- - diff --git a/packages/bbui/src/DatePicker/DatePicker.svench b/packages/bbui/src/DatePicker/DatePicker.svench deleted file mode 100644 index ed0d480a6f..0000000000 --- a/packages/bbui/src/DatePicker/DatePicker.svench +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/packages/bbui/src/List/Items/DetailSummary.svelte b/packages/bbui/src/DetailSummary/DetailSummary.svelte similarity index 84% rename from packages/bbui/src/List/Items/DetailSummary.svelte rename to packages/bbui/src/DetailSummary/DetailSummary.svelte index 8e3a08276a..1c39bc6aa7 100644 --- a/packages/bbui/src/List/Items/DetailSummary.svelte +++ b/packages/bbui/src/DetailSummary/DetailSummary.svelte @@ -1,4 +1,5 @@ + +
+ + diff --git a/packages/bbui/src/Drawer/Drawer.svelte b/packages/bbui/src/Drawer/Drawer.svelte index 2f0cc1b4f3..3658fdb7fe 100644 --- a/packages/bbui/src/Drawer/Drawer.svelte +++ b/packages/bbui/src/Drawer/Drawer.svelte @@ -1,7 +1,9 @@ - -{#if open} - - - -{/if} - - diff --git a/packages/bbui/src/DropdownMenu/DropdownMenu.svench b/packages/bbui/src/DropdownMenu/DropdownMenu.svench deleted file mode 100644 index af4e32db2e..0000000000 --- a/packages/bbui/src/DropdownMenu/DropdownMenu.svench +++ /dev/null @@ -1,161 +0,0 @@ - - - - - -
- -
- - - -
- - -
- -
- - - -
- - -
- -
- - - -
- -
- -
- - - -
- -
- -
- alert('Closed!')} - bind:this={dropdownLeft} - width="175px" - borderColor="#d1d1d1ff" - anchor={anchorLeft} - align="left"> - - -
\ No newline at end of file diff --git a/packages/bbui/src/Dropzone/Dropzone.svelte b/packages/bbui/src/Dropzone/Dropzone.svelte deleted file mode 100644 index 4f4f4bc7bf..0000000000 --- a/packages/bbui/src/Dropzone/Dropzone.svelte +++ /dev/null @@ -1,295 +0,0 @@ - - -
- {#if selectedImage} - - {/if} - - - -

Drop your files here

- -
- - diff --git a/packages/bbui/src/Dropzone/Dropzone.svench b/packages/bbui/src/Dropzone/Dropzone.svench deleted file mode 100644 index 110195ab5a..0000000000 --- a/packages/bbui/src/Dropzone/Dropzone.svench +++ /dev/null @@ -1,17 +0,0 @@ - - - - - diff --git a/packages/bbui/src/Dropzone/fileTypes.js b/packages/bbui/src/Dropzone/fileTypes.js deleted file mode 100644 index 1ebd85070b..0000000000 --- a/packages/bbui/src/Dropzone/fileTypes.js +++ /dev/null @@ -1,5 +0,0 @@ -export const FILE_TYPES = { - IMAGE: ["png", "tiff", "gif", "raw", "jpg", "jpeg", "svg"], - CODE: ["js", "rs", "py", "java", "rb", "hs", "yml"], - DOCUMENT: ["odf", "docx", "doc", "pdf", "csv"], -} diff --git a/packages/bbui/src/Form/Checkbox.svelte b/packages/bbui/src/Form/Checkbox.svelte index 21d5450123..1f3e439c2a 100644 --- a/packages/bbui/src/Form/Checkbox.svelte +++ b/packages/bbui/src/Form/Checkbox.svelte @@ -1,140 +1,22 @@ -
- -
-
-
-
-
- -
- - + + + diff --git a/packages/bbui/src/Form/Checkbox.svench.svx b/packages/bbui/src/Form/Checkbox.svench.svx deleted file mode 100644 index b3246ec9d2..0000000000 --- a/packages/bbui/src/Form/Checkbox.svench.svx +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - -## Multiple checkboxes -Use an array and an each block to use multiple checkboxes -```svelte - - -{#each menu as {text, checked}} - - - -{/each} -``` - - -
- {#each menu as {text, checked}} - - - - {/each} -
-
- - \ No newline at end of file diff --git a/packages/bbui/src/Form/Combobox.svelte b/packages/bbui/src/Form/Combobox.svelte new file mode 100644 index 0000000000..e08e609732 --- /dev/null +++ b/packages/bbui/src/Form/Combobox.svelte @@ -0,0 +1,40 @@ + + + + + diff --git a/packages/bbui/src/Form/Core/Checkbox.svelte b/packages/bbui/src/Form/Core/Checkbox.svelte new file mode 100644 index 0000000000..7d564d2a9d --- /dev/null +++ b/packages/bbui/src/Form/Core/Checkbox.svelte @@ -0,0 +1,47 @@ + + + diff --git a/packages/bbui/src/Form/Core/Combobox.svelte b/packages/bbui/src/Form/Core/Combobox.svelte new file mode 100644 index 0000000000..1bce8ba3c4 --- /dev/null +++ b/packages/bbui/src/Form/Core/Combobox.svelte @@ -0,0 +1,136 @@ + + +
+
+ (focus = true)} + on:blur={() => (focus = false)} + on:change={onChange} + {value} + {placeholder} + class="spectrum-Textfield-input spectrum-InputGroup-input" + /> +
+ + {#if open} +
(open = false)} /> +
+
    + {#if options && Array.isArray(options)} + {#each options as option} +
  • selectOption(getOptionValue(option))} + > + {getOptionLabel(option)} + +
  • + {/each} + {/if} +
+
+ {/if} +
+ + diff --git a/packages/bbui/src/Form/Core/DatePicker.svelte b/packages/bbui/src/Form/Core/DatePicker.svelte new file mode 100644 index 0000000000..f76e42a55a --- /dev/null +++ b/packages/bbui/src/Form/Core/DatePicker.svelte @@ -0,0 +1,149 @@ + + + +
+
+ {#if !!error} + + {/if} + +
+ +
+
+{#if open} +
+{/if} + + diff --git a/packages/bbui/src/Form/Core/Dropzone.svelte b/packages/bbui/src/Form/Core/Dropzone.svelte new file mode 100644 index 0000000000..9dd2cbbc73 --- /dev/null +++ b/packages/bbui/src/Form/Core/Dropzone.svelte @@ -0,0 +1,350 @@ + + +
+ {#if selectedImage} + + {/if} +
+
+ + + + + + + + + + + + + + + +

+ Drag and drop your file +

+ {#if !disabled} +

+ +
+ from your computer +

+ {/if} +
+
+
+ + diff --git a/packages/bbui/src/Form/Core/Multiselect.svelte b/packages/bbui/src/Form/Core/Multiselect.svelte new file mode 100644 index 0000000000..d659a63582 --- /dev/null +++ b/packages/bbui/src/Form/Core/Multiselect.svelte @@ -0,0 +1,82 @@ + + + diff --git a/packages/bbui/src/Form/Core/Picker.svelte b/packages/bbui/src/Form/Core/Picker.svelte new file mode 100644 index 0000000000..05fb196064 --- /dev/null +++ b/packages/bbui/src/Form/Core/Picker.svelte @@ -0,0 +1,132 @@ + + + +{#if open} +
(open = false)} + transition:fly={{ y: -20, duration: 200 }} + class="spectrum-Popover spectrum-Popover--bottom spectrum-Picker-popover is-open" + > +
    + {#if placeholderOption} +
  • onSelectOption(null)} + > + {placeholderOption} + +
  • + {/if} + {#if options && Array.isArray(options)} + {#each options as option, idx} +
  • onSelectOption(getOptionValue(option, idx))} + > + {getOptionLabel(option, idx)} + +
  • + {/each} + {/if} +
+
+{/if} + + diff --git a/packages/bbui/src/Form/Core/RadioGroup.svelte b/packages/bbui/src/Form/Core/RadioGroup.svelte new file mode 100644 index 0000000000..4ead9ed311 --- /dev/null +++ b/packages/bbui/src/Form/Core/RadioGroup.svelte @@ -0,0 +1,39 @@ + + +
+ {#if options && Array.isArray(options)} + {#each options as option} +
+ + + +
+ {/each} + {/if} +
diff --git a/packages/bbui/src/Form/Core/Search.svelte b/packages/bbui/src/Form/Core/Search.svelte new file mode 100644 index 0000000000..dbc8582ac3 --- /dev/null +++ b/packages/bbui/src/Form/Core/Search.svelte @@ -0,0 +1,87 @@ + + + + + diff --git a/packages/bbui/src/Form/Core/Select.svelte b/packages/bbui/src/Form/Core/Select.svelte new file mode 100644 index 0000000000..abc8610064 --- /dev/null +++ b/packages/bbui/src/Form/Core/Select.svelte @@ -0,0 +1,58 @@ + + + option === value} + onSelectOption={selectOption} +/> diff --git a/packages/bbui/src/Form/Core/Switch.svelte b/packages/bbui/src/Form/Core/Switch.svelte new file mode 100644 index 0000000000..a2f7e5ce01 --- /dev/null +++ b/packages/bbui/src/Form/Core/Switch.svelte @@ -0,0 +1,28 @@ + + +
+ + + +
diff --git a/packages/bbui/src/Form/Core/TextArea.svelte b/packages/bbui/src/Form/Core/TextArea.svelte new file mode 100644 index 0000000000..e4738b8e55 --- /dev/null +++ b/packages/bbui/src/Form/Core/TextArea.svelte @@ -0,0 +1,60 @@ + + +
+ {#if error} + + {/if} + + +
+ + diff --git a/packages/bbui/src/Form/Core/TextField.svelte b/packages/bbui/src/Form/Core/TextField.svelte new file mode 100644 index 0000000000..18b9a6fe8a --- /dev/null +++ b/packages/bbui/src/Form/Core/TextField.svelte @@ -0,0 +1,87 @@ + + +
+ {#if error} + + {/if} + +
+ + diff --git a/packages/bbui/src/Form/Core/index.js b/packages/bbui/src/Form/Core/index.js new file mode 100644 index 0000000000..a31c5941ec --- /dev/null +++ b/packages/bbui/src/Form/Core/index.js @@ -0,0 +1,11 @@ +export { default as CoreTextField } from "./TextField.svelte" +export { default as CoreSelect } from "./Select.svelte" +export { default as CoreMultiselect } from "./Multiselect.svelte" +export { default as CoreCheckbox } from "./Checkbox.svelte" +export { default as CoreRadioGroup } from "./RadioGroup.svelte" +export { default as CoreTextArea } from "./TextArea.svelte" +export { default as CoreCombobox } from "./Combobox.svelte" +export { default as CoreSwitch } from "./Switch.svelte" +export { default as CoreSearch } from "./Search.svelte" +export { default as CoreDatePicker } from "./DatePicker.svelte" +export { default as CoreDropzone } from "./Dropzone.svelte" diff --git a/packages/bbui/src/Form/DataList.svelte b/packages/bbui/src/Form/DataList.svelte deleted file mode 100644 index 6f5855d86a..0000000000 --- a/packages/bbui/src/Form/DataList.svelte +++ /dev/null @@ -1,158 +0,0 @@ - - -{#if label} - -{/if} -
- - - { - updateValue(e) - handleBlur(e) - }} - value={value || ''} - type="text" /> -
- -
-
- - diff --git a/packages/bbui/src/Form/DataList.svench b/packages/bbui/src/Form/DataList.svench deleted file mode 100644 index eea8294dea..0000000000 --- a/packages/bbui/src/Form/DataList.svench +++ /dev/null @@ -1,57 +0,0 @@ - - - - - {#each options as option} - - {/each} - - - - - - {#each options as option} - - {/each} - - - - - - {#each options as option} - - {/each} - - - - - - {#each options as option} - - {/each} - - - - - - {#each options as option} - - {/each} - - - - - - {#each options as option} - - {/each} - - - diff --git a/packages/bbui/src/Form/DatePicker.svelte b/packages/bbui/src/Form/DatePicker.svelte new file mode 100644 index 0000000000..e8dc4da9a7 --- /dev/null +++ b/packages/bbui/src/Form/DatePicker.svelte @@ -0,0 +1,30 @@ + + + + + diff --git a/packages/bbui/src/Form/Dropzone.svelte b/packages/bbui/src/Form/Dropzone.svelte new file mode 100644 index 0000000000..c8400ecc6a --- /dev/null +++ b/packages/bbui/src/Form/Dropzone.svelte @@ -0,0 +1,32 @@ + + + + + diff --git a/packages/bbui/src/Form/Field.svelte b/packages/bbui/src/Form/Field.svelte new file mode 100644 index 0000000000..5ecc7ba866 --- /dev/null +++ b/packages/bbui/src/Form/Field.svelte @@ -0,0 +1,42 @@ + + +
+ {#if label} + + {/if} +
+ + {#if error} +
{error}
+ {/if} +
+
+ + diff --git a/packages/bbui/src/Form/FieldLabel.svelte b/packages/bbui/src/Form/FieldLabel.svelte new file mode 100644 index 0000000000..b070df8cae --- /dev/null +++ b/packages/bbui/src/Form/FieldLabel.svelte @@ -0,0 +1,27 @@ + + + + + diff --git a/packages/bbui/src/Form/Input.svelte b/packages/bbui/src/Form/Input.svelte index e8afcffd36..a768f16681 100644 --- a/packages/bbui/src/Form/Input.svelte +++ b/packages/bbui/src/Form/Input.svelte @@ -1,190 +1,34 @@ -
- {#if label || edit} -
- {#if label} - - {/if} - {#if edit} -
- - -
- {/if} -
- {/if} - + - {#if error} -
{error}
- {/if} -
- - + on:change={onChange} + on:click + on:input + /> + diff --git a/packages/bbui/src/Form/Input.svench b/packages/bbui/src/Form/Input.svench deleted file mode 100644 index 1b95727a1a..0000000000 --- a/packages/bbui/src/Form/Input.svench +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/bbui/src/Form/Multiselect.svelte b/packages/bbui/src/Form/Multiselect.svelte index 924fd4b2b5..add60db2a4 100644 --- a/packages/bbui/src/Form/Multiselect.svelte +++ b/packages/bbui/src/Form/Multiselect.svelte @@ -1,324 +1,36 @@ -{#if label} - -{/if} -
-
-
- {#each selectedOptions as option} -
- {option.name} -
remove(option.value)}> - - - -
-
- {/each} - {#if !value || !value.length} - {#if placeholder && placeholder.length} -
{placeholder}
- {:else} -
 
- {/if} - {/if} -
-
- - - - {#if optionsVisible} - -
    showOptions(false)} - transition:fly={{ duration: 200, y: 5 }} - on:mousedown|preventDefault={handleOptionMousedown}> - {#each options as option} -
  • - {option.name} -
  • - {/each} - {#if !options.length} -
  • No results
  • - {/if} -
-
- {/if} -
- - + + + diff --git a/packages/bbui/src/Form/Multiselect.svench b/packages/bbui/src/Form/Multiselect.svench deleted file mode 100644 index 86ad0de529..0000000000 --- a/packages/bbui/src/Form/Multiselect.svench +++ /dev/null @@ -1,63 +0,0 @@ - - - - - {#each options as option} - - {/each} - - - - -
- - {#each options as option} - - {/each} - -
-
- - - - {#each options as option} - - {/each} - - - - - - {#each options as option} - - {/each} - - - - - - {#each options as option} - - {/each} - - - - - - {#each options as option} - - {/each} - - - - diff --git a/packages/bbui/src/Form/Radio.svelte b/packages/bbui/src/Form/Radio.svelte deleted file mode 100644 index b4a2637803..0000000000 --- a/packages/bbui/src/Form/Radio.svelte +++ /dev/null @@ -1,140 +0,0 @@ - - -
- -
-
-
-
-
- -
- - diff --git a/packages/bbui/src/Form/Radio.svench.svx b/packages/bbui/src/Form/Radio.svench.svx deleted file mode 100644 index 20d3c58c99..0000000000 --- a/packages/bbui/src/Form/Radio.svench.svx +++ /dev/null @@ -1,64 +0,0 @@ - - - ## Multiple checkboxes - Use an array and an each block to use the radio button. -```svelte - - -{#each menu as flavour} - -{/each} -``` - - - -
- {#each menu as flavour} - - - - {/each} -
-
- - -
- {#each menu as flavour} - - - - {/each} -
-
- - \ No newline at end of file diff --git a/packages/bbui/src/Form/RadioGroup.svelte b/packages/bbui/src/Form/RadioGroup.svelte new file mode 100644 index 0000000000..7b661d724e --- /dev/null +++ b/packages/bbui/src/Form/RadioGroup.svelte @@ -0,0 +1,38 @@ + + + + + diff --git a/packages/bbui/src/Form/RichText.svelte b/packages/bbui/src/Form/RichText.svelte deleted file mode 100644 index ab4b9c3d99..0000000000 --- a/packages/bbui/src/Form/RichText.svelte +++ /dev/null @@ -1,59 +0,0 @@ - - - - {#if mergedOptions.theme !== 'snow'} - - {/if} - - -
-
-
diff --git a/packages/bbui/src/Form/RichText.svench.svx b/packages/bbui/src/Form/RichText.svench.svx deleted file mode 100644 index 0a0a858866..0000000000 --- a/packages/bbui/src/Form/RichText.svench.svx +++ /dev/null @@ -1,40 +0,0 @@ - - -### Rich Text Component - -This component uses the QuillJS library to add Rich Text editing functionality. - -It exposes a content variable that you can bind to in order to get Markdown out of the component. - -As well as the content you can also pass in an option object that looks like so: - -```js -let options = { - modules: { - toolbar: [ - [{ header: [1, 2, 3, false] }], - ['bold', 'italic', 'underline', 'strike'] - ] - }, - placeholder: 'Type something...', - theme: 'snow' -} -``` - - - - - - - - - - - - diff --git a/packages/bbui/src/Form/Search.svelte b/packages/bbui/src/Form/Search.svelte new file mode 100644 index 0000000000..96a92a7c43 --- /dev/null +++ b/packages/bbui/src/Form/Search.svelte @@ -0,0 +1,28 @@ + + + + + diff --git a/packages/bbui/src/Form/Select.svelte b/packages/bbui/src/Form/Select.svelte index c245abd245..4b61ab3a33 100644 --- a/packages/bbui/src/Form/Select.svelte +++ b/packages/bbui/src/Form/Select.svelte @@ -1,95 +1,43 @@ -
- {#if label} - - {/if} -
- -
- -
-
-
- - + + - - {#each options as option} - - {/each} - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/bbui/src/Form/Slider.svelte b/packages/bbui/src/Form/Slider.svelte deleted file mode 100644 index c8a4c0122e..0000000000 --- a/packages/bbui/src/Form/Slider.svelte +++ /dev/null @@ -1,88 +0,0 @@ - - -
- {#if label} - - {/if} -
- {#if showRange && min != null}{min}{/if} - - {#if showRange && max != null}{max}{/if} -
-
- - diff --git a/packages/bbui/src/Form/Slider.svench b/packages/bbui/src/Form/Slider.svench deleted file mode 100644 index 7ed59f78b8..0000000000 --- a/packages/bbui/src/Form/Slider.svench +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/bbui/src/Form/TextArea.svelte b/packages/bbui/src/Form/TextArea.svelte index 1133a99127..12ee20190a 100644 --- a/packages/bbui/src/Form/TextArea.svelte +++ b/packages/bbui/src/Form/TextArea.svelte @@ -1,132 +1,30 @@ -
- {#if label || edit} -
- {#if label} - - {/if} - {#if edit} -
- - -
- {/if} -
- {/if} -