@jsenv/navi 0.15.2 → 0.15.3
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.
- package/dist/jsenv_navi.js +692 -167
- package/dist/jsenv_navi.js.map +72 -13
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -4736,6 +4736,7 @@ const hasWidthHeight = (context) => {
|
|
|
4736
4736
|
);
|
|
4737
4737
|
};
|
|
4738
4738
|
const DIMENSION_PROPS = {
|
|
4739
|
+
boxSizing: PASS_THROUGH,
|
|
4739
4740
|
width: PASS_THROUGH,
|
|
4740
4741
|
minWidth: PASS_THROUGH,
|
|
4741
4742
|
maxWidth: PASS_THROUGH,
|
|
@@ -4946,6 +4947,7 @@ const TYPO_PROPS = {
|
|
|
4946
4947
|
pre: applyToCssPropWhenTruthy("whiteSpace", "pre", "normal"),
|
|
4947
4948
|
preWrap: applyToCssPropWhenTruthy("whiteSpace", "pre-wrap", "normal"),
|
|
4948
4949
|
preLine: applyToCssPropWhenTruthy("whiteSpace", "pre-line", "normal"),
|
|
4950
|
+
userSelect: PASS_THROUGH,
|
|
4949
4951
|
};
|
|
4950
4952
|
const VISUAL_PROPS = {
|
|
4951
4953
|
outline: PASS_THROUGH,
|
|
@@ -5008,7 +5010,11 @@ const CONTENT_PROPS = {
|
|
|
5008
5010
|
}
|
|
5009
5011
|
return { alignItems: value };
|
|
5010
5012
|
}
|
|
5011
|
-
|
|
5013
|
+
|
|
5014
|
+
return {
|
|
5015
|
+
verticalAlign:
|
|
5016
|
+
{ center: "middle", start: "top", end: "bottom" }[value] || value,
|
|
5017
|
+
};
|
|
5012
5018
|
},
|
|
5013
5019
|
spacing: (value, { boxFlow }) => {
|
|
5014
5020
|
if (
|
|
@@ -13642,7 +13648,7 @@ const installCustomConstraintValidation = (
|
|
|
13642
13648
|
}
|
|
13643
13649
|
}
|
|
13644
13650
|
|
|
13645
|
-
if (failedConstraintInfo) {
|
|
13651
|
+
if (failedConstraintInfo && !failedConstraintInfo.silent) {
|
|
13646
13652
|
if (!hasTitleAttribute) {
|
|
13647
13653
|
// when a constraint is failing browser displays that constraint message if the element has no title attribute.
|
|
13648
13654
|
// We want to do the same with our message (overriding the browser in the process to get better messages)
|
|
@@ -14831,6 +14837,14 @@ const Icon = ({
|
|
|
14831
14837
|
const ariaProps = decorative ? {
|
|
14832
14838
|
"aria-hidden": "true"
|
|
14833
14839
|
} : {};
|
|
14840
|
+
if (typeof children === "string") {
|
|
14841
|
+
return jsx(Text, {
|
|
14842
|
+
...props,
|
|
14843
|
+
...ariaProps,
|
|
14844
|
+
"data-icon-text": "",
|
|
14845
|
+
children: children
|
|
14846
|
+
});
|
|
14847
|
+
}
|
|
14834
14848
|
if (box) {
|
|
14835
14849
|
return jsx(Box, {
|
|
14836
14850
|
square: true,
|
|
@@ -15675,6 +15689,7 @@ const useUIStateController = (
|
|
|
15675
15689
|
fallbackState = "",
|
|
15676
15690
|
getStateFromProp = (prop) => prop,
|
|
15677
15691
|
getPropFromState = (state) => state,
|
|
15692
|
+
getStateFromParent,
|
|
15678
15693
|
} = {},
|
|
15679
15694
|
) => {
|
|
15680
15695
|
const parentUIStateController = useContext(ParentUIStateControllerContext);
|
|
@@ -15701,6 +15716,9 @@ const useUIStateController = (
|
|
|
15701
15716
|
// (I think this should likely move earlier to win over the hasUIStateProp when it's undefined)
|
|
15702
15717
|
return getStateFromProp(navState);
|
|
15703
15718
|
}
|
|
15719
|
+
if (parentUIStateController && getStateFromParent) {
|
|
15720
|
+
return getStateFromParent(parentUIStateController);
|
|
15721
|
+
}
|
|
15704
15722
|
return getStateFromProp(fallbackState);
|
|
15705
15723
|
});
|
|
15706
15724
|
|
|
@@ -15927,7 +15945,7 @@ const useUIGroupStateController = (
|
|
|
15927
15945
|
throw new TypeError("aggregateChildStates must be a function");
|
|
15928
15946
|
}
|
|
15929
15947
|
const parentUIStateController = useContext(ParentUIStateControllerContext);
|
|
15930
|
-
const { onUIStateChange, name } = props;
|
|
15948
|
+
const { onUIStateChange, name, value } = props;
|
|
15931
15949
|
const childUIStateControllerArrayRef = useRef([]);
|
|
15932
15950
|
const childUIStateControllerArray = childUIStateControllerArrayRef.current;
|
|
15933
15951
|
const uiStateControllerRef = useRef();
|
|
@@ -15977,6 +15995,7 @@ const useUIGroupStateController = (
|
|
|
15977
15995
|
if (existingUIStateController) {
|
|
15978
15996
|
existingUIStateController.name = name;
|
|
15979
15997
|
existingUIStateController.onUIStateChange = onUIStateChange;
|
|
15998
|
+
existingUIStateController.value = value;
|
|
15980
15999
|
return existingUIStateController;
|
|
15981
16000
|
}
|
|
15982
16001
|
|
|
@@ -15990,6 +16009,7 @@ const useUIGroupStateController = (
|
|
|
15990
16009
|
const uiStateController = {
|
|
15991
16010
|
componentType,
|
|
15992
16011
|
name,
|
|
16012
|
+
value,
|
|
15993
16013
|
onUIStateChange,
|
|
15994
16014
|
uiState: emptyState,
|
|
15995
16015
|
setUIState: (newUIState, e) => {
|
|
@@ -16231,6 +16251,11 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
|
16231
16251
|
}
|
|
16232
16252
|
}
|
|
16233
16253
|
|
|
16254
|
+
&[data-reveal-on-interaction] {
|
|
16255
|
+
--x-button-background-color: transparent;
|
|
16256
|
+
--x-button-border-color: transparent;
|
|
16257
|
+
}
|
|
16258
|
+
|
|
16234
16259
|
/* Hover */
|
|
16235
16260
|
&[data-hover] {
|
|
16236
16261
|
--x-button-border-color: var(--button-border-color-hover);
|
|
@@ -16379,7 +16404,8 @@ const ButtonBasic = props => {
|
|
|
16379
16404
|
autoFocus,
|
|
16380
16405
|
// visual
|
|
16381
16406
|
icon,
|
|
16382
|
-
|
|
16407
|
+
revealOnInteraction = icon,
|
|
16408
|
+
discrete = icon && !revealOnInteraction,
|
|
16383
16409
|
children,
|
|
16384
16410
|
...rest
|
|
16385
16411
|
} = props;
|
|
@@ -16402,11 +16428,11 @@ const ButtonBasic = props => {
|
|
|
16402
16428
|
const renderButtonContentMemoized = useCallback(renderButtonContent, [children]);
|
|
16403
16429
|
return jsxs(Box, {
|
|
16404
16430
|
"data-readonly-silent": innerLoading ? "" : undefined,
|
|
16405
|
-
"data-nohover": icon ? "" : undefined,
|
|
16406
16431
|
...remainingProps,
|
|
16407
16432
|
as: "button",
|
|
16408
16433
|
ref: ref,
|
|
16409
16434
|
"data-icon": icon ? "" : undefined,
|
|
16435
|
+
"data-reveal-on-interaction": revealOnInteraction ? "" : undefined,
|
|
16410
16436
|
"data-discrete": discrete ? "" : undefined,
|
|
16411
16437
|
"data-callout-arrow-x": "center",
|
|
16412
16438
|
"aria-busy": innerLoading
|
|
@@ -17757,7 +17783,11 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
|
17757
17783
|
white
|
|
17758
17784
|
);
|
|
17759
17785
|
--border-color-readonly-checked: #d3d3d3;
|
|
17760
|
-
--background-color-readonly-checked:
|
|
17786
|
+
--background-color-readonly-checked: color-mix(
|
|
17787
|
+
in srgb,
|
|
17788
|
+
var(--background-color-checked) 30%,
|
|
17789
|
+
grey
|
|
17790
|
+
);
|
|
17761
17791
|
--checkmark-color-readonly: #eeeeee;
|
|
17762
17792
|
/* Disabled */
|
|
17763
17793
|
--border-color-disabled: var(--border-color-readonly);
|
|
@@ -17835,7 +17865,6 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
|
17835
17865
|
.navi_checkbox {
|
|
17836
17866
|
--x-background-color: var(--background-color);
|
|
17837
17867
|
--x-border-color: var(--border-color);
|
|
17838
|
-
--x-color: var(--color);
|
|
17839
17868
|
--x-checkmark-color: var(--checkmark-color);
|
|
17840
17869
|
--x-cursor: var(--cursor);
|
|
17841
17870
|
|
|
@@ -18072,21 +18101,18 @@ const CheckboxStyleCSSVars = {
|
|
|
18072
18101
|
"accentColor": "--accent-color",
|
|
18073
18102
|
":hover": {
|
|
18074
18103
|
backgroundColor: "--background-color-hover",
|
|
18075
|
-
borderColor: "--border-color-hover"
|
|
18076
|
-
color: "--color-hover"
|
|
18104
|
+
borderColor: "--border-color-hover"
|
|
18077
18105
|
},
|
|
18078
18106
|
":active": {
|
|
18079
18107
|
borderColor: "--border-color-active"
|
|
18080
18108
|
},
|
|
18081
18109
|
":read-only": {
|
|
18082
18110
|
backgroundColor: "--background-color-readonly",
|
|
18083
|
-
borderColor: "--border-color-readonly"
|
|
18084
|
-
color: "--color-readonly"
|
|
18111
|
+
borderColor: "--border-color-readonly"
|
|
18085
18112
|
},
|
|
18086
18113
|
":disabled": {
|
|
18087
18114
|
backgroundColor: "--background-color-disabled",
|
|
18088
|
-
borderColor: "--border-color-disabled"
|
|
18089
|
-
color: "--color-disabled"
|
|
18115
|
+
borderColor: "--border-color-disabled"
|
|
18090
18116
|
}
|
|
18091
18117
|
};
|
|
18092
18118
|
const CheckboxToggleStyleCSSVars = {
|
|
@@ -18467,33 +18493,35 @@ forwardRef((props, ref) => {
|
|
|
18467
18493
|
installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
18468
18494
|
@layer navi {
|
|
18469
18495
|
.navi_radio {
|
|
18496
|
+
--margin: 3px 3px 0 5px;
|
|
18470
18497
|
--outline-offset: 1px;
|
|
18471
18498
|
--outline-width: 2px;
|
|
18472
|
-
--width:
|
|
18473
|
-
--height:
|
|
18499
|
+
--width: 0.815em;
|
|
18500
|
+
--height: 0.815em;
|
|
18474
18501
|
|
|
18475
18502
|
--outline-color: var(--navi-focus-outline-color);
|
|
18476
18503
|
--loader-color: var(--navi-loader-color);
|
|
18477
18504
|
--border-color: light-dark(#767676, #8e8e93);
|
|
18478
18505
|
--background-color: white;
|
|
18479
|
-
--color: light-dark(#4476ff, #3b82f6);
|
|
18480
|
-
--radiomark-color: var(--color);
|
|
18481
|
-
--border-color-checked: var(--color);
|
|
18506
|
+
--accent-color: light-dark(#4476ff, #3b82f6);
|
|
18507
|
+
--radiomark-color: var(--accent-color);
|
|
18508
|
+
--border-color-checked: var(--accent-color);
|
|
18509
|
+
--cursor: pointer;
|
|
18482
18510
|
|
|
18483
|
-
--color-mix-light:
|
|
18484
|
-
--color-mix-dark:
|
|
18511
|
+
--color-mix-light: black;
|
|
18512
|
+
--color-mix-dark: white;
|
|
18485
18513
|
--color-mix: var(--color-mix-light);
|
|
18486
18514
|
|
|
18487
18515
|
/* Hover */
|
|
18488
18516
|
--border-color-hover: color-mix(in srgb, var(--border-color) 60%, black);
|
|
18489
18517
|
--border-color-hover-checked: color-mix(
|
|
18490
18518
|
in srgb,
|
|
18491
|
-
var(--color) 80%,
|
|
18519
|
+
var(--border-color-checked) 80%,
|
|
18492
18520
|
var(--color-mix)
|
|
18493
18521
|
);
|
|
18494
18522
|
--radiomark-color-hover: color-mix(
|
|
18495
18523
|
in srgb,
|
|
18496
|
-
var(--color) 80%,
|
|
18524
|
+
var(--radiomark-color) 80%,
|
|
18497
18525
|
var(--color-mix)
|
|
18498
18526
|
);
|
|
18499
18527
|
/* Readonly */
|
|
@@ -18503,30 +18531,52 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
|
18503
18531
|
white
|
|
18504
18532
|
);
|
|
18505
18533
|
--background-color-readonly: var(--background-color);
|
|
18506
|
-
--radiomark-color-readonly:
|
|
18507
|
-
|
|
18508
|
-
|
|
18534
|
+
--radiomark-color-readonly: color-mix(
|
|
18535
|
+
in srgb,
|
|
18536
|
+
var(--radiomark-color) 30%,
|
|
18537
|
+
grey
|
|
18538
|
+
);
|
|
18539
|
+
--border-color-readonly-checked: color-mix(
|
|
18540
|
+
in srgb,
|
|
18541
|
+
var(--radiomark-color) 30%,
|
|
18542
|
+
transparent
|
|
18543
|
+
);
|
|
18544
|
+
--background-color-readonly-checked: var(--border-color-readonly-checked);
|
|
18509
18545
|
/* Disabled */
|
|
18510
18546
|
--border-color-disabled: var(--border-color-readonly);
|
|
18511
18547
|
--background-color-disabled: rgba(248, 248, 248, 0.7);
|
|
18512
18548
|
--radiomark-color-disabled: #d3d3d3;
|
|
18513
18549
|
--border-color-checked-disabled: #d3d3d3;
|
|
18514
18550
|
--background-color-disabled-checked: var(--background-color);
|
|
18551
|
+
|
|
18552
|
+
/* Button specific */
|
|
18553
|
+
--button-border-width: 1px;
|
|
18554
|
+
--button-border-color: transparent;
|
|
18555
|
+
--button-background-color: transparent;
|
|
18556
|
+
--button-border-color-hover: color-mix(
|
|
18557
|
+
in srgb,
|
|
18558
|
+
var(--button-border-color) 70%,
|
|
18559
|
+
black
|
|
18560
|
+
);
|
|
18561
|
+
--button-background-color-hover: color-mix(
|
|
18562
|
+
in srgb,
|
|
18563
|
+
var(--button-border-color) 95%,
|
|
18564
|
+
black
|
|
18565
|
+
);
|
|
18566
|
+
--button-border-color-checked: var(--accent-color);
|
|
18567
|
+
--button-background-color-checked: transparent;
|
|
18568
|
+
--button-border-color-readonly: #eeeeee;
|
|
18569
|
+
--button-background-color-readonly: #d3d3d3;
|
|
18570
|
+
--button-border-color-disabled: var(--border-color-readonly);
|
|
18571
|
+
--button-background-color-disabled: var(--background-color-readonly);
|
|
18515
18572
|
}
|
|
18516
18573
|
|
|
18517
|
-
|
|
18574
|
+
&[data-dark] {
|
|
18518
18575
|
--color-mix: var(--color-mix-dark);
|
|
18519
18576
|
}
|
|
18520
18577
|
}
|
|
18521
18578
|
|
|
18522
18579
|
.navi_radio {
|
|
18523
|
-
position: relative;
|
|
18524
|
-
display: inline-flex;
|
|
18525
|
-
box-sizing: content-box;
|
|
18526
|
-
margin-top: 3px;
|
|
18527
|
-
margin-right: 3px;
|
|
18528
|
-
margin-left: 5px;
|
|
18529
|
-
|
|
18530
18580
|
--x-outline-offset: var(--outline-offset);
|
|
18531
18581
|
--x-outline-width: var(--outline-width);
|
|
18532
18582
|
--x-border-width: var(--border-width);
|
|
@@ -18535,102 +18585,196 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
|
18535
18585
|
--x-outline-color: var(--outline-color);
|
|
18536
18586
|
--x-background-color: var(--background-color);
|
|
18537
18587
|
--x-border-color: var(--border-color);
|
|
18538
|
-
--x-color: var(--color);
|
|
18539
18588
|
--x-radiomark-color: var(--radiomark-color);
|
|
18540
|
-
|
|
18541
|
-
|
|
18542
|
-
position:
|
|
18543
|
-
inset: 0;
|
|
18544
|
-
margin: 0;
|
|
18545
|
-
padding: 0;
|
|
18546
|
-
opacity: 0;
|
|
18547
|
-
cursor: inherit;
|
|
18548
|
-
}
|
|
18549
|
-
.navi_radio .navi_radio_field {
|
|
18589
|
+
--x-cursor: var(--cursor);
|
|
18590
|
+
|
|
18591
|
+
position: relative;
|
|
18550
18592
|
display: inline-flex;
|
|
18551
|
-
box-sizing:
|
|
18552
|
-
|
|
18553
|
-
height: var(--x-height);
|
|
18554
|
-
align-items: center;
|
|
18555
|
-
justify-content: center;
|
|
18556
|
-
border-radius: 50%;
|
|
18557
|
-
outline-width: var(--x-outline-width);
|
|
18558
|
-
outline-style: none;
|
|
18559
|
-
outline-color: var(--x-outline-color);
|
|
18560
|
-
outline-offset: var(--x-outline-offset);
|
|
18561
|
-
}
|
|
18562
|
-
.navi_radio_field svg {
|
|
18563
|
-
overflow: visible;
|
|
18564
|
-
}
|
|
18565
|
-
.navi_radio_border {
|
|
18566
|
-
fill: var(--x-background-color);
|
|
18567
|
-
stroke: var(--x-border-color);
|
|
18568
|
-
}
|
|
18569
|
-
.navi_radio_marker {
|
|
18570
|
-
width: 100%;
|
|
18571
|
-
height: 100%;
|
|
18572
|
-
opacity: 0;
|
|
18573
|
-
fill: var(--x-radiomark-color);
|
|
18574
|
-
transform: scale(0.3);
|
|
18575
|
-
transform-origin: center;
|
|
18576
|
-
pointer-events: none;
|
|
18577
|
-
}
|
|
18578
|
-
.navi_radio_dashed_border {
|
|
18579
|
-
display: none;
|
|
18580
|
-
}
|
|
18581
|
-
.navi_radio[data-transition] .navi_radio_marker {
|
|
18582
|
-
transition: all 0.15s ease;
|
|
18583
|
-
}
|
|
18584
|
-
.navi_radio[data-transition] .navi_radio_dashed_border {
|
|
18585
|
-
transition: all 0.15s ease;
|
|
18586
|
-
}
|
|
18587
|
-
.navi_radio[data-transition] .navi_radio_border {
|
|
18588
|
-
transition: all 0.15s ease;
|
|
18589
|
-
}
|
|
18593
|
+
box-sizing: content-box;
|
|
18594
|
+
margin: var(--margin);
|
|
18590
18595
|
|
|
18591
|
-
|
|
18592
|
-
|
|
18593
|
-
|
|
18594
|
-
|
|
18595
|
-
|
|
18596
|
-
|
|
18597
|
-
|
|
18598
|
-
|
|
18599
|
-
|
|
18600
|
-
|
|
18601
|
-
|
|
18602
|
-
|
|
18603
|
-
|
|
18604
|
-
|
|
18605
|
-
|
|
18606
|
-
|
|
18607
|
-
|
|
18608
|
-
|
|
18609
|
-
|
|
18610
|
-
|
|
18611
|
-
|
|
18612
|
-
|
|
18613
|
-
|
|
18614
|
-
|
|
18615
|
-
|
|
18616
|
-
|
|
18617
|
-
|
|
18618
|
-
|
|
18619
|
-
|
|
18620
|
-
|
|
18621
|
-
|
|
18622
|
-
|
|
18623
|
-
|
|
18624
|
-
|
|
18625
|
-
|
|
18626
|
-
|
|
18627
|
-
|
|
18628
|
-
|
|
18629
|
-
|
|
18630
|
-
|
|
18631
|
-
|
|
18632
|
-
|
|
18633
|
-
|
|
18596
|
+
.navi_native_field {
|
|
18597
|
+
position: absolute;
|
|
18598
|
+
inset: 0;
|
|
18599
|
+
margin: 0;
|
|
18600
|
+
padding: 0;
|
|
18601
|
+
border: none;
|
|
18602
|
+
border-radius: inherit;
|
|
18603
|
+
opacity: 0;
|
|
18604
|
+
appearance: none; /* This allows border-radius to have an effect */
|
|
18605
|
+
cursor: var(--x-cursor);
|
|
18606
|
+
}
|
|
18607
|
+
|
|
18608
|
+
/* Focus */
|
|
18609
|
+
&[data-focus-visible] {
|
|
18610
|
+
z-index: 1;
|
|
18611
|
+
.navi_radio_field {
|
|
18612
|
+
outline-style: solid;
|
|
18613
|
+
}
|
|
18614
|
+
}
|
|
18615
|
+
/* Hover */
|
|
18616
|
+
&[data-hover] {
|
|
18617
|
+
--x-border-color: var(--border-color-hover);
|
|
18618
|
+
--x-radiomark-color: var(--radiomark-color-hover);
|
|
18619
|
+
}
|
|
18620
|
+
/* Checked */
|
|
18621
|
+
&[data-checked] {
|
|
18622
|
+
--x-border-color: var(--border-color-checked);
|
|
18623
|
+
|
|
18624
|
+
&[data-hover] {
|
|
18625
|
+
--x-border-color: var(--border-color-hover-checked);
|
|
18626
|
+
}
|
|
18627
|
+
}
|
|
18628
|
+
/* Readonly */
|
|
18629
|
+
&[data-readonly] {
|
|
18630
|
+
--x-cursor: default;
|
|
18631
|
+
--x-background-color: var(--background-color-readonly);
|
|
18632
|
+
--x-border-color: var(--border-color-readonly);
|
|
18633
|
+
--x-radiomark-color: var(--radiomark-color-readonly);
|
|
18634
|
+
|
|
18635
|
+
.navi_radio_dashed_border {
|
|
18636
|
+
display: none;
|
|
18637
|
+
}
|
|
18638
|
+
|
|
18639
|
+
&[data-checked] {
|
|
18640
|
+
--x-background-color: var(--background-color-readonly-checked);
|
|
18641
|
+
--x-border-color: var(--border-color-readonly-checked);
|
|
18642
|
+
--x-radiomark-color: var(--radiomark-color-readonly);
|
|
18643
|
+
}
|
|
18644
|
+
}
|
|
18645
|
+
/* Disabled */
|
|
18646
|
+
&[data-disabled] {
|
|
18647
|
+
--x-cursor: default;
|
|
18648
|
+
--x-background-color: var(--background-color-disabled);
|
|
18649
|
+
--x-border-color: var(--border-color-disabled);
|
|
18650
|
+
--x-radiomark-color: var(--radiomark-color-disabled);
|
|
18651
|
+
|
|
18652
|
+
&[data-checked] {
|
|
18653
|
+
--x-border-color: var(--border-color-disabled);
|
|
18654
|
+
--x-radiomark-color: var(--radiomark-color-disabled);
|
|
18655
|
+
}
|
|
18656
|
+
}
|
|
18657
|
+
|
|
18658
|
+
.navi_radio_field {
|
|
18659
|
+
box-sizing: border-box;
|
|
18660
|
+
width: var(--x-width);
|
|
18661
|
+
height: var(--x-height);
|
|
18662
|
+
outline-width: var(--x-outline-width);
|
|
18663
|
+
outline-style: none;
|
|
18664
|
+
outline-color: var(--x-outline-color);
|
|
18665
|
+
outline-offset: var(--x-outline-offset);
|
|
18666
|
+
pointer-events: none;
|
|
18667
|
+
}
|
|
18668
|
+
|
|
18669
|
+
/* Radio appearance */
|
|
18670
|
+
&[data-appearance="radio"] {
|
|
18671
|
+
.navi_radio_field {
|
|
18672
|
+
display: inline-flex;
|
|
18673
|
+
align-items: center;
|
|
18674
|
+
justify-content: center;
|
|
18675
|
+
border-radius: 50%;
|
|
18676
|
+
|
|
18677
|
+
svg {
|
|
18678
|
+
overflow: visible;
|
|
18679
|
+
}
|
|
18680
|
+
|
|
18681
|
+
.navi_radio_border {
|
|
18682
|
+
fill: var(--x-background-color);
|
|
18683
|
+
stroke: var(--x-border-color);
|
|
18684
|
+
}
|
|
18685
|
+
.navi_radio_dashed_border {
|
|
18686
|
+
display: none;
|
|
18687
|
+
}
|
|
18688
|
+
.navi_radio_marker {
|
|
18689
|
+
width: 100%;
|
|
18690
|
+
height: 100%;
|
|
18691
|
+
opacity: 0;
|
|
18692
|
+
fill: var(--x-radiomark-color);
|
|
18693
|
+
transform: scale(0.3);
|
|
18694
|
+
transform-origin: center;
|
|
18695
|
+
pointer-events: none;
|
|
18696
|
+
}
|
|
18697
|
+
}
|
|
18698
|
+
|
|
18699
|
+
&[data-transition] {
|
|
18700
|
+
.navi_radio_border {
|
|
18701
|
+
transition: all 0.15s ease;
|
|
18702
|
+
}
|
|
18703
|
+
.navi_radio_dashed_border {
|
|
18704
|
+
transition: all 0.15s ease;
|
|
18705
|
+
}
|
|
18706
|
+
.navi_radio_marker {
|
|
18707
|
+
transition: all 0.15s ease;
|
|
18708
|
+
}
|
|
18709
|
+
}
|
|
18710
|
+
|
|
18711
|
+
&[data-checked] {
|
|
18712
|
+
.navi_radio_marker {
|
|
18713
|
+
opacity: 1;
|
|
18714
|
+
transform: scale(1);
|
|
18715
|
+
}
|
|
18716
|
+
}
|
|
18717
|
+
}
|
|
18718
|
+
|
|
18719
|
+
/* Icon appearance */
|
|
18720
|
+
&[data-appearance="icon"] {
|
|
18721
|
+
--width: auto;
|
|
18722
|
+
--height: auto;
|
|
18723
|
+
--outline-offset: 2px;
|
|
18724
|
+
--outline-width: 2px;
|
|
18725
|
+
}
|
|
18726
|
+
|
|
18727
|
+
/* Button appearance */
|
|
18728
|
+
&[data-appearance="button"] {
|
|
18729
|
+
--margin: 0;
|
|
18730
|
+
--outline-offset: 0px;
|
|
18731
|
+
--width: auto;
|
|
18732
|
+
--height: auto;
|
|
18733
|
+
--padding: 2px;
|
|
18734
|
+
--border-color: var(--button-border-color);
|
|
18735
|
+
--border-color-hover: var(--button-border-color-hover);
|
|
18736
|
+
--background-color: var(--button-background-color);
|
|
18737
|
+
--background-color-hover: var(--button-background-color-hover);
|
|
18738
|
+
--background-color-readonly: var(--button-background-color-readonly);
|
|
18739
|
+
--background-color-disabled: var(--button-background-color-disabled);
|
|
18740
|
+
--border-color-checked: var(--button-border-color);
|
|
18741
|
+
--background-color-checked: var(--button-background-color);
|
|
18742
|
+
|
|
18743
|
+
.navi_radio_field {
|
|
18744
|
+
display: inline-flex;
|
|
18745
|
+
box-sizing: border-box;
|
|
18746
|
+
padding-top: var(--padding-top, var(--padding-y, var(--padding)));
|
|
18747
|
+
padding-right: var(--padding-right, var(--padding-x, var(--padding)));
|
|
18748
|
+
padding-bottom: var(--padding-bottom, var(--padding-y, var(--padding)));
|
|
18749
|
+
padding-left: var(--padding-left, var(--padding-x, var(--padding)));
|
|
18750
|
+
align-items: center;
|
|
18751
|
+
justify-content: center;
|
|
18752
|
+
background-color: var(--x-background-color);
|
|
18753
|
+
border-width: var(--button-border-width);
|
|
18754
|
+
border-style: solid;
|
|
18755
|
+
border-color: var(--x-border-color);
|
|
18756
|
+
border-radius: var(--button-border-radius);
|
|
18757
|
+
}
|
|
18758
|
+
|
|
18759
|
+
&[data-hover] {
|
|
18760
|
+
--x-background-color: var(--button-background-color-hover);
|
|
18761
|
+
--x-border-color: var(--button-border-color-hover);
|
|
18762
|
+
}
|
|
18763
|
+
&[data-checked] {
|
|
18764
|
+
--x-border-color: var(--button-border-color-checked);
|
|
18765
|
+
--x-background-color: var(--button-background-color-checked);
|
|
18766
|
+
|
|
18767
|
+
.navi_radio_field {
|
|
18768
|
+
box-shadow:
|
|
18769
|
+
inset 0 2px 4px rgba(0, 0, 0, 0.15),
|
|
18770
|
+
inset 0 0 0 1px var(--button-border-color-checked);
|
|
18771
|
+
}
|
|
18772
|
+
}
|
|
18773
|
+
&[data-disabled] {
|
|
18774
|
+
--x-border-color: var(--button-border-color-disabled);
|
|
18775
|
+
--x-background-color: var(--button-background-color-disabled);
|
|
18776
|
+
}
|
|
18777
|
+
}
|
|
18634
18778
|
}
|
|
18635
18779
|
`;
|
|
18636
18780
|
const InputRadio = props => {
|
|
@@ -18641,7 +18785,13 @@ const InputRadio = props => {
|
|
|
18641
18785
|
statePropName: "checked",
|
|
18642
18786
|
fallbackState: false,
|
|
18643
18787
|
getStateFromProp: checked => checked ? value : undefined,
|
|
18644
|
-
getPropFromState: Boolean
|
|
18788
|
+
getPropFromState: Boolean,
|
|
18789
|
+
getStateFromParent: parentUIStateController => {
|
|
18790
|
+
if (parentUIStateController.componentType === "radio_list") {
|
|
18791
|
+
return parentUIStateController.value === props.value;
|
|
18792
|
+
}
|
|
18793
|
+
return undefined;
|
|
18794
|
+
}
|
|
18645
18795
|
});
|
|
18646
18796
|
const uiState = useUIState(uiStateController);
|
|
18647
18797
|
const radio = renderActionableComponent(props, {
|
|
@@ -18657,29 +18807,48 @@ const InputRadio = props => {
|
|
|
18657
18807
|
});
|
|
18658
18808
|
};
|
|
18659
18809
|
const RadioStyleCSSVars = {
|
|
18810
|
+
"width": "--width",
|
|
18811
|
+
"height": "--height",
|
|
18812
|
+
"borderRadius": "--border-radius",
|
|
18660
18813
|
"outlineWidth": "--outline-width",
|
|
18661
18814
|
"borderWidth": "--border-width",
|
|
18662
|
-
"borderRadius": "--border-radius",
|
|
18663
18815
|
"backgroundColor": "--background-color",
|
|
18664
18816
|
"borderColor": "--border-color",
|
|
18665
|
-
"
|
|
18817
|
+
"accentColor": "--accent-color",
|
|
18666
18818
|
":hover": {
|
|
18667
18819
|
backgroundColor: "--background-color-hover",
|
|
18668
|
-
borderColor: "--border-color-hover"
|
|
18669
|
-
color: "--color-hover"
|
|
18820
|
+
borderColor: "--border-color-hover"
|
|
18670
18821
|
},
|
|
18671
18822
|
":active": {
|
|
18672
18823
|
borderColor: "--border-color-active"
|
|
18673
18824
|
},
|
|
18674
18825
|
":read-only": {
|
|
18675
18826
|
backgroundColor: "--background-color-readonly",
|
|
18676
|
-
borderColor: "--border-color-readonly"
|
|
18677
|
-
color: "--color-readonly"
|
|
18827
|
+
borderColor: "--border-color-readonly"
|
|
18678
18828
|
},
|
|
18679
18829
|
":disabled": {
|
|
18680
18830
|
backgroundColor: "--background-color-disabled",
|
|
18681
|
-
borderColor: "--border-color-disabled"
|
|
18682
|
-
|
|
18831
|
+
borderColor: "--border-color-disabled"
|
|
18832
|
+
}
|
|
18833
|
+
};
|
|
18834
|
+
const RadioButtonStyleCSSVars = {
|
|
18835
|
+
...RadioStyleCSSVars,
|
|
18836
|
+
"padding": "--padding",
|
|
18837
|
+
"borderRadius": "--button-border-radius",
|
|
18838
|
+
"borderWidth": "--button-border-width",
|
|
18839
|
+
"borderColor": "--button-border-color",
|
|
18840
|
+
"backgroundColor": "--button-background-color",
|
|
18841
|
+
":hover": {
|
|
18842
|
+
backgroundColor: "--button-background-color-hover",
|
|
18843
|
+
borderColor: "--button-border-color-hover"
|
|
18844
|
+
},
|
|
18845
|
+
":read-only": {
|
|
18846
|
+
backgroundColor: "--button-background-color-readonly",
|
|
18847
|
+
borderColor: "--button-border-color-readonly"
|
|
18848
|
+
},
|
|
18849
|
+
":disabled": {
|
|
18850
|
+
backgroundColor: "--button-background-color-disabled",
|
|
18851
|
+
borderColor: "--button-border-color-disabled"
|
|
18683
18852
|
}
|
|
18684
18853
|
};
|
|
18685
18854
|
const RadioPseudoClasses = [":hover", ":active", ":focus", ":focus-visible", ":read-only", ":disabled", ":checked", ":-navi-loading"];
|
|
@@ -18708,6 +18877,8 @@ const InputRadioBasic = props => {
|
|
|
18708
18877
|
autoFocus,
|
|
18709
18878
|
onClick,
|
|
18710
18879
|
onInput,
|
|
18880
|
+
icon,
|
|
18881
|
+
appearance = icon ? "icon" : "radio",
|
|
18711
18882
|
color,
|
|
18712
18883
|
...rest
|
|
18713
18884
|
} = props;
|
|
@@ -18784,9 +18955,10 @@ const InputRadioBasic = props => {
|
|
|
18784
18955
|
}
|
|
18785
18956
|
});
|
|
18786
18957
|
const renderRadioMemoized = useCallback(renderRadio, [innerName, checked, innerRequired]);
|
|
18958
|
+
const boxRef = useRef();
|
|
18787
18959
|
useLayoutEffect(() => {
|
|
18788
|
-
const naviRadio =
|
|
18789
|
-
const luminance = resolveColorLuminance("var(--color)", naviRadio);
|
|
18960
|
+
const naviRadio = boxRef.current;
|
|
18961
|
+
const luminance = resolveColorLuminance("var(--accent-color)", naviRadio);
|
|
18790
18962
|
if (luminance < 0.3) {
|
|
18791
18963
|
naviRadio.setAttribute("data-dark", "");
|
|
18792
18964
|
} else {
|
|
@@ -18796,10 +18968,11 @@ const InputRadioBasic = props => {
|
|
|
18796
18968
|
return jsxs(Box, {
|
|
18797
18969
|
as: "span",
|
|
18798
18970
|
...remainingProps,
|
|
18799
|
-
ref:
|
|
18971
|
+
ref: boxRef,
|
|
18972
|
+
"data-appearance": appearance,
|
|
18800
18973
|
baseClassName: "navi_radio",
|
|
18801
18974
|
pseudoStateSelector: ".navi_native_field",
|
|
18802
|
-
styleCSSVars: RadioStyleCSSVars,
|
|
18975
|
+
styleCSSVars: appearance === "button" ? RadioButtonStyleCSSVars : RadioStyleCSSVars,
|
|
18803
18976
|
pseudoClasses: RadioPseudoClasses,
|
|
18804
18977
|
pseudoElements: RadioPseudoElements,
|
|
18805
18978
|
basePseudoState: {
|
|
@@ -18816,7 +18989,7 @@ const InputRadioBasic = props => {
|
|
|
18816
18989
|
color: "var(--loader-color)"
|
|
18817
18990
|
}), renderRadioMemoized, jsx("span", {
|
|
18818
18991
|
className: "navi_radio_field",
|
|
18819
|
-
children: jsxs("svg", {
|
|
18992
|
+
children: appearance === "radio" ? jsxs("svg", {
|
|
18820
18993
|
viewBox: "0 0 12 12",
|
|
18821
18994
|
"aria-hidden": "true",
|
|
18822
18995
|
preserveAspectRatio: "xMidYMid meet",
|
|
@@ -18840,7 +19013,7 @@ const InputRadioBasic = props => {
|
|
|
18840
19013
|
cy: "6",
|
|
18841
19014
|
r: "3.5"
|
|
18842
19015
|
})]
|
|
18843
|
-
})
|
|
19016
|
+
}) : icon
|
|
18844
19017
|
})]
|
|
18845
19018
|
});
|
|
18846
19019
|
};
|
|
@@ -20115,15 +20288,8 @@ const FormWithAction = props => {
|
|
|
20115
20288
|
// form.dispatchEvent(customEvent);
|
|
20116
20289
|
// };
|
|
20117
20290
|
|
|
20118
|
-
installImportMetaCss(import.meta);import.meta.css = /* css
|
|
20119
|
-
|
|
20120
|
-
.navi_radio_list {
|
|
20121
|
-
display: flex;
|
|
20122
|
-
flex-direction: column;
|
|
20123
|
-
}
|
|
20124
|
-
}
|
|
20125
|
-
`;
|
|
20126
|
-
const RadioList = forwardRef((props, ref) => {
|
|
20291
|
+
installImportMetaCss(import.meta);import.meta.css = /* css */``;
|
|
20292
|
+
const RadioList = props => {
|
|
20127
20293
|
const uiStateController = useUIGroupStateController(props, "radio_list", {
|
|
20128
20294
|
childComponentType: "radio",
|
|
20129
20295
|
aggregateChildStates: childUIStateControllers => {
|
|
@@ -20138,7 +20304,10 @@ const RadioList = forwardRef((props, ref) => {
|
|
|
20138
20304
|
}
|
|
20139
20305
|
});
|
|
20140
20306
|
const uiState = useUIState(uiStateController);
|
|
20141
|
-
const radioList = renderActionableComponent(props,
|
|
20307
|
+
const radioList = renderActionableComponent(props, {
|
|
20308
|
+
Basic: RadioListBasic,
|
|
20309
|
+
WithAction: RadioListWithAction
|
|
20310
|
+
});
|
|
20142
20311
|
return jsx(UIStateControllerContext.Provider, {
|
|
20143
20312
|
value: uiStateController,
|
|
20144
20313
|
children: jsx(UIStateContext.Provider, {
|
|
@@ -20146,9 +20315,9 @@ const RadioList = forwardRef((props, ref) => {
|
|
|
20146
20315
|
children: radioList
|
|
20147
20316
|
})
|
|
20148
20317
|
});
|
|
20149
|
-
}
|
|
20318
|
+
};
|
|
20150
20319
|
const Radio = InputRadio;
|
|
20151
|
-
const RadioListBasic =
|
|
20320
|
+
const RadioListBasic = props => {
|
|
20152
20321
|
const contextReadOnly = useContext(ReadOnlyContext);
|
|
20153
20322
|
const contextDisabled = useContext(DisabledContext);
|
|
20154
20323
|
const contextLoading = useContext(LoadingContext);
|
|
@@ -20162,19 +20331,15 @@ const RadioListBasic = forwardRef((props, ref) => {
|
|
|
20162
20331
|
required,
|
|
20163
20332
|
...rest
|
|
20164
20333
|
} = props;
|
|
20165
|
-
const innerRef = useRef();
|
|
20166
|
-
useImperativeHandle(ref, () => innerRef.current);
|
|
20167
20334
|
const innerLoading = loading || contextLoading;
|
|
20168
20335
|
const innerReadOnly = readOnly || contextReadOnly || innerLoading || uiStateController.readOnly;
|
|
20169
20336
|
const innerDisabled = disabled || contextDisabled;
|
|
20170
|
-
return jsx(
|
|
20337
|
+
return jsx(Box, {
|
|
20171
20338
|
"data-action": rest["data-action"],
|
|
20339
|
+
row: true,
|
|
20172
20340
|
...rest,
|
|
20173
|
-
|
|
20174
|
-
|
|
20175
|
-
"data-radio-list": true
|
|
20176
|
-
// eslint-disable-next-line react/no-unknown-property
|
|
20177
|
-
,
|
|
20341
|
+
baseClassName: "navi_radio_list",
|
|
20342
|
+
"data-radio-list": true,
|
|
20178
20343
|
onresetuistate: e => {
|
|
20179
20344
|
uiStateController.resetUIState(e);
|
|
20180
20345
|
},
|
|
@@ -20198,8 +20363,8 @@ const RadioListBasic = forwardRef((props, ref) => {
|
|
|
20198
20363
|
})
|
|
20199
20364
|
})
|
|
20200
20365
|
});
|
|
20201
|
-
}
|
|
20202
|
-
|
|
20366
|
+
};
|
|
20367
|
+
const RadioListWithAction = props => {
|
|
20203
20368
|
const uiStateController = useContext(UIStateControllerContext);
|
|
20204
20369
|
const uiState = useContext(UIStateContext);
|
|
20205
20370
|
const {
|
|
@@ -20216,7 +20381,6 @@ forwardRef((props, ref) => {
|
|
|
20216
20381
|
...rest
|
|
20217
20382
|
} = props;
|
|
20218
20383
|
const innerRef = useRef();
|
|
20219
|
-
useImperativeHandle(ref, () => innerRef.current);
|
|
20220
20384
|
const [boundAction] = useActionBoundToOneParam(action, uiState);
|
|
20221
20385
|
const {
|
|
20222
20386
|
loading: actionLoading
|
|
@@ -20257,7 +20421,8 @@ forwardRef((props, ref) => {
|
|
|
20257
20421
|
const radioListContainer = innerRef.current;
|
|
20258
20422
|
requestAction(radioListContainer, boundAction, {
|
|
20259
20423
|
event: e,
|
|
20260
|
-
requester: radio
|
|
20424
|
+
requester: radio,
|
|
20425
|
+
actionOrigin: "action_prop"
|
|
20261
20426
|
});
|
|
20262
20427
|
},
|
|
20263
20428
|
loading: loading || actionLoading,
|
|
@@ -20266,7 +20431,7 @@ forwardRef((props, ref) => {
|
|
|
20266
20431
|
children: children
|
|
20267
20432
|
})
|
|
20268
20433
|
});
|
|
20269
|
-
}
|
|
20434
|
+
};
|
|
20270
20435
|
|
|
20271
20436
|
const useRefArray = (items, keyFromItem) => {
|
|
20272
20437
|
const refMapRef = useRef(new Map());
|
|
@@ -23859,6 +24024,118 @@ const KeyboardShortcutAriaElement = ({
|
|
|
23859
24024
|
});
|
|
23860
24025
|
};
|
|
23861
24026
|
|
|
24027
|
+
installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
24028
|
+
@layer navi {
|
|
24029
|
+
.navi_clipboard_container {
|
|
24030
|
+
--height: 1.5em;
|
|
24031
|
+
--notif-spacing: 0.5em;
|
|
24032
|
+
}
|
|
24033
|
+
}
|
|
24034
|
+
|
|
24035
|
+
.navi_clipboard_container {
|
|
24036
|
+
position: relative;
|
|
24037
|
+
display: inline-flex;
|
|
24038
|
+
height: var(--height);
|
|
24039
|
+
align-items: center;
|
|
24040
|
+
|
|
24041
|
+
.navi_copied_notif {
|
|
24042
|
+
position: absolute;
|
|
24043
|
+
top: calc(-1 * var(--notif-spacing));
|
|
24044
|
+
right: 0;
|
|
24045
|
+
padding: 0.2em 0.5em;
|
|
24046
|
+
color: white;
|
|
24047
|
+
font-size: 80%;
|
|
24048
|
+
white-space: nowrap;
|
|
24049
|
+
background: black;
|
|
24050
|
+
border-radius: 3px;
|
|
24051
|
+
transform: translateY(-100%);
|
|
24052
|
+
}
|
|
24053
|
+
}
|
|
24054
|
+
`;
|
|
24055
|
+
const ButtonCopyToClipboard = ({
|
|
24056
|
+
children,
|
|
24057
|
+
...props
|
|
24058
|
+
}) => {
|
|
24059
|
+
const [copied, setCopied] = useState(false);
|
|
24060
|
+
const renderedRef = useRef();
|
|
24061
|
+
useEffect(() => {
|
|
24062
|
+
renderedRef.current = true;
|
|
24063
|
+
return () => {
|
|
24064
|
+
renderedRef.current = false;
|
|
24065
|
+
};
|
|
24066
|
+
}, []);
|
|
24067
|
+
return jsxs(Box, {
|
|
24068
|
+
class: "navi_clipboard_container",
|
|
24069
|
+
...props,
|
|
24070
|
+
children: [jsx(Box, {
|
|
24071
|
+
className: "navi_copied_notif",
|
|
24072
|
+
"aria-hidden": copied ? "false" : "true",
|
|
24073
|
+
opacity: copied ? 1 : 0,
|
|
24074
|
+
children: "Copi\xE9 !"
|
|
24075
|
+
}), jsx(Button, {
|
|
24076
|
+
className: "navi_copy_button",
|
|
24077
|
+
row: true,
|
|
24078
|
+
icon: true,
|
|
24079
|
+
revealOnInteraction: true,
|
|
24080
|
+
square: true,
|
|
24081
|
+
alignY: "center",
|
|
24082
|
+
expandY: true,
|
|
24083
|
+
borderRadius: "xs",
|
|
24084
|
+
action: async () => {
|
|
24085
|
+
await addToClipboard(children);
|
|
24086
|
+
setTimeout(() => {
|
|
24087
|
+
if (!renderedRef.current) {
|
|
24088
|
+
// do not call setState on unmounted component
|
|
24089
|
+
return;
|
|
24090
|
+
}
|
|
24091
|
+
setCopied(false);
|
|
24092
|
+
}, 1500);
|
|
24093
|
+
setCopied(true);
|
|
24094
|
+
},
|
|
24095
|
+
children: copied ? jsx(Icon, {
|
|
24096
|
+
color: "green",
|
|
24097
|
+
children: jsx(CopiedIcon, {})
|
|
24098
|
+
}) : jsx(Icon, {
|
|
24099
|
+
children: jsx(CopyIcon, {})
|
|
24100
|
+
})
|
|
24101
|
+
})]
|
|
24102
|
+
});
|
|
24103
|
+
};
|
|
24104
|
+
const addToClipboard = async text => {
|
|
24105
|
+
const type = "text/plain";
|
|
24106
|
+
const clipboardItemData = {
|
|
24107
|
+
[type]: text
|
|
24108
|
+
};
|
|
24109
|
+
const clipboardItem = new ClipboardItem(clipboardItemData);
|
|
24110
|
+
await window.navigator.clipboard.write([clipboardItem]);
|
|
24111
|
+
};
|
|
24112
|
+
const CopyIcon = () => jsxs("svg", {
|
|
24113
|
+
viewBox: "0 0 16 16",
|
|
24114
|
+
children: [jsx("path", {
|
|
24115
|
+
d: "M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"
|
|
24116
|
+
}), jsx("path", {
|
|
24117
|
+
d: "M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"
|
|
24118
|
+
})]
|
|
24119
|
+
});
|
|
24120
|
+
const CopiedIcon = () => jsx("svg", {
|
|
24121
|
+
viewBox: "0 0 16 16",
|
|
24122
|
+
children: jsx("path", {
|
|
24123
|
+
fill: "currentColor",
|
|
24124
|
+
d: "M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"
|
|
24125
|
+
})
|
|
24126
|
+
});
|
|
24127
|
+
|
|
24128
|
+
const Address = ({
|
|
24129
|
+
children,
|
|
24130
|
+
...props
|
|
24131
|
+
}) => {
|
|
24132
|
+
return jsx(Text, {
|
|
24133
|
+
as: "address",
|
|
24134
|
+
...props,
|
|
24135
|
+
children: children
|
|
24136
|
+
});
|
|
24137
|
+
};
|
|
24138
|
+
|
|
23862
24139
|
const CSS_VAR_NAME = "--x-color-contrasting";
|
|
23863
24140
|
|
|
23864
24141
|
const useContrastingColor = (ref, backgroundElementSelector) => {
|
|
@@ -24114,7 +24391,255 @@ const Caption = ({
|
|
|
24114
24391
|
});
|
|
24115
24392
|
};
|
|
24116
24393
|
|
|
24394
|
+
/**
|
|
24395
|
+
* Example of how you'd use this:
|
|
24396
|
+
* <code-block data-language="HTML" data-escaped="true">
|
|
24397
|
+
* <h1>Your HTML here. Any HTML should be escaped</h1>
|
|
24398
|
+
* </code-block>
|
|
24399
|
+
*
|
|
24400
|
+
* https://github.com/TheWebTech/hs-code-block-web-component/tree/main
|
|
24401
|
+
*/
|
|
24402
|
+
|
|
24403
|
+
const CodeBlock = ({
|
|
24404
|
+
language,
|
|
24405
|
+
escaped = false,
|
|
24406
|
+
children,
|
|
24407
|
+
...props
|
|
24408
|
+
}) => {
|
|
24409
|
+
return jsx("code-block", {
|
|
24410
|
+
"data-language": language,
|
|
24411
|
+
"data-escaped": escaped ? "" : null,
|
|
24412
|
+
...props,
|
|
24413
|
+
children: children
|
|
24414
|
+
});
|
|
24415
|
+
};
|
|
24416
|
+
(() => {
|
|
24417
|
+
const css = /* css */`
|
|
24418
|
+
*[aria-hidden="true"] {
|
|
24419
|
+
display: none;
|
|
24420
|
+
}
|
|
24421
|
+
|
|
24422
|
+
.clipboard_container {
|
|
24423
|
+
display: flex;
|
|
24424
|
+
padding: 8px;
|
|
24425
|
+
align-items: center;
|
|
24426
|
+
gap: 5px;
|
|
24427
|
+
}
|
|
24428
|
+
|
|
24429
|
+
#copied_notif {
|
|
24430
|
+
padding: 0.2em 0.5em;
|
|
24431
|
+
color: white;
|
|
24432
|
+
font-size: 80%;
|
|
24433
|
+
background: black;
|
|
24434
|
+
border-radius: 3px;
|
|
24435
|
+
}
|
|
24436
|
+
|
|
24437
|
+
button {
|
|
24438
|
+
width: 32px;
|
|
24439
|
+
height: 32px;
|
|
24440
|
+
background: none;
|
|
24441
|
+
background-color: rgb(246, 248, 250);
|
|
24442
|
+
border: none;
|
|
24443
|
+
border-width: 1px;
|
|
24444
|
+
border-style: solid;
|
|
24445
|
+
border-color: rgb(209, 217, 224);
|
|
24446
|
+
border-radius: 6px;
|
|
24447
|
+
cursor: pointer;
|
|
24448
|
+
}
|
|
24449
|
+
|
|
24450
|
+
button:hover {
|
|
24451
|
+
background-color: rgb(239, 242, 245);
|
|
24452
|
+
}
|
|
24453
|
+
`;
|
|
24454
|
+
const html = /* html */`<style>
|
|
24455
|
+
${css}
|
|
24456
|
+
</style>
|
|
24457
|
+
<div class="clipboard_container">
|
|
24458
|
+
<div id="copied_notif" aria-hidden="true">Copied !</div>
|
|
24459
|
+
<button id="copy_button">
|
|
24460
|
+
<svg
|
|
24461
|
+
id="copy_icon"
|
|
24462
|
+
aria-hidden="true"
|
|
24463
|
+
viewBox="0 0 16 16"
|
|
24464
|
+
width="16"
|
|
24465
|
+
height="16"
|
|
24466
|
+
>
|
|
24467
|
+
<path
|
|
24468
|
+
d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"
|
|
24469
|
+
></path>
|
|
24470
|
+
<path
|
|
24471
|
+
d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"
|
|
24472
|
+
></path>
|
|
24473
|
+
</svg>
|
|
24474
|
+
<svg
|
|
24475
|
+
id="copied_icon"
|
|
24476
|
+
aria-hidden="true"
|
|
24477
|
+
viewBox="0 0 16 16"
|
|
24478
|
+
width="16"
|
|
24479
|
+
height="16"
|
|
24480
|
+
>
|
|
24481
|
+
<path
|
|
24482
|
+
d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"
|
|
24483
|
+
></path>
|
|
24484
|
+
</svg>
|
|
24485
|
+
</button>
|
|
24486
|
+
</div>`;
|
|
24487
|
+
class ClipboardCopy extends HTMLElement {
|
|
24488
|
+
constructor() {
|
|
24489
|
+
super();
|
|
24490
|
+
const root = this.attachShadow({
|
|
24491
|
+
mode: "open"
|
|
24492
|
+
});
|
|
24493
|
+
root.innerHTML = html;
|
|
24494
|
+
}
|
|
24495
|
+
connectedCallback() {
|
|
24496
|
+
const valueToCopy = this.getAttribute("value");
|
|
24497
|
+
const shadowRoot = this.shadowRoot;
|
|
24498
|
+
const button = shadowRoot.querySelector("button");
|
|
24499
|
+
const copyIcon = shadowRoot.querySelector("#copy_icon");
|
|
24500
|
+
const copiedIcon = shadowRoot.querySelector("#copied_icon");
|
|
24501
|
+
const copiedNotif = shadowRoot.querySelector("#copied_notif");
|
|
24502
|
+
copyIcon.removeAttribute("aria-hidden");
|
|
24503
|
+
const copy = async () => {
|
|
24504
|
+
await addToClipboard(valueToCopy);
|
|
24505
|
+
copiedNotif.removeAttribute("aria-hidden");
|
|
24506
|
+
copyIcon.setAttribute("aria-hidden", "true");
|
|
24507
|
+
copiedIcon.setAttribute("aria-hidden", "false");
|
|
24508
|
+
setTimeout(() => {
|
|
24509
|
+
copiedNotif.setAttribute("aria-hidden", "true");
|
|
24510
|
+
copyIcon.setAttribute("aria-hidden", "false");
|
|
24511
|
+
copiedIcon.setAttribute("aria-hidden", "true");
|
|
24512
|
+
}, 1500);
|
|
24513
|
+
};
|
|
24514
|
+
button.onclick = () => {
|
|
24515
|
+
copy();
|
|
24516
|
+
};
|
|
24517
|
+
}
|
|
24518
|
+
}
|
|
24519
|
+
customElements.define("clipboard-copy", ClipboardCopy);
|
|
24520
|
+
const addToClipboard = async text => {
|
|
24521
|
+
const type = "text/plain";
|
|
24522
|
+
const clipboardItemData = {
|
|
24523
|
+
[type]: text
|
|
24524
|
+
};
|
|
24525
|
+
const clipboardItem = new ClipboardItem(clipboardItemData);
|
|
24526
|
+
await window.navigator.clipboard.write([clipboardItem]);
|
|
24527
|
+
};
|
|
24528
|
+
})();
|
|
24529
|
+
(() => {
|
|
24530
|
+
/*
|
|
24531
|
+
:host {
|
|
24532
|
+
display: block;
|
|
24533
|
+
}
|
|
24534
|
+
:host code[class*="language-"], :host pre[class*="language-"]{
|
|
24535
|
+
margin-top: 0;
|
|
24536
|
+
}
|
|
24537
|
+
*/
|
|
24538
|
+
|
|
24539
|
+
const css = /* css */`
|
|
24540
|
+
#code_block {
|
|
24541
|
+
position: relative;
|
|
24542
|
+
}
|
|
24543
|
+
|
|
24544
|
+
#pre {
|
|
24545
|
+
margin-top: 16px;
|
|
24546
|
+
margin-right: 0;
|
|
24547
|
+
margin-bottom: 16px;
|
|
24548
|
+
margin-left: 0;
|
|
24549
|
+
padding: 16px;
|
|
24550
|
+
font-size: 86%;
|
|
24551
|
+
background: #333;
|
|
24552
|
+
}
|
|
24553
|
+
`;
|
|
24554
|
+
const html = /* html */`<style>
|
|
24555
|
+
${css}
|
|
24556
|
+
</style>
|
|
24557
|
+
<div id="code_block">
|
|
24558
|
+
<pre id="pre"><code></code></pre>
|
|
24559
|
+
<div
|
|
24560
|
+
id="clipboard_copy_container"
|
|
24561
|
+
style="position: absolute; right: 0; top: 0"
|
|
24562
|
+
>
|
|
24563
|
+
<clipboard-copy></clipboard-copy>
|
|
24564
|
+
</div>
|
|
24565
|
+
</div>
|
|
24566
|
+
`;
|
|
24567
|
+
let loadPromise;
|
|
24568
|
+
const loadPrism = () => {
|
|
24569
|
+
if (loadPromise) {
|
|
24570
|
+
return loadPromise;
|
|
24571
|
+
}
|
|
24572
|
+
// https://prismjs.com/#basic-usage
|
|
24573
|
+
const scriptLoadPromise = new Promise((resolve, reject) => {
|
|
24574
|
+
window.Prism = window.Prism || {};
|
|
24575
|
+
window.Prism.manual = true;
|
|
24576
|
+
const script = document.createElement("script");
|
|
24577
|
+
script.src = "https://cdn.jsdelivr.net/npm/prismjs";
|
|
24578
|
+
script.onload = () => {
|
|
24579
|
+
resolve(window.Prism);
|
|
24580
|
+
};
|
|
24581
|
+
script.onerror = error => {
|
|
24582
|
+
reject(error);
|
|
24583
|
+
};
|
|
24584
|
+
document.head.appendChild(script);
|
|
24585
|
+
});
|
|
24586
|
+
const cssInjectionPromise = (async () => {
|
|
24587
|
+
const prismCssUrl = "https://cdn.jsdelivr.net/npm/prismjs/themes/prism-tomorrow.css?inline";
|
|
24588
|
+
const response = await window.fetch(prismCssUrl, {
|
|
24589
|
+
method: "GET"
|
|
24590
|
+
});
|
|
24591
|
+
const cssText = await response.text();
|
|
24592
|
+
const cssStylesheet = new CSSStyleSheet({
|
|
24593
|
+
baseUrl: prismCssUrl
|
|
24594
|
+
});
|
|
24595
|
+
cssStylesheet.replaceSync(cssText);
|
|
24596
|
+
return cssStylesheet;
|
|
24597
|
+
})();
|
|
24598
|
+
loadPromise = Promise.all([scriptLoadPromise, cssInjectionPromise]);
|
|
24599
|
+
return loadPromise;
|
|
24600
|
+
};
|
|
24601
|
+
class CodeBlock extends HTMLElement {
|
|
24602
|
+
constructor() {
|
|
24603
|
+
super();
|
|
24604
|
+
const root = this.attachShadow({
|
|
24605
|
+
mode: "open"
|
|
24606
|
+
});
|
|
24607
|
+
root.innerHTML = html;
|
|
24608
|
+
loadPrism();
|
|
24609
|
+
}
|
|
24610
|
+
async connectedCallback() {
|
|
24611
|
+
const shadowRoot = this.shadowRoot;
|
|
24612
|
+
const language = this.getAttribute("lang").toLowerCase();
|
|
24613
|
+
const isEscaped = this.hasAttribute("data-escaped");
|
|
24614
|
+
const addCopyButton = this.hasAttribute("data-copy-button");
|
|
24615
|
+
let code = this.innerHTML.trimStart();
|
|
24616
|
+
this.innerHTML = "";
|
|
24617
|
+
const codeNode = shadowRoot.querySelector("code");
|
|
24618
|
+
codeNode.className = `language-${language}`;
|
|
24619
|
+
codeNode.textContent = isEscaped ? unescapeHTML(code) : code;
|
|
24620
|
+
if (addCopyButton) {
|
|
24621
|
+
const clipboardCopy = shadowRoot.querySelector("clipboard-copy");
|
|
24622
|
+
clipboardCopy.setAttribute("value", isEscaped ? unescapeHTML(code) : code);
|
|
24623
|
+
}
|
|
24624
|
+
const [Prism, prismCssStyleSheet] = await loadPrism();
|
|
24625
|
+
shadowRoot.adoptedStyleSheets.push(prismCssStyleSheet);
|
|
24626
|
+
Prism.highlightAllUnder(shadowRoot);
|
|
24627
|
+
}
|
|
24628
|
+
}
|
|
24629
|
+
customElements.define("code-block", CodeBlock);
|
|
24630
|
+
const escape = document.createElement("textarea");
|
|
24631
|
+
function unescapeHTML(html) {
|
|
24632
|
+
escape.innerHTML = html;
|
|
24633
|
+
return escape.textContent;
|
|
24634
|
+
}
|
|
24635
|
+
})();
|
|
24636
|
+
|
|
24117
24637
|
const Code = props => {
|
|
24638
|
+
if (props.language) {
|
|
24639
|
+
return jsx(CodeBlock, {
|
|
24640
|
+
...props
|
|
24641
|
+
});
|
|
24642
|
+
}
|
|
24118
24643
|
if (props.box) {
|
|
24119
24644
|
return jsx(CodeBox, {
|
|
24120
24645
|
...props
|
|
@@ -24921,5 +25446,5 @@ const UserSvg = () => jsx("svg", {
|
|
|
24921
25446
|
})
|
|
24922
25447
|
});
|
|
24923
25448
|
|
|
24924
|
-
export { ActionRenderer, ActiveKeyboardShortcuts, BadgeCount, Box, Button, Caption, CheckSvg, Checkbox, CheckboxList, Code, Col, Colgroup, ConstructionSvg, Details, DialogLayout, Editable, ErrorBoundaryContext, ExclamationSvg, EyeClosedSvg, EyeSvg, Form, HeartSvg, HomeSvg, Icon, Image, Input, Label, Link, LinkAnchorSvg, LinkBlankTargetSvg, MessageBox, Paragraph, Radio, RadioList, Route, RouteLink, Routes, RowNumberCol, RowNumberTableCell, SINGLE_SPACE_CONSTRAINT, SVGMaskOverlay, SearchSvg, Select, SelectionContext, Separator, SettingsSvg, StarSvg, SummaryMarker, Svg, Tab, TabList, Table, TableCell, Tbody, Text, Thead, Title, Tr, UITransition, UserSvg, ViewportLayout, actionIntegratedVia, addCustomMessage, compareTwoJsValues, createAction, createAvailableConstraint, createRequestCanceller, createSelectionKeyboardShortcuts, enableDebugActions, enableDebugOnDocumentLoading, forwardActionRequested, installCustomConstraintValidation, isCellSelected, isColumnSelected, isRowSelected, localStorageSignal, navBack, navForward, navTo, openCallout, rawUrlPart, reload, removeCustomMessage, requestAction, rerunActions, resource, setBaseUrl, setupRoutes, stateSignal, stopLoad, stringifyTableSelectionValue, updateActions, useActionData, useActionStatus, useActiveRouteInfo, useCalloutClose, useCellsAndColumns, useConstraintValidityState, useDependenciesDiff, useDocumentResource, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useNavState$1 as useNavState, useRouteStatus, useRunOnMount, useSelectableElement, useSelectionController, useSignalSync, useStateArray, useTitleLevel, useUrlSearchParam, valueInLocalStorage };
|
|
25449
|
+
export { ActionRenderer, ActiveKeyboardShortcuts, Address, BadgeCount, Box, Button, ButtonCopyToClipboard, Caption, CheckSvg, Checkbox, CheckboxList, Code, Col, Colgroup, ConstructionSvg, Details, DialogLayout, Editable, ErrorBoundaryContext, ExclamationSvg, EyeClosedSvg, EyeSvg, Form, HeartSvg, HomeSvg, Icon, Image, Input, Label, Link, LinkAnchorSvg, LinkBlankTargetSvg, MessageBox, Paragraph, Radio, RadioList, Route, RouteLink, Routes, RowNumberCol, RowNumberTableCell, SINGLE_SPACE_CONSTRAINT, SVGMaskOverlay, SearchSvg, Select, SelectionContext, Separator, SettingsSvg, StarSvg, SummaryMarker, Svg, Tab, TabList, Table, TableCell, Tbody, Text, Thead, Title, Tr, UITransition, UserSvg, ViewportLayout, actionIntegratedVia, addCustomMessage, compareTwoJsValues, createAction, createAvailableConstraint, createRequestCanceller, createSelectionKeyboardShortcuts, enableDebugActions, enableDebugOnDocumentLoading, forwardActionRequested, installCustomConstraintValidation, isCellSelected, isColumnSelected, isRowSelected, localStorageSignal, navBack, navForward, navTo, openCallout, rawUrlPart, reload, removeCustomMessage, requestAction, rerunActions, resource, setBaseUrl, setupRoutes, stateSignal, stopLoad, stringifyTableSelectionValue, updateActions, useActionData, useActionStatus, useActiveRouteInfo, useCalloutClose, useCellsAndColumns, useConstraintValidityState, useDependenciesDiff, useDocumentResource, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useNavState$1 as useNavState, useRouteStatus, useRunOnMount, useSelectableElement, useSelectionController, useSignalSync, useStateArray, useTitleLevel, useUrlSearchParam, valueInLocalStorage };
|
|
24925
25450
|
//# sourceMappingURL=jsenv_navi.js.map
|