@limetech/lime-elements 40.17.0 → 40.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/heading-level-BxCuIKkm.js +14 -0
  3. package/dist/cjs/limel-collapsible-section.cjs.entry.js +4 -9
  4. package/dist/cjs/limel-file-viewer.cjs.entry.js +422 -248
  5. package/dist/cjs/limel-form-header.cjs.entry.js +1 -1
  6. package/dist/cjs/limel-form.cjs.entry.js +23 -20
  7. package/dist/collection/components/collapsible-section/collapsible-section.js +11 -9
  8. package/dist/collection/components/form/form.js +8 -6
  9. package/dist/collection/components/form/form.test-schemas.js +68 -0
  10. package/dist/collection/components/form/templates/array-field-collapsible-item.js +13 -3
  11. package/dist/collection/components/form/templates/heading-level.js +0 -10
  12. package/dist/collection/components/form/templates/object-field.js +6 -3
  13. package/dist/collection/components/form-header/form-header.js +3 -3
  14. package/dist/collection/global/shared-types/heading-level.types.js +1 -0
  15. package/dist/collection/interface.js +1 -0
  16. package/dist/collection/util/heading-level.js +10 -0
  17. package/dist/esm/heading-level-B3C0kDpZ.js +12 -0
  18. package/dist/esm/limel-collapsible-section.entry.js +2 -7
  19. package/dist/esm/limel-file-viewer.entry.js +422 -248
  20. package/dist/esm/limel-form-header.entry.js +1 -1
  21. package/dist/esm/limel-form.entry.js +21 -18
  22. package/dist/lime-elements/lime-elements.esm.js +1 -1
  23. package/dist/lime-elements/p-49a53f0b.entry.js +1 -0
  24. package/dist/lime-elements/{p-72907ffd.entry.js → p-68129487.entry.js} +1 -1
  25. package/dist/lime-elements/{p-9436aba6.entry.js → p-74db50a8.entry.js} +4 -4
  26. package/dist/lime-elements/p-B3C0kDpZ.js +1 -0
  27. package/dist/lime-elements/p-e8255f0b.entry.js +1 -0
  28. package/dist/types/components/collapsible-section/collapsible-section.d.ts +2 -1
  29. package/dist/types/components/form/form.d.ts +4 -2
  30. package/dist/types/components/form/form.test-schemas.d.ts +3 -0
  31. package/dist/types/components/form/form.types.d.ts +0 -6
  32. package/dist/types/components/form/row/row.d.ts +1 -1
  33. package/dist/types/components/form/templates/array-field-collapsible-item.d.ts +5 -1
  34. package/dist/types/components/form/templates/heading-level.d.ts +1 -6
  35. package/dist/types/components/form/templates/object-field.d.ts +2 -0
  36. package/dist/types/components/form-header/form-header.d.ts +1 -1
  37. package/dist/types/components.d.ts +9 -7
  38. package/dist/types/global/shared-types/heading-level.types.d.ts +7 -0
  39. package/dist/types/interface.d.ts +2 -1
  40. package/dist/types/util/heading-level.d.ts +7 -0
  41. package/package.json +2 -2
  42. package/dist/lime-elements/p-1d13245d.entry.js +0 -1
  43. package/dist/lime-elements/p-e6be5819.entry.js +0 -1
