@funidata/fudis-core 0.0.2 → 0.0.4

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 (39) hide show
  1. package/_index.scss +29 -2
  2. package/package.json +3 -1
  3. package/src/components/alert/alert.scss +75 -0
  4. package/src/components/badge/badge.scss +39 -0
  5. package/src/components/button/button.scss +49 -15
  6. package/src/components/checkbox/checkbox.scss +85 -0
  7. package/src/components/checkbox-group/checkbox-group.scss +7 -0
  8. package/src/components/error-summary/error-summary.scss +47 -0
  9. package/src/components/fieldset/fieldset.scss +90 -0
  10. package/src/components/guidance/guidance.scss +80 -0
  11. package/src/components/horizontal-rule/horizontal-rule.scss +13 -0
  12. package/src/components/icon/icon.scss +238 -0
  13. package/src/components/label/label.scss +33 -0
  14. package/src/components/link/link.scss +18 -0
  15. package/src/components/loading-spinner/loading-spinner.scss +49 -0
  16. package/src/components/notification/notification.scss +49 -0
  17. package/src/components/popover/popover.scss +18 -0
  18. package/src/components/radio-button/radio-button.scss +107 -0
  19. package/src/components/radio-button-group/radio-button-group.scss +7 -0
  20. package/src/components/tab-navigation/tab-navigation.scss +99 -0
  21. package/src/components/text-area/text-area.scss +7 -0
  22. package/src/components/text-input/text-input.scss +17 -0
  23. package/src/components/validator-error-message/validator-error-message.scss +17 -0
  24. package/src/foundations/borders/mixins.scss +10 -10
  25. package/src/foundations/colors/mixins.scss +5 -5
  26. package/src/foundations/focus/mixins.scss +8 -8
  27. package/src/foundations/grid/mixins.scss +1 -1
  28. package/src/foundations/spacing/classes.scss +1 -2
  29. package/src/foundations/spacing/tokens.scss +3 -0
  30. package/src/foundations/typography/classes.scss +4 -21
  31. package/src/foundations/typography/mixins.scss +15 -4
  32. package/src/foundations/utilities/classes.scss +7 -11
  33. package/src/foundations/utilities/mixins.scss +0 -1
  34. package/src/foundations/z-index/mixins.scss +1 -1
  35. package/src/assets/fonts/fonts.scss +0 -33
  36. package/src/assets/fonts/woff/FiraSans-Light.woff2 +0 -0
  37. package/src/assets/fonts/woff/FiraSans-Medium.woff2 +0 -0
  38. package/src/assets/fonts/woff/FiraSans-Regular.woff2 +0 -0
  39. package/src/assets/fonts/woff/FiraSans-SemiBold.woff2 +0 -0
package/_index.scss CHANGED
@@ -1,7 +1,10 @@
1
- /*
1
+ /**
2
2
  * Export all Core SCSS files here
3
3
  */
4
- @forward './src/assets/fonts/fonts';
4
+
5
+ /**
6
+ * Assets and Foundations
7
+ */
5
8
  @forward './src/foundations/borders/tokens';
6
9
  @forward './src/foundations/breakpoints/tokens';
7
10
  @forward './src/foundations/colors/tokens';
@@ -22,4 +25,28 @@
22
25
  @forward './src/foundations/z-index/mixins';
23
26
  @forward './src/foundations/spacing/classes';
24
27
  @forward './src/foundations/utilities/classes';
28
+
29
+ /**
30
+ * Component styles
31
+ */
32
+ @forward './src/components/alert/alert';
25
33
  @forward './src/components/button/button';
