Update pattern documentation

This commit is contained in:
A McIlwraith 2024-07-28 15:30:51 -04:00
parent 77a13bbd46
commit 3292729d53
15 changed files with 227 additions and 221 deletions

View File

@ -12,11 +12,17 @@
<h2>How to use it</h2> <h2>How to use it</h2>
<p>This pattern is only available for SCSS breakpoints. The mixin is avai</p> <p>This pattern is only available for SCSS breakpoints. The mixin is avai</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> <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>
<div class="tab-group" id="breakpoints"> <tabset id="breakpoints">
<pre class="language-css" data-tab="scss">//- DS2 core (c) 2024 Alexander McIlwraith <div tab="scss">
<pre class="language-sass">@import "[path-to]/breakpoints";
@include break([breakpoint]) {
// css here
}</pre>
<pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
//- Licensed under CC BY-SA 4.0 //- Licensed under CC BY-SA 4.0
$grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px ) !default; // default breakpoints match bootstrap 5 breakpoints.
$grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 1400px ) !default;
@mixin breakpoint-debug { @mixin breakpoint-debug {
body::before, body::after { body::before, body::after {
@ -99,6 +105,7 @@ $grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px ) !defau
} }
} }
}</pre> }</pre>
</div> </div>
</tabset>
</body> </body>
</html> </html>

View File

@ -9,7 +9,9 @@
<h2>When to use it</h2> <h2>When to use it</h2>
<p>Use a header at the top of every page. The 'front page' of a site may have a different header than the rest of the pages. </p> <p>Use a header at the top of every page. The 'front page' of a site may have a different header than the rest of the pages. </p>
<h2>How to use it</h2> <h2>How to use it</h2>
<p>Place the header at the top of the page after the skip to main content link. This basic header should be replaced with your own site's header. </p> <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
<pre class="inline language-js">core: true </pre> and create your own pattern in the location you wish it in your design system.
</p>
<div class="tab-group" id="header"> <div class="tab-group" id="header">
<pre class="language-html" data-tab="html"> <pre class="language-html" data-tab="html">
<!-- create temp variables and store the design system values--> <!-- create temp variables and store the design system values-->
@ -55,59 +57,7 @@ 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" data-tab="css">header { <pre class="language-css" data-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>
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-sass" data-tab="scss">//- DS2 core (c) 2024 Alexander McIlwraith <pre class="language-sass" data-tab="scss">//- DS2 core (c) 2024 Alexander McIlwraith
//- Licensed under CC BY-SA 4.0 //- Licensed under CC BY-SA 4.0

View File

@ -9,11 +9,11 @@
<h2>When to use it</h2> <h2>When to use it</h2>
<p>Use a sticky when you want to make a note without adding it to the content. </p> <p>Use a sticky when you want to make a note without adding it to the content. </p>
<h2>How to use it</h2> <h2>How to use it</h2>
<p>Uses absolute positioning. <p>Uses absolute positioning. Passing an optional element to the init function will initialise tabs within that element. You can move the position using either <code class="language-html inline">float="[ right | left &#93;"</code> or <code class="language-html inline">offset="[ top | left &#93;"</code>. Offset will take negative values in any web measurement unit.
<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> <sticky-note class="blue" offset="-10rem 1rem">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>
<sticky-note float="right">You will notice when you hover over the sticky, it shows a dot in the colour of the sticky in the position where the sticky note refers to (assuming you haven't dragged it and scrolled that location off the screen).</sticky-note>
</p> </p>
<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> <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>
<sticky-note>You will notice when you hover over the sticky, it shows a dot in the colour of the sticky in the position where the sticky note refers to (assuming you haven't dragged it and scrolled that location off the screen).</sticky-note>
<tabset id="sticky-note"> <tabset id="sticky-note">
<pre class="language-html" tab="html"> <pre class="language-html" tab="html">
<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>
@ -145,7 +145,11 @@ sticky-note-wrapper:has(sticky-note.pink:hover) {
sticky-note-wrapper:has(sticky-note.green:hover) { sticky-note-wrapper:has(sticky-note.green:hover) {
background-color: #bbfbc0; background-color: #bbfbc0;
}</pre> }</pre>
<pre class="language-css" data-tab="scss"> //- DS2 core (c) 2024 Alexander McIlwraith <div tab="scss">
<pre class="language-sass">$sticky-colors: ( [sass map with your own defined colours] );
@import "[path to]/_sticky-note";
@include sticky-note;</pre>
<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:color'; @use 'sass:color';
@ -297,7 +301,12 @@ $sticky-colors: (
} }
} }
}</pre> }</pre>
<pre class="language-js" data-tab="js"> //- DS2 core (c) 2024 Alexander McIlwraith </div>
<div tab="js">
<pre class="language-js">import * as stickynote from "[path to]]/_sticky-note.js";
stickynote.init()
</pre>
<pre class="language-js">//- DS2 core (c) 2024 Alexander McIlwraith
//- Licensed under CC BY-SA 4.0 //- Licensed under CC BY-SA 4.0
const font = { const font = {
@ -428,6 +437,7 @@ export function init(p = document){
}); });
} }
}</pre> }</pre>
</div>
</tabset> </tabset>
</body> </body>
</html> </html>

