Skip to content

Commit

Permalink
Build package
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamindehli committed Mar 21, 2024
1 parent 8f1a811 commit ba963c4
Show file tree
Hide file tree
Showing 21 changed files with 187 additions and 98 deletions.
2 changes: 1 addition & 1 deletion dist/components/Accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
var _AccordionModule = _interopRequireDefault(require("./Accordion.module.scss"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
const Accordion = props => {
const [expanded, setExpanded] = (0, _react.useState)(props.expanded);
Expand Down
2 changes: 1 addition & 1 deletion dist/components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var _helpers = require("../functions/helpers");
var _ButtonModule = _interopRequireDefault(require("./Button.module.scss"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
const Button = props => {
var _props$href, _props$href2, _props$children;
Expand Down
4 changes: 2 additions & 2 deletions dist/components/CheckBoxIcon.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
margin-top: 2px;
background: white;
&:not(.hasErrors) {
@include box-shadow(0 0 0 1px var(--color-primary, $color-primary));
@include box-shadow(0 0 0 1px var(--color-form-element, $color-form-element));
}
&.hasErrors {
@include box-shadow(0 0 0 1px var(--color-error, $color-error));
Expand All @@ -36,7 +36,7 @@
}
&.showBox {
&:not(.hasErrors) {
@include box-shadow(0 0 0 1px var(--color-primary, $color-primary));
@include box-shadow(0 0 0 1px var(--color-form-element, $color-form-element));
}
&.hasErrors {
@include box-shadow(0 0 0 1px var(--color-error, $color-error));
Expand Down
4 changes: 2 additions & 2 deletions dist/components/CheckBoxInput.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
.labelText {
font-size: 16px;
line-height: 24px;
color: var(--color-primary, $color-primary);
color: var(--color-form-element, $color-form-element);
}

&.disabled {
Expand All @@ -40,7 +40,7 @@

&:focus-within {
outline-width: 2px;
outline-color: var(--color-primary, $color-primary);
outline-color: var(--color-focus, $color-focus);
outline-style: auto;
outline-offset: 1px;
}
Expand Down
4 changes: 2 additions & 2 deletions dist/components/CheckBoxListItem.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
}
}

&.checked:not(.contentOnly):not(.compact):not(.disabled):not(.hasTheme) {
&.checked:not(.contentOnly):not(.compact):not(.disabled) {
background-color: var(--color-secondary-light, $color-secondary-light);
}

&:not(.checked):not(.contentOnly):not(.compact):not(.disabled):not(.hasTheme) {
&:not(.checked):not(.contentOnly):not(.compact):not(.disabled) {
&:hover {
background-color: var(--color-secondary-x-light, $color-secondary-x-light);
}
Expand Down
46 changes: 31 additions & 15 deletions dist/components/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ var _DialogModule = _interopRequireDefault(require("./Dialog.module.scss"));
var _helpers = require("../functions/helpers");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
const Dialog = props => {
var _props$attachTo, _props$maxWidth;
const dialogRef = (0, _react.useRef)();
const wrapperRef = (0, _react.useCallback)(element => {
const dialogContainerRef = (0, _react.useRef)();
const dialogContentRef = (0, _react.useCallback)(element => {
if (!!element) {
(0, _helpers.addFocusTrapInsideElement)(element);
}
return element;
}, []);
(0, _react.useEffect)(() => {
const keyDownFunction = event => {
Expand All @@ -30,22 +33,33 @@ const Dialog = props => {
}
};
const handleClickOutside = event => {
if (dialogRef !== null && dialogRef !== void 0 && dialogRef.current && !dialogRef.current.contains(event.target)) {
if (dialogContainerRef !== null && dialogContainerRef !== void 0 && dialogContainerRef.current && !dialogContainerRef.current.contains(event.target)) {
props.onClickOutside();
}
};
document.addEventListener("mousedown", handleClickOutside);
document.addEventListener("keydown", keyDownFunction, false);
}, [props, wrapperRef]);
return _react.default.createElement("div", {
className: "".concat(_DialogModule.default.dialogOverlay, " ").concat(props.hidden && _DialogModule.default.hidden),
ref: wrapperRef
}, _react.default.createElement("div", {
ref: dialogRef,
className: "".concat(_DialogModule.default.dialogContent, " ").concat(props.noPadding ? _DialogModule.default.noPadding : ""),
style: {
maxWidth: props.maxWidth
}, [props, dialogContainerRef]);
(0, _react.useEffect)(() => {
dialogRef.current.close();
if (!props.hidden) {
props.modal ? dialogRef.current.showModal() : dialogRef.current.show();
}
}, [dialogRef, props.hidden, props.modal]);
const sideBarClassNames = ((_props$attachTo = props.attachTo) === null || _props$attachTo === void 0 ? void 0 : _props$attachTo.length) && (0, _helpers.classNameArrayToClassNameString)([_DialogModule.default.isSidebar, _DialogModule.default[props.attachTo]]);
const dialogContentStyleProps = {
"--max-width": (props === null || props === void 0 || (_props$maxWidth = props.maxWidth) === null || _props$maxWidth === void 0 ? void 0 : _props$maxWidth.length) && props.maxWidth
};
return _react.default.createElement("dialog", {
className: (0, _helpers.classNameArrayToClassNameString)([_DialogModule.default.dialog, sideBarClassNames]),
ref: dialogRef
}, _react.default.createElement("div", {
ref: dialogContainerRef,
className: _DialogModule.default.dialogContainer,
style: dialogContentStyleProps
}, _react.default.createElement("div", {
ref: dialogContentRef,
className: (0, _helpers.classNameArrayToClassNameString)([_DialogModule.default.dialogContent, props.noPadding && _DialogModule.default.noPadding])
}, props.closeButton ? _react.default.createElement("button", {
"aria-label": "Lukk dialog",
onClick: props.onClickOutside,
Expand All @@ -56,15 +70,17 @@ const Dialog = props => {
})) : null, _react.default.createElement("div", {
"aria-live": "assertive",
role: "dialog"
}, props.children)));
}, props.children))));
};
Dialog.propTypes = {
maxWidth: _propTypes.default.string,
noPadding: _propTypes.default.bool,
closeButton: _propTypes.default.bool,
onClickOutside: _propTypes.default.func.isRequired
onClickOutside: _propTypes.default.func.isRequired,
modal: _propTypes.default.bool
};
Dialog.defaultProps = {
maxWidth: "none"
maxWidth: "none",
modal: false
};
var _default = exports.default = Dialog;
184 changes: 128 additions & 56 deletions dist/components/Dialog.module.scss
Original file line number Diff line number Diff line change
@@ -1,79 +1,151 @@
@import "../style/global.scss";

@keyframes modalIn {
@keyframes modalInVertical {
0% {
opacity: 0;
transform: translateY(2em);
}
}

.dialogOverlay {
display: flex;
flex-wrap: wrap;
position: fixed;
width: 100%;
background: rgba(0, 48, 69, 0.4);
height: 100%;
top: 0;
left: 0;
align-content: center;
padding: 8px 28px;
z-index: 2;
justify-content: center;
@media (min-width: $screen-md) {
padding: 36px;
@keyframes modalInHorizontalRight {
0% {
opacity: 0;
transform: translateX(2em);
}
}

@keyframes modalInHorizontalLeft {
0% {
opacity: 0;
transform: translateX(-2em);
}
}

&.hidden,
.hidden {
width: 0;
height: 0;
.dialog {
&::backdrop {
background: color-mix(in srgb, var(--color-primary, $color-primary), transparent 60%);
}
&[open] {
border: none;
position: absolute;
padding: 0;
overflow: hidden;
background: none;
display: flex;
max-height: none;
max-width: none;
top: 0;
bottom: 0;
left: 0;
position: fixed;
.dialogContainer {
display: flex;
flex-wrap: wrap;
background-color: #fff;
.dialogContent {
&:not(.noPadding) {
padding: 30px 15px;
@media only screen and (min-width: $screen-sm) {
padding: 60px 40px;
}
}
}
.dialogContent {
position: relative;
}
.closeButton {
background: none;
border: none;
color: var(--color-primary, $color-primary);
display: inline-block;
position: absolute;
right: 7px;
top: 4px;
text-decoration: underline;
font-size: 19px;
cursor: pointer;
@media only screen and (min-width: $screen-sm) {
right: 15px;
top: 10px;
}
&:hover {
text-decoration: none;
}
img {
width: 17px;
height: 17px;
}
}
}
&:not(.isSidebar) {
align-items: center;
justify-content: center;
padding: 8px 28px;
@media (min-width: $screen-md) {
padding: 36px;
}
.dialogContainer {
animation: 1000ms cubic-bezier(0.22, 1, 0.36, 1) 0s 1 normal none running modalInVertical;
}
}
&.isSidebar {
padding: 0;
height: 100vh;
.dialogContainer {
height: 100%;
width: var(--max-width, auto);
}
&.left {
margin: 0 auto 0 0;
.dialogContainer {
justify-content: left;
animation: 1000ms cubic-bezier(0.22, 1, 0.36, 1) 0s 1 normal none running modalInHorizontalLeft;
}
}
&.right {
margin: 0 0 0 auto;
.dialogContainer {
justify-content: right;
animation: 1000ms cubic-bezier(0.22, 1, 0.36, 1) 0s 1 normal none running modalInHorizontalRight;
}
}
}
}
}

.dialogContent {
@include calc("max-height", "100% - 128px");
max-width: 540px;
.dialogOverlay {
width: 0;
height: 0;
border: none;
position: absolute;
padding: 0;
overflow: hidden;

&[open] {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 2;
}

&:not(.isSidebar) {
align-content: center;
justify-content: center;

.dialogContent {
@include calc("max-height", "100% - 128px");
width: 100%;
max-width: var(--max-width, 540px);
}
}

.dialogContent {
background-color: #fff;
overflow: auto;
position: relative;
animation: 1000ms cubic-bezier(0.22, 1, 0.36, 1) 0s 1 normal none running modalIn;
&:not(.noPadding) {
padding: 30px 15px;
@media only screen and (min-width: $screen-sm) {
padding: 60px 40px;
}
}

@media (min-width: $screen-md) {
@include calc("width", "100% - 128px");
max-height: 100%;
}
.closeButton {
background: none;
border: none;
color: var(--color-primary, $color-primary);
display: inline-block;
position: absolute;
right: 7px;
top: 4px;
text-decoration: underline;
font-size: 19px;
cursor: pointer;
@media only screen and (min-width: $screen-sm) {
right: 15px;
top: 10px;
}
&:hover {
text-decoration: none;
}
img {
width: 17px;
height: 17px;
}
}
}
}
2 changes: 1 addition & 1 deletion dist/components/DragAndDropFileInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var _asterisk = _interopRequireDefault(require("../assets/svg/asterisk.svg?url")
var _DragAndDropFileInputModule = _interopRequireDefault(require("./DragAndDropFileInput.module.scss"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
const DragAndDropFileInput = props => {
var _props$errorMessage, _props$ariaDescribed;
Expand Down
Loading

0 comments on commit ba963c4

Please sign in to comment.