@cryptlex/web-components 6.7.8 → 6.7.10
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/components/alert.d.ts +2 -2
- package/dist/components/alert.js +2 -2
- package/dist/components/alert.js.map +1 -1
- package/dist/components/autocomplete.js +2 -2
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.d.ts +1 -1
- package/dist/components/avatar.js +2 -2
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.d.ts +2 -2
- package/dist/components/badge.js +2 -2
- package/dist/components/badge.js.map +1 -1
- package/dist/components/breadcrumbs.d.ts +5 -5
- package/dist/components/breadcrumbs.js +2 -2
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/button.d.ts +3 -3
- package/dist/components/button.js +2 -2
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar.d.ts +7 -7
- package/dist/components/calendar.js +2 -2
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/card.d.ts +6 -6
- package/dist/components/card.js +2 -2
- package/dist/components/card.js.map +1 -1
- package/dist/components/charts.d.ts +8 -8
- package/dist/components/charts.js +2 -2
- package/dist/components/charts.js.map +1 -1
- package/dist/components/checkbox.d.ts +2 -2
- package/dist/components/checkbox.js +2 -2
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/code-block.d.ts +1 -1
- package/dist/components/code-block.js +2 -2
- package/dist/components/code-block.js.map +1 -1
- package/dist/components/copy-button.d.ts +1 -1
- package/dist/components/copy-button.js +2 -2
- package/dist/components/copy-button.js.map +1 -1
- package/dist/components/data-table-filter.d.ts +1 -1
- package/dist/components/data-table-filter.js +1 -2
- package/dist/components/data-table.d.ts +12 -87
- package/dist/components/data-table.js +1 -2
- package/dist/components/date-picker.d.ts +3 -3
- package/dist/components/date-picker.js +2 -2
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/datefield.d.ts +4 -4
- package/dist/components/datefield.js +2 -2
- package/dist/components/datefield.js.map +1 -1
- package/dist/components/dialog.d.ts +8 -8
- package/dist/components/dialog.js +2 -2
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/disclosure.d.ts +4 -4
- package/dist/components/disclosure.js +2 -2
- package/dist/components/disclosure.js.map +1 -1
- package/dist/components/divider.d.ts +2 -2
- package/dist/components/divider.js +2 -2
- package/dist/components/divider.js.map +1 -1
- package/dist/components/duration-field.d.ts +2 -2
- package/dist/components/duration-field.js +2 -2
- package/dist/components/duration-field.js.map +1 -1
- package/dist/components/file-trigger.d.ts +1 -1
- package/dist/components/file-trigger.js +2 -2
- package/dist/components/file-trigger.js.map +1 -1
- package/dist/components/form.d.ts +11 -11
- package/dist/components/form.js +2 -2
- package/dist/components/form.js.map +1 -1
- package/dist/components/icons.js +1 -2
- package/dist/components/id-search.d.ts +5 -5
- package/dist/components/id-search.js +2 -2
- package/dist/components/id-search.js.map +1 -1
- package/dist/components/kbd.d.ts +1 -1
- package/dist/components/kbd.js +2 -2
- package/dist/components/kbd.js.map +1 -1
- package/dist/components/list-box.d.ts +3 -3
- package/dist/components/list-box.js +2 -2
- package/dist/components/list-box.js.map +1 -1
- package/dist/components/loader.d.ts +1 -1
- package/dist/components/loader.js +2 -2
- package/dist/components/loader.js.map +1 -1
- package/dist/components/menu.d.ts +7 -7
- package/dist/components/menu.js +2 -2
- package/dist/components/menu.js.map +1 -1
- package/dist/components/multi-select.d.ts +2 -2
- package/dist/components/multi-select.js +2 -2
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/numberfield.d.ts +5 -5
- package/dist/components/numberfield.js +2 -2
- package/dist/components/numberfield.js.map +1 -1
- package/dist/components/object-table.d.ts +1 -1
- package/dist/components/object-table.js +2 -2
- package/dist/components/object-table.js.map +1 -1
- package/dist/components/offline-request-file-input.d.ts +2 -2
- package/dist/components/offline-request-file-input.js +2 -2
- package/dist/components/offline-request-file-input.js.map +1 -1
- package/dist/components/otpfield.d.ts +1 -1
- package/dist/components/otpfield.js +2 -2
- package/dist/components/otpfield.js.map +1 -1
- package/dist/components/popover.d.ts +2 -2
- package/dist/components/popover.js +2 -2
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress-bar.d.ts +1 -1
- package/dist/components/progress-bar.js +2 -2
- package/dist/components/progress-bar.js.map +1 -1
- package/dist/components/searchfield.d.ts +1 -1
- package/dist/components/searchfield.js +2 -2
- package/dist/components/searchfield.js.map +1 -1
- package/dist/components/select-options.js +2 -2
- package/dist/components/select-options.js.map +1 -1
- package/dist/components/select.d.ts +5 -5
- package/dist/components/select.js +2 -2
- package/dist/components/select.js.map +1 -1
- package/dist/components/sidebar.d.ts +20 -20
- package/dist/components/sidebar.js +2 -2
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/skeleton.d.ts +1 -1
- package/dist/components/skeleton.js +2 -2
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/steps.d.ts +1 -1
- package/dist/components/steps.js +2 -2
- package/dist/components/steps.js.map +1 -1
- package/dist/components/table-of-contents.d.ts +1 -1
- package/dist/components/table-of-contents.js +2 -2
- package/dist/components/table-of-contents.js.map +1 -1
- package/dist/components/table.d.ts +8 -8
- package/dist/components/table.js +2 -2
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.d.ts +4 -4
- package/dist/components/tabs.js +2 -2
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tag-group.d.ts +2 -2
- package/dist/components/tag-group.js +2 -2
- package/dist/components/tag-group.js.map +1 -1
- package/dist/components/textfield.d.ts +2 -2
- package/dist/components/textfield.js +2 -2
- package/dist/components/textfield.js.map +1 -1
- package/dist/components/timeline.d.ts +6 -6
- package/dist/components/timeline.js +2 -2
- package/dist/components/timeline.js.map +1 -1
- package/dist/components/toast.d.ts +1 -1
- package/dist/components/toast.js +2 -2
- package/dist/components/toast.js.map +1 -1
- package/dist/components/tooltip.d.ts +2 -2
- package/dist/components/tooltip.js +2 -2
- package/dist/components/tooltip.js.map +1 -1
- package/dist/data-table-filter.js +2 -0
- package/dist/data-table-filter.js.map +1 -0
- package/dist/icons.js +2 -0
- package/dist/icons.js.map +1 -0
- package/dist/stories/atoms/color.stories.d.ts +11 -0
- package/dist/stories/atoms/icons.stories.d.ts +11 -0
- package/dist/stories/atoms/type.stories.d.ts +13 -0
- package/dist/stories/components/alert.stories.d.ts +11 -0
- package/dist/stories/components/avatar.stories.d.ts +6 -0
- package/dist/stories/components/badge.stories.d.ts +6 -0
- package/dist/stories/components/breadcrumbs.stories.d.ts +5 -0
- package/dist/stories/components/button.stories.d.ts +6 -0
- package/dist/stories/components/calendar.stories.d.ts +10 -0
- package/dist/stories/components/card.stories.d.ts +9 -0
- package/dist/stories/components/code-block.stories.d.ts +12 -0
- package/dist/stories/components/copy-button.stories.d.ts +6 -0
- package/dist/stories/components/date-range-picker.stories.d.ts +23 -0
- package/dist/stories/components/datepicker.stories.d.ts +23 -0
- package/dist/stories/components/dialog.stories.d.ts +5 -0
- package/dist/stories/components/divider.stories.d.ts +13 -0
- package/dist/stories/components/file-trigger.stories.d.ts +10 -0
- package/dist/stories/components/kbd.stories.d.ts +49 -0
- package/dist/stories/components/loader.stories.d.ts +12 -0
- package/dist/stories/components/offline-request-file-upload.stories.d.ts +10 -0
- package/dist/stories/components/progress-bar.stories.d.ts +15 -0
- package/dist/stories/components/sheet.stories.d.ts +15 -0
- package/dist/stories/components/skeleton.stories.d.ts +10 -0
- package/dist/stories/components/tabs.stories.d.ts +12 -0
- package/dist/stories/components/tag-group.stories.d.ts +8 -0
- package/dist/stories/components/timeline.stories.d.ts +6 -0
- package/dist/stories/components/timepicker.stories.d.ts +23 -0
- package/dist/stories/components/toast.stories.d.ts +12 -0
- package/dist/stories/components/tooltip.stories.d.ts +9 -0
- package/dist/stories/examples/autocomplete.stories.d.ts +11 -0
- package/dist/stories/examples/charts.stories.d.ts +11 -0
- package/dist/stories/examples/data-table.stories.d.ts +9 -0
- package/dist/stories/examples/key-value-card.stories.d.ts +42 -0
- package/dist/stories/examples/sidebar.stories.d.ts +32 -0
- package/dist/stories/examples/table-of-contents.stories.d.ts +6 -0
- package/dist/stories/inputs/form.stories.d.ts +6 -0
- package/dist/stories/inputs/id-search.stories.d.ts +8 -0
- package/dist/stories/inputs/otp-field.stories.d.ts +6 -0
- package/dist/stories/inputs/textfield.stories.d.ts +8 -0
- package/dist/stories/story-commons.d.ts +3 -0
- package/dist/stories/utilities/resource-formatter.stories.d.ts +7 -0
- package/dist/utilities/auth.js +2 -2
- package/dist/utilities/auth.js.map +1 -1
- package/dist/utilities/countries.d.ts +1 -1
- package/dist/utilities/countries.js +2 -2
- package/dist/utilities/countries.js.map +1 -1
- package/dist/utilities/ctx-client.d.ts +1 -1
- package/dist/utilities/ctx-client.js +2 -2
- package/dist/utilities/ctx-client.js.map +1 -1
- package/dist/utilities/date.js +2 -2
- package/dist/utilities/date.js.map +1 -1
- package/dist/utilities/duration.js +2 -2
- package/dist/utilities/duration.js.map +1 -1
- package/dist/utilities/empty-option.js +2 -2
- package/dist/utilities/empty-option.js.map +1 -1
- package/dist/utilities/errors.js +2 -2
- package/dist/utilities/errors.js.map +1 -1
- package/dist/utilities/form-context.js +2 -2
- package/dist/utilities/form-context.js.map +1 -1
- package/dist/utilities/form-hook.js +2 -2
- package/dist/utilities/form-hook.js.map +1 -1
- package/dist/utilities/form.js +2 -2
- package/dist/utilities/form.js.map +1 -1
- package/dist/utilities/highlight-code.js +2 -2
- package/dist/utilities/highlight-code.js.map +1 -1
- package/dist/utilities/normalize-arrays.js +2 -2
- package/dist/utilities/normalize-arrays.js.map +1 -1
- package/dist/utilities/numbers.js +2 -2
- package/dist/utilities/numbers.js.map +1 -1
- package/dist/utilities/resources.d.ts +1 -1
- package/dist/utilities/resources.js +2 -2
- package/dist/utilities/resources.js.map +1 -1
- package/dist/utilities/shiki.js +2 -2
- package/dist/utilities/shiki.js.map +1 -1
- package/dist/utilities/string.js +2 -2
- package/dist/utilities/string.js.map +1 -1
- package/dist/utilities/theme.js +2 -2
- package/dist/utilities/theme.js.map +1 -1
- package/dist/utilities/use-code-highlight.js +2 -2
- package/dist/utilities/use-code-highlight.js.map +1 -1
- package/dist/utilities/use-mobile.js +2 -2
- package/dist/utilities/use-mobile.js.map +1 -1
- package/dist/utilities/validators.js +2 -2
- package/dist/utilities/validators.js.map +1 -1
- package/package.json +40 -40
- package/dist/components/data-table-filter.js.map +0 -1
- package/dist/components/data-table.js.map +0 -1
- package/dist/components/icons.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=select-options.js.map
|
|
1
|
+
import{ALL_OS as e}from"../utilities/resources.js";import{V as t,lt as n,q as r}from"../icons.js";import{Fragment as i,jsx as a,jsxs as o}from"react/jsx-runtime";var s={"node-locked":`Node-locked`,"hosted-floating":`Hosted Floating`,"on-premise-floating":`On-premise Floating`},c={"node-locked":a(n,{}),"hosted-floating":a(t,{}),"on-premise-floating":a(r,{})},l=Object.entries(s).map(([e,t])=>({label:o(i,{children:[t,c[e]]}),id:e})),u=[{label:`License Creation`,id:`creation`},{label:`License Activation`,id:`activation`}];function d(e){switch(e){case`creation`:case`license-creation`:return`License Creation`;case`activation`:case`license-activation`:return`License Activation`;default:return``}}function f(e){function t(e){return String.fromCodePoint(127397+e.toUpperCase().charCodeAt(0))}return t(e[0])+t(e[1])}var p={AF:`Afghanistan`,AX:`Åland Islands`,AL:`Albania`,DZ:`Algeria`,AS:`American Samoa`,AD:`Andorra`,AO:`Angola`,AI:`Anguilla`,AQ:`Antarctica`,AG:`Antigua and Barbuda`,AR:`Argentina`,AM:`Armenia`,AW:`Aruba`,AU:`Australia`,AT:`Austria`,AZ:`Azerbaijan`,BS:`Bahamas`,BH:`Bahrain`,BD:`Bangladesh`,BB:`Barbados`,BY:`Belarus`,BE:`Belgium`,BZ:`Belize`,BJ:`Benin`,BM:`Bermuda`,BT:`Bhutan`,BO:`Bolivia (Plurinational State of)`,BQ:`Bonaire, Sint Eustatius and Saba`,BA:`Bosnia and Herzegovina`,BW:`Botswana`,BV:`Bouvet Island`,BR:`Brazil`,IO:`British Indian Ocean Territory`,BN:`Brunei Darussalam`,BG:`Bulgaria`,BF:`Burkina Faso`,BI:`Burundi`,CV:`Caboe Verde`,KH:`Cambodia`,CM:`Cameroon`,CA:`Canada`,KY:`Cayman Islands`,CF:`Central African Republic`,TD:`Chad`,CL:`Chile`,CN:`China`,CX:`Christmas Island`,CC:`Cocos (Keeling) Islands`,CO:`Colombia`,KM:`Comoros`,CG:`Congo`,CD:`Congo, Democratic Republic of the`,CK:`Cook Islands`,CR:`Costa Rica`,CI:`Côte d'voire`,HR:`Croatia`,CU:`Cuba`,CW:`Curaçao`,CY:`Cyprus`,CZ:`Czechia`,DK:`Denmark`,DJ:`Djibouti`,DM:`Dominica`,DO:`Dominican Republic`,EC:`Ecuador`,EG:`Egypt`,SV:`El Salvador`,GQ:`Equatorial Guinea`,ER:`Eritrea`,EE:`Estonia`,SZ:`Eswatini`,ET:`Ethiopia`,FK:`Falkland Islands (Malvinas)`,FO:`Faroe Islands`,FJ:`Fiji`,FI:`Finland`,FR:`France`,GF:`French Guiana`,PF:`French Polynesia`,TF:`French Southern Territories`,GA:`Gabon`,GM:`Gambia`,GE:`Georgia`,DE:`Germany`,GH:`Ghana`,GI:`Gibraltar`,GR:`Greece`,GL:`Greenland`,GD:`Grenada`,GP:`Guadeloupe`,GU:`Guam`,GT:`Guatemala`,GG:`Guernsey`,GN:`Guinea`,GW:`Guinea-Bissau`,GY:`Guyana`,HT:`Haiti`,HM:`Heard Island and Mcdonald Islands`,VA:`Holy See`,HN:`Honduras`,HK:`Hong Kong`,HU:`Hungary`,IS:`Iceland`,IN:`India`,ID:`Indonesia`,IR:`Iran (Islamic Republic of)`,IQ:`Iraq`,IE:`Ireland`,IM:`Isle of Man`,IL:`Israel`,IT:`Italy`,JM:`Jamaica`,JP:`Japan`,JE:`Jersey`,JO:`Jordan`,KZ:`Kazakhstan`,KE:`Kenya`,KI:`Kiribati`,KP:`Korea (Democratic People's Republic of)`,KR:`Korea (Republic of)`,KW:`Kuwait`,KG:`Kyrgyzstan`,LA:`Lao People's Democratic Republic`,LV:`Latvia`,LB:`Lebanon`,LS:`Lesotho`,LR:`Liberia`,LY:`Libya`,LI:`Liechtenstein`,LT:`Lithuania`,LU:`Luxembourg`,MO:`Macao`,MG:`Madagascar`,MW:`Malawi`,MY:`Malaysia`,MV:`Maldives`,ML:`Mali`,MT:`Malta`,MH:`Marshall Islands`,MQ:`Martinique`,MR:`Mauritania`,MU:`Mauritius`,YT:`Mayotte`,MX:`Mexico`,FM:`Micronesia (Federated States of)`,MD:`Moldova, Republic of`,MC:`Monaco`,MN:`Mongolia`,ME:`Montenegro`,MS:`Montserrat`,MA:`Morocco`,MZ:`Mozambique`,MM:`Myanmar`,NA:`Namibia`,NR:`Nauru`,NP:`Nepal`,NL:`Netherlands, Kingdom of the`,NC:`New Caledonia`,NZ:`New Zealand`,NI:`Nicaragua`,NE:`Niger`,NG:`Nigeria`,NU:`Niue`,NF:`Norfolk Island`,MK:`North Macedonia`,MP:`Northern Mariana Islands`,NO:`Norway`,OM:`Oman`,PK:`Pakistan`,PW:`Palau`,PS:`Palestine, State of`,PA:`Panama`,PG:`Papua New Guinea`,PY:`Paraguay`,PE:`Peru`,PH:`Philippines`,PN:`Pitcairn`,PL:`Poland`,PT:`Portugal`,PR:`Puerto Rico`,QA:`Qatar`,RE:`Réunion`,RO:`Romania`,RU:`Russian Federation`,RW:`Rwanda`,BL:`Saint Barthélemy`,SH:`Saint Helena, Ascension Island, Tristan da Cunha`,KN:`Saint Kitts and Nevis`,LC:`Saint Lucia`,MF:`Saint Martin (French part)`,PM:`Saint Pierre and Miquelon`,VC:`Saint Vincent and the Grenadines`,WS:`Samoa`,SM:`San Marino`,ST:`Sao Tome and Principe`,SA:`Saudi Arabia`,SN:`Senegal`,RS:`Serbia`,SC:`Seychelles`,SL:`Sierra Leone`,SG:`Singapore`,SX:`Sint Maarten (Dutch part)`,SK:`Slovakia`,SI:`Slovenia`,SB:`Solomon Islands`,SO:`Somalia`,ZA:`South Africa`,GS:`South Georgia and the South Sandwich Islands`,SS:`South Sudan`,ES:`Spain`,LK:`Sri Lanka`,SD:`Sudan`,SR:`Suriname`,SJ:`Svalbard and Jan Mayen`,SE:`Sweden`,CH:`Switzerland`,SY:`Syrian Arab Republic`,TW:`Taiwan, Province of China`,TJ:`Tajikistan`,TZ:`Tanzania, United Republic of`,TH:`Thailand`,TL:`Timor-Leste`,TG:`Togo`,TK:`Tokelau`,TO:`Tonga`,TT:`Trinidad and Tobago`,TN:`Tunisia`,TR:`Türkiye`,TM:`Turkmenistan`,TC:`Turks and Caicos Islands`,TV:`Tuvalu`,UG:`Uganda`,UA:`Ukraine`,AE:`United Arab Emirates`,GB:`United Kingdom of Great Britain and Northern Ireland`,UM:`United States Minor Outlying Islands`,US:`United States of America`,UY:`Uruguay`,UZ:`Uzbekistan`,VU:`Vanuatu`,VE:`Venezuela (Bolivarian Republic of)`,VN:`Viet Nam`,VG:`Virgin Islands (British)`,VI:`Virgin Islands (U.S)`,WF:`Wallis and Futuna`,EH:`Western Sahara`,YE:`Yemen`,ZM:`Zambia`,ZW:`Zimbabwe`};function m(e){return p[e]}var h=Object.entries(p).map(e=>({label:o(i,{children:[f(e[0]),` `,e[1]]}),id:e[0]})),g=Object.entries({us:`United States`,eu:`European Union`}).map(e=>({label:o(i,{children:[f(e[0]),` `,e[1]]}),id:e[0]})),_=Object.entries(e).map(([e,t])=>({label:t,id:e}));export{s as ALL_LICENSE_TYPES,h as COUNTRY_OPTIONS,g as DATA_REGION_OPTIONS,l as LICENSE_TYPE_OPTIONS,_ as OS_OPTIONS,u as SUBSCRIPTION_START_TRIGGER_OPTIONS,f as getCountryFlag,m as getCountryName,d as getSubscriptionStartTriggerLabel};
|
|
2
|
+
//# sourceMappingURL=select-options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-options.js","sources":["../../lib/components/select-options.tsx"],"sourcesContent":["import { ALL_OS } from '../utilities/resources';\nimport { IcHostedFloating, IcLexFloatServer, IcNodeLocked } from './icons';\n\nexport type SelectOption = {\n id: string;\n label: React.ReactNode;\n disabled?: boolean;\n};\n\nexport const ALL_LICENSE_TYPES: Record<string, string> = {\n 'node-locked': 'Node-locked',\n 'hosted-floating': 'Hosted Floating',\n 'on-premise-floating': 'On-premise Floating',\n};\n\nconst LICENSE_TYPE_ICONS: Record<string, React.ReactNode> = {\n 'node-locked': <IcNodeLocked />,\n 'hosted-floating': <IcHostedFloating />,\n 'on-premise-floating': <IcLexFloatServer />,\n};\n\nexport const LICENSE_TYPE_OPTIONS: SelectOption[] = Object.entries(ALL_LICENSE_TYPES).map(([id, label]) => ({\n label: (\n <>\n {label}\n {LICENSE_TYPE_ICONS[id]}\n </>\n ),\n id,\n}));\n\nexport const SUBSCRIPTION_START_TRIGGER_OPTIONS: SelectOption[] = [\n {\n label: 'License Creation',\n id: 'creation',\n },\n {\n label: 'License Activation',\n id: 'activation',\n },\n];\n\nexport function getSubscriptionStartTriggerLabel(subscriptionStartTrigger: string): string {\n switch (subscriptionStartTrigger) {\n case 'creation':\n case 'license-creation':\n return 'License Creation';\n case 'activation':\n case 'license-activation':\n return 'License Activation';\n default:\n return '';\n }\n}\n\n/**\n * Creates Unicode flag from a two-letter ISO country code.\n * https://stackoverflow.com/questions/24050671/how-to-put-japan-flag-character-in-a-string\n * @param {string} country — A two-letter ISO country code (case-insensitive).\n * @return {string}\n */\nexport function getCountryFlag(country: string) {\n function getRegionalIndicatorSymbol(letter: string) {\n return String.fromCodePoint(0x1f1e6 - 65 + letter.toUpperCase().charCodeAt(0));\n }\n\n return getRegionalIndicatorSymbol(country[0]) + getRegionalIndicatorSymbol(country[1]);\n}\n\nconst ALL_COUNTRIES: { [key: string]: string } = {\n AF: 'Afghanistan',\n AX: 'Åland Islands',\n AL: 'Albania',\n DZ: 'Algeria',\n AS: 'American Samoa',\n AD: 'Andorra',\n AO: 'Angola',\n AI: 'Anguilla',\n AQ: 'Antarctica',\n AG: 'Antigua and Barbuda',\n AR: 'Argentina',\n AM: 'Armenia',\n AW: 'Aruba',\n AU: 'Australia',\n AT: 'Austria',\n AZ: 'Azerbaijan',\n BS: 'Bahamas',\n BH: 'Bahrain',\n BD: 'Bangladesh',\n BB: 'Barbados',\n BY: 'Belarus',\n BE: 'Belgium',\n BZ: 'Belize',\n BJ: 'Benin',\n BM: 'Bermuda',\n BT: 'Bhutan',\n BO: 'Bolivia (Plurinational State of)',\n BQ: 'Bonaire, Sint Eustatius and Saba',\n BA: 'Bosnia and Herzegovina',\n BW: 'Botswana',\n BV: 'Bouvet Island',\n BR: 'Brazil',\n IO: 'British Indian Ocean Territory',\n BN: 'Brunei Darussalam',\n BG: 'Bulgaria',\n BF: 'Burkina Faso',\n BI: 'Burundi',\n CV: 'Caboe Verde',\n KH: 'Cambodia',\n CM: 'Cameroon',\n CA: 'Canada',\n KY: 'Cayman Islands',\n CF: 'Central African Republic',\n TD: 'Chad',\n CL: 'Chile',\n CN: 'China',\n CX: 'Christmas Island',\n CC: 'Cocos (Keeling) Islands',\n CO: 'Colombia',\n KM: 'Comoros',\n CG: 'Congo',\n CD: 'Congo, Democratic Republic of the',\n CK: 'Cook Islands',\n CR: 'Costa Rica',\n CI: \"Côte d'voire\",\n HR: 'Croatia',\n CU: 'Cuba',\n CW: 'Curaçao',\n CY: 'Cyprus',\n CZ: 'Czechia',\n DK: 'Denmark',\n DJ: 'Djibouti',\n DM: 'Dominica',\n DO: 'Dominican Republic',\n EC: 'Ecuador',\n EG: 'Egypt',\n SV: 'El Salvador',\n GQ: 'Equatorial Guinea',\n ER: 'Eritrea',\n EE: 'Estonia',\n SZ: 'Eswatini',\n ET: 'Ethiopia',\n FK: 'Falkland Islands (Malvinas)',\n FO: 'Faroe Islands',\n FJ: 'Fiji',\n FI: 'Finland',\n FR: 'France',\n GF: 'French Guiana',\n PF: 'French Polynesia',\n TF: 'French Southern Territories',\n GA: 'Gabon',\n GM: 'Gambia',\n GE: 'Georgia',\n DE: 'Germany',\n GH: 'Ghana',\n GI: 'Gibraltar',\n GR: 'Greece',\n GL: 'Greenland',\n GD: 'Grenada',\n GP: 'Guadeloupe',\n GU: 'Guam',\n GT: 'Guatemala',\n GG: 'Guernsey',\n GN: 'Guinea',\n GW: 'Guinea-Bissau',\n GY: 'Guyana',\n HT: 'Haiti',\n HM: 'Heard Island and Mcdonald Islands',\n VA: 'Holy See',\n HN: 'Honduras',\n HK: 'Hong Kong',\n HU: 'Hungary',\n IS: 'Iceland',\n IN: 'India',\n ID: 'Indonesia',\n IR: 'Iran (Islamic Republic of)',\n IQ: 'Iraq',\n IE: 'Ireland',\n IM: 'Isle of Man',\n IL: 'Israel',\n IT: 'Italy',\n JM: 'Jamaica',\n JP: 'Japan',\n JE: 'Jersey',\n JO: 'Jordan',\n KZ: 'Kazakhstan',\n KE: 'Kenya',\n KI: 'Kiribati',\n KP: \"Korea (Democratic People's Republic of)\",\n KR: 'Korea (Republic of)',\n KW: 'Kuwait',\n KG: 'Kyrgyzstan',\n LA: \"Lao People's Democratic Republic\",\n LV: 'Latvia',\n LB: 'Lebanon',\n LS: 'Lesotho',\n LR: 'Liberia',\n LY: 'Libya',\n LI: 'Liechtenstein',\n LT: 'Lithuania',\n LU: 'Luxembourg',\n MO: 'Macao',\n MG: 'Madagascar',\n MW: 'Malawi',\n MY: 'Malaysia',\n MV: 'Maldives',\n ML: 'Mali',\n MT: 'Malta',\n MH: 'Marshall Islands',\n MQ: 'Martinique',\n MR: 'Mauritania',\n MU: 'Mauritius',\n YT: 'Mayotte',\n MX: 'Mexico',\n FM: 'Micronesia (Federated States of)',\n MD: 'Moldova, Republic of',\n MC: 'Monaco',\n MN: 'Mongolia',\n ME: 'Montenegro',\n MS: 'Montserrat',\n MA: 'Morocco',\n MZ: 'Mozambique',\n MM: 'Myanmar',\n NA: 'Namibia',\n NR: 'Nauru',\n NP: 'Nepal',\n NL: 'Netherlands, Kingdom of the',\n NC: 'New Caledonia',\n NZ: 'New Zealand',\n NI: 'Nicaragua',\n NE: 'Niger',\n NG: 'Nigeria',\n NU: 'Niue',\n NF: 'Norfolk Island',\n MK: 'North Macedonia',\n MP: 'Northern Mariana Islands',\n NO: 'Norway',\n OM: 'Oman',\n PK: 'Pakistan',\n PW: 'Palau',\n PS: 'Palestine, State of',\n PA: 'Panama',\n PG: 'Papua New Guinea',\n PY: 'Paraguay',\n PE: 'Peru',\n PH: 'Philippines',\n PN: 'Pitcairn',\n PL: 'Poland',\n PT: 'Portugal',\n PR: 'Puerto Rico',\n QA: 'Qatar',\n RE: 'Réunion',\n RO: 'Romania',\n RU: 'Russian Federation',\n RW: 'Rwanda',\n BL: 'Saint Barthélemy',\n SH: 'Saint Helena, Ascension Island, Tristan da Cunha',\n KN: 'Saint Kitts and Nevis',\n LC: 'Saint Lucia',\n MF: 'Saint Martin (French part)',\n PM: 'Saint Pierre and Miquelon',\n VC: 'Saint Vincent and the Grenadines',\n WS: 'Samoa',\n SM: 'San Marino',\n ST: 'Sao Tome and Principe',\n SA: 'Saudi Arabia',\n SN: 'Senegal',\n RS: 'Serbia',\n SC: 'Seychelles',\n SL: 'Sierra Leone',\n SG: 'Singapore',\n SX: 'Sint Maarten (Dutch part)',\n SK: 'Slovakia',\n SI: 'Slovenia',\n SB: 'Solomon Islands',\n SO: 'Somalia',\n ZA: 'South Africa',\n GS: 'South Georgia and the South Sandwich Islands',\n SS: 'South Sudan',\n ES: 'Spain',\n LK: 'Sri Lanka',\n SD: 'Sudan',\n SR: 'Suriname',\n SJ: 'Svalbard and Jan Mayen',\n SE: 'Sweden',\n CH: 'Switzerland',\n SY: 'Syrian Arab Republic',\n TW: 'Taiwan, Province of China',\n TJ: 'Tajikistan',\n TZ: 'Tanzania, United Republic of',\n TH: 'Thailand',\n TL: 'Timor-Leste',\n TG: 'Togo',\n TK: 'Tokelau',\n TO: 'Tonga',\n TT: 'Trinidad and Tobago',\n TN: 'Tunisia',\n TR: 'Türkiye',\n TM: 'Turkmenistan',\n TC: 'Turks and Caicos Islands',\n TV: 'Tuvalu',\n UG: 'Uganda',\n UA: 'Ukraine',\n AE: 'United Arab Emirates',\n GB: 'United Kingdom of Great Britain and Northern Ireland',\n UM: 'United States Minor Outlying Islands',\n US: 'United States of America',\n UY: 'Uruguay',\n UZ: 'Uzbekistan',\n VU: 'Vanuatu',\n VE: 'Venezuela (Bolivarian Republic of)',\n VN: 'Viet Nam',\n VG: 'Virgin Islands (British)',\n VI: 'Virgin Islands (U.S)',\n WF: 'Wallis and Futuna',\n EH: 'Western Sahara',\n YE: 'Yemen',\n ZM: 'Zambia',\n ZW: 'Zimbabwe',\n};\n\nexport function getCountryName(country: string) {\n return ALL_COUNTRIES[country];\n}\n\n/** Options for MultiSelect component */\nexport const COUNTRY_OPTIONS: SelectOption[] = Object.entries(ALL_COUNTRIES).map(v => {\n return {\n label: (\n <>\n {getCountryFlag(v[0])} {v[1]}\n </>\n ),\n id: v[0],\n };\n});\n\nconst DATA_REGIONS: { [key: string]: string } = {\n us: 'United States',\n eu: 'European Union',\n};\nexport const DATA_REGION_OPTIONS: SelectOption[] = Object.entries(DATA_REGIONS).map(v => {\n return {\n label: (\n <>\n {getCountryFlag(v[0])} {v[1]}\n </>\n ),\n id: v[0],\n };\n});\n\nexport const OS_OPTIONS: SelectOption[] = Object.entries(ALL_OS).map(([id, label]) => ({\n label,\n id,\n}));\n"],"names":["ALL_LICENSE_TYPES","LICENSE_TYPE_ICONS","IcNodeLocked","IcHostedFloating","IcLexFloatServer","LICENSE_TYPE_OPTIONS","id","label","jsxs","Fragment","SUBSCRIPTION_START_TRIGGER_OPTIONS","getSubscriptionStartTriggerLabel","subscriptionStartTrigger","getCountryFlag","country","getRegionalIndicatorSymbol","letter","ALL_COUNTRIES","getCountryName","COUNTRY_OPTIONS","v","DATA_REGIONS","DATA_REGION_OPTIONS","OS_OPTIONS","ALL_OS"],"mappings":"+SASO,MAAMA,EAA4C,CACrD,cAAe,cACf,kBAAmB,kBACnB,sBAAuB,qBAC3B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GAAI,UACJ,GAAI,aACJ,GAAI,UACJ,GAAI,qCACJ,GAAI,WACJ,GAAI,2BACJ,GAAI,uBACJ,GAAI,oBACJ,GAAI,iBACJ,GAAI,QACJ,GAAI,SACJ,GAAI,UACR,EAEO,SAASC,EAAeJ,EAAiB,CAC5C,OAAOG,EAAcH,CAAO,CAChC,CAGO,MAAMK,EAAkC,OAAO,QAAQF,CAAa,EAAE,IAAIG,IACtE,CACH,MACIZ,EAAAC,EAAA,CACK,SAAA,CAAAI,EAAeO,EAAE,CAAC,CAAC,EAAE,IAAEA,EAAE,CAAC,CAAA,EAC/B,EAEJ,GAAIA,EAAE,CAAC,CAAA,EAEd,EAEKC,EAA0C,CAC5C,GAAI,gBACJ,GAAI,gBACR,EACaC,EAAsC,OAAO,QAAQD,CAAY,EAAE,IAAID,IACzE,CACH,MACIZ,EAAAC,EAAA,CACK,SAAA,CAAAI,EAAeO,EAAE,CAAC,CAAC,EAAE,IAAEA,EAAE,CAAC,CAAA,EAC/B,EAEJ,GAAIA,EAAE,CAAC,CAAA,EAEd,EAEYG,EAA6B,OAAO,QAAQC,CAAM,EAAE,IAAI,CAAC,CAAClB,EAAIC,CAAK,KAAO,CACnF,MAAAA,EACA,GAAAD,CACJ,EAAE"}
|
|
1
|
+
{"version":3,"file":"select-options.js","names":[],"sources":["../../lib/components/select-options.tsx"],"sourcesContent":["import { ALL_OS } from '../utilities/resources';\nimport { IcHostedFloating, IcLexFloatServer, IcNodeLocked } from './icons';\n\nexport type SelectOption = {\n id: string;\n label: React.ReactNode;\n disabled?: boolean;\n};\n\nexport const ALL_LICENSE_TYPES: Record<string, string> = {\n 'node-locked': 'Node-locked',\n 'hosted-floating': 'Hosted Floating',\n 'on-premise-floating': 'On-premise Floating',\n};\n\nconst LICENSE_TYPE_ICONS: Record<string, React.ReactNode> = {\n 'node-locked': <IcNodeLocked />,\n 'hosted-floating': <IcHostedFloating />,\n 'on-premise-floating': <IcLexFloatServer />,\n};\n\nexport const LICENSE_TYPE_OPTIONS: SelectOption[] = Object.entries(ALL_LICENSE_TYPES).map(([id, label]) => ({\n label: (\n <>\n {label}\n {LICENSE_TYPE_ICONS[id]}\n </>\n ),\n id,\n}));\n\nexport const SUBSCRIPTION_START_TRIGGER_OPTIONS: SelectOption[] = [\n {\n label: 'License Creation',\n id: 'creation',\n },\n {\n label: 'License Activation',\n id: 'activation',\n },\n];\n\nexport function getSubscriptionStartTriggerLabel(subscriptionStartTrigger: string): string {\n switch (subscriptionStartTrigger) {\n case 'creation':\n case 'license-creation':\n return 'License Creation';\n case 'activation':\n case 'license-activation':\n return 'License Activation';\n default:\n return '';\n }\n}\n\n/**\n * Creates Unicode flag from a two-letter ISO country code.\n * https://stackoverflow.com/questions/24050671/how-to-put-japan-flag-character-in-a-string\n * @param {string} country — A two-letter ISO country code (case-insensitive).\n * @return {string}\n */\nexport function getCountryFlag(country: string) {\n function getRegionalIndicatorSymbol(letter: string) {\n return String.fromCodePoint(0x1f1e6 - 65 + letter.toUpperCase().charCodeAt(0));\n }\n\n return getRegionalIndicatorSymbol(country[0]) + getRegionalIndicatorSymbol(country[1]);\n}\n\nconst ALL_COUNTRIES: { [key: string]: string } = {\n AF: 'Afghanistan',\n AX: 'Åland Islands',\n AL: 'Albania',\n DZ: 'Algeria',\n AS: 'American Samoa',\n AD: 'Andorra',\n AO: 'Angola',\n AI: 'Anguilla',\n AQ: 'Antarctica',\n AG: 'Antigua and Barbuda',\n AR: 'Argentina',\n AM: 'Armenia',\n AW: 'Aruba',\n AU: 'Australia',\n AT: 'Austria',\n AZ: 'Azerbaijan',\n BS: 'Bahamas',\n BH: 'Bahrain',\n BD: 'Bangladesh',\n BB: 'Barbados',\n BY: 'Belarus',\n BE: 'Belgium',\n BZ: 'Belize',\n BJ: 'Benin',\n BM: 'Bermuda',\n BT: 'Bhutan',\n BO: 'Bolivia (Plurinational State of)',\n BQ: 'Bonaire, Sint Eustatius and Saba',\n BA: 'Bosnia and Herzegovina',\n BW: 'Botswana',\n BV: 'Bouvet Island',\n BR: 'Brazil',\n IO: 'British Indian Ocean Territory',\n BN: 'Brunei Darussalam',\n BG: 'Bulgaria',\n BF: 'Burkina Faso',\n BI: 'Burundi',\n CV: 'Caboe Verde',\n KH: 'Cambodia',\n CM: 'Cameroon',\n CA: 'Canada',\n KY: 'Cayman Islands',\n CF: 'Central African Republic',\n TD: 'Chad',\n CL: 'Chile',\n CN: 'China',\n CX: 'Christmas Island',\n CC: 'Cocos (Keeling) Islands',\n CO: 'Colombia',\n KM: 'Comoros',\n CG: 'Congo',\n CD: 'Congo, Democratic Republic of the',\n CK: 'Cook Islands',\n CR: 'Costa Rica',\n CI: \"Côte d'voire\",\n HR: 'Croatia',\n CU: 'Cuba',\n CW: 'Curaçao',\n CY: 'Cyprus',\n CZ: 'Czechia',\n DK: 'Denmark',\n DJ: 'Djibouti',\n DM: 'Dominica',\n DO: 'Dominican Republic',\n EC: 'Ecuador',\n EG: 'Egypt',\n SV: 'El Salvador',\n GQ: 'Equatorial Guinea',\n ER: 'Eritrea',\n EE: 'Estonia',\n SZ: 'Eswatini',\n ET: 'Ethiopia',\n FK: 'Falkland Islands (Malvinas)',\n FO: 'Faroe Islands',\n FJ: 'Fiji',\n FI: 'Finland',\n FR: 'France',\n GF: 'French Guiana',\n PF: 'French Polynesia',\n TF: 'French Southern Territories',\n GA: 'Gabon',\n GM: 'Gambia',\n GE: 'Georgia',\n DE: 'Germany',\n GH: 'Ghana',\n GI: 'Gibraltar',\n GR: 'Greece',\n GL: 'Greenland',\n GD: 'Grenada',\n GP: 'Guadeloupe',\n GU: 'Guam',\n GT: 'Guatemala',\n GG: 'Guernsey',\n GN: 'Guinea',\n GW: 'Guinea-Bissau',\n GY: 'Guyana',\n HT: 'Haiti',\n HM: 'Heard Island and Mcdonald Islands',\n VA: 'Holy See',\n HN: 'Honduras',\n HK: 'Hong Kong',\n HU: 'Hungary',\n IS: 'Iceland',\n IN: 'India',\n ID: 'Indonesia',\n IR: 'Iran (Islamic Republic of)',\n IQ: 'Iraq',\n IE: 'Ireland',\n IM: 'Isle of Man',\n IL: 'Israel',\n IT: 'Italy',\n JM: 'Jamaica',\n JP: 'Japan',\n JE: 'Jersey',\n JO: 'Jordan',\n KZ: 'Kazakhstan',\n KE: 'Kenya',\n KI: 'Kiribati',\n KP: \"Korea (Democratic People's Republic of)\",\n KR: 'Korea (Republic of)',\n KW: 'Kuwait',\n KG: 'Kyrgyzstan',\n LA: \"Lao People's Democratic Republic\",\n LV: 'Latvia',\n LB: 'Lebanon',\n LS: 'Lesotho',\n LR: 'Liberia',\n LY: 'Libya',\n LI: 'Liechtenstein',\n LT: 'Lithuania',\n LU: 'Luxembourg',\n MO: 'Macao',\n MG: 'Madagascar',\n MW: 'Malawi',\n MY: 'Malaysia',\n MV: 'Maldives',\n ML: 'Mali',\n MT: 'Malta',\n MH: 'Marshall Islands',\n MQ: 'Martinique',\n MR: 'Mauritania',\n MU: 'Mauritius',\n YT: 'Mayotte',\n MX: 'Mexico',\n FM: 'Micronesia (Federated States of)',\n MD: 'Moldova, Republic of',\n MC: 'Monaco',\n MN: 'Mongolia',\n ME: 'Montenegro',\n MS: 'Montserrat',\n MA: 'Morocco',\n MZ: 'Mozambique',\n MM: 'Myanmar',\n NA: 'Namibia',\n NR: 'Nauru',\n NP: 'Nepal',\n NL: 'Netherlands, Kingdom of the',\n NC: 'New Caledonia',\n NZ: 'New Zealand',\n NI: 'Nicaragua',\n NE: 'Niger',\n NG: 'Nigeria',\n NU: 'Niue',\n NF: 'Norfolk Island',\n MK: 'North Macedonia',\n MP: 'Northern Mariana Islands',\n NO: 'Norway',\n OM: 'Oman',\n PK: 'Pakistan',\n PW: 'Palau',\n PS: 'Palestine, State of',\n PA: 'Panama',\n PG: 'Papua New Guinea',\n PY: 'Paraguay',\n PE: 'Peru',\n PH: 'Philippines',\n PN: 'Pitcairn',\n PL: 'Poland',\n PT: 'Portugal',\n PR: 'Puerto Rico',\n QA: 'Qatar',\n RE: 'Réunion',\n RO: 'Romania',\n RU: 'Russian Federation',\n RW: 'Rwanda',\n BL: 'Saint Barthélemy',\n SH: 'Saint Helena, Ascension Island, Tristan da Cunha',\n KN: 'Saint Kitts and Nevis',\n LC: 'Saint Lucia',\n MF: 'Saint Martin (French part)',\n PM: 'Saint Pierre and Miquelon',\n VC: 'Saint Vincent and the Grenadines',\n WS: 'Samoa',\n SM: 'San Marino',\n ST: 'Sao Tome and Principe',\n SA: 'Saudi Arabia',\n SN: 'Senegal',\n RS: 'Serbia',\n SC: 'Seychelles',\n SL: 'Sierra Leone',\n SG: 'Singapore',\n SX: 'Sint Maarten (Dutch part)',\n SK: 'Slovakia',\n SI: 'Slovenia',\n SB: 'Solomon Islands',\n SO: 'Somalia',\n ZA: 'South Africa',\n GS: 'South Georgia and the South Sandwich Islands',\n SS: 'South Sudan',\n ES: 'Spain',\n LK: 'Sri Lanka',\n SD: 'Sudan',\n SR: 'Suriname',\n SJ: 'Svalbard and Jan Mayen',\n SE: 'Sweden',\n CH: 'Switzerland',\n SY: 'Syrian Arab Republic',\n TW: 'Taiwan, Province of China',\n TJ: 'Tajikistan',\n TZ: 'Tanzania, United Republic of',\n TH: 'Thailand',\n TL: 'Timor-Leste',\n TG: 'Togo',\n TK: 'Tokelau',\n TO: 'Tonga',\n TT: 'Trinidad and Tobago',\n TN: 'Tunisia',\n TR: 'Türkiye',\n TM: 'Turkmenistan',\n TC: 'Turks and Caicos Islands',\n TV: 'Tuvalu',\n UG: 'Uganda',\n UA: 'Ukraine',\n AE: 'United Arab Emirates',\n GB: 'United Kingdom of Great Britain and Northern Ireland',\n UM: 'United States Minor Outlying Islands',\n US: 'United States of America',\n UY: 'Uruguay',\n UZ: 'Uzbekistan',\n VU: 'Vanuatu',\n VE: 'Venezuela (Bolivarian Republic of)',\n VN: 'Viet Nam',\n VG: 'Virgin Islands (British)',\n VI: 'Virgin Islands (U.S)',\n WF: 'Wallis and Futuna',\n EH: 'Western Sahara',\n YE: 'Yemen',\n ZM: 'Zambia',\n ZW: 'Zimbabwe',\n};\n\nexport function getCountryName(country: string) {\n return ALL_COUNTRIES[country];\n}\n\n/** Options for MultiSelect component */\nexport const COUNTRY_OPTIONS: SelectOption[] = Object.entries(ALL_COUNTRIES).map(v => {\n return {\n label: (\n <>\n {getCountryFlag(v[0])} {v[1]}\n </>\n ),\n id: v[0],\n };\n});\n\nconst DATA_REGIONS: { [key: string]: string } = {\n us: 'United States',\n eu: 'European Union',\n};\nexport const DATA_REGION_OPTIONS: SelectOption[] = Object.entries(DATA_REGIONS).map(v => {\n return {\n label: (\n <>\n {getCountryFlag(v[0])} {v[1]}\n </>\n ),\n id: v[0],\n };\n});\n\nexport const OS_OPTIONS: SelectOption[] = Object.entries(ALL_OS).map(([id, label]) => ({\n label,\n id,\n}));\n"],"mappings":"kKASA,IAAa,EAA4C,CACrD,cAAe,cACf,kBAAmB,kBACnB,sBAAuB,qBAC3B,EAEM,EAAsD,CACxD,cAAe,EAAC,EAAD,CAAe,CAAA,EAC9B,kBAAmB,EAAC,EAAD,CAAmB,CAAA,EACtC,sBAAuB,EAAC,EAAD,CAAmB,CAAA,CAC9C,EAEa,EAAuC,OAAO,QAAQ,CAAiB,CAAC,CAAC,KAAK,CAAC,EAAI,MAAY,CACxG,MACI,EAAA,EAAA,CAAA,SAAA,CACK,EACA,EAAmB,EACtB,CAAA,CAAA,EAEN,IACJ,EAAE,EAEW,EAAqD,CAC9D,CACI,MAAO,mBACP,GAAI,UACR,EACA,CACI,MAAO,qBACP,GAAI,YACR,CACJ,EAEA,SAAgB,EAAiC,EAA0C,CACvF,OAAQ,EAAR,CACI,IAAK,WACL,IAAK,mBACD,MAAO,mBACX,IAAK,aACL,IAAK,qBACD,MAAO,qBACX,QACI,MAAO,EACf,CACJ,CAQA,SAAgB,EAAe,EAAiB,CAC5C,SAAS,EAA2B,EAAgB,CAChD,OAAO,OAAO,cAAc,OAAe,EAAO,YAAY,CAAC,CAAC,WAAW,CAAC,CAAC,CACjF,CAEA,OAAO,EAA2B,EA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16 +6,16 @@ import { ListBoxHeader, ListBoxItem } from './list-box';
|
|
|
6
6
|
export declare const SelectItem: typeof ListBoxItem;
|
|
7
7
|
export declare const SelectHeader: typeof ListBoxHeader;
|
|
8
8
|
export declare const SelectCollection: typeof import('react-aria-components').Collection;
|
|
9
|
-
export declare const SelectValue: <T extends object>({ className, ...props }: AriaSelectValueProps<T>) => import("react
|
|
9
|
+
export declare const SelectValue: <T extends object>({ className, ...props }: AriaSelectValueProps<T>) => import("react").JSX.Element;
|
|
10
10
|
export declare function SelectTrigger({ className, children, withChevron, ...props }: React.ComponentProps<typeof Button> & {
|
|
11
11
|
withChevron?: boolean;
|
|
12
|
-
}): import("react
|
|
13
|
-
export declare function SelectPopover({ className, ...props }: AriaPopoverProps): import("react
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
export declare function SelectPopover({ className, ...props }: AriaPopoverProps): import("react").JSX.Element;
|
|
14
14
|
export interface SingleSelectProps<T extends SelectOption> extends Omit<AriaSelectProps<T>, 'children'>, FormFieldProps {
|
|
15
15
|
items: Iterable<T>;
|
|
16
16
|
children: React.ReactNode | ((item: T) => React.ReactNode);
|
|
17
17
|
}
|
|
18
|
-
export declare function SingleSelect<T extends SelectOption>({ label, description, errorMessage, children, className, requiredIndicator, items, ...props }: SingleSelectProps<T>): import("react
|
|
18
|
+
export declare function SingleSelect<T extends SelectOption>({ label, description, errorMessage, children, className, requiredIndicator, items, ...props }: SingleSelectProps<T>): import("react").JSX.Element;
|
|
19
19
|
type TfSingleSelectProps<T extends SelectOption> = Omit<SingleSelectProps<T>, 'value' | 'setValue' | 'children'>;
|
|
20
|
-
export declare function TfSingleSelect<T extends SelectOption>({ ...props }: TfSingleSelectProps<T>): import("react
|
|
20
|
+
export declare function TfSingleSelect<T extends SelectOption>({ ...props }: TfSingleSelectProps<T>): import("react").JSX.Element;
|
|
21
21
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{
|
|
2
|
-
//# sourceMappingURL=select.js.map
|
|
1
|
+
"use client";import{classNames as e}from"../utilities/theme.js";import{x as t}from"../icons.js";import{useFieldContext as n}from"../utilities/form-context.js";import{Button as r}from"./button.js";import{FormField as i}from"./form.js";import{ListBoxCollection as a,ListBoxHeader as o,ListBoxItem as s}from"./list-box.js";import{getFieldErrorMessage as c}from"../utilities/form.js";import{Popover as l}from"./popover.js";import{useId as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";import{ListBox as m,Select as h,SelectValue as g,composeRenderProps as _}from"react-aria-components";var v=h,y=s,b=o,x=a,S=({className:t,...n})=>f(g,{className:_(t,t=>e(`line-clamp-1 data-[placeholder]:text-muted-foreground`,`[&>[slot=description]]:hidden`,t)),...n});function C({className:n,children:i,withChevron:a=!0,...o}){return f(r,{type:`button`,...o,className:e(`px-2 bg-surface-primary`,a&&`justify-between`,n),children:_(i,e=>p(d,{children:[f(`span`,{className:`inline-flex gap-1`,children:e}),a&&f(t,{"aria-hidden":`true`,className:`shrink-0`})]}))})}function w({className:t,...n}){return f(l,{className:_(t,t=>e(`w-auto min-w-(--trigger-width)`,t)),...n})}function T({className:t,...n}){return f(m,{className:_(t,t=>e(`overflow-auto p-1 outline-none`,t)),...n})}function E({label:t,description:n,errorMessage:r,children:a,className:o,requiredIndicator:s,items:c,...l}){let d=u(),m=l.id||d;return f(`div`,{className:e(`group form-field`,o),children:f(i,{label:t,description:n,errorMessage:r,requiredIndicator:s,htmlFor:m,children:p(v,{...l,placeholder:l.placeholder??``,children:[f(C,{className:`w-full`,id:m,children:f(S,{className:`inline-flex gap-1 items-center`})}),f(w,{children:f(T,{items:c,children:a})})]})})})}function D({...e}){let t=n({disabled:e.isDisabled});return f(E,{requiredIndicator:t.isRequired,selectedKey:t.state.value,onSelectionChange:e=>t.handleChange(e.toString()),onBlur:t.handleBlur,errorMessage:c(t),...e,isDisabled:e.isDisabled||t.isSubmitting,children:e=>f(y,{id:e.id,children:e.label},e.id)})}export{x as SelectCollection,b as SelectHeader,y as SelectItem,w as SelectPopover,C as SelectTrigger,S as SelectValue,E as SingleSelect,D as TfSingleSelect};
|
|
2
|
+
//# sourceMappingURL=select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sources":["../../lib/components/select.tsx"],"sourcesContent":["'use client';\nimport { useId } from 'react';\nimport {\n ListBox as AriaListBox,\n ListBoxProps as AriaListBoxProps,\n PopoverProps as AriaPopoverProps,\n Select as AriaSelect,\n SelectProps as AriaSelectProps,\n SelectValue as AriaSelectValue,\n SelectValueProps as AriaSelectValueProps,\n composeRenderProps,\n} from 'react-aria-components';\n\nimport { Button } from '../components/button';\nimport type { SelectOption } from '../components/select-options';\nimport { getFieldErrorMessage } from '../utilities/form';\nimport { useFieldContext } from '../utilities/form-context';\nimport { classNames } from '../utilities/theme';\nimport { FormField, type FormFieldProps } from './form';\nimport { IcDown } from './icons';\nimport { ListBoxCollection, ListBoxHeader, ListBoxItem } from './list-box';\nimport { Popover } from './popover';\n\nconst ASelect = AriaSelect;\nexport const SelectItem = ListBoxItem;\nexport const SelectHeader = ListBoxHeader;\nexport const SelectCollection = ListBoxCollection;\n\nexport const SelectValue = <T extends object>({ className, ...props }: AriaSelectValueProps<T>) => (\n <AriaSelectValue\n className={composeRenderProps(className, className =>\n classNames(\n 'line-clamp-1 data-[placeholder]:text-muted-foreground',\n /* Description */\n '[&>[slot=description]]:hidden',\n className\n )\n )}\n {...props}\n />\n);\nexport function SelectTrigger({\n className,\n children,\n withChevron = true,\n ...props\n}: React.ComponentProps<typeof Button> & { withChevron?: boolean }) {\n return (\n <Button\n type=\"button\"\n {...props}\n className={classNames('px-2 bg-surface-primary', withChevron && 'justify-between', className)}\n >\n {composeRenderProps(children, children => (\n <>\n <span className=\"inline-flex gap-1\">{children}</span>\n {withChevron && <IcDown aria-hidden=\"true\" className=\"shrink-0\" />}\n </>\n ))}\n </Button>\n );\n}\n\nexport function SelectPopover({ className, ...props }: AriaPopoverProps) {\n return (\n <Popover\n className={composeRenderProps(className, className =>\n classNames('w-auto min-w-(--trigger-width)', className)\n )}\n {...props}\n />\n );\n}\n\nfunction SelectListBox<T extends object>({ className, ...props }: AriaListBoxProps<T>) {\n return (\n <AriaListBox\n className={composeRenderProps(className, className =>\n classNames('overflow-auto p-1 outline-none', className)\n )}\n {...props}\n />\n );\n}\n\nexport interface SingleSelectProps<T extends SelectOption>\n extends Omit<AriaSelectProps<T>, 'children'>,\n FormFieldProps {\n items: Iterable<T>;\n children: React.ReactNode | ((item: T) => React.ReactNode);\n}\n\nexport function SingleSelect<T extends SelectOption>({\n label,\n description,\n errorMessage,\n children,\n className,\n requiredIndicator,\n items,\n ...props\n}: SingleSelectProps<T>) {\n const generatedId = useId();\n const fieldId = props.id || generatedId;\n\n return (\n <div className={classNames('group form-field', className)}>\n <FormField {...{ label, description, errorMessage, requiredIndicator, htmlFor: fieldId }}>\n <ASelect {...props} placeholder={props.placeholder ?? ''}>\n <SelectTrigger className={'w-full'} id={fieldId}>\n <SelectValue className={'inline-flex gap-1 items-center'} />\n </SelectTrigger>\n <SelectPopover>\n <SelectListBox items={items}>{children}</SelectListBox>\n </SelectPopover>\n </ASelect>\n </FormField>\n </div>\n );\n}\n\ntype TfSingleSelectProps<T extends SelectOption> = Omit<SingleSelectProps<T>, 'value' | 'setValue' | 'children'>;\n\nexport function TfSingleSelect<T extends SelectOption>({ ...props }: TfSingleSelectProps<T>) {\n const field = useFieldContext<string>({ disabled: props.isDisabled });\n\n return (\n <SingleSelect\n requiredIndicator={field.isRequired}\n selectedKey={field.state.value}\n onSelectionChange={e => field.handleChange(e!.toString())}\n onBlur={field.handleBlur}\n errorMessage={getFieldErrorMessage(field)}\n {...props}\n isDisabled={props.isDisabled || field.isSubmitting}\n >\n {item => (\n <SelectItem id={item.id} key={item.id}>\n {item.label}\n </SelectItem>\n )}\n </SingleSelect>\n );\n}\n"],"
|
|
1
|
+
{"version":3,"file":"select.js","names":[],"sources":["../../lib/components/select.tsx"],"sourcesContent":["'use client';\nimport { useId } from 'react';\nimport {\n ListBox as AriaListBox,\n ListBoxProps as AriaListBoxProps,\n PopoverProps as AriaPopoverProps,\n Select as AriaSelect,\n SelectProps as AriaSelectProps,\n SelectValue as AriaSelectValue,\n SelectValueProps as AriaSelectValueProps,\n composeRenderProps,\n} from 'react-aria-components';\n\nimport { Button } from '../components/button';\nimport type { SelectOption } from '../components/select-options';\nimport { getFieldErrorMessage } from '../utilities/form';\nimport { useFieldContext } from '../utilities/form-context';\nimport { classNames } from '../utilities/theme';\nimport { FormField, type FormFieldProps } from './form';\nimport { IcDown } from './icons';\nimport { ListBoxCollection, ListBoxHeader, ListBoxItem } from './list-box';\nimport { Popover } from './popover';\n\nconst ASelect = AriaSelect;\nexport const SelectItem = ListBoxItem;\nexport const SelectHeader = ListBoxHeader;\nexport const SelectCollection = ListBoxCollection;\n\nexport const SelectValue = <T extends object>({ className, ...props }: AriaSelectValueProps<T>) => (\n <AriaSelectValue\n className={composeRenderProps(className, className =>\n classNames(\n 'line-clamp-1 data-[placeholder]:text-muted-foreground',\n /* Description */\n '[&>[slot=description]]:hidden',\n className\n )\n )}\n {...props}\n />\n);\nexport function SelectTrigger({\n className,\n children,\n withChevron = true,\n ...props\n}: React.ComponentProps<typeof Button> & { withChevron?: boolean }) {\n return (\n <Button\n type=\"button\"\n {...props}\n className={classNames('px-2 bg-surface-primary', withChevron && 'justify-between', className)}\n >\n {composeRenderProps(children, children => (\n <>\n <span className=\"inline-flex gap-1\">{children}</span>\n {withChevron && <IcDown aria-hidden=\"true\" className=\"shrink-0\" />}\n </>\n ))}\n </Button>\n );\n}\n\nexport function SelectPopover({ className, ...props }: AriaPopoverProps) {\n return (\n <Popover\n className={composeRenderProps(className, className =>\n classNames('w-auto min-w-(--trigger-width)', className)\n )}\n {...props}\n />\n );\n}\n\nfunction SelectListBox<T extends object>({ className, ...props }: AriaListBoxProps<T>) {\n return (\n <AriaListBox\n className={composeRenderProps(className, className =>\n classNames('overflow-auto p-1 outline-none', className)\n )}\n {...props}\n />\n );\n}\n\nexport interface SingleSelectProps<T extends SelectOption>\n extends Omit<AriaSelectProps<T>, 'children'>,\n FormFieldProps {\n items: Iterable<T>;\n children: React.ReactNode | ((item: T) => React.ReactNode);\n}\n\nexport function SingleSelect<T extends SelectOption>({\n label,\n description,\n errorMessage,\n children,\n className,\n requiredIndicator,\n items,\n ...props\n}: SingleSelectProps<T>) {\n const generatedId = useId();\n const fieldId = props.id || generatedId;\n\n return (\n <div className={classNames('group form-field', className)}>\n <FormField {...{ label, description, errorMessage, requiredIndicator, htmlFor: fieldId }}>\n <ASelect {...props} placeholder={props.placeholder ?? ''}>\n <SelectTrigger className={'w-full'} id={fieldId}>\n <SelectValue className={'inline-flex gap-1 items-center'} />\n </SelectTrigger>\n <SelectPopover>\n <SelectListBox items={items}>{children}</SelectListBox>\n </SelectPopover>\n </ASelect>\n </FormField>\n </div>\n );\n}\n\ntype TfSingleSelectProps<T extends SelectOption> = Omit<SingleSelectProps<T>, 'value' | 'setValue' | 'children'>;\n\nexport function TfSingleSelect<T extends SelectOption>({ ...props }: TfSingleSelectProps<T>) {\n const field = useFieldContext<string>({ disabled: props.isDisabled });\n\n return (\n <SingleSelect\n requiredIndicator={field.isRequired}\n selectedKey={field.state.value}\n onSelectionChange={e => field.handleChange(e!.toString())}\n onBlur={field.handleBlur}\n errorMessage={getFieldErrorMessage(field)}\n {...props}\n isDisabled={props.isDisabled || field.isSubmitting}\n >\n {item => (\n <SelectItem id={item.id} key={item.id}>\n {item.label}\n </SelectItem>\n )}\n </SingleSelect>\n );\n}\n"],"mappings":"smBAuBA,IAAM,EAAU,EACH,EAAa,EACb,EAAe,EACf,EAAmB,EAEnB,GAAiC,CAAE,YAAW,GAAG,KAC1D,EAAC,EAAD,CACI,UAAW,EAAmB,EAAW,GACrC,EACI,wDAEA,gCACA,CACJ,CACJ,EACA,GAAI,CACP,CAAA,EAEL,SAAgB,EAAc,CAC1B,YACA,WACA,cAAc,GACd,GAAG,GAC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AC,EAEpE,OACI,EAAC,EAAD,CACI,kBAAmB,EAAM,WACzB,YAAa,EAAM,MAAM,MACzB,kBAAmB,GAAK,EAAM,aAAa,EAAG,SAAS,CAAC,EACxD,OAAQ,EAAM,WACd,aAAc,EAAqB,CAAK,EACxC,GAAI,EACJ,WAAY,EAAM,YAAc,EAAM,aAErC,SAAA,GACG,EAAC,EAAD,CAAY,GAAI,EAAK,GAChB,SAAA,EAAK,KACE,EAFkB,EAAK,EAEvB,CAEN,CAAA,CAEtB"}
|
|
@@ -34,7 +34,7 @@ export declare function SidebarProvider({ defaultOpen, open: openProp, onOpenCha
|
|
|
34
34
|
open?: boolean;
|
|
35
35
|
/** Callback when sidebar opens/closes */
|
|
36
36
|
onOpenChange?: (open: boolean) => void;
|
|
37
|
-
}): import("react
|
|
37
|
+
}): import("react").JSX.Element;
|
|
38
38
|
/**
|
|
39
39
|
* The actual sidebar panel. On mobile it becomes a modal dialog.
|
|
40
40
|
*/
|
|
@@ -45,57 +45,57 @@ export declare function Sidebar({ side, variant, collapsible, className, childre
|
|
|
45
45
|
variant?: 'sidebar' | 'floating';
|
|
46
46
|
/** How it collapses. Default: offcanvas */
|
|
47
47
|
collapsible?: 'offcanvas' | 'icon' | 'none';
|
|
48
|
-
}): import("react
|
|
48
|
+
}): import("react").JSX.Element;
|
|
49
49
|
/**
|
|
50
50
|
* Button that toggles the sidebar. Shows arrow icons.
|
|
51
51
|
*/
|
|
52
|
-
export declare function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>): import("react
|
|
52
|
+
export declare function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>): import("react").JSX.Element;
|
|
53
53
|
/**
|
|
54
54
|
* Scrollable container for sidebar content
|
|
55
55
|
*/
|
|
56
|
-
export declare function SidebarContent({ className, ...props }: React.ComponentProps<'div'>): import("react
|
|
56
|
+
export declare function SidebarContent({ className, ...props }: React.ComponentProps<'div'>): import("react").JSX.Element;
|
|
57
57
|
/**
|
|
58
58
|
* Groups related menu items together
|
|
59
59
|
*/
|
|
60
|
-
export declare function SidebarGroup({ className, ...props }: React.ComponentProps<'div'>): import("react
|
|
60
|
+
export declare function SidebarGroup({ className, ...props }: React.ComponentProps<'div'>): import("react").JSX.Element;
|
|
61
61
|
/**
|
|
62
62
|
* Label for a group.
|
|
63
63
|
*/
|
|
64
|
-
export declare function SidebarGroupLabel({ className, ...props }: React.ComponentProps<'div'>): import("react
|
|
64
|
+
export declare function SidebarGroupLabel({ className, ...props }: React.ComponentProps<'div'>): import("react").JSX.Element;
|
|
65
65
|
/**
|
|
66
66
|
* Content wrapper for a group
|
|
67
67
|
*/
|
|
68
|
-
export declare function SidebarGroupContent({ className, ...props }: React.ComponentProps<'div'>): import("react
|
|
68
|
+
export declare function SidebarGroupContent({ className, ...props }: React.ComponentProps<'div'>): import("react").JSX.Element;
|
|
69
69
|
/**
|
|
70
70
|
* Container for menu items
|
|
71
71
|
*/
|
|
72
|
-
export declare function SidebarMenu({ className, ...props }: React.ComponentProps<'ul'>): import("react
|
|
72
|
+
export declare function SidebarMenu({ className, ...props }: React.ComponentProps<'ul'>): import("react").JSX.Element;
|
|
73
73
|
/**
|
|
74
74
|
* Single menu item wrapper
|
|
75
75
|
*/
|
|
76
|
-
export declare function SidebarMenuItem({ className, ...props }: React.ComponentProps<'li'>): import("react
|
|
76
|
+
export declare function SidebarMenuItem({ className, ...props }: React.ComponentProps<'li'>): import("react").JSX.Element;
|
|
77
77
|
/**
|
|
78
78
|
* Extra action button that appears on the right side of menu items
|
|
79
79
|
*/
|
|
80
80
|
export declare function SidebarMenuAction({ className, ...props }: React.ComponentProps<'button'> & {
|
|
81
81
|
/** Only show on hover */
|
|
82
82
|
showOnHover?: boolean;
|
|
83
|
-
}): import("react
|
|
83
|
+
}): import("react").JSX.Element;
|
|
84
84
|
/**
|
|
85
85
|
* Shows a number badge on menu items. Auto-formats large numbers.
|
|
86
86
|
*/
|
|
87
87
|
export declare function SidebarMenuBadge({ className, number, ...props }: Omit<React.ComponentProps<'div'>, 'children'> & {
|
|
88
88
|
/** The count to display */
|
|
89
89
|
number: number | bigint;
|
|
90
|
-
}): import("react
|
|
90
|
+
}): import("react").JSX.Element;
|
|
91
91
|
/**
|
|
92
92
|
* Nested submenu container
|
|
93
93
|
*/
|
|
94
|
-
export declare function SidebarMenuSub({ className, ...props }: React.ComponentProps<'ul'>): import("react
|
|
94
|
+
export declare function SidebarMenuSub({ className, ...props }: React.ComponentProps<'ul'>): import("react").JSX.Element;
|
|
95
95
|
/**
|
|
96
96
|
* Submenu item wrapper
|
|
97
97
|
*/
|
|
98
|
-
export declare function SidebarMenuSubItem({ className, ...props }: React.ComponentProps<'li'>): import("react
|
|
98
|
+
export declare function SidebarMenuSubItem({ className, ...props }: React.ComponentProps<'li'>): import("react").JSX.Element;
|
|
99
99
|
export declare const sidebarMenuButtonClasses = "btn-tab relative rounded-md border-0 justify-start w-full group-data-[collapsible=icon]:justify-center";
|
|
100
100
|
/**
|
|
101
101
|
* Main menu button. Pass isActive for current page.
|
|
@@ -106,13 +106,13 @@ export declare function SidebarMenuButton({ isActive, className, children, icon:
|
|
|
106
106
|
leading?: React.ReactNode;
|
|
107
107
|
isActive?: boolean;
|
|
108
108
|
children?: React.ReactNode;
|
|
109
|
-
}): import("react
|
|
109
|
+
}): import("react").JSX.Element;
|
|
110
110
|
/**
|
|
111
111
|
* Button for submenu items
|
|
112
112
|
*/
|
|
113
113
|
export declare function SidebarMenuSubButton({ isActive, className, ...props }: React.ComponentProps<'button'> & {
|
|
114
114
|
isActive?: boolean;
|
|
115
|
-
}): import("react
|
|
115
|
+
}): import("react").JSX.Element;
|
|
116
116
|
/**
|
|
117
117
|
* Sticky header at the top of the sidebar. Displays a square logo slot aligned with the outlet header.
|
|
118
118
|
*/
|
|
@@ -120,8 +120,8 @@ export declare function SidebarHeader({ className, logo, children, showTrigger,
|
|
|
120
120
|
/** Square logo/icon to display */
|
|
121
121
|
logo?: React.ReactNode;
|
|
122
122
|
showTrigger?: boolean;
|
|
123
|
-
}): import("react
|
|
124
|
-
export declare function SidebarFooter({ className, ...props }: React.ComponentProps<'div'>): import("react
|
|
123
|
+
}): import("react").JSX.Element;
|
|
124
|
+
export declare function SidebarFooter({ className, ...props }: React.ComponentProps<'div'>): import("react").JSX.Element;
|
|
125
125
|
/**
|
|
126
126
|
*
|
|
127
127
|
* @example Basic usage
|
|
@@ -132,7 +132,7 @@ export declare function SidebarFooter({ className, ...props }: React.ComponentPr
|
|
|
132
132
|
* </SidebarOutlet>
|
|
133
133
|
* ```
|
|
134
134
|
*/
|
|
135
|
-
export declare function SidebarOutlet({ className, ...props }: React.ComponentProps<'div'>): import("react
|
|
136
|
-
export declare function SidebarOutletContent({ className, ...props }: React.ComponentProps<'div'>): import("react
|
|
137
|
-
export declare function SidebarOutletHeader({ className, ...props }: React.ComponentProps<'nav'>): import("react
|
|
135
|
+
export declare function SidebarOutlet({ className, ...props }: React.ComponentProps<'div'>): import("react").JSX.Element;
|
|
136
|
+
export declare function SidebarOutletContent({ className, ...props }: React.ComponentProps<'div'>): import("react").JSX.Element;
|
|
137
|
+
export declare function SidebarOutletHeader({ className, ...props }: React.ComponentProps<'nav'>): import("react").JSX.Element;
|
|
138
138
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{
|
|
2
|
-
//# sourceMappingURL=sidebar.js.map
|
|
1
|
+
"use client";import{classNames as e}from"../utilities/theme.js";import{At as t,K as n,nt as r}from"../icons.js";import{Button as i}from"./button.js";import{useIsMobile as a}from"../utilities/use-mobile.js";import{Tooltip as o,TooltipTrigger as s}from"./tooltip.js";import{DialogContent as c,DialogOverlay as l,DialogTrigger as u}from"./dialog.js";import{createContext as d,use as f,useCallback as p,useEffect as m,useMemo as h,useState as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";var y=`/`,b=d(null);function x(){let e=f(b);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function S({defaultOpen:t=!0,open:n,onOpenChange:r,className:i,style:o,children:s,...c}){let l=a(),[u,d]=g(!1),[f,v]=g(t),x=n??f,S=p(e=>{let t=typeof e==`function`?e(x):e;r?r(t):v(t)},[r,x]),C=p(()=>l?d(e=>!e):S(e=>!e),[l,S,d]);m(()=>{let e=e=>{e.key===y&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),C())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[C]);let w=x?`expanded`:`collapsed`,T=h(()=>({state:w,open:x,setOpen:S,isMobile:l,openMobile:u,setOpenMobile:d,toggleSidebar:C}),[w,x,S,l,u,d,C]);return _(b.Provider,{value:T,children:_(`div`,{className:e(`group/sidebar-wrapper flex w-full has-[[data-variant=inset]]:bg-surface-primary`,i),...c,children:s})})}function C({side:t=`left`,variant:n=`sidebar`,collapsible:r=`icon`,className:i,children:a,...o}){let{isMobile:s,state:d,openMobile:f,setOpenMobile:p}=x();return r===`none`?_(`div`,{className:e(`flex h-full w-(--sidebar-width) flex-col bg-surface-primary text-text-primary`,i),...o,children:a}):s?_(u,{isOpen:f,onOpenChange:p,...o,children:_(l,{children:_(c,{"data-sidebar":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) max-h-svh overflow-auto p-0 [&>button]:hidden border-r! border-stroke-primary! bg-surface-primary!`,side:`left`,closeButton:!1,children:()=>_(`div`,{className:`flex h-full w-full flex-col`,children:a})})})}):v(`div`,{className:`group peer hidden text-text-primary md:block`,"data-state":d,"data-collapsible":d===`collapsed`?r:``,"data-variant":n,"data-side":t,children:[_(`div`,{className:e(`relative w-(--sidebar-width) bg-surface-primary transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,n===`floating`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),_(`div`,{className:e(`absolute z-10 hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex`,t===`left`?`left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]`:`right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,n===`floating`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,i),...o,children:_(`div`,{"data-sidebar":`sidebar`,className:`flex h-full w-full flex-col bg-surface-primary group-data-[variant=floating]:border group-data-[variant=floating]:border-border`,children:a})})]})}function w({className:a,onClick:o,...s}){let{toggleSidebar:c,open:l,isMobile:u}=x();return _(i,{"data-sidebar":`trigger`,variant:`neutral`,size:`icon-sm`,className:e(a,`!rounded-full p-icon`),onClick:e=>{o?.(e),c()},"aria-label":`trigger`,...s,children:_(u?r:l?n:t,{})})}function T({className:t,...n}){return _(`div`,{"data-sidebar":`content`,className:e(`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden`,t),...n})}function E({className:t,...n}){return _(`div`,{"data-sidebar":`group`,className:e(`group/section relative flex w-full min-w-0 flex-col px-3 group-data-[collapsible=icon]:items-center`,t),...n})}function D({className:t,...n}){return _(`div`,{"data-sidebar":`group-label`,className:e(`flex h-input shrink-0 items-center overflow-hidden px-2 text-xs select-none font-medium uppercase text-muted-foreground outline-none ring-ring transition-[height,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-icon [&>svg]:shrink-0`,`group-data-[collapsible=icon]:pointer-events-none group-data-[collapsible=icon]:!h-0 group-data-[collapsible=icon]:min-h-0 group-data-[collapsible=icon]:opacity-0`,t),...n})}function O({className:t,...n}){return _(`div`,{"data-sidebar":`group-content`,className:e(`w-full body-sm`,t),...n})}function k({className:t,...n}){return _(`ul`,{"data-sidebar":`menu`,className:e(`flex w-full min-w-0 flex-col gap-px`,t),...n})}function A({className:t,...n}){return _(`li`,{"data-sidebar":`menu-item`,className:e(`group/menu-item relative list-none group-data-[collapsible=icon]:[&>*:not([data-sidebar=menu-button])]:hidden`,t),...n})}function j({className:t,...n}){return _(`button`,{"data-sidebar":`menu-action`,className:e(`absolute top-0 right-0 btn btn-ghost h-input`,`group-data-[collapsible=icon]:hidden`,t),...n})}function M({className:t,number:n,...r}){return _(`div`,{"data-sidebar":`menu-badge`,className:e(`absolute pointer-events-none top-0 right-0 font-light h-input select-none flex items-center justify-center body-sm tabular-nums`,`group-data-[collapsible=icon]:hidden`,t),...r,children:new Intl.NumberFormat(navigator.language,{useGrouping:!0}).format(n)})}function N({className:t,...n}){return _(`ul`,{"data-sidebar":`menu-sub`,className:e(`ms-2 flex min-w-0 flex-col`,`group-data-[collapsible=icon]:hidden`,t),...n})}function P({className:t,...n}){return _(`li`,{className:e(`list-none ms-0`,t),...n})}var F=`btn-tab relative rounded-md border-0 justify-start w-full group-data-[collapsible=icon]:justify-center`;function I({isActive:t=!1,className:n,children:r,icon:a,leading:c,...l}){let{isMobile:u,state:d}=x(),f=!u&&d===`collapsed`;return v(s,{isDisabled:!f,children:[v(i,{size:f?`icon`:void 0,"data-sidebar":`menu-button`,...t&&{"data-selected":!0},className:e(`peer/menu-button group/active group-has-[[data-sidebar=menu-action]]/menu-item:pr-input`,F,n),...l,children:[_(`span`,{"aria-hidden":!0,className:`absolute inset-y-2 -left-1 w-[7px] rounded-full bg-primary opacity-0 group-data-[selected=true]/active:opacity-100`}),c===void 0?a?_(a,{}):null:c,!f&&r]}),_(o,{placement:`right`,children:_(`span`,{className:`flex items-center gap-2`,children:r})})]})}function L({isActive:t,className:n,...r}){return _(`button`,{"data-sidebar":`menu-sub-button`,"data-active":t,className:e(F,n),...r})}function R({className:t,logo:n,children:r,showTrigger:i=!0,...a}){return v(`div`,{"data-sidebar":`header`,className:e(`flex items-center h-header select-none shrink-0 border-b px-2 gap-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0`,t),...a,children:[n&&_(`div`,{className:`flex items-center justify-center size-input shrink-0`,children:n}),r&&_(`div`,{className:`flex-1 min-w-0 group-data-[collapsible=icon]:hidden`,children:r}),i&&_(w,{className:`hidden bg-surface-primary lg:flex lg:absolute lg:-right-4 lg:z-50`})]})}function z({className:t,...n}){return _(`div`,{"data-sidebar":`footer`,className:e(`mt-auto flex shrink-0 select-none items-center gap-2 border-t py-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0`,t),...n})}function B({className:t,...n}){return _(`div`,{className:e(t,`flex flex-col flex-1 overflow-auto`),...n})}function V({className:t,...n}){return _(`div`,{className:e(t,`flex-1 overflow-auto`),...n})}function H({className:t,...n}){return _(`nav`,{className:e(`flex items-center h-header bg-surface-primary p-2 border-b`,t),...n})}export{C as Sidebar,T as SidebarContent,b as SidebarContext,z as SidebarFooter,E as SidebarGroup,O as SidebarGroupContent,D as SidebarGroupLabel,R as SidebarHeader,k as SidebarMenu,j as SidebarMenuAction,M as SidebarMenuBadge,I as SidebarMenuButton,A as SidebarMenuItem,N as SidebarMenuSub,L as SidebarMenuSubButton,P as SidebarMenuSubItem,B as SidebarOutlet,V as SidebarOutletContent,H as SidebarOutletHeader,S as SidebarProvider,w as SidebarTrigger,F as sidebarMenuButtonClasses,x as useSidebar};
|
|
2
|
+
//# sourceMappingURL=sidebar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.js","sources":["../../lib/components/sidebar.tsx"],"sourcesContent":["'use client';\nimport { createContext, use, useCallback, useEffect, useMemo, useState } from 'react';\nimport { Button } from '../components/button';\nimport { DialogContent, DialogOverlay, DialogTrigger } from '../components/dialog';\nimport { Tooltip, TooltipTrigger } from '../components/tooltip';\nimport { classNames } from '../utilities/theme';\nimport { useIsMobile } from '../utilities/use-mobile';\nimport { IcLeft, IcMenu, IcRight, type CtxIcon } from './icons';\n\nconst SIDEBAR_KEYBOARD_SHORTCUT = '/';\n\ntype SidebarContextProps = {\n state: 'expanded' | 'collapsed';\n open: boolean;\n setOpen: (open: boolean) => void;\n openMobile: boolean;\n setOpenMobile: (open: boolean) => void;\n isMobile: boolean;\n toggleSidebar: () => void;\n};\n\nexport const SidebarContext = createContext<SidebarContextProps | null>(null);\n\n/**\n * Get the current sidebar state and controls. Must be inside SidebarProvider.\n * @throws When used outside of SidebarProvider\n */\nexport function useSidebar() {\n const context = use(SidebarContext);\n if (!context) {\n throw new Error('useSidebar must be used within a SidebarProvider.');\n }\n\n return context;\n}\n\n/**\n * Wraps your app layout and manages sidebar state. Handles keyboard shortcuts (Cmd/Ctrl + /)\n * and mobile vs desktop behavior.\n *\n * @example\n * <SidebarProvider>\n * <Sidebar>...</Sidebar>\n * <SidebarOutlet>\n * <main>Your app content</main>\n * </SidebarOutlet>\n * </SidebarProvider>\n */\nexport function SidebarProvider({\n defaultOpen = true,\n open: openProp,\n onOpenChange: setOpenProp,\n className,\n style,\n children,\n ...props\n}: React.ComponentProps<'div'> & {\n /** Initial open state. Defaults to true */\n defaultOpen?: boolean;\n /** Control the open state yourself */\n open?: boolean;\n /** Callback when sidebar opens/closes */\n onOpenChange?: (open: boolean) => void;\n}) {\n const isMobile = useIsMobile();\n const [openMobile, setOpenMobile] = useState(false);\n\n // This is the internal state of the sidebar.\n // We use openProp and setOpenProp for control from outside the component.\n const [_open, _setOpen] = useState(defaultOpen);\n const open = openProp ?? _open;\n const setOpen = useCallback(\n (value: boolean | ((value: boolean) => boolean)) => {\n const openState = typeof value === 'function' ? value(open) : value;\n if (setOpenProp) {\n setOpenProp(openState);\n } else {\n _setOpen(openState);\n }\n },\n [setOpenProp, open]\n );\n\n // Helper to toggle the sidebar.\n const toggleSidebar = useCallback(() => {\n return isMobile ? setOpenMobile(open => !open) : setOpen(open => !open);\n }, [isMobile, setOpen, setOpenMobile]);\n\n // Adds a keyboard shortcut to toggle the sidebar.\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {\n event.preventDefault();\n toggleSidebar();\n }\n };\n\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [toggleSidebar]);\n\n // We add a state so that we can do data-state=\"expanded\" or \"collapsed\".\n // This makes it easier to style the sidebar with Tailwind classes.\n const state = open ? 'expanded' : 'collapsed';\n\n const contextValue = useMemo<SidebarContextProps>(\n () => ({\n state,\n open,\n setOpen,\n isMobile,\n openMobile,\n setOpenMobile,\n toggleSidebar,\n }),\n [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]\n );\n\n return (\n <SidebarContext.Provider value={contextValue}>\n <div\n className={classNames(\n 'group/sidebar-wrapper flex w-full has-[[data-variant=inset]]:bg-surface-primary',\n className\n )}\n {...props}\n >\n {children}\n </div>\n </SidebarContext.Provider>\n );\n}\n\n/**\n * The actual sidebar panel. On mobile it becomes a modal dialog.\n */\nexport function Sidebar({\n side = 'left',\n variant = 'sidebar',\n collapsible = 'icon',\n className,\n children,\n ...props\n}: React.ComponentProps<'div'> & {\n /** Where to dock the sidebar. Default: left */\n side?: 'left' | 'right';\n /** Style variant. Default: sidebar */\n variant?: 'sidebar' | 'floating';\n /** How it collapses. Default: offcanvas */\n collapsible?: 'offcanvas' | 'icon' | 'none';\n}) {\n const { isMobile, state, openMobile, setOpenMobile } = useSidebar();\n\n if (collapsible === 'none') {\n return (\n <div\n className={classNames(\n 'flex h-full w-(--sidebar-width) flex-col bg-surface-primary text-text-primary',\n className\n )}\n {...props}\n >\n {children}\n </div>\n );\n }\n\n if (isMobile) {\n return (\n <DialogTrigger isOpen={openMobile} onOpenChange={setOpenMobile} {...props}>\n <DialogOverlay>\n <DialogContent\n data-sidebar=\"sidebar\"\n data-mobile=\"true\"\n className=\"w-(--sidebar-width) max-h-svh overflow-auto p-0 [&>button]:hidden border-r! border-stroke-primary! bg-surface-primary!\"\n side=\"left\"\n closeButton={false}\n >\n {() => <div className=\"flex h-full w-full flex-col\">{children}</div>}\n </DialogContent>\n </DialogOverlay>\n </DialogTrigger>\n );\n }\n\n return (\n <div\n className=\"group peer hidden text-text-primary md:block\"\n data-state={state}\n data-collapsible={state === 'collapsed' ? collapsible : ''}\n data-variant={variant}\n data-side={side}\n >\n {/* This is what handles the sidebar gap on desktop */}\n <div\n className={classNames(\n 'relative w-(--sidebar-width) bg-surface-primary transition-[width] duration-200 ease-linear',\n 'group-data-[collapsible=offcanvas]:w-0',\n 'group-data-[side=right]:rotate-180',\n variant === 'floating'\n ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]'\n : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)'\n )}\n />\n <div\n className={classNames(\n 'absolute z-10 hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex',\n side === 'left'\n ? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'\n : 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',\n // Adjust the padding for floating variant.\n variant === 'floating'\n ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]'\n : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l',\n className\n )}\n {...props}\n >\n <div\n data-sidebar=\"sidebar\"\n className=\"flex h-full w-full flex-col bg-surface-primary group-data-[variant=floating]:border group-data-[variant=floating]:border-border\"\n >\n {children}\n </div>\n </div>\n </div>\n );\n}\n\n/**\n * Button that toggles the sidebar. Shows arrow icons.\n */\nexport function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>) {\n const { toggleSidebar, open, isMobile } = useSidebar();\n\n return (\n <Button\n data-sidebar=\"trigger\"\n variant=\"neutral\"\n size=\"icon-sm\"\n className={classNames(className, '!rounded-full p-icon')}\n onClick={event => {\n onClick?.(event);\n toggleSidebar();\n }}\n aria-label=\"trigger\"\n {...props}\n >\n {/* Use transition to rotate a single icon */}\n {isMobile ? <IcMenu /> : open ? <IcLeft /> : <IcRight />}\n </Button>\n );\n}\n\n/**\n * Scrollable container for sidebar content\n */\nexport function SidebarContent({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-sidebar=\"content\"\n className={classNames('flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden', className)}\n {...props}\n />\n );\n}\n\n/**\n * Groups related menu items together\n */\nexport function SidebarGroup({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-sidebar=\"group\"\n className={classNames(\n 'group/section relative flex w-full min-w-0 flex-col px-3 group-data-[collapsible=icon]:items-center',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n * Label for a group.\n */\nexport function SidebarGroupLabel({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-sidebar=\"group-label\"\n className={classNames(\n 'flex h-input shrink-0 items-center overflow-hidden px-2 text-xs select-none font-medium uppercase text-muted-foreground outline-none ring-ring transition-[height,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-icon [&>svg]:shrink-0',\n 'group-data-[collapsible=icon]:pointer-events-none group-data-[collapsible=icon]:!h-0 group-data-[collapsible=icon]:min-h-0 group-data-[collapsible=icon]:opacity-0',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n * Content wrapper for a group\n */\nexport function SidebarGroupContent({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-sidebar=\"group-content\" className={classNames('w-full body-sm', className)} {...props} />;\n}\n\n/**\n * Container for menu items\n */\nexport function SidebarMenu({ className, ...props }: React.ComponentProps<'ul'>) {\n return (\n <ul data-sidebar=\"menu\" className={classNames('flex w-full min-w-0 flex-col gap-px', className)} {...props} />\n );\n}\n\n/**\n * Single menu item wrapper\n */\nexport function SidebarMenuItem({ className, ...props }: React.ComponentProps<'li'>) {\n return (\n <li\n data-sidebar=\"menu-item\"\n className={classNames(\n 'group/menu-item relative list-none group-data-[collapsible=icon]:[&>*:not([data-sidebar=menu-button])]:hidden',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n * Extra action button that appears on the right side of menu items\n */\nexport function SidebarMenuAction({\n className,\n ...props\n}: React.ComponentProps<'button'> & {\n /** Only show on hover */\n showOnHover?: boolean;\n}) {\n return (\n <button\n data-sidebar=\"menu-action\"\n className={classNames(\n 'absolute top-0 right-0 btn btn-ghost h-input',\n 'group-data-[collapsible=icon]:hidden',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n * Shows a number badge on menu items. Auto-formats large numbers.\n */\nexport function SidebarMenuBadge({\n className,\n number,\n ...props\n}: Omit<React.ComponentProps<'div'>, 'children'> & {\n /** The count to display */\n number: number | bigint;\n}) {\n return (\n <div\n data-sidebar=\"menu-badge\"\n className={classNames(\n 'absolute pointer-events-none top-0 right-0 font-light h-input select-none flex items-center justify-center body-sm tabular-nums',\n 'group-data-[collapsible=icon]:hidden',\n className\n )}\n {...props}\n >\n {/* Format the number */}\n {new Intl.NumberFormat(navigator.language, { useGrouping: true }).format(number)}\n </div>\n );\n}\n\n/**\n * Nested submenu container\n */\nexport function SidebarMenuSub({ className, ...props }: React.ComponentProps<'ul'>) {\n return (\n <ul\n data-sidebar=\"menu-sub\"\n className={classNames('ms-2 flex min-w-0 flex-col', 'group-data-[collapsible=icon]:hidden', className)}\n {...props}\n />\n );\n}\n\n/**\n * Submenu item wrapper\n */\nexport function SidebarMenuSubItem({ className, ...props }: React.ComponentProps<'li'>) {\n return <li className={classNames('list-none ms-0', className)} {...props} />;\n}\n\nexport const sidebarMenuButtonClasses =\n 'btn-tab relative rounded-md border-0 justify-start w-full group-data-[collapsible=icon]:justify-center';\n\n// Common interaction logic for SidebarMenuButton and SidebarMenuSubButton\n/**\n * Main menu button. Pass isActive for current page.\n */\nexport function SidebarMenuButton({\n isActive = false,\n className,\n children,\n icon: Icon,\n leading,\n ...props\n}: Omit<React.ComponentProps<typeof Button>, 'children'> & {\n /** Mark as currently active page */\n icon?: CtxIcon;\n leading?: React.ReactNode;\n isActive?: boolean;\n children?: React.ReactNode;\n}) {\n const { isMobile, state } = useSidebar();\n const isCollapsed = !isMobile && state === 'collapsed';\n\n return (\n <TooltipTrigger isDisabled={!isCollapsed}>\n <Button\n size={isCollapsed ? 'icon' : undefined}\n data-sidebar=\"menu-button\"\n {...(isActive && { 'data-selected': true })}\n className={classNames(\n 'peer/menu-button group/active group-has-[[data-sidebar=menu-action]]/menu-item:pr-input',\n sidebarMenuButtonClasses,\n className\n )}\n {...props}\n >\n <span\n aria-hidden\n className=\"absolute inset-y-2 -left-1 w-[7px] rounded-full bg-primary opacity-0 group-data-[selected=true]/active:opacity-100\"\n />\n {leading !== undefined ? leading : Icon ? <Icon /> : null}\n {!isCollapsed && children}\n </Button>\n <Tooltip placement=\"right\">\n <span className=\"flex items-center gap-2\">{children}</span>\n </Tooltip>\n </TooltipTrigger>\n );\n}\n\n/**\n * Button for submenu items\n */\nexport function SidebarMenuSubButton({\n isActive,\n className,\n ...props\n}: React.ComponentProps<'button'> & {\n isActive?: boolean;\n}) {\n return (\n <button\n data-sidebar=\"menu-sub-button\"\n data-active={isActive}\n className={classNames(sidebarMenuButtonClasses, className)}\n {...props}\n />\n );\n}\n\n/**\n * Sticky header at the top of the sidebar. Displays a square logo slot aligned with the outlet header.\n */\nexport function SidebarHeader({\n className,\n logo,\n children,\n showTrigger = true,\n ...props\n}: React.ComponentProps<'div'> & {\n /** Square logo/icon to display */\n logo?: React.ReactNode;\n showTrigger?: boolean;\n}) {\n return (\n <div\n data-sidebar=\"header\"\n className={classNames(\n 'flex items-center h-header select-none shrink-0 border-b px-2 gap-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0',\n className\n )}\n {...props}\n >\n {logo && <div className=\"flex items-center justify-center size-input shrink-0\">{logo}</div>}\n {children && <div className=\"flex-1 min-w-0 group-data-[collapsible=icon]:hidden\">{children}</div>}\n {showTrigger && (\n <SidebarTrigger className={'hidden bg-surface-primary lg:flex lg:absolute lg:-right-4 lg:z-50'} />\n )}\n </div>\n );\n}\n\nexport function SidebarFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-sidebar=\"footer\"\n className={classNames(\n 'mt-auto flex shrink-0 select-none items-center gap-2 border-t py-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n *\n * @example Basic usage\n * ```tsx\n * <SidebarOutlet>\n * <SidebarOutletHeader><SidebarTrigger/></SidebarOutletHeader>\n * <SidebarOutletContent><Outlet/></SidebarOutletContent>\n * </SidebarOutlet>\n * ```\n */\nexport function SidebarOutlet({ className, ...props }: React.ComponentProps<'div'>) {\n return <div className={classNames(className, 'flex flex-col flex-1 overflow-auto')} {...props} />;\n}\n\nexport function SidebarOutletContent({ className, ...props }: React.ComponentProps<'div'>) {\n return <div className={classNames(className, 'flex-1 overflow-auto')} {...props} />;\n}\n\nexport function SidebarOutletHeader({ className, ...props }: React.ComponentProps<'nav'>) {\n return (\n <nav\n className={classNames('flex items-center h-header bg-surface-primary p-2 border-b', className)}\n {...props}\n />\n );\n}\n"],"names":["SIDEBAR_KEYBOARD_SHORTCUT","SidebarContext","createContext","useSidebar","context","use","SidebarProvider","defaultOpen","openProp","setOpenProp","className","style","children","props","isMobile","useIsMobile","openMobile","setOpenMobile","useState","_open","_setOpen","open","setOpen","useCallback","value","openState","toggleSidebar","useEffect","handleKeyDown","event","state","contextValue","useMemo","jsx","classNames","Sidebar","side","variant","collapsible","DialogTrigger","DialogOverlay","DialogContent","jsxs","SidebarTrigger","onClick","Button","IcMenu","IcLeft","IcRight","SidebarContent","SidebarGroup","SidebarGroupLabel","SidebarGroupContent","SidebarMenu","SidebarMenuItem","SidebarMenuAction","SidebarMenuBadge","number","SidebarMenuSub","SidebarMenuSubItem","sidebarMenuButtonClasses","SidebarMenuButton","isActive","Icon","leading","isCollapsed","TooltipTrigger","Tooltip","SidebarMenuSubButton","SidebarHeader","logo","showTrigger","SidebarFooter","SidebarOutlet","Sidebar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AS6D,GAAqB,CAAE,UAAAhE,EAAW,GAAGG,GAAsC,CACvF,OAAOoB,EAAC,OAAI,UAAWC,EAAWxB,EAAW,sBAAsB,EAAI,GAAGG,EAAO,CACrF,CAEO,SAAS8D,GAAoB,CAAE,UAAAjE,EAAW,GAAGG,GAAsC,CACtF,OACIoB,EAAC,MAAA,CACG,UAAWC,EAAW,6DAA8DxB,CAAS,EAC5F,GAAGG,CAAA,CAAA,CAGhB"}
|
|
1
|
+
{"version":3,"file":"sidebar.js","names":[],"sources":["../../lib/components/sidebar.tsx"],"sourcesContent":["'use client';\nimport { createContext, use, useCallback, useEffect, useMemo, useState } from 'react';\nimport { Button } from '../components/button';\nimport { DialogContent, DialogOverlay, DialogTrigger } from '../components/dialog';\nimport { Tooltip, TooltipTrigger } from '../components/tooltip';\nimport { classNames } from '../utilities/theme';\nimport { useIsMobile } from '../utilities/use-mobile';\nimport { IcLeft, IcMenu, IcRight, type CtxIcon } from './icons';\n\nconst SIDEBAR_KEYBOARD_SHORTCUT = '/';\n\ntype SidebarContextProps = {\n state: 'expanded' | 'collapsed';\n open: boolean;\n setOpen: (open: boolean) => void;\n openMobile: boolean;\n setOpenMobile: (open: boolean) => void;\n isMobile: boolean;\n toggleSidebar: () => void;\n};\n\nexport const SidebarContext = createContext<SidebarContextProps | null>(null);\n\n/**\n * Get the current sidebar state and controls. Must be inside SidebarProvider.\n * @throws When used outside of SidebarProvider\n */\nexport function useSidebar() {\n const context = use(SidebarContext);\n if (!context) {\n throw new Error('useSidebar must be used within a SidebarProvider.');\n }\n\n return context;\n}\n\n/**\n * Wraps your app layout and manages sidebar state. Handles keyboard shortcuts (Cmd/Ctrl + /)\n * and mobile vs desktop behavior.\n *\n * @example\n * <SidebarProvider>\n * <Sidebar>...</Sidebar>\n * <SidebarOutlet>\n * <main>Your app content</main>\n * </SidebarOutlet>\n * </SidebarProvider>\n */\nexport function SidebarProvider({\n defaultOpen = true,\n open: openProp,\n onOpenChange: setOpenProp,\n className,\n style,\n children,\n ...props\n}: React.ComponentProps<'div'> & {\n /** Initial open state. Defaults to true */\n defaultOpen?: boolean;\n /** Control the open state yourself */\n open?: boolean;\n /** Callback when sidebar opens/closes */\n onOpenChange?: (open: boolean) => void;\n}) {\n const isMobile = useIsMobile();\n const [openMobile, setOpenMobile] = useState(false);\n\n // This is the internal state of the sidebar.\n // We use openProp and setOpenProp for control from outside the component.\n const [_open, _setOpen] = useState(defaultOpen);\n const open = openProp ?? _open;\n const setOpen = useCallback(\n (value: boolean | ((value: boolean) => boolean)) => {\n const openState = typeof value === 'function' ? value(open) : value;\n if (setOpenProp) {\n setOpenProp(openState);\n } else {\n _setOpen(openState);\n }\n },\n [setOpenProp, open]\n );\n\n // Helper to toggle the sidebar.\n const toggleSidebar = useCallback(() => {\n return isMobile ? setOpenMobile(open => !open) : setOpen(open => !open);\n }, [isMobile, setOpen, setOpenMobile]);\n\n // Adds a keyboard shortcut to toggle the sidebar.\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {\n event.preventDefault();\n toggleSidebar();\n }\n };\n\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [toggleSidebar]);\n\n // We add a state so that we can do data-state=\"expanded\" or \"collapsed\".\n // This makes it easier to style the sidebar with Tailwind classes.\n const state = open ? 'expanded' : 'collapsed';\n\n const contextValue = useMemo<SidebarContextProps>(\n () => ({\n state,\n open,\n setOpen,\n isMobile,\n openMobile,\n setOpenMobile,\n toggleSidebar,\n }),\n [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]\n );\n\n return (\n <SidebarContext.Provider value={contextValue}>\n <div\n className={classNames(\n 'group/sidebar-wrapper flex w-full has-[[data-variant=inset]]:bg-surface-primary',\n className\n )}\n {...props}\n >\n {children}\n </div>\n </SidebarContext.Provider>\n );\n}\n\n/**\n * The actual sidebar panel. On mobile it becomes a modal dialog.\n */\nexport function Sidebar({\n side = 'left',\n variant = 'sidebar',\n collapsible = 'icon',\n className,\n children,\n ...props\n}: React.ComponentProps<'div'> & {\n /** Where to dock the sidebar. Default: left */\n side?: 'left' | 'right';\n /** Style variant. Default: sidebar */\n variant?: 'sidebar' | 'floating';\n /** How it collapses. Default: offcanvas */\n collapsible?: 'offcanvas' | 'icon' | 'none';\n}) {\n const { isMobile, state, openMobile, setOpenMobile } = useSidebar();\n\n if (collapsible === 'none') {\n return (\n <div\n className={classNames(\n 'flex h-full w-(--sidebar-width) flex-col bg-surface-primary text-text-primary',\n className\n )}\n {...props}\n >\n {children}\n </div>\n );\n }\n\n if (isMobile) {\n return (\n <DialogTrigger isOpen={openMobile} onOpenChange={setOpenMobile} {...props}>\n <DialogOverlay>\n <DialogContent\n data-sidebar=\"sidebar\"\n data-mobile=\"true\"\n className=\"w-(--sidebar-width) max-h-svh overflow-auto p-0 [&>button]:hidden border-r! border-stroke-primary! bg-surface-primary!\"\n side=\"left\"\n closeButton={false}\n >\n {() => <div className=\"flex h-full w-full flex-col\">{children}</div>}\n </DialogContent>\n </DialogOverlay>\n </DialogTrigger>\n );\n }\n\n return (\n <div\n className=\"group peer hidden text-text-primary md:block\"\n data-state={state}\n data-collapsible={state === 'collapsed' ? collapsible : ''}\n data-variant={variant}\n data-side={side}\n >\n {/* This is what handles the sidebar gap on desktop */}\n <div\n className={classNames(\n 'relative w-(--sidebar-width) bg-surface-primary transition-[width] duration-200 ease-linear',\n 'group-data-[collapsible=offcanvas]:w-0',\n 'group-data-[side=right]:rotate-180',\n variant === 'floating'\n ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]'\n : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)'\n )}\n />\n <div\n className={classNames(\n 'absolute z-10 hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex',\n side === 'left'\n ? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'\n : 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',\n // Adjust the padding for floating variant.\n variant === 'floating'\n ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]'\n : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l',\n className\n )}\n {...props}\n >\n <div\n data-sidebar=\"sidebar\"\n className=\"flex h-full w-full flex-col bg-surface-primary group-data-[variant=floating]:border group-data-[variant=floating]:border-border\"\n >\n {children}\n </div>\n </div>\n </div>\n );\n}\n\n/**\n * Button that toggles the sidebar. Shows arrow icons.\n */\nexport function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>) {\n const { toggleSidebar, open, isMobile } = useSidebar();\n\n return (\n <Button\n data-sidebar=\"trigger\"\n variant=\"neutral\"\n size=\"icon-sm\"\n className={classNames(className, '!rounded-full p-icon')}\n onClick={event => {\n onClick?.(event);\n toggleSidebar();\n }}\n aria-label=\"trigger\"\n {...props}\n >\n {/* Use transition to rotate a single icon */}\n {isMobile ? <IcMenu /> : open ? <IcLeft /> : <IcRight />}\n </Button>\n );\n}\n\n/**\n * Scrollable container for sidebar content\n */\nexport function SidebarContent({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-sidebar=\"content\"\n className={classNames('flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden', className)}\n {...props}\n />\n );\n}\n\n/**\n * Groups related menu items together\n */\nexport function SidebarGroup({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-sidebar=\"group\"\n className={classNames(\n 'group/section relative flex w-full min-w-0 flex-col px-3 group-data-[collapsible=icon]:items-center',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n * Label for a group.\n */\nexport function SidebarGroupLabel({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-sidebar=\"group-label\"\n className={classNames(\n 'flex h-input shrink-0 items-center overflow-hidden px-2 text-xs select-none font-medium uppercase text-muted-foreground outline-none ring-ring transition-[height,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-icon [&>svg]:shrink-0',\n 'group-data-[collapsible=icon]:pointer-events-none group-data-[collapsible=icon]:!h-0 group-data-[collapsible=icon]:min-h-0 group-data-[collapsible=icon]:opacity-0',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n * Content wrapper for a group\n */\nexport function SidebarGroupContent({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-sidebar=\"group-content\" className={classNames('w-full body-sm', className)} {...props} />;\n}\n\n/**\n * Container for menu items\n */\nexport function SidebarMenu({ className, ...props }: React.ComponentProps<'ul'>) {\n return (\n <ul data-sidebar=\"menu\" className={classNames('flex w-full min-w-0 flex-col gap-px', className)} {...props} />\n );\n}\n\n/**\n * Single menu item wrapper\n */\nexport function SidebarMenuItem({ className, ...props }: React.ComponentProps<'li'>) {\n return (\n <li\n data-sidebar=\"menu-item\"\n className={classNames(\n 'group/menu-item relative list-none group-data-[collapsible=icon]:[&>*:not([data-sidebar=menu-button])]:hidden',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n * Extra action button that appears on the right side of menu items\n */\nexport function SidebarMenuAction({\n className,\n ...props\n}: React.ComponentProps<'button'> & {\n /** Only show on hover */\n showOnHover?: boolean;\n}) {\n return (\n <button\n data-sidebar=\"menu-action\"\n className={classNames(\n 'absolute top-0 right-0 btn btn-ghost h-input',\n 'group-data-[collapsible=icon]:hidden',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n * Shows a number badge on menu items. Auto-formats large numbers.\n */\nexport function SidebarMenuBadge({\n className,\n number,\n ...props\n}: Omit<React.ComponentProps<'div'>, 'children'> & {\n /** The count to display */\n number: number | bigint;\n}) {\n return (\n <div\n data-sidebar=\"menu-badge\"\n className={classNames(\n 'absolute pointer-events-none top-0 right-0 font-light h-input select-none flex items-center justify-center body-sm tabular-nums',\n 'group-data-[collapsible=icon]:hidden',\n className\n )}\n {...props}\n >\n {/* Format the number */}\n {new Intl.NumberFormat(navigator.language, { useGrouping: true }).format(number)}\n </div>\n );\n}\n\n/**\n * Nested submenu container\n */\nexport function SidebarMenuSub({ className, ...props }: React.ComponentProps<'ul'>) {\n return (\n <ul\n data-sidebar=\"menu-sub\"\n className={classNames('ms-2 flex min-w-0 flex-col', 'group-data-[collapsible=icon]:hidden', className)}\n {...props}\n />\n );\n}\n\n/**\n * Submenu item wrapper\n */\nexport function SidebarMenuSubItem({ className, ...props }: React.ComponentProps<'li'>) {\n return <li className={classNames('list-none ms-0', className)} {...props} />;\n}\n\nexport const sidebarMenuButtonClasses =\n 'btn-tab relative rounded-md border-0 justify-start w-full group-data-[collapsible=icon]:justify-center';\n\n// Common interaction logic for SidebarMenuButton and SidebarMenuSubButton\n/**\n * Main menu button. Pass isActive for current page.\n */\nexport function SidebarMenuButton({\n isActive = false,\n className,\n children,\n icon: Icon,\n leading,\n ...props\n}: Omit<React.ComponentProps<typeof Button>, 'children'> & {\n /** Mark as currently active page */\n icon?: CtxIcon;\n leading?: React.ReactNode;\n isActive?: boolean;\n children?: React.ReactNode;\n}) {\n const { isMobile, state } = useSidebar();\n const isCollapsed = !isMobile && state === 'collapsed';\n\n return (\n <TooltipTrigger isDisabled={!isCollapsed}>\n <Button\n size={isCollapsed ? 'icon' : undefined}\n data-sidebar=\"menu-button\"\n {...(isActive && { 'data-selected': true })}\n className={classNames(\n 'peer/menu-button group/active group-has-[[data-sidebar=menu-action]]/menu-item:pr-input',\n sidebarMenuButtonClasses,\n className\n )}\n {...props}\n >\n <span\n aria-hidden\n className=\"absolute inset-y-2 -left-1 w-[7px] rounded-full bg-primary opacity-0 group-data-[selected=true]/active:opacity-100\"\n />\n {leading !== undefined ? leading : Icon ? <Icon /> : null}\n {!isCollapsed && children}\n </Button>\n <Tooltip placement=\"right\">\n <span className=\"flex items-center gap-2\">{children}</span>\n </Tooltip>\n </TooltipTrigger>\n );\n}\n\n/**\n * Button for submenu items\n */\nexport function SidebarMenuSubButton({\n isActive,\n className,\n ...props\n}: React.ComponentProps<'button'> & {\n isActive?: boolean;\n}) {\n return (\n <button\n data-sidebar=\"menu-sub-button\"\n data-active={isActive}\n className={classNames(sidebarMenuButtonClasses, className)}\n {...props}\n />\n );\n}\n\n/**\n * Sticky header at the top of the sidebar. Displays a square logo slot aligned with the outlet header.\n */\nexport function SidebarHeader({\n className,\n logo,\n children,\n showTrigger = true,\n ...props\n}: React.ComponentProps<'div'> & {\n /** Square logo/icon to display */\n logo?: React.ReactNode;\n showTrigger?: boolean;\n}) {\n return (\n <div\n data-sidebar=\"header\"\n className={classNames(\n 'flex items-center h-header select-none shrink-0 border-b px-2 gap-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0',\n className\n )}\n {...props}\n >\n {logo && <div className=\"flex items-center justify-center size-input shrink-0\">{logo}</div>}\n {children && <div className=\"flex-1 min-w-0 group-data-[collapsible=icon]:hidden\">{children}</div>}\n {showTrigger && (\n <SidebarTrigger className={'hidden bg-surface-primary lg:flex lg:absolute lg:-right-4 lg:z-50'} />\n )}\n </div>\n );\n}\n\nexport function SidebarFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-sidebar=\"footer\"\n className={classNames(\n 'mt-auto flex shrink-0 select-none items-center gap-2 border-t py-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0',\n className\n )}\n {...props}\n />\n );\n}\n\n/**\n *\n * @example Basic usage\n * ```tsx\n * <SidebarOutlet>\n * <SidebarOutletHeader><SidebarTrigger/></SidebarOutletHeader>\n * <SidebarOutletContent><Outlet/></SidebarOutletContent>\n * </SidebarOutlet>\n * ```\n */\nexport function SidebarOutlet({ className, ...props }: React.ComponentProps<'div'>) {\n return <div className={classNames(className, 'flex flex-col flex-1 overflow-auto')} {...props} />;\n}\n\nexport function SidebarOutletContent({ className, ...props }: React.ComponentProps<'div'>) {\n return <div className={classNames(className, 'flex-1 overflow-auto')} {...props} />;\n}\n\nexport function SidebarOutletHeader({ className, ...props }: React.ComponentProps<'nav'>) {\n return (\n <nav\n className={classNames('flex items-center h-header bg-surface-primary p-2 border-b', className)}\n {...props}\n />\n );\n}\n"],"mappings":"ufASA,IAAM,EAA4B,IAYrB,EAAiB,EAA0C,IAAI,EAM5E,SAAgB,GAAa,CACzB,IAAM,EAAU,EAAI,CAAc,EAClC,GAAI,CAAC,EACD,MAAU,MAAM,mDAAmD,EAGvE,OAAO,CACX,CAcA,SAAgB,EAAgB,CAC5B,cAAc,GACd,KAAM,EACN,aAAc,EACd,YACA,QACA,WACA,GAAG,GAQJ,CACC,IAAM,EAAW,EAAY,EACvB,CAAC,EAAY,GAAiB,EAAS,EAAK,EAI5C,CAAC,EAAO,GAAY,EAAS,CAAW,EACxC,EAAO,GAAY,EACnB,EAAU,EACX,GAAmD,CAChD,IAAM,EAAY,OAAO,GAAU,WAAa,EAAM,CAAI,EAAI,EAC1D,EACA,EAAY,CAAS,EAErB,EAAS,CAAS,CAE1B,EACA,CAAC,EAAa,CAAI,CACtB,EAGM,EAAgB,MACX,EAAW,EAAc,GAAQ,CAAC,CAAI,EAAI,EAAQ,GAAQ,CAAC,CAAI,EACvE,CAAC,EAAU,EAAS,CAAa,CAAC,EAGrC,MAAgB,CACZ,IAAM,EAAiB,GAAyB,CACxC,EAAM,MAAQ,IAA8B,EAAM,SAAW,EAAM,WACnE,EAAM,eAAe,EACrB,EAAc,EAEtB,EAGA,OADA,OAAO,iBAAiB,UAAW,CAAa,MACnC,OAAO,oBAAoB,UAAW,CAAa,CACpE,EAAG,CAAC,CAAa,CAAC,EAIlB,IAAM,EAAQ,EAAO,WAAa,YAE5B,EAAe,OACV,CACH,QACA,OACA,UACA,WACA,aACA,gBACA,eACJ,GACA,CAAC,EAAO,EAAM,EAAS,EAAU,EAAY,EAAe,CAAa,CAC7E,EAEA,OACI,EAAC,EAAe,SAAhB,CAAyB,MAAO,EAC5B,SAAA,EAAC,MAAD,CACI,UAA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AQK,GAAQ,EAAC,MAAD,CAAK,UAAU,uDAAwD,SAAA,CAAU,CAAA,EACzF,GAAY,EAAC,MAAD,CAAK,UAAU,sDAAuD,UAAc,CAAA,EAChG,GACG,EAAC,EAAD,CAAgB,UAAW,mEAAsE,CAAA,CAEpG,GAEb,CAEA,SAAgB,EAAc,CAAE,YAAW,GAAG,GAAsC,CAChF,OACI,EAAC,MAAD,CACI,eAAa,SACb,UAAW,EACP,qJACA,CACJ,EACA,GAAI,CACP,CAAA,CAET,CAYA,SAAgB,EAAc,CAAE,YAAW,GAAG,GAAsC,CAChF,OAAO,EAAC,MAAD,CAAK,UAAW,EAAW,EAAW,oCAAoC,EAAG,GAAI,CAAQ,CAAA,CACpG,CAEA,SAAgB,EAAqB,CAAE,YAAW,GAAG,GAAsC,CACvF,OAAO,EAAC,MAAD,CAAK,UAAW,EAAW,EAAW,sBAAsB,EAAG,GAAI,CAAQ,CAAA,CACtF,CAEA,SAAgB,EAAoB,CAAE,YAAW,GAAG,GAAsC,CACtF,OACI,EAAC,MAAD,CACI,UAAW,EAAW,6DAA8D,CAAS,EAC7F,GAAI,CACP,CAAA,CAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function Skeleton({ className, ...props }: React.ComponentProps<'div'>): import("react
|
|
1
|
+
export declare function Skeleton({ className, ...props }: React.ComponentProps<'div'>): import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=skeleton.js.map
|
|
1
|
+
import{classNames as e}from"../utilities/theme.js";import{jsx as t}from"react/jsx-runtime";function n({className:n,...r}){return t(`div`,{className:e(`animate-pulse bg-primary/10`,n),...r})}export{n as Skeleton};
|
|
2
|
+
//# sourceMappingURL=skeleton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skeleton.js","sources":["../../lib/components/skeleton.tsx"],"sourcesContent":["import { classNames } from '../utilities/theme';\n\nexport function Skeleton({ className, ...props }: React.ComponentProps<'div'>) {\n return <div className={classNames('animate-pulse bg-primary/10', className)} {...props} />;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"skeleton.js","names":[],"sources":["../../lib/components/skeleton.tsx"],"sourcesContent":["import { classNames } from '../utilities/theme';\n\nexport function Skeleton({ className, ...props }: React.ComponentProps<'div'>) {\n return <div className={classNames('animate-pulse bg-primary/10', className)} {...props} />;\n}\n"],"mappings":"2FAEA,SAAgB,EAAS,CAAE,YAAW,GAAG,GAAsC,CAC3E,OAAO,EAAC,MAAD,CAAK,UAAW,EAAW,8BAA+B,CAAS,EAAG,GAAI,CAAQ,CAAA,CAC7F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function Steps({ ...props }: React.ComponentProps<'div'>): import("react
|
|
1
|
+
export declare function Steps({ ...props }: React.ComponentProps<'div'>): import("react").JSX.Element;
|