@@ -0,0 +1 @@
1
+ function e(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=1&&e<=6}export{e as i}
@@ -0,0 +1 @@
1
+ import{r as e,c as o,h as t,a as i}from"./p-BU9IJqli.js";import{d as n}from"./p-z_E3sq3p.js";import{m as s,r}from"./p-CIf8aGSd.js";import{c as a}from"./p-BrjD-ITe.js";import{b as l,d as c,g as d}from"./p-CgNJbSP4.js";import{t as p}from"./p-B26k4gw8.js";import{i as h}from"./p-B3C0kDpZ.js";import"./p-ChagAaNf.js";const g=class{constructor(i){e(this,i),this.open=o(this,"open",7),this.close=o(this,"close",7),this.action=o(this,"action",7),this.isOpen=!1,this.headingLevel=2,this.invalid=!1,this.language="en",this.bodyId=a(),this.headingId=a(),this.onClick=()=>{this.handleInteraction()},this.handleInteraction=()=>{this.isOpen=!this.isOpen,this.isOpen?(this.open.emit(),setTimeout(n,100)):this.close.emit()},this.renderExpandCollapseSign=()=>t("div",{class:"expand-icon",role:"presentation","aria-hidden":"true"},t("div",{class:"line"}),t("div",{class:"line"}),t("div",{class:"line"}),t("div",{class:"line"})),this.renderIcon=()=>{if(!this.icon)return;const e=d(this.icon),o=l(this.icon),i=c(this.icon);return t("limel-icon",{name:e,"aria-label":i,"aria-hidden":i?null:"true",style:{color:`${o}`}})},this.renderHeading=()=>{if(!this.header)return;const e=`h${this.getHeadingLevel()}`;return t(e,{class:"title mdc-typography mdc-typography--headline2",id:this.headingId},this.header)},this.renderActions=()=>{if(this.actions)return t("div",{class:"actions"},this.actions.map(this.renderActionButton))},this.renderActionButton=e=>t("limel-icon-button",{icon:e.icon,label:e.label,disabled:e.disabled,onClick:this.handleActionClick(e)}),this.handleActionClick=e=>o=>{o.stopPropagation(),this.action.emit(e)},this.getCollapsibleSectionAriaLabel=()=>p.get(this.isOpen?"collapsible-section.close":"collapsible-section.open",this.language,{header:this.header?`"${this.header}"`:" "})}componentWillLoad(){this.warnIfHeadingLevelIsInvalid()}handleHeadingLevelChange(){this.warnIfHeadingLevelIsInvalid()}componentDidRender(){const e=this.host.shadowRoot.querySelector(".open-close-toggle");s(e)}disconnectedCallback(){const e=this.host.shadowRoot.querySelector(".open-close-toggle");r(e)}render(){return t("section",{key:"ff18dacc5e74d3bd8d16da55be3e5340922acf86",class:this.isOpen?"open":"","aria-invalid":this.invalid,"aria-labelledby":this.header?this.headingId:null},t("header",{key:"f4dba35493c7ce7344ff34d2fbaeeb769f8c87eb"},t("button",{key:"d3a632b4002d01774c9bb88f250be4e196340ef3",class:"open-close-toggle",onClick:this.onClick,"aria-controls":this.bodyId,"aria-expanded":this.isOpen?"true":"false","aria-label":this.getCollapsibleSectionAriaLabel(),type:"button"}),this.renderExpandCollapseSign(),this.renderIcon(),this.renderHeading(),t("div",{key:"8d8489917d5e1bfa8de3cca8294651f448c8129c",class:"divider-line",role:"presentation"}),this.renderHeaderSlot(),this.renderActions()),t("div",{key:"fd7e13cf3bd26815d62c3fbac0ef04ed4db364b5",class:"body",inert:!this.isOpen,"aria-hidden":String(!this.isOpen),id:this.bodyId,role:"region"},t("slot",{key:"90ed08286c1091f5c5c5feec827729cfa65588fc"})))}getHeadingLevel(){return h(this.headingLevel)?this.headingLevel:2}warnIfHeadingLevelIsInvalid(){h(this.headingLevel)||console.warn(`limel-collapsible-section: headingLevel must be a whole number from 1 to 6, but it is ${this.headingLevel}. The heading is drawn as an h2 instead.`)}renderHeaderSlot(){return t("slot",{name:"header"})}get host(){return i(this)}static get watchers(){return{headingLevel:[{handleHeadingLevelChange:0}]}}};g.style='@charset "UTF-8";.expand-icon{position:relative;display:flex;align-items:center;justify-content:center;height:1.875rem;margin:0 0 0 0.5rem;width:0.75rem;flex-shrink:0}.line{position:absolute;inset:auto;margin:auto;width:100%;border-radius:1rem;height:0.125rem}.line:first-of-type,.line:last-of-type{transition:opacity 0.2s ease 0.1s, transform 0.4s ease 0.3s;opacity:0;background-color:var(--header-stroke-color, rgb(var(--contrast-900)))}.line:nth-of-type(2){transform:translate3d(0, 0.25rem, 0) rotate(90deg)}.line:nth-of-type(3){transform:translate3d(0, -0.25rem, 0) rotate(-90deg)}.line:nth-of-type(2),.line:nth-of-type(3){transition:opacity 0.2s ease, transform 0.18s ease}.line:nth-of-type(2):before,.line:nth-of-type(2):after,.line:nth-of-type(3):before,.line:nth-of-type(3):after{content:"";position:absolute;inset:0;margin:auto;width:50%;height:100%;border-radius:inherit;background-color:var(--header-stroke-color, rgb(var(--contrast-900)))}.line:nth-of-type(2):before,.line:nth-of-type(3):before{transform:translate3d(0, -0.1rem, 0) rotate(45deg)}.line:nth-of-type(2):after,.line:nth-of-type(3):after{transform:translate3d(0, 0.1rem, 0) rotate(-45deg)}.open-close-toggle:hover+.expand-icon .line:first-of-type,.open-close-toggle:hover+.expand-icon .line:last-of-type,.open-close-toggle:focus-visible+.expand-icon .line:first-of-type,.open-close-toggle:focus-visible+.expand-icon .line:last-of-type{transition:opacity 0.8s ease 0.4s, transform 0.4s ease 0.3s;opacity:1}.open-close-toggle:hover+.expand-icon .line:first-of-type,.open-close-toggle:focus-visible+.expand-icon .line:first-of-type{transform:rotate3d(0, 0, 1, 0deg)}.open-close-toggle:hover+.expand-icon .line:last-of-type,.open-close-toggle:focus-visible+.expand-icon .line:last-of-type{transform:rotate3d(0, 0, 1, 0deg)}.open-close-toggle:hover+.expand-icon .line:nth-of-type(2),.open-close-toggle:hover+.expand-icon .line:nth-of-type(3),.open-close-toggle:focus-visible+.expand-icon .line:nth-of-type(2),.open-close-toggle:focus-visible+.expand-icon .line:nth-of-type(3){transition:opacity 0.5s ease 0.4s, transform 0.7s cubic-bezier(0.85, 0.11, 0.14, 1.35) 0.2s}.open-close-toggle:hover+.expand-icon .line:nth-of-type(2),.open-close-toggle:focus-visible+.expand-icon .line:nth-of-type(2){transform:translate3d(0, 0.5rem, 0) rotate(90deg);opacity:0.4}.open-close-toggle:hover+.expand-icon .line:nth-of-type(3),.open-close-toggle:focus-visible+.expand-icon .line:nth-of-type(3){transform:translate3d(0, -0.5rem, 0) rotate(-90deg);opacity:0.4}section.open .line:first-of-type,section.open .line:last-of-type{transition:opacity 0.2s ease 0.1s, transform 0.4s ease 0.3s;opacity:1}section.open .line:first-of-type{transform:rotate3d(0, 0, 1, 0deg)}section.open .line:last-of-type{transform:rotate3d(0, 0, 1, 0deg)}section.open .line:nth-of-type(2),section.open .line:nth-of-type(3){transition:opacity 1s ease, transform 0.4s ease}section.open .line:nth-of-type(2){transform:translate3d(0, 1rem, 0) rotate(90deg);opacity:0}section.open .line:nth-of-type(3){transform:translate3d(0, -1rem, 0) rotate(-90deg);opacity:0}section.open .open-close-toggle:hover+.expand-icon .line:first-of-type,section.open .open-close-toggle:hover+.expand-icon .line:last-of-type,section.open .open-close-toggle:focus-visible+.expand-icon .line:first-of-type,section.open .open-close-toggle:focus-visible+.expand-icon .line:last-of-type{transition:opacity 0.2s ease 0.4s, transform 0.4s cubic-bezier(0.85, 0.11, 0.14, 1.35) 0.2s}section.open .open-close-toggle:hover+.expand-icon .line:first-of-type,section.open .open-close-toggle:focus-visible+.expand-icon .line:first-of-type{transform:rotate3d(0, 0, 1, 45deg)}section.open .open-close-toggle:hover+.expand-icon .line:last-of-type,section.open .open-close-toggle:focus-visible+.expand-icon .line:last-of-type{transform:rotate3d(0, 0, 1, -45deg)}section.open .open-close-toggle:hover+.expand-icon .line:nth-of-type(2),section.open .open-close-toggle:focus-visible+.expand-icon .line:nth-of-type(2){transform:translate3d(0, 1rem, 0) rotate(90deg);opacity:0}section.open .open-close-toggle:hover+.expand-icon .line:nth-of-type(3),section.open .open-close-toggle:focus-visible+.expand-icon .line:nth-of-type(3){transform:translate3d(0, -1rem, 0) rotate(-90deg);opacity:0}:host(limel-collapsible-section){--border-radius-of-header:0.75rem;display:block}:host([hidden]){display:none}button.open-close-toggle{appearance:none;background:none;border:none;padding:0;margin:0;font:inherit;color:inherit;text-align:inherit;position:absolute;inset:0;width:100%}button.open-close-toggle:focus{outline:none}button.open-close-toggle:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}button.open-close-toggle{transition:background-color 0.4s ease, border-radius 0.1s ease;cursor:pointer;z-index:-1;background-color:var(--closed-header-background-color, rgb(var(--contrast-200)));border-radius:var(--border-radius-of-header)}button.open-close-toggle:hover,button.open-close-toggle:focus-visible{background-color:var(--open-header-background-color, rgb(var(--contrast-300)))}section.open button.open-close-toggle{background-color:var(--open-header-background-color, rgb(var(--contrast-100)));border-radius:var(--border-radius-of-header) var(--border-radius-of-header) var(--limel-cs-open-header-bottom-border-radius, 0) var(--limel-cs-open-header-bottom-border-radius, 0)}section.open button.open-close-toggle:hover,section.open button.open-close-toggle:focus-visible{background-color:var(--open-header-background-color, rgb(var(--contrast-300)))}.title,.divider-line,.expand-icon{pointer-events:none}section{transition:box-shadow 0.4s ease;border-radius:var(--border-radius-of-header)}section[aria-invalid]:not([aria-invalid=false]){--header-stroke-color:rgb(var(--color-red-default)) !important}section[aria-invalid]:not([aria-invalid=false]):not(.open){box-shadow:0 0 0 1px rgb(var(--color-red-default))}header{isolation:isolate;position:relative;align-items:center;display:flex;justify-content:space-between;gap:0.5rem;padding-left:0.5rem;height:2.5rem}limel-icon{width:1.5rem;flex-shrink:0}.title{font-size:1rem;font-weight:300;color:var(--limel-theme-on-surface-color);justify-self:flex-start;user-select:none;height:auto;max-height:3rem;line-height:1.2rem;display:-webkit-box;overflow:hidden;white-space:normal;-webkit-box-orient:vertical;-webkit-line-clamp:2}.divider-line{transition:opacity 0.3s ease 0.3s;flex-grow:1;height:0.125rem;border-radius:1rem;background-color:var(--header-stroke-color, rgb(var(--contrast-900)));opacity:0;margin-right:0.5rem}section.open .divider-line{opacity:0.16}.actions{justify-self:flex-end;flex-shrink:0}::slotted([slot=header]){margin-right:0.5rem}.body{background-color:var(--body-background-color, var(--contrast-100));padding-left:var(--body-padding, 1.25rem);padding-right:var(--body-padding, 1.25rem);border-radius:0 0 var(--border-radius-of-header) var(--border-radius-of-header)}.body{transition:grid-template-rows var(--limel-cs-grid-template-rows-transition-speed) cubic-bezier(1, 0.09, 0, 0.89);display:grid;grid-template-rows:var(--limel-cs-grid-template-rows)}.body slot{transition:opacity var(--limel-cs-opacity-transition-speed) ease var(--limel-cs-opacity-transition-delay);display:block;overflow:hidden}:host(limel-collapsible-section:not([is-open])){--limel-cs-opacity-transition-speed:0.1s;--limel-cs-opacity-transition-delay:0s;--limel-cs-grid-template-rows-transition-speed:0.3s;--limel-cs-grid-template-rows:0fr}:host(limel-collapsible-section:not([is-open])) slot{opacity:0}:host(limel-collapsible-section[is-open]){--limel-cs-opacity-transition-speed:0.4s;--limel-cs-opacity-transition-delay:0.3s;--limel-cs-grid-template-rows-transition-speed:0.46s;--limel-cs-grid-template-rows:1fr}:host(limel-collapsible-section[is-open]) slot{opacity:1}header:hover+.body,header:has(.open-close-toggle:hover)+.body,header:has(.open-close-toggle:focus-visible)+.body{will-change:grid-template-rows}header:hover+.body slot,header:has(.open-close-toggle:hover)+.body slot,header:has(.open-close-toggle:focus-visible)+.body slot{will-change:opacity}';export{g as limel_collapsible_section}
@@ -1,6 +1,7 @@
1
1
  import { Action } from './action';
