move patterns and javascript to core directories
This commit is contained in:
330
public/patterns/core/colours/index.html
Normal file
330
public/patterns/core/colours/index.html
Normal file
@@ -0,0 +1,330 @@
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Pattern</title>
|
||||
</head>
|
||||
<body data-prismjs-copy-timeout="1500">
|
||||
<h2>Primary colours</h2>
|
||||
<color-samples>
|
||||
<color-sample data-color="rgb( 46, 81, 161)" style="background-color: rgb( 46, 81, 161); color: #FFF">
|
||||
<name data-hex="#2e51a1" data-rgb="rgb( 46, 81, 161)" data-token="--colour-blue"><span>Blue</span></name>
|
||||
<hex>#2e51a1</hex>
|
||||
<rgb>rgb(46,81,161)</rgb>
|
||||
<accessibility>
|
||||
<div class="acchb"> <span>color & black </span><small>2.8:1</small></div>
|
||||
<div class="acchw"> <span>color & white </span><small>7.5:1</small></div>
|
||||
<div class="aa">WCAG 2.0 AA </div>
|
||||
<div class="accbaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="accwaa result"><span style="color: rgb( 46, 81, 161)">✓ </span><span style="color: rgb( 46, 81, 161)">✓</span>
|
||||
</div>
|
||||
<div class="aaa">WCAG 2.0 AAA </div>
|
||||
<div class="accbaaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="accwaaa result"><span style="color: rgb( 46, 81, 161)">✓ </span><span style="color: rgb( 46, 81, 161)">✓</span>
|
||||
</div>
|
||||
</accessibility>
|
||||
<sample-block>
|
||||
<color-pill data-hex="#5c7abf" data-rgb="rgb( 92,122,191)" data-token="--colour-blue-l"> <span style="background-color: rgb( 92,122,191)">
|
||||
<div class="tooltip-tc color-accessibility" role="tooltip" inert="inert" tip-position="bottom">
|
||||
<div class="acchb"> <span>color & black </span><small>5:1</small></div>
|
||||
<div class="acchw"> <span>color & white </span><small>4.2:1</small></div>
|
||||
<div class="aa">WCAG 2.0 AA </div>
|
||||
<div class="accbaa result"><span style="color: rgb( 92,122,191)">✓</span><span style="color: rgb( 92,122,191)">✓</span>
|
||||
</div>
|
||||
<div class="accwaa result"><span>✗ </span><span style="color: rgb( 92,122,191)">✓</span>
|
||||
</div>
|
||||
<div class="aaa">WCAG 2.0 AAA </div>
|
||||
<div class="accbaaa result"><span>✗ </span><span style="color: rgb( 92,122,191)">✓</span>
|
||||
</div>
|
||||
<div class="accwaaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
</div></span><span>blue-l</span>
|
||||
</color-pill>
|
||||
<color-pill data-hex="#b2c3ec" data-rgb="rgb(178,195,236)" data-token="--colour-blue-xl"> <span style="background-color: rgb(178,195,236)">
|
||||
<div class="tooltip-tc color-accessibility" role="tooltip" inert="inert" tip-position="bottom">
|
||||
<div class="acchb"> <span>color & black </span><small>11.9:1</small></div>
|
||||
<div class="acchw"> <span>color & white </span><small>1.8:1</small></div>
|
||||
<div class="aa">WCAG 2.0 AA </div>
|
||||
<div class="accbaa result"><span style="color: rgb(178,195,236)">✓</span><span style="color: rgb(178,195,236)">✓</span>
|
||||
</div>
|
||||
<div class="accwaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="aaa">WCAG 2.0 AAA </div>
|
||||
<div class="accbaaa result"><span style="color: rgb(178,195,236)">✓ </span><span style="color: rgb(178,195,236)">✓</span>
|
||||
</div>
|
||||
<div class="accwaaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
</div></span><span>blue-xl</span>
|
||||
</color-pill>
|
||||
</sample-block>
|
||||
<sample-block>
|
||||
<color-pill data-hex="#133176" data-rgb="rgb( 19, 49,118)" data-token="--colour-blue-d"> <span style="background-color: rgb( 19, 49,118)">
|
||||
<div class="tooltip-tc color-accessibility" role="tooltip" inert="inert" tip-position="bottom">
|
||||
<div class="acchb"> <span>color & black </span><small>1.7:1</small></div>
|
||||
<div class="acchw"> <span>color & white </span><small>12.1:1</small></div>
|
||||
<div class="aa">WCAG 2.0 AA </div>
|
||||
<div class="accbaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="accwaa result"><span style="color: rgb( 19, 49,118)">✓ </span><span style="color: rgb( 19, 49,118)">✓</span>
|
||||
</div>
|
||||
<div class="aaa">WCAG 2.0 AAA </div>
|
||||
<div class="accbaaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="accwaaa result"><span style="color: rgb( 19, 49,118)">✓ </span><span style="color: rgb( 19, 49,118)">✓</span>
|
||||
</div>
|
||||
</div></span><span>blue-d</span>
|
||||
</color-pill>
|
||||
<color-pill data-hex="#031235" data-rgb="rgb( 3, 18, 53)" data-token="--colour-blue-xd"> <span style="background-color: rgb( 3, 18, 53)">
|
||||
<div class="tooltip-tc color-accessibility" role="tooltip" inert="inert" tip-position="bottom">
|
||||
<div class="acchb"> <span>color & black </span><small>1.1:1</small></div>
|
||||
<div class="acchw"> <span>color & white </span><small>18.4:1</small></div>
|
||||
<div class="aa">WCAG 2.0 AA </div>
|
||||
<div class="accbaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="accwaa result"><span style="color: rgb( 3, 18, 53)">✓ </span><span style="color: rgb( 3, 18, 53)">✓</span>
|
||||
</div>
|
||||
<div class="aaa">WCAG 2.0 AAA </div>
|
||||
<div class="accbaaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="accwaaa result"><span style="color: rgb( 3, 18, 53)">✓ </span><span style="color: rgb( 3, 18, 53)">✓</span>
|
||||
</div>
|
||||
</div></span><span>blue-xd</span>
|
||||
</color-pill>
|
||||
</sample-block>
|
||||
</color-sample>
|
||||
<color-sample data-color="rgb(127, 127, 127)" style="background-color: rgb(127, 127, 127); color: #000">
|
||||
<name data-hex="#7f7f7f" data-rgb="rgb(127, 127, 127)" data-token="--colour-grey"><span>Grey</span></name>
|
||||
<hex>#7f7f7f</hex>
|
||||
<rgb>rgb(127,127,127)</rgb>
|
||||
<accessibility>
|
||||
<div class="acchb"> <span>color & black </span><small>5.2:1</small></div>
|
||||
<div class="acchw"> <span>color & white </span><small>4:1</small></div>
|
||||
<div class="aa">WCAG 2.0 AA </div>
|
||||
<div class="accbaa result"><span style="color: rgb(127, 127, 127)">✓</span><span style="color: rgb(127, 127, 127)">✓</span>
|
||||
</div>
|
||||
<div class="accwaa result"><span>✗ </span><span style="color: rgb(127, 127, 127)">✓</span>
|
||||
</div>
|
||||
<div class="aaa">WCAG 2.0 AAA </div>
|
||||
<div class="accbaaa result"><span>✗ </span><span style="color: rgb(127, 127, 127)">✓</span>
|
||||
</div>
|
||||
<div class="accwaaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
</accessibility>
|
||||
<sample-block>
|
||||
<color-pill data-hex="#b2b2b2" data-rgb="rgb(178, 178, 178)" data-token="--colour-grey-l"> <span style="background-color: #b2b2b2">
|
||||
<div class="tooltip-tc color-accessibility" role="tooltip" inert="inert" tip-position="bottom">
|
||||
<div class="acchb"> <span>color & black </span><small>9.9:1</small></div>
|
||||
<div class="acchw"> <span>color & white </span><small>2.1:1</small></div>
|
||||
<div class="aa">WCAG 2.0 AA </div>
|
||||
<div class="accbaa result"><span style="color: rgb(178, 178, 178)">✓</span><span style="color: rgb(178, 178, 178)">✓</span>
|
||||
</div>
|
||||
<div class="accwaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="aaa">WCAG 2.0 AAA </div>
|
||||
<div class="accbaaa result"><span style="color: rgb(178, 178, 178)">✓ </span><span style="color: rgb(178, 178, 178)">✓</span>
|
||||
</div>
|
||||
<div class="accwaaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
</div></span><span>Light</span>
|
||||
</color-pill>
|
||||
<color-pill data-hex="#d8d8d8" data-rgb="rgb(216, 216, 216)" data-token="--colour-grey-xl"> <span style="background-color: #d8d8d8">
|
||||
<div class="tooltip-tc color-accessibility" role="tooltip" inert="inert" tip-position="bottom">
|
||||
<div class="acchb"> <span>color & black </span><small>14.7:1</small></div>
|
||||
<div class="acchw"> <span>color & white </span><small>1.4:1</small></div>
|
||||
<div class="aa">WCAG 2.0 AA </div>
|
||||
<div class="accbaa result"><span style="color: rgb(216, 216, 216)">✓</span><span style="color: rgb(216, 216, 216)">✓</span>
|
||||
</div>
|
||||
<div class="accwaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="aaa">WCAG 2.0 AAA </div>
|
||||
<div class="accbaaa result"><span style="color: rgb(216, 216, 216)">✓ </span><span style="color: rgb(216, 216, 216)">✓</span>
|
||||
</div>
|
||||
<div class="accwaaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
</div></span><span>Lighter</span>
|
||||
</color-pill>
|
||||
<color-pill data-hex="#f0f0f0" data-rgb="rgb(240, 240, 240)" data-token="--colour-grey-xxl"> <span style="background-color: #f0f0f0">
|
||||
<div class="tooltip-tc color-accessibility" role="tooltip" inert="inert" tip-position="bottom">
|
||||
<div class="acchb"> <span>color & black </span><small>18.4:1</small></div>
|
||||
<div class="acchw"> <span>color & white </span><small>1.1:1</small></div>
|
||||
<div class="aa">WCAG 2.0 AA </div>
|
||||
<div class="accbaa result"><span style="color: rgb(240, 240, 240)">✓</span><span style="color: rgb(240, 240, 240)">✓</span>
|
||||
</div>
|
||||
<div class="accwaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="aaa">WCAG 2.0 AAA </div>
|
||||
<div class="accbaaa result"><span style="color: rgb(240, 240, 240)">✓ </span><span style="color: rgb(240, 240, 240)">✓</span>
|
||||
</div>
|
||||
<div class="accwaaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
</div></span><span>Lightest</span>
|
||||
</color-pill>
|
||||
<color-pill data-hex="#FFF" data-rgb="rgb(255, 255, 255)" data-token="--colour-white"> <span style="background-color: #FFF">
|
||||
<div class="tooltip-tc color-accessibility" role="tooltip" inert="inert" tip-position="bottom">
|
||||
<div class="acchb"> <span>color & black </span><small>21:1</small></div>
|
||||
<div class="acchw"> <span>color & white </span><small>1:1</small></div>
|
||||
<div class="aa">WCAG 2.0 AA </div>
|
||||
<div class="accbaa result"><span style="color: rgb(255, 255, 255)">✓</span><span style="color: rgb(255, 255, 255)">✓</span>
|
||||
</div>
|
||||
<div class="accwaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="aaa">WCAG 2.0 AAA </div>
|
||||
<div class="accbaaa result"><span style="color: rgb(255, 255, 255)">✓ </span><span style="color: rgb(255, 255, 255)">✓</span>
|
||||
</div>
|
||||
<div class="accwaaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
</div></span><span>White</span>
|
||||
</color-pill>
|
||||
<color-pill data-hex="#FFF" data-rgb="rgb(255, 255, 255)" data-token="--colour-page"> <span style="background-color: #FFF">
|
||||
<div class="tooltip-tc color-accessibility" role="tooltip" inert="inert" tip-position="bottom">
|
||||
<div class="acchb"> <span>color & black </span><small>21:1</small></div>
|
||||
<div class="acchw"> <span>color & white </span><small>1:1</small></div>
|
||||
<div class="aa">WCAG 2.0 AA </div>
|
||||
<div class="accbaa result"><span style="color: rgb(255, 255, 255)">✓</span><span style="color: rgb(255, 255, 255)">✓</span>
|
||||
</div>
|
||||
<div class="accwaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="aaa">WCAG 2.0 AAA </div>
|
||||
<div class="accbaaa result"><span style="color: rgb(255, 255, 255)">✓ </span><span style="color: rgb(255, 255, 255)">✓</span>
|
||||
</div>
|
||||
<div class="accwaaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
</div></span><span>Default page</span>
|
||||
</color-pill>
|
||||
<color-pill data-hex="#FFF" data-rgb="rgb(255, 255, 255)" data-token="--colour-light"> <span style="background-color: #FFF">
|
||||
<div class="tooltip-tc color-accessibility" role="tooltip" inert="inert" tip-position="bottom">
|
||||
<div class="acchb"> <span>color & black </span><small>21:1</small></div>
|
||||
<div class="acchw"> <span>color & white </span><small>1:1</small></div>
|
||||
<div class="aa">WCAG 2.0 AA </div>
|
||||
<div class="accbaa result"><span style="color: rgb(255, 255, 255)">✓</span><span style="color: rgb(255, 255, 255)">✓</span>
|
||||
</div>
|
||||
<div class="accwaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="aaa">WCAG 2.0 AAA </div>
|
||||
<div class="accbaaa result"><span style="color: rgb(255, 255, 255)">✓ </span><span style="color: rgb(255, 255, 255)">✓</span>
|
||||
</div>
|
||||
<div class="accwaaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
</div></span><span>Light</span>
|
||||
</color-pill>
|
||||
</sample-block>
|
||||
<sample-block>
|
||||
<color-pill data-hex="#4c4c4c" data-rgb="rgb(76, 76, 76)" data-token="--colour-grey-d"> <span style="background-color: #4c4c4c">
|
||||
<div class="tooltip-tc color-accessibility" role="tooltip" inert="inert" tip-position="bottom">
|
||||
<div class="acchb"> <span>color & black </span><small>2.4:1</small></div>
|
||||
<div class="acchw"> <span>color & white </span><small>8.6:1</small></div>
|
||||
<div class="aa">WCAG 2.0 AA </div>
|
||||
<div class="accbaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="accwaa result"><span style="color: rgb(76, 76, 76)">✓ </span><span style="color: rgb(76, 76, 76)">✓</span>
|
||||
</div>
|
||||
<div class="aaa">WCAG 2.0 AAA </div>
|
||||
<div class="accbaaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="accwaaa result"><span style="color: rgb(76, 76, 76)">✓ </span><span style="color: rgb(76, 76, 76)">✓</span>
|
||||
</div>
|
||||
</div></span><span>Dark</span>
|
||||
</color-pill>
|
||||
<color-pill data-hex="#4c4c4c" data-rgb="rgb(76, 76, 76)" data-token="--colour-grey-xd"> <span style="background-color: #4c4c4c">
|
||||
<div class="tooltip-tc color-accessibility" role="tooltip" inert="inert" tip-position="bottom">
|
||||
<div class="acchb"> <span>color & black </span><small>2.4:1</small></div>
|
||||
<div class="acchw"> <span>color & white </span><small>8.6:1</small></div>
|
||||
<div class="aa">WCAG 2.0 AA </div>
|
||||
<div class="accbaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="accwaa result"><span style="color: rgb(76, 76, 76)">✓ </span><span style="color: rgb(76, 76, 76)">✓</span>
|
||||
</div>
|
||||
<div class="aaa">WCAG 2.0 AAA </div>
|
||||
<div class="accbaaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="accwaaa result"><span style="color: rgb(76, 76, 76)">✓ </span><span style="color: rgb(76, 76, 76)">✓</span>
|
||||
</div>
|
||||
</div></span><span>Darker</span>
|
||||
</color-pill>
|
||||
<color-pill data-hex="#000" data-rgb="rgb(0, 0, 0)" data-token="--colour-black"> <span style="background-color: #000">
|
||||
<div class="tooltip-tc color-accessibility" role="tooltip" inert="inert" tip-position="bottom">
|
||||
<div class="acchb"> <span>color & black </span><small>1:1</small></div>
|
||||
<div class="acchw"> <span>color & white </span><small>21:1</small></div>
|
||||
<div class="aa">WCAG 2.0 AA </div>
|
||||
<div class="accbaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="accwaa result"><span style="color: rgb(0, 0, 0)">✓ </span><span style="color: rgb(0, 0, 0)">✓</span>
|
||||
</div>
|
||||
<div class="aaa">WCAG 2.0 AAA </div>
|
||||
<div class="accbaaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="accwaaa result"><span style="color: rgb(0, 0, 0)">✓ </span><span style="color: rgb(0, 0, 0)">✓</span>
|
||||
</div>
|
||||
</div></span><span>Black</span>
|
||||
</color-pill>
|
||||
<color-pill data-hex="#000" data-rgb="rgb(0, 0, 0)" data-token="--colour-dark"> <span style="background-color: #000">
|
||||
<div class="tooltip-tc color-accessibility" role="tooltip" inert="inert" tip-position="bottom">
|
||||
<div class="acchb"> <span>color & black </span><small>1:1</small></div>
|
||||
<div class="acchw"> <span>color & white </span><small>21:1</small></div>
|
||||
<div class="aa">WCAG 2.0 AA </div>
|
||||
<div class="accbaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="accwaa result"><span style="color: rgb(0, 0, 0)">✓ </span><span style="color: rgb(0, 0, 0)">✓</span>
|
||||
</div>
|
||||
<div class="aaa">WCAG 2.0 AAA </div>
|
||||
<div class="accbaaa result"><span>✗ </span><span>✗</span>
|
||||
</div>
|
||||
<div class="accwaaa result"><span style="color: rgb(0, 0, 0)">✓ </span><span style="color: rgb(0, 0, 0)">✓</span>
|
||||
</div>
|
||||
</div></span><span>Dark</span>
|
||||
</color-pill>
|
||||
</sample-block>
|
||||
</color-sample>
|
||||
</color-samples>
|
||||
<div class="tab-group" id="colors">
|
||||
<div data-tab="css">
|
||||
<pre class="language-css">:root {
|
||||
--colour-blue: #2e51a1,
|
||||
--colour-blue-l: #5c7abf,
|
||||
--colour-blue-xl: #b2c3ec,
|
||||
--colour-blue-d: #133176,
|
||||
--colour-blue-xd: #031235,
|
||||
|
||||
--colour-grey: #7f7f7f,
|
||||
--colour-grey-l: #b2b2b2,
|
||||
--colour-grey-xl: #d8d8d8,
|
||||
--colour-grey-xxl: #f0f0f0,
|
||||
--colour-white: #fff,
|
||||
--colour-page: #fff,
|
||||
--colour-light: #fff,
|
||||
--colour-grey-d: #4c4c4c,
|
||||
--colour-grey-xd: #4c4c4c,
|
||||
--colour-black: #000,
|
||||
--colour-dark: #000,
|
||||
}</pre>
|
||||
</div>
|
||||
<div data-tab="scss">
|
||||
<pre class="language-css">$colour: (
|
||||
colour-blue: #2e51a1,
|
||||
colour-blue-l: #5c7abf,
|
||||
colour-blue-xl: #b2c3ec,
|
||||
colour-blue-d: #133176,
|
||||
colour-blue-xd: #031235,
|
||||
|
||||
colour-grey: #7f7f7f,
|
||||
colour-grey-l: #b2b2b2,
|
||||
colour-grey-xl: #d8d8d8,
|
||||
colour-grey-xxl: #f0f0f0,
|
||||
colour-white: #fff,
|
||||
colour-page: #fff,
|
||||
colour-light: #fff,
|
||||
colour-grey-d: #4c4c4c,
|
||||
colour-grey-xd: #4c4c4c,
|
||||
colour-black: #000,
|
||||
colour-dark: #000,
|
||||
);
|
||||
:root {
|
||||
@each $name, $color in $colour {
|
||||
--#{$name}: #{$color};
|
||||
}
|
||||
}</pre>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
428
public/patterns/core/components/sticky-note/index.html
Normal file
428
public/patterns/core/components/sticky-note/index.html
Normal file
@@ -0,0 +1,428 @@
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Pattern</title>
|
||||
</head>
|
||||
<body data-prismjs-copy-timeout="1500">
|
||||
<h2>What is it</h2>
|
||||
<h2>When to use it</h2>
|
||||
<h2>How to use it</h2>
|
||||
<p>Uses absolute positioning.
|
||||
<sticky-note class="blue" float="right">This <strong>is</strong> a test</sticky-note>You might need to add relative positioning to it's container.
|
||||
</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>another one</sticky-note>
|
||||
<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>
|
||||
<div class="tab-group" id="sticky-note">
|
||||
<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: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(#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="scss"> //- DS2 core (c) 2024 Alexander McIlwraith
|
||||
//- Licensed under CC BY-SA 4.0
|
||||
|
||||
@use 'sass:color';
|
||||
@use "sass:map";
|
||||
@use 'sass:list';
|
||||
@import url('https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap');
|
||||
|
||||
$sticky-colors: (
|
||||
"yellow": #ffffd3,
|
||||
"blue": #94daea,
|
||||
"pink": #fa728b,
|
||||
"green": #bbfbc0 ) !default;
|
||||
|
||||
@mixin sticky-note {
|
||||
sticky-note-wrapper {
|
||||
box-sizing: border-box;
|
||||
|
||||
border: 1px solid transparent;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
height: .5rem;
|
||||
position: relative;
|
||||
width: .5rem;
|
||||
& * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
sticky-note {
|
||||
cursor: grab;
|
||||
display: grid;
|
||||
float: left;
|
||||
font-size: 1rem;
|
||||
height: 13rem;
|
||||
left: 0;
|
||||
place-items: stretch;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 13rem;
|
||||
z-index: 100;
|
||||
|
||||
&:active {
|
||||
cursor: grabbing;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@media screen and (max-width: 1024px) {
|
||||
//width: 15rem;
|
||||
// background-color: green;
|
||||
}
|
||||
@media screen and (max-width: 768px) {
|
||||
//width: 20rem;
|
||||
// background-color: blue;
|
||||
}
|
||||
@media screen and (max-width: 640px) {
|
||||
//width: 30rem;
|
||||
// background-color: yellow;
|
||||
}
|
||||
&.right {
|
||||
float: right;
|
||||
}
|
||||
@content;
|
||||
|
||||
> div {
|
||||
grid-row: 1;
|
||||
grid-column: 1;
|
||||
&:nth-child(1) {
|
||||
background-color: rgba(0, 0, 0, 0.25);
|
||||
box-shadow: -2px 2px 15px 0 rgba(0, 0, 0, 0.5);
|
||||
display: grid;
|
||||
margin: 2rem 1rem .25rem .36rem;
|
||||
width: calc(100% - 1rem);
|
||||
|
||||
}
|
||||
&:nth-child(2) {
|
||||
clip-path: url(#stickyClip);
|
||||
display: grid;
|
||||
font-family: "Kalam", cursive;
|
||||
font-style: 1rem;
|
||||
font-weight: 300;
|
||||
line-height: 1.25rem;
|
||||
padding: 1rem;
|
||||
place-items: center;
|
||||
text-align: center;
|
||||
// not adding this because maybe we want the sticky note text to be able to be selected and copied.
|
||||
// user-select: none;
|
||||
> * {
|
||||
font-family: "Kalam", cursive !important;
|
||||
font-style: normal !important;
|
||||
font-weight: 300 !important;
|
||||
}
|
||||
|
||||
|
||||
@media screen and (max-width: 1024px) {
|
||||
max-width: 13rem;
|
||||
min-width: 13rem;
|
||||
width: 1rem;
|
||||
}
|
||||
@media screen and (max-width: 768px) {
|
||||
font-size: 1.75rem;
|
||||
max-width: 21rem;
|
||||
min-height: 21rem;
|
||||
}
|
||||
@media screen and (max-width: 640px) {
|
||||
font-size: 2.5rem;
|
||||
max-width: 26rem;
|
||||
min-height: 26rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// default colour
|
||||
> div:nth-child(2) {
|
||||
$sticky-color: 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%
|
||||
);
|
||||
}
|
||||
// all class colors
|
||||
@each $class, $sticky-color in $sticky-colors {
|
||||
&.#{$class} > div:nth-child(2) {
|
||||
@if $class != nth(map.keys($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%
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&:has(sticky-note:hover) {
|
||||
background-color: #{nth(map.values($sticky-colors), 1)};
|
||||
border: 1px solid black;
|
||||
|
||||
}
|
||||
@each $class, $sticky-color in $sticky-colors {
|
||||
&:has(sticky-note.#{$class}:hover) {
|
||||
background-color: $sticky-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}</pre>
|
||||
<pre class="language-js" data-tab="js"> //- DS2 core (c) 2024 Alexander McIlwraith
|
||||
//- Licensed under CC BY-SA 4.0
|
||||
|
||||
const font = {
|
||||
size: 0
|
||||
}
|
||||
|
||||
const pos = {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
|
||||
function drag(sticky) {
|
||||
sticky.onmousedown = event => {
|
||||
// get the position within the sticky
|
||||
pos.x = (event.clientX - sticky.offsetLeft);
|
||||
pos.y = (event.clientY - sticky.offsetTop);
|
||||
|
||||
// on mouse move, move the sticky to the position, minus the offset, of the mouse
|
||||
document.onmousemove = documentEvent => {
|
||||
sticky.style.top = (documentEvent.clientY - pos.y) + 'px';
|
||||
sticky.style.left = (documentEvent.clientX - pos.x) + 'px';
|
||||
sticky.setAttribute("moved", "true");
|
||||
}
|
||||
// when done, remove mouse move and mouse up handlers.
|
||||
document.onmouseup = () => {
|
||||
document.onmouseup = null;
|
||||
document.onmousemove = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function waitForElement(selector) {
|
||||
return new Promise(resolve => {
|
||||
if (document.querySelector(selector)) {
|
||||
return resolve(document.querySelector(selector));
|
||||
}
|
||||
|
||||
const observer = new MutationObserver(mutations => {
|
||||
if (document.querySelector(selector)) {
|
||||
observer.disconnect();
|
||||
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, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const checkBottom = (attach) => {
|
||||
// check if top or bottom
|
||||
if (attach.y < 0) {
|
||||
attach.ys = "bottom";
|
||||
attach.y = attach.y * -1;
|
||||
}
|
||||
}
|
||||
|
||||
const setStickyPostions = (s, attach) => {
|
||||
// set
|
||||
s.style[attach.ys] = `${attach.y}px`;
|
||||
s.style[attach.xs] = `${attach.x}px`;
|
||||
s.style.display = "grid";
|
||||
}
|
||||
|
||||
const css = (el, attr) => {
|
||||
let st = ""
|
||||
Object.entries(attr).forEach(val => {
|
||||
const [key, value] = val;
|
||||
st += `${key}: ${value}; `;
|
||||
})
|
||||
el.setAttribute("style",st.trim());
|
||||
}
|
||||
|
||||
|
||||
const calculateStickyPosition = (s) => {
|
||||
let float = s.getAttribute("float");
|
||||
let p = s.parentNode.getBoundingClientRect()
|
||||
switch (float) {
|
||||
case "left":
|
||||
css(s, {left: (p.left * -1) + "px"})
|
||||
break;
|
||||
case "right":
|
||||
css(s, { left: (Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) - p.left - s.offsetWidth - (font.size * 2)) + "px" });
|
||||
break;
|
||||
}
|
||||
|
||||
let offset = s.getAttribute("offset");
|
||||
if (offset !== null) {
|
||||
offset = offset.trim().split(" ");
|
||||
css(s, {top: offset[0], left: offset[1] })
|
||||
}
|
||||
}
|
||||
|
||||
export function init(p = document){
|
||||
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px",""));
|
||||
|
||||
p.querySelectorAll("sticky-note").forEach((s) => {
|
||||
if (s.querySelectorAll("svg").length == 0) {
|
||||
|
||||
let wrapper = document.createElement("sticky-note-wrapper");
|
||||
|
||||
s.parentNode.insertBefore(wrapper, s);
|
||||
wrapper.appendChild(s);
|
||||
|
||||
s.setAttribute("content", s.innerHTML.replace(/"/g, "\""));
|
||||
s.innerHTML = `<div><svg width='0' height='0'><defs><clipPath id='stickyClip' clipPathUnits='objectBoundingBox'><path d='M 0 0 Q 0 0.69, 0.03 0.96 0.03 0.96, 1 0.96 Q 0.96 0.69, 0.96 0 0.96 0, 0 0' stroke-linejoin='round' stroke-linecap='square' /></clipPath></defs></svg></div><div><div>${s.innerHTML}</div></div>`;
|
||||
}
|
||||
calculateStickyPosition(s);
|
||||
drag(s);
|
||||
s.ondblclick = (e) => {
|
||||
if (e.ctrlKey) {
|
||||
calculateStickyPosition(s);
|
||||
} else {
|
||||
// add one click select
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
window.onresize = () => {
|
||||
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px",""));
|
||||
let stickies = p.querySelectorAll("sticky-note");
|
||||
stickies.forEach((s) => {
|
||||
calculateStickyPosition(s);
|
||||
});
|
||||
}
|
||||
}</pre>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
109
public/patterns/core/components/switch/index.html
Normal file
109
public/patterns/core/components/switch/index.html
Normal file
@@ -0,0 +1,109 @@
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Pattern</title>
|
||||
</head>
|
||||
<body data-prismjs-copy-timeout="1500">
|
||||
<h2>What is it</h2>
|
||||
<h2>When to use it</h2>
|
||||
<h2>How to use it</h2>
|
||||
<h2>Example</h2>
|
||||
<p class="switch">
|
||||
<label for="example-switch">Switch label</label><span id="example-switch" role="switch"></span>
|
||||
</p>
|
||||
<div class="tab-group" id="switches">
|
||||
<pre class="language-html" data-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-css" data-tab="css">[role=switch] {
|
||||
display: -ms-inline-grid;
|
||||
display: inline-grid;
|
||||
border: 1px solid var(--colour-blue);
|
||||
background-color: var(--colour-grey-xl);
|
||||
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: var(--colour-blue);
|
||||
}
|
||||
[role=switch][aria-checked=true] > span {
|
||||
margin-left: calc(1.5rem - 5%);
|
||||
}</pre>
|
||||
<pre class="language-css" data-tab="scss">//- DS2 core (c) 2024 Alexander McIlwraith
|
||||
//- Licensed under CC BY-SA 4.0
|
||||
|
||||
@use "sass:math";
|
||||
|
||||
$switch-accent: var(--colour-blue) !default; // switch background when switched right (on/ true)
|
||||
$switch-background: var(--colour-grey-xl) !default; // switch background when switched left (off / false)
|
||||
$switch-color: var(--colour-white) !default; // the colour of the switch
|
||||
$switch-height: 1.5rem !default;
|
||||
|
||||
@mixin switch {
|
||||
[role='switch'] {
|
||||
display: inline-grid;
|
||||
border: 1px solid $switch-accent;
|
||||
background-color: $switch-background;
|
||||
border-radius: math.div($switch-height, 2);
|
||||
height: $switch-height;
|
||||
width: #{$switch-height * 2};
|
||||
transition: all 500ms;
|
||||
> span {
|
||||
display: inline-block;
|
||||
background-color: white;
|
||||
border-radius: 50%;
|
||||
margin: 2%;
|
||||
width: calc(#{$switch-height} - 2%);
|
||||
transition: all 500ms;
|
||||
}
|
||||
|
||||
&[aria-checked="true"] {
|
||||
background-color: $switch-accent;
|
||||
> span {
|
||||
margin-left: calc(#{$switch-height} - 5%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}</pre>
|
||||
<pre class="language-js" data-tab="js">//- DS2 core (c) 2024 Alexander McIlwraith
|
||||
//- Licensed under CC BY-SA 4.0
|
||||
|
||||
function flip(e) {
|
||||
let sw = e.currentTarget;
|
||||
switch(sw.getAttribute("aria-checked")) {
|
||||
case "true":
|
||||
sw.setAttribute("aria-checked", "false");
|
||||
break;
|
||||
case "false":
|
||||
sw.setAttribute("aria-checked", "true");
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function init(callback){
|
||||
let sw = document.querySelectorAll("[role='switch']");
|
||||
for (let i=0; i < sw.length; i++) {
|
||||
sw[i].innerHTML = "<span></span>";
|
||||
sw[i].setAttribute("aria-checked", "false");
|
||||
sw[i].setAttribute("tabindex", "0");
|
||||
sw[i].addEventListener("click", flip, false);
|
||||
sw[i].addEventListener("keypress", flip, false);
|
||||
}
|
||||
}
|
||||
|
||||
export {init};</pre>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
100
public/patterns/core/layouts/breakpoints/index.html
Normal file
100
public/patterns/core/layouts/breakpoints/index.html
Normal file
@@ -0,0 +1,100 @@
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Pattern</title>
|
||||
</head>
|
||||
<body data-prismjs-copy-timeout="1500">
|
||||
<h2>What is it</h2>
|
||||
<h2>When to use it</h2>
|
||||
<h2>How to use it</h2>
|
||||
<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">
|
||||
<pre class="language-css" data-tab="scss">//- DS2 core (c) 2024 Alexander McIlwraith
|
||||
//- Licensed under CC BY-SA 4.0
|
||||
|
||||
$grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px ) !default;
|
||||
|
||||
@mixin breakpoint-debug {
|
||||
body::before, body::after {
|
||||
background-color: #555;
|
||||
color: white;
|
||||
content: "bigger than extra large";
|
||||
display: grid;
|
||||
font-size: 25px;
|
||||
grid-template-columns: auto;
|
||||
padding: 25px;
|
||||
place-content: center;
|
||||
// text-align: center;
|
||||
@include break(-xl) {
|
||||
content: "extra large";
|
||||
}
|
||||
@include break(-lg) {
|
||||
content: "large";
|
||||
}
|
||||
@include break(-md) {
|
||||
content: "medium";
|
||||
}
|
||||
@include break(-sm) {
|
||||
content: "small";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@mixin break($bps, $points: $grid-breakpoints) {
|
||||
|
||||
@each $bp in $bps {
|
||||
|
||||
$min: 0;
|
||||
$max: 0;
|
||||
|
||||
@if str-length($bp) == 2 {
|
||||
|
||||
// only a single break point was received
|
||||
$min: map-get($points, $bp);
|
||||
$max: map-get($points, nth(map-keys($points), index(map-keys($points), $bp) + 1));
|
||||
|
||||
} @else {
|
||||
|
||||
|
||||
@if str-slice($bp, 0, 1) == "-" {
|
||||
// no lower breakpoint was received
|
||||
$min: null;
|
||||
$max: map-get($points, str-slice($bp, 2, 3));
|
||||
|
||||
} @else {
|
||||
|
||||
$min: map-get($points, unquote(str-slice($bp, 0, 2)));
|
||||
|
||||
|
||||
@if str-length($bp) == 3 {
|
||||
// no upper break point was received
|
||||
$max: null;
|
||||
} @else {
|
||||
$max: map-get($points, str-slice($bp, 4, 5));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@if $min != null and $max != null {
|
||||
// Makes the @content apply between the min and max breakpoints
|
||||
@media (min-width: $min) and (max-width: $max) {
|
||||
@content;
|
||||
}
|
||||
} @else if $min == null {
|
||||
// Makes the @content apply to the given breakpoint and narrower.
|
||||
@media (max-width: $max) {
|
||||
@content;
|
||||
}
|
||||
} @else if $max == null {
|
||||
// Makes the @content apply to the given breakpoint and wider.
|
||||
@media (min-width: $min) {
|
||||
@content;
|
||||
}
|
||||
} @else {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
}</pre>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
131
public/patterns/core/layouts/header/index.html
Normal file
131
public/patterns/core/layouts/header/index.html
Normal file
@@ -0,0 +1,131 @@
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Pattern</title>
|
||||
</head>
|
||||
<body data-prismjs-copy-timeout="1500">
|
||||
<div class="tab-group" id="header">
|
||||
<pre class="language-html" data-tab="html">
|
||||
<!-- create temp variables and store the design system values-->
|
||||
<header>
|
||||
<!-- The headline banner area -->
|
||||
<svg height="5.5rem" width="100%" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
||||
<text>[site name]</text>
|
||||
</svg>
|
||||
<div>
|
||||
<div class="header-title">
|
||||
<h1> <a href="[site root]">[site name]</a></h1>
|
||||
</div>
|
||||
<!-- Other sections can go here, such as search and directory-->
|
||||
</div>
|
||||
</header></pre>
|
||||
<pre class="language-sass" data-tab="scss">//- DS2 core (c) 2024 Alexander McIlwraith
|
||||
//- Licensed under CC BY-SA 4.0
|
||||
|
||||
$header-bg-color: var(--colour-grey-xxl) !default;
|
||||
$font-heading: sans-serif !default;
|
||||
$font-weight: 700 !default;
|
||||
|
||||
@mixin header {
|
||||
header {
|
||||
display: grid;
|
||||
grid-template-rows: 1.75rem 3.5rem;
|
||||
grid-column: 2 / 4;
|
||||
overflow: hidden;
|
||||
|
||||
svg {
|
||||
grid-column: 1 / -1;
|
||||
grid-row: 1 / -1;
|
||||
place-self: stretch;
|
||||
text {
|
||||
transform: translate(-1rem, 7.25rem);
|
||||
font-size: 10rem;
|
||||
font-weight: 1000;
|
||||
font-family: $font-heading;
|
||||
fill: $header-bg-color;
|
||||
}
|
||||
}
|
||||
> div {
|
||||
grid-row: 2;
|
||||
grid-column: 1 / -1;
|
||||
|
||||
display: grid;
|
||||
grid-column-gap: 1rem;
|
||||
grid-template-columns: auto max-content max-content;
|
||||
|
||||
.header-title {
|
||||
h1 {
|
||||
margin: 0;
|
||||
padding: 0 1rem;
|
||||
a, a:visited {
|
||||
border-bottom: none;
|
||||
color: var(--colour-black);
|
||||
font-family: $font-heading;
|
||||
font-size: 2.5rem;
|
||||
font-size: 32px;
|
||||
font-weight: $font-weight;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}</pre>
|
||||
<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>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
202
public/patterns/core/layouts/tabs/index.html
Normal file
202
public/patterns/core/layouts/tabs/index.html
Normal file
@@ -0,0 +1,202 @@
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Pattern</title>
|
||||
</head>
|
||||
<body data-prismjs-copy-timeout="1500">
|
||||
<h2>What is it</h2>
|
||||
<h2>When to use it</h2>
|
||||
<h2>How 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>
|
||||
<ul>
|
||||
<li>be logically chunked and ordered</li>
|
||||
<li>be arallel in nature</li>
|
||||
<li>show user's context</li>
|
||||
<li>obvious where they begin and end </li>
|
||||
</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>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>
|
||||
<tabset id="tabs">
|
||||
<pre class="language-html" tab="html">
|
||||
<div class="tab-group" id="uniqueID">
|
||||
<div data-tab="[tab title]"></div>
|
||||
<div data-tab="[tab title]"></div>
|
||||
</div></pre>
|
||||
<pre class="language-css" tab="css">tabset, .tab-group {
|
||||
margin: 2rem 0 1rem 0;
|
||||
}
|
||||
tabset > ul, .tab-group > ul {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
tabset > ul li.separator, .tab-group > ul li.separator {
|
||||
border-bottom: 1px solid var(--colour-grey);
|
||||
border-left: 1px solid var(--colour-grey);
|
||||
display: inline-block;
|
||||
margin: 0.45rem 0 0 0;
|
||||
width: 100%;
|
||||
}
|
||||
tabset .tab-hidden, .tab-group .tab-hidden {
|
||||
display: none;
|
||||
}
|
||||
tabset [role=tab], .tab-group [role=tab] {
|
||||
background-color: var(--colour-white);
|
||||
border-left: 1px solid var(--colour-grey);
|
||||
border-top: 1px solid var(--colour-grey);
|
||||
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;
|
||||
}
|
||||
tabset [role=tab]:last-of-type, .tab-group [role=tab]:last-of-type {
|
||||
border-right: 1px solid var(--colour-grey);
|
||||
}
|
||||
tabset [role=tab]:not(.selected), .tab-group [role=tab]:not(.selected) {
|
||||
background-color: var(--colour-grey-xxl);
|
||||
border-bottom: 1px solid var(--colour-grey);
|
||||
}
|
||||
tabset [role=tab] span, .tab-group [role=tab] span {
|
||||
display: block;
|
||||
margin: 0 0 0.5rem 0;
|
||||
}
|
||||
tabset [role=tabpanel], .tab-group [role=tabpanel] {
|
||||
background-color: var(--colour-white);
|
||||
border: 1px solid var(--colour-grey);
|
||||
border-top: none;
|
||||
padding: 1rem;
|
||||
z-index: 1;
|
||||
}
|
||||
tabset [role=tabpanel]:not(.open), .tab-group [role=tabpanel]:not(.open) {
|
||||
display: none;
|
||||
}</pre>
|
||||
<pre class="language-css" tab="scss">// DS2 core (c) 2024 Alexander McIlwraith
|
||||
// Licensed under CC BY-SA 4.0
|
||||
|
||||
$tab-border: var(--colour-grey) !default;
|
||||
$tab-selected: var(--colour-white) !default;
|
||||
$tab-notselected: var(--colour-grey-xxl) !default;
|
||||
|
||||
@mixin tabs {
|
||||
tabset, .tab-group {
|
||||
margin: 2rem 0 1rem 0;
|
||||
> ul {
|
||||
display: flex;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
li.separator {
|
||||
border-bottom: 1px solid $tab-border;
|
||||
border-left: 1px solid $tab-border;
|
||||
display: inline-block;
|
||||
margin: .45rem 0 0 0;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.tab-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
[role="tab"] {
|
||||
background-color: $tab-selected;
|
||||
border-left: 1px solid $tab-border;
|
||||
border-top: 1px solid $tab-border;
|
||||
border-radius: .5rem .5rem 0 0;
|
||||
cursor:pointer;
|
||||
margin: 0;
|
||||
display: inline;
|
||||
padding: 1rem 1.5rem .14rem 1.5rem;
|
||||
z-index: 2;
|
||||
|
||||
&:last-of-type {
|
||||
border-right: 1px solid $tab-border;
|
||||
}
|
||||
|
||||
&:not(.selected) {
|
||||
background-color: $tab-notselected;
|
||||
border-bottom: 1px solid $tab-border;
|
||||
}
|
||||
|
||||
span {
|
||||
display: block;
|
||||
margin: 0 0 .5rem 0;
|
||||
}
|
||||
|
||||
}
|
||||
[role="tabpanel"] {
|
||||
background-color: $tab-selected;
|
||||
border: 1px solid $tab-border;
|
||||
border-top: none;
|
||||
padding: 1rem;
|
||||
z-index: 1;
|
||||
|
||||
&:not(.open) {
|
||||
display: none;
|
||||
}
|
||||
@content;
|
||||
|
||||
}
|
||||
}
|
||||
}</pre>
|
||||
<pre class="language-css" tab="js">/* DS2 core (c) 2024 Alexander McIlwraith
|
||||
import * as tabs from "../pg/patterns/layouts/tabs/_tabs.js";
|
||||
tabs.init();
|
||||
*/
|
||||
|
||||
export function init(p = document) {
|
||||
p.querySelectorAll(".tab-group, tabset").forEach(tabGroup => {
|
||||
|
||||
if (tabGroup.querySelector("[role=tablist]") === null) {
|
||||
const tabgroup = tabGroup.getAttribute("id");
|
||||
let tablist = "";
|
||||
|
||||
Array.from(tabGroup.children).forEach(child => {
|
||||
const tab = child.getAttribute("tab") || child.getAttribute("data-tab");
|
||||
if (tab !== null) {
|
||||
const tabID = tab.replace(/\W+/g, "-").toLowerCase();
|
||||
const tabPanel = document.createElement('div');
|
||||
tabPanel.id = `tab-panel-${tabgroup}-${tabID}`;
|
||||
tabPanel.className = tablist === "" ? "open" : "";
|
||||
tabPanel.setAttribute("role", "tabpanel");
|
||||
tabPanel.setAttribute("tabindex", "0");
|
||||
tabPanel.setAttribute("aria-labelledby", `tab-${tabgroup}-${tabID}`);
|
||||
tabPanel.appendChild(child.cloneNode(true));
|
||||
child.parentNode.replaceChild(tabPanel, child);
|
||||
tablist += `<li tabindex="0" role="tab" ${tablist === "" ? "class='selected'" : ""} id="tab-${tabgroup}-${tabID}"><span>${tab}</span></li>`;
|
||||
} else {
|
||||
child.classList.add("tab-hidden");
|
||||
}
|
||||
});
|
||||
|
||||
const ul = document.createElement('ul');
|
||||
ul.setAttribute("role", "tablist");
|
||||
ul.innerHTML = `${tablist}<li role="separator" class="separator"></li>`;
|
||||
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
||||
|
||||
tabGroup.querySelectorAll('[role="tab"]').forEach(tab => {
|
||||
tab.addEventListener("click", () => {
|
||||
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)
|
||||
.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");
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
</pre>
|
||||
</tabset>
|
||||
</body>
|
||||
</html>
|
198
public/patterns/core/status/index.html
Normal file
198
public/patterns/core/status/index.html
Normal file
@@ -0,0 +1,198 @@
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Pattern</title>
|
||||
</head>
|
||||
<body data-prismjs-copy-timeout="1500">
|
||||
<div class="tab-group" id="status-report">
|
||||
<div class="status-report status-report-structure" data-tab="by&nbsp;structure">
|
||||
<table class="custom" role="presentation">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2">This pattern doesn't exist (1)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="./?p=this-pattern-doesn't-exist"> This pattern doesn't exist</a></td>
|
||||
<td><span class="status-deprecated">Deprecated</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">Colours (1)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="./?p=colours"> Colours</a></td>
|
||||
<td><span class="status-complete">Complete</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">Components (4)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="./?p=components"> Components</a></td>
|
||||
<td><span class="status-complete">Complete</span></td>
|
||||
<tr>
|
||||
<td><a href="./?p=components/sticky-note"> Sticky note</a></td>
|
||||
<td><span class="status-in-progress">In progress</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="./?p=components/switch"> Switch</a></td>
|
||||
<td><span class="status-in-progress">In progress</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="./?p=components/tooltip"> Tooltip</a></td>
|
||||
<td><span class="status-in-progress">In progress</span></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">Layouts (4)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="./?p=layouts"> Layouts</a></td>
|
||||
<td><span class="status-complete">Complete</span></td>
|
||||
<tr>
|
||||
<td><a href="./?p=layouts/header"> Header</a></td>
|
||||
<td><span class="status-in-progress">In progress</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="./?p=layouts/breakpoints"> Breakpoints</a></td>
|
||||
<td><span class="status-in-progress">In progress</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="./?p=layouts/tabs"> Tabs</a></td>
|
||||
<td><span class="status-complete">Complete</span></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">Status (1)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="./?p=status"> Status</a></td>
|
||||
<td><span class="status-complete">Complete</span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="status-report status-report-status" data-tab="by&nbsp;status">
|
||||
<table role="presentation">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2"><span class="status-not-started">Not started (0)</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><span class="status-in-progress">In progress (5)</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=layouts/breakpoints">Breakpoints</a></td>
|
||||
<td>Layouts</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=layouts/header">Header</a></td>
|
||||
<td>Layouts</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=components/sticky-note">Sticky note</a></td>
|
||||
<td>Components</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=components/switch">Switch</a></td>
|
||||
<td>Components</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=components/tooltip">Tooltip</a></td>
|
||||
<td>Components</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><span class="status-complete">Complete (5)</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=colours">Colours</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=components">Components</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=layouts">Layouts</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=status">Status</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=layouts/tabs">Tabs</a></td>
|
||||
<td>Layouts</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><span class="status-deprecated">Deprecated (1)</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=this-pattern-doesn't-exist">This pattern doesn't exist</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="status-report status-report-alpha" data-tab="alphabetical">
|
||||
<table role="presentation">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td> <a href="./?p=layouts/breakpoints">Breakpoints</a></td>
|
||||
<td><span><span class="status-in-progress">In Progress</span></span></td>
|
||||
<td>Layouts</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=colours">Colours</a></td>
|
||||
<td><span><span class="status-complete">Complete</span></span></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=components">Components</a></td>
|
||||
<td><span><span class="status-complete">Complete</span></span></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=layouts/header">Header</a></td>
|
||||
<td><span><span class="status-in-progress">In Progress</span></span></td>
|
||||
<td>Layouts</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=layouts">Layouts</a></td>
|
||||
<td><span><span class="status-complete">Complete</span></span></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=status">Status</a></td>
|
||||
<td><span><span class="status-complete">Complete</span></span></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=components/sticky-note">Sticky note</a></td>
|
||||
<td><span><span class="status-in-progress">In Progress</span></span></td>
|
||||
<td>Components</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=components/switch">Switch</a></td>
|
||||
<td><span><span class="status-in-progress">In Progress</span></span></td>
|
||||
<td>Components</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=layouts/tabs">Tabs</a></td>
|
||||
<td><span><span class="status-complete">Complete</span></span></td>
|
||||
<td>Layouts</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href="./?p=components/tooltip">Tooltip</a></td>
|
||||
<td><span><span class="status-in-progress">In Progress</span></span></td>
|
||||
<td>Components</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user