nk_jtb 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/index.html +16 -71
  2. package/main.js +1 -0
  3. package/package.json +5 -1
  4. package/public/images/logo.svg +1 -25
  5. package/scss/_nk.scss +10 -19
  6. package/scss/base/_base.scss +1 -1
  7. package/scss/base/_content_gap.scss +8 -2
  8. package/scss/base/_vars_base.scss +15 -4
  9. package/scss/base/_vars_colors.scss +3 -8
  10. package/scss/base/_vars_components.scss +17 -32
  11. package/scss/base/_vars_utility_maps.scss +17 -0
  12. package/scss/components/_box.scss +1 -1
  13. package/scss/components/_button.scss +1 -12
  14. package/scss/components/_dropdown.scss +0 -12
  15. package/scss/components/_hero.scss +2 -2
  16. package/scss/components/_icon.scss +1 -4
  17. package/scss/components/_list.scss +32 -0
  18. package/scss/components/_menu.scss +12 -6
  19. package/scss/components/_navbar.scss +10 -2
  20. package/scss/components/_other.scss +11 -16
  21. package/scss/components/_sidebar.scss +20 -6
  22. package/scss/forms/_index.scss +1 -0
  23. package/scss/forms/_toggle.scss +54 -0
  24. package/scss/functions/_colorFunctions.scss +35 -0
  25. package/scss/functions/_helpers.scss +4 -0
  26. package/scss/jtb.scss +6 -2
  27. package/scss/layouts/__two-column.scss +32 -0
  28. package/scss/mixins/_colorSchemeSimple.scss +1 -1
  29. package/scss/mixins/_createState.scss +1 -1
  30. package/scss/mixins/_makeColorSchemeAdvanced.scss +1 -1
  31. package/scss/mixins/_makeCssPropertyMixins.scss +8 -3
  32. package/scss/mixins/_makeMagicClass.scss +61 -0
  33. package/scss/mixins/_makeMagicGrid2Cols.scss +70 -0
  34. package/scss/mixins/_makeMagicGridFixedWidth.scss +55 -0
  35. package/scss/mixins/_makeResponsiveClasses.scss +91 -0
  36. package/scss/mixins/_makeResponsivePositionUtilities.scss +3 -3
  37. package/scss/mixins/_media.scss +25 -24
  38. package/scss/play.scss +30 -0
  39. package/scss/utilities/_border.scss +24 -0
  40. package/scss/utilities/_display_visibility.scss +21 -148
  41. package/scss/utilities/_flex.scss +11 -1
  42. package/scss/utilities/_general.scss +12 -19
  43. package/scss/utilities/_grid.scss +44 -126
  44. package/scss/utilities/_opacity.scss +8 -0
  45. package/scss/utilities/_position.scss +11 -14
  46. package/scss/utilities/_sizes.scss +24 -34
  47. package/scss/utilities/_spacing.scss +53 -29
  48. package/scss/utilities/_state.scss +7 -0
  49. package/scss/utilities/_text.scss +39 -12
  50. package/scss/utilities/_themes.scss +46 -35
  51. package/scss/utilities/_transition.scss +5 -0
  52. package/scss/utilities/_translate.scss +32 -0
  53. package/public/images/hero-lg.jpg +0 -0
  54. package/public/images/hero-md.jpg +0 -0
  55. package/public/images/hero-sm.jpg +0 -0
  56. package/public/images/hero-xl.jpg +0 -0
  57. package/public/images/logo-alt.svg +0 -24
  58. package/public/images/logo.png +0 -0
  59. package/public/images/painting.jpg +0 -0
  60. package/scss/_play.scss +0 -34
  61. package/scss/functions/_setTextColor.scss +0 -12
  62. package/tests.html +0 -252
@@ -24,21 +24,16 @@
24
24
  }
25
25
  }
26
26
 
