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..f98624812f 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ "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" @@ -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/index.js b/packages/auth/src/db/index.js index f94fe4afea..cca0a3ddba 100644 --- a/packages/auth/src/db/index.js +++ b/packages/auth/src/db/index.js @@ -1,9 +1,9 @@ let Pouch -module.exports.setDB = pouch => { +module.exports.setDB = (pouch) => { Pouch = pouch } -module.exports.getDB = dbName => { +module.exports.getDB = (dbName) => { return new Pouch(dbName) } diff --git a/packages/auth/src/db/utils.js b/packages/auth/src/db/utils.js index 393e03e492..de743a7764 100644 --- a/packages/auth/src/db/utils.js +++ b/packages/auth/src/db/utils.js @@ -48,7 +48,7 @@ exports.getGroupParams = (id = "", otherProps = {}) => { * Generates a new global user ID. * @returns {string} The new user ID which the user doc can be stored under. */ -exports.generateGlobalUserID = id => { +exports.generateGlobalUserID = (id) => { return `${DocumentTypes.USER}${SEPARATOR}${id || newid()}` } @@ -70,7 +70,7 @@ exports.getGlobalUserParams = (globalId, otherProps = {}) => { * Generates a template ID. * @param ownerId The owner/user of the template, this could be global or a group level. */ -exports.generateTemplateID = ownerId => { +exports.generateTemplateID = (ownerId) => { return `${DocumentTypes.TEMPLATE}${SEPARATOR}${ownerId}${newid()}` } @@ -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 }, @@ -132,7 +132,7 @@ const determineScopedConfig = async function(db, { type, user, group }) { } ) ) - const configs = response.rows.map(row => { + const configs = response.rows.map((row) => { const config = row.doc // Config is specific to a user and a group diff --git a/packages/auth/src/hashing.js b/packages/auth/src/hashing.js index 65976fc1f3..fe9b034c63 100644 --- a/packages/auth/src/hashing.js +++ b/packages/auth/src/hashing.js @@ -4,7 +4,7 @@ const { v4 } = require("uuid") const SALT_ROUNDS = env.SALT_ROUNDS || 10 -exports.hash = async data => { +exports.hash = async (data) => { const salt = await bcrypt.genSalt(SALT_ROUNDS) return bcrypt.hash(data, salt) } @@ -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/auth/src/utils.js b/packages/auth/src/utils.js index 10507410b1..beb1c33cf1 100644 --- a/packages/auth/src/utils.js +++ b/packages/auth/src/utils.js @@ -22,7 +22,7 @@ function confirmAppId(possibleAppId) { * @param {object} ctx The main request body to look through. * @returns {string|undefined} If an appId was found it will be returned. */ -exports.getAppId = ctx => { +exports.getAppId = (ctx) => { const options = [ctx.headers["x-budibase-app-id"], ctx.params.appId] if (ctx.subdomains) { options.push(ctx.subdomains[1]) @@ -41,7 +41,7 @@ exports.getAppId = ctx => { } let appPath = ctx.request.headers.referrer || - ctx.path.split("/").filter(subPath => subPath.startsWith(APP_PREFIX)) + ctx.path.split("/").filter((subPath) => subPath.startsWith(APP_PREFIX)) if (!appId && appPath.length !== 0) { appId = confirmAppId(appPath[0]) } @@ -101,11 +101,11 @@ exports.clearCookie = (ctx, name) => { * @param {object} ctx The koa context object to be tested. * @return {boolean} returns true if the call is from the client lib (a built app rather than the builder). */ -exports.isClient = ctx => { +exports.isClient = (ctx) => { return ctx.headers["x-budibase-type"] === "client" } -exports.getGlobalUserByEmail = async email => { +exports.getGlobalUserByEmail = async (email) => { const db = getDB(StaticDatabases.GLOBAL.name) try { let users = ( @@ -114,7 +114,7 @@ exports.getGlobalUserByEmail = async email => { include_docs: true, }) ).rows - users = users.map(user => user.doc) + users = users.map((user) => user.doc) return users.length <= 1 ? users[0] : users } catch (err) { if (err != null && err.name === "not_found") { 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..a4bfd29c83 --- /dev/null +++ b/packages/bbui/src/ActionButton/ActionButton.svelte @@ -0,0 +1,66 @@ + + + diff --git a/packages/bbui/src/ActionGroup/ActionGroup.svelte b/packages/bbui/src/ActionGroup/ActionGroup.svelte new file mode 100644 index 0000000000..514b473521 --- /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..776fc7f83e 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 } @@ -47,7 +47,7 @@ export default function positionDropdown(element, { anchor, align }) { element.style[positionSide] = `${dimensions[positionSide]}px` element.style.left = `${calcLeftPosition(dimensions).toFixed(0)}px` - const resizeObserver = new ResizeObserver(entries => { + const resizeObserver = new ResizeObserver((entries) => { entries.forEach(() => { dimensions = getDimensions() element.style[positionSide] = `${dimensions[positionSide]}px` 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..6e2b63adbd 100644 --- a/packages/bbui/src/Button/Button.svelte +++ b/packages/bbui/src/Button/Button.svelte @@ -1,212 +1,50 @@ -{#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..51055363a2 --- /dev/null +++ b/packages/bbui/src/ButtonGroup/ButtonGroup.svelte @@ -0,0 +1,15 @@ + + +
+ +
\ No newline at end of file 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..f786a54854 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..6b1e67a299 --- /dev/null +++ b/packages/bbui/src/Form/Combobox.svelte @@ -0,0 +1,39 @@ + + + + + diff --git a/packages/bbui/src/Form/Core/Checkbox.svelte b/packages/bbui/src/Form/Core/Checkbox.svelte new file mode 100644 index 0000000000..bc9b9a9fc7 --- /dev/null +++ b/packages/bbui/src/Form/Core/Checkbox.svelte @@ -0,0 +1,43 @@ + + + diff --git a/packages/bbui/src/Form/Core/Combobox.svelte b/packages/bbui/src/Form/Core/Combobox.svelte new file mode 100644 index 0000000000..4329467bb0 --- /dev/null +++ b/packages/bbui/src/Form/Core/Combobox.svelte @@ -0,0 +1,128 @@ + + +
+
+ (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..a3a2fefb38 --- /dev/null +++ b/packages/bbui/src/Form/Core/DatePicker.svelte @@ -0,0 +1,142 @@ + + + +
+
+ {#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..e6addd4e42 --- /dev/null +++ b/packages/bbui/src/Form/Core/Dropzone.svelte @@ -0,0 +1,334 @@ + + +
+ {#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..97420fabad --- /dev/null +++ b/packages/bbui/src/Form/Core/Multiselect.svelte @@ -0,0 +1,81 @@ + + + diff --git a/packages/bbui/src/Form/Core/Picker.svelte b/packages/bbui/src/Form/Core/Picker.svelte new file mode 100644 index 0000000000..2f5606dcf1 --- /dev/null +++ b/packages/bbui/src/Form/Core/Picker.svelte @@ -0,0 +1,123 @@ + + + +{#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..385e456a8e --- /dev/null +++ b/packages/bbui/src/Form/Core/RadioGroup.svelte @@ -0,0 +1,37 @@ + + +
+ {#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..6855799e86 --- /dev/null +++ b/packages/bbui/src/Form/Core/Search.svelte @@ -0,0 +1,82 @@ + + + + + diff --git a/packages/bbui/src/Form/Core/Select.svelte b/packages/bbui/src/Form/Core/Select.svelte new file mode 100644 index 0000000000..58e1ccca5a --- /dev/null +++ b/packages/bbui/src/Form/Core/Select.svelte @@ -0,0 +1,57 @@ + + + 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..520b8ebff1 --- /dev/null +++ b/packages/bbui/src/Form/Core/Switch.svelte @@ -0,0 +1,27 @@ + + +
+ + + +
diff --git a/packages/bbui/src/Form/Core/TextArea.svelte b/packages/bbui/src/Form/Core/TextArea.svelte new file mode 100644 index 0000000000..3903c37b28 --- /dev/null +++ b/packages/bbui/src/Form/Core/TextArea.svelte @@ -0,0 +1,55 @@ + + +
+ {#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..c470f755b0 --- /dev/null +++ b/packages/bbui/src/Form/Core/TextField.svelte @@ -0,0 +1,84 @@ + + +
+ {#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..1ac3b2bef0 --- /dev/null +++ b/packages/bbui/src/Form/DatePicker.svelte @@ -0,0 +1,29 @@ + + + + + diff --git a/packages/bbui/src/Form/Dropzone.svelte b/packages/bbui/src/Form/Dropzone.svelte new file mode 100644 index 0000000000..5886c58fa9 --- /dev/null +++ b/packages/bbui/src/Form/Dropzone.svelte @@ -0,0 +1,31 @@ + + + + + diff --git a/packages/bbui/src/Form/Field.svelte b/packages/bbui/src/Form/Field.svelte new file mode 100644 index 0000000000..5e4ca01f06 --- /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..c4219f5581 --- /dev/null +++ b/packages/bbui/src/Form/FieldLabel.svelte @@ -0,0 +1,26 @@ + + + + + diff --git a/packages/bbui/src/Form/Input.svelte b/packages/bbui/src/Form/Input.svelte index e8afcffd36..e4a155d342 100644 --- a/packages/bbui/src/Form/Input.svelte +++ b/packages/bbui/src/Form/Input.svelte @@ -1,190 +1,33 @@ -
- {#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..1615fac2b6 100644 --- a/packages/bbui/src/Form/Multiselect.svelte +++ b/packages/bbui/src/Form/Multiselect.svelte @@ -1,324 +1,35 @@ -{#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..61bc5f8552 --- /dev/null +++ b/packages/bbui/src/Form/RadioGroup.svelte @@ -0,0 +1,37 @@ + + + + + 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..e68a6a49fb --- /dev/null +++ b/packages/bbui/src/Form/Search.svelte @@ -0,0 +1,27 @@ + + + + + diff --git a/packages/bbui/src/Form/Select.svelte b/packages/bbui/src/Form/Select.svelte index c245abd245..0dd4a98102 100644 --- a/packages/bbui/src/Form/Select.svelte +++ b/packages/bbui/src/Form/Select.svelte @@ -1,95 +1,42 @@ -
- {#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..a11b87da0d 100644 --- a/packages/bbui/src/Form/TextArea.svelte +++ b/packages/bbui/src/Form/TextArea.svelte @@ -1,132 +1,29 @@ -
- {#if label || edit} -
- {#if label} - - {/if} - {#if edit} -
- - -
- {/if} -
- {/if} -