From 16f6c1e071f136620634f712c51509d292b80b64 Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Thu, 2 Feb 2023 11:03:06 +0100 Subject: [PATCH 1/6] maint(pat-switch): Remove demo related SASS styles, which are already included in the demo itself. --- _sass/_patterns.scss | 1 - src/pat/switch/_switch.scss | 9 --------- 2 files changed, 10 deletions(-) delete mode 100644 src/pat/switch/_switch.scss diff --git a/_sass/_patterns.scss b/_sass/_patterns.scss index 85438d2cc..a2347a6a1 100644 --- a/_sass/_patterns.scss +++ b/_sass/_patterns.scss @@ -36,7 +36,6 @@ @import "src/pat/notification/notification"; @import "src/pat/sortable/sortable"; @import "src/pat/stacks/stacks"; -@import "src/pat/switch/switch"; @import "src/pat/syntax-highlight/syntax-highlight"; @import "src/pat/toggle/toggle"; @import "src/pat/tooltip/tooltip"; diff --git a/src/pat/switch/_switch.scss b/src/pat/switch/_switch.scss deleted file mode 100644 index 7b4ee6af7..000000000 --- a/src/pat/switch/_switch.scss +++ /dev/null @@ -1,9 +0,0 @@ -li.mode-Red { - color: red !important; -} -li.mode-Green { - color: green; -} -li.mode-Blue { - color: blue; -} From 7cd76bf2bd1d3b4cc6e770b90f6cc4fca9ee5201 Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Thu, 2 Feb 2023 11:04:31 +0100 Subject: [PATCH 2/6] maint(pat-toggle): Remove demo related SASS styles and include it directly in the demo body. --- _sass/_patterns.scss | 1 - src/pat/toggle/_toggle.scss | 19 ------------------- src/pat/toggle/index.html | 5 ++--- 3 files changed, 2 insertions(+), 23 deletions(-) delete mode 100644 src/pat/toggle/_toggle.scss diff --git a/_sass/_patterns.scss b/_sass/_patterns.scss index a2347a6a1..ab5fd4a19 100644 --- a/_sass/_patterns.scss +++ b/_sass/_patterns.scss @@ -37,5 +37,4 @@ @import "src/pat/sortable/sortable"; @import "src/pat/stacks/stacks"; @import "src/pat/syntax-highlight/syntax-highlight"; -@import "src/pat/toggle/toggle"; @import "src/pat/tooltip/tooltip"; diff --git a/src/pat/toggle/_toggle.scss b/src/pat/toggle/_toggle.scss deleted file mode 100644 index 72df05555..000000000 --- a/src/pat/toggle/_toggle.scss +++ /dev/null @@ -1,19 +0,0 @@ -.green { - background-color: #23bf42; -} - -.blue { - background-color: #94bfdd; -} - -.red { - background-color: #cf6400; -} - -.blue, -.red, -.green { - display: inline-block; - padding: 5px 15px; - color: white; -} diff --git a/src/pat/toggle/index.html b/src/pat/toggle/index.html index 6c394b50e..04f43ba08 100644 --- a/src/pat/toggle/index.html +++ b/src/pat/toggle/index.html @@ -5,6 +5,8 @@ + + - -

Toggle a class

@@ -70,7 +70,6 @@

Toggle with checkboxes and pat-checklist

change - From 47214e97e479b5fe57253691f2ae17bce8efa216 Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Thu, 2 Feb 2023 11:05:25 +0100 Subject: [PATCH 3/6] feat(pat-collapsible): Include base styles in collapsible when window.__patternslib_import_styles is set to True. --- src/pat/collapsible/collapsible.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pat/collapsible/collapsible.js b/src/pat/collapsible/collapsible.js index 26b3c9583..85d6917a8 100644 --- a/src/pat/collapsible/collapsible.js +++ b/src/pat/collapsible/collapsible.js @@ -45,6 +45,10 @@ class Pattern extends BasePattern { }; init() { + if (window.__patternslib_import_styles) { + import("./_collapsible.scss"); + } + const $el = (this.$el = $(this.el)); let $content; From 33f5876487f16c7197d7b22ad1ae3b6be8ed3089 Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Thu, 2 Feb 2023 11:05:25 +0100 Subject: [PATCH 4/6] feat(pat-collapsible): Include base styles in collapsible when window.__patternslib_import_styles is set to True. --- src/pat/collapsible/_collapsible.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pat/collapsible/_collapsible.scss b/src/pat/collapsible/_collapsible.scss index 59ec25b58..1bd3a84e0 100644 --- a/src/pat/collapsible/_collapsible.scss +++ b/src/pat/collapsible/_collapsible.scss @@ -1,5 +1,5 @@ -@import "settings"; -@import "components/button"; +@import "../../../_sass/settings"; +@import "../../../_sass/components/button"; .pat-collapsible { margin-bottom: 0.5em; From 4d7f4aafe6e22b7d55374f037c92db06256e2ef5 Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Tue, 14 Feb 2023 16:48:45 +0100 Subject: [PATCH 5/6] feat(pat-sortable): Allow to configure the handle-selector. --- src/pat/sortable/sortable.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/pat/sortable/sortable.js b/src/pat/sortable/sortable.js index 2dc4c9c44..a3e24007c 100644 --- a/src/pat/sortable/sortable.js +++ b/src/pat/sortable/sortable.js @@ -6,6 +6,7 @@ import Parser from "../../core/parser"; export const parser = new Parser("sortable"); parser.addArgument("selector", "li"); +parser.addArgument("handle-selector", ".sortable-handle"); parser.addArgument("drag-class", "dragged"); // Class to apply to item that is being dragged. parser.addArgument("drop"); // Callback function for when item is dropped (null) @@ -52,21 +53,24 @@ export default Base.extend({ addHandles: function () { for (const sortable of this.$sortables) { - const handles = dom.querySelectorAllAndMe(sortable, ".sortable-handle"); + const handles = dom.querySelectorAllAndMe( + sortable, + this.options.handleSelector + ); if (handles.length === 0) { // TODO: we should change to a