27
- // ==========================================================================
28
- // -- Badge --
29
- // ==========================================================================
30
27
  .badge {
31
- position: absolute;
32
- top: 3px;
33
- right: 3px;
34
- height: 20px;
35
- min-width: 20px;
36
- border-radius: 50%;
37
- display: flex;
38
- justify-content: center;
39
- align-items: center;
40
- font-size: 12px;
41
- background-color: hsl(354, 70%, 54%);
42
- border: 1px solid hsl(354, 70%, 44%);
43
- color: rgb(255, 255, 255);
28
+ // font-size: 0.75em;
29
+ // padding-left: 0.25em;
30
+ // padding-right: 0.25em;
31
+ // padding-top: 0.25em;
32
+ // padding-bottom: 0.25em;
33
+
34
+ padding: 0.25em 0.4em;
35
+ font-size: .7rem;
36
+ line-height: 1;
37
+ text-align: center;
38
+ border-radius: 0.25rem;
44
39
  }
@@ -3,10 +3,24 @@
3
3
  left: 0;
4
4
  top: 0;
5
5
  bottom: 0;
6
- width: 100%;
7
- max-width: 360px;
8
- z-index: 1000;
6
+ right: 0;
7
+ // width: 100%;
8
+ // max-width: 360px;
9
+ // z-index: 1000;
10
+ // overflow-y: auto;
11
+ // outline: none;
12
+ // transition: transform 0.25s ease-in-out;
13
+ z-index: 500;
14
+ }
15
+
16
+ .overlay {
17
+ position: fixed;
18
+ top: 0;
19
+ bottom: 0;
20
+ left: 0;
21
+ right: 0;
9
22
  overflow-y: auto;
10
- outline: none;
11
- transition: transform 0.25s ease-in-out;
12
- }
23
+ background: rgba(0, 0, 0, 0.7);
24
+ z-index: 30;
25
+ margin: 0;
26
+ }
@@ -1,2 +1,3 @@
1
1
  @forward './form';
2
2
  @forward './file';