View File

@ -16,13 +16,13 @@
<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"> <div class="tab-group" id="switches">
<pre class="language-html" data-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" data-tab="pug">span#example-id(role="switch")</pre> <pre class="language-pug" tab="pug">span#example-id(role="switch")</pre>
<pre class="language-css" data-tab="css">[role=switch] { <pre class="language-css" tab="css">[role=switch] {
display: -ms-inline-grid; display: -ms-inline-grid;
display: inline-grid; display: inline-grid;
border: 1px solid var(--colour-blue); border: 1px solid #2e51a1;
background-color: var(--colour-grey-xl); background-color: #d8d8d8;
border-radius: 0.75rem; border-radius: 0.75rem;
height: 1.5rem; height: 1.5rem;
width: 3rem; width: 3rem;
@ -39,12 +39,16 @@
transition: all 500ms; transition: all 500ms;
} }
[role=switch][aria-checked=true] { [role=switch][aria-checked=true] {
background-color: var(--colour-blue); background-color: #2e51a1;
} }
[role=switch][aria-checked=true] > span { [role=switch][aria-checked=true] > span {
margin-left: calc(1.5rem - 5%); margin-left: calc(1.5rem - 5%);
}</pre> }</pre>
<pre class="language-css" data-tab="scss">//- DS2 core (c) 2024 Alexander McIlwraith <div tab="scss">
<pre class="language-sass">@import "[path to]/_switch";
@include switch;
</pre>
<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:math"; @use "sass:math";
@ -80,7 +84,13 @@ $switch-height: 1.5rem !default;
} }
} }
}</pre> }</pre>
<pre class="language-js" data-tab="js">//- DS2 core (c) 2024 Alexander McIlwraith </div>
<div tab="js">
<pre class="language-js">// Note that switch is a reserved word.
import * as swtch from "[path to]]/_switch.js";
swtch.init();
</pre>
<pre class="language-js">//- DS2 core (c) 2024 Alexander McIlwraith
//- Licensed under CC BY-SA 4.0 //- Licensed under CC BY-SA 4.0
function flip(e) { function flip(e) {
@ -107,6 +117,7 @@ module.exports = {
} }
} }
</pre> </pre>
</div>
</div> </div>
</body> </body>
</html> </html>

View File