2
2
  import { Icon, IconName } from '../../global/shared-types/icon.types';
3
3
  import { Languages } from '../date-picker/date.types';
4
+ import { HeadingLevel } from '../../global/shared-types/heading-level.types';
4
5
  /**
5
6
  * A collapsible section can be used to group related content together
6
7
  * and hide the group when not needed.
@@ -40,7 +41,7 @@ export declare class CollapsibleSection {
40
41
  * For example, when the section is below an `h2`, set it to `3`.
41
42
  * It does not change how the heading looks.
42
43
  */
43
- headingLevel: 1 | 2 | 3 | 4 | 5 | 6;
44
+ headingLevel: HeadingLevel;
44
45
  /**
45
46
  * Icon to display in the header of the section
46
47
  */
@@ -1,5 +1,6 @@
1
1
  import { EventEmitter } from '../../stencil-public-runtime';
2
- import { FormError, FormSchema, HeadingLevel, ValidationError, ValidationStatus } from './form.types';
2
+ import { FormError, FormSchema, ValidationError, ValidationStatus } from './form.types';
3
+ import { HeadingLevel } from '../../global/shared-types/heading-level.types';
3
4
  /**
4
5
  * @exampleComponent limel-example-form
5
6
  * @exampleComponent limel-example-nested-form
@@ -55,7 +56,8 @@ export declare class Form {
55
56
  /**
56
57
  * The level, from `1` to `6`, of the topmost headings in the form.
57
58
  * The headings of the sections inside them get one level more for each
58
- * level of nesting, down to `6`.
59
+ * level of nesting, down to `6`. A collapsible section, and each item
60
+ * of a list that is shown as one, counts as a level too.
59
61
  *
60
62
  * Set it so that the headings of the form fit below the headings of
61
63
  * the page around it. For example, when the form is in a section with
@@ -35,6 +35,7 @@ export declare const arrayItemControlsSchema: FormSchema;
35
35
  export declare const rowLayoutSchema: FormSchema;
36
36
  export declare const rowLayoutWithCustomComponentSchema: FormSchema;
37
37
  export declare const nestedArrayObjectSchema: FormSchema;
38
+ export declare const arrayItemWithEmptyListSchema: FormSchema;
38
39
  export declare const topLevelStringCustomComponentSchema: FormSchema;
39
40
  export declare const stringWithDefaultCustomComponentSchema: FormSchema;
40
41
  export declare const arrayItemWithDependenciesSchema: FormSchema;
@@ -48,5 +49,7 @@ export declare const requiredCheckboxSchema: FormSchema;
48
49
  export declare const nestedTitlesSchema: FormSchema;
49
50
  export declare const titledRowLayoutSchema: FormSchema;
50
51
  export declare const untitledRootSchema: FormSchema;
52
+ export declare const nestedCollapsibleSchema: FormSchema;
53
+ export declare const untitledCollapsibleSchema: FormSchema;
51
54
  export declare const untitledRowSchema: FormSchema;
52
55
  //# sourceMappingURL=form.test-schemas.d.ts.map
@@ -72,12 +72,6 @@ export type ValidationError = {
72
72
  */