3
+ @forward './toggle';
@@ -0,0 +1,54 @@
1
+ @use "../utilities/display_visibility" as *;
2
+ @use "../utilities/transition" as *;
3
+
4
+ $toggle-body-height: 1.5rem;
5
+ $toggle-body-width: 3rem;
6
+ $toggle-gap: 0.25rem;
7
+
8
+ .toggle {
9
+ position: relative;
10
+ display: inline-flex;
11
+ align-items: center;
12
+ cursor: pointer;
13
+
14
+ input[type="checkbox"] {
15
+ @extend .sr-only;
16
+ }
17
+
18
+ // toggle body
19
+ div {
20
+ border-radius: 9999px;
21
+ width: $toggle-body-width;
22
+ height: $toggle-body-height;
23
+ background-color: hsl(0deg, 0%, 90%);
24
+
25
+ // toggle off
26
+ &::after {
27
+ position: absolute;
28
+ content: "";
29
+ height: calc($toggle-body-height - $toggle-gap);
30
+ width: calc($toggle-body-height - $toggle-gap);
31
+ top: calc($toggle-gap / 2);
32
+ left: calc($toggle-gap / 2);
33
+ background-color: hsl(0, 0%, 100%);
34
+ border-color: rgba(0, 0, 0, 0.15);
35
+ border-radius: 9999px;
36
+ border-width: 1px;
37
+ @extend .transition;
38
+ }
39
+ }
40
+ }
41
+
42
+ input[type="checkbox"]:checked {
43
+ // toggle body on (checked)
44
+ ~ div {
45
+ background-color: hsl(100, 70%, 40%);
46
+ @extend .transition;
47
+ // toggle when checked
48
+ &::after {
49
+ // background-color: hsl(50, 10%, 10%);
50
+ transform: translateX(calc($toggle-body-width - $toggle-body-height));
51
+ @extend .transition;
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,35 @@
1
+ @use "../base/vars_base" as *;
2
+
3
+ // set text colour based on the background
4
+ // --------------------------------------------------------------------------
5
+
6
+ @function setTextColor($bg-color) {
7
+ @if (lightness($bg-color) > 60) {
8
+ @return $base-color;
9
+ } @else {
10
+ @return #fff;
11
+ }
12
+ }
13
+
14
+ // --------------------------------------------------------------
15
+ // -- CONVERT COLOR TO RGBA --
16
+ // --------------------------------------------------------------
17
+ // will convert when passing in rgb, hex or hsl
18
+ //
19
+ // manually set a colour to convert
20
+ // background-color: convertToRgba(#e23465);
21
+ //
22
+ // optionally set the opacity
23
+ // background-color: convertToRgba(#e23465, 0.5);
24
+ //
25
+ // fetch a color from the color-map
26
+ // background-color: convertToRgba(map-get($color-map, 'blue'));
27
+
28
+ @function convertToRgba($color, $alpha: 1) {
29
+ @return rgba(red($color), green($color), blue($color), $alpha);
30
+ }
31
+
32
+
33
+
34
+
35
+
@@ -40,3 +40,7 @@
40
40
  // search and escape decimals
41
41
  @return strReplace($class, ".", "\\.");
42
42
  }
43
+
44
+
45
+
46
+
package/scss/jtb.scss CHANGED
@@ -13,28 +13,32 @@
13
13
  @forward "nk";
14
14
  @forward "forms";
15
15
 
16
-
17
16
  @forward "components/accordion";
18
17
  @forward "components/box";
19
18
  @forward "components/button";
20
19
  @forward "components/dropdown";
21
20
  @forward "components/hero"; // has problems with img
22
21
  @forward "components/icon";
22
+ @forward "components/list";
23
23
  @forward "components/menu";
24
24
  @forward "components/navbar";
25
25
  @forward "components/other";
26
26
  @forward "components/sidebar";
27
27
 
28
+ // this is completly optional
29
+ // @forward "layouts/_two-column";
28
30
 
29
31
  @forward "utilities/border";
30
32
  @forward "utilities/display_visibility";
31
33
  @forward "utilities/flex";
32
34
  @forward "utilities/general";
33
35
  @forward "utilities/grid";
36
+ @forward "utilities/opacity";
34
37
  @forward "utilities/position";
35
38
  @forward "utilities/sizes";
36
39
  @forward "utilities/spacing";
37
40
  @forward "utilities/state";
38
41
  @forward "utilities/text";
39
42
  @forward "utilities/themes";
40
-
43
+ @forward "utilities/transition";
44
+ @forward "utilities/translate";
@@ -0,0 +1,32 @@
1
+ @use "../mixins/media" as *;
2
+ @use "../base/vars_base" as *;
3
+
4
+ // These are common design patterns layouts
5
+
6
+ // add reverse to swap column positions or use order utility classes??
7
+
8
+ // utility structure
9
+
10
+ // <div class="flex-col md:flex-row gg">
11
+ // <div class="w-24-full"></div>
12
+ // <div class="fg1"></div>
13
+ // </div>
14
+
15
+ // TEST: can i still override??
16
+ .two-column {
17
+ display: flex;
18
+ // gap: 3rem;
19
+
20
+ // > div {
21
+ // flex: 1;
22
+ // }
23
+
24
+ // aside {
25
+ // width: 24rem;
26
+ // flex: 0 1 100%;
27
+ // }
28
+
29
+ // @include to-lg {
30
+ // flex-direction: column;
31
+ // }
32
+ }
@@ -1,4 +1,4 @@
1
- @use '../functions/setTextColor' as *;
1
+ @use '../functions/colorFunctions' as *;
2
2
 
3
3
  // $base, $border-color (optional), $font-color (optional)
4
4
  // call with - @include colorSchemeSimple($base-color)
@@ -1,4 +1,4 @@
1
- @use "../functions/setTextColor" as *;
1
+ @use "../functions/colorFunctions" as *;
2
2
 
3
3
  @mixin hover($bg, $lightenBy: 10%, $color: setTextColor($bg),) {
4
4
  &:hover {
@@ -1,6 +1,6 @@
1
1
  @use "../base/vars_all" as *; // required to set defaults
2
2
  @use "../mixins/colorSchemeSimple" as *;
3
- @use "../functions/setTextColor" as *;
3
+ @use "../functions/colorFunctions" as *;
4
4
 
5
5
  // The minimum requirement for creating a theme-map is the $base
6
6
  // color, all other properties can be created intuitively.
@@ -13,9 +13,12 @@
13
13
  // --------------------------------------------------------------
14
14
  // -- CREATE SINGLE CSS PROPERTY --
15
15
  // --------------------------------------------------------------
16
-
17
- @mixin makeCssProperty($property, $value) {
18
- #{$property}: $value;
16
+ // creates a single size based properties. if the situation arises when you do
17
+ // not need a unit, re-write with conditional
18
+ @mixin makeCssProperty($property, $value, $unit: null) {
19
+ $val: if($value == "full", 100, $value);
20
+ $u: if($value == "full", "%", $unit);
21
+ #{$property}: #{$val}#{$u};
19
22
  }
20
23
 
21
24
  // --------------------------------------------------------------
@@ -26,3 +29,5 @@
26
29
  #{$property}: $value;
27
30
  }
28
31
  }
32
+
33
+
@@ -0,0 +1,61 @@
1
+ @use "./media" as *;
2
+ @use "./makeCssPropertyMixins" as *;
3
+ @use "sass:list";
4
+ @use "sass:map";
5
+ @use "sass:string";
6
+
7
+ // Make magic responsive class for a single css property.
8
+ //
9
+ // accepts single css property with list of lists with responsive sizes
10
+
11
+ @mixin makeMagicClass($property, $prefix, $listOfLists, $unit: rem) {
12
+ // must have at least two list
13
+ @each $list in $listOfLists {
14
+ // exclude empty list when creating single list
15
+ @if ($list != ()) {
16
+ $numBreakPoints: list.length($list);
17
+
18
+ // set the value of the BP based on position using negative
19
+ // numbers. This makes sure the position is always the same
20
+ $smValue: nth($list, -1);
21
+ $mdValue: nth($list, -2);
22
+ $lgValue: if($numBreakPoints >= 3, nth($list, -3), null);
23
+ $xlValue: if($numBreakPoints >= 4, nth($list, -4), null);
24
+ $xxlValue: if($numBreakPoints >= 5, nth($list, -5), null);
25
+
26
+ $derived-class: #{$mdValue}-#{$smValue};
27
+
28
+ @if ($numBreakPoints == 3) {
29
+ $derived-class: #{$lgValue}-#{$mdValue}-#{$smValue};
30
+ } @else if ($numBreakPoints == 4) {
31
+ $derived-class: #{$xlValue}-#{$lgValue}-#{$mdValue}-#{$smValue};
32
+ } @else if ($numBreakPoints == 5) {
33
+ $derived-class: #{$xxlValue}-#{$xlValue}-#{$lgValue}-#{$mdValue}-#{$smValue};
34
+ }
35
+
36
+ .#{$prefix}-#{$derived-class} {
37
+ @include from-sm {
38
+ @include makeCssProperty($property, $smValue, $unit);
39
+ }
40
+ @include from-md {
41
+ @include makeCssProperty($property, $mdValue, $unit);
42
+ }
43
+ @if ($numBreakPoints >= 3) {
44
+ @include from-lg {
45
+ @include makeCssProperty($property, $lgValue, $unit);
46
+ }
47
+ }
48
+ @if ($numBreakPoints >= 4) {
49
+ @include from-xl {
50
+ @include makeCssProperty($property, $xlValue, $unit);
51
+ }
52
+ }
53
+ @if ($numBreakPoints >= 5) {
54
+ @include from-xxl {
55
+ @include makeCssProperty($property, $xxlValue,$unit);
56
+ }
57
+ }
58
+ }
59
+ }
60
+ }
61
+ }
@@ -0,0 +1,70 @@
1
+ @use "../base/vars_utility_maps" as *;
2
+ @use "../mixins/media" as *;
3
+ @use "sass:list";
4
+
5
+ // mobile = 100
6
+ // small = 100
7
+ // medium = 50
8
+ // large = 30
9
+
10
+ // only need to add 1st column percentage, 2nd is calculated
11
+ // (25, 25) is shorthand for {25:75}_{25:75}_{100}
12
+
13
+ // The more sizes you add will cover more breakpoints.
14
+
15
+ // There is no need to specify a size for the smallest breakpoint as it will be automatically set to 100 percent in the make function.
16
+
17
+ // For example, if there are 2 sizes in the list there will be 3 breakpoints lg, md, and sm.
18
+
19
+ // In this example, only the first column width has been set as the second column width will be calculate and included automatically.
20
+
21
+ // Grid will display in rows by default, size are min-size so you do not need to worry about adding the smallest size as it will be 100% by default
22
+
23
+
24
+ @mixin makeMagicGrid2Cols($listOfLists) {
25
+ // must have at least two list
26
+ @each $list in $listOfLists {
27
+ // exclude empty list when creating single list
28
+ @if ($list != ()) {
29
+ $numBreakPoints: list.length($list);
30
+
31
+ $smValue: nth($list, -1);
32
+ $mdValue: nth($list, -2);
33
+ $lgValue: if($numBreakPoints >= 3, nth($list, -3), null);
34
+ $xlValue: if($numBreakPoints >= 4, nth($list, -4), null);
35
+ $xxlValue: if($numBreakPoints >= 5, nth($list, -5), null);
36
+
37
+ $class: #{$mdValue}_#{$smValue};
38
+
39
+ @if ($numBreakPoints == 3) {
40
+ $class: #{$lgValue}_#{$mdValue}_#{$smValue};
41
+ } @else if ($numBreakPoints == 4) {
42
+ $class: #{$xlValue}_#{$lgValue}_#{$mdValue}_#{$smValue};
43
+ } @else if ($numBreakPoints == 5) {
44
+ $class: #{$xxlValue}_#{$xlValue}_#{$lgValue}_#{$mdValue}_#{$smValue};
45
+ }
46
+
47
+ .cols-#{$class} {
48
+ @include from-sm {
49
+ grid-template-columns: nth(map-get($fr-map-2-col, $smValue), 1) nth(map-get($fr-map-2-col, $smValue), 2);
50
+ }
51
+
52
+ @include from-md {
53
+ grid-template-columns: nth(map-get($fr-map-2-col, $mdValue), 1) nth(map-get($fr-map-2-col, $mdValue), 2);
54
+ }
55
+
56
+ @if ($numBreakPoints >= 3) {
57
+ @include from-lg {
58
+ grid-template-columns: nth(map-get($fr-map-2-col, $lgValue), 1) nth(map-get($fr-map-2-col, $lgValue), 2);
59
+ }
60
+ }
61
+
62
+ @if ($numBreakPoints >= 4) {
63
+ @include from-xl {
64
+ grid-template-columns: nth(map-get($fr-map-2-col, $xlValue), 1) nth(map-get($fr-map-2-col, $xlValue), 2);
65
+ }
66
+ }
67
+ }
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,55 @@
1
+ @use "../base/vars_utility_maps" as *;
2
+ @use "../mixins/media" as *;
3
+ @use "sass:list";
4
+
5
+
6
+ @mixin makeMagicGridFixedWidth($listOfLists) {
7
+ // must have at least two list
8
+ @each $list in $listOfLists {
9
+ // exclude empty list when creating single list
10
+ @if ($list != ()) {
11
+ $numBreakPoints: list.length($list);
12
+
13
+ $smValue: nth($list, -1);
14
+ $mdValue: nth($list, -2);
15
+ $lgValue: if($numBreakPoints >= 3, nth($list, -3), null);
16
+ $xlValue: if($numBreakPoints >= 4, nth($list, -4), null);
17
+ $xxlValue: if($numBreakPoints >= 5, nth($list, -5), null);
18
+
19
+ $derived-class: #{$mdValue}-#{$smValue};
20
+
21
+ @if ($numBreakPoints == 3) {
22
+ $derived-class: #{$lgValue}-#{$mdValue}-#{$smValue};
23
+ } @else if ($numBreakPoints == 4) {
24
+ $derived-class: #{$xlValue}-#{$lgValue}-#{$mdValue}-#{$smValue};
25
+ } @else if ($numBreakPoints == 5) {
26
+ $derived-class: #{$xxlValue}-#{$xlValue}-#{$lgValue}-#{$mdValue}-#{$smValue};
27
+ }
28
+
29
+ .cols-#{$derived-class} {
30
+ // @include from-sm {
31
+ // grid-template-columns: repeat(nth($list, -1), 1fr);
32
+ // }
33
+
34
+ // I am not convinced that I need the small size!!
35
+ grid-template-columns: repeat(nth($list, -1), 1fr);
36
+
37
+ @include from-md {
38
+ grid-template-columns: repeat(nth($list, -2), 1fr);
39
+ }
40
+
41
+ @if ($numBreakPoints >= 3) {
42
+ @include from-lg {
43
+ grid-template-columns: repeat(nth($list, -3), 1fr);
44
+ }
45
+ }
46
+
47
+ @if ($numBreakPoints >= 4) {
48
+ @include from-xl {
49
+ grid-template-columns: repeat(nth($list, -4), 1fr);
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,91 @@
1
+ @use "./media" as *;
2
+
3
+ // At first glance it seems really dumb to create mixins full of if-else
4
+ // statements and that is because it is! SCSS will not allow interpolation for
5
+ // @include so there is no other way.
6
+
7
+ // ---------------- BEFORE YOU DO ANYTHING CRAZY ----------------
8
+ // must be marked !important to ensure override default property
9
+ // ---------------- BEFORE YOU DO ANYTHING CRAZY ----------------
10
+
11
+ @mixin makeFromDevice($prefix, $property, $value, $args...) {
12
+ @each $device in $args {
13
+ .#{$prefix}#{$device} {
14
+ @if ($device == "sm") {
15
+ @include from-sm {
16
+ #{$property}: $value !important;
17
+ }
18
+ } @else if($device == "md") {
19
+ @include from-md {
20
+ #{$property}: $value !important;
21
+ }
22
+ } @else if($device == "lg") {
23
+ @include from-lg {
24
+ #{$property}: $value !important;
25
+ }
26
+ } @else if($device == "xl") {
27
+ @include from-xl {
28
+ #{$property}: $value !important;
29
+ }
30
+ } @else if($device == "xxl") {
31
+ @include from-xxl {
32
+ #{$property}: $value !important;
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+ @mixin makeToDevice($prefix, $property, $value, $args...) {
40
+ @each $device in $args {
41
+ .#{$prefix}#{$device} {
42
+ @if ($device == "sm") {
43
+ @include to-sm {
44
+ #{$property}: $value !important;
45
+ }
46
+ } @else if($device == "md") {
47
+ @include to-md {
48
+ #{$property}: $value !important;
49
+ }
50
+ } @else if($device == "lg") {
51
+ @include to-lg {
52
+ #{$property}: $value !important;
53
+ }
54
+ } @else if($device == "xl") {
55
+ @include to-xl {
56
+ #{$property}: $value !important;
57
+ }
58
+ } @else {
59
+ @error 'The device '#{$device}' is not available for this mixin, you need to remove it from the args list.';
60
+ }
61
+ }
62
+ }
63
+ }
64
+
65
+ @mixin makeOnDevice($prefix, $property, $value, $args...) {
66
+ @each $device in $args {
67
+ .#{$prefix}#{$device} {
68
+ @if ($device == "sm") {
69
+ @include on-sm {
70
+ #{$property}: $value !important;
71
+ }
72
+ } @else if($device == "md") {
73
+ @include on-md {
74
+ #{$property}: $value !important;
75
+ }
76
+ } @else if($device == "lg") {
77
+ @include on-lg {
78
+ #{$property}: $value !important;
79
+ }
80
+ } @else if($device == "xl") {
81
+ @include on-xl {
82
+ #{$property}: $value !important;
83
+ }
84
+ } @else if($device == "xxl") {
85
+ @include on-xxl {
86
+ #{$property}: $value !important;
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
@@ -40,16 +40,16 @@
40
40
  .#{$class} {
41
41
  @include makeCssPositionProperty($property, #{nth($sizes-list, -1)}rem, $positions);
42
42
 
43
- @include from-tablet {
43
+ @include from-md {
44
44
  @include makeCssPositionProperty($property, #{nth($sizes-list, -2)}rem, $positions);
45
45
  }
46
46
 
47
- @include from-desktop {
47
+ @include from-xl {
48
48
  @include makeCssPositionProperty($property, #{nth($sizes-list, -3)}rem, $positions);
49
49
  }
50
50
 
51
51
  @if ($numSizes==4) {
52
- @include from-widescreen {
52
+ @include from-xxl {
53
53
  @include makeCssPositionProperty($property, #{nth($sizes-list, -4)}rem, $positions);
54
54
  }
55
55
  }