@konoma-development/react-components 0.2.12 → 0.3.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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function () {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
try{if(typeof document != 'undefined'){var elementStyle = document.createElement('style');elementStyle.appendChild(document.createTextNode("/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--color-gray-200:oklch(92.8% .006 264.531);--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height:calc(1.5/1);--font-weight-medium:500;--font-weight-semibold:600;--radius-md:.375rem;--animate-spin:spin 1s linear infinite;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*,:after,:before,::backdrop{border-color:var(--color-gray-200,currentcolor)}::file-selector-button{border-color:var(--color-gray-200,currentcolor)}}@layer components;@layer utilities{#app .pointer-events-none{pointer-events:none}#app .visible{visibility:visible}#app .absolute{position:absolute}#app .fixed{position:fixed}#app .relative{position:relative}#app .sticky{position:sticky}#app .inset-0{inset:calc(var(--spacing)*0)}#app .top-0{top:calc(var(--spacing)*0)}#app .top-\\[5px\\]{top:5px}#app .right-0{right:calc(var(--spacing)*0)}#app .right-3{right:calc(var(--spacing)*3)}#app .right-4{right:calc(var(--spacing)*4)}#app .-bottom-0\\.5{bottom:calc(var(--spacing)*-.5)}#app .bottom-0{bottom:calc(var(--spacing)*0)}#app .bottom-4{bottom:calc(var(--spacing)*4)}#app .left-0{left:calc(var(--spacing)*0)}#app .left-3{left:calc(var(--spacing)*3)}#app .left-\\[5px\\]{left:5px}#app .z-1{z-index:1}#app .z-10{z-index:10}#app .z-20{z-index:20}#app .my-auto{margin-block:auto}#app .-mt-4{margin-top:calc(var(--spacing)*-4)}#app .mt-3{margin-top:calc(var(--spacing)*3)}#app .ml-2{margin-left:calc(var(--spacing)*2)}#app .block{display:block}#app .contents{display:contents}#app .flex{display:flex}#app .grid{display:grid}#app .hidden{display:none}#app .inline{display:inline}#app .inline-flex{display:inline-flex}#app .h-0{height:calc(var(--spacing)*0)}#app .h-0\\.5{height:calc(var(--spacing)*.5)}#app .h-1\\.5{height:calc(var(--spacing)*1.5)}#app .h-3{height:calc(var(--spacing)*3)}#app .h-4{height:calc(var(--spacing)*4)}#app .h-5{height:calc(var(--spacing)*5)}#app .h-6{height:calc(var(--spacing)*6)}#app .h-8{height:calc(var(--spacing)*8)}#app .h-10{height:calc(var(--spacing)*10)}#app .h-12{height:calc(var(--spacing)*12)}#app .h-14{height:calc(var(--spacing)*14)}#app .h-16{height:calc(var(--spacing)*16)}#app .h-24{height:calc(var(--spacing)*24)}#app .h-auto{height:auto}#app .h-fit{height:fit-content}#app .h-full{height:100%}#app .h-px{height:1px}#app .max-h-100{max-height:calc(var(--spacing)*100)}#app .max-h-full{max-height:100%}#app .min-h-10{min-height:calc(var(--spacing)*10)}#app .w-0{width:calc(var(--spacing)*0)}#app .w-1\\.5{width:calc(var(--spacing)*1.5)}#app .w-3{width:calc(var(--spacing)*3)}#app .w-4{width:calc(var(--spacing)*4)}#app .w-5{width:calc(var(--spacing)*5)}#app .w-6{width:calc(var(--spacing)*6)}#app .w-8{width:calc(var(--spacing)*8)}#app .w-16{width:calc(var(--spacing)*16)}#app .w-18{width:calc(var(--spacing)*18)}#app .w-48{width:calc(var(--spacing)*48)}#app .w-full{width:100%}#app .max-w-full{max-width:100%}#app .min-w-4{min-width:calc(var(--spacing)*4)}#app .grow{flex-grow:1}#app .animate-spin{animation:var(--animate-spin)}#app .cursor-not-allowed{cursor:not-allowed}#app .cursor-pointer{cursor:pointer}#app .cursor-row-resize{cursor:row-resize}#app .cursor-text{cursor:text}#app .resize{resize:both}#app .resize-none{resize:none}#app .appearance-none{appearance:none}#app .flex-col{flex-direction:column}#app .flex-col-reverse{flex-direction:column-reverse}#app .flex-row{flex-direction:row}#app .flex-row-reverse{flex-direction:row-reverse}#app .flex-wrap{flex-wrap:wrap}#app .items-center{align-items:center}#app .items-start{align-items:flex-start}#app .justify-between{justify-content:space-between}#app .justify-center{justify-content:center}#app .justify-end{justify-content:flex-end}#app .justify-start{justify-content:flex-start}#app .gap-1{gap:calc(var(--spacing)*1)}#app .gap-2{gap:calc(var(--spacing)*2)}#app .gap-4{gap:calc(var(--spacing)*4)}#app .gap-5{gap:calc(var(--spacing)*5)}#app .gap-10{gap:calc(var(--spacing)*10)}:where(#app .divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}#app .truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}#app .overflow-x-auto{overflow-x:auto}#app .overflow-y-auto{overflow-y:auto}#app .rounded-full{border-radius:3.40282e38px}#app .rounded-krc-button{border-radius:var(--krc-button-borderRadius,1.5rem)}#app .rounded-krc-checkbox{border-radius:var(--krc-checkbox-borderRadius,.25rem)}#app .rounded-krc-input{border-radius:var(--krc-input-borderRadius,1.5rem)}#app .rounded-krc-modal{border-radius:var(--krc-modal-borderRadius,.5rem)}#app .rounded-krc-phone-input{border-radius:var(--krc-phoneInput-borderRadius,1.5rem)}#app .rounded-krc-radiobutton-group{border-radius:var(--krc-radiobuttonGroup-borderRadius,.5rem)}#app .rounded-krc-select{border-radius:var(--krc-select-borderRadius,1.5rem)}#app .rounded-krc-table{border-radius:var(--krc-table-borderRadius,1rem)}#app .rounded-krc-table-column-chooser{border-radius:var(--krc-tableColumnChooser-borderRadius,.375rem)}#app .rounded-krc-tag{border-radius:var(--krc-tag-borderRadius,.75rem)}#app .rounded-krc-tag-list{border-radius:var(--krc-tagList-borderRadius,1.5rem)}#app .rounded-krc-tag-list-add{border-radius:var(--krc-tagListAdd-borderRadius,.75rem)}#app .rounded-krc-textarea{border-radius:var(--krc-textarea-borderRadius,1rem)}#app .rounded-md{border-radius:var(--radius-md)}#app .rounded-t-krc-modal{border-top-left-radius:var(--krc-modal-borderRadius,.5rem);border-top-right-radius:var(--krc-modal-borderRadius,.5rem)}#app .rounded-t-krc-table{border-top-left-radius:var(--krc-table-borderRadius,1rem);border-top-right-radius:var(--krc-table-borderRadius,1rem)}#app .rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}#app .rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}#app .rounded-b-krc-modal{border-bottom-right-radius:var(--krc-modal-borderRadius,.5rem);border-bottom-left-radius:var(--krc-modal-borderRadius,.5rem)}#app .rounded-b-krc-table{border-bottom-right-radius:var(--krc-table-borderRadius,1rem);border-bottom-left-radius:var(--krc-table-borderRadius,1rem)}#app .border{border-style:var(--tw-border-style);border-width:1px}#app .border-r{border-right-style:var(--tw-border-style);border-right-width:1px}#app .border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}#app .border-l{border-left-style:var(--tw-border-style);border-left-width:1px}#app .border-none{--tw-border-style:none;border-style:none}#app .bg-black\\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){#app .bg-black\\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}#app .bg-krc-table-header{background-color:var(--krc-table-header-backgroundColor,#f9fafb)}#app .bg-white{background-color:var(--color-white)}#app .fill-white{fill:var(--color-white)}#app .p-2{padding:calc(var(--spacing)*2)}#app .p-4{padding:calc(var(--spacing)*4)}#app .px-1{padding-inline:calc(var(--spacing)*1)}#app .px-3{padding-inline:calc(var(--spacing)*3)}#app .px-3\\.5{padding-inline:calc(var(--spacing)*3.5)}#app .px-4{padding-inline:calc(var(--spacing)*4)}#app .px-6{padding-inline:calc(var(--spacing)*6)}#app .py-0{padding-block:calc(var(--spacing)*0)}#app .py-1{padding-block:calc(var(--spacing)*1)}#app .py-2{padding-block:calc(var(--spacing)*2)}#app .py-2\\.5{padding-block:calc(var(--spacing)*2.5)}#app .py-3{padding-block:calc(var(--spacing)*3)}#app .pt-4{padding-top:calc(var(--spacing)*4)}#app .pr-0{padding-right:calc(var(--spacing)*0)}#app .pr-10{padding-right:calc(var(--spacing)*10)}#app .pr-12{padding-right:calc(var(--spacing)*12)}#app .pb-2{padding-bottom:calc(var(--spacing)*2)}#app .pb-4{padding-bottom:calc(var(--spacing)*4)}#app .pl-0{padding-left:calc(var(--spacing)*0)}#app .pl-1{padding-left:calc(var(--spacing)*1)}#app .pl-10{padding-left:calc(var(--spacing)*10)}#app .pl-11{padding-left:calc(var(--spacing)*11)}#app .pl-13{padding-left:calc(var(--spacing)*13)}#app .pl-16{padding-left:calc(var(--spacing)*16)}#app .text-center{text-align:center}#app .text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}#app .text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}#app .text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}#app .font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}#app .font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}#app .text-white{color:var(--color-white)}#app .shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}#app .shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}#app .shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}#app .ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}#app .outline-hidden{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){#app .outline-hidden{outline-offset:2px;outline:2px solid #0000}}#app .outline-1{outline-style:var(--tw-outline-style);outline-width:1px}#app .outline-offset-2{outline-offset:2px}#app .filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}#app .outline-solid{--tw-outline-style:solid;outline-style:solid}#app .not-disabled\\:bg-white:not(:disabled){background-color:var(--color-white)}#app .group-active\\:outline-solid:is(:where(.group):active *){--tw-outline-style:solid;outline-style:solid}#app .placeholder\\:text-sm::placeholder{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}#app .first\\:grow:first-child{flex-grow:1}#app .first\\:rounded-tl-krc-table:first-child{border-top-left-radius:var(--krc-table-borderRadius,1rem)}#app .last\\:rounded-tr-krc-table:last-child{border-top-right-radius:var(--krc-table-borderRadius,1rem)}#app .last\\:rounded-b-krc-table:last-child{border-bottom-right-radius:var(--krc-table-borderRadius,1rem);border-bottom-left-radius:var(--krc-table-borderRadius,1rem)}#app .focus\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}#app .focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}#app .focus\\:not-disabled\\:ring-2:focus:not(:disabled){--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}#app .focus-visible\\:outline-hidden:focus-visible{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){#app .focus-visible\\:outline-hidden:focus-visible{outline-offset:2px;outline:2px solid #0000}}#app .disabled\\:pointer-events-none:disabled{pointer-events:none}#app .disabled\\:\\!cursor-not-allowed:disabled{cursor:not-allowed!important}#app .disabled\\:\\!opacity-50:disabled{opacity:.5!important}#app .disabled\\:\\!shadow-none:disabled{--tw-shadow:0 0 #0000!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}#app .disabled\\:\\!ring-0:disabled{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}#app .has-focus\\:ring-2:has(:focus){--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}@property --tw-divide-y-reverse{syntax:\"*\";inherits:false;initial-value:0}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-blur{syntax:\"*\";inherits:false}@property --tw-brightness{syntax:\"*\";inherits:false}@property --tw-contrast{syntax:\"*\";inherits:false}@property --tw-grayscale{syntax:\"*\";inherits:false}@property --tw-hue-rotate{syntax:\"*\";inherits:false}@property --tw-invert{syntax:\"*\";inherits:false}@property --tw-opacity{syntax:\"*\";inherits:false}@property --tw-saturate{syntax:\"*\";inherits:false}@property --tw-sepia{syntax:\"*\";inherits:false}@property --tw-drop-shadow{syntax:\"*\";inherits:false}@property --tw-drop-shadow-color{syntax:\"*\";inherits:false}@property --tw-drop-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:\"*\";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}"));document.head.appendChild(elementStyle);}}catch(e){console.error('vite-plugin-css-injected-by-js', e);}
|
|
4
|
+
try{if(typeof document != 'undefined'){var elementStyle = document.createElement('style');elementStyle.appendChild(document.createTextNode("/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--color-gray-200:oklch(92.8% .006 264.531);--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height:calc(1.5/1);--font-weight-medium:500;--font-weight-semibold:600;--radius-md:.375rem;--animate-spin:spin 1s linear infinite;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*,:after,:before,::backdrop{border-color:var(--color-gray-200,currentcolor)}::file-selector-button{border-color:var(--color-gray-200,currentcolor)}}@layer components;@layer utilities{#app .pointer-events-none{pointer-events:none}#app .visible{visibility:visible}#app .absolute{position:absolute}#app .fixed{position:fixed}#app .relative{position:relative}#app .sticky{position:sticky}#app .inset-0{inset:calc(var(--spacing)*0)}#app .top-0{top:calc(var(--spacing)*0)}#app .top-\\[5px\\]{top:5px}#app .right-0{right:calc(var(--spacing)*0)}#app .right-3{right:calc(var(--spacing)*3)}#app .right-4{right:calc(var(--spacing)*4)}#app .-bottom-0\\.5{bottom:calc(var(--spacing)*-.5)}#app .bottom-0{bottom:calc(var(--spacing)*0)}#app .bottom-4{bottom:calc(var(--spacing)*4)}#app .left-0{left:calc(var(--spacing)*0)}#app .left-3{left:calc(var(--spacing)*3)}#app .left-\\[5px\\]{left:5px}#app .z-1{z-index:1}#app .z-10{z-index:10}#app .z-20{z-index:20}#app .my-auto{margin-block:auto}#app .-mt-4{margin-top:calc(var(--spacing)*-4)}#app .mt-3{margin-top:calc(var(--spacing)*3)}#app .ml-2{margin-left:calc(var(--spacing)*2)}#app .ml-12{margin-left:calc(var(--spacing)*12)}#app .block{display:block}#app .contents{display:contents}#app .flex{display:flex}#app .grid{display:grid}#app .hidden{display:none}#app .inline{display:inline}#app .inline-flex{display:inline-flex}#app .h-0{height:calc(var(--spacing)*0)}#app .h-0\\.5{height:calc(var(--spacing)*.5)}#app .h-1\\.5{height:calc(var(--spacing)*1.5)}#app .h-3{height:calc(var(--spacing)*3)}#app .h-4{height:calc(var(--spacing)*4)}#app .h-5{height:calc(var(--spacing)*5)}#app .h-6{height:calc(var(--spacing)*6)}#app .h-8{height:calc(var(--spacing)*8)}#app .h-10{height:calc(var(--spacing)*10)}#app .h-12{height:calc(var(--spacing)*12)}#app .h-14{height:calc(var(--spacing)*14)}#app .h-16{height:calc(var(--spacing)*16)}#app .h-24{height:calc(var(--spacing)*24)}#app .h-auto{height:auto}#app .h-fit{height:fit-content}#app .h-full{height:100%}#app .h-px{height:1px}#app .max-h-100{max-height:calc(var(--spacing)*100)}#app .max-h-full{max-height:100%}#app .min-h-10{min-height:calc(var(--spacing)*10)}#app .w-0{width:calc(var(--spacing)*0)}#app .w-1\\.5{width:calc(var(--spacing)*1.5)}#app .w-3{width:calc(var(--spacing)*3)}#app .w-4{width:calc(var(--spacing)*4)}#app .w-5{width:calc(var(--spacing)*5)}#app .w-6{width:calc(var(--spacing)*6)}#app .w-8{width:calc(var(--spacing)*8)}#app .w-12{width:calc(var(--spacing)*12)}#app .w-16{width:calc(var(--spacing)*16)}#app .w-18{width:calc(var(--spacing)*18)}#app .w-48{width:calc(var(--spacing)*48)}#app .w-full{width:100%}#app .max-w-full{max-width:100%}#app .min-w-4{min-width:calc(var(--spacing)*4)}#app .grow{flex-grow:1}#app .animate-spin{animation:var(--animate-spin)}#app .cursor-not-allowed{cursor:not-allowed}#app .cursor-pointer{cursor:pointer}#app .cursor-row-resize{cursor:row-resize}#app .cursor-text{cursor:text}#app .resize{resize:both}#app .resize-none{resize:none}#app .appearance-none{appearance:none}#app .flex-col{flex-direction:column}#app .flex-col-reverse{flex-direction:column-reverse}#app .flex-row{flex-direction:row}#app .flex-row-reverse{flex-direction:row-reverse}#app .flex-wrap{flex-wrap:wrap}#app .items-center{align-items:center}#app .items-start{align-items:flex-start}#app .justify-between{justify-content:space-between}#app .justify-center{justify-content:center}#app .justify-end{justify-content:flex-end}#app .justify-start{justify-content:flex-start}#app .gap-1{gap:calc(var(--spacing)*1)}#app .gap-2{gap:calc(var(--spacing)*2)}#app .gap-4{gap:calc(var(--spacing)*4)}#app .gap-5{gap:calc(var(--spacing)*5)}#app .gap-10{gap:calc(var(--spacing)*10)}:where(#app .divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}#app .truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}#app .overflow-x-auto{overflow-x:auto}#app .overflow-y-auto{overflow-y:auto}#app .rounded-full{border-radius:3.40282e38px}#app .rounded-krc-button{border-radius:var(--krc-button-borderRadius,1.5rem)}#app .rounded-krc-checkbox{border-radius:var(--krc-checkbox-borderRadius,.25rem)}#app .rounded-krc-input{border-radius:var(--krc-input-borderRadius,1.5rem)}#app .rounded-krc-modal{border-radius:var(--krc-modal-borderRadius,.5rem)}#app .rounded-krc-select{border-radius:var(--krc-select-borderRadius,1.5rem)}#app .rounded-krc-table{border-radius:var(--krc-table-borderRadius,1rem)}#app .rounded-krc-tag{border-radius:var(--krc-tag-borderRadius,.75rem)}#app .rounded-krc-textarea{border-radius:var(--krc-textarea-borderRadius,1rem)}#app .rounded-md{border-radius:var(--radius-md)}#app .rounded-t-krc-modal{border-top-left-radius:var(--krc-modal-borderRadius,.5rem);border-top-right-radius:var(--krc-modal-borderRadius,.5rem)}#app .rounded-t-krc-table{border-top-left-radius:var(--krc-table-borderRadius,1rem);border-top-right-radius:var(--krc-table-borderRadius,1rem)}#app .rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}#app .rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}#app .rounded-b-krc-modal{border-bottom-right-radius:var(--krc-modal-borderRadius,.5rem);border-bottom-left-radius:var(--krc-modal-borderRadius,.5rem)}#app .rounded-b-krc-table{border-bottom-right-radius:var(--krc-table-borderRadius,1rem);border-bottom-left-radius:var(--krc-table-borderRadius,1rem)}#app .border{border-style:var(--tw-border-style);border-width:1px}#app .border-r{border-right-style:var(--tw-border-style);border-right-width:1px}#app .border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}#app .border-l{border-left-style:var(--tw-border-style);border-left-width:1px}#app .border-none{--tw-border-style:none;border-style:none}#app .bg-black\\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){#app .bg-black\\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}#app .bg-krc-table-header{background-color:var(--krc-table-header-backgroundColor,#f9fafb)}#app .bg-white{background-color:var(--color-white)}#app .fill-white{fill:var(--color-white)}#app .p-2{padding:calc(var(--spacing)*2)}#app .p-4{padding:calc(var(--spacing)*4)}#app .px-1{padding-inline:calc(var(--spacing)*1)}#app .px-3{padding-inline:calc(var(--spacing)*3)}#app .px-3\\.5{padding-inline:calc(var(--spacing)*3.5)}#app .px-4{padding-inline:calc(var(--spacing)*4)}#app .px-6{padding-inline:calc(var(--spacing)*6)}#app .py-0{padding-block:calc(var(--spacing)*0)}#app .py-1{padding-block:calc(var(--spacing)*1)}#app .py-2{padding-block:calc(var(--spacing)*2)}#app .py-2\\.5{padding-block:calc(var(--spacing)*2.5)}#app .py-3{padding-block:calc(var(--spacing)*3)}#app .pt-4{padding-top:calc(var(--spacing)*4)}#app .pr-0{padding-right:calc(var(--spacing)*0)}#app .pr-10{padding-right:calc(var(--spacing)*10)}#app .pr-12{padding-right:calc(var(--spacing)*12)}#app .pb-2{padding-bottom:calc(var(--spacing)*2)}#app .pb-4{padding-bottom:calc(var(--spacing)*4)}#app .pl-0{padding-left:calc(var(--spacing)*0)}#app .pl-1{padding-left:calc(var(--spacing)*1)}#app .pl-10{padding-left:calc(var(--spacing)*10)}#app .pl-11{padding-left:calc(var(--spacing)*11)}#app .pl-13{padding-left:calc(var(--spacing)*13)}#app .pl-16{padding-left:calc(var(--spacing)*16)}#app .text-center{text-align:center}#app .text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}#app .text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}#app .text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}#app .font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}#app .font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}#app .text-white{color:var(--color-white)}#app .shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}#app .shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}#app .shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}#app .ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}#app .outline-hidden{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){#app .outline-hidden{outline-offset:2px;outline:2px solid #0000}}#app .outline-1{outline-style:var(--tw-outline-style);outline-width:1px}#app .outline-offset-2{outline-offset:2px}#app .filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}#app .outline-solid{--tw-outline-style:solid;outline-style:solid}#app .not-disabled\\:bg-white:not(:disabled){background-color:var(--color-white)}#app .group-active\\:outline-solid:is(:where(.group):active *){--tw-outline-style:solid;outline-style:solid}#app .placeholder\\:text-sm::placeholder{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}#app .first\\:grow:first-child{flex-grow:1}#app .first\\:rounded-tl-krc-table:first-child{border-top-left-radius:var(--krc-table-borderRadius,1rem)}#app .last\\:rounded-tr-krc-table:last-child{border-top-right-radius:var(--krc-table-borderRadius,1rem)}#app .last\\:rounded-b-krc-table:last-child{border-bottom-right-radius:var(--krc-table-borderRadius,1rem);border-bottom-left-radius:var(--krc-table-borderRadius,1rem)}#app .focus\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}#app .focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}#app .focus\\:not-disabled\\:ring-2:focus:not(:disabled){--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}#app .focus-visible\\:outline-hidden:focus-visible{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){#app .focus-visible\\:outline-hidden:focus-visible{outline-offset:2px;outline:2px solid #0000}}#app .disabled\\:pointer-events-none:disabled{pointer-events:none}#app .disabled\\:\\!cursor-not-allowed:disabled{cursor:not-allowed!important}#app .disabled\\:\\!opacity-50:disabled{opacity:.5!important}#app .disabled\\:\\!shadow-none:disabled{--tw-shadow:0 0 #0000!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}#app .disabled\\:\\!ring-0:disabled{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}#app .has-focus\\:ring-2:has(:focus){--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}@property --tw-divide-y-reverse{syntax:\"*\";inherits:false;initial-value:0}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-blur{syntax:\"*\";inherits:false}@property --tw-brightness{syntax:\"*\";inherits:false}@property --tw-contrast{syntax:\"*\";inherits:false}@property --tw-grayscale{syntax:\"*\";inherits:false}@property --tw-hue-rotate{syntax:\"*\";inherits:false}@property --tw-invert{syntax:\"*\";inherits:false}@property --tw-opacity{syntax:\"*\";inherits:false}@property --tw-saturate{syntax:\"*\";inherits:false}@property --tw-sepia{syntax:\"*\";inherits:false}@property --tw-drop-shadow{syntax:\"*\";inherits:false}@property --tw-drop-shadow-color{syntax:\"*\";inherits:false}@property --tw-drop-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:\"*\";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}"));document.head.appendChild(elementStyle);}}catch(e){console.error('vite-plugin-css-injected-by-js', e);}
|
|
5
5
|
|
|
6
6
|
})();
|
|
7
7
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
@@ -18,87 +18,90 @@ import { jsx as jsx$1, css as css$2, keyframes } from '@emotion/react';
|
|
|
18
18
|
* Licensed under MIT.
|
|
19
19
|
*
|
|
20
20
|
* @license MIT
|
|
21
|
-
* @version
|
|
21
|
+
* @version 3.0.2
|
|
22
22
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
/** Default values for dimensions */
|
|
24
|
+
const defaultIconDimensions = Object.freeze({
|
|
25
|
+
left: 0,
|
|
26
|
+
top: 0,
|
|
27
|
+
width: 16,
|
|
28
|
+
height: 16
|
|
29
|
+
});
|
|
30
|
+
/** Default values for transformations */
|
|
31
31
|
const defaultIconTransformations = Object.freeze({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
rotate: 0,
|
|
33
|
+
vFlip: false,
|
|
34
|
+
hFlip: false
|
|
35
35
|
});
|
|
36
|
+
/** Default values for all optional IconifyIcon properties */
|
|
36
37
|
const defaultIconProps = Object.freeze({
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
...defaultIconDimensions,
|
|
39
|
+
...defaultIconTransformations
|
|
39
40
|
});
|
|
41
|
+
/** Default values for all properties used in ExtendedIconifyIcon */
|
|
40
42
|
const defaultExtendedIconProps = Object.freeze({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
...defaultIconProps,
|
|
44
|
+
body: "",
|
|
45
|
+
hidden: false
|
|
44
46
|
});
|
|
45
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Default icon customisations values
|
|
50
|
+
*/
|
|
46
51
|
const defaultIconSizeCustomisations = Object.freeze({
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
width: null,
|
|
53
|
+
height: null
|
|
49
54
|
});
|
|
50
55
|
const defaultIconCustomisations = Object.freeze({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// Transformations
|
|
54
|
-
...defaultIconTransformations
|
|
56
|
+
...defaultIconSizeCustomisations,
|
|
57
|
+
...defaultIconTransformations
|
|
55
58
|
});
|
|
56
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Get rotation value
|
|
62
|
+
*/
|
|
57
63
|
function rotateFromString(value, defaultValue = 0) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
num = num / split;
|
|
83
|
-
return num % 1 === 0 ? cleanup(num) : 0;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return defaultValue;
|
|
64
|
+
const units = value.replace(/^-?[0-9.]*/, "");
|
|
65
|
+
function cleanup(value$1) {
|
|
66
|
+
while (value$1 < 0) value$1 += 4;
|
|
67
|
+
return value$1 % 4;
|
|
68
|
+
}
|
|
69
|
+
if (units === "") {
|
|
70
|
+
const num = parseInt(value);
|
|
71
|
+
return isNaN(num) ? 0 : cleanup(num);
|
|
72
|
+
} else if (units !== value) {
|
|
73
|
+
let split = 0;
|
|
74
|
+
switch (units) {
|
|
75
|
+
case "%":
|
|
76
|
+
split = 25;
|
|
77
|
+
break;
|
|
78
|
+
case "deg": split = 90;
|
|
79
|
+
}
|
|
80
|
+
if (split) {
|
|
81
|
+
let num = parseFloat(value.slice(0, value.length - units.length));
|
|
82
|
+
if (isNaN(num)) return 0;
|
|
83
|
+
num = num / split;
|
|
84
|
+
return num % 1 === 0 ? cleanup(num) : 0;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return defaultValue;
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
const separator = /[\s,]+/;
|
|
91
|
+
/**
|
|
92
|
+
* Apply "flip" string to icon customisations
|
|
93
|
+
*/
|
|
90
94
|
function flipFromString(custom, flip) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
});
|
|
95
|
+
flip.split(separator).forEach((str) => {
|
|
96
|
+
switch (str.trim()) {
|
|
97
|
+
case "horizontal":
|
|
98
|
+
custom.hFlip = true;
|
|
99
|
+
break;
|
|
100
|
+
case "vertical":
|
|
101
|
+
custom.vFlip = true;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
102
105
|
}
|
|
103
106
|
|
|
104
107
|
const defaultCustomisations = {
|
|
@@ -136,995 +139,975 @@ function haveCustomisationsChanged(value1, value2) {
|
|
|
136
139
|
return false;
|
|
137
140
|
}
|
|
138
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Expression to test part of icon name.
|
|
144
|
+
*
|
|
145
|
+
* Used when loading icons from Iconify API due to project naming convension.
|
|
146
|
+
* Ignored when using custom icon sets - convension does not apply.
|
|
147
|
+
*/
|
|
139
148
|
const matchIconName = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
149
|
+
/**
|
|
150
|
+
* Convert string icon name to IconifyIconName object.
|
|
151
|
+
*/
|
|
140
152
|
const stringToIcon = (value, validate, allowSimpleName, provider = "") => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
name
|
|
177
|
-
};
|
|
178
|
-
return validate && !validateIconName(result, allowSimpleName) ? null : result;
|
|
179
|
-
}
|
|
180
|
-
return null;
|
|
153
|
+
const colonSeparated = value.split(":");
|
|
154
|
+
if (value.slice(0, 1) === "@") {
|
|
155
|
+
if (colonSeparated.length < 2 || colonSeparated.length > 3) return null;
|
|
156
|
+
provider = colonSeparated.shift().slice(1);
|
|
157
|
+
}
|
|
158
|
+
if (colonSeparated.length > 3 || !colonSeparated.length) return null;
|
|
159
|
+
if (colonSeparated.length > 1) {
|
|
160
|
+
const name$1 = colonSeparated.pop();
|
|
161
|
+
const prefix = colonSeparated.pop();
|
|
162
|
+
const result = {
|
|
163
|
+
provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,
|
|
164
|
+
prefix,
|
|
165
|
+
name: name$1
|
|
166
|
+
};
|
|
167
|
+
return validate && !validateIconName(result) ? null : result;
|
|
168
|
+
}
|
|
169
|
+
const name = colonSeparated[0];
|
|
170
|
+
const dashSeparated = name.split("-");
|
|
171
|
+
if (dashSeparated.length > 1) {
|
|
172
|
+
const result = {
|
|
173
|
+
provider,
|
|
174
|
+
prefix: dashSeparated.shift(),
|
|
175
|
+
name: dashSeparated.join("-")
|
|
176
|
+
};
|
|
177
|
+
return validate && !validateIconName(result) ? null : result;
|
|
178
|
+
}
|
|
179
|
+
if (allowSimpleName && provider === "") {
|
|
180
|
+
const result = {
|
|
181
|
+
provider,
|
|
182
|
+
prefix: "",
|
|
183
|
+
name
|
|
184
|
+
};
|
|
185
|
+
return validate && !validateIconName(result, allowSimpleName) ? null : result;
|
|
186
|
+
}
|
|
187
|
+
return null;
|
|
181
188
|
};
|
|
189
|
+
/**
|
|
190
|
+
* Check if icon is valid.
|
|
191
|
+
*
|
|
192
|
+
* This function is not part of stringToIcon because validation is not needed for most code.
|
|
193
|
+
*/
|
|
182
194
|
const validateIconName = (icon, allowSimpleName) => {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
return !!// Check prefix: cannot be empty, unless allowSimpleName is enabled
|
|
187
|
-
// Check name: cannot be empty
|
|
188
|
-
((allowSimpleName && icon.prefix === "" || !!icon.prefix) && !!icon.name);
|
|
195
|
+
if (!icon) return false;
|
|
196
|
+
return !!((allowSimpleName && icon.prefix === "" || !!icon.prefix) && !!icon.name);
|
|
189
197
|
};
|
|
190
198
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
199
|
+
/**
|
|
200
|
+
* Resolve icon set icons
|
|
201
|
+
*
|
|
202
|
+
* Returns parent icon for each icon
|
|
203
|
+
*/
|
|
204
|
+
function getIconsTree(data, names) {
|
|
205
|
+
const icons = data.icons;
|
|
206
|
+
const aliases = data.aliases || Object.create(null);
|
|
207
|
+
const resolved = Object.create(null);
|
|
208
|
+
function resolve(name) {
|
|
209
|
+
if (icons[name]) return resolved[name] = [];
|
|
210
|
+
if (!(name in resolved)) {
|
|
211
|
+
resolved[name] = null;
|
|
212
|
+
const parent = aliases[name] && aliases[name].parent;
|
|
213
|
+
const value = parent && resolve(parent);
|
|
214
|
+
if (value) resolved[name] = [parent].concat(value);
|
|
215
|
+
}
|
|
216
|
+
return resolved[name];
|
|
217
|
+
}
|
|
218
|
+
(Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve);
|
|
219
|
+
return resolved;
|
|
204
220
|
}
|
|
205
221
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
result[key] = parent[key];
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
return result;
|
|
222
|
+
/**
|
|
223
|
+
* Merge transformations
|
|
224
|
+
*/
|
|
225
|
+
function mergeIconTransformations(obj1, obj2) {
|
|
226
|
+
const result = {};
|
|
227
|
+
if (!obj1.hFlip !== !obj2.hFlip) result.hFlip = true;
|
|
228
|
+
if (!obj1.vFlip !== !obj2.vFlip) result.vFlip = true;
|
|
229
|
+
const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;
|
|
230
|
+
if (rotate) result.rotate = rotate;
|
|
231
|
+
return result;
|
|
220
232
|
}
|
|
221
233
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
if (value) {
|
|
235
|
-
resolved[name] = [parent].concat(value);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
return resolved[name];
|
|
239
|
-
}
|
|
240
|
-
(Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve);
|
|
241
|
-
return resolved;
|
|
234
|
+
/**
|
|
235
|
+
* Merge icon and alias
|
|
236
|
+
*
|
|
237
|
+
* Can also be used to merge default values and icon
|
|
238
|
+
*/
|
|
239
|
+
function mergeIconData(parent, child) {
|
|
240
|
+
const result = mergeIconTransformations(parent, child);
|
|
241
|
+
for (const key in defaultExtendedIconProps) if (key in defaultIconTransformations) {
|
|
242
|
+
if (key in parent && !(key in result)) result[key] = defaultIconTransformations[key];
|
|
243
|
+
} else if (key in child) result[key] = child[key];
|
|
244
|
+
else if (key in parent) result[key] = parent[key];
|
|
245
|
+
return result;
|
|
242
246
|
}
|
|
243
247
|
|
|
248
|
+
/**
|
|
249
|
+
* Get icon data, using prepared aliases tree
|
|
250
|
+
*/
|
|
244
251
|
function internalGetIconData(data, name, tree) {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
parse(name);
|
|
255
|
-
tree.forEach(parse);
|
|
256
|
-
return mergeIconData(data, currentProps);
|
|
252
|
+
const icons = data.icons;
|
|
253
|
+
const aliases = data.aliases || Object.create(null);
|
|
254
|
+
let currentProps = {};
|
|
255
|
+
function parse(name$1) {
|
|
256
|
+
currentProps = mergeIconData(icons[name$1] || aliases[name$1], currentProps);
|
|
257
|
+
}
|
|
258
|
+
parse(name);
|
|
259
|
+
tree.forEach(parse);
|
|
260
|
+
return mergeIconData(data, currentProps);
|
|
257
261
|
}
|
|
258
262
|
|
|
263
|
+
/**
|
|
264
|
+
* Extract icons from an icon set
|
|
265
|
+
*
|
|
266
|
+
* Returns list of icons that were found in icon set
|
|
267
|
+
*/
|
|
259
268
|
function parseIconSet(data, callback) {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
names.push(name);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
return names;
|
|
269
|
+
const names = [];
|
|
270
|
+
if (typeof data !== "object" || typeof data.icons !== "object") return names;
|
|
271
|
+
if (data.not_found instanceof Array) data.not_found.forEach((name) => {
|
|
272
|
+
callback(name, null);
|
|
273
|
+
names.push(name);
|
|
274
|
+
});
|
|
275
|
+
const tree = getIconsTree(data);
|
|
276
|
+
for (const name in tree) {
|
|
277
|
+
const item = tree[name];
|
|
278
|
+
if (item) {
|
|
279
|
+
callback(name, internalGetIconData(data, name, item));
|
|
280
|
+
names.push(name);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return names;
|
|
279
284
|
}
|
|
280
285
|
|
|
286
|
+
/**
|
|
287
|
+
* Optional properties
|
|
288
|
+
*/
|
|
281
289
|
const optionalPropertyDefaults = {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
290
|
+
provider: "",
|
|
291
|
+
aliases: {},
|
|
292
|
+
not_found: {},
|
|
293
|
+
...defaultIconDimensions
|
|
286
294
|
};
|
|
295
|
+
/**
|
|
296
|
+
* Check props
|
|
297
|
+
*/
|
|
287
298
|
function checkOptionalProps(item, defaults) {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
return false;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
return true;
|
|
299
|
+
for (const prop in defaults) if (prop in item && typeof item[prop] !== typeof defaults[prop]) return false;
|
|
300
|
+
return true;
|
|
294
301
|
}
|
|
302
|
+
/**
|
|
303
|
+
* Validate icon set, return it as IconifyJSON on success, null on failure
|
|
304
|
+
*
|
|
305
|
+
* Unlike validateIconSet(), this function is very basic.
|
|
306
|
+
* It does not throw exceptions, it does not check metadata, it does not fix stuff.
|
|
307
|
+
*/
|
|
295
308
|
function quicklyValidateIconSet(obj) {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
typeof icon.body !== "string" || // Check other props
|
|
313
|
-
!checkOptionalProps(
|
|
314
|
-
icon,
|
|
315
|
-
defaultExtendedIconProps
|
|
316
|
-
)
|
|
317
|
-
) {
|
|
318
|
-
return null;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
|
|
322
|
-
for (const name in aliases) {
|
|
323
|
-
const icon = aliases[name];
|
|
324
|
-
const parent = icon.parent;
|
|
325
|
-
if (
|
|
326
|
-
// Name cannot be empty
|
|
327
|
-
!name || // Parent must be set and point to existing icon
|
|
328
|
-
typeof parent !== "string" || !icons[parent] && !aliases[parent] || // Check other props
|
|
329
|
-
!checkOptionalProps(
|
|
330
|
-
icon,
|
|
331
|
-
defaultExtendedIconProps
|
|
332
|
-
)
|
|
333
|
-
) {
|
|
334
|
-
return null;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
return data;
|
|
309
|
+
if (typeof obj !== "object" || obj === null) return null;
|
|
310
|
+
const data = obj;
|
|
311
|
+
if (typeof data.prefix !== "string" || !obj.icons || typeof obj.icons !== "object") return null;
|
|
312
|
+
if (!checkOptionalProps(obj, optionalPropertyDefaults)) return null;
|
|
313
|
+
const icons = data.icons;
|
|
314
|
+
for (const name in icons) {
|
|
315
|
+
const icon = icons[name];
|
|
316
|
+
if (!name || typeof icon.body !== "string" || !checkOptionalProps(icon, defaultExtendedIconProps)) return null;
|
|
317
|
+
}
|
|
318
|
+
const aliases = data.aliases || Object.create(null);
|
|
319
|
+
for (const name in aliases) {
|
|
320
|
+
const icon = aliases[name];
|
|
321
|
+
const parent = icon.parent;
|
|
322
|
+
if (!name || typeof parent !== "string" || !icons[parent] && !aliases[parent] || !checkOptionalProps(icon, defaultExtendedIconProps)) return null;
|
|
323
|
+
}
|
|
324
|
+
return data;
|
|
338
325
|
}
|
|
339
326
|
|
|
340
|
-
|
|
327
|
+
/**
|
|
328
|
+
* Storage by provider and prefix
|
|
329
|
+
*/
|
|
330
|
+
const dataStorage = Object.create(null);
|
|
331
|
+
/**
|
|
332
|
+
* Create new storage
|
|
333
|
+
*/
|
|
341
334
|
function newStorage(provider, prefix) {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
335
|
+
return {
|
|
336
|
+
provider,
|
|
337
|
+
prefix,
|
|
338
|
+
icons: Object.create(null),
|
|
339
|
+
missing: /* @__PURE__ */ new Set()
|
|
340
|
+
};
|
|
348
341
|
}
|
|
342
|
+
/**
|
|
343
|
+
* Get storage for provider and prefix
|
|
344
|
+
*/
|
|
349
345
|
function getStorage(provider, prefix) {
|
|
350
|
-
|
|
351
|
-
|
|
346
|
+
const providerStorage = dataStorage[provider] || (dataStorage[provider] = Object.create(null));
|
|
347
|
+
return providerStorage[prefix] || (providerStorage[prefix] = newStorage(provider, prefix));
|
|
352
348
|
}
|
|
349
|
+
/**
|
|
350
|
+
* Add icon set to storage
|
|
351
|
+
*
|
|
352
|
+
* Returns array of added icons
|
|
353
|
+
*/
|
|
353
354
|
function addIconSet(storage, data) {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
storage.icons[name] = icon;
|
|
360
|
-
} else {
|
|
361
|
-
storage.missing.add(name);
|
|
362
|
-
}
|
|
363
|
-
});
|
|
355
|
+
if (!quicklyValidateIconSet(data)) return [];
|
|
356
|
+
return parseIconSet(data, (name, icon) => {
|
|
357
|
+
if (icon) storage.icons[name] = icon;
|
|
358
|
+
else storage.missing.add(name);
|
|
359
|
+
});
|
|
364
360
|
}
|
|
361
|
+
/**
|
|
362
|
+
* Add icon to storage
|
|
363
|
+
*/
|
|
365
364
|
function addIconToStorage(storage, name, icon) {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
return false;
|
|
365
|
+
try {
|
|
366
|
+
if (typeof icon.body === "string") {
|
|
367
|
+
storage.icons[name] = { ...icon };
|
|
368
|
+
return true;
|
|
369
|
+
}
|
|
370
|
+
} catch (err) {}
|
|
371
|
+
return false;
|
|
374
372
|
}
|
|
373
|
+
/**
|
|
374
|
+
* List available icons
|
|
375
|
+
*/
|
|
375
376
|
function listIcons$1(provider, prefix) {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
(name) => (provider2 !== "" ? "@" + provider2 + ":" : "") + prefix2 + ":" + name
|
|
385
|
-
)
|
|
386
|
-
);
|
|
387
|
-
});
|
|
388
|
-
});
|
|
389
|
-
return allIcons;
|
|
377
|
+
let allIcons = [];
|
|
378
|
+
(typeof provider === "string" ? [provider] : Object.keys(dataStorage)).forEach((provider$1) => {
|
|
379
|
+
(typeof provider$1 === "string" && typeof prefix === "string" ? [prefix] : Object.keys(dataStorage[provider$1] || {})).forEach((prefix$1) => {
|
|
380
|
+
const storage = getStorage(provider$1, prefix$1);
|
|
381
|
+
allIcons = allIcons.concat(Object.keys(storage.icons).map((name) => (provider$1 !== "" ? "@" + provider$1 + ":" : "") + prefix$1 + ":" + name));
|
|
382
|
+
});
|
|
383
|
+
});
|
|
384
|
+
return allIcons;
|
|
390
385
|
}
|
|
391
386
|
|
|
387
|
+
/**
|
|
388
|
+
* Allow storing icons without provider or prefix, making it possible to store icons like "home"
|
|
389
|
+
*/
|
|
392
390
|
let simpleNames = false;
|
|
393
391
|
function allowSimpleNames(allow) {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}
|
|
397
|
-
return simpleNames;
|
|
392
|
+
if (typeof allow === "boolean") simpleNames = allow;
|
|
393
|
+
return simpleNames;
|
|
398
394
|
}
|
|
395
|
+
/**
|
|
396
|
+
* Get icon data
|
|
397
|
+
*
|
|
398
|
+
* Returns:
|
|
399
|
+
* - IconifyIcon on success, object directly from storage so don't modify it
|
|
400
|
+
* - null if icon is marked as missing (returned in `not_found` property from API, so don't bother sending API requests)
|
|
401
|
+
* - undefined if icon is missing in storage
|
|
402
|
+
*/
|
|
399
403
|
function getIconData(name) {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
404
|
+
const icon = typeof name === "string" ? stringToIcon(name, true, simpleNames) : name;
|
|
405
|
+
if (icon) {
|
|
406
|
+
const storage = getStorage(icon.provider, icon.prefix);
|
|
407
|
+
const iconName = icon.name;
|
|
408
|
+
return storage.icons[iconName] || (storage.missing.has(iconName) ? null : void 0);
|
|
409
|
+
}
|
|
406
410
|
}
|
|
411
|
+
/**
|
|
412
|
+
* Add one icon
|
|
413
|
+
*/
|
|
407
414
|
function addIcon$1(name, data) {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
storage.missing.add(icon.name);
|
|
417
|
-
return true;
|
|
418
|
-
}
|
|
415
|
+
const icon = stringToIcon(name, true, simpleNames);
|
|
416
|
+
if (!icon) return false;
|
|
417
|
+
const storage = getStorage(icon.provider, icon.prefix);
|
|
418
|
+
if (data) return addIconToStorage(storage, icon.name, data);
|
|
419
|
+
else {
|
|
420
|
+
storage.missing.add(icon.name);
|
|
421
|
+
return true;
|
|
422
|
+
}
|
|
419
423
|
}
|
|
424
|
+
/**
|
|
425
|
+
* Add icon set
|
|
426
|
+
*/
|
|
420
427
|
function addCollection$1(data, provider) {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
const prefix = data.prefix;
|
|
440
|
-
if (!validateIconName({
|
|
441
|
-
prefix,
|
|
442
|
-
name: "a"
|
|
443
|
-
})) {
|
|
444
|
-
return false;
|
|
445
|
-
}
|
|
446
|
-
const storage = getStorage(provider, prefix);
|
|
447
|
-
return !!addIconSet(storage, data);
|
|
428
|
+
if (typeof data !== "object") return false;
|
|
429
|
+
if (typeof provider !== "string") provider = data.provider || "";
|
|
430
|
+
if (simpleNames && !provider && !data.prefix) {
|
|
431
|
+
let added = false;
|
|
432
|
+
if (quicklyValidateIconSet(data)) {
|
|
433
|
+
data.prefix = "";
|
|
434
|
+
parseIconSet(data, (name, icon) => {
|
|
435
|
+
if (addIcon$1(name, icon)) added = true;
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
return added;
|
|
439
|
+
}
|
|
440
|
+
const prefix = data.prefix;
|
|
441
|
+
if (!validateIconName({
|
|
442
|
+
prefix,
|
|
443
|
+
name: "a"
|
|
444
|
+
})) return false;
|
|
445
|
+
return !!addIconSet(getStorage(provider, prefix), data);
|
|
448
446
|
}
|
|
447
|
+
/**
|
|
448
|
+
* Check if icon data is available
|
|
449
|
+
*/
|
|
449
450
|
function iconLoaded$1(name) {
|
|
450
|
-
|
|
451
|
+
return !!getIconData(name);
|
|
451
452
|
}
|
|
453
|
+
/**
|
|
454
|
+
* Get full icon
|
|
455
|
+
*/
|
|
452
456
|
function getIcon$1(name) {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
function sortIcons(icons) {
|
|
461
|
-
const result = {
|
|
462
|
-
loaded: [],
|
|
463
|
-
missing: [],
|
|
464
|
-
pending: []
|
|
465
|
-
};
|
|
466
|
-
const storage = /* @__PURE__ */ Object.create(null);
|
|
467
|
-
icons.sort((a, b) => {
|
|
468
|
-
if (a.provider !== b.provider) {
|
|
469
|
-
return a.provider.localeCompare(b.provider);
|
|
470
|
-
}
|
|
471
|
-
if (a.prefix !== b.prefix) {
|
|
472
|
-
return a.prefix.localeCompare(b.prefix);
|
|
473
|
-
}
|
|
474
|
-
return a.name.localeCompare(b.name);
|
|
475
|
-
});
|
|
476
|
-
let lastIcon = {
|
|
477
|
-
provider: "",
|
|
478
|
-
prefix: "",
|
|
479
|
-
name: ""
|
|
480
|
-
};
|
|
481
|
-
icons.forEach((icon) => {
|
|
482
|
-
if (lastIcon.name === icon.name && lastIcon.prefix === icon.prefix && lastIcon.provider === icon.provider) {
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
lastIcon = icon;
|
|
486
|
-
const provider = icon.provider;
|
|
487
|
-
const prefix = icon.prefix;
|
|
488
|
-
const name = icon.name;
|
|
489
|
-
const providerStorage = storage[provider] || (storage[provider] = /* @__PURE__ */ Object.create(null));
|
|
490
|
-
const localStorage = providerStorage[prefix] || (providerStorage[prefix] = getStorage(provider, prefix));
|
|
491
|
-
let list;
|
|
492
|
-
if (name in localStorage.icons) {
|
|
493
|
-
list = result.loaded;
|
|
494
|
-
} else if (prefix === "" || localStorage.missing.has(name)) {
|
|
495
|
-
list = result.missing;
|
|
496
|
-
} else {
|
|
497
|
-
list = result.pending;
|
|
498
|
-
}
|
|
499
|
-
const item = {
|
|
500
|
-
provider,
|
|
501
|
-
prefix,
|
|
502
|
-
name
|
|
503
|
-
};
|
|
504
|
-
list.push(item);
|
|
505
|
-
});
|
|
506
|
-
return result;
|
|
457
|
+
const result = getIconData(name);
|
|
458
|
+
return result ? {
|
|
459
|
+
...defaultIconProps,
|
|
460
|
+
...result
|
|
461
|
+
} : result;
|
|
507
462
|
}
|
|
508
463
|
|
|
464
|
+
/**
|
|
465
|
+
* Remove callback
|
|
466
|
+
*/
|
|
509
467
|
function removeCallback(storages, id) {
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
}
|
|
515
|
-
});
|
|
468
|
+
storages.forEach((storage) => {
|
|
469
|
+
const items = storage.loaderCallbacks;
|
|
470
|
+
if (items) storage.loaderCallbacks = items.filter((row) => row.id !== id);
|
|
471
|
+
});
|
|
516
472
|
}
|
|
473
|
+
/**
|
|
474
|
+
* Update all callbacks for provider and prefix
|
|
475
|
+
*/
|
|
517
476
|
function updateCallbacks(storage) {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
if (!hasPending) {
|
|
557
|
-
removeCallback([storage], item.id);
|
|
558
|
-
}
|
|
559
|
-
item.callback(
|
|
560
|
-
icons.loaded.slice(0),
|
|
561
|
-
icons.missing.slice(0),
|
|
562
|
-
icons.pending.slice(0),
|
|
563
|
-
item.abort
|
|
564
|
-
);
|
|
565
|
-
}
|
|
566
|
-
});
|
|
567
|
-
});
|
|
568
|
-
}
|
|
477
|
+
if (!storage.pendingCallbacksFlag) {
|
|
478
|
+
storage.pendingCallbacksFlag = true;
|
|
479
|
+
setTimeout(() => {
|
|
480
|
+
storage.pendingCallbacksFlag = false;
|
|
481
|
+
const items = storage.loaderCallbacks ? storage.loaderCallbacks.slice(0) : [];
|
|
482
|
+
if (!items.length) return;
|
|
483
|
+
let hasPending = false;
|
|
484
|
+
const provider = storage.provider;
|
|
485
|
+
const prefix = storage.prefix;
|
|
486
|
+
items.forEach((item) => {
|
|
487
|
+
const icons = item.icons;
|
|
488
|
+
const oldLength = icons.pending.length;
|
|
489
|
+
icons.pending = icons.pending.filter((icon) => {
|
|
490
|
+
if (icon.prefix !== prefix) return true;
|
|
491
|
+
const name = icon.name;
|
|
492
|
+
if (storage.icons[name]) icons.loaded.push({
|
|
493
|
+
provider,
|
|
494
|
+
prefix,
|
|
495
|
+
name
|
|
496
|
+
});
|
|
497
|
+
else if (storage.missing.has(name)) icons.missing.push({
|
|
498
|
+
provider,
|
|
499
|
+
prefix,
|
|
500
|
+
name
|
|
501
|
+
});
|
|
502
|
+
else {
|
|
503
|
+
hasPending = true;
|
|
504
|
+
return true;
|
|
505
|
+
}
|
|
506
|
+
return false;
|
|
507
|
+
});
|
|
508
|
+
if (icons.pending.length !== oldLength) {
|
|
509
|
+
if (!hasPending) removeCallback([storage], item.id);
|
|
510
|
+
item.callback(icons.loaded.slice(0), icons.missing.slice(0), icons.pending.slice(0), item.abort);
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
});
|
|
514
|
+
}
|
|
569
515
|
}
|
|
516
|
+
/**
|
|
517
|
+
* Unique id counter for callbacks
|
|
518
|
+
*/
|
|
570
519
|
let idCounter = 0;
|
|
520
|
+
/**
|
|
521
|
+
* Add callback
|
|
522
|
+
*/
|
|
571
523
|
function storeCallback(callback, icons, pendingSources) {
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
524
|
+
const id = idCounter++;
|
|
525
|
+
const abort = removeCallback.bind(null, pendingSources, id);
|
|
526
|
+
if (!icons.pending.length) return abort;
|
|
527
|
+
const item = {
|
|
528
|
+
id,
|
|
529
|
+
icons,
|
|
530
|
+
callback,
|
|
531
|
+
abort
|
|
532
|
+
};
|
|
533
|
+
pendingSources.forEach((storage) => {
|
|
534
|
+
(storage.loaderCallbacks || (storage.loaderCallbacks = [])).push(item);
|
|
535
|
+
});
|
|
536
|
+
return abort;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Check if icons have been loaded
|
|
541
|
+
*/
|
|
542
|
+
function sortIcons(icons) {
|
|
543
|
+
const result = {
|
|
544
|
+
loaded: [],
|
|
545
|
+
missing: [],
|
|
546
|
+
pending: []
|
|
547
|
+
};
|
|
548
|
+
const storage = Object.create(null);
|
|
549
|
+
icons.sort((a, b) => {
|
|
550
|
+
if (a.provider !== b.provider) return a.provider.localeCompare(b.provider);
|
|
551
|
+
if (a.prefix !== b.prefix) return a.prefix.localeCompare(b.prefix);
|
|
552
|
+
return a.name.localeCompare(b.name);
|
|
553
|
+
});
|
|
554
|
+
let lastIcon = {
|
|
555
|
+
provider: "",
|
|
556
|
+
prefix: "",
|
|
557
|
+
name: ""
|
|
558
|
+
};
|
|
559
|
+
icons.forEach((icon) => {
|
|
560
|
+
if (lastIcon.name === icon.name && lastIcon.prefix === icon.prefix && lastIcon.provider === icon.provider) return;
|
|
561
|
+
lastIcon = icon;
|
|
562
|
+
const provider = icon.provider;
|
|
563
|
+
const prefix = icon.prefix;
|
|
564
|
+
const name = icon.name;
|
|
565
|
+
const providerStorage = storage[provider] || (storage[provider] = Object.create(null));
|
|
566
|
+
const localStorage = providerStorage[prefix] || (providerStorage[prefix] = getStorage(provider, prefix));
|
|
567
|
+
let list;
|
|
568
|
+
if (name in localStorage.icons) list = result.loaded;
|
|
569
|
+
else if (prefix === "" || localStorage.missing.has(name)) list = result.missing;
|
|
570
|
+
else list = result.pending;
|
|
571
|
+
const item = {
|
|
572
|
+
provider,
|
|
573
|
+
prefix,
|
|
574
|
+
name
|
|
575
|
+
};
|
|
576
|
+
list.push(item);
|
|
577
|
+
});
|
|
578
|
+
return result;
|
|
587
579
|
}
|
|
588
580
|
|
|
589
|
-
|
|
581
|
+
/**
|
|
582
|
+
* Local storate types and entries
|
|
583
|
+
*/
|
|
584
|
+
const storage = Object.create(null);
|
|
585
|
+
/**
|
|
586
|
+
* Set API module
|
|
587
|
+
*/
|
|
590
588
|
function setAPIModule(provider, item) {
|
|
591
|
-
|
|
589
|
+
storage[provider] = item;
|
|
592
590
|
}
|
|
591
|
+
/**
|
|
592
|
+
* Get API module
|
|
593
|
+
*/
|
|
593
594
|
function getAPIModule(provider) {
|
|
594
|
-
|
|
595
|
+
return storage[provider] || storage[""];
|
|
595
596
|
}
|
|
596
597
|
|
|
598
|
+
/**
|
|
599
|
+
* Convert icons list from string/icon mix to icons and validate them
|
|
600
|
+
*/
|
|
597
601
|
function listToIcons(list, validate = true, simpleNames = false) {
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
});
|
|
605
|
-
return result;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
// src/config.ts
|
|
609
|
-
var defaultConfig = {
|
|
610
|
-
resources: [],
|
|
611
|
-
index: 0,
|
|
612
|
-
timeout: 2e3,
|
|
613
|
-
rotate: 750,
|
|
614
|
-
random: false,
|
|
615
|
-
dataAfterTimeout: false
|
|
616
|
-
};
|
|
617
|
-
|
|
618
|
-
// src/query.ts
|
|
619
|
-
function sendQuery(config, payload, query, done) {
|
|
620
|
-
const resourcesCount = config.resources.length;
|
|
621
|
-
const startIndex = config.random ? Math.floor(Math.random() * resourcesCount) : config.index;
|
|
622
|
-
let resources;
|
|
623
|
-
if (config.random) {
|
|
624
|
-
let list = config.resources.slice(0);
|
|
625
|
-
resources = [];
|
|
626
|
-
while (list.length > 1) {
|
|
627
|
-
const nextIndex = Math.floor(Math.random() * list.length);
|
|
628
|
-
resources.push(list[nextIndex]);
|
|
629
|
-
list = list.slice(0, nextIndex).concat(list.slice(nextIndex + 1));
|
|
630
|
-
}
|
|
631
|
-
resources = resources.concat(list);
|
|
632
|
-
} else {
|
|
633
|
-
resources = config.resources.slice(startIndex).concat(config.resources.slice(0, startIndex));
|
|
634
|
-
}
|
|
635
|
-
const startTime = Date.now();
|
|
636
|
-
let status = "pending";
|
|
637
|
-
let queriesSent = 0;
|
|
638
|
-
let lastError;
|
|
639
|
-
let timer = null;
|
|
640
|
-
let queue = [];
|
|
641
|
-
let doneCallbacks = [];
|
|
642
|
-
if (typeof done === "function") {
|
|
643
|
-
doneCallbacks.push(done);
|
|
644
|
-
}
|
|
645
|
-
function resetTimer() {
|
|
646
|
-
if (timer) {
|
|
647
|
-
clearTimeout(timer);
|
|
648
|
-
timer = null;
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
function abort() {
|
|
652
|
-
if (status === "pending") {
|
|
653
|
-
status = "aborted";
|
|
654
|
-
}
|
|
655
|
-
resetTimer();
|
|
656
|
-
queue.forEach((item) => {
|
|
657
|
-
if (item.status === "pending") {
|
|
658
|
-
item.status = "aborted";
|
|
659
|
-
}
|
|
660
|
-
});
|
|
661
|
-
queue = [];
|
|
662
|
-
}
|
|
663
|
-
function subscribe(callback, overwrite) {
|
|
664
|
-
if (overwrite) {
|
|
665
|
-
doneCallbacks = [];
|
|
666
|
-
}
|
|
667
|
-
if (typeof callback === "function") {
|
|
668
|
-
doneCallbacks.push(callback);
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
function getQueryStatus() {
|
|
672
|
-
return {
|
|
673
|
-
startTime,
|
|
674
|
-
payload,
|
|
675
|
-
status,
|
|
676
|
-
queriesSent,
|
|
677
|
-
queriesPending: queue.length,
|
|
678
|
-
subscribe,
|
|
679
|
-
abort
|
|
680
|
-
};
|
|
681
|
-
}
|
|
682
|
-
function failQuery() {
|
|
683
|
-
status = "failed";
|
|
684
|
-
doneCallbacks.forEach((callback) => {
|
|
685
|
-
callback(void 0, lastError);
|
|
686
|
-
});
|
|
687
|
-
}
|
|
688
|
-
function clearQueue() {
|
|
689
|
-
queue.forEach((item) => {
|
|
690
|
-
if (item.status === "pending") {
|
|
691
|
-
item.status = "aborted";
|
|
692
|
-
}
|
|
693
|
-
});
|
|
694
|
-
queue = [];
|
|
695
|
-
}
|
|
696
|
-
function moduleResponse(item, response, data) {
|
|
697
|
-
const isError = response !== "success";
|
|
698
|
-
queue = queue.filter((queued) => queued !== item);
|
|
699
|
-
switch (status) {
|
|
700
|
-
case "pending":
|
|
701
|
-
break;
|
|
702
|
-
case "failed":
|
|
703
|
-
if (isError || !config.dataAfterTimeout) {
|
|
704
|
-
return;
|
|
705
|
-
}
|
|
706
|
-
break;
|
|
707
|
-
default:
|
|
708
|
-
return;
|
|
709
|
-
}
|
|
710
|
-
if (response === "abort") {
|
|
711
|
-
lastError = data;
|
|
712
|
-
failQuery();
|
|
713
|
-
return;
|
|
714
|
-
}
|
|
715
|
-
if (isError) {
|
|
716
|
-
lastError = data;
|
|
717
|
-
if (!queue.length) {
|
|
718
|
-
if (!resources.length) {
|
|
719
|
-
failQuery();
|
|
720
|
-
} else {
|
|
721
|
-
execNext();
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
return;
|
|
725
|
-
}
|
|
726
|
-
resetTimer();
|
|
727
|
-
clearQueue();
|
|
728
|
-
if (!config.random) {
|
|
729
|
-
const index = config.resources.indexOf(item.resource);
|
|
730
|
-
if (index !== -1 && index !== config.index) {
|
|
731
|
-
config.index = index;
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
status = "completed";
|
|
735
|
-
doneCallbacks.forEach((callback) => {
|
|
736
|
-
callback(data);
|
|
737
|
-
});
|
|
738
|
-
}
|
|
739
|
-
function execNext() {
|
|
740
|
-
if (status !== "pending") {
|
|
741
|
-
return;
|
|
742
|
-
}
|
|
743
|
-
resetTimer();
|
|
744
|
-
const resource = resources.shift();
|
|
745
|
-
if (resource === void 0) {
|
|
746
|
-
if (queue.length) {
|
|
747
|
-
timer = setTimeout(() => {
|
|
748
|
-
resetTimer();
|
|
749
|
-
if (status === "pending") {
|
|
750
|
-
clearQueue();
|
|
751
|
-
failQuery();
|
|
752
|
-
}
|
|
753
|
-
}, config.timeout);
|
|
754
|
-
return;
|
|
755
|
-
}
|
|
756
|
-
failQuery();
|
|
757
|
-
return;
|
|
758
|
-
}
|
|
759
|
-
const item = {
|
|
760
|
-
status: "pending",
|
|
761
|
-
resource,
|
|
762
|
-
callback: (status2, data) => {
|
|
763
|
-
moduleResponse(item, status2, data);
|
|
764
|
-
}
|
|
765
|
-
};
|
|
766
|
-
queue.push(item);
|
|
767
|
-
queriesSent++;
|
|
768
|
-
timer = setTimeout(execNext, config.rotate);
|
|
769
|
-
query(resource, payload, item.callback);
|
|
770
|
-
}
|
|
771
|
-
setTimeout(execNext);
|
|
772
|
-
return getQueryStatus;
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
// src/index.ts
|
|
776
|
-
function initRedundancy(cfg) {
|
|
777
|
-
const config = {
|
|
778
|
-
...defaultConfig,
|
|
779
|
-
...cfg
|
|
780
|
-
};
|
|
781
|
-
let queries = [];
|
|
782
|
-
function cleanup() {
|
|
783
|
-
queries = queries.filter((item) => item().status === "pending");
|
|
784
|
-
}
|
|
785
|
-
function query(payload, queryCallback, doneCallback) {
|
|
786
|
-
const query2 = sendQuery(
|
|
787
|
-
config,
|
|
788
|
-
payload,
|
|
789
|
-
queryCallback,
|
|
790
|
-
(data, error) => {
|
|
791
|
-
cleanup();
|
|
792
|
-
if (doneCallback) {
|
|
793
|
-
doneCallback(data, error);
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
);
|
|
797
|
-
queries.push(query2);
|
|
798
|
-
return query2;
|
|
799
|
-
}
|
|
800
|
-
function find(callback) {
|
|
801
|
-
return queries.find((value) => {
|
|
802
|
-
return callback(value);
|
|
803
|
-
}) || null;
|
|
804
|
-
}
|
|
805
|
-
const instance = {
|
|
806
|
-
query,
|
|
807
|
-
find,
|
|
808
|
-
setIndex: (index) => {
|
|
809
|
-
config.index = index;
|
|
810
|
-
},
|
|
811
|
-
getIndex: () => config.index,
|
|
812
|
-
cleanup
|
|
813
|
-
};
|
|
814
|
-
return instance;
|
|
602
|
+
const result = [];
|
|
603
|
+
list.forEach((item) => {
|
|
604
|
+
const icon = typeof item === "string" ? stringToIcon(item, validate, simpleNames) : item;
|
|
605
|
+
if (icon) result.push(icon);
|
|
606
|
+
});
|
|
607
|
+
return result;
|
|
815
608
|
}
|
|
816
609
|
|
|
610
|
+
/**
|
|
611
|
+
* Create full API configuration from partial data
|
|
612
|
+
*/
|
|
817
613
|
function createAPIConfig(source) {
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
// Timeout before next host is used.
|
|
835
|
-
rotate: source.rotate || 750,
|
|
836
|
-
// Timeout before failing query.
|
|
837
|
-
timeout: source.timeout || 5e3,
|
|
838
|
-
// Randomise default API end point.
|
|
839
|
-
random: source.random === true,
|
|
840
|
-
// Start index
|
|
841
|
-
index: source.index || 0,
|
|
842
|
-
// Receive data after time out (used if time out kicks in first, then API module sends data anyway).
|
|
843
|
-
dataAfterTimeout: source.dataAfterTimeout !== false
|
|
844
|
-
};
|
|
845
|
-
return result;
|
|
614
|
+
let resources;
|
|
615
|
+
if (typeof source.resources === "string") resources = [source.resources];
|
|
616
|
+
else {
|
|
617
|
+
resources = source.resources;
|
|
618
|
+
if (!(resources instanceof Array) || !resources.length) return null;
|
|
619
|
+
}
|
|
620
|
+
return {
|
|
621
|
+
resources,
|
|
622
|
+
path: source.path || "/",
|
|
623
|
+
maxURL: source.maxURL || 500,
|
|
624
|
+
rotate: source.rotate || 750,
|
|
625
|
+
timeout: source.timeout || 5e3,
|
|
626
|
+
random: source.random === true,
|
|
627
|
+
index: source.index || 0,
|
|
628
|
+
dataAfterTimeout: source.dataAfterTimeout !== false
|
|
629
|
+
};
|
|
846
630
|
}
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
631
|
+
/**
|
|
632
|
+
* Local storage
|
|
633
|
+
*/
|
|
634
|
+
const configStorage = Object.create(null);
|
|
635
|
+
/**
|
|
636
|
+
* Redundancy for API servers.
|
|
637
|
+
*
|
|
638
|
+
* API should have very high uptime because of implemented redundancy at server level, but
|
|
639
|
+
* sometimes bad things happen. On internet 100% uptime is not possible.
|
|
640
|
+
*
|
|
641
|
+
* There could be routing problems. Server might go down for whatever reason, but it takes
|
|
642
|
+
* few minutes to detect that downtime, so during those few minutes API might not be accessible.
|
|
643
|
+
*
|
|
644
|
+
* This script has some redundancy to mitigate possible network issues.
|
|
645
|
+
*
|
|
646
|
+
* If one host cannot be reached in 'rotate' (750 by default) ms, script will try to retrieve
|
|
647
|
+
* data from different host. Hosts have different configurations, pointing to different
|
|
648
|
+
* API servers hosted at different providers.
|
|
649
|
+
*/
|
|
650
|
+
const fallBackAPISources = ["https://api.simplesvg.com", "https://api.unisvg.com"];
|
|
852
651
|
const fallBackAPI = [];
|
|
853
|
-
while (fallBackAPISources.length > 0)
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
fallBackAPI.push(fallBackAPISources.pop());
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
configStorage[""] = createAPIConfig({
|
|
865
|
-
resources: ["https://api.iconify.design"].concat(fallBackAPI)
|
|
866
|
-
});
|
|
652
|
+
while (fallBackAPISources.length > 0) if (fallBackAPISources.length === 1) fallBackAPI.push(fallBackAPISources.shift());
|
|
653
|
+
else if (Math.random() > .5) fallBackAPI.push(fallBackAPISources.shift());
|
|
654
|
+
else fallBackAPI.push(fallBackAPISources.pop());
|
|
655
|
+
configStorage[""] = createAPIConfig({ resources: ["https://api.iconify.design"].concat(fallBackAPI) });
|
|
656
|
+
/**
|
|
657
|
+
* Add custom config for provider
|
|
658
|
+
*/
|
|
867
659
|
function addAPIProvider$1(provider, customConfig) {
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
configStorage[provider] = config;
|
|
873
|
-
return true;
|
|
660
|
+
const config = createAPIConfig(customConfig);
|
|
661
|
+
if (config === null) return false;
|
|
662
|
+
configStorage[provider] = config;
|
|
663
|
+
return true;
|
|
874
664
|
}
|
|
665
|
+
/**
|
|
666
|
+
* Get API configuration
|
|
667
|
+
*/
|
|
875
668
|
function getAPIConfig(provider) {
|
|
876
|
-
|
|
669
|
+
return configStorage[provider];
|
|
877
670
|
}
|
|
671
|
+
/**
|
|
672
|
+
* List API providers
|
|
673
|
+
*/
|
|
878
674
|
function listAPIProviders() {
|
|
879
|
-
|
|
675
|
+
return Object.keys(configStorage);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Default RedundancyConfig for API calls
|
|
680
|
+
*/
|
|
681
|
+
const defaultConfig = {
|
|
682
|
+
resources: [],
|
|
683
|
+
index: 0,
|
|
684
|
+
timeout: 2e3,
|
|
685
|
+
rotate: 750,
|
|
686
|
+
random: false,
|
|
687
|
+
dataAfterTimeout: false
|
|
688
|
+
};
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Send query
|
|
692
|
+
*/
|
|
693
|
+
function sendQuery(config, payload, query, done) {
|
|
694
|
+
const resourcesCount = config.resources.length;
|
|
695
|
+
const startIndex = config.random ? Math.floor(Math.random() * resourcesCount) : config.index;
|
|
696
|
+
let resources;
|
|
697
|
+
if (config.random) {
|
|
698
|
+
let list = config.resources.slice(0);
|
|
699
|
+
resources = [];
|
|
700
|
+
while (list.length > 1) {
|
|
701
|
+
const nextIndex = Math.floor(Math.random() * list.length);
|
|
702
|
+
resources.push(list[nextIndex]);
|
|
703
|
+
list = list.slice(0, nextIndex).concat(list.slice(nextIndex + 1));
|
|
704
|
+
}
|
|
705
|
+
resources = resources.concat(list);
|
|
706
|
+
} else resources = config.resources.slice(startIndex).concat(config.resources.slice(0, startIndex));
|
|
707
|
+
const startTime = Date.now();
|
|
708
|
+
let status = "pending";
|
|
709
|
+
let queriesSent = 0;
|
|
710
|
+
let lastError;
|
|
711
|
+
let timer = null;
|
|
712
|
+
let queue = [];
|
|
713
|
+
let doneCallbacks = [];
|
|
714
|
+
if (typeof done === "function") doneCallbacks.push(done);
|
|
715
|
+
/**
|
|
716
|
+
* Reset timer
|
|
717
|
+
*/
|
|
718
|
+
function resetTimer() {
|
|
719
|
+
if (timer) {
|
|
720
|
+
clearTimeout(timer);
|
|
721
|
+
timer = null;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Abort everything
|
|
726
|
+
*/
|
|
727
|
+
function abort() {
|
|
728
|
+
if (status === "pending") status = "aborted";
|
|
729
|
+
resetTimer();
|
|
730
|
+
queue.forEach((item) => {
|
|
731
|
+
if (item.status === "pending") item.status = "aborted";
|
|
732
|
+
});
|
|
733
|
+
queue = [];
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Add / replace callback to call when execution is complete.
|
|
737
|
+
* This can be used to abort pending query implementations when query is complete or aborted.
|
|
738
|
+
*/
|
|
739
|
+
function subscribe(callback, overwrite) {
|
|
740
|
+
if (overwrite) doneCallbacks = [];
|
|
741
|
+
if (typeof callback === "function") doneCallbacks.push(callback);
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Get query status
|
|
745
|
+
*/
|
|
746
|
+
function getQueryStatus() {
|
|
747
|
+
return {
|
|
748
|
+
startTime,
|
|
749
|
+
payload,
|
|
750
|
+
status,
|
|
751
|
+
queriesSent,
|
|
752
|
+
queriesPending: queue.length,
|
|
753
|
+
subscribe,
|
|
754
|
+
abort
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* Fail query
|
|
759
|
+
*/
|
|
760
|
+
function failQuery() {
|
|
761
|
+
status = "failed";
|
|
762
|
+
doneCallbacks.forEach((callback) => {
|
|
763
|
+
callback(void 0, lastError);
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* Clear queue
|
|
768
|
+
*/
|
|
769
|
+
function clearQueue() {
|
|
770
|
+
queue.forEach((item) => {
|
|
771
|
+
if (item.status === "pending") item.status = "aborted";
|
|
772
|
+
});
|
|
773
|
+
queue = [];
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* Got response from module
|
|
777
|
+
*/
|
|
778
|
+
function moduleResponse(item, response, data) {
|
|
779
|
+
const isError = response !== "success";
|
|
780
|
+
queue = queue.filter((queued) => queued !== item);
|
|
781
|
+
switch (status) {
|
|
782
|
+
case "pending": break;
|
|
783
|
+
case "failed":
|
|
784
|
+
if (isError || !config.dataAfterTimeout) return;
|
|
785
|
+
break;
|
|
786
|
+
default: return;
|
|
787
|
+
}
|
|
788
|
+
if (response === "abort") {
|
|
789
|
+
lastError = data;
|
|
790
|
+
failQuery();
|
|
791
|
+
return;
|
|
792
|
+
}
|
|
793
|
+
if (isError) {
|
|
794
|
+
lastError = data;
|
|
795
|
+
if (!queue.length) if (!resources.length) failQuery();
|
|
796
|
+
else execNext();
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
resetTimer();
|
|
800
|
+
clearQueue();
|
|
801
|
+
if (!config.random) {
|
|
802
|
+
const index = config.resources.indexOf(item.resource);
|
|
803
|
+
if (index !== -1 && index !== config.index) config.index = index;
|
|
804
|
+
}
|
|
805
|
+
status = "completed";
|
|
806
|
+
doneCallbacks.forEach((callback) => {
|
|
807
|
+
callback(data);
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Execute next query
|
|
812
|
+
*/
|
|
813
|
+
function execNext() {
|
|
814
|
+
if (status !== "pending") return;
|
|
815
|
+
resetTimer();
|
|
816
|
+
const resource = resources.shift();
|
|
817
|
+
if (resource === void 0) {
|
|
818
|
+
if (queue.length) {
|
|
819
|
+
timer = setTimeout(() => {
|
|
820
|
+
resetTimer();
|
|
821
|
+
if (status === "pending") {
|
|
822
|
+
clearQueue();
|
|
823
|
+
failQuery();
|
|
824
|
+
}
|
|
825
|
+
}, config.timeout);
|
|
826
|
+
return;
|
|
827
|
+
}
|
|
828
|
+
failQuery();
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
831
|
+
const item = {
|
|
832
|
+
status: "pending",
|
|
833
|
+
resource,
|
|
834
|
+
callback: (status$1, data) => {
|
|
835
|
+
moduleResponse(item, status$1, data);
|
|
836
|
+
}
|
|
837
|
+
};
|
|
838
|
+
queue.push(item);
|
|
839
|
+
queriesSent++;
|
|
840
|
+
timer = setTimeout(execNext, config.rotate);
|
|
841
|
+
query(resource, payload, item.callback);
|
|
842
|
+
}
|
|
843
|
+
setTimeout(execNext);
|
|
844
|
+
return getQueryStatus;
|
|
880
845
|
}
|
|
881
846
|
|
|
882
|
-
|
|
847
|
+
/**
|
|
848
|
+
* Redundancy instance
|
|
849
|
+
*/
|
|
850
|
+
function initRedundancy(cfg) {
|
|
851
|
+
const config = {
|
|
852
|
+
...defaultConfig,
|
|
853
|
+
...cfg
|
|
854
|
+
};
|
|
855
|
+
let queries = [];
|
|
856
|
+
/**
|
|
857
|
+
* Remove aborted and completed queries
|
|
858
|
+
*/
|
|
859
|
+
function cleanup() {
|
|
860
|
+
queries = queries.filter((item) => item().status === "pending");
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* Send query
|
|
864
|
+
*/
|
|
865
|
+
function query(payload, queryCallback, doneCallback) {
|
|
866
|
+
const query$1 = sendQuery(config, payload, queryCallback, (data, error) => {
|
|
867
|
+
cleanup();
|
|
868
|
+
if (doneCallback) doneCallback(data, error);
|
|
869
|
+
});
|
|
870
|
+
queries.push(query$1);
|
|
871
|
+
return query$1;
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* Find instance
|
|
875
|
+
*/
|
|
876
|
+
function find(callback) {
|
|
877
|
+
return queries.find((value) => {
|
|
878
|
+
return callback(value);
|
|
879
|
+
}) || null;
|
|
880
|
+
}
|
|
881
|
+
return {
|
|
882
|
+
query,
|
|
883
|
+
find,
|
|
884
|
+
setIndex: (index) => {
|
|
885
|
+
config.index = index;
|
|
886
|
+
},
|
|
887
|
+
getIndex: () => config.index,
|
|
888
|
+
cleanup
|
|
889
|
+
};
|
|
883
890
|
}
|
|
884
|
-
|
|
891
|
+
|
|
892
|
+
function emptyCallback$1() {}
|
|
893
|
+
const redundancyCache = Object.create(null);
|
|
894
|
+
/**
|
|
895
|
+
* Get Redundancy instance for provider
|
|
896
|
+
*/
|
|
885
897
|
function getRedundancyCache(provider) {
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
};
|
|
896
|
-
redundancyCache[provider] = cachedReundancy;
|
|
897
|
-
}
|
|
898
|
-
return redundancyCache[provider];
|
|
898
|
+
if (!redundancyCache[provider]) {
|
|
899
|
+
const config = getAPIConfig(provider);
|
|
900
|
+
if (!config) return;
|
|
901
|
+
redundancyCache[provider] = {
|
|
902
|
+
config,
|
|
903
|
+
redundancy: initRedundancy(config)
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
return redundancyCache[provider];
|
|
899
907
|
}
|
|
908
|
+
/**
|
|
909
|
+
* Send API query
|
|
910
|
+
*/
|
|
900
911
|
function sendAPIQuery(target, query, callback) {
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
if (!redundancy || !send) {
|
|
926
|
-
callback(void 0, 424);
|
|
927
|
-
return emptyCallback$1;
|
|
928
|
-
}
|
|
929
|
-
return redundancy.query(query, send, callback)().abort;
|
|
912
|
+
let redundancy;
|
|
913
|
+
let send;
|
|
914
|
+
if (typeof target === "string") {
|
|
915
|
+
const api = getAPIModule(target);
|
|
916
|
+
if (!api) {
|
|
917
|
+
callback(void 0, 424);
|
|
918
|
+
return emptyCallback$1;
|
|
919
|
+
}
|
|
920
|
+
send = api.send;
|
|
921
|
+
const cached = getRedundancyCache(target);
|
|
922
|
+
if (cached) redundancy = cached.redundancy;
|
|
923
|
+
} else {
|
|
924
|
+
const config = createAPIConfig(target);
|
|
925
|
+
if (config) {
|
|
926
|
+
redundancy = initRedundancy(config);
|
|
927
|
+
const api = getAPIModule(target.resources ? target.resources[0] : "");
|
|
928
|
+
if (api) send = api.send;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
if (!redundancy || !send) {
|
|
932
|
+
callback(void 0, 424);
|
|
933
|
+
return emptyCallback$1;
|
|
934
|
+
}
|
|
935
|
+
return redundancy.query(query, send, callback)().abort;
|
|
930
936
|
}
|
|
931
937
|
|
|
932
|
-
function emptyCallback() {
|
|
933
|
-
|
|
938
|
+
function emptyCallback() {}
|
|
939
|
+
/**
|
|
940
|
+
* Function called when new icons have been loaded
|
|
941
|
+
*/
|
|
934
942
|
function loadedNewIcons(storage) {
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
943
|
+
if (!storage.iconsLoaderFlag) {
|
|
944
|
+
storage.iconsLoaderFlag = true;
|
|
945
|
+
setTimeout(() => {
|
|
946
|
+
storage.iconsLoaderFlag = false;
|
|
947
|
+
updateCallbacks(storage);
|
|
948
|
+
});
|
|
949
|
+
}
|
|
942
950
|
}
|
|
951
|
+
/**
|
|
952
|
+
* Check icon names for API
|
|
953
|
+
*/
|
|
943
954
|
function checkIconNamesForAPI(icons) {
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
955
|
+
const valid = [];
|
|
956
|
+
const invalid = [];
|
|
957
|
+
icons.forEach((name) => {
|
|
958
|
+
(name.match(matchIconName) ? valid : invalid).push(name);
|
|
959
|
+
});
|
|
960
|
+
return {
|
|
961
|
+
valid,
|
|
962
|
+
invalid
|
|
963
|
+
};
|
|
953
964
|
}
|
|
965
|
+
/**
|
|
966
|
+
* Parse loader response
|
|
967
|
+
*/
|
|
954
968
|
function parseLoaderResponse(storage, icons, data) {
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
}
|
|
973
|
-
} catch (err) {
|
|
974
|
-
console.error(err);
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
checkMissing();
|
|
978
|
-
loadedNewIcons(storage);
|
|
969
|
+
function checkMissing() {
|
|
970
|
+
const pending = storage.pendingIcons;
|
|
971
|
+
icons.forEach((name) => {
|
|
972
|
+
if (pending) pending.delete(name);
|
|
973
|
+
if (!storage.icons[name]) storage.missing.add(name);
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
if (data && typeof data === "object") try {
|
|
977
|
+
if (!addIconSet(storage, data).length) {
|
|
978
|
+
checkMissing();
|
|
979
|
+
return;
|
|
980
|
+
}
|
|
981
|
+
} catch (err) {
|
|
982
|
+
console.error(err);
|
|
983
|
+
}
|
|
984
|
+
checkMissing();
|
|
985
|
+
loadedNewIcons(storage);
|
|
979
986
|
}
|
|
987
|
+
/**
|
|
988
|
+
* Handle response that can be async
|
|
989
|
+
*/
|
|
980
990
|
function parsePossiblyAsyncResponse(response, callback) {
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
} else {
|
|
988
|
-
callback(response);
|
|
989
|
-
}
|
|
991
|
+
if (response instanceof Promise) response.then((data) => {
|
|
992
|
+
callback(data);
|
|
993
|
+
}).catch(() => {
|
|
994
|
+
callback(null);
|
|
995
|
+
});
|
|
996
|
+
else callback(response);
|
|
990
997
|
}
|
|
998
|
+
/**
|
|
999
|
+
* Load icons
|
|
1000
|
+
*/
|
|
991
1001
|
function loadNewIcons(storage, icons) {
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
}
|
|
1036
|
-
if (!valid.length) {
|
|
1037
|
-
return;
|
|
1038
|
-
}
|
|
1039
|
-
const api = prefix.match(matchIconName) ? getAPIModule(provider) : null;
|
|
1040
|
-
if (!api) {
|
|
1041
|
-
parseLoaderResponse(storage, valid, null);
|
|
1042
|
-
return;
|
|
1043
|
-
}
|
|
1044
|
-
const params = api.prepare(provider, prefix, valid);
|
|
1045
|
-
params.forEach((item) => {
|
|
1046
|
-
sendAPIQuery(provider, item, (data) => {
|
|
1047
|
-
parseLoaderResponse(storage, item.icons, data);
|
|
1048
|
-
});
|
|
1049
|
-
});
|
|
1050
|
-
});
|
|
1051
|
-
}
|
|
1002
|
+
if (!storage.iconsToLoad) storage.iconsToLoad = icons;
|
|
1003
|
+
else storage.iconsToLoad = storage.iconsToLoad.concat(icons).sort();
|
|
1004
|
+
if (!storage.iconsQueueFlag) {
|
|
1005
|
+
storage.iconsQueueFlag = true;
|
|
1006
|
+
setTimeout(() => {
|
|
1007
|
+
storage.iconsQueueFlag = false;
|
|
1008
|
+
const { provider, prefix } = storage;
|
|
1009
|
+
const icons$1 = storage.iconsToLoad;
|
|
1010
|
+
delete storage.iconsToLoad;
|
|
1011
|
+
if (!icons$1 || !icons$1.length) return;
|
|
1012
|
+
const customIconLoader = storage.loadIcon;
|
|
1013
|
+
if (storage.loadIcons && (icons$1.length > 1 || !customIconLoader)) {
|
|
1014
|
+
parsePossiblyAsyncResponse(storage.loadIcons(icons$1, prefix, provider), (data) => {
|
|
1015
|
+
parseLoaderResponse(storage, icons$1, data);
|
|
1016
|
+
});
|
|
1017
|
+
return;
|
|
1018
|
+
}
|
|
1019
|
+
if (customIconLoader) {
|
|
1020
|
+
icons$1.forEach((name) => {
|
|
1021
|
+
parsePossiblyAsyncResponse(customIconLoader(name, prefix, provider), (data) => {
|
|
1022
|
+
parseLoaderResponse(storage, [name], data ? {
|
|
1023
|
+
prefix,
|
|
1024
|
+
icons: { [name]: data }
|
|
1025
|
+
} : null);
|
|
1026
|
+
});
|
|
1027
|
+
});
|
|
1028
|
+
return;
|
|
1029
|
+
}
|
|
1030
|
+
const { valid, invalid } = checkIconNamesForAPI(icons$1);
|
|
1031
|
+
if (invalid.length) parseLoaderResponse(storage, invalid, null);
|
|
1032
|
+
if (!valid.length) return;
|
|
1033
|
+
const api = prefix.match(matchIconName) ? getAPIModule(provider) : null;
|
|
1034
|
+
if (!api) {
|
|
1035
|
+
parseLoaderResponse(storage, valid, null);
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
1038
|
+
api.prepare(provider, prefix, valid).forEach((item) => {
|
|
1039
|
+
sendAPIQuery(provider, item, (data) => {
|
|
1040
|
+
parseLoaderResponse(storage, item.icons, data);
|
|
1041
|
+
});
|
|
1042
|
+
});
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1052
1045
|
}
|
|
1046
|
+
/**
|
|
1047
|
+
* Load icons
|
|
1048
|
+
*/
|
|
1053
1049
|
const loadIcons$1 = (icons, callback) => {
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
sortedIcons.pending.forEach((icon) => {
|
|
1091
|
-
const { provider, prefix, name } = icon;
|
|
1092
|
-
const storage = getStorage(provider, prefix);
|
|
1093
|
-
const pendingQueue = storage.pendingIcons || (storage.pendingIcons = /* @__PURE__ */ new Set());
|
|
1094
|
-
if (!pendingQueue.has(name)) {
|
|
1095
|
-
pendingQueue.add(name);
|
|
1096
|
-
newIcons[provider][prefix].push(name);
|
|
1097
|
-
}
|
|
1098
|
-
});
|
|
1099
|
-
sources.forEach((storage) => {
|
|
1100
|
-
const list = newIcons[storage.provider][storage.prefix];
|
|
1101
|
-
if (list.length) {
|
|
1102
|
-
loadNewIcons(storage, list);
|
|
1103
|
-
}
|
|
1104
|
-
});
|
|
1105
|
-
return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback;
|
|
1050
|
+
const sortedIcons = sortIcons(listToIcons(icons, true, allowSimpleNames()));
|
|
1051
|
+
if (!sortedIcons.pending.length) {
|
|
1052
|
+
let callCallback = true;
|
|
1053
|
+
if (callback) setTimeout(() => {
|
|
1054
|
+
if (callCallback) callback(sortedIcons.loaded, sortedIcons.missing, sortedIcons.pending, emptyCallback);
|
|
1055
|
+
});
|
|
1056
|
+
return () => {
|
|
1057
|
+
callCallback = false;
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1060
|
+
const newIcons = Object.create(null);
|
|
1061
|
+
const sources = [];
|
|
1062
|
+
let lastProvider, lastPrefix;
|
|
1063
|
+
sortedIcons.pending.forEach((icon) => {
|
|
1064
|
+
const { provider, prefix } = icon;
|
|
1065
|
+
if (prefix === lastPrefix && provider === lastProvider) return;
|
|
1066
|
+
lastProvider = provider;
|
|
1067
|
+
lastPrefix = prefix;
|
|
1068
|
+
sources.push(getStorage(provider, prefix));
|
|
1069
|
+
const providerNewIcons = newIcons[provider] || (newIcons[provider] = Object.create(null));
|
|
1070
|
+
if (!providerNewIcons[prefix]) providerNewIcons[prefix] = [];
|
|
1071
|
+
});
|
|
1072
|
+
sortedIcons.pending.forEach((icon) => {
|
|
1073
|
+
const { provider, prefix, name } = icon;
|
|
1074
|
+
const storage = getStorage(provider, prefix);
|
|
1075
|
+
const pendingQueue = storage.pendingIcons || (storage.pendingIcons = /* @__PURE__ */ new Set());
|
|
1076
|
+
if (!pendingQueue.has(name)) {
|
|
1077
|
+
pendingQueue.add(name);
|
|
1078
|
+
newIcons[provider][prefix].push(name);
|
|
1079
|
+
}
|
|
1080
|
+
});
|
|
1081
|
+
sources.forEach((storage) => {
|
|
1082
|
+
const list = newIcons[storage.provider][storage.prefix];
|
|
1083
|
+
if (list.length) loadNewIcons(storage, list);
|
|
1084
|
+
});
|
|
1085
|
+
return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback;
|
|
1106
1086
|
};
|
|
1087
|
+
/**
|
|
1088
|
+
* Load one icon using Promise
|
|
1089
|
+
*/
|
|
1107
1090
|
const loadIcon$1 = (icon) => {
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1091
|
+
return new Promise((fulfill, reject) => {
|
|
1092
|
+
const iconObj = typeof icon === "string" ? stringToIcon(icon, true) : icon;
|
|
1093
|
+
if (!iconObj) {
|
|
1094
|
+
reject(icon);
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1097
|
+
loadIcons$1([iconObj || icon], (loaded) => {
|
|
1098
|
+
if (loaded.length && iconObj) {
|
|
1099
|
+
const data = getIconData(iconObj);
|
|
1100
|
+
if (data) {
|
|
1101
|
+
fulfill({
|
|
1102
|
+
...defaultIconProps,
|
|
1103
|
+
...data
|
|
1104
|
+
});
|
|
1105
|
+
return;
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
reject(icon);
|
|
1109
|
+
});
|
|
1110
|
+
});
|
|
1128
1111
|
};
|
|
1129
1112
|
|
|
1130
1113
|
/**
|
|
@@ -1229,346 +1212,364 @@ function getRenderMode(body, mode) {
|
|
|
1229
1212
|
return body.indexOf('currentColor') === -1 ? 'bg' : 'mask';
|
|
1230
1213
|
}
|
|
1231
1214
|
|
|
1215
|
+
/**
|
|
1216
|
+
* Regular expressions for calculating dimensions
|
|
1217
|
+
*/
|
|
1232
1218
|
const unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
|
|
1233
1219
|
const unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
|
|
1234
1220
|
function calculateSize$1(size, ratio, precision) {
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
const num = parseFloat(code);
|
|
1255
|
-
if (isNaN(num)) {
|
|
1256
|
-
newParts.push(code);
|
|
1257
|
-
} else {
|
|
1258
|
-
newParts.push(Math.ceil(num * ratio * precision) / precision);
|
|
1259
|
-
}
|
|
1260
|
-
} else {
|
|
1261
|
-
newParts.push(code);
|
|
1262
|
-
}
|
|
1263
|
-
code = oldParts.shift();
|
|
1264
|
-
if (code === void 0) {
|
|
1265
|
-
return newParts.join("");
|
|
1266
|
-
}
|
|
1267
|
-
isNumber = !isNumber;
|
|
1268
|
-
}
|
|
1221
|
+
if (ratio === 1) return size;
|
|
1222
|
+
precision = precision || 100;
|
|
1223
|
+
if (typeof size === "number") return Math.ceil(size * ratio * precision) / precision;
|
|
1224
|
+
if (typeof size !== "string") return size;
|
|
1225
|
+
const oldParts = size.split(unitsSplit);
|
|
1226
|
+
if (oldParts === null || !oldParts.length) return size;
|
|
1227
|
+
const newParts = [];
|
|
1228
|
+
let code = oldParts.shift();
|
|
1229
|
+
let isNumber = unitsTest.test(code);
|
|
1230
|
+
while (true) {
|
|
1231
|
+
if (isNumber) {
|
|
1232
|
+
const num = parseFloat(code);
|
|
1233
|
+
if (isNaN(num)) newParts.push(code);
|
|
1234
|
+
else newParts.push(Math.ceil(num * ratio * precision) / precision);
|
|
1235
|
+
} else newParts.push(code);
|
|
1236
|
+
code = oldParts.shift();
|
|
1237
|
+
if (code === void 0) return newParts.join("");
|
|
1238
|
+
isNumber = !isNumber;
|
|
1239
|
+
}
|
|
1269
1240
|
}
|
|
1270
1241
|
|
|
1271
1242
|
function splitSVGDefs(content, tag = "defs") {
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
return {
|
|
1288
|
-
defs,
|
|
1289
|
-
content
|
|
1290
|
-
};
|
|
1243
|
+
let defs = "";
|
|
1244
|
+
const index = content.indexOf("<" + tag);
|
|
1245
|
+
while (index >= 0) {
|
|
1246
|
+
const start = content.indexOf(">", index);
|
|
1247
|
+
const end = content.indexOf("</" + tag);
|
|
1248
|
+
if (start === -1 || end === -1) break;
|
|
1249
|
+
const endEnd = content.indexOf(">", end);
|
|
1250
|
+
if (endEnd === -1) break;
|
|
1251
|
+
defs += content.slice(start + 1, end).trim();
|
|
1252
|
+
content = content.slice(0, index).trim() + content.slice(endEnd + 1);
|
|
1253
|
+
}
|
|
1254
|
+
return {
|
|
1255
|
+
defs,
|
|
1256
|
+
content
|
|
1257
|
+
};
|
|
1291
1258
|
}
|
|
1259
|
+
/**
|
|
1260
|
+
* Merge defs and content
|
|
1261
|
+
*/
|
|
1292
1262
|
function mergeDefsAndContent(defs, content) {
|
|
1293
|
-
|
|
1263
|
+
return defs ? "<defs>" + defs + "</defs>" + content : content;
|
|
1294
1264
|
}
|
|
1265
|
+
/**
|
|
1266
|
+
* Wrap SVG content, without wrapping definitions
|
|
1267
|
+
*/
|
|
1295
1268
|
function wrapSVGContent(body, start, end) {
|
|
1296
|
-
|
|
1297
|
-
|
|
1269
|
+
const split = splitSVGDefs(body);
|
|
1270
|
+
return mergeDefsAndContent(split.defs, start + split.content + end);
|
|
1298
1271
|
}
|
|
1299
1272
|
|
|
1273
|
+
/**
|
|
1274
|
+
* Check if value should be unset. Allows multiple keywords
|
|
1275
|
+
*/
|
|
1300
1276
|
const isUnsetKeyword = (value) => value === "unset" || value === "undefined" || value === "none";
|
|
1277
|
+
/**
|
|
1278
|
+
* Get SVG attributes and content from icon + customisations
|
|
1279
|
+
*
|
|
1280
|
+
* Does not generate style to make it compatible with frameworks that use objects for style, such as React.
|
|
1281
|
+
* Instead, it generates 'inline' value. If true, rendering engine should add verticalAlign: -0.125em to icon.
|
|
1282
|
+
*
|
|
1283
|
+
* Customisations should be normalised by platform specific parser.
|
|
1284
|
+
* Result should be converted to <svg> by platform specific parser.
|
|
1285
|
+
* Use replaceIDs to generate unique IDs for body.
|
|
1286
|
+
*/
|
|
1301
1287
|
function iconToSVG(icon, customisations) {
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
height = customisationsHeight === null ? calculateSize$1(width, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
|
|
1395
|
-
}
|
|
1396
|
-
const attributes = {};
|
|
1397
|
-
const setAttr = (prop, value) => {
|
|
1398
|
-
if (!isUnsetKeyword(value)) {
|
|
1399
|
-
attributes[prop] = value.toString();
|
|
1400
|
-
}
|
|
1401
|
-
};
|
|
1402
|
-
setAttr("width", width);
|
|
1403
|
-
setAttr("height", height);
|
|
1404
|
-
const viewBox = [box.left, box.top, boxWidth, boxHeight];
|
|
1405
|
-
attributes.viewBox = viewBox.join(" ");
|
|
1406
|
-
return {
|
|
1407
|
-
attributes,
|
|
1408
|
-
viewBox,
|
|
1409
|
-
body
|
|
1410
|
-
};
|
|
1288
|
+
const fullIcon = {
|
|
1289
|
+
...defaultIconProps,
|
|
1290
|
+
...icon
|
|
1291
|
+
};
|
|
1292
|
+
const fullCustomisations = {
|
|
1293
|
+
...defaultIconCustomisations,
|
|
1294
|
+
...customisations
|
|
1295
|
+
};
|
|
1296
|
+
const box = {
|
|
1297
|
+
left: fullIcon.left,
|
|
1298
|
+
top: fullIcon.top,
|
|
1299
|
+
width: fullIcon.width,
|
|
1300
|
+
height: fullIcon.height
|
|
1301
|
+
};
|
|
1302
|
+
let body = fullIcon.body;
|
|
1303
|
+
[fullIcon, fullCustomisations].forEach((props) => {
|
|
1304
|
+
const transformations = [];
|
|
1305
|
+
const hFlip = props.hFlip;
|
|
1306
|
+
const vFlip = props.vFlip;
|
|
1307
|
+
let rotation = props.rotate;
|
|
1308
|
+
if (hFlip) if (vFlip) rotation += 2;
|
|
1309
|
+
else {
|
|
1310
|
+
transformations.push("translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")");
|
|
1311
|
+
transformations.push("scale(-1 1)");
|
|
1312
|
+
box.top = box.left = 0;
|
|
1313
|
+
}
|
|
1314
|
+
else if (vFlip) {
|
|
1315
|
+
transformations.push("translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")");
|
|
1316
|
+
transformations.push("scale(1 -1)");
|
|
1317
|
+
box.top = box.left = 0;
|
|
1318
|
+
}
|
|
1319
|
+
let tempValue;
|
|
1320
|
+
if (rotation < 0) rotation -= Math.floor(rotation / 4) * 4;
|
|
1321
|
+
rotation = rotation % 4;
|
|
1322
|
+
switch (rotation) {
|
|
1323
|
+
case 1:
|
|
1324
|
+
tempValue = box.height / 2 + box.top;
|
|
1325
|
+
transformations.unshift("rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")");
|
|
1326
|
+
break;
|
|
1327
|
+
case 2:
|
|
1328
|
+
transformations.unshift("rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")");
|
|
1329
|
+
break;
|
|
1330
|
+
case 3:
|
|
1331
|
+
tempValue = box.width / 2 + box.left;
|
|
1332
|
+
transformations.unshift("rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")");
|
|
1333
|
+
break;
|
|
1334
|
+
}
|
|
1335
|
+
if (rotation % 2 === 1) {
|
|
1336
|
+
if (box.left !== box.top) {
|
|
1337
|
+
tempValue = box.left;
|
|
1338
|
+
box.left = box.top;
|
|
1339
|
+
box.top = tempValue;
|
|
1340
|
+
}
|
|
1341
|
+
if (box.width !== box.height) {
|
|
1342
|
+
tempValue = box.width;
|
|
1343
|
+
box.width = box.height;
|
|
1344
|
+
box.height = tempValue;
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
if (transformations.length) body = wrapSVGContent(body, "<g transform=\"" + transformations.join(" ") + "\">", "</g>");
|
|
1348
|
+
});
|
|
1349
|
+
const customisationsWidth = fullCustomisations.width;
|
|
1350
|
+
const customisationsHeight = fullCustomisations.height;
|
|
1351
|
+
const boxWidth = box.width;
|
|
1352
|
+
const boxHeight = box.height;
|
|
1353
|
+
let width;
|
|
1354
|
+
let height;
|
|
1355
|
+
if (customisationsWidth === null) {
|
|
1356
|
+
height = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
|
|
1357
|
+
width = calculateSize$1(height, boxWidth / boxHeight);
|
|
1358
|
+
} else {
|
|
1359
|
+
width = customisationsWidth === "auto" ? boxWidth : customisationsWidth;
|
|
1360
|
+
height = customisationsHeight === null ? calculateSize$1(width, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
|
|
1361
|
+
}
|
|
1362
|
+
const attributes = {};
|
|
1363
|
+
const setAttr = (prop, value) => {
|
|
1364
|
+
if (!isUnsetKeyword(value)) attributes[prop] = value.toString();
|
|
1365
|
+
};
|
|
1366
|
+
setAttr("width", width);
|
|
1367
|
+
setAttr("height", height);
|
|
1368
|
+
const viewBox = [
|
|
1369
|
+
box.left,
|
|
1370
|
+
box.top,
|
|
1371
|
+
boxWidth,
|
|
1372
|
+
boxHeight
|
|
1373
|
+
];
|
|
1374
|
+
attributes.viewBox = viewBox.join(" ");
|
|
1375
|
+
return {
|
|
1376
|
+
attributes,
|
|
1377
|
+
viewBox,
|
|
1378
|
+
body
|
|
1379
|
+
};
|
|
1411
1380
|
}
|
|
1412
1381
|
|
|
1382
|
+
/**
|
|
1383
|
+
* Generate <svg>
|
|
1384
|
+
*/
|
|
1413
1385
|
function iconToHTML$1(body, attributes) {
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
}
|
|
1418
|
-
return '<svg xmlns="http://www.w3.org/2000/svg"' + renderAttribsHTML + ">" + body + "</svg>";
|
|
1386
|
+
let renderAttribsHTML = body.indexOf("xlink:") === -1 ? "" : " xmlns:xlink=\"http://www.w3.org/1999/xlink\"";
|
|
1387
|
+
for (const attr in attributes) renderAttribsHTML += " " + attr + "=\"" + attributes[attr] + "\"";
|
|
1388
|
+
return "<svg xmlns=\"http://www.w3.org/2000/svg\"" + renderAttribsHTML + ">" + body + "</svg>";
|
|
1419
1389
|
}
|
|
1420
1390
|
|
|
1391
|
+
/**
|
|
1392
|
+
* Encode SVG for use in url()
|
|
1393
|
+
*
|
|
1394
|
+
* Short alternative to encodeURIComponent() that encodes only stuff used in SVG, generating
|
|
1395
|
+
* smaller code.
|
|
1396
|
+
*/
|
|
1421
1397
|
function encodeSVGforURL(svg) {
|
|
1422
|
-
|
|
1398
|
+
return svg.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
|
|
1423
1399
|
}
|
|
1400
|
+
/**
|
|
1401
|
+
* Generate data: URL from SVG
|
|
1402
|
+
*/
|
|
1424
1403
|
function svgToData(svg) {
|
|
1425
|
-
|
|
1404
|
+
return "data:image/svg+xml," + encodeSVGforURL(svg);
|
|
1426
1405
|
}
|
|
1406
|
+
/**
|
|
1407
|
+
* Generate url() from SVG
|
|
1408
|
+
*/
|
|
1427
1409
|
function svgToURL$1(svg) {
|
|
1428
|
-
|
|
1410
|
+
return "url(\"" + svgToData(svg) + "\")";
|
|
1429
1411
|
}
|
|
1430
1412
|
|
|
1431
1413
|
const detectFetch = () => {
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
}
|
|
1438
|
-
} catch (err) {
|
|
1439
|
-
}
|
|
1414
|
+
let callback;
|
|
1415
|
+
try {
|
|
1416
|
+
callback = fetch;
|
|
1417
|
+
if (typeof callback === "function") return callback;
|
|
1418
|
+
} catch (err) {}
|
|
1440
1419
|
};
|
|
1420
|
+
/**
|
|
1421
|
+
* Fetch function
|
|
1422
|
+
*/
|
|
1441
1423
|
let fetchModule = detectFetch();
|
|
1442
|
-
|
|
1443
|
-
|
|
1424
|
+
/**
|
|
1425
|
+
* Set custom fetch() function
|
|
1426
|
+
*/
|
|
1427
|
+
function setFetch(fetch$1) {
|
|
1428
|
+
fetchModule = fetch$1;
|
|
1444
1429
|
}
|
|
1430
|
+
/**
|
|
1431
|
+
* Get fetch() function. Used by Icon Finder Core
|
|
1432
|
+
*/
|
|
1445
1433
|
function getFetch() {
|
|
1446
|
-
|
|
1434
|
+
return fetchModule;
|
|
1447
1435
|
}
|
|
1436
|
+
/**
|
|
1437
|
+
* Calculate maximum icons list length for prefix
|
|
1438
|
+
*/
|
|
1448
1439
|
function calculateMaxLength(provider, prefix) {
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
result = config.maxURL - maxHostLength - config.path.length - url.length;
|
|
1464
|
-
}
|
|
1465
|
-
return result;
|
|
1440
|
+
const config = getAPIConfig(provider);
|
|
1441
|
+
if (!config) return 0;
|
|
1442
|
+
let result;
|
|
1443
|
+
if (!config.maxURL) result = 0;
|
|
1444
|
+
else {
|
|
1445
|
+
let maxHostLength = 0;
|
|
1446
|
+
config.resources.forEach((item) => {
|
|
1447
|
+
const host = item;
|
|
1448
|
+
maxHostLength = Math.max(maxHostLength, host.length);
|
|
1449
|
+
});
|
|
1450
|
+
const url = prefix + ".json?icons=";
|
|
1451
|
+
result = config.maxURL - maxHostLength - config.path.length - url.length;
|
|
1452
|
+
}
|
|
1453
|
+
return result;
|
|
1466
1454
|
}
|
|
1455
|
+
/**
|
|
1456
|
+
* Should query be aborted, based on last HTTP status
|
|
1457
|
+
*/
|
|
1467
1458
|
function shouldAbort(status) {
|
|
1468
|
-
|
|
1459
|
+
return status === 404;
|
|
1469
1460
|
}
|
|
1461
|
+
/**
|
|
1462
|
+
* Prepare params
|
|
1463
|
+
*/
|
|
1470
1464
|
const prepare = (provider, prefix, icons) => {
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1465
|
+
const results = [];
|
|
1466
|
+
const maxLength = calculateMaxLength(provider, prefix);
|
|
1467
|
+
const type = "icons";
|
|
1468
|
+
let item = {
|
|
1469
|
+
type,
|
|
1470
|
+
provider,
|
|
1471
|
+
prefix,
|
|
1472
|
+
icons: []
|
|
1473
|
+
};
|
|
1474
|
+
let length = 0;
|
|
1475
|
+
icons.forEach((name, index) => {
|
|
1476
|
+
length += name.length + 1;
|
|
1477
|
+
if (length >= maxLength && index > 0) {
|
|
1478
|
+
results.push(item);
|
|
1479
|
+
item = {
|
|
1480
|
+
type,
|
|
1481
|
+
provider,
|
|
1482
|
+
prefix,
|
|
1483
|
+
icons: []
|
|
1484
|
+
};
|
|
1485
|
+
length = name.length;
|
|
1486
|
+
}
|
|
1487
|
+
item.icons.push(name);
|
|
1488
|
+
});
|
|
1489
|
+
results.push(item);
|
|
1490
|
+
return results;
|
|
1497
1491
|
};
|
|
1492
|
+
/**
|
|
1493
|
+
* Get path
|
|
1494
|
+
*/
|
|
1498
1495
|
function getPath(provider) {
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
}
|
|
1505
|
-
return "/";
|
|
1496
|
+
if (typeof provider === "string") {
|
|
1497
|
+
const config = getAPIConfig(provider);
|
|
1498
|
+
if (config) return config.path;
|
|
1499
|
+
}
|
|
1500
|
+
return "/";
|
|
1506
1501
|
}
|
|
1502
|
+
/**
|
|
1503
|
+
* Load icons
|
|
1504
|
+
*/
|
|
1507
1505
|
const send = (host, params, callback) => {
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
setTimeout(() => {
|
|
1556
|
-
callback("success", data);
|
|
1557
|
-
});
|
|
1558
|
-
}).catch(() => {
|
|
1559
|
-
callback("next", defaultError);
|
|
1560
|
-
});
|
|
1506
|
+
if (!fetchModule) {
|
|
1507
|
+
callback("abort", 424);
|
|
1508
|
+
return;
|
|
1509
|
+
}
|
|
1510
|
+
let path = getPath(params.provider);
|
|
1511
|
+
switch (params.type) {
|
|
1512
|
+
case "icons": {
|
|
1513
|
+
const prefix = params.prefix;
|
|
1514
|
+
const iconsList = params.icons.join(",");
|
|
1515
|
+
const urlParams = new URLSearchParams({ icons: iconsList });
|
|
1516
|
+
path += prefix + ".json?" + urlParams.toString();
|
|
1517
|
+
break;
|
|
1518
|
+
}
|
|
1519
|
+
case "custom": {
|
|
1520
|
+
const uri = params.uri;
|
|
1521
|
+
path += uri.slice(0, 1) === "/" ? uri.slice(1) : uri;
|
|
1522
|
+
break;
|
|
1523
|
+
}
|
|
1524
|
+
default:
|
|
1525
|
+
callback("abort", 400);
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
let defaultError = 503;
|
|
1529
|
+
fetchModule(host + path).then((response) => {
|
|
1530
|
+
const status = response.status;
|
|
1531
|
+
if (status !== 200) {
|
|
1532
|
+
setTimeout(() => {
|
|
1533
|
+
callback(shouldAbort(status) ? "abort" : "next", status);
|
|
1534
|
+
});
|
|
1535
|
+
return;
|
|
1536
|
+
}
|
|
1537
|
+
defaultError = 501;
|
|
1538
|
+
return response.json();
|
|
1539
|
+
}).then((data) => {
|
|
1540
|
+
if (typeof data !== "object" || data === null) {
|
|
1541
|
+
setTimeout(() => {
|
|
1542
|
+
if (data === 404) callback("abort", data);
|
|
1543
|
+
else callback("next", defaultError);
|
|
1544
|
+
});
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
setTimeout(() => {
|
|
1548
|
+
callback("success", data);
|
|
1549
|
+
});
|
|
1550
|
+
}).catch(() => {
|
|
1551
|
+
callback("next", defaultError);
|
|
1552
|
+
});
|
|
1561
1553
|
};
|
|
1554
|
+
/**
|
|
1555
|
+
* Export module
|
|
1556
|
+
*/
|
|
1562
1557
|
const fetchAPIModule = {
|
|
1563
|
-
|
|
1564
|
-
|
|
1558
|
+
prepare,
|
|
1559
|
+
send
|
|
1565
1560
|
};
|
|
1566
1561
|
|
|
1562
|
+
/**
|
|
1563
|
+
* Set custom loader for multiple icons
|
|
1564
|
+
*/
|
|
1567
1565
|
function setCustomIconsLoader$1(loader, prefix, provider) {
|
|
1568
|
-
|
|
1566
|
+
getStorage(provider || "", prefix).loadIcons = loader;
|
|
1569
1567
|
}
|
|
1568
|
+
/**
|
|
1569
|
+
* Set custom loader for one icon
|
|
1570
|
+
*/
|
|
1570
1571
|
function setCustomIconLoader$1(loader, prefix, provider) {
|
|
1571
|
-
|
|
1572
|
+
getStorage(provider || "", prefix).loadIcon = loader;
|
|
1572
1573
|
}
|
|
1573
1574
|
|
|
1574
1575
|
/**
|
|
@@ -1689,16 +1690,7 @@ function exportFunctions() {
|
|
|
1689
1690
|
listAPIProviders,
|
|
1690
1691
|
};
|
|
1691
1692
|
return {
|
|
1692
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1693
|
-
enableCache: (storage) => {
|
|
1694
|
-
// No longer used
|
|
1695
|
-
},
|
|
1696
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1697
|
-
disableCache: (storage) => {
|
|
1698
|
-
// No longer used
|
|
1699
|
-
},
|
|
1700
1693
|
iconLoaded: iconLoaded$1,
|
|
1701
|
-
iconExists: iconLoaded$1, // deprecated, kept to avoid breaking changes
|
|
1702
1694
|
getIcon: getIcon$1,
|
|
1703
1695
|
listIcons: listIcons$1,
|
|
1704
1696
|
addIcon: addIcon$1,
|
|
@@ -1782,21 +1774,25 @@ function renderSPAN(data, icon, useMask) {
|
|
|
1782
1774
|
}
|
|
1783
1775
|
|
|
1784
1776
|
let policy;
|
|
1777
|
+
/**
|
|
1778
|
+
* Attempt to create policy
|
|
1779
|
+
*/
|
|
1785
1780
|
function createPolicy() {
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
} catch (err) {
|
|
1792
|
-
policy = null;
|
|
1793
|
-
}
|
|
1781
|
+
try {
|
|
1782
|
+
policy = window.trustedTypes.createPolicy("iconify", { createHTML: (s) => s });
|
|
1783
|
+
} catch (err) {
|
|
1784
|
+
policy = null;
|
|
1785
|
+
}
|
|
1794
1786
|
}
|
|
1787
|
+
/**
|
|
1788
|
+
* Clean up value for innerHTML assignment
|
|
1789
|
+
*
|
|
1790
|
+
* This code doesn't actually clean up anything.
|
|
1791
|
+
* It is intended be used with Iconify icon data, which has already been validated
|
|
1792
|
+
*/
|
|
1795
1793
|
function cleanUpInnerHTML(html) {
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
}
|
|
1799
|
-
return policy ? policy.createHTML(html) : html;
|
|
1794
|
+
if (policy === void 0) createPolicy();
|
|
1795
|
+
return policy ? policy.createHTML(html) : html;
|
|
1800
1796
|
}
|
|
1801
1797
|
|
|
1802
1798
|
/**
|
|
@@ -2309,8 +2305,7 @@ const IconifyIconComponent = defineIconifyIcon() || exportFunctions();
|
|
|
2309
2305
|
/**
|
|
2310
2306
|
* Export functions
|
|
2311
2307
|
*/
|
|
2312
|
-
const {
|
|
2313
|
-
getIcon, listIcons, addIcon, addCollection, calculateSize, buildIcon, iconToHTML, svgToURL, loadIcons, loadIcon, setCustomIconLoader, setCustomIconsLoader, addAPIProvider, _api, } = IconifyIconComponent;
|
|
2308
|
+
const { iconLoaded, getIcon, listIcons, addIcon, addCollection, calculateSize, buildIcon, iconToHTML, svgToURL, loadIcons, loadIcon, setCustomIconLoader, setCustomIconsLoader, addAPIProvider, _api, } = IconifyIconComponent;
|
|
2314
2309
|
|
|
2315
2310
|
// src/iconify.ts
|
|
2316
2311
|
var Icon$1 = React__default.forwardRef(
|
|
@@ -8231,7 +8226,7 @@ function requireReactDom_production () {
|
|
|
8231
8226
|
reactDom_production.useFormStatus = function () {
|
|
8232
8227
|
return ReactSharedInternals.H.useHostTransitionStatus();
|
|
8233
8228
|
};
|
|
8234
|
-
reactDom_production.version = "19.2.
|
|
8229
|
+
reactDom_production.version = "19.2.3";
|
|
8235
8230
|
return reactDom_production;
|
|
8236
8231
|
}
|
|
8237
8232
|
|
|
@@ -8659,7 +8654,7 @@ function requireReactDom_development () {
|
|
|
8659
8654
|
reactDom_development.useFormStatus = function () {
|
|
8660
8655
|
return resolveDispatcher().useHostTransitionStatus();
|
|
8661
8656
|
};
|
|
8662
|
-
reactDom_development.version = "19.2.
|
|
8657
|
+
reactDom_development.version = "19.2.3";
|
|
8663
8658
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
|
|
8664
8659
|
"function" ===
|
|
8665
8660
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
|
|
@@ -22585,6 +22580,7 @@ function Table({
|
|
|
22585
22580
|
pagination,
|
|
22586
22581
|
totalRows,
|
|
22587
22582
|
totalPagesProp,
|
|
22583
|
+
detailsRow,
|
|
22588
22584
|
currentPage = 0,
|
|
22589
22585
|
noEntryLabel,
|
|
22590
22586
|
allowReorder,
|
|
@@ -22655,6 +22651,7 @@ function Table({
|
|
|
22655
22651
|
const currentColumnsLeft = useMemo(() => columnsLeft?.filter((column) => !column?.hidden) || [], [columnsLeft]);
|
|
22656
22652
|
const currentColumnsCenter = useMemo(() => columnsCenter?.filter((column) => !column?.hidden) || [], [columnsCenter]);
|
|
22657
22653
|
const currentColumnsRight = useMemo(() => columnsRight?.filter((column) => !column?.hidden) || [], [columnsRight]);
|
|
22654
|
+
const [detailsOpen, setDetailsOpen] = useState(false);
|
|
22658
22655
|
useEffect(() => {
|
|
22659
22656
|
if (!triggeredFilter) {
|
|
22660
22657
|
return;
|
|
@@ -22685,96 +22682,99 @@ function Table({
|
|
|
22685
22682
|
/* @__PURE__ */ jsxs(
|
|
22686
22683
|
"div",
|
|
22687
22684
|
{
|
|
22688
|
-
"data-testid": name + "-table-header",
|
|
22689
22685
|
ref: header,
|
|
22686
|
+
"data-testid": name + "-table-header",
|
|
22690
22687
|
className: "sticky top-0 z-1 flex flex-row items-center justify-between rounded-t-krc-table bg-krc-table-header",
|
|
22691
22688
|
children: [
|
|
22692
|
-
!!currentColumnsLeft.length && /* @__PURE__ */
|
|
22693
|
-
"div",
|
|
22694
|
-
|
|
22695
|
-
"
|
|
22696
|
-
|
|
22697
|
-
|
|
22698
|
-
|
|
22699
|
-
|
|
22700
|
-
|
|
22701
|
-
|
|
22702
|
-
|
|
22703
|
-
|
|
22704
|
-
|
|
22705
|
-
|
|
22706
|
-
|
|
22707
|
-
|
|
22708
|
-
|
|
22709
|
-
|
|
22710
|
-
|
|
22711
|
-
|
|
22712
|
-
|
|
22713
|
-
|
|
22714
|
-
|
|
22715
|
-
|
|
22716
|
-
|
|
22717
|
-
|
|
22718
|
-
{
|
|
22719
|
-
|
|
22720
|
-
name: column.sorting ? {
|
|
22721
|
-
"+": sortingAscIconName || "heroicons:chevron-down-16-solid",
|
|
22722
|
-
"-": sortingDescIconName || "heroicons:chevron-up-16-solid"
|
|
22723
|
-
}[column.sorting] : sortingDescIconName || "heroicons:chevron-up-down-16-solid",
|
|
22724
|
-
path: column.sorting ? column.sorting === "+" ? sortingAscIconPath : sortingDescIconPath : void 0
|
|
22725
|
-
}
|
|
22726
|
-
) })
|
|
22727
|
-
] }),
|
|
22728
|
-
hasFilters && /* @__PURE__ */ jsx(
|
|
22729
|
-
"div",
|
|
22730
|
-
{
|
|
22731
|
-
className: "bg-krc-table-header w-full text-xs font-medium text-secondary-500 min-h-10",
|
|
22732
|
-
onClick: (e) => {
|
|
22733
|
-
e.stopPropagation();
|
|
22734
|
-
},
|
|
22735
|
-
children: column.filterable && column.filterKey && /* @__PURE__ */ jsx(Fragment, { children: column.filterComponent?.(filters, updateFilters) || filterComponents?.[column.id]?.(filters, updateFilters) || /* @__PURE__ */ jsx(
|
|
22736
|
-
Input$2,
|
|
22689
|
+
(detailsRow || !!currentColumnsLeft.length) && /* @__PURE__ */ jsxs("div", { className: "sticky left-0 flex flex-row z-1", "data-testid": name + "-table-header-left", children: [
|
|
22690
|
+
detailsRow && /* @__PURE__ */ jsx("div", { className: [headerClasses, "w-12", hasFilters ? "h-24" : "h-12"].join(" ") }),
|
|
22691
|
+
currentColumnsLeft.map((column) => /* @__PURE__ */ jsxs(
|
|
22692
|
+
"div",
|
|
22693
|
+
{
|
|
22694
|
+
"data-testid": `${name}-table-header-left-${column.id.toString()}`,
|
|
22695
|
+
style: {
|
|
22696
|
+
minWidth: column.initialWidth,
|
|
22697
|
+
maxWidth: !column.grow ? column.initialWidth : void 0
|
|
22698
|
+
},
|
|
22699
|
+
onClick: () => {
|
|
22700
|
+
return column.sortKey && onSort(
|
|
22701
|
+
Object.assign({}, column, {
|
|
22702
|
+
sorting: column.sorting ? { "+": "-", "-": void 0 }[column.sorting] : "+"
|
|
22703
|
+
})
|
|
22704
|
+
);
|
|
22705
|
+
},
|
|
22706
|
+
className: [
|
|
22707
|
+
headerClasses,
|
|
22708
|
+
hasFilters ? "h-24" : "h-12",
|
|
22709
|
+
column.sortKey ? "cursor-pointer" : "",
|
|
22710
|
+
column.grow ? "grow" : ""
|
|
22711
|
+
].join(" "),
|
|
22712
|
+
children: [
|
|
22713
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-2 w-full justify-between", children: [
|
|
22714
|
+
/* @__PURE__ */ jsx("span", { children: column.title }),
|
|
22715
|
+
column.sortKey && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
22716
|
+
Icon,
|
|
22737
22717
|
{
|
|
22738
|
-
|
|
22739
|
-
|
|
22740
|
-
|
|
22741
|
-
|
|
22718
|
+
className: "h-4 w-4",
|
|
22719
|
+
name: column.sorting ? {
|
|
22720
|
+
"+": sortingAscIconName || "heroicons:chevron-down-16-solid",
|
|
22721
|
+
"-": sortingDescIconName || "heroicons:chevron-up-16-solid"
|
|
22722
|
+
}[column.sorting] : sortingDescIconName || "heroicons:chevron-up-down-16-solid",
|
|
22723
|
+
path: column.sorting ? column.sorting === "+" ? sortingAscIconPath : sortingDescIconPath : void 0
|
|
22724
|
+
}
|
|
22725
|
+
) })
|
|
22726
|
+
] }),
|
|
22727
|
+
hasFilters && /* @__PURE__ */ jsx(
|
|
22728
|
+
"div",
|
|
22729
|
+
{
|
|
22730
|
+
className: "bg-krc-table-header w-full text-xs font-medium text-secondary-500 min-h-10",
|
|
22731
|
+
onClick: (e) => {
|
|
22732
|
+
e.stopPropagation();
|
|
22733
|
+
},
|
|
22734
|
+
children: column.filterable && column.filterKey && /* @__PURE__ */ jsx(Fragment, { children: column.filterComponent?.(filters, updateFilters) || filterComponents?.[column.id]?.(filters, updateFilters) || /* @__PURE__ */ jsx(
|
|
22735
|
+
Input$2,
|
|
22736
|
+
{
|
|
22737
|
+
defaultValue: filters[column.filterKey]?.join(", "),
|
|
22738
|
+
dataTestId: `${name}-table-header-left-filter-${column.id.toString()}`,
|
|
22739
|
+
onKeyDown: async (e) => {
|
|
22740
|
+
if (e.key === "Enter" && column.filterKey) {
|
|
22741
|
+
const key = column.filterKey;
|
|
22742
|
+
const value = e.currentTarget.value;
|
|
22743
|
+
if (e) {
|
|
22744
|
+
await updateFilters({ ...filters, [key]: [value] }, key);
|
|
22745
|
+
} else {
|
|
22746
|
+
const newFilters = { ...filters };
|
|
22747
|
+
delete newFilters[key];
|
|
22748
|
+
await updateFilters(newFilters, "");
|
|
22749
|
+
}
|
|
22750
|
+
}
|
|
22751
|
+
},
|
|
22752
|
+
onClick: (e) => {
|
|
22753
|
+
e.stopPropagation();
|
|
22754
|
+
},
|
|
22755
|
+
onIconRightClick: async (e) => {
|
|
22756
|
+
e.stopPropagation();
|
|
22742
22757
|
const key = column.filterKey;
|
|
22743
|
-
|
|
22744
|
-
if (e) {
|
|
22745
|
-
await updateFilters({ ...filters, [key]: [value] }, key);
|
|
22746
|
-
} else {
|
|
22758
|
+
if (key) {
|
|
22747
22759
|
const newFilters = { ...filters };
|
|
22748
22760
|
delete newFilters[key];
|
|
22749
22761
|
await updateFilters(newFilters, "");
|
|
22750
22762
|
}
|
|
22751
|
-
}
|
|
22752
|
-
|
|
22753
|
-
|
|
22754
|
-
|
|
22755
|
-
},
|
|
22756
|
-
onIconRightClick: async (e) => {
|
|
22757
|
-
e.stopPropagation();
|
|
22758
|
-
const key = column.filterKey;
|
|
22759
|
-
if (key) {
|
|
22760
|
-
const newFilters = { ...filters };
|
|
22761
|
-
delete newFilters[key];
|
|
22762
|
-
await updateFilters(newFilters, "");
|
|
22763
|
-
}
|
|
22763
|
+
},
|
|
22764
|
+
isClearable: true,
|
|
22765
|
+
className: "h-10",
|
|
22766
|
+
iconRightName: filters[column.filterKey] ? "heroicons:x-mark" : ""
|
|
22764
22767
|
},
|
|
22765
|
-
|
|
22766
|
-
|
|
22767
|
-
|
|
22768
|
-
|
|
22769
|
-
|
|
22770
|
-
|
|
22771
|
-
|
|
22772
|
-
|
|
22773
|
-
|
|
22774
|
-
|
|
22775
|
-
},
|
|
22776
|
-
column.id.toString()
|
|
22777
|
-
)) }),
|
|
22768
|
+
filters[column.filterKey]?.join(", ")
|
|
22769
|
+
) })
|
|
22770
|
+
},
|
|
22771
|
+
Object.keys(filters).join("-")
|
|
22772
|
+
)
|
|
22773
|
+
]
|
|
22774
|
+
},
|
|
22775
|
+
column.id.toString()
|
|
22776
|
+
))
|
|
22777
|
+
] }),
|
|
22778
22778
|
currentColumnsCenter.map((column) => /* @__PURE__ */ jsxs(
|
|
22779
22779
|
"div",
|
|
22780
22780
|
{
|
|
@@ -22886,6 +22886,7 @@ function Table({
|
|
|
22886
22886
|
index: i,
|
|
22887
22887
|
name,
|
|
22888
22888
|
entry,
|
|
22889
|
+
allowReorder,
|
|
22889
22890
|
onDragRow,
|
|
22890
22891
|
onDropRow,
|
|
22891
22892
|
currentColumnsCenter,
|
|
@@ -22898,76 +22899,93 @@ function Table({
|
|
|
22898
22899
|
rowClasses,
|
|
22899
22900
|
rowLeftWrapperClasses,
|
|
22900
22901
|
rowCenterWrapperClasses,
|
|
22901
|
-
rowRightWrapperClasses
|
|
22902
|
+
rowRightWrapperClasses,
|
|
22903
|
+
detailsRow
|
|
22902
22904
|
},
|
|
22903
22905
|
i
|
|
22904
22906
|
);
|
|
22905
22907
|
}) }) : /* @__PURE__ */ jsx(Fragment, { children: data.map((entry, i) => {
|
|
22906
|
-
return /* @__PURE__ */ jsxs(
|
|
22907
|
-
|
|
22908
|
-
|
|
22909
|
-
|
|
22910
|
-
|
|
22911
|
-
|
|
22912
|
-
|
|
22913
|
-
|
|
22914
|
-
|
|
22915
|
-
|
|
22916
|
-
|
|
22917
|
-
"div",
|
|
22918
|
-
|
|
22919
|
-
|
|
22920
|
-
|
|
22921
|
-
|
|
22908
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
22909
|
+
/* @__PURE__ */ jsxs(
|
|
22910
|
+
"div",
|
|
22911
|
+
{
|
|
22912
|
+
"data-testid": `${name}-table-row`,
|
|
22913
|
+
"data-foo": "bar",
|
|
22914
|
+
className: rowClasses,
|
|
22915
|
+
onClick: () => onRowClick(entry),
|
|
22916
|
+
onDoubleClick: () => onRowDoubleClick(entry),
|
|
22917
|
+
children: [
|
|
22918
|
+
(detailsRow || !!currentColumnsLeft.length) && /* @__PURE__ */ jsxs("div", { className: "sticky left-0 flex flex-row border-r", children: [
|
|
22919
|
+
detailsRow && /* @__PURE__ */ jsx("div", { className: ["flex items-center justify-center w-12", rowLeftWrapperClasses].join(" "), children: /* @__PURE__ */ jsx(
|
|
22920
|
+
"button",
|
|
22921
|
+
{
|
|
22922
|
+
className: "w-8 cursor-pointer",
|
|
22923
|
+
onClick: (e) => {
|
|
22924
|
+
e.stopPropagation();
|
|
22925
|
+
e.preventDefault();
|
|
22926
|
+
setDetailsOpen(!detailsOpen);
|
|
22927
|
+
},
|
|
22928
|
+
children: /* @__PURE__ */ jsx(Icon, { name: detailsOpen ? "heroicons:chevron-down" : "heroicons:chevron-right", className: "h-5 w-5" })
|
|
22929
|
+
}
|
|
22930
|
+
) }),
|
|
22931
|
+
currentColumnsLeft.map((column) => {
|
|
22932
|
+
return /* @__PURE__ */ jsx(
|
|
22933
|
+
"div",
|
|
22934
|
+
{
|
|
22935
|
+
style: {
|
|
22936
|
+
minWidth: column.initialWidth,
|
|
22937
|
+
maxWidth: !column.grow ? column.initialWidth : void 0
|
|
22938
|
+
},
|
|
22939
|
+
className: [rowLeftWrapperClasses, column.grow ? "grow" : ""].join(" "),
|
|
22940
|
+
title: entry[column.id] || "",
|
|
22941
|
+
children: cellRenderer?.[column.id]?.(entry) || /* @__PURE__ */ jsx("div", { "data-testid": `${name}-table-row-left-${column.id.toString()}`, className: "h-14 truncate p-4 text-sm", children: entry[column.id] || "-" })
|
|
22942
|
+
},
|
|
22943
|
+
column.id.toString()
|
|
22944
|
+
);
|
|
22945
|
+
})
|
|
22946
|
+
] }),
|
|
22947
|
+
currentColumnsCenter.map((column) => {
|
|
22948
|
+
return /* @__PURE__ */ jsx(
|
|
22949
|
+
"div",
|
|
22950
|
+
{
|
|
22951
|
+
style: {
|
|
22952
|
+
minWidth: column.initialWidth,
|
|
22953
|
+
maxWidth: !column.grow ? column.initialWidth : void 0
|
|
22954
|
+
},
|
|
22955
|
+
className: [rowCenterWrapperClasses, column.grow ? "grow" : ""].join(" "),
|
|
22956
|
+
title: entry[column.id] ? entry[column.id].toString() : "",
|
|
22957
|
+
children: cellRenderer?.[column.id]?.(entry) || /* @__PURE__ */ jsx("div", { "data-testid": `${name}-table-row-center-${column.id.toString()}}`, className: "h-14 truncate p-4 text-sm", children: entry[column.id] || "-" })
|
|
22922
22958
|
},
|
|
22923
|
-
|
|
22924
|
-
|
|
22925
|
-
|
|
22926
|
-
|
|
22927
|
-
|
|
22928
|
-
|
|
22929
|
-
|
|
22930
|
-
|
|
22931
|
-
|
|
22932
|
-
|
|
22933
|
-
|
|
22934
|
-
|
|
22935
|
-
|
|
22936
|
-
|
|
22959
|
+
column.id.toString()
|
|
22960
|
+
);
|
|
22961
|
+
}),
|
|
22962
|
+
!!currentColumnsRight.length && /* @__PURE__ */ jsx("div", { className: "sticky right-0 flex flex-row border-l", children: currentColumnsRight.map((column) => {
|
|
22963
|
+
return /* @__PURE__ */ jsx(
|
|
22964
|
+
"div",
|
|
22965
|
+
{
|
|
22966
|
+
style: {
|
|
22967
|
+
minWidth: column.initialWidth,
|
|
22968
|
+
maxWidth: !column.grow ? column.initialWidth : void 0
|
|
22969
|
+
},
|
|
22970
|
+
className: [rowRightWrapperClasses, column.grow ? "grow" : ""].join(" "),
|
|
22971
|
+
title: entry[column.id] || "",
|
|
22972
|
+
children: cellRenderer?.[column.id]?.(entry) || /* @__PURE__ */ jsx("div", { "data-testid": `${name}-table-row-right-${column.id.toString()}`, className: "h-14 truncate p-4 text-sm", children: entry[column.id] || "-" })
|
|
22937
22973
|
},
|
|
22938
|
-
|
|
22939
|
-
|
|
22940
|
-
|
|
22941
|
-
|
|
22942
|
-
column.id.toString()
|
|
22943
|
-
);
|
|
22944
|
-
}),
|
|
22945
|
-
!!currentColumnsRight.length && /* @__PURE__ */ jsx("div", { className: "sticky right-0 flex flex-row border-l", children: currentColumnsRight.map((column) => {
|
|
22946
|
-
return /* @__PURE__ */ jsx(
|
|
22974
|
+
column.id.toString()
|
|
22975
|
+
);
|
|
22976
|
+
}) }),
|
|
22977
|
+
/* @__PURE__ */ jsx(
|
|
22947
22978
|
"div",
|
|
22948
22979
|
{
|
|
22949
|
-
style: {
|
|
22950
|
-
|
|
22951
|
-
|
|
22952
|
-
|
|
22953
|
-
|
|
22954
|
-
|
|
22955
|
-
|
|
22956
|
-
|
|
22957
|
-
|
|
22958
|
-
);
|
|
22959
|
-
}) }),
|
|
22960
|
-
/* @__PURE__ */ jsx(
|
|
22961
|
-
"div",
|
|
22962
|
-
{
|
|
22963
|
-
style: { width: `${(header.current?.scrollWidth || 0) - 1}px` },
|
|
22964
|
-
className: "absolute bottom-0 left-0 right-0 h-px bg-krc-table-header"
|
|
22965
|
-
}
|
|
22966
|
-
)
|
|
22967
|
-
]
|
|
22968
|
-
},
|
|
22969
|
-
i
|
|
22970
|
-
);
|
|
22980
|
+
style: { width: `${(header.current?.scrollWidth || 0) - 1}px` },
|
|
22981
|
+
className: "absolute bottom-0 left-0 right-0 h-px bg-krc-table-header"
|
|
22982
|
+
}
|
|
22983
|
+
)
|
|
22984
|
+
]
|
|
22985
|
+
}
|
|
22986
|
+
),
|
|
22987
|
+
detailsRow && detailsOpen && /* @__PURE__ */ jsx("div", { className: "ml-12", children: detailsRow(entry) })
|
|
22988
|
+
] }, i);
|
|
22971
22989
|
}) }),
|
|
22972
22990
|
data.length === 0 && /* @__PURE__ */ jsx("div", { "data-testid": name + "-table-no-data", className: noDataClasses, children: noEntryLabel })
|
|
22973
22991
|
]
|
|
@@ -23019,11 +23037,14 @@ function Row({
|
|
|
23019
23037
|
rowLeftWrapperClasses,
|
|
23020
23038
|
rowCenterWrapperClasses,
|
|
23021
23039
|
rowRightWrapperClasses,
|
|
23040
|
+
allowReorder,
|
|
23041
|
+
detailsRow,
|
|
23022
23042
|
name
|
|
23023
23043
|
}) {
|
|
23024
23044
|
const dragRef = useRef(null);
|
|
23025
23045
|
const previewRef = useRef(null);
|
|
23026
|
-
|
|
23046
|
+
const [detailsOpen, setDetailsOpen] = useState(false);
|
|
23047
|
+
if (allowReorder && !Object.prototype.hasOwnProperty.call(entry, "index")) {
|
|
23027
23048
|
throw new Error("Entry must have index property");
|
|
23028
23049
|
}
|
|
23029
23050
|
const [{ handlerId }, drop] = useDrop({
|
|
@@ -23034,7 +23055,7 @@ function Row({
|
|
|
23034
23055
|
};
|
|
23035
23056
|
},
|
|
23036
23057
|
hover(item, monitor) {
|
|
23037
|
-
if (!previewRef.current) {
|
|
23058
|
+
if (!allowReorder || !previewRef.current) {
|
|
23038
23059
|
return;
|
|
23039
23060
|
}
|
|
23040
23061
|
const dragIndex = item.index;
|
|
@@ -23074,74 +23095,93 @@ function Row({
|
|
|
23074
23095
|
opacity: monitor.isDragging() ? 0.4 : 1
|
|
23075
23096
|
})
|
|
23076
23097
|
});
|
|
23077
|
-
|
|
23078
|
-
|
|
23079
|
-
|
|
23080
|
-
|
|
23081
|
-
|
|
23082
|
-
|
|
23083
|
-
|
|
23084
|
-
|
|
23085
|
-
|
|
23086
|
-
|
|
23087
|
-
|
|
23088
|
-
|
|
23089
|
-
|
|
23090
|
-
|
|
23091
|
-
|
|
23092
|
-
|
|
23093
|
-
|
|
23094
|
-
|
|
23095
|
-
|
|
23096
|
-
|
|
23098
|
+
if (allowReorder) {
|
|
23099
|
+
preview(drop(previewRef));
|
|
23100
|
+
drag(dragRef);
|
|
23101
|
+
}
|
|
23102
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
23103
|
+
/* @__PURE__ */ jsxs(
|
|
23104
|
+
"div",
|
|
23105
|
+
{
|
|
23106
|
+
className: rowClasses,
|
|
23107
|
+
onClick: () => onRowClick(entry),
|
|
23108
|
+
onDoubleClick: () => onRowDoubleClick(entry),
|
|
23109
|
+
ref: previewRef,
|
|
23110
|
+
style: { opacity },
|
|
23111
|
+
"data-handler-id": handlerId,
|
|
23112
|
+
"data-testid": `${name}-table-row`,
|
|
23113
|
+
children: [
|
|
23114
|
+
(detailsRow || !!currentColumnsLeft.length) && /* @__PURE__ */ jsxs("div", { className: "sticky left-0 flex flex-row border-r", children: [
|
|
23115
|
+
detailsRow && /* @__PURE__ */ jsx("div", { className: ["flex items-center justify-center w-12", rowLeftWrapperClasses].join(" "), children: /* @__PURE__ */ jsx(
|
|
23116
|
+
"button",
|
|
23117
|
+
{
|
|
23118
|
+
className: "w-8 cursor-pointer",
|
|
23119
|
+
onClick: (e) => {
|
|
23120
|
+
e.stopPropagation();
|
|
23121
|
+
e.preventDefault();
|
|
23122
|
+
setDetailsOpen(!detailsOpen);
|
|
23123
|
+
},
|
|
23124
|
+
children: /* @__PURE__ */ jsx(Icon, { name: detailsOpen ? "heroicons:chevron-down" : "heroicons:chevron-right", className: "h-5 w-5" })
|
|
23125
|
+
}
|
|
23126
|
+
) }),
|
|
23127
|
+
currentColumnsLeft.map((column) => {
|
|
23128
|
+
return /* @__PURE__ */ jsx(
|
|
23129
|
+
"div",
|
|
23130
|
+
{
|
|
23131
|
+
style: {
|
|
23132
|
+
minWidth: column.initialWidth,
|
|
23133
|
+
maxWidth: !column.grow ? column.initialWidth : void 0
|
|
23134
|
+
},
|
|
23135
|
+
className: [rowLeftWrapperClasses, column.grow ? "grow" : ""].join(" "),
|
|
23136
|
+
title: entry[column.id] || "",
|
|
23137
|
+
children: dragRef && cellRenderer?.[column.id]?.({ ...entry, dragRef }) || /* @__PURE__ */ jsx("div", { className: "h-14 truncate p-4 text-sm", children: entry[column.id] || "-" })
|
|
23138
|
+
},
|
|
23139
|
+
column.id.toString()
|
|
23140
|
+
);
|
|
23141
|
+
})
|
|
23142
|
+
] }),
|
|
23143
|
+
currentColumnsCenter.map((column) => {
|
|
23144
|
+
return /* @__PURE__ */ jsx(
|
|
23145
|
+
"div",
|
|
23146
|
+
{
|
|
23147
|
+
style: {
|
|
23148
|
+
minWidth: column.initialWidth,
|
|
23149
|
+
maxWidth: !column.grow ? column.initialWidth : void 0
|
|
23150
|
+
},
|
|
23151
|
+
className: [rowCenterWrapperClasses, column.grow ? "grow" : ""].join(" "),
|
|
23152
|
+
title: entry[column.id] ? entry[column.id].toString() : "",
|
|
23153
|
+
children: cellRenderer?.[column.id]?.({ ...entry, dragRef }) || /* @__PURE__ */ jsx("div", { className: "h-14 truncate p-4 text-sm", children: entry[column.id] || "-" })
|
|
23097
23154
|
},
|
|
23098
|
-
|
|
23099
|
-
|
|
23100
|
-
|
|
23101
|
-
|
|
23102
|
-
|
|
23103
|
-
|
|
23104
|
-
|
|
23105
|
-
|
|
23106
|
-
|
|
23107
|
-
|
|
23108
|
-
|
|
23109
|
-
|
|
23110
|
-
|
|
23111
|
-
|
|
23155
|
+
column.id.toString()
|
|
23156
|
+
);
|
|
23157
|
+
}),
|
|
23158
|
+
!!currentColumnsRight.length && /* @__PURE__ */ jsx("div", { className: "sticky right-0 flex flex-row border-l", children: currentColumnsRight.map((column) => {
|
|
23159
|
+
return /* @__PURE__ */ jsx(
|
|
23160
|
+
"div",
|
|
23161
|
+
{
|
|
23162
|
+
style: {
|
|
23163
|
+
minWidth: column.initialWidth,
|
|
23164
|
+
maxWidth: !column.grow ? column.initialWidth : void 0
|
|
23165
|
+
},
|
|
23166
|
+
className: [rowRightWrapperClasses, column.grow ? "grow" : ""].join(" "),
|
|
23167
|
+
title: entry[column.id] || "",
|
|
23168
|
+
children: cellRenderer?.[column.id]?.({ ...entry, dragRef }) || /* @__PURE__ */ jsx("div", { className: "h-14 truncate p-4 text-sm", children: entry[column.id] || "-" })
|
|
23112
23169
|
},
|
|
23113
|
-
|
|
23114
|
-
|
|
23115
|
-
|
|
23116
|
-
|
|
23117
|
-
column.id.toString()
|
|
23118
|
-
);
|
|
23119
|
-
}),
|
|
23120
|
-
!!currentColumnsRight.length && /* @__PURE__ */ jsx("div", { className: "sticky right-0 flex flex-row border-l", children: currentColumnsRight.map((column) => {
|
|
23121
|
-
return /* @__PURE__ */ jsx(
|
|
23170
|
+
column.id.toString()
|
|
23171
|
+
);
|
|
23172
|
+
}) }),
|
|
23173
|
+
/* @__PURE__ */ jsx(
|
|
23122
23174
|
"div",
|
|
23123
23175
|
{
|
|
23124
|
-
style: {
|
|
23125
|
-
|
|
23126
|
-
|
|
23127
|
-
|
|
23128
|
-
|
|
23129
|
-
|
|
23130
|
-
|
|
23131
|
-
|
|
23132
|
-
|
|
23133
|
-
);
|
|
23134
|
-
}) }),
|
|
23135
|
-
/* @__PURE__ */ jsx(
|
|
23136
|
-
"div",
|
|
23137
|
-
{
|
|
23138
|
-
style: { width: `${(header.current?.scrollWidth || 0) - 1}px` },
|
|
23139
|
-
className: "absolute bottom-0 left-0 right-0 h-px bg-secondary-50"
|
|
23140
|
-
}
|
|
23141
|
-
)
|
|
23142
|
-
]
|
|
23143
|
-
}
|
|
23144
|
-
);
|
|
23176
|
+
style: { width: `${(header.current?.scrollWidth || 0) - 1}px` },
|
|
23177
|
+
className: "absolute bottom-0 left-0 right-0 h-px bg-secondary-50"
|
|
23178
|
+
}
|
|
23179
|
+
)
|
|
23180
|
+
]
|
|
23181
|
+
}
|
|
23182
|
+
),
|
|
23183
|
+
detailsRow && detailsOpen && /* @__PURE__ */ jsx("div", { className: "ml-12", children: detailsRow(entry) })
|
|
23184
|
+
] });
|
|
23145
23185
|
}
|
|
23146
23186
|
|
|
23147
23187
|
function TableActions({
|
|
@@ -23167,7 +23207,7 @@ function TableActions({
|
|
|
23167
23207
|
actionsVisible && /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(FloatingFocusManager, { context, modal: false, children: /* @__PURE__ */ jsx(
|
|
23168
23208
|
"div",
|
|
23169
23209
|
{
|
|
23170
|
-
className: "flex w-48 flex-col rounded-md border border-secondary-200 bg-white py-2 text-sm font-medium shadow-sm",
|
|
23210
|
+
className: "flex w-48 flex-col rounded-md border border-secondary-200 bg-white py-2 text-sm font-medium shadow-sm z-1",
|
|
23171
23211
|
ref: refs.setFloating,
|
|
23172
23212
|
style: floatingStyles,
|
|
23173
23213
|
...getFloatingProps(),
|
|
@@ -23177,7 +23217,7 @@ function TableActions({
|
|
|
23177
23217
|
] });
|
|
23178
23218
|
}
|
|
23179
23219
|
function TableActionEntry({
|
|
23180
|
-
|
|
23220
|
+
content,
|
|
23181
23221
|
errorClasses = "cursor-pointer px-4 py-2 text-error-900 hover:bg-error-100",
|
|
23182
23222
|
defaultClasses = "cursor-pointer px-4 py-2 text-secondary-900 hover:bg-primary-100",
|
|
23183
23223
|
variant = "default",
|
|
@@ -23185,9 +23225,9 @@ function TableActionEntry({
|
|
|
23185
23225
|
}) {
|
|
23186
23226
|
switch (variant) {
|
|
23187
23227
|
case "error":
|
|
23188
|
-
return /* @__PURE__ */ jsx("span", { onClick, className: errorClasses, children:
|
|
23228
|
+
return /* @__PURE__ */ jsx("span", { onClick, className: errorClasses, children: content });
|
|
23189
23229
|
default:
|
|
23190
|
-
return /* @__PURE__ */ jsx("span", { onClick, className: defaultClasses, children:
|
|
23230
|
+
return /* @__PURE__ */ jsx("span", { onClick, className: defaultClasses, children: content });
|
|
23191
23231
|
}
|
|
23192
23232
|
}
|
|
23193
23233
|
|