34
+ @forward './src/components/badge/badge';
35
+ @forward './src/components/checkbox/checkbox';
36
+ @forward './src/components/checkbox-group/checkbox-group';
37
+ @forward './src/components/error-summary/error-summary';
38
+ @forward './src/components/fieldset/fieldset';
39
+ @forward './src/components/guidance/guidance';
40
+ @forward './src/components/horizontal-rule/horizontal-rule';
41
+ @forward './src/components/icon/icon';
42
+ @forward './src/components/label/label';
43
+ @forward './src/components/link/link';
44
+ @forward './src/components/loading-spinner/loading-spinner';
45
+ @forward './src/components/notification/notification';
46
+ @forward './src/components/popover/popover';
47
+ @forward './src/components/radio-button/radio-button';
48
+ @forward './src/components/radio-button-group/radio-button-group';
49
+ @forward './src/components/tab-navigation/tab-navigation';
50
+ @forward './src/components/text-area/text-area';
51
+ @forward './src/components/text-input/text-input';
52
+ @forward './src/components/validator-error-message/validator-error-message';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funidata/fudis-core",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Core styles and foundations for Fudis Design System",
5
5
  "files": [
6
6
  "src",
@@ -10,6 +10,7 @@
10
10
  "start": "storybook dev -p 6007",
11
11
  "build:storybook": "storybook build",
12
12
  "build:dist": "scripts/copy-files.sh",
13
+ "build:dist:watch": "nodemon --watch src --watch _index.scss --ext scss --exec \"npm run build:dist\"",
13
14
  "test": "echo \"Error: no test specified\" && exit 1"
14
15
  },
15
16
  "repository": {
@@ -36,6 +37,7 @@
36
37
  "@storybook/html": "^8.6.12",
37
38
  "@storybook/html-vite": "^8.6.12",
38
39
  "@storybook/test": "^8.6.12",
40
+ "nodemon": "^3.1.10",
39
41
  "sass-embedded": "^1.86.3",
40
42
  "storybook": "^8.6.12"
41
43
  }
@@ -0,0 +1,75 @@
1
+ @use '../../foundations/spacing/tokens.scss' as spacing;
2
+ @use '../../foundations/colors/mixins.scss' as colorMixin;
3
+ @use '../../foundations/colors/tokens.scss' as color;
4
+ @use '../../foundations/focus/mixins.scss' as focus;
5
+ @use '../../foundations/borders/mixins.scss' as border;
6
+
7
+ .fudis-alert {
8
+ display: flex;
9
+ align-items: center;
10
+ justify-content: center;
11
+ min-height: spacing.$spacing-lg;
12
+ text-align: center;
13
+
14
+ &__link {
15
+ margin-left: spacing.$spacing-xxs;
16
+ }
17
+
18
+ &__text {
19
+ flex-grow: 1;
20
+ }
21
+
22
+ &__close {
23
+ @include border.border-none;
24
+ @include colorMixin.bg-color('transparent');
25
+ @include border.outline('1px', 'solid', 'white');
26
+
27
+ display: flex;
28
+ align-items: center;
29
+ justify-content: center;
30
+ margin-right: spacing.$spacing-xxs;
31
+ margin-left: auto;
32
+ box-shadow: none;
33
+ width: spacing.$spacing-md;
34
+ height: spacing.$spacing-md;
35
+
36
+ &:focus {
37
+ @include focus.focus-generic;
38
+ }
39
+
40
+ &__warning {
41
+ @include border.outline('1px', 'solid', 'gray-dark');
42
+ }
43
+ }
44
+
45
+ &__info {
46
+ @include colorMixin.bg-color('primary');
47
+
48
+ p {
49
+ /* stylelint-disable-next-line property-disallowed-list, declaration-no-important */
50
+ color: color.$color-white !important;
51
+ }
52
+ }
53
+
54
+ &__success {
55
+ @include colorMixin.bg-color('green');
56
+
57
+ p {
58
+ /* stylelint-disable-next-line property-disallowed-list, declaration-no-important */
59
+ color: color.$color-white !important;
60
+ }
61
+ }
62
+
63
+ &__danger {
64
+ @include colorMixin.bg-color('red');
65
+
66
+ p {
67
+ /* stylelint-disable-next-line property-disallowed-list, declaration-no-important */
68
+ color: color.$color-white !important;
69
+ }
70
+ }
71
+
72
+ &__warning {
73
+ @include colorMixin.bg-color('yellow');
74
+ }
75
+ }
@@ -0,0 +1,39 @@
1
+ @use '../../foundations/colors/mixins.scss' as colorMixin;
2
+ @use '../../foundations/borders/mixins.scss' as border;
3
+ @use '../../foundations/typography/mixins.scss' as typography;
4
+ @use '../../foundations/spacing/tokens.scss' as spacing;
5
+
6
+ .fudis-badge {
7
+ @include border.border-radius('2px');
8
+ @include typography.badge-typography;
9
+ @include colorMixin.text-color('gray-dark');
10
+
11
+ display: inline-block;
12
+ padding: spacing.$pixel-1 spacing.$pixel-3;
13
+ vertical-align: middle;
14
+
15
+ &__accent {
16
+ @include colorMixin.bg-color('yellow-light');
17
+ @include border.border('1px', 'solid', 'yellow');
18
+ }
19
+
20
+ &__danger {
21
+ @include colorMixin.bg-color('red-light');
22
+ @include border.border('1px', 'solid', 'red');
23
+ }
24
+
25
+ &__primary {
26
+ @include colorMixin.bg-color('primary-light');
27
+ @include border.border('1px', 'solid', 'primary');
28
+ }
29
+
30
+ &__secondary {
31
+ @include colorMixin.bg-color('gray-extra-light');
32
+ @include border.border('1px', 'solid', 'gray-middle');
33
+ }
34
+
35
+ &__success {
36
+ @include colorMixin.bg-color('green-light');
37
+ @include border.border('1px', 'solid', 'green');
38
+ }
39
+ }
@@ -1,16 +1,16 @@
1
- @use '../../foundations/colors/mixins.scss' as colors;
1
+ @use '../../foundations/colors/mixins.scss' as colorMixin;
2
2
  @use '../../foundations/focus/mixins.scss' as focus;