@ -6,7 +6,7 @@
<body data-prismjs-copy-timeout="1500"> <body data-prismjs-copy-timeout="1500">
<h2>What is it</h2> <h2>What is it</h2>
<p>A tabs component that provides different sections of content that are displayed one at a time when the user selects that information. </p> <p>A tabs component that provides different sections of content that are displayed one at a time when the user selects that information. </p>
<h2>How to use it</h2> <h2>When to use it</h2>
<p>The tabbed user interface enables users to jump to their target section quickly. Tabs present like logically group information on the same page. Information should </p> <p>The tabbed user interface enables users to jump to their target section quickly. Tabs present like logically group information on the same page. Information should </p>
<ul> <ul>
<li>be logically chunked and ordered</li> <li>be logically chunked and ordered</li>
@ -15,8 +15,8 @@
<li>obvious where they begin and end </li> <li>obvious where they begin and end </li>
</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>When to use it</h2> <h2>How to use it</h2>
<p>The tab module can be initialised by importing a file with the javascript module using import * as tabs from "../pg/patterns/layouts/tabs/_tabs.js"; contains a modularized version of the jQuery code, so that it can be called on demand. It is what is used in the design system so that the JavaScript can be called at run time (after loading content).</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. </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">
@ -38,8 +38,8 @@ tabset > ul, .tab-group > ul {
padding: 0; padding: 0;
} }
tabset > ul li.separator, .tab-group > ul li.separator { tabset > ul li.separator, .tab-group > ul li.separator {
border-bottom: 1px solid var(--colour-grey); border-bottom: 1px solid #7f7f7f;
border-left: 1px solid var(--colour-grey); border-left: 1px solid #7f7f7f;
display: inline-block; display: inline-block;
margin: 0.45rem 0 0 0; margin: 0.45rem 0 0 0;
width: 100%; width: 100%;
@ -48,9 +48,9 @@ tabset .tab-hidden, .tab-group .tab-hidden {
display: none; display: none;
} }
tabset [role=tab], .tab-group [role=tab] { tabset [role=tab], .tab-group [role=tab] {
background-color: var(--colour-white); background-color: #FFF;
border-left: 1px solid var(--colour-grey); border-left: 1px solid #7f7f7f;
border-top: 1px solid var(--colour-grey); border-top: 1px solid #7f7f7f;
border-radius: 0.5rem 0.5rem 0 0; border-radius: 0.5rem 0.5rem 0 0;
cursor: pointer; cursor: pointer;
margin: 0; margin: 0;
@ -59,19 +59,19 @@ tabset [role=tab], .tab-group [role=tab] {
z-index: 2; z-index: 2;
} }
tabset [role=tab]:last-of-type, .tab-group [role=tab]:last-of-type { tabset [role=tab]:last-of-type, .tab-group [role=tab]:last-of-type {
border-right: 1px solid var(--colour-grey); border-right: 1px solid #7f7f7f;
} }
tabset [role=tab]:not(.selected), .tab-group [role=tab]:not(.selected) { tabset [role=tab]:not(.selected), .tab-group [role=tab]:not(.selected) {
background-color: var(--colour-grey-xxl); background-color: #f0f0f0;
border-bottom: 1px solid var(--colour-grey); border-bottom: 1px solid #7f7f7f;
} }
tabset [role=tab] span, .tab-group [role=tab] span { tabset [role=tab] span, .tab-group [role=tab] span {
display: block; display: block;
margin: 0 0 0.5rem 0; margin: 0 0 0.5rem 0;
} }
tabset [role=tabpanel], .tab-group [role=tabpanel] { tabset [role=tabpanel], .tab-group [role=tabpanel] {
background-color: var(--colour-white); background-color: #FFF;
border: 1px solid var(--colour-grey); border: 1px solid #7f7f7f;
border-top: none; border-top: none;
padding: 1rem; padding: 1rem;
z-index: 1; z-index: 1;
@ -79,7 +79,13 @@ tabset [role=tabpanel], .tab-group [role=tabpanel] {
tabset [role=tabpanel]:not(.open), .tab-group [role=tabpanel]:not(.open) { tabset [role=tabpanel]:not(.open), .tab-group [role=tabpanel]:not(.open) {
display: none; display: none;
}</pre> }</pre>
<pre class="language-css" tab="scss">// DS2 core (c) 2024 Alexander McIlwraith <div tab="scss">
<pre class="language-sass">@import "[path to]/_tabs";
@include tabs{
// optional content block
};
</pre>
<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;
@ -148,7 +154,11 @@ $tab-notselected: #f0f0f0 !default;
} }
} }
}</pre> }</pre>
<pre class="language-css" tab="js">/* DS2 core (c) 2024 Alexander McIlwraith </div>
<div tab="js">
<pre class="language-js">import * as tabs from "[path to]/_tabs.js";
tabs.init();</pre>
<pre class="language-js">/* DS2 core (c) 2024 Alexander McIlwraith
import * as tabs from "../pg/patterns/layouts/tabs/_tabs.js"; import * as tabs from "../pg/patterns/layouts/tabs/_tabs.js";
tabs.init(); tabs.init();
*/ */
@ -202,6 +212,7 @@ export function init(p = document) {
}); });
} }
</pre> </pre>
</div>
</tabset> </tabset>
</body> </body>
</html> </html>