73
73
  [key: string]: string[] | ValidationError;
74
74
  };
75
- /**
76
- * The level of a heading, from `1` for an `h1` to `6` for an `h6`.
77
- *
78
- * @public
79
- */
80
- export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
81
75
  /**
82
76
  * @public
83
77
  */
@@ -3,7 +3,7 @@ import { RowProps } from '../templates/types';
3
3
  import { HeadingLevelContext } from '../templates/heading-level';
4
4
  export declare class Row extends React.Component<RowProps> {
5
5
  props: RowProps;
6
- static readonly contextType: React.Context<import("../form.types").HeadingLevel>;
6
+ static readonly contextType: React.Context<import("../../..").HeadingLevel>;
7
7
  context: React.ContextType<typeof HeadingLevelContext>;
8
8
  constructor(props: RowProps);
9
9
  render(): React.DetailedReactHTMLElement<{
@@ -1,6 +1,7 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
2
  import { ArrayFieldItemButtonsTemplateProps, ErrorSchema } from '@rjsf/utils';
3
3
  import { JSONSchema7 } from 'json-schema';
4
+ import { HeadingLevelContext } from './heading-level';
4
5
  export interface CollapsibleItemProps {
5
6
  buttonsProps: ArrayFieldItemButtonsTemplateProps;
6
7
  /**
@@ -46,6 +47,8 @@ export interface CollapsibleItemProps {
46
47
  }
47
48
  export declare class CollapsibleItemTemplate extends React.Component<PropsWithChildren<CollapsibleItemProps>> {
48
49
  props: PropsWithChildren<CollapsibleItemProps>;
50
+ static readonly contextType: React.Context<import("../../..").HeadingLevel>;
51
+ context: React.ContextType<typeof HeadingLevelContext>;
49
52
  state: {
50
53
  isOpen: boolean;
51
54
  };
@@ -55,7 +58,8 @@ export declare class CollapsibleItemTemplate extends React.Component<PropsWithCh
55
58
  componentDidUpdate(): void;
56
59
  componentWillUnmount(): void;
57
60
  render(): React.ReactElement<{
58
- header: any;
61
+ header: string;
62
+ headingLevel: import("../../..").HeadingLevel;
59
63
  class: string;
60
64
  ref: (section: HTMLLimelCollapsibleSectionElement) => void;
61
65
  'is-open': boolean;
@@ -1,11 +1,6 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
2
  import { Help } from '../../help/help.types';
3
- import { HeadingLevel } from '../form.types';
4
- /**
5
- * @param level - any value
6
- * @returns whether the value is a heading level, from `1` to `6`
7
- */
8
- export declare function isHeadingLevel(level: unknown): level is HeadingLevel;
3
+ import { HeadingLevel } from '../../../global/shared-types/heading-level.types';
9
4
  /**
10
5
  * The heading level that a title at the current depth in the form gets.
11
6
  */
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import { LimeObjectFieldTemplateProps } from './types';
3
+ import { HeadingLevel } from '../../../global/shared-types/heading-level.types';
3
4
  export declare const ObjectFieldTemplate: (props: LimeObjectFieldTemplateProps) => React.FunctionComponentElement<React.FragmentProps> | React.ReactElement<{
4
5
  header: string;
6
+ headingLevel: HeadingLevel;
5
7
  id: string;
6
8
  'is-open': boolean;
7
9
  invalid: boolean;
@@ -1,5 +1,5 @@
1
1
  import { Help } from '../help/help.types';
2
- import { HeadingLevel } from '../form/form.types';
2
+ import { HeadingLevel } from '../../global/shared-types/heading-level.types';
3
3
  /**
4
4
  * This is an internal and private component that `limel-form` uses to
5
5
  * draw the heading of a section, a list or a custom component, together
@@ -24,6 +24,7 @@ import { MenuItem as MenuItem1 } from "./components";
24
24
  import { CircularProgressSize } from "./components/circular-progress/circular-progress.types";
25
25
  import { CodeDiffLayout } from "./components/code-diff/code-diff.types";
26
26
  import { ColorScheme, Language } from "./components/code-editor/code-editor.types";
27
+ import { HeadingLevel } from "./global/shared-types/heading-level.types";
27
28
  import { Action } from "./components/collapsible-section/action";
28
29
  import { CustomColorSwatch, CustomPalette } from "./components/color-picker/color-picker.types";
29
30
  import { Config } from "./global/config";
@@ -34,7 +35,7 @@ import { FileInfo } from "./global/shared-types/file.types";
34
35
  import { ResizeOptions } from "./util/image-resize";
35
36
  import { OfficeViewer } from "./components/file-viewer/file-viewer.types";
36
37
  import { FlexContainerAlign, FlexContainerDirection, FlexContainerJustify } from "./components/flex-container/flex-container.types";
37
- import { FormError, FormSchema, HeadingLevel, ValidationError, ValidationStatus } from "./components/form/form.types";
38
+ import { FormError, FormSchema, ValidationError, ValidationStatus } from "./components/form/form.types";
38
39
  import { Help } from "./components/help/help.types";
39
40
  import { IconSize } from "./components/icon/icon.types";
40
41
  import { InfoTileProgress } from "./components/info-tile/info-tile.types";
@@ -75,6 +76,7 @@ export { MenuItem as MenuItem1 } from "./components";
75
76
  export { CircularProgressSize } from "./components/circular-progress/circular-progress.types";
76
77
  export { CodeDiffLayout } from "./components/code-diff/code-diff.types";
77
78
  export { ColorScheme, Language } from "./components/code-editor/code-editor.types";
79
+ export { HeadingLevel } from "./global/shared-types/heading-level.types";
78
80
  export { Action } from "./components/collapsible-section/action";
79
81
  export { CustomColorSwatch, CustomPalette } from "./components/color-picker/color-picker.types";
80
82
  export { Config } from "./global/config";
@@ -85,7 +87,7 @@ export { FileInfo } from "./global/shared-types/file.types";
85
87
  export { ResizeOptions } from "./util/image-resize";
86
88
  export { OfficeViewer } from "./components/file-viewer/file-viewer.types";
87
89
  export { FlexContainerAlign, FlexContainerDirection, FlexContainerJustify } from "./components/flex-container/flex-container.types";
88
- export { FormError, FormSchema, HeadingLevel, ValidationError, ValidationStatus } from "./components/form/form.types";
90
+ export { FormError, FormSchema, ValidationError, ValidationStatus } from "./components/form/form.types";
89
91
  export { Help } from "./components/help/help.types";
90
92
  export { IconSize } from "./components/icon/icon.types";
91
93
  export { InfoTileProgress } from "./components/info-tile/info-tile.types";
@@ -1180,7 +1182,7 @@ export namespace Components {
1180
1182
  * The level of the heading that the `header` is drawn with, from `1` for an `h1` to `6` for an `h6`. Set it so that the heading fits below the headings around the section. For example, when the section is below an `h2`, set it to `3`. It does not change how the heading looks.
1181
1183
  * @default 2
1182
1184
  */
1183
- "headingLevel": 1 | 2 | 3 | 4 | 5 | 6;
1185
+ "headingLevel": HeadingLevel;
1184
1186
  /**
1185
1187
  * Icon to display in the header of the section
1186
1188
  */
@@ -1922,7 +1924,7 @@ export namespace Components {
1922
1924
  */
1923
1925
  "errors": ValidationError;
1924
1926
  /**
1925
- * The level, from `1` to `6`, of the topmost headings in the form. The headings of the sections inside them get one level more for each level of nesting, down to `6`. Set it so that the headings of the form fit below the headings of the page around it. For example, when the form is in a section with an `h2` heading, set it to `3`.
1927
+ * The level, from `1` to `6`, of the topmost headings in the form. The headings of the sections inside them get one level more for each level of nesting, down to `6`. A collapsible section, and each item of a list that is shown as one, counts as a level too. Set it so that the headings of the form fit below the headings of the page around it. For example, when the form is in a section with an `h2` heading, set it to `3`.
1926
1928
  * @default 1
1927
1929
  */
1928
1930
  "headingLevel": HeadingLevel;
@@ -8426,7 +8428,7 @@ declare namespace LocalJSX {
8426
8428
  * The level of the heading that the `header` is drawn with, from `1` for an `h1` to `6` for an `h6`. Set it so that the heading fits below the headings around the section. For example, when the section is below an `h2`, set it to `3`. It does not change how the heading looks.
8427
8429
  * @default 2
8428
8430
  */
8429
- "headingLevel"?: 1 | 2 | 3 | 4 | 5 | 6;
8431
+ "headingLevel"?: HeadingLevel;
8430
8432
  /**
8431
8433
  * Icon to display in the header of the section
8432
8434
  */
@@ -9257,7 +9259,7 @@ declare namespace LocalJSX {
9257
9259
  */
9258
9260
  "errors"?: ValidationError;
9259
9261
  /**
9260
- * The level, from `1` to `6`, of the topmost headings in the form. The headings of the sections inside them get one level more for each level of nesting, down to `6`. Set it so that the headings of the form fit below the headings of the page around it. For example, when the form is in a section with an `h2` heading, set it to `3`.
9262
+ * The level, from `1` to `6`, of the topmost headings in the form. The headings of the sections inside them get one level more for each level of nesting, down to `6`. A collapsible section, and each item of a list that is shown as one, counts as a level too. Set it so that the headings of the form fit below the headings of the page around it. For example, when the form is in a section with an `h2` heading, set it to `3`.
9261
9263
  * @default 1
9262
9264
  */
9263
9265
  "headingLevel"?: HeadingLevel;
@@ -12158,7 +12160,7 @@ declare namespace LocalJSX {
12158
12160
  interface LimelCollapsibleSectionAttributes {
12159
12161
  "isOpen": boolean;
12160
12162
  "header": string;
12161
- "headingLevel": 1 | 2 | 3 | 4 | 5 | 6;
12163
+ "headingLevel": HeadingLevel;
12162
12164
  "icon": IconName | Icon;
12163
12165
  "invalid": boolean;
12164
12166
  "language": Languages;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The level of a heading, from `1` for an `h1` to `6` for an `h6`.
3
+ *
4
+ * @public
5
+ */
6
+ export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
7
+ //# sourceMappingURL=heading-level.types.d.ts.map
@@ -19,7 +19,7 @@ export * from './components/flex-container/flex-container.types';
19
19
  export * from './global/shared-types/custom-element.types';
20
20
  export * from './global/config';
21
21
  export * from './global/shared-types/link.types';
22
- export { EventEmitter, ValidationStatus, FormError, ValidationError, FormComponent, FormInfo, FormSchema, HeadingLevel, LimeSchemaOptions, LimeLayoutOptions, FormComponentOptions, FormLayoutOptions, GridLayoutOptions, RowLayoutOptions, FormLayoutType, ReplaceObjectType, FormSchemaArrayItem, FormSubKeySchema, } from './components/form/form.types';
22
+ export { EventEmitter, ValidationStatus, FormError, ValidationError, FormComponent, FormInfo, FormSchema, LimeSchemaOptions, LimeLayoutOptions, FormComponentOptions, FormLayoutOptions, GridLayoutOptions, RowLayoutOptions, FormLayoutType, ReplaceObjectType, FormSchemaArrayItem, FormSubKeySchema, } from './components/form/form.types';
23
23
  export * from './components/help/help.types';
24
24
  export * from './components/icon/icon.types';
25
25
  export * from './components/info-tile/info-tile.types';
@@ -45,6 +45,7 @@ export * from './global/shared-types/separator.types';
45
45
  export * from './global/shared-types/icon.types';
46
46
  export * from './global/shared-types/image.types';
47
47
  export * from './global/shared-types/color.types';
48
+ export * from './global/shared-types/heading-level.types';
48
49
  export * from './components/text-editor/text-editor.types';
49
50
  export * from './components/text-editor/types';
50
51
  export * from './components/text-editor/prosemirror-adapter/menu/types';
@@ -0,0 +1,7 @@
1
+ import { HeadingLevel } from '../global/shared-types/heading-level.types';
2
+ /**
3
+ * @param level - any value
4
+ * @returns whether the value is a heading level, from `1` to `6`
5
+ */
6
+ export declare function isHeadingLevel(level: unknown): level is HeadingLevel;
7
+ //# sourceMappingURL=heading-level.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-elements",
3
- "version": "40.17.0",
3
+ "version": "40.17.1",
4
4
  "description": "Lime Elements",
5
5
  "author": "Lime Technologies",
6
6
  "license": "Apache-2.0",
@@ -93,7 +93,7 @@
93
93
  "morphdom": "^2.7.8",
94
94
  "number-abbreviate": "^2.0.0",
95
95
  "parse-css-color": "^0.2.1",
96
- "postal-mime": "^4.0.11",
96
+ "postal-mime": "^4.1.4",
97
97
  "prettier": "^3.9.10",
98
98
  "prosemirror-example-setup": "^1.2.3",
99
99
  "prosemirror-markdown": "^1.13.9",
@@ -1 +0,0 @@
1
- import{r as e,c as o,h as t,a as i}from"./p-BU9IJqli.js";import{d as n}from"./p-z_E3sq3p.js";import{m as s,r}from"./p-CIf8aGSd.js";import{c as a}from"./p-BrjD-ITe.js";import{b as l,d as c,g as d}from"./p-CgNJbSP4.js";import{t as p}from"./p-B26k4gw8.js";import"./p-ChagAaNf.js";function h(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=1&&e<=6}const g=class{constructor(i){e(this,i),this.open=o(this,"open",7),this.close=o(this,"close",7),this.action=o(this,"action",7),this.isOpen=!1,this.headingLevel=2,this.invalid=!1,this.language="en",this.bodyId=a(),this.headingId=a(),this.onClick=()=>{this.handleInteraction()},this.handleInteraction=()=>{this.isOpen=!this.isOpen,this.isOpen?(this.open.emit(),setTimeout(n,100)):this.close.emit()},this.renderExpandCollapseSign=()=>t("div",{class:"expand-icon",role:"presentation","aria-hidden":"true"},t("div",{class:"line"}),t("div",{class:"line"}),t("div",{class:"line"}),t("div",{class:"line"})),this.renderIcon=()=>{if(!this.icon)return;const e=d(this.icon),o=l(this.icon),i=c(this.icon);return t("limel-icon",{name:e,"aria-label":i,"aria-hidden":i?null:"true",style:{color:`${o}`}})},this.renderHeading=()=>{if(!this.header)return;const e=`h${this.getHeadingLevel()}`;return t(e,{class:"title mdc-typography mdc-typography--headline2",id:this.headingId},this.header)},this.renderActions=()=>{if(this.actions)return t("div",{class:"actions"},this.actions.map(this.renderActionButton))},this.renderActionButton=e=>t("limel-icon-button",{icon:e.icon,label:e.label,disabled:e.disabled,onClick:this.handleActionClick(e)}),this.handleActionClick=e=>o=>{o.stopPropagation(),this.action.emit(e)},this.getCollapsibleSectionAriaLabel=()=>p.get(this.isOpen?"collapsible-section.close":"collapsible-section.open",this.language,{header:this.header?`"${this.header}"`:" "})}componentWillLoad(){this.warnIfHeadingLevelIsInvalid()}handleHeadingLevelChange(){this.warnIfHeadingLevelIsInvalid()}componentDidRender(){const e=this.host.shadowRoot.querySelector(".open-close-toggle");s(e)}disconnectedCallback(){const e=this.host.shadowRoot.querySelector(".open-close-toggle");r(e)}render(){return t("section",{key:"1cb8db604bbbc8f8dbb7ca97895b3cfcf4dcd80b",class:this.isOpen?"open":"","aria-invalid":this.invalid,"aria-labelledby":this.header?this.headingId:null},t("header",{key:"4e55c5b636b1d049df4d77a77a35285648096ea0"},t("button",{key:"29eefb5499fb0f00cbdf513698acf8f357a935a6",class:"open-close-toggle",onClick:this.onClick,"aria-controls":this.bodyId,"aria-expanded":this.isOpen?"true":"false","aria-label":this.getCollapsibleSectionAriaLabel(),type:"button"}),this.renderExpandCollapseSign(),this.renderIcon(),this.renderHeading(),t("div",{key:"16ec84abfe81a812c9d30188a714b58d363ca8a3",class:"divider-line",role:"presentation"}),this.renderHeaderSlot(),this.renderActions()),t("div",{key:"f28ff7d73f05dc1a6ca0dcd9948cb67107647598",class:"body",inert:!this.isOpen,"aria-hidden":String(!this.isOpen),id:this.bodyId,role:"region"},t("slot",{key:"33d0fda5501c178f92dff4a1b0361a43829fe095"})))}getHeadingLevel(){return h(this.headingLevel)?this.headingLevel:2}warnIfHeadingLevelIsInvalid(){h(this.headingLevel)||console.warn(`limel-collapsible-section: headingLevel must be a whole number from 1 to 6, but it is ${this.headingLevel}. The heading is drawn as an h2 instead.`)}renderHeaderSlot(){return t("slot",{name:"header"})}get host(){return i(this)}static get watchers(){return{headingLevel:[{handleHeadingLevelChange:0}]}}};g.style='@charset "UTF-8";.expand-icon{position:relative;display:flex;align-items:center;justify-content:center;height:1.875rem;margin:0 0 0 0.5rem;width:0.75rem;flex-shrink:0}.line{position:absolute;inset:auto;margin:auto;width:100%;border-radius:1rem;height:0.125rem}.line:first-of-type,.line:last-of-type{transition:opacity 0.2s ease 0.1s, transform 0.4s ease 0.3s;opacity:0;background-color:var(--header-stroke-color, rgb(var(--contrast-900)))}.line:nth-of-type(2){transform:translate3d(0, 0.25rem, 0) rotate(90deg)}.line:nth-of-type(3){transform:translate3d(0, -0.25rem, 0) rotate(-90deg)}.line:nth-of-type(2),.line:nth-of-type(3){transition:opacity 0.2s ease, transform 0.18s ease}.line:nth-of-type(2):before,.line:nth-of-type(2):after,.line:nth-of-type(3):before,.line:nth-of-type(3):after{content:"";position:absolute;inset:0;margin:auto;width:50%;height:100%;border-radius:inherit;background-color:var(--header-stroke-color, rgb(var(--contrast-900)))}.line:nth-of-type(2):before,.line:nth-of-type(3):before{transform:translate3d(0, -0.1rem, 0) rotate(45deg)}.line:nth-of-type(2):after,.line:nth-of-type(3):after{transform:translate3d(0, 0.1rem, 0) rotate(-45deg)}.open-close-toggle:hover+.expand-icon .line:first-of-type,.open-close-toggle:hover+.expand-icon .line:last-of-type,.open-close-toggle:focus-visible+.expand-icon .line:first-of-type,.open-close-toggle:focus-visible+.expand-icon .line:last-of-type{transition:opacity 0.8s ease 0.4s, transform 0.4s ease 0.3s;opacity:1}.open-close-toggle:hover+.expand-icon .line:first-of-type,.open-close-toggle:focus-visible+.expand-icon .line:first-of-type{transform:rotate3d(0, 0, 1, 0deg)}.open-close-toggle:hover+.expand-icon .line:last-of-type,.open-close-toggle:focus-visible+.expand-icon .line:last-of-type{transform:rotate3d(0, 0, 1, 0deg)}.open-close-toggle:hover+.expand-icon .line:nth-of-type(2),.open-close-toggle:hover+.expand-icon .line:nth-of-type(3),.open-close-toggle:focus-visible+.expand-icon .line:nth-of-type(2),.open-close-toggle:focus-visible+.expand-icon .line:nth-of-type(3){transition:opacity 0.5s ease 0.4s, transform 0.7s cubic-bezier(0.85, 0.11, 0.14, 1.35) 0.2s}.open-close-toggle:hover+.expand-icon .line:nth-of-type(2),.open-close-toggle:focus-visible+.expand-icon .line:nth-of-type(2){transform:translate3d(0, 0.5rem, 0) rotate(90deg);opacity:0.4}.open-close-toggle:hover+.expand-icon .line:nth-of-type(3),.open-close-toggle:focus-visible+.expand-icon .line:nth-of-type(3){transform:translate3d(0, -0.5rem, 0) rotate(-90deg);opacity:0.4}section.open .line:first-of-type,section.open .line:last-of-type{transition:opacity 0.2s ease 0.1s, transform 0.4s ease 0.3s;opacity:1}section.open .line:first-of-type{transform:rotate3d(0, 0, 1, 0deg)}section.open .line:last-of-type{transform:rotate3d(0, 0, 1, 0deg)}section.open .line:nth-of-type(2),section.open .line:nth-of-type(3){transition:opacity 1s ease, transform 0.4s ease}section.open .line:nth-of-type(2){transform:translate3d(0, 1rem, 0) rotate(90deg);opacity:0}section.open .line:nth-of-type(3){transform:translate3d(0, -1rem, 0) rotate(-90deg);opacity:0}section.open .open-close-toggle:hover+.expand-icon .line:first-of-type,section.open .open-close-toggle:hover+.expand-icon .line:last-of-type,section.open .open-close-toggle:focus-visible+.expand-icon .line:first-of-type,section.open .open-close-toggle:focus-visible+.expand-icon .line:last-of-type{transition:opacity 0.2s ease 0.4s, transform 0.4s cubic-bezier(0.85, 0.11, 0.14, 1.35) 0.2s}section.open .open-close-toggle:hover+.expand-icon .line:first-of-type,section.open .open-close-toggle:focus-visible+.expand-icon .line:first-of-type{transform:rotate3d(0, 0, 1, 45deg)}section.open .open-close-toggle:hover+.expand-icon .line:last-of-type,section.open .open-close-toggle:focus-visible+.expand-icon .line:last-of-type{transform:rotate3d(0, 0, 1, -45deg)}section.open .open-close-toggle:hover+.expand-icon .line:nth-of-type(2),section.open .open-close-toggle:focus-visible+.expand-icon .line:nth-of-type(2){transform:translate3d(0, 1rem, 0) rotate(90deg);opacity:0}section.open .open-close-toggle:hover+.expand-icon .line:nth-of-type(3),section.open .open-close-toggle:focus-visible+.expand-icon .line:nth-of-type(3){transform:translate3d(0, -1rem, 0) rotate(-90deg);opacity:0}:host(limel-collapsible-section){--border-radius-of-header:0.75rem;display:block}:host([hidden]){display:none}button.open-close-toggle{appearance:none;background:none;border:none;padding:0;margin:0;font:inherit;color:inherit;text-align:inherit;position:absolute;inset:0;width:100%}button.open-close-toggle:focus{outline:none}button.open-close-toggle:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}button.open-close-toggle{transition:background-color 0.4s ease, border-radius 0.1s ease;cursor:pointer;z-index:-1;background-color:var(--closed-header-background-color, rgb(var(--contrast-200)));border-radius:var(--border-radius-of-header)}button.open-close-toggle:hover,button.open-close-toggle:focus-visible{background-color:var(--open-header-background-color, rgb(var(--contrast-300)))}section.open button.open-close-toggle{background-color:var(--open-header-background-color, rgb(var(--contrast-100)));border-radius:var(--border-radius-of-header) var(--border-radius-of-header) var(--limel-cs-open-header-bottom-border-radius, 0) var(--limel-cs-open-header-bottom-border-radius, 0)}section.open button.open-close-toggle:hover,section.open button.open-close-toggle:focus-visible{background-color:var(--open-header-background-color, rgb(var(--contrast-300)))}.title,.divider-line,.expand-icon{pointer-events:none}section{transition:box-shadow 0.4s ease;border-radius:var(--border-radius-of-header)}section[aria-invalid]:not([aria-invalid=false]){--header-stroke-color:rgb(var(--color-red-default)) !important}section[aria-invalid]:not([aria-invalid=false]):not(.open){box-shadow:0 0 0 1px rgb(var(--color-red-default))}header{isolation:isolate;position:relative;align-items:center;display:flex;justify-content:space-between;gap:0.5rem;padding-left:0.5rem;height:2.5rem}limel-icon{width:1.5rem;flex-shrink:0}.title{font-size:1rem;font-weight:300;color:var(--limel-theme-on-surface-color);justify-self:flex-start;user-select:none;height:auto;max-height:3rem;line-height:1.2rem;display:-webkit-box;overflow:hidden;white-space:normal;-webkit-box-orient:vertical;-webkit-line-clamp:2}.divider-line{transition:opacity 0.3s ease 0.3s;flex-grow:1;height:0.125rem;border-radius:1rem;background-color:var(--header-stroke-color, rgb(var(--contrast-900)));opacity:0;margin-right:0.5rem}section.open .divider-line{opacity:0.16}.actions{justify-self:flex-end;flex-shrink:0}::slotted([slot=header]){margin-right:0.5rem}.body{background-color:var(--body-background-color, var(--contrast-100));padding-left:var(--body-padding, 1.25rem);padding-right:var(--body-padding, 1.25rem);border-radius:0 0 var(--border-radius-of-header) var(--border-radius-of-header)}.body{transition:grid-template-rows var(--limel-cs-grid-template-rows-transition-speed) cubic-bezier(1, 0.09, 0, 0.89);display:grid;grid-template-rows:var(--limel-cs-grid-template-rows)}.body slot{transition:opacity var(--limel-cs-opacity-transition-speed) ease var(--limel-cs-opacity-transition-delay);display:block;overflow:hidden}:host(limel-collapsible-section:not([is-open])){--limel-cs-opacity-transition-speed:0.1s;--limel-cs-opacity-transition-delay:0s;--limel-cs-grid-template-rows-transition-speed:0.3s;--limel-cs-grid-template-rows:0fr}:host(limel-collapsible-section:not([is-open])) slot{opacity:0}:host(limel-collapsible-section[is-open]){--limel-cs-opacity-transition-speed:0.4s;--limel-cs-opacity-transition-delay:0.3s;--limel-cs-grid-template-rows-transition-speed:0.46s;--limel-cs-grid-template-rows:1fr}:host(limel-collapsible-section[is-open]) slot{opacity:1}header:hover+.body,header:has(.open-close-toggle:hover)+.body,header:has(.open-close-toggle:focus-visible)+.body{will-change:grid-template-rows}header:hover+.body slot,header:has(.open-close-toggle:hover)+.body slot,header:has(.open-close-toggle:focus-visible)+.body slot{will-change:opacity}';export{g as limel_collapsible_section}