3
- @use '../../foundations/borders/mixins.scss' as borders;
3
+ @use '../../foundations/borders/mixins.scss' as border;
4
4
  @use '../../foundations/typography/mixins.scss' as typography;
5
5
  @use '../../foundations/spacing/tokens.scss' as spacing;
6
6
  @use '../../foundations/utilities/mixins.scss' as utilities;
7
7
 
8
8
  .fudis-button {
9
9
  @include utilities.box-reset;
10
- @include borders.border-radius('2px');
11
- @include colors.bg-color('transparent');
10
+ @include border.border-radius('2px');
11
+ @include colorMixin.bg-color('transparent');
12
12
  @include typography.button-typography;
13
- @include borders.border('2px', 'solid', 'primary');
13
+ @include border.border('2px', 'solid', 'primary');
14
14
 
15
15
  display: inline-flex;
16
16
  align-items: center;
@@ -24,26 +24,34 @@
24
24
  @include focus.focus-generic;
25
25
  }
26
26
 
27
+ &:has(&__icon):not(&__label--hidden) {
28
+ padding-left: 0;
29
+ }
30
+
31
+ &[aria-disabled='true'] &__icon__component {
32
+ @include colorMixin.text-color('gray-dark');
33
+ }
34
+
27
35
  &[aria-disabled='true'] {
28
- @include colors.text-color('gray-dark');
29
- @include colors.bg-color('gray-light');
30
- @include borders.border('2px', 'solid', 'transparent');
31
- @include borders.outline('1px', 'dashed', 'gray-middle');
36
+ @include colorMixin.text-color('gray-dark');
37
+ @include colorMixin.bg-color('gray-light');
38
+ @include border.border('2px', 'solid', 'transparent');
39
+ @include border.outline('1px', 'dashed', 'gray-middle');
32
40
  }
33
41
 
34
42
  &__primary {
35
- @include colors.text-color('white');
36
- @include colors.bg-color('primary');
43
+ @include colorMixin.text-color('white');
44
+ @include colorMixin.bg-color('primary');
37
45
  }
38
46
 
39
47
  &__secondary {
40
- @include colors.text-color('primary');
41
- @include colors.bg-color('white');
48
+ @include colorMixin.text-color('primary');
49
+ @include colorMixin.bg-color('white');
42
50
  }
43
51
 