View File

@ -11,7 +11,9 @@
<p>Use tooltips to help differentiate between multiple, close, similar options. </p> <p>Use tooltips to help differentiate between multiple, close, similar options. </p>
<h2>How to use it</h2> <h2>How to use it</h2>
<p class="notification-box info">Currently, there is no easy way to activate a hover without with pure CSS without using a keyboard or mouse. Level4 media queries aim to solve that.</p> <p class="notification-box info">Currently, there is no easy way to activate a hover without with pure CSS without using a keyboard or mouse. Level4 media queries aim to solve that.</p>
<p>Either form works. Place this inside another element for the tooltip to be 'linked to that element.' A container element may need to be added for a single tag element, such as a input field. </p> <p>Either form works.
<sticky-note class="blue">"Either form works": What are the two forms.</sticky-note>Place the <code class="language-html inline">tooltip</code> inside another element for the tooltip to be 'linked to that element.' A container element may need to be added for a single tag element, such as a input field.
</p>
<p>Tool tip positions are: </p> <p>Tool tip positions are: </p>
<ul> <ul>
<li>top / block-start</li> <li>top / block-start</li>
@ -20,11 +22,11 @@
<li>left / inline-start</li> <li>left / inline-start</li>
</ul> </ul>
<p><a href="#">Link with a tool tip<span role="tooltip" inert="inert" tip-position="right">Tool tip content</span></a></p> <p><a href="#">Link with a tool tip<span role="tooltip" inert="inert" tip-position="right">Tool tip content</span></a></p>
<div class="tab-group" id="tooltip"> <tabset id="tooltip">
<pre class="language-html" data-tab="html"><a href="#">Link with a tool tip<span role="tooltip" inert="inert" tip-position="right">Tool tip content</span></a></pre> <pre class="language-html" tab="html"><a href="#">Link with a tool tip<span role="tooltip" inert="inert" tip-position="right">Tool tip content</span></a></pre>
<pre class="language-pug" data-tab="pug">a(href="#") Link with a tool tip <pre class="language-pug" tab="pug">a(href="#") Link with a tool tip
span(role="tooltip" inert tip-position="right") Tool tip content</pre> span(role="tooltip" inert tip-position="right") Tool tip content</pre>
<pre class="language-css" data-tab="css">/* Position Options <pre class="language-css" tab="css">/* Position Options
- top / block-start - top / block-start
- right / inline-end - right / inline-end
- bottom / block-end - bottom / block-end
@ -179,7 +181,10 @@
--tooltip-x: calc(-1 * 3px * -1); --tooltip-x: calc(-1 * 3px * -1);
} }
}</pre> }</pre>
<pre class="language-css" data-tab="scss">//- DS2 core (c) 2024 Alexander McIlwraith <div tab="scss">
<pre class="language-sass">@import "[path to]/_tooltip";
@include tooltip;</pre>
<pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
//- Licensed under CC BY-SA 4.0 //- Licensed under CC BY-SA 4.0
$tooltip-border-radius: .5rem !default; $tooltip-border-radius: .5rem !default;
@ -356,6 +361,7 @@ $tooltip-pointer-top: conic-gradient(from 150deg at top, rgba(0, 0, 0, 0), #000
} }
}</pre> }</pre>
</div> </div>
</tabset>
</body> </body>
</html> </html>

View File

@ -17,6 +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.
div.tab-group#breakpoints tabset#breakpoints
pre.language-css(data-tab="scss") div(tab="scss")
include _breakpoints.scss +h(3)
pre.language-sass.
@import "[path-to]/breakpoints";
@include break([breakpoint]) {
// css here
}
+h(4)
pre.language-sass
include _breakpoints.scss

View File

@ -1,53 +1 @@
header { 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}
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;
}

View File

@ -10,8 +10,7 @@ block content
p Use a header at the top of every page. The 'front page' of a site may have a different header than the rest of the pages. p Use a header at the top of every page. The 'front page' of a site may have a different header than the rest of the pages.
+h(2) +h(2)
p Place the header at the top of the page after the skip to main content link. This basic header should be replaced with your own site's header. 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 #[pre.inline.language-js core: true ] and create your own pattern in the location you wish it in your design system.
div.tab-group#header div.tab-group#header
pre.language-html(data-tab="html") pre.language-html(data-tab="html")

View File

@ -8,13 +8,13 @@ block content
+h(1) +h(1)
p Use a sticky when you want to make a note without adding it to the content. p Use a sticky when you want to make a note without adding it to the content.
+h(2) +h(2)
p Uses absolute positioning. p Uses absolute positioning. Passing an optional element to the init function will initialise tabs within that element. You can move the position using either #[code.language-html.inline float="[ right | left &#93;"] or #[code.language-html.inline offset="[ top | left &#93;"]. Offset will take negative values in any web measurement unit.
sticky-note(float="right").blue This #[strong is] a sample sticky. sticky-note.blue(offset="-10rem 1rem") This #[strong is] a sample sticky.
| You can drag it out of the way if you need to see the content under it. | You can drag it out of the way if you need to see the content under it.
sticky-note(float="right") You will notice when you hover over the sticky, it shows a dot in the colour of the sticky in the position where the sticky note refers to (assuming you haven't dragged it and scrolled that location off the screen).
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".
sticky-note You will notice when you hover over the sticky, it shows a dot in the colour of the sticky in the position where the sticky note refers to (assuming you haven't dragged it and scrolled that location off the screen).
tabset#sticky-note tabset#sticky-note
pre.language-html(tab="html") pre.language-html(tab="html")
@ -23,7 +23,21 @@ block content
include _sticky-note.pp include _sticky-note.pp
pre.language-css(data-tab="css") pre.language-css(data-tab="css")
include sticky-note.css include sticky-note.css
pre.language-css(data-tab="scss") div(tab="scss")
include _sticky-note.scss +h(3)
pre.language-js(data-tab="js") pre.language-sass.
include _sticky-note.js $sticky-colors: ( [sass map with your own defined colours] );
@import "[path to]/_sticky-note";
@include sticky-note;
+h(4)
pre.language-sass
include _sticky-note.scss
div(tab="js")
+h(3)
pre.language-js.
import * as stickynote from "[path to]]/_sticky-note.js";
stickynote.init()
+h(4)
pre.language-js
include _sticky-note.js

View File

@ -21,13 +21,28 @@ block content
span#example-switch(role="switch") span#example-switch(role="switch")
div#switches.tab-group div#switches.tab-group
pre.language-html(data-tab="html") pre.language-html(tab="html")
include _switch.pug include _switch.pug
pre.language-pug(data-tab="pug") pre.language-pug(tab="pug")
include _switch.pp include _switch.pp
pre.language-css(data-tab="css") pre.language-css(tab="css")
include switch.css include switch.css
pre.language-css(data-tab="scss") div(tab="scss")
include _switch.scss +h(3)
pre.language-js(data-tab="js") pre.language-sass.
include _switch.js @import "[path to]/_switch";
@include switch;
+h(4)
pre.language-sass
include _switch.scss
div(tab="js")
+h(3)
pre.language-js.
// Note that switch is a reserved word.
import * as swtch from "[path to]]/_switch.js";
swtch.init();
+h(4)
pre.language-js
include _switch.js

View File

@ -1,8 +1,8 @@
[role=switch] { [role=switch] {
display: -ms-inline-grid; display: -ms-inline-grid;
display: inline-grid; display: inline-grid;
border: 1px solid var(--colour-blue); border: 1px solid #2e51a1;
background-color: var(--colour-grey-xl); background-color: #d8d8d8;
border-radius: 0.75rem; border-radius: 0.75rem;
height: 1.5rem; height: 1.5rem;
width: 3rem; width: 3rem;
@ -19,7 +19,7 @@
transition: all 500ms; transition: all 500ms;
} }
[role=switch][aria-checked=true] { [role=switch][aria-checked=true] {
background-color: var(--colour-blue); background-color: #2e51a1;
} }
[role=switch][aria-checked=true] > span { [role=switch][aria-checked=true] > span {
margin-left: calc(1.5rem - 5%); margin-left: calc(1.5rem - 5%);

View File

@ -7,20 +7,21 @@ block content
+h(0) +h(0)
p A tabs component that provides different sections of content that are displayed one at a time when the user selects that information. p A tabs component that provides different sections of content that are displayed one at a time when the user selects that information.
+h(2) +h(1)
p The tabbed user interface enables users to jump to their target section quickly. Tabs present like logically group information on the same page. Information should p The tabbed user interface enables users to jump to their target section quickly. Tabs present like logically group information on the same page. Information should
ul ul
li be logically chunked and ordered li be logically chunked and ordered
li be parallel in nature li be arallel in nature
li show user's context li show user's context
li obvious where they begin and end li obvious where they begin and end
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 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.
+h(1) +h(2)
p The tab module can be initialised by importing a file with the javascript module using import * as tabs from "../pg/patterns/layouts/tabs/_tabs.js"; contains a modularized version of the jQuery code, so that it can be called on demand. It is what is used in the design system so that the JavaScript can be called at run time (after loading content). 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.
tabset#tabs tabset#tabs
pre.language-html(tab="html") pre.language-html(tab="html")
@ -29,8 +30,23 @@ block content
include _tabs.pp include _tabs.pp
pre.language-css(tab="css") pre.language-css(tab="css")
include tabs.css include tabs.css
pre.language-css(tab="scss") div(tab="scss")
include _tabs.scss +h(3)
pre.language-css(tab="js") pre.language-sass.
include _tabs.js @import "[path to]/_tabs";
@include tabs{
// optional content block
};
+h(4)
pre.language-sass
include _tabs.scss
div(tab="js")
+h(3)
pre.language-js.
import * as tabs from "[path to]/_tabs.js";
tabs.init();
+h(4)
pre.language-js
include _tabs.js

View File

@ -9,8 +9,8 @@ tabset > ul, .tab-group > ul {
padding: 0; padding: 0;
} }
tabset > ul li.separator, .tab-group > ul li.separator { tabset > ul li.separator, .tab-group > ul li.separator {
border-bottom: 1px solid var(--colour-grey); border-bottom: 1px solid #7f7f7f;
border-left: 1px solid var(--colour-grey); border-left: 1px solid #7f7f7f;
display: inline-block; display: inline-block;
margin: 0.45rem 0 0 0; margin: 0.45rem 0 0 0;
width: 100%; width: 100%;
@ -19,9 +19,9 @@ tabset .tab-hidden, .tab-group .tab-hidden {
display: none; display: none;
} }
tabset [role=tab], .tab-group [role=tab] { tabset [role=tab], .tab-group [role=tab] {
background-color: var(--colour-white); background-color: #FFF;
border-left: 1px solid var(--colour-grey); border-left: 1px solid #7f7f7f;
border-top: 1px solid var(--colour-grey); border-top: 1px solid #7f7f7f;
border-radius: 0.5rem 0.5rem 0 0; border-radius: 0.5rem 0.5rem 0 0;
cursor: pointer; cursor: pointer;
margin: 0; margin: 0;
@ -30,19 +30,19 @@ tabset [role=tab], .tab-group [role=tab] {
z-index: 2; z-index: 2;
} }
tabset [role=tab]:last-of-type, .tab-group [role=tab]:last-of-type { tabset [role=tab]:last-of-type, .tab-group [role=tab]:last-of-type {
border-right: 1px solid var(--colour-grey); border-right: 1px solid #7f7f7f;
} }
tabset [role=tab]:not(.selected), .tab-group [role=tab]:not(.selected) { tabset [role=tab]:not(.selected), .tab-group [role=tab]:not(.selected) {
background-color: var(--colour-grey-xxl); background-color: #f0f0f0;
border-bottom: 1px solid var(--colour-grey); border-bottom: 1px solid #7f7f7f;
} }
tabset [role=tab] span, .tab-group [role=tab] span { tabset [role=tab] span, .tab-group [role=tab] span {
display: block; display: block;
margin: 0 0 0.5rem 0; margin: 0 0 0.5rem 0;
} }
tabset [role=tabpanel], .tab-group [role=tabpanel] { tabset [role=tabpanel], .tab-group [role=tabpanel] {
background-color: var(--colour-white); background-color: #FFF;
border: 1px solid var(--colour-grey); border: 1px solid #7f7f7f;
border-top: none; border-top: none;
padding: 1rem; padding: 1rem;
z-index: 1; z-index: 1;

View File

@ -6,6 +6,7 @@ block content
+h(0) +h(0)
p Tooltips provide brief information messaging through a mouse or keyboard hover. p Tooltips provide brief information messaging through a mouse or keyboard hover.
+h(1) +h(1)
p Use tool tips to provide additional information. Don't use tooltips for that is required to complete an interaction as the information disappears when it loses the hover state. p Use tool tips to provide additional information. Don't use tooltips for that is required to complete an interaction as the information disappears when it loses the hover state.
@ -15,7 +16,11 @@ block content
p.notification-box.info Currently, there is no easy way to activate a hover without with pure CSS without using a keyboard or mouse. Level4 media queries aim to solve that. p.notification-box.info Currently, there is no easy way to activate a hover without with pure CSS without using a keyboard or mouse. Level4 media queries aim to solve that.
p Either form works. Place this inside another element for the tooltip to be 'linked to that element.' A container element may need to be added for a single tag element, such as a input field.
p Either form works.
sticky-note.blue "Either form works": What are the two forms.
| Place the #[code.language-html.inline tooltip] inside another element for the tooltip to be 'linked to that element.' A container element may need to be added for a single tag element, such as a input field.
p Tool tip positions are: p Tool tip positions are:
ul ul
@ -28,13 +33,19 @@ block content
include _tooltip.pug include _tooltip.pug
div#tooltip.tab-group tabset#tooltip
pre.language-html(data-tab="html") pre.language-html(tab="html")
include _tooltip.pug include _tooltip.pug
pre.language-pug(data-tab="pug") pre.language-pug(tab="pug")
include _tooltip.pp include _tooltip.pp
pre.language-css(data-tab="css") pre.language-css(tab="css")
include tooltip.css include tooltip.css
pre.language-css(data-tab="scss") div(tab="scss")
include _tooltip.scss +h(3)
pre.language-sass.
@import "[path to]/_tooltip";
@include tooltip;
+h(4)
pre.language-sass
include _tooltip.scss