Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e5a78b1571 | |||
| a4fc62ca5c | |||
| 97a7cabba3 | |||
| cfd23cd1a3 | |||
| 37762504a4 | |||
| 1354aac065 | |||
| d3f25a5ef1 | |||
| f7a343b626 | |||
| 162d55a8ce | |||
| 1bb1c297b3 | |||
| 3514094043 | |||
| b6cc236ced | |||
| f78b0a4c63 | |||
| 7bcb45d9bc | |||
| 05fbea8dfd | |||
| e0d62ccc4f | |||
| 2941a5903f | |||
| 857680c3b1 | |||
| b44b17d830 |
@@ -354,17 +354,6 @@
|
|||||||
"keep_fnames": false,
|
"keep_fnames": false,
|
||||||
"safari10": false
|
"safari10": false
|
||||||
},
|
},
|
||||||
"node-sass": {
|
|
||||||
"indentType": "space",
|
|
||||||
"allowWildcardImports": false,
|
|
||||||
"indentWidth": 2,
|
|
||||||
"linefeed": "lf",
|
|
||||||
"outputStyle": "expanded",
|
|
||||||
"precision": 10,
|
|
||||||
"sourceMap": false,
|
|
||||||
"removeCharset": false,
|
|
||||||
"sourceComments": false
|
|
||||||
},
|
|
||||||
"png": {
|
"png": {
|
||||||
"quality": 90
|
"quality": 90
|
||||||
},
|
},
|
||||||
@@ -442,6 +431,17 @@
|
|||||||
"turf": {
|
"turf": {
|
||||||
"rootDir": ""
|
"rootDir": ""
|
||||||
},
|
},
|
||||||
|
"node-sass": {
|
||||||
|
"indentType": "space",
|
||||||
|
"allowWildcardImports": false,
|
||||||
|
"indentWidth": 2,
|
||||||
|
"linefeed": "lf",
|
||||||
|
"outputStyle": "expanded",
|
||||||
|
"precision": 10,
|
||||||
|
"sourceMap": false,
|
||||||
|
"removeCharset": false,
|
||||||
|
"sourceComments": false
|
||||||
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"allowJs": false,
|
"allowJs": false,
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
@@ -516,7 +516,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"task": "minify-css",
|
"task": "minify-css",
|
||||||
"enable": true
|
"enable": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"output": {
|
"output": {
|
||||||
@@ -1372,6 +1372,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"file": "src/pg/patterns/core/header/_header.pp",
|
||||||
|
"config": {
|
||||||
|
"autoCompile": true
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"file": "src/pg/patterns/core/sticky-note/_sticky-note.pp",
|
"file": "src/pg/patterns/core/sticky-note/_sticky-note.pp",
|
||||||
"config": {
|
"config": {
|
||||||
|
|||||||
94
public/assets/scaffolding-min.js
vendored
94
public/assets/scaffolding-min.js
vendored
@@ -3223,6 +3223,20 @@ var waitForElement = function waitForElement(selector) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
var chooseTab = function chooseTab(tab) {
|
||||||
|
var siblings = Array.from(tab.parentNode.children);
|
||||||
|
siblings.forEach(function (sibling) {
|
||||||
|
return sibling.classList.remove("selected");
|
||||||
|
});
|
||||||
|
tab.classList.add("selected");
|
||||||
|
var tabPanels = Array.from(tab.parentNode.parentNode.children);
|
||||||
|
tabPanels.forEach(function (panel) {
|
||||||
|
return panel.classList.remove("open");
|
||||||
|
});
|
||||||
|
var tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
||||||
|
document.getElementById(tabPanelId).classList.add("open");
|
||||||
|
};
|
||||||
|
var pushState = 0;
|
||||||
var tabsetCount = 0;
|
var tabsetCount = 0;
|
||||||
function init() {
|
function init() {
|
||||||
var container = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
var container = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
||||||
@@ -3262,46 +3276,51 @@ function init() {
|
|||||||
tabPanel.setAttribute("tabindex", "0");
|
tabPanel.setAttribute("tabindex", "0");
|
||||||
tabPanel.setAttribute("aria-labelledby", "tab-".concat(tabgroup, "-").concat(tabID));
|
tabPanel.setAttribute("aria-labelledby", "tab-".concat(tabgroup, "-").concat(tabID));
|
||||||
child.parentNode.replaceChild(tabPanel, child);
|
child.parentNode.replaceChild(tabPanel, child);
|
||||||
var cls = tablist === "" ? "class='selected'" : "";
|
tablist += "<li tabindex=\"0\" role=\"tab\" id=\"tab-".concat(tabgroup, "-").concat(tabID, "\"><span>").concat(tab, "</span></li>");
|
||||||
tablist += "<li tabindex=\"0\" role=\"tab\" ".concat(cls, " id=\"tab-").concat(tabgroup, "-").concat(tabID, "\"><span>").concat(tab, "</span></li>");
|
|
||||||
} else {
|
} else {
|
||||||
child.classList.add("tab-hidden");
|
child.classList.add("tab-hidden");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var ul = document.createElement('ul');
|
var ul = document.createElement('ul');
|
||||||
ul.setAttribute("role", "tablist");
|
ul.setAttribute("role", "tablist");
|
||||||
ul.innerHTML = spacer != true ? "".concat(tablist) : "".concat(tablist, "<li role=\"separator\" class=\"separator\"></li>");
|
|
||||||
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
||||||
|
ul.innerHTML = spacer != true ? "".concat(tablist) : "".concat(tablist, "<li role=\"separator\" class=\"separator\"></li>");
|
||||||
|
if (tabGroup.hasAttribute("order") || tabGroup.hasAttribute("data-order")) {
|
||||||
|
var order = (tabGroup.getAttribute("order") || tabGroup.getAttribute("data-order")).split(",");
|
||||||
|
var items = Array.from(ul.getElementsByTagName("li"));
|
||||||
|
items.sort(function (a, b) {
|
||||||
|
console.log("here");
|
||||||
|
var aa = order.indexOf(a.textContent.trim());
|
||||||
|
var bb = order.indexOf(b.textContent.trim());
|
||||||
|
|
||||||
|
// Check if both items exist in orderArray
|
||||||
|
if (aa === -1) return 1; // Move to the end if not found
|
||||||
|
if (bb === -1) return -1; // Move to the end if not found
|
||||||
|
|
||||||
|
return aa - bb; // Sort based on the defined order
|
||||||
|
});
|
||||||
|
ul.innerHTML = '';
|
||||||
|
items.forEach(function (item) {
|
||||||
|
return ul.appendChild(item);
|
||||||
|
});
|
||||||
|
}
|
||||||
tabGroup.querySelectorAll('[role="tab"]').forEach(function (tab) {
|
tabGroup.querySelectorAll('[role="tab"]').forEach(function (tab) {
|
||||||
tab.addEventListener("click", function (evt) {
|
tab.addEventListener("click", function (evt) {
|
||||||
// if (evt.altKey && typeof args.altModifier == "function") {
|
if (pushState == 0) {
|
||||||
// args.altModifier(tab, evt);
|
|
||||||
// } else if (evt.shiftKey && typeof args.shiftModifier == "function") {
|
|
||||||
// args.shiftModifier(tab, evt);
|
|
||||||
// } else if (evt.metaKey && typeof args.metaModifier == "function") {
|
|
||||||
// args.metaModifier(tab, evt);
|
|
||||||
// } else {
|
|
||||||
var siblings = Array.from(tab.parentNode.children);
|
|
||||||
siblings.forEach(function (sibling) {
|
|
||||||
return sibling.classList.remove("selected");
|
|
||||||
});
|
|
||||||
tab.classList.add("selected");
|
|
||||||
var urlPath = window.location;
|
|
||||||
urlPath.hash = evt.currentTarget.getAttribute("id");
|
|
||||||
window.history.pushState({
|
window.history.pushState({
|
||||||
"pageTitle": window.title + " : " + evt.currentTarget.innerHTML
|
rand: Math.random(),
|
||||||
}, "", urlPath.toString());
|
pushState: pushState,
|
||||||
// window.history.pushState({"html":response.html,"pageTitle":response.pageTitle},"", urlPath);
|
tab: tab.parentNode.firstChild.getAttribute("id")
|
||||||
|
}, "", "#".concat(tab.parentNode.firstChild.getAttribute("id")));
|
||||||
var tabPanels = Array.from(tab.parentNode.parentNode.children).filter(function (child) {
|
pushState++;
|
||||||
return child.getAttribute("role") === "tabpanel";
|
}
|
||||||
});
|
chooseTab(evt.currentTarget);
|
||||||
tabPanels.forEach(function (panel) {
|
window.history.pushState({
|
||||||
return panel.classList.remove("open");
|
rand: Math.random(),
|
||||||
});
|
pushState: pushState,
|
||||||
var tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
tab: tab.getAttribute("id")
|
||||||
document.getElementById(tabPanelId).classList.add("open");
|
}, "", "#".concat(tab.getAttribute("id")));
|
||||||
//}
|
pushState++;
|
||||||
});
|
});
|
||||||
tab.addEventListener("keypress", function (e) {
|
tab.addEventListener("keypress", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -3310,20 +3329,23 @@ function init() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
ul.querySelector("li").classList.add("selected");
|
||||||
}
|
}
|
||||||
if (document.location.hash != "" && document.location.hash.substring(0, 5) == "#tab-") {
|
if (document.location.hash != "" && document.location.hash.substring(0, 5) == "#tab-") {
|
||||||
waitForElement(document.location.hash).then(function (el) {
|
waitForElement(document.location.hash).then(function (el) {
|
||||||
el.scrollIntoView();
|
//el.scrollIntoView();
|
||||||
el.focus();
|
el.focus();
|
||||||
el.dispatchEvent(click);
|
el.dispatchEvent(click);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addEventListener("hashchange", function (evt) {
|
window.addEventListener("popstate", function (e) {
|
||||||
document.querySelector(window.location.hash).dispatchEvent(click);
|
e.preventDefault();
|
||||||
|
if (e.state != null) {
|
||||||
// window.location.hash
|
chooseTab(document.querySelector("#".concat(e.state.tab)));
|
||||||
// console.log(window.location.hash)
|
} else {
|
||||||
|
history.go(-1);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -24,7 +24,7 @@
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
$allowed_types = ["scss", "js"];
|
$allowed_types = ['js','pug','scss'];
|
||||||
$patterns = dirname(dirname(__file__)) . "/src/pg/patterns";
|
$patterns = dirname(dirname(__file__)) . "/src/pg/patterns";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -76,8 +76,8 @@
|
|||||||
<h1 class="status-complete"><span>Header
|
<h1 class="status-complete"><span>Header
|
||||||
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
|
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
|
||||||
</article>
|
</article>
|
||||||
<article id="layouts-breakpoints" data-name="breakpoints" data-status="complete" data-template="pug" data-core="true" data-path="layouts/breakpoints" style="height: 100vh">
|
<article id="layouts-breakpoint" data-name="breakpoint" data-status="complete" data-template="pug" data-core="true" data-path="layouts/breakpoint" style="height: 100vh">
|
||||||
<h1 class="status-complete"><span>Breakpoints
|
<h1 class="status-complete"><span>Breakpoint
|
||||||
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
|
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
|
||||||
</article>
|
</article>
|
||||||
<article id="layouts-tabs" data-name="tabs" data-status="complete" data-template="pug" data-core="true" data-path="layouts/tabs" style="height: 100vh">
|
<article id="layouts-tabs" data-name="tabs" data-status="complete" data-template="pug" data-core="true" data-path="layouts/tabs" style="height: 100vh">
|
||||||
|
|||||||
@@ -2,6 +2,13 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Pattern</title>
|
<title>Pattern</title>
|
||||||
|
<script>
|
||||||
|
let u = document.location.href.substring(0, document.location.href.search(/patterns/i));
|
||||||
|
let p = document.location.pathname.substring(document.location.pathname.search(/patterns/i));
|
||||||
|
p = p.replace(/\/$|\/index\.html/i, "").substring(9);
|
||||||
|
window.location = u + "?p=" + p;
|
||||||
|
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body data-prismjs-copy-timeout="1500">
|
<body data-prismjs-copy-timeout="1500">
|
||||||
<h2>What is it</h2>
|
<h2>What is it</h2>
|
||||||
@@ -14,22 +21,27 @@
|
|||||||
<p>When using this, use the default break points as they are set to the same as the Bootstrap framework. The grid for the design system at large break point has been widened to accompdate 3 colour cards across. </p>
|
<p>When using this, use the default break points as they are set to the same as the Bootstrap framework. The grid for the design system at large break point has been widened to accompdate 3 colour cards across. </p>
|
||||||
<tabset id="breakpoints">
|
<tabset id="breakpoints">
|
||||||
<div tab="scss">
|
<div tab="scss">
|
||||||
<pre class="language-sass">@import "[path-to]/breakpoints";
|
<h2>Example</h2>
|
||||||
@include break([breakpoint]) {
|
<pre class="language-sass">@use "scss/core/breakpoint/breakpoint";
|
||||||
|
@include breapoint.break([breakpoint]) {
|
||||||
// css here
|
// css here
|
||||||
}</pre>
|
}</pre>
|
||||||
<pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
|
<pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
//- Licensed under CC BY-SA 4.0
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
|
@use 'sass:map';
|
||||||
|
@use 'sass:string';
|
||||||
|
|
||||||
// default breakpoints match bootstrap 5 breakpoints.
|
// default breakpoints match bootstrap 5 breakpoints.
|
||||||
$grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 1400px ) !default;
|
$grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 1400px ) !default;
|
||||||
|
|
||||||
@mixin breakpoint-debug {
|
@mixin debug {
|
||||||
body::before, body::after {
|
body::before, body::after {
|
||||||
background-color: #555;
|
background-color: #555;
|
||||||
color: white;
|
color: white;
|
||||||
content: "bigger than extra large";
|
content: "bigger than extra large";
|
||||||
display: grid;
|
display: grid;
|
||||||
|
font-family: sans-serif;
|
||||||
font-size: 25px;
|
font-size: 25px;
|
||||||
grid-template-columns: auto;
|
grid-template-columns: auto;
|
||||||
padding: 25px;
|
padding: 25px;
|
||||||
@@ -57,30 +69,30 @@ $grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 14
|
|||||||
$min: 0;
|
$min: 0;
|
||||||
$max: 0;
|
$max: 0;
|
||||||
|
|
||||||
@if str-length($bp) == 2 {
|
@if string.length($bp) == 2 {
|
||||||
|
|
||||||
// only a single break point was received
|
// only a single break point was received
|
||||||
$min: map-get($points, $bp);
|
$min: map.get($points, $bp);
|
||||||
$max: map-get($points, nth(map-keys($points), index(map-keys($points), $bp) + 1));
|
$max: map.get($points, nth(map.keys($points), index(map.keys($points), $bp) + 1));
|
||||||
|
|
||||||
} @else {
|
} @else {
|
||||||
|
|
||||||
|
|
||||||
@if str-slice($bp, 0, 1) == "-" {
|
@if string.slice($bp, 0, 1) == "-" {
|
||||||
// no lower breakpoint was received
|
// no lower breakpoint was received
|
||||||
$min: null;
|
$min: null;
|
||||||
$max: map-get($points, str-slice($bp, 2, 3));
|
$max: map.get($points, string.slice($bp, 2, 3));
|
||||||
|
|
||||||
} @else {
|
} @else {
|
||||||
|
|
||||||
$min: map-get($points, unquote(str-slice($bp, 0, 2)));
|
$min: map.get($points, string.unquote(string.slice($bp, 0, 2)));
|
||||||
|
|
||||||
|
|
||||||
@if str-length($bp) == 3 {
|
@if string.length($bp) == 3 {
|
||||||
// no upper break point was received
|
// no upper break point was received
|
||||||
$max: null;
|
$max: null;
|
||||||
} @else {
|
} @else {
|
||||||
$max: map-get($points, str-slice($bp, 4, 5));
|
$max: map.get($points, string.slice($bp, 4, 5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,13 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Pattern</title>
|
<title>Pattern</title>
|
||||||
|
<script>
|
||||||
|
let u = document.location.href.substring(0, document.location.href.search(/patterns/i));
|
||||||
|
let p = document.location.pathname.substring(document.location.pathname.search(/patterns/i));
|
||||||
|
p = p.replace(/\/$|\/index\.html/i, "").substring(9);
|
||||||
|
window.location = u + "?p=" + p;
|
||||||
|
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body data-prismjs-copy-timeout="1500">
|
<body data-prismjs-copy-timeout="1500">
|
||||||
<h2>What is it</h2>
|
<h2>What is it</h2>
|
||||||
@@ -284,7 +291,7 @@
|
|||||||
</sample-block>
|
</sample-block>
|
||||||
</color-sample>
|
</color-sample>
|
||||||
</color-samples>
|
</color-samples>
|
||||||
<div class="tab-group" id="colors">
|
<tabset id="colors">
|
||||||
<div data-tab="css">
|
<div data-tab="css">
|
||||||
<pre class="language-css">:root {
|
<pre class="language-css">:root {
|
||||||
--colour-blue: #2e51a1;
|
--colour-blue: #2e51a1;
|
||||||
@@ -332,6 +339,6 @@
|
|||||||
}
|
}
|
||||||
}</pre>
|
}</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</tabset>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -2,6 +2,13 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Pattern</title>
|
<title>Pattern</title>
|
||||||
|
<script>
|
||||||
|
let u = document.location.href.substring(0, document.location.href.search(/patterns/i));
|
||||||
|
let p = document.location.pathname.substring(document.location.pathname.search(/patterns/i));
|
||||||
|
p = p.replace(/\/$|\/index\.html/i, "").substring(9);
|
||||||
|
window.location = u + "?p=" + p;
|
||||||
|
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body data-prismjs-copy-timeout="1500">
|
<body data-prismjs-copy-timeout="1500">
|
||||||
<h2>What is it</h2>
|
<h2>What is it</h2>
|
||||||
@@ -42,9 +49,61 @@ header
|
|||||||
a(href="./")= site
|
a(href="./")= site
|
||||||
// Other sections can go here, such as search and directory
|
// Other sections can go here, such as search and directory
|
||||||
</pre>
|
</pre>
|
||||||
<pre class="language-css" tab="css">header{display:-ms-grid;display:grid;-ms-grid-rows:1.75rem 3.5rem;grid-template-rows:1.75rem 3.5rem;-ms-grid-column:2;-ms-grid-column-span:2;grid-column:2/4;overflow:hidden}header svg{grid-column:1/-1;grid-row:1/-1;-ms-grid-row-align:stretch;-ms-grid-column-align:stretch;place-self:stretch}header svg text{-webkit-transform:translate(-1rem,7.25rem);-ms-transform:translate(-1rem,7.25rem);transform:translate(-1rem,7.25rem);font-size:10rem;font-weight:1000;font-family:sans-serif;fill:var(--colour-grey-xxl)}header>div{-ms-grid-row:2;grid-row:2;grid-column:1/-1;display:-ms-grid;display:grid;grid-column-gap:1rem;-ms-grid-columns:auto -webkit-max-content -webkit-max-content;-ms-grid-columns:auto max-content max-content;grid-template-columns:auto -webkit-max-content -webkit-max-content;grid-template-columns:auto max-content max-content}header>div .header-title h1{margin:0;padding:0 1rem}header>div .header-title h1 a,header>div .header-title h1 a:visited{border-bottom:none;color:var(--colour-black);font-family:sans-serif;font-size:2.5rem;font-size:32px;font-weight:700;margin:0;padding:0;text-decoration:none}</pre>
|
<pre class="language-css" tab="css">header {
|
||||||
|
display: -ms-grid;
|
||||||
|
display: grid;
|
||||||
|
-ms-grid-rows: 1.75rem 3.5rem;
|
||||||
|
grid-template-rows: 1.75rem 3.5rem;
|
||||||
|
-ms-grid-column: 2;
|
||||||
|
-ms-grid-column-span: 2;
|
||||||
|
grid-column: 2/4;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
header svg {
|
||||||
|
grid-column: 1/-1;
|
||||||
|
grid-row: 1/-1;
|
||||||
|
-ms-grid-row-align: stretch;
|
||||||
|
-ms-grid-column-align: stretch;
|
||||||
|
place-self: stretch;
|
||||||
|
}
|
||||||
|
header svg text {
|
||||||
|
-webkit-transform: translate(-1rem, 7.25rem);
|
||||||
|
-ms-transform: translate(-1rem, 7.25rem);
|
||||||
|
transform: translate(-1rem, 7.25rem);
|
||||||
|
font-size: 10rem;
|
||||||
|
font-weight: 1000;
|
||||||
|
font-family: sans-serif;
|
||||||
|
fill: var(--colour-grey-xxl);
|
||||||
|
}
|
||||||
|
header > div {
|
||||||
|
-ms-grid-row: 2;
|
||||||
|
grid-row: 2;
|
||||||
|
grid-column: 1/-1;
|
||||||
|
display: -ms-grid;
|
||||||
|
display: grid;
|
||||||
|
grid-column-gap: 1rem;
|
||||||
|
-ms-grid-columns: auto -webkit-max-content -webkit-max-content;
|
||||||
|
-ms-grid-columns: auto max-content max-content;
|
||||||
|
grid-template-columns: auto -webkit-max-content -webkit-max-content;
|
||||||
|
grid-template-columns: auto max-content max-content;
|
||||||
|
}
|
||||||
|
header > div .header-title h1 {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0 1rem;
|
||||||
|
}
|
||||||
|
header > div .header-title h1 a, header > div .header-title h1 a:visited {
|
||||||
|
border-bottom: none;
|
||||||
|
color: var(--colour-black);
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 2.5rem;
|
||||||
|
font-size: 32px;
|
||||||
|
font-weight: 700;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
text-decoration: none;
|
||||||
|
}</pre>
|
||||||
<div class="language-sass" tab="scss">
|
<div class="language-sass" tab="scss">
|
||||||
<pre class="language-sass">@import "scss/core/header/header;
|
<pre class="language-sass">@use "scss/core/header/header;
|
||||||
</pre>
|
</pre>
|
||||||
<pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
|
<pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
//- Licensed under CC BY-SA 4.0
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|||||||
@@ -2,9 +2,16 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Pattern</title>
|
<title>Pattern</title>
|
||||||
|
<script>
|
||||||
|
let u = document.location.href.substring(0, document.location.href.search(/patterns/i));
|
||||||
|
let p = document.location.pathname.substring(document.location.pathname.search(/patterns/i));
|
||||||
|
p = p.replace(/\/$|\/index\.html/i, "").substring(9);
|
||||||
|
window.location = u + "?p=" + p;
|
||||||
|
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body data-prismjs-copy-timeout="1500">
|
<body data-prismjs-copy-timeout="1500">
|
||||||
<div class="tab-group" id="status-report">
|
<tabset id="status-report">
|
||||||
<div class="status-report status-report-structure" data-tab="by&nbsp;structure">
|
<div class="status-report status-report-structure" data-tab="by&nbsp;structure">
|
||||||
<table class="custom" role="presentation">
|
<table class="custom" role="presentation">
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -13,32 +20,38 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="./?p=this pattern doesn't exist"> This pattern doesn't exist</a></td>
|
<td><a href="./?p=this pattern doesn't exist"> This pattern doesn't exist</a></td>
|
||||||
<td><span class="status-deprecated">Deprecated</span></td>
|
<td><span class="status-deprecated">Deprecated</span>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">Colours (1)</td>
|
<td colspan="2">Colours (1)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="./?p=colours"> Colours</a></td>
|
<td><a href="./?p=colours"> Colours</a></td>
|
||||||
<td><span class="status-complete">Complete</span></td>
|
<td><span class="status-complete">Complete (Core)</span>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">Components (4)</td>
|
<td colspan="2">Components (4)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="./?p=components"> Components</a></td>
|
<td><a href="./?p=components"> Components</a></td>
|
||||||
<td><span class="status-complete">Complete</span></td>
|
<td><span class="status-complete">Complete</span>
|
||||||
|
</td>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="./?p=components/sticky-note"> Sticky note</a></td>
|
<td><a href="./?p=components/sticky-note"> Sticky note</a></td>
|
||||||
<td><span class="status-complete">Complete</span></td>
|
<td><span class="status-complete">Complete (Core)</span>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="./?p=components/switch"> Switch</a></td>
|
<td><a href="./?p=components/switch"> Switch</a></td>
|
||||||
<td><span class="status-complete">Complete</span></td>
|
<td><span class="status-complete">Complete (Core)</span>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="./?p=components/tooltip"> Tooltip</a></td>
|
<td><a href="./?p=components/tooltip"> Tooltip</a></td>
|
||||||
<td><span class="status-complete">Complete</span></td>
|
<td><span class="status-complete">Complete (Core)</span>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -46,18 +59,22 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="./?p=layouts"> Layouts</a></td>
|
<td><a href="./?p=layouts"> Layouts</a></td>
|
||||||
<td><span class="status-complete">Complete</span></td>
|
<td><span class="status-complete">Complete (Core)</span>
|
||||||
|
</td>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="./?p=layouts/header"> Header</a></td>
|
<td><a href="./?p=layouts/header"> Header</a></td>
|
||||||
<td><span class="status-complete">Complete</span></td>
|
<td><span class="status-complete">Complete (Core)</span>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="./?p=layouts/breakpoints"> Breakpoints</a></td>
|
<td><a href="./?p=layouts/breakpoint"> Breakpoint</a></td>
|
||||||
<td><span class="status-complete">Complete</span></td>
|
<td><span class="status-complete">Complete (Core)</span>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="./?p=layouts/tabs"> Tabs</a></td>
|
<td><a href="./?p=layouts/tabs"> Tabs</a></td>
|
||||||
<td><span class="status-complete">Complete</span></td>
|
<td><span class="status-complete">Complete (Core)</span>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -65,7 +82,8 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="./?p=status"> Status</a></td>
|
<td><a href="./?p=status"> Status</a></td>
|
||||||
<td><span class="status-complete">Complete</span></td>
|
<td><span class="status-complete">Complete (Core)</span>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -83,43 +101,63 @@
|
|||||||
<td colspan="2"><span class="status-complete">Complete (10)</span></td>
|
<td colspan="2"><span class="status-complete">Complete (10)</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=layouts/breakpoints">Breakpoints</a></td>
|
<td> <a href="./?p=layouts/breakpoint">Breakpoint</a></td>
|
||||||
|
<td><span>(core)</span>
|
||||||
|
</td>
|
||||||
<td>Layouts</td>
|
<td>Layouts</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=colours">Colours</a></td>
|
<td> <a href="./?p=colours">Colours</a></td>
|
||||||
|
<td><span>(core)</span>
|
||||||
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=components">Components</a></td>
|
<td> <a href="./?p=components">Components</a></td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=layouts/header">Header</a></td>
|
<td> <a href="./?p=layouts/header">Header</a></td>
|
||||||
|
<td><span>(core)</span>
|
||||||
|
</td>
|
||||||
<td>Layouts</td>
|
<td>Layouts</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=layouts">Layouts</a></td>
|
<td> <a href="./?p=layouts">Layouts</a></td>
|
||||||
|
<td><span>(core)</span>
|
||||||
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=status">Status</a></td>
|
<td> <a href="./?p=status">Status</a></td>
|
||||||
|
<td><span>(core)</span>
|
||||||
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=components/sticky-note">Sticky note</a></td>
|
<td> <a href="./?p=components/sticky-note">Sticky note</a></td>
|
||||||
|
<td><span>(core)</span>
|
||||||
|
</td>
|
||||||
<td>Components</td>
|
<td>Components</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=components/switch">Switch</a></td>
|
<td> <a href="./?p=components/switch">Switch</a></td>
|
||||||
|
<td><span>(core)</span>
|
||||||
|
</td>
|
||||||
<td>Components</td>
|
<td>Components</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=layouts/tabs">Tabs</a></td>
|
<td> <a href="./?p=layouts/tabs">Tabs</a></td>
|
||||||
|
<td><span>(core)</span>
|
||||||
|
</td>
|
||||||
<td>Layouts</td>
|
<td>Layouts</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=components/tooltip">Tooltip</a></td>
|
<td> <a href="./?p=components/tooltip">Tooltip</a></td>
|
||||||
|
<td><span>(core)</span>
|
||||||
|
</td>
|
||||||
<td>Components</td>
|
<td>Components</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -127,6 +165,8 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=this pattern doesn't exist">This pattern doesn't exist</a></td>
|
<td> <a href="./?p=this pattern doesn't exist">This pattern doesn't exist</a></td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -136,63 +176,63 @@
|
|||||||
<table role="presentation">
|
<table role="presentation">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=layouts/breakpoints">Breakpoints</a></td>
|
<td> <a href="./?p=layouts/breakpoint">Breakpoint</a></td>
|
||||||
<td><span><span class="status-complete">Complete</span></span></td>
|
<td><span> <span class="status-complete">Complete (Core)</span></span></td>
|
||||||
<td>Layouts</td>
|
<td>Layouts</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=colours">Colours</a></td>
|
<td> <a href="./?p=colours">Colours</a></td>
|
||||||
<td><span><span class="status-complete">Complete</span></span></td>
|
<td><span> <span class="status-complete">Complete (Core)</span></span></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=components">Components</a></td>
|
<td> <a href="./?p=components">Components</a></td>
|
||||||
<td><span><span class="status-complete">Complete</span></span></td>
|
<td><span> <span class="status-complete">Complete</span></span></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=layouts/header">Header</a></td>
|
<td> <a href="./?p=layouts/header">Header</a></td>
|
||||||
<td><span><span class="status-complete">Complete</span></span></td>
|
<td><span> <span class="status-complete">Complete (Core)</span></span></td>
|
||||||
<td>Layouts</td>
|
<td>Layouts</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=layouts">Layouts</a></td>
|
<td> <a href="./?p=layouts">Layouts</a></td>
|
||||||
<td><span><span class="status-complete">Complete</span></span></td>
|
<td><span> <span class="status-complete">Complete (Core)</span></span></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=status">Status</a></td>
|
<td> <a href="./?p=status">Status</a></td>
|
||||||
<td><span><span class="status-complete">Complete</span></span></td>
|
<td><span> <span class="status-complete">Complete (Core)</span></span></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=components/sticky-note">Sticky note</a></td>
|
<td> <a href="./?p=components/sticky-note">Sticky note</a></td>
|
||||||
<td><span><span class="status-complete">Complete</span></span></td>
|
<td><span> <span class="status-complete">Complete (Core)</span></span></td>
|
||||||
<td>Components</td>
|
<td>Components</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=components/switch">Switch</a></td>
|
<td> <a href="./?p=components/switch">Switch</a></td>
|
||||||
<td><span><span class="status-complete">Complete</span></span></td>
|
<td><span> <span class="status-complete">Complete (Core)</span></span></td>
|
||||||
<td>Components</td>
|
<td>Components</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=layouts/tabs">Tabs</a></td>
|
<td> <a href="./?p=layouts/tabs">Tabs</a></td>
|
||||||
<td><span><span class="status-complete">Complete</span></span></td>
|
<td><span> <span class="status-complete">Complete (Core)</span></span></td>
|
||||||
<td>Layouts</td>
|
<td>Layouts</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=this pattern doesn't exist">This pattern doesn't exist</a></td>
|
<td> <a href="./?p=this pattern doesn't exist">This pattern doesn't exist</a></td>
|
||||||
<td><span><span class="status-deprecated">Deprecated</span></span></td>
|
<td><span> <span class="status-deprecated">Deprecated</span></span></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="./?p=components/tooltip">Tooltip</a></td>
|
<td> <a href="./?p=components/tooltip">Tooltip</a></td>
|
||||||
<td><span><span class="status-complete">Complete</span></span></td>
|
<td><span> <span class="status-complete">Complete (Core)</span></span></td>
|
||||||
<td>Components</td>
|
<td>Components</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</tabset>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -2,6 +2,13 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Pattern</title>
|
<title>Pattern</title>
|
||||||
|
<script>
|
||||||
|
let u = document.location.href.substring(0, document.location.href.search(/patterns/i));
|
||||||
|
let p = document.location.pathname.substring(document.location.pathname.search(/patterns/i));
|
||||||
|
p = p.replace(/\/$|\/index\.html/i, "").substring(9);
|
||||||
|
window.location = u + "?p=" + p;
|
||||||
|
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body data-prismjs-copy-timeout="1500">
|
<body data-prismjs-copy-timeout="1500">
|
||||||
<h2>What is it</h2>
|
<h2>What is it</h2>
|
||||||
@@ -19,10 +26,135 @@
|
|||||||
<sticky-note class="blue" float="right">This <strong>is</strong> a sample sticky. You can drag it out of the way if you need to see the content under it.</sticky-note></pre>
|
<sticky-note class="blue" float="right">This <strong>is</strong> a sample sticky. You can drag it out of the way if you need to see the content under it.</sticky-note></pre>
|
||||||
<pre class="language-pug" tab="pug">sticky-note(float="right").blue This #[strong is] a sample sticky.
|
<pre class="language-pug" tab="pug">sticky-note(float="right").blue This #[strong is] a sample sticky.
|
||||||
| You can drag it out of the way if you need to see the content under it.</pre>
|
| You can drag it out of the way if you need to see the content under it.</pre>
|
||||||
<pre class="language-css" data-tab="css"> @import url("https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap");sticky-note-wrapper{-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid transparent;border-radius:50%;display:inline-block;height:0.5rem;position:relative;width:0.5rem}sticky-note-wrapper *{-webkit-box-sizing:border-box;box-sizing:border-box}sticky-note-wrapper sticky-note{cursor:-webkit-grab;cursor:grab;display:-ms-grid;display:grid;float:left;font-size:1rem;height:13rem;left:0;place-items:stretch;position:absolute;top:0;width:13rem;z-index:100}sticky-note-wrapper sticky-note:active{cursor:-webkit-grabbing;cursor:grabbing;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}sticky-note-wrapper sticky-note.right{float:right}sticky-note-wrapper sticky-note>div{-ms-grid-row:1;grid-row:1;-ms-grid-column:1;grid-column:1}sticky-note-wrapper sticky-note>div:first-child{background-color:rgba(0,0,0,0.25);-webkit-box-shadow:-2px 2px 15px 0 rgba(0,0,0,0.5);box-shadow:-2px 2px 15px 0 rgba(0,0,0,0.5);display:-ms-grid;display:grid;margin:2rem 1rem 0.25rem 0.36rem;width:calc(100% - 1rem)}sticky-note-wrapper sticky-note>div:nth-child(2){clip-path:url(#stickyClip);display:-ms-grid;display:grid;font-family:"Kalam",cursive;font-style:1rem;font-weight:300;line-height:1.25rem;padding:1rem;place-items:center;text-align:center}sticky-note-wrapper sticky-note>div:nth-child(2)>*{font-family:"Kalam",cursive!important;font-style:normal!important;font-weight:300!important}@media screen and (max-width:1024px){sticky-note-wrapper sticky-note>div:nth-child(2){max-width:13rem;min-width:13rem;width:1rem}}@media screen and (max-width:768px){sticky-note-wrapper sticky-note>div:nth-child(2){font-size:1.75rem;max-width:21rem;min-height:21rem}}@media screen and (max-width:640px){sticky-note-wrapper sticky-note>div:nth-child(2){font-size:2.5rem;max-width:26rem;min-height:26rem}}sticky-note-wrapper sticky-note>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#ffffdd),color-stop(2%,#ffffd3),color-stop(12%,#ffffd3),color-stop(75%,#ffffc9),to(#ffffba));background:linear-gradient(180deg,#ffffdd 0%,#ffffd3 2%,#ffffd3 12%,#ffffc9 75%,#ffffba 100%)}sticky-note-wrapper sticky-note.blue>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#9dddec),color-stop(2%,#94daea),color-stop(12%,#94daea),color-stop(75%,#8bd7e8),to(#7fd3e6));background:linear-gradient(180deg,#9dddec 0%,#94daea 2%,#94daea 12%,#8bd7e8 75%,#7fd3e6 100%)}sticky-note-wrapper sticky-note.pink>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#fa7c93),color-stop(2%,#fa728b),color-stop(12%,#fa728b),color-stop(75%,#fa6883),to(#f95977));background:linear-gradient(180deg,#fa7c93 0%,#fa728b 2%,#fa728b 12%,#fa6883 75%,#f95977 100%)}sticky-note-wrapper sticky-note.green>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#c5fcc9),color-stop(2%,#bbfbc0),color-stop(12%,#bbfbc0),color-stop(75%,#b1fab7),to(#a3faaa));background:linear-gradient(180deg,#c5fcc9 0%,#bbfbc0 2%,#bbfbc0 12%,#b1fab7 75%,#a3faaa 100%)}sticky-note-wrapper:has(sticky-note:hover){background-color:#ffffd3;border:1px solid black}sticky-note-wrapper:has(sticky-note.yellow:hover){background-color:#ffffd3}sticky-note-wrapper:has(sticky-note.blue:hover){background-color:#94daea}sticky-note-wrapper:has(sticky-note.pink:hover){background-color:#fa728b}sticky-note-wrapper:has(sticky-note.green:hover){background-color:#bbfbc0}</pre>
|
<pre class="language-css" data-tab="css"> sticky-note-wrapper {
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: inline-block;
|
||||||
|
height: 0.5rem;
|
||||||
|
position: relative;
|
||||||
|
width: 0.5rem;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper * {
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note {
|
||||||
|
cursor: -webkit-grab;
|
||||||
|
cursor: grab;
|
||||||
|
display: -ms-grid;
|
||||||
|
display: grid;
|
||||||
|
float: left;
|
||||||
|
font-size: 1rem;
|
||||||
|
height: 13rem;
|
||||||
|
left: 0;
|
||||||
|
place-items: stretch;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
width: 13rem;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note:active {
|
||||||
|
cursor: -webkit-grabbing;
|
||||||
|
cursor: grabbing;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note.right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note > div {
|
||||||
|
-ms-grid-row: 1;
|
||||||
|
grid-row: 1;
|
||||||
|
-ms-grid-column: 1;
|
||||||
|
grid-column: 1;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note > div:nth-child(1) {
|
||||||
|
background-color: rgba(0, 0, 0, 0.25);
|
||||||
|
-webkit-box-shadow: -2px 2px 15px 0 rgba(0, 0, 0, 0.5);
|
||||||
|
box-shadow: -2px 2px 15px 0 rgba(0, 0, 0, 0.5);
|
||||||
|
display: -ms-grid;
|
||||||
|
display: grid;
|
||||||
|
margin: 2rem 1rem 0.25rem 0.36rem;
|
||||||
|
width: calc(100% - 1rem);
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
||||||
|
clip-path: url(#stickyClip);
|
||||||
|
display: -ms-grid;
|
||||||
|
display: grid;
|
||||||
|
font-family: "Kalam", cursive;
|
||||||
|
font-style: 1rem;
|
||||||
|
font-weight: 300;
|
||||||
|
line-height: 1.25rem;
|
||||||
|
padding: 1rem;
|
||||||
|
place-items: center;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note > div:nth-child(2) > * {
|
||||||
|
font-family: "Kalam", cursive !important;
|
||||||
|
font-style: normal !important;
|
||||||
|
font-weight: 300 !important;
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 1024px) {
|
||||||
|
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
||||||
|
max-width: 13rem;
|
||||||
|
min-width: 13rem;
|
||||||
|
width: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 768px) {
|
||||||
|
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
||||||
|
font-size: 1.75rem;
|
||||||
|
max-width: 21rem;
|
||||||
|
min-height: 21rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 640px) {
|
||||||
|
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
||||||
|
font-size: 2.5rem;
|
||||||
|
max-width: 26rem;
|
||||||
|
min-height: 26rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(rgb(255, 255, 221.2)), color-stop(2%, #ffffd3), color-stop(12%, #ffffd3), color-stop(75%, rgb(255, 255, 200.8)), to(rgb(255, 255, 185.5)));
|
||||||
|
background: linear-gradient(180deg, rgb(255, 255, 221.2) 0%, #ffffd3 2%, #ffffd3 12%, rgb(255, 255, 200.8) 75%, rgb(255, 255, 185.5) 100%);
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note.blue > div:nth-child(2) {
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(rgb(156.5265625, 220.9484375, 235.6734375)), color-stop(2%, #94daea), color-stop(12%, #94daea), color-stop(75%, rgb(139.4734375, 215.0515625, 232.3265625)), to(rgb(126.68359375, 210.62890625, 229.81640625)));
|
||||||
|
background: linear-gradient(180deg, rgb(156.5265625, 220.9484375, 235.6734375) 0%, #94daea 2%, #94daea 12%, rgb(139.4734375, 215.0515625, 232.3265625) 75%, rgb(126.68359375, 210.62890625, 229.81640625) 100%);
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note.pink > div:nth-child(2) {
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(rgb(250.3493150685, 123.8506849315, 147.104109589)), color-stop(2%, #fa728b), color-stop(12%, #fa728b), color-stop(75%, rgb(249.6506849315, 104.1493150685, 130.895890411)), to(rgb(249.1267123288, 89.3732876712, 118.7397260274)));
|
||||||
|
background: linear-gradient(180deg, rgb(250.3493150685, 123.8506849315, 147.104109589) 0%, #fa728b 2%, #fa728b 12%, rgb(249.6506849315, 104.1493150685, 130.895890411) 75%, rgb(249.1267123288, 89.3732876712, 118.7397260274) 100%);
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note.green > div:nth-child(2) {
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(rgb(196.6333333333, 251.5666666667, 200.925)), color-stop(2%, #bbfbc0), color-stop(12%, #bbfbc0), color-stop(75%, rgb(177.3666666667, 250.4333333333, 183.075)), to(rgb(162.9166666667, 249.5833333333, 169.6875)));
|
||||||
|
background: linear-gradient(180deg, rgb(196.6333333333, 251.5666666667, 200.925) 0%, #bbfbc0 2%, #bbfbc0 12%, rgb(177.3666666667, 250.4333333333, 183.075) 75%, rgb(162.9166666667, 249.5833333333, 169.6875) 100%);
|
||||||
|
}
|
||||||
|
sticky-note-wrapper:has(sticky-note:hover) {
|
||||||
|
background-color: #ffffd3;
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper:has(sticky-note.yellow:hover) {
|
||||||
|
background-color: #ffffd3;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper:has(sticky-note.blue:hover) {
|
||||||
|
background-color: #94daea;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper:has(sticky-note.pink:hover) {
|
||||||
|
background-color: #fa728b;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper:has(sticky-note.green:hover) {
|
||||||
|
background-color: #bbfbc0;
|
||||||
|
}</pre>
|
||||||
<div tab="scss">
|
<div tab="scss">
|
||||||
|
<h2>Example</h2>
|
||||||
<pre class="language-sass">$sticky-colors: ( [sass map with your own defined colours] );
|
<pre class="language-sass">$sticky-colors: ( [sass map with your own defined colours] );
|
||||||
@import "scss/core/switch/_sticky-note";
|
@use "scss/core/switch/_sticky-note";
|
||||||
@include sticky-note;
|
@include sticky-note;
|
||||||
</pre>
|
</pre>
|
||||||
<pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
|
<pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
@@ -31,7 +163,7 @@
|
|||||||
@use 'sass:color';
|
@use 'sass:color';
|
||||||
@use "sass:map";
|
@use "sass:map";
|
||||||
@use 'sass:list';
|
@use 'sass:list';
|
||||||
@import url('https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap');
|
// @import url('https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap');
|
||||||
|
|
||||||
$sticky-colors: (
|
$sticky-colors: (
|
||||||
"yellow": #ffffd3,
|
"yellow": #ffffd3,
|
||||||
@@ -139,34 +271,52 @@ $sticky-colors: (
|
|||||||
|
|
||||||
// default colour
|
// default colour
|
||||||
> div:nth-child(2) {
|
> div:nth-child(2) {
|
||||||
$sticky-color: nth(map.values($sticky-colors), 1);
|
$sticky-color: list.nth(map.values($sticky-colors), 1);
|
||||||
|
// background: linear-gradient(
|
||||||
|
// 180deg,
|
||||||
|
// lighten($sticky-color, 2%) 0%,
|
||||||
|
// $sticky-color 2%,
|
||||||
|
// $sticky-color 12%,
|
||||||
|
// darken($sticky-color, 2%) 75%,
|
||||||
|
// darken($sticky-color, 5%) 100%
|
||||||
|
// );
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
180deg,
|
180deg,
|
||||||
lighten($sticky-color, 2%) 0%,
|
color.adjust($sticky-color, $lightness: 2%) 0%,
|
||||||
$sticky-color 2%,
|
$sticky-color 2%,
|
||||||
$sticky-color 12%,
|
$sticky-color 12%,
|
||||||
darken($sticky-color, 2%) 75%,
|
color.adjust($sticky-color, $lightness: -2%) 75%,
|
||||||
darken($sticky-color, 5%) 100%
|
color.adjust($sticky-color, $lightness: -5%) 100%
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// all class colors
|
// all class colors
|
||||||
@each $class, $sticky-color in $sticky-colors {
|
@each $class, $sticky-color in $sticky-colors {
|
||||||
&.#{$class} > div:nth-child(2) {
|
&.#{$class} > div:nth-child(2) {
|
||||||
@if $class != nth(map.keys($sticky-colors), 1) {
|
@if $class != list.nth(map.keys($sticky-colors), 1) {
|
||||||
|
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
180deg,
|
180deg,
|
||||||
lighten($sticky-color, 2%) 0%,
|
color.adjust($sticky-color, $lightness: 2%) 0%,
|
||||||
$sticky-color 2%,
|
$sticky-color 2%,
|
||||||
$sticky-color 12%,
|
$sticky-color 12%,
|
||||||
darken($sticky-color, 2%) 75%,
|
color.adjust($sticky-color, $lightness: -2%) 75%,
|
||||||
darken($sticky-color, 5%) 100%
|
color.adjust($sticky-color, $lightness: -5%) 100%
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// background: linear-gradient(
|
||||||
|
// 180deg,
|
||||||
|
// lighten($sticky-color, 2%) 0%,
|
||||||
|
// $sticky-color 2%,
|
||||||
|
// $sticky-color 12%,
|
||||||
|
// darken($sticky-color, 2%) 75%,
|
||||||
|
// darken($sticky-color, 5%) 100%
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&:has(sticky-note:hover) {
|
&:has(sticky-note:hover) {
|
||||||
background-color: #{nth(map.values($sticky-colors), 1)};
|
background-color: #{list.nth(map.values($sticky-colors), 1)};
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -179,6 +329,7 @@ $sticky-colors: (
|
|||||||
}</pre>
|
}</pre>
|
||||||
</div>
|
</div>
|
||||||
<div tab="js">
|
<div tab="js">
|
||||||
|
<h2>Example</h2>
|
||||||
<pre class="language-js">import * as stickynote from ""./js/core/sticky-note/_sticky-note.js";
|
<pre class="language-js">import * as stickynote from ""./js/core/sticky-note/_sticky-note.js";
|
||||||
stickynote.init()
|
stickynote.init()
|
||||||
</pre>
|
</pre>
|
||||||
@@ -279,7 +430,8 @@ const calculateStickyPosition = (s) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function init(p = document){
|
module.exports = {
|
||||||
|
init: (p = document) => {
|
||||||
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px",""));
|
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px",""));
|
||||||
|
|
||||||
p.querySelectorAll("sticky-note").forEach((s) => {
|
p.querySelectorAll("sticky-note").forEach((s) => {
|
||||||
@@ -312,6 +464,7 @@ export function init(p = document){
|
|||||||
calculateStickyPosition(s);
|
calculateStickyPosition(s);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}</pre>
|
}</pre>
|
||||||
</div>
|
</div>
|
||||||
</tabset>
|
</tabset>
|
||||||
|
|||||||
@@ -2,6 +2,13 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Pattern</title>
|
<title>Pattern</title>
|
||||||
|
<script>
|
||||||
|
let u = document.location.href.substring(0, document.location.href.search(/patterns/i));
|
||||||
|
let p = document.location.pathname.substring(document.location.pathname.search(/patterns/i));
|
||||||
|
p = p.replace(/\/$|\/index\.html/i, "").substring(9);
|
||||||
|
window.location = u + "?p=" + p;
|
||||||
|
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body data-prismjs-copy-timeout="1500">
|
<body data-prismjs-copy-timeout="1500">
|
||||||
<h2>What is it</h2>
|
<h2>What is it</h2>
|
||||||
@@ -15,12 +22,38 @@
|
|||||||
<p class="switch">
|
<p class="switch">
|
||||||
<label for="example-switch">Switch label (states the on state)</label><span id="example-switch" role="switch"></span>
|
<label for="example-switch">Switch label (states the on state)</label><span id="example-switch" role="switch"></span>
|
||||||
</p>
|
</p>
|
||||||
<div class="tab-group" id="switches">
|
<tabset id="switches">
|
||||||
<pre class="language-html" tab="html"><span id="example-id" role="switch"></span></pre>
|
<pre class="language-html" tab="html"><span id="example-id" role="switch"></span></pre>
|
||||||
<pre class="language-pug" tab="pug">span#example-id(role="switch")</pre>
|
<pre class="language-pug" tab="pug">span#example-id(role="switch")</pre>
|
||||||
<pre class="language-css" tab="css">[role=switch]{display:-ms-inline-grid;display:inline-grid;border:1px solid #2e51a1;background-color:#d8d8d8;border-radius:0.75rem;height:1.5rem;width:3rem;-webkit-transition:all 500ms;transition:all 500ms}[role=switch]>span{display:inline-block;background-color:white;border-radius:50%;margin:2%;width:calc(1.5rem - 2%);-webkit-transition:all 500ms;transition:all 500ms}[role=switch][aria-checked=true]{background-color:#2e51a1}[role=switch][aria-checked=true]>span{margin-left:calc(1.5rem - 5%)}</pre>
|
<pre class="language-css" tab="css">[role=switch] {
|
||||||
|
display: -ms-inline-grid;
|
||||||
|
display: inline-grid;
|
||||||
|
border: 1px solid #2e51a1;
|
||||||
|
background-color: #d8d8d8;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
height: 1.5rem;
|
||||||
|
width: 3rem;
|
||||||
|
-webkit-transition: all 500ms;
|
||||||
|
transition: all 500ms;
|
||||||
|
}
|
||||||
|
[role=switch] > span {
|
||||||
|
display: inline-block;
|
||||||
|
background-color: white;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin: 2%;
|
||||||
|
width: calc(1.5rem - 2%);
|
||||||
|
-webkit-transition: all 500ms;
|
||||||
|
transition: all 500ms;
|
||||||
|
}
|
||||||
|
[role=switch][aria-checked=true] {
|
||||||
|
background-color: #2e51a1;
|
||||||
|
}
|
||||||
|
[role=switch][aria-checked=true] > span {
|
||||||
|
margin-left: calc(1.5rem - 5%);
|
||||||
|
}</pre>
|
||||||
<div tab="scss">
|
<div tab="scss">
|
||||||
<pre class="language-sass">@import "scss/core/switch/_switch";
|
<h2>Example</h2>
|
||||||
|
<pre class="language-sass">@use "scss/core/switch/_switch";
|
||||||
@include switch;
|
@include switch;
|
||||||
</pre>
|
</pre>
|
||||||
<pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
|
<pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
@@ -61,6 +94,7 @@ $switch-height: 1.5rem !default;
|
|||||||
}</pre>
|
}</pre>
|
||||||
</div>
|
</div>
|
||||||
<div tab="js">
|
<div tab="js">
|
||||||
|
<h2>Example</h2>
|
||||||
<pre class="language-js">// Note that switch is a reserved word.
|
<pre class="language-js">// Note that switch is a reserved word.
|
||||||
import * as swtch from "./js/core/switch/_switch.js";
|
import * as swtch from "./js/core/switch/_switch.js";
|
||||||
swtch.init();
|
swtch.init();
|
||||||
@@ -97,6 +131,6 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</tabset>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -23,28 +23,77 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<p>Users should not need to see content of multiple tabs simultaneously and the user should be able to easily recognise where they are within the content. </p>
|
<p>Users should not need to see content of multiple tabs simultaneously and the user should be able to easily recognise where they are within the content. </p>
|
||||||
<h2>How to use it</h2>
|
<h2>How to use it</h2>
|
||||||
<p>The structure of the tab set is defined in html. There are two forms supported. Adding a class of <code class="inline">.tab-group</code> to the container element will work in place of the <code class="inline">tabset</code> tag, and the tab panels can be defined using either <code class="inline">tab=""</code> or <code class="inline">data-tab=""</code>. Passing an optional element to the init function will initialise tabs within that element. </p>
|
<p>The structure of the tab set is defined in html. There are two forms supported. Adding a class of <code class="inline">.tab-group</code> to the container element will work in place of the <code class="inline">tabset</code> tag, and the tab panels can be defined using either <code class="inline">tab=""</code> or <code class="inline">data-tab=""</code>. Passing an optional element to the init function will initialise tabs within that element. Adding a <code class="inline">order=""</code> or <code class="inline">data-order=""</code> element to the tabset you can have the tabs sorted in a consistent order across tabsets.</p>
|
||||||
<p>The tab initalize function now takes a new function parameter in the form of an third argument is an object that can take the following callbacks: </p>
|
<h2>Example</h2>
|
||||||
<ul>
|
<pre class="language-pug" tab="pug">tabset(order="tab2, tab1")
|
||||||
<li>altModifer (When the altKey is used)</li>
|
div(tab="tab1")
|
||||||
<li>shiftModifier (When the shift key is used)</li>
|
div(tab="tab2")
|
||||||
<li>metaModifier (When the Windows key or Apple key is used)</li>
|
</pre>
|
||||||
</ul>
|
|
||||||
<p>You can use these callbacks to create a custom event to get the tab information. </p>
|
|
||||||
<p>Note: There is a new core function (core.getTabPath) that will generate the query string and url hash for use in DS2 Core. You may wish to update your scaffolding.js file to make use of this functionality. </p>
|
|
||||||
<tabset id="tabs">
|
<tabset id="tabs">
|
||||||
<pre class="language-html" tab="html">
|
<pre class="language-html" tab="html">
|
||||||
<tabset id="uniqueID">
|
<tabset id="uniqueID" order="tab title 2,tab title 1">
|
||||||
<div tab="[tab title]"></div>
|
<div tab="[tab title 1]"></div>
|
||||||
<div tab="[tab title]"></div>
|
<div tab="[tab title 2]"></div>
|
||||||
</tabset></pre>
|
</tabset></pre>
|
||||||
<pre class="language-pug" tab="pug">tabset#uniqueID
|
<pre class="language-pug" tab="pug">tabset#uniqueID(order="tab title 2,tab title 1")
|
||||||
div(tab="[tab title]")
|
div(tab="[tab title 1]")
|
||||||
div(tab="[tab title]")
|
div(tab="[tab title 2]")
|
||||||
</pre>
|
</pre>
|
||||||
<pre class="language-css" tab="css">@media (min-width:450px){.tab-group,tabset{margin:2rem 0 1rem 0}}.tab-group>ul,tabset>ul{display:-webkit-box;display:-ms-flexbox;display:flex;margin:0;padding:0}.tab-group>ul li.separator,tabset>ul li.separator{border-bottom:1px solid #7f7f7f;border-left:1px solid #7f7f7f;display:inline-block;margin:0.45rem 0 0 0;width:100%}.tab-group .tab-hidden,tabset .tab-hidden{display:none}.tab-group [role=tab],tabset [role=tab]{background-color:#FFF;border-left:1px solid #7f7f7f;border-top:1px solid #7f7f7f;border-radius:0.5rem 0.5rem 0 0;cursor:pointer;margin:0;display:inline;padding:1rem 1.5rem 0.14rem 1.5rem;z-index:2}.tab-group [role=tab]:last-of-type,tabset [role=tab]:last-of-type{border-right:1px solid #7f7f7f}.tab-group [role=tab]:not(.selected),tabset [role=tab]:not(.selected){background-color:#f0f0f0;border-bottom:1px solid #7f7f7f}.tab-group [role=tab] span,tabset [role=tab] span{display:block;margin:0 0 0.5rem 0}.tab-group [role=tabpanel],tabset [role=tabpanel]{background-color:#FFF;border:1px solid #7f7f7f;border-top:none;padding:1rem;z-index:1}@media (min-width:450px){.tab-group [role=tabpanel][open] summary,tabset [role=tabpanel][open] summary{display:none}}@media (min-width:450px){.tab-group [role=tabpanel]:not(.open),tabset [role=tabpanel]:not(.open){display:none}}@media (max-width:450px){.tab-group:has(details) [role=tablist],tabset:has(details) [role=tablist]{display:none}.tab-group:has(details) [role=tabpanel],tabset:has(details) [role=tabpanel]{border:none}}</pre>
|
<pre class="language-css" tab="css">tabset, .tab-group {
|
||||||
|
margin: 2rem 0 1rem 0;
|
||||||
|
}
|
||||||
|
tabset [role=tablist], .tab-group [role=tablist] {
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
tabset [role=tablist] li.separator, .tab-group [role=tablist] li.separator {
|
||||||
|
border-bottom: 1px solid #7f7f7f;
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0.45rem 0 0 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
tabset [role=tablist] li[role=tab], .tab-group [role=tablist] li[role=tab] {
|
||||||
|
background-color: #FFF;
|
||||||
|
border-left: 1px solid #7f7f7f;
|
||||||
|
border-right: 1px solid #7f7f7f;
|
||||||
|
border-radius: 0.5rem 0.5rem 0 0;
|
||||||
|
border-top: 1px solid #7f7f7f;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline;
|
||||||
|
margin: 0;
|
||||||
|
padding: 1rem 1.5rem 0.14rem 1.5rem;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
tabset [role=tablist] li[role=tab]:last-of-type, .tab-group [role=tablist] li[role=tab]:last-of-type {
|
||||||
|
border-right: 1px solid #7f7f7f;
|
||||||
|
}
|
||||||
|
tabset [role=tablist] li[role=tab]:not(.selected), .tab-group [role=tablist] li[role=tab]:not(.selected) {
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
border-bottom: 1px solid #7f7f7f;
|
||||||
|
}
|
||||||
|
tabset [role=tablist] li[role=tab] span, .tab-group [role=tablist] li[role=tab] span {
|
||||||
|
display: block;
|
||||||
|
margin: 0 0 0.5rem 0;
|
||||||
|
}
|
||||||
|
tabset .tab-hidden, .tab-group .tab-hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
tabset [role=tabpanel], .tab-group [role=tabpanel] {
|
||||||
|
background-color: #FFF;
|
||||||
|
border: 1px solid #7f7f7f;
|
||||||
|
border-top: none;
|
||||||
|
padding: 1rem;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
tabset [role=tabpanel]:not(.open), .tab-group [role=tabpanel]:not(.open) {
|
||||||
|
display: none;
|
||||||
|
}</pre>
|
||||||
<div tab="scss">
|
<div tab="scss">
|
||||||
<pre class="language-sass">@import "scss/core/tabs/_tabs";
|
<h2>Example</h2>
|
||||||
|
<pre class="language-sass">@use "scss/core/tabs/_tabs";
|
||||||
@include tabs{
|
@include tabs{
|
||||||
// optional content block
|
// optional content block
|
||||||
};
|
};
|
||||||
@@ -52,46 +101,42 @@
|
|||||||
<pre class="language-sass">// DS2 core (c) 2024 Alexander McIlwraith
|
<pre class="language-sass">// DS2 core (c) 2024 Alexander McIlwraith
|
||||||
// Licensed under CC BY-SA 4.0
|
// Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
|
|
||||||
$tab-border: #7f7f7f !default;
|
$tab-border: #7f7f7f !default;
|
||||||
|
$tab-panel-background-color: #FFF !default;
|
||||||
|
$tab-panel-top-border: #7f7f7f !default;
|
||||||
|
$tab-panel-top-border-width: 1px !default;
|
||||||
$tab-selected: #FFF !default;
|
$tab-selected: #FFF !default;
|
||||||
|
$tab-selected-text: #000 !default;
|
||||||
$tab-notselected: #f0f0f0 !default;
|
$tab-notselected: #f0f0f0 !default;
|
||||||
$tab-break: 450px !default;
|
$tab-notselected-text: #000 !default;
|
||||||
|
|
||||||
@mixin tabs {
|
@mixin tabs {
|
||||||
tabset, .tab-group {
|
tabset, .tab-group {
|
||||||
@media (min-width: $tab-break) {
|
|
||||||
margin: 2rem 0 1rem 0;
|
margin: 2rem 0 1rem 0;
|
||||||
}
|
|
||||||
> ul {
|
[role="tablist"] {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
|
|
||||||
li.separator {
|
li {
|
||||||
|
&.separator {
|
||||||
border-bottom: 1px solid $tab-border;
|
border-bottom: 1px solid $tab-border;
|
||||||
border-left: 1px solid $tab-border;
|
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: .45rem 0 0 0;
|
margin: .45rem 0 0 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
&[role="tab"] {
|
||||||
|
|
||||||
.tab-hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
[role="tab"] {
|
|
||||||
background-color: $tab-selected;
|
background-color: $tab-selected;
|
||||||
border-left: 1px solid $tab-border;
|
border-left: 1px solid $tab-border;
|
||||||
border-top: 1px solid $tab-border;
|
border-right: 1px solid $tab-border;
|
||||||
border-radius: .5rem .5rem 0 0;
|
border-radius: .5rem .5rem 0 0;
|
||||||
|
border-top: 1px solid $tab-border;
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
margin: 0;
|
|
||||||
display: inline;
|
display: inline;
|
||||||
|
margin: 0;
|
||||||
padding: 1rem 1.5rem .14rem 1.5rem;
|
padding: 1rem 1.5rem .14rem 1.5rem;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
|
||||||
@@ -102,14 +147,21 @@ $tab-break: 450px !default;
|
|||||||
&:not(.selected) {
|
&:not(.selected) {
|
||||||
background-color: $tab-notselected;
|
background-color: $tab-notselected;
|
||||||
border-bottom: 1px solid $tab-border;
|
border-bottom: 1px solid $tab-border;
|
||||||
|
/// color
|
||||||
}
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
display: block;
|
display: block;
|
||||||
margin: 0 0 .5rem 0;
|
margin: 0 0 .5rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
[role="tabpanel"] {
|
[role="tabpanel"] {
|
||||||
background-color: $tab-selected;
|
background-color: $tab-selected;
|
||||||
border: 1px solid $tab-border;
|
border: 1px solid $tab-border;
|
||||||
@@ -117,39 +169,16 @@ $tab-break: 450px !default;
|
|||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
|
||||||
@media (min-width: $tab-break) {
|
|
||||||
&[open] summary {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: $tab-break) {
|
|
||||||
&:not(.open) {
|
&:not(.open) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@content;
|
@content;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: $tab-break) {
|
|
||||||
&:has(details) {
|
|
||||||
[role="tablist"] {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
[role="tabpanel"] {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}</pre>
|
}</pre>
|
||||||
</div>
|
</div>
|
||||||
<div tab="js">
|
<div tab="js">
|
||||||
|
<h2>Example</h2>
|
||||||
<pre class="language-js">import * as tabs from "./js/core/tabs/_tabs.js";
|
<pre class="language-js">import * as tabs from "./js/core/tabs/_tabs.js";
|
||||||
tabs.init();</pre>
|
tabs.init();</pre>
|
||||||
<pre class="language-js">/* DS2 core (c) 2024 Alexander McIlwraith
|
<pre class="language-js">/* DS2 core (c) 2024 Alexander McIlwraith
|
||||||
@@ -184,19 +213,29 @@ const waitForElement = (selector) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const chooseTab = (tab) => {
|
||||||
|
const siblings = Array.from(tab.parentNode.children);
|
||||||
|
siblings.forEach(sibling => sibling.classList.remove("selected"));
|
||||||
|
tab.classList.add("selected");
|
||||||
|
|
||||||
|
const tabPanels = Array.from(tab.parentNode.parentNode.children)
|
||||||
|
tabPanels.forEach(panel => panel.classList.remove("open"));
|
||||||
|
|
||||||
|
const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
||||||
|
document.getElementById(tabPanelId).classList.add("open");
|
||||||
|
}
|
||||||
|
|
||||||
|
let pushState = 0;
|
||||||
let tabsetCount = 0;
|
let tabsetCount = 0;
|
||||||
|
|
||||||
export function init(container = document, spacer = true, args = {}) {
|
export function init(container = document, spacer = true, args = {}) {
|
||||||
|
|
||||||
container.querySelectorAll(".tab-group, tabset").forEach(tabGroup => {
|
container.querySelectorAll(".tab-group, tabset").forEach(tabGroup => {
|
||||||
|
|
||||||
if (tabGroup.querySelector("[role=tablist]") === null) {
|
if (tabGroup.querySelector("[role=tablist]") === null) {
|
||||||
if (tabGroup.getAttribute("id") == null) {
|
if (tabGroup.getAttribute("id") == null) {
|
||||||
tabGroup.setAttribute("id", "tab-group-" + tabsetCount);
|
tabGroup.setAttribute("id", "tab-group-" + tabsetCount);
|
||||||
tabsetCount++;
|
tabsetCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const tabgroup = tabGroup.getAttribute("id");
|
const tabgroup = tabGroup.getAttribute("id");
|
||||||
let tablist = "";
|
let tablist = "";
|
||||||
|
|
||||||
@@ -229,8 +268,7 @@ export function init(container = document, spacer = true, args = {}) {
|
|||||||
tabPanel.setAttribute("tabindex", "0");
|
tabPanel.setAttribute("tabindex", "0");
|
||||||
tabPanel.setAttribute("aria-labelledby", `tab-${tabgroup}-${tabID}`);
|
tabPanel.setAttribute("aria-labelledby", `tab-${tabgroup}-${tabID}`);
|
||||||
child.parentNode.replaceChild(tabPanel, child);
|
child.parentNode.replaceChild(tabPanel, child);
|
||||||
let cls = tablist === "" ? "class='selected'" : "";
|
tablist += `<li tabindex="0" role="tab" id="tab-${tabgroup}-${tabID}"><span>${tab}</span></li>`;
|
||||||
tablist += `<li tabindex="0" role="tab" ${cls} id="tab-${tabgroup}-${tabID}"><span>${tab}</span></li>`;
|
|
||||||
} else {
|
} else {
|
||||||
child.classList.add("tab-hidden");
|
child.classList.add("tab-hidden");
|
||||||
}
|
}
|
||||||
@@ -238,39 +276,41 @@ export function init(container = document, spacer = true, args = {}) {
|
|||||||
|
|
||||||
const ul = document.createElement('ul');
|
const ul = document.createElement('ul');
|
||||||
ul.setAttribute("role", "tablist");
|
ul.setAttribute("role", "tablist");
|
||||||
ul.innerHTML = spacer != true ? `${tablist}` : `${tablist}<li role="separator" class="separator"></li>`;
|
|
||||||
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
||||||
|
ul.innerHTML = spacer != true ? `${tablist}` : `${tablist}<li role="separator" class="separator"></li>`;
|
||||||
|
|
||||||
|
if ( tabGroup.hasAttribute("order") || tabGroup.hasAttribute("data-order") ) {
|
||||||
|
let order = (tabGroup.getAttribute("order") || tabGroup.getAttribute("data-order")).split(",");
|
||||||
|
|
||||||
|
const items = Array.from(ul.getElementsByTagName("li"));
|
||||||
|
items.sort((a, b) => {
|
||||||
|
console.log("here")
|
||||||
|
const aa = order.indexOf(a.textContent.trim());
|
||||||
|
const bb = order.indexOf(b.textContent.trim());
|
||||||
|
|
||||||
|
// Check if both items exist in orderArray
|
||||||
|
if (aa === -1) return 1; // Move to the end if not found
|
||||||
|
if (bb === -1) return -1; // Move to the end if not found
|
||||||
|
|
||||||
|
return aa - bb; // Sort based on the defined order
|
||||||
|
});
|
||||||
|
|
||||||
|
ul.innerHTML = '';
|
||||||
|
items.forEach(item => ul.appendChild(item));
|
||||||
|
}
|
||||||
|
|
||||||
tabGroup.querySelectorAll('[role="tab"]').forEach(tab => {
|
tabGroup.querySelectorAll('[role="tab"]').forEach(tab => {
|
||||||
tab.addEventListener("click", (evt) => {
|
tab.addEventListener("click", (evt) => {
|
||||||
// if (evt.altKey && typeof args.altModifier == "function") {
|
if (pushState == 0) {
|
||||||
// args.altModifier(tab, evt);
|
window.history.pushState({rand: Math.random(), pushState: pushState, tab: tab.parentNode.firstChild.getAttribute("id")}, "", `#${tab.parentNode.firstChild.getAttribute("id")}`);
|
||||||
// } else if (evt.shiftKey && typeof args.shiftModifier == "function") {
|
pushState++;
|
||||||
// args.shiftModifier(tab, evt);
|
}
|
||||||
// } else if (evt.metaKey && typeof args.metaModifier == "function") {
|
|
||||||
// args.metaModifier(tab, evt);
|
|
||||||
// } else {
|
|
||||||
const siblings = Array.from(tab.parentNode.children);
|
|
||||||
siblings.forEach(sibling => sibling.classList.remove("selected"));
|
|
||||||
tab.classList.add("selected");
|
|
||||||
|
|
||||||
|
chooseTab(evt.currentTarget);
|
||||||
let urlPath = window.location;
|
window.history.pushState({rand: Math.random(), pushState: pushState, tab: tab.getAttribute("id")}, "", `#${tab.getAttribute("id")}`);
|
||||||
urlPath.hash = evt.currentTarget.getAttribute("id");
|
pushState++;
|
||||||
window.history.pushState({"pageTitle": window.title + " : " + evt.currentTarget.innerHTML},"", urlPath.toString());
|
|
||||||
// window.history.pushState({"html":response.html,"pageTitle":response.pageTitle},"", urlPath);
|
|
||||||
|
|
||||||
|
|
||||||
const tabPanels = Array.from(tab.parentNode.parentNode.children)
|
|
||||||
.filter(child => child.getAttribute("role") === "tabpanel");
|
|
||||||
tabPanels.forEach(panel => panel.classList.remove("open"));
|
|
||||||
|
|
||||||
const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
|
||||||
document.getElementById(tabPanelId).classList.add("open");
|
|
||||||
//}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
tab.addEventListener("keypress", (e) => {
|
tab.addEventListener("keypress", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if( e.which == 32 || e.which == 13 ) {
|
if( e.which == 32 || e.which == 13 ) {
|
||||||
@@ -278,26 +318,28 @@ export function init(container = document, spacer = true, args = {}) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
ul.querySelector("li").classList.add("selected");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.location.hash != "" && document.location.hash.substring(0,5) == "#tab-") {
|
if (document.location.hash != "" && document.location.hash.substring(0,5) == "#tab-") {
|
||||||
waitForElement(document.location.hash).then((el) => {
|
waitForElement(document.location.hash).then((el) => {
|
||||||
el.scrollIntoView();
|
//el.scrollIntoView();
|
||||||
el.focus();
|
el.focus();
|
||||||
el.dispatchEvent(click);
|
el.dispatchEvent(click);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
addEventListener("hashchange", (evt) => {
|
window.addEventListener("popstate", function (e) {
|
||||||
document.querySelector(window.location.hash).dispatchEvent(click);
|
e.preventDefault();
|
||||||
|
if (e.state != null) {
|
||||||
// window.location.hash
|
chooseTab(document.querySelector(`#${e.state.tab}`));
|
||||||
// console.log(window.location.hash)
|
} else {
|
||||||
})
|
history.go(-1);
|
||||||
|
}
|
||||||
|
});
|
||||||
}</pre>
|
}
|
||||||
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</tabset>
|
</tabset>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -2,6 +2,13 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Pattern</title>
|
<title>Pattern</title>
|
||||||
|
<script>
|
||||||
|
let u = document.location.href.substring(0, document.location.href.search(/patterns/i));
|
||||||
|
let p = document.location.pathname.substring(document.location.pathname.search(/patterns/i));
|
||||||
|
p = p.replace(/\/$|\/index\.html/i, "").substring(9);
|
||||||
|
window.location = u + "?p=" + p;
|
||||||
|
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body data-prismjs-copy-timeout="1500">
|
<body data-prismjs-copy-timeout="1500">
|
||||||
<h2>What is it</h2>
|
<h2>What is it</h2>
|
||||||
@@ -36,6 +43,7 @@
|
|||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
color: #000;
|
color: #000;
|
||||||
|
display: none;
|
||||||
-webkit-filter: drop-shadow(0 3px 3px hsla(0, 0%, 0%, 0.15)) drop-shadow(0 12px 12px hsla(0, 0%, 0%, 0.15));
|
-webkit-filter: drop-shadow(0 3px 3px hsla(0, 0%, 0%, 0.15)) drop-shadow(0 12px 12px hsla(0, 0%, 0%, 0.15));
|
||||||
filter: drop-shadow(0 3px 3px hsla(0, 0%, 0%, 0.15)) drop-shadow(0 12px 12px hsla(0, 0%, 0%, 0.15));
|
filter: drop-shadow(0 3px 3px hsla(0, 0%, 0%, 0.15)) drop-shadow(0 12px 12px hsla(0, 0%, 0%, 0.15));
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
@@ -162,6 +170,7 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
:has(> [role=tooltip]):is(:hover, :focus-visible, :active) > [role=tooltip] {
|
:has(> [role=tooltip]):is(:hover, :focus-visible, :active) > [role=tooltip] {
|
||||||
|
display: block;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
-webkit-transition-delay: 300ms;
|
-webkit-transition-delay: 300ms;
|
||||||
transition-delay: 300ms;
|
transition-delay: 300ms;
|
||||||
@@ -182,11 +191,13 @@
|
|||||||
}
|
}
|
||||||
}</pre>
|
}</pre>
|
||||||
<div tab="scss">
|
<div tab="scss">
|
||||||
<pre class="language-sass">@import "scss/core/tooltip/_tooltip";
|
<h2>Example</h2>
|
||||||
|
<pre class="language-sass">@use "scss/core/tooltip/_tooltip";
|
||||||
@include tooltip;</pre>
|
@include tooltip;</pre>
|
||||||
<pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
|
<pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
//- Licensed under CC BY-SA 4.0
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
|
$font-body: sans-serif !default;
|
||||||
$tooltip-border-radius: .5rem !default;
|
$tooltip-border-radius: .5rem !default;
|
||||||
$tooltip-dark-allow: true !default;
|
$tooltip-dark-allow: true !default;
|
||||||
$tooltip-dark-background: #1f2127 !default;
|
$tooltip-dark-background: #1f2127 !default;
|
||||||
@@ -214,7 +225,9 @@ $tooltip-pointer-top: conic-gradient(from 150deg at top, rgba(0, 0, 0, 0), #000
|
|||||||
background: $tooltip-light-background;
|
background: $tooltip-light-background;
|
||||||
border-radius: $tooltip-border-radius;
|
border-radius: $tooltip-border-radius;
|
||||||
color: $tooltip-light-foreground;
|
color: $tooltip-light-foreground;
|
||||||
|
display: none;
|
||||||
filter: $tooltip-light-drop-shadow;
|
filter: $tooltip-light-drop-shadow;
|
||||||
|
$font-family: $font-body;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
inline-size: max-content;
|
inline-size: max-content;
|
||||||
@@ -336,6 +349,7 @@ $tooltip-pointer-top: conic-gradient(from 150deg at top, rgba(0, 0, 0, 0), #000
|
|||||||
:has(> [role="tooltip"]) {
|
:has(> [role="tooltip"]) {
|
||||||
position: relative;
|
position: relative;
|
||||||
&:is(:hover, :focus-visible, :active) > [role="tooltip"] {
|
&:is(:hover, :focus-visible, :active) > [role="tooltip"] {
|
||||||
|
display: block;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transition-delay: 300ms;
|
transition-delay: 300ms;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
- var site = "DS2 core"
|
- var site = "DS2 core"
|
||||||
- var lang = "en-uk"
|
- var lang = "en-uk"
|
||||||
- var colorpfx = "colour"
|
- var colorpfx = "colour"
|
||||||
- var headings = ["What is it", "When to use it", "How to use it"]
|
- var headings = ["What is it", "When to use it", "How to use it", "Example"]
|
||||||
|
- var downloadExtensions = ["js", "pug", "scss"]
|
||||||
- var generateColourToken = ["colours"]
|
- var generateColourToken = ["colours"]
|
||||||
|
|
||||||
-
|
-
|
||||||
@@ -49,7 +50,7 @@
|
|||||||
core: true,
|
core: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "breakpoints",
|
name: "breakpoint",
|
||||||
status: "complete",
|
status: "complete",
|
||||||
core: true,
|
core: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ mixin colour-samples(colors, theid)
|
|||||||
notes= colors[i].note
|
notes= colors[i].note
|
||||||
- }
|
- }
|
||||||
|
|
||||||
div.tab-group(id= theid )
|
tabset(id= theid order= taborder)
|
||||||
- csstab = csstab == undefined ? "css" : csstab
|
- csstab = csstab == undefined ? "css" : csstab
|
||||||
- scsstab = scsstab == undefined ? "scss" : scsstab
|
- scsstab = scsstab == undefined ? "scss" : scsstab
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
display: grid;
|
display: grid;
|
||||||
gap: .5rem;
|
gap: .5rem;
|
||||||
grid-template-columns: repeat(3, 1fr);
|
grid-template-columns: repeat(3, 1fr);
|
||||||
grid-template-rows: 2.5rem repeat(2, max-content);
|
grid-template-rows: repeat(3, max-content);
|
||||||
.result {
|
.result {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border-radius: .5rem;
|
border-radius: .5rem;
|
||||||
|
|||||||
@@ -73,6 +73,9 @@ html(lang= lang )
|
|||||||
|
|
||||||
|
|
||||||
a.skip(href="#main") Skip to main content
|
a.skip(href="#main") Skip to main content
|
||||||
|
|
||||||
|
block top
|
||||||
|
|
||||||
div.container
|
div.container
|
||||||
|
|
||||||
block header
|
block header
|
||||||
@@ -83,4 +86,8 @@ html(lang= lang )
|
|||||||
each category in content
|
each category in content
|
||||||
+show-content(category, "")
|
+show-content(category, "")
|
||||||
|
|
||||||
|
block footer
|
||||||
|
|
||||||
|
block bottom
|
||||||
|
|
||||||
script(src="assets/scaffolding-min.js")
|
script(src="assets/scaffolding-min.js")
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
|
include ../_config.pug
|
||||||
|
|
||||||
|
if typeof downloadExtensions == "undefined"
|
||||||
|
- var extensions = `["js", "scss", "hello"]`
|
||||||
|
else
|
||||||
|
- var extensions = []
|
||||||
|
each ext in downloadExtensions
|
||||||
|
- extensions.push("'" + ext + "'")
|
||||||
|
- extensions = "[" + extensions + "]"
|
||||||
|
|
||||||
-
|
-
|
||||||
var php = `<?php
|
var php = `<?php
|
||||||
function recursor($dir, $type) {
|
function recursor($dir, $type) {
|
||||||
@@ -25,7 +35,7 @@
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
$allowed_types = ["scss", "js"];
|
$allowed_types = {{extensions}};
|
||||||
$patterns = dirname(dirname(__file__)) . "/src/pg/patterns";
|
$patterns = dirname(dirname(__file__)) . "/src/pg/patterns";
|
||||||
|
|
||||||
|
|
||||||
@@ -50,5 +60,7 @@
|
|||||||
|
|
||||||
header('Content-type: application/zip');
|
header('Content-type: application/zip');
|
||||||
header(sprintf('Content-Disposition: attachment; filename="%s.zip"', $type));
|
header(sprintf('Content-Disposition: attachment; filename="%s.zip"', $type));
|
||||||
echo(file_get_contents($t)); ?>`
|
echo(file_get_contents($t)); ?>`.replace("{{extensions}}", extensions)
|
||||||
| !{php}
|
| !{php}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
//- DS2 core (c) 2024 Alexander McIlwraith
|
//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
//- Licensed under CC BY-SA 4.0
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
|
@use 'sass:map';
|
||||||
|
@use 'sass:string';
|
||||||
|
|
||||||
// default breakpoints match bootstrap 5 breakpoints.
|
// default breakpoints match bootstrap 5 breakpoints.
|
||||||
$grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 1400px ) !default;
|
$grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 1400px ) !default;
|
||||||
|
|
||||||
@@ -38,30 +41,30 @@ $grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 14
|
|||||||
$min: 0;
|
$min: 0;
|
||||||
$max: 0;
|
$max: 0;
|
||||||
|
|
||||||
@if str-length($bp) == 2 {
|
@if string.length($bp) == 2 {
|
||||||
|
|
||||||
// only a single break point was received
|
// only a single break point was received
|
||||||
$min: map-get($points, $bp);
|
$min: map.get($points, $bp);
|
||||||
$max: map-get($points, nth(map-keys($points), index(map-keys($points), $bp) + 1));
|
$max: map.get($points, nth(map.keys($points), index(map.keys($points), $bp) + 1));
|
||||||
|
|
||||||
} @else {
|
} @else {
|
||||||
|
|
||||||
|
|
||||||
@if str-slice($bp, 0, 1) == "-" {
|
@if string.slice($bp, 0, 1) == "-" {
|
||||||
// no lower breakpoint was received
|
// no lower breakpoint was received
|
||||||
$min: null;
|
$min: null;
|
||||||
$max: map-get($points, str-slice($bp, 2, 3));
|
$max: map.get($points, string.slice($bp, 2, 3));
|
||||||
|
|
||||||
} @else {
|
} @else {
|
||||||
|
|
||||||
$min: map-get($points, unquote(str-slice($bp, 0, 2)));
|
$min: map.get($points, string.unquote(string.slice($bp, 0, 2)));
|
||||||
|
|
||||||
|
|
||||||
@if str-length($bp) == 3 {
|
@if string.length($bp) == 3 {
|
||||||
// no upper break point was received
|
// no upper break point was received
|
||||||
$max: null;
|
$max: null;
|
||||||
} @else {
|
} @else {
|
||||||
$max: map-get($points, str-slice($bp, 4, 5));
|
$max: map.get($points, string.slice($bp, 4, 5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,14 +17,14 @@ block content
|
|||||||
|
|
||||||
p When using this, use the default break points as they are set to the same as the Bootstrap framework. The grid for the design system at large break point has been widened to accompdate 3 colour cards across.
|
p When using this, use the default break points as they are set to the same as the Bootstrap framework. The grid for the design system at large break point has been widened to accompdate 3 colour cards across.
|
||||||
|
|
||||||
tabset#breakpoints
|
tabset#breakpoints(order= taborder)
|
||||||
div(tab="scss")
|
div(tab="scss")
|
||||||
+h(3)
|
+h(3)
|
||||||
pre.language-sass.
|
pre.language-sass.
|
||||||
@import "scss/core/breakpoints/breakpoints";
|
@use "scss/core/breakpoint/breakpoint";
|
||||||
@include break([breakpoint]) {
|
@include breapoint.break([breakpoint]) {
|
||||||
// css here
|
// css here
|
||||||
}
|
}
|
||||||
+h(4)
|
+h(4)
|
||||||
pre.language-sass
|
pre.language-sass
|
||||||
include _breakpoints.scss
|
include _breakpoint.scss
|
||||||
@@ -1 +1,53 @@
|
|||||||
header{display:-ms-grid;display:grid;-ms-grid-rows:1.75rem 3.5rem;grid-template-rows:1.75rem 3.5rem;-ms-grid-column:2;-ms-grid-column-span:2;grid-column:2/4;overflow:hidden}header svg{grid-column:1/-1;grid-row:1/-1;-ms-grid-row-align:stretch;-ms-grid-column-align:stretch;place-self:stretch}header svg text{-webkit-transform:translate(-1rem,7.25rem);-ms-transform:translate(-1rem,7.25rem);transform:translate(-1rem,7.25rem);font-size:10rem;font-weight:1000;font-family:sans-serif;fill:var(--colour-grey-xxl)}header>div{-ms-grid-row:2;grid-row:2;grid-column:1/-1;display:-ms-grid;display:grid;grid-column-gap:1rem;-ms-grid-columns:auto -webkit-max-content -webkit-max-content;-ms-grid-columns:auto max-content max-content;grid-template-columns:auto -webkit-max-content -webkit-max-content;grid-template-columns:auto max-content max-content}header>div .header-title h1{margin:0;padding:0 1rem}header>div .header-title h1 a,header>div .header-title h1 a:visited{border-bottom:none;color:var(--colour-black);font-family:sans-serif;font-size:2.5rem;font-size:32px;font-weight:700;margin:0;padding:0;text-decoration:none}
|
header {
|
||||||
|
display: -ms-grid;
|
||||||
|
display: grid;
|
||||||
|
-ms-grid-rows: 1.75rem 3.5rem;
|
||||||
|
grid-template-rows: 1.75rem 3.5rem;
|
||||||
|
-ms-grid-column: 2;
|
||||||
|
-ms-grid-column-span: 2;
|
||||||
|
grid-column: 2/4;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
header svg {
|
||||||
|
grid-column: 1/-1;
|
||||||
|
grid-row: 1/-1;
|
||||||
|
-ms-grid-row-align: stretch;
|
||||||
|
-ms-grid-column-align: stretch;
|
||||||
|
place-self: stretch;
|
||||||
|
}
|
||||||
|
header svg text {
|
||||||
|
-webkit-transform: translate(-1rem, 7.25rem);
|
||||||
|
-ms-transform: translate(-1rem, 7.25rem);
|
||||||
|
transform: translate(-1rem, 7.25rem);
|
||||||
|
font-size: 10rem;
|
||||||
|
font-weight: 1000;
|
||||||
|
font-family: sans-serif;
|
||||||
|
fill: var(--colour-grey-xxl);
|
||||||
|
}
|
||||||
|
header > div {
|
||||||
|
-ms-grid-row: 2;
|
||||||
|
grid-row: 2;
|
||||||
|
grid-column: 1/-1;
|
||||||
|
display: -ms-grid;
|
||||||
|
display: grid;
|
||||||
|
grid-column-gap: 1rem;
|
||||||
|
-ms-grid-columns: auto -webkit-max-content -webkit-max-content;
|
||||||
|
-ms-grid-columns: auto max-content max-content;
|
||||||
|
grid-template-columns: auto -webkit-max-content -webkit-max-content;
|
||||||
|
grid-template-columns: auto max-content max-content;
|
||||||
|
}
|
||||||
|
header > div .header-title h1 {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0 1rem;
|
||||||
|
}
|
||||||
|
header > div .header-title h1 a, header > div .header-title h1 a:visited {
|
||||||
|
border-bottom: none;
|
||||||
|
color: var(--colour-black);
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 2.5rem;
|
||||||
|
font-size: 32px;
|
||||||
|
font-weight: 700;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
@@ -5,5 +5,5 @@
|
|||||||
|
|
||||||
// this file should not be minified
|
// this file should not be minified
|
||||||
|
|
||||||
@import "_header.scss";
|
@use "_header.scss";
|
||||||
@include header;
|
@include header.header;
|
||||||
@@ -12,7 +12,7 @@ block content
|
|||||||
+h(2)
|
+h(2)
|
||||||
p Place the header at the top of the page after the skip to main content link. You will likely want to replace core header should be replaced with your own site's header. To do this, remove the #[code.inline.language-js core: true ] and create your own pattern in the location you wish it in your design system.
|
p Place the header at the top of the page after the skip to main content link. You will likely want to replace core header should be replaced with your own site's header. To do this, remove the #[code.inline.language-js core: true ] and create your own pattern in the location you wish it in your design system.
|
||||||
|
|
||||||
tabset#header
|
tabset#header(order= taborder)
|
||||||
pre.language-html(tab="html")
|
pre.language-html(tab="html")
|
||||||
// create temp variables and store the design system values
|
// create temp variables and store the design system values
|
||||||
- var tmpsite= site
|
- var tmpsite= site
|
||||||
@@ -32,7 +32,7 @@ block content
|
|||||||
div.language-sass(tab="scss")
|
div.language-sass(tab="scss")
|
||||||
|
|
||||||
pre.language-sass.
|
pre.language-sass.
|
||||||
@import "scss/core/header/header;
|
@use "scss/core/header/header;
|
||||||
|
|
||||||
pre.language-sass
|
pre.language-sass
|
||||||
include _header.scss
|
include _header.scss
|
||||||
@@ -6,13 +6,13 @@ block content
|
|||||||
-
|
-
|
||||||
- let list = []
|
- let list = []
|
||||||
- for(let i = 0; i < content.length; i++) {
|
- for(let i = 0; i < content.length; i++) {
|
||||||
- list.push({ "name": content[i].name, "path": content[i].name, "status": content[i].status, "display": (content[i].hasOwnProperty("display") && content[i].display != "" ? content[i].display : content[i].name.toSentenceCase().toContent()) } )
|
- list.push({ "name": content[i].name, "core": (typeof content[i].core != 'undefined' && content[i].core ? 'true' : 'false'), "path": content[i].name, "status": content[i].status, "display": (content[i].hasOwnProperty("display") && content[i].display != "" ? content[i].display : content[i].name.toSentenceCase().toContent()) } )
|
||||||
- if (content[i].files != undefined) {
|
- if (content[i].files != undefined) {
|
||||||
- for (let ii = 0; ii < content[i].files.length; ii++) {
|
- for (let ii = 0; ii < content[i].files.length; ii++) {
|
||||||
- list.push({ "name": content[i].files[ii].name, "path": content[i].name +"."+ content[i].files[ii].name, "status": content[i].files[ii].status, "display": (content[i].files[ii].hasOwnProperty("display") && content[i].files[ii].display != "" ? content[i].files[ii].display : content[i].files[ii].name.toSentenceCase().toContent()) } )
|
- list.push({ "name": content[i].files[ii].name, "core": (typeof content[i].files[ii].core != 'undefined' && content[i].files[ii].core ? 'true' : 'false'), "path": content[i].name +"."+ content[i].files[ii].name, "status": content[i].files[ii].status, "display": (content[i].files[ii].hasOwnProperty("display") && content[i].files[ii].display != "" ? content[i].files[ii].display : content[i].files[ii].name.toSentenceCase().toContent()) } )
|
||||||
- if (content[i].files[ii].files != undefined) {
|
- if (content[i].files[ii].files != undefined) {
|
||||||
- for (let iii = 0; iii < content[i].files[ii].files.length; iii++) {
|
- for (let iii = 0; iii < content[i].files[ii].files.length; iii++) {
|
||||||
- list.push({ "name": content[i].files[ii].files[iii].name, "path": content[i].name +"."+ content[i].files[ii].name + "." + content[i].files[ii].files[iii].name, "status": content[i].files[ii].files[iii].status, "display": (content[i].files[ii].files[iii].hasOwnProperty("display") && content[i].files[ii].files[iii].display != "" ? content[i].files[ii].files[iii].display : content[i].files[ii].files[iii].name.toSentenceCase().toContent()) } )
|
- list.push({ "name": content[i].files[ii].files[iii].name, "core": (typeof content[i].files[ii].files[iii].core != 'undefined' && content[i].files[ii].files[iii].core ? 'true' : 'false'), "path": content[i].name +"."+ content[i].files[ii].name + "." + content[i].files[ii].files[iii].name, "status": content[i].files[ii].files[iii].status, "display": (content[i].files[ii].files[iii].hasOwnProperty("display") && content[i].files[ii].files[iii].display != "" ? content[i].files[ii].files[iii].display : content[i].files[ii].files[iii].name.toSentenceCase().toContent()) } )
|
||||||
- }
|
- }
|
||||||
- }
|
- }
|
||||||
- }
|
- }
|
||||||
@@ -49,7 +49,7 @@ block content
|
|||||||
- return count;
|
- return count;
|
||||||
- }
|
- }
|
||||||
|
|
||||||
div.tab-group#status-report
|
tabset#status-report(order= taborder)
|
||||||
div.status-report.status-report-structure(data-tab="by structure")
|
div.status-report.status-report-structure(data-tab="by structure")
|
||||||
table.custom(role="presentation")
|
table.custom(role="presentation")
|
||||||
tbody
|
tbody
|
||||||
@@ -64,6 +64,9 @@ block content
|
|||||||
else
|
else
|
||||||
| !{category.name.toContent().toSentenceCase()}
|
| !{category.name.toContent().toSentenceCase()}
|
||||||
td
|
td
|
||||||
|
if typeof category.core && category.core
|
||||||
|
span.status-complete Complete (Core)
|
||||||
|
else
|
||||||
span(class="status-" + category.status)= category.status.toContent().toSentenceCase()
|
span(class="status-" + category.status)= category.status.toContent().toSentenceCase()
|
||||||
|
|
||||||
|
|
||||||
@@ -77,6 +80,9 @@ block content
|
|||||||
else
|
else
|
||||||
| !{pattern.name.toContent().toSentenceCase()}
|
| !{pattern.name.toContent().toSentenceCase()}
|
||||||
td
|
td
|
||||||
|
if typeof pattern.core && pattern.core
|
||||||
|
span.status-complete Complete (Core)
|
||||||
|
else
|
||||||
span(class="status-" + pattern.status)= pattern.status.toContent().toSentenceCase()
|
span(class="status-" + pattern.status)= pattern.status.toContent().toSentenceCase()
|
||||||
|
|
||||||
if pattern.files
|
if pattern.files
|
||||||
@@ -90,14 +96,22 @@ block content
|
|||||||
else
|
else
|
||||||
| !{sub.name.toContent().toSentenceCase()}
|
| !{sub.name.toContent().toSentenceCase()}
|
||||||
td
|
td
|
||||||
|
if typeof sub.core && sub.core
|
||||||
|
span.status-complete Complete (Core)
|
||||||
|
else
|
||||||
span(class="status-" + sub.status)= sub.status.toContent().toSentenceCase()
|
span(class="status-" + sub.status)= sub.status.toContent().toSentenceCase()
|
||||||
|
|
||||||
div.status-report.status-report-status(data-tab="by status")
|
div.status-report.status-report-status(data-tab="by status")
|
||||||
table(role="presentation")
|
table(role="presentation")
|
||||||
|
|
||||||
tbody
|
tbody
|
||||||
|
- bystatus = list;
|
||||||
|
- for(i=0; i < bystatus.length; i++) {
|
||||||
|
- if (bystatus[i].core == "true") {
|
||||||
|
- bystatus[i].status = "complete"
|
||||||
|
- }
|
||||||
|
- }
|
||||||
each status in statuses || []
|
each status in statuses || []
|
||||||
- out = list.filter(list => list.status === status.name)
|
- out = bystatus.filter(list => list.status === status.name)
|
||||||
tr
|
tr
|
||||||
td(colspan="2")
|
td(colspan="2")
|
||||||
span(class="status-" + status.name)= status.name.toContent().toSentenceCase() + " (" + out.length + ")"
|
span(class="status-" + status.name)= status.name.toContent().toSentenceCase() + " (" + out.length + ")"
|
||||||
@@ -110,6 +124,9 @@ block content
|
|||||||
| !{item.display}
|
| !{item.display}
|
||||||
else
|
else
|
||||||
| !{item.name.toContent().toSentenceCase()}
|
| !{item.name.toContent().toSentenceCase()}
|
||||||
|
td
|
||||||
|
if item.core == "true"
|
||||||
|
span (core)
|
||||||
td= getCategory(item.path)
|
td= getCategory(item.path)
|
||||||
|
|
||||||
div.status-report.status-report-alpha(data-tab="alphabetical")
|
div.status-report.status-report-alpha(data-tab="alphabetical")
|
||||||
@@ -125,6 +142,9 @@ block content
|
|||||||
| !{item.name.toContent().toSentenceCase()}
|
| !{item.name.toContent().toSentenceCase()}
|
||||||
td
|
td
|
||||||
span
|
span
|
||||||
|
if item.core == "true"
|
||||||
|
span.status-complete Complete (Core)
|
||||||
|
else
|
||||||
span(class="status-" + item.status)= item.status.toContent().toTitleCase()
|
span(class="status-" + item.status)= item.status.toContent().toTitleCase()
|
||||||
td= getCategory(item.path)
|
td= getCategory(item.path)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
@use 'sass:color';
|
@use 'sass:color';
|
||||||
@use "sass:map";
|
@use "sass:map";
|
||||||
@use 'sass:list';
|
@use 'sass:list';
|
||||||
@import url('https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap');
|
// @import url('https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap');
|
||||||
|
|
||||||
$sticky-colors: (
|
$sticky-colors: (
|
||||||
"yellow": #ffffd3,
|
"yellow": #ffffd3,
|
||||||
@@ -112,34 +112,52 @@ $sticky-colors: (
|
|||||||
|
|
||||||
// default colour
|
// default colour
|
||||||
> div:nth-child(2) {
|
> div:nth-child(2) {
|
||||||
$sticky-color: nth(map.values($sticky-colors), 1);
|
$sticky-color: list.nth(map.values($sticky-colors), 1);
|
||||||
|
// background: linear-gradient(
|
||||||
|
// 180deg,
|
||||||
|
// lighten($sticky-color, 2%) 0%,
|
||||||
|
// $sticky-color 2%,
|
||||||
|
// $sticky-color 12%,
|
||||||
|
// darken($sticky-color, 2%) 75%,
|
||||||
|
// darken($sticky-color, 5%) 100%
|
||||||
|
// );
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
180deg,
|
180deg,
|
||||||
lighten($sticky-color, 2%) 0%,
|
color.adjust($sticky-color, $lightness: 2%) 0%,
|
||||||
$sticky-color 2%,
|
$sticky-color 2%,
|
||||||
$sticky-color 12%,
|
$sticky-color 12%,
|
||||||
darken($sticky-color, 2%) 75%,
|
color.adjust($sticky-color, $lightness: -2%) 75%,
|
||||||
darken($sticky-color, 5%) 100%
|
color.adjust($sticky-color, $lightness: -5%) 100%
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// all class colors
|
// all class colors
|
||||||
@each $class, $sticky-color in $sticky-colors {
|
@each $class, $sticky-color in $sticky-colors {
|
||||||
&.#{$class} > div:nth-child(2) {
|
&.#{$class} > div:nth-child(2) {
|
||||||
@if $class != nth(map.keys($sticky-colors), 1) {
|
@if $class != list.nth(map.keys($sticky-colors), 1) {
|
||||||
|
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
180deg,
|
180deg,
|
||||||
lighten($sticky-color, 2%) 0%,
|
color.adjust($sticky-color, $lightness: 2%) 0%,
|
||||||
$sticky-color 2%,
|
$sticky-color 2%,
|
||||||
$sticky-color 12%,
|
$sticky-color 12%,
|
||||||
darken($sticky-color, 2%) 75%,
|
color.adjust($sticky-color, $lightness: -2%) 75%,
|
||||||
darken($sticky-color, 5%) 100%
|
color.adjust($sticky-color, $lightness: -5%) 100%
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// background: linear-gradient(
|
||||||
|
// 180deg,
|
||||||
|
// lighten($sticky-color, 2%) 0%,
|
||||||
|
// $sticky-color 2%,
|
||||||
|
// $sticky-color 12%,
|
||||||
|
// darken($sticky-color, 2%) 75%,
|
||||||
|
// darken($sticky-color, 5%) 100%
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&:has(sticky-note:hover) {
|
&:has(sticky-note:hover) {
|
||||||
background-color: #{nth(map.values($sticky-colors), 1)};
|
background-color: #{list.nth(map.values($sticky-colors), 1)};
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ block content
|
|||||||
p If you wish to create a custom element, that extends another HTML element, the native element has to be extended in customElements.define(). Custom elements that inherit native elements are also known as "type extension custom elements".
|
p If you wish to create a custom element, that extends another HTML element, the native element has to be extended in customElements.define(). Custom elements that inherit native elements are also known as "type extension custom elements".
|
||||||
|
|
||||||
|
|
||||||
tabset#sticky-note
|
tabset#sticky-note(order= taborder)
|
||||||
pre.language-html(tab="html")
|
pre.language-html(tab="html")
|
||||||
include _sticky-note.pug
|
include _sticky-note.pug
|
||||||
pre.language-pug(tab="pug")
|
pre.language-pug(tab="pug")
|
||||||
@@ -26,7 +26,7 @@ block content
|
|||||||
+h(3)
|
+h(3)
|
||||||
pre.language-sass.
|
pre.language-sass.
|
||||||
$sticky-colors: ( [sass map with your own defined colours] );
|
$sticky-colors: ( [sass map with your own defined colours] );
|
||||||
@import "scss/core/switch/_sticky-note";
|
@use "scss/core/switch/_sticky-note";
|
||||||
@include sticky-note;
|
@include sticky-note;
|
||||||
|
|
||||||
+h(4)
|
+h(4)
|
||||||
|
|||||||
@@ -1 +1,125 @@
|
|||||||
@import url("https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap");sticky-note-wrapper{-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid transparent;border-radius:50%;display:inline-block;height:0.5rem;position:relative;width:0.5rem}sticky-note-wrapper *{-webkit-box-sizing:border-box;box-sizing:border-box}sticky-note-wrapper sticky-note{cursor:-webkit-grab;cursor:grab;display:-ms-grid;display:grid;float:left;font-size:1rem;height:13rem;left:0;place-items:stretch;position:absolute;top:0;width:13rem;z-index:100}sticky-note-wrapper sticky-note:active{cursor:-webkit-grabbing;cursor:grabbing;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}sticky-note-wrapper sticky-note.right{float:right}sticky-note-wrapper sticky-note>div{-ms-grid-row:1;grid-row:1;-ms-grid-column:1;grid-column:1}sticky-note-wrapper sticky-note>div:first-child{background-color:rgba(0,0,0,0.25);-webkit-box-shadow:-2px 2px 15px 0 rgba(0,0,0,0.5);box-shadow:-2px 2px 15px 0 rgba(0,0,0,0.5);display:-ms-grid;display:grid;margin:2rem 1rem 0.25rem 0.36rem;width:calc(100% - 1rem)}sticky-note-wrapper sticky-note>div:nth-child(2){clip-path:url(#stickyClip);display:-ms-grid;display:grid;font-family:"Kalam",cursive;font-style:1rem;font-weight:300;line-height:1.25rem;padding:1rem;place-items:center;text-align:center}sticky-note-wrapper sticky-note>div:nth-child(2)>*{font-family:"Kalam",cursive!important;font-style:normal!important;font-weight:300!important}@media screen and (max-width:1024px){sticky-note-wrapper sticky-note>div:nth-child(2){max-width:13rem;min-width:13rem;width:1rem}}@media screen and (max-width:768px){sticky-note-wrapper sticky-note>div:nth-child(2){font-size:1.75rem;max-width:21rem;min-height:21rem}}@media screen and (max-width:640px){sticky-note-wrapper sticky-note>div:nth-child(2){font-size:2.5rem;max-width:26rem;min-height:26rem}}sticky-note-wrapper sticky-note>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#ffffdd),color-stop(2%,#ffffd3),color-stop(12%,#ffffd3),color-stop(75%,#ffffc9),to(#ffffba));background:linear-gradient(180deg,#ffffdd 0%,#ffffd3 2%,#ffffd3 12%,#ffffc9 75%,#ffffba 100%)}sticky-note-wrapper sticky-note.blue>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#9dddec),color-stop(2%,#94daea),color-stop(12%,#94daea),color-stop(75%,#8bd7e8),to(#7fd3e6));background:linear-gradient(180deg,#9dddec 0%,#94daea 2%,#94daea 12%,#8bd7e8 75%,#7fd3e6 100%)}sticky-note-wrapper sticky-note.pink>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#fa7c93),color-stop(2%,#fa728b),color-stop(12%,#fa728b),color-stop(75%,#fa6883),to(#f95977));background:linear-gradient(180deg,#fa7c93 0%,#fa728b 2%,#fa728b 12%,#fa6883 75%,#f95977 100%)}sticky-note-wrapper sticky-note.green>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#c5fcc9),color-stop(2%,#bbfbc0),color-stop(12%,#bbfbc0),color-stop(75%,#b1fab7),to(#a3faaa));background:linear-gradient(180deg,#c5fcc9 0%,#bbfbc0 2%,#bbfbc0 12%,#b1fab7 75%,#a3faaa 100%)}sticky-note-wrapper:has(sticky-note:hover){background-color:#ffffd3;border:1px solid black}sticky-note-wrapper:has(sticky-note.yellow:hover){background-color:#ffffd3}sticky-note-wrapper:has(sticky-note.blue:hover){background-color:#94daea}sticky-note-wrapper:has(sticky-note.pink:hover){background-color:#fa728b}sticky-note-wrapper:has(sticky-note.green:hover){background-color:#bbfbc0}
|
sticky-note-wrapper {
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: inline-block;
|
||||||
|
height: 0.5rem;
|
||||||
|
position: relative;
|
||||||
|
width: 0.5rem;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper * {
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note {
|
||||||
|
cursor: -webkit-grab;
|
||||||
|
cursor: grab;
|
||||||
|
display: -ms-grid;
|
||||||
|
display: grid;
|
||||||
|
float: left;
|
||||||
|
font-size: 1rem;
|
||||||
|
height: 13rem;
|
||||||
|
left: 0;
|
||||||
|
place-items: stretch;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
width: 13rem;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note:active {
|
||||||
|
cursor: -webkit-grabbing;
|
||||||
|
cursor: grabbing;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note.right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note > div {
|
||||||
|
-ms-grid-row: 1;
|
||||||
|
grid-row: 1;
|
||||||
|
-ms-grid-column: 1;
|
||||||
|
grid-column: 1;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note > div:nth-child(1) {
|
||||||
|
background-color: rgba(0, 0, 0, 0.25);
|
||||||
|
-webkit-box-shadow: -2px 2px 15px 0 rgba(0, 0, 0, 0.5);
|
||||||
|
box-shadow: -2px 2px 15px 0 rgba(0, 0, 0, 0.5);
|
||||||
|
display: -ms-grid;
|
||||||
|
display: grid;
|
||||||
|
margin: 2rem 1rem 0.25rem 0.36rem;
|
||||||
|
width: calc(100% - 1rem);
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
||||||
|
clip-path: url(#stickyClip);
|
||||||
|
display: -ms-grid;
|
||||||
|
display: grid;
|
||||||
|
font-family: "Kalam", cursive;
|
||||||
|
font-style: 1rem;
|
||||||
|
font-weight: 300;
|
||||||
|
line-height: 1.25rem;
|
||||||
|
padding: 1rem;
|
||||||
|
place-items: center;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note > div:nth-child(2) > * {
|
||||||
|
font-family: "Kalam", cursive !important;
|
||||||
|
font-style: normal !important;
|
||||||
|
font-weight: 300 !important;
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 1024px) {
|
||||||
|
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
||||||
|
max-width: 13rem;
|
||||||
|
min-width: 13rem;
|
||||||
|
width: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 768px) {
|
||||||
|
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
||||||
|
font-size: 1.75rem;
|
||||||
|
max-width: 21rem;
|
||||||
|
min-height: 21rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 640px) {
|
||||||
|
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
||||||
|
font-size: 2.5rem;
|
||||||
|
max-width: 26rem;
|
||||||
|
min-height: 26rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note > div:nth-child(2) {
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(rgb(255, 255, 221.2)), color-stop(2%, #ffffd3), color-stop(12%, #ffffd3), color-stop(75%, rgb(255, 255, 200.8)), to(rgb(255, 255, 185.5)));
|
||||||
|
background: linear-gradient(180deg, rgb(255, 255, 221.2) 0%, #ffffd3 2%, #ffffd3 12%, rgb(255, 255, 200.8) 75%, rgb(255, 255, 185.5) 100%);
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note.blue > div:nth-child(2) {
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(rgb(156.5265625, 220.9484375, 235.6734375)), color-stop(2%, #94daea), color-stop(12%, #94daea), color-stop(75%, rgb(139.4734375, 215.0515625, 232.3265625)), to(rgb(126.68359375, 210.62890625, 229.81640625)));
|
||||||
|
background: linear-gradient(180deg, rgb(156.5265625, 220.9484375, 235.6734375) 0%, #94daea 2%, #94daea 12%, rgb(139.4734375, 215.0515625, 232.3265625) 75%, rgb(126.68359375, 210.62890625, 229.81640625) 100%);
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note.pink > div:nth-child(2) {
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(rgb(250.3493150685, 123.8506849315, 147.104109589)), color-stop(2%, #fa728b), color-stop(12%, #fa728b), color-stop(75%, rgb(249.6506849315, 104.1493150685, 130.895890411)), to(rgb(249.1267123288, 89.3732876712, 118.7397260274)));
|
||||||
|
background: linear-gradient(180deg, rgb(250.3493150685, 123.8506849315, 147.104109589) 0%, #fa728b 2%, #fa728b 12%, rgb(249.6506849315, 104.1493150685, 130.895890411) 75%, rgb(249.1267123288, 89.3732876712, 118.7397260274) 100%);
|
||||||
|
}
|
||||||
|
sticky-note-wrapper sticky-note.green > div:nth-child(2) {
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(rgb(196.6333333333, 251.5666666667, 200.925)), color-stop(2%, #bbfbc0), color-stop(12%, #bbfbc0), color-stop(75%, rgb(177.3666666667, 250.4333333333, 183.075)), to(rgb(162.9166666667, 249.5833333333, 169.6875)));
|
||||||
|
background: linear-gradient(180deg, rgb(196.6333333333, 251.5666666667, 200.925) 0%, #bbfbc0 2%, #bbfbc0 12%, rgb(177.3666666667, 250.4333333333, 183.075) 75%, rgb(162.9166666667, 249.5833333333, 169.6875) 100%);
|
||||||
|
}
|
||||||
|
sticky-note-wrapper:has(sticky-note:hover) {
|
||||||
|
background-color: #ffffd3;
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper:has(sticky-note.yellow:hover) {
|
||||||
|
background-color: #ffffd3;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper:has(sticky-note.blue:hover) {
|
||||||
|
background-color: #94daea;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper:has(sticky-note.pink:hover) {
|
||||||
|
background-color: #fa728b;
|
||||||
|
}
|
||||||
|
sticky-note-wrapper:has(sticky-note.green:hover) {
|
||||||
|
background-color: #bbfbc0;
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
//- DS2 core (c) 2024 Alexander McIlwraith
|
//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
//- Licensed under CC BY-SA 4.0
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
@import "_sticky-note";
|
@use "_sticky-note";
|
||||||
@include sticky-note;
|
@include sticky-note.sticky-note;
|
||||||
@@ -20,7 +20,7 @@ block content
|
|||||||
label(for="example-switch") Switch label (states the on state)
|
label(for="example-switch") Switch label (states the on state)
|
||||||
span#example-switch(role="switch")
|
span#example-switch(role="switch")
|
||||||
|
|
||||||
div#switches.tab-group
|
tabset#switches(order= taborder)
|
||||||
pre.language-html(tab="html")
|
pre.language-html(tab="html")
|
||||||
include _switch.pug
|
include _switch.pug
|
||||||
pre.language-pug(tab="pug")
|
pre.language-pug(tab="pug")
|
||||||
@@ -30,7 +30,7 @@ block content
|
|||||||
div(tab="scss")
|
div(tab="scss")
|
||||||
+h(3)
|
+h(3)
|
||||||
pre.language-sass.
|
pre.language-sass.
|
||||||
@import "scss/core/switch/_switch";
|
@use "scss/core/switch/_switch";
|
||||||
@include switch;
|
@include switch;
|
||||||
|
|
||||||
+h(4)
|
+h(4)
|
||||||
|
|||||||
@@ -1 +1,26 @@
|
|||||||
[role=switch]{display:-ms-inline-grid;display:inline-grid;border:1px solid #2e51a1;background-color:#d8d8d8;border-radius:0.75rem;height:1.5rem;width:3rem;-webkit-transition:all 500ms;transition:all 500ms}[role=switch]>span{display:inline-block;background-color:white;border-radius:50%;margin:2%;width:calc(1.5rem - 2%);-webkit-transition:all 500ms;transition:all 500ms}[role=switch][aria-checked=true]{background-color:#2e51a1}[role=switch][aria-checked=true]>span{margin-left:calc(1.5rem - 5%)}
|
[role=switch] {
|
||||||
|
display: -ms-inline-grid;
|
||||||
|
display: inline-grid;
|
||||||
|
border: 1px solid #2e51a1;
|
||||||
|
background-color: #d8d8d8;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
height: 1.5rem;
|
||||||
|
width: 3rem;
|
||||||
|
-webkit-transition: all 500ms;
|
||||||
|
transition: all 500ms;
|
||||||
|
}
|
||||||
|
[role=switch] > span {
|
||||||
|
display: inline-block;
|
||||||
|
background-color: white;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin: 2%;
|
||||||
|
width: calc(1.5rem - 2%);
|
||||||
|
-webkit-transition: all 500ms;
|
||||||
|
transition: all 500ms;
|
||||||
|
}
|
||||||
|
[role=switch][aria-checked=true] {
|
||||||
|
background-color: #2e51a1;
|
||||||
|
}
|
||||||
|
[role=switch][aria-checked=true] > span {
|
||||||
|
margin-left: calc(1.5rem - 5%);
|
||||||
|
}
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
@import "_switch.scss";
|
@use "_switch.scss";
|
||||||
@include switch;
|
@include switch.switch;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/* DS2 core (c) 2024 Alexander McIlwraith
|
/* DS2 core (c) 2024-2026 Alexander McIlwraith
|
||||||
Released under Creative Commons Attribution-ShareAlike 4.0 International
|
Released under Creative Commons Attribution-ShareAlike 4.0 International
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// create a pure JS mouse click event
|
// create a pure JS mouse click event
|
||||||
const click = new MouseEvent('click', {
|
const click = new MouseEvent('click', {
|
||||||
@@ -9,63 +9,79 @@ const click = new MouseEvent('click', {
|
|||||||
cancelable: true
|
cancelable: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// wait for an element to appear in the DOM
|
||||||
const waitForElement = (selector) => {
|
const waitForElement = (selector) => {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
if (document.querySelector(selector)) {
|
if (document.querySelector(selector)) {
|
||||||
return resolve(document.querySelector(selector));
|
return resolve(document.querySelector(selector));
|
||||||
}
|
}
|
||||||
|
const observer = new MutationObserver(() => {
|
||||||
const observer = new MutationObserver(mutations => {
|
|
||||||
if (document.querySelector(selector)) {
|
if (document.querySelector(selector)) {
|
||||||
observer.disconnect();
|
observer.disconnect();
|
||||||
resolve(document.querySelector(selector));
|
resolve(document.querySelector(selector));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// If you get "parameter 1 is not of type 'Node'" error, see https://stackoverflow.com/a/77855838/492336
|
|
||||||
observer.observe(document.body, {
|
observer.observe(document.body, {
|
||||||
childList: true,
|
childList: true,
|
||||||
subtree: true
|
subtree: true
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
|
// Tab logic
|
||||||
|
const tabNamespace = "#tab:";
|
||||||
|
|
||||||
|
const chooseTab = (tab) => {
|
||||||
|
const siblings = Array.from(tab.parentNode.children);
|
||||||
|
siblings.forEach(sibling => sibling.classList.remove("selected"));
|
||||||
|
tab.classList.add("selected");
|
||||||
|
|
||||||
|
const tabPanels = Array.from(tab.parentNode.parentNode.children);
|
||||||
|
tabPanels.forEach(panel => panel.classList.remove("open"));
|
||||||
|
|
||||||
|
const tabPanelId = tab
|
||||||
|
.getAttribute("id")
|
||||||
|
.replace("tab", "tab-panel");
|
||||||
|
|
||||||
|
document
|
||||||
|
.getElementById(tabPanelId)
|
||||||
|
.classList.add("open");
|
||||||
|
};
|
||||||
|
|
||||||
|
let pushStateCount = 0;
|
||||||
let tabsetCount = 0;
|
let tabsetCount = 0;
|
||||||
|
|
||||||
export function init(container = document, spacer = true, args = {}) {
|
export function init(container = document, spacer = true) {
|
||||||
|
|
||||||
container.querySelectorAll(".tab-group, tabset").forEach(tabGroup => {
|
container.querySelectorAll(".tab-group, tabset").forEach(tabGroup => {
|
||||||
|
|
||||||
if (tabGroup.querySelector("[role=tablist]") === null) {
|
if (tabGroup.querySelector('[role="tablist"]') === null) {
|
||||||
if (tabGroup.getAttribute("id") == null) {
|
|
||||||
tabGroup.setAttribute("id", "tab-group-" + tabsetCount);
|
|
||||||
tabsetCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (tabGroup.getAttribute("id") == null) {
|
||||||
|
tabGroup.setAttribute("id", `tab-group-${tabsetCount++}`);
|
||||||
|
}
|
||||||
|
|
||||||
const tabgroup = tabGroup.getAttribute("id");
|
const tabgroup = tabGroup.getAttribute("id");
|
||||||
let tablist = "";
|
let tablist = "";
|
||||||
|
|
||||||
Array.from(tabGroup.children).forEach(child => {
|
Array.from(tabGroup.children).forEach(child => {
|
||||||
|
|
||||||
// is details?
|
const isDetails = child.nodeName === "DETAILS";
|
||||||
let dtls = child.nodeName == "DETAILS" ? true : false;
|
const tabLabel =
|
||||||
|
isDetails
|
||||||
|
? child.querySelector("summary")?.innerHTML
|
||||||
|
: child.getAttribute("tab") || child.getAttribute("data-tab");
|
||||||
|
|
||||||
// get the tab text
|
if (tabLabel !== null) {
|
||||||
let tab = dtls ? child.querySelector("summary").innerHTML : child.getAttribute("tab") || child.getAttribute("data-tab");
|
|
||||||
|
|
||||||
// if the tab text is not blank
|
const tabID = tabLabel.replace(/\W+/g, "-").toLowerCase();
|
||||||
if (tab !== null) {
|
let tabPanel;
|
||||||
const tabID = tab.replace(/\W+/g, "-").toLowerCase();
|
|
||||||
|
|
||||||
|
if (isDetails) {
|
||||||
// define the tab panel content
|
|
||||||
let tabPanel = null;
|
|
||||||
if (dtls) {
|
|
||||||
tabPanel = child;
|
tabPanel = child;
|
||||||
tabPanel.setAttribute("open", "");
|
tabPanel.setAttribute("open", "");
|
||||||
} else {
|
} else {
|
||||||
tabPanel = document.createElement('div');
|
tabPanel = document.createElement("div");
|
||||||
tabPanel.appendChild(child.cloneNode(true));
|
tabPanel.appendChild(child.cloneNode(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,74 +89,104 @@ export function init(container = document, spacer = true, args = {}) {
|
|||||||
tabPanel.className = tablist === "" ? "open" : "";
|
tabPanel.className = tablist === "" ? "open" : "";
|
||||||
tabPanel.setAttribute("role", "tabpanel");
|
tabPanel.setAttribute("role", "tabpanel");
|
||||||
tabPanel.setAttribute("tabindex", "0");
|
tabPanel.setAttribute("tabindex", "0");
|
||||||
tabPanel.setAttribute("aria-labelledby", `tab-${tabgroup}-${tabID}`);
|
tabPanel.setAttribute(
|
||||||
|
"aria-labelledby",
|
||||||
|
`tab-${tabgroup}-${tabID}`
|
||||||
|
);
|
||||||
|
|
||||||
child.parentNode.replaceChild(tabPanel, child);
|
child.parentNode.replaceChild(tabPanel, child);
|
||||||
let cls = tablist === "" ? "class='selected'" : "";
|
|
||||||
tablist += `<li tabindex="0" role="tab" ${cls} id="tab-${tabgroup}-${tabID}"><span>${tab}</span></li>`;
|
tablist += `
|
||||||
|
<li
|
||||||
|
tabindex="0"
|
||||||
|
role="tab"
|
||||||
|
id="tab-${tabgroup}-${tabID}"
|
||||||
|
>
|
||||||
|
<span>${tabLabel}</span>
|
||||||
|
</li>
|
||||||
|
`;
|
||||||
} else {
|
} else {
|
||||||
child.classList.add("tab-hidden");
|
child.classList.add("tab-hidden");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const ul = document.createElement('ul');
|
const ul = document.createElement("ul");
|
||||||
ul.setAttribute("role", "tablist");
|
ul.setAttribute("role", "tablist");
|
||||||
ul.innerHTML = spacer != true ? `${tablist}` : `${tablist}<li role="separator" class="separator"></li>`;
|
|
||||||
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
||||||
|
|
||||||
tabGroup.querySelectorAll('[role="tab"]').forEach(tab => {
|
ul.innerHTML = spacer !== true
|
||||||
tab.addEventListener("click", (evt) => {
|
? tablist
|
||||||
// if (evt.altKey && typeof args.altModifier == "function") {
|
: `${tablist}<li role="separator" class="separator"></li>`;
|
||||||
// args.altModifier(tab, evt);
|
|
||||||
// } else if (evt.shiftKey && typeof args.shiftModifier == "function") {
|
|
||||||
// args.shiftModifier(tab, evt);
|
|
||||||
// } else if (evt.metaKey && typeof args.metaModifier == "function") {
|
|
||||||
// args.metaModifier(tab, evt);
|
|
||||||
// } else {
|
|
||||||
const siblings = Array.from(tab.parentNode.children);
|
|
||||||
siblings.forEach(sibling => sibling.classList.remove("selected"));
|
|
||||||
tab.classList.add("selected");
|
|
||||||
|
|
||||||
|
// Tab ordering
|
||||||
|
if (tabGroup.hasAttribute("order") || tabGroup.hasAttribute("data-order")) {
|
||||||
|
|
||||||
let urlPath = window.location;
|
const order = (
|
||||||
urlPath.hash = evt.currentTarget.getAttribute("id");
|
tabGroup.getAttribute("order") ||
|
||||||
window.history.pushState({"pageTitle": window.title + " : " + evt.currentTarget.innerHTML},"", urlPath.toString());
|
tabGroup.getAttribute("data-order")
|
||||||
// window.history.pushState({"html":response.html,"pageTitle":response.pageTitle},"", urlPath);
|
).split(",");
|
||||||
|
|
||||||
|
const items = Array.from(ul.getElementsByTagName("li"));
|
||||||
|
|
||||||
const tabPanels = Array.from(tab.parentNode.parentNode.children)
|
items.sort((a, b) => {
|
||||||
.filter(child => child.getAttribute("role") === "tabpanel");
|
const aa = order.indexOf(a.textContent.trim());
|
||||||
tabPanels.forEach(panel => panel.classList.remove("open"));
|
const bb = order.indexOf(b.textContent.trim());
|
||||||
|
if (aa === -1) return 1;
|
||||||
const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
if (bb === -1) return -1;
|
||||||
document.getElementById(tabPanelId).classList.add("open");
|
return aa - bb;
|
||||||
//}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ul.innerHTML = "";
|
||||||
|
items.forEach(item => ul.appendChild(item));
|
||||||
|
chooseTab(items[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tab event handlers
|
||||||
|
tabGroup.querySelectorAll('[role="tab"]').forEach(tab => {
|
||||||
|
|
||||||
|
tab.addEventListener("click", (evt) => {
|
||||||
|
|
||||||
|
const tabId = tab.getAttribute("id");
|
||||||
|
const hash = `${tabNamespace}${tabId}`;
|
||||||
|
|
||||||
|
chooseTab(evt.currentTarget);
|
||||||
|
|
||||||
|
window.history.pushState(
|
||||||
|
{ tab: tabId },
|
||||||
|
"",
|
||||||
|
`${location.pathname}${location.search}${hash}`
|
||||||
|
);
|
||||||
|
|
||||||
|
pushStateCount++;
|
||||||
|
});
|
||||||
|
|
||||||
tab.addEventListener("keypress", (e) => {
|
tab.addEventListener("keypress", (e) => {
|
||||||
|
if (e.which === 32 || e.which === 13) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if( e.which == 32 || e.which == 13 ) {
|
|
||||||
e.currentTarget.dispatchEvent(click);
|
e.currentTarget.dispatchEvent(click);
|
||||||
}
|
}
|
||||||
})
|
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
|
||||||
if (document.location.hash != "" && document.location.hash.substring(0,5) == "#tab-") {
|
ul.querySelector("li")?.classList.add("selected");
|
||||||
waitForElement(document.location.hash).then((el) => {
|
}
|
||||||
el.scrollIntoView();
|
});
|
||||||
|
|
||||||
|
// Initial hash handling (tabs only)
|
||||||
|
if (location.hash.startsWith(tabNamespace)) {
|
||||||
|
const tabId = location.hash.replace(tabNamespace, "");
|
||||||
|
waitForElement(`#${tabId}`).then(el => {
|
||||||
el.focus();
|
el.focus();
|
||||||
el.dispatchEvent(click);
|
el.dispatchEvent(click);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// History navigation (tabs only)
|
||||||
|
window.addEventListener("popstate", (e) => {
|
||||||
|
if (!location.hash.startsWith(tabNamespace)) return;
|
||||||
|
if (e.state?.tab) {
|
||||||
|
const tab = document.querySelector(`#${e.state.tab}`);
|
||||||
|
if (tab) chooseTab(tab);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
addEventListener("hashchange", (evt) => {
|
|
||||||
document.querySelector(window.location.hash).dispatchEvent(click);
|
|
||||||
|
|
||||||
// window.location.hash
|
|
||||||
// console.log(window.location.hash)
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
tabset#uniqueID
|
tabset#uniqueID(order="tab title 2,tab title 1")
|
||||||
div(tab="[tab title]")
|
div(tab="[tab title 1]")
|
||||||
div(tab="[tab title]")
|
div(tab="[tab title 2]")
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
tabset#uniqueID
|
tabset#uniqueID(order="tab title 2,tab title 1")
|
||||||
div(tab="[tab title]")
|
div(tab="[tab title 1]")
|
||||||
div(tab="[tab title]")
|
div(tab="[tab title 2]")
|
||||||
|
|
||||||
@@ -1,46 +1,42 @@
|
|||||||
// DS2 core (c) 2024 Alexander McIlwraith
|
// DS2 core (c) 2024 Alexander McIlwraith
|
||||||
// Licensed under CC BY-SA 4.0
|
// Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
|
|
||||||
$tab-border: #7f7f7f !default;
|
$tab-border: #7f7f7f !default;
|
||||||
|
$tab-panel-background-color: #FFF !default;
|
||||||
|
$tab-panel-top-border: #7f7f7f !default;
|
||||||
|
$tab-panel-top-border-width: 1px !default;
|
||||||
$tab-selected: #FFF !default;
|
$tab-selected: #FFF !default;
|
||||||
|
$tab-selected-text: #000 !default;
|
||||||
$tab-notselected: #f0f0f0 !default;
|
$tab-notselected: #f0f0f0 !default;
|
||||||
$tab-break: 450px !default;
|
$tab-notselected-text: #000 !default;
|
||||||
|
|
||||||
@mixin tabs {
|
@mixin tabs {
|
||||||
tabset, .tab-group {
|
tabset, .tab-group {
|
||||||
@media (min-width: $tab-break) {
|
|
||||||
margin: 2rem 0 1rem 0;
|
margin: 2rem 0 1rem 0;
|
||||||
}
|
|
||||||
> ul {
|
[role="tablist"] {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
|
|
||||||
li.separator {
|
li {
|
||||||
|
&.separator {
|
||||||
border-bottom: 1px solid $tab-border;
|
border-bottom: 1px solid $tab-border;
|
||||||
border-left: 1px solid $tab-border;
|
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: .45rem 0 0 0;
|
margin: .45rem 0 0 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
&[role="tab"] {
|
||||||
|
|
||||||
.tab-hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
[role="tab"] {
|
|
||||||
background-color: $tab-selected;
|
background-color: $tab-selected;
|
||||||
border-left: 1px solid $tab-border;
|
border-left: 1px solid $tab-border;
|
||||||
border-top: 1px solid $tab-border;
|
border-right: 1px solid $tab-border;
|
||||||
border-radius: .5rem .5rem 0 0;
|
border-radius: .5rem .5rem 0 0;
|
||||||
|
border-top: 1px solid $tab-border;
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
margin: 0;
|
|
||||||
display: inline;
|
display: inline;
|
||||||
|
margin: 0;
|
||||||
padding: 1rem 1.5rem .14rem 1.5rem;
|
padding: 1rem 1.5rem .14rem 1.5rem;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
|
||||||
@@ -51,14 +47,21 @@ $tab-break: 450px !default;
|
|||||||
&:not(.selected) {
|
&:not(.selected) {
|
||||||
background-color: $tab-notselected;
|
background-color: $tab-notselected;
|
||||||
border-bottom: 1px solid $tab-border;
|
border-bottom: 1px solid $tab-border;
|
||||||
|
/// color
|
||||||
}
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
display: block;
|
display: block;
|
||||||
margin: 0 0 .5rem 0;
|
margin: 0 0 .5rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
[role="tabpanel"] {
|
[role="tabpanel"] {
|
||||||
background-color: $tab-selected;
|
background-color: $tab-selected;
|
||||||
border: 1px solid $tab-border;
|
border: 1px solid $tab-border;
|
||||||
@@ -66,34 +69,10 @@ $tab-break: 450px !default;
|
|||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
|
||||||
@media (min-width: $tab-break) {
|
|
||||||
&[open] summary {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: $tab-break) {
|
|
||||||
&:not(.open) {
|
&:not(.open) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@content;
|
@content;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: $tab-break) {
|
|
||||||
&:has(details) {
|
|
||||||
[role="tablist"] {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
[role="tabpanel"] {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,19 +20,15 @@ block content
|
|||||||
|
|
||||||
|
|
||||||
+h(2)
|
+h(2)
|
||||||
p The structure of the tab set is defined in html. There are two forms supported. Adding a class of #[code.inline .tab-group] to the container element will work in place of the #[code.inline tabset] tag, and the tab panels can be defined using either #[code.inline tab=""] or #[code.inline data-tab=""]. Passing an optional element to the init function will initialise tabs within that element.
|
p The structure of the tab set is defined in html. There are two forms supported. Adding a class of #[code.inline .tab-group] to the container element will work in place of the #[code.inline tabset] tag, and the tab panels can be defined using either #[code.inline tab=""] or #[code.inline data-tab=""]. Passing an optional element to the init function will initialise tabs within that element. Adding a #[code.inline order=""] or #[code.inline data-order=""] element to the tabset you can have the tabs sorted in a consistent order across tabsets.
|
||||||
|
|
||||||
p The tab initalize function now takes a new function parameter in the form of an third argument is an object that can take the following callbacks:
|
+h(3)
|
||||||
ul
|
pre.language-pug(tab="pug").
|
||||||
li altModifer (When the altKey is used)
|
tabset(order="tab2, tab1")
|
||||||
li shiftModifier (When the shift key is used)
|
div(tab="tab1")
|
||||||
li metaModifier (When the Windows key or Apple key is used)
|
div(tab="tab2")
|
||||||
p You can use these callbacks to create a custom event to get the tab information.
|
|
||||||
|
|
||||||
p Note: There is a new core function (core.getTabPath) that will generate the query string and url hash for use in DS2 Core. You may wish to update your scaffolding.js file to make use of this functionality.
|
tabset#tabs(order= taborder)
|
||||||
|
|
||||||
|
|
||||||
tabset#tabs
|
|
||||||
pre.language-html(tab="html")
|
pre.language-html(tab="html")
|
||||||
include _tabs.pug
|
include _tabs.pug
|
||||||
pre.language-pug(tab="pug")
|
pre.language-pug(tab="pug")
|
||||||
@@ -42,7 +38,7 @@ block content
|
|||||||
div(tab="scss")
|
div(tab="scss")
|
||||||
+h(3)
|
+h(3)
|
||||||
pre.language-sass.
|
pre.language-sass.
|
||||||
@import "scss/core/tabs/_tabs";
|
@use "scss/core/tabs/_tabs";
|
||||||
@include tabs{
|
@include tabs{
|
||||||
// optional content block
|
// optional content block
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1 +1,52 @@
|
|||||||
@media (min-width:450px){.tab-group,tabset{margin:2rem 0 1rem 0}}.tab-group>ul,tabset>ul{display:-webkit-box;display:-ms-flexbox;display:flex;margin:0;padding:0}.tab-group>ul li.separator,tabset>ul li.separator{border-bottom:1px solid #7f7f7f;border-left:1px solid #7f7f7f;display:inline-block;margin:0.45rem 0 0 0;width:100%}.tab-group .tab-hidden,tabset .tab-hidden{display:none}.tab-group [role=tab],tabset [role=tab]{background-color:#FFF;border-left:1px solid #7f7f7f;border-top:1px solid #7f7f7f;border-radius:0.5rem 0.5rem 0 0;cursor:pointer;margin:0;display:inline;padding:1rem 1.5rem 0.14rem 1.5rem;z-index:2}.tab-group [role=tab]:last-of-type,tabset [role=tab]:last-of-type{border-right:1px solid #7f7f7f}.tab-group [role=tab]:not(.selected),tabset [role=tab]:not(.selected){background-color:#f0f0f0;border-bottom:1px solid #7f7f7f}.tab-group [role=tab] span,tabset [role=tab] span{display:block;margin:0 0 0.5rem 0}.tab-group [role=tabpanel],tabset [role=tabpanel]{background-color:#FFF;border:1px solid #7f7f7f;border-top:none;padding:1rem;z-index:1}@media (min-width:450px){.tab-group [role=tabpanel][open] summary,tabset [role=tabpanel][open] summary{display:none}}@media (min-width:450px){.tab-group [role=tabpanel]:not(.open),tabset [role=tabpanel]:not(.open){display:none}}@media (max-width:450px){.tab-group:has(details) [role=tablist],tabset:has(details) [role=tablist]{display:none}.tab-group:has(details) [role=tabpanel],tabset:has(details) [role=tabpanel]{border:none}}
|
tabset, .tab-group {
|
||||||
|
margin: 2rem 0 1rem 0;
|
||||||
|
}
|
||||||
|
tabset [role=tablist], .tab-group [role=tablist] {
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
tabset [role=tablist] li.separator, .tab-group [role=tablist] li.separator {
|
||||||
|
border-bottom: 1px solid #7f7f7f;
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0.45rem 0 0 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
tabset [role=tablist] li[role=tab], .tab-group [role=tablist] li[role=tab] {
|
||||||
|
background-color: #FFF;
|
||||||
|
border-left: 1px solid #7f7f7f;
|
||||||
|
border-right: 1px solid #7f7f7f;
|
||||||
|
border-radius: 0.5rem 0.5rem 0 0;
|
||||||
|
border-top: 1px solid #7f7f7f;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline;
|
||||||
|
margin: 0;
|
||||||
|
padding: 1rem 1.5rem 0.14rem 1.5rem;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
tabset [role=tablist] li[role=tab]:last-of-type, .tab-group [role=tablist] li[role=tab]:last-of-type {
|
||||||
|
border-right: 1px solid #7f7f7f;
|
||||||
|
}
|
||||||
|
tabset [role=tablist] li[role=tab]:not(.selected), .tab-group [role=tablist] li[role=tab]:not(.selected) {
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
border-bottom: 1px solid #7f7f7f;
|
||||||
|
}
|
||||||
|
tabset [role=tablist] li[role=tab] span, .tab-group [role=tablist] li[role=tab] span {
|
||||||
|
display: block;
|
||||||
|
margin: 0 0 0.5rem 0;
|
||||||
|
}
|
||||||
|
tabset .tab-hidden, .tab-group .tab-hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
tabset [role=tabpanel], .tab-group [role=tabpanel] {
|
||||||
|
background-color: #FFF;
|
||||||
|
border: 1px solid #7f7f7f;
|
||||||
|
border-top: none;
|
||||||
|
padding: 1rem;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
tabset [role=tabpanel]:not(.open), .tab-group [role=tabpanel]:not(.open) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
//- DS2 core (c) 2024 Alexander McIlwraith
|
//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
//- Licensed under CC BY-SA 4.0
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
@import "_tabs.scss";
|
@use "_tabs.scss";
|
||||||
@include tabs;
|
@include tabs.tabs;
|
||||||
@@ -29,6 +29,7 @@ $tooltip-pointer-top: conic-gradient(from 150deg at top, rgba(0, 0, 0, 0), #000
|
|||||||
background: $tooltip-light-background;
|
background: $tooltip-light-background;
|
||||||
border-radius: $tooltip-border-radius;
|
border-radius: $tooltip-border-radius;
|
||||||
color: $tooltip-light-foreground;
|
color: $tooltip-light-foreground;
|
||||||
|
display: none;
|
||||||
filter: $tooltip-light-drop-shadow;
|
filter: $tooltip-light-drop-shadow;
|
||||||
$font-family: $font-body;
|
$font-family: $font-body;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
@@ -152,6 +153,7 @@ $tooltip-pointer-top: conic-gradient(from 150deg at top, rgba(0, 0, 0, 0), #000
|
|||||||
:has(> [role="tooltip"]) {
|
:has(> [role="tooltip"]) {
|
||||||
position: relative;
|
position: relative;
|
||||||
&:is(:hover, :focus-visible, :active) > [role="tooltip"] {
|
&:is(:hover, :focus-visible, :active) > [role="tooltip"] {
|
||||||
|
display: block;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transition-delay: 300ms;
|
transition-delay: 300ms;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ block content
|
|||||||
include _tooltip.pug
|
include _tooltip.pug
|
||||||
|
|
||||||
|
|
||||||
tabset#tooltip
|
tabset#tooltip(order= taborder)
|
||||||
pre.language-html(tab="html")
|
pre.language-html(tab="html")
|
||||||
include _tooltip.pug
|
include _tooltip.pug
|
||||||
pre.language-pug(tab="pug")
|
pre.language-pug(tab="pug")
|
||||||
@@ -43,7 +43,7 @@ block content
|
|||||||
div(tab="scss")
|
div(tab="scss")
|
||||||
+h(3)
|
+h(3)
|
||||||
pre.language-sass.
|
pre.language-sass.
|
||||||
@import "scss/core/tooltip/_tooltip";
|
@use "scss/core/tooltip/_tooltip";
|
||||||
@include tooltip;
|
@include tooltip;
|
||||||
+h(4)
|
+h(4)
|
||||||
pre.language-sass
|
pre.language-sass
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
color: #000;
|
color: #000;
|
||||||
|
display: none;
|
||||||
-webkit-filter: drop-shadow(0 3px 3px hsla(0, 0%, 0%, 0.15)) drop-shadow(0 12px 12px hsla(0, 0%, 0%, 0.15));
|
-webkit-filter: drop-shadow(0 3px 3px hsla(0, 0%, 0%, 0.15)) drop-shadow(0 12px 12px hsla(0, 0%, 0%, 0.15));
|
||||||
filter: drop-shadow(0 3px 3px hsla(0, 0%, 0%, 0.15)) drop-shadow(0 12px 12px hsla(0, 0%, 0%, 0.15));
|
filter: drop-shadow(0 3px 3px hsla(0, 0%, 0%, 0.15)) drop-shadow(0 12px 12px hsla(0, 0%, 0%, 0.15));
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
@@ -134,6 +135,7 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
:has(> [role=tooltip]):is(:hover, :focus-visible, :active) > [role=tooltip] {
|
:has(> [role=tooltip]):is(:hover, :focus-visible, :active) > [role=tooltip] {
|
||||||
|
display: block;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
-webkit-transition-delay: 300ms;
|
-webkit-transition-delay: 300ms;
|
||||||
transition-delay: 300ms;
|
transition-delay: 300ms;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//- DS2 core (c) 2024 Alexander McIlwraith
|
//- DS2 core (c) 2024 Alexander McIlwraith
|
||||||
//- Licensed under CC BY-SA 4.0
|
//- Licensed under CC BY-SA 4.0
|
||||||
|
|
||||||
@import "_tooltip.scss";
|
@use "_tooltip.scss";
|
||||||
@include tooltip;
|
@include tooltip.tooltip;
|
||||||
@@ -116,7 +116,7 @@
|
|||||||
display: grid;
|
display: grid;
|
||||||
gap: .5rem;
|
gap: .5rem;
|
||||||
grid-template-columns: repeat(3, 1fr);
|
grid-template-columns: repeat(3, 1fr);
|
||||||
grid-template-rows: 2.5rem repeat(2, max-content);
|
grid-template-rows: repeat(3, max-content);
|
||||||
.result {
|
.result {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border-radius: .5rem;
|
border-radius: .5rem;
|
||||||
|
|||||||
Reference in New Issue
Block a user