44
52
  &__tertiary {
45
- @include colors.text-color('primary');
46
- @include borders.border('2px', 'solid', 'transparent');
53
+ @include colorMixin.text-color('primary');
54
+ @include border.border('2px', 'solid', 'transparent');
47
55
  }
48
56
 
49
57
  &__size {
@@ -54,5 +62,31 @@
54
62
  &__medium {
55
63
  min-height: spacing.$spacing-lg;
56
64
  }
65
+
66
+ &__icon-only {
67
+ padding: 0;
68
+ width: spacing.$spacing-lg;
69
+ min-width: initial;
70
+ min-height: spacing.$spacing-lg;
71
+ }
72
+ }
73
+
74
+ &__label {
75
+ &--hidden {
76
+ padding: 0 spacing.$spacing-xs;
77
+ }
78
+ }
79
+
80
+ &__icon {
81
+ position: relative;
82
+ width: spacing.$spacing-lg;
83
+ height: spacing.$spacing-sm;
84
+
85
+ &__component {
86
+ position: absolute;
87
+ top: 50%;
88
+ left: 50%;
89
+ transform: translate(-50%, -50%);
90
+ }
57
91
  }
58
92
  }
@@ -0,0 +1,85 @@
1
+ @use '../../foundations/borders/mixins.scss' as border;
2
+ @use '../../foundations/spacing/tokens.scss' as spacing;
3
+ @use '../../foundations/colors/tokens.scss' as colors;
4
+ @use '../../foundations/colors/mixins.scss' as colorMixin;
5
+ @use '../../foundations/utilities/mixins.scss' as utilities;
6
+ @use '../../foundations/focus/mixins.scss' as focus;
7
+ @use '../../foundations/typography/mixins.scss' as typography;
8
+
9
+ .fudis-checkbox {
10
+ @include typography.body-text-md-regular;
11
+ @include colorMixin.text-color('gray-dark');
12
+
13
+ display: inline-flex;
14
+ position: relative;
15
+ align-items: center;
16
+ cursor: pointer;
17
+ width: auto;
18
+ min-height: spacing.$spacing-lg;
19
+
20
+ &__content {
21
+ display: inline-flex;
22
+ align-items: center;
23
+
24
+ &-wrapper {
25
+ display: flex;
26
+ align-items: center;
27
+ justify-content: center;
28
+ min-width: spacing.$spacing-lg;
29
+ min-height: spacing.$spacing-lg;
30
+ }
31
+
32
+ &__box {
33
+ @include border.border('1px', 'solid', 'gray-middle');
34
+
35
+ display: flex;
36
+ position: absolute;
37
+ align-items: center;
38
+ justify-content: center;
39
+ border-radius: 0;
40
+ width: spacing.$checkbox-size;
41
+ height: spacing.$checkbox-size;
42
+
43
+ &--focused {
44
+ @include focus.focus-checkbox;
45
+ }
46
+
47
+ &--disabled {
48
+ @include border.border('1px', 'dashed', 'gray-middle');
49
+ @include colorMixin.bg-color('gray-extra-light');
50
+
51
+ cursor: default;
52
+ }
53
+
54
+ &--invalid {
55
+ @include border.border('1px', 'solid', 'red');
56
+
57
+ box-shadow: 0 0 0 spacing.$pixel-3 colors.$color-red-light;
58
+ }
59
+ }
60
+
61
+ &__label {
62
+ position: relative;
63
+ padding-right: spacing.$spacing-xs;
64
+ padding-left: spacing.$spacing-xs;
65
+ }
66
+ }
67
+
68
+ &__input {
69
+ @include utilities.box-reset;
70
+
71
+ display: grid;
72
+ place-content: center;
73
+ opacity: 0;
74
+ width: spacing.$pixel-1;
75
+ height: spacing.$pixel-1;
76
+ }
77
+
78
+ /*
79
+ * If CheckboxGroup is disabled through "disabled" Input, we need to set pointer-event to none for each checkbox.
80
+ * This is not necessary when disabling comes through formControl.
81
+ */
82
+ &--disabled {
83
+ pointer-events: none;
84
+ }
85
+ }
@@ -0,0 +1,7 @@
1
+ @use '../../foundations/spacing/tokens.scss' as spacing;
2
+
3
+ .fudis-checkbox-group {
4
+ .fudis-fieldset-content {
5
+ margin-top: spacing.$spacing-none;
6
+ }
7
+ }
@@ -0,0 +1,47 @@
1
+ @use '../../foundations/colors/mixins.scss' as colorMixin;
2
+ @use '../../foundations/spacing/tokens.scss' as spacing;
3
+ @use '../../foundations/utilities/mixins.scss' as utilities;
4
+ @use '../../foundations/typography/mixins.scss' as typography;
5
+
6
+ .fudis-error-summary {
7
+ &__title {
8
+ @include utilities.box-reset;
9
+ @include colorMixin.text-color('gray-dark');
10
+ @include typography.body-text-md-regular;
11
+
12
+ margin-top: spacing.$pixel-2;
13
+ }
14
+
15
+ &__error-list {
16
+ @include utilities.box-reset;
17
+
18
+ margin-top: spacing.$spacing-xs;
19
+ margin-bottom: spacing.$pixel-2;
20
+ padding-left: 0;
21
+ list-style: none;
22
+
23
+ &__item {
24
+ position: relative;
25
+ margin-left: spacing.$spacing-sm;
26
+ padding-left: spacing.$spacing-xxs;
27
+
28
+ &::before {
29
+ @include colorMixin.bg-color('gray-dark');
30
+
31
+ position: absolute;
32
+ top: 50%;
33
+ left: 0;
34
+ transform: translate(calc(-1 * #{spacing.$spacing-xs}), -50%);
35
+ border-radius: spacing.$spacing-xxl;
36
+ width: spacing.$pixel-3;
37
+ height: spacing.$pixel-3;
38
+ vertical-align: middle;
39
+ content: '';
40
+ }
41
+
42
+ &:not(:last-of-type) {
43
+ margin-bottom: spacing.$spacing-xs;
44
+ }
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,90 @@
1
+ /* stylelint-disable selector-class-pattern */
2
+ @use '../../foundations/spacing/tokens.scss' as spacing;
3
+ @use '../../foundations/typography/mixins.scss' as typography;
4
+ @use '../../foundations/typography/tokens.scss' as typographyTokens;
5
+ @use '../../foundations/colors/mixins.scss' as colorMixin;
6
+ @use '../../foundations/focus/mixins.scss' as focus;
7
+ @use '../../foundations/borders/mixins.scss' as border;
8
+ @use '../../foundations/utilities/mixins.scss' as utilities;
9
+
10
+ .fudis-fieldset {
11
+ @include utilities.box-reset;
12
+ @include border.border-none;
13
+
14
+ display: grid;
15
+ grid-template-columns: 1fr;
16
+
17
+ &__legend {
18
+ @include utilities.box-reset;
19
+
20
+ display: contents;
21
+
22
+ &__main {
23
+ display: flex;
24
+ align-items: flex-end;
25
+
26
+ &:focus-visible {
27
+ @include focus.focus-generic;
28
+ }
29
+
30
+ &__text-content {
31
+ margin: spacing.$spacing-xxs 0;
32
+ min-height: spacing.$spacing-md;
33
+ }
34
+
35
+ &__text {
36
+ @include colorMixin.text-color('gray-dark');
37
+
38
+ margin-right: spacing.$spacing-xs;
39
+ }
40
+
41
+ &__required {
42
+ @include typography.text-field-label;
43
+ @include colorMixin.text-color('gray-middle');
44
+
45
+ display: inline-block;
46
+ vertical-align: bottom;
47
+ text-transform: initial;
48
+ /* stylelint-disable-next-line property-disallowed-list */
49
+ font-size: typographyTokens.$body-text-sm-font-size;
50
+ }
51
+
52
+ &__tooltip-button {
53
+ margin-top: auto;
54
+ }
55
+ }
56
+
57
+ &__sm {
58
+ @include typography.text-field-label;
59
+ }
60
+
61
+ &__md {
62
+ @include typography.heading-xs;
63
+
64
+ .fudis-fieldset__legend__main__text,
65
+ .fudis-fieldset__legend__main__required {
66
+ vertical-align: sub;
67
+ }
68
+ }
69
+
70
+ &--focused {
71
+ @include focus.focus-generic;
72
+ }
73
+ }
74
+
75
+ &__help-text {
76
+ margin-bottom: spacing.$spacing-xs;
77
+ }
78
+
79
+ &-content {
80
+ @include utilities.box-reset;
81
+ @include border.border-none;
82
+
83
+ display: flex;
84
+ flex-direction: column;
85
+ grid-column: 1/-1;
86
+ order: 4;
87
+ margin-top: spacing.$spacing-xs;
88
+ width: 100%;
89
+ }
90
+ }
@@ -0,0 +1,80 @@
1
+ @use '../../foundations/spacing/tokens.scss' as spacing;
2
+ @use '../../foundations/typography/mixins.scss' as typography;
3
+ @use '../../foundations/colors/mixins.scss' as colorMixin;
4
+
5
+ .fudis-guidance {
6
+ display: flex;
7
+ justify-content: space-between;
8
+ width: 100%;
9
+
10
+ &:not(:has(&__errors)):has(&__help-text) {
11
+ margin-top: spacing.$spacing-xs;
12
+ }
13
+
14
+ /* stylelint-disable no-descending-specificity */
15
+ &:not(:has(&__errors)) &__character-limit-indicator {
16
+ margin-top: 0;
17
+ }
18
+
19
+ &__help-text {
20
+ @include colorMixin.text-color('gray-dark');
21
+ @include typography.body-text-sm-regular;
22
+
23
+ margin-top: spacing.$spacing-none;
24
+ margin-bottom: spacing.$spacing-xs;
25
+ }
26
+
27
+ &__errors {
28
+ display: flex;
29
+ transform: translateX(
30
+ /* stylelint-disable unit-disallowed-list */
31
+ calc(-1 * calc(0.4rem / var(--fudis-rem-multiplier)))
32
+ );
33
+ opacity: 0;
34
+ height: spacing.$spacing-xs;
35
+ animation-name: delay-appearance;
36
+ animation-delay: 0.2s;
37
+ animation-iteration-count: 1;
38
+ animation-fill-mode: forwards;
39
+
40
+ &__list {
41
+ min-height: spacing.$spacing-xs;
42
+ }
43
+ }
44
+
45
+ &__character-limit-indicator {
46
+ @include colorMixin.text-color('gray-dark');
47
+ @include typography.body-text-sm-regular;
48
+
49
+ margin-top: spacing.$spacing-xs;
50
+ text-align: end;
51
+
52
+ &__sm {
53
+ min-width: spacing.$spacing-md;
54
+ }
55
+
56
+ &__md {
57
+ min-width: spacing.$spacing-xl;
58
+ }
59
+
60
+ &__lg {
61
+ min-width: spacing.$spacing-xxl;
62
+ }
63
+
64
+ &__float-right {
65
+ margin-left: auto;
66
+ }
67
+ }
68
+ }
69
+
70
+ @keyframes delay-appearance {
71
+ 0% {
72
+ opacity: 0;
73
+ height: spacing.$spacing-xs;
74
+ }
75
+
76
+ 100% {
77
+ opacity: 1;
78
+ height: auto;
79
+ }
80
+ }
@@ -0,0 +1,13 @@
1
+ /* stylelint-disable property-disallowed-list */
2
+ @use '../../foundations/colors/tokens.scss' as color;
3
+ @use '../../foundations/spacing/tokens.scss' as spacing;
4
+ @use '../../foundations/utilities/mixins.scss' as utilities;
5
+
6
+ .fudis-hr {
7
+ @include utilities.box-reset;
8
+
9
+ border: 0;
10
+ border-top: spacing.$pixel-1 solid color.$color-gray-middle;
11
+ width: 100%;
12
+ height: spacing.$pixel-1;
13
+ }